nadrino / SimpleModManager

SimpleModManager is an homebrew app for the Nintendo Switch
GNU General Public License v3.0
343 stars 12 forks source link

Mod downloader support? #25

Closed snoozbuster closed 1 year ago

snoozbuster commented 2 years ago

I was looking at the gamebanana API, which as far as I know is the premiere source for switch game mods. I'd love to fork this project and see if I can add support to it to be able to browse mods on gamebanana and directly download them to be applied (using the pre-existing functionality), sorta like how the HB app store works but for game mods. Caveat: I haven't done any C programming in a long time and haven't done any switch programming before at all, so who knows if I will even be successful in any of this.

I'm definitely not asking for someone to do this for me, but it would help me a ton if I could get some primer resources on things like:

Feel free to redirect me to a wiki or other switch library docs for the first two, happy to read those myself I just don't know where to start (and either way, knowing the basic app architecture would be incredibly useful).

If I was successful in adding this in a fork - would you be interested in integrating it back into upstream? I'd be happy to open a PR.

KP2048 commented 2 years ago

the problem with this is that there isn't any well defined format for the mod archives. the current method rely on a human deciding what goes where

KP2048 commented 2 years ago

you could have a prompt for the user to choose the root directory of the mod, but there aren't many other options

KP2048 commented 2 years ago

for the web requests, there is the curl portlib.

for title stuff look at how goldleaf does it https://github.com/XorTroll/Goldleaf/blob/e71fd36546975c579f6606133e13d588bd6b1a55/Goldleaf/source/hos/hos_Titles.cpp#L216

and as for the structure, look at the changes i made in my fork when i added the plugin browser page

KP2048 commented 2 years ago

if you need help setting things up just ask :)

KP2048 commented 2 years ago

I recommend working off of my fork until it gets merged because i fixed some compile issues from my last merge.

snoozbuster commented 2 years ago

interesting, I will have to download some mods off gamebanana for testing. I thought the format was pretty standard, or at least of the mods I've downloaded I thought the process was the same for each of them. I guess its kinda up to the mod packager though huh

snoozbuster commented 2 years ago

thanks for the other tips, those will be very useful

KP2048 commented 2 years ago

Example: https://gamebanana.com/mods/353943

Vs

https://gamebanana.com/mods/358217

KP2048 commented 2 years ago

I recommend extracting the archive to a temporary location, prompting the user to rearrange / create folders then select a directory to use as the root (/mods/\<game>/\<mod>/contents/\<titleid>/\<selected folder contents>

KP2048 commented 2 years ago

https://switchbrew.github.io/libnx/ns_8h.html#a801a457720759c13f79ab31df1e82c51

For listing titles

snoozbuster commented 2 years ago

Appreciate it! I’ll definitely take a look at all this. I’ve been caught up in work and the new Destiny 2 DLC - but I’ll definitely be back to spend some time on this soon!

KP2048 commented 2 years ago

https://github.com/withertech/NXModToolkit

maybe generate one of these from the gamebanana download? and add support for them in SMM? It would have a lot more metadata then just a folder which could be gleaned from gamebanana api. icons and author and description and even dependencies! (There is probably not a good way to resolve dependencies on gamebanana so the field can be unused. I put it there for future use. Maybe user repos like in tinfoil?)

KP2048 commented 2 years ago

Example mod (.nxmod is just a renamed zip file with some metadata in a json and a MANIFEST file containing relative paths of all the mod files relative to :/data/ where all the mod files are) example.zip

Python wheel for the completed toolkit NXModToolkit-1.0.dev0-py3-none-any.zip Now on PyPi NXModToolkit

JSON Schema for mod.json https://withertech.com/SimpleModManagerMod.json

KP2048 commented 2 years ago

(Wait till my fork gets re merged to fix those dumb compile errors) (If you're impatient you can fetch upstream when it gets merged and code blind until then)