Added File.c, added Tex.h,

added KuonMenu.h, Menu.h, Cdvd.h

Added missing struct defines, missing function defines
Implement File
This commit is contained in:
2026-08-03 17:41:47 -05:00
committed by Timothy O'Barr
parent b9a30026a0
commit 183a42e7e0
12 changed files with 705 additions and 11 deletions
+6
View File
@@ -0,0 +1,6 @@
#ifndef FSFONT_H
#define FSFONT_H
signed int FsFontSetTexBuf(signed int id /* r2 */, void * pTexFileBuf /* r2 */);
#endif // FSFONT_H
+115
View File
@@ -0,0 +1,115 @@
#ifndef CDVD_H
#define CDVD_H
/*
Compile unit: C:\cs4\Seimei\src\Cdvd.c
Producer: MW MIPS C Compiler
Language: C
*/
static // total size: 0x14C
struct /* @anon1 */ {
// Members
// total size: 0x24
struct /* @anon0 */ {
// Members
unsigned int lsn; // offset 0x0, size 0x4
unsigned int size; // offset 0x4, size 0x4
char name[16]; // offset 0x8, size 0x10
unsigned char date[8]; // offset 0x18, size 0x8
unsigned int flag; // offset 0x20, size 0x4
} cdlfile; // offset 0x0, size 0x24
char fname[128]; // offset 0x24, size 0x80
char sname[128]; // offset 0xA4, size 0x80
signed int state; // offset 0x124, size 0x4
signed int fileType; // offset 0x128, size 0x4
signed int index; // offset 0x12C, size 0x4
signed int fhd; // offset 0x130, size 0x4
signed int size; // offset 0x134, size 0x4
signed int sector; // offset 0x138, size 0x4
unsigned int align; // offset 0x13C, size 0x4
unsigned char retry; // offset 0x140, size 0x1
unsigned char unused[3]; // offset 0x141, size 0x3
unsigned char * * lplpAddr; // offset 0x144, size 0x4
unsigned char * lpDmyData; // offset 0x148, size 0x4
} * lpSetCdvd; // size: 0x4, address: 0x257560
static // total size: 0x14C
struct /* @anon1 */ {
// Members
// total size: 0x24
struct /* @anon0 */ {
// Members
unsigned int lsn; // offset 0x0, size 0x4
unsigned int size; // offset 0x4, size 0x4
char name[16]; // offset 0x8, size 0x10
unsigned char date[8]; // offset 0x18, size 0x8
unsigned int flag; // offset 0x20, size 0x4
} cdlfile; // offset 0x0, size 0x24
char fname[128]; // offset 0x24, size 0x80
char sname[128]; // offset 0xA4, size 0x80
signed int state; // offset 0x124, size 0x4
signed int fileType; // offset 0x128, size 0x4
signed int index; // offset 0x12C, size 0x4
signed int fhd; // offset 0x130, size 0x4
signed int size; // offset 0x134, size 0x4
signed int sector; // offset 0x138, size 0x4
unsigned int align; // offset 0x13C, size 0x4
unsigned char retry; // offset 0x140, size 0x1
unsigned char unused[3]; // offset 0x141, size 0x3
unsigned char * * lplpAddr; // offset 0x144, size 0x4
unsigned char * lpDmyData; // offset 0x148, size 0x4
} * lpLastCdvd; // size: 0x4, address: 0x257564
static // total size: 0x14C
struct /* @anon1 */ {
// Members
// total size: 0x24
struct /* @anon0 */ {
// Members
unsigned int lsn; // offset 0x0, size 0x4
unsigned int size; // offset 0x4, size 0x4
char name[16]; // offset 0x8, size 0x10
unsigned char date[8]; // offset 0x18, size 0x8
unsigned int flag; // offset 0x20, size 0x4
} cdlfile; // offset 0x0, size 0x24
char fname[128]; // offset 0x24, size 0x80
char sname[128]; // offset 0xA4, size 0x80
signed int state; // offset 0x124, size 0x4
signed int fileType; // offset 0x128, size 0x4
signed int index; // offset 0x12C, size 0x4
signed int fhd; // offset 0x130, size 0x4
signed int size; // offset 0x134, size 0x4
signed int sector; // offset 0x138, size 0x4
unsigned int align; // offset 0x13C, size 0x4
unsigned char retry; // offset 0x140, size 0x1
unsigned char unused[3]; // offset 0x141, size 0x3
unsigned char * * lplpAddr; // offset 0x144, size 0x4
unsigned char * lpDmyData; // offset 0x148, size 0x4
} * lpCdvdRead; // size: 0x4, address: 0x257568
// total size: 0x14C
struct /* @anon1 */ {
// Members
// total size: 0x24
struct /* @anon0 */ {
// Members
unsigned int lsn; // offset 0x0, size 0x4
unsigned int size; // offset 0x4, size 0x4
char name[16]; // offset 0x8, size 0x10
unsigned char date[8]; // offset 0x18, size 0x8
unsigned int flag; // offset 0x20, size 0x4
} cdlfile; // offset 0x0, size 0x24
char fname[128]; // offset 0x24, size 0x80
char sname[128]; // offset 0xA4, size 0x80
signed int state; // offset 0x124, size 0x4
signed int fileType; // offset 0x128, size 0x4
signed int index; // offset 0x12C, size 0x4
signed int fhd; // offset 0x130, size 0x4
signed int size; // offset 0x134, size 0x4
signed int sector; // offset 0x138, size 0x4
unsigned int align; // offset 0x13C, size 0x4
unsigned char retry; // offset 0x140, size 0x1
unsigned char unused[3]; // offset 0x141, size 0x3
unsigned char * * lplpAddr; // offset 0x144, size 0x4
unsigned char * lpDmyData; // offset 0x148, size 0x4
} CdvdReadSt[256]; // size: 0x14C00, address: 0xA01200
unsigned int GlobalLoadTimer; // size: 0x4, address: 0x257894
#endif // CDVD_H
+217 -9
View File
@@ -1,19 +1,227 @@
#include "File.h"
#include "Cdvd.h"
#include "Game.h"
#include "Model.h"
#include "Tex.h"
#include "Unk.h"
#include "common.h"
#include "lib/FsFont.h"
#include "menu/KuonMenu.h"
#include "menu/Menu.h"
INCLUDE_ASM("config/asm/nonmatchings/cs4/Seimei/src/File", AfterFileReadFunc);
unsigned char ScePath[128]; // size: 0x80, address: 0x3254B0
unsigned char RootPath[128]; // size: 0x80, address: 0x325530
INCLUDE_ASM("config/asm/nonmatchings/cs4/Seimei/src/File", FileCheckAsyncBusy);
void AfterFileReadFunc(u8 *lpAddr, s32 index, s32 fileType, s32 size) {
switch (fileType) {
case 0x0:
case 0x80:
RemapBinderFile(lpAddr);
SetMdlBndFile(index);
if (GameSt.GameMode != 4) {
if (index == 0) {
MyAppear(0, &MdlMng[0xA0], VW, 0.0f);
}
if ((GameSt.PlayerId != 2) && (index == 0x10E)) {
InitMyWeapon(GameSt.PlayerId);
break;
}
}
break;
case 0x1:
RemapCamData(lpAddr);
break;
INCLUDE_ASM("config/asm/nonmatchings/cs4/Seimei/src/File", FileBackReadControl);
case 0x2:
RemapMapFile(lpAddr);
ReadMapMdlFile(lpAddr);
break;
INCLUDE_ASM("config/asm/nonmatchings/cs4/Seimei/src/File", FileReadControl);
case 0x3:
break;
INCLUDE_ASM("config/asm/nonmatchings/cs4/Seimei/src/File", FileRead);
case 0x4:
break;
INCLUDE_ASM("config/asm/nonmatchings/cs4/Seimei/src/File", InitFileRead);
case 0x5:
RemapMdlLink(lpAddr);
SetMdlData(index, lpAddr);
break;
INCLUDE_ASM("config/asm/nonmatchings/cs4/Seimei/src/File", GetRootPath);
case 0x6:
RemapMdlLink(lpAddr);
SetTexList(lpAddr, 2);
break;
INCLUDE_ASM("config/asm/nonmatchings/cs4/Seimei/src/File", ReadRootPath);
case 0x7:
RemapMdlLink(lpAddr);
SetTexList(lpAddr, 2);
FsFontSetTexBuf(2,
GetTexMngByName(GetGameTexList(), "iconfont.tm2")->lpTm2);
ItemMng_CallBack_FinishLoadFile_ItemList();
break;
INCLUDE_ASM("config/asm/nonmatchings/cs4/Seimei/src/File", InitFileSystem);
case 0x8:
RemapMdlLink(lpAddr);
SetTexList(lpAddr, 1);
SetMapTexListFile(index);
break;
case 0x9:
RemapMdlLink(lpAddr);
SetAniData(index, lpAddr);
break;
case 0xA:
RemapMdlLink(lpAddr);
SetHdlData(index, lpAddr);
break;
case 0xB:
RemapMdlLink(lpAddr);
SetSdlData(index, lpAddr);
break;
case 0xC:
break;
case 0xD:
RemapBinderFile(lpAddr);
Rta_BndReadEndCallBack();
break;
case 0xE:
break;
case 0x11:
RemapMdlLink(lpAddr);
SetTexList(lpAddr, 1);
break;
case 0xF:
break;
case 0x10:
RemapBinderFile(lpAddr);
if ((Menu_GetLastReloadType() & 0xFFFF) == 0x8000) {
Menu_FileReadCallBack(0x8000);
KnMenuMng_ReMakeMenu(KUON_MENU__MAKE_TITLE);
break;
}
if ((Menu_GetLastReloadType(0x8000) & 0xFFFF) == 0x4000) {
Menu_FileReadCallBack(KUON_MENU_RELOAD_FLAG_GAME);
KnMenuMng_ReMakeMenu(KUON_MENU__MAKE_GAME);
SetFixMemoryEndIndex();
break;
}
break;
case 0x12:
SetScript(size, lpAddr);
break;
case 0x13:
break;
case 0x14:
break;
case 0x81:
break;
case 0x15:
RemapDramaData(lpAddr);
if (index != 0) {
SetDramaData();
break;
}
break;
case 0x16:
SND_LoadSecFromFileInMemory(index & 0xFF, lpAddr);
break;
case 0x21:
SND_LoadRandSeFromFileInMemory(lpAddr);
break;
case 0x17:
RemapBinderFile(lpAddr);
break;
case 0x18:
SND_SqPrepare();
break;
case 0x19:
SetSceneBndFile();
break;
case 0x1A:
break;
case 0x1B:
SfxFIO_CallBack_FinishLoadSfxBindFile();
break;
case 0x1C:
break;
case 0x1D:
SetRiddleData();
break;
case 0x1E:
break;
case 0x1F:
RemapMiz(lpAddr);
break;
case 0x20:
break;
case 0x82:
break;
}
return;
}
int FileCheckAsyncBusy(void) { return CdvdCheckAsyncBusy(); }
void FileBackReadControl(void) { CdvdBackReadProc(); }
void FileReadControl(int bDraw) { CdvdAsyncProc(bDraw); }
signed int FileRead(char *filename /* r2 */, signed int size /* r2 */,
unsigned char **lpBuf /* r2 */,
unsigned char bSynch /* r2 */, signed int index /* r2 */,
signed int filetype /* r2 */, unsigned int align /* r2 */) {
return CdvdRead(filename, size, lpBuf, bSynch, index, filetype, align);
}
void InitFileRead(void) { InitCdvdRead(); }
unsigned char *GetRootPath() { return RootPath; }
void ReadRootPath() {
memset(RootPath, 0, 0x80);
memset(ScePath, 0, 0x80);
sprintf((char *)RootPath, "cdrom0:\\");
sprintf((char *)ScePath, "cdrom0:\\");
}
void InitFileSystem() {
/* anonymous block */
// Range: 0x138C20 -> 0x138C78
sceSifInitRpc(0);
sceSifInitIopHeap();
sceSifLoadFileReset();
sceFsReset();
while (!sceCdInit(0)) {
}
sceCdMmode(2);
}
+3
View File
@@ -1,6 +1,9 @@
#ifndef FILE_H
#define FILE_H
extern unsigned char ScePath[128]; // size: 0x80, address: 0x3254B0
extern unsigned char RootPath[128]; // size: 0x80, address: 0x325530
void InitFileRead();
void InitFileSystem();
void ReadRootPath();
+1
View File
@@ -52,4 +52,5 @@ extern GameState GameSt; // size: 0x30, address: 0x3A5E10
int GameLoop();
void InitGameData();
void InitGameDataAfterLoad();
void * GetGameTexList();
#endif // GAME_H
+68
View File
@@ -0,0 +1,68 @@
#ifndef TEX_H
#define TEX_H
/*
Compile unit: C:\cs4\Seimei\src\Tex.c
Producer: MW MIPS C Compiler
Language: C
Code range: 0x0013FA80 -> 0x0013FB18
*/
// Range: 0x13FA80 -> 0x13FB18
// total size: 0x60
struct /* @anon0 */ {
// Members
unsigned char bUse; // offset 0x0, size 0x1
unsigned char unused0; // offset 0x1, size 0x1
unsigned short id; // offset 0x2, size 0x2
// total size: 0x20
struct /* @anon1 */ {
// Members
unsigned int size; // offset 0x0, size 0x4
unsigned int wnum; // offset 0x4, size 0x4
unsigned char dummy[5]; // offset 0x8, size 0x5
unsigned char compare; // offset 0xD, size 0x1
unsigned short tex_id; // offset 0xE, size 0x2
// total size: 0x8
struct /* @anon5 */ {
// Members
unsigned long TBP0 : 14; // offset 0x0, size 0x4
unsigned long TBW : 6; // offset 0x0, size 0x4
unsigned long PSM : 6; // offset 0x0, size 0x4
unsigned long TW : 4; // offset 0x0, size 0x4
unsigned long TH : 4; // offset 0x0, size 0x4
unsigned long TCC : 1; // offset 0x0, size 0x4
unsigned long TFX : 2; // offset 0x0, size 0x4
unsigned long CBP : 14; // offset 0x0, size 0x4
unsigned long CPSM : 4; // offset 0x0, size 0x4
unsigned long CSM : 1; // offset 0x0, size 0x4
unsigned long CSA : 5; // offset 0x0, size 0x4
unsigned long CLD : 3; // offset 0x0, size 0x4
} tex0; // offset 0x10, size 0x8
// total size: 0x8
struct /* @anon7 */ {
// Members
unsigned long LCM : 1; // offset 0x0, size 0x4
unsigned long pad01 : 1; // offset 0x0, size 0x4
unsigned long MXL : 3; // offset 0x0, size 0x4
unsigned long MMAG : 1; // offset 0x0, size 0x4
unsigned long MMIN : 3; // offset 0x0, size 0x4
unsigned long MTBA : 1; // offset 0x0, size 0x4
unsigned long pad10 : 9; // offset 0x0, size 0x4
unsigned long L : 2; // offset 0x0, size 0x4
unsigned long pad21 : 11; // offset 0x0, size 0x4
unsigned long K : 12; // offset 0x0, size 0x4
unsigned long pad44 : 20; // offset 0x0, size 0x4
} tex1; // offset 0x18, size 0x8
} * lpTm2; // offset 0x4, size 0x4
void * lpTexList; // offset 0x8, size 0x4
signed int unused1[1]; // offset 0xC, size 0x4
unsigned char texName[32]; // offset 0x10, size 0x20
unsigned char texNameBase[32]; // offset 0x30, size 0x20
signed int texW; // offset 0x50, size 0x4
signed int texH; // offset 0x54, size 0x4
signed int texTBW; // offset 0x58, size 0x4
signed int texPSM; // offset 0x5C, size 0x4
} * GetTexMngByName(void * lpTexList /* r18 */, char * texname /* r17 */);
#endif // TEX_H
+2
View File
@@ -31,6 +31,8 @@ extern struct /* @anon0 */ {
unsigned short cam_id; // offset 0x6, size 0x2
}* lpSceneLoad; // size: 0x4, address: 0x257530
static float VZ[4]; // size: 0x10, address: 0x228720
static float VW[4]; // size: 0x10, address: 0x228730
#endif // UNK_H
+24
View File
@@ -0,0 +1,24 @@
#ifndef KUONMENU_H
#define KUONMENU_H
enum _KUON_MENU__RELOAD_FLAG_EN {
KUON_MENU_RELOAD_FLAG_NONE = 0,
KUON_MENU_RELOAD_FLAG_TITLE_ = 1,
KUON_MENU_RELOAD_FLAG_START = 2,
KUON_MENU_RELOAD_FLAG_MAIN = 4,
KUON_MENU_RELOAD_FLAG_SAVE = 8,
KUON_MENU_RELOAD_FLAG_LOAD = 16,
KUON_MENU_RELOAD_FLAG_DEAD = 32,
KUON_MENU_RELOAD_FLAG_MM_TOP = 64,
KUON_MENU_RELOAD_FLAG_MM_EQUIP = 128,
KUON_MENU_RELOAD_FLAG_MM_ITEM = 256,
KUON_MENU_RELOAD_FLAG_MM_BOOK = 512,
KUON_MENU_RELOAD_FLAG_MM_MAP = 1024,
KUON_MENU_RELOAD_FLAG_MM_SET = 2048,
KUON_MENU_RELOAD_FLAG_MM_END = 4096,
KUON_MENU_RELOAD_FLAG_DOC = 8192,
KUON_MENU_RELOAD_FLAG_GAME = 16384,
KUON_MENU_RELOAD_FLAG_TITLE = -32768,
};
#endif // KUONMENU_H
+27
View File
@@ -0,0 +1,27 @@
#ifndef MENU_H
#define MENU_H
enum _KUON_MENU__TYPE_EN {
KUON_MENU__TEST_MENU = 0,
KUON_MENU__TITLE_MENU = 1,
KUON_MENU__START_MENU = 2,
KUON_MENU__MAIN_MENU = 3,
KUON_MENU__SAVE_MENU = 4,
KUON_MENU__LOAD_MENU = 5,
KUON_MENU__MAP_MENU = 6,
KUON_MENU__ITEM_MENU = 7,
KUON_MENU__MSG_MENU = 8,
KUON_MENU__SET_MENU = 9,
KUON_MENU__END_SAVE_MENU = 10,
KUON_MENU__DEAD_MENU = 11,
KUON_MENU__MENU_NUM = 12,
KUON_MENU__MAKE_NONE = 100,
KUON_MENU__MAKE_TITLE = 101,
KUON_MENU__MAKE_GAME = 102,
KUON_MENU__DMY_MENU = 999,
};
#endif // MENU_H