-
Notifications
You must be signed in to change notification settings - Fork 9
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Identify/fix some mcard inlines #177
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
dolphin/card.h
got some macros that could be used here, I made suggestions but idk if that makes sense or not
@@ -287,12 +257,12 @@ static bool mcardReplaceFileBlock(MemCard* pMCard, s32 index) { | |||
|
|||
simulatorPrepareMessage(S_M_CARD_SV09); | |||
|
|||
if (!UnkInlinemCardReplaceFileBlock2(pMCard, index << 13)) { | |||
if (!mcardWriteAnywhereNoTime(pMCard, index << 13, 0x2000, pMCard->writeBuffer)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if (!mcardWriteAnywhereNoTime(pMCard, index << 13, 0x2000, pMCard->writeBuffer)) { | |
if (!mcardWriteAnywhereNoTime(pMCard, index << 13, CARD_SYSTEM_BLOCK_SIZE, pMCard->writeBuffer)) { |
|
||
memcpy(buffer, pMCard->writeBuffer, 0x2000); | ||
|
||
if (!UnkInlinemCardReplaceFileBlock(pMCard)) { | ||
if (!mcardReadAnywhereNoTime(pMCard, 0x4000, 0x2000, pMCard->writeBuffer)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if (!mcardReadAnywhereNoTime(pMCard, 0x4000, 0x2000, pMCard->writeBuffer)) { | |
if (!mcardReadAnywhereNoTime(pMCard, 0x4000, CARD_SYSTEM_BLOCK_SIZE, pMCard->writeBuffer)) { |
maybe that 0x4000 is CARD_SYSTEM_BLOCK_SIZE * 2
? not sure if that makes sense though
@@ -263,11 +233,11 @@ static bool mcardReplaceFileBlock(MemCard* pMCard, s32 index) { | |||
s32 checksum1; | |||
s32 checksum2; | |||
char buffer[0x2000]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
char buffer[0x2000]; | |
char buffer[CARD_SYSTEM_BLOCK_SIZE]; |
char buffer2[0x2000]; | ||
s32 checksum; | ||
s32 pad[2]; | ||
|
||
memcpy(buffer2, pMCard->writeBuffer, 0x2000); | ||
memcpy(pMCard->writeBuffer, buffer, 0x2000); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
char buffer2[0x2000]; | |
s32 checksum; | |
s32 pad[2]; | |
memcpy(buffer2, pMCard->writeBuffer, 0x2000); | |
memcpy(pMCard->writeBuffer, buffer, 0x2000); | |
char buffer2[CARD_SYSTEM_BLOCK_SIZE]; | |
s32 checksum; | |
s32 pad[2]; | |
memcpy(buffer2, pMCard->writeBuffer, CARD_SYSTEM_BLOCK_SIZE); | |
memcpy(pMCard->writeBuffer, buffer, CARD_SYSTEM_BLOCK_SIZE); |
I definitely agree on |
I don't mind if it's done in this PR but do like you want about the name, |
Yeah sorry, I think I'd like to do a cleanup pass after the rest of mcard is decompiled, because it's a bit hard to tell how things are used right now |
I started matching more mcard functions and I think these are correct now, although I'm not sure on
mcardFinishFile
vsmcardFinishGame
. Highlights:UnkInlinemCardReplaceFileBlock
->mcardReadAnywhereNoTime
UnkInlinemCardReplaceFileBlock2
,UnkInlinemCardVerifyChecksumFileHeader2
->mcardWriteAnywhereNoTime
UnkInlinemCardVerifyChecksumFileHeader
,mcardGameEraseInline
->mcardReadyFile
UnkINlinemCardVerifyChecksumFileHeader3
,UnkINlinemCardVerifyChecksumFileHeader4
->mcardFinishFile
mcardGetFileTime
: missingpMCard->saveToggle == true
checkmcardFileRelease
: should callmcardGameRelease