Get ram usage data

elhobbs
Posts: 358
Joined: Thu Jul 02, 2009 1:19 pm

Re: Get ram usage data

Post by elhobbs » Sat Jun 29, 2013 2:24 am

I resized nitrofiles\stages\yoshi\yoshi from 512x512 to 128x128 and everything loads fine.

Almamu
Posts: 25
Joined: Tue Apr 07, 2009 8:45 pm

Re: Get ram usage data

Post by Almamu » Sat Jun 29, 2013 7:47 am

elhobbs wrote:I resized nitrofiles\stages\yoshi\yoshi from 512x512 to 128x128 and everything loads fine.
But it doesn't make sense. I only have those 3 graphics on VRAM. Before adding this to my engine I tested it first on a separate project and it worked without any problem (see attachment). The only difference between it and my game is that my game loads it from NitroFS instead of having the file stored as an array in .data...

EDIT: Oh, found why It worked on example but not on my game. NE_InitDual3D() behaves different that NE_Init3D() so one allocates less space for VRAM than the other...
Attachments
Sprites.rar
Example
(203.06 KiB) Downloaded 444 times

elhobbs
Posts: 358
Joined: Thu Jul 02, 2009 1:19 pm

Re: Get ram usage data

Post by elhobbs » Sat Jun 29, 2013 12:46 pm

The 512x512 background was being loaded as a 16bit image in VRAM. That by itself uses all of the VRAM the ds has available. It think the ne lib uses some of that VRAM for tracking allocations. So I do not think it would even fit by itself. In any case it leaves you with no place to load anything else.

Almamu
Posts: 25
Joined: Tue Apr 07, 2009 8:45 pm

Re: Get ram usage data

Post by Almamu » Sun Jun 30, 2013 6:40 pm

Meh... Then, any idea/suggestion how I should do the graphics? I dont know how to directly work with the DS hardware, I've always used a lib for that (like NFlib, PAlib or NitroEngine).

I've though about create a somewhat optimized tileset of the background and do like PoKéMoN for GBA did (have a background a bit bigger than the screen and copy tiles over from the RAM) and switch back to sprites, could it be the best way?

elhobbs
Posts: 358
Joined: Thu Jul 02, 2009 1:19 pm

Re: Get ram usage data

Post by elhobbs » Mon Jul 01, 2013 1:42 am

I am not saying that there is anything wrong with nflib. I am only pointing out that the assets you are trying to use are not particularly suited to the ds. keep in mind the ds screen resolution is 256x192 so you do not really need huge images. also you should probably look at 8bit or even 4bit textures rather than 16bit textures. 16bit images require twice as much vram as 8bit images.

you may also want to take a look at libgl2d. there is a link on the portal page or just search the forum.

Almamu
Posts: 25
Joined: Tue Apr 07, 2009 8:45 pm

Re: Get ram usage data

Post by Almamu » Tue Jul 02, 2013 10:05 pm

elhobbs wrote:I am not saying that there is anything wrong with nflib. I am only pointing out that the assets you are trying to use are not particularly suited to the ds. keep in mind the ds screen resolution is 256x192 so you do not really need huge images. also you should probably look at 8bit or even 4bit textures rather than 16bit textures. 16bit images require twice as much vram as 8bit images.

you may also want to take a look at libgl2d. there is a link on the portal page or just search the forum.
I've just changed the textures to 8bits (and indexed 'em as required by NitroEngine), now it loads just fine, but still has some weird problem.
As you've seen the game loads 3 textures: background and two characters (which are just a white sprite with a small magenta box), now the problem is: the character's textures displayed by the DS and the emulator are just a magenta box of 32x32. I've added support for palettes as required by NitroEngine. This time NitroEngine doesn't throw any error so I'm lost once again...
Image

elhobbs
Posts: 358
Joined: Thu Jul 02, 2009 1:19 pm

Re: Get ram usage data

Post by elhobbs » Wed Jul 03, 2013 12:38 am

Sounds like a palette issue. The original images load fine for me. Try a different image with more colors and details and see if you get something recognizable. Also try it out in desmume use the VRAM tools to see if the images are loaded correctly.

Almamu
Posts: 25
Joined: Tue Apr 07, 2009 8:45 pm

Re: Get ram usage data

Post by Almamu » Wed Jul 03, 2013 12:56 am

elhobbs wrote:Sounds like a palette issue. The original images load fine for me. Try a different image with more colors and details and see if you get something recognizable. Also try it out in desmume use the VRAM tools to see if the images are loaded correctly.
The palette loads fine, I can see it in the palette viewer. I've tried with a different sprite and the result is the same. The sprite is all one color (the first color in the palette). When debugging it with Desmume (I always use No$GBA's debugger) I noticed 2 messages:
Reading beyond end of cart! ... 0009441C >= 0009441C
Tried to reference unmapped texture memory: slot 2

Probably some code is doing what Its not supposed to and corrupting memory, the thing that annoys me is that the libnds exception handler doesn't get fired even on real hardware.

elhobbs
Posts: 358
Joined: Thu Jul 02, 2009 1:19 pm

Re: Get ram usage data

Post by elhobbs » Wed Jul 03, 2013 3:01 am

I think the first issue is just a symptom of using nitrofs which appends the data to the rom. The second issue is more likely the problem. That it is complaining about the second texture slot which is not displaying correctly sounds like it is the issue. This can also be a false positive if you use the texture prior to it being loaded in VRAM. Say if you glflush then load the textures.

To be clear I compiled your code after resizing the 512x512 image to 128x128 and everything displayed correctly. Including the pink dot player image. Also I meant for you to check that both the palette and the image loaded correctly.

Is the pink dot supposed to be on a transparent background or solid. You may want to try turning on palette 0 transparency and see what you get. This is also why I suggested a different image with more color and detail.

Almamu
Posts: 25
Joined: Tue Apr 07, 2009 8:45 pm

Re: Get ram usage data

Post by Almamu » Wed Jul 03, 2013 3:17 am

elhobbs wrote:I think the first issue is just a symptom of using nitrofs which appends the data to the rom. The second issue is more likely the problem. That it is complaining about the second texture slot which is not displaying correctly sounds like it is the issue. This can also be a false positive if you use the texture prior to it being loaded in VRAM. Say if you glflush then load the textures.

To be clear I compiled your code after resizing the 512x512 image to 128x128 and everything displayed correctly. Including the pink dot player image. Also I meant for you to check that both the palette and the image loaded correctly.

Is the pink dot supposed to be on a transparent background or solid. You may want to try turning on palette 0 transparency and see what you get. This is also why I suggested a different image with more color and detail.
The second issue is written into the console a lot of times (probably more than once per frame)

I still need the stage/yoshi/yoshi image to be 512x512 as its the game background and I do not want it to look weird, so i changed the function to load images to NE_FATMaterialTexLoadBMPtoRGB256 as its used to load 8bit textures, this way the big image fits in VRAM with all the sprites.

I already tried the transparency thing, the result is no sprites displayed (as first color in the palette is used as transparent color).
It should display a white box and a small transparent rectangle in the middle, but anyway, even with more complex sprites the result is the same, a box of 32x32 with just one color (the first in the palette).

EDIT: Nevermind, just fixed it. Once again the big texture was the issue. Resized it to 256x256 and everything seems to work fine. It looks a bit crappy when resized to 512x512 but I'll keep it as It doesnt really look bad at all.

Really, Thanks you very much. If I finish this homebrew I'll include you in the credits ^^

Post Reply

Who is online

Users browsing this forum: No registered users and 17 guests