baines / MiniGBS

Small .gbs chiptune player for Linux
MIT License
20 stars 4 forks source link

When ROM bank 0 is selected it is converted to 1 #2

Closed drfiemost closed 3 years ago

drfiemost commented 3 years ago

Fixes Grandia - Parallel Trippers

Found the explanation for bank switching here: https://b13rg.github.io/Gameboy-Bank-Switching/ Things looks a bit more complex but this did the trick.

drfiemost commented 3 years ago

Ok, changing parameter type to unsigned seems reasonable.

But after reading the document again I see that this is only valid for MBC1 cartridges. Is there a way to distinguish the cart model? I'm not familiar with Game Boy nor with gbs files.

baines commented 3 years ago

But after reading the document again I see that this is only valid for MBC1 cartridges. Is there a way to distinguish the cart model? I'm not familiar with Game Boy nor with gbs files.

It's been a while since I looked at the GBS format, but it doesn't look like the header contains any info about which cart was used: https://ocremix.org/info/GBS_Format_Specification

A full GB rom does have that info at $0147: https://gbdev.gg8.se/wiki/articles/The_Cartridge_Header but I'm not sure the "cut-down" rom in the GBS is guaranteed to contain that part.

I have a feeling the game that caused me to write that "seems to break some games" comment was Backgammon - but it seems to work fine with this PR too. I'll check some other games, but I think using MBC1 behaviour for all files is probably better than the current behaviour of ignoring the 0-write completely.

baines commented 3 years ago

Couldn't find any issues from testing various .gbs files I'm not sure if me approving this PR lets you merge it or not, so I'll just go ahead and merge it - thanks again.