Elf Image

Discuss the development of software, tools, libraries and anything else that helps make ps2dev happen.

Moderators: cheriff, Herben

Post Reply
ninjallo
Posts: 5
Joined: Mon Sep 08, 2008 6:10 am

Elf Image

Post by ninjallo »

i have this file that is for a logo i dont want this logo and i want to replace it with my own only problem is i dont kno how to change it from what my main.c says it sa gif but its in bytes in the logo.c file here's a link to the logo.c cna someone help me or direct em to somethign that i can use to make my logo http://www.zipperadmins.com/logo.c

i also kno that the logo fiel is in rgb array i cant find anythgin or kno how to amke anythign to convert an image to the rgb array liek that

here's what the stuff isnide teh main.c shows to load for it

Code: Select all

void DrawSplashLogo()
{
	PACKET packet;

	int x, y, i, r, g, b;

	dma_initialize();
	graph_initialize();
	packet_allocate(&packet, 1024);
	graph_set_mode(GRAPH_MODE_AUTO, GRAPH_PSM_32, GRAPH_PSM_32);
	graph_set_displaybuffer(0);
	graph_set_drawbuffer(0);
	graph_set_zbuffer(graph_get_width() * graph_get_height() * (graph_get_bpp() >> 3));

	graph_set_clearbuffer(0, 0, 0);

	graph_wait_vsync();

	i = 0;

	for &#40;x = 0; x < 600; x += 1&#41;
	&#123;
		for &#40;y = 0; y < 100; y += 1&#41;
		&#123;
			r = logomesh&#91;i&#93;;
			i += 1;
			g = logomesh&#91;i&#93;;
			i += 1;
			b = logomesh&#91;i&#93;;
			i += 1;

			packet_reset&#40;&packet&#41;;
			packet_append_64&#40;&packet, GIF_SET_TAG&#40;4, 1, 0, 0, 0, 1&#41;&#41;;
			packet_append_64&#40;&packet, 0x0E&#41;;
			packet_append_64&#40;&packet, GIF_SET_PRIM&#40;6, 0, 0, 0, 0, 0, 0, 0, 0&#41;&#41;;
			packet_append_64&#40;&packet, GIF_REG_PRIM&#41;;
			packet_append_64&#40;&packet, GIF_SET_RGBAQ&#40;r, g, b, 0x80, 0x3F800000&#41;&#41;;
			packet_append_64&#40;&packet, GIF_REG_RGBAQ&#41;;
			packet_append_64&#40;&packet, GIF_SET_XYZ&#40;&#40;1740 + x&#41; << 4, &#40;1990 + y&#41; << 4, 0&#41;&#41;;
			packet_append_64&#40;&packet, GIF_REG_XYZ2&#41;;
			packet_append_64&#40;&packet, GIF_SET_XYZ&#40;&#40;1740 + &#40;x + 1&#41;&#41; << 4, &#40;1990 + &#40;y + 1&#41;&#41;<< 4, 0&#41;&#41;;
			packet_append_64&#40;&packet, GIF_REG_XYZ2&#41;;
			packet_send&#40;&packet, DMA_CHANNEL_GIF, DMA_FLAG_NORMAL&#41;;
		&#125;
LBGSHI
Posts: 136
Joined: Mon Aug 07, 2006 5:56 am
Contact:

Post by LBGSHI »

No, GIF in this case stands for Graphic InterFace. What you have is likely a bitmap that was converted to a C array. This can be done by DreamTime's BMP2C tool (which can be found in the Tutorials section of this site, with DreamTime's PS2dev tutorials), and with a few other tools scattered around the net.
I may be lazy, but I can...zzzZZZzzzZZZzzz...
ninjallo
Posts: 5
Joined: Mon Sep 08, 2008 6:10 am

Post by ninjallo »

okay so i ran it but still it doesnt match what i need if u looka t ym logo.c its nothing liek what that compiles
heres a snippet of my logo.c

Code: Select all

 0, 63, 63, 63, 143, 143, 143, 223, 223, 223, 238, 238, 238, 238, 238, 238, 237, 237, 237, 238, 238, 238, 237, 237, 237, 189, 189, 189, 111, 111, 111, 16, 16, 16, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,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0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 79, 79, 79, 222, 222, 222, 238, 238, 238, 237, 237, 237, 238, 238, 238,


heres a snippet of what the bmp2c is generating

Code: Select all

uint32 __attribute__&#40;&#40;aligned&#40;16&#41;&#41;&#41; hover&#91;&#93; = &#123;
	// row 0
	0x80f8fcf8,
	0x80f8fcf8,
	0x80f8fcf8,
	0x80f8fcf8,
	0x80f8fcf8,
	0x80f8fcf8,
	0x80f8fcf8,
	0x80f8fcf8,
	0x80f8fcf8,
	0x80f8fcf8,
	0x80f8fcf8,
	0x80f8fcf8,
	0x80f8fcf8,
	0x80f8fcf8,
	0x80f8fcf8,
	0x80f8fcf8,
	0x80f8fcf8,
	0x80f8fcf8,
	0x80f8fcf8,
	0x80f8fcf8,
	0x80f8fcf8,
	0x80f8fcf8,
	0x80f8fcf8,
	0x80f8fcf8,
	0x80f8fcf8,
	0x80f8fcf8,
	0x80f8fcf8,
	0x80f8fcf8,
	0x80f8fbf8,
	0x80f7faf8,
	0x80f5faf8,
	0x80f3fbf8,
	0x80f1fcf8,
J.F.
Posts: 2906
Joined: Sun Feb 22, 2004 11:41 am

Post by J.F. »

Looking at the code above, the image should be 600x100 in raw RGB format - one byte each for Red, Green, and Blue, with no alpha channel.
ninjallo
Posts: 5
Joined: Mon Sep 08, 2008 6:10 am

Post by ninjallo »

okay so how to i convert an iamge to that i got a thign it converts to a raw but then i need to get that raw into the logo.c i need also those are tiny parts of it theirs WAY more for each
J.F.
Posts: 2906
Joined: Sun Feb 22, 2004 11:41 am

Post by J.F. »

They're storing the original data as a series of bytes (one each of red, green, blue). The conversion you did output a series of longs. In the first case, you have 600x100x3 bytes of data. In the other, you should have 600x100x3/4 ints of data.
ninjallo
Posts: 5
Joined: Mon Sep 08, 2008 6:10 am

Post by ninjallo »

so in other words i'd have to convert them with a float to get what i need correct

see i understand what it is i just need to get the iamge to convert to it and i dont kno how
J.F.
Posts: 2906
Joined: Sun Feb 22, 2004 11:41 am

Post by J.F. »

ninjallo wrote:so in other words i'd have to convert them with a float to get what i need correct

see i understand what it is i just need to get the iamge to convert to it and i dont kno how
No, that would destroy the image. You need it to save as RGB, not ARGB. Another thing you could do is to alter the code to skip the alpha channel in the data, but that's wasting space in your app, storing the A when it won't be used.
ninjallo
Posts: 5
Joined: Mon Sep 08, 2008 6:10 am

Post by ninjallo »

i got imagemajik to convert it came out kinda wierd but tis a 500x 500 pixel image i jsut need to remove all teh extra bullshit it contains so i can move it froma 9mb file down to a smaller format
J.F.
Posts: 2906
Joined: Sun Feb 22, 2004 11:41 am

Post by J.F. »

If you want to use a different resolution, don't forget to change the x/y for loops in the code. You'll also need to change the GIF_SET_XYZ commands to center the image.
cosmito
Posts: 307
Joined: Sun Mar 04, 2007 4:26 am
Location: Portugal
Contact:

Post by cosmito »

J.F. wrote:No, that would destroy the image. You need it to save as RGB, not ARGB.
Just a quick note : the order used by the GS is RGBA, not ARGB.
J.F.
Posts: 2906
Joined: Sun Feb 22, 2004 11:41 am

Post by J.F. »

cosmito wrote:
J.F. wrote:No, that would destroy the image. You need it to save as RGB, not ARGB.
Just a quick note : the order used by the GS is RGBA, not ARGB.
Yes, but look at how the routine above reads the data. He could use RGBA, but then he'd need to change the routine to match it... which is probably what he should be doing. :)
cosmito
Posts: 307
Joined: Sun Mar 04, 2007 4:26 am
Location: Portugal
Contact:

Post by cosmito »

J.F. wrote:Yes, but look at how the routine above reads the data. He could use RGBA, but then he'd need to change the routine to match it... which is probably what he should be doing. :)
I see.
Gtlcpimp
Posts: 2
Joined: Wed Sep 10, 2008 10:49 am

Post by Gtlcpimp »

ninjallo, if you want to know how it works and how to change it then you need to ask the person who made it. I would have gladly assisted you if you asked me, but now I shouldn't help you since I noticed you are trying to claim you made it all without any help on your site when in fact you took the source code I released and just changed the displaying text and claimed it's your product. I'm not trying to start a fight, but what I'm trying to say is 1) Give credit to those who you borrowed source codes from, 2) If you need help on a source your using from someone else, don't ask people who haven't used it, ask the person who made it that your using it from.
NoobWithBoobs
Posts: 23
Joined: Wed Jul 16, 2008 11:11 pm

Post by NoobWithBoobs »

so the gif_set_xyz sets the positon of the image? How do you know what the values are for top left screen,i've read it isnt 0,0.?
Gtlcpimp
Posts: 2
Joined: Wed Sep 10, 2008 10:49 am

Post by Gtlcpimp »

NoobWithBoobs wrote:so the gif_set_xyz sets the positon of the image? How do you know what the values are for top left screen,i've read it isnt 0,0.?
It works a little like this:

R = Red Value (0 to 255)
G = Greeen Value (0 to 255)
B = Blue Value (0 to 255)

X1 = First X Position
X2 = Second X Position
Y1 = First Y Position
Y2 = Second Y Position

It draws a square. You can use this to be a DrawPixel() function if you set X2 to be 1 greater than X1 and Y2 to be 1 greater than Y2. Also note, that the coordinates (0, 0) are not the top left corner of the screen for some odd reason. I found that the coordinates (1740, 1740) or (1740, 1840) are approximately the top left corner.

Code: Select all


         packet_reset&#40;&packet&#41;;
         packet_append_64&#40;&packet, GIF_SET_TAG&#40;4, 1, 0, 0, 0, 1&#41;&#41;;
         packet_append_64&#40;&packet, 0x0E&#41;;
         packet_append_64&#40;&packet, GIF_SET_PRIM&#40;6, 0, 0, 0, 0, 0, 0, 0, 0&#41;&#41;;
         packet_append_64&#40;&packet, GIF_REG_PRIM&#41;;
         packet_append_64&#40;&packet, GIF_SET_RGBAQ&#40;R, G, B, 0x80, 0x3F800000&#41;&#41;;
         packet_append_64&#40;&packet, GIF_REG_RGBAQ&#41;;
         packet_append_64&#40;&packet, GIF_SET_XYZ&#40; &#40;X1&#41; << 4, &#40;Y1&#41; << 4, 0&#41;&#41;;
         packet_append_64&#40;&packet, GIF_REG_XYZ2&#41;;
         packet_append_64&#40;&packet, GIF_SET_XYZ&#40; &#40;X2&#41; << 4, &#40;Y2&#41;<< 4, 0&#41;&#41;;
         packet_append_64&#40;&packet, GIF_REG_XYZ2&#41;;
         packet_send&#40;&packet, DMA_CHANNEL_GIF, DMA_FLAG_NORMAL&#41;; 


User avatar
jbit
Site Admin
Posts: 293
Joined: Sat May 28, 2005 3:11 am
Location: København, Danmark
Contact:

Post by jbit »

If the GS is setup to use a guard band then the top left can be [2048-(width/2), 2048-(height/2)].
So on a 640x512 screen (PAL) the top left will be 1728, 1792

This is so if you move a primitive off the screen to the top/left your values don't go below zero, then the GS can still actually attempt to draw the primitive without requiring you to do expensive clipping in your drawing code...
Post Reply