DRA import 627C4 and 63ED4 data (#1037)

This commit is contained in:
Luciano Ciccariello 2024-02-05 23:39:41 +00:00 committed by GitHub
parent 78953c01aa
commit 5f3c92dc72
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
21 changed files with 749 additions and 307 deletions

View File

@ -83,8 +83,10 @@ segments:
- [0x2FCC, .data, 5D5BC] # g_CapePaletteDefs
- [0x301C, .data, 5D5BC] # g_CheatCodes
- [0x3024, .data, 5D5BC] # D_800A3014
- [0x3144, data, 627C4]
- [0x37E8, data]
- [0x3144, .data, 627C4] # D_800A3194
- [0x31C0, .data, 63ED4] # D_800A3210
- [0x3340, .data, 63ED4] # D_800A33A0-D_800A35D0
- [0x37E8, .data, 63ED4] # Palette, GFX desc until D_800A3BB8
- [0x3C50, .data, lba_stage]
- [0x4A10, .data, config_jp]
- [0xC72C, data]
@ -103,7 +105,12 @@ segments:
- [0x1D2E8, data, assets, music_xa, g_XaMusicConfigs] # g_XaMusicConfigs
- [0x1F5F8, assets, sfx, g_SfxData] # g_SfxData
- [0x20A20, .data, 953A0]
- [0x22220, data]
- [0x22220, cmp, D_800C217C]
- [0x22854, cmp, D_800C27B0]
- [0x23604, cmp, D_800C3560]
- [0x24908, cmp, D_800C4864]
- [0x24B34, cmp, D_800C4A90]
- [0x24D90, data]
- [0x253C8, raw, g_GfxEquipIcon]
- [0x2F3C8, data]
- [0x38978, raw, g_PalEquipIcon]

View File

@ -81,9 +81,10 @@ segments:
- [0x2FBC, .data, 5D5BC] # g_CapePaletteDefs
- [0x300C, .data, 5D5BC] # g_CheatCodes
- [0x3014, .data, 5D5BC] # D_800A3014
- [0x3134, data, 627C4]
- [0x31B0, data, 63ED4]
- [0x37D8, data]
- [0x3134, .data, 627C4] # D_800A3194
- [0x31B0, .data, 63ED4] # D_800A3210
- [0x3330, .data, 63ED4] # D_800A33A0-D_800A35D0
- [0x37D8, .data, 63ED4] # Palette, GFX desc until D_800A3BB8
- [0x3C40, .data, lba_stage]
- [0x4A00, .data, config_us] # subweapons
- [0x4B04, .data, config_us] # equipments
@ -116,8 +117,12 @@ segments:
- [0x1D224, assets, music_xa, g_XaMusicConfigs]
- [0x1F554, assets, sfx, g_SfxData]
- [0x2097C, .data, 953A0]
- [0x2217C, data]
- [0x227B0, data]
- [0x2217C, cmp, D_800C217C]
- [0x227B0, cmp, D_800C27B0]
- [0x23560, cmp, D_800C3560]
- [0x24864, cmp, D_800C4864]
- [0x24A90, cmp, D_800C4A90]
- [0x24CEC, data]
- [0x25324, raw, g_GfxEquipIcon]
- [0x2F324, data]
- [0x388D4, raw, g_PalEquipIcon]

View File

@ -3,20 +3,10 @@ g_CapePaletteDefs = 0x800A2FCC;
g_CheatCodes = 0x800A301C;
D_800A3014 = 0x800A3024;
D_800A3194 = 0x800A31A4;
D_800A3210_hd = 0x800A3210;
D_800A3210 = 0x800A3220;
D_800A33A0_hd = 0x800A33A0;
D_800A33A0 = 0x800A33B0;
D_800A34C0 = 0x800A34D0;
D_800A3598 = 0x800A35A8;
D_800A35D0 = 0x800A35E0;
D_800A3608 = 0x800A3618;
D_800A3728 = 0x800A3738;
D_800A37B8 = 0x800A37C8;
D_800A37D8 = 0x800A37E8;
g_JosephsCloak = 0x800A37EC;
D_800A3B4C = 0x800A3B5C;
g_GfxSharedBank = 0x800A3B6C;
D_800A3B70 = 0x800A3B80;
D_800A3BB8 = 0x800A3BC8;
g_ExpNext = 0x800AC72C;
g_Vram = 0x800ACE48;
@ -113,10 +103,54 @@ D_800BD228 = 0x800BD2EC;
D_800BD22D = 0x800BD2F1;
D_800BD240 = 0x800BD304;
g_SfxData = 0x800BF5F8;
D_800C217C = 0x800C2220;
D_800C27B0 = 0x800C2854;
D_800C3560 = 0x800C3604;
D_800C4864 = 0x800C4908;
D_800C4A90 = 0x800C4B34;
D_800C52F8 = 0x800C539C;
g_GfxEquipIcon = 0x800C53C8;
D_800CF324 = 0x800CF3C8;
D_800CFE48 = 0x800CFEEC;
D_800CFF10 = 0x800CFFB4;
D_800D0F68 = 0x800D100C;
D_800D2BF4 = 0x800D2C98;
D_800D2CF8 = 0x800D2D9C;
D_800D2FFC = 0x800D30A0;
D_800D327C = 0x800D3320;
D_800D3428 = 0x800D34CC;
D_800D34B8 = 0x800D355C;
D_800D372C = 0x800D37D0;
D_800D3B88 = 0x800D3C2C;
D_800D5628 = 0x800D56CC;
D_800D56AC = 0x800D5750;
D_800D5868 = 0x800D590C;
D_800D68D4_hd = 0x800D68D4;
D_800D684C = 0x800D68F0;
D_800D68D4 = 0x800D6978;
D_800D68F4 = 0x800D6998;
D_800D6914 = 0x800D69B8;
D_800D6934 = 0x800D69D8;
D_800D6954 = 0x800D69F8;
D_800D6974 = 0x800D6A18;
D_800D6994 = 0x800D6A38;
D_800D69B4 = 0x800D6A58;
D_800D69D4 = 0x800D6A78;
D_800D69F4 = 0x800D6A98;
D_800D6A14 = 0x800D6AB8;
D_800D6A34 = 0x800D6AD8;
D_800D6AD4 = 0x800D6B78;
D_800D6B54 = 0x800D6BF8;
D_800D6C14 = 0x800D6CB8;
D_800D6CD4 = 0x800D6D78;
D_800D6ED4 = 0x800D6F78;
D_800D70D4 = 0x800D7178;
D_800D72D4 = 0x800D7378;
g_PalEquipIcon = 0x800D8978;
D_800DB0D4 = 0x800DB178;
D_800DB0F4 = 0x800DB198;
D_800DB114 = 0x800DB1B8;
D_800DB1F4 = 0x800DB298;
D_800DB3B0 = 0x800DB454;
D_800DBFFC = 0x800DBFFC; // ignore:true
aLightTimer02x = 0x800E1D64;
@ -228,8 +262,6 @@ EntitySubwpnThrownDagger = 0x80124814;
EntitySubwpnThrownAxe = 0x80124FBC;
EntityHolyWaterBreakGlass = 0x80125AF4;
EntitySubwpnCrashCross = 0x8012643C;
DraPrimDecreaseBrightness = 0x80128848;
func_801291C4 = 0x80128E50;
func_80129864 = 0x801294F0;
EntitySummonSpirit = 0x80129D30;
EntityStopWatch = 0x8012A528;

View File

@ -803,6 +803,9 @@ g_CurrentEntity = 0x8006C3B8;
g_Servant = 0x8006CBC4;
_svm_tn = 0x8006CBC8;
g_Clut = 0x8006CBCC;
D_8006ED0C = 0x8006ED0C;
D_8006ED2C = 0x8006ED2C;
D_8006ED4C = 0x8006ED4C;
g_Player = 0x80072BD0;
g_Player_padPressed = 0x80072EE8;
g_Player_padTapped = 0x80072EEC;

View File

@ -1,9 +1,4 @@
g_CheatCodes = 0x800A300C;
g_JosephsCloak = 0x800A37DC;
g_JosephsCloak_liningLight = 0x800A37DE;
g_JosephsCloak_exteriorDark = 0x800A37E0;
g_JosephsCloak_exteriorLight = 0x800A37E2;
g_GfxSharedBank = 0x800A3B5C;
g_Vram = 0x800ACD80;
g_Vram_D_800ACD88 = 0x800ACD88;
g_Vram_D_800ACD90 = 0x800ACD90;

View File

@ -838,6 +838,9 @@ g_CurrentEntity = 0x8006C3B8;
g_Servant = 0x8006CBC4;
_svm_tn = 0x8006CBC8;
g_Clut = 0x8006CBCC;
D_8006ED0C = 0x8006ED0C;
D_8006ED2C = 0x8006ED2C;
D_8006ED4C = 0x8006ED4C;
g_Player = 0x80072BD0;
g_Player_padPressed = 0x80072EE8;
g_Player_padTapped = 0x80072EEC;

View File

@ -338,14 +338,6 @@ typedef enum {
STAGE_MEMORYCARD = 0xFF,
} Stages;
typedef enum {
GFX_BANK_NONE,
GFX_BANK_4BPP,
GFX_BANK_8BPP,
GFX_BANK_16BPP,
GFX_BANK_COMPRESSED,
} GfxBankKind;
typedef enum {
// Clean-up and reset all the gameplay related memory
Play_Reset = 0,
@ -671,10 +663,20 @@ typedef struct {
/* 0x20 */ u32 env;
} GpuUsage;
typedef enum {
GFX_BANK_NONE,
GFX_BANK_4BPP,
GFX_BANK_8BPP,
GFX_BANK_16BPP,
GFX_BANK_COMPRESSED,
} GfxBankKind;
#define GFX_TERMINATE() ((u_long*)-1) // can't be in GfxBankKind
#define GFX_ENTRY(x, y, w, h, data) \
(u_long*)((x) | ((y) << 16)), (u_long*)((w) | ((h) << 16)), (u_long*)data
typedef struct {
/* 0x00 */ u32 xy;
/* 0x04 */ u32 wh;
/* 0x08 */ void* data;
/* 0x00 */ u_long* xy;
/* 0x04 */ u_long* wh;
/* 0x08 */ u_long* data;
} GfxEntry; // size=0xC
typedef struct {
@ -1549,12 +1551,12 @@ extern Entity* g_CurrentEntity;
extern Unkstruct_8006C3C4 D_8006C3C4[32];
extern s32 g_Servant; // Currently selected familiar in the menu
extern u16 g_Clut[0x3000];
extern u32 D_8006EBCC;
extern u16 D_8006EBE0;
extern u16 D_8006F3CC[];
extern u16 D_8006F42C[];
extern s16 D_800705CC[];
extern u32 D_80070BCC;
extern u16 D_8006EBCC[0x1000]; // part of g_Clut
extern u16 D_8006EBE0; // part of g_Clut
extern u16 D_8006F3CC[]; // part of g_Clut
extern u16 D_8006F42C[]; // part of g_Clut
extern s16 D_800705CC[]; // part of g_Clut
extern u32 D_80070BCC; // part of g_Clut
extern PlayerState g_Player;
extern u16 g_Player_D_80072EF6; // TODO merge with g_Player

View File

@ -27,12 +27,24 @@ typedef struct {
#define GET_PAL_OP_KIND(x) (LOH(x))
#define GET_PAL_OP_FREQ(x) (HIH(x))
#define PAL_COPY 1
#define PAL_COPY_INFO() MAKE_PAL_OP(PAL_COPY, 0)
#define PAL_COPY_DATA(dst, data) (dst), (u_long*)LEN(data), (u_long*)(data)
#define PAL_UNK_OP2 2
#define PAL_UNK_OP2_INFO(dst, n) (u_long*)(dst), (u_long*)(n)
#define PAL_UNK_OP2_DATA(data) (u_long*)(data)
#define PAL_UNK_OP3 3
#define PAL_UNK_OP3_INFO(dst, n) (u_long*)(dst), (u_long*)(n)
#define PAL_UNK_OP3_DATA(data) (u_long*)(data)
#define PAL_GLOW_ANIM 4
#define PAL_GLOW_INFO(dst, n) (u_long*)(dst), (u_long*)(n)
#define PAL_GLOW_DATA(data) (u_long*)(data)
#define PAL_BULK_COPY 5
#define PAL_BULK(dst, n, data) (u_long*)(dst), (u_long*)(n), (u_long*)(data)
#define PAL_BULK(dst, data) (u_long*)(dst), (u_long*)LEN(data), (u_long*)(data)
#define PAL_TERMINATE() ((u_long*)-1)
@ -110,11 +122,6 @@ typedef struct Unkstruct_801C3F9C {
/* 0x2C */ s16 unk2C;
} Unkstruct_801C3F9C;
typedef struct {
u16 D_800A37D8;
u16 D_800A37DA;
} Unkstruct_801092E8;
typedef struct {
s32 D_8003C908;
s32 D_8003C90C;

View File

@ -341,8 +341,8 @@ void LoadPendingGfx(void) {
s32 j;
u32 xy;
u32 wh;
u8* cmp;
u8* src;
u8* src2;
u8* dst;
s32 over;
GfxLoad* gfxLoad;
@ -358,10 +358,10 @@ void LoadPendingGfx(void) {
case GFX_BANK_8BPP:
case GFX_BANK_16BPP:
for (gfxEntry = gfxLoad->next; gfxEntry->xy != -1; gfxEntry++) {
xy = gfxEntry->xy;
wh = gfxEntry->wh;
src2 = gfxEntry->data;
LoadTPage(src2, gfxLoad->kind - 1, 0, xy >> 0x10, (u16)xy,
xy = (u32)gfxEntry->xy;
wh = (u32)gfxEntry->wh;
src = (u8*)gfxEntry->data;
LoadTPage(src, gfxLoad->kind - 1, 0, xy >> 0x10, (u16)xy,
wh >> 0x10, (u16)wh);
}
gfxLoad->kind = GFX_BANK_NONE;
@ -370,12 +370,12 @@ void LoadPendingGfx(void) {
gfxEntry = gfxLoad->next;
for (; j < 4; j++) {
dst = g_Pix[j];
xy = gfxEntry->xy;
wh = gfxEntry->wh;
src = gfxEntry->data;
over = DecompressData(dst, src);
xy = (u32)gfxEntry->xy;
wh = (u32)gfxEntry->wh;
cmp = (u8*)gfxEntry->data;
over = DecompressData(dst, cmp);
if (over) {
sprintf(buf, "over:%08x(%04x)", src, over);
sprintf(buf, "over:%08x(%04x)", cmp, over);
DebugInputWait(buf);
}
LoadTPage(dst, 0, 0, xy >> 0x10, (u16)xy, wh >> 0x10, (u16)wh);

View File

@ -3,6 +3,29 @@
#include "objects.h"
#include "sfx.h"
#define COORD_TERMINATOR 0x7FFF
u16 D_800A3134[] = {
3, -3, 2, -2, 1, -1, COORD_TERMINATOR,
};
u16 D_800A3144[] = {
3, -3, 3, -3, 2, -2, 2, -2, 1, -1, 1, -1, COORD_TERMINATOR,
};
u16 D_800A3160[] = {
+6, -6, +6, -6, +5,
-5, +5, -5, +4, -4,
+4, -4, +3, -3, +3,
-3, +2, -2, +2, -2,
+1, -1, +1, -1, COORD_TERMINATOR,
};
u16* D_800A3194[] = {
D_800A3134, D_800A3134, D_800A3144, D_800A3134,
D_800A3144, D_800A3144, D_800A3160,
};
extern s32 D_801379A4;
extern s32 D_801379A8;
@ -183,7 +206,8 @@ void func_80102CD8(s32 start) {
void func_80102D08(void) {
D_801379AC.unk8 = D_801379AC.coords[D_801379AC.current];
if (D_801379AC.coords[++D_801379AC.current] == 0x7FFF) {
D_801379AC.current++;
if (D_801379AC.coords[D_801379AC.current] == COORD_TERMINATOR) {
D_801379AC.start = 0;
D_801379AC.unk8 = 0;
}

View File

@ -2,6 +2,474 @@
#include "objects.h"
#include "sfx.h"
SVECTOR D_800A31B0 = {34, 0xFFEE, 0xFFF5};
SVECTOR D_800A31B8 = {21, 18, 0xFFE3};
SVECTOR D_800A31C0 = {0, 0xFFEE, 0xFFDC};
SVECTOR D_800A31C8 = {0, 0xFFD8, 0};
SVECTOR D_800A31D0 = {21, 0xFFEE, 29};
SVECTOR D_800A31D8 = {34, 18, 11};
SVECTOR D_800A31E0 = {0, 40, 0};
SVECTOR D_800A31E8 = {0, 18, 36};
SVECTOR D_800A31F0 = {0xFFDE, 0xFFEE, 0xFFF5};
SVECTOR D_800A31F8 = {0xFFEB, 18, 0xFFE3};
SVECTOR D_800A3200 = {0xFFEB, 0xFFEE, 0x001D};
SVECTOR D_800A3208 = {0xFFDE, 18, 11};
SVECTOR* D_800A3210[][3] = {
{&D_800A31C8, &D_800A31B0, &D_800A31C0},
{&D_800A31C8, &D_800A31C0, &D_800A31F0},
{&D_800A31F0, &D_800A31C0, &D_800A31F8},
{&D_800A31C8, &D_800A31F0, &D_800A3200},
{&D_800A31D0, &D_800A31B0, &D_800A31C8},
{&D_800A31C0, &D_800A31B0, &D_800A31B8},
{&D_800A31D0, &D_800A31D8, &D_800A31B0},
{&D_800A31F0, &D_800A3208, &D_800A3200},
{&D_800A31B0, &D_800A31D8, &D_800A31B8},
{&D_800A31D0, &D_800A31C8, &D_800A3200},
{&D_800A31F8, &D_800A31C0, &D_800A31B8},
{&D_800A31F0, &D_800A31F8, &D_800A3208},
{&D_800A3208, &D_800A31F8, &D_800A31E0},
{&D_800A31E8, &D_800A31D8, &D_800A31D0},
{&D_800A3208, &D_800A31E8, &D_800A3200},
{&D_800A31D8, &D_800A31E0, &D_800A31B8},
{&D_800A31E8, &D_800A31D0, &D_800A3200},
{&D_800A31E0, &D_800A31F8, &D_800A31B8},
{&D_800A31E8, &D_800A31E0, &D_800A31D8},
{&D_800A3208, &D_800A31E0, &D_800A31E8},
{&D_800A31E8, &D_800A31E8, &D_800A3200},
{&D_800A31E0, &D_800A31E0, &D_800A31B8},
{&D_800A31E8, &D_800A31E0, &D_800A31E8},
{&D_800A31E8, &D_800A31E0, &D_800A31E0},
};
SVECTOR D_800A3330 = {0xFFF1, 0xFFD2, 0x000A};
SVECTOR D_800A3338 = {0xFFE7, 0xFFEB, 0xFFF6};
SVECTOR D_800A3340 = {0xFFE7, 0xFFEB, 0x000A};
SVECTOR D_800A3348 = {0xFFF4, 0x0032, 0xFFF6};
SVECTOR D_800A3350 = {0xFFF4, 0x0032, 0x000A};
SVECTOR D_800A3358 = {0x0000, 0xFFF7, 0xFFF6};
SVECTOR D_800A3360 = {0xFFF1, 0xFFD2, 0xFFF6};
SVECTOR D_800A3368 = {0x000F, 0xFFD2, 0xFFF6};
SVECTOR D_800A3370 = {0x000C, 0x0032, 0xFFF6};
SVECTOR D_800A3378 = {0x0019, 0xFFEB, 0x000A};
SVECTOR D_800A3380 = {0x000F, 0xFFD2, 0x000A};
SVECTOR D_800A3388 = {0x0019, 0xFFEB, 0xFFF6};
SVECTOR D_800A3390 = {0x000C, 0x0032, 0x000A};
SVECTOR D_800A3398 = {0x0000, 0xFFF7, 0x000A};
SVECTOR* D_800A33A0[][3] = {
{&D_800A3380, &D_800A3368, &D_800A3360},
{&D_800A3380, &D_800A3360, &D_800A3330},
{&D_800A3330, &D_800A3360, &D_800A3338},
{&D_800A3380, &D_800A3330, &D_800A3398},
{&D_800A3378, &D_800A3368, &D_800A3380},
{&D_800A3360, &D_800A3368, &D_800A3358},
{&D_800A3378, &D_800A3388, &D_800A3368},
{&D_800A3330, &D_800A3340, &D_800A3398},
{&D_800A3368, &D_800A3388, &D_800A3358},
{&D_800A3378, &D_800A3380, &D_800A3398},
{&D_800A3338, &D_800A3360, &D_800A3358},
{&D_800A3330, &D_800A3338, &D_800A3340},
{&D_800A3340, &D_800A3338, &D_800A3348},
{&D_800A3390, &D_800A3388, &D_800A3378},
{&D_800A3340, &D_800A3350, &D_800A3398},
{&D_800A3388, &D_800A3370, &D_800A3358},
{&D_800A3390, &D_800A3378, &D_800A3398},
{&D_800A3348, &D_800A3338, &D_800A3358},
{&D_800A3390, &D_800A3370, &D_800A3388},
{&D_800A3340, &D_800A3348, &D_800A3350},
{&D_800A3350, &D_800A3390, &D_800A3398},
{&D_800A3370, &D_800A3348, &D_800A3358},
{&D_800A3350, &D_800A3370, &D_800A3390},
{&D_800A3350, &D_800A3348, &D_800A3370},
};
SVECTOR* D_800A34C0[][3] = {
{&D_800A3330, &D_800A3340, &D_800A3398},
{&D_800A3340, &D_800A3350, &D_800A3398},
{&D_800A3350, &D_800A3390, &D_800A3398},
{&D_800A3390, &D_800A3378, &D_800A3398},
{&D_800A3378, &D_800A3380, &D_800A3398},
{&D_800A3380, &D_800A3330, &D_800A3398},
{&D_800A3338, &D_800A3360, &D_800A3358},
{&D_800A3360, &D_800A3368, &D_800A3358},
{&D_800A3368, &D_800A3388, &D_800A3358},
{&D_800A3388, &D_800A3370, &D_800A3358},
{&D_800A3370, &D_800A3348, &D_800A3358},
{&D_800A3348, &D_800A3338, &D_800A3358},
{&D_800A3330, &D_800A3360, &D_800A3338},
{&D_800A3340, &D_800A3338, &D_800A3348},
{&D_800A3350, &D_800A3348, &D_800A3370},
{&D_800A3390, &D_800A3370, &D_800A3388},
{&D_800A3378, &D_800A3388, &D_800A3368},
{&D_800A3380, &D_800A3368, &D_800A3360},
};
SVECTOR* D_800A3598[] = {
&D_800A31F0, &D_800A31F8, &D_800A3208, &D_800A31E0, &D_800A31E8,
&D_800A31B8, &D_800A31C0, &D_800A31B0, &D_800A31E0, &D_800A31D0,
&D_800A31C8, &D_800A31D8, &D_800A31E8, &D_800A3200,
};
SVECTOR* D_800A35D0[] = {
&D_800A3330, &D_800A3338, &D_800A3340, &D_800A3348, &D_800A3350,
&D_800A3358, &D_800A3360, &D_800A3368, &D_800A3370, &D_800A3378,
&D_800A3380, &D_800A3388, &D_800A3390, &D_800A3398,
};
extern SVECTOR D_80137E70[14];
SVECTOR* D_800A3608[] = {
&D_80137E70[10], &D_80137E70[7], &D_80137E70[6], &D_80137E70[10],
&D_80137E70[6], &D_80137E70[0], &D_80137E70[0], &D_80137E70[6],
&D_80137E70[1], &D_80137E70[10], &D_80137E70[0], &D_80137E70[13],
&D_80137E70[9], &D_80137E70[7], &D_80137E70[10], &D_80137E70[6],
&D_80137E70[7], &D_80137E70[5], &D_80137E70[9], &D_80137E70[11],
&D_80137E70[7], &D_80137E70[0], &D_80137E70[2], &D_80137E70[13],
&D_80137E70[7], &D_80137E70[11], &D_80137E70[5], &D_80137E70[9],
&D_80137E70[10], &D_80137E70[13], &D_80137E70[1], &D_80137E70[6],
&D_80137E70[5], &D_80137E70[0], &D_80137E70[1], &D_80137E70[2],
&D_80137E70[2], &D_80137E70[1], &D_80137E70[3], &D_80137E70[12],
&D_80137E70[11], &D_80137E70[9], &D_80137E70[2], &D_80137E70[4],
&D_80137E70[13], &D_80137E70[11], &D_80137E70[8], &D_80137E70[5],
&D_80137E70[12], &D_80137E70[9], &D_80137E70[13], &D_80137E70[3],
&D_80137E70[1], &D_80137E70[5], &D_80137E70[12], &D_80137E70[8],
&D_80137E70[11], &D_80137E70[2], &D_80137E70[3], &D_80137E70[4],
&D_80137E70[4], &D_80137E70[12], &D_80137E70[13], &D_80137E70[8],
&D_80137E70[3], &D_80137E70[5], &D_80137E70[4], &D_80137E70[8],
&D_80137E70[12], &D_80137E70[4], &D_80137E70[3], &D_80137E70[8],
};
u8 D_800A3728[] = {
0x01, 0x7E, 0x3E, 0x68, 0x01, 0x68, 0x01, 0x7E, 0x3E, 0x68, 0x3E, 0x7F,
0x01, 0x7E, 0x3E, 0x68, 0x01, 0x68, 0x71, 0x71, 0x7E, 0x7E, 0x71, 0x7E,
0x01, 0x7E, 0x3E, 0x68, 0x3E, 0x7F, 0x0C, 0x03, 0x2A, 0x03, 0x1B, 0x2A,
0x01, 0x7E, 0x3E, 0x68, 0x01, 0x68, 0x71, 0x71, 0x7E, 0x7E, 0x71, 0x7E,
0x2A, 0x03, 0x36, 0x1E, 0x1B, 0x2A, 0x71, 0x71, 0x7E, 0x7E, 0x71, 0x7E,
0x01, 0x1E, 0x0C, 0x03, 0x1B, 0x2A, 0x01, 0x7E, 0x3E, 0x68, 0x3E, 0x7F,
0x01, 0x7E, 0x3E, 0x68, 0x01, 0x68, 0x01, 0x7E, 0x3E, 0x68, 0x3E, 0x7F,
0x71, 0x71, 0x7E, 0x7E, 0x71, 0x7E, 0x36, 0x1E, 0x27, 0x65, 0x1B, 0x2A,
0x71, 0x71, 0x7E, 0x7E, 0x71, 0x7E, 0x0F, 0x65, 0x01, 0x1E, 0x1B, 0x2A,
0x01, 0x7E, 0x3E, 0x68, 0x01, 0x68, 0x01, 0x7E, 0x3E, 0x68, 0x3E, 0x7F,
0x71, 0x71, 0x7E, 0x7E, 0x71, 0x7E, 0x27, 0x65, 0x0F, 0x65, 0x1B, 0x2A,
0x01, 0x7E, 0x3E, 0x68, 0x3E, 0x7F, 0x01, 0x7E, 0x3E, 0x68, 0x01, 0x68,
};
MATRIX D_800A37B8 = {0};
u16 D_800A37D8[] = {0x8430, 0x843F};
u16 g_JosephsCloakColors[] = {0x8000, 0x8000, 0x8000, 0x8000};
u16 D_800A37E4[] = {0x8430, 0x843F};
u16 D_800A37E8[] = {0xD5CE, 0xE739};
u16 D_800A37EC[] = {0xBEBB, 0xFFFF};
u16 D_800A37F0[] = {0x8594, 0x873F};
u16 D_800A37F4[] = {0x994A, 0xA5CE, 0x8421, 0x9CE7};
u16 D_800A37FC[] = {0x8420, 0x8427};
u16 D_800A3800[] = {0x8421, 0x9CE7};
u16 D_800A3804[] = {0xA4A8, 0xAD0A, 0xCC21, 0xFC42};
u16 D_800A380C[] = {0x910C, 0x996E, 0x8048, 0x80B2};
u16 D_800A3814[] = {0x90A1, 0x9102, 0xA821, 0xCC42};
u16 D_800A381C[] = {0x90C9, 0x94EB, 0x85E4, 0xA2CD};
u16 D_800A3824[] = {0x842C, 0x8C6F, 0x8018, 0x98DD};
u16 D_800A382C[] = {0x994A, 0xA5CE, 0x0000, 0xBC0F};
u16 D_800A3834[] = {0x8433, 0x843A};
u16 D_800A3838[] = {0x0000, 0x0000, 0x0000, 0x0000};
u16 D_800A3840[] = {0xCC21, 0xFC42, 0xA4A8, 0xAD0A};
extern u16 D_8006ED0C[0x10];
extern u16 D_8006ED2C[0x10];
extern u16 D_8006ED4C[0x10];
extern u8 D_800C217C[]; // external file
extern u8 D_800C27B0[]; // external file
extern u8 D_800C3560[]; // external file
extern u8 D_800C4864[]; // external file
extern u8 D_800C4A90[]; // external file
extern u16 D_800D68D4[0x10];
extern u16 D_800D68F4[0x10];
extern u16 D_800D6914[0x10];
extern u16 D_800D6934[0x10];
extern u16 D_800D6954[0x10];
extern u16 D_800D6974[0x10];
extern u16 D_800D6994[0x10];
extern u16 D_800D69B4[0x10];
extern u16 D_800D69D4[0x10];
extern u16 D_800D69F4[0x10];
extern u16 D_800D6A14[0x10];
extern u16 D_800D6A34[0x10];
extern u16 D_800D6A54[0x40]; // UNUSED
extern u16 D_800D6AD4[0x100];
extern u16 D_800D6B54[0x10]; // overlaps with D_800D6AD4?
extern u16 D_800D6C14[0x60]; // overlaps with D_800D6AD4?
extern u16 D_800D6CD4[0x100];
extern u16 D_800D6ED4[0x100];
extern u16 D_800D70D4[0x100];
extern u16 D_800D72D4[0x100];
extern u16 D_800DB0D4[0x10];
extern u16 D_800DB0F4[0x10];
extern u16 D_800DB114[0x70];
extern u16 D_800DB1F4[0xE0];
u_long* D_800A3848[] = {GFX_TERMINATE()};
u_long* D_800A384C[] = {
GFX_BANK_COMPRESSED,
GFX_ENTRY(256, 800, 128, 128, D_800C217C),
GFX_TERMINATE(),
};
u_long* D_800A3860[] = {
GFX_BANK_COMPRESSED,
GFX_ENTRY(256, 800, 128, 128, D_800C3560),
GFX_ENTRY(368, 992, 16, 80, D_800C4A90),
GFX_TERMINATE(),
};
u_long* D_800A3880[] = {
GFX_BANK_COMPRESSED,
GFX_ENTRY(256, 800, 128, 128, D_800C27B0),
GFX_ENTRY(368, 992, 16, 80, D_800C4864),
GFX_TERMINATE(),
};
u16 D_800A38A0[] = {
0x0000, 0xA108, 0xC210, 0xCA92, 0xD294, 0xDF97, 0xE739, 0xF39C,
0xFBDE, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
};
u_long* D_800A38C0[] = {
PAL_COPY_INFO(),
PAL_COPY_DATA(0x1A10, D_800A38A0),
PAL_TERMINATE(),
};
u_long* D_800A38D4[] = {
MAKE_PAL_OP(PAL_GLOW_ANIM, 6),
PAL_GLOW_INFO(0x1721, 1),
PAL_GLOW_DATA(&D_800A37E4[0]),
PAL_GLOW_DATA(&D_800A37E4[1]),
PAL_TERMINATE(),
};
u_long* D_800A38EC[] = {
PAL_COPY_INFO(),
PAL_COPY_DATA(0x171E, D_800A37E8),
};
u_long* D_800A38FC[] = {
PAL_COPY_INFO(),
PAL_COPY_DATA(0x171E, D_800A37EC),
};
u_long* D_800A390C[] = {
PAL_COPY_INFO(),
PAL_COPY_DATA(0x171E, D_800A37F0),
};
u_long* D_800A391C[] = {
MAKE_PAL_OP(PAL_UNK_OP3, 4),
PAL_UNK_OP3_INFO(0x1700, LEN(D_800D68D4)),
PAL_UNK_OP3_DATA(D_800D68D4),
PAL_UNK_OP3_DATA(D_800D68F4),
PAL_TERMINATE(),
};
u_long* D_800A3934[] = {
MAKE_PAL_OP(PAL_UNK_OP3, 4), PAL_UNK_OP3_INFO(0x1600, LEN(D_800D6AD4)),
PAL_UNK_OP3_DATA(D_800D6AD4), PAL_UNK_OP3_DATA(D_800D6CD4),
PAL_UNK_OP3_DATA(D_800D6ED4), PAL_UNK_OP3_DATA(D_800D70D4),
PAL_UNK_OP3_DATA(D_800D72D4), PAL_TERMINATE(),
};
u_long* D_800A3958[] = {
MAKE_PAL_OP(PAL_UNK_OP3, 4), PAL_UNK_OP3_INFO(0x17E0, LEN(D_800D6914)),
PAL_UNK_OP3_DATA(D_800D6914), PAL_UNK_OP3_DATA(D_800D6934),
PAL_UNK_OP3_DATA(D_800D6954), PAL_UNK_OP3_DATA(D_800D6974),
PAL_UNK_OP3_DATA(D_800D6994), PAL_TERMINATE(),
};
u_long* D_800A397C[] = {
MAKE_PAL_OP(PAL_UNK_OP3, 4), PAL_UNK_OP3_INFO(0x17F0, LEN(D_800D69B4)),
PAL_UNK_OP3_DATA(D_800D69B4), PAL_UNK_OP3_DATA(D_800D69D4),
PAL_UNK_OP3_DATA(D_800D69F4), PAL_UNK_OP3_DATA(D_800D6A14),
PAL_UNK_OP3_DATA(D_800D6A34), PAL_TERMINATE(),
};
u_long* D_800A39A0[] = {
PAL_COPY_INFO(),
PAL_COPY_DATA(0x1006, D_800A37F4),
};
u_long* D_800A39B0[] = {
PAL_COPY_INFO(),
PAL_COPY_DATA(0x1008, D_800A3800),
};
u_long* D_800A39C0[] = {
PAL_COPY_INFO(),
PAL_COPY_DATA(0x1006, D_800A3804),
};
u_long* D_800A39D0[] = {
PAL_COPY_INFO(),
PAL_COPY_DATA(0x1006, D_800A3840),
};
u_long* D_800A39E0[] = {
PAL_COPY_INFO(),
PAL_COPY_DATA(0x1006, D_800A380C),
};
u_long* D_800A39F0[] = {
PAL_COPY_INFO(),
PAL_COPY_DATA(0x1006, D_800A3814),
};
u_long* D_800A3A00[] = {
PAL_COPY_INFO(),
PAL_COPY_DATA(0x1006, D_800A381C),
};
u_long* D_800A3A10[] = {
PAL_COPY_INFO(),
PAL_COPY_DATA(0x1006, D_800A3824),
};
u_long* D_800A3A20[] = {
MAKE_PAL_OP(PAL_UNK_OP3, 1),
PAL_UNK_OP3_INFO(0x1006, LEN(D_800A382C)),
PAL_UNK_OP3_DATA(D_800A382C),
PAL_UNK_OP3_DATA(D_800A3838),
PAL_TERMINATE(),
};
u_long* D_800A3A38[] = {
PAL_COPY_INFO(),
PAL_COPY_DATA(0x1006, g_JosephsCloakColors),
};
u_long* D_800A3A48[] = {
MAKE_PAL_OP(PAL_GLOW_ANIM, 2),
PAL_GLOW_INFO(0x1006, LEN(D_800A37FC)),
PAL_GLOW_DATA(D_800A37FC),
PAL_GLOW_DATA(D_800A3834),
PAL_TERMINATE(),
};
u_long* D_800A3A60[] = {
PAL_COPY_INFO(),
PAL_COPY_DATA(0x0000, D_800DB0D4),
PAL_TERMINATE(),
};
u_long* D_800A3A74[] = {
PAL_COPY_INFO(),
PAL_COPY_DATA(0x1F00, D_800DB0F4),
PAL_TERMINATE(),
};
u_long* D_800A3A88[] = {
PAL_COPY_INFO(),
PAL_COPY_DATA(0x1F20, D_800D6B54),
PAL_TERMINATE(),
};
u_long* D_800A3A9C[] = {
MAKE_PAL_OP(PAL_GLOW_ANIM, 1),
PAL_GLOW_INFO(0x1F20, 16),
PAL_GLOW_DATA(D_800D6C14),
PAL_GLOW_DATA(D_800D6B54),
PAL_TERMINATE(),
};
u16 D_800A3AB4[] = {0x8076, 0x80FB};
u16 D_800A3AB8[] = {0x8048, 0x80B1};
u_long* D_800A3ABC[] = {
MAKE_PAL_OP(PAL_UNK_OP2, 1),
PAL_UNK_OP2_INFO(0x1F0E, LEN(D_800A3AB4)),
PAL_UNK_OP2_DATA(D_800A3AB4),
PAL_UNK_OP2_DATA(D_800A3AB8),
PAL_TERMINATE(),
};
u_long* D_800A3AD4[] = {
PAL_COPY_INFO(),
PAL_COPY_DATA(0x1D00, D_800DB114),
PAL_TERMINATE(),
};
u_long* D_800A3AE8[] = {
MAKE_PAL_OP(PAL_GLOW_ANIM, 2),
PAL_GLOW_INFO(0x100A, 1),
PAL_GLOW_DATA(&D_800A37D8[0]),
PAL_GLOW_DATA(&D_800A37D8[1]),
PAL_TERMINATE(),
};
u_long* D_800A3B00[] = {
PAL_COPY_INFO(),
PAL_COPY_DATA(0x10F0, D_8006ED0C),
};
u_long* D_800A3B10[] = {
MAKE_PAL_OP(PAL_UNK_OP2, 2),
PAL_UNK_OP2_INFO(0x10F0, LEN(D_8006ED4C)),
PAL_UNK_OP2_DATA(D_8006ED4C),
PAL_TERMINATE(),
};
u_long* D_800A3B24[] = {
MAKE_PAL_OP(PAL_UNK_OP2, 2),
PAL_UNK_OP2_INFO(0x10F0, 16),
PAL_UNK_OP2_DATA(D_8006EBCC),
PAL_TERMINATE(),
};
u_long* D_800A3B38[] = {
MAKE_PAL_OP(PAL_UNK_OP2, 2),
PAL_UNK_OP2_INFO(0x10F0, LEN(D_8006ED2C)),
PAL_UNK_OP2_DATA(D_8006ED2C),
PAL_TERMINATE(),
};
u_long* D_800A3B4C[] = {
PAL_COPY_INFO(),
PAL_COPY_DATA(0x1000, D_800DB1F4),
};
GfxBank** g_GfxSharedBank[] = {
D_800A3848, D_800A384C, D_800A3848, D_800A3860, D_800A3880,
};
extern s16* D_800CF324[];
extern s16* D_800CFF10[];
extern s16* D_800D0F68[];
extern s16* D_800D2BF4[];
extern s16* D_800D2CF8[];
extern s16* D_800D2FFC[];
extern s16* D_800D3428[];
extern s16* D_800D34B8[];
extern s16* D_800D372C[];
extern s16* D_800D3B88[];
extern s16* D_800D5628[];
extern s16* D_800D327C[];
extern unkstr_800cfe48* D_800CFE48[18];
extern s16* D_800D56AC[];
extern s16* D_800D5868[];
extern s16* D_800D684C[];
s16** D_800A3B70[] = {
NULL, D_800CF324, D_800CFF10, D_800D0F68, D_800D2BF4, D_800D2CF8,
D_800D2FFC, D_800D3428, D_800D34B8, D_800D372C, D_800D3B88, D_800D5628,
D_800D327C, D_800CFE48, D_800D56AC, D_800D5868, D_800D5868, D_800D684C,
};
u_long* D_800A3BB8[] = {
D_800A38C0, D_800A38EC, D_800A38FC, D_800A390C, D_800A391C, D_800A3934,
D_800A3958, D_800A397C, D_800A38D4, D_800A39A0, D_800A39B0, D_800A39C0,
D_800A39D0, D_800A39F0, D_800A3A00, D_800A3A10, D_800A3A20, D_800A3A38,
D_800A39E0, D_800A39A0, D_800A39A0, D_800A3A48, D_800A3B4C, D_800A3AE8,
D_800A3A74, D_800A3A88, D_800A3A60, D_800A3B00, D_800A3B10, D_800A3B24,
D_800A3A9C, D_800A3B38, D_800A3ABC, D_800A3AD4,
};
// Note: Including this as part of the previous file (62D70.c) caused
// four 00 bytes to be added to the rodata at 0x3CDC0; this indicates
// that this function should be the start of this new file.
@ -197,7 +665,7 @@ void func_80104790(s32 arg0, s32 arg1, s32 arg2) {
var_s3 = &D_80137B20;
var_s2 = &D_80137D40;
spA8 = 0x18;
for (spA0 = 0; spA0 < 14; spA0++) {
for (spA0 = 0; spA0 < LEN(D_800A3598); spA0++) {
D_80137E70[spA0].vx =
D_800A3598[spA0]->vx +
(((D_800A35D0[spA0]->vx - D_800A3598[spA0]->vx) * arg2) / 96);
@ -212,7 +680,8 @@ void func_80104790(s32 arg0, s32 arg1, s32 arg2) {
}
var_s7 = &D_800A3728;
for (spA0 = 0; spA0 < 24; spA0++, prim = prim->next, spB0 += 3) {
for (spA0 = 0; spA0 < LEN(D_800A3210); spA0++, prim = prim->next,
spB0 += 3) {
if (spA0 >= spA8) {
prim->drawMode = 8;
continue;

View File

@ -3,8 +3,8 @@
#include "player.h"
void func_801092E8(s32 arg0) {
D_800A37D8.D_800A37D8 = D_800ACE48[arg0 * 2];
D_800A37D8.D_800A37DA = D_800ACE48[arg0 * 2 + 1];
D_800A37D8[0] = D_800ACE48[arg0 * 2];
D_800A37D8[1] = D_800ACE48[arg0 * 2 + 1];
D_8006EBE0 = D_800ACE48[arg0 * 2];
}
@ -1043,7 +1043,7 @@ block_160:
func_8010D800();
if (PLAYER.animSet == 0xD) {
D_800CFE48[PLAYER.animCurFrame & 0x7FFF]->unk4 =
D_8013AECC + D_800ACE20[(s16)PLAYER.animCurFrame];
D_8013AECC + D_800ACE20[PLAYER.animCurFrame];
}
#ifdef VERSION_US
FntPrint("step:%04x\n", PLAYER.step);

View File

@ -329,14 +329,6 @@ typedef struct {
s32 unk28;
} PlayerHud;
// All the Joseph's Cloak color fields are in RGB555 format
typedef struct {
u16 liningDark;
u16 liningLight;
u16 exteriorDark;
u16 exteriorLight;
} JosephsCloak;
// g_ButtonCombo is an array of 16, here is what each index is for
// Names should be updated as each one is decompiled.
typedef enum {
@ -397,17 +389,11 @@ extern s32 D_800A2438;
extern RoomTeleport D_800A245C[];
extern u32 D_800A2D24;
extern const char* D_800A83AC[];
extern s32 D_800A3194[];
extern SVECTOR* D_800A3210[];
extern SVECTOR* D_800A33A0[];
extern SVECTOR* D_800A34C0[18][3];
extern SVECTOR* D_800A3598[];
extern SVECTOR* D_800A35D0[];
extern SVECTOR* D_800A3608[];
extern u8 D_800A3728;
extern MATRIX D_800A37B8;
extern Unkstruct_801092E8 D_800A37D8;
extern JosephsCloak g_JosephsCloak;
extern u16 D_800A37D8[2];
extern u16 g_JosephsCloakColors[4];
extern GfxBank** g_GfxSharedBank[];
extern u_long* D_800A3BB8[];
extern Lba g_StagesLba[80];
@ -655,7 +641,6 @@ extern s32 D_80137E60; // most likely part of the g_Cd struct
extern s32 g_MemCardRStep;
extern s32 g_MemCardRStepSub;
extern s32 D_80137E6C;
extern SVECTOR D_80137E70[];
extern s32 D_80137EE0;
extern s32 D_80137EE4;
extern s32 D_80137EE8;

View File

@ -854,19 +854,24 @@ s32 DarkenCloakColor(s32 color) { return color * 3 / 4; }
// Creates light and dark versions of cloak colors in BGR555 format
void ApplyJosephsCloakPalette(void) {
g_JosephsCloak.liningDark =
const int LiningDark = 0;
const int LiningLight = 1;
const int ExteriorDark = 2;
const int ExteriorLight = 3;
g_JosephsCloakColors[LiningDark] =
DarkenCloakColor(g_Settings.cloakColors[3]) +
((DarkenCloakColor(g_Settings.cloakColors[4]) << 5) - 0x8000) +
(DarkenCloakColor(g_Settings.cloakColors[5]) << 0xA);
g_JosephsCloak.liningLight =
g_JosephsCloakColors[LiningLight] =
(g_Settings.cloakColors[3] +
((g_Settings.cloakColors[4] << 5) - 0x8000)) +
((u32)g_Settings.cloakColors[5] << 0xA);
g_JosephsCloak.exteriorDark =
g_JosephsCloakColors[ExteriorDark] =
DarkenCloakColor(g_Settings.cloakColors[0]) +
((DarkenCloakColor(g_Settings.cloakColors[1]) << 5) - 0x8000) +
(DarkenCloakColor(g_Settings.cloakColors[2]) << 0xA);
g_JosephsCloak.exteriorLight =
g_JosephsCloakColors[ExteriorLight] =
g_Settings.cloakColors[0] +
((g_Settings.cloakColors[1] << 5) - 0x8000) +
((u32)g_Settings.cloakColors[2] << 0xA);
@ -2233,6 +2238,7 @@ void func_800F98AC(const char* str, u32 arg1) {
#ifdef VERSION_PC
NOT_IMPLEMENTED;
return;
#endif
for (data_ptr = str; *data_ptr != 0;) {
@ -2292,6 +2298,10 @@ void func_800F99B8(const char* str, s32 arg1, s32 arg2) {
var_s5 &= ~0x200;
}
var_s5 = func_800F548C(var_s5 & 0xFF) & 0xFF;
#ifdef VERSION_PC
NOT_IMPLEMENTED;
return;
#endif
while (*var_s1 != 0) {
var_s2 = 0;
var_s0 = *var_s1++;

View File

@ -13,8 +13,6 @@ bool InitPlatform() {
void ResetPlatform() {}
void MyRenderPrimitives(void) {}
void MyPadInit(int mode) {}
u_long MyPadRead(int id) { return 0; }

View File

@ -18,9 +18,16 @@
#define VRAM_H 512
#define VRAM_STRIDE 2048
typedef struct {
const char* path;
const void* content;
size_t length;
} FileLoad;
bool FileRead(bool (*cb)(FILE* file), const char* path);
bool FileStringify(bool (*cb)(const char* content), const char* path);
bool FileUseContent(bool (*cb)(void* content, size_t len), const char* path);
bool FileUseContent(
bool (*cb)(FileLoad* file, void* param), const char* path, void* param);
const char* AnsiToSotnMenuString(const char* str);

View File

@ -550,142 +550,6 @@ void SetSdlVertexGT4(SDL_Vertex* v, POLY_GT4* poly, bool isSemiTransp) {
v[5] = v[2];
}
void MyRenderPrimitives(void) {
POLY_G4* g4;
POLY_GT4* gt4;
LINE_G2* lg2;
SPRT* sp;
SPRT_16* sp16;
DR_MODE* dr;
bool prevDtd = false;
bool prevDfe = false;
bool dtd;
bool dfe;
u8 colorBlend;
RECT r = {0, 0, 0, 0};
for (int i = 0; i < LEN(g_PrimBuf); i++) {
Primitive* prim = &g_PrimBuf[i];
if (prim->drawMode & DRAW_HIDE) {
continue;
}
if (D_800973EC && !(prim->drawMode & DRAW_MENU)) {
continue;
}
switch (prim->type) {
case PRIM_NONE:
break;
case PRIM_G4:
g4 = &g_CurrentBuffer->polyG4[g_GpuUsage.g4++];
g4->r0 = prim->r0;
g4->g0 = prim->g0;
g4->b0 = prim->b0;
g4->x0 = prim->x0;
g4->y0 = prim->y0;
g4->r1 = prim->r1;
g4->g1 = prim->g1;
g4->b1 = prim->b1;
g4->x1 = prim->x1;
g4->y1 = prim->y1;
g4->r2 = prim->r2;
g4->g2 = prim->g2;
g4->b2 = prim->b2;
g4->x2 = prim->x2;
g4->y2 = prim->y2;
g4->r3 = prim->r3;
g4->g3 = prim->g3;
g4->b3 = prim->b3;
g4->x3 = prim->x3;
g4->y3 = prim->y3;
dtd = false;
dfe = false;
SetPolyG4(g4);
SetSemiTrans(g4, !!(prim->drawMode & DRAW_TRANSP));
AddPrim(&g_CurrentBuffer->ot[prim->priority], g4);
break;
case PRIM_GT4:
gt4 = &g_CurrentBuffer->polyGT4[g_GpuUsage.gt4++];
gt4->r0 = prim->r0 | 0xFF;
gt4->g0 = prim->g0 | 0xFF;
gt4->b0 = prim->b0 | 0xFF;
gt4->x0 = prim->x0;
gt4->y0 = prim->y0;
gt4->u0 = prim->u0;
gt4->v0 = prim->v0;
gt4->clut = D_8003C104[prim->clut];
gt4->r1 = prim->r1 | 0xFF;
gt4->g1 = prim->g1 | 0xFF;
gt4->b1 = prim->b1 | 0xFF;
gt4->p1 = prim->p1;
gt4->x1 = prim->x1;
gt4->y1 = prim->y1;
gt4->u1 = prim->u1;
gt4->v1 = prim->v1;
gt4->tpage = prim->tpage;
gt4->r2 = prim->r2 | 0xFF;
gt4->g2 = prim->g2 | 0xFF;
gt4->b2 = prim->b2 | 0xFF;
gt4->p2 = prim->p2;
gt4->x2 = prim->x2;
gt4->y2 = prim->y2;
gt4->u2 = prim->u2;
gt4->v2 = prim->v2;
gt4->r3 = prim->r3 | 0xFF;
gt4->g3 = prim->g3 | 0xFF;
gt4->b3 = prim->b3 | 0xFF;
gt4->p3 = prim->p3;
gt4->x3 = prim->x3;
gt4->y3 = prim->y3;
gt4->u3 = prim->u3;
gt4->v3 = prim->v3;
dtd = false;
dfe = false;
SetPolyGT4(gt4);
SetSemiTrans(gt4, !!(prim->drawMode & DRAW_TRANSP));
AddPrim(&g_CurrentBuffer->ot[prim->priority], gt4);
if (prevDtd != dtd || prevDfe != dfe) {
if (g_GpuUsage.drawModes < MAX_DRAW_MODES) {
dr = &g_CurrentBuffer->drawModes[g_GpuUsage.drawModes++];
SetDrawMode(dr, dtd, dfe, 0, &r);
AddPrim(&g_CurrentBuffer->ot[prim->priority], dr);
} else {
WARNF("draw mode buffer out of limit");
}
}
break;
case PRIM_SPRT:
colorBlend = prim->drawMode & DRAW_COLORS ? 0x00 : 0xFF;
sp = &g_CurrentBuffer->sprite[g_GpuUsage.sp++];
sp->r0 = PSX_COL(prim->r0) | colorBlend;
sp->g0 = PSX_COL(prim->g0) | colorBlend;
sp->b0 = PSX_COL(prim->b0) | colorBlend;
sp->x0 = prim->x0;
sp->y0 = prim->y0;
sp->u0 = prim->u0;
sp->v0 = prim->v0;
sp->clut = D_8003C104[prim->clut];
sp->w = prim->u1;
sp->h = prim->v1;
SetSprt(sp);
SetSemiTrans(sp, !!(prim->drawMode & DRAW_TRANSP));
AddPrim(&g_CurrentBuffer->ot[prim->priority], sp);
dr = &g_CurrentBuffer->drawModes[g_GpuUsage.drawModes++];
SetDrawMode(dr, dtd, dfe, prim->tpage, &r);
AddPrim(&g_CurrentBuffer->ot[prim->priority], dr);
break;
default:
WARNF("unhandled prim type %d", prim->type);
break;
}
}
}
u_short g_DrawEnvTpage;
DRAWENV* MyPutDrawEnv(DRAWENV* env) {
if (env->isbg) {

View File

@ -241,30 +241,27 @@ s32 LoadFileSimToMem(SimKind kind) {
return 0;
}
bool LoadFilePc(void* content, size_t len) {
g_SimFile->addr = content;
switch (g_SimFile->kind) { // slowly replacing the original func
bool LoadFilePc(FileLoad* file, SimFile* sim) {
sim->addr = file->content;
switch (sim->kind) { // slowly replacing the original func
case SIM_1:
DEBUGF("************ %p", content);
LoadStageTileset(content, len, 0x100);
LoadStageTileset(sim->addr, file->length, 0x100);
LoadImage(&g_Vram.D_800ACD98, D_800A04CC);
LoadImage(&g_Vram.D_800ACDA8, (u8*)content + 0x40000);
LoadImage(&g_Vram.D_800ACDA8, (u8*)sim->addr + 0x40000);
StoreImage(&g_Vram.D_800ACDA8, g_Clut + 0x1000);
break;
case SIM_STAGE_CHR:
DEBUGF("############# %p, %d", content, len);
LoadStageTileset(content, len, 0);
LoadStageTileset(sim->addr, file->length, 0);
break;
case SIM_12:
DEBUGF(">>>>>>>>>>>>> %p", content);
LoadStageTileset(content, len, 0x100);
LoadStageTileset(sim->addr, file->length, 0x100);
case SIM_13:
DEBUGF("============= %p", content);
LoadStageTileset(content, len, 0x100);
LoadStageTileset(sim->addr, file->length, 0x100);
LoadImage(&g_Vram.D_800ACD98, D_800A04CC);
break;
default:
if (LoadFileSimToMem(g_SimFile->kind) < 0) {
g_SimFile = sim;
if (LoadFileSimToMem(sim->kind) < 0) {
return false;
}
}
@ -313,9 +310,9 @@ s32 LoadFileSim(s32 fileId, SimFileType type) {
break;
case SimFileType_StagePrg:
switch (g_StageId) {
case STAGE_SEL:
InitStageSel(&g_api.o);
break;
// case STAGE_SEL:
// InitStageSel(&g_api.o);
// break;
default:
InitStageDummy(&g_api.o);
INFOF("TODO: will load stage '%s'", g_StagesLba[g_StageId].ovlName);
@ -395,8 +392,7 @@ s32 LoadFileSim(s32 fileId, SimFileType type) {
snprintf(buf, sizeof(buf), "disks/us/%s", sim.path);
INFOF("open %s", buf);
g_SimFile = &sim;
if (!FileUseContent(LoadFilePc, buf)) {
if (!FileUseContent(LoadFilePc, buf, &sim)) {
ERRORF("failed to load '%s'", buf);
D_800A04EC = 0;
return -1;

View File

@ -37,7 +37,7 @@ Weapon D_8017D000 = {
func_ptr_80170024, func_ptr_80170028,
};
extern GfxBank g_FakeGfxBank;
GfxBank* g_FakeGfxBank = NULL;
GfxBank** g_GfxStageBank[0x40] = {
&g_FakeGfxBank, &g_FakeGfxBank, &g_FakeGfxBank, &g_FakeGfxBank,
&g_FakeGfxBank, &g_FakeGfxBank, &g_FakeGfxBank, &g_FakeGfxBank,
@ -58,6 +58,13 @@ GfxBank** g_GfxStageBank[0x40] = {
};
extern u_long* D_800A3BB8[];
#define MAX_SIZE_FOR_COMPRESSED_GFX 8192
u8 D_800C217C[MAX_SIZE_FOR_COMPRESSED_GFX];
u8 D_800C27B0[MAX_SIZE_FOR_COMPRESSED_GFX];
u8 D_800C3560[MAX_SIZE_FOR_COMPRESSED_GFX];
u8 D_800C4864[MAX_SIZE_FOR_COMPRESSED_GFX];
u8 D_800C4A90[MAX_SIZE_FOR_COMPRESSED_GFX];
void WeaponLoadPaletteStub(s32 arg0) { NOT_IMPLEMENTED; }
// list of exposed API
@ -81,12 +88,18 @@ void MyDrawSyncCallback(int mode) {
DEBUGF("-------------------- frame %d --------------------", g_Frame);
DEBUGF("state: %d, game step: %d", g_GameState, g_GameStep);
// force loaded map to always be visible
if (g_Tilemap.tileDef) {
g_Tilemap.flags |= LAYER_SHOW;
}
g_Frame++;
}
// called before MainGame
bool InitPlatform(void);
void InitStrings(void);
static void InitAssets(void);
bool InitEquipDefs(const char* jsonContent);
bool InitAccessoryDefs(const char* jsonContent);
void InitRelicDefs(void);
@ -177,6 +190,7 @@ bool InitGame(void) {
D_8017D000.LoadWeaponPalette = WeaponLoadPaletteStub;
InitStrings();
InitAssets();
D_80137590 = g_DemoRecordingBuffer;
@ -258,7 +272,8 @@ bool FileStringify(bool (*cb)(const char* content), const char* path) {
fclose(f);
return r;
}
bool FileUseContent(bool (*cb)(void* content, size_t len), const char* path) {
bool FileUseContent(
bool (*cb)(FileLoad* file, void* param), const char* path, void* param) {
INFOF("open '%s'", path);
FILE* f = fopen(path, "rb");
if (f == NULL) {
@ -285,7 +300,12 @@ bool FileUseContent(bool (*cb)(void* content, size_t len), const char* path) {
return false;
}
bool r = cb(content, bytesread);
FileLoad file;
file.path = path;
file.content = content;
file.length = bytesread;
bool r = cb(&file, param);
free(content);
fclose(f);
return r;
@ -308,6 +328,24 @@ void InitStrings(void) {
}
}
static bool LoadCmpGfx(FileLoad* file, void* dst) {
if (file->length > MAX_SIZE_FOR_COMPRESSED_GFX) {
ERRORF("file '%s' too big, max size is %d ", file->path,
MAX_SIZE_FOR_COMPRESSED_GFX);
return false;
}
memcpy(dst, file->content, file->length);
return true;
}
static void InitAssets() {
FileUseContent(LoadCmpGfx, "assets/dra/D_800C217C.bin", D_800C217C);
FileUseContent(LoadCmpGfx, "assets/dra/D_800C27B0.bin", D_800C27B0);
FileUseContent(LoadCmpGfx, "assets/dra/D_800C3560.bin", D_800C3560);
FileUseContent(LoadCmpGfx, "assets/dra/D_800C4864.bin", D_800C4864);
FileUseContent(LoadCmpGfx, "assets/dra/D_800C4A90.bin", D_800C4A90);
}
void (*g_VsyncCallback)() = NULL;
int MyVSyncCallback(void (*f)()) { g_VsyncCallback = f; }

View File

@ -62,18 +62,10 @@ s32 D_800978C4;
s32 D_80097C98;
s8 D_80097B98;
s8 D_80097B99;
SVECTOR* D_800A3210[1];
SVECTOR* D_800A33A0[1];
SVECTOR* D_800A34C0[18][3];
SVECTOR* D_800A3598[1];
SVECTOR* D_800A35D0[1];
SVECTOR* D_800A3608[1];
u8 D_800A3728;
MATRIX D_800A37B8;
u8 D_800B0608[0xC0]; // size guessed
s16 D_80136308[1];
u16 g_Clut[0x3000];
u32 D_8006EBCC;
u16 D_8006EBCC[0x1000]; // part of g_Clut?
u16 D_8006EBE0;
s32 D_8006C384;
s32 D_8006C388;
@ -183,7 +175,6 @@ s16 D_800AC998[] = {
0x0300, 0x0320, 0x0300, 0x0320, 0x0340, 0x0360, 0x0340, 0x0360,
0x0380, 0x03A0, 0x0380, 0x03A0, 0x03C0, 0x03E0, 0x03C0, 0x03E0,
};
Unkstruct_801092E8 D_800A37D8;
s32 D_800ACDF8;
s32 D_800ACDFC;
s32 D_800ACE00[8];
@ -326,7 +317,7 @@ VECTOR D_801379E0;
VECTOR D_80137B20;
SVECTOR D_80137CA0;
SVECTOR D_80137D40;
SVECTOR D_80137E70[1];
SVECTOR D_80137E70[14] = {0};
s32 D_80137EE0;
s32 D_80137EE4;
s32 D_80137EE8;
@ -345,43 +336,12 @@ s32 D_8013984C;
s32 D_80139850;
s32 D_80139854;
u16 D_80137538[32];
GfxBank* g_FakeGfxBank = {NULL};
GfxBank** g_GfxSharedBank[] = {
&g_FakeGfxBank, &g_FakeGfxBank, &g_FakeGfxBank, &g_FakeGfxBank,
&g_FakeGfxBank, &g_FakeGfxBank, &g_FakeGfxBank, &g_FakeGfxBank,
&g_FakeGfxBank, &g_FakeGfxBank, &g_FakeGfxBank, &g_FakeGfxBank,
&g_FakeGfxBank, &g_FakeGfxBank, &g_FakeGfxBank, &g_FakeGfxBank,
&g_FakeGfxBank, &g_FakeGfxBank, &g_FakeGfxBank, &g_FakeGfxBank,
&g_FakeGfxBank, &g_FakeGfxBank, &g_FakeGfxBank, &g_FakeGfxBank,
&g_FakeGfxBank, &g_FakeGfxBank, &g_FakeGfxBank, &g_FakeGfxBank,
&g_FakeGfxBank, &g_FakeGfxBank, &g_FakeGfxBank, &g_FakeGfxBank,
&g_FakeGfxBank, &g_FakeGfxBank, &g_FakeGfxBank, &g_FakeGfxBank,
&g_FakeGfxBank, &g_FakeGfxBank, &g_FakeGfxBank, &g_FakeGfxBank,
&g_FakeGfxBank, &g_FakeGfxBank, &g_FakeGfxBank, &g_FakeGfxBank,
&g_FakeGfxBank, &g_FakeGfxBank, &g_FakeGfxBank, &g_FakeGfxBank,
&g_FakeGfxBank, &g_FakeGfxBank, &g_FakeGfxBank, &g_FakeGfxBank,
&g_FakeGfxBank, &g_FakeGfxBank, &g_FakeGfxBank, &g_FakeGfxBank,
&g_FakeGfxBank, &g_FakeGfxBank, &g_FakeGfxBank, &g_FakeGfxBank,
&g_FakeGfxBank, &g_FakeGfxBank, &g_FakeGfxBank, &g_FakeGfxBank,
};
u8* g_DecSrcPtr = NULL;
u8* g_DecDstPtr = NULL;
s32 g_DecReadNibbleFlag = 0;
s32 g_DecWriteNibbleFlag = 0;
u8 g_GfxEquipIcon[320][16 * 16 / 2];
s16 g_PalEquipIcon[320 * 16];
u_long g_FakeUnkStruct = {MAKE_PAL_OP(0, 0)};
u_long* D_800A3BB8[] = {
&g_FakeUnkStruct, &g_FakeUnkStruct, &g_FakeUnkStruct, &g_FakeUnkStruct,
&g_FakeUnkStruct, &g_FakeUnkStruct, &g_FakeUnkStruct, &g_FakeUnkStruct,
&g_FakeUnkStruct, &g_FakeUnkStruct, &g_FakeUnkStruct, &g_FakeUnkStruct,
&g_FakeUnkStruct, &g_FakeUnkStruct, &g_FakeUnkStruct, &g_FakeUnkStruct,
&g_FakeUnkStruct, &g_FakeUnkStruct, &g_FakeUnkStruct, &g_FakeUnkStruct,
&g_FakeUnkStruct, &g_FakeUnkStruct, &g_FakeUnkStruct, &g_FakeUnkStruct,
&g_FakeUnkStruct, &g_FakeUnkStruct, &g_FakeUnkStruct, &g_FakeUnkStruct,
&g_FakeUnkStruct, &g_FakeUnkStruct, &g_FakeUnkStruct, &g_FakeUnkStruct,
&g_FakeUnkStruct, &g_FakeUnkStruct,
};
u16 D_80137478[0x20];
u16 D_801374B8[0x20];
u16 D_801374F8[0x20];
@ -395,10 +355,52 @@ s32 D_80139008;
s32 D_801397FC;
SimFile* g_SimFile;
SimFile D_80136450;
s16 D_80136460[0x400];
s16 D_80136C60[0x400];
s16 D_80136460[0x400] = {0};
s16 D_80136C60[0x400] = {0};
u16 D_8006ED0C[0x10] = {0};
u16 D_8006ED2C[0x10] = {0};
u16 D_8006ED4C[0x10] = {0};
u16 D_800D68D4[0x10] = {0};
u16 D_800D68F4[0x10] = {0};
u16 D_800D6914[0x10] = {0};
u16 D_800D6934[0x10] = {0};
u16 D_800D6954[0x10] = {0};
u16 D_800D6974[0x10] = {0};
u16 D_800D6994[0x10] = {0};
u16 D_800D69B4[0x10] = {0};
u16 D_800D69D4[0x10] = {0};
u16 D_800D69F4[0x10] = {0};
u16 D_800D6A14[0x10] = {0};
u16 D_800D6A34[0x10] = {0};
u16 D_800D6A54[0x40] = {0};
u16 D_800D6AD4[0x100] = {0};
u16 D_800D6B54[0x10] = {0};
u16 D_800D6C14[0x60] = {0};
u16 D_800D6CD4[0x100] = {0};
u16 D_800D6ED4[0x100] = {0};
u16 D_800D70D4[0x100] = {0};
u16 D_800D72D4[0x100] = {0};
u16 D_800DB0D4[0x10] = {0};
u16 D_800DB0F4[0x10] = {0};
u16 D_800DB114[0x70] = {0};
u16 D_800DB1F4[0xE0] = {0};
s16* D_800CF324[] = {NULL};
s16* D_800CFF10[] = {NULL};
s16* D_800D0F68[] = {NULL};
s16* D_800D2BF4[] = {NULL};
s16* D_800D2CF8[] = {NULL};
s16* D_800D2FFC[] = {NULL};
s16* D_800D3428[] = {NULL};
s16* D_800D34B8[] = {NULL};
s16* D_800D372C[] = {NULL};
s16* D_800D3B88[] = {NULL};
s16* D_800D5628[] = {NULL};
s16* D_800D327C[] = {NULL};
unkstr_800cfe48* D_800CFE48[18] = {NULL};
s16* D_800D56AC[] = {NULL};
s16* D_800D5868[] = {NULL};
s16* D_800D684C[] = {NULL};
JosephsCloak g_JosephsCloak;
u8 g_Pix[4][128 * 128 / 2];
ImgSrc g_imgUnk8013C200_impl = {
0,
@ -409,7 +411,6 @@ ImgSrc* g_imgUnk8013C200 = &g_imgUnk8013C200_impl;
ImgSrc* g_imgUnk8013C270 = &g_imgUnk8013C200_impl;
s32 g_PrevEquippedWeapons[2];
s32 D_8013AEE4;
s32 D_800A3194[1];
s32 D_80139060;
u32 D_8013799C;
s32 D_801379A0;

View File

@ -73,32 +73,28 @@ u16 D_801805FC[] = {
u_long* D_8018061C[] = {
MAKE_PAL_OP(PAL_BULK_COPY, 0),
PAL_BULK(0x2000, LEN(D_8018CD54), D_8018CD54),
PAL_BULK(0x2100, LEN(D_8018CDB4), D_8018CDB4),
PAL_BULK(0x2000, D_8018CD54),
PAL_BULK(0x2100, D_8018CDB4),
PAL_TERMINATE(),
};
u_long* D_8018063C[] = {
MAKE_PAL_OP(PAL_BULK_COPY, 0),
PAL_BULK(0x1960, LEN(D_801805FC), D_801805FC),
PAL_BULK(0x2100, LEN(D_8018D5D4), D_8018D5D4),
PAL_BULK(0x2400, LEN(D_8018CFB4), D_8018CFB4),
PAL_BULK(0x2480, LEN(D_8018D1B4), D_8018D1B4),
PAL_BULK(0x2500, LEN(D_8018D3B4), D_8018D3B4),
PAL_BULK(0x2580, LEN(D_8018D5B4), D_8018D5B4),
PAL_TERMINATE(),
MAKE_PAL_OP(PAL_BULK_COPY, 0), PAL_BULK(0x1960, D_801805FC),
PAL_BULK(0x2100, D_8018D5D4), PAL_BULK(0x2400, D_8018CFB4),
PAL_BULK(0x2480, D_8018D1B4), PAL_BULK(0x2500, D_8018D3B4),
PAL_BULK(0x2580, D_8018D5B4), PAL_TERMINATE(),
};
u_long* D_8018068C[] = {
MAKE_PAL_OP(PAL_BULK_COPY, 0),
PAL_BULK(0x1960, LEN(D_801805FC), D_801805FC),
PAL_BULK(0x1960, D_801805FC),
PAL_TERMINATE(),
};
u_long* D_801806A0[] = {
MAKE_PAL_OP(PAL_BULK_COPY, 0),
PAL_BULK(0x2030, LEN(D_80180764), D_80180764),
PAL_BULK(0x2040, LEN(D_80180804), D_80180804),
PAL_BULK(0x2030, D_80180764),
PAL_BULK(0x2040, D_80180804),
PAL_TERMINATE(),
};
@ -122,7 +118,7 @@ u_long* D_801806D8[] = {
u_long* D_801806F8[] = {
MAKE_PAL_OP(PAL_BULK_COPY, 0),
PAL_BULK(0x2200, LEN(D_801808E4), D_801808E4),
PAL_BULK(0x2200, D_801808E4),
PAL_TERMINATE(),
};