Commit Graph
9 Commits
Author SHA1 Message Date
l 0761320177 Settings: a buffer path through the interface, and the first Config field
Pcsx2Config's strings do not terminate in Pcsx2Config.cpp. They run
through two abstract interfaces:

  FilenameOptions::Bios (std::string)
    -> SettingsWrapper::Entry(..., std::string&)         2 impls
      -> SettingsInterface::GetStringValue(std::string*) 2 impls

So the conversion starts at the bottom, as it had to in IopBios:
SettingsInterface gains GetStringValueBuf and SettingsWrapper gains
EntryBuf, both implemented in both of their subclasses
(MemorySettingsInterface / LayeredSettingsInterface, load / save).
With those in place the Config fields become mechanical.

GetStringValueBuf reports out_len -- the length the value actually had
-- so a caller can tell truncation from a short value. That is the
failure this whole area risks: a path cut at a buffer boundary is
silent, and nothing downstream can distinguish it from the user having
typed something short.

FilenameOptions::Bios is the first field converted. Its constructor
now zeroes the buffer explicitly, because a char array has no default
constructor and std::string did -- an uninitialised settings field
would read as garbage rather than as empty.

Verified with the round trip added in the previous commit: 14 cases, 0
failing, matching the pre-change baseline, including paths of exactly
64, 128, 255, 256, 511, 512 and 1024 bytes. Then the usual: BIOS still
found and identified at boot, Tekken from .cue, .cso and .chd at 1150
frame hashes each identical to baseline, savestate replay matching at
head[554], audio hash identical, gates 36/36. Both build systems, both
configurations.

The remaining Config fields -- Adapter, EthDevice, HddFile,
GzipIsoIndexTemplate, CurrentIRX, CurrentGameArgs, Mcd[].Filename --
are the same change repeated, each gated by the same round trip.
2026-08-23 00:27:56 +02:00
LibretroAdmin 11eb13d2ee pcsx2, common, libretro-common: include what we use
Dropping fast_float from StringUtil.h shrank the include graph every TU
in its closure had been leaning on, and GCC 16.2's leaner libstdc++
surfaced the reliance as build failures (GameDatabase.cpp, IopBios.cpp
on MinGW). Swept the whole closure -- 29 TUs and the 185 project headers
they pull -- for symbols resolved only through std-header transitivity,
and gave every file its own includes: <algorithm> and <utility> where
std::find/none_of/move live, <cmath> in the GSVector umbrella for the
sqrtf its fragments use, <system_error> in StringUtil.h for std::errc,
<cerrno>, <iterator>, <cstring> where named, and <string.h> in
retro_miscellaneous.h so the BIT*_CLEAR_ALL macros expand anywhere.
PRI_SIZET stays as-is: inttypes.h is the expansion site's include, and
MSVC 2005 has no such header.

Verified with a full pcsx2_libretro.so rebuild, the failing objects
through the Makefile path, the 36-TU emitter gate, and C89 checks on
the touched C header.
2026-08-22 12:14:13 +02:00
LibretroAdmin 694cdace20 move to mostly relative paths 2025-01-18 23:43:58 +01:00
libretroadmin a80a735819 Simplifications - HeterogeneousContainers/MemorySettingsInterface 2024-05-01 03:15:07 +02:00
libretroadmin 7bbba2f42f Cut down on SettingsInterface 2024-04-25 22:55:19 +02:00
libretroadmin f1a91be91f Slim down common code - Timer/LRUCache/etc 2024-04-10 02:39:12 +02:00
libretroadmin ace3d6e765 Clean SettingsInterface 2024-04-10 02:25:22 +02:00
Connor McLaughlin 509be0b3f8 MemorySettingsInterface: Add {Set,Get}KeyValueList 2022-12-23 07:24:32 +01:00
Connor McLaughlin e7c4894833 Common: Add MemorySettingsInterface 2022-10-20 19:43:29 +01:00