| 1 | #include "Project/File/FileLoaderThread.h" |
| 2 | |
| 3 | #include <thread/seadDelegateThread.h> |
| 4 | #include <thread/seadMessageQueue.h> |
| 5 | |
| 6 | #include "Project/FileEntryBase.h" |
| 7 | |
| 8 | namespace al { |
| 9 | |
| 10 | FileLoaderThread::FileLoaderThread(s32 priority) { |
| 11 | mThread = new sead::DelegateThread("FileLoadThread" , |
| 12 | new sead::Delegate2<FileLoaderThread, sead::Thread*, s64>( |
| 13 | this, &FileLoaderThread::threadFunction), |
| 14 | nullptr, priority, sead::MessageQueue::BlockType::Blocking, |
| 15 | 0x7fffffff, 0x4000, 0x800); |
| 16 | mThread->start(); |
| 17 | } |
| 18 | |
| 19 | void FileLoaderThread::threadFunction(sead::Thread* thread, s64 fileEntryPtr) { |
| 20 | FileEntryBase* fileEntry = (FileEntryBase*)fileEntryPtr; |
| 21 | fileEntry->load(); |
| 22 | } |
| 23 | |
| 24 | void FileLoaderThread::requestLoadFile(FileEntryBase* fileEntry) { |
| 25 | mThread->sendMessage(msg: (s64)fileEntry, block_type: sead::MessageQueue::BlockType::NonBlocking); |
| 26 | } |
| 27 | |
| 28 | } // namespace al |
| 29 | |