Skip to content
Open
Show file tree
Hide file tree
Changes from 33 commits
Commits
Show all changes
52 commits
Select commit Hold shift + click to select a range
6f39652
Update InputConfigDialog.h
PanMenel Dec 18, 2025
fc2b34d
This should work I guess
PanMenel Dec 18, 2025
fcf6a8f
Gówno fix usuwający feature
PanMenel Dec 18, 2025
5dcc694
fix gówno fixa i guess
PanMenel Dec 18, 2025
29a92d3
Epic update, i hope it works XD
PanMenel Dec 18, 2025
1dc324a
fix better buildu
PanMenel Dec 18, 2025
e4a2672
fix fixa XD
PanMenel Dec 18, 2025
bfb988b
i am so fucking stupid fix
PanMenel Dec 18, 2025
814ad81
Update README.md
PanMenel Dec 18, 2025
d03f875
Update README.md
PanMenel Dec 18, 2025
baf8bfa
Update README.md
PanMenel Dec 18, 2025
1690b03
Cosmetic changes to ReadMe
PanMenel Dec 18, 2025
e37fa68
my stupid ass added button traping users
PanMenel Dec 18, 2025
14805c1
fix because unused code
PanMenel Dec 18, 2025
1a76845
even stupider case for a fix
PanMenel Dec 18, 2025
0c04ac3
more unused code
PanMenel Dec 19, 2025
e389058
revert on readme
PanMenel Dec 19, 2025
8bdda09
Reworked EmuInstanceInput.cpp to not touch existing code and made it …
PanMenel Dec 19, 2025
f93c230
if function shift to look more clean
PanMenel Dec 19, 2025
3b75b1e
Full Rewrite to fit more into melonds code
PanMenel Dec 19, 2025
3e19c52
Update Config.h
PanMenel Dec 19, 2025
c55230e
Update Config.cpp
PanMenel Dec 19, 2025
71ddddc
Update EmuSettingsDialog.cpp
PanMenel Dec 19, 2025
ec2c4e9
First batch of changes. could be wrong
PanMenel Dec 29, 2025
ee8b670
added new files and batch2
PanMenel Dec 30, 2025
a81d479
RA files
PanMenel Dec 30, 2025
1dbec57
RA frontend files
PanMenel Dec 30, 2025
e9a0211
Rcheevos files
PanMenel Dec 30, 2025
b5dd626
Rcheevos v2
PanMenel Dec 30, 2025
921c74e
rcheevos v3
PanMenel Dec 30, 2025
9469e46
rcheevos v4
PanMenel Dec 30, 2025
7281d90
somehow - snuck in
PanMenel Dec 30, 2025
759e403
Merge branch 'melonDS-emu:master' into Retro-Achievements-Implementation
PanMenel Dec 30, 2025
4112671
core fixes and changes
PanMenel Jan 5, 2026
1789c3c
changes to frontend nr.1
PanMenel Jan 5, 2026
8c7c3c9
Some cleanup
PanMenel Jan 6, 2026
4e60f9e
forgor .ui
PanMenel Jan 6, 2026
c025f97
Toast Manager fixes to fix compiling
PanMenel Jan 6, 2026
738a8ca
now toast should be good i guess
PanMenel Jan 6, 2026
0ec40be
More cleaning up
PanMenel Jan 6, 2026
785e00b
EVEN MORE CLEANING UP
PanMenel Jan 6, 2026
15be17b
Merge branch 'melonDS-emu:master' into Retro-Achievements-Implementation
PanMenel Jan 6, 2026
2d951aa
mainly revert changes from my other fork
PanMenel Jan 6, 2026
ddfb317
massive update 2.0 but there could be more I overlooked.
PanMenel Jan 16, 2026
5fd0436
deleted unused files + forgor toast changes
PanMenel Jan 16, 2026
6254fc1
little cleanup
PanMenel Jan 16, 2026
437967e
littlecleanupv2
PanMenel Jan 16, 2026
2df7f71
Merge branch 'melonDS-emu:master' into Retro-Achievements-Implementation
PanMenel Jan 26, 2026
1c4e38a
Merge branch 'melonDS-emu:master' into Retro-Achievements-Implementation
PanMenel Feb 2, 2026
b8894cc
UPDATE 3
PanMenel Feb 2, 2026
010121f
little fix to keep the code -0
PanMenel Feb 2, 2026
9682e36
Merge branch 'melonDS-emu:master' into Retro-Achievements-Implementation
PanMenel Mar 5, 2026
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
66 changes: 66 additions & 0 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is this path hardcoded?

It appears that this code won't find cURL and SSL libraries on non-Windows (non-MSYS2, even) platforms as it stands.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Now it should be resolved, or at least better, I had my fair share of problems with implementing curl and making it work in a static build. I still have it "hardcoded" but only for Windows, because every time I try to link it automatically, the exe still says it requires some dlls. No idea if Linux/Mac will work, but now there is a chance at least.

endif()

set(NGTCP2_CRYPTO "${CURL_LDIR}/libngtcp2_crypto_ossl.a")

target_link_libraries(core PRIVATE
"${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
Expand Down
28 changes: 27 additions & 1 deletion src/NDS.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
std::string RA_Username = "";
std::string RA_Token = "";
}

using namespace Platform;

const s32 kMaxIterationCycles = 64;
Expand Down Expand Up @@ -543,6 +551,9 @@ void NDS::Reset()
SPI.Reset();
RTC.Reset();
Wifi.Reset();
memset(MainRAM, 0, MainRAMMask + 1);
Copy link
Contributor

@asiekierka asiekierka Dec 30, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is the memset() done here? It is already done in SetupDirectBoot, which makes sense as that path skips BIOS/firmware, and I'm not sure if the console RAM is actually zero on cold boot on real hardware. Did you verify this or do you have a source for this?

Copy link
Author

Choose a reason for hiding this comment

The 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()
Expand Down Expand Up @@ -755,6 +766,7 @@ bool NDS::DoSavestate(Savestate* file)

if (!file->Saving)
{
::RAContext::Get().DisableHardcore("Load state");
GPU.SetPowerCnt(PowerControl9);

SPU.SetPowerCnt(PowerControl7 & 0x0001);
Expand All @@ -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
auto cart = NDSCartSlot.GetCart();
if (cart)
{
const char* h = cart->GetRAHash();
if (h && h[0])
RAContext::Get().SetPendingGameHash(h);
}
#endif
}
}

void NDS::SetNDSSave(const u8* savedata, u32 savelen)
Expand Down Expand Up @@ -922,6 +946,7 @@ void NDS::RunSystemSleep(u64 timestamp)
template <CPUExecuteMode cpuMode>
u32 NDS::RunFrame()
{
RAContext::Get().DoFrame();
Current = this;

FrameStartTimestamp = SysTimestamp;
Expand Down Expand Up @@ -1597,6 +1622,7 @@ void NDS::MonitorARM9Jump(u32 addr)
{
Log(LogLevel::Info, "Game is now booting\n");
RunningGame = true;
RAContext::Get().AttachNDS(this);
}
}
}
Expand Down
5 changes: 5 additions & 0 deletions src/NDS.h
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,9 @@
// with this enabled, to make sure it doesn't desync
//#define DEBUG_CHECK_DESYNC

class RAContext;
extern RAContext* g_RAContext;

namespace melonDS
{
struct NDSArgs;
Expand Down Expand Up @@ -248,6 +251,8 @@ class NDS
#endif

public: // TODO: Encapsulate the rest of these members
bool IsGameRunning() const { return RunningGame; }
RAContext* ra = nullptr;
void* UserData;

int ConsoleType;
Expand Down
18 changes: 18 additions & 0 deletions src/NDSCart.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,12 @@
#include "melonDLDI.h"
#include "FATStorage.h"
#include "Utils.h"
#include "RetroAchievements/RAClient.h"
#include <rc_hash.h>

namespace Config {
extern bool RA_Enabled;
}

namespace melonDS
{
Expand Down Expand Up @@ -202,6 +208,18 @@ CartCommon::CartCommon(std::unique_ptr<u8[]>&& rom, u32 len, u32 chipid, bool ba
CartType(type),
UserData(userdata)
{
if (ROM && ROMLength > 0) {
if (rc_hash_generate_from_buffer(
this->ra_hash,
RC_CONSOLE_NINTENDO_DS,
ROM.get(),
ROMLength))
{
//printf("RetroAchievements: Hash gry to: %s\n", this->ra_hash);

RAContext::Get().SetPendingGameHash(this->ra_hash);
}
}
memcpy(&Header, ROM.get(), sizeof(Header));
IsDSi = Header.IsDSi() && !badDSiDump;
DSiBase = Header.DSiRegionStart << 19;
Expand Down
2 changes: 2 additions & 0 deletions src/NDSCart.h
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,8 @@ struct NDSCartArgs
class CartCommon
{
public:
const char* GetRAHash() const { return ra_hash; }
char ra_hash[33] = {0};
CartCommon(const u8* rom, u32 len, u32 chipid, bool badDSiDump, ROMListEntry romparams, CartType type, void* userdata);
CartCommon(std::unique_ptr<u8[]>&& rom, u32 len, u32 chipid, bool badDSiDump, ROMListEntry romparams, CartType type, void* userdata);
virtual ~CartCommon();
Expand Down
Loading