More vid_restart fixes
This commit is contained in:
parent
6f613a9249
commit
2768d1360e
@ -260,10 +260,23 @@ namespace gui
|
||||
}
|
||||
}
|
||||
|
||||
void shutdown_gui()
|
||||
{
|
||||
if (initialized)
|
||||
{
|
||||
ImGui_ImplWin32_Shutdown();
|
||||
ImGui::DestroyContext();
|
||||
}
|
||||
|
||||
initialized = false;
|
||||
}
|
||||
|
||||
HRESULT d3d11_create_device_stub(IDXGIAdapter* pAdapter, D3D_DRIVER_TYPE DriverType, HMODULE Software,
|
||||
UINT Flags, const D3D_FEATURE_LEVEL* pFeatureLevels, UINT FeatureLevels, UINT SDKVersion,
|
||||
ID3D11Device** ppDevice, D3D_FEATURE_LEVEL* pFeatureLevel, ID3D11DeviceContext** ppImmediateContext)
|
||||
{
|
||||
shutdown_gui();
|
||||
|
||||
const auto result = D3D11CreateDevice(pAdapter, DriverType, Software, Flags, pFeatureLevels,
|
||||
FeatureLevels, SDKVersion, ppDevice, pFeatureLevel, ppImmediateContext);
|
||||
|
||||
@ -402,11 +415,7 @@ namespace gui
|
||||
|
||||
void pre_destroy() override
|
||||
{
|
||||
if (initialized)
|
||||
{
|
||||
ImGui_ImplWin32_Shutdown();
|
||||
ImGui::DestroyContext();
|
||||
}
|
||||
shutdown_gui();
|
||||
}
|
||||
};
|
||||
}
|
||||
|
@ -319,11 +319,6 @@ namespace mods
|
||||
utils::io::create_directory(MOD_FOLDER);
|
||||
}
|
||||
|
||||
if (!utils::io::directory_exists(MOD_STATS_FOLDER))
|
||||
{
|
||||
utils::io::create_directory(MOD_STATS_FOLDER);
|
||||
}
|
||||
|
||||
db_release_xassets_hook.create(0x140416A80, db_release_xassets_stub);
|
||||
|
||||
command::add("loadmod", [](const command::params& params)
|
||||
|
@ -44,23 +44,16 @@ namespace patches
|
||||
gscr_set_save_dvar_hook.invoke<void>();
|
||||
}
|
||||
|
||||
void free_lui_memory()
|
||||
void vid_restart_stub()
|
||||
{
|
||||
// free stuff
|
||||
*reinterpret_cast<void**>(0x141E584D8) = nullptr; // free material
|
||||
utils::hook::invoke<void>(0x1406926B0); // free scripted viewmodel xanim stuff
|
||||
utils::hook::invoke<void>(0x14032A540); // properly free lui memory
|
||||
}
|
||||
|
||||
void vid_restart_stub_1()
|
||||
{
|
||||
free_lui_memory();
|
||||
utils::hook::invoke<void>(0x1405A6480);
|
||||
}
|
||||
|
||||
void vid_restart_stub_2()
|
||||
{
|
||||
free_lui_memory();
|
||||
utils::hook::invoke<void>(0x1406B5290);
|
||||
}
|
||||
|
||||
void exec_config_stub(void* a1)
|
||||
{
|
||||
dvars::register_string("name", "Unknown Soldier", game::DVAR_FLAG_SAVED, "Player name");
|
||||
@ -108,8 +101,7 @@ namespace patches
|
||||
gscr_set_save_dvar_hook.create(0x140504C60, &gscr_set_save_dvar_stub);
|
||||
|
||||
// fix vid_restart crashing
|
||||
utils::hook::call(0x1403D7413, vid_restart_stub_1);
|
||||
utils::hook::jump(0x1403D7402, vid_restart_stub_2);
|
||||
utils::hook::call(0x1403D7413, vid_restart_stub);
|
||||
|
||||
// cinematicingameloopresident -> cinematicingameloop (fix ingame cinematics)
|
||||
utils::hook::jump(0x140502140, 0x1405020C0);
|
||||
|
Loading…
Reference in New Issue
Block a user