VBA-M Forums

Full Version: Changing the background/empty color
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hi everyone, and thanks for giving us the opportunity to make suggestion for VBA-M, an already great emulator Smile.

One of my hobbies is making screenshot maps of console games, a process which usually requires taking a lot of screen captures of a level, usually several times over to capture different parts like the foreground, the background, the sprites, etc.

One of the biggest problem I've encountered while mapping is that, when removing a layer like, say, the background one, it is often replaced with the color black (RGB 0,0,0) (but not always, since some games seem to use their own colors for a sort of blue-screen effect). Anyway, the problem is that black is a color often used both in sprites and in some games' actual level graphics. It therefore becomes very hard to isolate a game's specific layer; if removing the background left a unique, user-defined color in its place, you could easily remove only that color and be left with clean screenshots that could then be assembled and pasted over a similar collage of the background.

Me and a few mapping friends have been lucky to see similar options included in other emulators (specifically Gens and FCEUX) and I thus humbly suggest a similar option if it is at all feasible by VBA-M's coders. It wouldn't even need to be fancy; both of my example simply read a user-defined RGB value in the emulator's config file.

Anyway, I don't want to sound like I'm demanding anything. If you ever consider such a thing, I and others would be very grateful. Thanks for reading Smile.
I might have a look at that.

Do you have a website where you upload your creations? I'd like to have a look at them,
What (few) games I've finished mapping are posted at http://www.VGMaps.com. I've never really thought about making a site of my own, since I suck at site design and probably would suck at maintaining it too. I also start mapping way more game than I ever finish, mostly because I tend to lose interest along the way, but also because sometimes it's just too difficult or time-consuming.

I really don't want to brag, but if you're interested, here are the game I've fully mapped:

-Game Boy: Nemesis, Gradius-The Interstellar Assault, Mega Man IV, Mega Man V, The Legend Of Zelda-Oracle Of Seasons

-Game Boy Advance: NiGHTS Into Dreams-Score Attack

-NES: Battletoads & Double Dragon, Gimmick!, Gradius 2, Maniac Mansion (Famicom), The Goonies 2, Treasure Master, Ufouria

-Genesis: Castlevania Bloodlines

-PC: Legend Of Kyrandia, Hand Of Fate, Prince Of Persia, Prince Of Persia 2

I've started twice as many as that, but most of it has been abandoned or put on hold indefinitely.

One game I was eager to finish mapping was Metroid Fusion, but that "black-on-black" problem just made it too long and hard to map even a single room, so I eventually gave up in the hopes of going back to it later.

Of course, two other people finished it in the meantime, but I'm still hoping to do it myself, if only because I have different ideas on how to do it and their maps have some mistakes on them.

Anyway, thanks for the interest Smile
Wow, I didn't knew there were people creating maps of whole games. That sure brings back memories and reminds me, I probably know more of some game maps than I know about my RL environment xD

Well, I had a quick look at the Map Viewer tool and I used Ctrl+ 1-8 and I am not so sure what to do. Are you talking about the scenario, where the game itself uses black, or where some layers are removed, and even though it should logically be transparent then, it's black or something else?

Btw, do you think I should re-add the menu entries for dispalying/hiding the seperate game layers? I am sure I did this some days ago, but somehow I reverted the changes -_-"
Regarding the menu entries, I personally never used them to enable/disable layers, but they were handy in some cases to indicate whether the various layers were being displayed or not, since it was sometimes hard to tell after playing with them for a while.

As for what I'm asking for, I must first admit that I'm not entirely sure if it's VBA or the game that's the problem. Alright, let's use a practical example: layer 5 (called OBJ in VBA) is (typically I assume) the sprite layer. Let's say that I turn off every layer except that one; in many games like, say, Metroid Fusion, I would see only the various sprites over a black screen. But in Castlevania: Harmony Of Dissonance, instead of black there's usually another color, like green for the title screen or blue for the introduction story, and it's still there even if you disable all eight layers.

*checks something*

Well, what do you know? After checking with "Castlevania: Harmony Of Dissonance", it would appear that this background color that shows up even with all layers turned off is the first color in the background palette.

I don't know if the implications of this would make my request harder to implement, but in theory, you'd have to change VBA-M's behaviour so that instead of defaulting to the first background palette entry as an "empty" or "transparent" color, you'd instead employ a user-defined color. Anyway, I appreciate your continued interest Smile
Hm, ok, so you dump your things only with the screenshot feature, not with the Map or OAM dialogs?

First, you need an indication of what layers are displayed, probably something quicker than than having to open the menu every time. Maybe I can add a modeless dialog or an optional status bar for that.

Second, I have to take a look at what happens when a layer is disabled. Of course I can't display transparent in the emulator, but it might be possible to expose a transparency mask by the core, which could be used by the screenshot function to create a BMP or PNG with this mask as an alpha channel. I'm pretty sure this would greatly improve your productivity.
Regarding what layers are displayed, it's not that important (to me at least), so don't feel like you have to waste time on that.

Sometimes, I'll use the Map Browser instead of taking screenshots if, for some reason, the map in-game is affected by some color/transparency effect that can't simply be disabled with layers, or if I want to include an area that is slightly off-screen but that I know is there. But usually, I simply capture from the game while playing since it's usually easier like that.

I'll admit that I don't know anything about alpha channel mask since the program I use the most for mapping remains goold old Paint. It doesn't have many features (read: none) but has one advantage: basic map assembly can be done easier and quicker with simpler keyboard shortcuts than with Paint Shop Pro which I also have but only use for transparencies. A simple cut-and-paste with the color I want to remove selected as the background one and presto! I can put a level's foreground over the background and that's that. I've tried using PSP but it remains clumsier and less intuitive to use for basic screenshot assembly.

Paint's simplicity I guess is also it's weakness. Whatever an alpha channel mask is, Paint doesn't know what to do with it I'm sure. The "Shape Opaqueness" choice box is all you have; either you move/paste an image "as is", or else you select a color that will be removed. This is why I'm interested in being able to either change the color that VBA-M displays by default with every layer disabled (in case said color is used by the game's graphics), or instead use a color that no GB/GBC/GBA game can use based on how the palette is calculated.

A friend, Maxim, did this with Gens, and you can change the background color to an RGB value that is outside the Genesis palette as rendered by the emulator, thus removing any fear of ever unknowingly removing a single pixel from a screenshot. For example, #FF00FF as the background while Gens cannot render anything "pinkier" than #F800F8. Does that make any sense?
Ah, ok. So all of it would come down to replace all pixels that are transparent in theory with a user-definable color which will default to some 32bit value outside of the GBA's 15-bit color space. For example, pure white #ffffff isn't possible in the GBA color space IIRC. This optional hack would work best when running VBA-M in 16bit or 24/32 bit mode.

Here's the link to the tech doc: http://nocash.emubase.de/gbatek.htm#lcdcolorpalettes
Technically, that would work great, even though according to the tech doc, there's a chance that this could interfere with a game's graphics if it uses that background color. An optional hack that could be turned on and off, thus restoring the original color if wanted, would work best.
Today I tried realizing the color-changing feature with a cheat code, writing to 0x05000000 (palette RAM, first color), but even though the color actually changes as desired when looking at the palette viewer, the game does not change at all.

I would guess that the cheat code gets applied at the wrong time, so it does not affect rendering. Any other ideas?

Ah, it probably was this:
Quote:VRAM, OAM, and Palette RAM Access
These memory regions can be accessed during H-Blank or V-Blank only (unless display is disabled by Forced Blank bit in DISPCNT register).
from http://nocash.emubase.de/gbatek.htm
OK, I GOT IT Smile

SVN781: ADDED "change backdrop color" button to palette view and added corresponding hack to the core rendering engine for all graphic modes.

It works as follow: click on the new button, select color, press OK, done Tongue
If you want to revert to the default behaviour, simply click cancel instead of OK.
I can't wait to try it! Hopefully, a new compile will be available soon Smile

VoilĂ !
I'm too lazy for a proper release thread right now. Anyway, I'm awaiting your feedback!
my avatar is at the right size spacy
Fixed, mybb team added a limit to scale back avatars in threads.
I didn't have much time to really test it, but it's working great so far. It's incredible how much time I would have saved if that feature had been in VBA back when I tried mapping Castlevania: Circle Of The Moon and Metroid Fusion and had to remove almost every background by hand.
Hehe, and there was even a "backdrop" or "background" color variable in every display mode source code file Smile
Sorry for taking so long to reply, but after testing it extensively, I can say that it works really well and is really helpful. The backgrounds are replaced by the chosen color, even in the case where said background was a gradiant color.

There's a tiny little problem that isn't one really: you can chose whatever color you want, but it will still be displayed according to the GBA's palette. For example, choosing full white (255, 255, 255) will end up on the screen as (248, 248, 248). But still, just being able to choose the one you want is more than enough for me. Nothing more would be gained by going further Smile.
Reference URL's