forums.ps2dev.org Forum Index forums.ps2dev.org
Homebrew PS2, PSP & PS3 Development Discussions
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Elf Image

 
Post new topic   Reply to topic    forums.ps2dev.org Forum Index -> PS2 Development
View previous topic :: View next topic  
Author Message
ninjallo



Joined: 08 Sep 2008
Posts: 5

PostPosted: Mon Sep 08, 2008 6:15 am    Post subject: Elf Image Reply with quote

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:
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 (x = 0; x < 600; x += 1)
   {
      for (y = 0; y < 100; y += 1)
      {
         r = logomesh[i];
         i += 1;
         g = logomesh[i];
         i += 1;
         b = logomesh[i];
         i += 1;

         packet_reset(&packet);
         packet_append_64(&packet, GIF_SET_TAG(4, 1, 0, 0, 0, 1));
         packet_append_64(&packet, 0x0E);
         packet_append_64(&packet, GIF_SET_PRIM(6, 0, 0, 0, 0, 0, 0, 0, 0));
         packet_append_64(&packet, GIF_REG_PRIM);
         packet_append_64(&packet, GIF_SET_RGBAQ(r, g, b, 0x80, 0x3F800000));
         packet_append_64(&packet, GIF_REG_RGBAQ);
         packet_append_64(&packet, GIF_SET_XYZ((1740 + x) << 4, (1990 + y) << 4, 0));
         packet_append_64(&packet, GIF_REG_XYZ2);
         packet_append_64(&packet, GIF_SET_XYZ((1740 + (x + 1)) << 4, (1990 + (y + 1))<< 4, 0));
         packet_append_64(&packet, GIF_REG_XYZ2);
         packet_send(&packet, DMA_CHANNEL_GIF, DMA_FLAG_NORMAL);
      }
Back to top
View user's profile Send private message
LBGSHI



Joined: 07 Aug 2006
Posts: 136

PostPosted: Mon Sep 08, 2008 10:57 am    Post subject: Reply with quote

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...
Back to top
View user's profile Send private message Visit poster's website AIM Address Yahoo Messenger MSN Messenger
ninjallo



Joined: 08 Sep 2008
Posts: 5

PostPosted: Mon Sep 08, 2008 11:01 am    Post subject: Reply with quote

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:
 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,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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, 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:
uint32 __attribute__((aligned(16))) hover[] = {
   // 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,
Back to top
View user's profile Send private message
J.F.



Joined: 22 Feb 2004
Posts: 2906

PostPosted: Mon Sep 08, 2008 11:58 am    Post subject: Reply with quote

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.
Back to top
View user's profile Send private message AIM Address
ninjallo



Joined: 08 Sep 2008
Posts: 5

PostPosted: Mon Sep 08, 2008 12:06 pm    Post subject: Reply with quote

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
Back to top
View user's profile Send private message
J.F.



Joined: 22 Feb 2004
Posts: 2906

PostPosted: Mon Sep 08, 2008 12:17 pm    Post subject: Reply with quote

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.
Back to top
View user's profile Send private message AIM Address
ninjallo



Joined: 08 Sep 2008
Posts: 5

PostPosted: Mon Sep 08, 2008 12:21 pm    Post subject: Reply with quote

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
Back to top
View user's profile Send private message
J.F.



Joined: 22 Feb 2004
Posts: 2906

PostPosted: Mon Sep 08, 2008 2:58 pm    Post subject: Reply with quote

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.
Back to top
View user's profile Send private message AIM Address
ninjallo



Joined: 08 Sep 2008
Posts: 5

PostPosted: Mon Sep 08, 2008 3:14 pm    Post subject: Reply with quote

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
Back to top
View user's profile Send private message
J.F.



Joined: 22 Feb 2004
Posts: 2906

PostPosted: Mon Sep 08, 2008 4:31 pm    Post subject: Reply with quote

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.
Back to top
View user's profile Send private message AIM Address
cosmito



Joined: 04 Mar 2007
Posts: 314
Location: Portugal

PostPosted: Mon Sep 08, 2008 11:10 pm    Post subject: Reply with quote

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.
Back to top
View user's profile Send private message Visit poster's website
J.F.



Joined: 22 Feb 2004
Posts: 2906

PostPosted: Tue Sep 09, 2008 7:31 am    Post subject: Reply with quote

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. :)
Back to top
View user's profile Send private message AIM Address
cosmito



Joined: 04 Mar 2007
Posts: 314
Location: Portugal

PostPosted: Tue Sep 09, 2008 8:17 am    Post subject: Reply with quote

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.
Back to top
View user's profile Send private message Visit poster's website
Gtlcpimp



Joined: 10 Sep 2008
Posts: 2

PostPosted: Wed Sep 10, 2008 11:09 am    Post subject: Reply with quote

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.
Back to top
View user's profile Send private message
NoobWithBoobs



Joined: 16 Jul 2008
Posts: 23

PostPosted: Tue Sep 23, 2008 3:34 pm    Post subject: Reply with quote

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.?
Back to top
View user's profile Send private message
Gtlcpimp



Joined: 10 Sep 2008
Posts: 2

PostPosted: Mon Sep 29, 2008 3:57 am    Post subject: Reply with quote

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:


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


Back to top
View user's profile Send private message
jbit
Site Admin


Joined: 28 May 2005
Posts: 293
Location: København, Danmark

PostPosted: Mon Sep 29, 2008 6:29 pm    Post subject: Reply with quote

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...
Back to top
View user's profile Send private message Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic    forums.ps2dev.org Forum Index -> PS2 Development All times are GMT + 10 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group