![]() |
| Forums | Gaming News | Videos | Downloads | Today's Posts | Mark Forums Read | Chat | FAQ | Members List | Contact |
| ||||||
This is a discussion on Help with code within the PSP Development Forum forums, part of the PSP Development, Hacks, and Homebrew category; I am new to C and compiling for the psp here is my code. I get a few errors so ...
![]() |
|
|
LinkBack | Thread Tools |
|
|
#1 |
![]() |
I am new to C and compiling for the psp here is my code. I get a few errors so can anyone help with my problems.
Thx! Code:
#include <pspkernel.h>
#include <pspctrl.h>
#include <pspdebug.h>
#include <pspaudio.h>
#include <pspaudiolib.h>
#include <psppower.h>
#include <pspdisplay.h>
#include <png.h>
#include <graphics.h>
#include <stdio.h>
#include <pspgu.h>
#define printf pspDebugScreenPrintf
#define MAX(X, Y) ((X) > (Y) ? (X) : (Y))
#include "mp3player.h"
PSP_MODULE_INFO("Mp3 Player Example", 0, 1, 1);
#define printf pspDebugScreenPrintf
// TWILIGHT ZONE! <do doo do doo>
/* Exit callback */
int exit_callback(int arg1, int arg2, void *common) {
sceKernelExitGame();
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()
{
char buffer[200];
Image* interface;
pspDebugScreenInit();
SetupCallbacks();
initGraphics();
sprintf(buffer, "interface.png");
interface = loadImage(buffer);
if (!interface) {
//Image load failed
printf("Sorry the image loading has failed try agian\n");
} else {
int x = 0;
int y = 0;
sceDisplayWaitVblankStart();
while (x < 480) {
while (y < 272) {
blitAlphaImageToScreen(0 ,0 ,480 , 272, interface, x, y);
y += 480;
}
x += 272;
y = 0;
}
}
// END OF TWILIGHT ZONE! <do doo do do>
int main() {
scePowerSetClockFrequency(333, 333, 166);
pspDebugScreenInit();
SetupCallbacks();
pspAudioInit();
SceCtrlData pad;
int i;
MP3_Init(1);
MP3_Load("test.mp3");
MP3_Play();
while(1) {
sceCtrlReadBufferPositive(&pad, 1);
if(pad.Buttons & PSP_CTRL_CROSS) {
break;
} else if(pad.Buttons & PSP_CTRL_CIRCLE) {
MP3_Pause();
for(i=0; i<10; i++) {
sceDisplayWaitVblankStart();
}
}
if (MP3_EndOfStream() == 1) {
MP3_Stop();
}
}
MP3_Stop();
MP3_FreeTune();
sceKernelSleepThread();
}
flipScreen();
}
sceKernelSleepThread();
return 0;
}
|
|
|
|
|
|
#2 | |
![]() ![]() Developer
|
There's a C/C++ thread for this.
You haven't listed what errors you're having. Learn what the parts of each tutorial do exactly before you copy/paste two of them together.
__________________
![]() Check out my homebrew & C tutorials at http://insomniac.0x89.org/ Coder formerly known as Insomniac197 Quote:
|
|
|
|
|
|
|
#3 | |
![]() |
Quote:
I know some C++ but not really any C Next time i'll post in the C/C++ Help thread
|
|
|
|
|
|
|
#5 |
![]() ![]() ...in a dream...
|
He copy and pasted, just as he admitted.
Also, you should really just use 1 blitAlphaImageToScreen rather than the loops that Yeldarb used to tile the image....
__________________
...you'll never know what it's like... spending your whole life in a dream...
Launch a Kitten out of a Cannon and win real cash! Checkout my newly updated site for all my projects (Kitten Cannon, BOXHEAD, Light Cycle 3D) |
|
|
|
![]() |
| Tags |
| code |
| Thread Tools | |
|
|