libretro: Add compatibility settings loading

This commit is contained in:
Connor McLaughlin
2020-11-27 15:42:22 +10:00
parent b16e639f0c
commit 859f23f4d5
11 changed files with 767 additions and 26 deletions

View File

@ -1,4 +1,6 @@
add_library(frontend-common
game_settings.cpp
game_settings.h
opengl_host_display.cpp
opengl_host_display.h
vulkan_host_display.cpp
@ -42,8 +44,6 @@ if(NOT BUILD_LIBRETRO_CORE)
cubeb_audio_stream.h
game_list.cpp
game_list.h
game_settings.cpp
game_settings.h
icon.cpp
icon.h
imgui_styles.cpp

View File

@ -11,10 +11,12 @@
#include <utility>
Log_SetChannel(GameSettings);
#ifndef LIBRETRO
#ifdef WIN32
#include "common/windows_headers.h"
#endif
#include "SimpleIni.h"
#endif
namespace GameSettings {
@ -173,6 +175,8 @@ bool Entry::SaveToStream(ByteStream* stream) const
WriteStringToStream(stream, memory_card_2_shared_path) && WriteStringToStream(stream, input_profile_name);
}
#ifndef LIBRETRO
static void ParseIniSection(Entry* entry, const char* section, const CSimpleIniA& ini)
{
for (u32 trait = 0; trait < static_cast<u32>(Trait::Count); trait++)
@ -467,6 +471,8 @@ void Database::SetEntry(const std::string& code, const std::string& name, const
m_entries.emplace(code, entry);
}
#endif
void Entry::ApplySettings(bool display_osd_messages) const
{
constexpr float osd_duration = 10.0f;

View File

@ -82,6 +82,8 @@ struct Entry
void ApplySettings(bool display_osd_messages) const;
};
#ifndef LIBRETRO
class Database
{
public:
@ -97,4 +99,6 @@ private:
std::unordered_map<std::string, Entry> m_entries;
};
#endif
}; // namespace GameSettings