Skip to content

Commit

Permalink
Add stop to 3.3, fix 3.3 compiler
Browse files Browse the repository at this point in the history
  • Loading branch information
sozud committed Mar 2, 2024
1 parent 9aea7b3 commit f5f2abc
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 11 deletions.
12 changes: 7 additions & 5 deletions build.py
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down Expand Up @@ -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',
Expand Down Expand Up @@ -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',

Expand All @@ -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',
Expand All @@ -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 = [
Expand Down
15 changes: 9 additions & 6 deletions prep_33.sh
Original file line number Diff line number Diff line change
@@ -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
16 changes: 16 additions & 0 deletions src/snd/stop.c
Original file line number Diff line number Diff line change
@@ -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;
Expand Down Expand Up @@ -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

0 comments on commit f5f2abc

Please sign in to comment.