Advertisement
Guest User

Zelda Ancient Stone Tablets_Share same sav SNES mini v1.2

a guest
Mar 22nd, 2018
675
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 3.58 KB | None | 0 0
  1. # ZeldaASTscript.hmod
  2. # Edit the sub folder structure to share the same saves between both 4 weeks roms
  3. # Games name must be as *Zelda*AST#* with # The week number
  4. # Games must be single in subfolders
  5. # Example :
  6. #          The_Legend_of_Zelda_-_AST1_(FR).sfrom
  7. #          The_Legend_of_Zelda_-_AST2_(FR).sfrom
  8. #          The_Legend_of_Zelda_-_AST3_(FR).sfrom
  9. #          The_Legend_of_Zelda_-_AST4_(FR).sfrom
  10. # v1.2 - March 15th, 2018
  11. # Based on explanations https://imgur.com/a/mqJMC
  12. # Hakchi Module by Narkoa
  13.  
  14. #Initialization
  15. #zhome="$mountpoint/var/lib/hakchi/rootfs/usr/share/games"
  16. zhome="$mountpoint/var/lib/hakchi"
  17. #zlogfile="$zhome/log"
  18. #echo "ZBS AST load" > $zlogfile
  19. #zhome="/var/lib/hakchi/rootfs/usr/share/games"
  20. #  retrieve folders
  21. #echo "retrieve folders" >> $zlogfile
  22. zfolder1=$(find "$zhome" -name *Zelda*AST1*) #the full path of game1
  23. zfolder2=$(find "$zhome" -name *Zelda*AST2*)
  24. zfolder3=$(find "$zhome" -name *Zelda*AST3*)
  25. zfolder4=$(find "$zhome" -name *Zelda*AST4*)
  26. #echo "folder1=$zfolder1" >> $zlogfile
  27. #echo "folder2=$zfolder2" >> $zlogfile
  28. #echo "folder3=$zfolder3" >> $zlogfile
  29. #echo "folder4=$zfolder4" >> $zlogfile
  30. #  test if structure already modified
  31. #echo "testing folder2" >> $zlogfile
  32. if [ "$zfolder2" != "" ]; then #if not, apply the modifications
  33.     #  retrieve games file name
  34.     #echo "retrieve games" >> $zlogfile
  35.     zfilename1="${zfolder1##*/}" #the full name of game1
  36.     zfilename2="${zfolder2##*/}"
  37.     zfilename3="${zfolder3##*/}"
  38.     zfilename4="${zfolder4##*/}"
  39.     #  retrieve games file path
  40.     zpath1="$(dirname $zfolder1)" #the path of game1 file
  41.     zpath2="$(dirname $zfolder2)"
  42.     zpath3="$(dirname $zfolder3)"
  43.     zpath4="$(dirname $zfolder4)"
  44.     #  retrieve clover id folder names
  45.     zgood1="${zpath1##*/}" #the good folder name of game1
  46.     zbad2="${zpath2%CLV*}" #the path of game2 folder without bad clover id folder
  47.     zbad3="${zpath3%CLV*}" #the path of game3 folder without bad clover id folder
  48.     zbad4="${zpath4%CLV*}" #the path of game4 folder without bad clover id folder
  49.     #perform modifications
  50.     #echo "rename" >> $zlogfile
  51.     #  rename .sfrom from 2 3 and 4 to 1
  52.     mv "$zfolder2" "$zpath2/$zfilename1"
  53.     mv "$zfolder3" "$zpath3/$zfilename1"
  54.     mv "$zfolder4" "$zpath4/$zfilename1"
  55.     #  old .png and .dektop delete from 2 3 and 4
  56.     #echo "delete" >> $zlogfile
  57.     find "$zpath2" -name "*.png" -type f -delete
  58.     find "$zpath2" -name "*.desktop" -type f -delete
  59.     find "$zpath3" -name "*.png" -type f -delete
  60.     find "$zpath3" -name "*.desktop" -type f -delete
  61.     find "$zpath4" -name "*.png" -type f -delete
  62.     find "$zpath4" -name "*.desktop" -type f -delete
  63.     #  copy of .png and .dektop from 1 to 2 3 and 4
  64.     #echo "copy" >> $zlogfile
  65.     copy "$zpath1/$zgood1.png" "$zpath2"
  66.     copy "$zpath1/$zgood1"\_small.png "$zpath2"
  67.     copy "$zpath1/$zgood1.desktop" "$zpath2"
  68.     copy "$zpath1/$zgood1.png" "$zpath3"
  69.     copy "$zpath1/$zgood1"\_small.png "$zpath3"
  70.     copy "$zpath1/$zgood1.desktop" "$zpath3"
  71.     copy "$zpath1/$zgood1.png" "$zpath4"
  72.     copy "$zpath1/$zgood1"\_small.png "$zpath4"
  73.     copy "$zpath1/$zgood1.desktop" "$zpath4"
  74.     #  rename folders from 2 3 and 4 to 1
  75.     #echo "rename folders" >> $zlogfile
  76.     mv "$zpath2" "$zbad2$zgood1"
  77.     mv "$zpath3" "$zbad3$zgood1"
  78.     mv "$zpath4" "$zbad4$zgood1"
  79.     echo === Zelda \"Ancient Stone Tablets\" mod applied === #>> $zlogfile
  80. else
  81.     echo === Zelda \"Ancient Stone Tablets\" mod not applied === #>> $zlogfile
  82. fi
  83. #variables deallocation
  84. #echo "deallocation" >> $zlogfile
  85. unset zfolder1 zfolder2 zfolder3 zfolder4
  86. unset zfilename1 zfilename2 zfilename3 zfilename4
  87. unset zpath1 zpath2 zpath3 zpath4
  88. unset zhome zgood1 zbad2 zbad3 zbad4
  89. unset zlogfile
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement