Skip to content

Commit 4e1173d

Browse files
committed
Release v4.2: internal menus RMF pass, update/HTTP layout, menu docs
1 parent 92b71da commit 4e1173d

37 files changed

Lines changed: 500 additions & 285 deletions

.cursor/commands/menu-know-how.md

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -117,8 +117,8 @@ Notice:
117117
* `backdrop` is primary full-background control. in many cut-frame layouts, `backfill` reads as frame-local/border-region fill
118118
* RMF tint use ABGR-style interpretation
119119
* plain words are flow text; `<text ...>` is interactive/clickable area text.
120-
* Avoid long prose under `<center>` on 480p; prefer `<left>` + small inset (`<blank 20-32 1>`) for reliable wrapping/visibility.
121-
120+
* CAUTION: `<center>` layout treats each space separated word as a new line, then if you use double quote around your space separated text, if the length is longer than the remaining space in the frame, it will not be rendered.
121+
* Seems wise to try to use 2 giant blank borders either side of the content, but they must be injected with resolution dependent pixels as: ((width_of_inner_frame_px - centered_content_size_px) / 2) . Then you have a fixed size area across resolutions. CAVEAT: hr element cant be used cos has inbuilt left
122122

123123
---
124124

@@ -228,11 +228,14 @@ hbr *hard line break*
228228
center *A layout command which forces all following areas to appear centred on the screen and applies a carriage return (I admit that this is not ideal). If you wish to centre a line with spaces in it, then place the phrase in quotes.*
229229

230230
normal *A layout command which places all following areas to the right of the previous area until no more will fit, and then a carriage return is applied. This is the default layout state, all areas appearing from left to right just like on a page of text.*
231+
aka **normal** will **target the next line with free space in it**
231232

232233
left
233234
```xml
234235
A layout command which places all the following areas from the left of the page going right. The only difference between this and <normal> is that <left> starts from the next available place on the left of the page and not the current “next area position”.
235236
```
237+
aka **left** will **always prioritise a new line further vertically down the frame even if off the screen, as long as that new line starts more left than the next line**
238+
CAVEAT: hr element cant be used cos has inbuilt left
236239

237240
right *A layout command which places the following areas at the right of the page working left.*
238241

@@ -496,4 +499,9 @@ ifge
496499
ifne
497500
ifeq
498501
ifset
499-
ifclr
502+
ifclr
503+
504+
505+
---
506+
507+
![[Pasted image 20260217062306.png]]

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
# Changelog
22

3+
## v4.2
4+
5+
- Internal menus: RMF layout and content pass across SoF Buddy tabs (main, input, lighting, perf, scaling, social, texture, tweaks, HTTP, update help/prompt), loading header, and HTTP providers; FS_LoadFile override and internal menu hooks refined.
6+
- Menu docs: menu-know-how guidance and build/makefile tweaks.
7+
38
## v4.1
49

510
- Windows updater UX polish: silenced noisy extractor stderr/stdout (`tar`, `7z`, PowerShell fallback) in `update_from_zip.cmd` so successful fallback installs do not show misleading error spam.

VERSION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
4.1
1+
4.2

hdr/version.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,4 @@
77
Increment version using: ./increment_version.sh
88
*/
99

10-
#define SOFBUDDY_VERSION "4.1"
10+
#define SOFBUDDY_VERSION "4.2"

makefile

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,8 @@ all: $(MENU_DATA_CPP) $(FEATURES_TXT) $(FEATURE_CONFIG_H) $(FEATURE_LIST_H) $(VE
100100

101101
FORCE:
102102

103-
$(MENU_DATA_CPP): FORCE $(GENERATE_MENU_EMBED_PY)
103+
SOFBUDDY_RMF_FILES = $(shell find $(MENU_LIBRARY_DIR) -name '*.rmf' 2>/dev/null || true)
104+
$(MENU_DATA_CPP): $(GENERATE_MENU_EMBED_PY) $(SOFBUDDY_RMF_FILES)
104105
@python3 $(GENERATE_MENU_EMBED_PY)
105106

106107
# Create build directory

src/features/http_maps/http_maps.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1080,6 +1080,7 @@ static void http_maps_download_worker(std::string map_bsp_path, std::string zip_
10801080
DeleteFileA(temp_zip_path.c_str());
10811081
PrintOut(PRINT_DEV, "http_maps: Downloaded and extracted %s\n", map_bsp_path.c_str());
10821082
http_maps_queue_status(job_id, "HTTP map ready.");
1083+
g_http_maps_state.worker_did_download.store(true, std::memory_order_release);
10831084
success = true;
10841085
} else {
10851086
DeleteFileA(temp_zip_path.c_str());

src/features/internal_menus/hooks/fs_loadfile_override.cpp

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -63,17 +63,25 @@ int internal_menus_fs_loadfile_override_callback(char* path, void** buffer, bool
6363
const std::vector<uint8_t>& vec = file_it->second;
6464
if (vec.empty()) return original(path, buffer, override_pak);
6565

66-
// Use the engine's allocator so the engine can free the buffer later.
66+
std::string content(vec.begin(), vec.end());
67+
content.erase(std::remove(content.begin(), content.end(), '\r'), content.end());
68+
const char* inset = internal_menus_get_content_inset_rmf();
69+
const char* inset_tall = internal_menus_get_content_inset_tall_rmf();
70+
for (std::string::size_type pos = 0; (pos = content.find("{content_inset_tall}", pos)) != std::string::npos; )
71+
content.replace(pos, 20, inset_tall), pos += std::strlen(inset_tall);
72+
for (std::string::size_type pos = 0; (pos = content.find("{content_inset}", pos)) != std::string::npos; )
73+
content.replace(pos, 15, inset), pos += std::strlen(inset);
74+
for (std::string::size_type pos = 0; (pos = content.find("tall}", pos)) != std::string::npos; )
75+
content.replace(pos, 5, "");
76+
77+
const int size = static_cast<int>(content.size() + 1);
6778
static void* (*Z_Malloc)(int) = nullptr;
6879
if (!Z_Malloc) Z_Malloc = (void*(*)(int))rvaToAbsExe((void*)0x0001F120);
6980
if (!Z_Malloc) return original(path, buffer, override_pak);
70-
71-
const int size = static_cast<int>(vec.size() + 1);
7281
void* copy = Z_Malloc(size);
7382
if (!copy) return original(path, buffer, override_pak);
74-
std::memcpy(copy, vec.data(), vec.size());
75-
static_cast<char*>(copy)[vec.size()] = '\0';
83+
std::memcpy(copy, content.c_str(), content.size() + 1);
7684
*buffer = copy;
77-
return static_cast<int>(vec.size()); // Same convention as FS_LoadFile: return size, buffer set.
85+
return static_cast<int>(content.size());
7886
}
7987
#endif

src/features/internal_menus/internal_menus.cpp

Lines changed: 38 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ void create_loading_cvars() {
5252

5353
}
5454

55-
constexpr int kSofBuddyCenterPanelVirtualWidth = 592;
55+
constexpr int kSofBuddyCenterPanelVirtualWidth = 640;
5656
constexpr int kSofBuddyDefaultRow1ContentWidth = 400;
5757
constexpr int kSofBuddyDefaultRow2ContentWidth = 520;
5858

@@ -68,11 +68,13 @@ void create_layout_cvars() {
6868
constexpr int kLayoutCvarFlags = 0;
6969
orig_Cvar_Get("_sofbuddy_menu_vid_w", "640", kLayoutCvarFlags, nullptr);
7070
orig_Cvar_Get("_sofbuddy_menu_vid_h", "480", kLayoutCvarFlags, nullptr);
71-
orig_Cvar_Get("_sofbuddy_sb_center_panel_px", "592", kLayoutCvarFlags, nullptr);
71+
orig_Cvar_Get("_sofbuddy_sb_center_panel_px", "640", kLayoutCvarFlags, nullptr);
7272
orig_Cvar_Get("_sofbuddy_sb_tabs_row1_prefix_px", "96", kLayoutCvarFlags, nullptr);
7373
orig_Cvar_Get("_sofbuddy_sb_tabs_row2_prefix_px", "36", kLayoutCvarFlags, nullptr);
7474
orig_Cvar_Get("_sofbuddy_sb_tabs_row1_prefix_rmf", "<blank 96 1>", kLayoutCvarFlags, nullptr);
7575
orig_Cvar_Get("_sofbuddy_sb_tabs_row2_prefix_rmf", "<blank 36 1>", kLayoutCvarFlags, nullptr);
76+
orig_Cvar_Get("_sofbuddy_sb_tabs_row1_suffix_rmf", "<blank 96 1>", kLayoutCvarFlags, nullptr);
77+
orig_Cvar_Get("_sofbuddy_sb_tabs_row2_suffix_rmf", "<blank 36 1>", kLayoutCvarFlags, nullptr);
7678
_sofbuddy_sb_tabs_row1_content_px = orig_Cvar_Get("_sofbuddy_sb_tabs_row1_content_px", "400", kLayoutCvarFlags, nullptr);
7779
_sofbuddy_sb_tabs_row2_content_px = orig_Cvar_Get("_sofbuddy_sb_tabs_row2_content_px", "520", kLayoutCvarFlags, nullptr);
7880
_sofbuddy_sb_tabs_center_bias_px = orig_Cvar_Get("_sofbuddy_sb_tabs_center_bias_px", "0", kLayoutCvarFlags, nullptr);
@@ -182,8 +184,12 @@ void Cmd_SoFBuddy_Apply_Profile_Visual_f() {
182184
void update_layout_cvars(bool trigger_reloadall_if_changed) {
183185
if (!orig_Cvar_Get || !orig_Cvar_Set2) return;
184186

185-
const int vid_w = (current_vid_w > 0) ? current_vid_w : 640;
186-
const int vid_h = (current_vid_h > 0) ? current_vid_h : 480;
187+
int vid_w = (current_vid_w > 0) ? current_vid_w : 0;
188+
int vid_h = (current_vid_h > 0) ? current_vid_h : 0;
189+
if (vid_w <= 0 && viddef_width && *viddef_width > 0) vid_w = *viddef_width;
190+
if (vid_h <= 0 && viddef_height && *viddef_height > 0) vid_h = *viddef_height;
191+
if (vid_w <= 0) vid_w = 640;
192+
if (vid_h <= 0) vid_h = 480;
187193

188194
// center_panel uses frame units (560 / 640 of screen width).
189195
const int center_panel_px = (vid_w * kSofBuddyCenterPanelVirtualWidth + 320) / 640;
@@ -211,6 +217,8 @@ void update_layout_cvars(bool trigger_reloadall_if_changed) {
211217
set_runtime_cvar_int("_sofbuddy_sb_tabs_row2_prefix_px", row2_prefix_px);
212218
set_runtime_cvar_str("_sofbuddy_sb_tabs_row1_prefix_rmf", row1_rmf);
213219
set_runtime_cvar_str("_sofbuddy_sb_tabs_row2_prefix_rmf", row2_rmf);
220+
set_runtime_cvar_str("_sofbuddy_sb_tabs_row1_suffix_rmf", row1_rmf);
221+
set_runtime_cvar_str("_sofbuddy_sb_tabs_row2_suffix_rmf", row2_rmf);
214222

215223
static int last_vid_w = -1;
216224
static int last_vid_h = -1;
@@ -225,6 +233,32 @@ void update_layout_cvars(bool trigger_reloadall_if_changed) {
225233

226234
} // namespace
227235

236+
static int internal_menus_content_inset_px(void) {
237+
int inner_frame_px = 0;
238+
if (orig_Cvar_Get) {
239+
cvar_t* c = orig_Cvar_Get("_sofbuddy_sb_center_panel_px", "640", 0, nullptr);
240+
if (c && c->value > 0) inner_frame_px = static_cast<int>(c->value + 0.5f);
241+
}
242+
if (inner_frame_px <= 0) {
243+
int vid_w = (current_vid_w > 0) ? current_vid_w : 0;
244+
if (vid_w <= 0 && viddef_width && *viddef_width > 0) vid_w = *viddef_width;
245+
if (vid_w <= 0) vid_w = 640;
246+
inner_frame_px = (vid_w * 640 + 320) / 640;
247+
}
248+
const int centered_content_size_px = 640;
249+
return std::max(28, (inner_frame_px - centered_content_size_px) / 2);
250+
}
251+
const char* internal_menus_get_content_inset_rmf(void) {
252+
static char buf[32];
253+
std::snprintf(buf, sizeof(buf), "<blank %d 1>", internal_menus_content_inset_px());
254+
return buf;
255+
}
256+
const char* internal_menus_get_content_inset_tall_rmf(void) {
257+
static char buf[32];
258+
std::snprintf(buf, sizeof(buf), "<blank %d 10000>", internal_menus_content_inset_px());
259+
return buf;
260+
}
261+
228262
bool internal_menus_should_lock_loading_input(void) {
229263
if (!orig_Cvar_Get) return true;
230264
cvar_t* c = orig_Cvar_Get("_sofbuddy_loading_lock_input", "1", CVAR_SOFBUDDY_ARCHIVE, nullptr);

src/features/internal_menus/menu_library/loading/loading_header.rmf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
<hbr>
1414
<hbar "misc/l_clip" "misc/l_bullet" cvar menu_loading><hbr>
1515
<hbr>
16-
<font type title tint gray atint gray>
16+
<font type title tint lblue atint lblue>
1717
<ctext _sofbuddy_loading_current atext "Map: "><hbr>
1818
<hbr>
1919
<ctext _sofbuddy_loading_status atext "Download: "><hbr>

src/features/internal_menus/menu_library/sof_buddy/sb_http.rmf

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,5 @@
88
<defaults noborder tiptint black tipbtint white tipfont title>
99

1010
<frame root 640 0>
11-
<frame left_spacer 24 0 cut root page sof_buddy/sb_margin_backdrop>
12-
<frame center_panel 592 0 cut root page sof_buddy/sb_http_content>
13-
<frame right_spacer 24 0 cut root page sof_buddy/sb_margin_backdrop>
11+
<frame center_panel 640 0 cut root page sof_buddy/sb_http_content>
1412
</stm>

0 commit comments

Comments
 (0)