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 

SDL CVS working?

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



Joined: 31 Mar 2007
Posts: 1

PostPosted: Sat Mar 31, 2007 7:27 pm    Post subject: SDL CVS working? Reply with quote

Hi,
I downloaded and compiled the complete sdk and some libs from cvs. However I can't get anything to work with sdl. I tested several programs such as reminiscence ps2port and a few others, but all I get with my own compiled versions is a black screen. Could someone please give me some pointers or try the latest sdl version out. Probably I've just forgotten something obvious. I'm developing on linux btw.
Back to top
View user's profile Send private message
protomank



Joined: 18 Dec 2008
Posts: 64
Location: Porto Alegre, RS, Brazil

PostPosted: Fri Dec 19, 2008 9:18 pm    Post subject: Reply with quote

I am having the same problem.
Anyone?
Back to top
View user's profile Send private message Visit poster's website
J.F.



Joined: 22 Feb 2004
Posts: 2906

PostPosted: Sat Dec 20, 2008 6:58 am    Post subject: Reply with quote

EDIT: Whoops! This was ps2 SDL. :)

I couldn't get the svn SDL for the PS2 to work either... need to look into that sometime.
Back to top
View user's profile Send private message AIM Address
protomank



Joined: 18 Dec 2008
Posts: 64
Location: Porto Alegre, RS, Brazil

PostPosted: Sat Dec 20, 2008 10:28 pm    Post subject: Reply with quote

I just got it working fine, was able to run some tests and draw on the screen just fine - I could already create a clone of atari 2600 adventure, hehehehe.
Back to top
View user's profile Send private message Visit poster's website
J.F.



Joined: 22 Feb 2004
Posts: 2906

PostPosted: Sun Dec 21, 2008 12:35 pm    Post subject: Reply with quote

Did you have to do anything special?
Back to top
View user's profile Send private message AIM Address
protomank



Joined: 18 Dec 2008
Posts: 64
Location: Porto Alegre, RS, Brazil

PostPosted: Sun Dec 21, 2008 11:26 pm    Post subject: Reply with quote

No, just started using print_scr in case there was any SDL errors, avoiding printfs. It seems like printf using the method I like (no ps2link, just good and old uLaunchelf and a pendrive) is not a good thing, it gives a black screen often, so just avoid it.

Here is the test code I compiled and works fine:

Quote:

/* Simple program: Loop, watching keystrokes
Note that you need to call SDL_PollEvent() or SDL_WaitEvent() to
pump the event loop and catch keystrokes.
*/

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <debug.h>

#include <SDL.h>


#define WIDTH 640
#define HEIGHT 480
#define BPP 4
#define DEPTH 32

void setpixel(SDL_Surface *screen, int x, int y, Uint8 r, Uint8 g, Uint8 b)
{
Uint32 *pixmem32;
Uint32 colour;

colour = SDL_MapRGB( screen->format, r, g, b );

pixmem32 = (Uint32*) screen->pixels + y + x;
*pixmem32 = colour;
}


void DrawScreen(SDL_Surface* screen, int h)
{
int x, y, ytimesw;

if(SDL_MUSTLOCK(screen))
{
if(SDL_LockSurface(screen) < 0) return;
}

for(y = 0; y < screen->h; y++ )
{
ytimesw = y*screen->pitch/BPP;
for( x = 0; x < screen->w; x++ )
{
setpixel(screen, x, ytimesw, (x*x)/256+3*y+h, (y*y)/256+x+h, h);
}
}

if(SDL_MUSTLOCK(screen)) SDL_UnlockSurface(screen);

SDL_Flip(screen);
}


int main(int argc, char* argv[])
{
SDL_Surface *screen;
SDL_Event event;

int keypress = 0;
int h=0;

if (SDL_Init(SDL_INIT_VIDEO) < 0 ) return 1;

if (!(screen = SDL_SetVideoMode(WIDTH, HEIGHT, DEPTH, SDL_FULLSCREEN|SDL_HWSURFACE)))
{
SDL_Quit();
return 1;
}

while(!keypress)
{
DrawScreen(screen,h++);
while(SDL_PollEvent(&event))
{
switch (event.type)
{
case SDL_QUIT:
keypress = 1;
break;
case SDL_KEYDOWN:
keypress = 1;
break;
}
}
}

SDL_Quit();

return 0;
}
Back to top
View user's profile Send private message Visit poster's website
J.F.



Joined: 22 Feb 2004
Posts: 2906

PostPosted: Mon Dec 22, 2008 9:06 am    Post subject: Reply with quote

Okay, thanks for the tip!
Back to top
View user's profile Send private message AIM Address
J.F.



Joined: 22 Feb 2004
Posts: 2906

PostPosted: Mon Dec 22, 2008 5:55 pm    Post subject: Reply with quote

Okay... the above doesn't work for me. It compiles without error, but I can't seem to get it to run successfully from ule off a memstick. I just get a blank screen. How are you running it? What irx's do you include, and where?
Back to top
View user's profile Send private message AIM Address
protomank



Joined: 18 Dec 2008
Posts: 64
Location: Porto Alegre, RS, Brazil

PostPosted: Mon Dec 22, 2008 7:14 pm    Post subject: Reply with quote

Well, I am not loading any IRX on the code, and just compiled SDL by myselft after the toolchain without any modified options, it is a very vanilla install of the SDK on a Ubuntu 8.10 machine.

Anyway, I run it from a USB pendrive using uLaunchELF
Back to top
View user's profile Send private message Visit poster's website
J.F.



Joined: 22 Feb 2004
Posts: 2906

PostPosted: Mon Dec 22, 2008 7:43 pm    Post subject: Reply with quote

I didn't think any irxs were needed... it just doesn't work for me. Never has. Nothing I've compiled that uses SDL for the PS2 has ever worked. Everything else does... the libito examples seem to work fine. It's just SDL that causes trouble. No errors - it simply doesn't work.
:(
Back to top
View user's profile Send private message AIM Address
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