2023-12-27 09:24:00 +00:00
|
|
|
cmake_minimum_required(VERSION 3.10)
|
|
|
|
|
|
|
|
project(Sound)
|
|
|
|
|
|
|
|
set(CMAKE_CXX_STANDARD 17)
|
|
|
|
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
|
|
|
|
2024-01-11 22:46:35 +00:00
|
|
|
if (WIN32)
|
|
|
|
set(CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake)
|
|
|
|
endif()
|
2023-12-27 09:24:00 +00:00
|
|
|
|
2024-01-11 22:46:35 +00:00
|
|
|
if (CMAKE_CXX_COMPILER_ID MATCHES "GNU|Clang|AppleClang")
|
2024-01-11 00:34:12 +00:00
|
|
|
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")
|
|
|
|
endif()
|
|
|
|
|
2024-01-11 22:46:35 +00:00
|
|
|
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()
|
|
|
|
|
2023-12-27 09:24:00 +00:00
|
|
|
find_package(SDL2 REQUIRED)
|
|
|
|
|
|
|
|
set(SOURCE_FILES_PC
|
|
|
|
src/pc/log.c
|
|
|
|
src/pc/stubs.c
|
|
|
|
src/pc/sotn.c
|
|
|
|
src/pc/pc.c
|
2024-01-01 23:31:56 +00:00
|
|
|
src/pc/sim_pc.c
|
2024-01-02 09:22:44 +00:00
|
|
|
src/pc/stage_dummy.c
|
2023-12-27 09:24:00 +00:00
|
|
|
)
|
|
|
|
|
2023-12-27 16:26:24 +00:00
|
|
|
if(WIN32)
|
|
|
|
list(APPEND SOURCE_FILES_PC src/pc/plat_win.c)
|
|
|
|
else()
|
|
|
|
list(APPEND SOURCE_FILES_PC src/pc/plat_unix.c)
|
|
|
|
endif()
|
|
|
|
|
2023-12-27 09:24:00 +00:00
|
|
|
set(SOURCE_FILES_PSX_SDK
|
|
|
|
src/main/psxsdk/libgpu/ext.c
|
|
|
|
)
|
|
|
|
|
|
|
|
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
|
2024-01-02 09:22:44 +00:00
|
|
|
src/dra/5087C.c
|
2024-01-07 16:41:18 +00:00
|
|
|
src/dra/lba_stage.c
|
2024-01-07 02:28:34 +00:00
|
|
|
src/dra/config_us.c
|
2023-12-27 09:24:00 +00:00
|
|
|
src/dra/menu.c
|
Refactor DRA func_800FD5BC (#980)
Came across this function today and found several improvements for it.
- Unkstruct_800FD5BC is a duplicate of DamageParam. Therefore, I have
changed all instances of Unkstruct_800FD5BC to DamageParam. The fields
make sense in context and everything.
- Because func_800FD5BC is in GameApi, which is defined in `game.h`, its
argument (now a DamageParam) needs to be accessible in `game.h`.
Therefore, DamageParam moves from dra.h to game.h.
- We had a fake division being done with using a `temp` and checking a
comparison to zero; this has been changed to be a normal division. This
is a common pattern I see in initial m2c output and I'm sure it exists
in other places in the repo, would be nice if we could find an automated
way to search for this type of structure to simplify the code.
- Changed a 0x14 to 20 since it makes way more sense that way
- Changed an `if(){dostuff; return} else{morestuff}` to just
`if(){dostuff; return} morestuff`, eliminating the `else`
I think this function should not be in `menu.c` since it has no close
connection to any kind of menu. It would also be nice if we could figure
out what damageKind actually is, and maybe make an enum for it.
Overall, no new decompiling here, but lots of improvement to the
readability of the code. This might actually be a good PR to keep in
mind as an example for people who are interested in the project but
aren't comfortable with assembly, since this is a lot of improvement and
change, without touching assembly at all.
2024-01-14 16:37:35 +00:00
|
|
|
src/dra/5D5BC.c
|
2023-12-27 09:24:00 +00:00
|
|
|
src/dra/627C4.c
|
|
|
|
src/dra/63ED4.c
|
2024-01-14 23:30:58 +00:00
|
|
|
src/dra/692E8.c
|
|
|
|
src/dra/6D59C.c
|
|
|
|
src/dra/704D0.c
|
|
|
|
src/dra/71830.c
|
2024-01-20 19:06:37 +00:00
|
|
|
src/dra/72BB0.c
|
|
|
|
#src/dra/75F54.c # unable to link it, the file needs to be splitted
|
|
|
|
#src/dra/7A4D0.c # loads of unimplemented calls and symbols
|
|
|
|
src/dra/7E4BC.c
|
|
|
|
src/dra/843B0.c
|
|
|
|
src/dra/86ECC.c
|
|
|
|
#src/dra/8D3E8.c # countless unimplemented symbols
|
2023-12-27 09:24:00 +00:00
|
|
|
src/dra/91EBC.c
|
|
|
|
src/dra/92F60.c
|
|
|
|
src/dra/93290.c
|
|
|
|
src/dra/93BDC.c
|
|
|
|
src/dra/94F50.c
|
|
|
|
src/dra/953A0.c
|
|
|
|
)
|
|
|
|
|
2024-01-11 20:13:33 +00:00
|
|
|
set(SOURCE_FILES_STAGE_SEL
|
|
|
|
src/pc/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
|
|
|
|
)
|
|
|
|
|
2024-01-19 02:32:22 +00:00
|
|
|
# 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}
|
2023-12-27 09:24:00 +00:00
|
|
|
${SOURCE_FILES_PC}
|
|
|
|
${SOURCE_FILES_PSX_SDK}
|
|
|
|
${SOURCE_FILES_MOCK_SDK}
|
|
|
|
${SOURCE_FILES_3RD}
|
|
|
|
${SOURCE_FILES_DRA}
|
2024-01-11 20:13:33 +00:00
|
|
|
${SOURCE_FILES_STAGE_SEL}
|
|
|
|
)
|
2023-12-27 09:24:00 +00:00
|
|
|
|
2024-01-19 02:32:22 +00:00
|
|
|
add_library(core ${SOURCE_FILES_CORE})
|
|
|
|
|
|
|
|
target_include_directories(core PRIVATE
|
|
|
|
include
|
|
|
|
src/dra
|
|
|
|
src/pc/3rd
|
|
|
|
)
|
|
|
|
|
|
|
|
target_compile_definitions(core PRIVATE
|
|
|
|
VERSION_PC
|
|
|
|
PERMUTER
|
|
|
|
NON_MATCHING
|
|
|
|
HARD_LINK
|
|
|
|
DEMO_KEY_PTR=0
|
|
|
|
_internal_version_us
|
|
|
|
)
|
|
|
|
|
|
|
|
# sdl2 target
|
|
|
|
|
|
|
|
add_executable(${PROJECT_NAME}
|
|
|
|
src/pc/sdl2.c
|
|
|
|
)
|
|
|
|
|
|
|
|
target_include_directories(${PROJECT_NAME} PRIVATE
|
2023-12-27 09:24:00 +00:00
|
|
|
${SDL2_INCLUDE_DIRS}
|
|
|
|
include
|
|
|
|
src/dra
|
|
|
|
src/pc/3rd
|
|
|
|
)
|
|
|
|
|
|
|
|
target_link_libraries(${PROJECT_NAME} PRIVATE
|
|
|
|
${SDL2_LIBRARIES}
|
2024-01-19 02:32:22 +00:00
|
|
|
core
|
2023-12-27 09:24:00 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
target_compile_definitions(${PROJECT_NAME} PRIVATE
|
|
|
|
VERSION_PC
|
|
|
|
PERMUTER
|
|
|
|
NON_MATCHING
|
2024-01-11 20:13:33 +00:00
|
|
|
HARD_LINK
|
2023-12-27 09:24:00 +00:00
|
|
|
DEMO_KEY_PTR=0
|
|
|
|
_internal_version_us
|
|
|
|
)
|
2024-01-19 02:32:22 +00:00
|
|
|
|
|
|
|
# null target
|
|
|
|
|
|
|
|
add_executable(${PROJECT_NAME}_null
|
|
|
|
src/pc/null.c
|
|
|
|
)
|
|
|
|
|
|
|
|
target_include_directories(${PROJECT_NAME}_null PRIVATE
|
|
|
|
include
|
|
|
|
src/dra
|
|
|
|
src/pc/3rd
|
|
|
|
)
|
|
|
|
|
|
|
|
target_link_libraries(${PROJECT_NAME}_null PRIVATE
|
|
|
|
core
|
|
|
|
)
|
|
|
|
|
|
|
|
target_compile_definitions(${PROJECT_NAME}_null PRIVATE
|
|
|
|
VERSION_PC
|
|
|
|
PERMUTER
|
|
|
|
NON_MATCHING
|
|
|
|
HARD_LINK
|
|
|
|
DEMO_KEY_PTR=0
|
|
|
|
_internal_version_us
|
|
|
|
)
|