diff --git a/scripts/patch_xp.c b/scripts/patch_xp.c new file mode 100644 index 000000000..9464d6e73 --- /dev/null +++ b/scripts/patch_xp.c @@ -0,0 +1,54 @@ +// patch GetTickCount64 for running on Windows XP +#include + +int main(int argc, char** argv) { + unsigned char* buf; + FILE* f=fopen(argv[1],"rb"); + if (f==NULL) { + perror("open"); + return 1; + } + + fseek(f,0,SEEK_END); + + size_t size=ftell(f); + buf=malloc(size); + + fseek(f,0,SEEK_SET); + + fread(buf,1,size,f); + fclose(f); + + // patch + size_t remain=size; + unsigned char* buf1=buf; + while (size>=14) { + unsigned char* where=memchr(buf1,'G',remain); + if (where==NULL) { + printf("GetTickCount64 not found\n"); + break; + } + + if (memcmp(where,"GetTickCount64",14)==0) { + printf("found GetTickCount64 - patching...\n"); + where[12]=0; + where[13]=0; + break; + } + + buf1=where+1; + remain=size-(buf1-buf); + } + + // write + FILE* of=fopen(argv[1],"wb"); + if (f==NULL) { + perror("open write"); + return 1; + } + + fwrite(buf,1,size,of); + fclose(of); + + return 0; +} diff --git a/scripts/release-winxp.sh b/scripts/release-winxp.sh index 5901f1643..134fc9f17 100755 --- a/scripts/release-winxp.sh +++ b/scripts/release-winxp.sh @@ -36,9 +36,8 @@ cp ../../res/docpdf/manual.pdf . || exit 1 i686-w64-mingw32-strip -s furnace.exe || exit 1 # patch to remove GetTickCount64 -xxd -c 256 -ps furnace.exe | sed "s/4765745469636b436f756e743634/4765745469636b436f756e740000/g" | xxd -ps -r > furnace-patched.exe -rm furnace.exe -mv furnace-patched.exe furnace.exe +gcc -o patch_xp ../../scripts/patch_xp.c || exit 1 +./patch_xp furnace.exe || exit 1 zip -r furnace.zip LICENSE.txt furnace.exe README.txt manual.pdf papers demos instruments wavetables