diff --git a/configure.py b/configure.py index 05c167f..d7abac0 100755 --- a/configure.py +++ b/configure.py @@ -62,7 +62,7 @@ TOOLS_DIR = ROOT / "tools" CROSS = "mips-ps2-decompals-" COMPILER = "mwcps2-3.0b52-030722" -COMPILER_FLAGS = "-O3,p -sym on -str readonly" +COMPILER_FLAGS = "-O3,p -sym on -str readonly -cwd source" PLATFORM = "x86_64" # @todo get this from makefile # PLATFORM = "macos" @@ -216,16 +216,18 @@ def build_stuff( # Rules ld_args = "-map -sym on,elf -noinhibit-exec -main _start -o $out $lcf $objects" + rel_root = Path(os.path.relpath(ROOT, config_dir)) + ld = Path("..", (Path("tools") / "cc" / COMPILER / "mwldps2.exe")) - cpp = Path("..", (Path("tools") / "cc" / COMPILER / "mwccps2.exe")) + cpp = Path("tools") / "cc" / COMPILER / "mwccps2.exe" + + print({cpp}) + print({common_includes}) ninja.rule( "as", description="as $in", - # NOTE: Japanese strings are EUC-JP encoded!! - # We need to convert them from (-f) UTF-8 to (-t) EUC-JP while compiling, - # otherwise Japanese strings will be compiled wrong! - command=f"{CROSS}as -no-pad-sections -EL -march=5900 -mabi=eabi -mno-branch-relocs -I{src_path.parent / 'include'} -Iinclude -o $out $in", + command=f"{CROSS}as -no-pad-sections -EL -march=5900 -mabi=eabi -I{src_path.parent / 'include'} -o $out", ) ninja.rule( @@ -234,8 +236,6 @@ def build_stuff( command=( f"s_in=$$(echo $in.S | sed 's,^[^/]*/[^/]*/,cc-src/,') && " # .............. 1) remove ../../ from path + prefix with cc-src/ + suffix with .S and store it into s_in var: ../src/file.c -> s_in=cc-src/src/file.c.S f'mkdir -p $$(dirname "$$s_in") && ' # ..................................... 2) create directory from s_in var: s_in=cc-src/src/path/to/file.c.S -> mkdir -p cc-src/src/path/to/ - f"{game_compile_cmd.replace(' -c ', ' -S ')} $in -o $$s_in && " # .......... 3) replace -c with -S in gcc command to generate intermediate assembly file instead of object - f"python3 {ROOT}/tools/python/fix_asm_matching.py {language} $$s_in && " # . 4) fix assembly file using known patterns with tools/python/fix_asm_matching.py f"{game_compile_cmd} $$s_in -o $out && " # ................................. 5) compile assembly file into object f"{ld}strip $out -N dummy-symbol-name" # ................................ 6) strip 'dummy-symbol-name' from object ), @@ -247,18 +247,6 @@ def build_stuff( command=f"{game_compile_cmd} $in -o $out && {ld}strip $out -N dummy-symbol-name", ) - ninja.rule( - "cc-eucjp", - description="convert source to EUC-JP encoding and compile same as 'cc'", - command=( - f"eucjp_in=$$(echo $in.eucjp.c | sed 's,^[^/]*/[^/]*/,cc-src/,') && " # . 1) remove ../../ from path + prefix with cc-src/ + suffix with .eucjp.c and store it into eucjp_in var: ../src/file.c -> eucjp_in=cc-src/src/file.c.eucjp.c - f'mkdir -p $$(dirname "$$eucjp_in") && ' # .............................. 2) create directory from eucjp_in var: s_in=cc-src/src/path/to/file.c.eucjp.c -> mkdir -p cc-src/src/path/to/ - #f"iconv -o $$eucjp_in -f=UTF-8 -t=EUC-JP $in && " # ..................... 3) convert source file to EUC-JP (save converted source to cc-src/src/file.c.eucjp.c) - f'{game_compile_cmd} -I$$(dirname "$in") $$eucjp_in -o $out && ' # ...... 4) compile converted source file into object (also add original source directory as include path to allow relative imports) - f"{CROSS}strip $out -N dummy-symbol-name" # ............................. 5) strip 'dummy-symbol-name' from object - ), - ) - #ninja.rule( # "libcc", # description="cc $in", diff --git a/include/ee/eekernel.h b/include/ee/eekernel.h index 5b17ac8..882d848 100644 --- a/include/ee/eekernel.h +++ b/include/ee/eekernel.h @@ -22,8 +22,8 @@ typedef struct { void *gpReg; int initPriority; int currentPriority; - u_int attr; - u_int option; + unsigned int attr; + unsigned int option; int waitType; int waitId; int wakeupCount; @@ -34,8 +34,8 @@ typedef struct { int maxCount; int initCount; int numWaitThreads; - u_int attr; - u_int option; + unsigned int attr; + unsigned int option; } SemaParam; extern void *_gp; diff --git a/src/cs4/Seimei/src/Fade.h b/src/cs4/Seimei/src/Fade.h index ffca37a..0bf255a 100644 --- a/src/cs4/Seimei/src/Fade.h +++ b/src/cs4/Seimei/src/Fade.h @@ -3,5 +3,7 @@ void InitFadeControl(); +void SetFadeMng(unsigned char Type, signed int * Col, signed int Timer, void (* lpMidFunc)(), void (* lpEndFunc)(), signed int OutEnd, signed int StartIn); + #endif // FADE_H \ No newline at end of file diff --git a/src/cs4/Seimei/src/Game.h b/src/cs4/Seimei/src/Game.h index 6055569..4110742 100644 --- a/src/cs4/Seimei/src/Game.h +++ b/src/cs4/Seimei/src/Game.h @@ -1,10 +1,51 @@ #ifndef GAME_H #define GAME_H -int GameLoop(); +extern struct { + // Members + unsigned int SystemCounter; // offset 0x0, size 0x4 + unsigned char ControlMode; // offset 0x4, size 0x1 + unsigned char GameMode; // offset 0x5, size 0x1 + unsigned char GameModePrev; // offset 0x6, size 0x1 + unsigned char DebugMode; // offset 0x7, size 0x1 + unsigned char StopMode; // offset 0x8, size 0x1 + unsigned char sceneNo; // offset 0x9, size 0x1 + unsigned char padport; // offset 0xA, size 0x1 + unsigned char ShadowTest; // offset 0xB, size 0x1 + unsigned char DepthTest; // offset 0xC, size 0x1 + unsigned char ScriptMode; // offset 0xD, size 0x1 + unsigned char DizzyTest; // offset 0xE, size 0x1 + unsigned char Pause; // offset 0xF, size 0x1 + unsigned char EnePause; // offset 0x10, size 0x1 + unsigned char EnemyOff; // offset 0x11, size 0x1 + unsigned char FadedTest; // offset 0x12, size 0x1 + unsigned char PeepMask; // offset 0x13, size 0x1 + unsigned char PlayerId; // offset 0x14, size 0x1 + unsigned char PadVib; // offset 0x15, size 0x1 + unsigned char KeyConfType; // offset 0x16, size 0x1 + unsigned char EneSearchOff; // offset 0x17, size 0x1 + unsigned char GameLevel; // offset 0x18, size 0x1 + unsigned char StartEquip; // offset 0x19, size 0x1 + unsigned char PenanceMode; // offset 0x1A, size 0x1 + unsigned char NineHitNum; // offset 0x1B, size 0x1 + unsigned char NegaPosi; // offset 0x1C, size 0x1 + unsigned char LoadStart; // offset 0x1D, size 0x1 + char Brightness; // offset 0x1E, size 0x1 + unsigned char GlareId; // offset 0x1F, size 0x1 + unsigned char MyAllAttack; // offset 0x20, size 0x1 + unsigned char DebugMenuOn; // offset 0x21, size 0x1 + unsigned char Sugoroku; // offset 0x22, size 0x1 + unsigned char TutorialOff; // offset 0x23, size 0x1 + float AmbRate; // offset 0x24, size 0x4 + unsigned char ClearCount[3]; // offset 0x28, size 0x3 + unsigned char ExtraClear; // offset 0x2B, size 0x1 + unsigned char VoiceLanguage; // offset 0x2C, size 0x1 + unsigned char LastLanguage; // offset 0x2D, size 0x1 + unsigned char unused[2]; // offset 0x2E, size 0x2 +} GameSt; // size: 0x30, address: 0x3A5E10 + +int GameLoop(); void InitGameData(); void InitGameDataAfterLoad(); - - -#endif // GAME_H \ No newline at end of file +#endif // GAME_H diff --git a/src/cs4/Seimei/src/Main.c b/src/cs4/Seimei/src/Main.c index fa7aa57..3399b48 100644 --- a/src/cs4/Seimei/src/Main.c +++ b/src/cs4/Seimei/src/Main.c @@ -12,8 +12,14 @@ #include "Title.h" #include "common.h" #include "ee/eekernel.h" +#include "ee/registers.h" +#include "sce/libcdvd.h" #include "typedefs.h" +int gTime; +int GoToEndingFlag; +int GoToTitleFlag; + void SetGoToEndingFade(void) { SetFadeMng(1, (sceVu0IVECTOR){0}, 30, NULL, SetGoToEndingFlag, 0, 0); SND_RemoveSound(); diff --git a/src/cs4/Seimei/src/Main.h b/src/cs4/Seimei/src/Main.h index ca41c45..006290a 100644 --- a/src/cs4/Seimei/src/Main.h +++ b/src/cs4/Seimei/src/Main.h @@ -1,6 +1,11 @@ #ifndef MAIN_H #define MAIN_H +extern int gTime; +extern int GoToEndingFlag; +extern int GoToTitleFlag; + + void SetGoToEndingFade(); int CheckGoToEndingFlag(); void SetGoToEndingFlag();