gbadev.org forum archive

This is a read-only mirror of the content originally found on forum.gbadev.org (now offline), salvaged from Wayback machine copies. A new forum can be found here.

Graphics > need help with usenti sprite exporting

#178033 - Pepepuhn - Mon Aug 12, 2013 3:24 pm

Hi,

I am trying to export the following spritesheet to a .c file using usenti:
[Images not permitted - Click here to view it]

However when I run the rom in visualboy and try to display the first frame I get the following image:
[Images not permitted - Click here to view it]

These are the settings I am using:
[Images not permitted - Click here to view it]

When I only export the first frame of the spritesheet (the first 64x64 pixels) the sprite is being displayed properly:

What am I doing wrong?

#178034 - Dwedit - Mon Aug 12, 2013 3:58 pm

Make sure your sprites are correctly set in the OAM. Use 16 color mode, not 256 color mode, and check that the tile indexes are correct.
Also check using the VRAM viewer that your sprite graphics and palette are correctly loaded as well.
_________________
"We are merely sprites that dance at the beck and call of our button pressing overlord."

#178035 - Pepepuhn - Mon Aug 12, 2013 5:40 pm

I think the problem is the way I am exporting the spritesheet, because when I am exporting the following spritesheet: [Images not permitted - Click here to view it]
I get the correct result, which is this: [Images not permitted - Click here to view it]

However when I use the exported spritesheet with the multiple frames, I get this image: [Images not permitted - Click here to view it]
I didn't change anything in the code, I just switched the exported .c and .h files. Tile index is set to 0, in both examples. Because I first want to see if frame 1 is being displayed correctly, but it isn't.

Tile viewer looks like this with only one frame in spritesheet: [Images not permitted - Click here to view it]

And Tile viewer with multiple frame spritesheet:
[Images not permitted - Click here to view it]

#178037 - Dwedit - Mon Aug 12, 2013 9:55 pm

You shouldn't be seeing any junk underneath the sprite in the tile viewer, no idea where that stuff is coming from. Are you copying 4 times as many bytes as needed?

If you were copying tons of random data, you could be overwriting mirrors of VRAM with more junk.
_________________
"We are merely sprites that dance at the beck and call of our button pressing overlord."

#178038 - Pepepuhn - Mon Aug 12, 2013 11:01 pm

Quote:
Are you copying 4 times as many bytes as needed?


As it turns out, I did.

I was using this piece of code, just like in the tonc tutorial:
Code:
memcpy32(&tile_mem[4][0], fooTiles, fooTilesLen);


Using the following fixed it:
Quote:
memcpy32(&tile_mem[4][0], fooTiles, fooTilesLen/4);


As I now understand memcpy32 uses the number of items to copy, not the size in bytes.

Thank you for your help ;)