Skip to content

Commit

Permalink
v0.65 - release
Browse files Browse the repository at this point in the history
  • Loading branch information
julesontheroad committed Nov 22, 2018
1 parent 5b59f06 commit d810561
Show file tree
Hide file tree
Showing 6 changed files with 72 additions and 17 deletions.
20 changes: 12 additions & 8 deletions NSCB.bat
Original file line number Diff line number Diff line change
Expand Up @@ -108,11 +108,11 @@ set "filename=%%~nf"
set "orinput=%%f"
set "showname=%orinput%"
call :processing_message
if "%zip_restore%" EQU "true" ( set "ziptarget=%%f" )
if "%zip_restore%" EQU "true" ( call :makezip )
REM echo %safe_var%>safe.txt
call :squirrell
%pycommand% "%nut%" %buffer% %patchRSV% -o "%w_folder%\secure" %nf_cleaner% "%%f"
if "%zip_restore%" EQU "true" ( set "ziptarget=%%f" )
if "%zip_restore%" EQU "true" ( call :makezip )
call :getname
REM setlocal enabledelayedexpansion
REM set vpack=!vrepack!
Expand Down Expand Up @@ -194,11 +194,11 @@ echo --------------------------------------
echo.
set "showname=%orinput%"
call :processing_message
if "%zip_restore%" EQU "true" ( set "ziptarget=%%f" )
if "%zip_restore%" EQU "true" ( call :makezip )
::echo %safe_var%>safe.txt
call :squirrell
%pycommand% "%nut%" %buffer% %patchRSV% -o "%w_folder%\secure" %nf_cleaner% "%%f"
if "%zip_restore%" EQU "true" ( set "ziptarget=%%f" )
if "%zip_restore%" EQU "true" ( call :makezip )
)

::FOR XCI FILES
Expand Down Expand Up @@ -255,9 +255,9 @@ call :processing_message
if exist "%w_folder%" rmdir /s /q "%w_folder%" >NUL 2>&1
call :squirrell
%pycommand% "%nut%" %buffer% %patchRSV% -o "%w_folder%\secure" %nf_cleaner% "%~1"
call :getname
if "%zip_restore%" EQU "true" ( set "ziptarget=%~1" )
if "%zip_restore%" EQU "true" ( call :makezip )
call :getname
if "%vrename%" EQU "true" call :addtags_from_nsp
::echo "%vrepack%"
::echo "%nsp_lib%"
Expand Down Expand Up @@ -533,17 +533,18 @@ if "%vrepack%" EQU "zip" ( goto nsp_just_zip )
%pycommand% "%nut%" %buffer% %patchRSV% -o "%w_folder%\secure" %nf_cleaner% "%orinput%"

:nsp_just_zip
call :getname
if "%zip_restore%" EQU "true" ( call :makezip )

call :getname
if "%vrename%" EQU "true" call :addtags_from_nsp
if "%vrepack%" EQU "nsp" ( call "%nsp_lib%" "repack" "%w_folder%" "%%f")
if "%vrepack%" EQU "xci" ( call "%xci_lib%" "repack" "%w_folder%" "%%f")
if "%vrepack%" EQU "both" ( call "%nsp_lib%" "repack" "%w_folder%" "%%f")
if "%vrepack%" EQU "both" ( call "%xci_lib%" "repack" "%w_folder%" "%%f")
setlocal enabledelayedexpansion
if "%zip_restore%" EQU "true" ( goto :nsp_just_zip2 )
if exist "%fold_output%\!end_folder!" RD /S /Q "%fold_output%\!end_folder!" >NUL 2>&1
MD "%fold_output%\!end_folder!" >NUL 2>&1
:nsp_just_zip2
if not exist "%fold_output%\!end_folder!" MD "%fold_output%\!end_folder!" >NUL 2>&1
move "%w_folder%\*.xci" "%fold_output%\!end_folder!" >NUL 2>&1
move "%w_folder%\*.nsp" "%fold_output%\!end_folder!" >NUL 2>&1
move "%w_folder%\*.zip" "%fold_output%\!end_folder!" >NUL 2>&1
Expand Down Expand Up @@ -1007,11 +1008,14 @@ if "%vrename%" EQU "true" ( set "filename=%end_folder%" )
exit /B

:makezip
echo.
echo Making zip for %ziptarget%
echo.
%pycommand% "%nut%" %buffer% %patchRSV% -o "%w_folder%\zip" --zip_combo "%ziptarget%"
%pycommand% "%nut%" -o "%w_folder%\zip" --NSP_c_KeyBlock "%ziptarget%"
%pycommand% "%nut%" --nsptitleid "%ziptarget%" >"%w_folder%\nsptitleid.txt"
if exist "%w_folder%\secure\*.dat" ( move "%w_folder%\secure\*.dat" "%w_folder%\zip" ) >NUL 2>&1

set /p titleid=<"%w_folder%\nsptitleid.txt"
del "%w_folder%\nsptitleid.txt" >NUL 2>&1
%pycommand% "%nut%" --nsptype "%ziptarget%" >"%w_folder%\nsptype.txt"
Expand Down
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,8 @@ builds.

``` --C_clean_ND-> Copy and remove titlerights skipping deltas```

- patchRSV -> Patch RequiredSystemVersion

#### OPTION 4: Route to game_info.ini and keys.txt
#### OPTION 5: REPACK OPTIONS. Controls repack in auto mode.
##### Repack option for auto-mode
Expand Down
Binary file added profiles.zip
Binary file not shown.
62 changes: 56 additions & 6 deletions ztools/Fs/Nsp.py
Original file line number Diff line number Diff line change
Expand Up @@ -1044,6 +1044,7 @@ def get_cnmt_verID(self):
def cr_tr_nca(self,ofolder,buffer,metapatch):
indent = 1
tabs = '\t' * indent
text_file='newcontent_'+self.getnspid()+'.dat'
ticket = self.ticket()
masterKeyRev = ticket.getMasterKeyRevision()
titleKeyDec = Keys.decryptTitleKey(ticket.getTitleKeyBlock().to_bytes(16, byteorder='big'), Keys.getMasterKeyIndex(masterKeyRev))
Expand All @@ -1068,6 +1069,9 @@ def cr_tr_nca(self,ofolder,buffer,metapatch):
filepath = os.path.join(outfolder, filename)
if not os.path.exists(outfolder):
os.makedirs(outfolder)
textpath = os.path.join(outfolder, text_file)
with open(textpath, 'a') as tfile:
tfile.write(str(nca.header.contentType)+ ': ' + tabs + str(nca._path) + '\n')
fp = open(filepath, 'w+b')
nca.rewind()
Print.info(tabs + 'Copying: ' + str(filename))
Expand Down Expand Up @@ -1150,14 +1154,26 @@ def cr_tr_nca(self,ofolder,buffer,metapatch):
newpath=dir+ '/' + newname
os.rename(filepath, newpath)
Print.info(tabs + '-------------------------------------')
textpath = os.path.join(outfolder, text_file)
with open(textpath, 'a') as tfile:
tfile.write(str(nca.header.contentType)+ ': ' + tabs + tabs + newname + '\n')
else:
Print.info(tabs +'-> No need to patch the meta' )
Print.info(tabs + '-------------------------------------')
Print.info(tabs + '-------------------------------------')
textpath = os.path.join(outfolder, text_file)
with open(textpath, 'a') as tfile:
tfile.write(str(nca.header.contentType)+ ': ' + tabs + tabs + str(nca._path) + '\n')
else:
textpath = os.path.join(outfolder, text_file)
with open(textpath, 'a') as tfile:
tfile.write(str(nca.header.contentType)+ ': ' + tabs + str(nca._path) + '\n')


#COPY AND CLEAN NCA FILES SKIPPING DELTAS AND PATCH NEEDED SYSTEM VERSION
def cr_tr_nca_nd(self,ofolder,buffer,metapatch):
indent = 1
tabs = '\t' * indent
text_file='newcontent_'+self.getnspid()+'.dat'
ticket = self.ticket()
masterKeyRev = ticket.getMasterKeyRevision()
titleKeyDec = Keys.decryptTitleKey(ticket.getTitleKeyBlock().to_bytes(16, byteorder='big'), Keys.getMasterKeyIndex(masterKeyRev))
Expand Down Expand Up @@ -1192,6 +1208,9 @@ def cr_tr_nca_nd(self,ofolder,buffer,metapatch):
filepath = os.path.join(outfolder, filename)
if not os.path.exists(outfolder):
os.makedirs(outfolder)
textpath = os.path.join(outfolder, text_file)
with open(textpath, 'a') as tfile:
tfile.write(str(nca.header.contentType)+ ': ' + tabs + str(nca._path)+'\n')
fp = open(filepath, 'w+b')
nca.rewind()
Print.info(tabs + 'Copying: ' + str(filename))
Expand Down Expand Up @@ -1274,14 +1293,25 @@ def cr_tr_nca_nd(self,ofolder,buffer,metapatch):
newpath=dir+ '/' + newname
os.rename(filepath, newpath)
Print.info(tabs + '-------------------------------------')
textpath = os.path.join(outfolder, text_file)
with open(textpath, 'a') as tfile:
tfile.write(str(nca.header.contentType)+ ': ' + tabs + tabs + newname + '\n')
else:
Print.info(tabs +'-> No need to patch the meta' )
Print.info(tabs + '-------------------------------------')
Print.info(tabs + '-------------------------------------')
textpath = os.path.join(outfolder, text_file)
with open(textpath, 'a') as tfile:
tfile.write(str(nca.header.contentType)+ ': ' + tabs + tabs + str(nca._path) + '\n')
else:
textpath = os.path.join(outfolder, text_file)
with open(textpath, 'a') as tfile:
tfile.write(str(nca.header.contentType)+ ': ' + tabs + str(nca._path) + '\n')

#Copy nca files
def copy_nca(self,ofolder,buffer,metapatch):
indent = 1
tabs = '\t' * indent
text_file='newcontent_'+self.getnspid()+'.dat'
for nca in self:
if type(nca) == Nca:
nca.rewind()
Expand Down Expand Up @@ -1345,15 +1375,26 @@ def copy_nca(self,ofolder,buffer,metapatch):
newpath=dir+ '/' + newname
os.rename(filepath, newpath)
Print.info(tabs + '-------------------------------------')
textpath = os.path.join(outfolder, text_file)
with open(textpath, 'a') as tfile:
tfile.write(str(nca.header.contentType)+ ': ' + tabs + tabs + newname + '\n')
else:
Print.info(tabs +'-> No need to patch the meta' )
Print.info(tabs + '-------------------------------------')
Print.info(tabs + '-------------------------------------')
textpath = os.path.join(outfolder, text_file)
with open(textpath, 'a') as tfile:
tfile.write(str(nca.header.contentType)+ ': ' + tabs + tabs + str(nca._path) + '\n')
else:
textpath = os.path.join(outfolder, text_file)
with open(textpath, 'a') as tfile:
tfile.write(str(nca.header.contentType)+ ': ' + tabs + str(nca._path) + '\n')


#Copy nca files skipping deltas
def copy_nca_nd(self,ofolder,buffer,metapatch):
indent = 1
tabs = '\t' * indent
text_file='newcontent_'+self.getnspid()+'.dat'
Print.info('Copying files: ')
for nca in self:
vfragment="false"
Expand All @@ -1373,7 +1414,7 @@ def copy_nca_nd(self,ofolder,buffer,metapatch):
outfolder = str(ofolder)+'/'
filepath = os.path.join(outfolder, filename)
if not os.path.exists(outfolder):
os.makedirs(outfolder)
os.makedirs(outfolder)
fp = open(filepath, 'w+b')
nca.rewind()
Print.info(tabs + 'Copying: ' + str(filename))
Expand Down Expand Up @@ -1429,10 +1470,19 @@ def copy_nca_nd(self,ofolder,buffer,metapatch):
newpath=dir+ '/' + newname
os.rename(filepath, newpath)
Print.info(tabs + '-------------------------------------')
textpath = os.path.join(outfolder, text_file)
with open(textpath, 'a') as tfile:
tfile.write(str(nca.header.contentType)+ ': ' + tabs + tabs + newname + '\n')
else:
Print.info(tabs +'-> No need to patch the meta' )
Print.info(tabs + '-------------------------------------')

Print.info(tabs + '-------------------------------------')
textpath = os.path.join(outfolder, text_file)
with open(textpath, 'a') as tfile:
tfile.write(str(nca.header.contentType)+ ': ' + tabs + tabs + str(nca._path) + '\n')
else:
textpath = os.path.join(outfolder, text_file)
with open(textpath, 'a') as tfile:
tfile.write(str(nca.header.contentType)+ ': ' + tabs + str(nca._path) + '\n')



Expand Down
Binary file modified ztools/Fs/__pycache__/Nsp.cpython-37.pyc
Binary file not shown.
5 changes: 2 additions & 3 deletions ztools/squirrel.py
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@
parser.add_argument('--NSP_copy_ntr_nca', nargs='+', help='Extracts nca files without titlerights from target nsp')
parser.add_argument('--NSP_c_KeyBlock', nargs='+', help='Extracts keyblock from nsca files with titlerigths from target nsp')
parser.add_argument('--C_clean', nargs='+', help='Extracts nca files and removes it.s titlerights from target NSP OR XCI')
parser.add_argument('--C_clean_ND', nargs='+', help='Extracts nca files and removes it.s titlerights from target NSP OR XCI without deltas')
parser.add_argument('--C_clean_ND', nargs='+', help='Extracts nca files and removes it.s titlerights from target NSP OR XCI without deltas')

# Combinations
parser.add_argument('--placeholder_combo', nargs='+', help='Extracts nca files for placeholder nsp')
Expand All @@ -132,7 +132,6 @@

Status.start()


# NCA/NSP IDENTIFICATION
# ..................................................
# Get titleid from nca file
Expand Down Expand Up @@ -313,7 +312,7 @@
f.close()
except BaseException as e:
Print.error('Exception: ' + str(e))

# GAMECARD FLAG FUNCTIONS
# ...................................................
# Set isgamecard flag from all nca in an NSP as ESHOP
Expand Down

0 comments on commit d810561

Please sign in to comment.