Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 15 additions & 4 deletions CMake/DolphinLibraryTools.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,17 @@ function(dolphin_add_bundled_library library use_system bundled_path)
add_subdirectory(${bundled_path} EXCLUDE_FROM_ALL)
endfunction()

function(dolphin_set_library_type library type)
if(DEFINED ${library}_TYPE AND NOT ${${library}_TYPE} STREQUAL "${type}")
message(FATAL_ERROR
"The selection for ${library} changed from '${${library}_TYPE}' to '${type}' after configuration.\n"
"Please delete the build directory (or at least CMakeCache.txt) and reconfigure."
)
endif()

set(${library}_TYPE "${type}" CACHE INTERNAL "")
endfunction()

function(dolphin_find_optional_system_library library bundled_path)
dolphin_optional_system_library(use_system ${library})
string(TOUPPER ${library} upperlib)
Expand Down Expand Up @@ -101,11 +112,11 @@ function(dolphin_find_optional_system_library library bundled_path)
endif()
endif()
if(${prefix}_FOUND)
dolphin_set_library_type(${library} "System")
message(STATUS "Using system ${library}")
set(${prefix}_TYPE "System" PARENT_SCOPE)
else()
dolphin_set_library_type(${library} "Bundled")
dolphin_add_bundled_library(${library} ${use_system} ${bundled_path})
set(${prefix}_TYPE "Bundled" PARENT_SCOPE)
endif()
endfunction()

Expand All @@ -119,11 +130,11 @@ function(dolphin_find_optional_system_library_pkgconfig library search alias bun
endif()
endif()
if(${library}_FOUND)
dolphin_set_library_type(${library} "System")
message(STATUS "Using system ${library}")
dolphin_alias_library(${alias} PkgConfig::${library})
set(${library}_TYPE "System" PARENT_SCOPE)
else()
dolphin_set_library_type(${library} "Bundled")
dolphin_add_bundled_library(${library} ${use_system} ${bundled_path})
set(${library}_TYPE "Bundled" PARENT_SCOPE)
endif()
endfunction()
31 changes: 18 additions & 13 deletions CMake/FindLibUSB.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,15 @@
if(ANDROID)
set(LIBUSB_FOUND FALSE CACHE INTERNAL "libusb-1.0 found")
message(STATUS "libusb-1.0 not found.")
elseif (NOT LIBUSB_FOUND)
pkg_check_modules (LIBUSB_PKG libusb-1.0)
return()
endif()

if(TARGET LibUSB::LibUSB)
return()
endif()

if(NOT LIBUSB_FOUND)
pkg_check_modules(LIBUSB_PKG libusb-1.0)

find_path(LIBUSB_INCLUDE_DIR NAMES libusb.h
PATHS
Expand All @@ -30,21 +37,19 @@ elseif (NOT LIBUSB_FOUND)
/usr/local/lib
)

if(LIBUSB_INCLUDE_DIR AND LIBUSB_LIBRARIES)
set(LIBUSB_FOUND TRUE CACHE INTERNAL "libusb-1.0 found")
message(STATUS "Found libusb-1.0: ${LIBUSB_INCLUDE_DIR}, ${LIBUSB_LIBRARIES}")
else(LIBUSB_INCLUDE_DIR AND LIBUSB_LIBRARIES)
set(LIBUSB_FOUND FALSE CACHE INTERNAL "libusb-1.0 found")
message(STATUS "libusb-1.0 not found.")
endif(LIBUSB_INCLUDE_DIR AND LIBUSB_LIBRARIES)

mark_as_advanced(LIBUSB_INCLUDE_DIR LIBUSB_LIBRARIES)
endif ()
if(LIBUSB_FOUND AND NOT TARGET LibUSB::LibUSB)
endif()


if(LIBUSB_INCLUDE_DIR AND LIBUSB_LIBRARIES)
add_library(LibUSB::LibUSB UNKNOWN IMPORTED)
set_target_properties(LibUSB::LibUSB PROPERTIES
IMPORTED_LOCATION "${LIBUSB_LIBRARIES}"
INTERFACE_INCLUDE_DIRECTORIES "${LIBUSB_INCLUDE_DIR}"
)
set(LIBUSB_FOUND TRUE CACHE INTERNAL "libusb-1.0 found")
message(STATUS "Found libusb-1.0: ${LIBUSB_INCLUDE_DIR}, ${LIBUSB_LIBRARIES}")
else()
set(LIBUSB_FOUND FALSE CACHE INTERNAL "libusb-1.0 found")
message(STATUS "libusb-1.0 not found.")
endif()

2 changes: 1 addition & 1 deletion CMake/ScmRevGen.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ string(TIMESTAMP DOLPHIN_WC_BUILD_DATE "%Y-%m-%d" UTC)

# version number
set(DOLPHIN_VERSION_MAJOR "2603")
set(DOLPHIN_VERSION_MINOR "0")
set(DOLPHIN_VERSION_MINOR "1")
set(DOLPHIN_VERSION_PATCH ${DOLPHIN_WC_REVISION})

# If Dolphin is not built from a Git repository, default the version info to
Expand Down
30 changes: 13 additions & 17 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -657,10 +657,6 @@ if(UNIX)
add_definitions(-DUSE_MEMORYWATCHER=1)
endif()

if(ENABLE_SDL)
dolphin_find_optional_system_library(SDL3 Externals/SDL 3.2.0)
endif()

if(ENABLE_ANALYTICS)
message(STATUS "Enabling analytics collection (subject to end-user opt-in)")
add_definitions(-DUSE_ANALYTICS=1)
Expand Down Expand Up @@ -700,7 +696,7 @@ endif()
add_subdirectory(Externals/cpp-optparse)

dolphin_find_optional_system_library_pkgconfig(FMT
fmt>=11.0 fmt::fmt Externals/fmt
fmt>=10.1 fmt::fmt Externals/fmt
)

add_subdirectory(Externals/imgui)
Expand Down Expand Up @@ -733,6 +729,13 @@ if(NOT (WIN32 AND _M_ARM_64))
add_definitions(-DHAS_OPENGL)
endif()

if(NOT WIN32)
if(ANDROID)
set(USE_SYSTEM_Iconv OFF)
endif()
dolphin_find_optional_system_library(Iconv Externals/libiconv 1.14)
endif()

dolphin_find_optional_system_library(pugixml Externals/pugixml)

dolphin_find_optional_system_library_pkgconfig(ENET libenet>=1.3.18 enet::enet Externals/enet)
Expand Down Expand Up @@ -776,12 +779,14 @@ if(ENABLE_CUBEB)
endif()

if(NOT ANDROID AND NOT IOS)
dolphin_find_optional_system_library_pkgconfig(
LibUSB libusb-1.0 LibUSB::LibUSB Externals/libusb
)
dolphin_find_optional_system_library(LibUSB Externals/libusb)
add_definitions(-D__LIBUSB__)
endif()

if(ENABLE_SDL)
dolphin_find_optional_system_library(SDL3 Externals/SDL 3.2.0)
endif()

dolphin_find_optional_system_library(SFML Externals/SFML 3.0 COMPONENTS Network System)

if(USE_UPNP)
Expand All @@ -793,15 +798,6 @@ dolphin_find_optional_system_library(MBEDTLS Externals/mbedtls 2.28)

dolphin_find_optional_system_library(CURL Externals/curl)

if(NOT WIN32)
if(NOT ANDROID)
dolphin_find_optional_system_library(Iconv Externals/libiconv 1.14)
else()
message(STATUS "Using static iconv from Externals")
add_subdirectory(Externals/libiconv EXCLUDE_FROM_ALL)
endif()
endif()

if(NOT ANDROID AND NOT IOS)
dolphin_find_optional_system_library(HIDAPI Externals/hidapi)
endif()
Expand Down
2 changes: 2 additions & 0 deletions Data/Sys/GameSettings/G3F.ini
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
[Core]
# Values set here will override the main Dolphin settings.
MMU = True
# Fixes freeze on second loading screen
PageTableFastmem = False

[OnFrame]
# Add memory patches to be applied every frame here.
Expand Down
5 changes: 5 additions & 0 deletions Externals/SDL/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,11 @@ if(CCACHE_BIN)
set(CCACHE_BINARY ${CCACHE_BIN})
endif()

if(LibUSB_TYPE STREQUAL Bundled)
set(LibUSB_FOUND TRUE)
set(SDL_HIDAPI_LIBUSB_SHARED OFF)
endif()

add_subdirectory(SDL)

if (TARGET SDL3)
Expand Down
6 changes: 5 additions & 1 deletion Externals/curl/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,11 @@ set(HTTP_ONLY ON)
set(CURL_USE_LIBPSL OFF)
set(CURL_USE_LIBSSH2 OFF)
set(CURL_ZLIB OFF CACHE BOOL "" FORCE)
set(CURL_ZSTD OFF)
set(CURL_ZSTD OFF CACHE BOOL "" FORCE)
set(CURL_BROTLI OFF CACHE BOOL "" FORCE)
set(ZLIB_FOUND FALSE) # TODO: Remove once we update to cURL >=8.17.1 https://github.com/curl/curl/pull/20147
set(ZSTD_FOUND FALSE) # TODO: Same as above
set(BROTLI_FOUND FALSE) # TODO: Same as above
set(USE_LIBIDN2 OFF)
set(USE_NGHTTP2 OFF)

Expand Down
13 changes: 12 additions & 1 deletion Externals/libusb/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -125,4 +125,15 @@ check_include_files(sys/timerfd.h HAVE_TIMERFD)
check_include_files(unistd.h HAVE_UNISTD_H)

configure_file(config.h.in config.h)
add_library(LibUSB::LibUSB ALIAS usb)

# We don't create an ALIAS here so that dependencies (SDL) that try_compile libusb
# don't fail due to LibUSB::LibUSB being an alias target
add_library(LibUSB::LibUSB INTERFACE IMPORTED GLOBAL)
target_link_libraries(LibUSB::LibUSB
INTERFACE
usb
)
target_include_directories(LibUSB::LibUSB
INTERFACE
${CMAKE_CURRENT_SOURCE_DIR}/libusb/libusb
)
36 changes: 33 additions & 3 deletions Externals/minizip-ng/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,42 @@ set(MZ_BUILD_TESTS OFF)
set(MZ_BUILD_UNIT_TESTS OFF)
set(MZ_BUILD_FUZZ_TESTS OFF)
set(MZ_CODE_COVERAGE OFF)
set(MZ_FETCH_LIBS OFF)
set(MZ_BZIP2 OFF)
set(MZ_PKCRYPT OFF)
set(MZ_WZAES OFF)
set(MZ_OPENSSL OFF)
set(MZ_LIBBSD OFF)
set(SKIP_INSTALL_ALL ON)

if (MINGW OR MSVC)
set(MZ_FETCH_LIBS OFF)
set(MZ_FORCE_FETCH_LIBS OFF)
if(Iconv_TYPE STREQUAL Bundled)
set(CMAKE_DISABLE_FIND_PACKAGE_Iconv TRUE)
set(Iconv_FOUND TRUE)
set(Iconv_LIBRARIES Iconv::Iconv)
get_target_property(Iconv_INCLUDE_DIRS ${Iconv_LIBRARIES} INTERFACE_INCLUDE_DIRECTORIES)
endif()
if(LibLZMA_TYPE STREQUAL Bundled)
set(CMAKE_DISABLE_FIND_PACKAGE_LibLZMA TRUE)
set(LIBLZMA_FOUND TRUE)
set(LIBLZMA_LIBRARIES LibLZMA::LibLZMA)
get_target_property(LIBLZMA_INCLUDE_DIRS ${LIBLZMA_LIBRARIES} INTERFACE_INCLUDE_DIRECTORIES)
endif()
if(ZLIB_TYPE STREQUAL Bundled)
set(CMAKE_DISABLE_FIND_PACKAGE_ZLIB TRUE)
set(ZLIB_FOUND TRUE)
set(ZLIB_LIBRARIES ZLIB::ZLIB)
get_target_property(ZLIB_INCLUDE_DIRS ${ZLIB_LIBRARIES} INTERFACE_INCLUDE_DIRECTORIES)
endif()
if(ZSTD_TYPE STREQUAL Bundled)
set(CMAKE_DISABLE_FIND_PACKAGE_ZSTD TRUE)
set(ZSTD_FOUND TRUE)
set(ZSTD_LIBRARIES zstd::zstd)
get_target_property(ZSTD_INCLUDE_DIRS ${ZSTD_LIBRARIES} INTERFACE_INCLUDE_DIRECTORIES)
endif()

# minizip-ng otherwise uses system libraries when we provide them above
set(CMAKE_DISABLE_FIND_PACKAGE_PkgConfig TRUE)
set(PKGCONFIG_FOUND FALSE)

add_subdirectory(minizip-ng)
dolphin_disable_warnings(minizip-ng)
2 changes: 1 addition & 1 deletion Source/Core/Common/TraversalServer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
#include <unordered_map>
#include <vector>

#include <fmt/base.h>
#include <fmt/format.h>

#ifdef HAVE_LIBSYSTEMD
#include <systemd/sd-daemon.h>
Expand Down
20 changes: 20 additions & 0 deletions Source/Core/Core/AchievementManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
#include "Core/Config/FreeLookSettings.h"
#include "Core/Config/MainSettings.h"
#include "Core/ConfigLoaders/GameConfigLoader.h"
#include "Core/ConfigManager.h"
#include "Core/Core.h"
#include "Core/GeckoCode.h"
#include "Core/HW/Memmap.h"
Expand Down Expand Up @@ -215,6 +216,25 @@ void AchievementManager::LoadGame(const DiscIO::Volume* volume)
}
}

void AchievementManager::ChangeDisc(const DiscIO::Volume* volume)
{
if (volume == nullptr)
{
INFO_LOG_FMT(ACHIEVEMENTS, "Ejecting disc.");
LoadGame(nullptr);
}
else if (volume->GetGameID() != SConfig::GetInstance().GetGameID())
{
INFO_LOG_FMT(ACHIEVEMENTS, "Inserting disc that doesn't belong to the running game.");
LoadGame(nullptr);
}
else
{
INFO_LOG_FMT(ACHIEVEMENTS, "Inserting disc.");
LoadGame(volume);
}
}

bool AchievementManager::IsGameLoaded() const
{
auto* game_info = rc_client_get_game_info(m_client);
Expand Down
3 changes: 3 additions & 0 deletions Source/Core/Core/AchievementManager.h
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,7 @@ class AchievementManager
void Login(const std::string& password);
bool HasAPIToken() const;
void LoadGame(const DiscIO::Volume* volume);
void ChangeDisc(const DiscIO::Volume* volume);
bool IsGameLoaded() const;
void SetBackgroundExecutionAllowed(bool allowed);

Expand Down Expand Up @@ -333,6 +334,8 @@ class AchievementManager

constexpr void LoadGame(const DiscIO::Volume*) {}

constexpr void ChangeDisc(const DiscIO::Volume*) {}

constexpr void SetBackgroundExecutionAllowed(bool allowed) {}

constexpr void DoFrame() {}
Expand Down
13 changes: 7 additions & 6 deletions Source/Core/Core/Boot/Boot.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -537,6 +537,7 @@ bool CBoot::BootUp(Core::System& system, const Core::CPUThreadGuard& guard,
NOTICE_LOG_FMT(BOOT, "Booting from disc: {}", disc.path);
const DiscIO::VolumeDisc* volume =
SetDisc(system.GetDVDInterface(), std::move(disc.volume), disc.auto_disc_change_paths);
AchievementManager::GetInstance().LoadGame(volume);

if (!volume)
return false;
Expand Down Expand Up @@ -655,17 +656,17 @@ bool CBoot::BootUp(Core::System& system, const Core::CPUThreadGuard& guard,
if (!Load_BS2(system, ipl.path))
return false;

const DiscIO::VolumeDisc* volume = nullptr;
if (ipl.disc)
{
NOTICE_LOG_FMT(BOOT, "Inserting disc: {}", ipl.disc->path);
SetDisc(system.GetDVDInterface(), DiscIO::CreateDiscForCore(ipl.disc->path),
ipl.disc->auto_disc_change_paths);
}
else
{
AchievementManager::GetInstance().LoadGame(nullptr);

volume = SetDisc(system.GetDVDInterface(), DiscIO::CreateDiscForCore(ipl.disc->path),
ipl.disc->auto_disc_change_paths);
}

AchievementManager::GetInstance().LoadGame(volume);

SConfig::OnTitleDirectlyBooted(guard);
return true;
}
Expand Down
1 change: 1 addition & 0 deletions Source/Core/Core/Config/MainSettings.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ const Info<PowerPC::CPUCore> MAIN_CPU_CORE{{System::Main, "Core", "CPUCore"},
PowerPC::DefaultCPUCore()};
const Info<bool> MAIN_JIT_FOLLOW_BRANCH{{System::Main, "Core", "JITFollowBranch"}, true};
const Info<bool> MAIN_FASTMEM{{System::Main, "Core", "Fastmem"}, true};
const Info<bool> MAIN_PAGE_TABLE_FASTMEM{{System::Main, "Core", "PageTableFastmem"}, true};
const Info<bool> MAIN_FASTMEM_ARENA{{System::Main, "Core", "FastmemArena"}, true};
const Info<bool> MAIN_LARGE_ENTRY_POINTS_MAP{{System::Main, "Core", "LargeEntryPointsMap"}, true};
const Info<bool> MAIN_ACCURATE_CPU_CACHE{{System::Main, "Core", "AccurateCPUCache"}, false};
Expand Down
1 change: 1 addition & 0 deletions Source/Core/Core/Config/MainSettings.h
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ extern const Info<bool> MAIN_SKIP_IPL;
extern const Info<PowerPC::CPUCore> MAIN_CPU_CORE;
extern const Info<bool> MAIN_JIT_FOLLOW_BRANCH;
extern const Info<bool> MAIN_FASTMEM;
extern const Info<bool> MAIN_PAGE_TABLE_FASTMEM;
extern const Info<bool> MAIN_FASTMEM_ARENA;
extern const Info<bool> MAIN_LARGE_ENTRY_POINTS_MAP;
extern const Info<bool> MAIN_ACCURATE_CPU_CACHE;
Expand Down
2 changes: 1 addition & 1 deletion Source/Core/Core/DSP/LabelMap.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
#include <string>
#include <vector>

#include <fmt/base.h>
#include <fmt/format.h>

#include "Core/DSP/DSPTables.h"

Expand Down
3 changes: 2 additions & 1 deletion Source/Core/Core/FifoPlayer/FifoDataFile.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -274,7 +274,8 @@ std::unique_ptr<FifoDataFile> FifoDataFile::Load(const std::string& filename, bo
}
else
{
dataFile->m_game_id = std::string{header.gameid, DEFAULT_GAME_ID.size()};
const size_t gameid_length = strnlen(header.gameid, DEFAULT_GAME_ID.size());
dataFile->m_game_id = std::string{header.gameid, gameid_length};
}

if (flagsOnly)
Expand Down
Loading