SimpleModManager icon indicating copy to clipboard operation
SimpleModManager copied to clipboard

Mod downloader support?

Open snoozbuster opened this issue 3 years ago • 14 comments

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:

  • how to read installed switch titles
  • how to initialize the network stack and make requests out
  • the basic architecture of the app and what parts I would be especially interested in for a project like this

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.

snoozbuster avatar Feb 13 '22 23:02 snoozbuster

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 avatar Feb 22 '22 20:02 KP2048

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

KP2048 avatar Feb 22 '22 20:02 KP2048

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 avatar Feb 22 '22 20:02 KP2048

if you need help setting things up just ask :)

KP2048 avatar Feb 22 '22 21:02 KP2048

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

KP2048 avatar Feb 22 '22 21:02 KP2048

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 avatar Feb 23 '22 08:02 snoozbuster

thanks for the other tips, those will be very useful

snoozbuster avatar Feb 23 '22 08:02 snoozbuster

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

Vs

https://gamebanana.com/mods/358217

KP2048 avatar Feb 23 '22 13:02 KP2048

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 avatar Feb 23 '22 13:02 KP2048

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

For listing titles

KP2048 avatar Feb 23 '22 14:02 KP2048

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!

snoozbuster avatar Feb 24 '22 19:02 snoozbuster

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 avatar Feb 27 '22 01:02 KP2048

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 avatar Feb 27 '22 01:02 KP2048

(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)

KP2048 avatar Feb 27 '22 02:02 KP2048