1. drfsupercenter

    OP drfsupercenter Flash Cart Aficionado
    Member

    Joined:
    Mar 26, 2008
    Messages:
    1,907
    Country:
    United States
    Hey guys,

    Over the past few days I've done a bit of experimentation with this myself. I was able to figure some things out, but sadly I will need community help on the rest.

    First of all, here's what I discovered:
    • All Game Boy VC titles (not counting the Ambassador GBA) uses the exact same emulator. The "L+R+Y" color swapping is included with all of them, but something in the code.bin tells it - in layman's terms - if the ROM is not a GBC game (I'm quite sure it reads from the ROM header and if it finds a 0x00, it boots it in non-color mode, using the config.ini) Otherwise, it disables the palette swap mode and boots using the built-in palettes.
    • There is an image file that represents the screen border when you boot in native-size mode. It's the same file for all GBC games and for all GB games, and is named "face_cgb.ttp" regardless if the image is a Game Boy "brick" or GBC.
    • Functionally, the emulator is identical besides the image. If you want a prebuilt example, look at BigBlueBox's Pokémon Red and Blue releases - those ones use the GBC border, but since they do not have GBC data, you can hold L+R and press Y, which changes between gray and green modes. If you're in native-size mode, it also glitches the frame a little bit since Nintendo never planned on that option being usable with the GBC face.

    All of the games have a config.ini file. It looks something like this:
    If you convert those 5-bit (or sometimes called 15-bit) colors to 32-bit ones, you'll notice that the first has shades of green while the second has shades of gray - hence the "COLOR_GRAY" heading.

    As far as I can tell, that is the default coloring of all games - even GBC ones have this entry.

    As a simple test, I used Tetris (the official VC release, just extracted and rebuilt) and changed the gray/green modes to GBC/SGB colors. You can see my success here:

    [​IMG]

    [​IMG]

    I changed the colors of the green/gray to be the SGB and GBC colorized modes. I got the GBC info from here, and the SGB from here:
    [​IMG]

    The big reason I chose Tetris is that all three layers have the same coloring - BG, OBJ0 and OBJ1.

    Most games do not work that way, and they have different colors for different layers.

    I was going to test out Kirby's Dream Land (the Kirby's Dream Collection disc for Wii has the first two GB games as virtual console and guess what, they use the same config.ini files! Using Dolphin I was able to tweak these a bit and see the results in real time.)

    Something interesting though. This is the first part of the config from the Wii disc:
    It actually doesn't use the first two settings at all - it uses the third one, with the three separate layers.

    Neat, right? I was able to do this, to mimic the GBC colors (which does have separate colors on all three layers! Easiest way to tell is that Kirby himself is pink, which is on the OBJ0 layer!)

    [​IMG]


    However, no such luck on the 3DS end. I tried all sorts of things, and it only used one layer worth of colors. Interestingly if I just deleted the Color0, Color1, Color2, Color3 and replaced them with the BG/OBJ colors from the Wii config, it still worked properly (with gray/green colors)... so those might be built-in as well and just reads from the config if it can.

    Here's where it gets tricky.

    I took the decompressed code.bin and searched for Color0 in a hex editor. I found a few references to them, but most notably these:

    So I tried changing the second and third sets - to values like Color4, Color5, and then instead of 10 and 11 (since you can't change the size of a code.bin at all) I used Color$ and Color%

    Anyway, it didn't work. Still only read the first three colors.

    And this is where I need your help, gbatemp community. I don't know anything about ARM programming, and it's obvious that the code.bin is going to need to be edited in order to support separate colors for each layer. For simple colorations like Tetris, you can just modify it as-is, and rebuild it... but very few games have uniform coloring like that.

    It might be simple, it might not be, but I thought I'd reach out for help - as well as share my progress so you know it definitely IS possible to do some crude coloration. I think it works a lot better than forced grayscale.

    Some stuff I'd like to see, but a bit more heavy lifting:

    • More than just two color modes. Three if not four settings - so you can have a Super Game Boy palette mode*, Game Boy Color mode, original grayscale mode, and possibly the green-tinted mode too.
    • *Games made after the SGB came out usually have actual SGB color palettes. The super super super awesome thing would be if we could somehow get the emulator to load these colors, like it will with GBC colors. Games like Pokémon Red and Blue have full color support via the SGB, and when using any computer emulators, you can simply put them in SGB mode and voila... full colors! They also look much nicer than the GBC colors, as those are static and do not change based on the gameplay as SGB does.
    • Basically, like I mentioned in the above bullet, Super Game Boy color support.
    What do you guys think?

    And by the way, if you need an extracted VC title to look at, I can provide one if you PM me... but you can totally do it yourself using Decrypt9 and any VC game you own. All GB and GBC games use the same emulator and set of files as I said.

    Thanks for reading! I'm looking forward to some more knowledgable code hackers being able to help.


    Edit: totally random side question... how come when you modify a file in romFS and recompile in 3DS Builder, it takes much longer to load? I can compile the extracted VC contents (unmodified) in 3DS Builder, load it up via the Gateway and it takes maybe 1-2 seconds of showing the 3DS boot logo before it starts.

    When I change the config it takes 10, sometimes up to 20 or even 30 seconds of showing the Nintendo 3DS logo before it finally starts.
     
    Last edited by drfsupercenter, Mar 26, 2016
    BETA215, d4mation, hippy dave and 2 others like this.
  2. drfsupercenter

    OP drfsupercenter Flash Cart Aficionado
    Member

    Joined:
    Mar 26, 2008
    Messages:
    1,907
    Country:
    United States
    I'd really like to gravedig this, been bored recently and thought how cool it would be to get proper colors
     
  3. Flame

    Flame Me > You
    Moderator

    Joined:
    Jul 15, 2008
    Messages:
    5,796
    what do you mean proper colors?
     
  4. drfsupercenter

    OP drfsupercenter Flash Cart Aficionado
    Member

    Joined:
    Mar 26, 2008
    Messages:
    1,907
    Country:
    United States
    Not greyscale. At the very least the GBC colors seen here
     
  5. AleronIves

    AleronIves Advanced Member
    Newcomer

    Joined:
    Nov 17, 2016
    Messages:
    83
    Country:
    United States
    Use GM9 to extract the ROM from your VC purchase, then use GameYob or Gambatte (via RetroArch) to get GBC palettes.
     
  6. drfsupercenter

    OP drfsupercenter Flash Cart Aficionado
    Member

    Joined:
    Mar 26, 2008
    Messages:
    1,907
    Country:
    United States
    That's not the same thing. I like the actual VC, and none of those will have the wireless multi-player stuff for Pokémon.
     
  7. AleronIves

    AleronIves Advanced Member
    Newcomer

    Joined:
    Nov 17, 2016
    Messages:
    83
    Country:
    United States
    True, but Nintendo's emulators are pretty barebones compared to homebrew ones. Nintendo gave priority to making all VC titles equal in terms of features, so games with SGB and GBC palettes remain greyscale. Since your post is five years old, I guess 3DS devs don't want to reinvent the wheel when it comes to supporting extra palettes.

    BTW regarding Kirby's Dream Collection, the other games are also VC titles, and you can extract and rebuild the ROMs with vcromclaim. I've played through Kirby's Adventure, Kirby Super Star, and Kirby's Dream Land 3 on my 3DS thanks to KDC. :)
     
  8. drfsupercenter

    OP drfsupercenter Flash Cart Aficionado
    Member

    Joined:
    Mar 26, 2008
    Messages:
    1,907
    Country:
    United States
    GBC palettes show up fine, it's only the ones with SGB that don't. Games like Pokémon Yellow (outside of Japan) have the GBC palettes and are in full color on the VC. Starting at 1:12 in this video you can see them playing the original "Medarot" game from 1997, but the emulator has it in full color. I checked in an emulator and it is indeed the Super Gameboy colors that are being shown. The 3DS compilation of those games has it in greyscale, because of course it does.

    Interesting thing, I just discovered the Japanese compilation of Medabots game has an emulator that uses SGB colors.

    Aren't the Game Boy games available as 3DS VC as well? I'm pretty sure I bought at least the original Kirby's Dream Land on my 3DS.
     
  9. AleronIves

    AleronIves Advanced Member
    Newcomer

    Joined:
    Nov 17, 2016
    Messages:
    83
    Country:
    United States
    Pokemon Yellow is kind of a special case. Red and Blue have colour when played on SGB but not GBC. Pokemon Yellow was reworked so the SGB colours are usable by the GBC, so 3DS VC would most likely be running Yellow in the GBC emulator. Since R/B require SGB to access the colour graphics, 3DS VC shows them greyscale in the regular DMG emulator. I don't think any 3DS VC is able to use SGB palettes, even though the SGB information is still present in the VC ROM files.

    Sure, but I already own KDL1/2 carts and GB cart dumpers, so I don't need to buy the VC titles. The SNES Kirby titles are sadly not on the eShop, because Nintendo doesn't support any SA-1 SNES titles on 3DS. Thankfully, homebrew SNES emulators are able to run SA-1 games on N3DS at full speed, so you can still play the SNES games from Kirby's Dream Collection on a modded 3DS.
     
  10. lone_wolf323

    lone_wolf323 GBAtemp Psycho!
    Member

    Joined:
    May 27, 2011
    Messages:
    4,131
    Country:
    Canada
    Kirby dream course was about the only snes release nintendo did https://www.nintendo.com/games/detail/kirbys-dream-course-3ds/

    ** I do realize this one i dont think needed the SA-1 chip to run. The rest of them never got a eshop release
     
    Last edited by lone_wolf323, May 15, 2021
  11. drfsupercenter

    OP drfsupercenter Flash Cart Aficionado
    Member

    Joined:
    Mar 26, 2008
    Messages:
    1,907
    Country:
    United States
    All of the VC releases used a 100% unmodified ROM that matches the retail cartridge. It's quite odd actually, they applied a ton of patches to the games to make the wireless trading work, but the ROM files themselves are the same as what we've had for years, all the custom stuff is done via patches. Even the Jynx censorship in Yellow is done in a patch and not editing the ROM.

    So yes, the emulator used in Game Boy VC does both GB and GBC, it's the same exact emulator used in both, I mentioned this a bit in my original post from 2016. All it's doing is checking 0x143 and if it's 0x80 or 0xC0 it disables the palette-switcher and uses GBC mode. If it's 0x00 (like Pokémon Red and Blue), it starts up in greyscale mode and lets you switch to the ugly green mode.

    As far as Yellow and being a hack of SGB... I just came across this thread at ProjectPokémon and the OP mentions something similar. Whether the story is true or not (of them coming up with a hacky method to convert SGB palettes because it would be poorly received in the US), the fact is that yes, international Yellow version has both SGB palettes *and* GBC palettes, and they are basically the same thing. GBC is just brighter because of the lack of a backlight.

    I do think there's a viable solution in modifying the actual ROM files and putting colors in there, but for games that predate the SGB (like, Tetris and all the older ones... Mario Land 1 and 2, etc) it's a bit overkill to change the ROM when you can simply edit the colors in the .ini file. Just need to figure out how to do the different layers
     
  12. AleronIves

    AleronIves Advanced Member
    Newcomer

    Joined:
    Nov 17, 2016
    Messages:
    83
    Country:
    United States
    It's not odd at all. Changing a ROM is a huge pain, so using patches is the preferred way to avoid having to rebuild the ROM. Most commercial emulators work this way today, AFAIK.

    It doesn't matter if it's a "hack" or not. Game Freak added GBC palettes to Yellow that look the same as SGB mode, but Red/Blue are SGB only, and Nintendo's DMG emulator does not support SGB features. Judging by his codebase, making the SGB palettes readable by GBC required tons of new code. He managed to backport the feature to Red and Blue, but it wasn't easy at all.

    Yes, the golf game doesn't use SA-1, so Nintendo put it on 3DS. The SA-1 Kirby games only came out on the Wii U's VC. It's just sad, because N3DS is more than fast enough to emulate SA-1 games, but Nintendo didn't bother to write a good enough emulator to do it on 3DS, so we have to rely on homebrew, just like we do for SGB support.
     
    Last edited by AleronIves, May 19, 2021
Draft saved Draft deleted
Loading...

Hide similar threads Similar threads with keywords - Emulator, Editing, Colors