Baoulettes

Classmith 2014 (almost done.)

Jul 20th, 2015
349
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 11.21 KB | None | 0 0
  1. #SingleInstance force
  2. ; 20th July 2014 by Baoulettes aka Joffrey Panisset
  3. ; Unauthorized use is forbidden.
  4. ; Here are my credit list :
  5. ; Autohotkey to allow such code stuff :)
  6. ; fabianosan for Rocksmith Custom Song Toolkit unpacker.
  7. ; Snakez for Rocksmith Custom Song Toolkit unpacker.
  8. ; Maveth for Rocksmith Custom Song Toolkit unpacker.
  9. ; Raynebc for Rocksmith Custom Song Toolkit unpacker.
  10. ; Dreddfoxx for Rocksmith Custom Song Toolkit unpacker.
  11. ; Alex360 (L0fka) for Rocksmith Custom Song Toolkit unpacker.
  12. ; Shrubbery (otaznik) for Rocksmith Custom Song Toolkit unpacker.
  13. ; Cozy1 for Rocksmith Custom Song Toolkit unpacker.
  14. ; Zephyrix for Rocksmith Custom Song Toolkit unpacker.
  15. ; Xavatar (PowerSlinky) for Rocksmith Custom Song Toolkit unpacker.
  16. ; Chlipouni for Rocksmith Custom Song Toolkit unpacker.
  17. ; Cgeorge for Rocksmith Custom Song Toolkit unpacker.
  18.  
  19. ;Variables Setting :
  20. Appname = Classmith 2014
  21. Appversion = V1.0.0
  22.  
  23. ; Reading various Variables
  24. IniRead, Languages, Options.ini, Options, Languages
  25. IniRead, SelectedRS2014Folder, Options.ini, Options, R2014dir
  26. IniRead, DLCWantingNameInput, Options.ini, Options, WantedPsarcName
  27. IniRead, Platform, Options.ini, Options, Platform
  28. IniRead, YesnoDL, Options.ini, Options, SeparateInFolderQS
  29. If SelectedRS2014Folder = ERROR
  30. {
  31. FileSelectFolder, SelectedRS2014Folder,, 3,Please choice Rocksmith 2014 directory.
  32. IniWrite, %SelectedRS2014Folder%, Options.ini, Options, R2014dir
  33. }
  34. If SelectedRS2014Folder =
  35. {
  36. FileSelectFolder, SelectedRS2014Folder,, 3,Please choice Rocksmith 2014 directory.
  37. IniWrite, %SelectedRS2014Folder%, Options.ini, Options, R2014dir
  38. }
  39. If Languages = ERROR
  40. {
  41. Languages=En
  42. }
  43. If Languages =
  44. {
  45. Languages=En
  46. }
  47. If YesnoDL = ERROR
  48. {
  49. YesnoDL = Yes||No
  50. }
  51. If YesnoDL =
  52. {
  53. YesnoDL = Yes||No
  54. }
  55. If YesnoDL = Yes
  56. {
  57. YesnoDL = Yes||No
  58. }
  59. If YesnoDL = No
  60. {
  61. YesnoDL = Yes|No||
  62. }
  63. If Platform = ERROR
  64. {
  65. Platform = PC||Mac
  66. }
  67. If Platform =
  68. {
  69. Platform = PC||Mac
  70. }
  71. If Platform = PC
  72. {
  73. Platform = PC||Mac
  74. }
  75. If Platform = Mac
  76. {
  77. Platform = PC|Mac||
  78. }
  79. If DLCWantingNameInput = ERROR
  80. {
  81. DLCWantingNameInput=`%A`%_`%SN`%_`%AN`%_V`%V`%
  82. }
  83. If DLCWantingNameInput =
  84. {
  85. DLCWantingNameInput=`%A`%_`%SN`%_`%AN`%_V`%V`%
  86. }
  87.  
  88. ;Variables for translation :
  89. ;Base - English :
  90. If Languages = EN
  91. {
  92. about = About
  93. choiceRSDir = Please choice Rocksmith 2014 directory.
  94. RS2014FSelectB = Browse
  95. DLCWantedName = Please set a name scheme. (More information about variables name at right)
  96. 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.
  97. SelectPFText = Target platform :
  98. SeparateInFolderQS = Would you like to sort song in a Artist folder inside DLC folder?
  99. 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
  100.  
  101. StartProcess = Let do it !
  102. CreditText = This Application has been mady by Baoulettes. 2015
  103. AboutTextWindows = Credits List:`nAutohotkey`nBaoulettes`nRocksmith Custom Song Toolkit maker :`nfabianosan`nSnakez`nMaveth`nRaynebc`nDreddfoxx`nAlex360 (L0fka)`nShrubbery (otaznik)`nCozy1`nZephyrix`nXavatar`nChlipouni`nCgeorge
  104. }
  105. ;Gui Making !
  106. Gui,1: Add, Button, x412 y5 w60 h20 gaboutwin, %about%
  107. Gui,1: Add, Text, x100 y29 w370 h30 +Center, %choiceRSDir%
  108. Gui,1: Add, Button, x412 y29 w60 h20 gSelRS2014Folder, %RS2014FSelectB%
  109. Gui,1: Add, Edit, x2 y59 w470 h30 vactualdir +Center, %SelectedRS2014Folder%
  110. Gui,1: Add, Text, x2 y95 w250 h30 +Center, %DLCWantedName%
  111. Gui,1: Add, Edit, x2 y129 w250 h40 vnameinput +Center, %DLCWantingNameInput%
  112. Gui,1: Add, Text, x262 y95 w210 h80 +Center, %BasicInfoFileNaming%
  113. Gui,1: Add, DropDownList, x362 y187 w100 h20 r2 vSelPlatform, %Platform%
  114. Gui,1: Add, Text, x262 y191 w100 h30 , %SelectPFText%
  115. Gui,1: Add, Text, x2 y185 w150 h30 , %SeparateInFolderQS%
  116. Gui,1: Add, DropDownList, x152 y187 w100 h21 r2 vFolderYesNo, %YesnoDL%
  117. Gui,1: Add, Text, x2 y223 w470 h160 +Center, %AppsUsageText%
  118. Gui,1: Add, Button, x12 y399 w450 h30 gGoforIt, %StartProcess%
  119. Gui,1: Add, Text, x2 y429 w470 h20 +Center, %CreditText%
  120. Gui,1: Show, x379 y162 h450 w476, %Appname% - %Appversion%
  121. Gui,1: Add, Picture, x0 y0 w180 h60, D:\RS2014SongClassifier\Baoulettes.png
  122. Return
  123.  
  124. aboutwin:
  125. Gui,1: Hide
  126. Gui,2: Add, Picture, x0 y0 w150 h150 , D:\RS2014SongClassifier\Baoulettes.png
  127. Gui,2: Add, Text, x0 y149 w150 h230 +Center, %AboutTextWindows%
  128. Gui,2: Show, x379 y162 h381 w150, %Appname% - %Appversion%
  129. Return
  130.  
  131.  
  132. ;Functions :
  133. SelRS2014Folder:
  134. FileSelectFolder, SelectedRS2014Folder,, 3,%choiceRSDir%
  135. GuiControl,1:,actualdir, %SelectedRS2014Folder%
  136. IniWrite, %SelectedRS2014Folder%, Options.ini, Options, R2014dir
  137. Return
  138.  
  139. GoforIt:
  140. Gui,1: Submit
  141. GuiControlGet, actualdir,1:,
  142. GuiControlGet, nameinput,1:,
  143. GuiControlGet, SelPlatform,1:,
  144. GuiControlGet, FolderYesNo,1:,
  145. DLCWantingNameInput = %nameinput%
  146. SelectedRS2014Folder = %actualdir%
  147. Platform = %SelPlatform%
  148. YesnoDL = %FolderYesNo%
  149. If SelectedRS2014Folder = ERROR
  150. {
  151. FileSelectFolder, SelectedRS2014Folder,, 3,%choiceRSDir%
  152. GuiControl,1:,actualdir, %SelectedRS2014Folder%
  153. IniWrite, %SelectedRS2014Folder%, Options.ini, Options, R2014dir
  154. Gui,1: Restore
  155. return
  156. }
  157. If SelectedRS2014Folder =
  158. {
  159. FileSelectFolder, SelectedRS2014Folder,, 3,%choiceRSDir%
  160. GuiControl,1:,actualdir, %SelectedRS2014Folder%
  161. IniWrite, %SelectedRS2014Folder%, Options.ini, Options, R2014dir
  162. Gui,1: Restore
  163. return
  164. }
  165. If DLCWantingNameInput = ERROR
  166. {
  167. Msgbox, Please set a name other than Error... Use Variables too!
  168. Gui,1: Restore
  169. return
  170. }
  171. If DLCWantingNameInput =
  172. {
  173. Msgbox, Please set a name other than Error... Use Variables too!
  174. Gui,1: Restore
  175. return
  176. }
  177. If Platform = PC||Mac
  178. {
  179. Platform = PC
  180. }
  181. If Platform = PC|Mac||
  182. {
  183. Platform = Mac
  184. }
  185. If YesnoDL = Yes||No
  186. {
  187. YesnoDL = Yes
  188. }
  189. If YesnoDL = Yes|No||
  190. {
  191. YesnoDL = No
  192. }
  193. IniWrite, %Languages%, Options.ini, Options, Languages
  194. IniWrite, %SelectedRS2014Folder%, Options.ini, Options, R2014dir
  195. IniWrite, %DLCWantingNameInput%, Options.ini, Options, WantedPsarcName
  196. IniWrite, %Platform%, Options.ini, Options, Platform
  197. IniWrite, %YesnoDL%, Options.ini, Options, SeparateInFolderQS
  198. If Platform = PC
  199. {
  200. endfilename = _p.psarc
  201. PT = _Pc
  202. }
  203. If Platform = Mac
  204. {
  205. endfilename = _m.psarc
  206. PT = _Mac
  207. }
  208. FileCreateDir, %A_ScriptDir%\tmp
  209. FileCreateDir, %A_ScriptDir%\tmp\ToRename
  210. Gui,3: Add, Text, x0 y0 w240 h90 vGui3Txt +Center, %Gui3Text%
  211. Gui,3: Show, x268 y174 h88 w244, Working . . .
  212. Loop Files, %SelectedRS2014Folder%\dlc\*.psarc,
  213. {
  214. ;FileName = %A_LoopFileName%
  215. StringReplace, CutedName, A_LoopFileName, .psarc, , All
  216. UnpackFDName = %CutedName%%PT%
  217. FileCreateDir, %A_ScriptDir%\tmp\ToRename\Unpack
  218. FileMove, %SelectedRS2014Folder%\dlc\%A_LoopFileName%, %A_ScriptDir%\tmp\ToRename
  219. RunWait, %A_ScriptDir%\ressources\packer\packer.exe --unpack -i="%A_ScriptDir%\tmp\ToRename\%A_LoopFileName%" -o="%A_ScriptDir%\tmp\ToRename\Unpack",,Hide
  220. Loop Files, %A_ScriptDir%\tmp\ToRename\Unpack\%UnpackFDName%\*.nt,
  221. {
  222. StringTrimRight, UniqueID, A_LoopFileName, 18
  223. }
  224. FileRead, VersionCheck, %A_ScriptDir%\tmp\ToRename\Unpack\%UnpackFDName%\toolkit.version
  225. if not ErrorLevel
  226. {
  227. Checkif = Package Version:
  228. IfInString, VersionCheck, %Checkif%
  229. FoundV := InStr(VersionCheck, Checkif)
  230. FoundV+=16
  231. StringTrimLeft, PVersion2Split, VersionCheck, %FoundV%
  232. StringLeft, PVersion, PVersion2Split, 2
  233. }
  234. else
  235. {
  236. PVersion =1
  237. }
  238. FileRead, HSANFile, %A_ScriptDir%\tmp\ToRename\Unpack\%UnpackFDName%\manifests\songs_dlc_%UniqueID%\songs_dlc_%UniqueID%.hsan
  239.  
  240. Check4AN = `"AlbumName`": `"
  241. IfInString, HSANFile, %Check4AN%
  242. FoundAN := InStr(HSANFile, Check4AN)
  243. FoundAN+=13
  244. StringTrimLeft, AlbumName2Split, HSANFile, %FoundAN%
  245. CheckNameEnd = `",
  246. IfInString, AlbumName2Split, %CheckNameEnd%
  247. FoundANEnd := InStr(AlbumName2Split, CheckNameEnd)
  248. FoundANEnd-=1
  249. StringLeft, AlbumNameCuted, AlbumName2Split, %FoundANEnd%
  250. Gui3Text = Working on : %ArtistNameCuted% - %SongNameCuted%
  251. GuiControl,3:,Gui3Txt, %Gui3Text%
  252. Check4ArtN = `"ArtistName`": `"
  253. IfInString, HSANFile, %Check4ArtN%
  254. FoundArtN := InStr(HSANFile, Check4ArtN)
  255. FoundArtN+=14
  256. StringTrimLeft, ArtistName2Split, HSANFile, %FoundArtN%
  257. IfInString, ArtistName2Split, %CheckNameEnd%
  258. FoundArtNEnd := InStr(ArtistName2Split, CheckNameEnd)
  259. FoundArtNEnd-=1
  260. StringLeft, ArtistNameCuted, ArtistName2Split, %FoundArtNEnd%
  261. Gui3Text = Working on : %ArtistNameCuted% - %SongNameCuted%
  262. GuiControl,3:,Gui3Txt, %Gui3Text%
  263. Check4SN = `"SongName`": `"
  264. IfInString, HSANFile, %Check4SN%
  265. FoundSN := InStr(HSANFile, Check4SN)
  266. FoundSN+=12
  267. StringTrimLeft, SongName2Split, HSANFile, %FoundSN%
  268. IfInString, SongName2Split, %CheckNameEnd%
  269. FoundSNEnd := InStr(SongName2Split, CheckNameEnd)
  270. FoundSNEnd-=1
  271. StringLeft, SongNameCuted, SongName2Split, %FoundSNEnd%
  272. Gui3Text = Working on : %ArtistNameCuted% - %SongNameCuted%
  273. GuiControl,3:,Gui3Txt, %Gui3Text%
  274. StringReplace, AlbumName, AlbumNameCuted, %A_SPACE%, -, All
  275. StringReplace, ArtistName, ArtistNameCuted, %A_SPACE%, -, All
  276. StringReplace, SongName, SongNameCuted, %A_SPACE%, -, All
  277. StringReplace, PackVersion, PVersion, %A_SPACE%, ., All
  278. StringReplace, AlbumName, AlbumName, `%, %A_SPACE%, All
  279. StringReplace, ArtistName, ArtistName, `%, %A_SPACE%, All
  280. StringReplace, SongName, SongName, `%, %A_SPACE%, All
  281. StringReplace, PackVersion, PackVersion, `%, %A_SPACE%, All
  282. DLCWantingNameInputCorrect = %DLCWantingNameInput%
  283. StringReplace, DLCWantingNameInput, DLCWantingNameInput, `%A`%, %ArtistName%
  284. StringReplace, DLCWantingNameInput, DLCWantingNameInput, `%SN`%, %SongName%
  285. StringReplace, DLCWantingNameInput, DLCWantingNameInput, `%AN`%, %AlbumName%
  286. StringReplace, DLCWantingNameInput, DLCWantingNameInput, `%V`%, %PackVersion%
  287. StringReplace, DLCWantingNameInput, DLCWantingNameInput, `%, , All
  288. If YesnoDL = Yes
  289. {
  290. FileCreateDir, %SelectedRS2014Folder%\dlc\%ArtistName%
  291. FileMove, %A_ScriptDir%\tmp\ToRename\%A_LoopFileName%, %SelectedRS2014Folder%\dlc\%ArtistName%\%DLCWantingNameInput%%endfilename%
  292. }
  293. If YesnoDL = No
  294. {
  295. FileMove, %A_ScriptDir%\tmp\ToRename\%A_LoopFileName%, %SelectedRS2014Folder%\dlc\%DLCWantingNameInput%%endfilename%
  296. }
  297. FileRemoveDir, %A_ScriptDir%\tmp\ToRename\Unpack, 1
  298. DLCWantingNameInput = %DLCWantingNameInputCorrect%
  299. }
  300. If YesnoDL = Yes
  301. {
  302. YesnoDL = Yes||No
  303. }
  304. If YesnoDL = No
  305. {
  306. YesnoDL = Yes|No||
  307. }
  308. If Platform = PC
  309. {
  310. Platform = PC||Mac
  311. }
  312. If Platform = Mac
  313. {
  314. Platform = PC|Mac||
  315. }
  316. GuiControl,1:,actualdir, %SelectedRS2014Folder%
  317. GuiControl,1:,nameinput, %DLCWantingNameInput%
  318. GuiControl,1:,SelPlatform, %Platform%
  319. GuiControl,1:,FolderYesNo, %YesnoDL%
  320. FileRemoveDir, %A_ScriptDir%\tmp, 1
  321. Gui,3: Destroy
  322. MsgBox, Work Done.`nYou can now play as you wish :)
  323. Gui,1: Restore
  324. return
  325.  
  326.  
  327.  
  328. 1GuiClose:
  329. Gui,1: Destroy
  330. Gui,2: Destroy
  331. Gui,3: Destroy
  332. ExitApp
  333.  
  334. 2GuiClose:
  335. Gui,1: Restore
  336. Gui,2: Destroy
  337. Gui,3: Destroy
  338. Return
Advertisement
Add Comment
Please, Sign In to add comment