diff --git a/examples/mods/aim1_community_fix/aim.exe.fixes.h b/examples/mods/aim1_community_fix/aim.exe.fixes.h index 0180e95..0dd7cb2 100644 --- a/examples/mods/aim1_community_fix/aim.exe.fixes.h +++ b/examples/mods/aim1_community_fix/aim.exe.fixes.h @@ -1,5 +1,9 @@ #include +#ifdef DONT_OPTIMIZE +#pragma optimize("", off) +#endif + // public enums enum aim1_fix : uint32_t { script_function__ISGLIDER = 0x0043A1F6, @@ -444,3 +448,7 @@ BOOL WINAPI DllMain(HINSTANCE, DWORD fdwReason, LPVOID) { return TRUE; } #endif + +#ifdef DONT_OPTIMIZE +#pragma optimize("", on) +#endif diff --git a/src/aim1_mod_maker/aim1_mod_maker.h b/src/aim1_mod_maker/aim1_mod_maker.h index 037fa99..31c2a2f 100644 --- a/src/aim1_mod_maker/aim1_mod_maker.h +++ b/src/aim1_mod_maker/aim1_mod_maker.h @@ -657,21 +657,25 @@ private: //fs::copy_file(fn, get_mod_dir() / fn.filename(), fs::copy_options::overwrite_existing); std::string contents; contents += "void build(Solution &s) {\n"; - contents += "auto &t = s.addSharedLibrary(\"" + name + "\""; + contents += " auto &t = s.addSharedLibrary(\"" + name + "\""; if (!version.empty()) { contents += ", \"" + version + "\""; } contents += ");\n"; - contents += "t += cpp23;\n"; - contents += "t += \"" + boost::replace_all_copy(fn.string(), "\\", "/") + "\";\n"; - contents += "t += \"INJECTED_DLL\"_def;\n"; + contents += " t += cpp23;\n"; + contents += " t += \"" + boost::replace_all_copy(fn.string(), "\\", "/") + "\";\n"; + contents += " t += \"INJECTED_DLL\"_def;\n"; +#if !defined(NDEBUG) + contents += " t += \"DONT_OPTIMIZE\"_def;\n"; +#endif contents += "}\n"; write_file(get_mod_dir() / "sw.cpp", contents); // when you enable debug build, you cannot distribute this dll, // because user systems does not have debug dll dependencies!!! - auto conf = "d"s; -#if 1 || defined(NDEBUG) + // so we use rwdi + auto conf = "rwdi"s; +#if defined(NDEBUG) conf = "r"; #endif