summaryrefslogtreecommitdiff
path: root/include/nw4r/snd/snd_PlayerHeap.h
blob: ae67e8b2759b4c122ca4bed58d8dcdcb78c754dc (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
#ifndef NW4R_SND_PLAYER_HEAP_H
#define NW4R_SND_PLAYER_HEAP_H

/*******************************************************************************
 * headers
 */

#include "common.h" // u32

#include "nw4r/snd/snd_SoundMemoryAllocatable.h"

#include "nw4r/ut/ut_LinkList.h"

/*******************************************************************************
 * types
 */

// forward declarations
namespace nw4r { namespace snd { namespace detail { class BasicSound; }}}
namespace nw4r { namespace snd { class SoundPlayer; }}

/*******************************************************************************
 * classes and functions
 */

namespace nw4r { namespace snd { namespace detail
{
	// [R89JEL]:/bin/RVL/Debug/mainD.elf:.debug::0x26e9c
	class PlayerHeap : public SoundMemoryAllocatable
	{
	// typedefs
	public:
		typedef ut::LinkList<PlayerHeap, 0x18> LinkList;

	// methods
	public:
		// cdtors
		PlayerHeap();
		virtual ~PlayerHeap();

		// virtual function ordering
		// vtable SoundMemoryAllocatable
		virtual void *Alloc(u32 size);

		// methods
		bool Create(void *startAddress, u32 size);
		void Clear();
		void Destroy();

		u32 GetFreeSize() const;

		void AttachSound(BasicSound *sound);
		void DetachSound(BasicSound *sound);

		void AttachSoundPlayer(SoundPlayer *player) { mPlayer = player; }

	// members
	private:
		/* base SoundMemoryAllocatable */	// size 0x04, offset 0x00
		BasicSound			*mSound;		// size 0x04, offset 0x04
		SoundPlayer			*mPlayer;		// size 0x04, offset 0x08
		void				*mStartAddress;	// size 0x04, offset 0x0c
		void				*mEndAddress;	// size 0x04, offset 0x10
		void				*mAllocAddress;	// size 0x04, offset 0x14
	public:
		ut::LinkListNode	mLink;			// size 0x08, offset 0x18
	}; // size 0x20
}}} // namespace nw4r::snd::detail

#endif // NW4R_SND_PLAYER_HEAP_H