marcrobledo / super-game-boy-border-injector

Injects a custom Super Game Boy Border into any Game Boy ROM in the most possible user-friendly way!
http://www.marcrobledo.com/super-game-boy-border-injector/
Other
16 stars 3 forks source link

Game Boy Camera compatibility #5

Closed JohndoGB closed 3 months ago

JohndoGB commented 4 months ago

Hi, thank you once again for offering this wonderful way of customizing our Game Boy games, and I'd love to be able to do it with the Game Boy Camera rom, which already incorporates an overlay that is, how shall I say ... Awfully ugly :D

Thank you in advance, and no pressure, you do it when you have the time ;) (signed: a Frenchman admiring your work :) )

marcrobledo commented 4 months ago

I've uploaded an update (v1.1). Let me know if it works!

JohndoGB commented 4 months ago

But you're extremely fast! I've just tested the rom pass this time (American rom, but I'll test with the others, but no reason it can't pass), and I'll try to inject it in my modified GB cam to pass on the Super Nintendo today! Thanks to you for your responsiveness and your superb web application!

JohndoGB commented 4 months ago

So, unfortunately, it's impossible to run the rom on a Super Nintendo with the Super GB.

Let me explain my process, I tried to flash the rom on the modified Game Boy Camera, and unlike the other usual images, I got this message: warningflash

I then tested with the "yes" option, which triggered a total site verification, ending with the classic flash success message, but after booting Nintendo, nothing starts! With "no", flashing also ends, but on this screen: 3 This simply means that recognition of the boot nintendo logo is impossible, so in the end you can't even get past the logo...

I then tried flashing it on a "classic" cartridge, with no more success, and the same suggestions for the same results...

I finally tested the created rom on an emulator, and there's no problem, everything launches perfectly! But as you said yesterday on X, there's really no point in using this with an emulator, so in the end I've bothered you for nothing, and I apologize! I'm still going to submit my request to the GB camera Experts, as well as on the discord dedicated to Flash GBX, and I'll let you know if I get any further info, for this very specific case!

5

marcrobledo commented 4 months ago

It's probably because the ROM needs to be expanded to make room for the new border :-(

It would be possible to make it so it replaces the old border, but it will be limited to the original border size (which is probably very low since it was almost all blank tiles). Unfortunately, doesn't sound easy for a simple injector, it would require specific hacking for this ROM.

JohndoGB commented 4 months ago

Thank you for your reply. Indeed, even with a YYCHR-type tool, we can't find the location of this border, because as you said, it's made up almost exclusively of monochrome tiles. But I understand the principle you're stating, and that the "new" border should correspond in size to the old one, which would ultimately be of limited interest, or else for the technical challenges of changing colors ...

I'll keep you posted if I come up with any new ideas!

cristofercruz commented 4 months ago

@marcrobledo how much space is required for let's say the largest possible border, and does it have to be continuous? There's some areas of unused space throughout the rom, wondering if it that border data could be spread throughout various ranges.

marcrobledo commented 4 months ago

Largest possible border is:

map + tiles + palettes = 10080 bytes However, since map size is always fixed, it would be safe to replace the current map with the new one, so... tiles + palettes = 8288 bytes

Yes. It would be possible to spread all these across the entire ROM. But this would require extra hacking and, probably, become a separate project of its own. This injector's main aim wasn't to add specific patches for incompatible games.

cristofercruz commented 4 months ago

@JohndoGB as mentioned on Discord, your best bet is probably to write 0x00 to a bank or two in an unimportant area of the rom like where the built-in Album B images are stored. That can be done externally in a hex editor and then this tool will work.

marcrobledo commented 4 months ago

What are the banks where those photos are stored? Is there any information on GB Camera picture data structure? How big is every picture?

cristofercruz commented 4 months ago

There are 30 Album B photos baked into the ROM stored in offset range from 0xDA000 to 0xF8000. Each photo, its thumbnail and some 'metadata' takes up 4096bytes.

Video scrolling through the images in a tile viewer: https://github.com/marcrobledo/super-game-boy-border-injector/assets/9136454/5a05a4f9-7ded-41c8-bebf-545aa9631611

These are safe to replace without affecting any functionality. album-b-001 album-b-002

marcrobledo commented 4 months ago

Thank you for the information!

So it's four pictures per ROM bank. That's good to know! I can improve the injector so it overwrites the latest photo bank automatically, so there would be no need to do a manual hex replace. Also, I could also improve it, so it doesn't necessarily takes the maximum space, so probably you only lose one or two photos.

PD: Now I'm tempted to do a GB Camera photo converter/extractor/injector for both SRAM and ROM :-P

JohndoGB commented 4 months ago

Thank you both for the information and the means!

Otherwise it's the risk with this kind of project, to make people want to take on new challenges even more ^^.

cristofercruz commented 4 months ago

@marcrobledo Sounds good, overwriting data in the last album B bank seems like a good way forward.

The SRAM data structure is well documented here: https://funtography.online/wiki/Structure_of_the_Game_Boy_Camera_Save_Data Modifying SRAM needs to be done with caution as there are checksums enforced which cause the SRAM to get wiped when failure occurs.

I made a python utility some time ago to inject custom frames into the camera ROM. You can check it here: https://github.com/cristofercruz/gb-camera-frames

marcrobledo commented 4 months ago

Just to be sure... Bank 0x3d is the latest safe one to overwrite, right?

marcrobledo commented 4 months ago

@JohndoGB @cristofercruz Added a quick fix for GB Camera in 969eaadd76c22b46f36ee4ad3bb29c5c61819fff. All it does is to set to zeroes all bank in 0x3d (absolute offsets: 0x0f4000-0x0f8000), let me know if it works!

cristofercruz commented 3 months ago

@marcrobledo This workaround works well! I think this issue can be closed. Perhaps it's worth mentioning this special case behavior somewhere in the readme?

marcrobledo commented 3 months ago

@marcrobledo This workaround works well! I think this issue can be closed. Perhaps it's worth mentioning this special case behavior somewhere in the readme?

I don't think it's needed. Chances are you are the only ones that are changing the original SGB border in GB Camera and reflashing the cartridge haha