Skip to content

Commit a2ec9fd

Browse files
committed
Release v6.0: stable scaled UI since v5.7 — auto scale, cinematics, scoreboard, mission text
Consolidates all work since v5.7-build160: resolution-auto font/HUD scale (-1), cinematic text and credit images, hybrid scoreboard scaling, mission status and pause text, DM ranking fixes, Wine-safe caller detection, and F12 menu fixes.
1 parent 2430fd1 commit a2ec9fd

35 files changed

Lines changed: 957 additions & 2830 deletions

CHANGELOG.md

Lines changed: 46 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -2,24 +2,56 @@
22

33
## v6.0
44

5-
- **Scaled UI / scoreboard:** Scoreboard text now scales with `_sofbuddy_font_scale` and images with `_sofbuddy_hud_scale` (hybrid path in `hkglVertex2f` instead of applying HUD scale to all vertices).
6-
- **Scaled UI / cinematic text:** Hook `SCR_DrawCinematicString` and scale cinematic string vertices with `fontScale`.
7-
- **Scaled UI / mission status:** Add `FontCaller::MissionStatus` and shared `scaleCenterAnchoredText` helper for mission-status / center-anchored on-screen text.
8-
- **Linux scripts:** Fix `enable_*.sh` patch scripts to resolve paths relative to script location (works when run from any cwd).
5+
Stable release consolidating all changes since **v5.7-build160** (intermediate v5.8/v5.9 builds were withdrawn).
96

10-
## v5.9
7+
### Scaled UI — auto resolution scaling
118

12-
- **Scaled HUD:** Restored scoreboard scaling in `hkglVertex2f` — v5.8 had limited `SCR_ExecuteLayoutString` scaling to image quads only, which left scoreboard text tiny/unscaled; scoreboard mode again scales all layout vertices.
9+
- **`_sofbuddy_font_scale -1` (Auto):** Negative value enables auto mode — scale tracks `vid_h / 480` and updates on resolution changes (`vid_restart`, `vid_checkchanges`). Default is **`-1`**.
10+
- **`_sofbuddy_hud_scale -1` (Auto):** Same auto ratio for HUD elements. Default is **`-1`**.
11+
- **F12 → UI Scale:** Font Scale and HUD Scale lists include **Auto** as the first option (writes `-1`). Restore Defaults resets both to Auto.
12+
- **`_sofbuddy_scale_cinematic_pics`:** New cvar (default **`1` = on**) scales cinematic credit/fade images (`SP_FLAG_CREDIT` / `SCR_DrawCinemaScope`) from 640×480 to your resolution. Toggle in F12 → UI Scale → **Scale Cinematic Images**.
1313

14-
## v5.8
14+
### Scaled UI — scoreboard (CTF / DM)
1515

16-
- **Scaled UI / HUD vertex scaling:**
17-
- Fixed sticky quad-vertex counters in `hkglVertex2f` by moving state to file scope and adding `resetGlVertexQuadState()` at draw-hook boundaries (`Draw_Pic`, `Draw_StretchPic`, `Draw_PicOptions`, console, scoreboard, font).
18-
- Scoreboard layout (`SCR_ExecuteLayoutString`) now scales only image quads (`Pic` / `StretchPic` / `PicOptions`); layout text via `Draw_String`/`Draw_Char` passes through unscaled (fixes garbled scoreboard text at non-1:1 HUD scale).
19-
- Hardened exit paths: symmetric quad-state reset on `Draw_PicOptions`, `R_DrawFont`, and console `Draw_StretchPic` early returns.
20-
- Removed duplicate dead scaling helpers from `sui_hooks.cpp`.
21-
- **Core:** Added `video_state_fallback.cpp` so `current_vid_w` / `viddef_*` symbols resolve when all scaled UI features are disabled (needed by internal menus).
22-
- **README:** Restored badges and hero screenshots; collapsible `<details>` sections; static Discord join badge; removed map-entity feature from the advertised list; credit for Acadie.
16+
- **Hybrid scoreboard scaling:** Scoreboard layout text scales with `_sofbuddy_font_scale`; scoreboard images/icons scale with `_sofbuddy_hud_scale` (via `hkglVertex2f` scoreboard path using screen-center pivot).
17+
- **Quad-state hygiene:** `resetGlVertexQuadState()` at draw-hook boundaries (`Draw_Pic`, `Draw_StretchPic`, `Draw_PicOptions`, `R_DrawFont`, console, scoreboard layout) fixes sticky vertex counters that caused mis-scaled or garbled quads.
18+
- **CTF player list:** Fixed regression where DM-ranking font repositioning was applied to scoreboard player names — removed erroneous `HudDmRanking → DMRankingCalcXY` mapping from render-type caller detection.
19+
20+
### Scaled UI — cinematic text & images
21+
22+
- **Typematic / cinematic subtitles:** Hook `SCR_DrawCinematicString` + `Draw_CharExtra` — green bottom-left typewriter text scales with `_sofbuddy_font_scale` (including Auto). Uses `g_cinematicDrawDepth` scope guard so HUD `hud_scale` text paths are not affected.
23+
- **Bottom-anchored text scaling:** Typematic and yellow subtitle/center-print text preserve 480p bottom-margin percentage when scaled (`computeTextBottomAnchor` / `applyBottomAnchoredScale`).
24+
- **Cinematic credit images:** Hook `SCR_DrawCinemaScope` with scope-based `PicCaller::SCR_DrawCinemaScope`; `glVertex2f` scales the fade/credit quad when `_sofbuddy_scale_cinematic_pics` is on. Renamed mislabeled `NetworkDisconnectIcon` caller entry.
25+
26+
### Scaled UI — mission status, pause, center print
27+
28+
- **Mission status text** (`cMissionStatus::Draw` @ `0x9250`): Scope hook sets `FontCaller::MissionStatus`; scales with **`fontScale`** (not `hudScale`) via `scaleCenterAnchoredText` — fixes red upper-center messages like “Mission Objectives Updated” / “Mission Failed” at wrong size and off-center. Added `0x9250` to SoF.exe funcmap.
29+
- **“Paused” text** (`SCR_DrawPause` @ `0x13710`): Scope hook + `fontScale` center compensation in `hkR_DrawFont` and per-glyph vertex scaling.
30+
- **Center print** (`SCR_DrawCenterPrint` @ `0x163C0`): Scope hook replaces fragile text-matching fallback; merged v5.7 word-wrap with bottom-margin scaling for yellow subtitles and center-print lines.
31+
32+
### Scaled UI — DM ranking HUD
33+
34+
- Restored v5.7 `hudDmRanking_wasImage` + `scorePhase` alternation for frag count vs ping/limit lines under team chevrons.
35+
- `resetDmRankingFontPhase()` at each `cDMRanking_Draw` frame start — prevents line overlap from stale phase state.
36+
- `FontCaller::DMRankingCalcXY` set from `HudDmRanking` render scope (no fragile per-call-site RVA checks through ref.dll).
37+
38+
### Scaled UI — console & menu caller detection
39+
40+
- **Console repaint:** `Draw_StretchPic` treats `g_activeRenderType == Console` as console background — dirty-rect marking no longer depends solely on stack caller detection (fixes backspace / stale pixel artifacts).
41+
- **`visitExternalCallers`:** Safe stack walk picks the first *known* `FontCaller` (e.g. `RectDrawTextItem` for F12 menu rows), skipping unknown frames like `R_DrawFont` itself.
42+
- **Wine crash fix:** Hardened EBP chain walk in `hook_callsite.cpp` (`plausibleFramePtr`, bounded frame advance) — fixes page fault when classifying callers on Wine.
43+
- **F12 menu bug fix:** Changing Font Scale no longer mis-scales the HUD Scale value below it (removed center-print substring fallback; menu text resolves to `RectDrawTextItem` etc. using `screen_y_scale`).
44+
45+
### Core & Linux scripts
46+
47+
- **`video_state_fallback.cpp`:** Resolves `current_vid_w` / `viddef_*` when all scaled UI features are disabled (needed by internal menus).
48+
- **Linux `enable_*.sh`:** Patch scripts resolve paths relative to script location (works from any cwd).
49+
50+
### README & docs
51+
52+
- Restored badges and hero screenshots; collapsible `<details>` sections; static Discord join badge.
53+
- Documented **Auto (`-1`)** for `_sofbuddy_font_scale` and `_sofbuddy_hud_scale`, plus `_sofbuddy_scale_cinematic_pics`.
54+
- Credit for Acadie; removed map-entity feature from advertised list.
2355

2456
## v5.7
2557

README.md

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,9 @@
2626
<details open>
2727
<summary><b>Click to expand</b></summary>
2828

29-
- 🔠 **Font Scaling** — Crisp, readable fonts at any resolution: `1x`, `2x`, `3x`, `4x`, etc.
30-
- 🖥️ **HUD Scaling** — Scale the HUD independently from the font for perfect UI balance.
29+
- 🔠 **Font Scaling** — Crisp, readable fonts at any resolution: `1x`, `2x`, `3x`, `4x`, etc. Set `_sofbuddy_font_scale -1` (or pick **Auto** in F12 → UI Scale) to scale automatically with resolution (`vid_h / 480`).
30+
- 🖥️ **HUD Scaling** — Scale the HUD independently from the font for perfect UI balance. Set `_sofbuddy_hud_scale -1` (or **Auto** in the menu) for the same resolution-based scaling.
31+
- 🎬 **Cinematic Image Scaling** — Credit/fade images (`SP_FLAG_CREDIT`) scale up from 640×480 to your resolution. Toggle with `_sofbuddy_scale_cinematic_pics` (`1` = on, `0` = off) or **Scale Cinematic Images** in F12 → UI Scale.
3132
- 🎯 **Crosshair Scaling** — Scale crosshair textures independently for improved visibility.
3233
- 🎯 **Restored `cl_maxfps` in Singleplayer** — Enjoy smooth, uncapped framerates without legacy workarounds.
3334
-**Stable Framerate & CPU Saver** — Uses `QueryPerformanceCounter` for precise timing and energy savings. New cvar: `_sofbuddy_sleep`.
@@ -117,7 +118,7 @@
117118

118119
### In-Game Commands
119120

120-
- `**F12`** (or `**bind <key> sofbuddy_menu sof_buddy`**) — **Open the SoF Buddy menu. Use this. It’s the main entry point for all settings, updater, and profiles.**
121+
- `**F12`** (or `**bind <key> sofbuddy_menu sof_buddy`**) — **Open the SoF Buddy menu. Use this. It’s the main entry point for all settings, updater, and profiles.** Under **UI Scale**: Font/HUD Scale **Auto** writes `-1` to `_sofbuddy_font_scale` / `_sofbuddy_hud_scale`; **Scale Cinematic Images** toggles `_sofbuddy_scale_cinematic_pics`.
121122
- `sofbuddy_list_features` — Print compiled features (and whether they are on/off).
122123
- `sofbuddy_menu <name>` — Open an embedded internal menu page (examples: `loading`, `sof_buddy`).
123124
- `sofbuddy_menu <menu>/<page>` — Open a specific embedded page (e.g. `sofbuddy_menu sof_buddy/cpu`).
@@ -190,8 +191,9 @@
190191
| -------------------------------- | --------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
191192
| `_sofbuddy_classic_timer` | 0 | Use classic timer (set at launch, for vsync/old systems) |
192193
| `_sofbuddy_high_priority` | 1 | Set process priority to HIGH (set to 0 for NORMAL) |
193-
| `_sofbuddy_font_scale` | 1 | Font scaling multiplier (1x, 2x, 3x, ...) |
194-
| `_sofbuddy_hud_scale` | 1 | HUD scaling multiplier |
194+
| `_sofbuddy_font_scale` | -1 | Font scaling multiplier (`1`, `2`, `2.25`, …). **`-1` = Auto** — tracks resolution (`vid_h / 480`) and updates on `vid_restart` / resolution changes. Writable in `config.cfg` or via F12 → UI Scale → **Auto**. |
195+
| `_sofbuddy_hud_scale` | -1 | HUD scaling multiplier. **`-1` = Auto** — same resolution ratio as font auto mode. Set in config (`set _sofbuddy_hud_scale -1`) or pick **Auto** in F12 → UI Scale. |
196+
| `_sofbuddy_scale_cinematic_pics` | 1 | Scale cinematic credit/fade images (`SP_FLAG_CREDIT` / `SCR_DrawCinemaScope`) from 640×480 to your resolution. `1` = on, `0` = off. F12 → UI Scale → **Scale Cinematic Images**. |
195197
| `_sofbuddy_crossh_scale` | 1 | Crosshair scaling multiplier |
196198
| `_sofbuddy_console_size` | 0.35 | Console height as % of screen (0-1, 1=fullscreen) |
197199
| `_sofbuddy_sleep` | 1 | Enable CPU-saving sleep |

build/generated_detours.cpp

Lines changed: 105 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -145,10 +145,22 @@ namespace detour_SCR_CenterPrint {
145145
tSCR_CenterPrint oSCR_CenterPrint = nullptr;
146146
}
147147

148+
namespace detour_SCR_DrawPause {
149+
tSCR_DrawPause oSCR_DrawPause = nullptr;
150+
}
151+
152+
namespace detour_SCR_DrawCenterPrint {
153+
tSCR_DrawCenterPrint oSCR_DrawCenterPrint = nullptr;
154+
}
155+
148156
namespace detour_SCR_DrawCinematicString {
149157
tSCR_DrawCinematicString oSCR_DrawCinematicString = nullptr;
150158
}
151159

160+
namespace detour_SCR_DrawCinemaScope {
161+
tSCR_DrawCinemaScope oSCR_DrawCinemaScope = nullptr;
162+
}
163+
152164
namespace detour_cInventory2_And_cGunAmmo2_Draw {
153165
tcInventory2_And_cGunAmmo2_Draw ocInventory2_And_cGunAmmo2_Draw = nullptr;
154166
}
@@ -157,6 +169,10 @@ namespace detour_cHealthArmor2_Draw {
157169
tcHealthArmor2_Draw ocHealthArmor2_Draw = nullptr;
158170
}
159171

172+
namespace detour_cMissionStatus_Draw {
173+
tcMissionStatus_Draw ocMissionStatus_Draw = nullptr;
174+
}
175+
160176
namespace detour_cDMRanking_Draw {
161177
tcDMRanking_Draw ocDMRanking_Draw = nullptr;
162178
}
@@ -165,6 +181,10 @@ namespace detour_cCtfFlag_Draw {
165181
tcCtfFlag_Draw ocCtfFlag_Draw = nullptr;
166182
}
167183

184+
namespace detour_Draw_CharExtra {
185+
tDraw_CharExtra oDraw_CharExtra = nullptr;
186+
}
187+
168188
namespace detour_Draw_StretchPic {
169189
tDraw_StretchPic oDraw_StretchPic = nullptr;
170190
}
@@ -477,6 +497,28 @@ namespace detour_SCR_CenterPrint {
477497
}
478498
}
479499

500+
namespace detour_SCR_DrawPause {
501+
ManagerType& GetManager() {
502+
static ManagerType* instance = nullptr;
503+
if (!instance) {
504+
static char storage[sizeof(ManagerType)];
505+
instance = new(storage) ManagerType();
506+
}
507+
return *instance;
508+
}
509+
}
510+
511+
namespace detour_SCR_DrawCenterPrint {
512+
ManagerType& GetManager() {
513+
static ManagerType* instance = nullptr;
514+
if (!instance) {
515+
static char storage[sizeof(ManagerType)];
516+
instance = new(storage) ManagerType();
517+
}
518+
return *instance;
519+
}
520+
}
521+
480522
namespace detour_SCR_DrawCinematicString {
481523
ManagerType& GetManager() {
482524
static ManagerType* instance = nullptr;
@@ -488,6 +530,17 @@ namespace detour_SCR_DrawCinematicString {
488530
}
489531
}
490532

533+
namespace detour_SCR_DrawCinemaScope {
534+
ManagerType& GetManager() {
535+
static ManagerType* instance = nullptr;
536+
if (!instance) {
537+
static char storage[sizeof(ManagerType)];
538+
instance = new(storage) ManagerType();
539+
}
540+
return *instance;
541+
}
542+
}
543+
491544
namespace detour_cInventory2_And_cGunAmmo2_Draw {
492545
ManagerType& GetManager() {
493546
static ManagerType* instance = nullptr;
@@ -510,6 +563,17 @@ namespace detour_cHealthArmor2_Draw {
510563
}
511564
}
512565

566+
namespace detour_cMissionStatus_Draw {
567+
ManagerType& GetManager() {
568+
static ManagerType* instance = nullptr;
569+
if (!instance) {
570+
static char storage[sizeof(ManagerType)];
571+
instance = new(storage) ManagerType();
572+
}
573+
return *instance;
574+
}
575+
}
576+
513577
namespace detour_cDMRanking_Draw {
514578
ManagerType& GetManager() {
515579
static ManagerType* instance = nullptr;
@@ -532,6 +596,17 @@ namespace detour_cCtfFlag_Draw {
532596
}
533597
}
534598

599+
namespace detour_Draw_CharExtra {
600+
ManagerType& GetManager() {
601+
static ManagerType* instance = nullptr;
602+
if (!instance) {
603+
static char storage[sizeof(ManagerType)];
604+
instance = new(storage) ManagerType();
605+
}
606+
return *instance;
607+
}
608+
}
609+
535610
namespace detour_Draw_StretchPic {
536611
ManagerType& GetManager() {
537612
static ManagerType* instance = nullptr;
@@ -886,6 +961,12 @@ namespace detour_DispatchMessageA {
886961
}
887962
}
888963

964+
namespace detour_Draw_CharExtra {
965+
void __cdecl hkDraw_CharExtra(float x, float y, float scale, void* palette, int ch) {
966+
::hkDraw_CharExtra(x, y, scale, palette, ch, oDraw_CharExtra);
967+
}
968+
}
969+
889970
namespace detour_Draw_CroppedPicOptions {
890971
void __cdecl hkDraw_CroppedPicOptions(int x, int y, int c1x, int c1y, int c2x, int c2y, int palette, char* name) {
891972
::hkDraw_CroppedPicOptions(x, y, c1x, c1y, c2x, c2y, palette, name, oDraw_CroppedPicOptions);
@@ -940,12 +1021,30 @@ namespace detour_SCR_CenterPrint {
9401021
}
9411022
}
9421023

1024+
namespace detour_SCR_DrawCenterPrint {
1025+
void __cdecl hkSCR_DrawCenterPrint() {
1026+
::hkSCR_DrawCenterPrint(oSCR_DrawCenterPrint);
1027+
}
1028+
}
1029+
1030+
namespace detour_SCR_DrawCinemaScope {
1031+
void __cdecl hkSCR_DrawCinemaScope() {
1032+
::hkSCR_DrawCinemaScope(oSCR_DrawCinemaScope);
1033+
}
1034+
}
1035+
9431036
namespace detour_SCR_DrawCinematicString {
9441037
void __cdecl hkSCR_DrawCinematicString(int speed, int x, int y) {
9451038
::hkSCR_DrawCinematicString(speed, x, y, oSCR_DrawCinematicString);
9461039
}
9471040
}
9481041

1042+
namespace detour_SCR_DrawPause {
1043+
void __cdecl hkSCR_DrawPause() {
1044+
::hkSCR_DrawPause(oSCR_DrawPause);
1045+
}
1046+
}
1047+
9491048
namespace detour_SCR_DrawPlayerInfo {
9501049
void __cdecl hkSCR_DrawPlayerInfo() {
9511050
::hkSCR_DrawPlayerInfo(oSCR_DrawPlayerInfo);
@@ -1006,6 +1105,12 @@ namespace detour_cInventory2_And_cGunAmmo2_Draw {
10061105
}
10071106
}
10081107

1108+
namespace detour_cMissionStatus_Draw {
1109+
void __thiscall hkcMissionStatus_Draw(void* self) {
1110+
::hkcMissionStatus_Draw(self, ocMissionStatus_Draw);
1111+
}
1112+
}
1113+
10091114
// Pointer-only symbols (detours.yaml + pointers.json)
10101115
void RegisterPointerOnlyFunctions_SofExe() {
10111116
using namespace detour_Cmd_AddCommand;

0 commit comments

Comments
 (0)