Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

is it possible to combine multiple nsp into one .xci file #113

Open
ghost opened this issue Aug 19, 2022 · 18 comments
Open

is it possible to combine multiple nsp into one .xci file #113

ghost opened this issue Aug 19, 2022 · 18 comments

Comments

@ghost
Copy link

ghost commented Aug 19, 2022

is it possible to combine multiple nsp into one .xci file on macos

@nicoboss
Copy link
Owner

Putting multiple games into a single XCI is not something that's possible. All NSP, XCI, NSZ and XCZ can only hold a single game. They are all just containers containing the actual NCA/NCZ files. Technically nothing stops you from putting multiple games into one container, but it would create a huge unplayable mess with absolutely no use. If you want to combine multiple games into one file just tar the resulting NSZ files but I don't see any reason why you would want to do that.

Do you maybe mean split NSPs used to overcome the fat32 file system limitations? In that case just merge them first using cat *.nsp > merged.nsp and then put the combined NSP into this tool.

I'm maybe misunderstanding your question. Can you please elaborate what you want to achieve?

@ghost
Copy link
Author

ghost commented Aug 20, 2022

Sorry, I didn't express myself correctly. I mean, the NSP files of base, patches and DLCs of the same game to be merged into one NSP or XCI file, maybe say it as multicontents NSP or XCI of one game.

I found such multicontents XCI on the internet, but don't know how they produce it.

@Masamune3210
Copy link

You use something like nsc_builder to make the multicontent file, nsz is just for compressing or validating the resulting nsp file

@ghost
Copy link
Author

ghost commented Aug 20, 2022

OK but problem is nsc builder only support Windows. how to do the same thing on mac?

@Masamune3210
Copy link

iirc nsc_builder is mostly if not completely in python, or does it rely on some windows exe that I'm forgetting. The most work you would have to do is either call the tools manually or figure out a way to convert the gigantic AF batch files it uses as a menu system to .sh files or the ilk

@ghost
Copy link
Author

ghost commented Sep 3, 2022

Will nsz -c repack multiple nsp files into one nsp file? How to use --create command?

@nicoboss
Copy link
Owner

nicoboss commented Sep 3, 2022

There currently is no official support for multicontent files inside this tool.

You are correct and there indeed is --create that allows you to recreate an NSP based on the content of a folder. By using --extract for base, updates and DLCs to the same folder and then using --create to get an NSP of that folder you indeed get an NSP that contains base, updates and DLCs. You could than compress that to an NSZ. But is that really what you want? It would just be an NSZ that contains base, update and DLCs but updates and DLCs aren't really applied so whatever title installer you use would still need to install them all separately and somehow be able to deal with the quite messed up metadata. I don't think that's how multicontent files work and what you would get is likely not supported by any currently existing title installer.

I never looked into multicontent files so far so no idea how they work. I might plan to support them in the future as they are probably not that hard to implement. If you or anyone else wants to implement them, feel free to do so and create a pull request.

@Masamune3210
Copy link

afaik they are multiple cmnt and file combos inside of the nsp and the installer just iterates through all the cmnt files to see what is included in the nsp

Here is a issue chain from nsc_builder kinda explaining the format a bit
https://web.archive.org/web/20200919101029/https://github.com/julesontheroad/NSC_BUILDER/issues/135

@Masamune3210
Copy link

In total, it seems that the nsp is just treated as a archive, all the different individual nsp's files are included in the multi nsp and the installer and tools just have to change the assumption that there is only one title, and scan through all the included files to see what is included in the multi nsp

@ghost
Copy link
Author

ghost commented Sep 4, 2022

wow i tried some tests and it actually works well, so i would like to share and communicate with you:
1.on windows (virtual machine) i use nsc builder to combine game base.xci, update.nsp, dlc.nsp together, into one multicontent xci file.
2. on Mac i use nsz -C to compress the multicontent xci file, and nsz cli shows it compress game base, update, dlc one by one, and output one multicontent xcz file. xcz file saves about 20% size of original xci file.
3. i use DBI to connect Switch to Mac, start MTP, drag xcz file to 'MicroSD install' partitioninin in the SD card, game base, update, dlc are installed successfully.

multicontent xcz file is better to store, especially for old games that not updating anymore.

so, if nsz cli can originally provide repacking multicontent xci or nsp file, it would be very helpful to Mac users.

please consider to use the same backbone that NSCB does to create the XCI, squirrel.py.
https://github.com/ItsCinnabar/Mass_Custom_XCIs

i prefer to do all things above on mac with one nsz cli, and without using virtual machine.

but anyway, nsz is very good tool by now, thanks a lot!

@ghost
Copy link
Author

ghost commented Sep 7, 2022

I cd to folder where .nsp files are, and run nsz -c CREATE, it shows error below, am i doing wrong way or how can it fix error, thx a lot!

❯ nsz -c CREATE

             NSZ v4.1   ,;:;;,
                       ;;;;;
               .=',    ;:;;:,
              /_', "=. ';:;:;
              @=:__,  \,;:;:'
                _(\.=  ;:;;'
               `"_(  _/="`
                `"'

Creating "CREATE"
	Repacking to NSP...
nut exception: 'Counter' object has no attribute 'write'
Traceback (most recent call last):
  File "/Users/username/.pyenv/versions/3.10.6/bin/nsz", line 8, in <module>
    sys.exit(main())
  File "/Users/username/.pyenv/versions/3.10.6/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/nsz/__init__.py", line 148, in main
    nsp.pack(args.file)
  File "/Users/username/.pyenv/versions/3.10.6/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/nsz/Fs/Nsp.py", line 384, in pack
    t.write('\t\tWriting header...')
AttributeError: 'Counter' object has no attribute 'write'

@ghost
Copy link
Author

ghost commented Sep 7, 2022

You are correct and there indeed is --create that allows you to recreate an NSP based on the content of a folder. By using --extract for base, updates and DLCs to the same folder and then using --create to get an NSP of that folder you indeed get an NSP that contains base, updates and DLCs.

I think yes, it is what i am trying, but get trouble with nsz --create step.
I have used nsz --extract to game base, dlc, updates nsp file, for the same game, and got a few folders for each nsp file.
Then i cd to folder where those output folders are, and run nsz --create CREATE, it gave the same error as above.
don't know how to solve, please help, thank you!

@nicoboss
Copy link
Owner

nicoboss commented Sep 7, 2022

@blacklein You should now be able to repack the extracted folders back to an NSP if you use latest master. I fixed the issue you experienced with --create and improved its syntax and documentation.

Example how to use it:

python .\nsz.py --create name_of_outfile.nsp .\first_extracted_folder .\second_extracted_folder .\third_extracted_folder

@ghost
Copy link
Author

ghost commented Sep 8, 2022

it still not works, gives error below

❯ python nsz.py --create output.nsp ./base, ./updates, ./dlc

             NSZ v4.1   ,;:;;,
                       ;;;;;
               .=',    ;:;;:,
              /_', "=. ';:;:;
              @=:__,  \,;:;:'
                _(\.=  ;:;;'
               `"_(  _/="`
                `"'

nut exception: module 'enlighten' has no attribute 'get_manager'
Traceback (most recent call last):
  File "/Users/username/Downloads/nsz/nsz.py", line 18, in <module>
    nsz.main()
  File "/Users/username/Downloads/nsz/nsz/__init__.py", line 110, in main
    barManager = enlighten.get_manager()
AttributeError: module 'enlighten' has no attribute 'get_manager'

@RinMaru
Copy link

RinMaru commented Jul 7, 2024

i couldn't get this to work much unfortunately but i also am useless in cmd so a gui would be great. NSC Builder will combine files but NSZ will have issues compressing them so im not sure what to do

@Masamune3210
Copy link

NSC_BUILDER can also compress, btw. It's just not focused on certain things like nsz is

@RinMaru
Copy link

RinMaru commented Jul 8, 2024

NSC_BUILDER can also compress, btw. It's just not focused on certain things like nsz is

problem is its outdated and has issues. anytime i merge stuff in NSC, it and NSZ can no longer find the titlekey and NSZ just has issues compressing anything NSC spits out with validation errors

@RinMaru
Copy link

RinMaru commented Jul 8, 2024

@blacklein You should now be able to repack the extracted folders back to an NSP if you use latest master. I fixed the issue you experienced with --create and improved its syntax and documentation.

Example how to use it:

python .\nsz.py --create name_of_outfile.nsp .\first_extracted_folder .\second_extracted_folder .\third_extracted_folder

could you possibly make a bat script out of that so i can just drag the folder into it and it will spit it out?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants