diff --git a/.gitignore b/.gitignore index eea66dc..d4bdfc0 100644 --- a/.gitignore +++ b/.gitignore @@ -16,3 +16,5 @@ build/ builds/ __pycache__ CMakeFiles +/msvc/MetaObjects/moc_main-window.cpp +/msvc/MetaObjects/moc_widgets.cpp diff --git a/common/mt19937-64.c b/common/mt19937-64.c index 1d9aa93..260f723 100644 --- a/common/mt19937-64.c +++ b/common/mt19937-64.c @@ -58,6 +58,7 @@ #include #include +#include #include "mt64.h" @@ -147,7 +148,7 @@ int mt_rand_bool() void mt_shuffle(void *array, size_t n, size_t size) { - char tmp[size]; + char *tmp = malloc(size); char *arr = array; size_t i,j, stride = size * sizeof(char); @@ -160,5 +161,6 @@ void mt_shuffle(void *array, size_t n, size_t size) memcpy(arr + i * stride, tmp, size); } } + free(tmp); } diff --git a/common/sprites.c b/common/sprites.c index 91798fc..1f262f0 100644 --- a/common/sprites.c +++ b/common/sprites.c @@ -2678,6 +2678,8 @@ static void challenge1(dw_rom *rom) vpatch(rom, 0x12820, 15, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00); vpatch(rom, 0x12840, 16, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00); vpatch(rom, 0x12860, 16, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00); + vpatch(rom, 0x12910, 16, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00); + vpatch(rom, 0x12930, 16, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00); vpatch(rom, 0x12950, 16, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00); vpatch(rom, 0x12970, 144, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00); vpatch(rom, 0x12a20, 112, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00); @@ -2700,6 +2702,16 @@ static void challenge2(dw_rom *rom) static void challenge5(dw_rom *rom) { + vpatch(rom, 0x10000, 7, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00); + vpatch(rom, 0x10010, 7, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00); + vpatch(rom, 0x10020, 7, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00); + vpatch(rom, 0x10030, 7, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00); + vpatch(rom, 0x10040, 7, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00); + vpatch(rom, 0x10050, 7, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00); + vpatch(rom, 0x10060, 7, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00); + vpatch(rom, 0x10070, 7, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00); + vpatch(rom, 0x10080, 7, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00); + vpatch(rom, 0x10090, 7, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00); vpatch(rom, 0x11000, 7, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00); vpatch(rom, 0x11010, 7, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00); vpatch(rom, 0x11020, 7, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00); @@ -2715,7 +2727,9 @@ static void challenge5(dw_rom *rom) void sprite(dw_rom *rom, const char *sprite_name) { - void (*sprite_func[sprite_count()-2])(dw_rom *rom); + typedef void(*sprite_func_t)(dw_rom *rom); + + sprite_func_t *sprite_func = _alloca((sprite_count() - 2) * sizeof(sprite_func_t)); size_t i=0; sprite_func[i++] = &gwaelin; diff --git a/msvc/DwRandomizer.sln b/msvc/DwRandomizer.sln new file mode 100644 index 0000000..dbc8e89 --- /dev/null +++ b/msvc/DwRandomizer.sln @@ -0,0 +1,31 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio 15 +VisualStudioVersion = 15.0.27703.2018 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "DwRandomizer", "DwRandomizer.vcxproj", "{14D33B21-0098-4ECA-8D2E-7F0E57EE1E8B}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|x64 = Debug|x64 + Debug|x86 = Debug|x86 + Release|x64 = Release|x64 + Release|x86 = Release|x86 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {14D33B21-0098-4ECA-8D2E-7F0E57EE1E8B}.Debug|x64.ActiveCfg = Debug|x64 + {14D33B21-0098-4ECA-8D2E-7F0E57EE1E8B}.Debug|x64.Build.0 = Debug|x64 + {14D33B21-0098-4ECA-8D2E-7F0E57EE1E8B}.Debug|x86.ActiveCfg = Debug|Win32 + {14D33B21-0098-4ECA-8D2E-7F0E57EE1E8B}.Debug|x86.Build.0 = Debug|Win32 + {14D33B21-0098-4ECA-8D2E-7F0E57EE1E8B}.Release|x64.ActiveCfg = Release|x64 + {14D33B21-0098-4ECA-8D2E-7F0E57EE1E8B}.Release|x64.Build.0 = Release|x64 + {14D33B21-0098-4ECA-8D2E-7F0E57EE1E8B}.Release|x86.ActiveCfg = Release|Win32 + {14D33B21-0098-4ECA-8D2E-7F0E57EE1E8B}.Release|x86.Build.0 = Release|Win32 + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {CF5BA447-6274-44FD-B679-566997066215} + EndGlobalSection +EndGlobal diff --git a/msvc/DwRandomizer.vcxproj b/msvc/DwRandomizer.vcxproj new file mode 100644 index 0000000..e1f06df --- /dev/null +++ b/msvc/DwRandomizer.vcxproj @@ -0,0 +1,210 @@ + + + + + Debug + Win32 + + + Release + Win32 + + + Debug + x64 + + + Release + x64 + + + + 15.0 + {14D33B21-0098-4ECA-8D2E-7F0E57EE1E8B} + DwRandomizer + 10.0.17134.0 + + + + Application + true + v141 + MultiByte + + + Application + false + v141 + true + MultiByte + + + Application + true + v141 + MultiByte + + + Application + false + v141 + true + MultiByte + + + + + + + + + + + + + + + + + + + + + $(QtDirectory)\msvc2017_64\bin;$(ExecutablePath) + + + $(QtDirectory)\msvc2017_64\bin;$(ExecutablePath) + + + $(QtDirectory)\msvc2015\bin;$(ExecutablePath) + + + $(QtDirectory)\msvc2015\bin;$(ExecutablePath) + + + + Level3 + Disabled + true + true + $(ProjectDir)\..\common;$(ProjectDir)\..\ui;$(QtDirectory)\msvc2015\include;%(AdditionalIncludeDirectories) + _CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions) + + + $(QtDirectory)\msvc2015\lib;%(AdditionalLibraryDirectories) + qtmaind.lib;Qt5Widgetsd.lib;Qt5Guid.lib;Qt5Cored.lib;%(AdditionalDependencies) + Windows + + + + + Level3 + Disabled + true + true + $(ProjectDir)\..\common;$(ProjectDir)\..\ui;$(QtDirectory)\msvc2017_64\include;%(AdditionalIncludeDirectories) + _CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions) + + + $(QtDirectory)\msvc2017_64\lib;%(AdditionalLibraryDirectories) + qtmaind.lib;Qt5Widgetsd.lib;Qt5Guid.lib;Qt5Cored.lib;%(AdditionalDependencies) + Windows + + + + + Level3 + MaxSpeed + true + true + true + true + $(ProjectDir)\..\common;$(ProjectDir)\..\ui;$(QtDirectory)\msvc2015\include;%(AdditionalIncludeDirectories) + _CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions) + MultiThreadedDLL + + + true + true + $(QtDirectory)\msvc2015\lib;%(AdditionalLibraryDirectories) + qtmain.lib;Qt5Widgets.lib;Qt5Gui.lib;Qt5Core.lib;%(AdditionalDependencies) + Windows + + + + + Level3 + MaxSpeed + true + true + true + true + $(ProjectDir)\..\common;$(ProjectDir)\..\ui;$(QtDirectory)\msvc2017_64\include;%(AdditionalIncludeDirectories) + _CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions) + MultiThreadedDLL + + + true + true + $(QtDirectory)\msvc2017_64\lib;%(AdditionalLibraryDirectories) + qtmain.lib;Qt5Widgets.lib;Qt5Gui.lib;Qt5Core.lib;%(AdditionalDependencies) + Windows + + + + + + + + + + + + + + moc.exe "%(FullPath)" > "$(ProjectDir)MetaObjects\moc_%(Filename).cpp + QT: Generate $(ProjectDir)MetaObjects\moc_%(Filename).cpp + $(ProjectDir)MetaObjects\moc_%(Filename).cpp + moc.exe "%(FullPath)" > "$(ProjectDir)MetaObjects\moc_%(Filename).cpp + QT: Generate $(ProjectDir)MetaObjects\moc_%(Filename).cpp + $(ProjectDir)MetaObjects\moc_%(Filename).cpp + moc.exe "%(FullPath)" > "$(ProjectDir)MetaObjects\moc_%(Filename).cpp + QT: Generate $(ProjectDir)MetaObjects\moc_%(Filename).cpp + $(ProjectDir)MetaObjects\moc_%(Filename).cpp + moc.exe "%(FullPath)" > "$(ProjectDir)MetaObjects\moc_%(Filename).cpp + QT: Generate $(ProjectDir)MetaObjects\moc_%(Filename).cpp + $(ProjectDir)MetaObjects\moc_%(Filename).cpp + + + moc.exe "%(FullPath)" > "$(ProjectDir)MetaObjects\moc_%(Filename).cpp + moc.exe "%(FullPath)" > "$(ProjectDir)MetaObjects\moc_%(Filename).cpp + moc.exe "%(FullPath)" > "$(ProjectDir)MetaObjects\moc_%(Filename).cpp + moc.exe "%(FullPath)" > "$(ProjectDir)MetaObjects\moc_%(Filename).cpp + QT: Generate $(ProjectDir)MetaObjects\moc_%(Filename).cpp + QT: Generate $(ProjectDir)MetaObjects\moc_%(Filename).cpp + QT: Generate $(ProjectDir)MetaObjects\moc_%(Filename).cpp + QT: Generate $(ProjectDir)MetaObjects\moc_%(Filename).cpp + $(ProjectDir)MetaObjects\moc_%(Filename).cpp + $(ProjectDir)MetaObjects\moc_%(Filename).cpp + $(ProjectDir)MetaObjects\moc_%(Filename).cpp + $(ProjectDir)MetaObjects\moc_%(Filename).cpp + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/msvc/DwRandomizer.vcxproj.filters b/msvc/DwRandomizer.vcxproj.filters new file mode 100644 index 0000000..2d674c4 --- /dev/null +++ b/msvc/DwRandomizer.vcxproj.filters @@ -0,0 +1,107 @@ + + + + + {4FC737F1-C7A5-4376-A066-2A32D752A2FF} + cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx + + + {93995380-89BD-4b04-88EB-625FBE52EBFB} + h;hh;hpp;hxx;hm;inl;inc;ipp;xsd + + + {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} + rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms + + + {c9054c2d-93b2-4ce3-9735-16ff46466f26} + + + {7f0e4093-bcbd-4032-b7fa-f260c6e8f182} + + + {7f59b801-3232-499b-aa17-577e592c3b6b} + + + {88071a20-2997-4d86-9036-70ea9191b117} + + + {2b25a0a3-9561-4b9a-a977-a1fa6185f35b} + + + + + Header Files\common + + + Header Files\common + + + Header Files\common + + + Header Files\common + + + Header Files\common + + + Header Files\common + + + Header Files\common + + + Header Files\common + + + Header Files\common + + + + + Source Files\common + + + Source Files\common + + + Source Files\common + + + Source Files\common + + + Source Files\common + + + Source Files\common + + + Source Files\common + + + Source Files\ui + + + Source Files\ui + + + Source Files\ui + + + MetaObjects + + + MetaObjects + + + + + Header Files\ui + + + Header Files + + + \ No newline at end of file diff --git a/msvc/MetaObjects/.gitkeep b/msvc/MetaObjects/.gitkeep new file mode 100644 index 0000000..e69de29