Homebrew Question Is it possible to reduce game size?

  • Thread starter Thread starter ariltonsama
  • Start date Start date
  • Views Views 5,874
  • Replies Replies 18
Sure. Same way we have done it for years and years. Pull apart game. Delete files, remap/relink* files, replace files with others from the game or self generated versions that are as small as they can be (this will require some ROM hacking skills where the others are try it and see most of the time, maybe learning enough to recognise common extensions). Rebuild if necessary and play new version. What tools we are suggesting for the kids to manipulate their XCIs and NSPs at this point in time is something I am unaware of at this point.

*not sure if there is a tool for it like the PSP had with umdgen. The idea is simple enough though -- in the game will be a file allocation table. Basically a list of locations of files within the game. While you can overwrite files with small files you can also make it such that this table points to one particular file for... all of it if you wanted. You would still need a means to remove the "redundant" data from the ROM (probably have to be manual again) or overwrite it and compress but eh -- cheating way is to make a bunch of small files (0 bytes or a couple of bytes) named for all the ones you want, leave them in the ROM as they take no space and change the pointers in the FAT to the file you want if simply deleting is not an option.

Language files are not going to represent the sorts of percentages they did years ago -- 100000 words is still going to be about the same and it is not like game scripts have got that much bigger.

Most space today is going to be in videos if the game has them, possibly music as well but the Switch does not have as much in the way of silliness like the PS3 saw. 3d models, animations and textures (all of which will probably also be the levels in modern games -- old school level design formats is rarer to see, though not absent) will also be up there and can be a good thing to look at.

Oh and it is a valid thing to do to split a game in half and when you get to where it does not work any more swap out to the second version of the ROM.

It should also be noted only certain aspects of cheats and save tampering where the devs are looking for such things (not uncommon on the Switch from what we have seen) will send up a bigger flare on the getting banned front here.
 
First: you will need to repack NCA and next to XCI/NSP. It takes some time (For 20 GB with HDD it may take more than 2 hours)
Second: only games that have many audio languages and different versions of prerendered video for each language will make a difference. Localizations file are small, so it will not make a difference.
 
You might want to try nsZip if you just want to automatically lossless reduce the NSP size by around 20% to 50% but it only deletes files that later can be restored when uncompressing like the NDV0 fragment files inside updates used to directly update from the previous to the current update. Such compressed files can't be directly played on the Switch yet. If you really want to irreversibly remove content just extract, modify and repack the game manually.
 
Last edited by nicoboss,
  • Like
Reactions: Ramzi
You might want to try nsZip if you just want to automatically lossless reduce the NSP size by around 20% to 50% but it only deletes files that later can be restored when uncompressing like the NDV0 fragment files inside updates used to directly update from the previous to the current update. Such compressed files can't be directly played on the Switch yet. If you really want to irreversibly remove content just extract, modify and repack the game manually.
Hi
You have extracted an update nsp file fifa20 switch
I got a file fragment
I couldn't find any way to extract the file
You have no solution
WrTglrs.jpg
 
Hi
You have extracted an update nsp file fifa20 switch
I got a file fragment
I couldn't find any way to extract the file
You have no solution
NDV0 fragment files are awesome and I know everything about them but honestly, they are quite useless for normal users. They are just to patch the previous update to the next update and so saving a lot of CDN bandwidth by only storing the update difference and instructions how to patch. You can use hactoolnet from https://github.com/Thealexbarney/LibHac/releases to apply them to a previous update to get the new update or nsZip to trim them to their patch instructions removing the diff data as it can be reconstructed from the patched NCA. However most likely they are completely useless for you so feel free to delete them as your game will work even without them. If you need any more information how they work feel free to ask.

If you want to just compress the game take a look at https://gbatemp.net/threads/nsz-hom...-compressor-decompressor.550556/#post-8831771
 
Last edited by nicoboss,
  • Like
Reactions: Ramzi
NDV0 fragment files are awesome and I know everything about them but honestly, they are quite useless for normal users. They are just to patch the previous update to the next update and so saving a lot of CDN bandwidth by only storing the update difference and instructions how to patch. You can use hactoolnet from https://github.com/Thealexbarney/LibHac/releases to apply them to a previous update to get the new update or nsZip to trim them to their patch instructions removing the diff data as it can be reconstructed from the patched NCA. However most likely they are completely useless for you so feel free to delete them as your game will work even without them. If you need any more information how they work feel free to ask.

If you want to just compress the game take a look at https://gbatemp.net/threads/nsz-hom...-compressor-decompressor.550556/#post-8831771
Thank you brother for the answer
I just want to extract the files in order to make a patch

--------------------- MERGED ---------------------------

NDV0 fragment files are awesome and I know everything about them but honestly, they are quite useless for normal users. They are just to patch the previous update to the next update and so saving a lot of CDN bandwidth by only storing the update difference and instructions how to patch. You can use hactoolnet from https://github.com/Thealexbarney/LibHac/releases to apply them to a previous update to get the new update or nsZip to trim them to their patch instructions removing the diff data as it can be reconstructed from the patched NCA. However most likely they are completely useless for you so feel free to delete them as your game will work even without them. If you need any more information how they work feel free to ask.

If you want to just compress the game take a look at https://gbatemp.net/threads/nsz-hom...-compressor-decompressor.550556/#post-8831771
I have loaded hactoolnet
I am a beginner did not understand your explanation well
Is it possible to clarify
 
Thank you brother for the answer
I just want to extract the files in order to make a patch
Fragment files are not packed in any way but contain patch instraction for NCA files. The diff data inside the fragment file is encrypted and there's no tool to directly decrypt fragment files however it wouldn't be hard to modify nsZip to do so. But in the end, it won't help you much as you would only have fragments of the new NCA which won't help you much anyways. So just apply them to the previous NCA to get the updated NCA if you don't have the updated NCA already anyways (which you should).
Take a look at the hactoolnet manual to understand how to aplly NDV0 patches:

Options:
-t, --intype=type Specify input file type [nca, xci, romfs, pfs0, pk11, pk21, ini1, kip1, switchfs, save, ndv0, keygen, romfsbuild, pfsbuild]

NDV0 (Delta) options:
Input delta patch can be a delta NCA file or a delta fragment file.
--basefile <file> Specify base file path.
--outfile Specify patched file path.
 
Last edited by nicoboss,
  • Like
Reactions: Ramzi
Fragment files are not packed in any way but contain patch instraction for NCA files. The diff data inside the fragment file is encrypted and there's no tool to directly decrypt fragment files however it wouldn't be hard to modify nsZip to do so. But in the end, it won't help you much as you would only have fragments of the new NCA which won't help you much anyways. So just apply them to the previous NCA to get the updated NCA if you don't have the updated NCA already anyways (which you should).
Take a look at the hactoolnet manual to understand how to aplly NDV0 patches:

Options:
-t, --intype=type Specify input file type [nca, xci, romfs, pfs0, pk11, pk21, ini1, kip1, switchfs, save, ndv0, keygen, romfsbuild, pfsbuild]

NDV0 (Delta) options:
Input delta patch can be a delta NCA file or a delta fragment file.
--basefile <file> Specify base file path.
--outfile Specify patched file path.
Updated the old and the second updated
How to apply now
I'm sorry that I am very novice
gyrkF71.jpg
 
Updated the old and the second updated
How to apply now
I'm sorry that I am very novice
If I remember correctly you can use it like this:
.\hactoolnet.exe -t ndv0 --basefile NcaOfOldVersion.nca --outfile PatchedNcaFile.nca fragment
 
  • Like
Reactions: Ramzi
If I remember correctly you can use it like this:
.\hactoolnet.exe -t ndv0 --basefile NcaOfOldVersion.nca --outfile PatchedNcaFile.nca fragment
Brother, thanks for your efforts with me
But I didn't understand anything
Because I do not have a device switch
I just let you extract the file fragment
But it seems complicated
 
Brother, thanks for your efforts with me
But I didn't understand anything
Because I do not have a device switch
I just let you extract the file fragment
But it seems complicated
It's not that complicated. You only have to specify the NCA of the old version and the fragment file containing the patch you want to apply and obviously the output file where you want to save your patched NCA as shown by the command I posted above. I highly doubt you need to manually apply the patch anyways as most if not all dumps already contain the patched NCAs as soon the game installs on real hardware the NDV0 patch will be automatically applied and deleted afterwards. It's quite special for a normal user to obtain NDV0 files in the first place. They are so beautiful but probably also so useless for you.
 
  • Like
Reactions: Ramzi
It's not that complicated. You only have to specify the NCA of the old version and the fragment file containing the patch you want to apply and obviously the output file where you want to save your patched NCA as shown by the command I posted above. I highly doubt you need to manually apply the patch anyways as most if not all dumps already contain the patched NCAs as soon the game installs on real hardware the NDV0 patch will be automatically applied and deleted afterwards. It's quite special for a normal user to obtain NDV0 files in the first place. They are so beautiful but probably also so useless for you.
Yes I guess I don't know how to deal with hactoolnet
The first time I download it
 
It's not that complicated. You only have to specify the NCA of the old version and the fragment file containing the patch you want to apply and obviously the output file where you want to save your patched NCA as shown by the command I posted above. I highly doubt you need to manually apply the patch anyways as most if not all dumps already contain the patched NCAs as soon the game installs on real hardware the NDV0 patch will be automatically applied and deleted afterwards. It's quite special for a normal user to obtain NDV0 files in the first place. They are so beautiful but probably also so useless for you.
getting errors..



Set "StrBasefile=572448c2d9ad4f4470416b9388a47c43.nca"


Set "StrInputfile=fragment"

Set "StrOutfile=.\out"



hactoolnet.exe "%StrInputfile%" -t ndv0 --basefile "%StrBasefile%" --outfile "%StrOutfile%"

pause​
 
getting errors..



Set "StrBasefile=572448c2d9ad4f4470416b9388a47c43.nca"


Set "StrInputfile=fragment"

Set "StrOutfile=.\out"



hactoolnet.exe "%StrInputfile%" -t ndv0 --basefile "%StrBasefile%" --outfile "%StrOutfile%"

pause​
What error are you getting? Also keep in mind that you need prod.keys inside %userprofile%/.switch/ for this to work as otherwise hactoolnet can't decrypt nca files.
 
Last edited by nicoboss,
  • Like
Reactions: Ramzi
What error are you getting? Also keep in mind that you need prod.keys inside %userprofile%/.switch/ for this to work as otherwise hactoolnet can't decrypt nca files.
i get :
ERROR: Original file size does not match the size in the delta header.
 
i get :
ERROR: Original file size does not match the size in the delta header.
You are most likely using the wrong fragment for the wrong nca. Let's say you have a fragment from v131072 now you need to apply this fragment to an NCA from the same game but one version lower which would be v65536 in this case. v65536 contains A LOT of NCAs and there’s no easy way for you to know so just try to apply the patch to all NCAs you can find inside v65536 and one should work.

Anyways this is getting off topic so if you have any further problems or questions please send me a personal message so we don't spam this thread.
 
Last edited by nicoboss,
  • Like
Reactions: Ramzi

Site & Scene News

Popular threads in this forum