Move frontend-common to util/core

This commit is contained in:
Stenzek 2023-08-13 16:28:28 +10:00
parent 5b980dafa5
commit bb60170d9a
144 changed files with 2506 additions and 3180 deletions

View File

@ -35,8 +35,6 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libchdr", "dep\libchdr\libc
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "lzma", "dep\lzma\lzma.vcxproj", "{DD944834-7899-4C1C-A4C1-064B5009D239}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "frontend-common", "src\frontend-common\frontend-common.vcxproj", "{6245DEC8-D2DA-47EE-A373-CBD6FCF3ECE6}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "xxhash", "dep\xxhash\xxhash.vcxproj", "{09553C96-9F39-49BF-8AE6-7ACBD07C410C}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "googletest", "dep\googletest\googletest.vcxproj", "{49953E1B-2EF7-46A4-B88B-1BF9E099093B}"
@ -401,30 +399,6 @@ Global
{DD944834-7899-4C1C-A4C1-064B5009D239}.ReleaseLTCG|x64.Build.0 = ReleaseLTCG|x64
{DD944834-7899-4C1C-A4C1-064B5009D239}.ReleaseLTCG|x86.ActiveCfg = ReleaseLTCG|Win32
{DD944834-7899-4C1C-A4C1-064B5009D239}.ReleaseLTCG|x86.Build.0 = ReleaseLTCG|Win32
{6245DEC8-D2DA-47EE-A373-CBD6FCF3ECE6}.Debug|ARM64.ActiveCfg = Debug|ARM64
{6245DEC8-D2DA-47EE-A373-CBD6FCF3ECE6}.Debug|ARM64.Build.0 = Debug|ARM64
{6245DEC8-D2DA-47EE-A373-CBD6FCF3ECE6}.Debug|x64.ActiveCfg = Debug|x64
{6245DEC8-D2DA-47EE-A373-CBD6FCF3ECE6}.Debug|x64.Build.0 = Debug|x64
{6245DEC8-D2DA-47EE-A373-CBD6FCF3ECE6}.Debug|x86.ActiveCfg = Debug|Win32
{6245DEC8-D2DA-47EE-A373-CBD6FCF3ECE6}.Debug|x86.Build.0 = Debug|Win32
{6245DEC8-D2DA-47EE-A373-CBD6FCF3ECE6}.DebugFast|ARM64.ActiveCfg = DebugFast|ARM64
{6245DEC8-D2DA-47EE-A373-CBD6FCF3ECE6}.DebugFast|ARM64.Build.0 = DebugFast|ARM64
{6245DEC8-D2DA-47EE-A373-CBD6FCF3ECE6}.DebugFast|x64.ActiveCfg = DebugFast|x64
{6245DEC8-D2DA-47EE-A373-CBD6FCF3ECE6}.DebugFast|x64.Build.0 = DebugFast|x64
{6245DEC8-D2DA-47EE-A373-CBD6FCF3ECE6}.DebugFast|x86.ActiveCfg = DebugFast|Win32
{6245DEC8-D2DA-47EE-A373-CBD6FCF3ECE6}.DebugFast|x86.Build.0 = DebugFast|Win32
{6245DEC8-D2DA-47EE-A373-CBD6FCF3ECE6}.Release|ARM64.ActiveCfg = Release|ARM64
{6245DEC8-D2DA-47EE-A373-CBD6FCF3ECE6}.Release|ARM64.Build.0 = Release|ARM64
{6245DEC8-D2DA-47EE-A373-CBD6FCF3ECE6}.Release|x64.ActiveCfg = Release|x64
{6245DEC8-D2DA-47EE-A373-CBD6FCF3ECE6}.Release|x64.Build.0 = Release|x64
{6245DEC8-D2DA-47EE-A373-CBD6FCF3ECE6}.Release|x86.ActiveCfg = Release|Win32
{6245DEC8-D2DA-47EE-A373-CBD6FCF3ECE6}.Release|x86.Build.0 = Release|Win32
{6245DEC8-D2DA-47EE-A373-CBD6FCF3ECE6}.ReleaseLTCG|ARM64.ActiveCfg = ReleaseLTCG|ARM64
{6245DEC8-D2DA-47EE-A373-CBD6FCF3ECE6}.ReleaseLTCG|ARM64.Build.0 = ReleaseLTCG|ARM64
{6245DEC8-D2DA-47EE-A373-CBD6FCF3ECE6}.ReleaseLTCG|x64.ActiveCfg = ReleaseLTCG|x64
{6245DEC8-D2DA-47EE-A373-CBD6FCF3ECE6}.ReleaseLTCG|x64.Build.0 = ReleaseLTCG|x64
{6245DEC8-D2DA-47EE-A373-CBD6FCF3ECE6}.ReleaseLTCG|x86.ActiveCfg = ReleaseLTCG|Win32
{6245DEC8-D2DA-47EE-A373-CBD6FCF3ECE6}.ReleaseLTCG|x86.Build.0 = ReleaseLTCG|Win32
{09553C96-9F39-49BF-8AE6-7ACBD07C410C}.Debug|ARM64.ActiveCfg = Debug|ARM64
{09553C96-9F39-49BF-8AE6-7ACBD07C410C}.Debug|ARM64.Build.0 = Debug|ARM64
{09553C96-9F39-49BF-8AE6-7ACBD07C410C}.Debug|x64.ActiveCfg = Debug|x64
@ -611,12 +585,10 @@ Global
{0A172B2E-DC67-49FC-A4C1-975F93C586C4}.Debug|x86.Build.0 = Debug|Win32
{0A172B2E-DC67-49FC-A4C1-975F93C586C4}.DebugFast|ARM64.ActiveCfg = DebugFast|ARM64
{0A172B2E-DC67-49FC-A4C1-975F93C586C4}.DebugFast|x64.ActiveCfg = DebugFast|x64
{0A172B2E-DC67-49FC-A4C1-975F93C586C4}.DebugFast|x64.Build.0 = DebugFast|x64
{0A172B2E-DC67-49FC-A4C1-975F93C586C4}.DebugFast|x86.ActiveCfg = DebugFast|Win32
{0A172B2E-DC67-49FC-A4C1-975F93C586C4}.DebugFast|x86.Build.0 = DebugFast|Win32
{0A172B2E-DC67-49FC-A4C1-975F93C586C4}.Release|ARM64.ActiveCfg = Release|ARM64
{0A172B2E-DC67-49FC-A4C1-975F93C586C4}.Release|x64.ActiveCfg = Release|x64
{0A172B2E-DC67-49FC-A4C1-975F93C586C4}.Release|x64.Build.0 = Release|x64
{0A172B2E-DC67-49FC-A4C1-975F93C586C4}.Release|x86.ActiveCfg = Release|Win32
{0A172B2E-DC67-49FC-A4C1-975F93C586C4}.Release|x86.Build.0 = Release|Win32
{0A172B2E-DC67-49FC-A4C1-975F93C586C4}.ReleaseLTCG|ARM64.ActiveCfg = ReleaseLTCG|ARM64

View File

@ -2,7 +2,6 @@ add_subdirectory(common)
add_subdirectory(util)
add_subdirectory(core)
add_subdirectory(scmversion)
add_subdirectory(frontend-common)
if(NOT ANDROID)
add_subdirectory(common-tests)

View File

@ -16,6 +16,8 @@ add_library(core
cheats.h
controller.cpp
controller.h
common_host.cpp
common_host.h
cpu_code_cache.cpp
cpu_code_cache.h
cpu_core.cpp
@ -29,8 +31,12 @@ add_library(core
digital_controller.h
dma.cpp
dma.h
fullscreen_ui.cpp
fullscreen_ui.h
game_database.cpp
game_database.h
game_list.cpp
game_list.h
gdb_protocol.cpp
gdb_protocol.h
gpu.cpp
@ -54,12 +60,13 @@ add_library(core
gte_types.h
host.cpp
host.h
host_display.cpp
host_display.h
host_interface_progress_callback.cpp
host_interface_progress_callback.h
host_settings.cpp
host_settings.h
input_types.h
imgui_overlays.cpp
imgui_overlays.h
interrupt_controller.cpp
interrupt_controller.h
libcrypt_serials.cpp
@ -90,8 +97,6 @@ add_library(core
settings.cpp
settings.h
shader_cache_version.h
shadergen.cpp
shadergen.h
sio.cpp
sio.h
spu.cpp
@ -181,5 +186,20 @@ else()
endif()
if(ENABLE_CHEEVOS)
target_compile_definitions(core PRIVATE -DWITH_CHEEVOS=1)
target_sources(core PRIVATE
achievements.cpp
achievements_private.h
)
target_compile_definitions(core PUBLIC -DWITH_CHEEVOS=1)
target_link_libraries(core PRIVATE rcheevos rapidjson)
endif()
if(ENABLE_DISCORD_PRESENCE)
target_compile_definitions(core PUBLIC -DWITH_DISCORD_PRESENCE=1)
target_link_libraries(core PRIVATE discord-rpc)
endif()
# Copy the provided data directory to the output directory.
add_custom_command(TARGET core POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy_directory "${CMAKE_SOURCE_DIR}/data" "${CMAKE_RUNTIME_OUTPUT_DIRECTORY}"
)

View File

@ -1,7 +1,17 @@
// SPDX-FileCopyrightText: 2019-2022 Connor McLaughlin <stenzek@gmail.com>
// SPDX-License-Identifier: (GPL-3.0 OR CC-BY-NC-ND-4.0)
#include "achievements.h"
#include "achievements_private.h"
#include "bios.h"
#include "bus.h"
#include "cpu_core.h"
#include "fullscreen_ui.h"
#include "host.h"
#include "host_settings.h"
#include "system.h"
#include "scmversion/scmversion.h"
#include "common/assert.h"
#include "common/file_system.h"
#include "common/http_downloader.h"
@ -10,16 +20,12 @@
#include "common/path.h"
#include "common/platform.h"
#include "common/string_util.h"
#include "core/bios.h"
#include "core/bus.h"
#include "core/cpu_core.h"
#include "core/host.h"
#include "core/host_display.h"
#include "core/host_settings.h"
#include "core/system.h"
#include "fullscreen_ui.h"
#include "imgui_fullscreen.h"
#include "platform_misc.h"
#include "util/cd_image.h"
#include "util/imgui_fullscreen.h"
#include "util/platform_misc.h"
#include "util/state_wrapper.h"
#include "rapidjson/document.h"
#include "rc_api_info.h"
#include "rc_api_request.h"
@ -27,9 +33,7 @@
#include "rc_api_user.h"
#include "rc_url.h"
#include "rcheevos.h"
#include "scmversion/scmversion.h"
#include "util/cd_image.h"
#include "util/state_wrapper.h"
#include <algorithm>
#include <atomic>
#include <cstdarg>
@ -38,6 +42,7 @@
#include <functional>
#include <string>
#include <vector>
Log_SetChannel(Achievements);
#ifdef WITH_RAINTEGRATION

View File

@ -4,6 +4,8 @@
#pragma once
#include "common/types.h"
#include <string>
class StateWrapper;
class CDImage;

View File

@ -2,10 +2,13 @@
// SPDX-License-Identifier: (GPL-3.0 OR CC-BY-NC-ND-4.0)
#pragma once
#include "achievements.h"
#include "settings.h"
#include "types.h"
#include "common/string.h"
#include "core/achievements.h"
#include "core/settings.h"
#include "core/types.h"
#include <functional>
#include <optional>
#include <string>

View File

@ -2,7 +2,38 @@
// SPDX-License-Identifier: (GPL-3.0 OR CC-BY-NC-ND-4.0)
#include "common_host.h"
#include "IconsFontAwesome5.h"
#include "cdrom.h"
#include "cheats.h"
#include "controller.h"
#include "cpu_code_cache.h"
#include "dma.h"
#include "fullscreen_ui.h"
#include "game_list.h"
#include "gpu.h"
#include "gte.h"
#include "host.h"
#include "host_settings.h"
#include "imgui_overlays.h"
#include "mdec.h"
#include "pgxp.h"
#include "resources.h"
#include "save_state_version.h"
#include "settings.h"
#include "spu.h"
#include "system.h"
#include "texture_replacements.h"
#include "timers.h"
#include "scmversion/scmversion.h"
#include "util/audio_stream.h"
#include "util/host_display.h"
#include "util/imgui_fullscreen.h"
#include "util/imgui_manager.h"
#include "util/ini_settings_interface.h"
#include "util/input_manager.h"
#include "util/platform_misc.h"
#include "common/assert.h"
#include "common/byte_stream.h"
#include "common/crash_handler.h"
@ -10,36 +41,10 @@
#include "common/log.h"
#include "common/path.h"
#include "common/string_util.h"
#include "core/cdrom.h"
#include "core/cheats.h"
#include "core/controller.h"
#include "core/cpu_code_cache.h"
#include "core/dma.h"
#include "core/gpu.h"
#include "core/gte.h"
#include "core/host.h"
#include "core/host_display.h"
#include "core/host_settings.h"
#include "core/mdec.h"
#include "core/pgxp.h"
#include "core/save_state_version.h"
#include "core/settings.h"
#include "core/spu.h"
#include "core/system.h"
#include "core/texture_replacements.h"
#include "core/timers.h"
#include "fullscreen_ui.h"
#include "game_list.h"
#include "icon.h"
#include "IconsFontAwesome5.h"
#include "imgui.h"
#include "imgui_fullscreen.h"
#include "imgui_manager.h"
#include "imgui_overlays.h"
#include "input_manager.h"
#include "platform_misc.h"
#include "scmversion/scmversion.h"
#include "util/audio_stream.h"
#include "util/ini_settings_interface.h"
#include <cmath>
#include <cstdio>
#include <cstring>
@ -50,24 +55,24 @@
#endif
#ifdef WITH_CHEEVOS
#include "achievements.h"
#include "achievements_private.h"
#endif
#ifdef _WIN32
#include "common/windows_headers.h"
#include "frontend-common/d3d11_host_display.h"
#include "frontend-common/d3d12_host_display.h"
#include "util/d3d11_host_display.h"
#include "util/d3d12_host_display.h"
#include <KnownFolders.h>
#include <ShlObj.h>
#include <mmsystem.h>
#endif
#ifdef WITH_OPENGL
#include "frontend-common/opengl_host_display.h"
#include "util/opengl_host_display.h"
#endif
#ifdef WITH_VULKAN
#include "frontend-common/vulkan_host_display.h"
#include "util/vulkan_host_display.h"
#endif
Log_SetChannel(CommonHostInterface);
@ -196,12 +201,12 @@ std::unique_ptr<AudioStream> Host::CreateAudioStream(AudioBackend backend, u32 s
{
#ifdef WITH_CUBEB
case AudioBackend::Cubeb:
return CommonHost::CreateCubebAudioStream(sample_rate, channels, buffer_ms, latency_ms, stretch);
return AudioStream::CreateCubebAudioStream(sample_rate, channels, buffer_ms, latency_ms, stretch);
#endif
#ifdef _WIN32
case AudioBackend::XAudio2:
return CommonHost::CreateXAudio2Stream(sample_rate, channels, buffer_ms, latency_ms, stretch);
return AudioStream::CreateXAudio2Stream(sample_rate, channels, buffer_ms, latency_ms, stretch);
#endif
case AudioBackend::Null:

View File

@ -2,7 +2,9 @@
// SPDX-License-Identifier: (GPL-3.0 OR CC-BY-NC-ND-4.0)
#pragma once
#include "core/system.h"
#include "system.h"
#include <memory>
#include <mutex>
#include <string>
@ -39,16 +41,6 @@ void ReleaseHostDisplayResources();
/// Returns the time elapsed in the current play session.
u64 GetSessionPlayedTime();
#ifdef WITH_CUBEB
std::unique_ptr<AudioStream> CreateCubebAudioStream(u32 sample_rate, u32 channels, u32 buffer_ms, u32 latency_ms,
AudioStretchMode stretch);
std::vector<std::string> GetCubebDriverNames();
std::vector<std::pair<std::string, std::string>> GetCubebOutputDevices(const char* driver);
#endif
#ifdef _WIN32
std::unique_ptr<AudioStream> CreateXAudio2Stream(u32 sample_rate, u32 channels, u32 buffer_ms, u32 latency_ms,
AudioStretchMode stretch);
#endif
} // namespace CommonHost
namespace ImGuiManager {

View File

@ -4,16 +4,16 @@
<ItemDefinitionGroup>
<ClCompile>
<PreprocessorDefinitions>WITH_CHEEVOS=1;WITH_CUBEB=1;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions>WITH_CHEEVOS=1;WITH_DISCORD_PRESENCE=1;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions Condition="('$(Platform)'!='ARM64')">WITH_RAINTEGRATION=1;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions Condition="('$(Platform)'=='x64' Or '$(Platform)'=='ARM' Or '$(Platform)'=='ARM64')">WITH_RECOMPILER=1;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions Condition="('$(Platform)'=='x64' Or '$(Platform)'=='ARM64')">WITH_MMAP_FASTMEM=1;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<AdditionalIncludeDirectories>%(AdditionalIncludeDirectories);$(SolutionDir)dep\tinyxml2\include;$(SolutionDir)dep\glad\include;$(SolutionDir)dep\stb\include;$(SolutionDir)dep\imgui\include;$(SolutionDir)dep\xxhash\include;$(SolutionDir)dep\zlib\include;$(SolutionDir)dep\rcheevos\include;$(SolutionDir)dep\rapidjson\include</AdditionalIncludeDirectories>
<AdditionalIncludeDirectories Condition="'$(Platform)'!='ARM64'">$(SolutionDir)dep\rainterface;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<AdditionalIncludeDirectories>%(AdditionalIncludeDirectories);$(SolutionDir)dep\tinyxml2\include;$(SolutionDir)dep\xxhash\include;$(SolutionDir)dep\zlib\include;$(SolutionDir)dep\rcheevos\include;$(SolutionDir)dep\rapidjson\include;$(SolutionDir)dep\discord-rpc\include</AdditionalIncludeDirectories>
<AdditionalIncludeDirectories Condition="'$(Platform)'!='ARM64'">%(AdditionalIncludeDirectories);$(SolutionDir)dep\rainterface</AdditionalIncludeDirectories>
<AdditionalIncludeDirectories Condition="'$(Platform)'=='x64'">$(SolutionDir)dep\xbyak\xbyak;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<AdditionalIncludeDirectories Condition="'$(Platform)'=='ARM' Or '$(Platform)'=='ARM64'">$(SolutionDir)dep\vixl\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<AdditionalIncludeDirectories Condition="'$(Platform)'=='x64'">%(AdditionalIncludeDirectories);$(SolutionDir)dep\xbyak\xbyak</AdditionalIncludeDirectories>
<AdditionalIncludeDirectories Condition="'$(Platform)'=='ARM' Or '$(Platform)'=='ARM64'">%(AdditionalIncludeDirectories);$(SolutionDir)dep\vixl\include</AdditionalIncludeDirectories>
</ClCompile>
</ItemDefinitionGroup>
</Project>

View File

@ -2,6 +2,7 @@
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="..\..\dep\msvc\vsprops\Configurations.props" />
<ItemGroup>
<ClCompile Include="achievements.cpp" />
<ClCompile Include="analog_controller.cpp" />
<ClCompile Include="analog_joystick.cpp" />
<ClCompile Include="bios.cpp" />
@ -9,6 +10,7 @@
<ClCompile Include="cdrom.cpp" />
<ClCompile Include="cdrom_async_reader.cpp" />
<ClCompile Include="cheats.cpp" />
<ClCompile Include="common_host.cpp" />
<ClCompile Include="cpu_core.cpp" />
<ClCompile Include="cpu_disasm.cpp" />
<ClCompile Include="cpu_code_cache.cpp" />
@ -32,7 +34,9 @@
</ClCompile>
<ClCompile Include="cpu_types.cpp" />
<ClCompile Include="digital_controller.cpp" />
<ClCompile Include="fullscreen_ui.cpp" />
<ClCompile Include="game_database.cpp" />
<ClCompile Include="game_list.cpp" />
<ClCompile Include="gpu_backend.cpp" />
<ClCompile Include="gpu_commands.cpp" />
<ClCompile Include="gpu_hw_d3d11.cpp" />
@ -52,8 +56,9 @@
<ExcludedFromBuild Condition="'$(Platform)'=='ARM64'">true</ExcludedFromBuild>
</ClCompile>
<ClCompile Include="host.cpp" />
<ClCompile Include="host_display.cpp" />
<ClCompile Include="host_interface_progress_callback.cpp" />
<ClCompile Include="host_settings.cpp" />
<ClCompile Include="imgui_overlays.cpp" />
<ClCompile Include="interrupt_controller.cpp" />
<ClCompile Include="libcrypt_serials.cpp" />
<ClCompile Include="mdec.cpp" />
@ -70,7 +75,6 @@
<ClCompile Include="psf_loader.cpp" />
<ClCompile Include="resources.cpp" />
<ClCompile Include="settings.cpp" />
<ClCompile Include="shadergen.cpp" />
<ClCompile Include="sio.cpp" />
<ClCompile Include="spu.cpp" />
<ClCompile Include="system.cpp" />
@ -79,6 +83,7 @@
<ClCompile Include="timing_event.cpp" />
</ItemGroup>
<ItemGroup>
<ClInclude Include="achievements_private.h" />
<ClInclude Include="analog_controller.h" />
<ClInclude Include="analog_joystick.h" />
<ClInclude Include="bios.h" />
@ -87,6 +92,7 @@
<ClInclude Include="cdrom_async_reader.h" />
<ClInclude Include="cheats.h" />
<ClInclude Include="achievements.h" />
<ClInclude Include="common_host.h" />
<ClInclude Include="cpu_core.h" />
<ClInclude Include="cpu_core_private.h" />
<ClInclude Include="cpu_disasm.h" />
@ -104,7 +110,9 @@
<ExcludedFromBuild Condition="'$(Platform)'=='Win32'">true</ExcludedFromBuild>
</ClInclude>
<ClInclude Include="digital_controller.h" />
<ClInclude Include="fullscreen_ui.h" />
<ClInclude Include="game_database.h" />
<ClInclude Include="game_list.h" />
<ClInclude Include="gpu_backend.h" />
<ClInclude Include="gpu_hw_d3d11.h" />
<ClInclude Include="gpu_hw_d3d12.h" />
@ -126,9 +134,9 @@
</ClInclude>
<ClInclude Include="gte_types.h" />
<ClInclude Include="host.h" />
<ClInclude Include="host_display.h" />
<ClInclude Include="host_interface_progress_callback.h" />
<ClInclude Include="host_settings.h" />
<ClInclude Include="imgui_overlays.h" />
<ClInclude Include="input_types.h" />
<ClInclude Include="interrupt_controller.h" />
<ClInclude Include="libcrypt_serials.h" />
@ -147,7 +155,6 @@
<ClInclude Include="resources.h" />
<ClInclude Include="save_state_version.h" />
<ClInclude Include="settings.h" />
<ClInclude Include="shadergen.h" />
<ClInclude Include="shader_cache_version.h" />
<ClInclude Include="sio.h" />
<ClInclude Include="spu.h" />
@ -158,6 +165,9 @@
<ClInclude Include="types.h" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\dep\discord-rpc\discord-rpc.vcxproj">
<Project>{4266505b-dbaf-484b-ab31-b53b9c8235b3}</Project>
</ProjectReference>
<ProjectReference Include="..\..\dep\imgui\imgui.vcxproj">
<Project>{bb08260f-6fbc-46af-8924-090ee71360c6}</Project>
</ProjectReference>
@ -185,6 +195,9 @@
<ProjectReference Include="..\..\dep\zstd\zstd.vcxproj">
<Project>{73ee0c55-6ffe-44e7-9c12-baa52434a797}</Project>
</ProjectReference>
<ProjectReference Include="..\scmversion\scmversion.vcxproj">
<Project>{075ced82-6a20-46df-94c7-9624ac9ddbeb}</Project>
</ProjectReference>
<ProjectReference Include="..\util\util.vcxproj">
<Project>{57f6206d-f264-4b07-baf8-11b9bbe1f455}</Project>
</ProjectReference>

View File

@ -35,7 +35,6 @@
<ClCompile Include="sio.cpp" />
<ClCompile Include="controller.cpp" />
<ClCompile Include="analog_controller.cpp" />
<ClCompile Include="host_display.cpp" />
<ClCompile Include="timing_event.cpp" />
<ClCompile Include="cdrom_async_reader.cpp" />
<ClCompile Include="psf_loader.cpp" />
@ -47,7 +46,6 @@
<ClCompile Include="host_interface_progress_callback.cpp" />
<ClCompile Include="pgxp.cpp" />
<ClCompile Include="cheats.cpp" />
<ClCompile Include="shadergen.cpp" />
<ClCompile Include="memory_card_image.cpp" />
<ClCompile Include="analog_joystick.cpp" />
<ClCompile Include="cpu_recompiler_code_generator_aarch32.cpp" />
@ -60,6 +58,12 @@
<ClCompile Include="host.cpp" />
<ClCompile Include="game_database.cpp" />
<ClCompile Include="pcdrv.cpp" />
<ClCompile Include="game_list.cpp" />
<ClCompile Include="host_settings.cpp" />
<ClCompile Include="imgui_overlays.cpp" />
<ClCompile Include="fullscreen_ui.cpp" />
<ClCompile Include="common_host.cpp" />
<ClCompile Include="achievements.cpp" />
</ItemGroup>
<ItemGroup>
<ClInclude Include="types.h" />
@ -86,7 +90,6 @@
<ClInclude Include="gpu_sw.h" />
<ClInclude Include="gpu_hw_shadergen.h" />
<ClInclude Include="gpu_hw_d3d11.h" />
<ClInclude Include="host_display.h" />
<ClInclude Include="bios.h" />
<ClInclude Include="cpu_recompiler_types.h" />
<ClInclude Include="cpu_code_cache.h" />
@ -109,7 +112,6 @@
<ClInclude Include="pgxp.h" />
<ClInclude Include="cpu_core_private.h" />
<ClInclude Include="cheats.h" />
<ClInclude Include="shadergen.h" />
<ClInclude Include="memory_card_image.h" />
<ClInclude Include="analog_joystick.h" />
<ClInclude Include="gpu_types.h" />
@ -127,5 +129,10 @@
<ClInclude Include="game_database.h" />
<ClInclude Include="input_types.h" />
<ClInclude Include="pcdrv.h" />
<ClInclude Include="game_list.h" />
<ClInclude Include="imgui_overlays.h" />
<ClInclude Include="fullscreen_ui.h" />
<ClInclude Include="common_host.h" />
<ClInclude Include="achievements_private.h" />
</ItemGroup>
</Project>

View File

@ -4,7 +4,30 @@
#define IMGUI_DEFINE_MATH_OPERATORS
#include "fullscreen_ui.h"
#include "IconsFontAwesome5.h"
#include "achievements.h"
#include "bios.h"
#include "cheats.h"
#include "common_host.h"
#include "controller.h"
#include "core/memory_card_image.h"
#include "cpu_core.h"
#include "game_list.h"
#include "gpu.h"
#include "host.h"
#include "host_settings.h"
#include "resources.h"
#include "settings.h"
#include "system.h"
#include "util/host_display.h"
#include "scmversion/scmversion.h"
#include "util/imgui_fullscreen.h"
#include "util/imgui_manager.h"
#include "util/ini_settings_interface.h"
#include "util/input_manager.h"
#include "util/postprocessing_chain.h"
#include "common/byte_stream.h"
#include "common/file_system.h"
#include "common/log.h"
@ -13,43 +36,25 @@
#include "common/string.h"
#include "common/string_util.h"
#include "common/threading.h"
#include "common_host.h"
#include "core/achievements.h"
#include "core/bios.h"
#include "core/cheats.h"
#include "core/controller.h"
#include "core/cpu_core.h"
#include "core/gpu.h"
#include "core/host.h"
#include "core/host_display.h"
#include "core/host_settings.h"
#include "core/memory_card_image.h"
#include "core/resources.h"
#include "core/settings.h"
#include "core/system.h"
#include "IconsFontAwesome5.h"
#include "fmt/chrono.h"
#include "fmt/format.h"
#include "game_list.h"
#include "icon.h"
#include "imgui.h"
#include "imgui_fullscreen.h"
#include "imgui_internal.h"
#include "imgui_manager.h"
#include "imgui_stdlib.h"
#include "input_manager.h"
#include "postprocessing_chain.h"
#include "scmversion/scmversion.h"
#include "util/ini_settings_interface.h"
#include <atomic>
#include <bitset>
#include <thread>
#include <unordered_map>
#include <utility>
#include <vector>
Log_SetChannel(FullscreenUI);
#ifdef WITH_CHEEVOS
#include "achievements.h"
#include "achievements_private.h"
#endif
using ImGuiFullscreen::g_large_font;
@ -4863,9 +4868,9 @@ void FullscreenUI::PopulateSaveStateScreenshot(SaveStateListEntry* li, const Ext
}
else
{
li->preview_texture =
g_host_display->CreateTexture(PLACEHOLDER_ICON_WIDTH, PLACEHOLDER_ICON_HEIGHT, 1, 1, 1, GPUTexture::Format::RGBA8,
PLACEHOLDER_ICON_DATA, sizeof(u32) * PLACEHOLDER_ICON_WIDTH, false);
li->preview_texture = g_host_display->CreateTexture(
Resources::PLACEHOLDER_ICON_WIDTH, Resources::PLACEHOLDER_ICON_HEIGHT, 1, 1, 1, GPUTexture::Format::RGBA8,
Resources::PLACEHOLDER_ICON_DATA, sizeof(u32) * Resources::PLACEHOLDER_ICON_WIDTH, false);
}
if (!li->preview_texture)

View File

@ -2,6 +2,15 @@
// SPDX-License-Identifier: (GPL-3.0 OR CC-BY-NC-ND-4.0)
#include "game_list.h"
#include "bios.h"
#include "host.h"
#include "host_settings.h"
#include "psf_loader.h"
#include "settings.h"
#include "system.h"
#include "util/cd_image.h"
#include "common/assert.h"
#include "common/byte_stream.h"
#include "common/file_system.h"
@ -12,14 +21,9 @@
#include "common/path.h"
#include "common/progress_callback.h"
#include "common/string_util.h"
#include "core/bios.h"
#include "core/host.h"
#include "core/host_settings.h"
#include "core/psf_loader.h"
#include "core/settings.h"
#include "core/system.h"
#include "tinyxml2.h"
#include "util/cd_image.h"
#include <algorithm>
#include <array>
#include <cctype>
@ -28,6 +32,7 @@
#include <type_traits>
#include <unordered_map>
#include <utility>
Log_SetChannel(GameList);
#ifdef _WIN32

View File

@ -2,10 +2,14 @@
// SPDX-License-Identifier: (GPL-3.0 OR CC-BY-NC-ND-4.0)
#pragma once
#include "common/string.h"
#include "core/game_database.h"
#include "core/types.h"
#include "game_database.h"
#include "types.h"
#include "util/cd_image.h"
#include "common/string.h"
#include <ctime>
#include <functional>
#include <mutex>

View File

@ -7,7 +7,7 @@
#include "common/log.h"
#include "common/string_util.h"
#include "cpu_core.h"
#include "frontend-common/common_host.h"
#include "common_host.h"
#include "system.h"
#include <functional>
#include <iomanip>

View File

@ -8,7 +8,7 @@
#include "common/string_util.h"
#include "dma.h"
#include "host.h"
#include "host_display.h"
#include "util/host_display.h"
#include "imgui.h"
#include "interrupt_controller.h"
#include "settings.h"

View File

@ -4,7 +4,7 @@
#pragma once
#include "common/heap_array.h"
#include "gpu.h"
#include "host_display.h"
#include "util/host_display.h"
#include <sstream>
#include <string>
#include <tuple>

View File

@ -8,7 +8,7 @@
#include "common/timer.h"
#include "gpu_hw_shadergen.h"
#include "gpu_sw_backend.h"
#include "host_display.h"
#include "util/host_display.h"
#include "shader_cache_version.h"
#include "system.h"
#include "util/state_wrapper.h"

View File

@ -13,7 +13,7 @@
#include "common/scoped_guard.h"
#include "common/timer.h"
#include "gpu_hw_shadergen.h"
#include "host_display.h"
#include "util/host_display.h"
#include "system.h"
Log_SetChannel(GPU_HW_D3D12);

View File

@ -7,7 +7,7 @@
#include "common/timer.h"
#include "gpu_hw_shadergen.h"
#include "host.h"
#include "host_display.h"
#include "util/host_display.h"
#include "shader_cache_version.h"
#include "system.h"
#include "texture_replacements.h"

View File

@ -3,7 +3,7 @@
#pragma once
#include "gpu_hw.h"
#include "shadergen.h"
#include "util/shadergen.h"
class GPU_HW_ShaderGen : public ShaderGen
{

View File

@ -11,7 +11,7 @@
#include "common/vulkan/shader_cache.h"
#include "common/vulkan/util.h"
#include "gpu_hw_shadergen.h"
#include "host_display.h"
#include "util/host_display.h"
#include "system.h"
#include "util/state_wrapper.h"
Log_SetChannel(GPU_HW_Vulkan);

View File

@ -7,7 +7,7 @@
#include "common/log.h"
#include "common/make_array.h"
#include "common/platform.h"
#include "host_display.h"
#include "util/host_display.h"
#include "system.h"
#include <algorithm>
Log_SetChannel(GPU_SW);

View File

@ -5,7 +5,7 @@
#include "common/heap_array.h"
#include "gpu.h"
#include "gpu_sw_backend.h"
#include "host_display.h"
#include "util/host_display.h"
#include <array>
#include <memory>
#include <vector>

View File

@ -5,7 +5,7 @@
#include "common/assert.h"
#include "common/log.h"
#include "gpu_sw_backend.h"
#include "host_display.h"
#include "util/host_display.h"
#include "system.h"
#include <algorithm>
Log_SetChannel(GPU_SW_Backend);

View File

@ -6,7 +6,7 @@
#include "common/bitutils.h"
#include "cpu_core.h"
#include "cpu_core_private.h"
#include "host_display.h"
#include "util/host_display.h"
#include "pgxp.h"
#include "settings.h"
#include "timing_event.h"

View File

@ -6,7 +6,7 @@
#include "common/log.h"
#include "gpu.h"
#include "host.h"
#include "host_display.h"
#include "util/host_display.h"
#include "resources.h"
#include "system.h"
#include "util/state_wrapper.h"

View File

@ -2,33 +2,36 @@
// SPDX-License-Identifier: (GPL-3.0 OR CC-BY-NC-ND-4.0)
#include "imgui_overlays.h"
#include "IconsFontAwesome5.h"
#include "controller.h"
#include "fullscreen_ui.h"
#include "gpu.h"
#include "host.h"
#include "host_settings.h"
#include "resources.h"
#include "settings.h"
#include "spu.h"
#include "system.h"
#include "util/audio_stream.h"
#include "util/host_display.h"
#include "util/imgui_fullscreen.h"
#include "util/imgui_manager.h"
#include "util/input_manager.h"
#include "common/align.h"
#include "common/assert.h"
#include "common/file_system.h"
#include "common/log.h"
#include "common/string_util.h"
#include "common/timer.h"
#include "common_host.h"
#include "core/controller.h"
#include "core/gpu.h"
#include "core/host.h"
#include "core/host_display.h"
#include "core/host_settings.h"
#include "core/settings.h"
#include "core/spu.h"
#include "core/system.h"
#include "IconsFontAwesome5.h"
#include "fmt/chrono.h"
#include "fmt/format.h"
#include "fullscreen_ui.h"
#include "gsl/span"
#include "icon.h"
#include "imgui.h"
#include "imgui_fullscreen.h"
#include "imgui_internal.h"
#include "imgui_manager.h"
#include "input_manager.h"
#include "util/audio_stream.h"
#include <atomic>
#include <chrono>
#include <cmath>
@ -729,9 +732,9 @@ void SaveStateSelectorUI::InitializeListEntry(ListEntry* li, ExtendedSaveStateIn
}
else
{
li->preview_texture = g_host_display->CreateTexture(PLACEHOLDER_ICON_WIDTH, PLACEHOLDER_ICON_HEIGHT, 1, 1, 1,
GPUTexture::Format::RGBA8, PLACEHOLDER_ICON_DATA,
sizeof(u32) * PLACEHOLDER_ICON_WIDTH, false);
li->preview_texture = g_host_display->CreateTexture(
Resources::PLACEHOLDER_ICON_WIDTH, Resources::PLACEHOLDER_ICON_HEIGHT, 1, 1, 1, GPUTexture::Format::RGBA8,
Resources::PLACEHOLDER_ICON_DATA, sizeof(u32) * Resources::PLACEHOLDER_ICON_WIDTH, false);
}
if (!li->preview_texture)
@ -750,9 +753,9 @@ void SaveStateSelectorUI::InitializePlaceholderListEntry(ListEntry* li, std::str
if (g_host_display)
{
li->preview_texture =
g_host_display->CreateTexture(PLACEHOLDER_ICON_WIDTH, PLACEHOLDER_ICON_HEIGHT, 1, 1, 1, GPUTexture::Format::RGBA8,
PLACEHOLDER_ICON_DATA, sizeof(u32) * PLACEHOLDER_ICON_WIDTH, false);
li->preview_texture = g_host_display->CreateTexture(
Resources::PLACEHOLDER_ICON_WIDTH, Resources::PLACEHOLDER_ICON_HEIGHT, 1, 1, 1, GPUTexture::Format::RGBA8,
Resources::PLACEHOLDER_ICON_DATA, sizeof(u32) * Resources::PLACEHOLDER_ICON_WIDTH, false);
if (!li->preview_texture)
Log_ErrorPrintf("Failed to upload save state image to GPU");
}

View File

@ -3,7 +3,7 @@
#pragma once
#include "imgui_manager.h"
#include "util/imgui_manager.h"
namespace ImGuiManager {
void RenderTextOverlays();

View File

@ -6,7 +6,7 @@
#include "common/log.h"
#include "gpu.h"
#include "host.h"
#include "host_display.h"
#include "util/host_display.h"
#include "system.h"
#include "util/state_wrapper.h"
#include <array>

File diff suppressed because it is too large Load Diff

View File

@ -12,4 +12,12 @@ constexpr u32 CROSSHAIR_IMAGE_WIDTH = 96;
constexpr u32 CROSSHAIR_IMAGE_HEIGHT = 96;
extern const std::array<u32, CROSSHAIR_IMAGE_WIDTH * CROSSHAIR_IMAGE_HEIGHT> CROSSHAIR_IMAGE_DATA;
constexpr int WINDOW_ICON_WIDTH = 64;
constexpr int WINDOW_ICON_HEIGHT = 64;
extern unsigned int WINDOW_ICON_DATA[WINDOW_ICON_WIDTH * WINDOW_ICON_HEIGHT];
constexpr int PLACEHOLDER_ICON_WIDTH = 128;
constexpr int PLACEHOLDER_ICON_HEIGHT = 96;
extern unsigned int PLACEHOLDER_ICON_DATA[PLACEHOLDER_ICON_WIDTH * PLACEHOLDER_ICON_HEIGHT];
} // namespace Resources

View File

@ -11,7 +11,7 @@
#include "common/string_util.h"
#include "controller.h"
#include "host.h"
#include "host_display.h"
#include "util/host_display.h"
#include "host_settings.h"
#include "system.h"
#include <algorithm>
@ -354,7 +354,6 @@ void Settings::Load(SettingsInterface& si)
memory_card_paths[1] = si.GetStringValue("MemoryCards", "Card2Path", "");
memory_card_use_playlist_title = si.GetBoolValue("MemoryCards", "UsePlaylistTitle", true);
#ifdef WITH_CHEEVOS
achievements_enabled = si.GetBoolValue("Cheevos", "Enabled", false);
achievements_test_mode = si.GetBoolValue("Cheevos", "TestMode", false);
achievements_unofficial_test_mode = si.GetBoolValue("Cheevos", "UnofficialTestMode", false);
@ -365,7 +364,6 @@ void Settings::Load(SettingsInterface& si)
achievements_notifications = si.GetBoolValue("Cheevos", "Notifications", true);
achievements_sound_effects = si.GetBoolValue("Cheevos", "SoundEffects", true);
achievements_primed_indicators = si.GetBoolValue("Cheevos", "PrimedIndicators", true);
#endif
log_level = ParseLogLevelName(si.GetStringValue("Logging", "LogLevel", GetLogLevelName(DEFAULT_LOG_LEVEL)).c_str())
.value_or(DEFAULT_LOG_LEVEL);
@ -551,7 +549,6 @@ void Settings::Save(SettingsInterface& si) const
si.SetStringValue("ControllerPorts", "MultitapMode", GetMultitapModeName(multitap_mode));
#ifdef WITH_CHEEVOS
si.SetBoolValue("Cheevos", "Enabled", achievements_enabled);
si.SetBoolValue("Cheevos", "TestMode", achievements_test_mode);
si.SetBoolValue("Cheevos", "UnofficialTestMode", achievements_unofficial_test_mode);
@ -562,7 +559,6 @@ void Settings::Save(SettingsInterface& si) const
si.SetBoolValue("Cheevos", "Notifications", achievements_notifications);
si.SetBoolValue("Cheevos", "SoundEffects", achievements_sound_effects);
si.SetBoolValue("Cheevos", "PrimedIndicators", achievements_primed_indicators);
#endif
si.SetStringValue("Logging", "LogLevel", GetLogLevelName(log_level));
si.SetStringValue("Logging", "LogFilter", log_filter.c_str());

View File

@ -178,7 +178,6 @@ struct Settings
u32 gpu_fifo_size = DEFAULT_GPU_FIFO_SIZE;
TickCount gpu_max_run_ahead = DEFAULT_GPU_MAX_RUN_AHEAD;
#ifdef WITH_CHEEVOS
// achievements
bool achievements_enabled = false;
bool achievements_test_mode = false;
@ -190,7 +189,6 @@ struct Settings
bool achievements_notifications = true;
bool achievements_sound_effects = true;
bool achievements_primed_indicators = true;
#endif
struct DebugSettings
{

View File

@ -25,7 +25,7 @@
#include "gpu.h"
#include "gte.h"
#include "host.h"
#include "host_display.h"
#include "util/host_display.h"
#include "host_interface_progress_callback.h"
#include "host_settings.h"
#include "interrupt_controller.h"

View File

@ -4,7 +4,7 @@ add_executable(duckstation-nogui
nogui_platform.h
)
target_link_libraries(duckstation-nogui PRIVATE core util common imgui glad frontend-common scmversion)
target_link_libraries(duckstation-nogui PRIVATE core util common imgui glad scmversion)
if(WIN32)
message(STATUS "Building Win32 NoGUI Platform.")

View File

@ -48,9 +48,6 @@
<ProjectReference Include="..\core\core.vcxproj">
<Project>{868b98c8-65a1-494b-8346-250a73a48c0a}</Project>
</ProjectReference>
<ProjectReference Include="..\frontend-common\frontend-common.vcxproj">
<Project>{6245dec8-d2da-47ee-a373-cbd6fcf3ece6}</Project>
</ProjectReference>
<ProjectReference Include="..\util\util.vcxproj">
<Project>{57f6206d-f264-4b07-baf8-11b9bbe1f455}</Project>
</ProjectReference>
@ -59,6 +56,6 @@
<ProjectGuid>{0A172B2E-DC67-49FC-A4C1-975F93C586C4}</ProjectGuid>
</PropertyGroup>
<Import Project="..\..\dep\msvc\vsprops\Win32Application.props" />
<Import Project="..\frontend-common\frontend-common.props" />
<Import Project="..\core\core.props" />
<Import Project="..\..\dep\msvc\vsprops\Targets.props" />
</Project>

View File

@ -2,6 +2,30 @@
// SPDX-License-Identifier: (GPL-3.0 OR CC-BY-NC-ND-4.0)
#include "nogui_host.h"
#include "nogui_platform.h"
#include "scmversion/scmversion.h"
#include "core/common_host.h"
#include "core/controller.h"
#include "core/fullscreen_ui.h"
#include "core/game_list.h"
#include "core/gpu.h"
#include "core/host.h"
#include "core/host_settings.h"
#include "core/imgui_overlays.h"
#include "core/settings.h"
#include "core/system.h"
#include "util/host_display.h"
#include "util/imgui_manager.h"
#include "util/ini_settings_interface.h"
#include "util/input_manager.h"
#include "imgui.h"
#include "imgui_internal.h"
#include "imgui_stdlib.h"
#include "common/assert.h"
#include "common/byte_stream.h"
#include "common/crash_handler.h"
@ -10,35 +34,17 @@
#include "common/path.h"
#include "common/string_util.h"
#include "common/threading.h"
#include "core/controller.h"
#include "core/gpu.h"
#include "core/host.h"
#include "core/host_display.h"
#include "core/host_settings.h"
#include "core/settings.h"
#include "core/system.h"
#include "frontend-common/common_host.h"
#include "frontend-common/fullscreen_ui.h"
#include "frontend-common/game_list.h"
#include "frontend-common/icon.h"
#include "frontend-common/imgui_manager.h"
#include "frontend-common/imgui_overlays.h"
#include "frontend-common/input_manager.h"
#include "imgui.h"
#include "imgui_internal.h"
#include "imgui_stdlib.h"
#include "nogui_platform.h"
#include "scmversion/scmversion.h"
#include "util/ini_settings_interface.h"
#include <cinttypes>
#include <cmath>
#include <condition_variable>
#include <csignal>
#include <thread>
Log_SetChannel(NoGUIHost);
#ifdef WITH_CHEEVOS
#include "frontend-common/achievements.h"
#include "core/achievements_private.h"
#endif
#ifdef _WIN32
@ -731,6 +737,7 @@ void NoGUIHost::ReleaseHostDisplay()
InputManager::CloseSources();
CommonHost::ReleaseHostDisplayResources();
FullscreenUI::Shutdown();
ImGuiManager::Shutdown();
g_host_display.reset();
g_nogui_window->ExecuteInMessageLoop([]() {

View File

@ -4,7 +4,7 @@
#pragma once
#include "common/types.h"
#include "core/host_display.h"
#include "util/host_display.h"
#include <functional>
#include <memory>
#include <optional>

View File

@ -8,7 +8,7 @@
#include "common/threading.h"
#include "core/host.h"
#include "core/host_settings.h"
#include "frontend-common/imgui_manager.h"
#include "util/imgui_manager.h"
#include "nogui_host.h"
#include "resource.h"
#include "win32_key_names.h"

View File

@ -170,7 +170,7 @@ qt6_add_translation(QM_FILES ${TS_FILES})
add_executable(duckstation-qt ${SRCS} ${QM_FILES})
target_include_directories(duckstation-qt PRIVATE "${Qt6Gui_PRIVATE_INCLUDE_DIRS}" "${CMAKE_CURRENT_SOURCE_DIR}")
target_link_libraries(duckstation-qt PRIVATE frontend-common core common imgui glad minizip scmversion Qt6::Core Qt6::Gui Qt6::Widgets Qt6::Network)
target_link_libraries(duckstation-qt PRIVATE core common imgui glad minizip scmversion Qt6::Core Qt6::Gui Qt6::Widgets Qt6::Network)
if(WIN32)
# We want a Windows subsystem application not console.

View File

@ -2,7 +2,7 @@
// SPDX-License-Identifier: (GPL-3.0 OR CC-BY-NC-ND-4.0)
#include "achievementlogindialog.h"
#include "frontend-common/achievements.h"
#include "core/achievements_private.h"
#include "qthost.h"
#include <QtWidgets/QMessageBox>

View File

@ -3,13 +3,16 @@
#include "achievementsettingswidget.h"
#include "achievementlogindialog.h"
#include "common/string_util.h"
#include "core/system.h"
#include "frontend-common/achievements.h"
#include "mainwindow.h"
#include "qtutils.h"
#include "settingsdialog.h"
#include "settingwidgetbinder.h"
#include "core/achievements_private.h"
#include "core/system.h"
#include "common/string_util.h"
#include <QtCore/QDateTime>
#include <QtWidgets/QMessageBox>

View File

@ -2,11 +2,14 @@
// SPDX-License-Identifier: (GPL-3.0 OR CC-BY-NC-ND-4.0)
#include "audiosettingswidget.h"
#include "core/spu.h"
#include "frontend-common/common_host.h"
#include "settingsdialog.h"
#include "settingwidgetbinder.h"
#include "core/common_host.h"
#include "core/spu.h"
#include "util/audio_stream.h"
#include <cmath>
AudioSettingsWidget::AudioSettingsWidget(SettingsDialog* dialog, QWidget* parent) : QWidget(parent), m_dialog(dialog)
@ -107,8 +110,8 @@ void AudioSettingsWidget::updateDriverNames()
#ifdef WITH_CUBEB
if (backend == AudioBackend::Cubeb)
{
names = CommonHost::GetCubebDriverNames();
devices = CommonHost::GetCubebOutputDevices(m_dialog->getEffectiveStringValue("Audio", "Driver", "").c_str());
names = AudioStream::GetCubebDriverNames();
devices = AudioStream::GetCubebOutputDevices(m_dialog->getEffectiveStringValue("Audio", "Driver", "").c_str());
}
#endif

View File

@ -8,7 +8,7 @@
#include "controllersettingwidgetbinder.h"
#include "core/controller.h"
#include "core/host_settings.h"
#include "frontend-common/input_manager.h"
#include "util/input_manager.h"
#include "qthost.h"
#include "qtutils.h"
#include "settingsdialog.h"

View File

@ -7,7 +7,7 @@
#include "qtutils.h"
#include "settingwidgetbinder.h"
#include "frontend-common/sdl_input_source.h"
#include "util/sdl_input_source.h"
ControllerGlobalSettingsWidget::ControllerGlobalSettingsWidget(QWidget* parent, ControllerSettingsDialog* dialog)
: QWidget(parent), m_dialog(dialog)

View File

@ -8,7 +8,7 @@
#include "controllerglobalsettingswidget.h"
#include "core/controller.h"
#include "core/host_settings.h"
#include "frontend-common/input_manager.h"
#include "util/input_manager.h"
#include "hotkeysettingswidget.h"
#include "qthost.h"
#include "util/ini_settings_interface.h"

View File

@ -3,7 +3,7 @@
#pragma once
#include "common/types.h"
#include "frontend-common/input_manager.h"
#include "util/input_manager.h"
#include "ui_controllersettingsdialog.h"
#include <QtCore/QList>
#include <QtCore/QPair>

View File

@ -2,8 +2,10 @@
// SPDX-License-Identifier: (GPL-3.0 OR CC-BY-NC-ND-4.0)
#include "coverdownloaddialog.h"
#include "core/game_list.h"
#include "common/assert.h"
#include "frontend-common/game_list.h"
CoverDownloadDialog::CoverDownloadDialog(QWidget* parent /*= nullptr*/) : QDialog(parent)
{

View File

@ -12,11 +12,11 @@
// For enumerating adapters.
#ifdef _WIN32
#include "frontend-common/d3d11_host_display.h"
#include "frontend-common/d3d12_host_display.h"
#include "util/d3d11_host_display.h"
#include "util/d3d12_host_display.h"
#endif
#ifdef WITH_VULKAN
#include "frontend-common/vulkan_host_display.h"
#include "util/vulkan_host_display.h"
#endif
DisplaySettingsWidget::DisplaySettingsWidget(SettingsDialog* dialog, QWidget* parent)

View File

@ -5,7 +5,7 @@
#include "common/assert.h"
#include "common/bitutils.h"
#include "common/log.h"
#include "frontend-common/imgui_manager.h"
#include "util/imgui_manager.h"
#include "mainwindow.h"
#include "qthost.h"
#include "qtutils.h"

View File

@ -343,8 +343,8 @@
<ProjectReference Include="..\core\core.vcxproj">
<Project>{868b98c8-65a1-494b-8346-250a73a48c0a}</Project>
</ProjectReference>
<ProjectReference Include="..\frontend-common\frontend-common.vcxproj">
<Project>{6245dec8-d2da-47ee-a373-cbd6fcf3ece6}</Project>
<ProjectReference Include="..\scmversion\scmversion.vcxproj">
<Project>{075ced82-6a20-46df-94c7-9624ac9ddbeb}</Project>
</ProjectReference>
<ProjectReference Include="..\util\util.vcxproj">
<Project>{57f6206d-f264-4b07-baf8-11b9bbe1f455}</Project>
@ -359,7 +359,7 @@
</PropertyGroup>
<Import Project="..\..\dep\msvc\vsprops\Win32Application.props" />
<Import Project="..\..\dep\msvc\vsprops\QtCompile.props" />
<Import Project="..\frontend-common\frontend-common.props" />
<Import Project="..\core\core.props" />
<ItemDefinitionGroup>
<Link>
<AdditionalDependencies>$(QtEntryPointLib);%(AdditionalDependencies)</AdditionalDependencies>

View File

@ -2,11 +2,14 @@
// SPDX-License-Identifier: (GPL-3.0 OR CC-BY-NC-ND-4.0)
#pragma once
#include "core/game_database.h"
#include "core/game_list.h"
#include "core/types.h"
#include "common/heterogeneous_containers.h"
#include "common/lru_cache.h"
#include "core/game_database.h"
#include "core/types.h"
#include "frontend-common/game_list.h"
#include <QtCore/QAbstractTableModel>
#include <QtGui/QPixmap>
#include <algorithm>

View File

@ -2,10 +2,13 @@
// SPDX-License-Identifier: (GPL-3.0 OR CC-BY-NC-ND-4.0)
#include "gamelistrefreshthread.h"
#include "core/game_list.h"
#include "common/log.h"
#include "common/progress_callback.h"
#include "common/timer.h"
#include "frontend-common/game_list.h"
#include <QtWidgets/QMessageBox>
AsyncRefreshProgressCallback::AsyncRefreshProgressCallback(GameListRefreshThread* parent) : m_parent(parent) {}

View File

@ -2,14 +2,16 @@
// SPDX-License-Identifier: (GPL-3.0 OR CC-BY-NC-ND-4.0)
#include "gamelistsettingswidget.h"
#include "common/assert.h"
#include "common/file_system.h"
#include "common/string_util.h"
#include "frontend-common/game_list.h"
#include "core/game_list.h"
#include "gamelistsearchdirectoriesmodel.h"
#include "mainwindow.h"
#include "qthost.h"
#include "qtutils.h"
#include "common/assert.h"
#include "common/file_system.h"
#include "common/string_util.h"
#include <QtCore/QAbstractTableModel>
#include <QtCore/QDebug>
#include <QtCore/QSettings>

View File

@ -2,15 +2,18 @@
// SPDX-License-Identifier: (GPL-3.0 OR CC-BY-NC-ND-4.0)
#include "gamelistwidget.h"
#include "common/assert.h"
#include "common/string_util.h"
#include "core/host_settings.h"
#include "core/settings.h"
#include "frontend-common/game_list.h"
#include "gamelistmodel.h"
#include "gamelistrefreshthread.h"
#include "qthost.h"
#include "qtutils.h"
#include "core/game_list.h"
#include "core/host_settings.h"
#include "core/settings.h"
#include "common/assert.h"
#include "common/string_util.h"
#include <QtCore/QSortFilterProxyModel>
#include <QtGui/QGuiApplication>
#include <QtGui/QPixmap>

View File

@ -2,9 +2,11 @@
// SPDX-License-Identifier: (GPL-3.0 OR CC-BY-NC-ND-4.0)
#pragma once
#include "frontend-common/game_list.h"
#include "ui_emptygamelistwidget.h"
#include "ui_gamelistwidget.h"
#include "core/game_list.h"
#include <QtWidgets/QListView>
#include <QtWidgets/QTableView>

View File

@ -2,13 +2,17 @@
// SPDX-License-Identifier: (GPL-3.0 OR CC-BY-NC-ND-4.0)
#include "gamesummarywidget.h"
#include "common/string_util.h"
#include "core/game_database.h"
#include "fmt/format.h"
#include "frontend-common/game_list.h"
#include "qthost.h"
#include "qtprogresscallback.h"
#include "settingsdialog.h"
#include "core/game_database.h"
#include "core/game_list.h"
#include "common/string_util.h"
#include "fmt/format.h"
#include <QtConcurrent/QtConcurrent>
#include <QtCore/QFuture>
#include <QtWidgets/QMessageBox>

View File

@ -3,7 +3,7 @@
#include "hotkeysettingswidget.h"
#include "controllersettingsdialog.h"
#include "frontend-common/input_manager.h"
#include "util/input_manager.h"
#include "inputbindingwidgets.h"
#include "qtutils.h"
#include "settingwidgetbinder.h"

View File

@ -3,7 +3,7 @@
#pragma once
#include "common/types.h"
#include "frontend-common/input_manager.h"
#include "util/input_manager.h"
#include "ui_inputbindingdialog.h"
#include <QtWidgets/QDialog>
#include <optional>

View File

@ -3,7 +3,7 @@
#pragma once
#include "common/types.h"
#include "frontend-common/input_manager.h"
#include "util/input_manager.h"
#include <QtWidgets/QPushButton>
#include <optional>

View File

@ -5,20 +5,9 @@
#include "aboutdialog.h"
#include "autoupdaterdialog.h"
#include "cheatmanagerdialog.h"
#include "common/assert.h"
#include "common/file_system.h"
#include "common/log.h"
#include "core/achievements.h"
#include "core/host.h"
#include "core/host_display.h"
#include "core/memory_card.h"
#include "core/settings.h"
#include "core/system.h"
#include "coverdownloaddialog.h"
#include "debuggerwindow.h"
#include "displaywidget.h"
#include "frontend-common/game_list.h"
#include "frontend-common/platform_misc.h"
#include "gamelistsettingswidget.h"
#include "gamelistwidget.h"
#include "memorycardeditordialog.h"
@ -26,7 +15,21 @@
#include "qtutils.h"
#include "settingsdialog.h"
#include "settingwidgetbinder.h"
#include "core/achievements.h"
#include "core/game_list.h"
#include "core/host.h"
#include "core/memory_card.h"
#include "core/settings.h"
#include "core/system.h"
#include "util/cd_image.h"
#include "util/host_display.h"
#include "util/platform_misc.h"
#include "common/assert.h"
#include "common/file_system.h"
#include "common/log.h"
#include <QtCore/QDebug>
#include <QtCore/QFile>
@ -44,7 +47,7 @@
#include <cmath>
#ifdef WITH_CHEEVOS
#include "frontend-common/achievements.h"
#include "core/achievements_private.h"
#endif
#ifdef _WIN32

View File

@ -2,9 +2,9 @@
// SPDX-License-Identifier: (GPL-3.0 OR CC-BY-NC-ND-4.0)
#include "postprocessingchainconfigwidget.h"
#include "frontend-common/postprocessing_chain.h"
#include "postprocessingshaderconfigwidget.h"
#include "qthost.h"
#include "util/postprocessing_chain.h"
#include <QtGui/QCursor>
#include <QtWidgets/QMenu>
#include <QtWidgets/QMessageBox>

View File

@ -4,7 +4,7 @@
#pragma once
#include "common/types.h"
#include "ui_postprocessingchainconfigwidget.h"
#include "frontend-common/postprocessing_chain.h"
#include "util/postprocessing_chain.h"
#include <QtWidgets/QWidget>
#include <optional>
#include <memory>

View File

@ -2,7 +2,7 @@
// SPDX-License-Identifier: (GPL-3.0 OR CC-BY-NC-ND-4.0)
#pragma once
#include "frontend-common/postprocessing_shader.h"
#include "util/postprocessing_shader.h"
#include <QtWidgets/QDialog>
#include <QtWidgets/QWidget>

View File

@ -2,6 +2,24 @@
// SPDX-License-Identifier: (GPL-3.0 OR CC-BY-NC-ND-4.0)
#include "qthost.h"
#include "displaywidget.h"
#include "mainwindow.h"
#include "qtprogresscallback.h"
#include "qtutils.h"
#include "core/cheats.h"
#include "core/controller.h"
#include "core/fullscreen_ui.h"
#include "core/game_database.h"
#include "core/game_list.h"
#include "core/gpu.h"
#include "core/host.h"
#include "core/host_settings.h"
#include "core/imgui_overlays.h"
#include "core/memory_card.h"
#include "core/spu.h"
#include "core/system.h"
#include "common/assert.h"
#include "common/byte_stream.h"
#include "common/crash_handler.h"
@ -10,28 +28,16 @@
#include "common/path.h"
#include "common/string_util.h"
#include "common/window_info.h"
#include "core/cheats.h"
#include "core/controller.h"
#include "core/game_database.h"
#include "core/gpu.h"
#include "core/host.h"
#include "core/host_settings.h"
#include "core/memory_card.h"
#include "core/spu.h"
#include "core/system.h"
#include "displaywidget.h"
#include "frontend-common/fullscreen_ui.h"
#include "frontend-common/game_list.h"
#include "frontend-common/imgui_manager.h"
#include "frontend-common/imgui_overlays.h"
#include "frontend-common/input_manager.h"
#include "imgui.h"
#include "mainwindow.h"
#include "qtprogresscallback.h"
#include "qtutils.h"
#include "scmversion/scmversion.h"
#include "util/audio_stream.h"
#include "util/imgui_manager.h"
#include "util/ini_settings_interface.h"
#include "util/input_manager.h"
#include "scmversion/scmversion.h"
#include "imgui.h"
#include <QtCore/QCoreApplication>
#include <QtCore/QDateTime>
#include <QtCore/QDebug>
@ -49,7 +55,8 @@
#include <cstdio>
#include <cstdlib>
#include <memory>
Log_SetChannel(EmuThread);
Log_SetChannel(QtHost);
#ifdef _WIN32
#include "common/windows_headers.h"
@ -57,7 +64,7 @@ Log_SetChannel(EmuThread);
#endif
#ifdef WITH_CHEEVOS
#include "frontend-common/achievements.h"
#include "core/achievements_private.h"
#endif
static constexpr u32 SETTINGS_VERSION = 3;
@ -807,6 +814,7 @@ void EmuThread::releaseHostDisplay()
return;
CommonHost::ReleaseHostDisplayResources();
FullscreenUI::Shutdown();
ImGuiManager::Shutdown();
g_host_display.reset();
emit destroyDisplayRequested();

View File

@ -3,13 +3,13 @@
#pragma once
#include "core/host.h"
#include "core/host_display.h"
#include "util/host_display.h"
#include "core/host_settings.h"
#include "core/system.h"
#include "core/types.h"
#include "frontend-common/common_host.h"
#include "frontend-common/game_list.h"
#include "frontend-common/input_manager.h"
#include "core/common_host.h"
#include "core/game_list.h"
#include "util/input_manager.h"
#include "gdbserver.h"
#include "qtutils.h"
#include <QtCore/QByteArray>

View File

@ -4,7 +4,7 @@
#include "qtutils.h"
#include "common/string_util.h"
#include "fmt/format.h"
#include "frontend-common/input_manager.h"
#include "util/input_manager.h"
#include <QtGui/QKeyEvent>
struct KeyCodeName

View File

@ -4,7 +4,7 @@
#include "common/log.h"
#include "common/string_util.h"
#include "fmt/format.h"
#include "frontend-common/imgui_manager.h"
#include "util/imgui_manager.h"
#include "imgui.h"
#include "qthost.h"
#include <QtCore/QFile>

View File

@ -2,10 +2,13 @@
// SPDX-License-Identifier: (GPL-3.0 OR CC-BY-NC-ND-4.0)
#include "qtutils.h"
#include "core/game_list.h"
#include "core/system.h"
#include "common/byte_stream.h"
#include "common/make_array.h"
#include "core/system.h"
#include "frontend-common/game_list.h"
#include <QtCore/QCoreApplication>
#include <QtCore/QMetaObject>
#include <QtGui/QDesktopServices>

View File

@ -5,11 +5,8 @@
#include "advancedsettingswidget.h"
#include "audiosettingswidget.h"
#include "biossettingswidget.h"
#include "common/assert.h"
#include "common/file_system.h"
#include "consolesettingswidget.h"
#include "core/host.h"
#include "core/host_settings.h"
#include "displaysettingswidget.h"
#include "emulationsettingswidget.h"
#include "enhancementsettingswidget.h"
@ -21,13 +18,21 @@
#include "memorycardsettingswidget.h"
#include "postprocessingsettingswidget.h"
#include "qthost.h"
#include "core/host.h"
#include "core/host_settings.h"
#include "util/ini_settings_interface.h"
#include "common/assert.h"
#include "common/file_system.h"
#include <QtWidgets/QMessageBox>
#include <QtWidgets/QTextEdit>
#ifdef WITH_CHEEVOS
#include "achievementsettingswidget.h"
#include "frontend-common/achievements.h"
#include "core/achievements_private.h"
#endif
static QList<SettingsDialog*> s_open_game_properties_dialogs;

View File

@ -4,4 +4,4 @@ add_executable(duckstation-regtest
regtest_host.cpp
)
target_link_libraries(duckstation-regtest PRIVATE core common frontend-common scmversion)
target_link_libraries(duckstation-regtest PRIVATE core common scmversion)

View File

@ -18,14 +18,11 @@
<ProjectReference Include="..\core\core.vcxproj">
<Project>{868b98c8-65a1-494b-8346-250a73a48c0a}</Project>
</ProjectReference>
<ProjectReference Include="..\frontend-common\frontend-common.vcxproj">
<Project>{6245dec8-d2da-47ee-a373-cbd6fcf3ece6}</Project>
</ProjectReference>
<ProjectReference Include="..\util\util.vcxproj">
<Project>{57f6206d-f264-4b07-baf8-11b9bbe1f455}</Project>
</ProjectReference>
</ItemGroup>
<Import Project="..\..\dep\msvc\vsprops\ConsoleApplication.props" />
<Import Project="..\frontend-common\frontend-common.props" />
<Import Project="..\core\core.props" />
<Import Project="..\..\dep\msvc\vsprops\Targets.props" />
</Project>

View File

@ -1,154 +0,0 @@
add_library(frontend-common
common_host.cpp
common_host.h
fullscreen_ui.cpp
fullscreen_ui.h
game_list.cpp
game_list.h
host_settings.cpp
icon.cpp
icon.h
input_manager.cpp
input_manager.h
input_source.cpp
input_source.h
imgui_fullscreen.cpp
imgui_fullscreen.h
imgui_manager.cpp
imgui_manager.h
imgui_overlays.cpp
imgui_overlays.h
platform_misc.h
postprocessing_chain.cpp
postprocessing_chain.h
postprocessing_shader.cpp
postprocessing_shader.h
postprocessing_shadergen.cpp
postprocessing_shadergen.h
)
target_link_libraries(frontend-common PUBLIC core common imgui tinyxml2 rapidjson scmversion)
if(ENABLE_CUBEB)
target_sources(frontend-common PRIVATE
cubeb_audio_stream.cpp
cubeb_audio_stream.h
)
target_link_libraries(frontend-common PRIVATE cubeb)
endif()
if(WIN32)
target_sources(frontend-common PRIVATE
d3d11_host_display.cpp
d3d11_host_display.h
d3d12_host_display.cpp
d3d12_host_display.h
dinput_source.cpp
dinput_source.h
imgui_impl_dx11.cpp
imgui_impl_dx11.h
imgui_impl_dx12.cpp
imgui_impl_dx12.h
win32_raw_input_source.cpp
win32_raw_input_source.h
xaudio2_audio_stream.cpp
xaudio2_audio_stream.h
xinput_source.cpp
xinput_source.h
)
target_link_libraries(frontend-common PRIVATE d3d11.lib dxgi.lib)
endif()
if(ENABLE_OPENGL)
target_sources(frontend-common PRIVATE
opengl_host_display.cpp
opengl_host_display.h
imgui_impl_opengl3.cpp
imgui_impl_opengl3.h
)
target_link_libraries(frontend-common PRIVATE glad)
endif()
if(ENABLE_VULKAN)
target_sources(frontend-common PRIVATE
imgui_impl_vulkan.cpp
imgui_impl_vulkan.h
vulkan_host_display.cpp
vulkan_host_display.h
)
endif()
if(WIN32)
target_sources(frontend-common PRIVATE
platform_misc_win32.cpp
)
target_link_libraries(frontend-common PRIVATE winmm.lib)
elseif(APPLE)
find_library(IOK_LIBRARY IOKit REQUIRED)
target_link_libraries(frontend-common PRIVATE "${IOK_LIBRARY}")
target_sources(frontend-common PRIVATE
platform_misc_mac.mm
)
elseif(NOT ANDROID)
target_sources(frontend-common PRIVATE
platform_misc_unix.cpp
)
endif()
if(SDL2_FOUND)
target_sources(frontend-common PRIVATE
sdl_input_source.cpp
sdl_input_source.h
)
target_compile_definitions(frontend-common PUBLIC "WITH_SDL2=1")
target_include_directories(frontend-common PUBLIC ${SDL2_INCLUDE_DIRS})
target_link_libraries(frontend-common PUBLIC ${SDL2_LIBRARIES})
# Copy bundled SDL2 to output on Windows.
if(WIN32)
add_custom_command(TARGET frontend-common POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy_if_different "${SDL2_DLL_PATH}" "${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/SDL2.dll")
endif()
endif()
if(USE_EVDEV)
target_compile_definitions(frontend-common PUBLIC "-DWITH_EVDEV=1")
target_include_directories(frontend-common PRIVATE ${LIBEVDEV_INCLUDE_DIRS})
target_link_libraries(frontend-common PRIVATE ${LIBEVDEV_LIBRARIES})
target_sources(frontend-common PRIVATE
evdev_input_source.cpp
evdev_input_source.h
)
endif()
if(USE_X11)
target_compile_definitions(frontend-common PRIVATE "-DUSE_X11=1")
target_include_directories(frontend-common PRIVATE "${X11_INCLUDE_DIR}")
endif()
if(USE_DBUS)
target_compile_definitions(frontend-common PRIVATE USE_DBUS)
find_package(PkgConfig REQUIRED)
pkg_check_modules(DBUS REQUIRED dbus-1)
target_include_directories(frontend-common PRIVATE ${DBUS_INCLUDE_DIRS})
target_link_libraries(frontend-common PRIVATE ${DBUS_LINK_LIBRARIES})
endif()
if(ENABLE_DISCORD_PRESENCE)
target_compile_definitions(frontend-common PUBLIC -DWITH_DISCORD_PRESENCE=1)
target_link_libraries(frontend-common PRIVATE discord-rpc)
endif()
if(ENABLE_CHEEVOS)
target_sources(frontend-common PRIVATE
achievements.cpp
achievements.h
)
target_compile_definitions(frontend-common PUBLIC -DWITH_CHEEVOS=1)
target_link_libraries(frontend-common PRIVATE rcheevos rapidjson)
endif()
# Copy the provided data directory to the output directory.
add_custom_command(TARGET frontend-common POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy_directory "${CMAKE_SOURCE_DIR}/data" "${CMAKE_RUNTIME_OUTPUT_DIRECTORY}"
)

View File

@ -1,542 +0,0 @@
// SPDX-FileCopyrightText: 2019-2022 Connor McLaughlin <stenzek@gmail.com>
// SPDX-License-Identifier: (GPL-3.0 OR CC-BY-NC-ND-4.0)
#include "evdev_input_source.h"
#include "common/assert.h"
#include "common/log.h"
#include "common/string_util.h"
#include "core/host.h"
#include "fmt/format.h"
#include "input_manager.h"
#include <cmath>
#include <cstdlib>
#include <errno.h>
#include <fcntl.h>
#include <poll.h>
#include <tuple>
#include <unistd.h>
#ifdef __linux__
#include <alloca.h>
#endif
Log_SetChannel(EvdevInputSource);
static GenericInputBinding GetGenericBindingForButton(int button_id)
{
switch (button_id)
{
case BTN_A:
return GenericInputBinding::Cross;
case BTN_B:
return GenericInputBinding::Circle;
case BTN_X:
return GenericInputBinding::Square;
case BTN_Y:
return GenericInputBinding::Triangle;
case BTN_SELECT:
return GenericInputBinding::Select;
case BTN_START:
return GenericInputBinding::Start;
case BTN_MODE:
return GenericInputBinding::System;
case BTN_TL:
return GenericInputBinding::L1;
case BTN_TR:
return GenericInputBinding::R1;
case BTN_TL2:
return GenericInputBinding::L2;
case BTN_TR2:
return GenericInputBinding::R2;
case BTN_THUMBL:
return GenericInputBinding::L3;
case BTN_THUMBR:
return GenericInputBinding::R3;
case BTN_DPAD_LEFT:
return GenericInputBinding::DPadLeft;
case BTN_DPAD_RIGHT:
return GenericInputBinding::DPadRight;
case BTN_DPAD_UP:
return GenericInputBinding::DPadUp;
case BTN_DPAD_DOWN:
return GenericInputBinding::DPadDown;
default:
return GenericInputBinding::Unknown;
}
}
static std::tuple<GenericInputBinding, GenericInputBinding> GetGenericBindingForAxis(u32 axis)
{
switch (axis)
{
case ABS_X:
return std::make_tuple(GenericInputBinding::LeftStickLeft, GenericInputBinding::LeftStickRight);
case ABS_Y:
return std::make_tuple(GenericInputBinding::LeftStickUp, GenericInputBinding::LeftStickDown);
case ABS_RX:
return std::make_tuple(GenericInputBinding::RightStickLeft, GenericInputBinding::RightStickRight);
case ABS_RY:
return std::make_tuple(GenericInputBinding::RightStickUp, GenericInputBinding::RightStickDown);
default:
return std::make_tuple(GenericInputBinding::Unknown, GenericInputBinding::Unknown);
}
}
static bool IsFullAxis(u32 axis)
{
// ugh, so min isn't necessarily zero for full axes... :/
return (axis >= ABS_X && axis <= ABS_RZ);
}
EvdevInputSource::EvdevInputSource() = default;
EvdevInputSource::~EvdevInputSource() = default;
bool EvdevInputSource::Initialize(SettingsInterface& si, std::unique_lock<std::mutex>& settings_lock)
{
for (int index = 0; index < 1000; index++)
{
TinyString path;
path.Format("/dev/input/event%d", index);
int fd = open(path, O_RDONLY | O_NONBLOCK);
if (fd < 0)
{
if (errno == ENOENT)
break;
else
continue;
}
struct libevdev* obj;
if (libevdev_new_from_fd(fd, &obj) != 0)
{
Log_ErrorPrintf("libevdev_new_from_fd(%s) failed", path.GetCharArray());
close(fd);
continue;
}
ControllerData data(fd, obj);
data.controller_id = static_cast<int>(m_controllers.size());
if (InitializeController(index, &data))
m_controllers.push_back(std::move(data));
}
return true;
}
void EvdevInputSource::UpdateSettings(SettingsInterface& si, std::unique_lock<std::mutex>& settings_lock)
{
// noop
}
bool EvdevInputSource::ReloadDevices()
{
return false;
}
void EvdevInputSource::Shutdown()
{
// noop
}
EvdevInputSource::ControllerData::ControllerData(int fd_, struct libevdev* obj_) : obj(obj_), fd(fd_) {}
EvdevInputSource::ControllerData::ControllerData(ControllerData&& move)
: obj(move.obj), fd(move.fd), controller_id(move.controller_id), num_motors(move.num_motors), deadzone(move.deadzone),
uniq(std::move(move.uniq)), name(std::move(move.name)), axes(std::move(move.axes)), buttons(std::move(move.buttons))
{
move.obj = nullptr;
move.fd = -1;
}
EvdevInputSource::ControllerData::~ControllerData()
{
if (obj)
libevdev_free(obj);
if (fd >= 0)
close(fd);
}
EvdevInputSource::ControllerData& EvdevInputSource::ControllerData::operator=(EvdevInputSource::ControllerData&& move)
{
if (obj)
libevdev_free(obj);
obj = move.obj;
move.obj = nullptr;
if (fd >= 0)
close(fd);
fd = move.fd;
move.fd = -1;
controller_id = move.controller_id;
num_motors = move.num_motors;
deadzone = move.deadzone;
uniq = std::move(move.uniq);
name = std::move(move.name);
axes = std::move(move.axes);
buttons = std::move(move.buttons);
return *this;
}
EvdevInputSource::ControllerData* EvdevInputSource::GetControllerById(int id)
{
for (ControllerData& cd : m_controllers)
{
if (cd.controller_id == id)
return &cd;
}
return nullptr;
}
EvdevInputSource::ControllerData* EvdevInputSource::GetControllerByUniq(const std::string_view& uniq)
{
for (ControllerData& cd : m_controllers)
{
if (uniq == cd.uniq)
return &cd;
}
return nullptr;
}
bool EvdevInputSource::InitializeController(int index, ControllerData* cd)
{
const char* name = libevdev_get_name(cd->obj);
const char* uniq = libevdev_get_uniq(cd->obj);
cd->name = name ? name : "Unknown";
cd->uniq = uniq ? fmt::format("Evdev-{}", uniq) : fmt::format("Evdev-Unknown{}", index);
// Sanitize the name a bit just in case..
for (size_t i = 6; i < cd->uniq.length(); i++)
{
const char ch = cd->uniq[i];
if (!(ch >= 'a' && ch <= 'z') && !(ch >= 'A' && ch <= 'Z') && !(ch >= '0' && ch <= '9') && ch != '_')
cd->uniq[i] = '_';
}
Log_DevPrintf("Input %d device name: \"%s\" ('%s')", index, cd->name.c_str(), cd->uniq.c_str());
Log_DevPrintf("Input %d device ID: bus %#x vendor %#x product %#x", index, libevdev_get_id_bustype(cd->obj),
libevdev_get_id_vendor(cd->obj), libevdev_get_id_product(cd->obj));
bool has_dpad = false;
for (u32 key = 0; key < KEY_CNT; key++)
{
if (!libevdev_has_event_code(cd->obj, EV_KEY, key))
continue;
const char* button_name = libevdev_event_code_get_name(EV_KEY, key);
Log_DebugPrintf("Key %d: %s", key, button_name ? button_name : "null");
ControllerData::Button button;
button.name = button_name ? std::string(button_name) : fmt::format("Button{}", key);
button.id = key;
button.generic = GetGenericBindingForButton(key);
cd->buttons.push_back(std::move(button));
if (key == BTN_DPAD_LEFT || key == BTN_DPAD_RIGHT || key == BTN_DPAD_UP || key == BTN_DPAD_DOWN)
has_dpad = true;
}
// Prelookup axes to get the range of them.
for (u32 axis = 0; axis <= ABS_TOOL_WIDTH; axis++)
{
if (!libevdev_has_event_code(cd->obj, EV_ABS, axis))
continue;
const s32 min = libevdev_get_abs_minimum(cd->obj, axis);
const s32 max = libevdev_get_abs_maximum(cd->obj, axis);
const char* axis_name = libevdev_event_code_get_name(EV_ABS, axis);
Log_DebugPrintf("Axis %u: %s [%d-%d]", axis, axis_name ? axis_name : "null", min, max);
ControllerData::Axis ad;
ad.name = axis_name ? std::string(axis_name) : fmt::format("Button{}", axis);
ad.id = axis;
ad.min = min;
ad.range = max - min;
ad.neg_button = 0;
ad.pos_button = 0;
std::tie(ad.neg_generic, ad.pos_generic) = GetGenericBindingForAxis(axis);
if (!has_dpad)
{
// map hat -> dpad
if (axis == ABS_HAT0X)
{
Log_VerbosePrintf("Redirecting HAT0X to DPad left/right");
ad.neg_button = BTN_DPAD_LEFT;
ad.pos_button = BTN_DPAD_RIGHT;
cd->buttons.emplace_back("BTN_DPAD_LEFT", BTN_DPAD_LEFT, GenericInputBinding::DPadLeft);
cd->buttons.emplace_back("BTN_DPAD_RIGHT", BTN_DPAD_RIGHT, GenericInputBinding::DPadRight);
}
else if (axis == ABS_HAT0Y)
{
Log_VerbosePrintf("Redirecting HAT0Y to DPad up/down");
ad.neg_button = BTN_DPAD_UP;
ad.pos_button = BTN_DPAD_DOWN;
cd->buttons.emplace_back("BTN_DPAD_UP", BTN_DPAD_UP, GenericInputBinding::DPadUp);
cd->buttons.emplace_back("BTN_DPAD_DOWN", BTN_DPAD_DOWN, GenericInputBinding::DPadDown);
}
}
cd->axes.push_back(std::move(ad));
}
// Heuristic borrowed from Dolphin's evdev controller interface - ignore bogus devices
// which do have less than 2 axes and less than 8 buttons. Key count of 80 is probably a keyboard.
// Axes with no buttons is probably a motion sensor.
if ((cd->axes.size() < 2 && cd->buttons.size() < 8) || cd->buttons.size() > 80 || (cd->axes.size() >= 6 && cd->buttons.empty()))
{
Log_VerbosePrintf("Ignoring device %s with %zu axes and %zu buttons due to heuristic", name, cd->axes.size(),
cd->buttons.size());
return false;
}
Log_InfoPrintf("Controller %d -> %s with %zu axes and %zu buttons", cd->controller_id, name, cd->axes.size(),
cd->buttons.size());
return true;
}
std::vector<std::pair<std::string, std::string>> EvdevInputSource::EnumerateDevices()
{
std::vector<std::pair<std::string, std::string>> ret;
for (const ControllerData& cd : m_controllers)
ret.emplace_back(cd.uniq, cd.name);
return ret;
}
std::optional<InputBindingKey> EvdevInputSource::ParseKeyString(const std::string_view& device,
const std::string_view& binding)
{
if (!StringUtil::StartsWith(device, "Evdev-") || binding.empty())
return std::nullopt;
const ControllerData* cd = GetControllerByUniq(device);
if (!cd)
return std::nullopt;
InputBindingKey key = {};
key.source_type = InputSourceType::Evdev;
key.source_index = static_cast<u32>(cd->controller_id);
if (binding[0] == '-' || binding[0] == '+')
{
const std::string_view abinding(binding.substr(1));
for (const ControllerData::Axis& axis : cd->axes)
{
if (abinding == axis.name)
{
key.source_subtype = InputSubclass::ControllerAxis;
key.negative = (binding[0] == '-');
key.data = axis.id;
return key;
}
}
}
else
{
for (const ControllerData::Button& button : cd->buttons)
{
if (binding == button.name)
{
key.source_subtype = InputSubclass::ControllerButton;
key.data = button.id;
return key;
}
}
}
return std::nullopt;
}
std::string EvdevInputSource::ConvertKeyToString(InputBindingKey key)
{
std::string ret;
if (key.source_type == InputSourceType::Evdev)
{
const ControllerData* cd = GetControllerById(key.source_index);
if (cd)
{
if (key.source_subtype == InputSubclass::ControllerAxis)
{
for (const ControllerData::Axis& axis : cd->axes)
{
if (static_cast<u32>(axis.id) == key.data)
{
ret = fmt::format("{}/{}{}", cd->uniq, key.negative ? "-" : "+", axis.name);
break;
}
}
}
else if (key.source_subtype == InputSubclass::ControllerButton)
{
for (const ControllerData::Button& button : cd->buttons)
{
if (static_cast<u32>(button.id) == key.data)
{
ret = fmt::format("{}/{}", cd->uniq, button.name);
break;
}
}
}
}
}
return ret;
}
bool EvdevInputSource::GetGenericBindingMapping(const std::string_view& device, GenericInputBindingMapping* mapping)
{
const ControllerData* cd = GetControllerByUniq(device);
if (!cd)
return false;
for (const ControllerData::Button& button : cd->buttons)
{
if (button.generic != GenericInputBinding::Unknown)
mapping->emplace_back(button.generic, fmt::format("{}/{}", cd->uniq, button.name));
}
for (const ControllerData::Axis& axis : cd->axes)
{
if (axis.neg_generic != GenericInputBinding::Unknown)
mapping->emplace_back(axis.neg_generic, fmt::format("{}/-{}", cd->uniq, axis.name));
if (axis.pos_generic != GenericInputBinding::Unknown)
mapping->emplace_back(axis.pos_generic, fmt::format("{}/+{}", cd->uniq, axis.name));
}
return true;
}
std::vector<InputBindingKey> EvdevInputSource::EnumerateMotors()
{
// noop
return {};
}
void EvdevInputSource::UpdateMotorState(InputBindingKey key, float intensity)
{
// noop
}
void EvdevInputSource::UpdateMotorState(InputBindingKey large_key, InputBindingKey small_key, float large_intensity,
float small_intensity)
{
// noop
}
void EvdevInputSource::PollEvents()
{
if (m_controllers.empty())
return;
struct pollfd* fds = static_cast<struct pollfd*>(alloca(sizeof(struct pollfd) * m_controllers.size()));
for (size_t i = 0; i < m_controllers.size(); i++)
{
fds[i].events = POLLIN;
fds[i].fd = m_controllers[i].fd;
fds[i].revents = 0;
}
if (poll(fds, static_cast<int>(m_controllers.size()), 0) <= 0)
return;
for (size_t i = 0; i < m_controllers.size(); i++)
{
if (fds[i].revents & POLLIN)
HandleControllerEvents(&m_controllers[i]);
}
}
void EvdevInputSource::HandleControllerEvents(ControllerData* cd)
{
struct input_event ev;
while (libevdev_next_event(cd->obj, LIBEVDEV_READ_FLAG_NORMAL, &ev) == 0)
{
switch (ev.type)
{
case EV_KEY:
{
// auto-repeat
if (ev.value == 2)
continue;
const bool pressed = (ev.value == 1);
Log_DebugPrintf("%s %s Key %d %s", cd->uniq.c_str(), cd->name.c_str(), ev.code, pressed ? "pressed" : "unpressed");
InputManager::InvokeEvents(MakeGenericControllerButtonKey(InputSourceType::Evdev, cd->controller_id, ev.code),
pressed ? 1.0f : 0.0f, GetGenericBindingForButton(ev.code));
}
break;
case EV_ABS:
{
// axis
Log_DebugPrintf("%s %s Axis %u %d", cd->uniq.c_str(), cd->name.c_str(), ev.code, ev.value);
for (ControllerData::Axis& axis : cd->axes)
{
if (axis.id == ev.code)
{
const float norm_value = static_cast<float>(static_cast<s32>(ev.value) - static_cast<s32>(axis.min)) /
static_cast<float>(axis.range);
const float real_value = (axis.min < 0 || IsFullAxis(ev.code)) ? ((norm_value * 2.0f) - 1.0f) : norm_value;
// hat -> dpad mapping
static constexpr float MAPPING_DEADZONE = 0.5f;
if (axis.neg_button != 0)
{
if (real_value <= -MAPPING_DEADZONE && axis.last_value > -MAPPING_DEADZONE)
{
// gone negative
InputManager::InvokeEvents(
MakeGenericControllerButtonKey(InputSourceType::Evdev, cd->controller_id, axis.neg_button), 1.0f,
GetGenericBindingForButton(axis.neg_button));
}
else if (real_value > -MAPPING_DEADZONE && axis.last_value <= -MAPPING_DEADZONE)
{
// no longer negative
InputManager::InvokeEvents(
MakeGenericControllerButtonKey(InputSourceType::Evdev, cd->controller_id, axis.neg_button), 0.0f,
GetGenericBindingForButton(axis.neg_button));
}
else if (real_value >= MAPPING_DEADZONE && axis.last_value < MAPPING_DEADZONE)
{
// gone positive
InputManager::InvokeEvents(
MakeGenericControllerButtonKey(InputSourceType::Evdev, cd->controller_id, axis.pos_button), 1.0f,
GetGenericBindingForButton(axis.pos_button));
}
else if (real_value < MAPPING_DEADZONE && axis.last_value >= MAPPING_DEADZONE)
{
// no longer positive
InputManager::InvokeEvents(
MakeGenericControllerButtonKey(InputSourceType::Evdev, cd->controller_id, axis.pos_button), 0.0f,
GetGenericBindingForButton(axis.pos_button));
}
}
else if (axis.last_value != real_value)
{
const GenericInputBinding generic = (real_value < 0.0f) ? axis.neg_generic : axis.pos_generic;
InputManager::InvokeEvents(
MakeGenericControllerAxisKey(InputSourceType::Evdev, cd->controller_id, ev.code), real_value, generic);
}
axis.last_value = real_value;
break;
}
}
}
break;
default:
break;
}
}
}
std::unique_ptr<InputSource> InputSource::CreateEvdevSource()
{
return std::make_unique<EvdevInputSource>();
}

View File

@ -1,92 +0,0 @@
// SPDX-FileCopyrightText: 2019-2022 Connor McLaughlin <stenzek@gmail.com>
// SPDX-License-Identifier: (GPL-3.0 OR CC-BY-NC-ND-4.0)
#pragma once
#include "core/types.h"
#include "input_source.h"
#include <array>
#include <functional>
#include <libevdev/libevdev.h>
#include <mutex>
#include <vector>
class EvdevInputSource final : public InputSource
{
public:
EvdevInputSource();
~EvdevInputSource() override;
bool Initialize(SettingsInterface& si, std::unique_lock<std::mutex>& settings_lock) override;
void UpdateSettings(SettingsInterface& si, std::unique_lock<std::mutex>& settings_lock) override;
bool ReloadDevices() override;
void Shutdown() override;
void PollEvents() override;
std::vector<std::pair<std::string, std::string>> EnumerateDevices() override;
std::vector<InputBindingKey> EnumerateMotors() override;
bool GetGenericBindingMapping(const std::string_view& device, GenericInputBindingMapping* mapping) override;
void UpdateMotorState(InputBindingKey key, float intensity) override;
void UpdateMotorState(InputBindingKey large_key, InputBindingKey small_key, float large_intensity,
float small_intensity) override;
std::optional<InputBindingKey> ParseKeyString(const std::string_view& device,
const std::string_view& binding) override;
std::string ConvertKeyToString(InputBindingKey key) override;
private:
struct ControllerData
{
ControllerData(int fd_, struct libevdev* obj_);
ControllerData(const ControllerData&) = delete;
ControllerData(ControllerData&& move);
~ControllerData();
ControllerData& operator=(const ControllerData&) = delete;
ControllerData& operator=(ControllerData&& move);
struct libevdev* obj = nullptr;
int fd = -1;
int controller_id = 0;
u32 num_motors = 0;
float deadzone = 0.25f;
struct Axis
{
std::string name;
u32 id;
s32 min;
s32 range;
u32 neg_button;
u32 pos_button;
GenericInputBinding neg_generic;
GenericInputBinding pos_generic;
float last_value;
};
struct Button
{
Button() = default;
Button(std::string name_, u32 id_, GenericInputBinding generic_)
: name(std::move(name_)), id(id_), generic(generic_)
{
}
std::string name;
u32 id;
GenericInputBinding generic;
};
std::string uniq;
std::string name;
std::vector<Axis> axes;
std::vector<Button> buttons;
};
ControllerData* GetControllerById(int id);
ControllerData* GetControllerByUniq(const std::string_view& uniq);
bool InitializeController(int index, ControllerData* cd);
void HandleControllerEvents(ControllerData* cd);
std::vector<ControllerData> m_controllers;
};

View File

@ -1,13 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="..\core\core.props" />
<ItemDefinitionGroup>
<ClCompile>
<PreprocessorDefinitions>WITH_SDL2=1;WITH_DINPUT=1;WITH_DISCORD_PRESENCE=1;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<AdditionalIncludeDirectories>%(AdditionalIncludeDirectories);$(SolutionDir)dep\cubeb\include;$(SolutionDir)dep\discord-rpc\include</AdditionalIncludeDirectories>
</ClCompile>
</ItemDefinitionGroup>
<Import Project="..\..\dep\msvc\vsprops\SDL2Compile.props" />
</Project>

View File

@ -1,110 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="..\..\dep\msvc\vsprops\Configurations.props" />
<ItemGroup>
<ClCompile Include="achievements.cpp" />
<ClCompile Include="common_host.cpp" />
<ClCompile Include="cubeb_audio_stream.cpp" />
<ClCompile Include="d3d11_host_display.cpp" />
<ClCompile Include="dinput_source.cpp" />
<ClCompile Include="fullscreen_ui.cpp" />
<ClCompile Include="d3d12_host_display.cpp" />
<ClCompile Include="game_list.cpp" />
<ClCompile Include="host_settings.cpp" />
<ClCompile Include="icon.cpp" />
<ClCompile Include="imgui_fullscreen.cpp" />
<ClCompile Include="imgui_impl_dx11.cpp" />
<ClCompile Include="imgui_impl_dx12.cpp" />
<ClCompile Include="imgui_impl_opengl3.cpp">
<ExcludedFromBuild Condition="'$(Platform)'=='ARM64'">true</ExcludedFromBuild>
</ClCompile>
<ClCompile Include="imgui_impl_vulkan.cpp">
<ExcludedFromBuild Condition="'$(Platform)'=='ARM64'">true</ExcludedFromBuild>
</ClCompile>
<ClCompile Include="imgui_manager.cpp" />
<ClCompile Include="imgui_overlays.cpp" />
<ClCompile Include="input_manager.cpp" />
<ClCompile Include="input_source.cpp" />
<ClCompile Include="opengl_host_display.cpp">
<ExcludedFromBuild Condition="'$(Platform)'=='ARM64'">true</ExcludedFromBuild>
</ClCompile>
<ClCompile Include="platform_misc_win32.cpp" />
<ClCompile Include="postprocessing_chain.cpp" />
<ClCompile Include="postprocessing_shader.cpp" />
<ClCompile Include="postprocessing_shadergen.cpp" />
<ClCompile Include="sdl_input_source.cpp" />
<ClCompile Include="vulkan_host_display.cpp">
<ExcludedFromBuild Condition="'$(Platform)'=='ARM64'">true</ExcludedFromBuild>
</ClCompile>
<ClCompile Include="win32_raw_input_source.cpp" />
<ClCompile Include="xaudio2_audio_stream.cpp" />
<ClCompile Include="xinput_source.cpp" />
</ItemGroup>
<ItemGroup>
<ClInclude Include="achievements.h" />
<ClInclude Include="common_host.h" />
<ClInclude Include="cubeb_audio_stream.h" />
<ClInclude Include="d3d11_host_display.h" />
<ClInclude Include="dinput_source.h" />
<ClInclude Include="fullscreen_ui.h" />
<ClInclude Include="d3d12_host_display.h" />
<ClInclude Include="game_list.h" />
<ClInclude Include="icon.h" />
<ClInclude Include="imgui_fullscreen.h" />
<ClInclude Include="imgui_impl_dx11.h" />
<ClInclude Include="imgui_impl_dx12.h" />
<ClInclude Include="imgui_impl_opengl3.h">
<ExcludedFromBuild Condition="'$(Platform)'=='ARM64'">true</ExcludedFromBuild>
</ClInclude>
<ClInclude Include="imgui_impl_vulkan.h">
<ExcludedFromBuild Condition="'$(Platform)'=='ARM64'">true</ExcludedFromBuild>
</ClInclude>
<ClInclude Include="imgui_manager.h" />
<ClInclude Include="imgui_overlays.h" />
<ClInclude Include="platform_misc.h" />
<ClInclude Include="input_manager.h" />
<ClInclude Include="input_source.h" />
<ClInclude Include="opengl_host_display.h">
<ExcludedFromBuild Condition="'$(Platform)'=='ARM64'">true</ExcludedFromBuild>
</ClInclude>
<ClInclude Include="postprocessing_chain.h" />
<ClInclude Include="postprocessing_shader.h" />
<ClInclude Include="postprocessing_shadergen.h" />
<ClInclude Include="sdl_input_source.h" />
<ClInclude Include="vulkan_host_display.h">
<ExcludedFromBuild Condition="'$(Platform)'=='ARM64'">true</ExcludedFromBuild>
</ClInclude>
<ClInclude Include="win32_raw_input_source.h" />
<ClInclude Include="xaudio2_audio_stream.h" />
<ClInclude Include="xinput_source.h" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\dep\cubeb\cubeb.vcxproj">
<Project>{72f9423c-91ee-4487-aac6-555ed6f61aa1}</Project>
</ProjectReference>
<ProjectReference Include="..\..\dep\discord-rpc\discord-rpc.vcxproj">
<Project>{4266505b-dbaf-484b-ab31-b53b9c8235b3}</Project>
</ProjectReference>
<ProjectReference Include="..\..\dep\minizip\minizip.vcxproj">
<Project>{8bda439c-6358-45fb-9994-2ff083babe06}</Project>
</ProjectReference>
<ProjectReference Include="..\..\dep\simpleini\simpleini.vcxproj">
<Project>{3773f4cc-614e-4028-8595-22e08ca649e3}</Project>
</ProjectReference>
<ProjectReference Include="..\..\dep\tinyxml2\tinyxml2.vcxproj">
<Project>{933118a9-68c5-47b4-b151-b03c93961623}</Project>
</ProjectReference>
<ProjectReference Include="..\core\core.vcxproj">
<Project>{868b98c8-65a1-494b-8346-250a73a48c0a}</Project>
</ProjectReference>
<ProjectReference Include="..\scmversion\scmversion.vcxproj">
<Project>{075ced82-6a20-46df-94c7-9624ac9ddbeb}</Project>
</ProjectReference>
</ItemGroup>
<PropertyGroup Label="Globals">
<ProjectGuid>{6245DEC8-D2DA-47EE-A373-CBD6FCF3ECE6}</ProjectGuid>
</PropertyGroup>
<Import Project="..\..\dep\msvc\vsprops\StaticLibrary.props" />
<Import Project="frontend-common.props" />
<Import Project="..\..\dep\msvc\vsprops\Targets.props" />
</Project>

View File

@ -1,64 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
<ClCompile Include="icon.cpp" />
<ClCompile Include="common_host.cpp" />
<ClCompile Include="vulkan_host_display.cpp" />
<ClCompile Include="d3d11_host_display.cpp" />
<ClCompile Include="opengl_host_display.cpp" />
<ClCompile Include="game_list.cpp" />
<ClCompile Include="imgui_impl_dx11.cpp" />
<ClCompile Include="imgui_impl_opengl3.cpp" />
<ClCompile Include="imgui_impl_vulkan.cpp" />
<ClCompile Include="postprocessing_shader.cpp" />
<ClCompile Include="postprocessing_shadergen.cpp" />
<ClCompile Include="postprocessing_chain.cpp" />
<ClCompile Include="cubeb_audio_stream.cpp" />
<ClCompile Include="fullscreen_ui.cpp" />
<ClCompile Include="xaudio2_audio_stream.cpp" />
<ClCompile Include="d3d12_host_display.cpp" />
<ClCompile Include="imgui_impl_dx12.cpp" />
<ClCompile Include="host_settings.cpp" />
<ClCompile Include="input_source.cpp" />
<ClCompile Include="sdl_input_source.cpp" />
<ClCompile Include="xinput_source.cpp" />
<ClCompile Include="input_manager.cpp" />
<ClCompile Include="imgui_manager.cpp" />
<ClCompile Include="imgui_fullscreen.cpp" />
<ClCompile Include="achievements.cpp" />
<ClCompile Include="win32_raw_input_source.cpp" />
<ClCompile Include="dinput_source.cpp" />
<ClCompile Include="imgui_overlays.cpp" />
<ClCompile Include="platform_misc_win32.cpp" />
</ItemGroup>
<ItemGroup>
<ClInclude Include="icon.h" />
<ClInclude Include="common_host.h" />
<ClInclude Include="vulkan_host_display.h" />
<ClInclude Include="d3d11_host_display.h" />
<ClInclude Include="opengl_host_display.h" />
<ClInclude Include="game_list.h" />
<ClInclude Include="imgui_impl_vulkan.h" />
<ClInclude Include="imgui_impl_dx11.h" />
<ClInclude Include="imgui_impl_opengl3.h" />
<ClInclude Include="postprocessing_shader.h" />
<ClInclude Include="postprocessing_shadergen.h" />
<ClInclude Include="postprocessing_chain.h" />
<ClInclude Include="cubeb_audio_stream.h" />
<ClInclude Include="fullscreen_ui.h" />
<ClInclude Include="platform_misc.h" />
<ClInclude Include="xaudio2_audio_stream.h" />
<ClInclude Include="d3d12_host_display.h" />
<ClInclude Include="imgui_impl_dx12.h" />
<ClInclude Include="input_manager.h" />
<ClInclude Include="input_source.h" />
<ClInclude Include="sdl_input_source.h" />
<ClInclude Include="xinput_source.h" />
<ClInclude Include="imgui_manager.h" />
<ClInclude Include="imgui_fullscreen.h" />
<ClInclude Include="achievements.h" />
<ClInclude Include="win32_raw_input_source.h" />
<ClInclude Include="dinput_source.h" />
<ClInclude Include="imgui_overlays.h" />
</ItemGroup>
</Project>

File diff suppressed because it is too large Load Diff

View File

@ -1,12 +0,0 @@
// SPDX-FileCopyrightText: 2019-2022 Connor McLaughlin <stenzek@gmail.com>
// SPDX-License-Identifier: (GPL-3.0 OR CC-BY-NC-ND-4.0)
#pragma once
constexpr int WINDOW_ICON_WIDTH = 64;
constexpr int WINDOW_ICON_HEIGHT = 64;
extern unsigned int WINDOW_ICON_DATA[WINDOW_ICON_WIDTH * WINDOW_ICON_HEIGHT];
constexpr int PLACEHOLDER_ICON_WIDTH = 128;
constexpr int PLACEHOLDER_ICON_HEIGHT = 96;
extern unsigned int PLACEHOLDER_ICON_DATA[PLACEHOLDER_ICON_WIDTH * PLACEHOLDER_ICON_HEIGHT];

View File

@ -21,8 +21,18 @@ add_library(util
cd_xa.h
cue_parser.cpp
cue_parser.h
host_display.cpp
host_display.h
imgui_fullscreen.cpp
imgui_fullscreen.h
imgui_manager.cpp
imgui_manager.h
ini_settings_interface.cpp
ini_settings_interface.h
input_manager.cpp
input_manager.h
input_source.cpp
input_source.h
iso_reader.cpp
iso_reader.h
jit_code_buffer.cpp
@ -31,6 +41,15 @@ add_library(util
memory_arena.h
page_fault_handler.cpp
page_fault_handler.h
platform_misc.h
postprocessing_chain.cpp
postprocessing_chain.h
postprocessing_shader.cpp
postprocessing_shader.h
postprocessing_shadergen.cpp
postprocessing_shadergen.h
shadergen.cpp
shadergen.h
shiftjis.cpp
shiftjis.h
state_wrapper.cpp
@ -41,5 +60,95 @@ add_library(util
target_include_directories(util PRIVATE "${CMAKE_CURRENT_SOURCE_DIR}/..")
target_include_directories(util PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}/..")
target_link_libraries(util PUBLIC common simpleini)
target_link_libraries(util PRIVATE libchdr zlib soundtouch)
target_link_libraries(util PUBLIC common simpleini imgui)
target_link_libraries(util PRIVATE stb libchdr zlib soundtouch)
if(ENABLE_CUBEB)
target_sources(util PRIVATE
cubeb_audio_stream.cpp
cubeb_audio_stream.h
)
target_compile_definitions(util PUBLIC "WITH_CUBEB=1")
target_link_libraries(util PRIVATE cubeb)
endif()
if(ENABLE_OPENGL)
target_sources(util PRIVATE
opengl_host_display.cpp
opengl_host_display.h
imgui_impl_opengl3.cpp
imgui_impl_opengl3.h
)
target_link_libraries(util PRIVATE glad)
endif()
if(ENABLE_VULKAN)
target_sources(util PRIVATE
imgui_impl_vulkan.cpp
imgui_impl_vulkan.h
vulkan_host_display.cpp
vulkan_host_display.h
)
endif()
if(SDL2_FOUND)
target_sources(util PRIVATE
sdl_input_source.cpp
sdl_input_source.h
)
target_compile_definitions(util PUBLIC "WITH_SDL2=1")
target_include_directories(util PUBLIC ${SDL2_INCLUDE_DIRS})
target_link_libraries(util PUBLIC ${SDL2_LIBRARIES})
# Copy bundled SDL2 to output on Windows.
if(WIN32)
add_custom_command(TARGET util POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy_if_different "${SDL2_DLL_PATH}" "${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/SDL2.dll")
endif()
endif()
if(USE_X11)
target_compile_definitions(util PRIVATE "-DUSE_X11=1")
target_include_directories(util PRIVATE "${X11_INCLUDE_DIR}")
endif()
if(USE_DBUS)
target_compile_definitions(util PRIVATE USE_DBUS)
find_package(PkgConfig REQUIRED)
pkg_check_modules(DBUS REQUIRED dbus-1)
target_include_directories(util PRIVATE ${DBUS_INCLUDE_DIRS})
target_link_libraries(util PRIVATE ${DBUS_LINK_LIBRARIES})
endif()
if(WIN32)
target_sources(util PRIVATE
d3d11_host_display.cpp
d3d11_host_display.h
d3d12_host_display.cpp
d3d12_host_display.h
dinput_source.cpp
dinput_source.h
imgui_impl_dx11.cpp
imgui_impl_dx11.h
imgui_impl_dx12.cpp
imgui_impl_dx12.h
platform_misc_win32.cpp
win32_raw_input_source.cpp
win32_raw_input_source.h
xaudio2_audio_stream.cpp
xaudio2_audio_stream.h
xinput_source.cpp
xinput_source.h
)
target_link_libraries(util PRIVATE d3d11.lib dxgi.lib winmm.lib)
elseif(APPLE)
find_library(IOK_LIBRARY IOKit REQUIRED)
target_link_libraries(util PRIVATE "${IOK_LIBRARY}")
target_sources(util PRIVATE
platform_misc_mac.mm
)
elseif(NOT ANDROID)
target_sources(util PRIVATE
platform_misc_unix.cpp
)
endif()

View File

@ -7,6 +7,8 @@
#include <atomic>
#include <memory>
#include <optional>
#include <string>
#include <vector>
#ifdef _MSC_VER
#pragma warning(push)
@ -77,6 +79,17 @@ public:
static std::unique_ptr<AudioStream> CreateNullStream(u32 sample_rate, u32 channels, u32 buffer_ms);
#ifdef WITH_CUBEB
static std::unique_ptr<AudioStream> CreateCubebAudioStream(u32 sample_rate, u32 channels, u32 buffer_ms,
u32 latency_ms, AudioStretchMode stretch);
static std::vector<std::string> GetCubebDriverNames();
static std::vector<std::pair<std::string, std::string>> GetCubebOutputDevices(const char* driver);
#endif
#ifdef _WIN32
static std::unique_ptr<AudioStream> CreateXAudio2Stream(u32 sample_rate, u32 channels, u32 buffer_ms, u32 latency_ms,
AudioStretchMode stretch);
#endif
protected:
AudioStream(u32 sample_rate, u32 channels, u32 buffer_ms, AudioStretchMode stretch);
void BaseInitialize();

View File

@ -6,7 +6,6 @@
#include "common/log.h"
#include "common/scoped_guard.h"
#include "common/string_util.h"
#include "common_host.h"
#include "core/host.h"
#include "core/settings.h"
#include "cubeb/cubeb.h"
@ -232,8 +231,8 @@ void CubebAudioStream::SetOutputVolume(u32 volume)
m_volume = volume;
}
std::unique_ptr<AudioStream> CommonHost::CreateCubebAudioStream(u32 sample_rate, u32 channels, u32 buffer_ms,
u32 latency_ms, AudioStretchMode stretch)
std::unique_ptr<AudioStream> AudioStream::CreateCubebAudioStream(u32 sample_rate, u32 channels, u32 buffer_ms,
u32 latency_ms, AudioStretchMode stretch)
{
std::unique_ptr<CubebAudioStream> stream(
std::make_unique<CubebAudioStream>(sample_rate, channels, buffer_ms, stretch));
@ -242,7 +241,7 @@ std::unique_ptr<AudioStream> CommonHost::CreateCubebAudioStream(u32 sample_rate,
return stream;
}
std::vector<std::string> CommonHost::GetCubebDriverNames()
std::vector<std::string> AudioStream::GetCubebDriverNames()
{
std::vector<std::string> names;
const char** cubeb_names = cubeb_get_backend_names();
@ -251,7 +250,7 @@ std::vector<std::string> CommonHost::GetCubebDriverNames()
return names;
}
std::vector<std::pair<std::string, std::string>> CommonHost::GetCubebOutputDevices(const char* driver)
std::vector<std::pair<std::string, std::string>> AudioStream::GetCubebOutputDevices(const char* driver)
{
std::vector<std::pair<std::string, std::string>> ret;
ret.emplace_back(std::string(), Host::TranslateStdString("CommonHost", "Default Output Device"));

View File

@ -2,7 +2,9 @@
// SPDX-License-Identifier: (GPL-3.0 OR CC-BY-NC-ND-4.0)
#pragma once
#include "util/audio_stream.h"
#include "audio_stream.h"
#include <cstdint>
struct cubeb;

View File

@ -7,7 +7,7 @@
#include "common/d3d11/shader_compiler.h"
#include "common/log.h"
#include "common/string_util.h"
#include "common_host.h"
#include "core/common_host.h"
#include "core/host_settings.h"
#include "core/settings.h"
#include "core/shader_cache_version.h"

View File

@ -7,8 +7,8 @@
#include "common/timer.h"
#include "common/window_info.h"
#include "common/windows_headers.h"
#include "core/host_display.h"
#include "frontend-common/postprocessing_chain.h"
#include "host_display.h"
#include "postprocessing_chain.h"
#include <d3d11.h>
#include <dxgi.h>
#include <memory>

View File

@ -13,7 +13,7 @@
#include "display_ps.hlsl.h"
#include "display_ps_alpha.hlsl.h"
#include "display_vs.hlsl.h"
#include "frontend-common/postprocessing_shadergen.h"
#include "postprocessing_shadergen.h"
#include "imgui.h"
#include "imgui_impl_dx12.h"
#include <array>

View File

@ -9,7 +9,7 @@
#include "common/timer.h"
#include "common/window_info.h"
#include "common/windows_headers.h"
#include "core/host_display.h"
#include "host_display.h"
#include "postprocessing_chain.h"
#include <d3d12.h>
#include <dxgi.h>

View File

@ -8,7 +8,6 @@
#include "common/log.h"
#include "common/make_array.h"
#include "common/string_util.h"
#include "common_host.h"
#include "core/host.h"
#include "fmt/format.h"
#include "input_manager.h"

View File

@ -8,7 +8,7 @@
#include "common/log.h"
#include "common/string_util.h"
#include "common/timer.h"
#include "settings.h"
#include "core/settings.h" // TODO FIXME
#include "stb_image.h"
#include "stb_image_resize.h"
#include "stb_image_write.h"

View File

@ -2,10 +2,11 @@
// SPDX-License-Identifier: (GPL-3.0 OR CC-BY-NC-ND-4.0)
#pragma once
#include "common/gpu_texture.h"
#include "common/rectangle.h"
#include "common/window_info.h"
#include "types.h"
#include <memory>
#include <string>
#include <string_view>

Some files were not shown because too many files have changed in this diff Show More