From 8588af60be07b07b2b3d55ba738daebf934e7a34 Mon Sep 17 00:00:00 2001 From: Luke Street Date: Tue, 9 Aug 2022 23:00:57 -0400 Subject: [PATCH] Link zlib Former-commit-id: 107ea767f9b2c334633c60ae3b4c94a196f99933 --- Makefile | 9 +++++++++ asm/Kyoto/CARAMManager.s | 3 +++ asm/Kyoto/Graphics/CCubeMaterial.s | 4 ++++ asm/Kyoto/Math/CFrustumPlanes.s | 2 ++ obj_files.mk | 12 ++++++------ src/Kyoto/zlib/inflate.c | 6 +++--- src/Kyoto/zlib/zlib.h | 6 +++--- 7 files changed, 30 insertions(+), 12 deletions(-) diff --git a/Makefile b/Makefile index eb76ba2d..afc7f817 100644 --- a/Makefile +++ b/Makefile @@ -105,6 +105,7 @@ endif CFLAGS_1.2 = -proc gekko -nodefaults -Cpp_exceptions off -RTTI off -fp fmadd -fp_contract on -O4,p -maxerrors 1 -enum int -inline auto -MMD $(INCLUDES) CFLAGS_MUSYX = -proc gekko -nodefaults -Cpp_exceptions off -RTTI off -fp fmadd -str reuse,pool,readonly -O4,p -maxerrors 1 -enum int -inline auto -MMD $(INCLUDES) CFLAGS = $(CFLAGS_1.2) -use_lmw_stmw on -str reuse,pool,readonly -gccinc -inline deferred,noauto +CFLAGS_ZLIB = $(CFLAGS_1.2) -use_lmw_stmw on -str reuse,pool,readonly -gccinc -inline deferred,auto CFLAGS_1.2 += -str reuse ifeq ($(VERBOSE),0) @@ -137,6 +138,14 @@ $(BUILD_DIR)/src/musyx/reverb_fx.o: CFLAGS := $(CFLAGS_MUSYX) $(BUILD_DIR)/src/musyx/delay_fx.o: CFLAGS := $(CFLAGS_MUSYX) $(BUILD_DIR)/src/musyx/creverb_fx.o: CFLAGS := $(CFLAGS_MUSYX) $(BUILD_DIR)/src/musyx/synth_ac.o: CFLAGS := $(CFLAGS_MUSYX) +$(BUILD_DIR)/src/Kyoto/zlib/adler32.o: CFLAGS := $(CFLAGS_ZLIB) +$(BUILD_DIR)/src/Kyoto/zlib/infblock.o: CFLAGS := $(CFLAGS_ZLIB) +$(BUILD_DIR)/src/Kyoto/zlib/infcodes.o: CFLAGS := $(CFLAGS_ZLIB) +$(BUILD_DIR)/src/Kyoto/zlib/inffast.o: CFLAGS := $(CFLAGS_ZLIB) +$(BUILD_DIR)/src/Kyoto/zlib/inflate.o: CFLAGS := $(CFLAGS_ZLIB) +$(BUILD_DIR)/src/Kyoto/zlib/inftrees.o: CFLAGS := $(CFLAGS_ZLIB) +$(BUILD_DIR)/src/Kyoto/zlib/infutil.o: CFLAGS := $(CFLAGS_ZLIB) +$(BUILD_DIR)/src/Kyoto/zlib/zutil.o: CFLAGS := $(CFLAGS_ZLIB) #------------------------------------------------------------------------------- diff --git a/asm/Kyoto/CARAMManager.s b/asm/Kyoto/CARAMManager.s index 64c4925b..c018537c 100644 --- a/asm/Kyoto/CARAMManager.s +++ b/asm/Kyoto/CARAMManager.s @@ -1,6 +1,7 @@ .include "macros.inc" .section .sdata +.balign 8 .global lbl_805A8920 lbl_805A8920: @@ -9,6 +10,7 @@ lbl_805A8920: .4byte 0 .section .bss +.balign 8 .global lbl_804BFF40 lbl_804BFF40: @@ -776,6 +778,7 @@ lbl_80344FAC: /* 80344FC8 00341F28 4E 80 00 20 */ blr .section .rodata +.balign 8 .global lbl_803D7F50 lbl_803D7F50: # ROM: 0x3D4F50 diff --git a/asm/Kyoto/Graphics/CCubeMaterial.s b/asm/Kyoto/Graphics/CCubeMaterial.s index 923fb2cb..3a121203 100644 --- a/asm/Kyoto/Graphics/CCubeMaterial.s +++ b/asm/Kyoto/Graphics/CCubeMaterial.s @@ -1,6 +1,7 @@ .include "macros.inc" .section .data +.balign 8 .global lbl_803EF610 lbl_803EF610: @@ -31,6 +32,7 @@ lbl_803EF640: .4byte lbl_80347E5C .section .sdata +.balign 8 .global lbl_805A8928 lbl_805A8928: @@ -53,6 +55,7 @@ lbl_805A8934: .4byte 0xFFFFFFFF .section .bss +.balign 8 .global lbl_804BFF50 lbl_804BFF50: @@ -62,6 +65,7 @@ lbl_804BFF5C: .skip 0x34 .section .sbss, "wa" +.balign 8 .global lbl_805A9540 lbl_805A9540: diff --git a/asm/Kyoto/Math/CFrustumPlanes.s b/asm/Kyoto/Math/CFrustumPlanes.s index 152d5ee9..38466bf7 100644 --- a/asm/Kyoto/Math/CFrustumPlanes.s +++ b/asm/Kyoto/Math/CFrustumPlanes.s @@ -529,6 +529,8 @@ sub_803456b0: /* 80345748 003426A8 4E 80 00 20 */ blr .section .sdata2, "a" +.balign 8 + .global lbl_805AE8D0 lbl_805AE8D0: # ROM: 0x3FB170 diff --git a/obj_files.mk b/obj_files.mk index bf981d55..feffa4d8 100644 --- a/obj_files.mk +++ b/obj_files.mk @@ -572,12 +572,12 @@ KYOTO :=\ $(BUILD_DIR)/asm/Kyoto/CToken.o\ $(BUILD_DIR)/asm/Kyoto/IObj.o\ $(BUILD_DIR)/src/Kyoto/zlib/adler32.o\ - $(BUILD_DIR)/asm/Kyoto/zlib/infblock.o\ - $(BUILD_DIR)/asm/Kyoto/zlib/infcodes.o\ - $(BUILD_DIR)/asm/Kyoto/zlib/inffast.o\ - $(BUILD_DIR)/asm/Kyoto/zlib/inflate.o\ - $(BUILD_DIR)/asm/Kyoto/zlib/inftrees.o\ - $(BUILD_DIR)/asm/Kyoto/zlib/infutil.o\ + $(BUILD_DIR)/src/Kyoto/zlib/infblock.o\ + $(BUILD_DIR)/src/Kyoto/zlib/infcodes.o\ + $(BUILD_DIR)/src/Kyoto/zlib/inffast.o\ + $(BUILD_DIR)/src/Kyoto/zlib/inflate.o\ + $(BUILD_DIR)/src/Kyoto/zlib/inftrees.o\ + $(BUILD_DIR)/src/Kyoto/zlib/infutil.o\ $(BUILD_DIR)/src/Kyoto/zlib/zutil.o\ $(BUILD_DIR)/asm/Kyoto/CARAMManager.o\ $(BUILD_DIR)/asm/Kyoto/Math/CFrustumPlanes.o\ diff --git a/src/Kyoto/zlib/inflate.c b/src/Kyoto/zlib/inflate.c index 32e9b8de..015aeb36 100644 --- a/src/Kyoto/zlib/inflate.c +++ b/src/Kyoto/zlib/inflate.c @@ -78,12 +78,12 @@ z_streamp z; } -int ZEXPORT inflateInit2_(z, w, version, stream_size) +int ZEXPORT inflateInit2_(z, version, stream_size) z_streamp z; -int w; const char *version; int stream_size; { + int w = 15; // Hardcoded window size if (version == Z_NULL || version[0] != ZLIB_VERSION[0] || stream_size != sizeof(z_stream)) return Z_VERSION_ERROR; @@ -140,7 +140,7 @@ z_streamp z; const char *version; int stream_size; { - return inflateInit2_(z, DEF_WBITS, version, stream_size); + return inflateInit2_(z, version, stream_size); } diff --git a/src/Kyoto/zlib/zlib.h b/src/Kyoto/zlib/zlib.h index 49f56b43..d945d77b 100644 --- a/src/Kyoto/zlib/zlib.h +++ b/src/Kyoto/zlib/zlib.h @@ -865,7 +865,7 @@ ZEXTERN int ZEXPORT deflateInit2_ OF((z_streamp strm, int level, int method, int windowBits, int memLevel, int strategy, const char *version, int stream_size)); -ZEXTERN int ZEXPORT inflateInit2_ OF((z_streamp strm, int windowBits, +ZEXTERN int ZEXPORT inflateInit2_ OF((z_streamp strm, const char *version, int stream_size)); #define deflateInit(strm, level) \ deflateInit_((strm), (level), ZLIB_VERSION, sizeof(z_stream)) @@ -874,8 +874,8 @@ ZEXTERN int ZEXPORT inflateInit2_ OF((z_streamp strm, int windowBits, #define deflateInit2(strm, level, method, windowBits, memLevel, strategy) \ deflateInit2_((strm),(level),(method),(windowBits),(memLevel),\ (strategy), ZLIB_VERSION, sizeof(z_stream)) -#define inflateInit2(strm, windowBits) \ - inflateInit2_((strm), (windowBits), ZLIB_VERSION, sizeof(z_stream)) +#define inflateInit2(strm) \ + inflateInit2_((strm), ZLIB_VERSION, sizeof(z_stream)) #if !defined(_Z_UTIL_H) && !defined(NO_DUMMY_DECL)