Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: AnalogMan151/splitNSP
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: v1.0.1
Choose a base ref
...
head repository: AnalogMan151/splitNSP
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: master
Choose a head ref
  • 5 commits
  • 2 files changed
  • 3 contributors

Commits on Mar 13, 2019

  1. Add option to change output path

    Added the '-o' flag to the tool, in order to directly write the split nsp file to the SD card, rather than writing the split files to disk, then copying it to SD card
    pcouy authored Mar 13, 2019

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    d3dff1f View commit details

Commits on Mar 14, 2019

  1. Copy the full SHA
    1f03a3d View commit details
  2. Copy the full SHA
    8ff761b View commit details

Commits on Mar 18, 2019

  1. Merge pull request #7 from pcouy/patch-1

    Add option to change output path
    AnalogMan authored Mar 18, 2019

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    2547248 View commit details

Commits on May 15, 2021

  1. Update README.md

    Added mention of NX-Shell to readme for setting archive flag.
    AnalogMan151 authored May 15, 2021

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    d5cf915 View commit details
Showing with 14 additions and 6 deletions.
  1. +1 −1 README.md
  2. +13 −5 splitNSP.py
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -6,7 +6,7 @@ To run it you'll need Python3 installed. Once installed, call the script from Te

```python3 splitNSP.py filename.nsp```

By default this will make a copy of the NSP and split it up into parts. Once created, you'll need to open the folder's properties and check the Archive flag. This is easily done on Windows, I'm still working on a way to do it for macOS since file flags aren't saved when copying to FAT32.
By default this will make a copy of the NSP and split it up into parts. Once created, you'll need to open the folder's properties and check the Archive flag. This is easily done on Windows, I'm still working on a way to do it for macOS since file flags aren't saved when copying to FAT32. You can also set the archive flag on a folder directly on the Switch using a homebrew such as NX-Shell.

You can also activate quick mode with this command:

18 changes: 13 additions & 5 deletions splitNSP.py
Original file line number Diff line number Diff line change
@@ -25,7 +25,7 @@ def splitQuick(filepath):
return

print('Splitting NSP into {0} parts...\n'.format(splitNum + 1))

# Create directory, delete if already exists
dir = filepath[:-4] + '_split.nsp'
if os.path.exists(dir):
@@ -74,7 +74,7 @@ def splitQuick(filepath):

print('\nNSP successfully split!\n')

def splitCopy(filepath):
def splitCopy(filepath, output_dir=""):
fileSize = os.path.getsize(filepath)
info = shutil.disk_usage(os.path.dirname(os.path.abspath(filepath)))
if info.free < fileSize*2:
@@ -89,7 +89,12 @@ def splitCopy(filepath):
print('Splitting NSP into {0} parts...\n'.format(splitNum + 1))

# Create directory, delete if already exists
dir = filepath[:-4] + '_split.nsp'
if output_dir == "":
dir = filepath[:-4] + '_split.nsp'
else:
if output_dir[-4:] != '.nsp':
output_dir+= ".nsp"
dir = output_dir
if os.path.exists(dir):
shutil.rmtree(dir)
os.makedirs(dir)
@@ -121,7 +126,10 @@ def main():
# Arg parser for program options
parser = argparse.ArgumentParser(description='Split NSP files into FAT32 compatible sizes')
parser.add_argument('filepath', help='Path to NSP file')
parser.add_argument('-q', '--quick', action='store_true', help='Splits file in-place without creating a copy. Only requires 4GiB free space to run')
group = parser.add_mutually_exclusive_group()
group.add_argument('-q', '--quick', action='store_true', help='Splits file in-place without creating a copy. Only requires 4GiB free space to run')
group.add_argument('-o', '--output-dir', type=str, default="",
help="Set alternative output dir")

# Check passed arguments
args = parser.parse_args()
@@ -137,7 +145,7 @@ def main():
if args.quick:
splitQuick(filepath)
else:
splitCopy(filepath)
splitCopy(filepath, args.output_dir)

if __name__ == "__main__":
main()