From 72fcd19a9e6e8b7d40193391ea19dc087b2ee7f6 Mon Sep 17 00:00:00 2001 From: Random06457 <28494085+Random06457@users.noreply.github.com> Date: Sat, 4 Jun 2022 16:59:41 +0900 Subject: [PATCH] fix compilation --- ZAPDTR/Makefile | 2 +- ZAPDTR/ZAPD/ZAudioDecode.cpp | 8 +++--- libultraship/Makefile | 18 +++++++------ libultraship/libultraship/Lib/Fast3D/gfx_pc.h | 1 + libultraship/libultraship/Resource.h | 6 ++--- soh/Makefile | 25 +++++++++++-------- soh/src/code/audio_load.c | 6 ++--- 7 files changed, 37 insertions(+), 29 deletions(-) diff --git a/ZAPDTR/Makefile b/ZAPDTR/Makefile index 13f0dce20..8123f8162 100644 --- a/ZAPDTR/Makefile +++ b/ZAPDTR/Makefile @@ -45,7 +45,7 @@ endif # CXXFLAGS += -DTEXTURE_DEBUG LDFLAGS := -lm -ldl -lpng \ - -L../external -L../libultraship -lz -lbz2 -pthread -lpulse -lultraship -lstorm -lSDL2 -lGLEW -lGL -lX11 + -L../StormLib/build -L../libultraship -lz -lbz2 -pthread -lpulse -lultraship -lstorm -lSDL2 -lGLEW -lGL -lX11 # Use LLD if available. Set LLD=0 to not use it ifeq ($(shell command -v ld.lld >/dev/null 2>&1; echo $$?),0) diff --git a/ZAPDTR/ZAPD/ZAudioDecode.cpp b/ZAPDTR/ZAPD/ZAudioDecode.cpp index b8b066474..921a3fd8b 100644 --- a/ZAPDTR/ZAPD/ZAudioDecode.cpp +++ b/ZAPDTR/ZAPD/ZAudioDecode.cpp @@ -461,8 +461,8 @@ char* OldMain(char* infilename) else { char comprType[5] = { - CommChunk.compressionTypeH >> 8, CommChunk.compressionTypeH & 0xFF, - CommChunk.compressionTypeL >> 8, CommChunk.compressionTypeL & 0xFF, 0}; + static_cast(CommChunk.compressionTypeH >> 8), static_cast(CommChunk.compressionTypeH & 0xFF), + static_cast(CommChunk.compressionTypeL >> 8), static_cast(CommChunk.compressionTypeL & 0xFF), 0}; fail_parse("file is of the wrong compression type [got %s (%08x)]", &comprType, cType); } @@ -603,8 +603,8 @@ char* OldMain(char* infilename) { s32 startPos = aloops[0].start, endPos = aloops[0].end; const char* markerNames[2] = {"start", "end"}; - Marker markers[2] = {{1, startPos >> 16, startPos & 0xffff}, - {2, endPos >> 16, endPos & 0xffff}}; + Marker markers[2] = {{1, static_cast(startPos >> 16), static_cast(startPos & 0xffff)}, + {2, static_cast(endPos >> 16), static_cast(endPos & 0xffff)}}; write_header(ofile, "MARK", 2 + 2 * sizeof(Marker) + 1 + 5 + 1 + 3); s16 numMarkers = bswap16(2); fwrite(&numMarkers, sizeof(s16), 1, ofile); diff --git a/libultraship/Makefile b/libultraship/Makefile index d6789db0b..66d1b7b9a 100644 --- a/libultraship/Makefile +++ b/libultraship/Makefile @@ -18,8 +18,11 @@ WARN := -Wall -Wextra -Werror \ -Wno-narrowing \ -Wno-missing-field-initializers -CXXFLAGS := $(WARN) -std=c++20 -D_GNU_SOURCE -DENABLE_OPENGL -DSPDLOG_ACTIVE_LEVEL=0 -m32 -CFLAGS := $(WARN) -std=c99 -D_GNU_SOURCE -DENABLE_OPENGL -DSPDLOG_ACTIVE_LEVEL=0 -m32 +CWARN := +CXXWARN := -Wno-deprecated-enum-enum-conversion + +CXXFLAGS := $(WARN) $(CXXWARN) -std=c++20 -D_GNU_SOURCE -DENABLE_OPENGL -DSPDLOG_ACTIVE_LEVEL=0 +CFLAGS := $(WARN) $(CWARN) -std=c99 -D_GNU_SOURCE -DENABLE_OPENGL -DSPDLOG_ACTIVE_LEVEL=0 CPPFLAGS := -MMD ifneq ($(DEBUG),0) @@ -40,10 +43,10 @@ endif SRC_DIRS := $(shell find -type d -not -path "*build*") CXX_FILES := \ - $(shell find libultraship/Factories -name *.cpp) \ - $(shell find libultraship/Lib/Fast3D -name *.cpp) \ - $(shell find libultraship -maxdepth 1 -name *.cpp) \ - $(shell find libultraship/Lib/ImGui -maxdepth 1 -name *.cpp) \ + $(shell find libultraship/Factories -name "*.cpp") \ + $(shell find libultraship/Lib/Fast3D -name *.cpp") \ + $(shell find libultraship -maxdepth 1 -name "*.cpp") \ + $(shell find libultraship/Lib/ImGui -maxdepth 1 -name "*.cpp") \ libultraship/Lib/ImGui/backends/imgui_impl_opengl3.cpp \ libultraship/Lib/ImGui/backends/imgui_impl_sdl.cpp \ libultraship/Lib/StrHash64.cpp \ @@ -53,7 +56,7 @@ C_FILES := \ libultraship/mixer.c \ libultraship/Lib/stb/stb_impl.c -FMT_FILES := $(shell find libultraship/ -type f \( -name *.cpp -o -name *.h \) -a -not -path "libultraship/Lib/*") +FMT_FILES := $(shell find libultraship/ -type f \( -name "*.cpp" -o -name "*.h" \) -a -not -path "libultraship/Lib/*") O_FILES := \ $(CXX_FILES:%.cpp=build/%.o) \ @@ -69,6 +72,7 @@ INC_DIRS := $(addprefix -I, \ libultraship/Lib/spdlog \ libultraship/Lib/spdlog/include \ libultraship \ + ../StormLib/src \ ) # create build directories diff --git a/libultraship/libultraship/Lib/Fast3D/gfx_pc.h b/libultraship/libultraship/Lib/Fast3D/gfx_pc.h index 65a6b57ba..3be10a016 100644 --- a/libultraship/libultraship/Lib/Fast3D/gfx_pc.h +++ b/libultraship/libultraship/Lib/Fast3D/gfx_pc.h @@ -5,6 +5,7 @@ #include #include #include +#include #include "U64/PR/ultra64/types.h" diff --git a/libultraship/libultraship/Resource.h b/libultraship/libultraship/Resource.h index 01949675e..c347865b0 100644 --- a/libultraship/libultraship/Resource.h +++ b/libultraship/libultraship/Resource.h @@ -30,9 +30,9 @@ namespace Ship Array = 0x4F415252, // OARR Text = 0x4F545854, // OTXT Blob = 0x4F424C42, // OBLB - Audio = 'OAUD', - AudioSample = 'OSMP', - AudioSoundFont = 'OSFT', + Audio = 0x4F415544, // OAUD + AudioSample = 0x4F534D50, // OSMP + AudioSoundFont = 0x4F534654, // OSFT }; enum class DataType diff --git a/soh/Makefile b/soh/Makefile index 74a112ecb..4d3068e04 100644 --- a/soh/Makefile +++ b/soh/Makefile @@ -16,11 +16,11 @@ LTO ?= 0 WARN := \ -Wno-return-type \ -funsigned-char \ - -m32 -mhard-float -fno-stack-protector -fno-common -fno-zero-initialized-in-bss -fno-strict-aliasing -fno-inline-functions -fno-inline-small-functions -fno-toplevel-reorder -ffreestanding -fwrapv \ + -mhard-float -fno-stack-protector -fno-common -fno-zero-initialized-in-bss -fno-strict-aliasing -fno-inline-functions -fno-inline-small-functions -fno-toplevel-reorder -ffreestanding -fwrapv \ -CXXFLAGS := $(WARN) -std=c++20 -D_GNU_SOURCE -fpermissive -no-pie -nostdlib -march=i386 -msse2 -mfpmath=sse -CFLAGS := $(WARN) -std=c99 -D_GNU_SOURCE -no-pie -nostdlib -march=i386 -msse2 -mfpmath=sse -LDFLAGS := -m32 +CXXFLAGS := $(WARN) -std=c++20 -D_GNU_SOURCE -fpermissive -no-pie -nostdlib -msse2 -mfpmath=sse +CFLAGS := $(WARN) -std=c99 -D_GNU_SOURCE -no-pie -nostdlib -msse2 -mfpmath=sse +LDFLAGS := CPPFLAGS := -MMD ifneq ($(DEBUG),0) @@ -54,7 +54,7 @@ INC_DIRS := $(addprefix -I, \ ) LDDIRS := $(addprefix -L, \ - ../external \ + ../StormLib/build \ ../libultraship/ \ ) @@ -87,14 +87,14 @@ TEXTURE_FILES_OUT := $(foreach f,$(TEXTURE_FILES_PNG:.png=.inc.c),build/$f) \ $(foreach f,$(TEXTURE_FILES_JPG:.jpg=.jpg.inc.c),build/$f) \ CXX_FILES := \ - $(shell find soh -type f -name *.cpp) + $(shell find soh -type f -name "*.cpp") C_FILES := \ - $(shell find soh -type f -name *.c) \ - $(shell find src/boot -type f -name *.c) \ - $(shell find src/buffers -type f -name *.c) \ - $(shell find src/code -type f -name *.c) \ - $(shell find src/overlays -type f -name *.c) \ + $(shell find soh -type f -name "*.c") \ + $(shell find src/boot -type f -name "*.c") \ + $(shell find src/buffers -type f -name "*.c") \ + $(shell find src/code -type f -name "*.c") \ + $(shell find src/overlays -type f -name "*.c") \ src/libultra/gu/coss.c \ src/libultra/gu/guLookAt.c \ src/libultra/gu/guLookAtHilite.c \ @@ -125,6 +125,8 @@ setup: $(MAKE) mpq mpq: + cmake -B ../StormLib/build -S ../StormLib + cmake --build ../StormLib/build $(MAKE) -C ../libultraship $(MAKE) -C ../OTRExporter/OTRExporter $(MAKE) -C ../ZAPDTR @@ -137,6 +139,7 @@ distclean: clean $(MAKE) clean -C ../libultraship $(MAKE) clean -C ../OTRExporter/OTRExporter $(MAKE) clean -C ../ZAPDTR + rm -rf ../StormLib/build clean: rm -rf build $(TARGET) diff --git a/soh/src/code/audio_load.c b/soh/src/code/audio_load.c index 70ee68da1..02986ca6c 100644 --- a/soh/src/code/audio_load.c +++ b/soh/src/code/audio_load.c @@ -51,9 +51,9 @@ s32 AudioLoad_Dma(OSIoMesg* mesg, u32 priority, s32 direction, uintptr_t devAddr OSMesgQueue* reqQueue, s32 medium, const char* dmaFuncType); void* AudioLoad_AsyncLoadInner(s32 tableType, s32 id, s32 nChunks, s32 retData, OSMesgQueue* retQueue); AudioAsyncLoad* AudioLoad_StartAsyncLoadUnkMedium(s32 unkMediumParam, uintptr_t devAddr, uintptr_t ramAddr, - ptrdiff_t size, s32 medium, + size_t size, s32 medium, s32 nChunks, OSMesgQueue* retQueue, s32 retMsg); -AudioAsyncLoad* AudioLoad_StartAsyncLoad(u32 devAddr, uintptr_t ramAddr, size_t size, s32 medium, s32 nChunks, +AudioAsyncLoad* AudioLoad_StartAsyncLoad(uintptr_t devAddr, uintptr_t ramAddr, size_t size, s32 medium, s32 nChunks, OSMesgQueue* retQueue, s32 retMsg); void AudioLoad_AsyncDma(AudioAsyncLoad* asyncLoad, size_t size); void AudioLoad_AsyncDmaUnkMedium(uintptr_t devAddr, uintptr_t ramAddr, size_t size, s16 arg3); @@ -1638,7 +1638,7 @@ void AudioLoad_InitAsyncLoads(void) { } } -AudioAsyncLoad* AudioLoad_StartAsyncLoadUnkMedium(s32 unkMediumParam, u32 devAddr, uintptr_t ramAddr, size_t size, +AudioAsyncLoad* AudioLoad_StartAsyncLoadUnkMedium(s32 unkMediumParam, uintptr_t devAddr, uintptr_t ramAddr, size_t size, s32 medium, s32 nChunks, OSMesgQueue* retQueue, s32 retMsg) { AudioAsyncLoad* asyncLoad;