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 Slasher Well make your bullets into a struct, then use a for loop to go through them and ...
-
12-15-2007, 04:59 PM #7111QJ Gamer Silver

- Registriert seit
- May 2006
- Ort
- Behind you.
- Beiträge
- 1.814
- Points
- 10.921
- Level
- 69
- Downloads
- 0
- Uploads
- 0
Zitat von Slasher
Ok, i tried something like that, but i couldn't get it working. I am sticking with my old code:
How can i modify THIS code to make more than one weapon appear on the screen. Obviously, since i am using on one blitAlphaImageToScreen, the same image refreshes when i hold Square. Therefore, onle one bullet appears one the screen no matter how much i change the speed of the bullet. So my question is, how do i modify my code?Code://Square if (pad.Buttons & PSP_CTRL_SQUARE) { //Shoot FireTimer++; } /******************* Shooting ********************/ //Fresh Shot Ready if (FireTimer < 1) { WeaponPosX = SpaceshipPosX + SpaceshipWidth; WeaponPosY = SpaceshipPosY + 15; FireTimer = 0; } //Active Shoot if (FireTimer > 1) { if (FireTimer < 4) { WAV_Play(fire1); } blitAlphaImageToScreen(0, 0, WeaponWidth, WeaponHeight, Weapon, WeaponPosX, WeaponPosY); FireTimer++; WeaponPosX += WeaponSpeed; } //Refresh Shooting if (FireTimer > WeaponDistance) { WeaponPosX = SpaceshipPosX + SpaceshipWidth; WeaponPosY = SpaceshipPosY + 15; FireTimer = 0; }
Thanks!
Calypso - Enjoy the excellent 2D space shooter:
http://dl.qj.net/Calypso-v1-PSP-Home...6542/catid/195
"Quoting yourself in your signature means you love to masterbate while looking at the mirror." -me (oh, wait...)
-
12-15-2007, 05:02 PM #7112Developer and Tutor.
- Registriert seit
- Jul 2007
- Ort
- Widnes, England
- Beiträge
- 1.649
- Points
- 8.736
- Level
- 62
- My Mood
-
- Downloads
- 0
- Uploads
- 0
argh im new to coding in c but im only trying to add something into lua player could someone please help me figure out how to fix this error please
thanksCode:src/luasystem.cpp: In function 'int lua_IRKeybGetKey(lua_State*)': src/luasystem.cpp:58: error: invalid conversion from 'int' to 'void*' src/luasystem.cpp:58: error: initializing argument 1 of 'int pspIrKeybReadinpu t(void*, int*)' src/luasystem.cpp:58: error: invalid conversion from 'int' to 'int*' src/luasystem.cpp:58: error: initializing argument 2 of 'int pspIrKeybReadinpu t(void*, int*)' make: *** [src/luasystem.o] Error 1
im sure its something simple like ive put int instead of char or something
** eagerly waits for help------ FaT3oYCG -----
AKA Craig, call me what you want to It's your preference.
My Website: http://www.modern-gamer.co.uk/
Currently working on:
(0) MediaGrab
(0) PGE Gears Of War - On hold (Very large project).
(0) PS???? -On Hold A tactical 2d side scrolling game involving AI and online multiplayer features. - Tile engine nearley finished (1 bug to fix).
-
12-15-2007, 05:03 PM #7113I'm back!

- Registriert seit
- Feb 2007
- Ort
- England
- Beiträge
- 902
- Points
- 8.236
- Level
- 61
- Downloads
- 0
- Uploads
- 0
*Sigh*... The whole point of me making a new one and not editing the current one is so I can run them side by side. I want to run the normal pspbtcnf.bin file, and then when I run an app, it will reboot the pspbtcnf_alt.bin file, ultimately going through that bootup, and not the Sony/Dark_AleX one.
Zitat von Mr305
-Aura
-
12-15-2007, 05:26 PM #7114
I don't have one to look at, so I don't know exactly what type of file it is. I know htat pspbtcnf.txt is a text file with a bunch of .prx paths in it, but I doubt that's what the .bin file is. Have you tried a simple sceKernelLoadExec()?
Zitat von Auraomega
[IMG]http://upload.wikimedia.org/wikipedia/commons/thumb/c/c5/Zoso.svg/744px-Zoso.svg.png[/IMG]
Looking for some good C programming tutorials for the PSP? Look no further! [URL="http://psp-coding.com/"]PSP-Coding.com[/URL] is your source for all your PSP coding needs.
-
12-15-2007, 05:43 PM #7115QJ Gamer Bronze
- Registriert seit
- Mar 2007
- Beiträge
- 758
- Points
- 8.665
- Level
- 62
- Downloads
- 0
- Uploads
- 0
Can we see the code that you tried to add?
Zitat von FaT3oYCG
-
12-15-2007, 08:10 PM #7116Developer and Tutor.
- Registriert seit
- Jul 2007
- Ort
- Widnes, England
- Beiträge
- 1.649
- Points
- 8.736
- Level
- 62
- My Mood
-
- Downloads
- 0
- Uploads
- 0
yeah sure here it is
i took out the bit im having the problem with coz i have tried a few different waysCode:static int lua_IRKeybStart(lua_State *L) { int argc = lua_gettop(L); if (argc != 2) return luaL_error(L, "two arguments expected (config file[path], kernel mode[1/0])"); const char* config_file = luaL_checkstring(L, 1); int kernel_mode = luaL_checkint(L, 2); pspIrKeybInit(config_file, kernel_mode); return 0; } static int lua_IRKeybSetMode(lua_State *L) { int argc = lua_gettop(L); if (argc != 1) return luaL_error(L, "one argument expected (mode)"); int mode = luaL_checkint(L, 1); pspIrKeybOutputMode(mode); return 0; } static int lua_IRKeybGetMode(lua_State *L) { int argc = lua_gettop(L); if (argc != 0) return luaL_error(L, "no arguments expected"); pspIrKeybGetOutputMode(); return 0; } static int lua_IRKeybGetKey(lua_State *L) { pspIrKeybReadinput(); - ???????????????? } static int lua_IRKeybEnd(lua_State *L) { int argc = lua_gettop(L); if (argc != 0) return luaL_error(L, "no arguments expected"); pspIrKeybFinish(); return 0; }
im integrating the irkeyboard functionality into luaplayer and it all works except for the main part getting key input
lol
so basically i would like some help so that i can get it up and running thanks
here is a cutout from the file im reading it from
Code:* @param buffer - Receive buffer. * @param length - Length of the received data. * * @par Example: * @code * unsigned char buffer[255]; * int length; * * while( 1 ) { * if( pspIrKeybReadinput( buffer, &length ) == 0 && length > 0) * // Do something with the read keyboard data * processKeyboardData( buffer, length ); * tick(); // this is a non blocking read * } * @endcode * * @returns PspIrKeyResults constant. */ int pspIrKeybReadinput(void* buffer, int *length);------ FaT3oYCG -----
AKA Craig, call me what you want to It's your preference.
My Website: http://www.modern-gamer.co.uk/
Currently working on:
(0) MediaGrab
(0) PGE Gears Of War - On hold (Very large project).
(0) PS???? -On Hold A tactical 2d side scrolling game involving AI and online multiplayer features. - Tile engine nearley finished (1 bug to fix).
-
12-15-2007, 08:32 PM #7117lol

- Registriert seit
- Aug 2006
- Ort
- Whittier, CA
- Beiträge
- 5.791
- Points
- 20.859
- Level
- 91
- Downloads
- 0
- Uploads
- 0
If I remember correctly SG57 integrated his IR keyboard into Lua Player, I have the source somewhere....
EDIT:
Spoiler for codez:
-
12-15-2007, 09:01 PM #7118QJ Gamer Bronze

- Registriert seit
- Aug 2007
- Ort
- Australia
- Beiträge
- 659
- Points
- 8.045
- Level
- 60
- Downloads
- 0
- Uploads
- 0
Hey guys, Does anyone know another lib other than OSLib and WAVplayer that loads .WAV's? Thanks
-
12-16-2007, 03:58 AM #7119QJ Gamer Silver

- Registriert seit
- Jan 2006
- Ort
- Germany
- Beiträge
- 926
- Points
- 14.087
- Level
- 77
- Downloads
- 0
- Uploads
- 0
triEngine :P
Raphs board rules #31: Excessive use of punctuation is either a sign of a lesser ego or a small mind. Avoid it if you don't want to look like a total moron.
Raphs board rules #17: When you need to ask whether you are capable of doing something, you are not.
Raphs board rules #2: Exploits aren't found by changing version numbers, blindly merging data into a file or turning your PSP upside down.
Raphs board rules #1: If you have no clue how exploits work, don't come up with ideas about them.
-
12-16-2007, 06:47 AM #7120I'm back!

- Registriert seit
- Feb 2007
- Ort
- England
- Beiträge
- 902
- Points
- 8.236
- Level
- 61
- Downloads
- 0
- Uploads
- 0
The .bin file is the new versions for the 3.50+ firmwares, its basically all the pspbtcnf files combined, so you have the VSH, GAME, UPDATER, POPS, and all the other types in it.
Zitat von Judas
I doubt sceKernelLoadExec will work, because you can't loadexec a module from flash as far as I'm aware, but if you know of any way that this can be bypassed it would be extreamly useful :)
-Aura
-
12-16-2007, 06:52 AM #7121
Well, you can't use it when it's in the flash. But you can copy it to the MS, load it, then delete. It might work. I never really had a chance to get that in depth before I sold my PSP, so I'm just guessing here.
Zitat von Auraomega
[IMG]http://upload.wikimedia.org/wikipedia/commons/thumb/c/c5/Zoso.svg/744px-Zoso.svg.png[/IMG]
Looking for some good C programming tutorials for the PSP? Look no further! [URL="http://psp-coding.com/"]PSP-Coding.com[/URL] is your source for all your PSP coding needs.
-
12-16-2007, 06:59 AM #7122I'm back!

- Registriert seit
- Feb 2007
- Ort
- England
- Beiträge
- 902
- Points
- 8.236
- Level
- 61
- Downloads
- 0
- Uploads
- 0
Ah, I need it to specifically load from the flash, thats whats causing me so many problems.
This question is most probably aimed at Raphael, is there anyway I can loadexec a module in flash? Or, if I load a module using sceKernelLoadExecBufferPl ain, and the file containing the buffer was on flash0, will it work, or just return the same error because the buffer came from something from flash?
-Aura
-
12-16-2007, 07:22 AM #7123
Wait, I'm pretty sure you can load a module from the flash, as I once loaded an EBOOT that was written to the flash. Loading an EBOOT is a bit different, but it still uses sceKernelLoadExec.
Zitat von Auraomega
[IMG]http://upload.wikimedia.org/wikipedia/commons/thumb/c/c5/Zoso.svg/744px-Zoso.svg.png[/IMG]
Looking for some good C programming tutorials for the PSP? Look no further! [URL="http://psp-coding.com/"]PSP-Coding.com[/URL] is your source for all your PSP coding needs.
-
12-16-2007, 08:32 AM #7124QJ Gamer Silver

- Registriert seit
- Jan 2006
- Ort
- Germany
- Beiträge
- 926
- Points
- 14.087
- Level
- 77
- Downloads
- 0
- Uploads
- 0
You can load modules from flash, and the LoadExecBufferPlain method doesn't know anything about where the buffer came from, so you definitely should be able to use it.
Zitat von Auraomega
However, the pspbtcfn.bin file isn't an executable you can load like this. It's just a (binary) list of modules to load, so if you want to use a new created list on boot, you'd have to create a backup, overwrite the original and reboot the PSP, then restore the old one on startup. That or you find a way to tell the IPL to load the list from a different file. You'd have to ask DAX or someone knowledged on this topic though.Raphs board rules #31: Excessive use of punctuation is either a sign of a lesser ego or a small mind. Avoid it if you don't want to look like a total moron.
Raphs board rules #17: When you need to ask whether you are capable of doing something, you are not.
Raphs board rules #2: Exploits aren't found by changing version numbers, blindly merging data into a file or turning your PSP upside down.
Raphs board rules #1: If you have no clue how exploits work, don't come up with ideas about them.
-
12-16-2007, 08:44 AM #7125I'm back!

- Registriert seit
- Feb 2007
- Ort
- England
- Beiträge
- 902
- Points
- 8.236
- Level
- 61
- Downloads
- 0
- Uploads
- 0
Well I want to either load a different module from flash, hence the sceKernelLoadExec, or load a pspbtcnf.bin file, for which I've been using sctrlKernelExitVSH and supplying a pspbtcnf.bin file to load:
But it only ever loads pspbtcnf.bin. I've also tried writing a text format version too, just to make sure that it doesn't only accept that.Code:struct SceKernelLoadExecVSHParam param; u32 error; u32 vshmain_args[0x20/4]; memset(¶m, 0, sizeof(param)); memset(vshmain_args, 0, sizeof(vshmain_args)); vshmain_args[0/4] = 0x0400; vshmain_args[4/4] = 0x20; vshmain_args[0x14/4] = 0xFFFFFFFF; param.size = sizeof(param); param.args = 0x400; param.argp = vshmain_args; param.vshmain_args_size = 0x400; param.vshmain_args = vshmain_args; param.configfile = "flash0:/kn/pspbtcnf_alt.bin"; sctrlKernelExitVSH(¶m);
Also, when I try loadexec'ing a file from flash, I get this error, 0x80020147 (I think, can't check right now), which is SCE_KERNEL_ERROR_PROHIBIT _LOADEXEC_DEVICE, I also got 0x80020146 which is SCE_KERNEL_ERROR_PROHIBIT _LOADMODULE_DEVICE
-Aura
-= Double Post =-
Ok, I just checked, and it appears the error is 0x80020149 SCE_KERNEL_ERROR_ILLEGAL_ PERM_CALL.Geändert von Auraomega (12-16-2007 um 10:10 AM Uhr) Grund: Automerged Doublepost
-
12-16-2007, 12:27 PM #7126Heroes never die

- Registriert seit
- Aug 2006
- Ort
- ...........
- Beiträge
- 1.323
- Points
- 8.645
- Level
- 62
- Downloads
- 0
- Uploads
- 0
oke it's a lon g time ago I have been programming but
vshmain_args[4/4] = 0x20;
=?=
vshmain_args[1] = 0x20;
-
12-16-2007, 12:50 PM #7127QJ Gamer Platinum
- Registriert seit
- Dec 2005
- Ort
- h0000000rj
- Beiträge
- 12.867
- Points
- 57.528
- Level
- 100
- Downloads
- 0
- Uploads
- 0
What about it? It's the same thing. Alex used 4/4 to remind himself of the storage size of each element of the array (4 bytes).
[I fail @ life]
-
12-16-2007, 12:55 PM #7128I'm back!

- Registriert seit
- Feb 2007
- Ort
- England
- Beiträge
- 902
- Points
- 8.236
- Level
- 61
- Downloads
- 0
- Uploads
- 0
Ah thanks for that, I did wonder myself, I just copied it from the OE source codes, I guess it explains and I can put it how I want without fear of it not working :)
-Aura
-
12-16-2007, 11:43 PM #7129QJ Gamer Bronze

- Registriert seit
- Aug 2007
- Ort
- Australia
- Beiträge
- 659
- Points
- 8.045
- Level
- 60
- Downloads
- 0
- Uploads
- 0
Hey guys, I was just wondering if there was a way to print an integer using printextscreen()? If i add in the [ , int to be printed] bit it comes up saying there are to many parameters. Any help would be great, thanks
-
12-17-2007, 12:50 AM #7130QJ Gamer Green
- Registriert seit
- Jul 2006
- Ort
- USA SC/NC
- Beiträge
- 699
- Points
- 5.712
- Level
- 48
- Downloads
- 0
- Uploads
- 0
I don't know what parameters the function takes but I assume that it does not use variable argument list to the function. You can add one yourself then use sprintf to format the string in the way you want. Anyway, here's a quick way out.
Zitat von Xsjado7
char buffer[32];
sprintf(buffer, "%d", 3);
printTextScreen(...,buffe r,...);
I don't know the other arguments for the function so I just replace the ellipses with the proper arguments.[CODE]Random Facts:
irc://irc.malloc.us #wtf #**********
[/CODE]
[SIZE="6"][FONT="Century Gothic"][COLOR="Blue"][URL="http://forums.**********.net"]http://forums.**********.net[/URL][/COLOR][/FONT][/SIZE]
-
12-17-2007, 08:24 AM #7131Heroes never die

- Registriert seit
- Aug 2006
- Ort
- ...........
- Beiträge
- 1.323
- Points
- 8.645
- Level
- 62
- Downloads
- 0
- Uploads
- 0
Zitat von Auraomega
Another thing learned
Zitat von FreePlay
-
12-17-2007, 10:51 AM #7132Banned for LIFE
- Registriert seit
- Oct 2006
- Ort
- East London, England
- Beiträge
- 2
- Points
- 18.744
- Level
- 86
- Downloads
- 0
- Uploads
- 0
What do these two errors mean?Code:[email protected] ~/bouncing $ make make: execvp: /usr/local/pspdev/psp/bin: Permission denied make: execvp: /usr/local/pspdev/psp/bin: Permission denied make: execvp: /usr/local/pspdev/psp/bin: Permission denied make: *** No rule to make target `Bouncing.o', needed by `Bouncing.elf'. Stop.

I am an admin on xp so I know it cant be that.
-
12-17-2007, 11:48 AM #7133I'm back!

- Registriert seit
- Feb 2007
- Ort
- England
- Beiträge
- 902
- Points
- 8.236
- Level
- 61
- Downloads
- 0
- Uploads
- 0
Hmm the first error I've never seen before, and I'm not sure what to even suggest could be the cause, but the latter error normally occurs when the system can't find the source file in respective possition to the makefile, remember if its in a different directory you need to point it to the correct directory, I.E:
E:/EBOOT/ (makefile plus eboot output)
E:/Source/ (source codes, plus .o outputs)
The makefile would need:
objs =
../source/main.o
../source/Bouncing.o
of course, the error may just be caused by the former error, and solving that may solve this also.
-Aura
-
12-17-2007, 11:53 AM #7134Banned for LIFE
- Registriert seit
- Oct 2006
- Ort
- East London, England
- Beiträge
- 2
- Points
- 18.744
- Level
- 86
- Downloads
- 0
- Uploads
- 0
:Argh: Ive googled and found nothing on the error. It has got to be my makefile because the usb sample compiles fine.
- Thanks Aura
-
12-17-2007, 12:48 PM #7135
Zitat von Blackbelttcon
does anyone no
-
12-17-2007, 05:00 PM #7136QJ Gamer Silver

- Registriert seit
- Jun 2006
- Ort
- UK
- Beiträge
- 2.326
- Points
- 10.263
- Level
- 67
- Downloads
- 0
- Uploads
- 0
Post full code and the example data.
[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]
-
12-17-2007, 05:07 PM #7137
ill pm you
-
12-18-2007, 01:15 AM #7138QJ Gamer Bronze

- Registriert seit
- Aug 2007
- Ort
- Australia
- Beiträge
- 659
- Points
- 8.045
- Level
- 60
- Downloads
- 0
- Uploads
- 0
Hey everyone, I was wondering if there's any alternative to PSP_CTRL so that it just records the initial press of a button and not you constantly holding it. Any help would be great, thanks
-
12-18-2007, 01:47 AM #7139QJ Gamer Silver

- Registriert seit
- Jan 2006
- Ort
- Germany
- Beiträge
- 926
- Points
- 14.087
- Level
- 77
- Downloads
- 0
- Uploads
- 0
triEngine again :P
Raphs board rules #31: Excessive use of punctuation is either a sign of a lesser ego or a small mind. Avoid it if you don't want to look like a total moron.
Raphs board rules #17: When you need to ask whether you are capable of doing something, you are not.
Raphs board rules #2: Exploits aren't found by changing version numbers, blindly merging data into a file or turning your PSP upside down.
Raphs board rules #1: If you have no clue how exploits work, don't come up with ideas about them.
-
12-18-2007, 01:52 AM #7140QJ Gamer Bronze

- Registriert seit
- Aug 2007
- Ort
- Australia
- Beiträge
- 659
- Points
- 8.045
- Level
- 60
- Downloads
- 0
- Uploads
- 0
dang it! lol, i would usually have no problem because id be using OSLib but im not using it so yeah. How big is TriEngine?


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