Skip to: Site menu | Main content


Welcome to PSP-Programming.com, a place for developers to get together.

Welcome to the forums. Here you can find other user tutorials as well as homebrew releases and the source code repository. You can also ask for help with your code here and post your own homebrew!

PSP-Programming.com Forums
February 10, 2012, 01:16:07 AM *
Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length

News: Join our IRC channel: ##psp-programming on freenode
Home Help Search Shop Login Register
Digg This!
Pages: [1]
Print
Author Topic: How to link libraries  (Read 1128 times)
singha
Newbie
*

Karma: +0/-0
Offline Offline

Posts: 8
583.04 points

View Inventory
Send Money to singha

View Profile
« on: April 05, 2010, 01:02:35 AM »

Hello all,

I think I'm having trouble with linking libraries.  Everything compiles fine with my makefile, but when I run the app on my PSP, it gives me an error "could not start game (8002013C)."  The very useful PSP Error codes thread tells me that the this is because a library was missing.

Now, I've begun using two new libraries in my code:

Code:
#include <pspiofilemgr.h>
#include <pspsystimer.h>

I'm also using <stdio.h>, which I'm mentioning only because its a standard C library and not necessarily a PSP library.

I think the problem may be that I am not linking them in my Makefile.  I noticed that the LIBS line had a couple of options that seem to relate to the graphics libraries:

Code:
LIBS = -lpspgu -lpng -lz -lm

Are there similar options that I need to add for the above libraries?  Where can I find them?  Or is something else wrong?

Your help is much appreciated!

Thank you,
L
Logged


mowglisanu

C/C++ Developer
Hero Member
*

Karma: +36/-11
Offline Offline

Posts: 787
0.00 points

View Inventory
Send Money to mowglisanu


View Profile
« Reply #1 on: April 05, 2010, 09:01:03 AM »

8002013C doesn't refer to static libraries? if that was the case it wouldn't compile in the first place. You're probably trying to use a function that can't be linked at runtime.
Logged

Check out my:
 Audio lib
 Pmf Viewer
singha
Newbie
*

Karma: +0/-0
Offline Offline

Posts: 8
583.04 points

View Inventory
Send Money to singha

View Profile
« Reply #2 on: April 05, 2010, 09:07:41 AM »

How would I be able to tell which functions can't be used?  The error said "library not found," so I suppose that lines up with what you're saying.  The following code chunk is where things were added.  Can you spot a function call that wouldn't work?

Code:
#include <pspctrl.h>
#include <pspkernel.h>
#include <stdio.h>
#include <pspiofilemgr.h>
#include <pspsystimer.h>
#include "draw.h"
#include "control.h"
#include "callbacks.h"
#include "test.h"

#define printf pspDebugScreenPrintf
#define PHRASE_SIZE 45

PSP_MODULE_INFO("Two Cursor Text Input", 0, 1, 1);
int testPhrase[PHRASE_SIZE]; // Holds the test phrase...

/* Write results to resultFile. */
void writeResults(SceUID resultFile, int testType, char* input, int time) {
int dataSize = 128;
char* data = malloc(dataSize);

sprintf(data, "%d\t%s\t%s%d\n", testType, testPhrase, input, time);
sceIoWrite(resultFile, data, dataSize);

free(data);
}

int* getTestPhrase() { return testPhrase; }

/* Reads the next test phrase from testFile and puts it in testPhrase. */
int readNextPhrase(SceUID testFile) {
int i = 0;

do {
i += sceIoRead(testFile, testPhrase+i, 1);
} while (i > 0 && testPhrase[i-1] != '\n');
testPhrase[i] = 0;

return i;
}

/* Run test with phrases from testFilName, write the results to resultFileName,
with either 1Cursor or 2Cursor testType. */
void runTest(const char* testFileName, const char* resultFileName, int testType) {
SceUID testFile = sceIoOpen(testFileName, PSP_O_RDONLY, 0777);
SceUID resultFile = sceIoOpen(resultFileName, PSP_O_APPEND, 0777);

SceSysTimerId timer = sceSTimerAlloc(); // Clock
int time; // Holds how long user took to input a phrase
char* input; // What the user inputted
int done = 0; // Return value of readNextPhrase

initControl(); // Initialize!

bzero(testPhrase, PHRASE_SIZE);
done = readNextPhrase(testFile); // Read test phrase

while (done != 0) {
sceSTimerStartCount(timer); // Start timer
input = parseInput(testType); // Get user input
sceSTimerStopCount(timer); // Stop timer

sceSTimerGetCount(timer, &time); // Get time
sceSTimerResetCount(timer); // Reset timer

writeResults(resultFile, testType, input, time); // Write results

bzero(testPhrase, PHRASE_SIZE); // Reset testPhrase
done = readNextPhrase(testFile); // Read new test phrase
}

sceIoWrite(resultFile, "\n\n", 2); // Add two lines to the file

// Cleanup
cleanControl();

sceSTimerFree(timer);
sceIoClose(testFile);
sceIoClose(resultFile);
}


I should add that none of this code is executed right at runtime.  It goes to a menu first before it calls this.  I don't know if that makes a difference...

Thank you,
L
Logged
mowglisanu

C/C++ Developer
Hero Member
*

Karma: +36/-11
Offline Offline

Posts: 787
0.00 points

View Inventory
Send Money to mowglisanu


View Profile
« Reply #3 on: April 05, 2010, 09:51:32 AM »

A quick google search tells me the timer functions are your problem. On the psp libdocs I see that they're imported from SysTimerForKernel which implies kernel mode

You could put them in an external kernel prx and import them to your app or find user mode timer functions.
Logged

Check out my:
 Audio lib
 Pmf Viewer
singha
Newbie
*

Karma: +0/-0
Offline Offline

Posts: 8
583.04 points

View Inventory
Send Money to singha

View Profile
« Reply #4 on: April 05, 2010, 11:00:31 AM »

Thank you!  I realized that that was the newest thing I've added, so cool.  I will replace with psprtc.h.
Thanks again,
L
Logged
Pages: [1]
Print
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.11 | SMF © 2006-2009, Simple Machines LLC Valid XHTML 1.0! Valid CSS!
Page created in 0.179 seconds with 28 queries.
Sister Sites: Guitar Hero 4   BrokeniTouch.com