binji / binjgb

Gameboy emulator implemented in C, that also runs in the browser
https://binji.github.io/binjgb/
MIT License
534 stars 61 forks source link

Cube Raider doesn't work as expected #50

Closed dag7dev closed 11 months ago

dag7dev commented 11 months ago

Description

When Cube Raider tries to load, it loads, but it's not correctly viewed. This is a behavior encountered with other emus too.

Steps

Could we do something to fix this behaviour? TBH I don't know if we can do anything for it, but it would be nice to have it working.

binji commented 11 months ago

AFAICT, this game seems to expect an incorrect implementation of MBC2 behavior, where it can write to address $2000 to switch the ROM1 bank. But according to https://gbdev.io/pandocs/MBC2.html, bit 8 of the address must be set to switch rom banks (e.g. it should be writing to $2100).

Hacking my emulator to allow this incorrect behavior makes it work. But it would be better to patch the game instead, I think.

dag7dev commented 11 months ago

AFAICT, this game seems to expect an incorrect implementation of MBC2 behavior, where it can write to address $2000 to switch the ROM1 bank. But according to https://gbdev.io/pandocs/MBC2.html, bit 8 of the address must be set to switch rom banks (e.g. it should be writing to $2100).

Hacking my emulator to allow this incorrect behavior makes it work. But it would be better to patch the game instead, I think.

It would be really interesting even if I don't know where to start. But nice idea, thanks for suggesting this!

binji commented 11 months ago

Well, the simplest fix would be to change from using MBC2 to MBC1. You should be able to patch just one byte, see https://gbdev.io/pandocs/The_Cartridge_Header.html#0147--cartridge-type.