Bangai-Oh VGA Patch

Place for discussing homebrew games, development, new releases and emulation.

Moderators: pcwzrd13, deluxux, VasiliyRS

User avatar
CrashMidnick
blackout!
Posts: 140
Location: FRANCE

Re: Bangai-Oh VGA Patch

Post by CrashMidnick »

Amazing ! Thank you so much TapamN. Another beautiful present from you :)

Edit : it works like a charm !

TapamN
letterbomb
Posts: 150

Re: Bangai-Oh VGA Patch

Post by TapamN »

How the patch works:

When setting the video mode, the functions that handle it take an integer where different bits control different parts of the video signal. The bottom two bits control the output type (0 = NTSC, 1 = VGA, 2 = PAL), and there is a pair of bits that control horizontal (0 = 320, 1 = 640) and vertical (0 = 240, 1 = 480) resolution. When using VGA, it goes out of its way to overrides/ignores/bypasses the resolution bits, and always runs at 640x480. The patch is mainly disabling the VGA resolution overrides so that the rendering hardware targets 320x240, then forcing the signal to 320x240 VGA. The 0x01 to 0xFF patches basically change code like this:

Code: Select all

#define SIGNAL_TYPE(mode) (mode & 0x03)
#define VGA 1
if (SIGNAL_TYPE((requested_mode) == VGA) {
        //Force 640x480
} else {
        //Handle low resolutions, not run
}
...to this:

Code: Select all

#define SIGNAL_TYPE(mode) (mode & 0x03)
if (SIGNAL_TYPE((requested_mode) == 0xFF) {
        //Force 640x480 is not run because of impossible check
} else {
        //Handle low resolutions, now always run
}
Some bits that control the resolution still don't get set correctly, so some additional changes were needed to force 320x240.
streeker wrote:Though Scart/RGB output is now broken.
Hmm, keeping NTSC working was mainly kind of lucky. There was one patch that I think might have responsible for breaking RGB, maybe I'll check and see if I can modify it to work differently, but it's not something I'm going to go out of my way for. Anyone who wants RGB still has the original after all.

Getting other non-VGA games to remain working with NTSC will probably be more difficult. Bangai-Oh is unique in that it still kind of works if you bypass the BIOS's cable check; the game still checks the cable type and requests VGA, but runs at the wrong resolution because of the PVR driver. Other non-VGA games are probably be hard coded to NTSC, so squeezing in a cable check would be hard. Any patches for those will likely be VGA only, without NTSC support.
Last edited by TapamN on Tue Apr 25, 2023 6:19 pm, edited 1 time in total.

mario64
shadow
Posts: 10

Re: Bangai-Oh VGA Patch

Post by mario64 »

MoeFoh wrote:VGA patched track01 and track37 of the TOSEC Bangai-O dump. Working on GDEMU.

https://www.mediafire.com/file/gyt7ev3y ... mN.7z/file
I'm seeing Track03 and Track37 in the archive. No Track01. Is this correct?

EDIT: Never mind. Got it working with the Universal Patcher. Thank you @TapamN and @ateam!!!
Last edited by mario64 on Sat Apr 22, 2023 5:25 pm, edited 1 time in total.

User avatar
ateam
Animated Violence
Posts: 498

Re: Bangai-Oh VGA Patch

Post by ateam »

Excellent work!

I documented some of my progress is developing VGA patches for the handful of heavy hitters that lack it. While I was able to get somewhere, I got distracted with the slew of other projects on my plate. God bless you for seeing it through on Bangai-O!

For everyone's convenience, here's a .DCP patch file for use with my Universal Dreamcast Patcher. It was built against the NTSC-U version of the game. Note that this patch also sets the VGA flag in IP.BIN, as well as includes the missing disc art PVR. Simply load up the .DCP and either a TOSEC GDI or Redump CUE/BIN of the original, and let the patcher do the rest!

Bangai-O (VGA Patch - TapamN).dcp
https://drive.google.com/u/0/uc?id=1DXp ... t=download
Last edited by ateam on Sat Apr 22, 2023 5:25 pm, edited 1 time in total.
Find me on...

DreamcastForever.com
GitHub
Reddit
SegaXtreme
Twitter
YouTube
• Discord: derek.ateam

User avatar
CrashMidnick
blackout!
Posts: 140
Location: FRANCE

Re: Bangai-Oh VGA Patch

Post by CrashMidnick »

TapamN wrote:Anyone who wants RGB still has the original after all.
TapamN wrote:Getting other non-VGA games to remain working with NTSC will probably be more difficult. Bangai-Oh is unique in that it still kind of works if you bypass the BIOS's cable check; the game still checks the cable type and requests VGA, but runs at the wrong resolution because of the PVR driver. Other non-VGA games are probably be hard coded to NTSC, so squeezing in a cable check would be hard. Any patches for those will likely be VGA only, without NTSC support.
Really not a big deal IMHO. We just have to choose whatever version of the game we want to use whith the desired cables.

User avatar
VirtuaShenmue
fire
Posts: 84

Re: Bangai-Oh VGA Patch

Post by VirtuaShenmue »

Great work!
a codebreaker code could be great! Hope to can convert it in future!

I wonder if Pal Skies of Arcadia could be patched too with the same method, as the japanese cake patch had speed / audio sync issues.

streeker
fragger
Posts: 254

Re: Bangai-Oh VGA Patch

Post by streeker »

TapamN wrote: Hmm, keeping NTSC working was mainly kind of lucky. There was one patch that I think might have responsible for breaking RGB, maybe I'll check and see if I can modify it to work differently, but it's not something I'm going to go out of my way for. Anyone who wants RGB still has the original after all.
To be clearer about the RGB issue: video output is still there. But vertically it is "too big" now, so that the bottom half is cut off.

TapamN
letterbomb
Posts: 150

Re: Bangai-Oh VGA Patch

Post by TapamN »

streeker wrote:To be clearer about the RGB issue: video output is still there. But vertically it is "too big" now, so that the bottom half is cut off.
Oh, that's not what I was expecting. That would be trickier to fix. I'll try to take a look at it, but it's probably more effort than I'm willing to spend.

I think there's a bug in the patch? When I was originally testing it, I just went though the first level with Riki, but I noticed that with Mami's shots (the blue lasers), it looks like there are green energy blobs on the end of the lasers when using the patch? I thought they were just lines, or am I misremembering? I don't see them on YouTube videos. Not sure what's going on, but this seems important enough to go back and try to figure it out (like some buffer size not being calculated correctly). Bangai-Oh still seems to still play fine, but it might be important when patching other games.

User avatar
MoeFoh
Outrun
Posts: 1138

Re: Bangai-Oh VGA Patch

Post by MoeFoh »

mario64 wrote:
MoeFoh wrote:VGA patched track01 and track37 of the TOSEC Bangai-O dump. Working on GDEMU.

https://www.mediafire.com/file/gyt7ev3y ... mN.7z/file
I'm seeing Track03 and Track37 in the archive. No Track01. Is this correct?

EDIT: Never mind. Got it working with the Universal Patcher. Thank you @TapamN and @ateam!!!
Thanks, updated to say "track03".

User avatar
MoeFoh
Outrun
Posts: 1138

Re: Bangai-Oh VGA Patch

Post by MoeFoh »

I didn't know the Dreamcast could output QVGA (320x240 VGA). I'm wondering if any devices out there will have trouble accepting this input signal. My upscaler certainly likes it.