[Feature Request] Add support for Skyline modding framework
jam1garner opened this issue · 25 comments
Spinning this off from #6076 as it's unspecific and doesn't provided any technical details about what it'd entail.
Motivation
Skyline, for those who aren't familiar, is a framework for modifying the code of games. It acts as a subsdk (overriding subsdk9, as no current game uses it) and uses a plugin system in order to allow users to load their own code, and provides an API for users to patch existing game code in order to redirect into user re-implementations of functions.
It's desirable to support due to its usage across a variety of games, most notably Smash Ultimate, which requires it to do any serious patching of game files, but it is also the framework used for moveset edits among other things. It's also been used some in the {Animal Crossing New Horizon, Pokemon SwSh/BdSp, Spelunky, etc} modding scenes, and other developers seem to be showing interest in it. (For example Pokemon Mystery Dungeon has shown interest but needs emulator support first: tech-ticks/hyperbeam#3 (comment))
Outstanding Issues
- SVC Support
- Support
MapProcessMemory
SVC- Implementation status: #7519
- Support
UnmapProcessMemory
SVC- Implementation status: #7519
- Support
CreateCodeMemory
SVC- Implementation status: #7519
- Support
ControlCodeMemory
SVC- Implementation status: #7519
- Support
SetProcessMemoryPermission
SVC- Implementation status: #7394
- Support
- CPU Emulation Level Support
- Support Instruction Cache Clearing
- Seems to be mostly implemented as it's implemented in dynarmic (See merryhime/dynarmic#562), just requires a
InstructionCacheOperationRaised
callback be implemented for yuzu'sDynarmicCallbacks64
to actually handle the cache clear, which shouldn't be too hard asparent.InvalidateCacheRange(...)
should do the trick. - Implementation status: #7407
- Seems to be mostly implemented as it's implemented in dynarmic (See merryhime/dynarmic#562), just requires a
- Support Instruction Cache Clearing
- IPC Service Support
- Atmosphere's
pm:info
extension, notablyAtmosphereGetProcessId
- This is decently easy, and such an implementation could effectively just return a constant due to the application being the only real concept of a process under yuzu. The only input actually of interest to Skyline is
0xFFFF8001
, Atmosphere's Program ID assigned for getting the current process' Process ID. The hardcoded process ID it could return for the application should then be usable with the SVCs mentioned before (MapProcessMemory
,UnmapProcessMemory
,SetProcessMemoryPermission
) - Implementation status: #7393
- This is decently easy, and such an implementation could effectively just return a constant due to the application being the only real concept of a process under yuzu. The only input actually of interest to Skyline is
- Atmosphere's
pm:dmnt
extension'sAtmosphereGetProcessInfo
- Similar to
GetProcessId
, Skyline only cares about the special0xFFFF8001
handle, which is used to the process info for the current process. Skyline uses this to get a handle to the current process. - Implementation status: #7847
- Similar to
- Atmosphere's
- Loader
- Load
subsdk
s properly (e.g. supportsubsdk8
andsubsdk9
)- Implementation status: #7523
- Load
- Misc
- Debugging Skyline and ensuring no other functionality is missing/dysfunctional in Yuzu
- Status: Blocked on yuzu debugging,
see comment by tech-ticks belowundocumented memory issue - Note: may result in finding additional issues to be added above
- Status: Blocked on yuzu debugging,
- Debugging Skyline and ensuring no other functionality is missing/dysfunctional in Yuzu
Next Steps
I'm willing to provide some development time to help with the above implementation, but would appreciate guidance/thoughts first, in order to avoid submitting non-trivial PRs without being sure they'd be excepted.
I'm also willing to provide help for any Yuzu developers on the Skyline end of things, as I'm certainly not asking for Yuzu devs to have to debug skyline code.
Update: I do not have time or resources to dedicate at this time. I'm doing my best to keep this thread updated but my organizational/PR help is done for the time being.
@jam1garner hi jam if you need help with this we can do this tomorrow. feel free to contact me on discord:
@Morph1984 has implemented some so you have a base guideline on how to proceed.
you can contact me at: Blinkhawk#2544 on discord
I hope you will finish this
I'm too excited to play all the mods on yuzu :)
I just want to say thank you for doing this. Even if this never sees the light of day or isn't ever completed fully, taking the time out of your day to do something like this is amazing. Everyone who contributed to this project is awesome :)
I really wish success to this project, I wish I knew how to help.
Having skyline on emulators will be revolutionary to smash bros modding, specially as hacked switches are getting harder to get each day.
I really hope this can be finished! Modding SSBU on a emulator would be cool.
I really hope this can be finished! Modding SSBU on a emulator would be cool.
All the prerequisites are now implemented, but Skyline hits an access violation in the memset
in KCodeMemory::Initialize()
(it passes address 0x00000295f6d84000
and size 0x1000
, the device memory backing base pointer is 0x0000028576680000
). The crash happens when Skyline calls svcCreateCodeMemory
with an address from memalign
(see https://github.com/skyline-dev/skyline/blob/master/source/skyline/nx/kernel/detect.c#L64). I'm not familiar enough with Yuzu internals to debug this, but let me know if you have any ideas.
you guys got this good job! I cant wait too mod smash ultimate!
I am in no way a good enough programmer to help with this project, but I'm following your with the utmost curiosity. The potential of eventually having access to the training mod on yuzu could completely change the competitive scene for the better.
Any further updates on this? I noticed that most (if not all, according to tech-ticks' post) of the prerequisites are ready to go, so is it just a matter of backend testing we're not privy to?
this is amazing. ive been wanting this for awhile now
Any further updates on this? I noticed that most (if not all, according to tech-ticks' post) of the prerequisites are ready to go, so is it just a matter of backend testing we're not privy to?
@bunnei is looking into it, so its in good hands.
It will be done soon hopefully
i hope this all works out, good luck to everyone
Hey so if you can send me the stuff you have been working on I can have my dad help he's worked at Microsoft for 20 years now and codes daily I think I can get him to help
Hi! Is there any update?
I'd be happy to contribute, want to get this done
Any updates on this?
Hey folks if you need someone to test this let us know. If someone wrote up a test case I'm willing to help out.
Hello? Any updates on this?
Everything for skyline seems ready I think. Is it time to close this issue @bunnei @tech-ticks ?
#8090 (comment) Seems to confirm it is working right.
Which comment, last comment is 7 months old
Yes and the comment states that the previous issue (which if I understand correctly is the last remaining) is no longer an issue for skyline.
Yes and the comment states that the previous issue (which if I understand correctly is the last remaining) is no longer an issue for skyline.
"Skyline loads but is not working" doesn't tell one anything except that loading non-sequential subsdks works, not anything regarding skyline itself working.