summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPheenoh <pheenoh@gmail.com>2021-05-12 22:30:54 -0400
committerPheenoh <pheenoh@gmail.com>2021-05-12 22:30:54 -0400
commitd9f24828567057824a6a14cfd68ad4bf29d8a5f3 (patch)
tree40439fffbe4c04ffdaaf21f10a882dd4d0e8bc75
parente89ded1cc1902cb3602f08a22e82b8d464f127c9 (diff)
Interpolate gz version from makefile, fix generate-patches script
-rw-r--r--Makefile3
-rw-r--r--external/misc/generate-patches.sh16
-rw-r--r--src/lib.cpp8
3 files changed, 18 insertions, 9 deletions
diff --git a/Makefile b/Makefile
index 243eb3d..afd7fd0 100644
--- a/Makefile
+++ b/Makefile
@@ -30,12 +30,13 @@ EXTERNAL := external
DATA := data
INCLUDES := include external
MAKEFILES := $(shell find . -mindepth 2 -name Makefile)
+GZ_VERSION ?= 0.4
#---------------------------------------------------------------------------------
# options for code generation
#---------------------------------------------------------------------------------
-CFLAGS = -g -c -O2 -Wall $(MACHDEP) $(INCLUDE) -D $(PLATFORM)_$(REGION) -D $(PLATFORM)_PLATFORM
+CFLAGS = -g -c -O2 -Wall $(MACHDEP) $(INCLUDE) -D $(PLATFORM)_$(REGION) -D $(PLATFORM)_PLATFORM -D GZ_VERSION=$(GZ_VERSION)
CXXFLAGS = $(CFLAGS)
#---------------------------------------------------------------------------------
diff --git a/external/misc/generate-patches.sh b/external/misc/generate-patches.sh
index 006a3dc..41d55ab 100644
--- a/external/misc/generate-patches.sh
+++ b/external/misc/generate-patches.sh
@@ -1,38 +1,40 @@
#!/bin/bash
-version=$1
+export GZ_VERSION=$1
-if [ -z "$version" ]
+if [ -z $GZ_VERSION ]
then
+ echo "You need to specify a version. Ex: generate-patches.sh 1.0"
exit 1
fi
make clean
+# This can be optimized but too lazy atm
export PLATFORM="GCN"
export REGION="NTSCU"
make
romhack build --raw --patch
-mv ./build/tpgz.patch ./$version-gcn-ntscu.patch
+mv ./build/tpgz.patch ./$GZ_VERSION-gcn-ntscu.patch
make clean
export REGION="NTSCJ"
make
romhack build --raw --patch
-mv ./build/tpgz.patch ./$version-gcn-ntscj.patch
+mv ./build/tpgz.patch ./$GZ_VERSION-gcn-ntscj.patch
make clean
export REGION="PAL"
make
romhack build --raw --patch
-mv ./build/tpgz.patch ./$version-gcn-pal.patch
+mv ./build/tpgz.patch ./$GZ_VERSION-gcn-pal.patch
make clean
export PLATFORM="WII"
export REGION="NTSCU_10"
make
romhack build --raw --patch
-mv ./build/tpgzw.patch ./$version-wii-ntscu-10.patch
+mv ./build/tpgzw.patch ./$GZ_VERSION-wii-ntscu-10.patch
make clean
export PLATFORM="WII"
export REGION="PAL"
make
romhack build --raw --patch
-mv ./build/tpgzw.patch ./$version-wii-pal.patch
+mv ./build/tpgzw.patch ./$GZ_VERSION-wii-pal.patch
make clean \ No newline at end of file
diff --git a/src/lib.cpp b/src/lib.cpp
index 99b7b7c..47e6df6 100644
--- a/src/lib.cpp
+++ b/src/lib.cpp
@@ -29,6 +29,9 @@ bool last_frame_was_loading = false;
extern "C" {
+#define Q(x) #x
+#define QUOTE(x) Q(x)
+
#if (GCN_NTSCU)
#define main_tampoline ((void (*)(void))0x803737b4)
#endif
@@ -44,6 +47,9 @@ extern "C" {
#if (WII_PAL)
#define main_tampoline ((void (*)(void))0x803b929c)
#endif
+#ifdef GZ_VERSION
+#define INTERNAL_GZ_VERSION QUOTE(GZ_VERSION)
+#endif
void apply_lib_hooks() {
Hook::apply_hooks();
@@ -119,7 +125,7 @@ void draw() {
setupRendering();
// Consolas.setupRendering();
if (MenuRendering::is_menu_open()) {
- Font::gz_renderChars("tpgz v0.3", sprite_offsets[MENU_INDEX].x + 35.0f, 25.0f, cursor_rgba,
+ Font::gz_renderChars("tpgz v" INTERNAL_GZ_VERSION, sprite_offsets[MENU_INDEX].x + 35.0f, 25.0f, cursor_rgba,
g_drop_shadows);
if (gzIconTex.loadCode == TexCode::TEX_OK) {
Draw::draw_rect(0xFFFFFFFF, {sprite_offsets[MENU_INDEX].x, 5.0f}, {30, 30},