[mod] Better debuggability.

This commit is contained in:
lzwdgc 2024-04-04 23:50:28 +03:00
parent 3846e8d735
commit 20ee8abbb3
2 changed files with 18 additions and 6 deletions

View file

@ -1,5 +1,9 @@
#include <stdint.h>
#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

View file

@ -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