MiSTer-devel / Gameboy_MiSTer

Gameboy for MiSTer
103 stars 48 forks source link

SGB: "Multiple border" games don't load their borders sometimes or at all #147

Closed birdybro closed 3 years ago

birdybro commented 3 years ago

For some reason all multiple border games have issues with the way they display borders (https://en.wikipedia.org/wiki/List_of_Super_Game_Boy_games - and sort by the "Multiple Borders" column). Maybe this is expected as there isn't an actual SNES core built-in there of course. I looked around in case anyone else brought this up but didn't see it. It seems like some of them are sending a command to change the border or something, and the Gameboy core is currently only tuned to accept a command like this upon load, or maybe only supports a certain set of these border commands. Just speculating.

For instance, Dragon Warrior I&II for SGB initially starts off with no border (on the SGB it uses the built-in), then when you finally get past the intro of Dragon Warrior I you are greeted with this border:

q5I1nhfclo (screenshot from bsnes just to show what it should do, bsnes handles the SNES side and it has a gameboy emulator named gambatte running inside it as well).

Dragon Warrior II if picked instead should show this during the intro, but doesn't have a border either:

15nsZl09oI

Another interesting example is that Tetris DX will display a different SGB border if it is played on an SGB2 than a regular SGB.

rMvxnCPQpz - Tetris DX on SGB1

QsoFGj02qP - Tetris DX on SGB2

This is probably not possible to do without some "SGB1/2" mode that tells the game it's whatever different hardware it is (through A-register value mentioned below I guess?). If the OSD option had an additional "Super Game Boy 2" option than this would enable detection of that particular hardware. I highly doubt it's used for more than a couple games though.

no$ has some pretty decent looking documentation on the way the borders work, but they might not be complete:

http://problemkaputt.de/pandocs.htm#sgbunlockinganddetectingsgbfunctions

This little section indicates that at least the detection between SGB1 and SGB2 could be accomplished probably. In addition to the MLT_REQ command being responded to, there is an additional method required to differentiate between the SGB and SGB2. I do not have a full list of games that utilize this, but Tetris DX is a good example.

Separating between SGB and SGB2
It is also possible to separate between SGB and SGB2 models by examining the inital value of the accumulator (A-register) directly after startup.
    01h  SGB or Normal Gameboy (DMG)
    FFh  SGB2 or Pocket Gameboy
    11h  CGB or GBA

http://problemkaputt.de/pandocs.htm#sgbborderandobjcommands - I'm sure the vast majority of this is known or already implemented, but adding it in case it's helpful. This section covers more of the border stuff. It could take awhile but I might just test out the multiple border games specifically if that would help. Let me know. They all might do different things.

paulb-nl commented 3 years ago

All games with multiple borders work fine for me like Arcade Classic 3 Galaga/Galaxian, Bomberman Collection, Konami Collection 2, Mario's Picross (Hold direction on title screen when pressing start to select different colors) , Street Fighter 2 and even Dragon Warrior 1&2.

I think you are running Dragon Warrior in System: Auto mode and since it is a Gameboy Color game the Super Gameboy hardware is disabled. You need to set System to Gameboy for that game.

birdybro commented 3 years ago

Ah so it's not automatic like the Super Game Boy typically is, this detection of the border stuff isn't automated like normal. That's probably the result of it requiring SNES hardware correct?

And now it's sorta working with Auto selected? Auto wasn't working before, but now it is. I'm confused, the behavior isn't consistent on my end or documented.

paulb-nl commented 3 years ago

Ah so it's not automatic like the Super Game Boy typically is, this detection of the border stuff isn't automated like normal. That's probably the result of it requiring SNES hardware correct?

I don't know what you mean. Why wouldn't it be automated?

A real Super Game Boy doesn't support Game Boy Color games so they always run in Game Boy mode. This also happens with the core set to System: Gameboy.

On System: Auto mode this core will run in Game Boy Color mode with games that are made for both Game Boy Color and Game Boy with Super Game Boy enhancements. Game Boy Color mode is incompatible with Super Game Boy Hardware.

paulb-nl commented 3 years ago

I could add an extra Auto mode that runs a Gameboy Color game in Super Game Boy mode if it has SGB enhancements.

So then you can choose: Auto(Prefer GBC), Auto(Prefer SGB), Gameboy,Gameboy Color

Would that be something that you want?

birdybro commented 3 years ago

Ideally, I think the intuitive functionality to the user, would be for the borders and palettes to load similar to how they load with a Super Game Boy, so if it's set to Super Game Boy and Auto, then the games that should run in "Game Boy" mode just do, but this probably isn't feasible without the Super Game Boy rom being used as the BIOS for the gameboy, which entails all kinds of other stuff.

I think it would be unnecessary to add the "prefers" options. Now that I know how it works, maybe I can add a mention in the readme.md of how this works briefly since the confusion was mostly over how this worked moreso than a flaw in the design. :)

birdybro commented 3 years ago

After more testing, yup it's as you say, user error. ;)