Skip to content

Instantly share code, notes, and snippets.

@FromDarkHell
Last active September 12, 2020 20:03
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save FromDarkHell/38b09cc3b22a577659077f85661c7dce to your computer and use it in GitHub Desktop.
Save FromDarkHell/38b09cc3b22a577659077f85661c7dce to your computer and use it in GitHub Desktop.
Lollipop Chainsaw Game Info Dump Scripts
import os
import glob
from PIL import Image, ImageFilter
for artFile in glob.iglob('./**/*.png', recursive=True):
print(f"Parsing: {artFile}")
# Init the image file so we can do some sweet sweet moidification
img = Image.open(artFile)
x, y = img.size
bottomHalf = img.crop( (0, x - 256, 720, x) )
bottomHalf = bottomHalf.rotate(90, expand=True)
topHalf = img.crop( (0, 0, x, y-300) )
endResult = Image.new('RGBA', (topHalf.size[0] + bottomHalf.size[0], topHalf.size[1]))
endResult.paste(topHalf)
endResult.paste(bottomHalf, (endResult.size[0] - bottomHalf.size[0], endResult.size[1] - topHalf.size[1] ))
filePath = artFile.replace(".\\","./OUTPUT/").replace('\\','/')
os.makedirs(filePath.rsplit('/',1)[0], exist_ok=True)
print(f"Saving to: " + filePath)
endResult.save(filePath)
import json
import os
import glob
from mp3_tagger import MP3File, VERSION_1, VERSION_2, VERSION_BOTH
songDictionary = {"Punk1.mp3":{"Title":"Zombie Festival All Day!","In-Game":"Punk 8"},"Punk2.mp3":{"Title":"5 Meters to Juliet","In-Game":"Punk 4"},"Punk3.mp3":{"Title":"Throwin' Around Zombie Heads","In-Game":"Punk 5"},"Punk4.mp3":{"Title":"Junkyard Killing","In-Game":"Punk 1"},"Punk5.mp3":{"Title":"My Friend is a Zombie?","In-Game":"Punk 3"},"Punk6.mp3":{"Title":"First Date: Zombie Edition","In-Game":"Punk 6"},"Punk7.mp3":{"Title":"Love For My Insane Lover","In-Game":"Punk 2"},"Punk8.mp3":{"Title":"Cannibalism 101","In-Game":"Punk 7"},"Viking1.mp3":{"Title":"Code of the Viking Zombies","In-Game":"Viking 3"},"Viking2.mp3":{"Title":"We Are Norse Gods","In-Game":"Viking 1"},"Viking3.mp3":{"Title":"Drink Your Blood After a Workout","In-Game":"Viking 2"},"Viking4.mp3":{"Title":"Zombies Dance When the Drums Play","In-Game":"Viking 9"},"Viking5.mp3":{"Title":"Eat This, Yumil!","In-Game":"Viking 5"},"Viking6.mp3":{"Title":"Ragnarok Comes and I Hunger for Flesh","In-Game":"Viking 6"},"Viking7.mp3":{"Title":"Zombie Tackle","In-Game":"Viking 4"},"Viking8.mp3":{"Title":"Dashing Through the Rain","In-Game":"Viking 7"},"Viking9.mp3":{"Title":"Viking Zombies Sail on Lightning Seas","In-Game":"Viking 8"},"Psyche1.mp3":{"Title":"Illusion of New World","In-Game":"Psyche 2"},"Psyche2.mp3":{"Title":"Double-crop Rock","In-Game":"Psyche 3"},"Psyche3.mp3":{"Title":"The Mushrooms Arrive","In-Game":"Psyche 6"},"Psyche4.mp3":{"Title":"The Queen's Rotting Funhouse","In-Game":"Psyche 4"},"Psyche5.mp3":{"Title":"Reflections in a Bubble","In-Game":"Psyche 8"},"Psyche6.mp3":{"Title":"The Bus on the Wheels Go Round","In-Game":"Psyche 5"},"Psyche7.mp3":{"Title":"Hello From the Fields of Death","In-Game":"Psyche 7"},"Psyche8.mp3":{"Title":"Zombie Guts","In-Game":"Psyche 1"},"Psyche9.mp3":{"Title":"Zombeef Burger","In-Game":"Killabilly 2"},"Funk1.mp3":{"Title":"Retro Diapers","In-Game":"Funk 8"},"Funk2.mp3":{"Title":"Happy Hand Club","In-Game":"Funk 6"},"Funk3.mp3":{"Title":"Digital Splatter","In-Game":"Funk 2"},"Funk4.mp3":{"Title":"Will Boogie For Food","In-Game":"Funk 9"},"Funk5.mp3":{"Title":"Heading to Space at Warp Five","In-Game":"Funk 5"},"Funk6.mp3":{"Title":"Groovy Zombie Trap","In-Game":"Funk 4"},"Funk7.mp3":{"Title":"Sparking Sunglasses","In-Game":"Funk 1"},"Funk8.mp3":{"Title":"Mirrorball Madhouse","In-Game":"Funk 3"},"Funk9.mp3":{"Title":"Rainbow Zombie Fever","In-Game":"Funk 7"},"Rock1.mp3":{"Title":"Dead Girlfriend & Zombie Guts","In-Game":"Rock 7"},"Rock2.mp3":{"Title":"You're in Love With a Zombie","In-Game":"Rock 3"},"Rock3.mp3":{"Title":"Forgotten Zombie Rock","In-Game":"Rock 2"},"Rock4.mp3":{"Title":"Violent Student Poetry","In-Game":"Rock 9"},"Rock5.mp3":{"Title":"Elephant Corpse Rock","In-Game":"Rock 4"},"Rock6.mp3":{"Title":"Burning Pompadour Zombie","In-Game":"Rock 5"},"Rock7.mp3":{"Title":"Bowel Purge","In-Game":"Rock 1"},"Rock8.mp3":{"Title":"Scattering Guts","In-Game":"Rock 6"},"Rock9.mp3":{"Title":"To The Rotten World","In-Game":"Rock 8"}}
mp3Files = glob.glob("*.mp3")
index = 1
for f in mp3Files:
f = f.lower()
f = f.capitalize()
if f not in songDictionary: continue
mp3 = MP3File(f)
mp3.set_version(VERSION_2)
mp3.album = "Lollipop Chainsaw Soundtrack"
mp3.artist = "Akira Yamaoka"
mp3.song = songDictionary[f]["Title"]
mp3.track = index
mp3.year = "2012"
mp3.genre = ""
mp3.save()
index += 1
for f in mp3Files:
z = f.lower()
z = f.capitalize()
if z not in songDictionary: continue
os.rename(f, songDictionary[z]["In-Game"] + '.mp3')
import json
tableToParse = """| Punk1.mp3 | Zombie Festival All Day! | Punk 8
| Punk2.mp3 | 5 Meters to Juliet | Punk 4
| Punk3.mp3 | Throwin' Around Zombie Heads | Punk 5
| Punk4.mp3 | Junkyard Killing | Punk 1
| Punk5.mp3 | My Friend is a Zombie? | Punk 3
| Punk6.mp3 | First Date: Zombie Edition | Punk 6
| Punk7.mp3 | Love For My Insane Lover | Punk 2
| Punk8.mp3 | Cannibalism 101 | Punk 7
| Viking1.mp3 | Code of the Viking Zombies | Viking 3
| Viking2.mp3 | We Are Norse Gods | Viking 1
| Viking3.mp3 | Drink Your Blood After a Workout | Viking 2
| Viking4.mp3 | Zombies Dance When the Drums Play | Viking 9
| Viking5.mp3 | Eat This, Yumil! | Viking 5
| Viking6.mp3 | Ragnarok Comes and I Hunger for Flesh | Viking 6
| Viking7.mp3 | Zombie Tackle | Viking 4
| Viking8.mp3 | Dashing Through the Rain | Viking 7
| Viking9.mp3 | Viking Zombies Sail on Lightning Seas | Viking 8
| Psyche1.mp3 | Illusion of New World | Psyche 2
| Psyche2.mp3 | Double-crop Rock | Psyche 3
| Psyche3.mp3 | The Mushrooms Arrive | Psyche 6
| Psyche4.mp3 | The Queen's Rotting Funhouse | Psyche 4
| Psyche5.mp3 | Reflections in a Bubble | Psyche 8
| Psyche6.mp3 | The Bus on the Wheels Go Round | Psyche 5
| Psyche7.mp3 | Hello From the Fields of Death | Psyche 7
| Psyche8.mp3 | Zombie Guts | Psyche 1
| Psyche9.mp3 | Zombeef Burger | Killabilly 2 / Inside Killabilly
| Funk1.mp3 | Retro Diapers | Funk 8
| Funk2.mp3 | Happy Hand Club | Funk 6
| Funk3.mp3 | Digital Splatter | Funk 2
| Funk4.mp3 | Will Boogie For Food | Funk 9
| Funk5.mp3 | Heading to Space at Warp Five | Funk 5
| Funk6.mp3 | Groovy Zombie Trap | Funk 4
| Funk7.mp3 | Sparking Sunglasses | Funk 1
| Funk8.mp3 | Mirrorball Madhouse | Funk 3
| Funk9.mp3 | Rainbow Zombie Fever | Funk 7
| Rock1.mp3 | Dead Girlfriend & Zombie Guts | Rock 7
| Rock2.mp3 | You're in Love With a Zombie | Rock 3 / Stage Select
| Rock3.mp3 | Forgotten Zombie Rock | Rock 2
| Rock4.mp3 | Violent Student Poetry | Rock 9
| Rock5.mp3 | Elephant Corpse Rock | Rock 4
| Rock6.mp3 | Burning Pompadour Zombie | Rock 5
| Rock7.mp3 | Bowel Purge | Rock 1
| Rock8.mp3 | Scattering Guts | Rock 6
| Rock9.mp3 | To The Rotten World | Rock 8"""
jsonDictionary = {}
for newSong in tableToParse.split('\n'):
originalSongFile = newSong.split('| ')[1].replace(' ','')
songTitle = newSong.split('| ')[2].replace(' ','')
if(songTitle[-1] == ' '): songTitle = songTitle[:-1]
inGameSongName = newSong.split('| ')[3]
print(f"Original Song File: {originalSongFile} = {songTitle} = {inGameSongName}")
jsonDictionary.update({ originalSongFile : {"Title": songTitle, "In-Game": inGameSongName} })
outFile = open('output.json', 'w')
json.dump(jsonDictionary, outFile, indent=3)
outFile.close()
import os
import glob
import shutil
ignoredFiles = ["TX_UI_Collection_NEV_obj1.png"]
for f in glob.iglob('./UICOLLECTION_ARTS/**/*.png', recursive=True):
os.remove(f)
for filename in glob.iglob('./**/*.png', recursive=True):
# This just removes all of the garbage UI elements that show up in the upks
if filename.rsplit("\\")[-1] in ignoredFiles: continue
artName = filename.rsplit("\\")[-1].replace("TX_UI_Collection_", "")
descriptor = artName.rsplit("_")[0]
os.makedirs(f'./UICOLLECTION_ARTS/{descriptor}/', exist_ok=True)
shutil.copy(filename, f'./UICOLLECTION_ARTS/{descriptor}/{artName}')
print(f"{artName}: {descriptor}")
import os
# This script is basically used to convert the extracted cover images over into more human readable names
nameDict = {"EVI":"Evil", "FNK": "Funk", "MTL": "Metal", "PHC": "Psychedelic", "PNK":"Punk", "ROC": "Rock"}
for filename in os.listdir('./../../soundtrack/cover-images/'):
if not (filename.endswith(".png")): continue
musicGenre = [v for (k,v) in nameDict.items() if k in filename][0]
musicNumber = filename[:-4].rsplit("_",1)[-1][1:]
os.rename(filename, f"{musicGenre}_{musicNumber}.png")
import os
import xml.etree.ElementTree as ET
import shutil
# These .sfm files are actually just slightly more complex xml files so just use an XML library
trophyConf = ET.parse("./../../trophies/Raw_Trophies/TROP.SFM").getroot()
# A dictionary of the trophy # to the trophy name as shown in the .sfm file
trophyIDToName = {}
# Anything past the 5th element are the trophies embedded in this .sfm file
for trophy in trophyConf[5:]:
print(f"Trophy #{trophy.get('id')}: {trophy[0].text}")
trophyName = trophy[0].text
# Just some safetry, pretty sure this isn't actually useful in Lollipop Chainsaw afaik
for c in '[<>:"/\|?*]': trophyName = trophyName.replace(c,'')
trophyIDToName.update({trophy.get('id') : trophyName})
# This script is used to convert the Raw trophies into a more user-friendly named version
for filename in os.listdir('./../../trophies/Raw_Trophies'):
if not (filename.endswith(".PNG")) or filename.startswith("ICON"): continue
trophyID = filename[4:-4]
trophyName = trophyIDToName[trophyID]
print(f"Trophy #{trophyID} ({filename}) to: {trophyName}")
shutil.copy("./../../trophies/Raw_Trophies/" + filename, "./../../trophies/Processed_Trophies/" + trophyName + ".png")
import os
import xml.etree.ElementTree as ET
# These .sfm files are actually just slightly more complex xml files so just use an XML library
trophyConf = ET.parse("./../../trophies/Raw_Trophies/TROP.SFM").getroot()
tableOut = open("./../../trophies/Processed_Trophies/trophy_data.txt", "w")
for trophy in trophyConf[5:]:
tableOut.write(f"| {trophy[0].text} | {trophy[1].text} | {trophy.get('id')}\n")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment