diff --git a/Makefile.win b/Makefile.win new file mode 100644 index 0000000..cbe70b6 --- /dev/null +++ b/Makefile.win @@ -0,0 +1,5 @@ +# Windows requires -lws2_32 for htons(), htonl(), etc. +# Use make -f Makefile.win to use this Makefile, which adds +# the required library to the LDFLAGS. +LDFLAGS += -lws2_32 +include Makefile \ No newline at end of file diff --git a/cli/Makefile.inc b/cli/Makefile.inc index f8bac28..096cbf4 100644 --- a/cli/Makefile.inc +++ b/cli/Makefile.inc @@ -9,6 +9,6 @@ cli_clean: rm -f $(ROMPATCHER_EXE) $(ROMPATCHER_EXE): $(ROMPATCHER_SRCS:%.c=%.o) $(ROMLIB_A) - $(CC) $(CFLAGS) -o $@ $< $(LDFLAGS) $(ROMLIB_A) + $(CC) $(CFLAGS) -o $@ $< $(ROMLIB_A) $(LDFLAGS) cli/%o: cli/%.c diff --git a/lib/checksum.c b/lib/checksum.c index d607b6b..fc66aec 100644 --- a/lib/checksum.c +++ b/lib/checksum.c @@ -1,5 +1,9 @@ #include +#ifdef __MINGW32__ +#include +#else #include +#endif #include "macrompatcher.h" RomErr GetChecksum(RomCtx *rom, uint32_t *checksum) { diff --git a/lib/locate_drvr.c b/lib/locate_drvr.c index aa8dd62..aa6d8bd 100644 --- a/lib/locate_drvr.c +++ b/lib/locate_drvr.c @@ -1,4 +1,8 @@ +#ifdef __MINGW32__ +#include +#else #include +#endif #include #include "macrompatcher.h" diff --git a/qtgui/RomPatcher.cpp b/qtgui/RomPatcher.cpp index 69d5c3f..ca3d6a1 100644 --- a/qtgui/RomPatcher.cpp +++ b/qtgui/RomPatcher.cpp @@ -100,8 +100,7 @@ void RomPatcher::updateChecksumUI() uint32_t cksum; char *cksumstr = NULL; GetChecksum(rom, &cksum); - asprintf(&cksumstr, "Checksum: %#x", cksum); - checksum->setText(cksumstr); + checksum->setText(QString().sprintf("%#x", cksum)); free(cksumstr); } diff --git a/qtgui/RomPatcher.manifest b/qtgui/RomPatcher.manifest new file mode 100644 index 0000000..38e7e50 --- /dev/null +++ b/qtgui/RomPatcher.manifest @@ -0,0 +1,10 @@ + + + + + + + + + + \ No newline at end of file diff --git a/qtgui/RomPatcher.pro b/qtgui/RomPatcher.pro index e7f6aaa..3a9dc43 100644 --- a/qtgui/RomPatcher.pro +++ b/qtgui/RomPatcher.pro @@ -4,3 +4,8 @@ HEADERS = RomPatcher.h CONFIG += qt LIBS += ../lib/libmacrom.a + +win32 { + QMAKE_PRE_LINK += "windres --input ../qtgui/RomPatcher.rc --output RomPatcher.res --output-format=coff" + LIBS += -lws2_32 RomPatcher.res +} diff --git a/qtgui/RomPatcher.rc b/qtgui/RomPatcher.rc new file mode 100644 index 0000000..9172543 --- /dev/null +++ b/qtgui/RomPatcher.rc @@ -0,0 +1,2 @@ +#include "winuser.h" +1 RT_MANIFEST RomPatcher.manifest \ No newline at end of file