Skip to content

Commit

Permalink
Fixed more fixes.
Browse files Browse the repository at this point in the history
  • Loading branch information
dboddie committed Mar 3, 2024
1 parent fd38ca5 commit c0bca98
Show file tree
Hide file tree
Showing 15 changed files with 79 additions and 80 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/make-roms.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ jobs:
- name: Fix resources
run: |
export PATH=$PATH:$PWD
python3 fix-uefs.py
PYTHONPATH=. python3 fix-uefs.py
tree UEFs
- name: Create scripts
run: python3 csv2scripts.py
Expand Down
2 changes: 1 addition & 1 deletion Fixes/Adventure_Quest/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ fi

UEFtrans.py "$1" extract 0 temp

python patch_file.py
python3 patch_file.py

UEFtrans.py "$2" new Electron 0
UEFtrans.py "$2" append temp/LOADER,temp/QUEST
Expand Down
6 changes: 3 additions & 3 deletions Fixes/Adventure_Quest/patch_file.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
#!/usr/bin/env python
#!/usr/bin/env python3

t = open("temp/QUEST", "rb").read()
u = ("\x00" * 0xb00) + t[0xb00:]
u = (b"\x00" * 0xb00) + t[0xb00:]
open("temp/QUEST", "wb").write(u)

t = "\x11\x00MODE6:?&34E=10:CLS:VDU28,0,11,39,0:*/\r"
t = b"\x11\x00MODE6:?&34E=10:CLS:VDU28,0,11,39,0:*/\r"
open("temp/LOADER", "wb").write(t)
open("temp/LOADER.inf", "wb").write("$.LOADER\t0000\t0000\t%x" % len(t))
2 changes: 1 addition & 1 deletion Fixes/Confuzion/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ fi
cp "$1" "$2"
UEFtrans.py "$1" extract 1 temp

python patch_checks.py
python3 patch_checks.py

# Replace the original CONFUZION file with the patched version.
UEFtrans.py "$2" remove 1
Expand Down
20 changes: 10 additions & 10 deletions Fixes/Confuzion/patch_checks.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,16 @@
# ) + t[0x2c:]

t = (# Update CFS checks.
"\xa9\x91" # lda #$91
"\x8d\xca\x03" # sta $3ca
"\xa9\x0e" # lda #$0e
"\x8d\xcb\x03" # sta $3cb
"\xa9\x0d" # lda #$0d
"\x8d\xcc\x03" # sta $3cc
"\xa9\x22" # lda #$22
"\x8d\xcd\x03" # sta $3cd
"\xa9\x42" # lda #$42
"\x8d\xce\x03" # sta $3ce
b"\xa9\x91" # lda #$91
b"\x8d\xca\x03" # sta $3ca
b"\xa9\x0e" # lda #$0e
b"\x8d\xcb\x03" # sta $3cb
b"\xa9\x0d" # lda #$0d
b"\x8d\xcc\x03" # sta $3cc
b"\xa9\x22" # lda #$22
b"\x8d\xcd\x03" # sta $3cd
b"\xa9\x42" # lda #$42
b"\x8d\xce\x03" # sta $3ce
) + t

open("temp/CONFUZION", "wb").write(t)
Expand Down
2 changes: 1 addition & 1 deletion Fixes/Dunjunz/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ sed -i s/6b/3b/g temp/Level*.inf

# Unscramble all the levels to make them easier to compress and patch the
# loader to skip the level data check.
python unscramble.py
python3 unscramble.py

UEFtrans.py "$2" new Electron 0
UEFtrans.py "$2" append temp/DUNK,temp/LOADER,temp/TITLE,temp/Dunjunz,temp/Level1,temp/Level2,temp/Level3,temp/Level4,temp/Level5,temp/Level6,temp/Level7,temp/Level8,temp/Level9,temp/Level10,temp/Level11,temp/Level12,temp/Level13,temp/Level14,temp/Level15,temp/Level16,temp/Level17,temp/Level18,temp/Level19,temp/Level20,temp/Level21,temp/Level22,temp/Level23,temp/Level24,temp/Level25
Expand Down
17 changes: 8 additions & 9 deletions Fixes/Dunjunz/unscramble.py
Original file line number Diff line number Diff line change
@@ -1,18 +1,17 @@
def unscramble_data(data):

new_data = ""
new_data = []
for i in range(len(data)):
new_data.append(data[i] ^ (i % 256))

new_data += chr(ord(data[i]) ^ (i % 256))

return new_data
return bytes(new_data)

for i in range(1, 26):
t = open("temp/Level%i" % i).read()
t = open("temp/Level%i" % i, "rb").read()
u = unscramble_data(t)
open("temp/Level%i" % i, "w").write(u)
open("temp/Level%i" % i, "wb").write(u)


t = open("temp/LOADER").read()
t = t[:0x50] + "\x60" + t[0x51:]
open("temp/LOADER", "w").write(t)
t = open("temp/LOADER", "rb").read()
t = t[:0x50] + b"\x60" + t[0x51:]
open("temp/LOADER", "wb").write(t)
2 changes: 1 addition & 1 deletion Fixes/Galaxy_Wars/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ fi
UEFtrans.py "$1" extract 0 temp

# Patch the game.
python patch_file.py
python3 patch_file.py

UEFtrans.py "$2" new Electron 0
UEFtrans.py "$2" append temp/WARS
Expand Down
54 changes: 27 additions & 27 deletions Fixes/Galaxy_Wars/patch_file.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/env python
#!/usr/bin/env python3

t = open("temp/WARS", "rb").read()

Expand All @@ -14,42 +14,42 @@
# 8d3: 0x8d (141)

l = [# Level (double height text)
(0x3cd, "\x0a"), # VDU 10 (down)
(0x3d0, "\x09"), # VDU 9 (right)
(0x3e3, "\x00"), # VDU 0 (nothing)
(0x3e6, "\x09"), # VDU 9 (right)
(0x3cd, b"\x0a"), # VDU 10 (down)
(0x3d0, b"\x09"), # VDU 9 (right)
(0x3e3, b"\x00"), # VDU 0 (nothing)
(0x3e6, b"\x09"), # VDU 9 (right)

# Galaxy Wars Hall Of Fame (double height text)
(0x62d, "\x0a"), # down
(0x630, "\x09"), # right
(0x63b, "\x00"), # nothing
(0x63e, "\x09"), # right
(0x62d, b"\x0a"), # down
(0x630, b"\x09"), # right
(0x63b, b"\x00"), # nothing
(0x63e, b"\x09"), # right
#(0x6a3, "GALAXY"),
#(0x6dc, "\x8d"),
# GALAXY WARS (double height text)
(0x6d9, "\x00"), # nothing
(0x6dc, "\x09"), # right
(0x6e7, "\x0b"), # up
(0x6ea, "\x09"), # right
(0x6f4, "\x0a"), # extra space between the title and the instructions
(0x770, '"Z", "X" and "Return"'),
(0x6d9, b"\x00"), # nothing
(0x6dc, b"\x09"), # right
(0x6e7, b"\x0b"), # up
(0x6ea, b"\x09"), # right
(0x6f4, b"\x0a"), # extra space between the title and the instructions
(0x770, b'"Z", "X" and "Return"'),

# Bug_Byte 1982 (double height text)
(0x8be, "\x09"), # cursor x = 9
(0x8c2, "\x00"), # nothing
(0x8c5, "\x09"), # right
(0x8cc, "\x09"), # cursor x = 9
(0x8d0, "\x0b"), # up
(0x8d3, "\x09"), # right
(0x83f, "P to freeze the action. "),
(0x330e, "\xb6"), # Fire = Return
(0x330f, "\x9e"), # Left = Z
(0x3314, "\xc8"), # Pause = P
(0x3371, "\xbd")] # Right = X
(0x8be, b"\x09"), # cursor x = 9
(0x8c2, b"\x00"), # nothing
(0x8c5, b"\x09"), # right
(0x8cc, b"\x09"), # cursor x = 9
(0x8d0, b"\x0b"), # up
(0x8d3, b"\x09"), # right
(0x83f, b"P to freeze the action. "),
(0x330e, b"\xb6"), # Fire = Return
(0x330f, b"\x9e"), # Left = Z
(0x3314, b"\xc8"), # Pause = P
(0x3371, b"\xbd")] # Right = X

# Sort the list in case we have accidentally added items to it out of order.
l.sort()
u = ""
u = b""
i = 0
for offset, c in l:
u += t[i:offset] + c
Expand Down
2 changes: 1 addition & 1 deletion Fixes/Palace_Of_Magic_2016/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ fi
SSD2UEF.py "$1" temp.uef $.!BOOT,$.Loader,$.Pom2016,$.PlcOMgc
UEFtrans.py temp.uef extract 0,1,2,3 temp

python patch_loader.py
python3 patch_loader.py

UEFtrans.py "$2" new Electron 0
UEFtrans.py "$2" append temp/\!BOOT,temp/Loader,temp/Pom2016,temp/PlcOMgc
Expand Down
14 changes: 7 additions & 7 deletions Fixes/Palace_Of_Magic_2016/patch_loader.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
#!/usr/bin/env python
#!/usr/bin/env python3

t = open("temp/Loader").read()
t = open("temp/Loader", "rb").read()
t = t.replace(
"*FX 200 1",
"\xef 21 "
b"*FX 200 1",
b"\xef 21 "
).replace(
' 3000"',
'" : \xef6'
b' 3000"',
b'" : \xef6'
)
open("temp/Loader", "w").write(t)
open("temp/Loader", "wb").write(t)
2 changes: 1 addition & 1 deletion Fixes/The_Last_Ninja/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ fi
SSD2UEF.py "$1" "$2" $.LOADER,$.LOADSCR,$.NINJA-1,$.NINJA-2,$.NINJA-3,1.LEVEL-A,1.LEVEL-B,2.LEVEL-A,2.LEVEL-B,3.LEVEL-A,3.LEVEL-B,4.LEVEL-A,4.LEVEL-B,5.LEVEL-A,5.LEVEL-B,6.LEVEL-A,6.LEVEL-B

UEFtrans.py "$2" extract 0 temp
python patch.py temp/LOADER
python3 patch.py temp/LOADER

UEFtrans.py "$2" remove 0
UEFtrans.py "$2" insert 0 temp/LOADER
Expand Down
6 changes: 3 additions & 3 deletions Fixes/The_Last_Ninja/patch.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import sys

t = open(sys.argv[1]).read()
t = t.replace("FX178,0", "*******")
t = open(sys.argv[1], "rb").read()
t = t.replace(b"FX178,0", b"*******")

#s = ""
#i = 0x2a1
Expand All @@ -26,4 +26,4 @@
#
#t = t[:0x2a1] + s + t[0x2f9:]

open(sys.argv[1], "w").write(t)
open(sys.argv[1], "wb").write(t)
2 changes: 1 addition & 1 deletion Fixes/ZAOR/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ UEFtrans.py "$1" extract 0,1,2,3 temp
#SSD2UEF.py "$1" "$2" $.ZAOR,$.ZAOR1

# Fix the loader and screen.
python fix_loader.py temp/LOADER temp/ZAORCV temp/INST
python3 fix_loader.py temp/LOADER temp/ZAORCV temp/INST

UEFtrans.py "$2" new Electron 0
UEFtrans.py "$2" append temp/LOADER,temp/ZAORCV,temp/INST,temp/BIBM
Expand Down
26 changes: 13 additions & 13 deletions Fixes/ZAOR/fix_loader.py
Original file line number Diff line number Diff line change
@@ -1,26 +1,26 @@
#!/usr/bin/env python
#!/usr/bin/env python3

import sys

t = open(sys.argv[1], "rb").read()
t = t.replace("*TAPE", "*****")
t = t.replace(" 28,0,0,0,0", "28,2,5,10,2")
t = t.replace(" STOP ", " ")
t = t.replace(" THE ", " ")
t = t.replace(" TAPE !! ", " ")
t = t.replace(b"*TAPE", b"*****")
t = t.replace(b" 28,0,0,0,0", b"28,2,5,10,2")
t = t.replace(b" STOP ", b" ")
t = t.replace(b" THE ", b" ")
t = t.replace(b" TAPE !! ", b" ")
open(sys.argv[1], "wb").write(t)

s = open(sys.argv[2], "rb").read()
p1 = ""
p2 = ""
p1 = []
p2 = []
for i in range(4):
p1 += s[8 + i]
p2 += s[0x144 + i]
p1.append(s[8 + i])
p2.append(s[0x144 + i])

s = p1 + p2 + s[8:]
s = bytes(p1 + p2) + s[8:]
open(sys.argv[2], "wb").write(s)

t = open(sys.argv[3], "rb").read()
t = t.replace("*TAPE", "*****")
t = t.replace("STOP THE TAPE!!", " ")
t = t.replace(b"*TAPE", b"*****")
t = t.replace(b"STOP THE TAPE!!", b" ")
open(sys.argv[3], "wb").write(t)

0 comments on commit c0bca98

Please sign in to comment.