Conversation
|
🆗 ✅+810 bytes No Regressions 🎉Progress: 13📈 |
🆗 ✅+810 bytes No Regressions 🎉Progress: 13📈 |
| void ResetButton::CheckResetButton() | ||
| { | ||
| // TODO | ||
| // mainly just ghidra output | ||
|
|
||
| U32 uVar1; | ||
| U32 uVar2; | ||
| S32 iVar3; | ||
| bool tempblank = false; | ||
| bool mWasResetButtonPressed = false; | ||
| U64 uVar5; //ulonglong? | ||
|
|
||
| uVar2 = OSGetResetButtonState(); | ||
| uVar1 = uVar2; | ||
| if (((uVar2 == 0) && (mWasResetButtonPressed != 0)) && | ||
| (uVar1 = mWasResetButtonPressed, mResetEnabled != '\0')) { | ||
| uVar5 = OSDisableInterrupts(); | ||
| // if (mSndKill != (code *)0x0) { | ||
| // (*mSndKill__11ResetButton)((int)(uVar5 >> 0x20),(int)uVar5); | ||
| // } | ||
| PADRecalibrate(0xf0000000); | ||
| VISetBlack(1); | ||
| VIFlush(); | ||
| VIWaitForRetrace(); | ||
| OSEnableInterrupts(); | ||
| iVar3 = DVDGetDriveStatus(); | ||
| if (((iVar3 == 6) || (iVar3 = DVDGetDriveStatus(), iVar3 == 5)) || | ||
| ((iVar3 = DVDCheckDisk(), iVar3 == 0 && (iVar3 = DVDGetDriveStatus(), iVar3 == 0)))) { | ||
| OSResetSystem(1,0,0); // bool = osresetsystem | ||
| uVar2 = (U32)tempblank; | ||
| uVar1 = mWasResetButtonPressed; | ||
| } | ||
| else { | ||
| OSResetSystem(0,0,0); // bool = osresetsystem | ||
| uVar2 = (U32)tempblank; | ||
| uVar1 = mWasResetButtonPressed; | ||
| } | ||
| } | ||
| mWasResetButtonPressed = uVar1; | ||
| //return uVar2; | ||
| } |
There was a problem hiding this comment.
Good stuff overall! Please clean up some of the Ghidraisms here and use bool macros for the appropriate conditional checks.
For example, (code*) 0x0 can just be rewritten as NULL, and the conditionals that are checking 0 values are replaceable with the more semantic FALSE.
We also avoid using the comma operator in conditionals because it makes the conditions harder to read - please convert those to statements outside the condition using a nested conditional.
🆗 ✅+842 bytes No Regressions 🎉Progress: 13📈 |
|
Lots of work to zMain (mostly done manually). Out of time to finish. Will resume later. |
|
|
* zShrapnel work * fix include
* zCameraTweak: Progress for most functions * zCameraTweak: Implement zCameraTweakGlobal_Update and clang-format * zCameraTweak: Remove empty space and format * zCameraTweak: Better name for local
|
JoshSanch
left a comment
There was a problem hiding this comment.
Excellent contribution! Since this is a big one, there's a few review items I have left feedback on. Additionally, please format all the files in this PR with clang-format - there were at least a couple which were not formatted as such. This will appear in our contribution guidelines going forward.
src/SB/Core/gc/iTRC.cpp
Outdated
|
|
||
| OSGetResetButtonState(); | ||
| PADRecalibrate(0xf0000000); | ||
| VISetBlack(1); |
There was a problem hiding this comment.
This spot would benefit from the TRUE macro.
src/SB/Core/gc/iTRC.cpp
Outdated
| if ((diskChk != 0) && (diskChk = DVDGetDriveStatus(), diskChk == 0)) { | ||
| diskIDed = 1; |
There was a problem hiding this comment.
Please use for TRUE/FALSE macros for diskChk conditions.
Also, the conditional body should read as this instead since diskIDed is a boolean:
diskIDed = true;
src/SB/Core/gc/iTRC.cpp
Outdated
| void iTRCDisk::DisplayErrorMessage() | ||
| { | ||
| S32 tempVar; | ||
| U32 local_18 [4]; |
There was a problem hiding this comment.
This variable isn't used in the function, so it should be removed.
There was a problem hiding this comment.
Which one? iirc the variable local_18 is in the dwarf so it theoretically should be used. Since it isn't currently being used I will remove it.
There was a problem hiding this comment.
What's causing this file not to match? If the unused array is going to end up being required for the 100% match, then I'd leave it in.
|
src/SB/Core/gc/iTRC.cpp
Outdated
| S32 diskChk; | ||
| bool diskIDed; | ||
|
|
||
| diskIDed = FALSE; |
There was a problem hiding this comment.
This is kind of confusing so I totally understand why you used FALSE here, and it technically compiles but:
Use the C++ keyword false for working with C++ bool data types.
Use the C-style macro FALSE for working with C types (S32, S8, U8, etc.)
Same applies for TRUE/true usage.
|
iTRC work and some file cleanup