crueter 39f226a853 [qt] Ryujinx save data link (#2815)
This adds an action to the Game List context menu that lets users link
save data from Eden to Ryujinx, or vice versa.

Unfortunately, this isn't so simple to deal with due to the way Ryujinx's saves work. Ryujinx stores its saves in the... config directory... in `bis/user/save`. Unlike Yuzu, however, it doesn't store things by TitleID, instead it's just a bunch of directories from 000...01 to 000...0f and so on. The way it *maps* TitleID to SaveID is via `imkvdb.arc` in `bis/system/save/8000000000000000/0/` and also an identical copy in the `1` directory for... some reason. `imkvdb.arc` is handled by `FlatMapKeyValueStore` in LibHac, which, as the name implies, is a key-value storage system that `imkvdb.arc`, and seemingly `imkvdb.arc` alone, uses. The way this class is written is really weird, almost as if it's designed to accommodate more types of kvdbs... but for now we can safely assume that there aren't gonna be any other `kvdb` implementations added to HorizonNX.

Regardless, the file format is ridiculously simple so I didn't actually need to do a deep dive into C# code... of which I can basically only read Avalonia. A simple `xxd` on the `imkvdb.arc` is all that's needed, and here's everything that matters:
- The `IMKV` magic header (4 bytes)
- 8 bytes that don't really have anything useful to us, except for a size byte (presumably a `u32`) strewn at offset `0x08` from the start of the file, which is useless to us
- Then we start the `IMEN` list. I don't know what the `IM` stands for, but `IMEN` is just, well, an ENtry. Offsets shown are relative to the start of the `IMEN` header.
  * 4-byte `IMEN` magic header at 0x0
  * 8 bytes of filler data. It contains two `0x40` bytes, but I'm not really sure what they do
  * TitleID (u64) at `0xC`, for example `00a0 df10  501f 0001` for Legends: Arceus (the byte order is swapped)
  * 0x38 bytes of filler starting at offset 0x14
  * SaveID (u64) at `0x4C`, for example `0a00 0000 0000 0000` for my Legends: Arceus save
  * 0x38 bytes of filler starting at offset 0x54

Full example for Legends: Arceus:
```
000001b0: 494d 454e 4000 0000 4000 0000 00a0 df10  IMEN@...@.......
000001c0: 501f 0001 0100 0000 0000 0000 0000 0000  P...............
000001d0: 0000 0000 0000 0000 0000 0000 0100 0000  ................
000001e0: 0000 0000 0000 0000 0000 0000 0000 0000  ................
000001f0: 0000 0000 0000 0000 0000 0000 0a00 0000  ................
00000200: 0000 0000 0000 0000 0000 0000 0000 0000  ................
00000210: 0000 0000 0100 0000 0000 0000 0000 0000  ................
00000220: 0000 0000 0000 0000 0000 0000 0000 0000  ................
00000230: 0000 0000 0000 0000 0000 0000 494d 454e  ............IMEN
```
Ultimately, the size of the `IMEN` sits at 0x8C or 140 bytes. With this knowledge reading all the TitleID -> SaveID pairs is basically free, and outside of validation and stuff is like 15 lines of relevant code. Some interesting caveats, though:
- There are two entries for some TitleIDs for... some reason? Ignoring the second one seems to work though.
- Within each save directory, there are directories `0` and `1`... and only `0` ever seems used??? It's where Ryujinx points you to for save, so I just chose to use that.

Once everything is parsed, the rest of the implementation is extremely trivial:
- When the user requests a Ryujinx link, match the current program_id to the corresponding SaveID in `imkvdb`
- If it doesn't exist, just error out (save data is probably nonexistent)
- If it does though, give the user the option to use Eden's current save data OR Ryujinx's current save data.

Old save data is deleted depending on which one you chose.

Signed-off-by: crueter <crueter@eden-emu.dev>
Reviewed-on: https://git.eden-emu.dev/eden-emu/eden/pulls/2815
Reviewed-by: Lizzie <lizzie@eden-emu.dev>
Reviewed-by: MaranBr <maranbr@eden-emu.dev>
2025-10-28 03:46:47 +01:00
2025-10-26 20:45:06 +01:00
2022-07-27 12:53:49 +02:00
2024-01-08 09:34:32 -05:00
2025-10-28 03:46:47 +01:00
2023-11-04 18:26:49 +00:00
2022-07-27 12:53:49 +02:00
2022-07-27 12:53:49 +02:00


Eden
Eden

Eden is an open-source Nintendo Switch emulator, forked from the Yuzu emulator — started by former Citron developer Camille LaVey and the Eden team. It is written in C++ with portability in mind, and we actively maintain builds for Windows, Linux and Android.

Discord Revolt

Compatibility | Development | Building | Download | Support | License

Compatibility

The emulator is capable of running most commercial games at full speed, provided you meet the necessary hardware requirements.

A list of supported games will be available in future. Please be patient.

Check out our website for the latest news on exciting features, monthly progress reports, and more!

Packaging status

Development

Most of the development happens on our Git server. It is also where our central repository is hosted. For development discussions, please join us on Discord or Revolt. You can also follow us on X (Twitter) for updates and announcements.

If you would like to contribute, we are open to new developers and pull requests. Please ensure that your work is of a high standard and properly documented. You can also contact any of the developers on Discord or Revolt to learn more about the current state of the emulator.

See the sign-up instructions for information on registration.

Alternatively, if you wish to add translations, go to the Eden project on Transifex and review the translations README.

Building

See the General Build Guide

For information on provided development tooling, see the Tools directory

Download

You can download the latest releases from here.

Support

If you enjoy the project and would like to support us financially, please check out our developers' donation pages!

Any donations received will go towards things such as:

  • Switch consoles to explore and reverse-engineer the hardware
  • Switch games for testing, reverse-engineering, and implementing new features
  • Web hosting and infrastructure setup
  • Additional hardware (e.g. GPUs as needed to improve rendering support, other peripherals to add support for, etc.)
  • CI Infrastructure

If you would prefer to support us in a different way, please join our Discord and talk to Camille or any of our other developers.

License

Eden is licensed under the GPLv3 (or any later version). Refer to the LICENSE.txt file.

Description
A fork of Eden Emulator that works best for Legacy Online - Original code at https://git.eden-emu.dev/eden-emu/eden
https://eden-emu.dev
Readme 154 MiB
jdlo-eden-v3 Latest
2026-01-15 02:26:30 -03:00
Languages
C++ 63.7%
cpp 26.4%
POV-Ray SDL 4.6%
Kotlin 3.1%
CMake 0.9%
Other 1.2%