Detach ingame console from the safearea

This commit is contained in:
momo5502 2016-06-10 19:53:09 +02:00
parent 64593aa079
commit 6dd08dad5a
7 changed files with 55 additions and 3 deletions

2
deps/mongoose vendored

@ -1 +1 @@
Subproject commit 1d4f97bb4c6253c94aa811b25516456c0094cf4a
Subproject commit 17184909820c448d51212599006ab65476a398df

2
deps/protobuf vendored

@ -1 +1 @@
Subproject commit fba7976f5d6f1be69d4219a7c485c93b8b28bf65
Subproject commit 088c5c491e7a1c95c7b8eb55f119a8a999c81dc1

View File

@ -440,6 +440,27 @@ namespace Components
Utils::Hook(0x4F690C, Console::ToggleConsole, HOOK_CALL).Install()->Quick();
Utils::Hook(0x4F65A5, Console::ToggleConsole, HOOK_JUMP).Install()->Quick();
// Patch safearea for ingame-console
Utils::Hook(0x5A50EF, [] ()
{
// Backup the original safe area
Game::SafeArea safeAreaBackup;
safeAreaBackup = *Game::safeArea;
// Apply new safe area and border
float border = 6.0f;
Game::safeArea->top = border;
Game::safeArea->left = border;
Game::safeArea->bottom = static_cast<float>(Renderer::Height()) - border;
Game::safeArea->right = static_cast<float>(Renderer::Width()) - border;
// Draw the console
Game::Con_DrawSolidConsole();
// Restore the initial safe area
*Game::safeArea = safeAreaBackup;
}, HOOK_CALL).Install()->Quick();
// Check for bad food ;)
Utils::Hook(0x4CB9F4, Console::GetAutoCompleteFileList, HOOK_CALL).Install()->Quick();

View File

@ -139,7 +139,18 @@ namespace Components
Utils::Hook::Set<char*>(0x60BD56, "IW4x (r" REVISION_STR REVISION_SUFFIX ")");
// console title
Utils::Hook::Set<char*>(0x4289E8, "IW4x (r" REVISION_STR REVISION_SUFFIX "): Console");
if (ZoneBuilder::IsEnabled())
{
Utils::Hook::Set<char*>(0x4289E8, "IW4x (r" REVISION_STR REVISION_SUFFIX "): ZoneBuilder");
}
else if (Dedicated::IsDedicated())
{
Utils::Hook::Set<char*>(0x4289E8, "IW4x (r" REVISION_STR REVISION_SUFFIX "): Dedicated");
}
else
{
Utils::Hook::Set<char*>(0x4289E8, "IW4x (r" REVISION_STR REVISION_SUFFIX "): Console");
}
// window title
Utils::Hook::Set<char*>(0x5076A0, "IW4x: Multiplayer");

View File

@ -12,6 +12,7 @@ namespace Game
CL_IsCgameInitialized_t CL_IsCgameInitialized = (CL_IsCgameInitialized_t)0x43EB20;
CL_ConnectFromParty_t CL_ConnectFromParty = (CL_ConnectFromParty_t)0x433D30;
CL_DownloadsComplete_t CL_DownloadsComplete = (CL_DownloadsComplete_t)0x42CE90;
CL_ResetViewport_t CL_ResetViewport = (CL_ResetViewport_t)0x4A8830;
Cmd_AddCommand_t Cmd_AddCommand = (Cmd_AddCommand_t)0x470090;
Cmd_AddServerCommand_t Cmd_AddServerCommand = (Cmd_AddServerCommand_t)0x4DCE00;
@ -24,6 +25,7 @@ namespace Game
Com_ParseExt_t Com_ParseExt = (Com_ParseExt_t)0x474D60;
Con_DrawMiniConsole_t Con_DrawMiniConsole = (Con_DrawMiniConsole_t)0x464F30;
Con_DrawSolidConsole_t Con_DrawSolidConsole = (Con_DrawSolidConsole_t)0x5A5040;
DB_EnumXAssets_t DB_EnumXAssets = (DB_EnumXAssets_t)0x4B76D0;
DB_FindXAssetHeader_t DB_FindXAssetHeader = (DB_FindXAssetHeader_t)0x407930;
@ -217,6 +219,8 @@ namespace Game
SOCKET* ip_socket = (SOCKET*)0x64A3008;
SafeArea* safeArea = (SafeArea*)0xA15F48;
void* ReallocateAssetPool(XAssetType type, unsigned int newSize)
{
int elSize = DB_GetXAssetSizeHandlers[type]();

View File

@ -21,6 +21,9 @@ namespace Game
typedef void(__cdecl * CL_DownloadsComplete_t)(int controller);
extern CL_DownloadsComplete_t CL_DownloadsComplete;
typedef void(__cdecl * CL_ResetViewport_t)();
extern CL_ResetViewport_t CL_ResetViewport;
typedef void(__cdecl * Cmd_AddCommand_t)(const char* name, void(*callback), cmd_function_t* data, char);
extern Cmd_AddCommand_t Cmd_AddCommand;
@ -48,6 +51,9 @@ namespace Game
typedef char* (__cdecl * Con_DrawMiniConsole_t)(int localClientNum, int xPos, int yPos, float alpha);
extern Con_DrawMiniConsole_t Con_DrawMiniConsole;
typedef void (__cdecl * Con_DrawSolidConsole_t)();
extern Con_DrawSolidConsole_t Con_DrawSolidConsole;
typedef void(__cdecl * DB_EnumXAssets_t)(XAssetType type, void(*)(XAssetHeader, void *), void* userdata, bool overrides);
extern DB_EnumXAssets_t DB_EnumXAssets;
@ -433,6 +439,8 @@ namespace Game
extern netadr_t* connectedHost;
extern SOCKET* ip_socket;
extern SafeArea* safeArea;
void* ReallocateAssetPool(XAssetType type, unsigned int newSize);
void Menu_FreeItemMemory(Game::itemDef_t* item);
const char* TableLookup(StringTable* stringtable, int row, int column);

View File

@ -1858,6 +1858,14 @@ namespace Game
{
DWORD unk;
} PartyData_t;
struct SafeArea
{
float left;
float top;
float right;
float bottom;
};
#ifdef __cplusplus
}