Page 1 of 1

Problem with screen when run .elf

Posted: Sat Apr 15, 2006 8:04 pm
by wing64
Hello
I compile my own program use SDL already and have .elf file.
When i run program by InLink v1.3.7 then screen (on TV) is crash. What's happened ? Please suggest me.
best regards
wing64

SourceCode Program

Code: Select all

#include <stdio.h>
#include "SDL.h"

int main&#40;int argc, char *argv&#91;&#93;&#41;
&#123;
	SDL_Surface *screen;

	/* Initialize SDL &#40;Note&#58; video is required to start event loop&#41; */
	if &#40; SDL_Init&#40;SDL_INIT_VIDEO|SDL_INIT_JOYSTICK&#41; < 0 &#41; &#123;
		printf&#40;"Couldn't initialize SDL&#58; %s\n",SDL_GetError&#40;&#41;&#41;;
		exit&#40;1&#41;;
	&#125;

	/* Set a video mode to display joystick axis position */
	screen = SDL_SetVideoMode&#40;640, 480, 16, SDL_SWSURFACE&#41;;
	if &#40; screen == NULL &#41; &#123;
		printf&#40;"Couldn't set video mode&#58; %s\n",SDL_GetError&#40;&#41;&#41;;
		return 0;
	&#125;

	while&#40; 1 &#41; 
	&#123;
			SDL_FillRect&#40;screen, NULL, 0&#41;;
			SDL_Flip&#40;screen &#41;;
	&#125;

	return 0;
&#125;
Inlink v1.3.7 message

Code: Select all

&#91;NET&#93; &#58; Executing host&#58;C&#58;\cygwin\home\test100\test200.elf ...
Setting Curent Directory to C&#58;\cygwin\home\test100\.
Executing Elf host&#58;C&#58;\cygwin\home\test100\test200.elf...
loadelf&#58; fname host&#58;C&#58;\cygwin\home\test100\test200.elf secname all
loadelf version 3.30
Input ELF format filename = host&#58;C&#58;\cygwin\home\test100\test200.elf
0 00100000 000440d4 .....
Loaded, host&#58;C&#58;\cygwin\home\test100\test200.elf
start address 0x1000e0
gp address 00000000
&#91;NET&#93; &#58; Sent test200.elf at 560KB/s
SDL&#58; initializing gsKit in NTSC mode
SDL_Joystick&#58; JoystickInit begins
loadmodule&#58; fname rom0&#58;XSIO2MAN args 0 arg 
loadmodule&#58; id 28, ret 0
loadmodule&#58; fname rom0&#58;XPADMAN args 0 arg 
Pad Driver for OSD &#40;2000/12/05 18&#58;05&#41; 392, 128
loadmodule&#58; id 29, ret 0
loadmodule&#58; fname rom0&#58;XMTAPMAN args 0 arg 
loadmodule&#58; id 30, ret 0
SDL_Joystick&#58; padInit&#58; 0
SDL_Joystick&#58; mtapInit&#58; 1
SDL_Joystick&#58; numports 2

SDL_Joystick&#58; Port&#58; 0  mtapPortOpen&#58; 1
SDL_Joystick&#58; Port&#58; 0  mtapGetConnection&#58; 0
SDL_Joystick&#58; Port 0, MaxSlots&#58; 1
SDL_Joystick&#58; pad &#40;0,0&#41; is in state EXECCMD
SDL_Joystick&#58; pad &#40;0,0&#41; is in state ERROR
SDL_Joystick&#58; pad &#40;0,0&#41; is in state EXECCMD
SDL_Joystick&#58; pad &#40;0,0&#41; is in state ERROR
SDL_Joystick&#58; pad &#40;0,0&#41; is in state EXECCMD
SDL_Joystick&#58; digital pad detected
JoystickInit&#58; Request received
SDL_Joystick&#58; pad &#40;0,0&#41; is in state EXECCMD
Joystick 0 at port=0 slot=0

SDL_Joystick&#58; Port&#58; 1  mtapPortOpen&#58; 1
SDL_Joystick&#58; Port&#58; 1  mtapGetConnection&#58; 0
SDL_Joystick&#58; Port 1, MaxSlots&#58; 1
SDL_Joystick&#58; pad &#40;1,0&#41; is in state EXECCMD
SDL_Joystick&#58; pad &#40;1,0&#41; is in state ERROR
SDL_Joystick&#58; pad &#40;1,0&#41; is in state DISCONNECT
waited too long! giving up
SDL_Joystick&#58; JoystickInit ends with 1 joysticks
SDL_SetVideoMode 640 x 480 x 16
SDL_Video&#58; local texture allocated at 0x00294850
SDL_video&#58; centered surface of &#40;640, 480&#41; onto a screen of &#40;640, 448&#41; at &#40;21, 0&#41;
SDL_video&#58; ratio of 1&#58;0.933, rastered surface is &#40;597, 448&#41;

Posted: Sat Apr 15, 2006 9:08 pm
by Drakonite
Don't use Inlink. It is old, outdated, buggy, and does not work correctly with a recent versions of PS2Link.

You also to to clarify "screen (on TV) is crash" and give more information. If you mean there is a lot of white text on the screen, it sounds like the exception handler, and there is a ton of useful information on the screen.

screen image problem

Posted: Sun Apr 16, 2006 3:47 pm
by wing64
Hello
First image is run .elf on InLink.

Image

Second image is run .elf on Ps2Link.

Image

I don't understand this problem with SDL lib or PS2SDK or GSKit. Please help..

best regards
wing64

Posted: Mon Apr 17, 2006 1:03 pm
by wing64
Hello
I don't know this's correct. I add this code to function PS2_UpdateRects() before call gsKit_sync_flip(gsGlobal); in SDL_ps2video.c then it work fine

Code: Select all

/* execute render queue */
gsKit_queue_exec&#40;gsGlobal&#41;;
but when run my screen have a black rectangle in left screen (see image below). What's black rectangle ? And how do i fix it ?

Image

And when i init SDL by SDL_Init(SDL_INIT_TIMER |SDL_INIT_VIDEO | SDL_INIT_JOYSTICK ) it work ok but when i add flags SDL_INIT_AUDIO program will freeze at SDL: initializing gsKit in NTSC.
What happend with my program ? Please suggest me.

best regards
wing64

Posted: Mon Apr 17, 2006 4:53 pm
by Drakonite
Oy... oh yes... that is right..
GSKIT had some MAJOR changes, including some API changes, and AFAIK SDL has not been updated to work with the new GSKIT.

Posted: Mon Apr 17, 2006 8:30 pm
by evilo
damn... yes... and this gonna be a problem if people want to enter the competition using SDL on PS2 ...

is the rigth (I mean the old one needed for SDL) version of gsKit tagged in SVN ??

wing64, you can try with my compiled version of SDL that should use the *old* gsKit 0.2 : http://psxdev.info/evilo/download/ps2_sdl_gsKit02.zip

I hope it will help you :)

[EDIT] also, 640x480x32 mode is causing pb with SDL on PS2, so try to avoid using it, if possible.

Posted: Mon Apr 17, 2006 9:45 pm
by Drakonite
GSKIT isn't tagged per se... However you can specify the revision to checkout with the -r option. (i.e. 'svn checkout -r 1258 ...')

The version I have saved and am using (I have numerous things that would break with new gskit I didn't want to bother fixing) seems to be based on 1258, which does seem to be the last revision before the changes that break SDL.

There are numerous bugs in revision 1258 of course, including startx/y being known to be off.

Posted: Tue Apr 18, 2006 10:44 pm
by wing64
Thank you very much. It's work.
best regards.
wing64

Posted: Tue Apr 18, 2006 11:32 pm
by wing64
Hello
But when i set SDL_INIT_AUDIO flag in function SDL_Init() program will freeze and any flag SDL_INIT_TIMER , SDL_INIT_VIDEO , SDL_INIT_JOYSTICK it work fine. What's happened in my SDL lib ? :-(
beset regards
wing 64

Posted: Wed Apr 19, 2006 12:38 am
by evilo
Hi,

Which PS2 model do you own ? JAP one ?

have you defined a SDL_main ?

Posted: Thu Apr 20, 2006 2:41 pm
by wing64
Hi
- PSTwo model 70006 cb (NTSC/J)
- i define SDL_Main already and add sdl_main.a in EE_LIBS flags but it not work program freeze at SDL: initializing gsKit in NTSC mode (see message from inlink below)

Code: Select all

&#91;NET&#93; &#58; Executing host&#58;C&#58;\cygwin\home\m13sdl101\sources\m13sdl101.elf ...
Setting Curent Directory to C&#58;\cygwin\home\m13sdl101\sources\.
Executing Elf host&#58;C&#58;\cygwin\home\m13sdl101\sources\m13sdl101.elf...
loadelf&#58; fname host&#58;C&#58;\cygwin\home\m13sdl101\sources\m13sdl101.elf secname all
loadelf version 3.30
Input ELF format filename = host&#58;C&#58;\cygwin\home\m13sdl101\sources\m13sdl101.elf
0 00100000 000c025c .............
Loaded, host&#58;C&#58;\cygwin\home\m13sdl101\sources\m13sdl101.elf
start address 0x1000e0
gp address 00000000
&#91;NET&#93; &#58; Sent m13sdl101.elf at 610KB/s
SDL&#58; initializing gsKit in NTSC mode
best regards
wing64

Posted: Thu Apr 20, 2006 2:54 pm
by wing64
Hi
I trace SDL and found error at SDL_ps2audio.c in function spu2_init() when call audsrv_init() my program freeze in this function. So..How should i do fix it ?
best regards
wing64

Posted: Thu Apr 20, 2006 2:58 pm
by Drakonite
As I said earlier, don't use inlink. Seriously. It doesn't work correctly with any remotely modern versions of ps2link. While I can't say for sure it is causing a problem here, I do seem to remember people having problems with the elf getting corrupted in transfer when using inlink, which can cause all sorts of randomish crashes and glitches that will send people spinning for days on end until they reailze the elf is being corrupted.

So grab a copy of ps2client (or pksh should be up to date as well.. there might another couple PC side clients, I don't track them anymore) and check out the situation with that.

Posted: Thu Apr 20, 2006 3:03 pm
by Drakonite
IIRC SDL has a build option for using freesd.
Make sure to build SDL with and use freesd ... libsd is horribly buggy, and there are different versions of it on different ps2s that have their own brokeness.

Posted: Thu Apr 20, 2006 5:49 pm
by wing64
Hi
1. Now... SDL_INIT_AUDIO work ok. When program load my own sound (001.wav) ps2client said load successed (see message below) but sound not going out (i set volume to MIX_MAX_VOLUME by function Mix_Volume and Mix_VolumeMusic but i can't here any sound). How do i ?
2. How do i play mp3 , ogg and midi on SDL_Mixer (i download from web svn://svn.ps2dev.org/ps2/trunks/ps2sdk-ports) ?

Code: Select all

$ make run
ps2client execee host&#58;tester.elf
loadelf&#58; fname host&#58;tester.elf secname all
loadelf version 3.30
Input ELF format filename = host&#58;tester.elf
0 00100000 0009c37c ..........
Loaded, host&#58;tester.elf
start address 0x1000e0
gp address 00000000
Initialize the sdl library.
SDL&#58; initializing gsKit in NTSC mode
loadmodule&#58; fname rom0&#58;LIBSD args 0 arg
loadmodule&#58; id 33, ret 0
loadbuffer&#58; addrres 55b00 args 0 arg
audsrv&#58; greetings from version 0.90 !
audsrv_adpcm_init&#40;&#41;
audsrv&#58; rpc server thread 0x97b925 started
audsrv&#58; creating rpc server
loadbuffer&#58; id 34, ret 0
audsrv&#58; sceSdInit&#40;SD_INIT_COLD&#41;
audsrv&#58; sceSdInit&#40;SD_INIT_COLD&#41; OK
audsrv&#58; transfer_sema = CreateMutex&#40;0&#41;
audsrv&#58; transfer_sema = CreateMutex&#40;0&#41; OK
audsrv&#58; queue_sema = CreateMutex&#40;0&#41;;
audsrv&#58; queue_sema = CreateMutex&#40;0&#41;; OK
audsrv&#58; freq 48000 bits 16 channels 2 ringbuf_sz 20480 feed_size 2048 shift 2
audsrv&#58; play_tid = create_thread&#40;play_thread, 39, 0&#41;;
starting play thread
audsrv&#58; playing thread 0x97a027 started
audsrv&#58; play_tid = create_thread&#40;play_thread, 39, 0&#41;; OK
audsrv&#58; kickstarted
Initialize the sdl library OK.
SDL_SetVideoMode 640 x 480 x 16
SDL_Video&#58; local texture allocated at 0x002c16e0
SDL_video&#58; centered surface of &#40;640, 480&#41; onto a screen of &#40;640, 448&#41; at &#40;21, 0&#41;

SDL_video&#58; ratio of 1&#58;0.933, rastered surface is &#40;597, 448&#41;
Loading audio
audsrv&#58; freq 22050 bits 16 channels 2 ringbuf_sz 9400 feed_size 940 shift 2
SDL_SYS_CreateThread
SDL_SYS_CreateThread ends successfully
Thread started
Loading audio OK
open name host&#58;001.wav flag 1 data 44078
open fd = 2
open name host&#58;001.wav flag 1 data 44078
open fd = 2
Playing music...
Playing music...OK
open name host&#58;media/image.jpg flag 1 data 44078
open fd = 3
best regards
wing 64

Posted: Thu Apr 20, 2006 5:59 pm
by Drakonite
Was the problem inlink then?

Posted: Thu Apr 20, 2006 6:21 pm
by wing64
Hi
Inlink and ps2ling both work fine (for init audio system only) but load sound i have a problem (see question above post)
best regards
wing64

Posted: Thu Apr 20, 2006 7:00 pm
by Drakonite
I was asking about the problem with it locking up during init... from what your next post said I can see you switched to ps2client, and it loaded and ran correctly. If using inlink as the PC side client was indeed the cause of the problem I would like to know about it.

Posted: Fri Apr 21, 2006 5:49 pm
by wing64
Inlink said message in status bar tranfering file 001.wav at 0% then i wait about 5 minute inlink not tranfer 001.wav file. What happen i don't understand ?

Image

Posted: Fri Apr 21, 2006 6:39 pm
by Drakonite
What happened is that inlink is broken. Don't use it.

I have no idea what is wrong with your audio code TBH. Though I wouldn't be surprised if it's a problem with LIBSD being buggy.