diff options
| author | Jan Trencansky <jan.trencansky@protonmail.com> | 2026-11-24 20:53:47 -0500 |
|---|---|---|
| committer | Jan Trencansky <jan.trencansky@protonmail.com> | 2026-11-24 20:53:47 -0500 |
| commit | 0ce9f8992cedaa1e9f7668c34b1a04b15eca4770 (patch) | |
| tree | d0ef1b7ebb2c6fd0a9df82b0c7f2bb354a92d703 /runtime/src/main.cpp | |
| parent | b25da08cb64ff20c8e7874de7e370b725b18b2a4 (diff) | |
first-run-ui: a variable that is set but empty does not count as the caller's setting
run_tiny_first_run_ui clears two variables by passing them empty. Windows cannot hold an empty variable, so there they are unset; under Wine they exist, and the profile's size-only query reported them as set and kept them. The test failed that way on #939's head too. The profile now reads the first character, so an empty value gets the profile's default on both.
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Diffstat (limited to 'runtime/src/main.cpp')
| -rw-r--r-- | runtime/src/main.cpp | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/runtime/src/main.cpp b/runtime/src/main.cpp index a870cb814..8e3767740 100644 --- a/runtime/src/main.cpp +++ b/runtime/src/main.cpp | |||
| @@ -163,8 +163,11 @@ extern "C" __declspec(allocate(".CRT$XCT")) void(__cdecl* const gta6rt_reserve_t | |||
| 163 | 163 | ||
| 164 | // Select the settings used to display the offline first-run UI. Keep explicit caller settings. | 164 | // Select the settings used to display the offline first-run UI. Keep explicit caller settings. |
| 165 | bool configure_first_run_ui(const std::filesystem::path& package, std::filesystem::path& overlay) { | 165 | bool configure_first_run_ui(const std::filesystem::path& package, std::filesystem::path& overlay) { |
| 166 | // A variable that is set but empty is not a setting: Windows cannot hold one, but a caller on Wine can pass one | ||
| 167 | // (NAME= in the environment), and asking for the size alone reports it as present there. | ||
| 166 | const auto set_default = [](const wchar_t* name, const wchar_t* value) { | 168 | const auto set_default = [](const wchar_t* name, const wchar_t* value) { |
| 167 | return GetEnvironmentVariableW(name, nullptr, 0) != 0 || _wputenv_s(name, value) == 0; | 169 | wchar_t first[2]{}; |
| 170 | return GetEnvironmentVariableW(name, first, 2) != 0 || _wputenv_s(name, value) == 0; | ||
| 168 | }; | 171 | }; |
| 169 | const struct { const wchar_t* name; const wchar_t* value; } settings[] = { | 172 | const struct { const wchar_t* name; const wchar_t* value; } settings[] = { |
| 170 | {L"LEONIDA_D3D12", L"vulkan"}, {L"LEONIDA_ARENA_MB", L"2048"}, | 173 | {L"LEONIDA_D3D12", L"vulkan"}, {L"LEONIDA_ARENA_MB", L"2048"}, |