C/C++ Programming Help Thread
This is a discussion on C/C++ Programming Help Thread within the PSP Development Forum forums, part of the PSP Development, Hacks, and Homebrew category; Zitat von AdjutantReflex I see that's the source I used in my personal Lua Player w/ IR support (and flasing ...
-
07-01-2007, 10:25 PM #5281QJ Gamer Green
- Registriert seit
- Dec 2006
- Ort
- main();
- Beiträge
- 1.071
- Points
- 11.300
- Level
- 70
- Downloads
- 0
- Uploads
- 0
Nope, that won't run. IIRC, sceKernelLoadExec() doesn't even take a path as a parameter.
Zitat von AdjutantReflex
-
07-01-2007, 10:30 PM #5282QJ Gamer Green

- Registriert seit
- Oct 2006
- Ort
- Cd. Juarez Mexico -
- Beiträge
- 341
- Points
- 8.244
- Level
- 61
- Downloads
- 0
- Uploads
- 0
-
07-01-2007, 10:38 PM #5283QJ Gamer Green
- Registriert seit
- Dec 2006
- Ort
- main();
- Beiträge
- 1.071
- Points
- 11.300
- Level
- 70
- Downloads
- 0
- Uploads
- 0
Look here. You need to pass a struct to the second param, not null.
-= Double Post =-
Something like this, I would say:
Code:int plEbootLoad(char* pathToPbp) { if(strlen(pathToPbp) <= 0) { printf("Must pass the location of the PBP file.\n"); return 0; } struct SceKernelLoadExecVSHParam pbpParam; memset(&pbpParam, 0, sizeof(pbpParam)); pbpParam.size = sizeof(pbpParam); pbpParam.args = (strlen(pathToPbp) + 1); pbpParam.argp = pathToPbp; pbpParam.key = "game"; if(sceKernelLoadExec(pathToPbp, &pbpParam) < 0) { return 0; } return 1; }Geändert von PSPJunkie_ (07-01-2007 um 10:51 PM Uhr) Grund: Automerged Doublepost
-
07-02-2007, 05:48 AM #5284
What does "nan" mean in floats?
-
07-02-2007, 06:03 AM #5285QJ Gamer Silver

- Registriert seit
- Jun 2006
- Ort
- UK
- Beiträge
- 2.326
- Points
- 10.263
- Level
- 67
- Downloads
- 0
- Uploads
- 0
Not A Number.
Zitat von Mr305
http://en.wikipedia.org/wiki/NaN[Blog] [Portfolio]
[Homebrew Illuminati - Serious Homebrew Development Forums]
[I want to make Homebrew FAQ] [How I broke into the Games Industry]
[Programming Book List] [Programming Article List]
-
07-02-2007, 08:22 AM #5286QJ Gamer Green

- Registriert seit
- Oct 2006
- Ort
- Cd. Juarez Mexico -
- Beiträge
- 341
- Points
- 8.244
- Level
- 61
- Downloads
- 0
- Uploads
- 0
-
07-02-2007, 12:32 PM #5287QJ Gamer Blue
- Registriert seit
- Aug 2006
- Ort
- c:\Program Files\World of Warcraft\WoW.exe
- Beiträge
- 98
- Points
- 4.031
- Level
- 40
- Downloads
- 0
- Uploads
- 0
Hmmm... for some reason my code that i ported isn't working at all...
Nothing is displayed.
Here are the files:
http://mihd.net/09qzvw
The main.c:
The makefileCode:#include <pspdisplay.h> #include <stdlib.h> #include <pspctrl.h> #include <pspkernel.h> #include <pspdebug.h> #include <pspgu.h> #include <png.h> #include <stdio.h> #include <time.h> #include <psppower.h> #include <pspaudio.h> #include <pspaudiolib.h> #include "graphics.h" #define true 1 #define false 0 PSP_MODULE_INFO("BallBounce Test", 0, 1, 1); /* 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; } char *path[2] = { "BGimage.png", //0 "Ball.png"}; //1 int main() { SetupCallbacks(); pspDebugScreenInit(); initGraphics(); int x = 0; int y = 0; Image* images[2]; int i; for(i = 0; i < 2; i++) { images[i] = loadImage(path[i]); } while(1) { blitAlphaImageToScreen(0 ,0 ,32 , 32, images[1], x, y); blitAlphaImageToScreen(0 ,0 ,480 , 272, images[0], 0, 0); sceDisplayWaitVblankStart(); flipScreen(); } sceKernelSleepThread(); return 0; }
Code:TARGET = BouncingBallDemo OBJS = main.o graphics.o framebuffer.o CFLAGS = -O2 -G0 -Wall CXXFLAGS = $(CFLAGS) -fno-exceptions -fno-rtti ASFLAGS = $(CFLAGS) LIBDIR = LIBS = -lpspgu -lpng -lz -lm -lpsprtc -lmad -lpspaudiolib -lpspaudio -lpsppower LDFLAGS = EXTRA_TARGETS = EBOOT.PBP PSP_EBOOT_TITLE = Bouncing Ball Demo PSPSDK=$(shell psp-config --pspsdk-path) include $(PSPSDK)/lib/build.mak
-
07-02-2007, 12:39 PM #5288I'm back!

- Registriert seit
- Feb 2007
- Ort
- England
- Beiträge
- 902
- Points
- 8.236
- Level
- 61
- Downloads
- 0
- Uploads
- 0
I'm having a problem again loading modules :Argh:
Using the pspSdkLoadStartModule, I sometimes load the modules fine, and other times... well I get an error message, and 0x44088000 as the error code.
I can load perfectly in 3.10, but when trying to run this in 1.50, I seem to get that error code a lot.
I've tried looking through and finding what exactly is causing the error, but to no avail, its not based on the loading code, because the exact same code can load another module perfectly, and the modules that won't work sometimes work when loaded from elsewhere...
Thanks for any help
-Aura
-
07-02-2007, 12:41 PM #5289QJ Gamer Green
- Registriert seit
- Dec 2006
- Ort
- main();
- Beiträge
- 1.071
- Points
- 11.300
- Level
- 70
- Downloads
- 0
- Uploads
- 0
Long time, no see!
Zitat von Nicko01
-
07-02-2007, 01:01 PM #5290QJ Gamer Blue
- Registriert seit
- Aug 2006
- Ort
- c:\Program Files\World of Warcraft\WoW.exe
- Beiträge
- 98
- Points
- 4.031
- Level
- 40
- Downloads
- 0
- Uploads
- 0
lol.... I took a break from programming a few months to play WoW.
I'm not sure why this always happens, but for some reason my stupid screen never is displayed.
-
07-02-2007, 01:05 PM #5291QJ Gamer Green
- Registriert seit
- Dec 2006
- Ort
- main();
- Beiträge
- 1.071
- Points
- 11.300
- Level
- 70
- Downloads
- 0
- Uploads
- 0
D'oh.
Zitat von Nicko01
-
07-02-2007, 01:09 PM #5292QJ Gamer Blue
- Registriert seit
- Aug 2006
- Ort
- c:\Program Files\World of Warcraft\WoW.exe
- Beiträge
- 98
- Points
- 4.031
- Level
- 40
- Downloads
- 0
- Uploads
- 0
what? dont like World of Warcraft?
-
07-02-2007, 01:13 PM #5293QJ Gamer Green
- Registriert seit
- Dec 2006
- Ort
- main();
- Beiträge
- 1.071
- Points
- 11.300
- Level
- 70
- Downloads
- 0
- Uploads
- 0
Well, you can say I'm wow-o-phobic. :P But, hey, we go back a long way, so whatever.
http://
elite.proboards79.com :P Idiots United...
-
07-02-2007, 01:25 PM #5294QJ Gamer Blue
- Registriert seit
- Aug 2006
- Ort
- c:\Program Files\World of Warcraft\WoW.exe
- Beiträge
- 98
- Points
- 4.031
- Level
- 40
- Downloads
- 0
- Uploads
- 0
You were on idiots united???
What was your name?
-
07-02-2007, 01:25 PM #5295QJ Gamer Green
- Registriert seit
- Dec 2006
- Ort
- main();
- Beiträge
- 1.071
- Points
- 11.300
- Level
- 70
- Downloads
- 0
- Uploads
- 0
It's PSPJunkie :P
-
07-02-2007, 01:29 PM #5296QJ Gamer Blue
- Registriert seit
- Aug 2006
- Ort
- c:\Program Files\World of Warcraft\WoW.exe
- Beiträge
- 98
- Points
- 4.031
- Level
- 40
- Downloads
- 0
- Uploads
- 0
:) I should have known because of the NY Giants thing.
Well, lets get back on topic...
Can you see a problem?
-
07-02-2007, 01:32 PM #5297QJ Gamer Green
- Registriert seit
- Dec 2006
- Ort
- main();
- Beiträge
- 1.071
- Points
- 11.300
- Level
- 70
- Downloads
- 0
- Uploads
- 0
Did you run it through PSPLink?
-
07-02-2007, 01:33 PM #5298QJ Gamer Blue
- Registriert seit
- Aug 2006
- Ort
- c:\Program Files\World of Warcraft\WoW.exe
- Beiträge
- 98
- Points
- 4.031
- Level
- 40
- Downloads
- 0
- Uploads
- 0
no
-
07-02-2007, 01:53 PM #5299QJ Gamer Green
- Registriert seit
- Dec 2006
- Ort
- main();
- Beiträge
- 1.071
- Points
- 11.300
- Level
- 70
- Downloads
- 0
- Uploads
- 0
Got it!
'BGimage.png' is not actually a PNG file. If you ran it through PSPLink, you would see that libpng throws out an error (You don't notice it because it is with printf which doesn't go the PSPs screen). Rename 'BGimage.png' to 'BGimage.bmp' and resave it as a PNG in you preferred image editing program.
That's it :P
Although, just so you know, you blit the ball first, so the background in front of it and you will never see it. :P

EDIT: I attached the converted image.
-
07-02-2007, 01:57 PM #5300QJ Gamer Blue
- Registriert seit
- Aug 2006
- Ort
- c:\Program Files\World of Warcraft\WoW.exe
- Beiträge
- 98
- Points
- 4.031
- Level
- 40
- Downloads
- 0
- Uploads
- 0
oh cool.
thanks.
well, when i converted it, it must have been converted wrong.
lol... i didn't even put all of my code in there...
i forgot the whole bouncing part.
-
07-02-2007, 02:03 PM #5301QJ Gamer Green
- Registriert seit
- Dec 2006
- Ort
- main();
- Beiträge
- 1.071
- Points
- 11.300
- Level
- 70
- Downloads
- 0
- Uploads
- 0
No problem. When libpng threw the error, I just opened the file in a hex editor and saw the header was BMP.
-
07-03-2007, 03:25 AM #5302QJ Gamer Green
- Registriert seit
- Jul 2006
- Ort
- Middle Europe
- Beiträge
- 1.281
- Points
- 11.800
- Level
- 71
- Downloads
- 0
- Uploads
- 0
hi i'm still learning......
if i have something like this
how would i use it to print battery life?Code:int scePowerGetBatteryLifePercent(void);
[1 Year QJ Member]
[LUA Coder and C Learner]
[Ball Revamped Clone v0.1]
[Phil's Shooting Range v0.3]
[HideFile PRX v2]
[SSR PRX v1.1]
-
07-03-2007, 03:34 AM #5303QJ Gamer Blue
- Registriert seit
- Aug 2006
- Ort
- c:\Program Files\World of Warcraft\WoW.exe
- Beiträge
- 98
- Points
- 4.031
- Level
- 40
- Downloads
- 0
- Uploads
- 0
how that works is that the int means it will be an interger.
void means it takes no parameters
This shows how to make it into a variable which can be used in all kinds of things:
Code:int PowerRemaining = scePowerGetBatteryLifePercent();
-
07-03-2007, 03:42 AM #5304QJ Gamer Green
- Registriert seit
- Jul 2006
- Ort
- Middle Europe
- Beiträge
- 1.281
- Points
- 11.800
- Level
- 71
- Downloads
- 0
- Uploads
- 0
yeah thats what i thought:
but im getting error:Code:int bat = scePowerGetBatteryLifePercent();
and also at the top i have:$ make
psp-gcc -I. -I/usr/local/pspdev/psp/sdk/include -O2 -G0 -Wall -D_PSP_FW_VERSION=
150 -c -o main.o main.c
main.c:20: error: initializer element is not constant //this is that line
make: *** [main.o] Error 1
# include <psppower.h>[1 Year QJ Member]
[LUA Coder and C Learner]
[Ball Revamped Clone v0.1]
[Phil's Shooting Range v0.3]
[HideFile PRX v2]
[SSR PRX v1.1]
-
07-03-2007, 03:48 AM #5305QJ Gamer Blue
- Registriert seit
- Aug 2006
- Ort
- c:\Program Files\World of Warcraft\WoW.exe
- Beiträge
- 98
- Points
- 4.031
- Level
- 40
- Downloads
- 0
- Uploads
- 0
make sure you have these:
Code:#include <pspkernel.h> #include <pspdebug.h> #include <pspctrl.h> #include <pspdisplay.h> #include <stdio.h> #include <pspmoduleinfo.h> #include <psppower.h>
make sure this is in your makefile
Code:LIBS = -lpsppower
-
07-03-2007, 04:21 AM #5306QJ Gamer Green
- Registriert seit
- Jul 2006
- Ort
- Middle Europe
- Beiträge
- 1.281
- Points
- 11.800
- Level
- 71
- Downloads
- 0
- Uploads
- 0
still same error o_O strange....... but anyway thx for help ;)

probably im doing something wrong...
and how would you print it? just:
printf("%d",bat)
??[1 Year QJ Member]
[LUA Coder and C Learner]
[Ball Revamped Clone v0.1]
[Phil's Shooting Range v0.3]
[HideFile PRX v2]
[SSR PRX v1.1]
-
07-03-2007, 04:35 AM #5307QJ Gamer Blue
- Registriert seit
- Aug 2006
- Ort
- c:\Program Files\World of Warcraft\WoW.exe
- Beiträge
- 98
- Points
- 4.031
- Level
- 40
- Downloads
- 0
- Uploads
- 0
yeah, thats right, as long as you have
in there.Code:#define printf pspDebugScreenPrintf
-
07-03-2007, 04:55 AM #5308QJ Gamer Gold

- Registriert seit
- Jul 2005
- Ort
- everywhere
- Beiträge
- 3.526
- Points
- 17.453
- Level
- 84
- Downloads
- 1
- Uploads
- 0
when making a function how can i return the info to the input command for example:
void function(int input){
input = 6;
}
int number=3;
function(number);
of course this isn't practical however how would i return the input 6 to number so i change it's value to 6 while keeping the function void and no need for a return1. Failed....again...
2. http://slicer.gibbocool.com/ stay updated on all my projects
3. it'll be 5 years in june, that's nearly 1/4 of my life on this planet that i've visited these forums, what a ride it has been
-
07-03-2007, 05:06 AM #5309QJ Gamer Silver

- Registriert seit
- Jun 2006
- Ort
- UK
- Beiträge
- 2.326
- Points
- 10.263
- Level
- 67
- Downloads
- 0
- Uploads
- 0
C or C++?
Zitat von slicer4ever
[Blog] [Portfolio]
[Homebrew Illuminati - Serious Homebrew Development Forums]
[I want to make Homebrew FAQ] [How I broke into the Games Industry]
[Programming Book List] [Programming Article List]
-
07-03-2007, 05:09 AM #5310
void function(int *input)
Zitat von slicer4ever
{
*input=6;
}
function(&number);
That's what U wanted?


LinkBack URL
About LinkBacks
Mit Zitat antworten




Hello everyone I am new here and I am glad to be part of this amazing community and I think there...
New to forum