Skip to content

Commit

Permalink
fix: bit more linux support
Browse files Browse the repository at this point in the history
  • Loading branch information
ThisAMJ committed Feb 7, 2025
1 parent 3e38ac2 commit 9b37ab0
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 11 deletions.
19 changes: 12 additions & 7 deletions src/Features/Hud/Watermark.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,14 +29,19 @@ class WatermarkHud : public Hud {
int screenWidth, screenHeight;
engine->GetScreenSize(nullptr, screenWidth, screenHeight);

auto font = "Trebuchet MS";
#ifndef _WIN32
if (!sar.game->Is(SourceGame_BeginnersGuide)) {
font = "DejaVu Sans";
static Surface::HFont headerFont = scheme->FindFont("Trebuchet MS", 72);
static Surface::HFont subTextFont = scheme->FindFont("Trebuchet MS", 24);
if (headerFont == scheme->GetDefaultFont() || subTextFont == scheme->GetDefaultFont()) {
static bool printedWarning = false;
if (!printedWarning) { // don't spam the console / expensive-ish FindFont calls
if (headerFont == scheme->GetDefaultFont()) headerFont = scheme->FindFont("DejaVu Sans", 72);
if (subTextFont == scheme->GetDefaultFont()) subTextFont = scheme->FindFont("DejaVu Sans", 24);
if (headerFont == scheme->GetDefaultFont() || subTextFont == scheme->GetDefaultFont()) {
console->DevWarning("Failed to load font for watermark\n");
printedWarning = true;
}
}
}
#endif
static Surface::HFont headerFont = scheme->FindFont(font, 72);
static Surface::HFont subTextFont = scheme->FindFont(font, 24);

int fontSize = surface->GetFontHeight(headerFont);

Expand Down
10 changes: 6 additions & 4 deletions src/Modules/Engine.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1239,13 +1239,15 @@ void Engine::Shutdown() {
Interface::Delete(this->g_physCollision);

// Reset to the offsets that were originally in the code
if (this->readCustomDataInjectAddr && this->readConsoleCommandInjectAddr) {
#ifdef _WIN32
*(uint32_t *)this->readCustomDataInjectAddr = 0x50E8458D;
*(uint32_t *)this->readConsoleCommandInjectAddr = 0x000491E3;
*(uint32_t *)this->readCustomDataInjectAddr = 0x50E8458D;
*(uint32_t *)this->readConsoleCommandInjectAddr = 0x000491E3;
#else
*(uint32_t *)this->readCustomDataInjectAddr = 0x08244489;
*(uint32_t *)this->readConsoleCommandInjectAddr = 0x0008155A;
*(uint32_t *)this->readCustomDataInjectAddr = 0x08244489;
*(uint32_t *)this->readConsoleCommandInjectAddr = 0x0008155A;
#endif
}

#ifdef _WIN32
MH_UNHOOK(Engine::ParseSmoothingInfo_Mid);
Expand Down

0 comments on commit 9b37ab0

Please sign in to comment.