Page 1 of 2

[Solved] PSP & SDL problem

Posted: Sat Feb 13, 2010 7:22 am
by Christer
I followed a tutorial on how to get a psp sdk to work. I can compile the examples and such. But when I try to use the makefile that should be used with sdl it dont work to compile.
The tutorial i followed: http://www.consolespot.net/forums/psp-h ... ygwin.html

Error:

Code: Select all

C:\pspdev\psp\sdk\mystuff>make
psp-gcc -I. -IC:/pspdev/psp/sdk/include -O2 -G0 -Wall -D PSP -IC:/pspdev/psp/inc
lude/SDL -Dmain=SDL_main  -D_PSP_FW_VERSION=150  -L. -LC:/pspdev/psp/sdk/lib   m
ain.o -lstdc++ -lSDL_ttf -lfreetype -lSDL_image -ljpeg -lpng -lz -lm -lSDL_mixer
 -lvorbisidec -lmikmod -lmad -LC:/pspdev/psp/lib -lSDLmain -lSDL -lm -lGL -lpspv
fpu -LC:/pspdev/psp/sdk/lib -lpspdebug -lpspgu -lpspctrl -lpspge -lpspdisplay -l
psphprm -lpspsdk -lpsprtc -lpspaudio -lc -lpspuser -lpsputility -lpspkernel -lps
pnet_inet  -lpspaudiolib -lpspaudio -lpsppower -lpspdebug -lpspdisplay -lpspge -
lpspctrl -lpspsdk -lc -lpspnet -lpspnet_inet -lpspnet_apctl -lpspnet_resolver -l
psputility -lpspuser -lpspkernel -o testprogram.elf
C:/pspdev/psp/lib\libSDLmain.a(SDL_psp_main.o): In function `sdl_psp_setup_callb
acks':
psp/SDL_psp_main.c:71: multiple definition of `module_info'
main.o:(.rodata.sceModuleInfo+0x0): first defined here
collect2: ld returned 1 exit status

make: *** [testprogram.elf] Error 1
CODE:

Code: Select all

/*
 * PSP Software Development Kit - http://www.pspdev.org
 * -----------------------------------------------------------------------
 * Licensed under the BSD license, see LICENSE in PSPSDK root for details.
 *
 * main.c - Basic Input demo -- reads from control pad and indicates button
 *          presses.
 *
 * Copyright (c) 2005 Marcus R. Brown <mrbrown@ocgnet.org>
 * Copyright (c) 2005 James Forshaw <tyranid@gmail.com>
 * Copyright (c) 2005 John Kelley <ps2dev@kelley.ca>
 * Copyright (c) 2005 Donour Sizemore <donour@uchicago.edu>
 *
 * $Id: main.c 1095 2005-09-27 21:02:16Z jim $
 */
#include <pspkernel.h>
#include <pspdebug.h>
#include <pspctrl.h>
#include <stdlib.h>
#include <string.h>

/* Define the module info section */
PSP_MODULE_INFO("CONTROLTEST", 0, 1, 1);

/* Define the main thread's attribute value (optional) */
PSP_MAIN_THREAD_ATTR(THREAD_ATTR_USER | THREAD_ATTR_VFPU);

/* Define printf, just to make typing easier */
#define printf	pspDebugScreenPrintf

void dump_threadstatus(void);

int done = 0;

/* Exit callback */
int exit_callback(int arg1, int arg2, void *common)
{
	done = 1;
	return 0;
}

/* Callback thread */
int CallbackThread(SceSize args, void *argp)
{
	int cbid;

	cbid = sceKernelCreateCallback("Exit Callback", exit_callback, NULL);
	sceKernelRegisterExitCallback(cbid);
	sceKernelSleepThreadCB();

	return 0;
}

/* Sets up the callback thread and returns its thread id */
int SetupCallbacks(void)
{
	int thid = 0;

	thid = sceKernelCreateThread("update_thread", CallbackThread,
				     0x11, 0xFA0, 0, 0);
	if(thid >= 0)
	{
		sceKernelStartThread(thid, 0, 0);
	}

	return thid;
}

int main(void)
{
	SceCtrlData pad;

	pspDebugScreenInit();
	SetupCallbacks();

	sceCtrlSetSamplingCycle(0);
	sceCtrlSetSamplingMode(PSP_CTRL_MODE_ANALOG);

	while(!done){
		pspDebugScreenSetXY(0, 2);

    		sceCtrlReadBufferPositive(&pad, 1); 

		printf("Analog X = %d ", pad.Lx);
		printf("Analog Y = %d \n", pad.Ly);

		if (pad.Buttons != 0){
			if (pad.Buttons & PSP_CTRL_SQUARE){
				printf("Square pressed \n");
			}
			if (pad.Buttons & PSP_CTRL_TRIANGLE){
				printf("Triangle pressed \n");
			} 
			if (pad.Buttons & PSP_CTRL_CIRCLE){
				printf("Cicle pressed \n");
			} 
			if (pad.Buttons & PSP_CTRL_CROSS){
				printf("Cross pressed \n");
			} 

			if (pad.Buttons & PSP_CTRL_UP){
				printf("Up pressed \n");
			} 
			if (pad.Buttons & PSP_CTRL_DOWN){
				printf("Down pressed \n");
			} 
			if (pad.Buttons & PSP_CTRL_LEFT){
				printf("Left pressed \n");
			} 
			if (pad.Buttons & PSP_CTRL_RIGHT){
				printf("Right pressed \n");
			}      

			if (pad.Buttons & PSP_CTRL_START){
				printf("Start pressed \n");
			}
			if (pad.Buttons & PSP_CTRL_SELECT){
				printf("Select pressed \n");
			}
			if (pad.Buttons & PSP_CTRL_LTRIGGER){
				printf("L-trigger pressed \n");
			}
			if (pad.Buttons & PSP_CTRL_RTRIGGER){
				printf("R-trigger pressed \n");
			}      
		}
	}

	sceKernelExitGame();
	return 0;
}
Makefile:

Code: Select all

TARGET = testprogram
OBJS = main.o

PSPSDK = $(shell psp-config --pspsdk-path)
PSPDEV = $(shell psp-config -d)
PSPBIN = $(PSPDEV)/bin
SDL_CONFIG = $(PSPBIN)/sdl-config

CFLAGS = -O2 -G0 -Wall -D PSP
CFLAGS += $(shell $(SDL_CONFIG) --cflags)
CXXFLAGS = $(CFLAGS) -fno-exceptions -fno-rtti
ASFLAGS = $(CFLAGS)

LIBS = -lstdc++ -lSDL_ttf -lfreetype -lSDL_image -ljpeg -lpng -lz -lm -lSDL_mixer -lvorbisidec -lmikmod -lmad $(shell $(SDL_CONFIG) --libs)
LIBS += -lpspaudiolib -lpspaudio -lpsppower

EXTRA_TARGETS = EBOOT.PBP
PSP_EBOOT_TITLE = TestProgram

include $(PSPSDK)/lib/build.mak
Thanks for help :)

Re: PSP & SDL problem

Posted: Sat Feb 13, 2010 10:11 am
by Falco Girgis
Dude, "it won't work" isn't good enough. What's the error output? How are we supposed to help you with what we've been given (without spending hours looking through that)? Show us Make/GCC's output.

Re: PSP & SDL problem

Posted: Sat Feb 13, 2010 10:28 am
by K-Bal
GyroVorbis wrote:Dude, "it won't work" isn't good enough. What's the error output? How are we supposed to help you with what we've been given (without spending hours looking through that)? Show us Make/GCC's output.
He did :) Seems like you have two definitions of main() in your project.

Re: PSP & SDL problem

Posted: Sat Feb 13, 2010 10:53 am
by Christer
K-Bal wrote:
GyroVorbis wrote:Dude, "it won't work" isn't good enough. What's the error output? How are we supposed to help you with what we've been given (without spending hours looking through that)? Show us Make/GCC's output.
He did :) Seems like you have two definitions of main() in your project.
I can only see one..

Re: PSP & SDL problem

Posted: Sat Feb 13, 2010 10:55 am
by combatant936
Why don't you try linking -lSDLmain in your makefile? That might work. :)

Re: PSP & SDL problem

Posted: Sat Feb 13, 2010 10:57 am
by Christer
oh fixed it. I just had to remove the PSP_MODULE_INFO("CONTROLTEST", 0, 1, 1); line.

Re: [Solved] PSP & SDL problem

Posted: Sat Feb 13, 2010 10:57 am
by combatant936
Christer wrote:oh fixed it. I just had to remove the PSP_MODULE_INFO("CONTROLTEST", 0, 1, 1); line.
That was my NEXT guess xD

Re: [Solved] PSP & SDL problem

Posted: Sat Feb 13, 2010 10:58 am
by Christer
combatant936 wrote:
Christer wrote:oh fixed it. I just had to remove the PSP_MODULE_INFO("CONTROLTEST", 0, 1, 1); line.
That was my NEXT guess xD
Thanks anyway :D

Re: [Solved] PSP & SDL problem

Posted: Sat Feb 13, 2010 11:00 am
by Christer
oh I have a question... when I compile it compiles a .PBP wich is the executeable for PSP but then it also make a .elf file what is that for?

Re: [Solved] PSP & SDL problem

Posted: Sat Feb 13, 2010 11:17 am
by combatant936
I think that .PBP is the pure binary file, and the .elf file contains debug information from the linker. The .PBP file would be created from the .elf. There are converters for .elf to .PBP, and also for .dol (wii executable).

Thats what it's like for the Wii at least... I'm not completely positive about PSP, but I'd think it's the same. ;)

Re: [Solved] PSP & SDL problem

Posted: Sun Feb 14, 2010 9:51 am
by Falco Girgis
combatant936 wrote:I think that .PBP is the pure binary file, and the .elf file contains debug information from the linker. The .PBP file would be created from the .elf. There are converters for .elf to .PBP, and also for .dol (wii executable).

Thats what it's like for the Wii at least... I'm not completely positive about PSP, but I'd think it's the same. ;)
^ What he said.

Re: PSP & SDL problem

Posted: Sun Feb 14, 2010 9:56 am
by Falco Girgis
GyroVorbis wrote:Dude, "it won't work" isn't good enough. What's the error output? How are we supposed to help you with what we've been given (without spending hours looking through that)? Show us Make/GCC's output.
WHAT THE FUCK IS WRONG WITH ME!? That was the first thing you posted!

Man, I'm really sorry. I don't know how I missed that. Feel free to bash/slam/harass me. I could have helped you, but I bitched you out instead.

/phail.

By the way, guys. How is the SDL performance on PSP? I'm guessing fairly poor?

Re: PSP & SDL problem

Posted: Sun Feb 14, 2010 1:26 pm
by dandymcgee
GyroVorbis wrote:I could have helped you, but I bitched you out instead.

/phail.
I can't believe you. :nono:

Re: PSP & SDL problem

Posted: Thu Feb 18, 2010 2:01 am
by short
GyroVorbis wrote:
GyroVorbis wrote:By the way, guys. How is the SDL performance on PSP? I'm guessing fairly poor?
I'm also curious, my brother 14 yr old brother has a psp and i might jack it for a few months this summer. I will be using opengl for the graphics and if the audio/input/everything else ports to the psp I wonder how the performance of SDL with everything that is not graphics is on the psp.

Re: PSP & SDL problem

Posted: Thu Feb 18, 2010 3:04 am
by LeonBlade
GyroVorbis wrote:
GyroVorbis wrote:Dude, "it won't work" isn't good enough. What's the error output? How are we supposed to help you with what we've been given (without spending hours looking through that)? Show us Make/GCC's output.
WHAT THE FUCK IS WRONG WITH ME!? That was the first thing you posted!

Man, I'm really sorry. I don't know how I missed that. Feel free to bash/slam/harass me. I could have helped you, but I bitched you out instead.

/phail.

By the way, guys. How is the SDL performance on PSP? I'm guessing fairly poor?
Everyone makes stupid mistakes like this, and then people go after them after their fault is realized in an attempt to somehow make them feel bad about what they said and make them feel stupid in some way.

I'm not that kind of person though :)

So basically what I'm saying is... it's okay.
Plus, this doesn't even concern me... in fact... this post is kind of useless... :|