Fastfile stuff.

This commit is contained in:
momo5502
2016-01-12 23:42:05 +01:00
parent 9f01412ca8
commit 8a629bc391
6 changed files with 67 additions and 0 deletions

View File

@ -63,6 +63,8 @@ namespace Components
FastFiles::FastFiles()
{
Dvar::Register<bool>("ui_zoneDebug", false, Game::dvar_flag::DVAR_FLAG_SAVED, "Display current loaded zone.");
// Redirect zone paths
Utils::Hook(0x44DA90, FastFiles::GetZoneLocation, HOOK_JUMP).Install()->Quick();
@ -94,6 +96,15 @@ namespace Components
// Add custom zone paths
FastFiles::AddZonePath("zone\\patch\\");
FastFiles::AddZonePath("zone\\dlc\\");
Renderer::OnFrame([] ()
{
if (!FastFiles::Current().size() || !Dvar::Var("ui_zoneDebug").Get<bool>()) return;
Game::Font_s* font = Game::R_RegisterFont("fonts/consoleFont"); // Inlining that seems to skip xpos, no idea why xD
float color[4] = { 1.0f, 1.0f, 1.0f, (Game::CL_IsCgameInitialized() ? 0.3f : 1.0f) };
Game::R_AddCmdDrawText(Utils::VA("Loading FastFile: %s", FastFiles::Current().data()), 0x7FFFFFFF, font, 5.0f, (float)(Renderer::Height() - 5), 1.0f, 1.0f, 0.0f, color, 0);
});
}
FastFiles::~FastFiles()

View File

@ -27,6 +27,16 @@ namespace Components
Renderer::FrameCallbacks.push_back(callback);
}
int Renderer::Width()
{
return Utils::Hook::Get<int>(0x66E1C68);
}
int Renderer::Height()
{
return Utils::Hook::Get<int>(0x66E1C6C);
}
Renderer::Renderer()
{
// Frame hook

View File

@ -9,6 +9,9 @@ namespace Components
~Renderer();
const char* GetName() { return "Renderer"; };
static int Width();
static int Height();
static void OnFrame(Callback callback);
private: