diff --git a/README.md b/README.md index 2082e2a8..f68cfb81 100644 --- a/README.md +++ b/README.md @@ -173,8 +173,9 @@ you simply have to remove the semicolon. Below are the features you can take advantage of. - [Halo settings](#halo-settings) - [Scoreboard settings](#scoreboard-settings) +- [Name settings](#name-settings) - [Memory settings](#memory-settings) -- [Video mode](#video-mode) +- [Video mode settings](#video-mode-settings) - [Custom chat settings](#custom-chat-settings) - [Hotkeys](#hotkeys) @@ -189,10 +190,14 @@ These features exist to modify how Halo is initialized. - `multiple_instances` (allow Halo to spawn in multiple instances) - `hash` (set a custom hash or `%` for a random one) -#### Scoreboard +#### Scoreboard settings This exists to manipulate the scoreboard - `font` (change the font) +#### Name settings +This exists to manipulate the names shown when looking at players. +- `font` (change the font) + #### Memory settings This feature exists to allow you to take advantage larger amounts of RAM, reducing hiccups and stutters, especially on slower storage. However, you will @@ -200,7 +205,7 @@ need an LAA-patched executable to use this feature. - `enable_map_memory_buffer` (enables loading maps directly into RAM) - `benchmark` (shows a benchmark whenever a map is loaded) -#### Video mode +#### Video mode settings These settings allow you to change Halo's video settings without requiring vidmode. You can even use refresh rates in excess of 120 Hz. - `enabled` (enables the feature) diff --git a/chimera.ini b/chimera.ini index 21423914..0b50c6ce 100755 --- a/chimera.ini +++ b/chimera.ini @@ -131,6 +131,18 @@ windowed=0 font=small +[name] + +;=============================================================================== +; Name settings +; +; This is used to customize names displayed when looking at players. +;=============================================================================== + +; Set the font (can be system, console, small, or large) +font=small + + [memory] ;=============================================================================== diff --git a/src/chimera/chimera.cmake b/src/chimera/chimera.cmake index 299b99aa..aeed2598 100644 --- a/src/chimera/chimera.cmake +++ b/src/chimera/chimera.cmake @@ -78,6 +78,8 @@ add_library(chimera STATIC src/chimera/halo_data/effect.cpp src/chimera/halo_data/flag.cpp src/chimera/halo_data/game_engine.cpp + src/chimera/halo_data/hud_fonts.cpp + src/chimera/halo_data/hud_fonts.S src/chimera/halo_data/keyboard.cpp src/chimera/halo_data/light.cpp src/chimera/halo_data/map.cpp @@ -92,7 +94,6 @@ add_library(chimera STATIC src/chimera/halo_data/resolution.cpp src/chimera/halo_data/script.cpp src/chimera/halo_data/script.S - src/chimera/halo_data/scoreboard_font.S src/chimera/halo_data/server.cpp src/chimera/halo_data/tag.cpp src/chimera/localization/localization.cpp diff --git a/src/chimera/chimera.cpp b/src/chimera/chimera.cpp index 6e94bf87..db2e9850 100644 --- a/src/chimera/chimera.cpp +++ b/src/chimera/chimera.cpp @@ -10,7 +10,7 @@ #include "console/console.hpp" #include "event/frame.hpp" #include "halo_data/path.hpp" -#include "halo_data/scoreboard_font.hpp" +#include "halo_data/hud_fonts.hpp" #include "output/draw_text.hpp" #include "output/output.hpp" #include "signature/hook.hpp" @@ -167,6 +167,7 @@ namespace Chimera { // Someone might want this set of course set_up_scoreboard_font(); + set_up_name_font(); // lol set_up_nav_numbers_fix(); diff --git a/src/chimera/command/client/visual/simple_score_screen.cpp b/src/chimera/command/client/visual/simple_score_screen.cpp index 4d69732b..7b029f81 100644 --- a/src/chimera/command/client/visual/simple_score_screen.cpp +++ b/src/chimera/command/client/visual/simple_score_screen.cpp @@ -3,46 +3,11 @@ #include "../../../signature/signature.hpp" #include "../../../chimera.hpp" #include "../../../output/output.hpp" -#include "../../../output/draw_text.hpp" #include "../../../config/ini.hpp" #include "../../../halo_data/game_engine.hpp" +#include "../../../halo_data/hud_fonts.hpp" namespace Chimera { - GenericFont g; - - extern "C" void get_scoreboard_font_esi_asm() noexcept; - extern "C" void get_scoreboard_font_edx_asm() noexcept; - extern "C" std::uint32_t get_scoreboard_font() { - return get_generic_font(g).whole_id; - } - - void set_up_scoreboard_font() noexcept { - auto &chimera = get_chimera(); - auto *ini = chimera.get_ini(); - - - // Get the generic font set (if it is set) - auto *font = ini->get_value("scoreboard.font"); - if(!font) { - return; - } - - g = generic_font_from_string(font); - static Hook hook; - - // Non-trial - if(chimera.feature_present("client_score_screen")) { - auto &ss_elements_sig_b = chimera.get_signature("ss_elements_sig_b"); - write_jmp_call(ss_elements_sig_b.data(), hook, reinterpret_cast(get_scoreboard_font_esi_asm), nullptr, false); - } - - // Trial - else if(chimera.feature_present("client_score_screen_font_demo")) { - auto &ss_elements_font_demo_sig = chimera.get_signature("ss_elements_font_demo_sig"); - write_jmp_call(ss_elements_font_demo_sig.data(), hook, nullptr, reinterpret_cast(get_scoreboard_font_edx_asm), false); - } - } - bool simple_score_screen_command(int argc, const char **argv) { static bool simple_score_screen_active = false; if(argc == 1) { diff --git a/src/chimera/halo_data/scoreboard_font.S b/src/chimera/halo_data/hud_fonts.S similarity index 71% rename from src/chimera/halo_data/scoreboard_font.S rename to src/chimera/halo_data/hud_fonts.S index fdfb4822..6ebd5f64 100644 --- a/src/chimera/halo_data/scoreboard_font.S +++ b/src/chimera/halo_data/hud_fonts.S @@ -23,3 +23,14 @@ _get_scoreboard_font_edx_asm: popfd popad ret + +;# Get the name font into the eax register +.globl _get_name_font_eax_asm +_get_name_font_eax_asm: + pushad + pushfd + call _get_name_font + mov [esp+0x20], eax + popfd + popad + ret diff --git a/src/chimera/halo_data/hud_fonts.cpp b/src/chimera/halo_data/hud_fonts.cpp new file mode 100644 index 00000000..50ce9d28 --- /dev/null +++ b/src/chimera/halo_data/hud_fonts.cpp @@ -0,0 +1,71 @@ +#include +#include "../signature/hook.hpp" +#include "../signature/signature.hpp" +#include "../chimera.hpp" +#include "../config/ini.hpp" +#include "../output/draw_text.hpp" + +#include "hud_fonts.hpp" + +namespace Chimera { + GenericFont scoreboard_font; + + extern "C" void get_scoreboard_font_esi_asm() noexcept; + extern "C" void get_scoreboard_font_edx_asm() noexcept; + extern "C" std::uint32_t get_scoreboard_font() { + return get_generic_font(scoreboard_font).whole_id; + } + + GenericFont name_font; + + //extern "C" void get_scoreboard_font_esi_asm() noexcept; + extern "C" void get_name_font_eax_asm() noexcept; + extern "C" std::uint32_t get_name_font() { + return get_generic_font(scoreboard_font).whole_id; + } + + void set_up_scoreboard_font() noexcept { + auto &chimera = get_chimera(); + auto *ini = chimera.get_ini(); + + // Get the generic font set (if it is set) + auto *font = ini->get_value("scoreboard.font"); + if(!font) { + return; + } + + scoreboard_font = generic_font_from_string(font); + static Hook hook; + + // Non-trial + if(chimera.feature_present("client_score_screen")) { + auto &ss_elements_sig_b = chimera.get_signature("ss_elements_sig_b"); + write_jmp_call(ss_elements_sig_b.data(), hook, reinterpret_cast(get_scoreboard_font_esi_asm), nullptr, false); + } + + // Trial + else if(chimera.feature_present("client_score_screen_font_demo")) { + auto &ss_elements_font_demo_sig = chimera.get_signature("ss_elements_font_demo_sig"); + write_jmp_call(ss_elements_font_demo_sig.data(), hook, nullptr, reinterpret_cast(get_scoreboard_font_edx_asm), false); + } + } + + void set_up_name_font() noexcept { + auto &chimera = get_chimera(); + auto *ini = chimera.get_ini(); + + // Get the generic font set (if it is set) + auto *font = ini->get_value("name.font"); + if(!font) { + return; + } + + name_font = generic_font_from_string(font); + static Hook hook; + + if(chimera.feature_present("client_name_font")) { + auto &name_font_demo_sig = chimera.get_signature("name_font_sig"); + write_jmp_call(name_font_demo_sig.data(), hook, nullptr, reinterpret_cast(get_name_font_eax_asm), false); + } + } +} diff --git a/src/chimera/halo_data/hud_fonts.hpp b/src/chimera/halo_data/hud_fonts.hpp new file mode 100644 index 00000000..f0669c48 --- /dev/null +++ b/src/chimera/halo_data/hud_fonts.hpp @@ -0,0 +1,16 @@ +#ifndef CHIMERA_HALO_DATA_HUD_FONTS_HPP +#define CHIMERA_HALO_DATA_HUD_FONTS_HPP + +namespace Chimera { + /** + * Set the scoreboard font + */ + void set_up_scoreboard_font() noexcept; + + /** + * Set the name font + */ + void set_up_name_font() noexcept; +} + +#endif diff --git a/src/chimera/halo_data/scoreboard_font.hpp b/src/chimera/halo_data/scoreboard_font.hpp deleted file mode 100644 index 3593e3af..00000000 --- a/src/chimera/halo_data/scoreboard_font.hpp +++ /dev/null @@ -1,11 +0,0 @@ -#ifndef CHIMERA_HALO_DATA_SCOREBOARD_FONT_HPP -#define CHIMERA_HALO_DATA_SCOREBOARD_FONT_HPP - -namespace Chimera { - /** - * Set the scoreboard font - */ - void set_up_scoreboard_font() noexcept; -} - -#endif diff --git a/src/chimera/signature/hook.cpp b/src/chimera/signature/hook.cpp index b1839bd9..83f315a4 100644 --- a/src/chimera/signature/hook.cpp +++ b/src/chimera/signature/hook.cpp @@ -232,7 +232,7 @@ namespace Chimera { case 0x8B: { auto a = *reinterpret_cast(at + 1); auto b = *reinterpret_cast(at + 2); - if((a == 0x6C || a == 0x4C || a == 0x44) && b == 0x24) { + if((a == 0x6C || a == 0x4C || a == 0x44 || a == 0x54) && b == 0x24) { offsets.push_back(at - at_start); bytes.insert(bytes.end(), at, at + 4); at += 4; @@ -244,7 +244,7 @@ namespace Chimera { at += 2; break; } - else if(a == 0x50) { + else if(a == 0x50 || a == 0x40) { offsets.push_back(at - at_start); bytes.insert(bytes.end(), at, at + 3); at += 3; diff --git a/src/chimera/signature/signature.cpp b/src/chimera/signature/signature.cpp index b21603a1..660ef4ff 100644 --- a/src/chimera/signature/signature.cpp +++ b/src/chimera/signature/signature.cpp @@ -316,6 +316,8 @@ namespace Chimera { FIND("ss_score_background_sig", "client_score_screen", { 0xC7, 0x44, 0x24, 0x24, 0x00, 0x00, 0x00, 0x3E, 0xC7, 0x44, 0x24, 0x28, 0x00, 0x00, 0x00, 0x3E, 0xC7, 0x44, 0x24, 0x2C, 0x00, 0x00, 0x00, 0x3E, 0x66, 0xC7, 0x44, 0x24, 0x3E, 0x0A, 0x00, 0x66, 0xC7, 0x44, 0x24, 0x42, 0x76, 0x02, 0x66, 0xC7, 0x44, 0x24, 0x40, 0x86, 0x01, 0x66, 0xC7, 0x44, 0x24, 0x3C, 0x3C, 0x00, 0xE8, -1, -1, -1, -1, 0x8D }); FIND("ss_elements_font_demo_sig", "client_score_screen_font_demo", {0x8B, 0x50, 0x1C, 0x8B, 0x4C, 0x24, 0x30, 0x8B, 0x44, 0x24, 0x34}); + FIND("name_font_sig", "client_name_font", { 0x8B, 0x40, 0x1C, 0x8B, 0x54, 0x24, 0x20, 0xB9, 0x08, 0x00, 0x00, 0x00 }); + FIND("join_server_ip_text_sig", "client_server_ip", { 0xB8, -1, -1, -1, -1, 0xE8, -1, -1, -1, -1, 0x8B, 0x84, 0x24, 0x28, 0x01, 0x00, 0x00, 0x50 }); FIND("f1_ip_text_render_call_sig", "client_server_ip", { 0xE8, -1, -1, -1, -1, 0x83, 0xC4, 0x0C, 0x5F, 0x5E, 0x5D, 0x5B, 0x81, 0xC4, 0xE0, 0x06, 0x00, 0x00, 0xC3 }); FIND("create_server_ip_text_sig", "client_server_ip", { 0x8B, 0x0D, -1, -1, -1, -1, 0x8B, 0xC1, 0xC1, 0xE0, 0x10, 0x81, 0xE1, 0x00, 0xFF, 0x00, 0x00, 0x0B, 0xC1, 0x66, 0x8B, 0x0D, -1, -1, -1, -1, 0x33, 0xD2, 0x8A, 0xF1, 0xC1, 0xE0, 0x08, 0x0F, 0xB6, 0xCD, 0x0B, 0xC2, 0x0B, 0xC1, 0x50, 0xFF, 0x15, -1, -1, -1, -1, 0x8B, 0xC8, 0x8D, 0x70, 0x01, 0x8D, 0x49, 0x00, 0x8A, 0x10 });