LADX: apworld (#1665)
This commit is contained in:
parent
eef8f7af1a
commit
ece6598b09
1
setup.py
1
setup.py
|
@ -71,6 +71,7 @@ apworlds: set = {
|
||||||
"Timespinner",
|
"Timespinner",
|
||||||
"Minecraft",
|
"Minecraft",
|
||||||
"The Messenger",
|
"The Messenger",
|
||||||
|
"Links Awakening DX",
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -115,8 +115,8 @@ class Tokenizer:
|
||||||
assert kind is not None
|
assert kind is not None
|
||||||
value: Union[str, int] = mo.group()
|
value: Union[str, int] = mo.group()
|
||||||
if kind == 'MISMATCH':
|
if kind == 'MISMATCH':
|
||||||
print(code.split("\n")[line_num-1])
|
line = code.split("\n")[line_num - 1]
|
||||||
raise RuntimeError("Syntax error on line: %d: %s\n%s", line_num, value)
|
raise RuntimeError(f"Syntax error on line: {line_num}: {kind}:`{line}`")
|
||||||
elif kind == 'SKIP':
|
elif kind == 'SKIP':
|
||||||
pass
|
pass
|
||||||
elif kind == 'COMMENT':
|
elif kind == 'COMMENT':
|
||||||
|
|
|
@ -1,5 +1,7 @@
|
||||||
import os
|
import os
|
||||||
import binascii
|
import binascii
|
||||||
|
import pkgutil
|
||||||
|
|
||||||
from ..assembler import ASM
|
from ..assembler import ASM
|
||||||
from ..utils import formatText
|
from ..utils import formatText
|
||||||
|
|
||||||
|
@ -13,7 +15,6 @@ ItemNameStringBufferStart = ItemNameLookupTable + \
|
||||||
|
|
||||||
|
|
||||||
def addBank34(rom, item_list):
|
def addBank34(rom, item_list):
|
||||||
my_path = os.path.dirname(__file__)
|
|
||||||
rom.patch(0x34, 0x0000, ItemNameLookupTable, ASM("""
|
rom.patch(0x34, 0x0000, ItemNameLookupTable, ASM("""
|
||||||
; Get the pointer in the lookup table, doubled as it's two bytes
|
; Get the pointer in the lookup table, doubled as it's two bytes
|
||||||
ld hl, $2080
|
ld hl, $2080
|
||||||
|
@ -74,7 +75,7 @@ def addBank34(rom, item_list):
|
||||||
.notCavesA:
|
.notCavesA:
|
||||||
add hl, de
|
add hl, de
|
||||||
ret
|
ret
|
||||||
""" + open(os.path.join(my_path, "bank3e.asm/message.asm"), "rt").read(), 0x4000), fill_nop=True)
|
""" + pkgutil.get_data(__name__, os.path.join("bank3e.asm", "message.asm")).decode().replace("\r", ""), 0x4000), fill_nop=True)
|
||||||
|
|
||||||
nextItemLookup = ItemNameStringBufferStart
|
nextItemLookup = ItemNameStringBufferStart
|
||||||
nameLookup = {
|
nameLookup = {
|
||||||
|
|
|
@ -3,6 +3,7 @@ import binascii
|
||||||
from ..assembler import ASM
|
from ..assembler import ASM
|
||||||
from ..utils import formatText
|
from ..utils import formatText
|
||||||
|
|
||||||
|
import pkgutil
|
||||||
|
|
||||||
def hasBank3E(rom):
|
def hasBank3E(rom):
|
||||||
return rom.banks[0x3E][0] != 0x00
|
return rom.banks[0x3E][0] != 0x00
|
||||||
|
@ -54,7 +55,9 @@ def addBank3E(rom, seed, player_id, player_name_list):
|
||||||
ret
|
ret
|
||||||
"""))
|
"""))
|
||||||
|
|
||||||
my_path = os.path.dirname(__file__)
|
def get_asm(name):
|
||||||
|
return pkgutil.get_data(__name__, os.path.join("bank3e.asm", name)).decode().replace("\r", "")
|
||||||
|
|
||||||
rom.patch(0x3E, 0x0000, 0x2F00, ASM("""
|
rom.patch(0x3E, 0x0000, 0x2F00, ASM("""
|
||||||
call MainJumpTable
|
call MainJumpTable
|
||||||
pop af
|
pop af
|
||||||
|
@ -204,15 +207,15 @@ LocalOnlyItemAndMessage:
|
||||||
call GiveItemFromChest
|
call GiveItemFromChest
|
||||||
call ItemMessage
|
call ItemMessage
|
||||||
ret
|
ret
|
||||||
""" + open(os.path.join(my_path, "bank3e.asm/multiworld.asm"), "rt").read()
|
""" + get_asm("multiworld.asm")
|
||||||
+ open(os.path.join(my_path, "bank3e.asm/link.asm"), "rt").read()
|
+ get_asm("link.asm")
|
||||||
+ open(os.path.join(my_path, "bank3e.asm/chest.asm"), "rt").read()
|
+ get_asm("chest.asm")
|
||||||
+ open(os.path.join(my_path, "bank3e.asm/bowwow.asm"), "rt").read()
|
+ get_asm("bowwow.asm")
|
||||||
+ open(os.path.join(my_path, "bank3e.asm/message.asm"), "rt").read()
|
+ get_asm("message.asm")
|
||||||
+ open(os.path.join(my_path, "bank3e.asm/itemnames.asm"), "rt").read()
|
+ get_asm("itemnames.asm")
|
||||||
+ "".join(generate_name(["The Server"] + player_name_list, i ) for i in range(100)) # allocate
|
+ "".join(generate_name(["The Server"] + player_name_list, i ) for i in range(100)) # allocate
|
||||||
+ 'db "another world", $ff\n'
|
+ 'db "another world", $ff\n'
|
||||||
+ open(os.path.join(my_path, "bank3e.asm/owl.asm"), "rt").read(), 0x4000), fill_nop=True)
|
+ get_asm("owl.asm"), 0x4000), fill_nop=True)
|
||||||
# 3E:3300-3616: Multiworld flags per room (for both chests and dropped keys)
|
# 3E:3300-3616: Multiworld flags per room (for both chests and dropped keys)
|
||||||
# 3E:3800-3B16: DroppedKey item types
|
# 3E:3800-3B16: DroppedKey item types
|
||||||
# 3E:3B16-3E2C: Owl statue or trade quest items
|
# 3E:3B16-3E2C: Owl statue or trade quest items
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
from ..assembler import ASM
|
from ..assembler import ASM
|
||||||
import os
|
import os
|
||||||
|
import pkgutil
|
||||||
|
|
||||||
def updateEndScreen(rom):
|
def updateEndScreen(rom):
|
||||||
# Call our custom data loader in bank 3F
|
# Call our custom data loader in bank 3F
|
||||||
|
@ -134,6 +134,6 @@ loadLoop2:
|
||||||
"""))
|
"""))
|
||||||
|
|
||||||
addr = 0x1000
|
addr = 0x1000
|
||||||
for c in open(os.path.join(os.path.dirname(__file__), "nyan.bin"), "rb").read():
|
data = pkgutil.get_data(__name__, "nyan.bin")
|
||||||
rom.banks[0x3F][addr] = c
|
rom.banks[0x3F][addr : addr + len(data)] = data
|
||||||
addr += 1
|
|
||||||
|
|
|
@ -7,7 +7,7 @@ h2b = binascii.unhexlify
|
||||||
|
|
||||||
class ROM:
|
class ROM:
|
||||||
def __init__(self, filename):
|
def __init__(self, filename):
|
||||||
data = open(Utils.local_path(filename), "rb").read()
|
data = open(Utils.user_path(filename), "rb").read()
|
||||||
#assert len(data) == 1024 * 1024
|
#assert len(data) == 1024 * 1024
|
||||||
self.banks = []
|
self.banks = []
|
||||||
for n in range(0x40):
|
for n in range(0x40):
|
||||||
|
|
Loading…
Reference in New Issue