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 markdown vs megadrive autodetect and a markdown reader #2370

Open
bootmii opened this issue Mar 16, 2024 · 6 comments
Open

Add markdown vs megadrive autodetect and a markdown reader #2370

bootmii opened this issue Mar 16, 2024 · 6 comments

Comments

@bootmii
Copy link

bootmii commented Mar 16, 2024

Is your feature request related to a problem? Please describe.
Yes! The .md extension is now supported for Mega Drive roms. However, it's also used for Markdown.

Describe the solution you'd like
EPUB readers exist for DS(i), and it shouldn't be that hard to repurpose them for Markdown.

Describe alternatives you've considered
RetroArch on 3DS doesn't have a Markdown viewer either yet.

Additional context
The same problem exists for Colors vs ColecoVision but it's probably harder to solve because Markdown is text.

@bootmii
Copy link
Author

bootmii commented Mar 16, 2024

At 5:46 PM, RocketRobz wrote:

.md files will only appear if one of these checks are passes:

  • Offset 0x4 contains an entry point range between offsets 0x8 and 0x3FFFFE.

If there's a space, number, or punctuation in line 1 column 5 this check passes. For example, this comment has an entry point of 0x3a3436, and my first comment has an entry point of 0x20796f.

  • The SEGA string is stored at offset 0x100.

@RocketRobz
Copy link
Member

I deleted my post because I thought I misunderstood your post...

@bootmii
Copy link
Author

bootmii commented Mar 16, 2024

You weren't too far off. How many Sega Genesis ROMs have you seen where byte 0x4 was 0x0a, 0x0d, or between 0x20 and 0x3f? (The Sega Mega Drive is big-endian.)

As for deleting your post, don't worry, I got it in an email.

@bootmii
Copy link
Author

bootmii commented Mar 16, 2024

Ishido would fail, as the entry point is 0x2 and Accolade wasn't putting "SEGA" at 0x100 yet (there was no need to in 1990). That's unless the entry point is actually 0x200, but then wouldn't this check guarantee that the byte at 0x4 is always 0x00? If so, there's no bug here of Markdown files getting detected as Mega Drive ROMs, which is more than I can say for RetroArch. I still want a Markdown reader though. That's my feature request.

@bootmii
Copy link
Author

bootmii commented Mar 16, 2024

Thanks for writing a commit so quickly. You might actually be checking byte 0x7 though. The point of reversing bytes 4 through 7 is that the Sega Genesis is big-endian and the Nintendo DS is little-endian, I'm not sure if fread swaps the byte order when writing into a byte array (that is, if segaEntryPointReversed[0] corresponds to byte 0x7 or 0x5 and segaEntryPointReversed[3] corresponds to byte 0x4 or 0x6) but if it doesn't, we should be checking the byte that corresponds to offset 0x4.

@RocketRobz
Copy link
Member

Thanks for writing a commit so quickly. You might actually be checking byte 0x7 though. The point of reversing bytes 4 through 7 is that the Sega Genesis is big-endian and the Nintendo DS is little-endian, I'm not sure if fread swaps the byte order when writing into a byte array (that is, if segaEntryPointReversed[0] corresponds to byte 0x7 or 0x5 and segaEntryPointReversed[3] corresponds to byte 0x4 or 0x6) but if it doesn't, we should be checking the byte that corresponds to offset 0x4.

Commit a6bcedd already checks the correct offset. fread does not swap the bytes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants