mirror of
https://github.com/Xeeynamo/sotn-decomp.git
synced 2024-11-23 04:59:41 +00:00
9112ccc88c
I documented all the `PLAYER.step` for Richter and got the meaning of most of the functions with their parameters. There are some additional renaming and magic numbers documented that are not worth to mention individually. I plan to get rid of `EntityTypes` as it is not sustainable to document 256 combination of entities. Instead I am thinking it would be a better approach to document the `g_Entities` indices as ranges. For example from `32` to `47` we have particles, from `48` to `64` we have player entities that can hit the stage entities and so on. I re-organised and re-imported some of the data close to the function that use them. This will allow me to later split entities into their own units as separate C files.
426 lines
11 KiB
CMake
426 lines
11 KiB
CMake
cmake_minimum_required(VERSION 3.10)
|
|
|
|
project(Sound)
|
|
|
|
set(CMAKE_CXX_STANDARD 17)
|
|
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
|
|
|
if (WIN32)
|
|
set(CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake)
|
|
endif()
|
|
|
|
if (CMAKE_CXX_COMPILER_ID MATCHES "GNU|Clang|AppleClang")
|
|
set(CMAKE_BUILD_TYPE Debug)
|
|
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fsanitize=address")
|
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fsanitize=address")
|
|
set(CMAKE_LINKER_FLAGS "${CMAKE_LINKER_FLAGS} -fsanitize=address")
|
|
|
|
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wno-implicit-function-declaration")
|
|
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wno-incompatible-pointer-types")
|
|
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wno-int-conversion")
|
|
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wno-return-mismatch")
|
|
endif()
|
|
|
|
if (CMAKE_CXX_COMPILER_ID STREQUAL "AppleClang")
|
|
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wno-implicit-function-declaration")
|
|
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wno-return-type")
|
|
endif()
|
|
|
|
find_package(SDL2 REQUIRED)
|
|
|
|
set(SOURCE_FILES_PC
|
|
src/pc/log.c
|
|
src/pc/stubs.c
|
|
src/pc/sotn.c
|
|
src/pc/pc.c
|
|
src/pc/io.c
|
|
src/pc/str.c
|
|
src/pc/sim_pc.c
|
|
src/pc/pl_arc.c
|
|
src/pc/pl_ric.c
|
|
src/pc/stages/stage_loader.c
|
|
src/pc/stages/stage_dummy.c
|
|
src/pc/weapon_pc.c
|
|
src/pc/psxsdk/PsyCross/src/gte/PsyX_GTE.cpp
|
|
src/pc/psxsdk/PsyCross/src/gte/inline_c.c
|
|
src/pc/psxsdk/PsyCross/src/gte/libgte_.c
|
|
|
|
)
|
|
|
|
if(WIN32)
|
|
list(APPEND SOURCE_FILES_PC src/pc/plat_win.c)
|
|
else()
|
|
list(APPEND SOURCE_FILES_PC src/pc/plat_unix.c)
|
|
endif()
|
|
|
|
set(SOURCE_FILES_PSX_SDK
|
|
src/main/psxsdk/libgpu/ext.c
|
|
src/main/psxsdk/libgpu/prim.c
|
|
)
|
|
|
|
set(WANT_LIBSND_LLE FALSE CACHE BOOL "Whether to append use LLE for libsnd")
|
|
|
|
if(WANT_LIBSND_LLE)
|
|
set(SOURCE_FILES_LIBSND_LLE
|
|
# libsnd
|
|
src/main/psxsdk/libsnd/adsr.c
|
|
src/main/psxsdk/libsnd/cres.c
|
|
src/main/psxsdk/libsnd/decre.c
|
|
src/main/psxsdk/libsnd/libsnd_i.h
|
|
src/main/psxsdk/libsnd/next.c
|
|
src/main/psxsdk/libsnd/pause.c
|
|
src/main/psxsdk/libsnd/play.c
|
|
src/main/psxsdk/libsnd/replay.c
|
|
src/main/psxsdk/libsnd/scsmvol.c
|
|
src/main/psxsdk/libsnd/scssattr.c
|
|
src/main/psxsdk/libsnd/scssvol.c
|
|
src/main/psxsdk/libsnd/seqinit.c
|
|
src/main/psxsdk/libsnd/seqread.c
|
|
src/main/psxsdk/libsnd/seskoff.c
|
|
src/main/psxsdk/libsnd/seskon.c
|
|
src/main/psxsdk/libsnd/sscall.c
|
|
src/main/psxsdk/libsnd/ssclose.c
|
|
src/main/psxsdk/libsnd/ssend.c
|
|
src/main/psxsdk/libsnd/ssinit.c
|
|
src/main/psxsdk/libsnd/ssinit_h.c
|
|
src/main/psxsdk/libsnd/ssplay.c
|
|
src/main/psxsdk/libsnd/ssquit.c
|
|
src/main/psxsdk/libsnd/ssstart.c
|
|
src/main/psxsdk/libsnd/sstable.c
|
|
src/main/psxsdk/libsnd/sstick.c
|
|
src/main/psxsdk/libsnd/ssvol.c
|
|
src/main/psxsdk/libsnd/stop.c
|
|
src/main/psxsdk/libsnd/tempo.c
|
|
src/main/psxsdk/libsnd/ut_gpa.c
|
|
src/main/psxsdk/libsnd/ut_gva.c
|
|
src/main/psxsdk/libsnd/ut_rdel.c
|
|
src/main/psxsdk/libsnd/ut_rdep.c
|
|
src/main/psxsdk/libsnd/ut_rev.c
|
|
src/main/psxsdk/libsnd/ut_rfb.c
|
|
src/main/psxsdk/libsnd/ut_roff.c
|
|
src/main/psxsdk/libsnd/ut_ron.c
|
|
src/main/psxsdk/libsnd/ut_sva.c
|
|
src/main/psxsdk/libsnd/vm_doff.c
|
|
src/main/psxsdk/libsnd/vm_don.c
|
|
src/main/psxsdk/libsnd/vm_vsu.c
|
|
src/main/psxsdk/libsnd/vmanager.c
|
|
src/main/psxsdk/libsnd/vs_mono.c
|
|
src/main/psxsdk/libsnd/vs_srv.c
|
|
src/main/psxsdk/libsnd/vs_vab.c
|
|
src/main/psxsdk/libsnd/vs_vfb.c
|
|
src/main/psxsdk/libsnd/vs_vh.c
|
|
src/main/psxsdk/libsnd/vs_vtb.c
|
|
src/main/psxsdk/libsnd/vs_vtbp.c
|
|
src/main/psxsdk/libsnd/vs_vtc.c
|
|
|
|
# libspu
|
|
src/main/psxsdk/libspu/s_cb.c
|
|
src/main/psxsdk/libspu/s_crwa.c
|
|
src/main/psxsdk/libspu/s_dcb.c
|
|
src/main/psxsdk/libspu/s_gva.c
|
|
src/main/psxsdk/libspu/s_i.c
|
|
src/main/psxsdk/libspu/s_ini.c
|
|
src/main/psxsdk/libspu/s_it.c
|
|
src/main/psxsdk/libspu/s_itc.c
|
|
src/main/psxsdk/libspu/s_m_f.c
|
|
src/main/psxsdk/libspu/s_m_init.c
|
|
src/main/psxsdk/libspu/s_m_m.c
|
|
src/main/psxsdk/libspu/s_m_util.c
|
|
src/main/psxsdk/libspu/s_m_wsa.c
|
|
src/main/psxsdk/libspu/s_n2p.c
|
|
src/main/psxsdk/libspu/s_q.c
|
|
src/main/psxsdk/libspu/s_r.c
|
|
src/main/psxsdk/libspu/s_sav.c
|
|
src/main/psxsdk/libspu/s_sca.c
|
|
src/main/psxsdk/libspu/s_si.c
|
|
src/main/psxsdk/libspu/s_sic.c
|
|
src/main/psxsdk/libspu/s_sk.c
|
|
src/main/psxsdk/libspu/s_snv.c
|
|
src/main/psxsdk/libspu/s_sr.c
|
|
src/main/psxsdk/libspu/s_srmp.c
|
|
src/main/psxsdk/libspu/s_stm.c
|
|
src/main/psxsdk/libspu/s_stsa.c
|
|
src/main/psxsdk/libspu/s_sva.c
|
|
src/main/psxsdk/libspu/s_w.c
|
|
src/main/psxsdk/libspu/s_wp.c
|
|
src/main/psxsdk/libspu/spu.c
|
|
src/main/psxsdk/libspu/sr_gaks.c
|
|
|
|
src/pc/psxsdk/emu.cpp
|
|
src/pc/psxsdk/mednafen/spu.cpp
|
|
)
|
|
list(APPEND SOURCE_FILES_PSX_SDK ${SOURCE_FILES_LIBSND_LLE})
|
|
endif()
|
|
|
|
set(SOURCE_FILES_MOCK_SDK
|
|
src/pc/psxsdk/libapi.c
|
|
src/pc/psxsdk/libetc.c
|
|
src/pc/psxsdk/libgpu.c
|
|
src/pc/psxsdk/libgte.c
|
|
src/pc/psxsdk/libgs.c
|
|
src/pc/psxsdk/libcd.c
|
|
src/pc/psxsdk/libcard.c
|
|
src/pc/psxsdk/libspu.c
|
|
src/pc/psxsdk/libsnd.c
|
|
src/pc/psxsdk/cdc.c
|
|
)
|
|
|
|
set(SOURCE_FILES_3RD
|
|
src/pc/3rd/cJSON/cJSON.c
|
|
)
|
|
|
|
set(SOURCE_FILES_DRA
|
|
src/dra/42398.c
|
|
src/dra/play.c
|
|
src/dra/loading.c
|
|
src/dra/pads.c
|
|
src/dra/save_mgr_pre.c
|
|
src/dra/save_mgr.c
|
|
src/dra/4A538.c
|
|
src/dra/collider.c
|
|
src/dra/demo.c
|
|
src/dra/5087C.c
|
|
src/dra/lba_stage.c
|
|
src/dra/config_us.c
|
|
src/dra/menu.c
|
|
src/dra/5D5BC.c
|
|
src/dra/d_C910.c
|
|
src/dra/627C4.c
|
|
src/dra/63ED4.c
|
|
src/dra/d_CD80.c
|
|
src/dra/692E8.c
|
|
src/dra/6D59C.c
|
|
src/dra/704D0.c
|
|
src/dra/71830.c
|
|
src/dra/72BB0.c
|
|
src/dra/75F54.c
|
|
src/dra/78D0C.c
|
|
src/dra/d_CF74.c
|
|
src/dra/7A4D0.c
|
|
src/dra/7E4BC.c
|
|
src/dra/d_DBD4.c
|
|
src/dra/d_E294.c
|
|
src/dra/d_10798.c
|
|
src/dra/843B0.c
|
|
src/dra/8A0A4.c
|
|
src/dra/8D3E8.c
|
|
src/dra/91EBC.c
|
|
src/dra/92F60.c
|
|
src/dra/93290.c
|
|
src/dra/93BDC.c
|
|
src/dra/94F50.c
|
|
src/dra/953A0.c
|
|
src/dra/d_24CEC.c
|
|
src/dra/d_2F324.c
|
|
src/dra/d_3B0D4.c
|
|
src/dra/bss.c
|
|
)
|
|
|
|
set(SOURCE_FILES_RIC
|
|
src/ric/pl_header.c
|
|
src/ric/1AC60.c
|
|
src/ric/1FCD0.c
|
|
src/ric/20920.c
|
|
src/ric/24788.c
|
|
src/ric/2A060.c
|
|
src/ric/319C4.c
|
|
src/ric/spriteparts.c
|
|
src/ric/1CB04.c
|
|
src/ric/202A8.c
|
|
src/ric/21250.c
|
|
src/ric/26C84.c
|
|
src/ric/2C4C4.c
|
|
src/ric/e_giant_spinning_cross.c
|
|
src/ric/bss.c
|
|
src/ric/d_18568.c
|
|
src/ric/pl_anims.c
|
|
)
|
|
|
|
set(SOURCE_FILES_TT_000
|
|
src/servant/tt_000/10E8.c
|
|
src/servant/tt_000/448.c
|
|
src/servant/tt_000/45E4.c
|
|
src/servant/tt_000/4A8.c
|
|
src/servant/tt_000/608.c
|
|
src/servant/tt_000/spriteparts.c
|
|
)
|
|
|
|
set(SOURCE_FILES_STAGE_SEL
|
|
src/pc/stages/stage_sel.c
|
|
src/st/sel/banks.c
|
|
src/st/sel/CD54.c
|
|
src/st/sel/2C048.c
|
|
src/st/sel/33164.c
|
|
src/st/sel/3410C.c
|
|
src/st/sel/3585C.c
|
|
src/st/sel/3642C.c
|
|
)
|
|
|
|
set(SOURCE_FILES_STAGE_WRP
|
|
src/pc/stages/stage_wrp.c
|
|
src/st/wrp/d_1b8.c
|
|
src/st/wrp/e_laydef.c
|
|
src/st/wrp/e_init.c
|
|
src/st/wrp/st_debug.c
|
|
src/st/wrp/e_breakable.c
|
|
src/st/wrp/d_608.c
|
|
src/st/wrp/rooms.c
|
|
src/st/wrp/e_layout.c
|
|
src/st/wrp/tile_data.c
|
|
src/st/wrp/sprites.c
|
|
src/st/wrp/warp.c
|
|
src/st/wrp/st_update.c
|
|
src/st/wrp/collision.c
|
|
src/st/wrp/create_entity.c
|
|
src/st/wrp/e_red_door.c
|
|
src/st/wrp/st_common.c
|
|
src/st/wrp/e_collect.c
|
|
src/st/wrp/blit_char.c
|
|
src/st/wrp/e_misc.c
|
|
src/st/wrp/e_stage_name.c
|
|
src/st/wrp/e_particles.c
|
|
src/st/wrp/e_room_fg.c
|
|
src/st/wrp/popup.c
|
|
src/st/wrp/prim_helpers.c
|
|
src/st/wrp/bss.c
|
|
)
|
|
|
|
set(SOURCE_FILES_WEAPON
|
|
src/weapon/w_000.c
|
|
src/weapon/w_002.c
|
|
src/weapon/w_007.c
|
|
src/weapon/w_012.c
|
|
src/weapon/w_034.c
|
|
src/weapon/w_041.c
|
|
src/weapon/w_045.c
|
|
src/weapon/w_046.c
|
|
src/weapon/w_051.c
|
|
src/weapon/w_052.c
|
|
)
|
|
|
|
# WEAPON_ID needs to be a string and not just a number
|
|
set_source_files_properties(src/weapon/w_000.c PROPERTIES COMPILE_DEFINITIONS WEAPON_ID=w_000)
|
|
set_source_files_properties(src/weapon/w_002.c PROPERTIES COMPILE_DEFINITIONS WEAPON_ID=w_002)
|
|
set_source_files_properties(src/weapon/w_007.c PROPERTIES COMPILE_DEFINITIONS WEAPON_ID=w_007)
|
|
set_source_files_properties(src/weapon/w_012.c PROPERTIES COMPILE_DEFINITIONS WEAPON_ID=w_012)
|
|
set_source_files_properties(src/weapon/w_034.c PROPERTIES COMPILE_DEFINITIONS WEAPON_ID=w_034)
|
|
set_source_files_properties(src/weapon/w_041.c PROPERTIES COMPILE_DEFINITIONS WEAPON_ID=w_041)
|
|
set_source_files_properties(src/weapon/w_045.c PROPERTIES COMPILE_DEFINITIONS WEAPON_ID=w_045)
|
|
set_source_files_properties(src/weapon/w_046.c PROPERTIES COMPILE_DEFINITIONS WEAPON_ID=w_046)
|
|
set_source_files_properties(src/weapon/w_051.c PROPERTIES COMPILE_DEFINITIONS WEAPON_ID=w_051)
|
|
set_source_files_properties(src/weapon/w_052.c PROPERTIES COMPILE_DEFINITIONS WEAPON_ID=w_052)
|
|
|
|
# organization is:
|
|
# two executables, sdl2 and null, plus a shared library "core"
|
|
# any executable links core (which is pc shared code + sotn psx code)
|
|
# the null backend is present to try and help with developing a backend-agnostic interface
|
|
# and for a basic "does it segfault" check in CI
|
|
|
|
# core library
|
|
|
|
set(SOURCE_FILES_CORE
|
|
${SOURCE_FILES_DRA}
|
|
${SOURCE_FILES_RIC}
|
|
${SOURCE_FILES_PC}
|
|
${SOURCE_FILES_PSX_SDK}
|
|
${SOURCE_FILES_MOCK_SDK}
|
|
${SOURCE_FILES_3RD}
|
|
${SOURCE_FILES_STAGE_SEL}
|
|
${SOURCE_FILES_STAGE_WRP}
|
|
${SOURCE_FILES_WEAPON}
|
|
${SOURCE_FILES_TT_000}
|
|
)
|
|
|
|
add_library(core ${SOURCE_FILES_CORE})
|
|
|
|
target_include_directories(core PRIVATE
|
|
include
|
|
src/dra
|
|
src/pc/3rd
|
|
)
|
|
|
|
target_compile_definitions(core PRIVATE
|
|
_USE_MATH_DEFINES # needed for msvc
|
|
VERSION_PC
|
|
PERMUTER
|
|
NON_MATCHING
|
|
HARD_LINK
|
|
DEMO_KEY_PTR=0
|
|
_internal_version_us
|
|
)
|
|
|
|
# sdl2 target
|
|
|
|
add_executable(${PROJECT_NAME}
|
|
src/pc/sdl2.c
|
|
src/pc/render_soft.c
|
|
src/pc/render_shared.c
|
|
src/pc/render_gl.c
|
|
src/pc/psxsdk/mednafen/gpu.cpp
|
|
src/pc/psxsdk/mednafen/gpu_line.cpp
|
|
src/pc/psxsdk/mednafen/gpu_polygon.cpp
|
|
src/pc/psxsdk/mednafen/gpu_sprite.cpp
|
|
src/pc/sdl2_macros.c
|
|
)
|
|
|
|
target_include_directories(${PROJECT_NAME} PRIVATE
|
|
${SDL2_INCLUDE_DIRS}
|
|
include
|
|
src/dra
|
|
src/pc/3rd
|
|
)
|
|
|
|
if (WIN32)
|
|
target_link_libraries(${PROJECT_NAME} PRIVATE
|
|
${SDL2_LIBRARIES} core)
|
|
else()
|
|
target_link_libraries(${PROJECT_NAME} PRIVATE
|
|
${SDL2_LIBRARIES} core m)
|
|
endif()
|
|
|
|
|
|
target_compile_definitions(${PROJECT_NAME} PRIVATE
|
|
_USE_MATH_DEFINES # needed for msvc
|
|
VERSION_PC
|
|
PERMUTER
|
|
NON_MATCHING
|
|
HARD_LINK
|
|
DEMO_KEY_PTR=0
|
|
_internal_version_us
|
|
)
|
|
|
|
if(WANT_LIBSND_LLE)
|
|
target_compile_definitions(core PRIVATE WANT_LIBSND_LLE=1)
|
|
target_compile_definitions(${PROJECT_NAME} PRIVATE WANT_LIBSND_LLE=1)
|
|
endif()
|
|
|
|
# null target
|
|
|
|
add_executable(${PROJECT_NAME}_null
|
|
src/pc/null.c
|
|
)
|
|
|
|
target_include_directories(${PROJECT_NAME}_null PRIVATE
|
|
include
|
|
src/dra
|
|
src/pc/3rd
|
|
)
|
|
|
|
if (WIN32)
|
|
target_link_libraries(${PROJECT_NAME}_null PRIVATE
|
|
core)
|
|
else()
|
|
target_link_libraries(${PROJECT_NAME}_null PRIVATE
|
|
core m)
|
|
endif()
|
|
|
|
target_compile_definitions(${PROJECT_NAME}_null PRIVATE
|
|
_USE_MATH_DEFINES # needed for msvc
|
|
VERSION_PC
|
|
PERMUTER
|
|
NON_MATCHING
|
|
HARD_LINK
|
|
DEMO_KEY_PTR=0
|
|
_internal_version_us
|
|
)
|