[⚡Patch] Refactored another dvar patch
This commit is contained in:
parent
61becec5f8
commit
2141953330
@ -433,6 +433,12 @@ namespace Components
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Game::dvar_t* QuickPatch::Dvar_RegisterUIBuildLocation(const char* dvarName,
|
||||||
|
float /*x*/, float /*y*/, float min, float max, int /*flags*/, const char* description)
|
||||||
|
{
|
||||||
|
return Game::Dvar_RegisterVec2(dvarName, -60.0f, 474.0f, min, max, Game::DVAR_FLAG_READONLY, description);
|
||||||
|
}
|
||||||
|
|
||||||
QuickPatch::QuickPatch()
|
QuickPatch::QuickPatch()
|
||||||
{
|
{
|
||||||
// quit_hard
|
// quit_hard
|
||||||
@ -527,16 +533,11 @@ namespace Components
|
|||||||
Utils::Hook::Set<const char*>(0x60BD56, "IW4x (" VERSION ")");
|
Utils::Hook::Set<const char*>(0x60BD56, "IW4x (" VERSION ")");
|
||||||
|
|
||||||
// version string color
|
// version string color
|
||||||
static float buildLocColor[] = { 1.0f, 1.0f, 1.0f, 0.8f };
|
static Game::vec4_t buildLocColor = { 1.0f, 1.0f, 1.0f, 0.8f };
|
||||||
Utils::Hook::Set(0x43F710, buildLocColor);
|
Utils::Hook::Set<float*>(0x43F710, buildLocColor);
|
||||||
|
|
||||||
// Shift ui version string to the left (ui_buildlocation)
|
// Shift ui version string to the left (ui_buildlocation)
|
||||||
Utils::Hook::Nop(0x6310A0, 5); // Don't register the initial dvar
|
Utils::Hook(0x6310A0, QuickPatch::Dvar_RegisterUIBuildLocation, HOOK_CALL).install()->quick();
|
||||||
Utils::Hook::Nop(0x6310B8, 5); // Don't write the result
|
|
||||||
Dvar::OnInit([]()
|
|
||||||
{
|
|
||||||
*reinterpret_cast<Game::dvar_t**>(0x62E4B64) = Game::Dvar_RegisterVec2("ui_buildLocation", -60.0f, 474.0f, -10000.0, 10000.0, Game::DVAR_FLAG_READONLY, "Where to draw the build number");
|
|
||||||
});
|
|
||||||
|
|
||||||
// console title
|
// console title
|
||||||
if (ZoneBuilder::IsEnabled())
|
if (ZoneBuilder::IsEnabled())
|
||||||
@ -763,11 +764,6 @@ namespace Components
|
|||||||
QuickPatch::UnlockStats();
|
QuickPatch::UnlockStats();
|
||||||
});
|
});
|
||||||
|
|
||||||
Command::Add("crash", [](Command::Params*)
|
|
||||||
{
|
|
||||||
throw new std::exception();
|
|
||||||
});
|
|
||||||
|
|
||||||
Command::Add("dumptechsets", [](Command::Params* param)
|
Command::Add("dumptechsets", [](Command::Params* param)
|
||||||
{
|
{
|
||||||
if (param->length() != 2)
|
if (param->length() != 2)
|
||||||
@ -1000,11 +996,6 @@ namespace Components
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
QuickPatch::~QuickPatch()
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
bool QuickPatch::unitTest()
|
bool QuickPatch::unitTest()
|
||||||
{
|
{
|
||||||
uint32_t randIntCount = 4'000'000;
|
uint32_t randIntCount = 4'000'000;
|
||||||
|
@ -6,7 +6,6 @@ namespace Components
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
QuickPatch();
|
QuickPatch();
|
||||||
~QuickPatch();
|
|
||||||
|
|
||||||
bool unitTest() override;
|
bool unitTest() override;
|
||||||
|
|
||||||
@ -48,5 +47,7 @@ namespace Components
|
|||||||
|
|
||||||
static void CL_KeyEvent_OnEscape();
|
static void CL_KeyEvent_OnEscape();
|
||||||
static void CL_KeyEvent_ConsoleEscape_Stub();
|
static void CL_KeyEvent_ConsoleEscape_Stub();
|
||||||
|
|
||||||
|
static Game::dvar_t* Dvar_RegisterUIBuildLocation(const char* dvarName, float x, float y, float min, float max, int flags, const char* description);
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user