diff --git a/Makefile.mingw-w64 b/Makefile.mingw-w64 new file mode 100644 index 0000000..e36030f --- /dev/null +++ b/Makefile.mingw-w64 @@ -0,0 +1,38 @@ +# In case CMake's being a shit +CC=i686-w64-mingw32-gcc +STRIP=i686-w64-mingw32-strip +WINDRES=i686-w64-mingw32-windres + +LAUNCHER_FLAGS=-static -DNDEBUG -Os -mwindows --entry _WinMain@16 -nostdlib -lkernel32 -luser32 + +all: lotrbfme.exe lotrbfme2.exe lotrbfme2ep1.exe fixinst.exe + +lotrbfme-res.o: ../lotrbfme.rc ../lotrbfme.ico + ${WINDRES} $< -O coff $@ + +lotrbfme2-res.o: ../lotrbfme2.rc ../lotrbfme2.ico + ${WINDRES} $< -O coff $@ + +lotrbfme2ep1-res.o: ../lotrbfme2ep1.rc ../lotrbfme2ep1.ico + ${WINDRES} $< -O coff $@ + +lotrbfme.exe: ../launcher.c ../launcher.h lotrbfme-res.o + ${CC} -o $@ -DLOTRBFME_GAME=1 $^ ${LAUNCHER_FLAGS} + ${STRIP} -s $@ + +lotrbfme2.exe: ../launcher.c ../launcher.h lotrbfme2-res.o + ${CC} -o $@ -DLOTRBFME_GAME=2 $^ ${LAUNCHER_FLAGS} + ${STRIP} -s $@ + +lotrbfme2ep1.exe: ../launcher.c ../launcher.h lotrbfme2ep1-res.o + ${CC} -o $@ -DLOTRBFME_GAME=3 $^ ${LAUNCHER_FLAGS} + ${STRIP} -s $@ + +fixinst.exe: ../fixinst.c ../launcher.h + ${CC} -o $@ $^ -Os -mconsole -lshlwapi + ${STRIP} -s $@ + +clean: + rm -f lotrbfme.exe lotrbfme2.exe lotrbfme2ep1.exe lotrbfme-res.o lotrbfme2-res.o lotrbfme2ep1-res.o fixinst.exe + +.PHONY: all clean diff --git a/fixinst.exe b/fixinst.exe index 5b467dd..e5429f0 100755 Binary files a/fixinst.exe and b/fixinst.exe differ diff --git a/launcher.c b/launcher.c index 7f10ff0..e8ef1fd 100644 --- a/launcher.c +++ b/launcher.c @@ -37,6 +37,15 @@ static void show_error_box(LPCWSTR msg) MessageBoxW(NULL, msg, LOTRBFME_SKUNAME, MB_OK | MB_ICONERROR); } +static LPWSTR lstrrchrW(LPCWSTR s, WCHAR c) +{ + LPCWSTR p; + for(p = s + lstrlenW(s); p >= s && *p != c; p--) + ; + + return p >= s ? (LPWSTR)p : 0; +} + static LPWSTR get_executable_directory() { HMODULE hThis = GetModuleHandleW(NULL); @@ -59,7 +68,7 @@ static LPWSTR get_executable_directory() p = np; } - LPWSTR end = wcsrchr(p, '\\'); + LPWSTR end = lstrrchrW(p, '\\'); if(end) *end = L'\0'; diff --git a/lotrbfme.exe b/lotrbfme.exe index 8069b50..d7ccbb4 100755 Binary files a/lotrbfme.exe and b/lotrbfme.exe differ diff --git a/lotrbfme2.exe b/lotrbfme2.exe index d85d53f..24af6a5 100755 Binary files a/lotrbfme2.exe and b/lotrbfme2.exe differ diff --git a/lotrbfme2ep1.exe b/lotrbfme2ep1.exe index 192295b..b0d89fa 100755 Binary files a/lotrbfme2ep1.exe and b/lotrbfme2ep1.exe differ