iw4x-client/iw4/Components/Console.cpp

39 lines
1.0 KiB
C++
Raw Normal View History

2015-12-23 08:45:53 -05:00
#include "..\STDInclude.hpp"
namespace Components
{
2015-12-27 08:05:08 -05:00
char** Console::GetAutoCompleteFileList(const char *path, const char *extension, Game::FsListBehavior_e behavior, int *numfiles, int allocTrackType)
{
2015-12-27 09:39:49 -05:00
if (path == (char*)0xBAADF00D || IsBadReadPtr(path, 1)) return nullptr;
2015-12-27 08:05:08 -05:00
return Game::FS_ListFiles(path, extension, behavior, numfiles, allocTrackType);
}
2015-12-23 08:45:53 -05:00
void Console::ToggleConsole()
{
// possibly cls.keyCatchers?
2015-12-23 09:00:01 -05:00
Utils::Hook::Xor<DWORD>(0xB2C538, 1);
2015-12-23 08:45:53 -05:00
// g_consoleField
Game::Field_Clear((void*)0xA1B6B0);
// show console output?
Utils::Hook::Set<BYTE>(0xA15F38, 0);
}
Console::Console()
{
// External console
Utils::Hook::Nop(0x60BB58, 11);
// Console '%s: %s> ' string
Utils::Hook::Set<char*>(0x5A44B4, "IW4x > ");
// Internal console
Utils::Hook(0x4F690C, Console::ToggleConsole, HOOK_CALL).Install()->Quick();
Utils::Hook(0x4F65A5, Console::ToggleConsole, HOOK_JUMP).Install()->Quick();
2015-12-27 08:05:08 -05:00
// Check for bad food ;)
Utils::Hook(0x4CB9F4, Console::GetAutoCompleteFileList, HOOK_CALL).Install()->Quick();
2015-12-23 08:45:53 -05:00
}
}