mirror of
https://github.com/a2-4am/4cade.git
synced 2024-11-26 01:49:25 +00:00
rename some games' internal names to reduce memory pressure in LC RAM
This commit is contained in:
parent
4ee6475a3d
commit
ac50f41d52
@ -4,6 +4,7 @@ import fileinput
|
||||
import glob
|
||||
import subprocess
|
||||
import sys
|
||||
import tempfile
|
||||
|
||||
def replace_string_in_file(filename, old_string, new_string):
|
||||
for line in fileinput.input(glob.glob(filename), inplace=True):
|
||||
@ -19,10 +20,37 @@ def rename_one_file_in_directory(dirname, old_filename, new_filename):
|
||||
|
||||
def rename_inside_disk_image(filename, old_name, new_name):
|
||||
rt = subprocess.run(['cadius', 'CATALOG', filename], stdout=subprocess.PIPE, text=True)
|
||||
if not rt:
|
||||
print('cadius CATALOG command failed')
|
||||
if not [line for line in rt.stdout.split('\n') if line == f'/{old_name}/']:
|
||||
return
|
||||
subprocess.run(['cadius', 'RENAMEFILE', filename, f'/{old_name}/{old_name}', new_name], stdout=subprocess.PIPE, text=True)
|
||||
subprocess.run(['cadius', 'RENAMEVOLUME', filename, new_name], stdout=subprocess.PIPE, text=True)
|
||||
rt = subprocess.run(['cadius', 'RENAMEFILE', filename, f'/{old_name}/{old_name}', new_name], stdout=subprocess.PIPE, text=True)
|
||||
if not rt:
|
||||
print('cadius RENAMEFILE command failed')
|
||||
rt = subprocess.run(['cadius', 'RENAMEVOLUME', filename, new_name], stdout=subprocess.PIPE, text=True)
|
||||
if not rt:
|
||||
print('cadius RENAMEVOLUME command failed')
|
||||
with tempfile.TemporaryDirectory() as tmpdir:
|
||||
rt = subprocess.run(['cadius', 'EXTRACTFILE', filename, f'/{new_name}/LOADER.SYSTEM', tmpdir], stdout=subprocess.PIPE, text=True)
|
||||
if not rt:
|
||||
print('cadius EXTRACTFILE command failed')
|
||||
try:
|
||||
loader_file = glob.glob(tmpdir + "/LOADER.SYSTEM*").pop()
|
||||
except IndexError:
|
||||
return
|
||||
with open(loader_file, 'rb') as f:
|
||||
loader = f.read()
|
||||
loader_as_list = list(loader)
|
||||
while loader_as_list.pop() >= 0x10:
|
||||
pass
|
||||
loader_as_list.append(len(new_name))
|
||||
loader_as_list.extend([ord(x) for x in new_name])
|
||||
new_loader = bytes(loader_as_list)
|
||||
with open(loader_file, 'wb') as f:
|
||||
f.write(new_loader)
|
||||
rt = subprocess.run(['cadius', 'REPLACEFILE', filename, f'/{new_name}/', loader_file], stdout=subprocess.PIPE, text=True)
|
||||
if not rt:
|
||||
print('cadius REPLACEFILE command failed')
|
||||
|
||||
def rename(old_game_name, new_game_name):
|
||||
print(old_game_name)
|
||||
@ -59,7 +87,7 @@ def rename(old_game_name, new_game_name):
|
||||
rename_files_in_directory(dirname, old_game_name, new_game_name)
|
||||
|
||||
def driver():
|
||||
rename("SLICKS", "S8")
|
||||
#rename("SLICKS", "S8")
|
||||
rename("CIDER.SPIDER", "AC")
|
||||
rename("ARCADE.BT.CAMP", "AB")
|
||||
rename("ARDY.AARDVARK", "AA")
|
||||
@ -92,7 +120,7 @@ def driver():
|
||||
rename("LITTLE.COMP.PPL", "LP")
|
||||
rename("LOCK.N.CHASE", "LC")
|
||||
rename("MARIO.BROS", "MB")
|
||||
rename("MATTERHORN", "MS")
|
||||
#rename("MATTERHORN", "MS")
|
||||
rename("MINGS.CHALLENGE", "MI")
|
||||
rename("THUNDERHEAD", "MT")
|
||||
rename("MONTEZUMA", "MZ")
|
||||
@ -125,4 +153,5 @@ def driver():
|
||||
rename("WINGS.OF.FURY", "WF")
|
||||
|
||||
if __name__ == '__main__':
|
||||
#rename("MR.DO", "MD")
|
||||
driver()
|
||||
|
@ -14,19 +14,19 @@ BATMAN3=Type(06),AuxType(3FF8),Access(C3)
|
||||
BATMAN4=Type(06),AuxType(3FF8),Access(C3)
|
||||
BATMAN5=Type(06),AuxType(3FF8),Access(C3)
|
||||
COLUMNS=Type(06),AuxType(3FF8),Access(C3)
|
||||
D.GENERATION=Type(06),AuxType(3FF8),Access(C3)
|
||||
DEATH.SWORD=Type(06),AuxType(3FF8),Access(C3)
|
||||
DEATH.SWORD2=Type(06),AuxType(3FF8),Access(C3)
|
||||
DEATH.SWORD3=Type(06),AuxType(3FF8),Access(C3)
|
||||
DEATH.SWORD4=Type(06),AuxType(3FF8),Access(C3)
|
||||
EAGLES.NEST=Type(06),AuxType(3FF8),Access(C3)
|
||||
EAGLES.NEST2=Type(06),AuxType(3FF8),Access(C3)
|
||||
DG=Type(06),AuxType(3FF8),Access(C3)
|
||||
HEAVY.BARREL=Type(06),AuxType(3FF8),Access(C3)
|
||||
HEAVY2=Type(06),AuxType(3FF8),Access(C3)
|
||||
HEAVY3=Type(06),AuxType(3FF8),Access(C3)
|
||||
I2=Type(06),AuxType(3FF8),Access(C3)
|
||||
IE=Type(06),AuxType(3FF8),Access(C3)
|
||||
IE2=Type(06),AuxType(3FF8),Access(C3)
|
||||
IMPOSSIBLE.M.2B=Type(06),AuxType(3FF8),Access(C3)
|
||||
IMPOSSIBLE.M.2C=Type(06),AuxType(3FF8),Access(C3)
|
||||
IMPOSSIBLE.M.II=Type(06),AuxType(3FF8),Access(C3)
|
||||
INDIANA.JONES=Type(06),AuxType(3FF8),Access(C3)
|
||||
INDIANA.JONES2=Type(06),AuxType(3FF8),Access(C3)
|
||||
INDIANA.JONES3=Type(06),AuxType(3FF8),Access(C3)
|
||||
@ -49,20 +49,20 @@ RAMPAGE4=Type(06),AuxType(3FF8),Access(C3)
|
||||
ROBOCOP=Type(06),AuxType(3FF8),Access(C3)
|
||||
ROBOCOP2=Type(06),AuxType(3FF8),Access(C3)
|
||||
ROBOCOP3=Type(06),AuxType(3FF8),Access(C3)
|
||||
ROGER.RABBIT=Type(06),AuxType(3FF8),Access(C3)
|
||||
RR=Type(06),AuxType(3FF8),Access(C3)
|
||||
SLICKS=Type(06),AuxType(3FF8),Access(C3)
|
||||
SLICKS2=Type(06),AuxType(3FF8),Access(C3)
|
||||
SOKO.BAN=Type(06),AuxType(3FF8),Access(C3)
|
||||
SOKO.BAN2=Type(06),AuxType(3FF8),Access(C3)
|
||||
SOKO.BAN3=Type(06),AuxType(3FF8),Access(C3)
|
||||
SOKO.BAN4=Type(06),AuxType(3FF8),Access(C3)
|
||||
SOKO.BAN5=Type(06),AuxType(3FF8),Access(C3)
|
||||
SO=Type(06),AuxType(3FF8),Access(C3)
|
||||
SO2=Type(06),AuxType(3FF8),Access(C3)
|
||||
SO3=Type(06),AuxType(3FF8),Access(C3)
|
||||
SO4=Type(06),AuxType(3FF8),Access(C3)
|
||||
SO5=Type(06),AuxType(3FF8),Access(C3)
|
||||
SPIDERBOT=Type(06),AuxType(3FF8),Access(C3)
|
||||
SPIDERBOT2=Type(06),AuxType(3FF8),Access(C3)
|
||||
SPIDERBOT3=Type(06),AuxType(3FF8),Access(C3)
|
||||
SPIDERBOT4=Type(06),AuxType(3FF8),Access(C3)
|
||||
SPIDERBOT5=Type(06),AuxType(3FF8),Access(C3)
|
||||
TECHNOCOP=Type(06),AuxType(3FF8),Access(C3)
|
||||
TC=Type(06),AuxType(3FF8),Access(C3)
|
||||
TETRIS=Type(06),AuxType(3FF8),Access(C3)
|
||||
TETRIS2=Type(06),AuxType(3FF8),Access(C3)
|
||||
TETRIS3=Type(06),AuxType(3FF8),Access(C3)
|
||||
|
@ -1,6 +1,6 @@
|
||||
# This file is automatically generated
|
||||
|
||||
BLOCKCHAIN=Type(06),AuxType(6000),Access(C3)
|
||||
OOTW=Type(06),AuxType(6000),Access(C3)
|
||||
BC=Type(06),AuxType(6000),Access(C3)
|
||||
OW=Type(06),AuxType(6000),Access(C3)
|
||||
POLLYWOG=Type(06),AuxType(6000),Access(C3)
|
||||
_FileInformation.txt=Type(06),AuxType(6000),Access(C3)
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user