diff options
| author | TakaRikka <38417346+TakaRikka@users.noreply.github.com> | 2024-01-20 02:53:06 -0800 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-01-20 12:53:06 +0200 |
| commit | 49a4319fb85eaa6e3cbbaebad7c3a8df286b512f (patch) | |
| tree | 0c88cdec1cf8ad19c83acb4708e536dfbad33177 /src/DynamicLink.cpp | |
| parent | 5ad3727d177dd7b1c39523e3377410902cb781ad (diff) | |
OSLink done (#2038)
Diffstat (limited to 'src/DynamicLink.cpp')
| -rw-r--r-- | src/DynamicLink.cpp | 40 |
1 files changed, 20 insertions, 20 deletions
diff --git a/src/DynamicLink.cpp b/src/DynamicLink.cpp index 8024c44dbe..a3558b9729 100644 --- a/src/DynamicLink.cpp +++ b/src/DynamicLink.cpp @@ -229,19 +229,19 @@ bool DynamicModuleControl::do_load() { snprintf(buffer, 64, "%s.rel", mName); if (mModule == NULL && sArchive != NULL) { if (mModule == NULL) { - mModule = (OSModuleInfo*)JKRGetResource('MMEM', buffer, sArchive); + mModule = (OSModuleHeader*)JKRGetResource('MMEM', buffer, sArchive); if (mModule != NULL) { mResourceType = 1; } } if (mModule == NULL) { - mModule = (OSModuleInfo*)JKRGetResource('AMEM', buffer, sArchive); + mModule = (OSModuleHeader*)JKRGetResource('AMEM', buffer, sArchive); if (mModule != NULL) { mResourceType = 2; } } if (mModule == NULL) { - mModule = (OSModuleInfo*)JKRGetResource('DMEM', buffer, sArchive); + mModule = (OSModuleHeader*)JKRGetResource('DMEM', buffer, sArchive); if (mModule != NULL) { mResourceType = 3; } @@ -253,7 +253,7 @@ bool DynamicModuleControl::do_load() { } else { if (mModule == NULL) { snprintf(buffer, 64, "/rel/Final/Release/%s.rel", mName); - mModule = (OSModuleInfo*)JKRDvdToMainRam( + mModule = (OSModuleHeader*)JKRDvdToMainRam( buffer, NULL, EXPAND_SWITCH_UNKNOWN1, NULL, heap, JKRDvdRipper::ALLOC_DIRECTION_FORWARD, 0, NULL, NULL); if (mModule != NULL) { @@ -262,7 +262,7 @@ bool DynamicModuleControl::do_load() { } } if (mModule == NULL && sFileCache != NULL) { - mModule = (OSModuleInfo*)sFileCache->getResource('rels', buffer); + mModule = (OSModuleHeader*)sFileCache->getResource('rels', buffer); if (mModule != NULL) { mSize = 0; mResourceType = 11; @@ -351,8 +351,8 @@ void DynamicModuleControl::dump2() { if (mModule != NULL) { OSSectionInfo* section = (OSSectionInfo*)mModule->info.sectionInfoOffset; OSSectionInfo* section2 = section + 1; - u32 offset = section2->mOffset & ~(1); - OSReport("%08x-%08x %08x %08x", mModule, offset, offset + section2->mSize); + u32 offset = section2->offset & ~(1); + OSReport("%08x-%08x %08x %08x", mModule, offset, offset + section2->size); } } @@ -368,57 +368,57 @@ BOOL DynamicModuleControl::do_link() { ASSERT((u32)mModule + mModule->fixSize < 0x82000000); OSGetTime(); OSGetTime(); - if (mModule->mModuleVersion >= 3) { + if (mModule->info.version >= 3) { u32 fixSizePtr; u32 fixSize = mModule->fixSize; u32 fixSize2 = (fixSize + 0x1f) & ~0x1f; fixSizePtr = (u32)mModule + fixSize2; s32 size = JKRGetMemBlockSize(NULL, mModule); if (size < 0) { - void* bss = JKRAlloc(mModule->mBssSize, 0x20); + void* bss = JKRAlloc(mModule->bssSize, 0x20); if (bss == NULL) { // "BSS Memory allocation failed\n" OSReport_Error("BSSメモリ確保失敗\n", bss); goto error; } mBss = bss; - BOOL linkResult = OSLink(mModule); + BOOL linkResult = OSLink(&mModule->info, bss); if (linkResult == FALSE) { // "link failed\n" OSReport_Error("リンク失敗\n"); goto error; } } else { - if (fixSize2 + mModule->mBssSize < size) { - BOOL linkResult = OSLinkFixed(mModule, fixSizePtr); + if (fixSize2 + mModule->bssSize < size) { + BOOL linkResult = OSLinkFixed(&mModule->info, (void*)fixSizePtr); if (linkResult == FALSE) { // "link failed\n" OSReport_Error("リンク失敗\n"); goto error; } - s32 result = JKRResizeMemBlock(NULL, mModule, fixSize2 + mModule->mBssSize); + s32 result = JKRResizeMemBlock(NULL, mModule, fixSize2 + mModule->bssSize); if (result < 0) { // "Module size (resize) failed\n" OSReport_Error("モジュールリサイズ(縮小)失敗\n"); } } else { - s32 result = JKRResizeMemBlock(NULL, mModule, fixSize2 + mModule->mBssSize); + s32 result = JKRResizeMemBlock(NULL, mModule, fixSize2 + mModule->bssSize); if (result > 0) { - BOOL linkResult = OSLinkFixed(mModule, fixSizePtr); + BOOL linkResult = OSLinkFixed(&mModule->info, (void*)fixSizePtr); if (linkResult == FALSE) { // "link failed\n" OSReport_Error("リンク失敗\n"); goto error; } } else { - void* bss = JKRAlloc(mModule->mBssSize, 0x20); + void* bss = JKRAlloc(mModule->bssSize, 0x20); if (bss == NULL) { // "BSS Memory allocation failure [%x]\n" - OSReport_Error("BSSメモリ確保失敗 [%x]\n", mModule->mBssSize); + OSReport_Error("BSSメモリ確保失敗 [%x]\n", mModule->bssSize); goto error; } mBss = bss; - BOOL linkResult = OSLinkFixed(mModule, (u32)bss); + BOOL linkResult = OSLinkFixed(&mModule->info, bss); if (linkResult == FALSE) { // "link failed\n" OSReport_Error("リンク失敗\n"); @@ -460,7 +460,7 @@ bool DynamicModuleControl::do_unlink() { OSTime time1 = OSGetTime(); ((void (*)())mModule->epilog)(); OSTime time2 = OSGetTime(); - BOOL unklink = OSUnlink(mModule); + BOOL unklink = OSUnlink(&mModule->info); OSTime time3 = OSGetTime(); if (unklink == FALSE) { // "Unlink failed mModule=%08x mBss=%08x\n" @@ -483,7 +483,7 @@ int DynamicModuleControl::getModuleSize() const { if (mBss != NULL) { JKRGetMemBlockSize(NULL, mBss); } - return size + mModule->mBssSize; + return size + mModule->bssSize; } else { return 0; } |
