Skip to content

Commit

Permalink
Move frontend-common to util/core
Browse files Browse the repository at this point in the history
  • Loading branch information
stenzek committed Aug 15, 2023
1 parent 5b980da commit bb60170
Show file tree
Hide file tree
Showing 144 changed files with 2,504 additions and 3,178 deletions.
28 changes: 0 additions & 28 deletions duckstation.sln
Original file line number Diff line number Diff line change
Expand Up @@ -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}"
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
1 change: 0 additions & 1 deletion src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
30 changes: 25 additions & 5 deletions src/core/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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}"
)
33 changes: 19 additions & 14 deletions src/frontend-common/achievements.cpp → src/core/achievements.cpp
Original file line number Diff line number Diff line change
@@ -1,7 +1,17 @@
// SPDX-FileCopyrightText: 2019-2022 Connor McLaughlin <[email protected]>
// 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"
Expand All @@ -10,26 +20,20 @@
#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"
#include "rc_api_runtime.h"
#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>
Expand All @@ -38,6 +42,7 @@
#include <functional>
#include <string>
#include <vector>

Log_SetChannel(Achievements);

#ifdef WITH_RAINTEGRATION
Expand Down
2 changes: 2 additions & 0 deletions src/core/achievements.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
#pragma once
#include "common/types.h"

#include <string>

class StateWrapper;
class CDImage;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down
79 changes: 42 additions & 37 deletions src/frontend-common/common_host.cpp → src/core/common_host.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,44 +2,49 @@
// 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"
#include "common/file_system.h"
#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>
Expand All @@ -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);
Expand Down Expand Up @@ -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:
Expand Down
14 changes: 3 additions & 11 deletions src/frontend-common/common_host.h → src/core/common_host.h
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down Expand Up @@ -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 {
Expand Down
10 changes: 5 additions & 5 deletions src/core/core.props
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Loading

0 comments on commit bb60170

Please sign in to comment.