From f5f2abcf2183df29ed65d9ca90518ec74c921d88 Mon Sep 17 00:00:00 2001 From: sozud <122322823+sozud@users.noreply.github.com> Date: Sat, 2 Mar 2024 14:00:04 -0800 Subject: [PATCH] Add stop to 3.3, fix 3.3 compiler --- build.py | 12 +++++++----- prep_33.sh | 15 +++++++++------ src/snd/stop.c | 16 ++++++++++++++++ 3 files changed, 32 insertions(+), 11 deletions(-) diff --git a/build.py b/build.py index 1775c2c..a28e1da 100644 --- a/build.py +++ b/build.py @@ -26,12 +26,14 @@ def add_lib_263(srcs, output_dir, lib_name, flags, folder): filename_without_extension = os.path.splitext(os.path.basename(src))[0] obj_name = f"{output_dir}/{filename_without_extension}.obj" + cpp_flags = f"-undef -D__GNUC__=2 {flags} -v -D__OPTIMIZE__ -I./src/snd -I./include -lang-c -Dmips -D__mips__ -D__mips -Dpsx -D__psx__ -D__psx -D__EXTENSIONS__ -D_MIPSEL -D__CHAR_UNSIGNED__ -D_LANGUAGE_C -DLANGUAGE_C" + # run c preprocessor ninja.build( f"{output_dir}/{filename_without_extension}.cpp", 'cpp_263', inputs=[src], - variables={'FLAGS': flags, 'FOLDER': folder}) + variables={'FLAGS': flags, 'FOLDER': folder, 'CPP_FLAGS': cpp_flags}) # run cc1 ninja.build( @@ -69,9 +71,8 @@ def add_lib_263(srcs, output_dir, lib_name, flags, folder): command='sh dosemu_wrapper.sh $in $out $FLAGS $FOLDER', description='Building $out from $in') -cpp_flags = "-undef -D__GNUC__=2 -DVERSION=35 -v -D__OPTIMIZE__ -I./src/snd -I./include -lang-c -Dmips -D__mips__ -D__mips -Dpsx -D__psx__ -D__psx -D__EXTENSIONS__ -D_MIPSEL -D__CHAR_UNSIGNED__ -D_LANGUAGE_C -DLANGUAGE_C" ninja.rule('cpp_263', - command=f'cpp {cpp_flags} $in $out', + command=f'cpp $CPP_FLAGS $in $out', description='Running preprocessor on $out from $in') ninja.rule('cc1_263', @@ -111,6 +112,7 @@ def build_33(): # 'src/snd/sstable.c', # 'src/snd/sstick.c', # 'src/snd/ssvol.c', + 'src/snd/stop.c', # 'src/snd/tempo.c', # 'src/snd/ut_gpa.c', @@ -135,7 +137,7 @@ def build_33(): 'src/snd/vs_vtc.c', ] - add_lib(snd_srcs, "build/3.3/snd", "./psy-q/3.3/PSX/LIB/LIBSND.LIB", "-DVERSION=33", "3.3") + add_lib_263(snd_srcs, "build/3.3/snd", "./psy-q/3.3/PSX/LIB/LIBSND.LIB", "-DVERSION=33", "3.3") spu_srcs = [ 'src/spu/s_cb.c', @@ -160,7 +162,7 @@ def build_33(): 'src/spu/sr_gaks.c', ] - add_lib(spu_srcs, "build/3.3/spu", "./psy-q/3.3/PSX/LIB/LIBSPU.LIB", "-DVERSION=33", "3.3") + add_lib_263(spu_srcs, "build/3.3/spu", "./psy-q/3.3/PSX/LIB/LIBSPU.LIB", "-DVERSION=33", "3.3") def build_35(): snd_srcs = [ diff --git a/prep_33.sh b/prep_33.sh index 02e906e..8b5e3a4 100644 --- a/prep_33.sh +++ b/prep_33.sh @@ -1,6 +1,9 @@ - mkdir -p build/3.3 - # put toolchain together - cp -r ./psy-q/3.3/PSYQ/* build/3.3 - cp -r ./psy-q/cc_2.60/* build/3.3 - # replace aspsx with newer one - cp psy-q/3.5/PSYQ/ASPSX.EXE build/3.3 +mkdir -p build/3.3 +# put toolchain together +cp -r ./psy-q/3.3/PSYQ/* build/3.3 + +wget -O cc1-psx-26.tar.gz https://github.com/Xeeynamo/sotn-decomp/releases/download/cc1-psx-26/cc1-psx-26.tar.gz +tar -xvf cc1-psx-26.tar.gz -C build/3.3 +cp -r ./psy-q/cc_2.60/* build/3.3 +# replace aspsx with newer one +cp psy-q/3.5/PSYQ/ASPSX.EXE build/3.3 diff --git a/src/snd/stop.c b/src/snd/stop.c index 2ea3ab2..a6291bc 100644 --- a/src/snd/stop.c +++ b/src/snd/stop.c @@ -1,6 +1,10 @@ #include "libsnd_i.h" +#if VERSION == 33 +void Snd_stop(s16 arg0, s16 arg1) +#else void _SsSndStop(s16 arg0, s16 arg1) +#endif { int i; struct SeqStruct *score; @@ -41,6 +45,18 @@ void _SsSndStop(s16 arg0, s16 arg1) score->unk7A = 0x7F; } +#if VERSION == 33 +void SsSeqStop(s16 arg0) { + Snd_stop(arg0, 0); +} +#else void SsSeqStop(s16 arg0) { _SsSndStop(arg0, 0); } +#endif +#if VERSION == 33 +void SsSepStop(s16 arg0, s16 arg1) { + Snd_stop(arg0, arg1); +} +#else void SsSepStop(s16 arg0, s16 arg1) { _SsSndStop(arg0, arg1); } +#endif