[Auth]: Remove whitespace (#996)

This commit is contained in:
Edo 2023-05-03 00:10:14 +01:00 committed by GitHub
parent 4c7353646c
commit dc3cc28693
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 43 additions and 22 deletions

View File

@ -71,7 +71,7 @@ namespace Components
TokenContainer.cancel = false;
}
}
void Auth::SendConnectDataStub(Game::netsrc_t sock, Game::netadr_t adr, const char* format, int len)
{
// Ensure our certificate is loaded
@ -88,7 +88,7 @@ namespace Components
Logger::Error(Game::ERR_SERVERDISCONNECT, "Your online profile is invalid. A new key has been generated.");
return;
}
std::string connectString(format, len);
Game::SV_Cmd_TokenizeString(connectString.data());

View File

@ -1,4 +1,4 @@
#include <STDInclude.hpp>
#include <STDInclude.hpp>
#include "Console.hpp"
#include "TextRenderer.hpp"
@ -56,6 +56,8 @@ namespace Components
Game::SafeArea Console::OriginalSafeArea;
bool Console::isCommand;
const char** Console::GetAutoCompleteFileList(const char* path, const char* extension, Game::FsListBehavior_e behavior, int* numfiles, int allocTrackType)
{
if (path == reinterpret_cast<char*>(0xBAADF00D) || path == reinterpret_cast<char*>(0xCDCDCDCD) || ::Utils::Memory::IsBadReadPtr(path)) return nullptr;
@ -807,6 +809,20 @@ namespace Components
return reinterpret_cast<Game::Dvar_RegisterVec4_t>(0x471500)(dvarName, r, g, b, a, min, max, flags, description);
}
bool Console::Con_IsDvarCommand_Stub(const char* cmd)
{
isCommand = Game::Con_IsDvarCommand(cmd);
return isCommand;
}
void Console::Cmd_ForEach_Stub(void(*callback)(const char* str))
{
if (!isCommand)
{
Game::Cmd_ForEach(callback);
}
}
void Console::Con_ToggleConsole()
{
Game::Field_Clear(Game::g_consoleField);
@ -885,6 +901,10 @@ namespace Components
// Don't resize the console
Utils::Hook(0x64DC6B, 0x64DCC2, HOOK_JUMP).install()->quick();
// Con_DrawInput
Utils::Hook(0x5A45BD, Con_IsDvarCommand_Stub, HOOK_CALL).install()->quick();
Utils::Hook(0x5A466C, Cmd_ForEach_Stub, HOOK_CALL).install()->quick();
#ifdef _DEBUG
AddConsoleCommand();
#endif

View File

@ -49,6 +49,8 @@ namespace Components
static Game::SafeArea OriginalSafeArea;
static bool isCommand;
static void ShowPrompt();
static void RefreshStatus();
static void RefreshOutput();
@ -75,6 +77,9 @@ namespace Components
static void AddConsoleCommand();
static Game::dvar_t* RegisterConColor(const char* dvarName, float r, float g, float b, float a, float min, float max, unsigned __int16 flags, const char* description);
static bool Con_IsDvarCommand_Stub(const char* cmd);
static void Cmd_ForEach_Stub(void(*callback)(const char* str));
static LRESULT CALLBACK ConWndProc(HWND hWnd, UINT Msg, WPARAM wParam, unsigned int lParam);
static ATOM CALLBACK RegisterClassHook(WNDCLASSA* lpWndClass);

View File

@ -813,18 +813,6 @@ namespace Components
Utils::Hook::Set<DWORD>(0x64A029, 0x1C200000); // 450 MiB
Utils::Hook::Set<DWORD>(0x64A057, 0x1C200000);
#if DEBUG
// Hunk debugging
Utils::Hook::Set<BYTE>(0x4FF57B, 0xCC);
Utils::Hook::Nop(0x4FF57C, 4);
#else
// Temporarily disable distortion warnings
Utils::Hook::Nop(0x50DBFF, 5);
Utils::Hook::Nop(0x50DC4F, 5);
Utils::Hook::Nop(0x50DCA3, 5);
Utils::Hook::Nop(0x50DCFE, 5);
#endif
// Intercept BSP name resolving
Utils::Hook(0x4C5979, Maps::GetBSPName, HOOK_CALL).install()->quick();

View File

@ -3407,10 +3407,10 @@ namespace Components
constexpr auto fileCountMultiplier = 8;
constexpr auto maxFileCount = 8191 * fileCountMultiplier;
int RelocateFileCount(std::uint32_t dwSize, int unk1, int unk2, int unk3)
Game::HunkUser* Hunk_UserCreate_Stub(int maxSize, const char* name, bool fixed, int type)
{
dwSize *= fileCountMultiplier;
return Utils::Hook::Call<int(std::uint32_t, int, int, int)>(0x430E90)(dwSize, unk1, unk2, unk3);
maxSize *= fileCountMultiplier;
return Utils::Hook::Call<Game::HunkUser*(int, const char*, bool, int)>(0x430E90)(maxSize, name, fixed, type);
}
void Zones::LoadMaterialAsset(Game::Material** asset)
@ -3554,8 +3554,8 @@ namespace Components
Utils::Hook::Set<std::uint32_t>(0x64AF78, maxFileCount);
Utils::Hook::Set<std::uint32_t>(0x64B04F, maxFileCount);
Utils::Hook::Set<std::uint32_t>(0x45A8CE, maxFileCount);
Utils::Hook(0x45A806, RelocateFileCount, HOOK_CALL).install()->quick();
Utils::Hook(0x45A6A0, RelocateFileCount, HOOK_CALL).install()->quick();
Utils::Hook(0x45A806, Hunk_UserCreate_Stub, HOOK_CALL).install()->quick();
Utils::Hook(0x45A6A0, Hunk_UserCreate_Stub, HOOK_CALL).install()->quick();
#ifndef DEBUG
// Ignore missing soundaliases for now
@ -3662,4 +3662,4 @@ namespace Components
#endif
}
}
#pragma optimize( "", on )
#pragma optimize( "", on )

View File

@ -25,10 +25,12 @@ namespace Game
Cmd_AddCommand_t Cmd_AddCommand = Cmd_AddCommand_t(0x470090);
Cmd_AddServerCommand_t Cmd_AddServerCommand = Cmd_AddServerCommand_t(0x4DCE00);
Cmd_ExecuteSingleCommand_t Cmd_ExecuteSingleCommand = Cmd_ExecuteSingleCommand_t(0x609540);
Cmd_ForEach_t Cmd_ForEach = Cmd_ForEach_t(0x45D680);
Con_DrawMiniConsole_t Con_DrawMiniConsole = Con_DrawMiniConsole_t(0x464F30);
Con_DrawSolidConsole_t Con_DrawSolidConsole = Con_DrawSolidConsole_t(0x5A5040);
Con_CancelAutoComplete_t Con_CancelAutoComplete = Con_CancelAutoComplete_t(0x435580);
Con_IsDvarCommand_t Con_IsDvarCommand = Con_IsDvarCommand_t(0x5A3FF0);
DB_AllocStreamPos_t DB_AllocStreamPos = DB_AllocStreamPos_t(0x418380);
DB_PushStreamPos_t DB_PushStreamPos = DB_PushStreamPos_t(0x458A20);

View File

@ -60,7 +60,10 @@ namespace Game
typedef void(*Cmd_ExecuteSingleCommand_t)(int localClientNum, int controllerIndex, const char* cmd);
extern Cmd_ExecuteSingleCommand_t Cmd_ExecuteSingleCommand;
typedef char* (*Con_DrawMiniConsole_t)(int localClientNum, int xPos, int yPos, float alpha);
typedef void(*Cmd_ForEach_t)(void(*callback)(const char* str));
extern Cmd_ForEach_t Cmd_ForEach;
typedef char*(*Con_DrawMiniConsole_t)(int localClientNum, int xPos, int yPos, float alpha);
extern Con_DrawMiniConsole_t Con_DrawMiniConsole;
typedef void (*Con_DrawSolidConsole_t)();
@ -69,6 +72,9 @@ namespace Game
typedef bool(*Con_CancelAutoComplete_t)();
extern Con_CancelAutoComplete_t Con_CancelAutoComplete;
typedef bool(*Con_IsDvarCommand_t)(const char* cmd);
extern Con_IsDvarCommand_t Con_IsDvarCommand;
typedef bool(*Encode_Init_t)(const char* );
extern Encode_Init_t Encode_Init;