sotn-decomp/CMakeLists.txt

128 lines
2.6 KiB
CMake
Raw Normal View History

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")
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/main.c
src/pc/log.c
src/pc/stubs.c
src/pc/sotn.c
src/pc/pc.c
src/pc/sdl2.c
Texture render support (#934) Technically unimpressive, but I had to go through quite a good amount of changes. Here is the full changelog to make everything work: * Ensure `ResetPlatform` is always called to avoid memory leaks * Add `g_RawVram` to emulate the PS1 VRAM * ~~The engine will load the optional file `disks/vram.bin`, a RAM dump from an emulator~~ * SDL2 will create 256x256 textures on-the-fly whenever a specific tpage is requested via `GetVramTexture` * The function `GetVramTexture` caches the last called tpage to avoid tanking the performance * `GetVramTexture` for only renders 4bpp and 8bpp textures with their specified palette * Remove `SDL2_image` as the font is now loaded straight from the VRAM * Calling `VSync` will call the set callback, which the game uses for DMA operations * `MyLoadImage` is not yet implemented, but it is a placeholder to then interact with `g_RawVram` * The menu font now uses the texture found in the VRAM * Plugged a custom version of `LoadFileSim` * The file `sim_pc.c` is similar to the original game's code but it is used here to load files from custom paths * Using F5, F6 or F7 can dump the VRAM content on-screen, respectively in 16bpp, 8bpp and 4bpp There are new graphical glitches on the font. In some occasions it appears black. It seems to be related to a flag in `P_TAG.code`. I plan to dig into it when I can render entities on screen to avoid potential mistakes. The same problem is present for the first half of Alucard's portrait. It seems to be related when a texture is transparent? 🤷 I am not sure why the font is completely corrupted when entering in the Equip menu. It is hard to understand if I introduced any regression. Maybe the glitch was always there but it was hidden since I was always forcing the font texture to be rendered. EDIT: Implemented `LoadImage`, `SaveImage` and `ClearImage`
2024-01-01 23:31:56 +00:00
src/pc/sim_pc.c
src/pc/stage_dummy.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
)
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/5D6C4.c
src/dra/627C4.c
src/dra/63ED4.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
)
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
)
add_executable(${PROJECT_NAME}
${SOURCE_FILES_PC}
${SOURCE_FILES_PSX_SDK}
${SOURCE_FILES_MOCK_SDK}
${SOURCE_FILES_3RD}
${SOURCE_FILES_DRA}
${SOURCE_FILES_STAGE_SEL}
)
target_include_directories(${PROJECT_NAME} PRIVATE
${SDL2_INCLUDE_DIRS}
include
src/dra
src/pc/3rd
)
target_link_libraries(${PROJECT_NAME} PRIVATE
${SDL2_LIBRARIES}
)
target_compile_definitions(${PROJECT_NAME} PRIVATE
VERSION_PC
PERMUTER
NON_MATCHING
HARD_LINK
DEMO_KEY_PTR=0
_internal_version_us
)