summaryrefslogtreecommitdiff
path: root/src/card.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/card.c')
-rw-r--r--src/card.c16
1 files changed, 9 insertions, 7 deletions
diff --git a/src/card.c b/src/card.c
index e704e1d..3b3571b 100644
--- a/src/card.c
+++ b/src/card.c
@@ -5,7 +5,6 @@
// We declare those instead of using the standard headers to let
// the linker link them against the ones already in the game's code.
-int32_t strncmp(const char* str1, const char* str2, size_t n);
void* memset(void* dst, int val, size_t n);
// +=-=-=-=-=-=-=-=-=-=-=+
@@ -70,14 +69,17 @@ int32_t __CARDGetFileNo(void* card, const char* fileName, int32_t* fileNo) {
for (i = 0; i < 127; i++)
{
uint8_t* currentDirBlock = (uint8_t*)(dirBlock + (i * 0x40));
- const char* currentFileName = (const char*)(&currentDirBlock[0x8]);
- if (strncmp(fileName, currentFileName, 32) == 0) {
- if (__CARDAccess(card, currentDirBlock) >= Ready) {
- *fileNo = i;
- break;
- }
+ if (!__CARDCompareFileName(currentDirBlock, fileName)) {
+ continue;
}
+
+ if (__CARDAccess(card, currentDirBlock) < Ready) {
+ continue;
+ }
+
+ *fileNo = i;
+ break;
}
if (i >= 127) {