diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index b284bb0..4d309aa 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -34,6 +34,7 @@ jobs: sh prep_33.sh sh prep_35.sh sh prep_36.sh + sh prep_40.sh python3 build.py ninja -j1 diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..ea1a9c0 --- /dev/null +++ b/LICENSE @@ -0,0 +1,9 @@ +MIT License + +Copyright (c) 2024 the psy-q-decomp contributors + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the " Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice (including the next paragraph) shall be included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/build.py b/build.py index 0518955..1d65e86 100644 --- a/build.py +++ b/build.py @@ -92,6 +92,30 @@ def add_lib_263(srcs, output_dir, lib_name, flags, folder): command='./tools/psy-q-splitter/splitter/target/release/splitter diff_obj_with_lib $LIBRARY $in', description='Checking that $in matches') + + +def add_lib_wibo(srcs, output_dir, lib_name, flags, folder): + for src in srcs: + filename_without_extension = os.path.splitext(os.path.basename(src))[0] + obj_name = f"{output_dir}/{filename_without_extension}.obj" + ninja.build( + obj_name, + 'compile_wibo', + inputs=[src], + variables={'FLAGS': flags, 'FOLDER': folder}) + + # this doesn't generate a file output but ninja apparently needs an output name + ninja.build( + f"{obj_name}.check", + 'check', + inputs=[obj_name], + variables={'LIBRARY': lib_name} + ) + +ninja.rule('compile_wibo', + command='WIBO_DEBUG=1 PSYQ_PATH=build/4.0 COMPILER_PATH=build/4.0 C_INCLUDE_PATH=include build/4.0/wibo build/4.0/CCPSX.EXE $in $FLAGS -o$out', + description='Building $out from $in') + def build_33(): snd_srcs = [ 'src/snd/next.c', @@ -354,9 +378,35 @@ def build_36(): add_lib(spu_srcs, "build/3.6/spu", "./psy-q/3.6/PSX/LIB/LIBSPU.LIB", "-DVERSION=36", "3.6") +def build_40(): + spu_srcs = [ + 'src/spu/s_cb.c', + 'src/spu/s_crwa.c', + 'src/spu/s_dcb.c', + 'src/spu/s_i.c', + # 'src/spu/s_ini.c', + # 'src/spu/s_it.c', + # 'src/spu/s_m_f.c', + 'src/spu/s_m_init.c', + # 'src/spu/s_m_util.c', + # 'src/spu/s_r.c', + # 'src/spu/s_sav.c', + 'src/spu/s_sic.c', + # 'src/spu/s_sk.c', + 'src/spu/s_snv.c', + 'src/spu/s_sr.c', + 'src/spu/s_stm.c', + # 'src/spu/s_stsa.c', + # 'src/spu/s_w.c', + # 'src/spu/s_wp.c', + # 'src/spu/sr_gaks.c', + ] + + add_lib_wibo(spu_srcs, "build/4.0/spu", "./psy-q/4.0/PSX/LIB/LIBSPU.LIB", "-O2 -g0 -G0 -funsigned-char -c -I./src/snd -I./include -DVERSION=40", "4.0") + build_33() build_35() build_36() - +build_40() ninja.close() diff --git a/prep_40.sh b/prep_40.sh new file mode 100644 index 0000000..5f17a30 --- /dev/null +++ b/prep_40.sh @@ -0,0 +1,6 @@ +mkdir -p build/4.0 +curl -sSfL -o build/4.0/wibo https://github.com/decompals/wibo/releases/download/0.6.13/wibo +chmod +x build/4.0/wibo +# put toolchain together +cp -r ./psy-q/4.0/PSYQ/* build/4.0 +cp -r ./psy-q/4.0/COMPILER/* build/4.0 diff --git a/psy-q b/psy-q index 9f541db..2266d67 160000 --- a/psy-q +++ b/psy-q @@ -1 +1 @@ -Subproject commit 9f541dbade4b25bcba449aea0e3dac9ab3cde14b +Subproject commit 2266d676f8de8a7e7a96d9cbb92854f0a55a86a1 diff --git a/src/spu/libspu_i.h b/src/spu/libspu_i.h index 1c328ad..c60c4ef 100644 --- a/src/spu/libspu_i.h +++ b/src/spu/libspu_i.h @@ -161,9 +161,6 @@ extern s32 D_800330A8; extern s32 D_8003309C; -#define SPU_TRANSFER_BY_DMA 0 -#define SPU_TRANSFER_BY_IO 1 - void WaitEvent(s32); s32 _SpuIsInAllocateArea_(u32); extern s32 _spu_rev_startaddr[];