Decompile PSP DebugShowWaitInfo (#1899)
Some checks are pending
Format code / format (push) Waiting to run
Build C code / extract-assets (push) Waiting to run
Build C code / build-linux (i686, Debug, clang, custom) (push) Blocked by required conditions
Build C code / build-linux (i686, Debug, clang, lle) (push) Blocked by required conditions
Build C code / build-linux (i686, Debug, gcc, custom) (push) Blocked by required conditions
Build C code / build-linux (i686, Debug, gcc, lle) (push) Blocked by required conditions
Build C code / build-linux (i686, RelWithDebInfo, clang, custom) (push) Blocked by required conditions
Build C code / build-linux (i686, RelWithDebInfo, clang, lle) (push) Blocked by required conditions
Build C code / build-linux (i686, RelWithDebInfo, gcc, custom) (push) Blocked by required conditions
Build C code / build-linux (i686, RelWithDebInfo, gcc, lle) (push) Blocked by required conditions
Build C code / build-linux (x86_64, Debug, clang, custom) (push) Blocked by required conditions
Build C code / build-linux (x86_64, Debug, clang, lle) (push) Blocked by required conditions
Build C code / build-linux (x86_64, Debug, gcc, custom) (push) Blocked by required conditions
Build C code / build-linux (x86_64, Debug, gcc, lle) (push) Blocked by required conditions
Build C code / build-linux (x86_64, RelWithDebInfo, clang, custom) (push) Blocked by required conditions
Build C code / build-linux (x86_64, RelWithDebInfo, clang, lle) (push) Blocked by required conditions
Build C code / build-linux (x86_64, RelWithDebInfo, gcc, custom) (push) Blocked by required conditions
Build C code / build-linux (x86_64, RelWithDebInfo, gcc, lle) (push) Blocked by required conditions
Build C code / build-macos (Debug, custom) (push) Blocked by required conditions
Build C code / build-macos (Debug, lle) (push) Blocked by required conditions
Build C code / build-macos (RelWithDebInfo, custom) (push) Blocked by required conditions
Build C code / build-macos (RelWithDebInfo, lle) (push) Blocked by required conditions
Build C code / build-windows (Debug, custom) (push) Blocked by required conditions
Build C code / build-windows (Debug, lle) (push) Blocked by required conditions
Build C code / build-windows (RelWithDebInfo, custom) (push) Blocked by required conditions
Build C code / build-windows (RelWithDebInfo, lle) (push) Blocked by required conditions
Build Saturn version / build-and-test-saturn (push) Waiting to run
Build Saturn version / function-finder-saturn (push) Waiting to run
Build Debug Module tool / build (push) Waiting to run
Build PSX and PSP version / build-and-test (pspeu, hd) (push) Waiting to run
Build PSX and PSP version / build-and-test (pspeu, pspeu) (push) Waiting to run
Build PSX and PSP version / build-and-test (us, us) (push) Waiting to run
Build PSX and PSP version / generate-progress-report (pspeu, hd) (push) Blocked by required conditions
Build PSX and PSP version / generate-progress-report (pspeu, pspeu) (push) Blocked by required conditions
Build PSX and PSP version / generate-progress-report (us, us) (push) Blocked by required conditions
Build PSX and PSP version / generate-duplicates-report (us, us) (push) Blocked by required conditions
Build PSX and PSP version / generate-duplicates-report-psp (pspeu, pspeu) (push) Blocked by required conditions

Mostly an inconsequential function, but we can learn a whole lot from
this one.

1. Lots more symbols added to PSP. This function touches a lot of
previously-unseen things in PSP.
2. This is the first PSP function to print a string. Importantly, PSP
puts strings in `data`, not `rodata`! Luckily, the process of pulling
them in is simple and easy, as demonstrated here.
3. I modified the Makefile for the -O4 stuff. At this point I think DRA
is `O4` and all the overlays are `O0`. We can always make the logic more
complicated later if we need to.
4. We discovered a discrepancy in the size of DR_ENV on PSP. I suspect
we will have more SDK differences, but we will find them function by
function. I decided to set the size in a variable so that we can put all
the version differences at the top of the file, instead of them being
more scattered.

I think that's it!
This commit is contained in:
bismurphy 2024-11-13 13:06:22 -05:00 committed by GitHub
parent a91c2acd3c
commit 45bfe61037
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
7 changed files with 38 additions and 5 deletions

View File

@ -81,9 +81,11 @@ $(BUILD_DIR)/%.s.o: %.s
@mkdir -p $(dir $@)
$(AS) $(AS_FLAGS) -o $@ $<
FILES_WITH_O4 = 624DC.c.o 61F30.c.o 63C90.c.o
OPT_HIGH = -O4,p #need this because otherwise the comma breaks the filter statement
OPTIMIZATION = $(if $(filter $(notdir $@),$(FILES_WITH_O4)), $(OPT_HIGH), -Op)
# DRA appears to be compiled with -O4,p. This will control that flag.
# May need to modify if other -O4,p functions are found in other overlays.
# Works for now. Look in git history for a different approach which filters by individual .o file.
OPT_HIGH = -O4,p #need this because otherwise the comma breaks the if-statement
OPTIMIZATION = $(if $(findstring dra, $@), $(OPT_HIGH), -Op)
$(BUILD_DIR)/%.c.o: %.c $(MWCCPSP) $(MWCCGAP_APP)
@mkdir -p $(dir $@)

View File

@ -184,6 +184,8 @@ segments:
- [0x67E90, c, dra_psp/67E90]
- [0x680C0, c, dra_psp/680C0]
- [0x68D80, data]
- [0x6DDE8, .data, dra_psp/18210] # "\no\n"
- [0x6DDF0, data]
- [0xEE380, .rodata, dra_psp/80]
- [0xEE3A0, .rodata, dra/624DC]
- [0xEE3C0, .rodata, dra_psp/60F8]

View File

@ -17,6 +17,7 @@ func_80102CD8 = 0x090E2EC8;
SetNextRoomToLoad = 0x090E73D0;
func_800F0CD8 = 0x090E74E8;
func_800F298C = 0x090e9018;
DebugShowWaitInfo = 0x090f5068;
DebugUpdate = 0x090f5180;
MainGame = 0x090f5b58;
HandleTitle = 0x090f6800;
@ -105,6 +106,7 @@ D_8013799C = 0x091CDC70;
D_801379A0 = 0x091CDC74;
D_801379A4 = 0x091CDC78;
D_801379A8 = 0x091CDC7C;
g_DebugWaitInfoTimer = 0x091CE268;
D_80097420 = 0x091CE620;
g_MenuNavigation = 0x091cefd0;
D_80097C98 = 0x091ed280;

View File

@ -1,9 +1,13 @@
abs = 0x08906AF0;
memcpy = 0x08909F84;
rand = 0x0890B954;
DrawSync = 0x0891B448;
VSync = 0x0891B5BC;
LoadImage = 0x0891BFE4;
ClearImage = 0x0891CA60;
ClearOTag = 0x0891D0E0;
PutDrawEnv = 0x0891D484;
PutDispEnv = 0x0891D68C;
FntPrint = 0x08925e98;
SsSetMVol = 0x89261B4;
SsUtSetReverbDepth = 0x89261D4;
@ -61,5 +65,6 @@ g_Clut = 0x091F5DF8;
g_Clut_2800 = 0x091F85F8;
g_Clut_2860 = 0x091F8658;
g_GameTimer = 0x091FC460;
g_CurrentBuffer = 0x091FC4E0;
g_CastleFlags = 0x09234730;
g_ItemIconSlots = 0x0924BC20;

View File

@ -1,6 +1,11 @@
#ifndef LIBGPU_H
#define LIBGPU_H
#ifndef VERSION_PSP
#define DR_ENV_CODE_SIZE 15
#else
#define DR_ENV_CODE_SIZE 8
#endif
/*
* Set Primitive Attributes
*/
@ -171,7 +176,7 @@ typedef struct {
typedef struct {
O_TAG;
/* 0x4 */ u_long code[15];
/* 0x4 */ u_long code[DR_ENV_CODE_SIZE];
} DR_ENV; /* Packed Drawing Environment, size = 0x40 */
typedef struct {

View File

@ -58,7 +58,9 @@ void DebugShowWaitInfo(const char* msg) {
VSync(0);
PutDrawEnv(&g_CurrentBuffer->draw);
PutDispEnv(&g_CurrentBuffer->disp);
#if !defined(VERSION_PSP)
FntFlush(-1);
#endif
}
void DebugInputWait(const char* msg) {

View File

@ -5,6 +5,21 @@ INCLUDE_ASM("dra_psp/psp/dra_psp/18210", func_psp_090F4B90);
INCLUDE_ASM("dra_psp/psp/dra_psp/18210", func_psp_090F4FC8);
INCLUDE_ASM("dra_psp/psp/dra_psp/18210", func_psp_090F5068);
extern s32 g_DebugWaitInfoTimer;
void DebugShowWaitInfo(const char* msg) {
g_CurrentBuffer = g_CurrentBuffer->next;
FntPrint(msg);
if (g_DebugWaitInfoTimer++ & 4) {
FntPrint("\no\n");
}
DrawSync(0);
VSync(0);
PutDrawEnv(&g_CurrentBuffer->draw);
PutDispEnv(&g_CurrentBuffer->disp);
#if !defined(VERSION_PSP)
FntFlush(-1);
#endif
}
INCLUDE_ASM("dra_psp/psp/dra_psp/18210", func_psp_090F50F8);