From 562bcd7b201095a51cc9ca28f84b0c1428511753 Mon Sep 17 00:00:00 2001 From: invertego Date: Mon, 18 Sep 2023 02:13:20 -0700 Subject: [PATCH] build: miscellaneous fixes (#1233) Fix various recently introduced build issues. Some background for the string indexing thing: using operator[] to index nall::string causes some ambiguous overload errors in 32-bit builds. This isn't the first time it's come up, but since it's so easy to work around (using operator() instead) I haven't bothered to try to fix it. --- mia/GNUmakefile | 5 +++-- nall/gdb/server.cpp | 10 ++++++---- nall/tcptext/tcp-socket.cpp | 4 +++- tools/genius/GNUmakefile | 2 +- 4 files changed, 13 insertions(+), 8 deletions(-) diff --git a/mia/GNUmakefile b/mia/GNUmakefile index 3e207a20e..a4c106dc1 100644 --- a/mia/GNUmakefile +++ b/mia/GNUmakefile @@ -9,6 +9,7 @@ include $(nall.path)/GNUmakefile thirdparty.path := ../thirdparty libchdr.path := $(thirdparty.path)/libchdr +tzxfile.path := $(thirdparty.path)/TZXFile include $(thirdparty.path)/GNUmakefile hiro.path := ../hiro @@ -25,8 +26,8 @@ $(object.path)/ares.o: $(ares.path)/ares/ares.cpp $(object.path)/mia.o: $(mia.path)/mia.cpp $(object.path)/resource.o: $(mia.path)/resource/resource.cpp -all.objects := $(libchdr.objects) $(nall.objects) $(hiro.objects) $(objects) -all.options := $(libchdr.options) $(nall.options) $(hiro.options) $(options) +all.objects := $(libchdr.objects) $(tzxfile.objects) $(nall.objects) $(hiro.objects) $(objects) +all.options := $(libchdr.options) $(tzxfile.options) $(nall.options) $(hiro.options) $(options) $(all.objects): | $(object.path) diff --git a/nall/gdb/server.cpp b/nall/gdb/server.cpp index 0137bd0b7..8a335f427 100644 --- a/nall/gdb/server.cpp +++ b/nall/gdb/server.cpp @@ -1,5 +1,7 @@ #include +#include + using string = ::nall::string; using string_view = ::nall::string_view; @@ -110,7 +112,7 @@ namespace nall::GDB { { auto cmdParts = cmd.split(":"); auto cmdName = cmdParts[0]; - char cmdPrefix = cmdName.size() > 0 ? cmdName[0] : ' '; + char cmdPrefix = cmdName.size() > 0 ? cmdName(0) : ' '; if constexpr(GDB_LOG_MESSAGES) { printf("GDB <: %s\n", cmdBuffer.data()); @@ -277,7 +279,7 @@ namespace nall::GDB { case 's': { if(cmdName.size() > 1) { u64 address = cmdName.slice(1).integer(); - printf("stepping at address unsupported, ignore (%016lX)\n", address); + printf("stepping at address unsupported, ignore (%016" PRIX64 ")\n", address); } shouldReply = false; @@ -315,7 +317,7 @@ namespace nall::GDB { case 'z': // remove breakpoint (e.g. "z0,801a0ef4,4") { bool isInsert = cmdPrefix == 'Z'; - bool isHardware = cmdName[1] == '1'; // 0=software, 1=hardware + bool isHardware = cmdName(1) == '1'; // 0=software, 1=hardware auto sepIdxMaybe = cmdName.findFrom(3, ","); u32 sepIdx = sepIdxMaybe ? (sepIdxMaybe.get()+3) : 0; @@ -329,7 +331,7 @@ namespace nall::GDB { } Watchpoint wp{addressStart, addressEnd, address}; - switch(cmdName[1]) { + switch(cmdName(1)) { case '0': // (hardware/software breakpoints are the same for us) case '1': addOrRemoveEntry(breakpoints, address, isInsert); break; diff --git a/nall/tcptext/tcp-socket.cpp b/nall/tcptext/tcp-socket.cpp index dc744c092..7f2eaf575 100644 --- a/nall/tcptext/tcp-socket.cpp +++ b/nall/tcptext/tcp-socket.cpp @@ -1,4 +1,6 @@ #include + +#include #include #include @@ -198,7 +200,7 @@ NALL_HEADER_INLINE auto Socket::open(u32 port, bool useIPv4) -> bool { } if constexpr(TCP_LOG_MESSAGES) { - printf("%.4f | TCP >: [%ld]: %.*s\n", (f64)chrono::millisecond() / 1000.0, localSendBuffer.size(), localSendBuffer.size() > 100 ? 100 : (int)localSendBuffer.size(), (char*)localSendBuffer.data()); + printf("%.4f | TCP >: [%" PRIu64 "]: %.*s\n", (f64)chrono::millisecond() / 1000.0, localSendBuffer.size(), localSendBuffer.size() > 100 ? 100 : (int)localSendBuffer.size(), (char*)localSendBuffer.data()); } localSendBuffer.resize(0); diff --git a/tools/genius/GNUmakefile b/tools/genius/GNUmakefile index 54a2f2254..88a48753c 100644 --- a/tools/genius/GNUmakefile +++ b/tools/genius/GNUmakefile @@ -1,6 +1,6 @@ name := genius build := stable -flags += -I../../ -DNALL_HEADER_ONLY +flags += -I../../ nall.path := ../../nall include $(nall.path)/GNUmakefile