[Solved] PSP & SDL problem

Whether you're a newbie or an experienced programmer, any questions, help, or just talk of any language will be welcomed here.

Moderator: Coders of Rage

User avatar
Christer
Chaos Rift Newbie
Chaos Rift Newbie
Posts: 44
Joined: Thu Feb 05, 2009 12:39 pm
Location: Sweden

[Solved] PSP & SDL problem

Post 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 :)
Last edited by Christer on Sat Feb 13, 2010 10:57 am, edited 1 time in total.
User avatar
Falco Girgis
Elysian Shadows Team
Elysian Shadows Team
Posts: 10294
Joined: Thu May 20, 2004 2:04 pm
Current Project: Elysian Shadows
Favorite Gaming Platforms: Dreamcast, SNES, NES
Programming Language of Choice: C/++
Location: Studio Vorbis, AL
Contact:

Re: PSP & SDL problem

Post 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.
K-Bal
ES Beta Backer
ES Beta Backer
Posts: 701
Joined: Sun Mar 15, 2009 3:21 pm
Location: Germany, Aachen
Contact:

Re: PSP & SDL problem

Post 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.
User avatar
Christer
Chaos Rift Newbie
Chaos Rift Newbie
Posts: 44
Joined: Thu Feb 05, 2009 12:39 pm
Location: Sweden

Re: PSP & SDL problem

Post 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..
User avatar
combatant936
Chaos Rift Newbie
Chaos Rift Newbie
Posts: 39
Joined: Wed Jul 29, 2009 11:11 pm
Current Project: It's a secret!!
Favorite Gaming Platforms: N64, SNES, PS2, PC
Programming Language of Choice: C++, 65816 asm
Location: Pennsylvania
Contact:

Re: PSP & SDL problem

Post by combatant936 »

Why don't you try linking -lSDLmain in your makefile? That might work. :)
User avatar
Christer
Chaos Rift Newbie
Chaos Rift Newbie
Posts: 44
Joined: Thu Feb 05, 2009 12:39 pm
Location: Sweden

Re: PSP & SDL problem

Post by Christer »

oh fixed it. I just had to remove the PSP_MODULE_INFO("CONTROLTEST", 0, 1, 1); line.
User avatar
combatant936
Chaos Rift Newbie
Chaos Rift Newbie
Posts: 39
Joined: Wed Jul 29, 2009 11:11 pm
Current Project: It's a secret!!
Favorite Gaming Platforms: N64, SNES, PS2, PC
Programming Language of Choice: C++, 65816 asm
Location: Pennsylvania
Contact:

Re: [Solved] PSP & SDL problem

Post 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
User avatar
Christer
Chaos Rift Newbie
Chaos Rift Newbie
Posts: 44
Joined: Thu Feb 05, 2009 12:39 pm
Location: Sweden

Re: [Solved] PSP & SDL problem

Post 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
User avatar
Christer
Chaos Rift Newbie
Chaos Rift Newbie
Posts: 44
Joined: Thu Feb 05, 2009 12:39 pm
Location: Sweden

Re: [Solved] PSP & SDL problem

Post 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?
User avatar
combatant936
Chaos Rift Newbie
Chaos Rift Newbie
Posts: 39
Joined: Wed Jul 29, 2009 11:11 pm
Current Project: It's a secret!!
Favorite Gaming Platforms: N64, SNES, PS2, PC
Programming Language of Choice: C++, 65816 asm
Location: Pennsylvania
Contact:

Re: [Solved] PSP & SDL problem

Post 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. ;)
User avatar
Falco Girgis
Elysian Shadows Team
Elysian Shadows Team
Posts: 10294
Joined: Thu May 20, 2004 2:04 pm
Current Project: Elysian Shadows
Favorite Gaming Platforms: Dreamcast, SNES, NES
Programming Language of Choice: C/++
Location: Studio Vorbis, AL
Contact:

Re: [Solved] PSP & SDL problem

Post 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.
User avatar
Falco Girgis
Elysian Shadows Team
Elysian Shadows Team
Posts: 10294
Joined: Thu May 20, 2004 2:04 pm
Current Project: Elysian Shadows
Favorite Gaming Platforms: Dreamcast, SNES, NES
Programming Language of Choice: C/++
Location: Studio Vorbis, AL
Contact:

Re: PSP & SDL problem

Post 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?
User avatar
dandymcgee
ES Beta Backer
ES Beta Backer
Posts: 4709
Joined: Tue Apr 29, 2008 3:24 pm
Current Project: https://github.com/dbechrd/RicoTech
Favorite Gaming Platforms: NES, Sega Genesis, PS2, PC
Programming Language of Choice: C
Location: San Francisco
Contact:

Re: PSP & SDL problem

Post by dandymcgee »

GyroVorbis wrote:I could have helped you, but I bitched you out instead.

/phail.
I can't believe you. :nono:
Falco Girgis wrote:It is imperative that I can broadcast my narcissistic commit strings to the Twitter! Tweet Tweet, bitches! :twisted:
User avatar
short
ES Beta Backer
ES Beta Backer
Posts: 548
Joined: Thu Apr 30, 2009 2:22 am
Current Project: c++, c
Favorite Gaming Platforms: SNES, PS2, SNES, SNES, PC NES
Programming Language of Choice: c, c++
Location: Oregon, US

Re: PSP & SDL problem

Post 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.
My github repository contains the project I am currently working on,
link: https://github.com/bjadamson
User avatar
LeonBlade
Chaos Rift Demigod
Chaos Rift Demigod
Posts: 1314
Joined: Thu Jan 22, 2009 12:22 am
Current Project: Trying to make my first engine in C++ using OGL
Favorite Gaming Platforms: PS3
Programming Language of Choice: C++
Location: Blossvale, NY

Re: PSP & SDL problem

Post 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... :|
There's no place like ~/
Post Reply