-
-
Notifications
You must be signed in to change notification settings - Fork 705
Retro Achievements implementation #2529
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from 33 commits
6f39652
fc2b34d
fcf6a8f
5dcc694
29a92d3
1dc324a
e4a2672
bfb988b
814ad81
d03f875
baf8bfa
1690b03
e37fa68
14805c1
1a76845
0c04ac3
e389058
8bdda09
f93c230
3b75b1e
3e19c52
c55230e
71ddddc
ec2c4e9
ee8b670
a81d479
1dbec57
e9a0211
b5dd626
921c74e
9469e46
7281d90
759e403
4112671
1789c3c
8c7c3c9
4e60f9e
c025f97
738a8ca
0ec40be
785e00b
15be17b
2d951aa
ddfb317
5fd0436
6254fc1
437967e
2df7f71
1c4e38a
b8894cc
010121f
9682e36
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -225,6 +225,72 @@ if (ENABLE_JIT_PROFILING) | |
| target_link_libraries(core PRIVATE "${VTUNE_LIBRARY}") | ||
| endif() | ||
|
|
||
| # --- RetroAchievements --- | ||
| message(STATUS "Adding RetroAchievements integration sources") | ||
|
|
||
| target_sources(core PRIVATE | ||
| RetroAchievements/RAClient.cpp | ||
| RetroAchievements/RAClient.h | ||
| RetroAchievements/RAFunctions.h | ||
| ) | ||
|
|
||
| target_include_directories(core PRIVATE | ||
| "${CMAKE_CURRENT_SOURCE_DIR}/RetroAchievements" | ||
| "${CMAKE_CURRENT_SOURCE_DIR}" | ||
| ) | ||
|
|
||
| message(STATUS "RetroAchievements support enabled") | ||
|
|
||
| # --- CURL & SSL Configuration --- | ||
| target_compile_definitions(core PRIVATE HAVE_CURL CURL_STATICLIB) | ||
|
|
||
| if(DEFINED ENV{MSYSTEM_PREFIX}) | ||
| set(CURL_LDIR "$ENV{MSYSTEM_PREFIX}/lib") | ||
| else() | ||
| set(CURL_LDIR "C:/msys64/ucrt64/lib") | ||
|
||
| endif() | ||
|
|
||
| set(NGTCP2_CRYPTO "${CURL_LDIR}/libngtcp2_crypto_ossl.a") | ||
|
|
||
| target_link_libraries(core PRIVATE | ||
PanMenel marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| "${CURL_LDIR}/libcurl.a" | ||
| "${CURL_LDIR}/libnghttp2.a" | ||
| "${CURL_LDIR}/libnghttp3.a" | ||
| "${CURL_LDIR}/libngtcp2.a" | ||
| "${NGTCP2_CRYPTO}" | ||
| "${CURL_LDIR}/libssh2.a" | ||
| "${CURL_LDIR}/libpsl.a" | ||
| "${CURL_LDIR}/libssl.a" | ||
| "${CURL_LDIR}/libcrypto.a" | ||
| "${CURL_LDIR}/libbrotlidec.a" | ||
| "${CURL_LDIR}/libbrotlicommon.a" | ||
| "${CURL_LDIR}/libbrotlienc.a" | ||
| "${CURL_LDIR}/libzstd.a" | ||
| "${CURL_LDIR}/libidn2.a" | ||
| "${CURL_LDIR}/libunistring.a" | ||
| "${CURL_LDIR}/libiconv.a" | ||
| "${CURL_LDIR}/libz.a" | ||
| ws2_32 wldap32 crypt32 normaliz advapi32 secur32 bcrypt | ||
| ) | ||
|
|
||
| # --- rcheevos --- | ||
| file(GLOB_RECURSE RCH_ALL | ||
| "${CMAKE_CURRENT_SOURCE_DIR}/rcheevos/src/*.c" | ||
| ) | ||
|
|
||
| list(FILTER RCH_ALL EXCLUDE REGEX | ||
| "rc_libretro.c|rc_client_external.c|rhash/aes.c" | ||
| ) | ||
|
|
||
| target_sources(core PRIVATE ${RCH_ALL}) | ||
|
|
||
| target_include_directories(core PRIVATE | ||
| "${CMAKE_CURRENT_SOURCE_DIR}/rcheevos/include" | ||
| "${CMAKE_CURRENT_SOURCE_DIR}/rcheevos/src" | ||
| ) | ||
|
|
||
| target_compile_definitions(core PRIVATE RETROACHIEVEMENTS_ENABLED) | ||
|
|
||
| #if(CMAKE_BUILD_TYPE MATCHES "Debug") | ||
| # set( | ||
| # CMAKE_C_FLAGS | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -44,9 +44,17 @@ | |
| #include "DSi_DSP.h" | ||
| #include "ARMJIT.h" | ||
| #include "ARMJIT_Memory.h" | ||
| #include "RetroAchievements/RAClient.h" | ||
| #include <string> | ||
|
|
||
| namespace melonDS | ||
| { | ||
|
|
||
| namespace Config { | ||
PanMenel marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| std::string RA_Username = ""; | ||
| std::string RA_Token = ""; | ||
| } | ||
|
|
||
| using namespace Platform; | ||
|
|
||
| const s32 kMaxIterationCycles = 64; | ||
|
|
@@ -543,6 +551,9 @@ void NDS::Reset() | |
| SPI.Reset(); | ||
| RTC.Reset(); | ||
| Wifi.Reset(); | ||
| memset(MainRAM, 0, MainRAMMask + 1); | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why is the
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I did implement this because I got a random achievement on starting a new game without fully restarting the emulator. I didn't really verify it, but it requires further testing if needed. |
||
| memset(SharedWRAM, 0, 0x8000); | ||
| memset(ARM7WRAM, 0, 0x10000); | ||
| } | ||
|
|
||
| void NDS::Start() | ||
|
|
@@ -755,6 +766,7 @@ bool NDS::DoSavestate(Savestate* file) | |
|
|
||
| if (!file->Saving) | ||
| { | ||
| ::RAContext::Get().DisableHardcore("Load state"); | ||
| GPU.SetPowerCnt(PowerControl9); | ||
|
|
||
| SPU.SetPowerCnt(PowerControl7 & 0x0001); | ||
|
|
@@ -773,9 +785,21 @@ bool NDS::DoSavestate(Savestate* file) | |
| void NDS::SetNDSCart(std::unique_ptr<NDSCart::CartCommon>&& cart) | ||
| { | ||
| NDSCartSlot.SetCart(std::move(cart)); | ||
| // The existing cart will always be ejected; | ||
| // The existing cart will always be ejected; | ||
| // if cart is null, then that's equivalent to ejecting a cart | ||
| // without inserting a new one. | ||
|
|
||
| if (NDSCartSlot.GetCart()) { | ||
| #ifdef RETROACHIEVEMENTS_ENABLED | ||
PanMenel marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| auto cart = NDSCartSlot.GetCart(); | ||
| if (cart) | ||
PanMenel marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| { | ||
| const char* h = cart->GetRAHash(); | ||
| if (h && h[0]) | ||
| RAContext::Get().SetPendingGameHash(h); | ||
| } | ||
| #endif | ||
| } | ||
| } | ||
|
|
||
| void NDS::SetNDSSave(const u8* savedata, u32 savelen) | ||
|
|
@@ -922,6 +946,7 @@ void NDS::RunSystemSleep(u64 timestamp) | |
| template <CPUExecuteMode cpuMode> | ||
| u32 NDS::RunFrame() | ||
| { | ||
| RAContext::Get().DoFrame(); | ||
| Current = this; | ||
|
|
||
| FrameStartTimestamp = SysTimestamp; | ||
|
|
@@ -1597,6 +1622,7 @@ void NDS::MonitorARM9Jump(u32 addr) | |
| { | ||
| Log(LogLevel::Info, "Game is now booting\n"); | ||
| RunningGame = true; | ||
| RAContext::Get().AttachNDS(this); | ||
| } | ||
| } | ||
| } | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.