Skip to content

zMain #561

Merged
JoshSanch merged 4 commits intobfbbdecomp:mainfrom
LivewireCB:dev5
May 22, 2025
Merged

zMain #561
JoshSanch merged 4 commits intobfbbdecomp:mainfrom
LivewireCB:dev5

Conversation

@LivewireCB
Copy link
Contributor

Cleanup and function implementations on zMain

@github-actions
Copy link

⚠️ 🔥

+1538 bytes
🆗 Bot Rating: A fantastic contribution! ✨🎉

Regressions: 1

⚠️ main/SB/Game/zMain - .sbss -5 bytes -> 36.36%

Progress: 8

📈 main/SB/Game/zMain - .text +1504 bytes -> 61.24%
📈 main/SB/Game/zMain - .rodata +35 bytes -> 87.11%
📈 main/SB/Game/zMain - zMainParseINIGlobals(xIniFile*) +3 bytes -> 77.55%
📈 main/SB/Game/zMain - zMainLoop() +764 bytes -> 57.53%
📈 main/SB/Game/zMain - zMainLoadFontHIP() +264 bytes -> 93.24%
📈 main/SB/Game/zMain - zMainShowProgressBar() +216 bytes -> 85.94%
📈 main/SB/Game/zMain - zMainMemCardQueryPost(int, int, int, int) +116 bytes -> 72.50%
📈 main/SB/Game/zMain - zMainMemCardRenderText(const char*, bool) +140 bytes -> 92.11%

Copy link
Collaborator

@JoshSanch JoshSanch left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great work overall! Lots of small things here that I wanted to call your attention to so excuse the overly short review comments by the end.

void zMainShowProgressBar()
{
S32 progBar;
size_t sVar2;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please give sVar2 a semantically appropriate name based on its usage.

Comment on lines +649 to +658
xUtil_idtag2string(0x464f4e54, 0);
iTimeDiffSec(time);
xSTPreLoadScene(0x464f4e54, NULL, 0x1);
time = iTimeGet();
xUtil_idtag2string(0x464f4e54, 0);
iTimeDiffSec(time);
xSTQueueSceneAssets(0x464f4e54, 1);
time = iTimeGet();
xUtil_idtag2string(0x464f4e54, 0);
iTimeDiffSec(time);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please replace usages of 0x464f4e54 with the char literal representation 'FONT', which is more readable and more likely to be what Heavy Iron used here.

Comment on lines +665 to +668
xSTDisconnect(0x464f4e54, 1);
time = iTimeGet();
xUtil_idtag2string(0x464f4e54, 0);
iTimeDiffSec(time);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please additionally address these usages of 0x464f4e54.

Comment on lines +670 to +671
xSTPreLoadScene(0x504c4154, 0, 1);
xSTQueueSceneAssets(0x504c4154, 1);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is equivalent to 'PLAT'.

Comment on lines +678 to +730
xSTDisconnect(0x504c4154, 1);
zMainShowProgressBar();
iTimeGet();
xShadowSimple_Init();
globals.pickupTable = (zAssetPickupTable*)xSTFindAssetByType(0x5049434b, 0, 0);
// globals.pickupTable = zPickupTableInit();
// zPickupTableInit hasnt been implemented yet
xMemPushBase();
time = iTimeGet();
xUtil_idtag2string(0x4d4e5534, 0);
iTimeDiffSec(time);
xSTPreLoadScene(0x4d4e5534, 0, 1);
time = iTimeGet();
xUtil_idtag2string(0x4d4e5534, 0);
iTimeDiffSec(time);
xSTQueueSceneAssets(0x4d4e5534, 1);
time = iTimeGet();
xUtil_idtag2string(0x4d4e5534, 0);
iTimeDiffSec(time);
do
{
xSTLoadStep(time);
} while (time < 1.0f);
xSTDisconnect(0x4d4e5534, 1);
zMainShowProgressBar();
time = iTimeGet();
xUtil_idtag2string(0x4d4e5534, 0);
iTimeDiffSec(time);
xMemPushBase();
time = iTimeGet();
xUtil_idtag2string(0x4d4e5535, 0);
iTimeDiffSec(time);
xSTPreLoadScene(0x4d4e5535, 0, 1);
time = iTimeGet();
xUtil_idtag2string(0x4d4e5535, 0);
iTimeDiffSec(time);
xSTQueueSceneAssets(0x4d4e5535, 1);
time = iTimeGet();
xUtil_idtag2string(0x4d4e5535, 0);
iTimeDiffSec(time);
do
{
xSTLoadStep(time);
} while (time < 1.0f);
xSTDisconnect(0x4d4e5535, 1);
zMainShowProgressBar();
time = iTimeGet();
xUtil_idtag2string(0x4d4e5535, 0);
iTimeDiffSec(time);
xModelInit();
xModelPoolInit(0x20, 0x40);
xModelPoolInit(0x28, 8);
xModelPoolInit(0x38, 1);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Make sure that any integer that can be better expressed by a char literal (e.g 'PLAT', 'FONT') is substituted with that char literal here.

Comment on lines +764 to +781
cam = iCameraCreate(0x280, 0x1e0, 0);
RwCameraClear(cam, colour, clearMode);
RwCameraBeginUpdate(cam);
render_mem_card_no_space(needed, available, neededFiles, unk0);
RwCameraEndUpdate(cam);
RwCameraShowRaster(cam, 0, 1);
iCameraDestroy(cam);
}

void zMainMemCardRenderText(const char* a, bool enabled)
{
RwCamera* cam = 0;
RwRGBA* colour = 0;
RwInt32 clearMode = 3;

cam = iCameraCreate(0x280, 0x1e0, 0);
RwCameraClear(cam, colour, clearMode);
RwCameraBeginUpdate(cam);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These are meant to specify the screen dimensions 640 x 480 - please replace the hex values with their integer equivalents.

RwCameraBeginUpdate(cam);
RenderText(a, enabled);
RwCameraEndUpdate(cam);
RwCameraShowRaster(cam, 0, 1);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are either of these integers better represented using TRUE/FALSE?

Comment on lines +794 to +802
xUtil_idtag2string(0x464f4e54, 0);
iTimeDiffSec(time);
xSTPreLoadScene(0x464f4e54, NULL, 0x1);
time = iTimeGet();
xUtil_idtag2string(0x464f4e54, 0);
iTimeDiffSec(time);
xSTQueueSceneAssets(0x464f4e54, 1);
time = iTimeGet();
xUtil_idtag2string(0x464f4e54, 0);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please substitute char literals here as well

Comment on lines +810 to +812
xSTDisconnect(0x464f4e54, 1);
time = iTimeGet();
xUtil_idtag2string(0x464f4e54, 0);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

More char literals

@github-actions
Copy link

🆗 ✅

+1538 bytes
🆗 Bot Rating: A fantastic contribution! ✨🎉

No Regressions 🎉

Progress: 8

📈 main/SB/Game/zMain - .text +1504 bytes -> 61.18%
📈 main/SB/Game/zMain - .rodata +35 bytes -> 87.11%
📈 main/SB/Game/zMain - zMainParseINIGlobals(xIniFile*) +3 bytes -> 77.55%
📈 main/SB/Game/zMain - zMainLoop() +764 bytes -> 57.53%
📈 main/SB/Game/zMain - zMainLoadFontHIP() +264 bytes -> 93.24%
📈 main/SB/Game/zMain - zMainShowProgressBar() +216 bytes -> 85.94%
📈 main/SB/Game/zMain - zMainMemCardQueryPost(int, int, int, int) +116 bytes -> 72.50%
📈 main/SB/Game/zMain - zMainMemCardRenderText(const char*, bool) +140 bytes -> 92.11%

@github-actions
Copy link

🆗 ✅

+1594 bytes
🆗 Bot Rating: A fantastic contribution! ✨🎉

No Regressions 🎉

Progress: 8

📈 main/SB/Game/zMain - .text +1560 bytes -> 61.56%
📈 main/SB/Game/zMain - .rodata +35 bytes -> 87.11%
📈 main/SB/Game/zMain - zMainParseINIGlobals(xIniFile*) +3 bytes -> 77.55%
📈 main/SB/Game/zMain - zMainLoop() +820 bytes -> 61.75%
📈 main/SB/Game/zMain - zMainLoadFontHIP() +264 bytes -> 93.24%
📈 main/SB/Game/zMain - zMainShowProgressBar() +216 bytes -> 85.94%
📈 main/SB/Game/zMain - zMainMemCardQueryPost(int, int, int, int) +116 bytes -> 72.50%
📈 main/SB/Game/zMain - zMainMemCardRenderText(const char*, bool) +140 bytes -> 92.11%

Copy link
Collaborator

@JoshSanch JoshSanch left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nearly there, some straggling ints that should have char literal substitutions.

@github-actions
Copy link

🆗 ✅

+1586 bytes
🆗 Bot Rating: A fantastic contribution! ✨🎉

No Regressions 🎉

Progress: 8

📈 main/SB/Game/zMain - .text +1552 bytes -> 61.51%
📈 main/SB/Game/zMain - .rodata +35 bytes -> 87.11%
📈 main/SB/Game/zMain - zMainParseINIGlobals(xIniFile*) +3 bytes -> 77.55%
📈 main/SB/Game/zMain - zMainLoop() +812 bytes -> 61.14%
📈 main/SB/Game/zMain - zMainLoadFontHIP() +264 bytes -> 93.24%
📈 main/SB/Game/zMain - zMainShowProgressBar() +216 bytes -> 85.94%
📈 main/SB/Game/zMain - zMainMemCardQueryPost(int, int, int, int) +116 bytes -> 72.50%
📈 main/SB/Game/zMain - zMainMemCardRenderText(const char*, bool) +140 bytes -> 92.11%

Copy link
Collaborator

@JoshSanch JoshSanch left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me, good work!

@JoshSanch JoshSanch merged commit dcb19b2 into bfbbdecomp:main May 22, 2025
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants