SettingsInterface was a base class with five pure-virtual config-getter
methods, defined in core/settings.h. There has only ever been one
concrete subclass: LibretroSettingsInterface (in libretro/), which
backs every GetXxxValue call with a single retro_environment_callback
to RETRO_ENVIRONMENT_GET_VARIABLE.
The single-impl shape means every si.GetBoolValue / si.GetIntValue /
si.GetStringValue call in Settings::Load and elsewhere goes through a
vtable indirection that resolves to exactly one place. Settings::Load
issues 61 such calls, and runs at boot plus on every libretro
core-options change. The cost per call is small (~2 ns per virtual
dispatch on modern CPUs), so the wall-clock saving is modest, but
the abstraction itself buys nothing - there is no second
implementation, no plan to add one (the core target is libretro-only),
and no use case where the indirection would help.
Drop the base class:
- Remove 'class SettingsInterface' from core/settings.h, along with
its virtual destructor and five pure virtuals.
- Remove the SettingsInterface destructor definition from
core/settings.cpp.
- Make LibretroSettingsInterface a plain class with non-virtual
methods (drop the 'override' keyword and the public-inheritance
base).
- Change Settings::Load's signature from (SettingsInterface&) to
(LibretroSettingsInterface&). The one caller already passes a
LibretroSettingsInterface, so no call site needs to change.
- Forward-declare LibretroSettingsInterface in core/settings.h
(the type only appears as a reference in Load's signature) and
include the libretro header from settings.cpp where the
member function calls actually have to see the definition.
The forward-declaration plus include-from-cpp pattern keeps
core/settings.h free of libretro headers - a header-level layering
nicety. The cpp-level dependency is an existing pattern (multiple
core/ TUs already include libretro/ headers - gpu_hw_d3d11.cpp,
gpu_hw_opengl.cpp, gpu_hw_vulkan.cpp, texture_replacements.cpp).
Linux x64 build still warning-clean. .so size drops from 8048432
to 8047800 bytes (-632) from removing the SettingsInterface vtable,
its typeinfo, the virtual destructor, and the indirect-call sites
in Settings::Load. 25 retro_* exports unchanged. Behaviour is
identical (same calls, same arguments, just direct now).
- Fix missing break in DoCDROMAccess.
- Fix missing include for va_list and change to std::va_list.
- Fix missing initializer for VkClearDepthStencilValue.
Improvements:
- Replace all enum constants with constexpr constants.
- Replace LOGLEVEL enum with an enum class.
- Remove some unused variables.
- Remove redundant const in some methods.
- Prefer using std::numeric_limits.
- Fix some missing initializers.
This uses the chd_precache() function of libchdr which just loads the
CHD image to memory without decompressing it. So this is "weaker" than
the full preload to RAM option, which fully decompresses the CHD image,
but it still solves the problem of having the CHD images stored on
unreliable network storage. It's also much faster, since CHDs are quite
slow to decompress in whole.
The main point of this is to be able to use M3U files to run multi-disc
games and still be able to work around unreliable storage. The full
preload to RAM option does not work with M3U files. This option does.
CHD precache is ignored (and the option disabled in the UI) if the full
preload to RAM option is enabled.