Skip to content

Commit

Permalink
replaced patcher and removed dummy library (#84)
Browse files Browse the repository at this point in the history
Co-authored-by: Pheenoh <[email protected]>
  • Loading branch information
kipcode66 and Pheenoh authored Jul 31, 2024
1 parent 46de39e commit dac181e
Show file tree
Hide file tree
Showing 15 changed files with 13 additions and 33 deletions.
11 changes: 4 additions & 7 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ file(MAKE_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/isos)
file(MAKE_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/bin)

# Set compiler stuff
include_directories(include external)
include_directories(external)
add_definitions(-D${PLATFORM}_${REGION} -D${PLATFORM}_PLATFORM -DGZ_VERSION=${CMAKE_PROJECT_VERSION} -D_PROJECT_NAME="${CMAKE_PROJECT_NAME}" -D_VERSION="${CMAKE_PROJECT_VERSION}" -D_VARIANT="public" -D_BUILDID="${CMAKE_PROJECT_VERSION}" ${DEBUG} ${RUN_PR_TEST})
add_compile_options(-fdiagnostics-color=always -fvisibility=hidden)

Expand All @@ -88,12 +88,9 @@ string(REGEX REPLACE "([0-9a-fA-F]?[0-9a-fA-F]?[0-9a-fA-F]?[0-9a-fA-F]?[0-9a-fA-
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/patch.asm.in ${CMAKE_CURRENT_BINARY_DIR}/patch.asm)
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/RomHack.toml.in ${CMAKE_CURRENT_BINARY_DIR}/RomHack.toml)

include_directories(${CMAKE_CURRENT_BINARY_DIR}/include)

add_subdirectory(src)
add_subdirectory(modules)

add_library(tpgz STATIC "${CPPFILES}")
add_custom_target(tpgz ALL)
add_dependencies(tpgz tp_c gcn_c modules)
set_property(TARGET tpgz PROPERTY COMPILE_FLAGS "-g -c -Os -std=gnu++20 -Wall ${DEVKITPRO_MACHDEP}")

Expand All @@ -112,7 +109,7 @@ endforeach()

add_custom_command(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${TPGZ_CFG_BLD_ISO}
DEPENDS tpgz modules ${TPGZ_PATCHER_EXE} ${CMAKE_CURRENT_SOURCE_DIR}/res ${CMAKE_CURRENT_SOURCE_DIR}/isos/${TPGZ_ISO_FILE}.iso ${CMAKE_CURRENT_BINARY_DIR}/patch.asm ${CMAKE_CURRENT_BINARY_DIR}/RomHack.toml ${TPGZ_REL_FILES}
COMMAND ${TPGZ_PATCHER_EXE} build --raw)
COMMAND ${TPGZ_PATCHER_EXE} build)

string(REPLACE ".iso" ".patch" TPGZ_CFG_BLD_PATCH_OLD ${TPGZ_CFG_BLD_ISO})
string(TOLOWER ${PLATFORM} tpgz_platform_lower)
Expand All @@ -121,7 +118,7 @@ string(REPLACE "_" "-" tpgz_region_lower ${tpgz_region_lower})
set(TPGZ_CFG_BLD_PATCH ${CMAKE_PROJECT_VERSION}-${tpgz_platform_lower}-${tpgz_region_lower}.patch)
add_custom_command(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${TPGZ_CFG_BLD_PATCH}
DEPENDS tpgz modules ${TPGZ_PATCHER_EXE} ${CMAKE_CURRENT_SOURCE_DIR}/res ${CMAKE_CURRENT_BINARY_DIR}/patch.asm ${CMAKE_CURRENT_BINARY_DIR}/RomHack.toml ${TPGZ_REL_FILES}
COMMAND ${TPGZ_PATCHER_EXE} build --raw --patch
COMMAND ${TPGZ_PATCHER_EXE} build --patch
COMMAND ${CMAKE_COMMAND} -E rename ${TPGZ_CFG_BLD_PATCH_OLD} ${TPGZ_CFG_BLD_PATCH})

add_custom_target(iso
Expand Down
7 changes: 1 addition & 6 deletions RomHack.toml.in
Original file line number Diff line number Diff line change
Expand Up @@ -5,19 +5,14 @@ developer-name = "Twilight Princess Community"
full-developer-name = "Speedrun Community"

[src]
iso = "@TPGZ_CFG_SRC_ISO@"
iso = "../isos/@TPGZ_CFG_SRC_ISO@"
patch = "patch.asm"
map = "@TPGZ_CFG_SRC_MAP@"

[build]
map = "@TPGZ_CFG_BLD_MAP@"
iso = "@TPGZ_CFG_BLD_ISO@"

[link]
entries = ["apply_lib_hooks"]
base = "@TPGZ_CFG_LINK_BASE@"
libs = ["libtpgz.a"]

[files]
# textures
"tpgz/tex" = "../res/tex"
Expand Down
Binary file removed bin/gcn/romhack
Binary file not shown.
Binary file added bin/romhack
Binary file not shown.
Binary file removed bin/wii/romhack
Binary file not shown.
2 changes: 1 addition & 1 deletion cmake/GCN_NTSCJ.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ set(TPGZ_CFG_LOADER_ADDR "0x80004D18")
set(TPGZ_CFG_SETTAG_ADDR "0x802398E0")

# TOML values
set(TPGZ_CFG_SRC_ISO "${CMAKE_SOURCE_DIR}/isos/GZ2J01.iso")
set(TPGZ_CFG_SRC_ISO "GZ2J01.iso")
set(TPGZ_CFG_SRC_MAP "map/Final/Release/frameworkF.map")
set(TPGZ_CFG_BLD_ISO "tpgz.iso")
set(TPGZ_CFG_BLD_MAP "GZ2J01.map")
Expand Down
2 changes: 1 addition & 1 deletion cmake/GCN_NTSCU.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ set(TPGZ_CFG_LOADER_ADDR "0x80004D18")
set(TPGZ_CFG_SETTAG_ADDR "0x80238F58")

# TOML values
set(TPGZ_CFG_SRC_ISO "${CMAKE_SOURCE_DIR}/isos/GZ2E01.iso")
set(TPGZ_CFG_SRC_ISO "GZ2E01.iso")
set(TPGZ_CFG_SRC_MAP "map/Final/Release/frameworkF.map")
set(TPGZ_CFG_BLD_ISO "tpgz.iso")
set(TPGZ_CFG_BLD_MAP "GZ2E01.map")
Expand Down
2 changes: 1 addition & 1 deletion cmake/GCN_PAL.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ set(TPGZ_CFG_LOADER_ADDR "0x80004D18")
set(TPGZ_CFG_SETTAG_ADDR "0x802395D8")

# TOML values
set(TPGZ_CFG_SRC_ISO "${CMAKE_SOURCE_DIR}/isos/GZ2P01.iso")
set(TPGZ_CFG_SRC_ISO "GZ2P01.iso")
set(TPGZ_CFG_SRC_MAP "map/Final/Release/frameworkF.map")
set(TPGZ_CFG_BLD_ISO "tpgz.iso")
set(TPGZ_CFG_BLD_MAP "GZ2P01.map")
Expand Down
2 changes: 1 addition & 1 deletion cmake/WII_NTSCJ.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ set(TPGZ_CFG_LOADER_ADDR "0x80005BF4")
set(TPGZ_CFG_SETTAG_ADDR "0x802268b4")

# TOML values
set(TPGZ_CFG_SRC_ISO "${CMAKE_SOURCE_DIR}/isos/RZDJ01.iso")
set(TPGZ_CFG_SRC_ISO "RZDJ01.iso")
set(TPGZ_CFG_SRC_MAP "map/Rfinal/Release/RframeworkF.map")
set(TPGZ_CFG_BLD_ISO "tpgzw.iso")
set(TPGZ_CFG_BLD_MAP "RZDJ01.map")
Expand Down
2 changes: 1 addition & 1 deletion cmake/WII_NTSCU_10.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ set(TPGZ_CFG_LOADER_ADDR "0x80005BF4")
set(TPGZ_CFG_SETTAG_ADDR "0x8022657c")

# TOML values
set(TPGZ_CFG_SRC_ISO "${CMAKE_SOURCE_DIR}/isos/RZDE01.iso")
set(TPGZ_CFG_SRC_ISO "RZDE01.iso")
set(TPGZ_CFG_SRC_MAP "map/Rfinal/Release/RframeworkF.map")
set(TPGZ_CFG_BLD_ISO "tpgzw.iso")
set(TPGZ_CFG_BLD_MAP "RZDE01.map")
Expand Down
2 changes: 1 addition & 1 deletion cmake/WII_NTSCU_12.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ set(TPGZ_CFG_LOADER_ADDR "0x80005BF4")
set(TPGZ_CFG_SETTAG_ADDR "0x80226318")

# TOML values
set(TPGZ_CFG_SRC_ISO "${CMAKE_SOURCE_DIR}/isos/RZDE01_2.iso")
set(TPGZ_CFG_SRC_ISO "RZDE01_2.iso")
set(TPGZ_CFG_SRC_MAP "map/Rfinal/Release/RframeworkF.map")
set(TPGZ_CFG_BLD_ISO "tpgzw.iso")
set(TPGZ_CFG_BLD_MAP "RZDE01_2.map")
Expand Down
2 changes: 1 addition & 1 deletion cmake/WII_PAL.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ set(TPGZ_CFG_LOADER_ADDR "0x80005BF4")
set(TPGZ_CFG_SETTAG_ADDR "0x802261a0")

# TOML values
set(TPGZ_CFG_SRC_ISO "${CMAKE_SOURCE_DIR}/isos/RZDP01.iso")
set(TPGZ_CFG_SRC_ISO "RZDP01.iso")
set(TPGZ_CFG_SRC_MAP "map/Rfinal/Release/RframeworkF.map")
set(TPGZ_CFG_BLD_ISO "tpgzw.iso")
set(TPGZ_CFG_BLD_MAP "RZDP01.map")
Expand Down
4 changes: 1 addition & 3 deletions cmake/patcher.cmake
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
string(TOLOWER ${PLATFORM} TPGZ_PATCHER_DIR)

find_program(TPGZ_PATCHER_EXE romhack HINTS ${CMAKE_SOURCE_DIR}/bin/${TPGZ_PATCHER_DIR})
find_program(TPGZ_PATCHER_EXE romhack HINTS ${CMAKE_SOURCE_DIR}/bin)

if(NOT TPGZ_PATCHER_EXE)
message(FATAL_ERROR "please put \"romhack\" in the bin/ folder")
Expand Down
7 changes: 0 additions & 7 deletions src/CMakeLists.txt

This file was deleted.

3 changes: 0 additions & 3 deletions src/lib.cpp

This file was deleted.

0 comments on commit dac181e

Please sign in to comment.