Twilight Princess
Decompilation of The Legend of Zelda: Twilight Princess
Loading...
Searching...
No Matches
JKRThread.h
Go to the documentation of this file.
1#ifndef JKRTHREAD_H
2#define JKRTHREAD_H
3
6#include "dolphin/os/OSTime.h"
7
14 char* name;
15};
16
17class JUTConsole;
18
24public:
25 class TLoad {
26 public:
28 clear();
29 mValid = false;
30 mThreadId = 0;
31 }
32
33 bool isValid() const { return mValid; }
34 u32 getCost() const { return mCost; }
35 u32 getCount() const { return mSwitchCount; }
36 s32 getId() const { return mThreadId; }
37
38 void setValid(bool valid) { mValid = valid; }
39 void setId(s32 id) { mThreadId = id; }
41
42 void resetCost() { mCost = 0; }
43 void resetCount() { mSwitchCount = 0; }
44
45 void incCount() { mSwitchCount++; }
47
48 void clear() {
49 resetCount();
50 resetCost();
51 mLastTick = 0;
52 }
53
54 private:
55 /* 0x00 */ bool mValid;
56 /* 0x01 */ u8 padding_0x61[3];
57 /* 0x04 */ u32 mCost;
58 /* 0x08 */ u32 mSwitchCount;
59 /* 0x0C */ OSTick mLastTick;
60 /* 0x10 */ s32 mThreadId;
61 };
62
63 JKRThread(u32 stack_size, int message_count, int param_3);
64 JKRThread(JKRHeap* heap, u32 stack_size, int message_count, int param_4);
65 JKRThread(OSThread* thread, int message_count);
66 virtual ~JKRThread();
67
68 /* vt[03] */ virtual void* run();
69
71 void setCommon_heapSpecified(JKRHeap* heap, u32 stack_size, int param_3);
72
74 void* getStack() const { return mStackMemory; }
75 TLoad* getLoadInfo() { return &mLoadInfo; }
76 JKRHeap* getCurrentHeap() const { return mCurrentHeap; }
78
79 void setCurrentHeap(JKRHeap* heap) {
80 mCurrentHeap = heap ? heap : JKRHeap::getCurrentHeap();
81 }
82
83protected:
96
113
114private:
115 /* 0x00 */ // vtable
116 /* 0x04 */ // JKRDisposer
118 /* 0x28 */ JKRHeap* mHeap;
121 /* 0x50 */ OSMessage* mMessages;
122 /* 0x54 */ s32 mMessageCount;
123 /* 0x58 */ void* mStackMemory;
124 /* 0x5C */ u32 mStackSize;
125 /* 0x60 */ TLoad mLoadInfo;
128
129public:
130 static void* start(void* param_1);
131 static JKRThread* searchThread(OSThread* thread);
133
135 // static u8 sThreadList[12];
136};
137
140
146public:
149 virtual void draw(JKRThreadName_* param_1);
150 virtual ~JKRThreadSwitch();
151
153
155 static void callback(OSThread* param_1, OSThread* param_2);
156
157 static JKRThreadSwitch* getManager() { return sManager; }
158 static u32 getTotalCount() { return sTotalCount; }
159
160private:
166
167private:
168 /* 0x00 */ // vtable
169 /* 0x04 */ JKRHeap* mHeap;
170 /* 0x08 */ bool mSetNextHeap;
171 /* 0x09 */ u8 field_0x9[3];
172 /* 0x0C */ u32 field_0xC;
173 /* 0x10 */ u32 field_0x10;
174 /* 0x14 */ u8 field_0x14[4];
175 /* 0x18 */ s64 field_0x18;
176 /* 0x20 */ u32 field_0x20;
177 /* 0x24 */ u32 field_0x24;
178};
179
180struct JKRTask {
182 static u8 sEndMesgQueue[32];
183};
184
185#endif /* JKRTHREAD_H */
static unsigned long int next
Definition CARDUnlock.c:76
void(* JKRThreadSwitch_PreCallback)(OSThread *current, OSThread *next)
Definition JKRThread.h:138
void(* JKRThreadSwitch_PostCallback)(OSThread *current, OSThread *next)
Definition JKRThread.h:139
BOOL OSReceiveMessage(OSMessageQueue *mq, OSMessage *msg, s32 flags)
Definition OSMessage.c:40
BOOL OSJamMessage(OSMessageQueue *queue, void *msg, s32 flags)
Definition OSMessage.c:67
BOOL OSSendMessage(OSMessageQueue *mq, OSMessage msg, s32 flags)
Definition OSMessage.c:14
void * OSMessage
Definition OSMessage.h:10
s32 OSResumeThread(OSThread *thread)
Definition OSThread.c:565
asm OSTick OSGetTick(void)
Definition OSTime.c:25
u32 OSTick
Definition OSTime.h:11
T cLib_calcTimer(T *value)
Definition c_lib.h:74
Definition JKRDisposer.h:12
Definition JKRHeap.h:16
static JKRHeap * getCurrentHeap()
Definition JKRHeap.h:154
Definition JKRThread.h:145
JKRThread * enter(JKRThread *param_1, int param_2)
Definition JKRThread.cpp:152
u8 field_0x9[3]
Definition JKRThread.h:171
s64 field_0x18
Definition JKRThread.h:175
u32 field_0xC
Definition JKRThread.h:172
static JKRThreadSwitch * sManager
Definition JKRThread.h:161
virtual ~JKRThreadSwitch()
Definition JKRThread.cpp:315
static JKRThreadSwitch_PostCallback mUserPostCallback
Definition JKRThread.h:165
u32 field_0x20
Definition JKRThread.h:176
bool mSetNextHeap
Definition JKRThread.h:170
virtual void draw(JKRThreadName_ *param_1, JUTConsole *param_2)
Definition JKRThread.cpp:247
u32 field_0x10
Definition JKRThread.h:173
static u32 sTotalStart
Definition JKRThread.h:163
u8 field_0x14[4]
Definition JKRThread.h:174
u32 field_0x24
Definition JKRThread.h:177
static void callback(OSThread *param_1, OSThread *param_2)
Definition JKRThread.cpp:177
static JKRThreadSwitch * createManager(JKRHeap *heap)
Definition JKRThread.cpp:140
static JKRThreadSwitch * getManager()
Definition JKRThread.h:157
static u32 getTotalCount()
Definition JKRThread.h:158
JKRHeap * mHeap
Definition JKRThread.h:169
static u32 sTotalCount
Definition JKRThread.h:162
static JKRThreadSwitch_PreCallback mUserPreCallback
Definition JKRThread.h:164
Definition JKRThread.h:25
s32 mThreadId
Definition JKRThread.h:60
void resetCount()
Definition JKRThread.h:43
bool isValid() const
Definition JKRThread.h:33
OSTick mLastTick
Definition JKRThread.h:59
void setId(s32 id)
Definition JKRThread.h:39
u32 getCount() const
Definition JKRThread.h:35
u32 getCost() const
Definition JKRThread.h:34
TLoad()
Definition JKRThread.h:27
void setCurrentTime()
Definition JKRThread.h:40
u32 mSwitchCount
Definition JKRThread.h:58
u8 padding_0x61[3]
Definition JKRThread.h:56
void resetCost()
Definition JKRThread.h:42
void incCount()
Definition JKRThread.h:45
u32 mCost
Definition JKRThread.h:57
void clear()
Definition JKRThread.h:48
void addCurrentCost()
Definition JKRThread.h:46
s32 getId() const
Definition JKRThread.h:36
void setValid(bool valid)
Definition JKRThread.h:38
bool mValid
Definition JKRThread.h:55
Definition JKRThread.h:23
void * mStackMemory
Definition JKRThread.h:123
virtual void * run()
Definition JKRThread.cpp:305
static JSUList< JKRThread > & getList()
Definition JKRThread.h:132
s32 mCurrentHeapError
Definition JKRThread.h:127
OSMessage * mMessages
Definition JKRThread.h:121
TLoad * getLoadInfo()
Definition JKRThread.h:75
static JKRThread * searchThread(OSThread *thread)
Definition JKRThread.cpp:110
OSMessage waitMessageBlock()
Definition JKRThread.h:105
void * getStack() const
Definition JKRThread.h:74
s32 mMessageCount
Definition JKRThread.h:122
JSULink< JKRThread > mThreadListLink
Definition JKRThread.h:117
void sendMessageBlock(OSMessage message)
Definition JKRThread.h:88
void jamMessageBlock(OSMessage message)
Definition JKRThread.h:110
BOOL sendMessage(OSMessage message)
Definition JKRThread.h:85
OSThread * getThreadRecord() const
Definition JKRThread.h:73
JKRHeap * mHeap
Definition JKRThread.h:118
static JSUList< JKRThread > sThreadList
Definition JKRThread.h:134
void setCommon_heapSpecified(JKRHeap *heap, u32 stack_size, int param_3)
Definition JKRThread.cpp:92
JKRHeap * mCurrentHeap
Definition JKRThread.h:126
TLoad mLoadInfo
Definition JKRThread.h:125
u32 mStackSize
Definition JKRThread.h:124
OSMessage waitMessage()
Definition JKRThread.h:91
void setCurrentHeap(JKRHeap *heap)
Definition JKRThread.h:79
virtual ~JKRThread()
Definition JKRThread.cpp:62
OSMessage waitMessage(BOOL *received)
Definition JKRThread.h:97
void setCommon_mesgQueue(JKRHeap *heap, int message_count)
Definition JKRThread.cpp:79
s32 getCurrentHeapError() const
Definition JKRThread.h:77
OSMessageQueue mMessageQueue
Definition JKRThread.h:120
void resume()
Definition JKRThread.h:84
JKRHeap * getCurrentHeap() const
Definition JKRThread.h:76
OSThread * mThreadRecord
Definition JKRThread.h:119
Definition JSUList.h:96
Definition JUTConsole.h:13
static SECTION_RODATA u8 const id[8]
Definition d_a_npc_bans.cpp:1309
@ start
Definition strtoul.c:8
Definition JKRThread.h:180
static JSUList< JKRTask > sTaskList
Definition JKRThread.h:181
static u8 sEndMesgQueue[32]
Definition JKRThread.h:182
Definition JKRThread.h:12
s32 id
Definition JKRThread.h:13
char * name
Definition JKRThread.h:14
Definition OSMessage.h:12
Definition OSThread.h:56
int BOOL
Definition types.h:27
unsigned long u32
Definition types.h:10
signed long long s64
Definition types.h:7
signed long s32
Definition types.h:6
unsigned char u8
Definition types.h:8
static u32 message
Definition vi.c:838