Sync with 3cd9c83
This commit is contained in:
parent
89b20d82cb
commit
847bdea4ff
@ -13,7 +13,6 @@ namespace patches
|
|||||||
{
|
{
|
||||||
utils::hook::detour gscr_set_save_dvar_hook;
|
utils::hook::detour gscr_set_save_dvar_hook;
|
||||||
utils::hook::detour dvar_register_float_hook;
|
utils::hook::detour dvar_register_float_hook;
|
||||||
utils::hook::detour dvar_register_bool_hook;
|
|
||||||
|
|
||||||
void* sub_46148()
|
void* sub_46148()
|
||||||
{
|
{
|
||||||
@ -30,7 +29,7 @@ namespace patches
|
|||||||
void gscr_set_save_dvar_stub()
|
void gscr_set_save_dvar_stub()
|
||||||
{
|
{
|
||||||
const auto string = utils::string::to_lower(utils::hook::invoke<const char*>(0x1405C7C20, 0));
|
const auto string = utils::string::to_lower(utils::hook::invoke<const char*>(0x1405C7C20, 0));
|
||||||
if (string == "cg_fov" || string == "cg_fovscale" || string == "snd_musicdisabledforcustomsoundtrack")
|
if (string == "cg_fov" || string == "cg_fovscale")
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -59,20 +58,6 @@ namespace patches
|
|||||||
return dvar_register_float_hook.invoke<game::dvar_t*>(hash, dvarName, value, min, max, flags);
|
return dvar_register_float_hook.invoke<game::dvar_t*>(hash, dvarName, value, min, max, flags);
|
||||||
}
|
}
|
||||||
|
|
||||||
game::dvar_t* snd_musicDisabledForCustomSoundtrack = nullptr;
|
|
||||||
|
|
||||||
game::dvar_t* dvar_register_bool_stub(int hash, const char* name, bool value, unsigned int flags)
|
|
||||||
{
|
|
||||||
static const auto snd_musicdisabledforcustomsoundtrack_hash = game::generateHashValue("snd_musicdisabledforcustomsoundtrack");
|
|
||||||
|
|
||||||
if (hash == snd_musicdisabledforcustomsoundtrack_hash)
|
|
||||||
{
|
|
||||||
return snd_musicDisabledForCustomSoundtrack;
|
|
||||||
}
|
|
||||||
|
|
||||||
return dvar_register_bool_hook.invoke<game::dvar_t*>(hash, name, value, flags);
|
|
||||||
}
|
|
||||||
|
|
||||||
void free_lui_memory()
|
void free_lui_memory()
|
||||||
{
|
{
|
||||||
utils::hook::invoke<void>(0x14032A540); // properly free lui memory
|
utils::hook::invoke<void>(0x14032A540); // properly free lui memory
|
||||||
@ -89,6 +74,11 @@ namespace patches
|
|||||||
free_lui_memory();
|
free_lui_memory();
|
||||||
utils::hook::invoke<void>(0x1406B5290);
|
utils::hook::invoke<void>(0x1406B5290);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
game::dvar_t* register_snd_music_stub(int hash, const char* name, bool value, unsigned int /*flags*/)
|
||||||
|
{
|
||||||
|
return game::Dvar_RegisterBool(hash, name, value, game::DVAR_FLAG_SAVED);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
class component final : public component_interface
|
class component final : public component_interface
|
||||||
@ -123,17 +113,14 @@ namespace patches
|
|||||||
cg_fovScale = dvars::register_float("cg_fovScale", 1.f, 0.1f, 2.f,
|
cg_fovScale = dvars::register_float("cg_fovScale", 1.f, 0.1f, 2.f,
|
||||||
game::DVAR_FLAG_SAVED, "Scale applied to the field of view");
|
game::DVAR_FLAG_SAVED, "Scale applied to the field of view");
|
||||||
|
|
||||||
// Make snd_musicDisabledForCustomSoundtrack saved dvar
|
|
||||||
|
|
||||||
snd_musicDisabledForCustomSoundtrack = dvars::register_bool("snd_musicDisabledForCustomSoundtrack", 0,
|
|
||||||
game::DVAR_FLAG_SAVED, "Disable all in-game music");
|
|
||||||
|
|
||||||
dvar_register_float_hook.create(game::Dvar_RegisterFloat.get(), dvar_register_float_stub);
|
dvar_register_float_hook.create(game::Dvar_RegisterFloat.get(), dvar_register_float_stub);
|
||||||
dvar_register_bool_hook.create(game::Dvar_RegisterBool.get(), dvar_register_bool_stub);
|
|
||||||
|
|
||||||
// fix vid_restart crashing
|
// fix vid_restart crashing
|
||||||
utils::hook::call(0x1403D7413, vid_restart_stub_1);
|
utils::hook::call(0x1403D7413, vid_restart_stub_1);
|
||||||
utils::hook::jump(0x1403D7402, vid_restart_stub_2);
|
utils::hook::jump(0x1403D7402, vid_restart_stub_2);
|
||||||
|
|
||||||
|
// make snd_musicDisabledForCustomSoundtrack saved
|
||||||
|
utils::hook::call(0x1405D05FB, register_snd_music_stub);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user