2021-12-06 10:25:59 -05:00
|
|
|
#pragma once
|
|
|
|
|
|
2023-12-13 00:40:16 -05:00
|
|
|
#include "Game/System/OSThreadWrapper.hpp"
|
|
|
|
|
#include "Game/Util.hpp"
|
2023-08-08 00:18:18 -04:00
|
|
|
|
|
|
|
|
class JKRExpHeap;
|
|
|
|
|
class JKRUnitHeap;
|
2021-12-06 10:25:59 -05:00
|
|
|
|
|
|
|
|
class FunctionAsyncExecInfo {
|
|
|
|
|
public:
|
|
|
|
|
FunctionAsyncExecInfo(MR::FunctorBase *, int, const char *);
|
2023-08-04 14:31:07 -04:00
|
|
|
|
|
|
|
|
FunctionAsyncExecInfo() {
|
2023-08-07 14:36:40 -04:00
|
|
|
|
2023-08-04 14:31:07 -04:00
|
|
|
}
|
|
|
|
|
|
2021-12-06 10:25:59 -05:00
|
|
|
~FunctionAsyncExecInfo();
|
|
|
|
|
|
|
|
|
|
void execute();
|
2023-08-07 14:36:40 -04:00
|
|
|
|
|
|
|
|
inline bool isSame(const char *pStr) {
|
|
|
|
|
return MR::strcasecmp(_8, pStr) == 0;
|
|
|
|
|
}
|
2021-12-06 10:25:59 -05:00
|
|
|
|
2024-08-20 20:19:54 -04:00
|
|
|
MR::FunctorBase* mFunc; // 0x0
|
|
|
|
|
int mPriority; // 0x4
|
2021-12-06 10:25:59 -05:00
|
|
|
const char* _8;
|
2023-08-07 14:36:40 -04:00
|
|
|
bool _C;
|
2024-08-20 20:19:54 -04:00
|
|
|
OSMessageQueue mQueue; // 0x10
|
|
|
|
|
OSMessage mMessage; // 0x30
|
2021-12-06 10:25:59 -05:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
class FunctionAsyncExecutorThread : public OSThreadWrapper {
|
|
|
|
|
public:
|
|
|
|
|
FunctionAsyncExecutorThread(JKRHeap *);
|
|
|
|
|
|
|
|
|
|
virtual ~FunctionAsyncExecutorThread();
|
|
|
|
|
virtual s32 run();
|
|
|
|
|
|
2024-08-20 20:19:54 -04:00
|
|
|
bool mIsSuspended; // 0x3C
|
2021-12-06 10:25:59 -05:00
|
|
|
const char* _40;
|
2023-01-30 14:27:56 -05:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
class FunctionAsyncExecutorOnMainThread {
|
|
|
|
|
public:
|
|
|
|
|
FunctionAsyncExecutorOnMainThread(OSThread *);
|
|
|
|
|
|
2023-08-04 14:31:07 -04:00
|
|
|
void update();
|
|
|
|
|
|
2023-01-30 14:27:56 -05:00
|
|
|
u8 _0;
|
|
|
|
|
u8 _1;
|
|
|
|
|
u8 _2;
|
|
|
|
|
u8 _3;
|
2024-08-20 20:19:54 -04:00
|
|
|
OSMessageQueue mQueue; // 0x4
|
|
|
|
|
OSMessage mMsgArray[0x40]; // 0x24
|
|
|
|
|
OSThread* mThread; // 0x124
|
2023-08-07 14:36:40 -04:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
class FunctionAsyncExecutor {
|
|
|
|
|
public:
|
|
|
|
|
FunctionAsyncExecutor();
|
|
|
|
|
|
|
|
|
|
void update();
|
|
|
|
|
void start(const MR::FunctorBase &, int, const char *);
|
|
|
|
|
bool startOnMainThread(const MR::FunctorBase &, const char *);
|
|
|
|
|
void waitForEnd(const char *);
|
|
|
|
|
bool isEnd(const char *) const;
|
|
|
|
|
OSThread* getOSThread(const char *);
|
|
|
|
|
FunctionAsyncExecInfo* createAndAddExecInfo(const MR::FunctorBase &, int, const char *);
|
|
|
|
|
FunctionAsyncExecutorThread* getSuspendThread();
|
|
|
|
|
|
|
|
|
|
inline FunctionAsyncExecInfo* const* first() const {
|
|
|
|
|
return &mHolders[0];
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
inline FunctionAsyncExecInfo* const* last() const {
|
|
|
|
|
return &mHolders[_40C];
|
|
|
|
|
}
|
|
|
|
|
|
2024-08-20 20:19:54 -04:00
|
|
|
FunctionAsyncExecutorThread* mThreads[2]; // 0x0
|
|
|
|
|
FunctionAsyncExecutorOnMainThread* mMainThreadExec; // 0x8
|
2023-08-07 14:36:40 -04:00
|
|
|
FunctionAsyncExecInfo* mHolders[0x100];
|
|
|
|
|
u32 _40C;
|
|
|
|
|
JKRUnitHeap* _410;
|
|
|
|
|
JKRExpHeap* _414;
|
2021-12-06 10:25:59 -05:00
|
|
|
};
|