Decompile PSP version of func_801024DC (#1886)
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

Picked a random `.c` file from PSP to decompile.

This caused me to discover that this function requires `-O4,p`, which is
new. All the other -O4 files also match with this, which is good.

Also back-ported my changes to PS1.

Some tiny changes to the texture displaying tools that I made due to
xeeynamo finding a tiny bug; not worth a whole PR so I just tossed them
into this one.
This commit is contained in:
bismurphy 2024-11-08 15:11:45 -05:00 committed by GitHub
parent 4eca413d89
commit 9eb2d507b9
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
6 changed files with 63 additions and 20 deletions

View File

@ -80,12 +80,13 @@ $(BUILD_DIR)/%.s.o: %.s
@mkdir -p $(dir $@)
$(AS) $(AS_FLAGS) -o $@ $<
FILES_WITH_O4 = 61F30.c.o 63C90.c.o
OPTIMIZATION = $(if $(filter $(notdir $@),$(FILES_WITH_O4)), -O4, -Op)
FILES_WITH_O4 = 5DA0.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)
$(BUILD_DIR)/%.c.o: %.c $(MWCCPSP) $(MWCCGAP_APP)
@mkdir -p $(dir $@)
$(MWCCGAP) $< $@ --mwcc-path $(MWCCPSP) --use-wibo --wibo-path $(WIBO) --as-path $(AS) --asm-dir-prefix asm/pspeu $(OPTIMIZATION) $(MWCCPSP_FLAGS)
$(MWCCGAP) $< $@ --mwcc-path $(MWCCPSP) --use-wibo --wibo-path $(WIBO) --as-path $(AS) --asm-dir-prefix asm/pspeu $(MWCCPSP_FLAGS) $(OPTIMIZATION)
$(BUILD_DIR)/assets/%/mwo_header.bin.o: assets/%/mwo_header.bin
@mkdir -p $(dir $@)

View File

@ -7,6 +7,7 @@ AllocPrimitives = 0x090E0E30;
func_800EDD9C = 0x090E0F00;
FreePrimitives = 0x090E0FA8;
RenderPrimitives = 0x090E0FF8;
func_801024DC = 0x090E2720;
func_801027C4 = 0x090E29B0;
func_80102CD8 = 0x090E2EC8;
SetNextRoomToLoad = 0x090E73D0;
@ -95,6 +96,10 @@ CheckCollision = 0x09144C90;
g_ApiInit = 0x0914A628;
g_DraEntityTbl = 0x09183838;
g_SubwpnDefs = 0x09190EC8;
D_8013799C = 0x091CDC70;
D_801379A0 = 0x091CDC74;
D_801379A4 = 0x091CDC78;
D_801379A8 = 0x091CDC7C;
D_80097420 = 0x091CE620;
g_MenuNavigation = 0x091cefd0;
D_80097C98 = 0x091ed280;

View File

@ -2231,36 +2231,36 @@ extern s32 D_801379A8;
void func_801024DC(void) {
Primitive* prim;
Primitive* prim2;
s32 x;
D_8013799C = AllocPrimitives(PRIM_TILE, 4);
prim = &g_PrimBuf[D_8013799C];
for (x = 0; prim != 0; x++) {
prim->x0 = (x & 1) << 7;
for (x = 0; prim != NULL; x++) {
prim->x0 = (x & 1) * 128;
prim->u0 = 0x80;
prim->v0 = 0xF0;
prim->priority = 0x1FD;
prim->drawMode = DRAW_HIDE;
prim = prim->next;
}
D_801379A8 = 0;
D_801379A4 = 0;
D_801379A0 = AllocPrimitives(PRIM_GT4, 1);
prim2 = &g_PrimBuf[D_801379A0];
prim2->u1 = 0xFF;
prim2->v2 = 0xFF;
prim2->u3 = 0xFF;
prim2->v3 = 0xFF;
prim2->tpage = 0x1D;
prim2->clut = 0x1C0;
prim2->priority = 0x1FE;
prim2->u0 = 0;
prim2->v0 = 0;
prim = prim2;
prim = &g_PrimBuf[D_801379A0];
prim->u0 = 0;
prim->v0 = 0;
prim->u1 = 0xFF;
prim->v1 = 0;
prim->u2 = 0;
prim->v2 = 0xFF;
prim->u3 = 0xFF;
prim->v3 = 0xFF;
prim->tpage = 0x1D;
prim->clut = 0x1C0;
prim->priority = 0x1FE;
prim->drawMode = DRAW_HIDE;
}

View File

@ -1,8 +1,45 @@
// SPDX-License-Identifier: AGPL-3.0-or-later
#include "../dra/dra.h"
INCLUDE_ASM("dra_psp/psp/dra_psp/5DA0", func_psp_090E2720);
extern u32 D_8013799C;
extern s32 D_801379A0;
extern s32 D_801379A4;
extern s32 D_801379A8;
void func_801024DC(void) {
Primitive* prim;
s32 x;
D_8013799C = AllocPrimitives(PRIM_TILE, 4);
prim = &g_PrimBuf[D_8013799C];
for (x = 0; prim != NULL; x++) {
prim->x0 = (x & 1) * 128;
prim->u0 = 0x80;
prim->v0 = 0xF0;
prim->priority = 0x1FD;
prim->drawMode = DRAW_HIDE;
prim = prim->next;
}
D_801379A8 = 0;
D_801379A4 = 0;
D_801379A0 = AllocPrimitives(PRIM_GT4, 1);
prim = &g_PrimBuf[D_801379A0];
prim->u0 = 0;
prim->v0 = 0;
prim->u1 = 0xFF;
prim->v1 = 0;
prim->u2 = 0;
prim->v2 = 0xFF;
prim->u3 = 0xFF;
prim->v3 = 0xFF;
prim->tpage = 0x1D;
prim->clut = 0x1C0;
prim->priority = 0x1FE;
prim->drawMode = DRAW_HIDE;
}
INCLUDE_ASM("dra_psp/psp/dra_psp/5DA0", func_psp_090E2820);
INCLUDE_ASM("dra_psp/psp/dra_psp/5DA0", func_psp_090E2848);

View File

@ -84,7 +84,7 @@ def show_animset(ovl_name, anim_num, arg_palette, view_w, view_h, unk5A):
animdata = f.read().splitlines()
animarray = load_array_from_file(animdata, main_array)
anim_set_name = animarray[spritebank]
print(f"Animation set {anim_num} is {anim_set_name}. Loading.")
print(f"Animation set {spritebank} is {anim_set_name}. Loading.")
with open(animset_file) as f:
self.framesdata = f.read().splitlines()
print("Loading framearray")

View File

@ -85,7 +85,7 @@ def color_tpage(tpage, clut):
# Experimentally determined. For a tpage from 0x00 to 0x1F, get that tpage
# out of VRAM.
def get_tpage_by_number(raw_dump, tpage_num):
assert 0 < tpage_num < 0x20
assert 0 <= tpage_num < 0x20
tpage_row = tpage_num >= 0x10 # Row 0 or 1. First 16 are row 0, then row 1
tpage_top = tpage_row * 256 # rows are 256 pixels tall so this is where it starts
tpage_bottom = tpage_top + 256