Skip to content

Commit

Permalink
Add support for 8MB non-WAAS cards (#17)
Browse files Browse the repository at this point in the history
  • Loading branch information
dimaryaz authored Dec 23, 2024
1 parent 97ca5b1 commit 934c38a
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 4 deletions.
23 changes: 19 additions & 4 deletions src/jdmtool/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -110,21 +110,36 @@ def wrapper(dev: SkyboundDevice, *args, **kwargs):

# TODO: Figure out the actual meaning of the iid and the "unknown" value.
iid = dev.get_iid()
unknown = dev.get_unknown()

if iid == 0x01004100:
# 16MB WAAS card
print("Detected data card: 16MB WAAS")
dev.set_memory_layout(SkyboundDevice.MEMORY_LAYOUT_16MB)
elif iid == 0x0100ad00:
# 4MB non-WAAS card
print("Detected data card: 4MB non-WAAS")
dev.set_memory_layout(SkyboundDevice.MEMORY_LAYOUT_4MB)
if unknown >> 30 == 0x00:
# 8MB non-WAAS card
print("Detected data card: 8MB non-WAAS")
dev.set_memory_layout(SkyboundDevice.MEMORY_LAYOUT_8MB)
elif unknown >> 30 == 0x03:
# 4MB non-WAAS card
print("Detected data card: 4MB non-WAAS")
dev.set_memory_layout(SkyboundDevice.MEMORY_LAYOUT_4MB)
else:
raise SkyboundException(
f"Unexpected identifier 0x{unknown:08x} for a 4MB/8MB card. Please file a bug!"
)
elif iid == 0x89007e00:
# 16MB WAAS card, the orange one.
print("Detected data card: 16MB WAAS (orange)")
dev.set_memory_layout(SkyboundDevice.MEMORY_LAYOUT_16MB)
elif iid == 0x90009000:
raise SkyboundException(
"This looks like a Terrain/Obstacles card. It is not supported by Skybound Programmer."
)
else:
raise SkyboundException(
f"Unknown data card IID: 0x{iid:08x} (possibly 8MB non-WAAS?). Please file a bug!"
f"Unknown data card IID: 0x{iid:08x}. Please file a bug!"
)

f(dev, *args, **kwargs)
Expand Down
1 change: 1 addition & 0 deletions src/jdmtool/skybound.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ class SkyboundDevice():

MEMORY_LAYOUT_UNKNOWN = [0]
MEMORY_LAYOUT_4MB = [0, 2]
MEMORY_LAYOUT_8MB = [0, 2, 4, 6]
MEMORY_LAYOUT_16MB = [0, 1, 2, 3, 4, 5, 6, 7]

def __init__(self, handle: 'USBDeviceHandle') -> None:
Expand Down

0 comments on commit 934c38a

Please sign in to comment.