diff options
| author | Jcw87 <Jcw87@users.noreply.github.com> | 2023-09-24 02:05:03 -0700 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-09-24 02:05:03 -0700 |
| commit | 3e46ad6b30aa63aff320c5c39741d6f1804a0b6d (patch) | |
| tree | 5a3322844486cbb19795c81097d22c593c2750ed /libs/JSystem/JKernel/JKRFileCache.cpp | |
| parent | f26fc0a26c64810dbd28e5d5c8f32df947d24721 (diff) | |
JKernel (#1942)
Diffstat (limited to 'libs/JSystem/JKernel/JKRFileCache.cpp')
| -rw-r--r-- | libs/JSystem/JKernel/JKRFileCache.cpp | 28 |
1 files changed, 13 insertions, 15 deletions
diff --git a/libs/JSystem/JKernel/JKRFileCache.cpp b/libs/JSystem/JKernel/JKRFileCache.cpp index d77e26ddcd..91c6015c42 100644 --- a/libs/JSystem/JKernel/JKRFileCache.cpp +++ b/libs/JSystem/JKernel/JKRFileCache.cpp @@ -7,6 +7,7 @@ #include "JSystem/JKernel/JKRDvdFile.h" #include "JSystem/JKernel/JKRFileFinder.h" #include "JSystem/JKernel/JKRHeap.h" +#include "JSystem/JUtility/JUTAssert.h" #include "MSL_C/MSL_Common/Src/ctype.h" #include "MSL_C/string.h" #include "global.h" @@ -40,7 +41,7 @@ JKRFileCache* JKRFileCache::mount(const char* path, JKRHeap* heap, const char* p } /* 802D4AB4-802D4C70 2CF3F4 01BC+00 1/1 0/0 0/0 .text __ct__12JKRFileCacheFPCcPCc */ -JKRFileCache::JKRFileCache(const char* path, const char* volume) : mCacheBlockList() { +JKRFileCache::JKRFileCache(const char* path, const char* volume) { mParentHeap = JKRHeap::findFromRoot(this); mMountCount = 1; mVolumeType = 'CASH'; @@ -119,7 +120,7 @@ bool JKRFileCache::becomeCurrent(const char* path) { /* 802D4DD8-802D4EDC 2CF718 0104+00 1/0 0/0 0/0 .text getResource__12JKRFileCacheFPCc */ void* JKRFileCache::getResource(const char* path) { - ASSERT(isMounted()); + JUT_ASSERT(237, isMounted()); void* buffer = NULL; char* name = getDvdPathName(path); @@ -151,7 +152,7 @@ void* JKRFileCache::getResource(const char* path) { /* 802D4EDC-802D4F64 2CF81C 0088+00 1/0 0/0 0/0 .text getResource__12JKRFileCacheFUlPCc */ void* JKRFileCache::getResource(u32, const char* path) { - ASSERT(isMounted()); + JUT_ASSERT(303, isMounted()); char finalPath[256]; u32 rootLength = strlen(mRootPath); @@ -167,7 +168,7 @@ void* JKRFileCache::getResource(u32, const char* path) { /* 802D4F64-802D503C 2CF8A4 00D8+00 1/0 0/0 0/0 .text readResource__12JKRFileCacheFPvUlPCc */ u32 JKRFileCache::readResource(void* dst, u32 dstLength, const char* path) { - ASSERT(isMounted()); + JUT_ASSERT(412, isMounted()); char* name = getDvdPathName(path); JKRDvdFile dvdFile(name); @@ -176,8 +177,10 @@ u32 JKRFileCache::readResource(void* dst, u32 dstLength, const char* path) { // !@bug: (maybe?) Infinite Loop: Because dvdFile.isAvailable() is never updated in the loop-body // will would never exit the loop. -loop: - if (dvdFile.isAvailable()) { + while (true) { + if (!dvdFile.isAvailable()) { + break; + } u32 fileSize = dvdFile.getFileInfo()->length; resourceSize = ALIGN_NEXT(fileSize, 0x20); dstLength = ALIGN_PREV(dstLength, 0x20); @@ -191,7 +194,6 @@ loop: } else { memcpy(dst, cacheBlock->mMemoryPtr, resourceSize); } - goto loop; } JKRFreeToSysHeap(name); @@ -200,7 +202,7 @@ loop: /* 802D503C-802D50D4 2CF97C 0098+00 1/0 0/0 0/0 .text readResource__12JKRFileCacheFPvUlUlPCc */ u32 JKRFileCache::readResource(void* dst, u32 dstLength, u32, const char* path) { - ASSERT(isMounted()); + JUT_ASSERT(344, isMounted()); char finalPath[256]; u32 rootLength = strlen(mRootPath); @@ -217,7 +219,7 @@ u32 JKRFileCache::readResource(void* dst, u32 dstLength, u32, const char* path) /* 802D50D4-802D5164 2CFA14 0090+00 1/0 0/0 0/0 .text removeResourceAll__12JKRFileCacheFv */ void JKRFileCache::removeResourceAll(void) { - ASSERT(isMounted()); + JUT_ASSERT(412, isMounted()); JSUListIterator<CCacheBlock> iterator; iterator = mCacheBlockList.getFirst(); @@ -232,7 +234,7 @@ void JKRFileCache::removeResourceAll(void) { /* 802D5164-802D51F8 2CFAA4 0094+00 1/0 0/0 0/0 .text removeResource__12JKRFileCacheFPv */ bool JKRFileCache::removeResource(void* resource) { - ASSERT(isMounted()); + JUT_ASSERT(463, isMounted()); CCacheBlock* cacheBlock = findCacheBlock(resource); if (!cacheBlock) @@ -252,7 +254,7 @@ bool JKRFileCache::removeResource(void* resource) { /* 802D51F8-802D526C 2CFB38 0074+00 1/0 0/0 0/0 .text detachResource__12JKRFileCacheFPv */ bool JKRFileCache::detachResource(void* resource) { - ASSERT(isMounted()); + JUT_ASSERT(490, isMounted()); CCacheBlock* cacheBlock = findCacheBlock(resource); if (!cacheBlock) @@ -265,8 +267,6 @@ bool JKRFileCache::detachResource(void* resource) { /* 802D526C-802D52A0 2CFBAC 0034+00 1/0 0/0 0/0 .text getResSize__12JKRFileCacheCFPCv */ u32 JKRFileCache::getResSize(const void* resource) const { - ASSERT(isMounted()); - CCacheBlock* cacheBlock = findCacheBlock(resource); if (cacheBlock == NULL) { return -1; @@ -277,8 +277,6 @@ u32 JKRFileCache::getResSize(const void* resource) const { /* 802D52A0-802D531C 2CFBE0 007C+00 1/0 0/0 0/0 .text countFile__12JKRFileCacheCFPCc */ u32 JKRFileCache::countFile(const char* path) const { - ASSERT(isMounted()); - DVDDirectory dir; DVDDirectoryEntry dirEntry; |
