diff options
| author | salmonik <salmonik@tuta.io> | 2026-11-03 22:44:22 +0100 |
|---|---|---|
| committer | salmonik <salmonik@tuta.io> | 2026-11-03 22:44:22 +0100 |
| commit | 5f256e1f92bf7b495667a0ff453b491f98a38fbf (patch) | |
| tree | a19081268ca0ea665869dc4655325308b5881ba8 | |
| parent | Startup crash: skip fullbright command when off; drop bad owner netvars; add ... (diff) | |
| download | hl2h-5f256e1f92bf7b495667a0ff453b491f98a38fbf.tar.gz hl2h-5f256e1f92bf7b495667a0ff453b491f98a38fbf.zip | |
Fix undefined fullbright symbols; link with --no-undefined
The fullbright_update/fullbright_invalidate definitions were lost when the
old text-menu section was removed, leaving undefined symbols that made the
dynamic loader reject libhl2hake.so. Restore both definitions and add
-Wl,--no-undefined so missing definitions fail the build instead of the game.
| -rwxr-xr-x | build.sh | 2 | ||||
| -rw-r--r-- | src/menu.cpp | 35 |
2 files changed, 36 insertions, 1 deletions
| @@ -4,5 +4,5 @@ cd "$(dirname "$0")" | |||
| 4 | g++ -m32 -O2 -std=c++17 -Wall -Wextra -Werror -fPIC -shared -fvisibility=hidden -fno-omit-frame-pointer \ | 4 | g++ -m32 -O2 -std=c++17 -Wall -Wextra -Werror -fPIC -shared -fvisibility=hidden -fno-omit-frame-pointer \ |
| 5 | -o libhl2hake.so \ | 5 | -o libhl2hake.so \ |
| 6 | src/hl2h.cpp src/modules.cpp src/cinput.cpp src/netvars.cpp src/menu.cpp src/gui.cpp src/esp.cpp src/server.cpp src/bones.cpp src/vischeck.cpp \ | 6 | src/hl2h.cpp src/modules.cpp src/cinput.cpp src/netvars.cpp src/menu.cpp src/gui.cpp src/esp.cpp src/server.cpp src/bones.cpp src/vischeck.cpp \ |
| 7 | -ldl | 7 | -ldl -Wl,--no-undefined |
| 8 | file libhl2hake.so | 8 | file libhl2hake.so |
diff --git a/src/menu.cpp b/src/menu.cpp index af1d2b8..e48fee0 100644 --- a/src/menu.cpp +++ b/src/menu.cpp | |||
| @@ -660,6 +660,41 @@ void draw_text_col(int x, int y, const char *text, int r, int g, int b) { | |||
| 660 | surf_draw_print_text(wtext, (int)wcslen(wtext)); | 660 | surf_draw_print_text(wtext, (int)wcslen(wtext)); |
| 661 | } | 661 | } |
| 662 | 662 | ||
| 663 | // --------------------------------------------------------------------------- | ||
| 664 | // mat_fullbright | ||
| 665 | // --------------------------------------------------------------------------- | ||
| 666 | |||
| 667 | static int g_fullbright_applied = -1; | ||
| 668 | static bool g_fullbright_fail_logged = false; | ||
| 669 | |||
| 670 | void fullbright_invalidate() { g_fullbright_applied = -1; } | ||
| 671 | |||
| 672 | void fullbright_update() { | ||
| 673 | bool want = feature_active(FEAT_FULLBRIGHT); | ||
| 674 | if ((int)want == g_fullbright_applied) | ||
| 675 | return; | ||
| 676 | // Avoid touching the engine console before the first map/menu frame. The | ||
| 677 | // engine may still be initializing its command buffer. | ||
| 678 | if (!want && g_fullbright_applied < 0) { | ||
| 679 | g_fullbright_applied = 0; | ||
| 680 | return; | ||
| 681 | } | ||
| 682 | bool ok = cvar_set_int("mat_fullbright", want ? 1 : 0); | ||
| 683 | g_fullbright_applied = want; | ||
| 684 | if (ok) { | ||
| 685 | if (want) | ||
| 686 | logf("fullbright: on"); | ||
| 687 | else | ||
| 688 | logd("fullbright: off"); | ||
| 689 | return; | ||
| 690 | } | ||
| 691 | if (want && !g_fullbright_fail_logged) { | ||
| 692 | g_fullbright_fail_logged = true; | ||
| 693 | logf("fullbright: mat_fullbright cvar unavailable"); | ||
| 694 | toastf(TOAST_ERROR, "Fullbright unavailable: cvar interface missing"); | ||
| 695 | } | ||
| 696 | } | ||
| 697 | |||
| 663 | // Draw overlay. MUST be called from inside the ISurface paint path | 698 | // Draw overlay. MUST be called from inside the ISurface paint path |
| 664 | // (see hkdDrawPrintText hook in hl2h.cpp): we wrap our draws in | 699 | // (see hkdDrawPrintText hook in hl2h.cpp): we wrap our draws in |
| 665 | // PushMakeCurrent/PopMakeCurrent so they are submitted with a clean clip. | 700 | // PushMakeCurrent/PopMakeCurrent so they are submitted with a clean clip. |
