Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for 8MB non-WAAS cards #17

Merged
merged 1 commit into from
Dec 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 19 additions & 4 deletions src/jdmtool/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -105,21 +105,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