#5567 - Xenobach - Fri May 02, 2003 12:35 am
Ok I'm on Chapter 3 on the GBAJunkie tutorials and it uses a .h file for a background display.
So I wanted to use my own .h picture and change the cpp code. I've changed the code and it works fine, its just the picture thats off.
The picture is just a simple b&w defocused picture of myself that I converted into PCX and BMP format using Photoshop. I've tried using both of them but I keep getting just weird b&w lines that dont even come close to representing what I did in Photoshop.
The ms-dos line of code that I used was:
gfx2gba test.pcx test.h -t type -s 2 -z 256
Then I get my .h file but I suppose it doesn't work.
Anyone have any ideas for this newbie? If you need more info just ask. Thanx in advance. (get it? Advance?..ah forget it).
[/code]
#5600 - Xenobach - Fri May 02, 2003 8:55 pm
Geez, 26 views and no one can help me? Or even give me a hint?
Anyways I guess I'll decribe it a little more.
The picture after converted into a .h file looks like when your looking at the fuzzy television. There is all these b&w lines that just look out of place.
ANY help would be helpful.
#5601 - niltsair - Fri May 02, 2003 9:04 pm
Try aligning your data on a 32bits boundary.
I'm also having a similar problem that sometime occurs with a Slides Program i'm wokring on. The quick temp fix that worked for me, was to not use weird dimension. So, try converting a 240x160 picture as a first try.
#5611 - Xenobach - Sat May 03, 2003 7:00 am
The picture is 240x160. At 256 colors.
I'll see about the 32 bit boundry. Even though I'm not too keen on that.
#6946 - Ninj4D4n - Wed Jun 04, 2003 11:10 pm
Xeno,
What mode are you in? There are to graphics converts floating around out there. One is for tile mode (0,1, 2), one is for bitmap mode (3, 4, 5). the difference is the way that they strip the pixel data into the array. One of them just reads straight across the bmp and converts it directly to array. The other preserves the tile arangement (ie the first 32 numbers are for the first tile, the next 32 for the next tile).
It does sound like your using the correctly named program, but it sounds like its behaving like the other one. so i'm not sure if this helps at all.
also, just try dragging and dropping your pcx file ontop of the gfx2gba.exe and see if that fixes it.
--Ninj4D4n
#6959 - Quirky - Thu Jun 05, 2003 7:34 am
Xenobach wrote: |
The ms-dos line of code that I used was:
gfx2gba test.pcx test.h -t type -s 2 -z 256
Then I get my .h file but I suppose it doesn't work.
|
Which gfx2gba are you using? There are 2 programs with the same name that do different things and have different switches, make sure you use the right one.
#7681 - Xenobach - Sun Jun 22, 2003 10:16 pm
I still have no clue on how to do this. So I guess I'll provide more information so I can get some help.
I'm using the gfx2gba program created by D. Sillett and uses the command prompt to enter options.
The code I enter I have already put in one of my earlier posts.
Here is my '.h' file. It isn't like the other .h file provided by the person who made the tutorial though. And even if I do get it to be like his (w/ another program), it still doesn't work.
Here is my '.elf' file. My picture is in black and white but this just looks strange. Run the elf file in your GBA emulator and you'll see how it looks.
Here is what the img file (a bmp made in photoshop) looks like: [Images not permitted - Click here to view it]
It is a 256 color (I don't know why...it just came that way) bmp pic as is a 240 x 160.
Any help or any questions at all (anything will help) would be greatly appreciated. Thank you in advance.[/url][/code]
#7709 - djei-dot - Mon Jun 23, 2003 11:21 am
The picture looks OK to me. I'm pretty sure the problem is in your code. Could you show us a snippet of it? (I didn't find it in your last posts - I'm not talking about the gfx2gba prompt).
#7744 - Xenobach - Mon Jun 23, 2003 9:15 pm
Code: |
#include "gba.h" //GBA register definitions
#include "dispcnt.h" //REG_DISPCNT register definitions
#include "test.h" //holds the image information in an array
void PlotPixel(int x,int y, unsigned short int c)
{
VideoBuffer[(y) * 120 + (x)] = (c);
}
int main()
{
int loop;
int x, y;
SetMode(MODE_4 | BG2_ENABLE); //set mode 4 and enable background 2
for(loop = 0; loop < 256; loop++) //256 entries allowed
BGPaletteMem[loop] = testPalette[loop]; //load the palette into palette memory
while(1)
{
for(y = 0; y < 160; y++) //screen height
{
for(x = 0; x < 120; x++) //screen width
{
PlotPixel(x,y, testData[y*120+x]); //load image data into
} //memory pixel by pixel
}
}
}
|
Last edited by Xenobach on Mon Jun 23, 2003 9:18 pm; edited 1 time in total
#7745 - Xenobach - Mon Jun 23, 2003 9:17 pm
I dont think it is the code though since every other picture that has been turned into a .h file (provided by other sources or as a example) works just fine.
I'm pretty sure its the picture or my misuse of gfx2gba. I'm trying to use the pcx2gba program but I can't get it to work.
Thanx for any help.
#7769 - djei-dot - Tue Jun 24, 2003 11:58 am
OK I got your problem.
Your gfx2gba instruction uses the -z option, which turns your picture into sprites/tiles. You don't need tiles in bitmap modes (3-5), so you have to remove that option. The correct gfx2gba instruction would be:
Code: |
gfx2gba test.pcx test.h -8 -s 2 |
The -8 option is to output in Mode 4 format (modes 3 and 5 use -16). Also, you don't need the -t type, because the -s 2 sets the default type. The output of this instruction should work now and should be the same as the output from pcx2gba.
#7792 - Xenobach - Tue Jun 24, 2003 7:00 pm
I grovel at your feet djei-dot. Thanx alot (cause it worked).
Now I can finally move on.
I can't say thanx enough but I'll try:
thanx, thanx, thanx, thanx...(+ 1000.)
Anyways one final one: Thank you very much djei-dot. I'm glad people like you are here in this community.
#7794 - sgeos - Tue Jun 24, 2003 8:08 pm
Xenobach wrote: |
thanx, thanx, thanx, thanx...(+ 1000.) |
You could have said something like:
Code: |
int ctr;
for (ctr = 0; ctr < 65535; ctr++)
printf("thanx\n");
|
Or even:
Code: |
while (1)
printf("thanx\n");
|
-Brendan
#7797 - Xenobach - Tue Jun 24, 2003 9:21 pm
I'm not a big fan of talking in code.
Too geekish.
#7800 - Cyberman - Wed Jun 25, 2003 12:36 am
Xenobach wrote: |
I'm not a big fan of talking in code.
Too geekish. |
Then you should stop posting in GBA dev? ;)
Really I'm not sure talking C/C++ code is the same as biting chicken's heads off as a carnival performer.
Cyb - my 2 cents :)
#7804 - Xenobach - Wed Jun 25, 2003 3:03 am
Ha. I'm not sure what a carnival chicken-head eater has anything to do with "geekish" but I'll take that into consideration.
Hey Cyberman, I wanted a penny for your thoughts and you gave me your two cents. So do ya want your cent back? ;)