[Mod FF]: Added fonts from console versions.

This commit is contained in:
JerryALT 2024-03-29 20:21:54 +03:00
parent 7d92fb4b63
commit 1976c730d4
50 changed files with 90 additions and 32 deletions

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -135,4 +135,19 @@ namespace Components
got->second(&params);
}
}
const char* Command::Cmd_Argv/*eax*/(int argIndex/*eax*/)
{
const char* result;
const static uint32_t Cmd_Argv_func = 0x40F150;
__asm
{
pushad;
mov eax, argIndex;
call Cmd_Argv_func;
mov result, eax;
popad;
}
return result;
}
}

View File

@ -45,6 +45,8 @@ namespace Components
static void AddRaw(const char* name, const char* args, const char* description, void(*callback)(), bool key = false);
static void Execute(std::string command, bool sync = true);
static const char* Cmd_Argv/*eax*/(int argIndex/*eax*/);
static Game::cmd_function_s* Find(const std::string& command);
private:

View File

@ -6,59 +6,97 @@ namespace Components
void ServerCommand::Add(const char* name, const std::function<void()>& callback)
{
ServerCommands[name] = callback;
const auto command = Utils::String::ToLower(name);
ServerCommands[command] = callback;
}
void ServerCommand::DispatchServerCommand(const char* cmd_args)
void ServerCommand::DispatchServerCommand(const char* cmd, int cmdArgCount)
{
//Game::Com_Printf(0, "^3CmdArg: %s\n", cmd_args);
Game::Com_Printf(0, "Command Name %s\n", cmd);
Game::Com_Printf(0, "Command Argument Count %d\n", cmdArgCount);
if (const auto itr = ServerCommands.begin(); itr != ServerCommands.end())
{
if (!std::strcmp(cmd_args, itr->first.c_str()))
if (!std::strcmp(cmd, itr->first.c_str()))
{
itr->second();
//Game::Com_Printf(0, "^2game find custom command :D\n");
return;
}
}
}
void __declspec(naked) CG_DispatchServerCommand_stub()
bool ServerCommand::CustomServerCommandExists(const char* cmd)
{
const static uint32_t next_cmd_offset = 0x429963;
const static uint32_t sw_func_offset = 0x429942;
for (const auto& [key, value] : ServerCommands)
{
if (!std::strcmp(cmd, key.c_str()))
{
return true;
}
}
// push edi; text
// push esi; cmd_args
// push ecx; length (wtf?)
return false;
}
void __declspec(naked) ServerCommand::CG_DispatchServerCommandStub1()
{
const static uint32_t end_jump = 0x42A1C7;
const static uint32_t original_checks = 0x42992D;
__asm
{
push esi; //cmd_args
jz cmd_not_found;
pushad;
push esi;
call ServerCommand::DispatchServerCommand;
add esp, 4;
jnz SW_STOCK;
push ebp;
push eax;
call DispatchServerCommand;
add esp, 8;
popad;
pop esi;
SW_STOCK:
popad;
pop esi;
jmp original_checks;
cmd_not_found:
jmp end_jump;
}
}
void __declspec(naked) ServerCommand::CG_DispatchServerCommandStub2()
{
const static uint32_t retn_addr = 0x42A1AB;
const static uint32_t jmp_unknown_cmd = 0x42A1B7;
const static uint32_t return_op = 0x42A1C7;
__asm
{
//stock op's
xor edx, edx;
repe cmpsb;
jnz NEXT_SERVER_CMD;
cmp ebp, 1;
jmp sw_func_offset;
NEXT_SERVER_CMD:
jmp next_cmd_offset;
jnz UNKNOWN_COMMAND_HOOK;
jmp retn_addr;
UNKNOWN_COMMAND_HOOK:
// just making another check variant here with custom container.
pushad;
push eax;
call CustomServerCommandExists;
add esp, 4;
test al, al;
jz UNKNOWN_COMMAND_REAL;
popad;
jmp return_op;
UNKNOWN_COMMAND_REAL:
popad;
jmp jmp_unknown_cmd;
}
}
ServerCommand::ServerCommand()
{
Utils::Hook::Nop(0x42993B, 7);
// Sadly, but I doesn't find resolve about printing error in the game console,
// when cmd_args similar with strings and custom server cmds works fine.
Utils::Hook::Nop(0x42A1BF, 5);
Utils::Hook(0x42993B, CG_DispatchServerCommand_stub, HOOK_JUMP).install()->quick();
Utils::Hook(0x429927, CG_DispatchServerCommandStub1, HOOK_JUMP).install()->quick();
Utils::Hook::Nop(0x42A1A5, 6);
Utils::Hook(0x42A1A5, CG_DispatchServerCommandStub2, HOOK_JUMP).install()->quick();
}
ServerCommand::~ServerCommand()

View File

@ -10,7 +10,10 @@ namespace Components
static void Add(const char* name, const std::function<void()>& callback);
private:
static void DispatchServerCommand(const char* cmd_args);
static void DispatchServerCommand(const char* cmd, int cmdArgCount);
static std::unordered_map<std::string, std::function<void()>> ServerCommands;
static void CG_DispatchServerCommandStub1();
static void CG_DispatchServerCommandStub2();
static bool CustomServerCommandExists(const char* cmd);
};
}

View File

@ -334,8 +334,8 @@ namespace Components
viewportWidth,
viewportHeight,
viewportWidth / adjustedRealWidth,
Dvars::safeArea_horizontal->current.value,
Dvars::safeArea_vertical->current.value,
Dvars::console_menu_style->current.enabled ? 0.85f : Dvars::safeArea_horizontal->current.value,
Dvars::console_menu_style->current.enabled ? 0.85f : Dvars::safeArea_vertical->current.value,
scrPlace->virtualViewableMin,
scrPlace->virtualViewableMax,
viewportWidth,