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.

Beginners > Corrupting Sprite Info?

#26192 - ldlework - Thu Sep 09, 2004 9:18 am

Okay, I have followed the Pern Project, GBAJunkie, every tutorial under the sun, I have converted my image with every converter I can find, gfx2gba, pcx2gba, pcx2spr, pcx2sprite, I have converted it into C Arrays, Binary files, and when I open my .gba in Visualboy... I am TIRED of seeing the same old garbled image!!!

The image is not even close to what its supposed to look like, and its even stippled, meaning instead of being drawn like a packed rectangle "||||||||" its every other line "| | | | | |" I'm including my source and image and everything here.

http://vector.ics-il.com/Sprite1D.rar

Someone please help me, I would really hate sprites to be the factor that turns me away from GBA dev....

Thanks in advance - (no pun intended hehehe)
ldle

#26211 - Miked0801 - Thu Sep 09, 2004 5:47 pm

SOunds like a 4-bit/8-bit issue. Others?

#26213 - DiscoStew - Thu Sep 09, 2004 6:07 pm

From what I got out of it, you are copying your image manually from an array of type char to a pointer of type short, which means you would be copying every byte of your image into every other byte in VRAM. I don't think VRAM can be written 1 byte at a time, so you'll need to set your array to type short. Perhaps one of those programs you used could output to a type short array instead of type char array, or cast your array in your copy sequence to type short so it will copy 2 bytes instead of 1.

Just so you can see what I mean, run your ROM in VisualBoyAdvance, open up the Memory Viewer, and look at address 03000018 (I used nm.exe to check where your image started in your elf file). That is the beginning of where your image starts. (NOTE: Because your image array was not set to const, it was copied into IWRAM, everything set with const goes into ROM) Now look at address 06010000. This is where you copied your image. The first areas are blank, but as you go down, you will see the rest of your image, except that every byte is segmented with 0s (if you are looking at it in 8-bit). That is because it is writing each byte to every least significant byte of a 2-byte short. Easily fixable.
_________________
DS - It's all about DiscoStew

#26250 - ldlework - Fri Sep 10, 2004 8:08 am

Wow, thank you so much, you helped me a lot. It was a simple matter once you told me it was size differences. Looking back at the tut, dovoto said the same thing.. guess it was just selective reading :P thanks a bunch!