Backbuffer Color
Moderator: ZSNES Mods
-
- Rookie
- Posts: 17
- Joined: Tue Jul 11, 2006 4:56 pm
Backbuffer Color
Is there any way to change the backbuffer clear color? That is to say, is there any way to change the color of the screen when some layers are disabled? Right now, it defaults to black. But what if we wanted purple or something, as a way to grab graphics from a game, already properly rendered with the proper palette and so forth.
Any help would be appreciated.
Any help would be appreciated.
-
- Seen it all
- Posts: 2302
- Joined: Mon Jan 03, 2005 5:04 pm
- Location: Germany
- Contact:
This should be possible... though it would decrease performance (very slightly), and code has to be added to use the color value from the config file / command line / GUI.
For few graphics you can use savestate viewers - see my sig.
For few graphics you can use savestate viewers - see my sig.
vSNES | Delphi 10 BPLs
bsnes launcher with recent files list
bsnes launcher with recent files list
-
- Rookie
- Posts: 17
- Joined: Tue Jul 11, 2006 4:56 pm
I'll check that out.
But, uhm, well, the back buffer needs to be cleared to some color, no matter what. Otherwise, if you'd play the game with just the sprite layer on, you'd see really neat (but weird) effects. The amount of time it takes to clear to black is the same amount of time it would take to clear to purple. At least, when using DirectX for the Windows port.
But, uhm, well, the back buffer needs to be cleared to some color, no matter what. Otherwise, if you'd play the game with just the sprite layer on, you'd see really neat (but weird) effects. The amount of time it takes to clear to black is the same amount of time it would take to clear to purple. At least, when using DirectX for the Windows port.
-
- Seen it all
- Posts: 2302
- Joined: Mon Jan 03, 2005 5:04 pm
- Location: Germany
- Contact:
I don't know much about DirectX, but the ZSNES code probably uses a function call like "ClearSurface(0)", ie. the compiler inserts a constant (null). The modification would replace the constant with a variable reference, which is a tiny bit slower. I don't think you'd see a difference.PhoenixX_2 wrote:But, uhm, well, the back buffer needs to be cleared to some color, no matter what. Otherwise, if you'd play the game with just the sprite layer on, you'd see really neat (but weird) effects. The amount of time it takes to clear to black is the same amount of time it would take to clear to purple. At least, when using DirectX for the Windows port.

vSNES | Delphi 10 BPLs
bsnes launcher with recent files list
bsnes launcher with recent files list
-
- Devil's Advocate
- Posts: 2293
- Joined: Mon Aug 02, 2004 7:51 pm
- Location: Hmo. Son.
-
- Rookie
- Posts: 17
- Joined: Tue Jul 11, 2006 4:56 pm
Hehe, yeah. Using a varibale instead of a constant is slower, slightly. But, have you been able to compile zsnes? I'm currently having trouble. But, would you be able to make me a mod, possibly
?
I did try the state viewer. It's good I can change the background that way. This seems to be a possible solution. But to grab an animation, I'd have to make some 5 save states
.

I did try the state viewer. It's good I can change the background that way. This seems to be a possible solution. But to grab an animation, I'd have to make some 5 save states

-
- Seen it all
- Posts: 2302
- Joined: Mon Jan 03, 2005 5:04 pm
- Location: Germany
- Contact:
re: mod
I would; I've never written or edited a C/C++ program though. There are other reasons as well.
Maybe devs like Poobah would do it.
I would; I've never written or edited a C/C++ program though. There are other reasons as well.
Maybe devs like Poobah would do it.

vSNES | Delphi 10 BPLs
bsnes launcher with recent files list
bsnes launcher with recent files list
-
- Rookie
- Posts: 17
- Joined: Tue Jul 11, 2006 4:56 pm
-
- Seen it all
- Posts: 2302
- Joined: Mon Jan 03, 2005 5:04 pm
- Location: Germany
- Contact:
-
- Seen it all
- Posts: 2302
- Joined: Mon Jan 03, 2005 5:04 pm
- Location: Germany
- Contact:
-
- ZSNES Developer
- Posts: 3904
- Joined: Tue Jul 27, 2004 10:54 pm
- Location: Solar powered park bench
- Contact:
If you use Windows and want to build ZSNES yourself, download zget. Search forums for more info.
May 9 2007 - NSRT 3.4, now with lots of hashing and even more accurate information! Go download it.
_____________
Insane Coding
_____________
Insane Coding
-
- Rookie
- Posts: 17
- Joined: Tue Jul 11, 2006 4:56 pm
Reading all your posts I'm sure I'm getting something wrong, but I thought the background color was determined by the game? Running donkey kong country 2 for example, it will be different for levels, menus etc.
[size=75][b]Procrastination.[/b]
Hard Work Often Pays Off After Time, but Laziness Always Pays Off Now.[/size]
Hard Work Often Pays Off After Time, but Laziness Always Pays Off Now.[/size]
-
- Seen it all
- Posts: 2302
- Joined: Mon Jan 03, 2005 5:04 pm
- Location: Germany
- Contact:
blackmyst is right though, games can change that backdrop color via writes to $2132. (For gfx ripping, HDMA should be disabled. I think there's a key for that.)
I was probably wrong with the "ClearSurface(0)" call - I guess ZSNES just skips the disabled layers when rendering the screen. The backdrop color would still get set, so no additional clearing is needed to erase the previous screen content.
The code modification would have to always use the user-selected color for backdrop, not the SNES value at $2132.
I was probably wrong with the "ClearSurface(0)" call - I guess ZSNES just skips the disabled layers when rendering the screen. The backdrop color would still get set, so no additional clearing is needed to erase the previous screen content.
The code modification would have to always use the user-selected color for backdrop, not the SNES value at $2132.
vSNES | Delphi 10 BPLs
bsnes launcher with recent files list
bsnes launcher with recent files list
-
- Rookie
- Posts: 17
- Joined: Tue Jul 11, 2006 4:56 pm
-
- ZSNES Developer
- Posts: 6747
- Joined: Tue Dec 28, 2004 6:47 am
The only thing that may be of some use would be the Palette0 option that is used in the DOS port. By default (it wasn't in earlier versions), ZSNES colors the background black when using an 8-bit rendering mode. When disabled, the background color changes to other colors... This might be something worth looking at as a start.creaothceann wrote:blackmyst is right though, games can change that backdrop color via writes to $2132. (For gfx ripping, HDMA should be disabled. I think there's a key for that.)
I was probably wrong with the "ClearSurface(0)" call - I guess ZSNES just skips the disabled layers when rendering the screen. The backdrop color would still get set, so no additional clearing is needed to erase the previous screen content.
The code modification would have to always use the user-selected color for backdrop, not the SNES value at $2132.
Continuing [url=http://slickproductions.org/forum/index.php?board=13.0]FF4[/url] Research...
-
- Seen it all
- Posts: 2302
- Joined: Mon Jan 03, 2005 5:04 pm
- Location: Germany
- Contact:
Glad to hear that. Have you checked romhacking.net if there's something about that game? Anyway, good luck!PhoenixX_2 wrote:But yeah, vSNES is kinda solving every problem for me. Though, I WISH someone had hacked into Soulblazer before, instead of me having to do it.
Yeah, the whole monitor background is filled by color 0 of the VGA palette, which ZSNES probably was setting to the SNES backdrop color. This could also be modified to support the user's selected color - but 8-bit screenshots save the palette, and for a few pics you can change color 0 in an image editor like PaintShop Pro.Deathlike2 wrote:The only thing that may be of some use would be the Palette0 option that is used in the DOS port. By default (it wasn't in earlier versions), ZSNES colors the background black when using an 8-bit rendering mode. When disabled, the background color changes to other colors... This might be something worth looking at as a start.
vSNES | Delphi 10 BPLs
bsnes launcher with recent files list
bsnes launcher with recent files list
-
- Rookie
- Posts: 17
- Joined: Tue Jul 11, 2006 4:56 pm
Could I request a feature for vSNES
? Something that grabs the tiles from a specific BG and puts it into a bmp? Because right now, I will have to manually go through each palette and export the VRAM and figure out which palette was meant for each tile.
I mean, it's not a big deal, nor something I'll probably wait for, unless you can do it super quickly. But I'd imagine it'd be pretty useful for others too
.

I mean, it's not a big deal, nor something I'll probably wait for, unless you can do it super quickly. But I'd imagine it'd be pretty useful for others too

-
- Seen it all
- Posts: 2302
- Joined: Mon Jan 03, 2005 5:04 pm
- Location: Germany
- Contact:
That's a bit difficult since a gfx tile might be used by several layers, and each layer could use it several times with a different palette. I (almost) only do the stuff that requires no guesswork.
You can use BGMAPPER (the inspiration for vSNES); it tries to color the VRAM tiles. It'll not be perfect in every case, but maybe it saves some work.
Btw. the tiles of the current scene are visible in the SceneViewer... does that help?
You can use BGMAPPER (the inspiration for vSNES); it tries to color the VRAM tiles. It'll not be perfect in every case, but maybe it saves some work.
Btw. the tiles of the current scene are visible in the SceneViewer... does that help?
vSNES | Delphi 10 BPLs
bsnes launcher with recent files list
bsnes launcher with recent files list
-
- Rookie
- Posts: 17
- Joined: Tue Jul 11, 2006 4:56 pm
That's what I mean, it'd take a specific BG and grab the tiles with the appropriate palette. So say a specific BG had four diamonds, using the same tile (using four different palettes). It'd grab those four diamonds in each of their form, and put them into a file. So you'd have a table:
Tile | Palette
And each time you see a tile/palette tuple, you'd add it to the bitmap.
I definately do not mean have it automatically figure out each tile and how it could be used. I just mean from a specific state, it forms a tile-set based purely on the BG and how IT used it.
Just an idea.
Tile | Palette
And each time you see a tile/palette tuple, you'd add it to the bitmap.
I definately do not mean have it automatically figure out each tile and how it could be used. I just mean from a specific state, it forms a tile-set based purely on the BG and how IT used it.
Just an idea.
-
- Seen it all
- Posts: 2302
- Joined: Mon Jan 03, 2005 5:04 pm
- Location: Germany
- Contact:
Well, I won't be able to change vSNES or write a new tool, since the source and the compiler is inaccessible to me right now.
(Not for others though.)
But anyway:
How exactly is this "grabbing" meant? Do you mean creating a text file with the tile / palette indices, or creating a new bitmap?
It would not be hard IMO to create a C/C++ program that opens a ZSNES savestate, reads VRAM, some registers (which could also be entered manually) and the palette, and iterates through the tilemaps. You could take the savestate format from vSNES' source or romhacking.net.

But anyway:
How exactly is this "grabbing" meant? Do you mean creating a text file with the tile / palette indices, or creating a new bitmap?
It would not be hard IMO to create a C/C++ program that opens a ZSNES savestate, reads VRAM, some registers (which could also be entered manually) and the palette, and iterates through the tilemaps. You could take the savestate format from vSNES' source or romhacking.net.
vSNES | Delphi 10 BPLs
bsnes launcher with recent files list
bsnes launcher with recent files list
I was gonna say do a par code for the bg color register but it doesn't work. it pry has to be written to for it to update. in which case you could learn a little asm while you're at it, and pry put a write in the vblank. it'd be like a 2 byte rom hack.
[url=http://www.alexchiu.com/affiliates/clickthru.cgi?id=phonymike]ultimate immortality[/url]
[url=http://www.sloganizer.net/en/][img]http://www.sloganizer.net/en/image,zsnes,white,purple.png[/img][/url]
[url=http://www.sloganizer.net/en/][img]http://www.sloganizer.net/en/image,zsnes,white,purple.png[/img][/url]