[qt] Ryujinx save data link #2815
			No reviewers
			
		
		
		
	
	
	
		Labels
		
	
	
	
	No labels
	
		
			
	
	android
		
			audio
		
			bug
		
			ci
		
			cmake
		
			confirmed
		
			core
		
			desktop
		
			duplicate
		
			enhancement
		
			frontend
		
			fw
		
			git
		
			graphics
		
			loader
		
			nv gpu
		
			ui
		
			vulkan
		
		
	
		No milestone
		
	No project
	
		
	
	
	
	
		No assignees
		
	
	
		
			
		
	
	
	
		3 participants
	
	
		
		
	Notifications
	
		
	
	
	
		
	
	
	Due date
No due date set.
	
		Dependencies
		
		
	
	
	No dependencies set.
	
	
		
	
	
		
			Reference
		
	
	
		
	
	
			eden-emu/eden!2815
			
		
	
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	
	No description provided.
		
		Delete branch "ryujinx-compat"
	
	Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
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 viaimkvdb.arcinbis/system/save/8000000000000000/0/and also an identical copy in the1directory for... some reason.imkvdb.arcis handled byFlatMapKeyValueStorein LibHac, which, as the name implies, is a key-value storage system thatimkvdb.arc, and seeminglyimkvdb.arcalone, 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 otherkvdbimplementations 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
xxdon theimkvdb.arcis all that's needed, and here's everything that matters:IMKVmagic header (4 bytes)u32) strewn at offset0x08from the start of the file, which is useless to usIMENlist. I don't know what theIMstands for, butIMENis just, well, an ENtry. Offsets shown are relative to the start of theIMENheader.IMENmagic header at 0x00x40bytes, but I'm not really sure what they do0xC, for example00a0 df10 501f 0001for Legends: Arceus (the byte order is swapped)0x4C, for example0a00 0000 0000 0000for my Legends: Arceus saveFull example for Legends: Arceus:
Ultimately, the size of the
IMENsits 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:0and1... and only0ever 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:
imkvdbOld save data is deleted depending on which one you chose.
Signed-off-by: crueter crueter@eden-emu.dev
b18649818a098f6feae5New commits pushed, approval review dismissed automatically according to repository settings
New commits pushed, approval review dismissed automatically according to repository settings
8d974baf0d5867a1a1f9WIP: [qt] Ryujinx save data linkto [qt] Ryujinx save data link