From 5308c377456af42be7b504b5d2c9077559420aa7 Mon Sep 17 00:00:00 2001 From: wheremyfoodat <44909372+wheremyfoodat@users.noreply.github.com> Date: Tue, 5 Sep 2023 16:34:12 +0300 Subject: [PATCH 1/2] Add rcheevos --- .gitmodules | 3 +++ CMakeLists.txt | 40 ++++++++++++++++++++++++++++++++++++++++ third_party/rcheevos | 1 + 3 files changed, 44 insertions(+) create mode 160000 third_party/rcheevos diff --git a/.gitmodules b/.gitmodules index af704c7d..ca44c130 100644 --- a/.gitmodules +++ b/.gitmodules @@ -34,3 +34,6 @@ [submodule "third_party/discord-rpc"] path = third_party/discord-rpc url = https://github.com/Panda3DS-emu/discord-rpc +[submodule "third_party/rcheevos"] + path = third_party/rcheevos + url = https://github.com/RetroAchievements/rcheevos/ diff --git a/CMakeLists.txt b/CMakeLists.txt index d0ac2804..be7a3af1 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -36,6 +36,7 @@ option(ENABLE_LTO "Enable link-time optimization" OFF) option(ENABLE_USER_BUILD "Make a user-facing build. These builds have various assertions disabled, LTO, and more" OFF) option(ENABLE_HTTP_SERVER "Enable HTTP server. Used for Discord bot support" OFF) option(ENABLE_DISCORD_RPC "Compile with Discord RPC support (disabled by default)" ON) +option(ENABLE_RETROACHIEVEMENTS "Compile with RetroAchievements support" ON) include_directories(${PROJECT_SOURCE_DIR}/include/) include_directories(${PROJECT_SOURCE_DIR}/include/kernel) @@ -52,6 +53,10 @@ include_directories(third_party/httplib) include_directories(third_party/stb) include_directories(third_party/opengl) +if(ENABLE_RETROACHIEVEMENTS) + include_directories(third_party/rcheevos/include) +endif() + add_compile_definitions(NOMINMAX) # Make windows.h not define min/max macros because third-party deps don't like it add_compile_definitions(WIN32_LEAN_AND_MEAN) # Make windows.h not include literally everything add_compile_definitions(SDL_MAIN_HANDLED) @@ -199,6 +204,41 @@ set(THIRD_PARTY_SOURCE_FILES third_party/imgui/imgui.cpp third_party/cityhash/cityhash.cpp third_party/xxhash/xxhash.c ) + +if(ENABLE_RETROACHIEVEMENTS) + add_definitions(-DRC_DISABLE_LUA) + + set(RCHEEVOS_SOURCE_FILES + third_party/rcheevos/src/rapi/rc_api_common.c + third_party/rcheevos/src/rapi/rc_api_editor.c + third_party/rcheevos/src/rapi/rc_api_info.c + third_party/rcheevos/src/rapi/rc_api_runtime.c + third_party/rcheevos/src/rapi/rc_api_user.c + third_party/rcheevos/src/rcheevos/alloc.c + third_party/rcheevos/src/rcheevos/compat.c + third_party/rcheevos/src/rcheevos/condition.c + third_party/rcheevos/src/rcheevos/condset.c + third_party/rcheevos/src/rcheevos/consoleinfo.c + third_party/rcheevos/src/rcheevos/format.c + third_party/rcheevos/src/rcheevos/lboard.c + third_party/rcheevos/src/rcheevos/memref.c + third_party/rcheevos/src/rcheevos/operand.c + third_party/rcheevos/src/rcheevos/rc_client.c + third_party/rcheevos/src/rcheevos/rc_validate.c + third_party/rcheevos/src/rcheevos/richpresence.c + third_party/rcheevos/src/rcheevos/runtime.c + third_party/rcheevos/src/rcheevos/runtime_progress.c + third_party/rcheevos/src/rcheevos/trigger.c + third_party/rcheevos/src/rcheevos/value.c + third_party/rcheevos/src/rhash/cdreader.c + third_party/rcheevos/src/rhash/hash.c + third_party/rcheevos/src/rhash/md5.c + third_party/rcheevos/src/rurl/url.c + ) + + set(THIRD_PARTY_SOURCE_FILES ${THIRD_PARTY_SOURCE_FILES} ${RCHEEVOS_SOURCE_FILES}) +endif() + source_group("Source Files\\Core" FILES ${SOURCE_FILES}) source_group("Source Files\\Core\\Crypto" FILES ${CRYPTO_SOURCE_FILES}) source_group("Source Files\\Core\\Filesystem" FILES ${FS_SOURCE_FILES}) diff --git a/third_party/rcheevos b/third_party/rcheevos new file mode 160000 index 00000000..92371afb --- /dev/null +++ b/third_party/rcheevos @@ -0,0 +1 @@ +Subproject commit 92371afb266ffbc4322e04148c7faeb41ea40b9f From 5217a1115f095661b26390543f7a8df3264f98f1 Mon Sep 17 00:00:00 2001 From: wheremyfoodat <44909372+wheremyfoodat@users.noreply.github.com> Date: Tue, 5 Sep 2023 17:02:14 +0300 Subject: [PATCH 2/2] Add retroachievements define --- CMakeLists.txt | 7 ++++++- include/achievements.hpp | 7 +++++++ src/achievements.cpp | 1 + 3 files changed, 14 insertions(+), 1 deletion(-) create mode 100644 include/achievements.hpp create mode 100644 src/achievements.cpp diff --git a/CMakeLists.txt b/CMakeLists.txt index be7a3af1..13e6e2a0 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -123,7 +123,7 @@ set(SOURCE_FILES src/main.cpp src/emulator.cpp src/io_file.cpp src/config.cpp src/core/CPU/cpu_dynarmic.cpp src/core/CPU/dynarmic_cycles.cpp src/core/memory.cpp src/renderer.cpp src/core/renderer_null/renderer_null.cpp src/http_server.cpp src/stb_image_write.c src/core/cheats.cpp src/core/action_replay.cpp - src/discord_rpc.cpp + src/discord_rpc.cpp src/achievements.cpp ) set(CRYPTO_SOURCE_FILES src/core/crypto/aes_engine.cpp) set(KERNEL_SOURCE_FILES src/core/kernel/kernel.cpp src/core/kernel/resource_limits.cpp @@ -186,6 +186,7 @@ set(HEADER_FILES include/emulator.hpp include/helpers.hpp include/termcolor.hpp include/fs/romfs.hpp include/fs/ivfc.hpp include/discord_rpc.hpp include/services/http.hpp include/result/result_cfg.hpp include/applets/applet.hpp include/applets/mii_selector.hpp include/math_util.hpp include/services/soc.hpp include/services/news_u.hpp include/applets/software_keyboard.hpp include/applets/applet_manager.hpp include/fs/archive_user_save_data.hpp + include/achievements.hpp ) cmrc_add_resource_library( @@ -396,3 +397,7 @@ endif() if(ENABLE_HTTP_SERVER) target_compile_definitions(Alber PRIVATE PANDA3DS_ENABLE_HTTP_SERVER=1) endif() + +if(ENABLE_RETROACHIEVEMENTS) + target_compile_definitions(Alber PRIVATE PANDA3DS_ENABLE_RETROACHIEVEMENTS=1) +endif() diff --git a/include/achievements.hpp b/include/achievements.hpp new file mode 100644 index 00000000..59049f80 --- /dev/null +++ b/include/achievements.hpp @@ -0,0 +1,7 @@ +#pragma once + +#ifdef PANDA3DS_ENABLE_RETROACHIEVEMENTS +class RetroAchievements {}; +#else +class RetroAchievements {}; +#endif \ No newline at end of file diff --git a/src/achievements.cpp b/src/achievements.cpp new file mode 100644 index 00000000..37eb745e --- /dev/null +++ b/src/achievements.cpp @@ -0,0 +1 @@ +#include "achievements.hpp" \ No newline at end of file