Twilight Princess
Decompilation of The Legend of Zelda: Twilight Princess
Loading...
Searching...
No Matches
JOREntry.h
Go to the documentation of this file.
1
#ifndef JORENTRY_H
2
#define JORENTRY_H
3
4
#include "
JSystem/JHostIO/JHIComm.h
"
5
#include <
dolphin/os.h
>
6
7
template
<
typename
T,
int
I>
8
class
JHIpvector
{
9
public
:
10
JHIpvector
() {
m_size
= 0; }
11
12
s32
size
()
const
{
return
m_size
; }
13
T
get
(
u32
i
)
const
{
return
m_vector
[
i
]; }
14
15
s32
push_back
(T
p
) {
16
if
(
m_size
>= I) {
17
return
0;
18
}
19
20
m_vector
[
m_size
++] =
p
;
21
return
1;
22
}
23
24
/* 0x00 */
T
m_vector
[I];
25
/* 0x28 */
s32
m_size
;
26
};
27
28
template
<
typename
T>
29
class
JHIComPortManager
{
30
public
:
31
JHIComPortManager
() {
32
field_0x10040
= 0;
33
field_0x10041
= 0;
34
}
35
36
T&
getRefPort
() {
return
port
; }
37
38
void
addTag
(
JHITag<T>
* pTag) {
39
pTag->
mp_data
=
this
;
40
field_0xc
.
push_back
(pTag);
41
}
42
43
JHITag<T>
*
find
(
u32
param_1) {
44
for
(
u32
i
= 0;
i
<
field_0xc
.
size
();
i
++) {
45
JHITag<T>
* tag =
field_0xc
.
get
(
i
);
46
if
(tag->
m_tag
== param_1) {
47
return
tag;
48
}
49
}
50
return
NULL;
51
}
52
53
void
dispatchMessage
() {
54
u32
r29 =
port
.available();
55
while
(
true
) {
56
if
(!
field_0x10040
) {
57
if
(r29 < 8) {
58
return
;
59
}
60
port
.receive(&
field_0x10038
, 8);
61
r29 -= 8;
62
field_0x10038
=
JHIntohl
(
field_0x10038
);
63
field_0x1003c
=
JHIntohl
(
field_0x1003c
);
64
field_0x10040
= 1;
65
JHITag<T>
* r27 =
find
(
field_0x10038
);
66
if
(
field_0x1003c
>
port
.getMaxReaderableSize()) {
67
port
.initBuffers();
68
OSReport
(
"JHostIO::ERROR: JHIComportManager: invalid datasize ( port.initialized )\n"
);
69
}
else
if
(!r27) {
70
OSReport
(
"JHostIO::ERROR: JHIComportManager: invalid tag message\n"
);
71
}
72
}
73
if
(!
field_0x10040
) {
74
continue
;
75
}
76
77
if
(r29 <
field_0x1003c
) {
78
return
;
79
}
80
u32
r26 =
port
.receive(
field_0x38
,
field_0x1003c
);
81
r29 -= r26;
82
JHITag<T>
* r28 =
find
(
field_0x10038
);
83
field_0x10040
= 0;
84
if
(r28) {
85
r28->
receive
(
field_0x38
,
field_0x1003c
);
86
}
87
}
88
}
89
90
static
JHIComPortManager<T>
*
create
() {
91
if
(
instance
== NULL) {
92
instance
=
new
JHIComPortManager<T>
();
93
}
94
95
return
instance
;
96
}
97
98
static
JHIComPortManager<T>
*
getInstance
() {
return
instance
; }
99
100
static
JHIComPortManager<T>
*
instance
;
101
102
/* 0x00000 */
T
port
;
103
/* 0x0000C */
JHIpvector<JHITag<T>
*, 10>
field_0xc
;
104
/* 0x00038 */
char
field_0x38
[0x10000];
105
/* 0x10038 */
u32
field_0x10038
;
106
/* 0x1003C */
u32
field_0x1003c
;
107
/* 0x10040 */
u8
field_0x10040
;
108
/* 0x10041 */
u8
field_0x10041
;
109
};
110
111
void
JORInit
();
112
113
#endif
/* JORENTRY_H */
JHIComm.h
JHIntohl
u32 JHIntohl(u32 v)
Definition
JHICommonMem.h:14
JORInit
void JORInit()
Definition
JOREntry.cpp:7
JHIComPortManager
Definition
JOREntry.h:29
JHIComPortManager::dispatchMessage
void dispatchMessage()
Definition
JOREntry.h:53
JHIComPortManager::getInstance
static JHIComPortManager< T > * getInstance()
Definition
JOREntry.h:98
JHIComPortManager::field_0x10038
u32 field_0x10038
Definition
JOREntry.h:105
JHIComPortManager::find
JHITag< T > * find(u32 param_1)
Definition
JOREntry.h:43
JHIComPortManager::field_0xc
JHIpvector< JHITag< T > *, 10 > field_0xc
Definition
JOREntry.h:103
JHIComPortManager::JHIComPortManager
JHIComPortManager()
Definition
JOREntry.h:31
JHIComPortManager::create
static JHIComPortManager< T > * create()
Definition
JOREntry.h:90
JHIComPortManager::getRefPort
T & getRefPort()
Definition
JOREntry.h:36
JHIComPortManager::field_0x38
char field_0x38[0x10000]
Definition
JOREntry.h:104
JHIComPortManager::field_0x10040
u8 field_0x10040
Definition
JOREntry.h:107
JHIComPortManager::addTag
void addTag(JHITag< T > *pTag)
Definition
JOREntry.h:38
JHIComPortManager::port
T port
Definition
JOREntry.h:102
JHIComPortManager::field_0x1003c
u32 field_0x1003c
Definition
JOREntry.h:106
JHIComPortManager::field_0x10041
u8 field_0x10041
Definition
JOREntry.h:108
JHIComPortManager::instance
static JHIComPortManager< T > * instance
Definition
JOREntry.h:100
JHIpvector
Definition
JOREntry.h:8
JHIpvector::push_back
s32 push_back(T p)
Definition
JOREntry.h:15
JHIpvector::size
s32 size() const
Definition
JOREntry.h:12
JHIpvector::get
T get(u32 i) const
Definition
JOREntry.h:13
JHIpvector::m_vector
T m_vector[I]
Definition
JOREntry.h:24
JHIpvector::JHIpvector
JHIpvector()
Definition
JOREntry.h:10
JHIpvector::m_size
s32 m_size
Definition
JOREntry.h:25
OSReport
void OSReport(const char *msg,...)
Definition
OSError.c:12
os.h
p
p
Definition
e_acos.c:103
i
int i
Definition
e_log.c:92
u32
unsigned long u32
Definition
types.h:12
s32
signed long s32
Definition
types.h:11
u8
unsigned char u8
Definition
types.h:8
JHITag
Definition
JHICommonMem.h:21
JHITag::m_tag
u32 m_tag
Definition
JHICommonMem.h:44
JHITag::receive
virtual void receive(const char *, s32)
Definition
JHICommonMem.h:42
JHITag::mp_data
JHIComPortManager< T > * mp_data
Definition
JHICommonMem.h:45
include
JSystem
JHostIO
JOREntry.h
Generated by
1.12.0