mirror of
https://github.com/RetroDECK/Duckstation.git
synced 2025-01-17 22:25:37 +00:00
SDL: Move SDLSettingsInterface (ini) to frontend-common
This commit is contained in:
parent
9ab5212833
commit
bbdee22ea8
|
@ -6,12 +6,10 @@ add_executable(duckstation-sdl
|
||||||
opengl_host_display.h
|
opengl_host_display.h
|
||||||
sdl_host_interface.cpp
|
sdl_host_interface.cpp
|
||||||
sdl_host_interface.h
|
sdl_host_interface.h
|
||||||
sdl_settings_interface.cpp
|
|
||||||
sdl_settings_interface.h
|
|
||||||
)
|
)
|
||||||
|
|
||||||
target_include_directories(duckstation-sdl PRIVATE ${SDL2_INCLUDE_DIRS})
|
target_include_directories(duckstation-sdl PRIVATE ${SDL2_INCLUDE_DIRS})
|
||||||
target_link_libraries(duckstation-sdl PRIVATE core common imgui nativefiledialog glad simpleini frontend-common ${SDL2_LIBRARIES})
|
target_link_libraries(duckstation-sdl PRIVATE core common imgui nativefiledialog glad frontend-common ${SDL2_LIBRARIES})
|
||||||
|
|
||||||
if(WIN32)
|
if(WIN32)
|
||||||
target_sources(duckstation-sdl PRIVATE
|
target_sources(duckstation-sdl PRIVATE
|
||||||
|
|
|
@ -57,14 +57,12 @@
|
||||||
<ClCompile Include="opengl_host_display.cpp" />
|
<ClCompile Include="opengl_host_display.cpp" />
|
||||||
<ClCompile Include="sdl_host_interface.cpp" />
|
<ClCompile Include="sdl_host_interface.cpp" />
|
||||||
<ClCompile Include="main.cpp" />
|
<ClCompile Include="main.cpp" />
|
||||||
<ClCompile Include="sdl_settings_interface.cpp" />
|
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ClInclude Include="d3d11_host_display.h" />
|
<ClInclude Include="d3d11_host_display.h" />
|
||||||
<ClInclude Include="imgui_impl_sdl.h" />
|
<ClInclude Include="imgui_impl_sdl.h" />
|
||||||
<ClInclude Include="opengl_host_display.h" />
|
<ClInclude Include="opengl_host_display.h" />
|
||||||
<ClInclude Include="sdl_host_interface.h" />
|
<ClInclude Include="sdl_host_interface.h" />
|
||||||
<ClInclude Include="sdl_settings_interface.h" />
|
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Manifest Include="duckstation-sdl.manifest" />
|
<Manifest Include="duckstation-sdl.manifest" />
|
||||||
|
|
|
@ -5,14 +5,12 @@
|
||||||
<ClCompile Include="opengl_host_display.cpp" />
|
<ClCompile Include="opengl_host_display.cpp" />
|
||||||
<ClCompile Include="sdl_host_interface.cpp" />
|
<ClCompile Include="sdl_host_interface.cpp" />
|
||||||
<ClCompile Include="d3d11_host_display.cpp" />
|
<ClCompile Include="d3d11_host_display.cpp" />
|
||||||
<ClCompile Include="sdl_settings_interface.cpp" />
|
|
||||||
<ClCompile Include="imgui_impl_sdl.cpp" />
|
<ClCompile Include="imgui_impl_sdl.cpp" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ClInclude Include="opengl_host_display.h" />
|
<ClInclude Include="opengl_host_display.h" />
|
||||||
<ClInclude Include="sdl_host_interface.h" />
|
<ClInclude Include="sdl_host_interface.h" />
|
||||||
<ClInclude Include="d3d11_host_display.h" />
|
<ClInclude Include="d3d11_host_display.h" />
|
||||||
<ClInclude Include="sdl_settings_interface.h" />
|
|
||||||
<ClInclude Include="imgui_impl_sdl.h" />
|
<ClInclude Include="imgui_impl_sdl.h" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
|
|
@ -9,11 +9,11 @@
|
||||||
#include "core/system.h"
|
#include "core/system.h"
|
||||||
#include "frontend-common/icon.h"
|
#include "frontend-common/icon.h"
|
||||||
#include "frontend-common/imgui_styles.h"
|
#include "frontend-common/imgui_styles.h"
|
||||||
|
#include "frontend-common/ini_settings_interface.h"
|
||||||
#include "frontend-common/sdl_audio_stream.h"
|
#include "frontend-common/sdl_audio_stream.h"
|
||||||
#include "frontend-common/sdl_controller_interface.h"
|
#include "frontend-common/sdl_controller_interface.h"
|
||||||
#include "imgui_impl_sdl.h"
|
#include "imgui_impl_sdl.h"
|
||||||
#include "opengl_host_display.h"
|
#include "opengl_host_display.h"
|
||||||
#include "sdl_settings_interface.h"
|
|
||||||
#include <cinttypes>
|
#include <cinttypes>
|
||||||
#include <cmath>
|
#include <cmath>
|
||||||
#include <imgui.h>
|
#include <imgui.h>
|
||||||
|
@ -268,7 +268,7 @@ void SDLHostInterface::RunLater(std::function<void()> callback)
|
||||||
|
|
||||||
void SDLHostInterface::SaveSettings()
|
void SDLHostInterface::SaveSettings()
|
||||||
{
|
{
|
||||||
SDLSettingsInterface si(GetSettingsFileName().c_str());
|
INISettingsInterface si(GetSettingsFileName().c_str());
|
||||||
m_settings_copy.Save(si);
|
m_settings_copy.Save(si);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -296,7 +296,7 @@ std::unique_ptr<SDLHostInterface> SDLHostInterface::Create()
|
||||||
std::unique_ptr<SDLHostInterface> intf = std::make_unique<SDLHostInterface>();
|
std::unique_ptr<SDLHostInterface> intf = std::make_unique<SDLHostInterface>();
|
||||||
|
|
||||||
// Settings need to be loaded prior to creating the window for OpenGL bits.
|
// Settings need to be loaded prior to creating the window for OpenGL bits.
|
||||||
SDLSettingsInterface si(intf->GetSettingsFileName().c_str());
|
INISettingsInterface si(intf->GetSettingsFileName().c_str());
|
||||||
intf->m_settings_copy.Load(si);
|
intf->m_settings_copy.Load(si);
|
||||||
intf->m_settings = intf->m_settings_copy;
|
intf->m_settings = intf->m_settings_copy;
|
||||||
intf->m_fullscreen = intf->m_settings_copy.display_fullscreen;
|
intf->m_fullscreen = intf->m_settings_copy.display_fullscreen;
|
||||||
|
|
|
@ -5,6 +5,8 @@ add_library(frontend-common
|
||||||
icon.h
|
icon.h
|
||||||
imgui_styles.cpp
|
imgui_styles.cpp
|
||||||
imgui_styles.h
|
imgui_styles.h
|
||||||
|
ini_settings_interface.cpp
|
||||||
|
ini_settings_interface.h
|
||||||
)
|
)
|
||||||
|
|
||||||
if(SDL2_FOUND)
|
if(SDL2_FOUND)
|
||||||
|
@ -21,5 +23,5 @@ if(SDL2_FOUND)
|
||||||
target_link_libraries(frontend-common PRIVATE ${SDL2_LIBRARIES})
|
target_link_libraries(frontend-common PRIVATE ${SDL2_LIBRARIES})
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
target_link_libraries(frontend-common PRIVATE core common imgui)
|
target_link_libraries(frontend-common PRIVATE core common imgui simpleini)
|
||||||
|
|
||||||
|
|
|
@ -44,11 +44,21 @@
|
||||||
<ProjectReference Include="..\..\dep\libcue\libcue.vcxproj">
|
<ProjectReference Include="..\..\dep\libcue\libcue.vcxproj">
|
||||||
<Project>{6a4208ed-e3dc-41e1-81cd-f61025fc285a}</Project>
|
<Project>{6a4208ed-e3dc-41e1-81cd-f61025fc285a}</Project>
|
||||||
</ProjectReference>
|
</ProjectReference>
|
||||||
|
<ProjectReference Include="..\..\dep\simpleini\simpleini.vcxproj">
|
||||||
|
<Project>{3773f4cc-614e-4028-8595-22e08ca649e3}</Project>
|
||||||
|
</ProjectReference>
|
||||||
|
<ProjectReference Include="..\common\common.vcxproj">
|
||||||
|
<Project>{ee054e08-3799-4a59-a422-18259c105ffd}</Project>
|
||||||
|
</ProjectReference>
|
||||||
|
<ProjectReference Include="..\core\core.vcxproj">
|
||||||
|
<Project>{868b98c8-65a1-494b-8346-250a73a48c0a}</Project>
|
||||||
|
</ProjectReference>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ClCompile Include="common_host_interface.cpp" />
|
<ClCompile Include="common_host_interface.cpp" />
|
||||||
<ClCompile Include="icon.cpp" />
|
<ClCompile Include="icon.cpp" />
|
||||||
<ClCompile Include="imgui_styles.cpp" />
|
<ClCompile Include="imgui_styles.cpp" />
|
||||||
|
<ClCompile Include="ini_settings_interface.cpp" />
|
||||||
<ClCompile Include="sdl_audio_stream.cpp" />
|
<ClCompile Include="sdl_audio_stream.cpp" />
|
||||||
<ClCompile Include="sdl_controller_interface.cpp" />
|
<ClCompile Include="sdl_controller_interface.cpp" />
|
||||||
<ClCompile Include="sdl_initializer.cpp" />
|
<ClCompile Include="sdl_initializer.cpp" />
|
||||||
|
@ -57,6 +67,7 @@
|
||||||
<ClInclude Include="common_host_interface.h" />
|
<ClInclude Include="common_host_interface.h" />
|
||||||
<ClInclude Include="icon.h" />
|
<ClInclude Include="icon.h" />
|
||||||
<ClInclude Include="imgui_styles.h" />
|
<ClInclude Include="imgui_styles.h" />
|
||||||
|
<ClInclude Include="ini_settings_interface.h" />
|
||||||
<ClInclude Include="sdl_audio_stream.h" />
|
<ClInclude Include="sdl_audio_stream.h" />
|
||||||
<ClInclude Include="sdl_controller_interface.h" />
|
<ClInclude Include="sdl_controller_interface.h" />
|
||||||
<ClInclude Include="sdl_initializer.h" />
|
<ClInclude Include="sdl_initializer.h" />
|
||||||
|
@ -205,7 +216,7 @@
|
||||||
<PreprocessorDefinitions>WITH_SDL2=1;WIN32;_DEBUG;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
<PreprocessorDefinitions>WITH_SDL2=1;WIN32;_DEBUG;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||||
<SDLCheck>true</SDLCheck>
|
<SDLCheck>true</SDLCheck>
|
||||||
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
|
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
|
||||||
<AdditionalIncludeDirectories>$(SolutionDir)dep\msvc\include\SDL;$(SolutionDir)dep\glad\include;$(SolutionDir)dep\imgui\include;$(SolutionDir)src;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
<AdditionalIncludeDirectories>$(SolutionDir)dep\msvc\include\SDL;$(SolutionDir)dep\imgui\include;$(SolutionDir)dep\simpleini\include;$(SolutionDir)src;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||||
<MultiProcessorCompilation>true</MultiProcessorCompilation>
|
<MultiProcessorCompilation>true</MultiProcessorCompilation>
|
||||||
<LanguageStandard>stdcpp17</LanguageStandard>
|
<LanguageStandard>stdcpp17</LanguageStandard>
|
||||||
<ConformanceMode>true</ConformanceMode>
|
<ConformanceMode>true</ConformanceMode>
|
||||||
|
@ -232,7 +243,7 @@
|
||||||
<PreprocessorDefinitions>WITH_SDL2=1;_ITERATOR_DEBUG_LEVEL=1;WIN32;_DEBUGFAST;_DEBUG;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
<PreprocessorDefinitions>WITH_SDL2=1;_ITERATOR_DEBUG_LEVEL=1;WIN32;_DEBUGFAST;_DEBUG;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||||
<SDLCheck>true</SDLCheck>
|
<SDLCheck>true</SDLCheck>
|
||||||
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
|
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
|
||||||
<AdditionalIncludeDirectories>$(SolutionDir)dep\msvc\include\SDL;$(SolutionDir)dep\glad\include;$(SolutionDir)dep\imgui\include;$(SolutionDir)src;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
<AdditionalIncludeDirectories>$(SolutionDir)dep\msvc\include\SDL;$(SolutionDir)dep\imgui\include;$(SolutionDir)dep\simpleini\include;$(SolutionDir)src;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||||
<BasicRuntimeChecks>Default</BasicRuntimeChecks>
|
<BasicRuntimeChecks>Default</BasicRuntimeChecks>
|
||||||
<SupportJustMyCode>false</SupportJustMyCode>
|
<SupportJustMyCode>false</SupportJustMyCode>
|
||||||
<MultiProcessorCompilation>true</MultiProcessorCompilation>
|
<MultiProcessorCompilation>true</MultiProcessorCompilation>
|
||||||
|
@ -262,7 +273,7 @@
|
||||||
<PreprocessorDefinitions>WITH_SDL2=1;WIN32;_DEBUG;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
<PreprocessorDefinitions>WITH_SDL2=1;WIN32;_DEBUG;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||||
<SDLCheck>true</SDLCheck>
|
<SDLCheck>true</SDLCheck>
|
||||||
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
|
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
|
||||||
<AdditionalIncludeDirectories>$(SolutionDir)dep\msvc\include\SDL;$(SolutionDir)dep\glad\include;$(SolutionDir)dep\imgui\include;$(SolutionDir)src;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
<AdditionalIncludeDirectories>$(SolutionDir)dep\msvc\include\SDL;$(SolutionDir)dep\imgui\include;$(SolutionDir)dep\simpleini\include;$(SolutionDir)src;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||||
<MultiProcessorCompilation>true</MultiProcessorCompilation>
|
<MultiProcessorCompilation>true</MultiProcessorCompilation>
|
||||||
<LanguageStandard>stdcpp17</LanguageStandard>
|
<LanguageStandard>stdcpp17</LanguageStandard>
|
||||||
<ConformanceMode>true</ConformanceMode>
|
<ConformanceMode>true</ConformanceMode>
|
||||||
|
@ -289,7 +300,7 @@
|
||||||
<PreprocessorDefinitions>WITH_SDL2=1;_ITERATOR_DEBUG_LEVEL=1;WIN32;_DEBUGFAST;_DEBUG;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
<PreprocessorDefinitions>WITH_SDL2=1;_ITERATOR_DEBUG_LEVEL=1;WIN32;_DEBUGFAST;_DEBUG;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||||
<SDLCheck>true</SDLCheck>
|
<SDLCheck>true</SDLCheck>
|
||||||
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
|
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
|
||||||
<AdditionalIncludeDirectories>$(SolutionDir)dep\msvc\include\SDL;$(SolutionDir)dep\glad\include;$(SolutionDir)dep\imgui\include;$(SolutionDir)src;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
<AdditionalIncludeDirectories>$(SolutionDir)dep\msvc\include\SDL;$(SolutionDir)dep\imgui\include;$(SolutionDir)dep\simpleini\include;$(SolutionDir)src;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||||
<BasicRuntimeChecks>Default</BasicRuntimeChecks>
|
<BasicRuntimeChecks>Default</BasicRuntimeChecks>
|
||||||
<SupportJustMyCode>false</SupportJustMyCode>
|
<SupportJustMyCode>false</SupportJustMyCode>
|
||||||
<MultiProcessorCompilation>true</MultiProcessorCompilation>
|
<MultiProcessorCompilation>true</MultiProcessorCompilation>
|
||||||
|
@ -320,7 +331,7 @@
|
||||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||||
<PreprocessorDefinitions>WITH_SDL2=1;WIN32;NDEBUG;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
<PreprocessorDefinitions>WITH_SDL2=1;WIN32;NDEBUG;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||||
<SDLCheck>true</SDLCheck>
|
<SDLCheck>true</SDLCheck>
|
||||||
<AdditionalIncludeDirectories>$(SolutionDir)dep\msvc\include\SDL;$(SolutionDir)dep\glad\include;$(SolutionDir)dep\imgui\include;$(SolutionDir)src;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
<AdditionalIncludeDirectories>$(SolutionDir)dep\msvc\include\SDL;$(SolutionDir)dep\imgui\include;$(SolutionDir)dep\simpleini\include;$(SolutionDir)src;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||||
<MultiProcessorCompilation>true</MultiProcessorCompilation>
|
<MultiProcessorCompilation>true</MultiProcessorCompilation>
|
||||||
<LanguageStandard>stdcpp17</LanguageStandard>
|
<LanguageStandard>stdcpp17</LanguageStandard>
|
||||||
<WholeProgramOptimization>false</WholeProgramOptimization>
|
<WholeProgramOptimization>false</WholeProgramOptimization>
|
||||||
|
@ -349,7 +360,7 @@
|
||||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||||
<PreprocessorDefinitions>WITH_SDL2=1;WIN32;NDEBUG;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
<PreprocessorDefinitions>WITH_SDL2=1;WIN32;NDEBUG;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||||
<SDLCheck>true</SDLCheck>
|
<SDLCheck>true</SDLCheck>
|
||||||
<AdditionalIncludeDirectories>$(SolutionDir)dep\msvc\include\SDL;$(SolutionDir)dep\glad\include;$(SolutionDir)dep\imgui\include;$(SolutionDir)src;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
<AdditionalIncludeDirectories>$(SolutionDir)dep\msvc\include\SDL;$(SolutionDir)dep\imgui\include;$(SolutionDir)dep\simpleini\include;$(SolutionDir)src;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||||
<OmitFramePointers>true</OmitFramePointers>
|
<OmitFramePointers>true</OmitFramePointers>
|
||||||
<MultiProcessorCompilation>true</MultiProcessorCompilation>
|
<MultiProcessorCompilation>true</MultiProcessorCompilation>
|
||||||
<LanguageStandard>stdcpp17</LanguageStandard>
|
<LanguageStandard>stdcpp17</LanguageStandard>
|
||||||
|
@ -380,7 +391,7 @@
|
||||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||||
<PreprocessorDefinitions>WITH_SDL2=1;WIN32;NDEBUG;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
<PreprocessorDefinitions>WITH_SDL2=1;WIN32;NDEBUG;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||||
<SDLCheck>true</SDLCheck>
|
<SDLCheck>true</SDLCheck>
|
||||||
<AdditionalIncludeDirectories>$(SolutionDir)dep\msvc\include\SDL;$(SolutionDir)dep\glad\include;$(SolutionDir)dep\imgui\include;$(SolutionDir)src;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
<AdditionalIncludeDirectories>$(SolutionDir)dep\msvc\include\SDL;$(SolutionDir)dep\imgui\include;$(SolutionDir)dep\simpleini\include;$(SolutionDir)src;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||||
<MultiProcessorCompilation>true</MultiProcessorCompilation>
|
<MultiProcessorCompilation>true</MultiProcessorCompilation>
|
||||||
<LanguageStandard>stdcpp17</LanguageStandard>
|
<LanguageStandard>stdcpp17</LanguageStandard>
|
||||||
<WholeProgramOptimization>false</WholeProgramOptimization>
|
<WholeProgramOptimization>false</WholeProgramOptimization>
|
||||||
|
@ -409,7 +420,7 @@
|
||||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||||
<PreprocessorDefinitions>WITH_SDL2=1;WIN32;NDEBUG;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
<PreprocessorDefinitions>WITH_SDL2=1;WIN32;NDEBUG;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||||
<SDLCheck>true</SDLCheck>
|
<SDLCheck>true</SDLCheck>
|
||||||
<AdditionalIncludeDirectories>$(SolutionDir)dep\msvc\include\SDL;$(SolutionDir)dep\glad\include;$(SolutionDir)dep\imgui\include;$(SolutionDir)src;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
<AdditionalIncludeDirectories>$(SolutionDir)dep\msvc\include\SDL;$(SolutionDir)dep\imgui\include;$(SolutionDir)dep\simpleini\include;$(SolutionDir)src;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||||
<OmitFramePointers>true</OmitFramePointers>
|
<OmitFramePointers>true</OmitFramePointers>
|
||||||
<MultiProcessorCompilation>true</MultiProcessorCompilation>
|
<MultiProcessorCompilation>true</MultiProcessorCompilation>
|
||||||
<LanguageStandard>stdcpp17</LanguageStandard>
|
<LanguageStandard>stdcpp17</LanguageStandard>
|
||||||
|
|
|
@ -7,6 +7,7 @@
|
||||||
<ClCompile Include="sdl_controller_interface.cpp" />
|
<ClCompile Include="sdl_controller_interface.cpp" />
|
||||||
<ClCompile Include="sdl_initializer.cpp" />
|
<ClCompile Include="sdl_initializer.cpp" />
|
||||||
<ClCompile Include="common_host_interface.cpp" />
|
<ClCompile Include="common_host_interface.cpp" />
|
||||||
|
<ClCompile Include="ini_settings_interface.cpp" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ClInclude Include="icon.h" />
|
<ClInclude Include="icon.h" />
|
||||||
|
@ -15,6 +16,7 @@
|
||||||
<ClInclude Include="sdl_controller_interface.h" />
|
<ClInclude Include="sdl_controller_interface.h" />
|
||||||
<ClInclude Include="sdl_initializer.h" />
|
<ClInclude Include="sdl_initializer.h" />
|
||||||
<ClInclude Include="common_host_interface.h" />
|
<ClInclude Include="common_host_interface.h" />
|
||||||
|
<ClInclude Include="ini_settings_interface.h" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<None Include="font_roboto_regular.inl" />
|
<None Include="font_roboto_regular.inl" />
|
||||||
|
|
|
@ -1,16 +1,16 @@
|
||||||
#include "sdl_settings_interface.h"
|
#include "ini_settings_interface.h"
|
||||||
#include "common/log.h"
|
#include "common/log.h"
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
Log_SetChannel(SDLSettingsInterface);
|
Log_SetChannel(INISettingsInterface);
|
||||||
|
|
||||||
SDLSettingsInterface::SDLSettingsInterface(const char* filename) : m_filename(filename), m_ini(true, true)
|
INISettingsInterface::INISettingsInterface(const char* filename) : m_filename(filename), m_ini(true, true)
|
||||||
{
|
{
|
||||||
SI_Error err = m_ini.LoadFile(filename);
|
SI_Error err = m_ini.LoadFile(filename);
|
||||||
if (err != SI_OK)
|
if (err != SI_OK)
|
||||||
Log_WarningPrintf("Settings could not be loaded from '%s', defaults will be used.", filename);
|
Log_WarningPrintf("Settings could not be loaded from '%s', defaults will be used.", filename);
|
||||||
}
|
}
|
||||||
|
|
||||||
SDLSettingsInterface::~SDLSettingsInterface()
|
INISettingsInterface::~INISettingsInterface()
|
||||||
{
|
{
|
||||||
if (m_dirty)
|
if (m_dirty)
|
||||||
{
|
{
|
||||||
|
@ -20,63 +20,63 @@ SDLSettingsInterface::~SDLSettingsInterface()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void SDLSettingsInterface::Clear()
|
void INISettingsInterface::Clear()
|
||||||
{
|
{
|
||||||
m_ini.Reset();
|
m_ini.Reset();
|
||||||
}
|
}
|
||||||
|
|
||||||
int SDLSettingsInterface::GetIntValue(const char* section, const char* key, int default_value /*= 0*/)
|
int INISettingsInterface::GetIntValue(const char* section, const char* key, int default_value /*= 0*/)
|
||||||
{
|
{
|
||||||
return static_cast<int>(m_ini.GetLongValue(section, key, default_value));
|
return static_cast<int>(m_ini.GetLongValue(section, key, default_value));
|
||||||
}
|
}
|
||||||
|
|
||||||
float SDLSettingsInterface::GetFloatValue(const char* section, const char* key, float default_value /*= 0.0f*/)
|
float INISettingsInterface::GetFloatValue(const char* section, const char* key, float default_value /*= 0.0f*/)
|
||||||
{
|
{
|
||||||
return static_cast<float>(m_ini.GetDoubleValue(section, key, default_value));
|
return static_cast<float>(m_ini.GetDoubleValue(section, key, default_value));
|
||||||
}
|
}
|
||||||
|
|
||||||
bool SDLSettingsInterface::GetBoolValue(const char* section, const char* key, bool default_value /*= false*/)
|
bool INISettingsInterface::GetBoolValue(const char* section, const char* key, bool default_value /*= false*/)
|
||||||
{
|
{
|
||||||
return m_ini.GetBoolValue(section, key, default_value);
|
return m_ini.GetBoolValue(section, key, default_value);
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string SDLSettingsInterface::GetStringValue(const char* section, const char* key,
|
std::string INISettingsInterface::GetStringValue(const char* section, const char* key,
|
||||||
const char* default_value /*= ""*/)
|
const char* default_value /*= ""*/)
|
||||||
{
|
{
|
||||||
return m_ini.GetValue(section, key, default_value);
|
return m_ini.GetValue(section, key, default_value);
|
||||||
}
|
}
|
||||||
|
|
||||||
void SDLSettingsInterface::SetIntValue(const char* section, const char* key, int value)
|
void INISettingsInterface::SetIntValue(const char* section, const char* key, int value)
|
||||||
{
|
{
|
||||||
m_dirty = true;
|
m_dirty = true;
|
||||||
m_ini.SetLongValue(section, key, static_cast<long>(value), nullptr, false, true);
|
m_ini.SetLongValue(section, key, static_cast<long>(value), nullptr, false, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
void SDLSettingsInterface::SetFloatValue(const char* section, const char* key, float value)
|
void INISettingsInterface::SetFloatValue(const char* section, const char* key, float value)
|
||||||
{
|
{
|
||||||
m_dirty = true;
|
m_dirty = true;
|
||||||
m_ini.SetDoubleValue(section, key, static_cast<double>(value), nullptr, true);
|
m_ini.SetDoubleValue(section, key, static_cast<double>(value), nullptr, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
void SDLSettingsInterface::SetBoolValue(const char* section, const char* key, bool value)
|
void INISettingsInterface::SetBoolValue(const char* section, const char* key, bool value)
|
||||||
{
|
{
|
||||||
m_dirty = true;
|
m_dirty = true;
|
||||||
m_ini.SetBoolValue(section, key, value, nullptr, true);
|
m_ini.SetBoolValue(section, key, value, nullptr, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
void SDLSettingsInterface::SetStringValue(const char* section, const char* key, const char* value)
|
void INISettingsInterface::SetStringValue(const char* section, const char* key, const char* value)
|
||||||
{
|
{
|
||||||
m_dirty = true;
|
m_dirty = true;
|
||||||
m_ini.SetValue(section, key, value, nullptr, true);
|
m_ini.SetValue(section, key, value, nullptr, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
void SDLSettingsInterface::DeleteValue(const char* section, const char* key)
|
void INISettingsInterface::DeleteValue(const char* section, const char* key)
|
||||||
{
|
{
|
||||||
m_dirty = true;
|
m_dirty = true;
|
||||||
m_ini.Delete(section, key);
|
m_ini.Delete(section, key);
|
||||||
}
|
}
|
||||||
|
|
||||||
std::vector<std::string> SDLSettingsInterface::GetStringList(const char* section, const char* key)
|
std::vector<std::string> INISettingsInterface::GetStringList(const char* section, const char* key)
|
||||||
{
|
{
|
||||||
std::list<CSimpleIniA::Entry> entries;
|
std::list<CSimpleIniA::Entry> entries;
|
||||||
if (!m_ini.GetAllValues(section, key, entries))
|
if (!m_ini.GetAllValues(section, key, entries))
|
||||||
|
@ -89,7 +89,7 @@ std::vector<std::string> SDLSettingsInterface::GetStringList(const char* section
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
void SDLSettingsInterface::SetStringList(const char* section, const char* key,
|
void INISettingsInterface::SetStringList(const char* section, const char* key,
|
||||||
const std::vector<std::string_view>& items)
|
const std::vector<std::string_view>& items)
|
||||||
{
|
{
|
||||||
m_dirty = true;
|
m_dirty = true;
|
||||||
|
@ -99,13 +99,13 @@ void SDLSettingsInterface::SetStringList(const char* section, const char* key,
|
||||||
m_ini.SetValue(section, key, std::string(sv).c_str(), nullptr, false);
|
m_ini.SetValue(section, key, std::string(sv).c_str(), nullptr, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool SDLSettingsInterface::RemoveFromStringList(const char* section, const char* key, const char* item)
|
bool INISettingsInterface::RemoveFromStringList(const char* section, const char* key, const char* item)
|
||||||
{
|
{
|
||||||
m_dirty = true;
|
m_dirty = true;
|
||||||
return m_ini.DeleteValue(section, key, item, true);
|
return m_ini.DeleteValue(section, key, item, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool SDLSettingsInterface::AddToStringList(const char* section, const char* key, const char* item)
|
bool INISettingsInterface::AddToStringList(const char* section, const char* key, const char* item)
|
||||||
{
|
{
|
||||||
std::list<CSimpleIniA::Entry> entries;
|
std::list<CSimpleIniA::Entry> entries;
|
||||||
if (m_ini.GetAllValues(section, key, entries) &&
|
if (m_ini.GetAllValues(section, key, entries) &&
|
|
@ -3,11 +3,11 @@
|
||||||
|
|
||||||
#include "SimpleIni.h"
|
#include "SimpleIni.h"
|
||||||
|
|
||||||
class SDLSettingsInterface : public SettingsInterface
|
class INISettingsInterface : public SettingsInterface
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
SDLSettingsInterface(const char* filename);
|
INISettingsInterface(const char* filename);
|
||||||
~SDLSettingsInterface();
|
~INISettingsInterface();
|
||||||
|
|
||||||
void Clear() override;
|
void Clear() override;
|
||||||
|
|
Loading…
Reference in a new issue