mirror of
https://github.com/SMGCommunity/Petari.git
synced 2024-11-24 05:59:43 +00:00
FileLoaderThread 100%
This commit is contained in:
parent
6edaf2cbc9
commit
068279e83d
@ -163,12 +163,12 @@ removeFile__10FileLoaderFPCc,FileLoader.o,System.a,false
|
||||
isNeedToLoad__10FileLoaderCFPCc,FileLoader.o,System.a,false
|
||||
getRequestFileInfoConst__10FileLoaderCFPCc,FileLoader.o,System.a,false
|
||||
addRequest__10FileLoaderFPCc,FileLoader.o,System.a,false
|
||||
loadFileUsingRipper__30@unnamed@FileLoaderThread_cpp@FP15RequestFileInfo,FileLoaderThread.o,System.a,false
|
||||
__ct__16FileLoaderThreadFiiP7JKRHeap,FileLoaderThread.o,System.a,false
|
||||
run__16FileLoaderThreadFv,FileLoaderThread.o,System.a,false
|
||||
loadToMainRAM__16FileLoaderThreadFP15RequestFileInfo,FileLoaderThread.o,System.a,false
|
||||
mountArchiveAndStartCreateResource__16FileLoaderThreadFP15RequestFileInfo,FileLoaderThread.o,System.a,false
|
||||
__dt__16FileLoaderThreadFv,FileLoaderThread.o,System.a,false
|
||||
loadFileUsingRipper__30@unnamed@FileLoaderThread_cpp@FP15RequestFileInfo,FileLoaderThread.o,System.a,true
|
||||
__ct__16FileLoaderThreadFiiP7JKRHeap,FileLoaderThread.o,System.a,true
|
||||
run__16FileLoaderThreadFv,FileLoaderThread.o,System.a,true
|
||||
loadToMainRAM__16FileLoaderThreadFP15RequestFileInfo,FileLoaderThread.o,System.a,true
|
||||
mountArchiveAndStartCreateResource__16FileLoaderThreadFP15RequestFileInfo,FileLoaderThread.o,System.a,true
|
||||
__dt__16FileLoaderThreadFv,FileLoaderThread.o,System.a,true
|
||||
setup__10FileRipperFUlP7JKRHeap,FileRipper.o,System.a,false
|
||||
checkCompressed__10FileRipperFPCUc,FileRipper.o,System.a,false
|
||||
loadToMainRAM__10FileRipperFPCcPUcbP7JKRHeapQ210FileRipper14AllocDirection,FileRipper.o,System.a,false
|
||||
|
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"schemaVersion": 1,
|
||||
"label": "Game",
|
||||
"message": "10.35176908770153%",
|
||||
"message": "10.364691569085979%",
|
||||
"color": "blue"
|
||||
}
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"schemaVersion": 1,
|
||||
"label": "System",
|
||||
"message": "8.964%",
|
||||
"message": "9.293%",
|
||||
"color": "696969"
|
||||
}
|
@ -22,5 +22,5 @@
|
||||
| [Scene](https://github.com/shibbo/Petari/blob/master/docs/lib/Scene.md) | 10.954951600893521% |
|
||||
| [Screen](https://github.com/shibbo/Petari/blob/master/docs/lib/Screen.md) | 3.9020947950289457% |
|
||||
| [Speaker](https://github.com/shibbo/Petari/blob/master/docs/lib/Speaker.md) | 49.743881616391576% |
|
||||
| [System](https://github.com/shibbo/Petari/blob/master/docs/lib/System.md) | 8.964240475494496% |
|
||||
| [System](https://github.com/shibbo/Petari/blob/master/docs/lib/System.md) | 9.293091688590081% |
|
||||
| [Util](https://github.com/shibbo/Petari/blob/master/docs/lib/Util.md) | 9.661178747499052% |
|
||||
|
@ -20,7 +20,7 @@
|
||||
| [DrawSyncManager.o](https://github.com/shibbo/Petari/blob/master/docs/lib/System/DrawSyncManager.md) | 36.7816091954023% | 10 / 17 | 58.82352941176471% | :eight_pointed_black_star:
|
||||
| [FileHolder.o](https://github.com/shibbo/Petari/blob/master/docs/lib/System/FileHolder.md) | 76.36986301369863% | 10 / 12 | 83.33333333333334% | :eight_pointed_black_star:
|
||||
| [FileLoader.o](https://github.com/shibbo/Petari/blob/master/docs/lib/System/FileLoader.md) | 0.0% | 0 / 16 | 0.0% | :x:
|
||||
| [FileLoaderThread.o](https://github.com/shibbo/Petari/blob/master/docs/lib/System/FileLoaderThread.md) | 0.0% | 0 / 6 | 0.0% | :x:
|
||||
| [FileLoaderThread.o](https://github.com/shibbo/Petari/blob/master/docs/lib/System/FileLoaderThread.md) | 100.0% | 6 / 6 | 100.0% | :white_check_mark:
|
||||
| [FileRipper.o](https://github.com/shibbo/Petari/blob/master/docs/lib/System/FileRipper.md) | 0.0% | 0 / 7 | 0.0% | :x:
|
||||
| [FunctionAsyncExecutor.o](https://github.com/shibbo/Petari/blob/master/docs/lib/System/FunctionAsyncExecutor.md) | 24.47817836812144% | 5 / 17 | 29.411764705882355% | :eight_pointed_black_star:
|
||||
| [GameSystem.o](https://github.com/shibbo/Petari/blob/master/docs/lib/System/GameSystem.md) | 8.732394366197182% | 1 / 32 | 3.125% | :eight_pointed_black_star:
|
||||
|
@ -5,13 +5,13 @@
|
||||
| :white_check_mark: | Function is completed.
|
||||
|
||||
|
||||
# 0 / 6 Completed -- (0.0%)
|
||||
# 6 / 6 Completed -- (100.0%)
|
||||
# FileLoaderThread.o
|
||||
| Symbol | Decompiled? |
|
||||
| ------------- | ------------- |
|
||||
| `loadFileUsingRipper__30@unnamed@FileLoaderThread_cpp@FP15RequestFileInfo` | :x: |
|
||||
| `__ct__16FileLoaderThreadFiiP7JKRHeap` | :x: |
|
||||
| `run__16FileLoaderThreadFv` | :x: |
|
||||
| `loadToMainRAM__16FileLoaderThreadFP15RequestFileInfo` | :x: |
|
||||
| `mountArchiveAndStartCreateResource__16FileLoaderThreadFP15RequestFileInfo` | :x: |
|
||||
| `__dt__16FileLoaderThreadFv` | :x: |
|
||||
| `loadFileUsingRipper__30@unnamed@FileLoaderThread_cpp@FP15RequestFileInfo` | :white_check_mark: |
|
||||
| `__ct__16FileLoaderThreadFiiP7JKRHeap` | :white_check_mark: |
|
||||
| `run__16FileLoaderThreadFv` | :white_check_mark: |
|
||||
| `loadToMainRAM__16FileLoaderThreadFP15RequestFileInfo` | :white_check_mark: |
|
||||
| `mountArchiveAndStartCreateResource__16FileLoaderThreadFP15RequestFileInfo` | :white_check_mark: |
|
||||
| `__dt__16FileLoaderThreadFv` | :white_check_mark: |
|
||||
|
23
include/Game/System/FileLoaderThread.h
Normal file
23
include/Game/System/FileLoaderThread.h
Normal file
@ -0,0 +1,23 @@
|
||||
#pragma once
|
||||
|
||||
#include "Game/System/OSThreadWrapper.h"
|
||||
#include "Game/System/FileHolder.h"
|
||||
|
||||
struct RequestFileInfo {
|
||||
u32 _0;
|
||||
s32 mRequestType; // _4
|
||||
char mFileName[0x80]; // _8
|
||||
u32 _88;
|
||||
FileHolderFileEntry* mFileEntry; // _8C
|
||||
};
|
||||
|
||||
class FileLoaderThread : OSThreadWrapper {
|
||||
public:
|
||||
FileLoaderThread(int, int, JKRHeap *);
|
||||
|
||||
virtual ~FileLoaderThread();
|
||||
virtual s32 run();
|
||||
|
||||
void loadToMainRAM(RequestFileInfo *);
|
||||
void mountArchiveAndStartCreateResource(RequestFileInfo *);
|
||||
};
|
@ -6,5 +6,13 @@ class JKRHeap;
|
||||
|
||||
class FileRipper {
|
||||
public:
|
||||
enum AllocDirection {
|
||||
UNK_0 = 0,
|
||||
UNK_1 = 1,
|
||||
UNK_2 = 2
|
||||
};
|
||||
|
||||
static void setup(u32, JKRHeap *);
|
||||
|
||||
static void* loadToMainRAM(const char *, u8 *, bool, JKRHeap *, AllocDirection);
|
||||
};
|
BIN
prog.png
BIN
prog.png
Binary file not shown.
Before Width: | Height: | Size: 25 KiB After Width: | Height: | Size: 25 KiB |
74
source/Game/System/FileLoaderThread.cpp
Normal file
74
source/Game/System/FileLoaderThread.cpp
Normal file
@ -0,0 +1,74 @@
|
||||
#include "Game/System/FileLoaderThread.h"
|
||||
#include "Game/System/FileRipper.h"
|
||||
|
||||
#include "Inline.h"
|
||||
|
||||
namespace {
|
||||
void* loadFileUsingRipper(RequestFileInfo *pInfo) NO_INLINE {
|
||||
s32 val = 0;
|
||||
|
||||
if (pInfo->mRequestType != 1) {
|
||||
val = 1;
|
||||
}
|
||||
|
||||
return FileRipper::loadToMainRAM(pInfo->mFileName, (u8*)pInfo->mFileEntry->mContents, true, pInfo->mFileEntry->mHeap, (FileRipper::AllocDirection)val);
|
||||
}
|
||||
};
|
||||
|
||||
FileLoaderThread::FileLoaderThread(int a1, int a2, JKRHeap *pHeap) : OSThreadWrapper(0x8000, a2, a1, pHeap) {
|
||||
|
||||
}
|
||||
|
||||
s32 FileLoaderThread::run() {
|
||||
// OSInitFastCast
|
||||
__asm {
|
||||
li r3, 4
|
||||
oris r3, r3, 4
|
||||
mtspr 0x392, r3
|
||||
li r3, 5
|
||||
oris r3, r3, 5
|
||||
mtspr 0x393, r3
|
||||
li r3, 6
|
||||
oris r3, r3, 6
|
||||
mtspr 0x394, r3
|
||||
li r3, 7
|
||||
oris r3, r3, 7
|
||||
mtspr 0x395, r3
|
||||
};
|
||||
|
||||
while (true) {
|
||||
OSMessage msg;
|
||||
OSReceiveMessage(&mQueue, &msg, 1);
|
||||
RequestFileInfo* info = (RequestFileInfo*)msg;
|
||||
|
||||
switch (info->_0) {
|
||||
case 0:
|
||||
loadToMainRAM(info);
|
||||
break;
|
||||
case 1:
|
||||
mountArchiveAndStartCreateResource(info);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* this function matches in other compiler versions */
|
||||
void FileLoaderThread::loadToMainRAM(RequestFileInfo *pInfo) {
|
||||
pInfo->_88 = 1;
|
||||
void* data = ::loadFileUsingRipper(pInfo);
|
||||
pInfo->mFileEntry->setContext(data, pInfo->mFileEntry->mHeap);
|
||||
pInfo->_88 = 2;
|
||||
}
|
||||
|
||||
/* same with this one */
|
||||
void FileLoaderThread::mountArchiveAndStartCreateResource(RequestFileInfo *pInfo) {
|
||||
pInfo->_88 = 1;
|
||||
void* data = ::loadFileUsingRipper(pInfo);
|
||||
MR::createAndAddArchive(data, pInfo->mFileEntry->mHeap, pInfo->mFileName);
|
||||
pInfo->mFileEntry->setContext(data, pInfo->mFileEntry->mHeap);
|
||||
pInfo->_88 = 2;
|
||||
}
|
||||
|
||||
FileLoaderThread::~FileLoaderThread() {
|
||||
|
||||
}
|
Loading…
Reference in New Issue
Block a user