Gameboy Development Forum

Discussion about software development for the old-school Gameboys, ranging from the "Gray brick" to Gameboy Color
(Launched in 2008)

You are not logged in.

Ads

#1 2019-02-05 20:00:50

mlhope
New member
Registered: 2019-02-04
Posts: 2

Game Boy Tile Designer sprite data corruption(?) (ZGB/GBDK)

Hey everyone,

Just getting started with homebrew. I decided to start prototyping with ZGB which has been great for iteration.

I hit a problem, however, this morning when I mis-clicked and overwrote the wrong Sprite *.c file with Tile Designer.
Basically, I meant to overwrite filenameA.c, but accidentally overwrote filenameB.c With filenameA's properties (label, etc).

This resulted in scrambled tiles (no discernible pattern resembling the .gbr work file) when I built the rom,
but even after correcting the resources (replacing filenameB.c and filenameB.h with correct data from GBTD, and a clean re-export of all filenameA's C resources), the result is the same.

I've also tried the following:
- running clean.bat and rebuilding
- deleting the Release and bin directories and rebuilding
- any combination of the above

And the result remains the same.

One thing I noticed was the following output after starting from scratch with the rsc directory (note that cyrus_sprite.b3.c == 'filenameA.c' in my example above):

==========

D:\Projects\GBDev\tutorials\zgb-tut>cd src

D:\Projects\GBDev\tutorials\zgb-tut\src>D:\Projects\GBDev\ZGB\common\..\env\make-3.81-bin\bin\make run
compiling resource: ../res/src/cyrus_sprite.b3.c
sed: preserving permissions for `../res/src/sed023960': Permission denied
compiling D:/Projects/GBDev/ZGB/common/src/ZGBMain_Init.c
compiling StateGame.c
compiling ZGBMain.c
Linking
D:/Projects/GBDev/ZGB/common/../env/gbdk/bin/lcc -Wl-yt1 -Wl-yo4 -o ../Release/ZGB_TEMPLATE.gb ../Release/res/cyrus.b3.o ../Release/res/cyrus_sprite.b3.o ../Release/res/font.b3.o ../Release/res/map.b3.o ../Release/res/player.b3.o ../Release/res/tiles.b3.o  ../Release/zgb/__sdcc_call_hl.o ../Release/zgb/div.o ../Release/zgb/gbt_player.o ../Release/zgb/gbt_player_bank1.o ../Release/zgb/mul.o ../Release/zgb/_memcpy.o ../Release/zgb/BankManager.o ../Release/zgb/Fade.o ../Release/zgb/Fade_b.o ../Release/zgb/Frame.o ../Release/zgb/Frame_b.o ../Release/zgb/Keys.o ../Release/zgb/main.o ../Release/zgb/Math.o ../Release/zgb/OAMManager.o ../Release/zgb/Print.o ../Release/zgb/Scroll.o ../Release/zgb/Sound.o ../Release/zgb/Sprite.o ../Release/zgb/SpriteManager.o ../Release/zgb/Stack.o ../Release/zgb/Vector.o ../Release/zgb/ZGBMain_Init.o   ../Release/SpritePlayer.o ../Release/StateGame.o ../Release/ZGBMain.o
mv ../Release/ZGB_TEMPLATE.gb ../bin/ZGB_TEMPLATE.gb
Running ../bin/ZGB_TEMPLATE.gb
=========

The 'sed' line (in red with permissions errors stood out to me. I'm wondering if:

1. The permissions error might be the cause.
2. If anyone has encountered this (sprite corruption) before

I should note that I haven't validated the tile array's values to see if Tile Designer was able to even output the correct data. I also haven't attempted repro in another project. But if anyone has some ideas in the meantime your advice would be greatly appreciated. My next step after work is to somehow  check if it's Tile Designer's output or that is incorrect or if it's happening at build. If anyone can suggest how to validate the sprite's char array, that would be a big help too. Also, it's probably obvious from my post that I am a C novice, so let me know what additional info might be helpful to post.

Thanks in advance!

Last edited by mlhope (2019-02-06 06:45:28)

Offline

 

#2 2019-02-06 08:40:46

mlhope
New member
Registered: 2019-02-04
Posts: 2

Re: Game Boy Tile Designer sprite data corruption(?) (ZGB/GBDK)

Well, I did indeed have a permissions / ownership issue throughout my drive, but this wasn't the cause of the sprite "garbage" issue. I had unwittingly changed the third parameter in the LoadSprite method from OAMManager.h. Took me some searching but turns out that's the bank number.

Don't change params you don't understand: lesson learned. tongue

I'll be committing more time to undertanding a bit more of what ZGB is doing under the hood from now on.

Cheers.

Offline

 

Board footer

Powered by PunBB
© Copyright 2002–2005 Rickard Andersson