#144116 - HyperHacker - Mon Oct 29, 2007 6:17 am
After a lot of struggling and searching around I finally managed to get both screens having a text layer and a 16-bit bitmap layer, but it involved an ugly hack in which the top 64 pixels of the bitmap are overwritten by the tilemap and character set and just get scrolled off the top of the screen. I'd like to put a second text layer (using the same character set and palettes) on each screen and a second bitmap on the main screen. I have no idea how to go about doing this.
Only 256x192 of each layer is used, so the top or bottom 64 rows of each bitmap and the top or bottom 8 rows of each text layer can get overwritten.
Right now each screen uses BG0 as text and BG3 as bitmap. Bank A is VRAM_A_MAIN_BG_0x06000000, C is VRAM_C_SUB_BG_0x06200000, everything else is unused. It looks like there should be enough VRAM left to pull this off:
Main text 1: 1.5k
Main text 2: 1.5k
Main character set: 16k
Main bitmap 1: 96k
Main bitmap 2: 96k
=211K
Sub text 1: 1.5k
Sub text 2: 1.5k
Sub character set: 16k
Sub bitmap: 96k
=115K, for a total of 326K. I could shave 16K from that if I could use the same character set for both screens, but it looks like there's no way to do that. :-/
If it's really necessary I could probably get away with only showing 8 pixels of the main screen's second bitmap at a time. It'd be a bit of a pain, though. Or I could use a single 512x256 or 256x512 bitmap and scroll it around, but that seems like it'd eat up even more VRAM.
So is this configuration possible? It sure looks like I can just use A and B for the main screen and C for the subscreen, but every time I try to change this stuff, I just break it. <_<
The idea here is the main screen has a menu on it with a background. The second bitmap gets turned on and off (actually scrolled on and off the screen) in HBlank so that it only appears behind the currently selected option, so only 8 rows of it are visible at a time. However I want to be able to choose between two different ways that this would work:
#1: The top 8 rows of the image are shown behind the selected option (like Moonshell's file list). The rest of the image is never used.
#2: Whatever 8 rows of the image line up with the selected option are displayed. (That is, if the option is at the very top of the screen, rows 0 to 7 are shown; if it's the next line, rows 8 to 15 are shown, etc.) The bitmap doesn't scroll (except to turn it on/off), just different parts of it are displayed depending which option is selected. (The reason for this is so that you can, for example, copy the background image to it, darkening it in the process, so you have a fake translucent black cursor.)
This essentially means all 256x192 of it may be displayed at one time or another. If I have to, I could simulate method 2 by using method 1 and copying 8 rows of an image from main RAM into the bitmap each frame. I fear to think how much this would slow things down though.
If you don't understand this maybe a screenshot (OK, photo <_<) would help. Main screen is the bottom. See the blue bar highlighting "BG3.BMP"? Right now it's done by turning off the bitmap and changing the background colour in HBlank, but this only allows you one colour per scanline. I want to use a bitmap layer for that instead, so I can do things like this (fake translucency by duplicating and darkening the background on the second layer), this or this. Notice all three of these would use method 2, but if you just wanted a solid image (like in the actual screenshot) you would use method 1.
Another idea that just came to mind is using sprites instead of a second bitmap. Any good?
I really have no idea what I'm doing when it comes to DS VRAM so any help is certainly appreciated. v?v;
_________________
I'm a PSP hacker now, but I still <3 DS.
Last edited by HyperHacker on Thu Nov 01, 2007 5:31 am; edited 1 time in total
Only 256x192 of each layer is used, so the top or bottom 64 rows of each bitmap and the top or bottom 8 rows of each text layer can get overwritten.
Right now each screen uses BG0 as text and BG3 as bitmap. Bank A is VRAM_A_MAIN_BG_0x06000000, C is VRAM_C_SUB_BG_0x06200000, everything else is unused. It looks like there should be enough VRAM left to pull this off:
Main text 1: 1.5k
Main text 2: 1.5k
Main character set: 16k
Main bitmap 1: 96k
Main bitmap 2: 96k
=211K
Sub text 1: 1.5k
Sub text 2: 1.5k
Sub character set: 16k
Sub bitmap: 96k
=115K, for a total of 326K. I could shave 16K from that if I could use the same character set for both screens, but it looks like there's no way to do that. :-/
If it's really necessary I could probably get away with only showing 8 pixels of the main screen's second bitmap at a time. It'd be a bit of a pain, though. Or I could use a single 512x256 or 256x512 bitmap and scroll it around, but that seems like it'd eat up even more VRAM.
So is this configuration possible? It sure looks like I can just use A and B for the main screen and C for the subscreen, but every time I try to change this stuff, I just break it. <_<
The idea here is the main screen has a menu on it with a background. The second bitmap gets turned on and off (actually scrolled on and off the screen) in HBlank so that it only appears behind the currently selected option, so only 8 rows of it are visible at a time. However I want to be able to choose between two different ways that this would work:
#1: The top 8 rows of the image are shown behind the selected option (like Moonshell's file list). The rest of the image is never used.
#2: Whatever 8 rows of the image line up with the selected option are displayed. (That is, if the option is at the very top of the screen, rows 0 to 7 are shown; if it's the next line, rows 8 to 15 are shown, etc.) The bitmap doesn't scroll (except to turn it on/off), just different parts of it are displayed depending which option is selected. (The reason for this is so that you can, for example, copy the background image to it, darkening it in the process, so you have a fake translucent black cursor.)
This essentially means all 256x192 of it may be displayed at one time or another. If I have to, I could simulate method 2 by using method 1 and copying 8 rows of an image from main RAM into the bitmap each frame. I fear to think how much this would slow things down though.
If you don't understand this maybe a screenshot (OK, photo <_<) would help. Main screen is the bottom. See the blue bar highlighting "BG3.BMP"? Right now it's done by turning off the bitmap and changing the background colour in HBlank, but this only allows you one colour per scanline. I want to use a bitmap layer for that instead, so I can do things like this (fake translucency by duplicating and darkening the background on the second layer), this or this. Notice all three of these would use method 2, but if you just wanted a solid image (like in the actual screenshot) you would use method 1.
Another idea that just came to mind is using sprites instead of a second bitmap. Any good?
I really have no idea what I'm doing when it comes to DS VRAM so any help is certainly appreciated. v?v;
_________________
I'm a PSP hacker now, but I still <3 DS.
Last edited by HyperHacker on Thu Nov 01, 2007 5:31 am; edited 1 time in total