Twilight Princess
Decompilation of The Legend of Zelda: Twilight Princess
Loading...
Searching...
No Matches
JHICommonMem.h
Go to the documentation of this file.
1#ifndef JHICOMMONMEM_H
2#define JHICOMMONMEM_H
3
4#include <dolphin/types.h>
5
6inline u32 JHIhtonl(u32 v) {
7#if __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__
8 return v;
9#else
10 // todo
11#endif
12}
13
14template <typename T>
15struct JHITag {
16 JHITag(u32 tag) {
17 m_tag = tag;
18 mp_data = NULL;
19 }
20
21 // NONMATCHING - stack stuff
22 const void* send(const void* param_0, s32 param_1) {
25
26 if (mp_data->sendBegin() >= param_1 + 8) {
27 mp_data->sendCont(&sp10, 8);
28 mp_data->sendCont(param_0, param_1);
29 mp_data->sendEnd();
30 }
31
32 return param_0;
33 }
34
35 virtual ~JHITag() {}
36 virtual void receive(const char*, s32);
37
38 /* 0x4 */ u32 m_tag;
39 /* 0x8 */ T* mp_data;
40};
41
42class JHIMemBuf;
43
45public:
46 virtual ~JHICommonMem() {}
47 virtual int create() = 0;
48 virtual int open() = 0;
49 virtual void close() = 0;
50 virtual u8* getPointer() const = 0;
51 virtual void readIO(u32 position, u32* out_data) const = 0;
52 virtual u32 readIO(u32 position) const = 0;
53 virtual void writeIO(u32 position, u32 data) const = 0;
54 virtual void writeIO(u32 position, u8* src_data, u32 length) const = 0;
55
56 static JHIMemBuf* Instance();
58};
59
60class JHIMemBuf : public JHICommonMem {
61public:
62 JHIMemBuf();
63
64 virtual ~JHIMemBuf();
65 virtual int create();
66 virtual int open();
67 virtual void close();
68 virtual u8* getPointer() const;
69 virtual void readIO(u32 position, u32* out_data) const;
70 virtual u32 readIO(u32 position) const;
71 virtual void writeIO(u32 position, u32 data) const;
72 virtual void writeIO(u32 position, u8* src_data, u32 length) const;
73
74 /* 0x4 */ u8* mp_buffer;
75};
76
77#endif /* JHICOMMONMEM_H */
u32 JHIhtonl(u32 v)
Definition JHICommonMem.h:6
T cLib_calcTimer(T *value)
Definition c_lib.h:79
Definition JHICommonMem.h:44
virtual void close()=0
static JHIMemBuf * Instance()
Definition JHICommonMem.cpp:5
virtual ~JHICommonMem()
Definition JHICommonMem.h:46
virtual u32 readIO(u32 position) const =0
virtual void writeIO(u32 position, u32 data) const =0
virtual u8 * getPointer() const =0
virtual void readIO(u32 position, u32 *out_data) const =0
virtual void writeIO(u32 position, u8 *src_data, u32 length) const =0
static JHIMemBuf * instance
Definition JHICommonMem.h:57
virtual int open()=0
virtual int create()=0
Definition JHICommonMem.h:60
u8 * mp_buffer
Definition JHICommonMem.h:74
virtual int create()
Definition JHIMemBuf.cpp:5
virtual u8 * getPointer() const
Definition JHIMemBuf.cpp:35
virtual void writeIO(u32 position, u32 data) const
Definition JHIMemBuf.cpp:62
virtual void readIO(u32 position, u32 *out_data) const
Definition JHIMemBuf.cpp:45
virtual void close()
Definition JHIMemBuf.cpp:25
JHIMemBuf()
Definition JHICommonMem.cpp:13
virtual ~JHIMemBuf()
Definition JHIMemBuf.cpp:31
virtual int open()
Definition JHIMemBuf.cpp:21
double v
Definition e_pow.c:163
static const double T[]
Definition k_tan.c:106
Definition JHICommonMem.h:15
JHITag(u32 tag)
Definition JHICommonMem.h:16
u32 m_tag
Definition JHICommonMem.h:38
const void * send(const void *param_0, s32 param_1)
Definition JHICommonMem.h:22
virtual void receive(const char *, s32)
T * mp_data
Definition JHICommonMem.h:39
virtual ~JHITag()
Definition JHICommonMem.h:35
unsigned long u32
Definition types.h:10
signed long s32
Definition types.h:6
unsigned char u8
Definition types.h:8