Files

86 lines
2.0 KiB
C++
Raw Permalink Normal View History

#pragma once
#include "Game/System/OSThreadWrapper.hpp"
#include "Game/Util.hpp"
2023-08-08 00:18:18 -04:00
class JKRExpHeap;
class JKRUnitHeap;
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
}
~FunctionAsyncExecInfo();
void execute();
2023-08-07 14:36:40 -04:00
inline bool isSame(const char *pStr) {
return MR::strcasecmp(_8, pStr) == 0;
}
2024-08-20 20:19:54 -04:00
MR::FunctorBase* mFunc; // 0x0
int mPriority; // 0x4
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
};
class FunctionAsyncExecutorThread : public OSThreadWrapper {
public:
FunctionAsyncExecutorThread(JKRHeap *);
virtual ~FunctionAsyncExecutorThread();
virtual s32 run();
2024-08-20 20:19:54 -04:00
bool mIsSuspended; // 0x3C
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;
};