mirror of
https://github.com/Xeeynamo/sotn-decomp.git
synced 2024-11-23 04:59:41 +00:00
Finish a .c file for DRA PSP (#1914)
More functions, lots of them are direct copies of the existing ones, or just tiny tweaks away. No de-duping at this stage since things are still pretty different.
This commit is contained in:
parent
1148580550
commit
b1c617a1dd
@ -82,8 +82,6 @@ segments:
|
||||
- [0x18210, c, dra_psp/18210]
|
||||
# Start of shared C. All prior C is PSP-exclusive.
|
||||
- [0x186E8, c, dra_psp/186E8]
|
||||
- [0x18920, c, dra_psp/18920]
|
||||
- [0x18BA0, c, dra_psp/18BA0]
|
||||
- [0x18BE0, c, dra_psp/18BE0]
|
||||
- [0x19AB0, c, dra_psp/19AB0]
|
||||
- [0x1A0D0, c, dra_psp/1A0D0]
|
||||
@ -186,7 +184,8 @@ segments:
|
||||
- [0x680C0, c, dra_psp/680C0]
|
||||
- [0x68D80, data]
|
||||
- [0x6DDE8, .data, dra_psp/186E8] # "\no\n"
|
||||
- [0x6DDF0, data]
|
||||
- [0x6DDF0, .data, dra_psp/186E8] # func_psp_090F5188 strings
|
||||
- [0x6DE50, data]
|
||||
- [0xEE380, .rodata, dra_psp/80]
|
||||
- [0xEE3A0, .rodata, dra/624DC]
|
||||
- [0xEE3C0, .rodata, dra_psp/60F8]
|
||||
|
@ -20,6 +20,12 @@ func_800F298C = 0x090e9018;
|
||||
DebugShowWaitInfo = 0x090f5068;
|
||||
DebugInputWait = 0x090f50f8;
|
||||
DebugUpdate = 0x090f5180;
|
||||
SetGPUBuffRGBZero = 0x090F5230;
|
||||
SetGPUBuffRGB = 0x090F5268;
|
||||
func_800E34DC = 0x090F52A0;
|
||||
SetStageDisplayBuffer = 0x090F5318;
|
||||
SetCgiDisplayBuffer = 0x090F53A8;
|
||||
SetMenuDisplayBuffer = 0x090F5440;
|
||||
MainGame = 0x090f5b58;
|
||||
HandleTitle = 0x090f6800;
|
||||
HandlePlay = 0x090f6b28;
|
||||
@ -116,6 +122,7 @@ g_DemoMode = 0x091fc420;
|
||||
D_800973EC = 0x091fc428;
|
||||
g_GameStep = 0x091fc448;
|
||||
g_GameState = 0x091fc450;
|
||||
g_GpuBuffers = 0x091FC4E8;
|
||||
g_sfxRingBufferWritePos = 0x09236b80;
|
||||
g_SfxRingBuffer = 0x09236b90;
|
||||
g_SoundCommandRingBufferWritePos = 0x09237190;
|
||||
|
@ -1,6 +1,7 @@
|
||||
abs = 0x08906AF0;
|
||||
memcpy = 0x08909F84;
|
||||
rand = 0x0890B954;
|
||||
psp_sprintf = 0x0890C6FC;
|
||||
DrawSync = 0x0891B448;
|
||||
VSync = 0x0891B5BC;
|
||||
LoadImage = 0x0891BFE4;
|
||||
@ -8,6 +9,8 @@ ClearImage = 0x0891CA60;
|
||||
ClearOTag = 0x0891D0E0;
|
||||
PutDrawEnv = 0x0891D484;
|
||||
PutDispEnv = 0x0891D68C;
|
||||
SetDefDrawEnv = 0x0891DCF4;
|
||||
SetDefDispEnv = 0x0891DDDC;
|
||||
FntPrint = 0x08925e98;
|
||||
SsSetMVol = 0x89261B4;
|
||||
SsUtSetReverbDepth = 0x89261D4;
|
||||
@ -21,6 +24,7 @@ ratan2 = 0x08927CFC;
|
||||
rcos = 0x08927E0C;
|
||||
rsin = 0x08927F2C;
|
||||
SsUtSetVVol = 0x0892F75C;
|
||||
D_psp_08B42060 = 0x08B42060;
|
||||
D_08C6BC30 = 0x08C6BC30;
|
||||
D_08C6BC34 = 0x08C6BC34;
|
||||
g_pStObjLayoutHorizontal = 0x08C6BC38;
|
||||
|
@ -1,3 +1,4 @@
|
||||
D_psp_08B42060 = 0x08B42060;
|
||||
D_08C6BC30 = 0x08C6BC30;
|
||||
D_08C6BC34 = 0x08C6BC34;
|
||||
g_pStObjLayoutHorizontal = 0x08C6BC38;
|
||||
|
@ -89,20 +89,24 @@ typedef enum {
|
||||
#define COLOR_LEN ((COLOR_BPP) / 8)
|
||||
#define PALETTE_LEN ((COLORS_PER_PAL) * ((COLOR_BPP) / 8))
|
||||
#define COLOR16(r, g, b, a) (r) + ((g) << 5) + ((b) << 10) + ((a) << 15)
|
||||
// PS1 and PSP use different values for these two
|
||||
// PS1 and PSP use different values for most of these.
|
||||
#ifndef VERSION_PSP
|
||||
#define OTSIZE 0x200
|
||||
#define MAXSPRT16 0x280
|
||||
#define MAX_DRAW_MODES 0x400
|
||||
#define MAX_POLY_GT4_COUNT 0x300
|
||||
#endif
|
||||
#ifdef VERSION_PSP
|
||||
#define OTSIZE 0x600
|
||||
#define MAXSPRT16 0x320
|
||||
// Very low confidence on these. These make GpuBuffer the right size.
|
||||
// More decomp will give proper sizes for individual members.
|
||||
#define MAX_DRAW_MODES 0x1F0
|
||||
#define MAX_POLY_GT4_COUNT 0x2F0
|
||||
#endif
|
||||
#define MAX_DRAW_MODES 0x400
|
||||
#define MAX_TILE_COUNT 0x100
|
||||
#define MAX_LINE_G2_COUNT 0x100
|
||||
#define MAX_POLY_GT3_COUNT 0x30
|
||||
#define MAX_POLY_GT4_COUNT 0x300
|
||||
#define MAX_POLY_G4_COUNT 0x100
|
||||
#define MAX_SPRT_COUNT 0x200
|
||||
#define MAX_ENV_COUNT 0x10
|
||||
|
@ -652,7 +652,7 @@ s32 LoadVabData(void) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
void func_800E346C(void) {
|
||||
void SetGPUBuffRGBZero(void) {
|
||||
g_GpuBuffers[0].draw.r0 = 0;
|
||||
g_GpuBuffers[0].draw.g0 = 0;
|
||||
g_GpuBuffers[0].draw.b0 = 0;
|
||||
@ -661,7 +661,7 @@ void func_800E346C(void) {
|
||||
g_GpuBuffers[1].draw.b0 = 0;
|
||||
}
|
||||
|
||||
void func_800E34A4(u8 arg0) {
|
||||
void SetGPUBuffRGB(u8 arg0) {
|
||||
g_GpuBuffers[0].draw.r0 = arg0;
|
||||
g_GpuBuffers[0].draw.g0 = arg0;
|
||||
g_GpuBuffers[0].draw.b0 = arg0;
|
||||
@ -681,7 +681,7 @@ void func_800E34DC(s32 arg0) {
|
||||
}
|
||||
g_GpuBuffers[1].draw.clip.h = 0x00CF;
|
||||
g_GpuBuffers[0].draw.isbg = g_GpuBuffers[1].draw.isbg = 1;
|
||||
func_800E346C();
|
||||
SetGPUBuffRGBZero();
|
||||
g_GpuBuffers[0].draw.dtd = g_GpuBuffers[1].draw.dtd = 0;
|
||||
g_GpuBuffers[0].disp.isrgb24 = g_GpuBuffers[1].disp.isrgb24 = 0;
|
||||
}
|
||||
@ -723,7 +723,7 @@ static void SetTitleDisplayBuffer(void) {
|
||||
g_GpuBuffers[0].draw.clip.y = 0;
|
||||
g_GpuBuffers[1].draw.isbg = 1;
|
||||
g_GpuBuffers[0].draw.isbg = 1;
|
||||
func_800E346C();
|
||||
SetGPUBuffRGBZero();
|
||||
g_GpuBuffers[1].disp.isrgb24 = 0;
|
||||
g_GpuBuffers[0].disp.isrgb24 = 0;
|
||||
}
|
||||
|
@ -984,7 +984,7 @@ void func_800F2404(s32 arg0) {
|
||||
D_80097448[0] = 0;
|
||||
D_80097448[1] = 0;
|
||||
D_80097450 = 0;
|
||||
func_800E346C();
|
||||
SetGPUBuffRGBZero();
|
||||
}
|
||||
|
||||
void func_800F24F4(void) {
|
||||
@ -1849,7 +1849,7 @@ void RunMainEngine(void) {
|
||||
if (g_StageId == STAGE_ST0) {
|
||||
SetGameState(Game_GameOver);
|
||||
ClearImage(&g_Vram.D_800ACDA0, 0xFF, 0xFF, 0xFF);
|
||||
func_800E34A4(-1);
|
||||
SetGPUBuffRGB(-1);
|
||||
DestroyEntitiesFromIndex(0);
|
||||
DestroyAllPrimitives();
|
||||
func_800EDAE4();
|
||||
@ -1865,7 +1865,7 @@ void RunMainEngine(void) {
|
||||
break;
|
||||
case 2:
|
||||
SetGameState(Game_GameOver);
|
||||
func_800E346C();
|
||||
SetGPUBuffRGBZero();
|
||||
break;
|
||||
}
|
||||
func_801028AC(0);
|
||||
|
@ -464,8 +464,8 @@ void SetRoomBackgroundLayer(s32 index, LayerDef* layerDef);
|
||||
void CheckCollision(s32 x, s32 y, Collider* res, s32 unk);
|
||||
void DemoInit(s32 arg0);
|
||||
void DemoUpdate(void);
|
||||
void func_800E346C(void);
|
||||
void func_800E34A4(u8 arg0);
|
||||
void SetGPUBuffRGBZero(void);
|
||||
void SetGPUBuffRGB(u8 arg0);
|
||||
void func_800E34DC(s32 arg0);
|
||||
void SetGameState(GameState gameState);
|
||||
void func_800E4970(void);
|
||||
|
@ -611,7 +611,7 @@ void HandlePrologueEnd(void) {
|
||||
if (func_80131F68() != 0) {
|
||||
PlaySfx(0x80);
|
||||
}
|
||||
func_800E346C();
|
||||
SetGPUBuffRGBZero();
|
||||
g_GameStep++;
|
||||
return;
|
||||
}
|
||||
|
@ -3412,7 +3412,7 @@ block_4:
|
||||
if (func_801025F4() == 0) {
|
||||
break;
|
||||
}
|
||||
func_800E346C();
|
||||
SetGPUBuffRGBZero();
|
||||
func_80102628(0x180);
|
||||
SetMenuDisplayBuffer();
|
||||
func_800FAC48();
|
||||
@ -3930,7 +3930,7 @@ block_4:
|
||||
if (g_pads[0].tapped & PAD_MENU_BACK_ALT) {
|
||||
func_801073C0();
|
||||
g_CdStep = CdStep_None;
|
||||
func_800E346C();
|
||||
SetGPUBuffRGBZero();
|
||||
func_80102628(0x180);
|
||||
SetMenuDisplayBuffer();
|
||||
func_800FAC48();
|
||||
|
@ -275,7 +275,7 @@ void HandlePlay(void) {
|
||||
prim->tpage = 0x110;
|
||||
prim = prim->next;
|
||||
}
|
||||
func_800E346C();
|
||||
SetGPUBuffRGBZero();
|
||||
g_GameStep++;
|
||||
break;
|
||||
case Play_WaitStageChr:
|
||||
@ -425,7 +425,7 @@ void HandleGameOver(void) {
|
||||
case Gameover_AllocResources:
|
||||
if (g_StageId != STAGE_ST0) {
|
||||
MoveImage(&g_CurrentBuffer->next->disp.disp, 0x300, 0);
|
||||
func_800E346C();
|
||||
SetGPUBuffRGBZero();
|
||||
g_GpuBuffers[1].draw.isbg = 1;
|
||||
g_GpuBuffers[0].draw.isbg = 1;
|
||||
D_8013640C = AllocPrimitives(PRIM_GT4, 259);
|
||||
|
@ -333,10 +333,88 @@ void DebugEditColorChannel(s32 colorAdd) {
|
||||
|
||||
#endif
|
||||
|
||||
INCLUDE_ASM("dra_psp/psp/dra_psp/186E8", DebugUpdate);
|
||||
s32 DebugUpdate() { return 1; }
|
||||
|
||||
INCLUDE_ASM("dra_psp/psp/dra_psp/186E8", func_psp_090F5188);
|
||||
extern s32 D_psp_08B42060;
|
||||
|
||||
INCLUDE_ASM("dra_psp/psp/dra_psp/186E8", func_psp_090F5230);
|
||||
s32 func_psp_090F5188(void) {
|
||||
char sp10[0x100];
|
||||
|
||||
INCLUDE_ASM("dra_psp/psp/dra_psp/186E8", func_psp_090F5268);
|
||||
psp_sprintf(&sp10, "%sSE/sd_j010.spk;1", D_psp_08B42060);
|
||||
func_892EAFC(&sp10, 0);
|
||||
psp_sprintf(&sp10, "%sSE/sd_alk.spk;1", D_psp_08B42060);
|
||||
func_892EAFC(&sp10, 1);
|
||||
psp_sprintf(&sp10, "%sSE/sd_mak.spk;1", D_psp_08B42060);
|
||||
func_892EAFC(&sp10, 2);
|
||||
psp_sprintf(&sp10, "%sSE/sd_rou.spk;1", D_psp_08B42060);
|
||||
func_892EAFC(&sp10, 3);
|
||||
return 0;
|
||||
}
|
||||
|
||||
void SetGPUBuffRGBZero(void) {
|
||||
g_GpuBuffers[0].draw.r0 = 0;
|
||||
g_GpuBuffers[0].draw.g0 = 0;
|
||||
g_GpuBuffers[0].draw.b0 = 0;
|
||||
g_GpuBuffers[1].draw.r0 = 0;
|
||||
g_GpuBuffers[1].draw.g0 = 0;
|
||||
g_GpuBuffers[1].draw.b0 = 0;
|
||||
}
|
||||
void SetGPUBuffRGB(u8 arg0) {
|
||||
g_GpuBuffers[0].draw.r0 = arg0;
|
||||
g_GpuBuffers[0].draw.g0 = arg0;
|
||||
g_GpuBuffers[0].draw.b0 = arg0;
|
||||
g_GpuBuffers[1].draw.r0 = arg0;
|
||||
g_GpuBuffers[1].draw.g0 = arg0;
|
||||
g_GpuBuffers[1].draw.b0 = arg0;
|
||||
}
|
||||
|
||||
void func_800E34DC(s32 arg0) {
|
||||
g_GpuBuffers[0].draw.clip.y = 0x0014;
|
||||
g_GpuBuffers[0].draw.clip.h = 0x00CF;
|
||||
g_GpuBuffers[1].draw.clip.y = 0x0014;
|
||||
g_GpuBuffers[1].draw.clip.h = 0x00CF;
|
||||
g_GpuBuffers[0].draw.isbg = g_GpuBuffers[1].draw.isbg = 1;
|
||||
SetGPUBuffRGBZero();
|
||||
g_GpuBuffers[0].draw.dtd = g_GpuBuffers[1].draw.dtd = 0;
|
||||
g_GpuBuffers[0].disp.isrgb24 = g_GpuBuffers[1].disp.isrgb24 = 0;
|
||||
}
|
||||
|
||||
void SetStageDisplayBuffer(void) {
|
||||
SetDefDrawEnv(&g_GpuBuffers[0].draw, 0, 0, DISP_STAGE_W, DISP_STAGE_H);
|
||||
SetDefDrawEnv(&g_GpuBuffers[1].draw, 0, 0, DISP_STAGE_W, DISP_STAGE_H);
|
||||
SetDefDispEnv(&g_GpuBuffers[0].disp, 0, 0, DISP_STAGE_W, DISP_STAGE_H);
|
||||
SetDefDispEnv(&g_GpuBuffers[1].disp, 0, 0, DISP_STAGE_W, DISP_STAGE_H);
|
||||
func_800E34DC(0);
|
||||
}
|
||||
|
||||
void SetCgiDisplayBuffer(s32 width) {
|
||||
SetDefDrawEnv(&g_GpuBuffers[0].draw, 0, 0, width, DISP_ALL_H);
|
||||
SetDefDrawEnv(&g_GpuBuffers[1].draw, 0, 0, width, DISP_ALL_H);
|
||||
SetDefDispEnv(&g_GpuBuffers[0].disp, 0, 0, width, DISP_ALL_H);
|
||||
SetDefDispEnv(&g_GpuBuffers[1].disp, 0, 0, width, DISP_ALL_H);
|
||||
func_800E34DC(1);
|
||||
}
|
||||
|
||||
void SetMenuDisplayBuffer(void) {
|
||||
SetDefDrawEnv(&g_GpuBuffers[0].draw, 0, 0, DISP_MENU_W, DISP_MENU_H);
|
||||
SetDefDrawEnv(&g_GpuBuffers[1].draw, 0, 0, DISP_MENU_W, DISP_MENU_H);
|
||||
SetDefDispEnv(&g_GpuBuffers[0].disp, 0, 0, DISP_MENU_W, DISP_MENU_H);
|
||||
SetDefDispEnv(&g_GpuBuffers[1].disp, 0, 0, DISP_MENU_W, DISP_MENU_H);
|
||||
func_800E34DC(1);
|
||||
g_GpuBuffers[0].draw.dtd = g_GpuBuffers[1].draw.dtd = 1;
|
||||
}
|
||||
|
||||
extern s32 D_psp_091CE1E8;
|
||||
void func_psp_090F54E0(void) {
|
||||
if (D_psp_091CE1E8 != 0) {
|
||||
func_891AEC8();
|
||||
D_psp_091CE1E8 = 0;
|
||||
}
|
||||
func_psp_090FA740();
|
||||
}
|
||||
|
||||
void func_psp_090F5520(void) {
|
||||
while (D_psp_091CE1E8 != 0) {
|
||||
func_8939EB8(1);
|
||||
}
|
||||
}
|
||||
|
@ -1,12 +0,0 @@
|
||||
// SPDX-License-Identifier: AGPL-3.0-or-later
|
||||
#include "../dra/dra.h"
|
||||
|
||||
INCLUDE_ASM("dra_psp/psp/dra_psp/18920", func_psp_090F52A0);
|
||||
|
||||
INCLUDE_ASM("dra_psp/psp/dra_psp/18920", func_psp_090F5318);
|
||||
|
||||
INCLUDE_ASM("dra_psp/psp/dra_psp/18920", func_psp_090F53A8);
|
||||
|
||||
INCLUDE_ASM("dra_psp/psp/dra_psp/18920", func_psp_090F5440);
|
||||
|
||||
INCLUDE_ASM("dra_psp/psp/dra_psp/18920", func_psp_090F54E0);
|
@ -1,4 +0,0 @@
|
||||
// SPDX-License-Identifier: AGPL-3.0-or-later
|
||||
#include "../dra/dra.h"
|
||||
|
||||
INCLUDE_ASM("dra_psp/psp/dra_psp/18BA0", func_psp_090F5520);
|
Loading…
Reference in New Issue
Block a user