Commit Graph

23 Commits

Author SHA1 Message Date
Léo Lam 05c8d229af Config: Handle unknown system strings better
Currently, a simple typo in the system name will trigger an assert
message that complains about a "programming error". This is not
user friendly and misleading.

So this changes GetSystemFromName to return an std::optional, which
allows for callers to check whether the system exists and handle
failures better.
2017-11-26 18:24:01 +01:00
MerryMage 37419b9a57 Config/Layer: Allow all keys of a section to be iterated over 2017-11-15 18:04:40 +00:00
MerryMage 4c24629b95 Config: Flatten structures
Originally, Layer contained a std::map of Sections, which containted a std::map
containing the (key, value) pairs. Here we flattern this structure so that only
one std::map is required, reducing the number of indirections required and
vastly simplifying the code.
2017-11-15 18:04:40 +00:00
MerryMage e331a76176 ConfigInfo: Switch to doing case-insensitive comparison 2017-11-15 18:04:40 +00:00
MerryMage ec7b84c5f2 Config: Extract ConfigInfo into own header 2017-11-15 18:04:40 +00:00
MerryMage c8f970e2b0 Config: Remove recursive layer 2017-11-15 18:04:40 +00:00
Léo Lam 940cc843ed Config: Fix Movie config loading/saving
* Add missing Language setting loading/saving. This was added after the
  original OnionConfig PR, which is why support for it was missing.

* Change MovieConfigLoader to reuse ConfigInfos. Less duplication.

* Extract MovieConfigLoader::Save into SaveToDTM. The DTM should use
  the current config and not just the movie layer. This makes more
  sense than just saving the movie layer, which may not always exist,
  and also fixes a crash that would happen when creating a new
  recording because the movie layer wouldn't exist in that case.

  (Plus, having to get the loader from the layer and call ChangeDTM
  on it manually is not very pretty.)
2017-08-11 15:36:32 +08:00
Léo Lam b2c41cec0a Config: Include SYSCONF in base layer
Settings that come from the SYSCONF are now included in Dolphin's
config system as part of the base layer. They are handled in a
special way compared to other settings to make sure they are only
loaded from and saved to the SYSCONF (to avoid different, possibly
contradicting sources of truth).
2017-08-11 15:36:31 +08:00
Léo Lam c900e77ac5 Config: Add Get/Set on Layer
For convenience, when getting/setting from ConfigInfos.
2017-08-11 15:28:11 +08:00
Michael M 7d509a7a94 Config/Section: support u16 values 2017-08-03 13:16:16 -07:00
MerryMage 31ec3e2501 Config: Missed a line in #5770 2017-08-01 18:07:53 +01:00
Léo Lam f5fd183571 Config: Fix the loader Load() being called twice
The Config::AddLoadLayer functions call Load on the layer
explicitly, but Load is already called in the constructor,
so they'd cause the loader's Load function to be called twice,
which is potentially expensive considering we have to read an INI
from the host filesystem.

This commit removes the Config::AddLoadLayer functions because
they don't appear to be necessary.
2017-07-31 22:32:05 +08:00
Michael Maltese 8b54ac225b Merge Core/Config/Config.h into Common/Config/Config.h
Allows code in Common to take advantage of the layered config logic.
2017-07-09 16:28:54 -07:00
Léo Lam 90f8265497 Replace StringFromInt with std::to_string
Updated version of #47. Android should support to_string now that
we use a modern version of libc++ when building.
2017-07-05 13:49:33 +02:00
MerryMage 33879bf611 Config: Remove creation of unnecessary CommandLine layer 2017-06-10 19:07:17 +01:00
Shawn Hoffman fd166032ab msbuild: obey some warnings about missing virtual destructors 2017-06-07 20:20:25 -07:00
MerryMage 1e766ab490 Config: Add layers CommandLine and CurrentRun 2017-06-03 18:11:57 +01:00
MerryMage 1548a15c68 Config: Implement Get and Set 2017-06-03 18:11:56 +01:00
MerryMage 6151bc1714 Config: Extract layer search order to header 2017-06-03 18:11:56 +01:00
MerryMage bd3e493695 Section: Fix Section::Get 2017-05-13 15:22:29 +01:00
Léo Lam 6185933d18 Config: Fix a formatting issue
Not sure why clang-format did not catch this on the lint builder, but
it definitely doesn't like the lines being too long here.
2017-05-10 17:56:09 +02:00
MerryMage 32d9428171 Config/Layer: Fix accidental cast of RecursiveSection to Section 2017-05-09 00:17:00 +01:00
Léo Lam 88a21dd2b9 Fix things mentioned during code review
Ref: https://github.com/dolphin-emu/dolphin/pull/4917
2017-02-23 18:15:12 +01:00