From fa92e07da383476093a553d19eb9f1bd06d84a36 Mon Sep 17 00:00:00 2001 From: weirdbeardgame Date: Wed, 19 Aug 2026 22:22:39 -0500 Subject: [PATCH] Added several missing functions and structs. Set Game to c, still doesn't compile --- config/kuon.yaml | 2 +- include/typedefs.h | 3 +- src/cs4/Seimei/src/Camera.h | 21 ++++ src/cs4/Seimei/src/DrawOT.h | 10 ++ src/cs4/Seimei/src/EtcEvent.h | 29 +++++ src/cs4/Seimei/src/Game.c | 6 + src/cs4/Seimei/src/Game.h | 2 +- src/cs4/Seimei/src/Model.h | 11 ++ src/cs4/Seimei/src/My.h | 10 +- src/cs4/Seimei/src/TexEffect.h | 2 + src/cs4/Seimei/src/Unk.h | 194 +++++++++++++++++++++++++++++++-- 11 files changed, 275 insertions(+), 15 deletions(-) create mode 100644 src/cs4/Seimei/src/Camera.h create mode 100644 src/cs4/Seimei/src/DrawOT.h create mode 100644 src/cs4/Seimei/src/EtcEvent.h diff --git a/config/kuon.yaml b/config/kuon.yaml index 1959519..c259220 100644 --- a/config/kuon.yaml +++ b/config/kuon.yaml @@ -236,7 +236,7 @@ segments: - [0x034930, asmtu, cs4/Seimei/src/Debug] - [0x034D10, asmtu, cs4/Seimei/src/Draw] - [0x038710, asmtu, cs4/Seimei/src/File] - - [0x038D00, asmtu, cs4/Seimei/src/Game] + - [0x038D00, c, cs4/Seimei/src/Game] - [0x039A00, asmtu, cs4/Seimei/src/Load] - [0x03A380, asmtu, cs4/Seimei/src/Main] - [0x03AFE0, asmtu, cs4/Seimei/src/MathUtil] diff --git a/include/typedefs.h b/include/typedefs.h index fee9bfc..ea46707 100644 --- a/include/typedefs.h +++ b/include/typedefs.h @@ -19,7 +19,8 @@ typedef int sceVu0IVECTOR[4] __attribute__((aligned (16))); typedef float sceVu0FVECTOR[4] __attribute__((aligned (16))); typedef float sceVu0FMATRIX[4][4] __attribute__((aligned (16))); - +#define false (u_char)0x0 +#define true (u_char)0x1 typedef char s8; typedef short s16; diff --git a/src/cs4/Seimei/src/Camera.h b/src/cs4/Seimei/src/Camera.h new file mode 100644 index 0000000..b3cfc2f --- /dev/null +++ b/src/cs4/Seimei/src/Camera.h @@ -0,0 +1,21 @@ +#ifndef CAMERA_H +#define CAMERA_H + +typedef struct /* @anon0 */ { + // Members + unsigned char * lpCamData; // offset 0x0, size 0x4 + signed int nowIndex; // offset 0x4, size 0x4 + float frame; // offset 0x8, size 0x4 + unsigned char LockDirFlag; // offset 0xC, size 0x1 + char LockL3V; // offset 0xD, size 0x1 + char LockL3H; // offset 0xE, size 0x1 + unsigned char noneUpdate; // offset 0xF, size 0x1 + unsigned char eraseMap[256][48]; // offset 0x10, size 0x3000 +} CAMINFO; + +void UpdateCamera(); +void SetCamEnv(CAMINFO * CAMINFO, int Index); +CAMINFO * GetGameCamInfo(); +void InitCamera(); + +#endif // CAMERA_H \ No newline at end of file diff --git a/src/cs4/Seimei/src/DrawOT.h b/src/cs4/Seimei/src/DrawOT.h new file mode 100644 index 0000000..12ef327 --- /dev/null +++ b/src/cs4/Seimei/src/DrawOT.h @@ -0,0 +1,10 @@ +#ifndef DRAW_OT_H +#define DRAW_OT_H +#include "common.h" +#include "Model.h" + + + void DrawByOT(); + void ClearDrawOT(); + int SetDrawOTModel(MDLMNG * lpMdlMng /* r18 */, float * WorldPos /* r17 */, u_char Priority /* r16 */); +#endif // DRAW_OT_H \ No newline at end of file diff --git a/src/cs4/Seimei/src/EtcEvent.h b/src/cs4/Seimei/src/EtcEvent.h new file mode 100644 index 0000000..7fdcf95 --- /dev/null +++ b/src/cs4/Seimei/src/EtcEvent.h @@ -0,0 +1,29 @@ +#ifndef ETC_EVENT_H +#define ETC_EVENT_H +#include "common.h" +#include "Model.h" +#include "Unk.h" + +struct _ETC_EVENT_MNSG__ENE_EXT_GENE_DATA_ST { + // Members + signed int state; // offset 0x0, size 0x4 + MDLMNG * pMdlMng; // offset 0x4, size 0x4 + PENECTRL * pEneCtrl; + unsigned int ene_num; // offset 0xC, size 0x4 + unsigned int counter; // offset 0x10, size 0x4 + unsigned int dmy[3]; // offset 0x14, size 0xC +}; + +struct _ETC_EVENT_MNG_ST { + // Members + _MNG_STATE_ST mng_state; // offset 0x0, size 0x20 + signed int DrawState; // offset 0x20, size 0x4 + unsigned char * * pEtcEventFileBuf; // offset 0x24, size 0x4 + struct _ETC_EVENT_MNSG__ENE_EXT_GENE_DATA_ST EneExtGeneEventData; // offset 0x28, size 0x20 +}; + + struct _ETC_EVENT_MNG_ST g_EtcEventMng; + + int EtcEventMng_EneExtGeneEvent_Update(struct _ETC_EVENT_MNG_ST * pEtcEventMng /* r2 */); + int EtcEventMng_EneExtGeneEvent_End(struct _ETC_EVENT_MNG_ST * pEtcEventMng /* r2 */); +#endif // ETC_EVENT_H \ No newline at end of file diff --git a/src/cs4/Seimei/src/Game.c b/src/cs4/Seimei/src/Game.c index d8272ef..c96f3fb 100644 --- a/src/cs4/Seimei/src/Game.c +++ b/src/cs4/Seimei/src/Game.c @@ -1,9 +1,15 @@ #include "Game.h" +#include "Camera.h" #include "Drama.h" +#include "DrawOT.h" +#include "EtcEvent.h" #include "Event.h" #include "Filter.h" #include "Main.h" +#include "Model.h" #include "Pad.h" +#include "TexEffect.h" +#include "Unk.h" #include "common.h" void InitGameData() { diff --git a/src/cs4/Seimei/src/Game.h b/src/cs4/Seimei/src/Game.h index 46d8ce9..62e4893 100644 --- a/src/cs4/Seimei/src/Game.h +++ b/src/cs4/Seimei/src/Game.h @@ -1,7 +1,7 @@ #ifndef GAME_H #define GAME_H -#include "typedefs.h" +#include "common.h" typedef struct { // Members diff --git a/src/cs4/Seimei/src/Model.h b/src/cs4/Seimei/src/Model.h index 45d74ec..bea4f15 100644 --- a/src/cs4/Seimei/src/Model.h +++ b/src/cs4/Seimei/src/Model.h @@ -157,6 +157,17 @@ typedef struct _mdlmng { u_short blood_pool_sfx_idx; // offset 0x1BC, size 0x2 } MDLMNG; +// total size: 0x20 +typedef struct { + // Members + signed int state; // offset 0x0, size 0x4 + unsigned int flag; // offset 0x4, size 0x4 + unsigned int calc_total_time; // offset 0x8, size 0x4 + unsigned int total_time; // offset 0xC, size 0x4 + unsigned int get_time; // offset 0x10, size 0x4 + unsigned int dmy[3]; // offset 0x14, size 0xC +} _MNG_STATE_ST; + extern MDLMNG MdlMng[770]; // size: 0x54380, address: 0x6A0E50 void KickMdlPacket(); diff --git a/src/cs4/Seimei/src/My.h b/src/cs4/Seimei/src/My.h index bacdc11..4b9ea6e 100644 --- a/src/cs4/Seimei/src/My.h +++ b/src/cs4/Seimei/src/My.h @@ -1,8 +1,14 @@ #ifndef MY_H #define MY_H - - +#include "common.h" +#include "Model.h" void MyAppear(signed int MyNo /* r2 */, struct _mdlmng * lpMy /* r18 */, float * Pos /* r16 */, float AngY /* r20 */); +void CheckMyEquipUpdate(); +void MyPlay(MDLMNG * lpMy /* r18 */); +void MyReset(MDLMNG * lpMy /* r17 */); +void StabilizeMyCloth(); + + #endif // MY_H \ No newline at end of file diff --git a/src/cs4/Seimei/src/TexEffect.h b/src/cs4/Seimei/src/TexEffect.h index 3581fe0..9f3c35e 100644 --- a/src/cs4/Seimei/src/TexEffect.h +++ b/src/cs4/Seimei/src/TexEffect.h @@ -2,6 +2,8 @@ #define TEXEFFECT_H void InitBloodStain(); +void InitTextureScroll(); +void UpdateTextureScroll(); #endif // TEXEFFECT_H diff --git a/src/cs4/Seimei/src/Unk.h b/src/cs4/Seimei/src/Unk.h index 7dff7c1..78b4d36 100644 --- a/src/cs4/Seimei/src/Unk.h +++ b/src/cs4/Seimei/src/Unk.h @@ -1,19 +1,11 @@ #ifndef UNK_H #define UNK_H -typedef struct _MNG_STATE_ST { - // Members - int state; // offset 0x0, size 0x4 - u_int flag; // offset 0x4, size 0x4 - u_int calc_total_time; // offset 0x8, size 0x4 - u_int total_time; // offset 0xC, size 0x4 - u_int get_time; // offset 0x10, size 0x4 - u_int dmy[3]; // offset 0x14, size 0xC -} MNG_STATE_ST; +#include "Model.h" typedef struct _TMP_MENU_MNG_ST { // Members - MNG_STATE_ST mng_state; // offset 0x0, size 0x20 + _MNG_STATE_ST mng_state; // offset 0x0, size 0x20 int DrawState; // offset 0x20, size 0x4 u_char** pTmpMenuFileBuf; // offset 0x24, size 0x4 float draw_up_rate; // offset 0x28, size 0x4 @@ -34,5 +26,187 @@ extern struct /* @anon0 */ { static float VZ[4]; // size: 0x10, address: 0x228720 static float VW[4]; // size: 0x10, address: 0x228730 +typedef enum /* @enum */ { + HSYN_PORT_SQBGM = 0, + HSYN_PORT_SQBGM1 = 1, + HSYN_PORT_SQBGM2 = 2, + HSYN_PORT_SQBGM3 = 3, + HSYN_PORT_SE_0 = 4, + HSYN_PORT_SE_1 = 5, + HSYN_PORT_SE_2 = 6, + HSYN_PORT_SE_3 = 7, + HSYN_PORT_SE_4 = 8, + HSYN_PORT_SE_5 = 9, + HSYN_PORT_SE_6 = 10, + HSYN_PORT_SE_7 = 11, + HSYN_PORT_SE_8 = 12, + HSYN_PORT_SE_9 = 13, + HSYN_PORT_SE_10 = 14, + HSYN_PORT_SE_11 = 15, + HSYN_PORT_MAX = 16, +} PORT; + +typedef enum /* @enum */ { + SND_SQSONG_FADE_OUT = 0, + SND_SQSONG_FADE_OUT_STATE_QUO = 1, + SND_SQSONG_FADE_IN = 2, + SND_SQSONG_FADE_STATE_QUO = 3, +} FADE; + +typedef enum { + TMP_MENU__UDDRAW_ORDER__ON = 0, + TMP_MENU__UDDRAW_ORDER__OFF = 1, + TMP_MENU__UDDRAW_ORDER__OFF_FORCE = 2, +} _TMP_MENU__UDDRAW_ORDER_EN; + +// Members +// total size: 0x1A0 +typedef struct /* @anon10 */ +{ + // Members + void (* ThkFunc[32])(); // offset 0x0, size 0x80 + void (* ActFunc[32])(); // offset 0x80, size 0x80 + void (* SetActFunc[32])(); // offset 0x100, size 0x80 + u_char actID; // offset 0x180, size 0x1 + u_char actIDB; // offset 0x181, size 0x1 + u_char freeEnd; // offset 0x182, size 0x1 + u_char unused0[1]; // offset 0x183, size 0x1 + int (* GetDmgAnimFunc)(); // offset 0x184, size 0x4 + int (* CalcDmgFunc)(); // offset 0x188, size 0x4 + void (* FrameLastFunc)(); // offset 0x18C, size 0x4 + void (* DramaStartFunc)(); // offset 0x190, size 0x4 + void (* DramaEndFunc)(); // offset 0x194, size 0x4 + int unused[2]; // offset 0x198, size 0x8 +} FUNC; // offset 0x0, size 0x1A0 + +typedef struct /* @anon15 */ +{ + // Members + u_short select : 1; // offset 0x0, size 0x2 + u_short L3 : 1; // offset 0x0, size 0x2 + u_short R3 : 1; // offset 0x0, size 0x2 + u_short start : 1; // offset 0x0, size 0x2 + u_short Lup : 1; // offset 0x0, size 0x2 + u_short Lright : 1; // offset 0x0, size 0x2 + u_short Ldown : 1; // offset 0x0, size 0x2 + u_short Lleft : 1; // offset 0x0, size 0x2 + u_short L2 : 1; // offset 0x0, size 0x2 + u_short R2 : 1; // offset 0x0, size 0x2 + u_short L1 : 1; // offset 0x0, size 0x2 + u_short R1 : 1; // offset 0x0, size 0x2 + u_short Rup : 1; // offset 0x0, size 0x2 + u_short Rdown : 1; // offset 0x0, size 0x2 + u_short Rright : 1; // offset 0x0, size 0x2 + u_short Rleft : 1; // offset 0x0, size 0x2 +} BIT; // offset 0x0, size 0x2 + +// total size: 0xC +typedef struct /* @anon33 */ { + // Members + u_char Lright; // offset 0x0, size 0x1 + u_char Lleft; // offset 0x1, size 0x1 + u_char Lup; // offset 0x2, size 0x1 + u_char Ldown; // offset 0x3, size 0x1 + u_char Rup; // offset 0x4, size 0x1 + u_char Rright; // offset 0x5, size 0x1 + u_char Rdown; // offset 0x6, size 0x1 + u_char Rleft; // offset 0x7, size 0x1 + u_char L1; // offset 0x8, size 0x1 + u_char R1; // offset 0x9, size 0x1 + u_char L2; // offset 0xA, size 0x1 + u_char R2; // offset 0xB, size 0x1 +} PRESS; // offset 0x14, size 0xC + +// Members +// total size: 0x24 +typedef struct /* @anon23 */ +{ + // Members + u_char success; // offset 0x0, size 0x1 + u_char data_len; // offset 0x1, size 0x1 + union /* @anon31 */ + { + // total size: 0x2 + BIT bit; // offset 0x0, size 0x2 + u_short set; // offset 0x0, size 0x2 + } button; // offset 0x2, size 0x2 + u_char r3h; // offset 0x4, size 0x1 + u_char r3v; // offset 0x5, size 0x1 + u_char l3h; // offset 0x6, size 0x1 + u_char l3v; // offset 0x7, size 0x1 + u_char apress[12]; // offset 0x8, size 0xC + PRESS press; + union /* @anon31 */ + { + BIT bit; + u_short set; // offset 0x0, size 0x2 + } edge; // offset 0x20, size 0x2 + + union /* @anon31 */ + { + BIT bit; + u_short set; // offset 0x0, size 0x2 + } repeat; // offset 0x22, size 0x2 +} LPPAD; // offset 0x0, size 0x4 + +// total size: 0x10 +typedef struct /* @anon20 */ +{ + LPPAD * lpPad; // offset 0x0, size 0x4 + char L3H; // offset 0x4, size 0x1 + char L3V; // offset 0x5, size 0x1 + char R3H; // offset 0x6, size 0x1 + char R3V; // offset 0x7, size 0x1 + u_int unused[2]; // offset 0x8, size 0x8 +} KEY; // offset 0x1A0, size 0x10 + +typedef struct /* @anon1 */ +{ + FUNC func; + KEY key; + float InitPos[4]; // offset 0x1B0, size 0x10 + float DstPos[4]; // offset 0x1C0, size 0x10 + float moveRange; // offset 0x1D0, size 0x4 + float moveAngle; // offset 0x1D4, size 0x4 + u_char bDash; // offset 0x1D8, size 0x1 + u_char Rebirth; // offset 0x1D9, size 0x1 + u_char bHitOff; // offset 0x1DA, size 0x1 + u_char bDead; // offset 0x1DB, size 0x1 + u_short stayTimer; // offset 0x1DC, size 0x2 + u_short walkTimer; // offset 0x1DE, size 0x2 + u_short approachTimer; // offset 0x1E0, size 0x2 + u_short ClingDmgMyAnim; // offset 0x1E2, size 0x2 + MDLMNG * lpCling; // offset 0x1E4, size 0x4 + int attackOff; // offset 0x1E8, size 0x4 + short RebirthTimer; // offset 0x1EC, size 0x2 + u_short PauseTime; // offset 0x1EE, size 0x2 + u_char bWeak; // offset 0x1F0, size 0x1 + u_char UseSfxHdlNum; // offset 0x1F1, size 0x1 + u_char bFired; // offset 0x1F2, size 0x1 + u_char bFree; // offset 0x1F3, size 0x1 + float rollAng; // offset 0x1F4, size 0x4 + u_short lifecut; // offset 0x1F8, size 0x2 + u_short noDamage; // offset 0x1FA, size 0x2 + short DisableSearch; // offset 0x1FC, size 0x2 + short GuardFrame; // offset 0x1FE, size 0x2 + int SfxHdl[8]; // offset 0x200, size 0x20 + int SeHdl[8]; // offset 0x220, size 0x20 + MDLMNG * lpP019; // offset 0x240, size 0x4 + u_char lifecutscl; // offset 0x244, size 0x1 + u_char captureLock; // offset 0x245, size 0x1 + u_char ClingPos; // offset 0x246, size 0x1 + u_char ClingFree; // offset 0x247, size 0x1 + u_char NoSave; // offset 0x248, size 0x1 + u_char FreeDamage; // offset 0x249, size 0x1 + u_char bEraseDisable; // offset 0x24A, size 0x1 + u_char NoFloorDeadTimer; // offset 0x24B, size 0x1 + u_char bNoFloorDeadDisable; // offset 0x24C, size 0x1 + u_char AppearTypeAlpha; // offset 0x24D, size 0x1 + u_char unused0[2]; // offset 0x24E, size 0x2 + float PowerScl; // offset 0x250, size 0x4 + int MaxHp; // offset 0x254, size 0x4 + int ItemId; // offset 0x258, size 0x4 + float SclLimit; // offset 0x25C, size 0x4 +} PENECTRL; #endif // UNK_H