-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.cpp
More file actions
3726 lines (3507 loc) · 162 KB
/
Copy pathmain.cpp
File metadata and controls
3726 lines (3507 loc) · 162 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
// DPLauncher — Deadly Premonition rexglue port launcher
// Win32 + GDI+ native window with PLAY / Settings / Exit buttons.
// Derived from the Silent Hill: Downpour launcher (DPourLauncher); the
// Downpour-only flows (ISO/title-update installer, UE3 Coalesced editor,
// background music controls) were removed for this port.
#define WIN32_LEAN_AND_MEAN
#include <windows.h>
#include <windowsx.h>
#include <objidl.h>
#include <gdiplus.h>
#include <shellapi.h>
#include <shlwapi.h>
#include <commdlg.h>
#include <mmsystem.h>
#include <digitalv.h>
#include <dwmapi.h>
#include <uxtheme.h>
#include <commctrl.h>
#include <shlobj.h>
#include <winhttp.h>
#include <dxgi.h>
#include <wrl/client.h>
#include <thread>
#include <string>
#include <fstream>
#include <filesystem>
#include <sstream>
#include <vector>
#include <map>
#include <memory>
#include <unordered_map>
#include <cwchar>
#include <algorithm>
#include <set>
#include <atomic>
#pragma comment(lib, "gdiplus.lib")
#pragma comment(lib, "shlwapi.lib")
#pragma comment(lib, "comctl32.lib")
#pragma comment(lib, "winmm.lib")
#pragma comment(lib, "dwmapi.lib")
#pragma comment(lib, "uxtheme.lib")
#pragma comment(lib, "winhttp.lib")
using namespace Gdiplus;
// Defined at file scope (outside namespace) so wWinMain can reach them too.
void SaveLauncherLanguageSidecar();
void LoadLauncherLanguageFromToml();
// v1.1.6: launcher.ini access from inside the anonymous namespace (Settings
// dialog Save handler) needs these symbols pre-declared. The definitions
// live further down at file scope, after the anon ns closes.
extern std::unordered_map<std::string, std::string> g_launcher_ini;
void WriteLauncherIni();
void MaybeShareShaderCache();
void ApplySteamDeckPresetIfDetected();
void GenerateKeyPromptOverlay();
void EnsureBundledAssets();
std::string GetPromptStyle();
bool IsKnownPromptStyle(const std::string& v);
static void ReadLauncherIni();
extern std::unordered_map<std::string, std::string> g_launcher_ini;
namespace {
constexpr int kWindowWidth = 1280;
constexpr int kWindowHeight = 720;
constexpr wchar_t kWindowClass[] = L"DPLauncherWindow";
// Base title used by message boxes and other "what is this window" queries.
// The actual top-level window title built in wWinMain composes this with
// kLauncherVersion + author suffix so the taskbar always shows the shipping
// version (e.g. "Deadly Premonition v0.2.0 | «Little Bit»"). Bumping
// kLauncherVersion is the SINGLE source of truth — title updates flow from
// there. Don't add a separate version string here.
constexpr wchar_t kWindowTitle[] = L"Deadly Premonition Recompilation";
constexpr wchar_t kWindowTitleAuthorSuffix[] = L" | «Little Bit»";
// Game-side file names next to the launcher.
constexpr wchar_t kGameExeName[] = L"deadlyprem.exe";
constexpr wchar_t kGameTomlName[] = L"deadlyprem.toml";
// Resource IDs (must match resources.rc).
#define IDR_BANNER 200
#define IDR_LOGO 201
#define IDR_FONT 203 // Cinema Calligraphy (the game's UI font) for the key prompts
#define IDR_MUSIC 202
ULONG_PTR g_gdiplus_token = 0;
std::unique_ptr<Bitmap> g_banner_bitmap;
std::unique_ptr<Bitmap> g_logo_bitmap;
HFONT g_button_font = nullptr;
HFONT g_hint_font = nullptr;
HFONT g_title_font = nullptr;
std::wstring g_music_temp_path;
// ===== i18n =====
enum LangId { kLangEn = 0, kLangUk = 1 };
LangId g_lang = kLangEn;
std::wstring Widen(const std::string& s);
bool LooksNumeric(const std::string& s);
static const std::map<std::string, std::wstring>& UkTable() {
static const std::map<std::string, std::wstring> t = {
// Buttons / hint.
{"PLAY", L"ГРАТИ"},
{"Update available: ",L"Доступне оновлення: "},
{" — click to install",L" — натисніть, щоб встановити"},
{"Download and install update?",
L"Завантажити та встановити оновлення?"},
{"Latest version: ", L"Остання версія: "},
{"Current version: ",L"Поточна версія: "},
{"Downloading update",L"Завантаження оновлення"},
{"Update failed", L"Помилка оновлення"},
{"Could not download the update zip. Check your internet connection.",
L"Не вдалося завантажити zip-архів оновлення. Перевірте інтернет-зʼєднання."},
{"The latest release contains no DPRecomp zip asset.",
L"У останньому релізі відсутній zip-архів DPRecomp."},
{"Update — preparing installer...",
L"Оновлення — підготовка інсталятора..."},
{"Previous update did not finish",
L"Попереднє оновлення не завершилось"},
{"The auto-updater logged an error on the last attempt. Open the diagnostic log? (No = delete log and continue.)",
L"Авто-оновлювач залишив помилку у журналі при минулій спробі. Відкрити діагностичний лог? (Ні — видалити лог і продовжити.)"},
{"Yes", L"Так"},
{"No", L"Ні"},
{"Settings", L"Налаштування"},
{"Exit", L"Вихід"},
{"Save && Close", L"Зберегти і закрити"},
{"Cancel", L"Скасувати"},
{"D-Pad: Select Option A: Confirm",
L"D-Pad: Вибір A: Підтвердити"},
// Tabs.
{"Graphics", L"Графіка"},
{"Advanced", L"Додатково"},
{"Mouse", L"Миша"},
{"Controls", L"Керування"},
{"Debug", L"Діагностика"},
// Graphics cvars.
{"Render Target Path", L"Шлях рендеру"},
{"ROV (recommended)", L"ROV (рекомендовано)"},
{"RTV (compatibility)", L"RTV (сумісність)"},
{"Auto (SDK default)", L"Авто (за замовчуванням SDK)"},
{"Internal Resolution Scale", L"Внутрішнє суперсемплування"},
{"1x — 1280x720 internal", L"1x — 1280x720 внутрішньо"},
{"2x — 2560x1440 internal (recommended)",
L"2x — 2560x1440 внутрішньо (рекомендовано)"},
{"3x — 3840x2160 internal", L"3x — 3840x2160 внутрішньо"},
{"4x — 5120x2880 internal (slowest)",
L"4x — 5120x2880 внутрішньо (найповільніше)"},
{"Native 2x MSAA", L"Нативний 2x MSAA"},
{"Anisotropic Filtering", L"Анізотропна фільтрація"},
{"Game default", L"Як у грі"},
{"Off", L"Вимк."},
{"Post-process Anti-Aliasing", L"Згладжування (FXAA)"},
{"Off (sharp, more aliasing)", L"Вимкнено (чітко, видно aliasing)"},
{"FXAA (recommended)", L"FXAA (рекомендовано)"},
{"FXAA Extreme (heavier blur, hides specks)",
L"FXAA Extreme (сильніший blur, ховає точки)"},
{"Upscaler / Sharpener", L"Апскейлер / Різкість"},
{"Bilinear (off)", L"Білінійний"},
{"AMD CAS (sharpening)", L"AMD CAS"},
{"AMD FSR 1 (spatial)", L"AMD FSR 1"},
{"AMD FSR 2 (temporal)", L"AMD FSR 2"},
{"AMD FSR 3 (temporal+)", L"AMD FSR 3"},
{"FSR Quality Mode", L"Режим якості FSR"},
{"Auto", L"Авто"},
{"Native AA", L"Native AA"},
{"Quality", L"Якість"},
{"Balanced", L"Збалансований"},
{"Performance", L"Швидкодія"},
{"Ultra Performance", L"Макс. швидкодія"},
{"FSR Softness (0 = sharpest)", L"М'якість FSR (0 = різко)"},
{"CAS Extra Sharpness", L"CAS: додаткова різкість"},
{"Preserve Aspect (Letterbox)", L"Зберегти пропорції"},
{"60 FPS (ehw patch)", L"60 FPS (патч ehw)"},
{"VSync", L"Вертикальна синхр."},
{"Fullscreen", L"Повноекранний режим"},
{"Window Width (0 = auto)", L"Ширина вікна (0 = авто)"},
{"Window Height (0 = auto)", L"Висота вікна (0 = авто)"},
{"Monitor", L"Монітор"},
{"Default (primary)", L"Типово (основний)"},
{"Allow VRR / Tearing", L"Дозволити VRR / tearing"},
{"Output Dithering", L"Дизеринг виводу"},
// Advanced.
{"Launcher Language", L"Мова лаунчера"},
{"English", L"Англійська"},
{"Ukrainian", L"Українська"},
{"Input Backend", L"Бекенд вводу"},
{"SDL (recommended, DualSense support)",
L"SDL (рекомендовано, підтримка DualSense)"},
{"XInput (Xbox controllers only)",
L"XInput (лише Xbox-геймпади)"},
{"Controller Mappings (SDL)",
L"Мапінги геймпадів (SDL)"},
{"Game Language", L"Мова гри"},
{"German (Deutsch)", L"Німецька"},
{"French (Francais)", L"Французька"},
{"Spanish (Espanol)", L"Іспанська"},
{"Italian (Italiano)", L"Італійська"},
{"GPU Adapter", L"Відеоадаптер"},
{"Auto (first physical GPU)", L"Авто (перший фізичний GPU)"},
{"Adapter 0", L"Адаптер 0"},
{"Adapter 1", L"Адаптер 1"},
{"Adapter 2", L"Адаптер 2"},
{"Async Shader Compilation", L"Асинхронні шейдери"},
{"Texture Cache Soft Limit (MB)",
L"Кеш текстур: м'який (МБ)"},
{"Texture Cache Hard Limit (MB)",
L"Кеш текстур: жорсткий (МБ)"},
{"Mute Game Audio", L"Вимкнути звук гри"},
// Mouse.
{"Mouse & Keyboard Mode", L"Миша + клавіатура"},
{"Mouse Camera Hook (direct)",
L"Хук камери (миша)"},
{"Camera Hook Sensitivity", L"Чутливість хука камери"},
{"Camera Hook Invert Y", L"Хук: інверсія Y"},
{"Mouse as Right Stick",
L"Миша як правий стік"},
{"Mouse Sensitivity", L"Чутливість миші"},
{"Stick Scale (units per pixel)", L"Масштаб стіка (од./піксель)"},
{"Deadzone Floor (stick units)", L"Мін. мертва зона (стік)"},
{"Invert Mouse Y", L"Інверсія миші по Y"},
// DualSense.
{"DualSense Adaptive Triggers", L"DualSense: адаптивні курки"},
{"Right Trigger Effect Mode", L"Правий курок: режим ефекту"},
{"Left Trigger Effect Mode", L"Лівий курок: режим ефекту"},
{"Off (pass-through)", L"Вимк. (без ефекту)"},
{"Feedback (constant resistance)",
L"Feedback (постійний опір)"},
{"Weapon (click point — gun trigger feel)",
L"Weapon (клацання спуску)"},
{"Vibration (buzz on pull)", L"Vibration (вібрація)"},
{"Right Trigger Start Position", L"Правий курок: початок"},
{"Right Trigger End Position", L"Правий курок: кінець"},
{"Right Trigger Strength", L"Правий курок: сила"},
{"Left Trigger Start Position", L"Лівий курок: початок"},
{"Left Trigger End Position", L"Лівий курок: кінець"},
{"Left Trigger Strength", L"Лівий курок: сила"},
// Keybinds (Director's Cut layout).
{"A button (action / fire)",
L"A (дія / постріл)"},
{"B button", L"B"},
{"X button", L"X"},
{"Y button", L"Y"},
{"Left Trigger", L"LT (лівий курок)"},
{"Right Trigger (aim)", L"RT (прицілювання)"},
{"Left Shoulder", L"LB (лівий бампер)"},
{"Right Shoulder", L"RB (правий бампер)"},
{"Left Stick Press", L"Натиск лівого стіку"},
{"Right Stick Press", L"Натиск правого стіку"},
{"Move Forward", L"Рух уперед"},
{"Move Backward", L"Рух назад"},
{"Strafe Left", L"Крок ліворуч"},
{"Strafe Right", L"Крок праворуч"},
{"D-Pad Up", L"D-Pad угору"},
{"D-Pad Down", L"D-Pad униз"},
{"D-Pad Left", L"D-Pad ліворуч"},
{"D-Pad Right", L"D-Pad праворуч"},
{"Back", L"Back"},
{"Start (pause menu)", L"Start (пауза)"},
// Debug.
{"Log Level", L"Рівень логування"},
{"Off (no logs)", L"Вимк. (без логів)"},
{"Error", L"Error (лише помилки)"},
{"Warn", L"Warn (попередження)"},
{"Info (recommended)", L"Info (рекомендовано)"},
{"Debug (verbose)", L"Debug (детально)"},
{"Trace (very verbose)", L"Trace (дуже детально)"},
{"Memexport Readback (keep on)", L"Читання memexport (лишити)"},
{"Occlusion Queries", L"Occlusion-запити (відсікання)"},
{"PSO Missing Policy", L"Якщо шейдер ще не готовий"},
{"Block (wait per draw, budgeted — recommended)",
L"Чекати (рекомендовано)"},
{"Skip (no block, pop-in on miss)",
L"Пропустити (об'єкт зникне)"},
{"Sync (inline compile, longest stutter)",
L"Синхронно (найдовший фриз)"},
{"PSO Block Budget (ms)", L"Макс. очікування шейдера (мс)"},
{"No PSO Wait At Frame End", L"Не чекати шейдери в кінці кадру"},
{"D3D12 Debug Layer (slow)", L"Debug-шар D3D12 (повільно)"},
{"Shader Storage Cache", L"Зберігати шейдери на диску"},
{"Share Shader Cache", L"Надсилати кеш шейдерів"},
{"Help other players?", L"Допомогти іншим гравцям?"},
{"Steam Deck preset", L"Пресет Steam Deck"},
{"Steam Overlay", L"Оверлей Steam"},
{"Button Prompts", L"Підказки кнопок"},
{"Texture Dump (textures\\dump)", L"Дамп текстур (textures\\dump)"},
{"Keyboard (keys from your bindings)", L"Клавіатура (ваші клавіші)"},
{"Xbox (original icons)", L"Xbox (рідні іконки)"},
{"PlayStation - solid (DualShock / DualSense)", L"PlayStation - суцільні (DualShock / DualSense)"},
{"PlayStation - solid with ring", L"PlayStation - суцільні з кільцем"},
{"PlayStation - outline", L"PlayStation - контурні"},
{"On (Steam default)", L"Увімк. (типово в Steam)"},
{"Off (fixes black screen / tinted quarter frame)",
L"Вимк. (лікує чорний екран)"},
{"On - send my shader cache (anonymous) to the project",
L"Увімк. (анонімно, після гри)"},
{"Shader Compile Indicator", L"Індикатор компіляції PSO"},
{"Shader Indicator: Verbose", L"Індикатор: детально"},
{"PSO Library (disk cache)", L"Бібліотека PSO (на диску)"},
{"Camera Hook: Direct Yaw", L"Хук: прямий поворот"},
{"Camera Hook: Catch-up", L"Хук: наздоганяння"},
{"Camera Auto-center Hold (ms)", L"Затримка автоцентру (мс)"},
{"Key Stick Ramp (ms)", L"Розгін стіка з клавіш (мс)"},
{"Auto-shake (hold A + D)", L"Автотряска (тримати A + D)"},
{"Auto-shake Rate (Hz)", L"Частота автотряски (Гц)"},
{"Steam Deck detected - the community-tested Deck preset was applied (RTV, 1x, 2x MSAA, 16x AF, FXAA + CAS, 30 FPS, VSync, fullscreen 1280x800). You can change anything in Settings; this will not be applied again.",
L"Виявлено Steam Deck - застосовано перевірений спільнотою пресет (RTV, 1x, 2x MSAA, 16x AF, FXAA + CAS, 30 FPS, VSync, повний екран 1280x800). Усе можна змінити в Settings; повторно не застосовуватиметься."},
{"Share your shader cache with the project?\n\nWhen enabled, the launcher sends the shader cache the game builds while you play (only shader microcode and pipeline descriptions - no personal data, no save games) to the developers. Merged caches ship with the next release, so people who play after you get fewer stutters in new scenes.\n\nYou can change this later in Settings -> Advanced -> Share Shader Cache.",
L"Поділитися кешем шейдерів із проєктом?\n\nЯкщо увімкнути, лаунчер надсилатиме розробникам кеш шейдерів, який гра будує під час твоєї гри (лише мікрокод шейдерів і описи pipeline - без персональних даних і сейвів). Злиті кеші виходять у наступному релізі, тож ті, хто гратиме після тебе, матимуть менше підлагувань у нових сценах.\n\nЗмінити можна пізніше: Settings -> Advanced -> Share Shader Cache."},
{"Log Files To Keep", L"Кількість лог-файлів"},
{"Log File Size Limit (MB)", L"Ліміт розміру лог-файлу (МБ)"},
// Misc.
{"Launcher language changed. Restart to apply.",
L"Мова лаунчера змінена. Перезапустіть для застосування."},
{"Failed to launch deadlyprem.exe.\nMake sure it exists next to PlayDeadlyPremonition.exe.",
L"Не вдалося запустити deadlyprem.exe.\nПереконайтеся, що він поруч із PlayDeadlyPremonition.exe."},
{"Game data not found.\nExpected assets\\default.xex next to the launcher.\n"
"Copy the extracted game files into the assets folder and try again.",
L"Файли гри не знайдено.\nОчікується assets\\default.xex поруч із лаунчером.\n"
L"Скопіюйте розпаковані файли гри в теку assets і спробуйте знову."},
};
return t;
}
std::wstring TrW(const std::string& en) {
if (g_lang == kLangUk) {
const auto& t = UkTable();
auto it = t.find(en);
if (it != t.end()) return it->second;
}
return Widen(en);
}
const wchar_t* TrC(const char* en) {
thread_local std::wstring cache;
cache = TrW(en);
return cache.c_str();
}
struct Button {
RECT rect;
std::wstring text;
bool hovered = false;
bool pressed = false;
int id = 0;
};
constexpr int kBtnPlay = 1;
constexpr int kBtnSettings = 2;
constexpr int kBtnExit = 3;
constexpr int kBtnUpdate = 4;
// Embedded launcher version. Bump on every release. The boot-time GitHub
// API probe compares this to the latest release `tag_name` to decide whether
// to show the "Update available" banner. Keep resources.rc in sync.
constexpr const wchar_t* kLauncherVersion = L"v1.3.1";
// v1.1: opt-in shader cache sharing. When the user enables "Share Shader
// Cache" (launcher.ini: launcher_share_shader_cache = on) the launcher zips
// userdata\cache\shaders\shareable\*.xsh / *.xpso (game shader microcode +
// pipeline descriptions only, no personal data) and posts it to this Discord
// webhook whenever the cache changed since the last upload. Empty = feature
// hidden and disabled.
constexpr const wchar_t* kShaderCacheWebhookUrl = L"";
constexpr const char* kGithubReleaseUrl =
"https://github.com/LittleBitUA/DPRecomp/releases/latest";
// Background-probed update state. Written once by the worker thread, then
// read every paint frame from the UI thread. The atomic flag is the
// happens-before fence; the tag string + asset URL are only read after the
// flag flips to true so the relaxed-vs-acquire pairing is sufficient.
std::atomic<bool> g_update_available{false};
std::wstring g_update_tag; // e.g. "v1.0.1"
std::wstring g_update_asset_url; // direct https URL to the zip asset
// Translations for the update-flow strings.
struct UpdateStrings {
std::wstring banner_text; // "Update available: v1.0.1 — click to install"
std::wstring confirm_title; // dialog title
std::wstring confirm_body; // "Download X MB and install update?"
std::wstring progress_title; // "Downloading update"
std::wstring failure_title; // "Update failed"
std::wstring failure_body; // "Could not download the update zip."
std::wstring no_asset_body; // "No DPRecomp zip was found in the release."
};
UpdateStrings BuildUpdateStrings();
std::vector<Button> g_buttons;
int g_focused_button = 0;
std::wstring GetExeDir() {
wchar_t path[MAX_PATH];
GetModuleFileNameW(nullptr, path, MAX_PATH);
PathRemoveFileSpecW(path);
return path;
}
Bitmap* LoadBitmapFromResource(int res_id) {
HRSRC hres = FindResourceW(nullptr, MAKEINTRESOURCEW(res_id), RT_RCDATA);
if (!hres) return nullptr;
DWORD size = SizeofResource(nullptr, hres);
HGLOBAL hmem = LoadResource(nullptr, hres);
if (!hmem) return nullptr;
void* data = LockResource(hmem);
if (!data) return nullptr;
HGLOBAL hbuf = GlobalAlloc(GMEM_MOVEABLE, size);
if (!hbuf) return nullptr;
void* buf = GlobalLock(hbuf);
memcpy(buf, data, size);
GlobalUnlock(hbuf);
IStream* stream = nullptr;
if (CreateStreamOnHGlobal(hbuf, TRUE, &stream) != S_OK) {
GlobalFree(hbuf);
return nullptr;
}
Bitmap* bmp = Bitmap::FromStream(stream);
stream->Release();
if (bmp && bmp->GetLastStatus() != Ok) {
delete bmp;
return nullptr;
}
return bmp;
}
void ExtractMusicToTemp() {
HRSRC hres = FindResourceW(nullptr, MAKEINTRESOURCEW(IDR_MUSIC), RT_RCDATA);
if (!hres) return;
DWORD size = SizeofResource(nullptr, hres);
HGLOBAL hmem = LoadResource(nullptr, hres);
if (!hmem) return;
void* data = LockResource(hmem);
if (!data) return;
wchar_t temp_dir[MAX_PATH];
GetTempPathW(MAX_PATH, temp_dir);
wchar_t temp_file[MAX_PATH];
GetTempFileNameW(temp_dir, L"dpm", 0, temp_file);
std::wstring ogg_path = std::wstring(temp_file) + L".ogg";
HANDLE h = CreateFileW(ogg_path.c_str(), GENERIC_WRITE, 0, nullptr,
CREATE_ALWAYS, FILE_ATTRIBUTE_TEMPORARY, nullptr);
if (h == INVALID_HANDLE_VALUE) return;
DWORD written = 0;
BOOL ok = WriteFile(h, data, size, &written, nullptr);
CloseHandle(h);
DeleteFileW(temp_file); // remove the placeholder file the API generated.
if (!ok || written != size) {
DeleteFileW(ogg_path.c_str());
return; // Partial/failed write — don't expose truncated audio to MCI.
}
g_music_temp_path = ogg_path;
}
// v1.1.6: launcher background-music volume (0..100 percent) and mute toggle.
// User reported the music played at full volume by default which was too loud;
// dropped default to 25%. Persisted in launcher.ini so the choice survives
// across releases (toml is reserved for game-side cvars). MCI's setaudio
// expects 0..1000 internally so we multiply by 10 in ApplyMusicVolume.
static int g_music_volume = 25;
static bool g_music_muted = false;
static bool g_music_open = false;
void ApplyMusicVolume() {
if (!g_music_open) return;
int percent = g_music_muted ? 0 : g_music_volume;
if (percent < 0) percent = 0;
if (percent > 100) percent = 100;
wchar_t cmd[64];
swprintf_s(cmd, L"setaudio bgmusic volume to %d", percent * 10);
mciSendStringW(cmd, nullptr, 0, nullptr);
}
void StartMusic() {
if (g_music_temp_path.empty()) return;
std::wstring open_cmd = L"open \"" + g_music_temp_path + L"\" type mpegvideo alias bgmusic";
if (mciSendStringW(open_cmd.c_str(), nullptr, 0, nullptr) != 0) {
// Fallback: try alias type detection.
std::wstring fallback = L"open \"" + g_music_temp_path + L"\" alias bgmusic";
mciSendStringW(fallback.c_str(), nullptr, 0, nullptr);
}
g_music_open = true;
ApplyMusicVolume();
mciSendStringW(L"play bgmusic repeat", nullptr, 0, nullptr);
}
void StopMusic() {
mciSendStringW(L"stop bgmusic", nullptr, 0, nullptr);
mciSendStringW(L"close bgmusic", nullptr, 0, nullptr);
if (!g_music_temp_path.empty()) {
DeleteFileW(g_music_temp_path.c_str());
g_music_temp_path.clear();
}
}
void LoadAssets() {
g_banner_bitmap.reset(LoadBitmapFromResource(IDR_BANNER));
g_logo_bitmap.reset(LoadBitmapFromResource(IDR_LOGO));
}
void CreateFonts() {
LOGFONTW lf = {};
lf.lfHeight = -22;
lf.lfWeight = FW_BOLD;
lf.lfQuality = CLEARTYPE_QUALITY;
wcscpy_s(lf.lfFaceName, L"Bahnschrift");
g_button_font = CreateFontIndirectW(&lf);
lf.lfHeight = -14;
lf.lfWeight = FW_NORMAL;
wcscpy_s(lf.lfFaceName, L"Segoe UI");
g_hint_font = CreateFontIndirectW(&lf);
lf.lfHeight = -28;
lf.lfWeight = FW_BOLD;
wcscpy_s(lf.lfFaceName, L"Bahnschrift");
g_title_font = CreateFontIndirectW(&lf);
}
void LayoutButtons(int client_w, int client_h) {
g_buttons.clear();
const int default_w = 140;
const int btn_h = 44;
const int gap = 10;
const int margin_right = 24;
const int margin_bottom = 24;
const char* labels[] = {"PLAY", "Settings", "Exit"};
const int widths[] = {default_w, default_w, default_w};
const int ids[] = {kBtnPlay, kBtnSettings, kBtnExit};
const int count = 3;
int total_w = (gap * (count - 1));
for (int i = 0; i < count; ++i) total_w += widths[i];
int x = client_w - margin_right - total_w;
int y = client_h - margin_bottom - btn_h;
for (int i = 0; i < count; ++i) {
Button b;
b.rect = {x, y, x + widths[i], y + btn_h};
b.text = TrW(labels[i]);
b.id = ids[i];
g_buttons.push_back(b);
x += widths[i] + gap;
}
// Update banner (if a newer GitHub release was found). Modern pill-shaped
// notification at top-center. Painted via DrawUpdateBanner (rounded corners
// + accent gradient + subtle glow) instead of the generic DrawButton.
if (g_update_available.load(std::memory_order_acquire)) {
const int banner_h = 44;
const int banner_w = 540; // wide enough for "Update available: vX.Y.Z — click to install"
const int banner_y = 36;
int banner_x = (client_w - banner_w) / 2;
if (banner_x < 24) banner_x = 24;
Button b;
b.rect = {banner_x, banner_y, banner_x + banner_w, banner_y + banner_h};
b.text = TrW("Update available: ") + g_update_tag +
TrW(" — click to install");
b.id = kBtnUpdate;
g_buttons.push_back(b);
}
}
// GDI+ FontFamily ctor fails (status != Ok) when the requested face isn't
// installed — unlike GDI's CreateFont which substitutes silently. Bahnschrift
// (Win10+) and Segoe UI (Win7+) are not on stock Wine: DrawString then
// renders nothing → blank buttons / blank title on Linux. Walk a list of
// candidates and finally fall back to GDI+'s GenericSansSerif which is
// guaranteed available on any platform.
std::unique_ptr<FontFamily> MakeFontFamilyWithFallback(
std::initializer_list<const wchar_t*> candidates) {
for (const wchar_t* name : candidates) {
auto ff = std::make_unique<FontFamily>(name);
if (ff->GetLastStatus() == Ok && ff->IsAvailable()) {
return ff;
}
}
// GenericSansSerif() returns a borrowed singleton; FontFamily's copy ctor is
// private. Look up its family name and construct a fresh, owned instance.
WCHAR generic_name[LF_FACESIZE] = {};
if (auto* generic = FontFamily::GenericSansSerif()) {
generic->GetFamilyName(generic_name);
}
if (generic_name[0] == L'\0') {
wcscpy_s(generic_name, L"Microsoft Sans Serif"); // ships with Wine too
}
return std::make_unique<FontFamily>(generic_name);
}
// Build a rounded-rectangle path with the given corner radius. Used by
// DrawUpdateBanner — GDI+ has no native rounded-rect primitive, so we
// stitch four arcs and two line edges.
static void BuildRoundedRectPath(GraphicsPath& path, int x, int y, int w,
int h, int radius) {
const int d = radius * 2;
path.Reset();
path.AddArc(x, y, d, d, 180, 90);
path.AddArc(x + w - d, y, d, d, 270, 90);
path.AddArc(x + w - d, y + h - d, d, d, 0, 90);
path.AddArc(x, y + h - d, d, d, 90, 90);
path.CloseFigure();
}
// Custom paint for the GitHub update notification. Designed to sit on the
// Downpour title-screen art without standing out as a Windows-toast pill —
// uses the game's muted blue-grey + aged-blood palette:
// • near-black fill ~92 % opacity (sits over banner art without blocking)
// • thin 1 px maroon border with a faint blood-red outer glow
// • white text matching the PLAY / Settings buttons exactly
// • rounded full-pill corners (radius = half-height) for the only round
// element on screen — that alone marks it as "this is a notification"
static void DrawUpdateBanner(Graphics& g, const Button& btn, bool focused) {
const int x = btn.rect.left;
const int y = btn.rect.top;
const int w = btn.rect.right - btn.rect.left;
const int h = btn.rect.bottom - btn.rect.top;
const int radius = h / 2;
const bool active = btn.hovered || btn.pressed || focused;
// Outer aged-blood glow — concentric layers, deeper red when active.
for (int i = 5; i >= 1; --i) {
GraphicsPath glow;
BuildRoundedRectPath(glow, x - i, y - i, w + 2 * i, h + 2 * i,
radius + i);
BYTE alpha = (BYTE)((active ? 28 : 16) / i);
SolidBrush glow_brush(Color(alpha, 120, 22, 22));
g.FillPath(&glow_brush, &glow);
}
// Main fill — near-black, slightly translucent so the banner art bleeds
// through and the pill belongs to the scene, not floats above it.
GraphicsPath shape;
BuildRoundedRectPath(shape, x, y, w, h, radius);
Color fill_top = active ? Color(245, 36, 36, 40) : Color(230, 22, 22, 26);
Color fill_bottom = active ? Color(245, 22, 22, 26) : Color(230, 14, 14, 18);
LinearGradientBrush fill(Rect(x, y, w, h), fill_top, fill_bottom,
LinearGradientModeVertical);
g.FillPath(&fill, &shape);
// Hairline maroon border. Slightly brighter (closer to neutral grey) on
// hover so the affordance reads as "this is interactive" without going
// full primary-button white.
Pen border(active ? Color(220, 200, 200, 200) : Color(180, 140, 56, 56),
1.0f);
g.DrawPath(&border, &shape);
// Text — same colour and style as the PLAY / Settings buttons. No icon
// glyph (the Unicode ⬇ rendered with non-uniform advance width on the
// Bahnschrift fallback chain, which threw StringAlignmentCenter off by
// ~15 px). The pill shape itself signals "this is a notification".
auto ff = MakeFontFamilyWithFallback({L"Bahnschrift", L"Segoe UI", L"Tahoma"});
Font text_font(ff.get(), 15, FontStyleBold, UnitPixel);
StringFormat fmt;
fmt.SetAlignment(StringAlignmentCenter);
fmt.SetLineAlignment(StringAlignmentCenter);
SolidBrush text_brush(Color(255, 230, 230, 230));
RectF rf((REAL)x, (REAL)y, (REAL)w, (REAL)h);
g.DrawString(btn.text.c_str(), -1, &text_font, rf, &fmt, &text_brush);
}
void DrawButton(Graphics& g, const Button& btn, bool focused) {
Color fill_color(220, 20, 20, 20);
Color border_color(255, 200, 200, 200);
Color text_color(255, 230, 230, 230);
if (btn.pressed) {
fill_color = Color(255, 60, 60, 60);
} else if (btn.hovered || focused) {
fill_color = Color(240, 50, 50, 50);
border_color = Color(255, 240, 240, 240);
}
Rect r(btn.rect.left, btn.rect.top, btn.rect.right - btn.rect.left,
btn.rect.bottom - btn.rect.top);
SolidBrush bg(fill_color);
g.FillRectangle(&bg, r);
Pen pen(border_color, 1.5f);
g.DrawRectangle(&pen, r);
auto ff = MakeFontFamilyWithFallback({L"Bahnschrift", L"Segoe UI", L"Tahoma"});
Font font(ff.get(), 18, FontStyleBold, UnitPixel);
StringFormat fmt;
fmt.SetAlignment(StringAlignmentCenter);
fmt.SetLineAlignment(StringAlignmentCenter);
RectF rf((REAL)r.X, (REAL)r.Y, (REAL)r.Width, (REAL)r.Height);
SolidBrush text_brush(text_color);
g.DrawString(btn.text.c_str(), -1, &font, rf, &fmt, &text_brush);
}
void OnPaint(HWND hwnd) {
PAINTSTRUCT ps;
HDC hdc = BeginPaint(hwnd, &ps);
RECT rc;
GetClientRect(hwnd, &rc);
const int w = rc.right - rc.left;
const int h = rc.bottom - rc.top;
HDC mem_dc = CreateCompatibleDC(hdc);
HBITMAP mem_bm = CreateCompatibleBitmap(hdc, w, h);
HBITMAP old_bm = (HBITMAP)SelectObject(mem_dc, mem_bm);
{
Graphics g(mem_dc);
g.SetInterpolationMode(InterpolationModeHighQualityBicubic);
g.SetSmoothingMode(SmoothingModeAntiAlias);
g.SetTextRenderingHint(TextRenderingHintClearTypeGridFit);
// Background banner — fill window.
if (g_banner_bitmap) {
UINT bw = g_banner_bitmap->GetWidth();
UINT bh = g_banner_bitmap->GetHeight();
// Scale to fill window preserving aspect (cover).
float scale = (float)w / (float)bw;
float scale_h = (float)h / (float)bh;
if (scale_h > scale) scale = scale_h;
int dw = (int)(bw * scale);
int dh = (int)(bh * scale);
int dx = (w - dw) / 2;
int dy = (h - dh) / 2;
g.DrawImage(g_banner_bitmap.get(), dx, dy, dw, dh);
} else {
SolidBrush bg(Color(255, 12, 14, 18));
g.FillRectangle(&bg, 0, 0, w, h);
}
// Soft darkening only at very bottom for button area, smooth fade.
LinearGradientBrush grad(Point(0, h - 80), Point(0, h),
Color(0, 0, 0, 0), Color(160, 0, 0, 0));
g.FillRectangle(&grad, 0, h - 80, w, 80);
// Logo — top-left, large, above "HE HAS TO PAY" graffiti.
if (g_logo_bitmap) {
UINT lw = g_logo_bitmap->GetWidth();
UINT lh = g_logo_bitmap->GetHeight();
const int target_w = (int)(w * 0.42f); // ~540 px at 1280-wide window
float scale = (float)target_w / (float)lw;
int dw = (int)(lw * scale);
int dh = (int)(lh * scale);
int dx = (int)(w * 0.04f); // ~50 px from left
int dy = (int)(h * 0.06f); // ~45 px from top
g.DrawImage(g_logo_bitmap.get(), dx, dy, dw, dh);
}
// Bottom-left hint.
{
auto ff = MakeFontFamilyWithFallback({L"Segoe UI", L"Tahoma", L"Arial"});
Font font(ff.get(), 14, FontStyleRegular, UnitPixel);
SolidBrush brush(Color(200, 220, 220, 220));
std::wstring hint = TrW("D-Pad: Select Option A: Confirm");
g.DrawString(hint.c_str(), -1, &font,
PointF(20.0f, (REAL)(h - 32)), &brush);
}
// Top-right corner: small version label.
{
auto ff = MakeFontFamilyWithFallback({L"Segoe UI", L"Tahoma", L"Arial"});
Font font(ff.get(), 12, FontStyleRegular, UnitPixel);
SolidBrush brush(Color(150, 200, 200, 200));
StringFormat fmt;
fmt.SetAlignment(StringAlignmentFar);
RectF rf(0.0f, 12.0f, (REAL)w - 20.0f, 20.0f);
std::wstring corner_text =
std::wstring(L"DPLauncher ") + kLauncherVersion + L" — github.com/LittleBitUA/DPRecomp";
g.DrawString(corner_text.c_str(),
-1, &font, rf, &fmt, &brush);
}
// Buttons (with the update banner painted via a separate pill renderer).
for (size_t i = 0; i < g_buttons.size(); ++i) {
const bool focused = (int)i == g_focused_button;
if (g_buttons[i].id == kBtnUpdate) {
DrawUpdateBanner(g, g_buttons[i], focused);
} else {
DrawButton(g, g_buttons[i], focused);
}
}
}
BitBlt(hdc, 0, 0, w, h, mem_dc, 0, 0, SRCCOPY);
SelectObject(mem_dc, old_bm);
DeleteObject(mem_bm);
DeleteDC(mem_dc);
EndPaint(hwnd, &ps);
}
bool PointInRect(int x, int y, const RECT& r) {
return x >= r.left && x < r.right && y >= r.top && y < r.bottom;
}
// Shared dark background brush for the update dialogs (was also used by the
// Downpour ISO-extraction dialog, which this launcher no longer has).
static HBRUSH g_extract_bg_brush = nullptr;
// PLAY: verify the extracted game data is present, then start the runtime.
// Deadly Premonition has no title update and this launcher ships no ISO
// installer — the user copies the extracted game files into assets/ by hand.
void LaunchGame(HWND hwnd) {
std::wstring exe_dir = GetExeDir();
std::wstring marker = exe_dir + L"\\assets\\default.xex";
// No game data yet: start the game anyway - its built-in first-run installer
// asks for the user's disc image, extracts it into assets\ and then starts
// the build matching the disc region (2026-09-06; the previous "game data
// not found" error box is gone).
// Region pick (2026-09-06): the PAL and USA discs ship different executables,
// so the release carries two recompiled builds. Choose by the size of the
// user's default.xex (PAL 10,113,024 bytes; USA 10,080,256 bytes). Unknown
// sizes fall back to the PAL build, which also hosts the first-run installer.
std::wstring exe = exe_dir + L"\\" + kGameExeName;
{
WIN32_FILE_ATTRIBUTE_DATA fad{};
if (GetFileAttributesExW(marker.c_str(), GetFileExInfoStandard, &fad)) {
const unsigned long long size =
(static_cast<unsigned long long>(fad.nFileSizeHigh) << 32) | fad.nFileSizeLow;
if (size == 10080256ull) {
std::wstring usa = exe_dir + L"\\deadlyprem_usa.exe";
if (GetFileAttributesW(usa.c_str()) != INVALID_FILE_ATTRIBUTES) {
exe = usa;
}
}
}
}
std::wstring args = L"--game_data_root assets";
std::wstring cmdline = L"\"" + exe + L"\" " + args;
// v1.1 (DPRecomp #13): optional Steam overlay opt-out for users who added
// the launcher to Steam. The child inherits our environment.
{
ReadLauncherIni();
auto it = g_launcher_ini.find("launcher_steam_overlay");
if (it != g_launcher_ini.end() && it->second == "off") {
SetEnvironmentVariableW(L"SteamNoOverlayUIDrawing", L"1");
}
}
STARTUPINFOW si = {sizeof(si)};
PROCESS_INFORMATION pi = {};
std::vector<wchar_t> cmd_buf(cmdline.begin(), cmdline.end());
cmd_buf.push_back(0);
if (CreateProcessW(exe.c_str(), cmd_buf.data(), nullptr, nullptr, FALSE,
0, nullptr, exe_dir.c_str(), &si, &pi)) {
CloseHandle(pi.hThread);
CloseHandle(pi.hProcess);
PostMessage(hwnd, WM_CLOSE, 0, 0);
} else {
MessageBoxW(hwnd,
TrC("Failed to launch deadlyprem.exe.\nMake sure it exists next to PlayDeadlyPremonition.exe."),
kWindowTitle, MB_ICONERROR | MB_OK);
}
}
void OpenSettings(HWND hwnd);
static void RunUpdateFlow(HWND hwnd);
void HandleButton(HWND hwnd, int id) {
switch (id) {
case kBtnPlay:
LaunchGame(hwnd);
break;
case kBtnSettings:
OpenSettings(hwnd);
break;
case kBtnExit:
PostMessage(hwnd, WM_CLOSE, 0, 0);
break;
case kBtnUpdate:
RunUpdateFlow(hwnd);
break;
}
}
LRESULT CALLBACK WndProc(HWND hwnd, UINT msg, WPARAM wp, LPARAM lp) {
switch (msg) {
case WM_CREATE: {
RECT rc;
GetClientRect(hwnd, &rc);
LayoutButtons(rc.right - rc.left, rc.bottom - rc.top);
return 0;
}
case WM_SIZE: {
LayoutButtons(LOWORD(lp), HIWORD(lp));
InvalidateRect(hwnd, nullptr, FALSE);
return 0;
}
// Posted by ProbeReleaseAsync when a newer GitHub release is found.
// Re-runs LayoutButtons on the UI thread so the update banner button
// gets appended to g_buttons before the next WM_PAINT.
case WM_APP + 0: {
RECT rc;
GetClientRect(hwnd, &rc);
LayoutButtons(rc.right - rc.left, rc.bottom - rc.top);
InvalidateRect(hwnd, nullptr, TRUE);
return 0;
}
case WM_ERASEBKGND:
return 1;
case WM_PAINT:
OnPaint(hwnd);
return 0;
case WM_MOUSEMOVE: {
int x = GET_X_LPARAM(lp);
int y = GET_Y_LPARAM(lp);
bool any_change = false;
for (auto& b : g_buttons) {
bool h = PointInRect(x, y, b.rect);
if (h != b.hovered) {
b.hovered = h;
any_change = true;
}
}
if (any_change) InvalidateRect(hwnd, nullptr, FALSE);
TRACKMOUSEEVENT tme = {sizeof(tme), TME_LEAVE, hwnd, 0};
TrackMouseEvent(&tme);
return 0;
}
case WM_MOUSELEAVE: {
for (auto& b : g_buttons) b.hovered = false;
InvalidateRect(hwnd, nullptr, FALSE);
return 0;
}
case WM_LBUTTONDOWN: {
int x = GET_X_LPARAM(lp);
int y = GET_Y_LPARAM(lp);
for (auto& b : g_buttons) {
if (PointInRect(x, y, b.rect)) {
b.pressed = true;
SetCapture(hwnd);
InvalidateRect(hwnd, nullptr, FALSE);
return 0;
}
}
return 0;
}
case WM_LBUTTONUP: {
int x = GET_X_LPARAM(lp);
int y = GET_Y_LPARAM(lp);
ReleaseCapture();
int clicked = 0;
for (auto& b : g_buttons) {
bool was = b.pressed;
b.pressed = false;
if (was && PointInRect(x, y, b.rect)) clicked = b.id;
}
InvalidateRect(hwnd, nullptr, FALSE);
if (clicked) HandleButton(hwnd, clicked);
return 0;
}
case WM_KEYDOWN: {
if (wp == VK_LEFT || wp == VK_UP) {
g_focused_button = (g_focused_button + (int)g_buttons.size() - 1) % (int)g_buttons.size();
InvalidateRect(hwnd, nullptr, FALSE);
} else if (wp == VK_RIGHT || wp == VK_DOWN || wp == VK_TAB) {
g_focused_button = (g_focused_button + 1) % (int)g_buttons.size();
InvalidateRect(hwnd, nullptr, FALSE);
} else if (wp == VK_RETURN || wp == VK_SPACE) {
if (g_focused_button >= 0 && g_focused_button < (int)g_buttons.size()) {
HandleButton(hwnd, g_buttons[g_focused_button].id);
}
} else if (wp == VK_ESCAPE) {
PostMessage(hwnd, WM_CLOSE, 0, 0);
}
return 0;
}
case WM_DESTROY:
PostQuitMessage(0);
return 0;
}
return DefWindowProcW(hwnd, msg, wp, lp);
}
// ===== Settings dialog =====
// Simple cvar list editor for deadlyprem.toml.
enum CvarCategory {
kCatGraphics = 0,
kCatAdvanced = 1,
kCatMouse = 2,
kCatControls = 3,
kCatDebug = 4,
// Auto-managed cvars not surfaced in the Settings UI. Saved/loaded
// alongside the rest, but never get a label or control built for them.
kCatHidden = 5,
};
struct CvarRow {
std::string key;
std::string display_name;
std::string description;
enum Kind { kBool, kInt, kFloat, kString, kEnum } kind;
std::string value;
CvarCategory category = kCatGraphics;
// For ints / floats:
double min_val = 0;