Skip to content

Commit

Permalink
Add name fonts
Browse files Browse the repository at this point in the history
  • Loading branch information
SnowyMouse committed May 13, 2020
1 parent d89cc89 commit 6138913
Show file tree
Hide file tree
Showing 11 changed files with 127 additions and 54 deletions.
11 changes: 8 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand All @@ -189,18 +190,22 @@ 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
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)
Expand Down
12 changes: 12 additions & 0 deletions chimera.ini
Original file line number Diff line number Diff line change
Expand Up @@ -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]

;===============================================================================
Expand Down
3 changes: 2 additions & 1 deletion src/chimera/chimera.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down
3 changes: 2 additions & 1 deletion src/chimera/chimera.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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();
Expand Down
37 changes: 1 addition & 36 deletions src/chimera/command/client/visual/simple_score_screen.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<const void *>(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<const void *>(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) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
71 changes: 71 additions & 0 deletions src/chimera/halo_data/hud_fonts.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
#include <optional>
#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<const void *>(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<const void *>(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<const void *>(get_name_font_eax_asm), false);
}
}
}
16 changes: 16 additions & 0 deletions src/chimera/halo_data/hud_fonts.hpp
Original file line number Diff line number Diff line change
@@ -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
11 changes: 0 additions & 11 deletions src/chimera/halo_data/scoreboard_font.hpp

This file was deleted.

4 changes: 2 additions & 2 deletions src/chimera/signature/hook.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,7 @@ namespace Chimera {
case 0x8B: {
auto a = *reinterpret_cast<const std::uint8_t *>(at + 1);
auto b = *reinterpret_cast<const std::uint8_t *>(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;
Expand All @@ -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;
Expand Down
2 changes: 2 additions & 0 deletions src/chimera/signature/signature.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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 });
Expand Down

0 comments on commit 6138913

Please sign in to comment.