Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #SingleInstance force
- ; 20th July 2014 by Baoulettes aka Joffrey Panisset
- ; Joffrey.panisset@hotmail.com
- ; Unauthorized use is forbidden.
- ; Here are my credit list :
- ; Autohotkey to allow such code stuff :)
- ; fabianosan for Rocksmith Custom Song Toolkit unpacker.
- ; Snakez for Rocksmith Custom Song Toolkit unpacker.
- ; Maveth for Rocksmith Custom Song Toolkit unpacker.
- ; Raynebc for Rocksmith Custom Song Toolkit unpacker.
- ; Dreddfoxx for Rocksmith Custom Song Toolkit unpacker.
- ; Alex360 (L0fka) for Rocksmith Custom Song Toolkit unpacker.
- ; Shrubbery (otaznik) for Rocksmith Custom Song Toolkit unpacker.
- ; Cozy1 for Rocksmith Custom Song Toolkit unpacker.
- ; Zephyrix for Rocksmith Custom Song Toolkit unpacker.
- ; Xavatar (PowerSlinky) for Rocksmith Custom Song Toolkit unpacker.
- ; Chlipouni for Rocksmith Custom Song Toolkit unpacker.
- ; Cgeorge for Rocksmith Custom Song Toolkit unpacker.
- ;Variables Setting :
- Appname = Classmith 2014
- Appversion = V1.0.0
- ;Creating Ressources Directory :
- fileCreateDir, %A_ScriptDir%\ressources\
- fileCreateDir, %A_ScriptDir%\ressources\packer
- ;Installing required files :
- FileInstall, D:\RS2014SongClassifier\Ressources\packer\NDesk.Options.dll, %A_ScriptDir%\ressources\packer\NDesk.Options.dll
- FileInstall, D:\RS2014SongClassifier\Ressources\packer\packer.exe, %A_ScriptDir%\ressources\packer\packer.exe
- FileInstall, D:\RS2014SongClassifier\Ressources\packer\packer.pdb, %A_ScriptDir%\ressources\packer\packer.pdb
- FileInstall, D:\RS2014SongClassifier\Ressources\packer\RocksmithToolkitLib.dll, %A_ScriptDir%\ressources\packer\RocksmithToolkitLib.dll
- FileInstall, D:\RS2014SongClassifier\Ressources\packer\X360.dll, %A_ScriptDir%\ressources\packer\X360.dll
- FileInstall, D:\RS2014SongClassifier\Ressources\packer\ZLIB.dll, %A_ScriptDir%\ressources\packer\ZLIB.dll
- FileInstall, D:\RS2014SongClassifier\Ressources\packer\zlib.net.dll, %A_ScriptDir%\ressources\packer\zlib.net.dll
- FileInstall, D:\RS2014SongClassifier\Ressources\Baoulettes.png, %A_ScriptDir%\ressources\Baoulettes.png,1
- FileInstall, D:\RS2014SongClassifier\Ressources\Rocksmith-2014-Edition-Logo.png, %A_ScriptDir%\ressources\Rocksmith-2014-Edition-Logo.png,1
- ; Reading various Variables
- IniRead, Languages, Options.ini, Options, Languages
- IniRead, SelectedRS2014Folder, Options.ini, Options, R2014dir
- IniRead, DLCWantingNameInput, Options.ini, Options, WantedPsarcName
- IniRead, Platform, Options.ini, Options, Platform
- IniRead, YesnoDL, Options.ini, Options, SeparateInFolderQS
- If SelectedRS2014Folder = ERROR
- {
- FileSelectFolder, SelectedRS2014Folder,, 3,Please choice Rocksmith 2014 directory.
- IniWrite, %SelectedRS2014Folder%, Options.ini, Options, R2014dir
- }
- If SelectedRS2014Folder =
- {
- FileSelectFolder, SelectedRS2014Folder,, 3,Please choice Rocksmith 2014 directory.
- IniWrite, %SelectedRS2014Folder%, Options.ini, Options, R2014dir
- }
- If Languages = ERROR
- {
- Languages=En
- }
- If Languages =
- {
- Languages=En
- }
- If YesnoDL = ERROR
- {
- YesnoDL = Yes||No
- }
- If YesnoDL =
- {
- YesnoDL = Yes||No
- }
- If YesnoDL = Yes
- {
- YesnoDL = Yes||No
- }
- If YesnoDL = No
- {
- YesnoDL = Yes|No||
- }
- If Platform = ERROR
- {
- Platform = PC||Mac
- }
- If Platform =
- {
- Platform = PC||Mac
- }
- If Platform = PC
- {
- Platform = PC||Mac
- }
- If Platform = Mac
- {
- Platform = PC|Mac||
- }
- If DLCWantingNameInput = ERROR
- {
- DLCWantingNameInput=`%A`%_`%SN`%_`%AN`%_V`%V`%
- }
- If DLCWantingNameInput =
- {
- DLCWantingNameInput=`%A`%_`%SN`%_`%AN`%_V`%V`%
- }
- ;Variables for translation :
- ;Base - English :
- If Languages = EN
- {
- about = About
- choiceRSDir = Please choice Rocksmith 2014 directory.
- RS2014FSelectB = Browse
- DLCWantedName = Please set a name scheme. (More information about variables name at right)
- BasicInfoFileNaming = use `%A`% for Artist Name`n use `%SN`% for Song Name`n use `%AN`% for Album Name`n use `%V`% for Package Version (Recommended.)`nAll space will be replaced by underscores.
- SelectPFText = Target platform :
- SeparateInFolderQS = Would you like to sort song in a Artist folder inside DLC folder?
- AppsUsageText = 1st You have to select a Rocksmith 2014 directory (NOT dlc just root folder!)`n2nd Config the application as you wish.`n3rd Press "Let do it".`nCommon error possible :`nNo dlc in DLC folder so nothing to do`nAlready sorted .psarc (This application don't look in subfolder to prevent unwanted error)`nFolder isn't Rocksmith 2014 root.`nPlease becareful and make Backups if you're unsure !`nThe more CDLC/DLC you have the more time it will take so please be patient !`nIf you have Any problem contact me over: `nFacebook : Page: Baoulettes`nSkype : mysticia26
- StartProcess = Let do it !
- CreditText = This Application has been mady by Baoulettes. 2015
- AboutTextWindows = Credits List:`nAutohotkey`nBaoulettes`nRocksmith Custom Song Toolkit maker :`nfabianosan`nSnakez`nMaveth`nRaynebc`nDreddfoxx`nAlex360 (L0fka)`nShrubbery (otaznik)`nCozy1`nZephyrix`nXavatar`nChlipouni`nCgeorge
- }
- ;Gui Making !
- Gui,1: Add, Button, x412 y5 w60 h20 gaboutwin, %about%
- Gui,1: Add, Text, x100 y29 w370 h30 BackGroundTrans +Center, %choiceRSDir%
- Gui,1: Add, Button, x412 y29 w60 h20 gSelRS2014Folder, %RS2014FSelectB%
- Gui,1: Add, Edit, x2 y59 w470 h30 vactualdir +Center, %SelectedRS2014Folder%
- Gui,1: Add, Text, x2 y95 w250 h30 +Center, %DLCWantedName%
- Gui,1: Add, Edit, x2 y129 w250 h40 vnameinput +Center, %DLCWantingNameInput%
- Gui,1: Add, Text, x262 y95 w210 h80 +Center, %BasicInfoFileNaming%
- Gui,1: Add, DropDownList, x362 y187 w100 h20 r2 vSelPlatform, %Platform%
- Gui,1: Add, Text, x262 y191 w100 h30 , %SelectPFText%
- Gui,1: Add, Text, x2 y185 w150 h30 , %SeparateInFolderQS%
- Gui,1: Add, DropDownList, x152 y187 w100 h21 r2 vFolderYesNo, %YesnoDL%
- Gui,1: Add, Text, x2 y223 w470 h160 +Center, %AppsUsageText%
- Gui,1: Add, Button, x12 y399 w450 h30 gGoforIt, %StartProcess%
- Gui,1: Add, Text, x2 y429 w470 h20 +Center, %CreditText%
- Gui,1: Add, Picture, x0 y0 w180 h60 BackGroundTrans, %A_ScriptDir%\ressources\Rocksmith-2014-Edition-Logo.png
- Gui,1: Show, h450 w476, %Appname% - %Appversion%
- Return
- ; Creating Credit / About window
- aboutwin:
- Gui,1: Hide
- Gui,2: Add, Picture, x0 y0 w150 h150 , %A_ScriptDir%\ressources\Baoulettes.png
- Gui,2: Add, Text, x0 y149 w150 h230 +Center, %AboutTextWindows%
- Gui,2: Show, h381 w150, %Appname% - %Appversion%
- Return
- ;Functions :
- ; Rocksmith Directory selection.
- SelRS2014Folder:
- FileSelectFolder, SelectedRS2014Folder,, 3,%choiceRSDir%
- GuiControl,1:,actualdir, %SelectedRS2014Folder%
- IniWrite, %SelectedRS2014Folder%, Options.ini, Options, R2014dir
- Return
- ; Main Function to parse files & rename etc.
- GoforIt:
- Gui,1: Submit
- GuiControlGet, actualdir,1:,
- GuiControlGet, nameinput,1:,
- GuiControlGet, SelPlatform,1:,
- GuiControlGet, FolderYesNo,1:,
- DLCWantingNameInput = %nameinput%
- SelectedRS2014Folder = %actualdir%
- Platform = %SelPlatform%
- YesnoDL = %FolderYesNo%
- If SelectedRS2014Folder = ERROR
- {
- FileSelectFolder, SelectedRS2014Folder,, 3,%choiceRSDir%
- GuiControl,1:,actualdir, %SelectedRS2014Folder%
- IniWrite, %SelectedRS2014Folder%, Options.ini, Options, R2014dir
- Gui,1: Restore
- return
- }
- If SelectedRS2014Folder =
- {
- FileSelectFolder, SelectedRS2014Folder,, 3,%choiceRSDir%
- GuiControl,1:,actualdir, %SelectedRS2014Folder%
- IniWrite, %SelectedRS2014Folder%, Options.ini, Options, R2014dir
- Gui,1: Restore
- return
- }
- If DLCWantingNameInput = ERROR
- {
- Msgbox, Please set a name other than Error... Use Variables too!
- Gui,1: Restore
- return
- }
- If DLCWantingNameInput =
- {
- Msgbox, Please set a name other than Error... Use Variables too!
- Gui,1: Restore
- return
- }
- If Platform = PC||Mac
- {
- Platform = PC
- }
- If Platform = PC|Mac||
- {
- Platform = Mac
- }
- If YesnoDL = Yes||No
- {
- YesnoDL = Yes
- }
- If YesnoDL = Yes|No||
- {
- YesnoDL = No
- }
- IniWrite, %Languages%, Options.ini, Options, Languages
- IniWrite, %SelectedRS2014Folder%, Options.ini, Options, R2014dir
- IniWrite, %DLCWantingNameInput%, Options.ini, Options, WantedPsarcName
- IniWrite, %Platform%, Options.ini, Options, Platform
- IniWrite, %YesnoDL%, Options.ini, Options, SeparateInFolderQS
- NameId=0
- If Platform = PC
- {
- endfilename = _p.psarc
- PT = _Pc
- FileCreateDir, %SelectedRS2014Folder%\dlc\01MacVersion
- FileMove, %SelectedRS2014Folder%\dlc\*_m.psarc, %SelectedRS2014Folder%\dlc\01MacVersion
- }
- If Platform = Mac
- {
- endfilename = _m.psarc
- FileCreateDir, %SelectedRS2014Folder%\dlc\01PcVersion
- FileMove, %SelectedRS2014Folder%\dlc\*_p.psarc, %SelectedRS2014Folder%\dlc\01PcVersion
- PT = _Mac
- }
- FileCreateDir, %A_ScriptDir%\tmp
- FileCreateDir, %A_ScriptDir%\tmp\ToRename
- Gui,3: Add, Text, x0 y0 w240 h90 vGui3Txt +Center, %Gui3Text%
- Gui,3: -SysMenu
- Gui,3: Show, h88 w244, Working . . .
- Loop Files, %SelectedRS2014Folder%\dlc\*.psarc,
- {
- ;FileName = %A_LoopFileName%
- StringReplace, CutedName, A_LoopFileName, .psarc, , All
- UnpackFDName = %CutedName%%PT%
- FileCreateDir, %A_ScriptDir%\tmp\ToRename\Unpack
- FileMove, %SelectedRS2014Folder%\dlc\%A_LoopFileName%, %A_ScriptDir%\tmp\ToRename
- RunWait, %A_ScriptDir%\ressources\packer\packer.exe --unpack -i="%A_ScriptDir%\tmp\ToRename\%A_LoopFileName%" -o="%A_ScriptDir%\tmp\ToRename\Unpack",,Hide
- Loop Files, %A_ScriptDir%\tmp\ToRename\Unpack\%UnpackFDName%\*.nt,
- {
- StringTrimRight, UniqueID, A_LoopFileName, 18
- }
- FileRead, VersionCheck, %A_ScriptDir%\tmp\ToRename\Unpack\%UnpackFDName%\toolkit.version
- if not ErrorLevel
- {
- Checkif = Package Version:
- IfInString, VersionCheck, %Checkif%
- FoundV := InStr(VersionCheck, Checkif)
- FoundV+=16
- StringTrimLeft, PVersion2Split, VersionCheck, %FoundV%
- StringLeft, PVersion, PVersion2Split, 2
- }
- else
- {
- PVersion =1
- }
- FileRead, HSANFile, %A_ScriptDir%\tmp\ToRename\Unpack\%UnpackFDName%\manifests\songs_dlc_%UniqueID%\songs_dlc_%UniqueID%.hsan
- Check4AN = `"AlbumName`": `"
- IfInString, HSANFile, %Check4AN%
- FoundAN := InStr(HSANFile, Check4AN)
- FoundAN+=13
- StringTrimLeft, AlbumName2Split, HSANFile, %FoundAN%
- CheckNameEnd = `",
- IfInString, AlbumName2Split, %CheckNameEnd%
- FoundANEnd := InStr(AlbumName2Split, CheckNameEnd)
- FoundANEnd-=1
- StringLeft, AlbumNameCuted, AlbumName2Split, %FoundANEnd%
- Gui3Text = Working on : %ArtistNameCuted% - %SongNameCuted%
- GuiControl,3:,Gui3Txt, %Gui3Text%
- Check4ArtN = `"ArtistName`": `"
- IfInString, HSANFile, %Check4ArtN%
- FoundArtN := InStr(HSANFile, Check4ArtN)
- FoundArtN+=14
- StringTrimLeft, ArtistName2Split, HSANFile, %FoundArtN%
- IfInString, ArtistName2Split, %CheckNameEnd%
- FoundArtNEnd := InStr(ArtistName2Split, CheckNameEnd)
- FoundArtNEnd-=1
- StringLeft, ArtistNameCuted, ArtistName2Split, %FoundArtNEnd%
- Gui3Text = Working on : %ArtistNameCuted% - %SongNameCuted%
- GuiControl,3:,Gui3Txt, %Gui3Text%
- Check4SN = `"SongName`": `"
- IfInString, HSANFile, %Check4SN%
- FoundSN := InStr(HSANFile, Check4SN)
- FoundSN+=12
- StringTrimLeft, SongName2Split, HSANFile, %FoundSN%
- IfInString, SongName2Split, %CheckNameEnd%
- FoundSNEnd := InStr(SongName2Split, CheckNameEnd)
- FoundSNEnd-=1
- StringLeft, SongNameCuted, SongName2Split, %FoundSNEnd%
- Gui3Text = Working on : %ArtistNameCuted% - %SongNameCuted%
- GuiControl,3:,Gui3Txt, %Gui3Text%
- StringReplace, AlbumName, AlbumNameCuted, %A_SPACE%, -, All
- StringReplace, ArtistName, ArtistNameCuted, %A_SPACE%, -, All
- StringReplace, SongName, SongNameCuted, %A_SPACE%, -, All
- StringReplace, PackVersion, PVersion, %A_SPACE%, ., All
- StringReplace, AlbumName, AlbumName, `%, %A_SPACE%, All
- StringReplace, ArtistName, ArtistName, `%, %A_SPACE%, All
- StringReplace, SongName, SongName, `%, %A_SPACE%, All
- StringReplace, PackVersion, PackVersion, `%, %A_SPACE%, All
- DLCWantingNameInputCorrect = %DLCWantingNameInput%
- StringReplace, DLCWantingNameInput, DLCWantingNameInput, `%A`%, %ArtistName%
- StringReplace, DLCWantingNameInput, DLCWantingNameInput, `%SN`%, %SongName%
- StringReplace, DLCWantingNameInput, DLCWantingNameInput, `%AN`%, %AlbumName%
- StringReplace, DLCWantingNameInput, DLCWantingNameInput, `%V`%, %PackVersion%
- StringReplace, DLCWantingNameInput, DLCWantingNameInput, `%, , All
- If YesnoDL = Yes
- {
- FileCreateDir, %SelectedRS2014Folder%\dlc\%ArtistName%
- FileMove, %A_ScriptDir%\tmp\ToRename\%A_LoopFileName%, %SelectedRS2014Folder%\dlc\%ArtistName%\%DLCWantingNameInput%%endfilename%
- if ErrorLevel
- {
- FileCreateDir, %SelectedRS2014Folder%\dlc\01CheckDuplicat
- FileMove, %A_ScriptDir%\tmp\ToRename\%A_LoopFileName%, %SelectedRS2014Folder%\dlc\01CheckDuplicat\%NameId%%DLCWantingNameInput%%endfilename%
- NameId++
- }
- }
- If YesnoDL = No
- {
- FileMove, %A_ScriptDir%\tmp\ToRename\%A_LoopFileName%, %SelectedRS2014Folder%\dlc\%DLCWantingNameInput%%endfilename%
- if ErrorLevel
- {
- FileCreateDir, %SelectedRS2014Folder%\dlc\01CheckDuplicat
- FileMove, %A_ScriptDir%\tmp\ToRename\%A_LoopFileName%, %SelectedRS2014Folder%\dlc\01CheckDuplicat\%NameId%%DLCWantingNameInput%%endfilename%
- NameId++
- }
- }
- FileRemoveDir, %A_ScriptDir%\tmp\ToRename\Unpack, 1
- DLCWantingNameInput = %DLCWantingNameInputCorrect%
- }
- If YesnoDL = Yes
- {
- YesnoDL = Yes||No
- }
- If YesnoDL = No
- {
- YesnoDL = Yes|No||
- }
- If Platform = PC
- {
- Platform = PC||Mac
- Platform2 = Pc
- }
- If Platform = Mac
- {
- Platform = PC|Mac||
- Platform2 = Mac
- }
- GuiControl,1:,actualdir, %SelectedRS2014Folder%
- GuiControl,1:,nameinput, %DLCWantingNameInput%
- GuiControl,1:,SelPlatform, %Platform%
- GuiControl,1:,FolderYesNo, %YesnoDL%
- FileRemoveDir, %A_ScriptDir%\tmp, 1
- Gui,3: Destroy
- MsgBox, Work Done.`nYou can now play as you wish :)`nCheck DLC folder if there isn't a folder `"01CheckDuplicat`" If there all duplicate or outdated CLDC are there !`nDepending on the platform you choicen but the useless version as been put in folder dlc into `"01%Platform2%Version`"
- Gui,1: Restore
- return
- ; Close all if main Gui is closed
- 1GuiClose:
- FileRemoveDir, %A_ScriptDir%\tmp, 1
- Gui,1: Destroy
- Gui,2: Destroy
- Gui,3: Destroy
- ExitApp
- ; Restore Gui 1 if Gui 2 is closed.
- 2GuiClose:
- Gui,1: Restore
- Gui,2: Destroy
- Gui,3: Destroy
- Return
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement