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; Now I get an error when I compile LuaPlayer. I get Spoiler for Error : [email protected] ~/source/LuaPLayer $ make psp-gcc ...
-
11-23-2007, 07:43 PM #6961lol

- Registriert seit
- Aug 2006
- Ort
- Whittier, CA
- Beiträge
- 5.791
- Points
- 20.859
- Level
- 91
- Downloads
- 0
- Uploads
- 0
Now I get an error when I compile LuaPlayer.
I get
I am pretty sure I have both libmikmod and mikmodlib installed.Spoiler for Error:
-
11-23-2007, 08:33 PM #6962It's good to be free...

- Registriert seit
- Feb 2007
- Beiträge
- 2.440
- Points
- 10.420
- Level
- 67
- Downloads
- 0
- Uploads
- 0
It seems like you have faulty version of libmikmod installed, seeing as it finds libmikmod.a, but can't link with them. Are you sure you specified --host psp when you configured it?
pəʇuɒɹɓ ɹoɟ ɓuɪɥʇou əʞɒʇ
-
11-23-2007, 10:41 PM #6963QJ Gamer Silver
- Registriert seit
- Feb 2007
- Ort
- Melbourne, Australia
- Beiträge
- 1.773
- Points
- 8.717
- Level
- 62
- My Mood
-
- Downloads
- 0
- Uploads
- 0
is there a tutorial anywhere to load externel PRXs? for 3.XX (or how to use wlanscan) :s?
WHA!?
-
11-23-2007, 11:07 PM #6964
im having a strange problem where cygwin seems to be conflicting with USBhost. I recently formatted my PC but backed up my cygwin directory. at first when I copied the cygwin folder back over I had some problems but I ran cygwin setup.exe and alls well now. However USBhost functions no longer properly work. I can confirm this because when I first ran the cygwin.bat it only said bash-3.2$ but when I closed out usbhostfs.exe it works fine. Now usbhost connects and quickly disconnects
-
11-24-2007, 03:15 AM #6965I'm back!

- Registriert seit
- Feb 2007
- Ort
- England
- Beiträge
- 902
- Points
- 8.236
- Level
- 61
- Downloads
- 0
- Uploads
- 0
I have this problem from time to time, I've found that using a different USB port helps, every so often it ends up happening in the port I switched too, which means I am forced to switch back, its a pain, but if it helps, its worth it.
Zitat von vodkkaa
-Aura
-
11-24-2007, 06:24 AM #6966QJ Gamer Bronze

- Registriert seit
- Aug 2007
- Ort
- Australia
- Beiträge
- 659
- Points
- 8.045
- Level
- 60
- Downloads
- 0
- Uploads
- 0
hey everyone,
just a quick question, how would i go about having multiple instances of an object? i wanna have to of the same object onscreen but using different coordinates. thanks
-
11-24-2007, 09:22 AM #6967It's good to be free...

- Registriert seit
- Feb 2007
- Beiträge
- 2.440
- Points
- 10.420
- Level
- 67
- Downloads
- 0
- Uploads
- 0
Um...the only way not be able to make multiple instances is to have static fields...
Zitat von Xsjado7
But something tells me you haven't abstracted the object into a class. Can we see your code?pəʇuɒɹɓ ɹoɟ ɓuɪɥʇou əʞɒʇ
-
11-24-2007, 01:32 PM #6968QJ Gamer Silver
- Registriert seit
- Feb 2007
- Ort
- Melbourne, Australia
- Beiträge
- 1.773
- Points
- 8.717
- Level
- 62
- My Mood
-
- Downloads
- 0
- Uploads
- 0
I can load an external PRX just what should the PRX look like?
Zitat von BigSanFrey
E.G what should the functions be? like printf("XRFDF"); doesn't work :s?WHA!?
-
11-24-2007, 05:09 PM #6969QJ Gamer Silver

- Registriert seit
- Oct 2006
- Ort
- Pimp'en in the US F#
- Beiträge
- 1.254
- Points
- 7.278
- Level
- 56
- Downloads
- 0
- Uploads
- 0
All right, Using OSLIB, how would I get a different off Set of an image?
im trying to use a tileset, and not sure how to go to the different tiles when blitting em'
Thank you!NEWMy New BLOG!NEWThe Wentire Worls in two Sectors....When did I get dev statz?
Spoiler for my PSP homebrewReleases:Spoiler for Great Quotes:
-
11-24-2007, 05:12 PM #6970
I guess you just wanna use the function oslCreateImageTile()
Zitat von BlackShark
It's very easy to use. Tell me if you need an example.
CheersPlaco23
Why not donate and become part of this selected list?Spoiler for Wanna see my Apps?:Spoiler for Donators:
-
11-24-2007, 05:39 PM #6971QJ Gamer Silver

- Registriert seit
- Oct 2006
- Ort
- Pimp'en in the US F#
- Beiträge
- 1.254
- Points
- 7.278
- Level
- 56
- Downloads
- 0
- Uploads
- 0
an example would help!
what are the x2 and y2 for?NEWMy New BLOG!NEWThe Wentire Worls in two Sectors....When did I get dev statz?
Spoiler for my PSP homebrewReleases:Spoiler for Great Quotes:
-
11-24-2007, 06:17 PM #6972QJ Gamer Bronze

- Registriert seit
- Aug 2007
- Ort
- Australia
- Beiträge
- 659
- Points
- 8.045
- Level
- 60
- Downloads
- 0
- Uploads
- 0
Dont worry about, iv got it pretty much sorted now. one question, in LUA you can use functions globally for several different objects. e.g:
Zitat von Archaemic
and then if you putCode:collision(object) { object.x; object.y; }
it would replace the words object with playerCode:collision(player);
my question is how would you do this in C? is it something like:
and then simplyCode:void collision(*char object) { object->x object->y }
?Code:collision(player)
any help would be great, thanks
-
11-24-2007, 06:32 PM #6973QJ Gamer Silver

- Registriert seit
- Jun 2006
- Ort
- UK
- Beiträge
- 2.326
- Points
- 10.263
- Level
- 67
- Downloads
- 0
- Uploads
- 0
[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]
-
11-24-2007, 06:52 PM #6974QJ Gamer Bronze

- Registriert seit
- Aug 2007
- Ort
- Australia
- Beiträge
- 659
- Points
- 8.045
- Level
- 60
- Downloads
- 0
- Uploads
- 0
isnt a struct just used to group chars/ints together?
-
11-24-2007, 07:32 PM #6975It's good to be free...

- Registriert seit
- Feb 2007
- Beiträge
- 2.440
- Points
- 10.420
- Level
- 67
- Downloads
- 0
- Uploads
- 0
It's used to group any type of data together.
pəʇuɒɹɓ ɹoɟ ɓuɪɥʇou əʞɒʇ
-
11-24-2007, 08:15 PM #6976QJ Gamer Bronze

- Registriert seit
- Aug 2007
- Ort
- Australia
- Beiträge
- 659
- Points
- 8.045
- Level
- 60
- Downloads
- 0
- Uploads
- 0
so how does that refer to my question?
im not trying to group anything, i just want to know if my example would work or what i would have to change
-
11-24-2007, 08:58 PM #6977It's good to be free...

- Registriert seit
- Feb 2007
- Beiträge
- 2.440
- Points
- 10.420
- Level
- 67
- Downloads
- 0
- Uploads
- 0
Well, the syntax of your code suggested you were looking for structs.
But anyway, function invocation is a bit more complex than substitution. If it's just substitution, it's called a macro. With function invocation, data is actually passed. For instance.
Try this code out. You'll see that the function a does absolutely nothing. Actually, that's not entirely true. It changes the value of b, which is the value of a copied into a local variable, which then falls out of scope, doing effectively nothing. However, because d is substituted into the function, the value of c changes after calling d. I highly discourage the use of macros. yaustar can give better reasons than I can for not using macros.Code:#define d(e) (e = 2) void a(int b) { b = 0; } int main() { int c = 1; a(c); if(c == 1) printf("This is what you will see."); else printf("This is not printed."); d(c); if(c == 2) printf("This is printed, though."); else printf("This still isn't printed."); return 0; }pəʇuɒɹɓ ɹoɟ ɓuɪɥʇou əʞɒʇ
-
11-24-2007, 11:05 PM #6978QJ Gamer Bronze

- Registriert seit
- Aug 2007
- Ort
- Australia
- Beiträge
- 659
- Points
- 8.045
- Level
- 60
- Downloads
- 0
- Uploads
- 0
thanks for the help. th reason is for asking is that iv got a function to check wether an object is at certain coordinates an i need to use the same code for alot of objects. for example:
thats one of my few functions that im going to be using several times with different objects and i want to just be able to easily substitute note for note2 and so on instead if typing the function a whole stack of times and just changing note to note2... each time. thats the best i can explain it. it would just save me a stack of time and make my code a lot lighter. also, ididnt mean to be looking for a struct that code was just, off the top of my head, what i thought it may be. thanks for the help so farCode:if (line1->y > note1->y + notetop && line1->y < note1->y + notebottom) do something;
-
11-25-2007, 03:56 AM #6979QJ Gamer Silver

- Registriert seit
- Jun 2006
- Ort
- UK
- Beiträge
- 2.326
- Points
- 10.263
- Level
- 67
- Downloads
- 0
- Uploads
- 0
For god's sake. You asked how to do this in C and using structs was the answer.
Code:typedef struct _Line { int mX; int mY; } Line; typedef struct _Object { int mX; int mY; int mWidth; int mHeight; } Object; // Using direct copy of your function void function( Line * aLine, Object * aObject ) { if( NULL != aLine && NULL != aObject ) { if( aLine->y > aObject->y + aObject->mWidth && aLine->y < aObject->y + aObject->mHeight ) { // Do something } } } int main() { Line someLine; someLine->mX = 300; someLine->mY = 200; Object someObject; someObject->mX = 320; someObject->mY = 200; someObject->mWidth = 10; someObject->mHeight = 20; Object someObject2; someObject2->mX = 220; someObject2->mY = 200; someObject2->mWidth = 20; someObject2->mHeight = 20; function( &someLine, &someObject ); function( &someLine, &someObject2 ); return 0; }[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]
-
11-26-2007, 12:52 AM #6980I'm back!

- Registriert seit
- Feb 2007
- Ort
- England
- Beiträge
- 902
- Points
- 8.236
- Level
- 61
- Downloads
- 0
- Uploads
- 0
Anyone?
Zitat von Auraomega
-Aura
-
11-26-2007, 09:54 AM #6981QJ Gamer Green
- Registriert seit
- Apr 2006
- Ort
- England ~¦¦¦|+|¦¦¦~
- Beiträge
- 1.112
- Points
- 9.165
- Level
- 64
- My Mood
-
- Downloads
- 0
- Uploads
- 0
Can i just ask you yaustar, what's the difference between defining a struct type like this:
and this:Code:typedef struct _Test { int h; char y; } Test;
ThanxCode:typedef struct { int h; char y; } Test;...Just Returned To The Scene...
-
11-26-2007, 10:33 AM #6982QJ Gamer Silver

- Registriert seit
- Jun 2006
- Ort
- UK
- Beiträge
- 2.326
- Points
- 10.263
- Level
- 67
- Downloads
- 0
- Uploads
- 0
Probably none. It is just the style I am used to.
[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]
-
11-26-2007, 10:54 AM #6983QJ Gamer Silver

- Registriert seit
- Jan 2006
- Ort
- Germany
- Beiträge
- 926
- Points
- 14.087
- Level
- 77
- Downloads
- 0
- Uploads
- 0
With the first you can also create a variable of that type by using the following:
Zitat von JaSo PsP
BTW, you can even name it like that:Code:struct _Type variable;
Code:typedef struct Type { ... } Type;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.
-
11-27-2007, 12:04 AM #6984Developer

- Registriert seit
- Aug 2007
- Beiträge
- 74
- Points
- 3.206
- Level
- 35
- Downloads
- 0
- Uploads
- 0
Small mistake: this wont compile, someLine is not pointer you'll get invalid type doing someLine->mX, either change to someLine.mX or Line *someLine (same with the others).
Zitat von yaustar
PSP PRX LibDoc's Lives On!
http://silverspring.lan.st/
My new home:
http://my.malloc.us/silverspring/
-
11-27-2007, 02:10 AM #6985QJ Gamer Silver

- Registriert seit
- Jun 2006
- Ort
- UK
- Beiträge
- 2.326
- Points
- 10.263
- Level
- 67
- Downloads
- 0
- Uploads
- 0
Oops. My bad:
Code:int main() { Line someLine; someLine.mX = 300; someLine.mY = 200; Object someObject; someObject.mX = 320; someObject.mY = 200; someObject.mWidth = 10; someObject.mHeight = 20; Object someObject2; someObject2.mX = 220; someObject2.mY = 200; someObject2.mWidth = 20; someObject2.mHeight = 20; function( &someLine, &someObject ); function( &someLine, &someObject2 ); return 0; }[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]
-
11-28-2007, 12:39 PM #6986It's good to be free...

- Registriert seit
- Feb 2007
- Beiträge
- 2.440
- Points
- 10.420
- Level
- 67
- Downloads
- 0
- Uploads
- 0
So I'm trying to write a plugin to grab savegame encryption keys (because keygrabber_v2 just isn't working for me...I even tried it with the WiFi switch on because I saw a reference to that in the source), but it just isn't loading. When I try to load it from a homebrew app, it loads and runs just fine. But not as a plugin. Here's my code (it's really hack-y, I've done a lot of stuff to get apiHook working without most of PSPLink's source...and I don't even know yet if it is working, or if I'm doing it right):
My exports file:Code:#include <pspiofilemgr.h> #include <psputility.h> #include <psploadcore.h> #include <pspmoduleinfo.h> #include "apihook.h" PSP_MODULE_INFO("uSEdown",0x1000, 0, 1); PSP_MAIN_THREAD_ATTR(0); static u32 sceUtilitySavedateInitStart_real = 0; int shprintf(const char *fmt, ...) { return 0; } int sceUtilitySavedataInitStart_fake(SceUtilitySavedataParam *params) { SceUID keyout = sceIoOpen("ms0:/key.bin",PSP_O_WRONLY|PSP_O_CREAT,0777); if(keyout >= 0) { sceIoWrite(keyout,((char*)params)+0x5DC, 16*sizeof(char)); sceIoClose(keyout); } return sceUtilitySavedataInitStart(params); } int module_start(SceSize args, void *argp) { sceIoClose(sceIoOpen("ms0:/ack",PSP_O_WRONLY|PSP_O_CREAT,0777)); sceUtilitySavedateInitStart_real = apiHookByName( sceKernelFindModuleByName("sceUtility_Driver")->modid,"sceUtility", "sceUtilitySavedataInitStart",(void*)sceUtilitySavedataInitStart_fake); return 0; }
and my Makefile:Code:PSP_BEGIN_EXPORTS PSP_EXPORT_START(syslib, 0, 0x8000) PSP_EXPORT_FUNC_HASH(module_start) PSP_EXPORT_VAR_HASH(module_info) PSP_EXPORT_END PSP_END_EXPORTS
I have no clue why it's not running. I've compared the source to several other plugins (e.g., keygrabber_v2 and music_plugin v0.55), but...I dunno.Code:OBJS = main.o apihook.o decodeaddr.o kmode.o libs.o util.o #CFLAGS = -G0 -O2 #Normal build CFLAGS = -G0 -g -Wall #Debug build LIBS = -lpsputility TARGET = usedown BUILD_PRX = 1 PRX_EXPORTS = exports.exp USE_KERNEL_LIBS = 1 USE_KERNEL_LIBC = 1 LDFLAGS = -nostdlib -nodefaultlibs PSPSDK=$(shell psp-config --pspsdk-path) include $(PSPSDK)/lib/build.mak
pəʇuɒɹɓ ɹoɟ ɓuɪɥʇou əʞɒʇ
-
11-28-2007, 01:33 PM #6987QJ Gamer Silver

- Registriert seit
- Jan 2006
- Ort
- Germany
- Beiträge
- 926
- Points
- 14.087
- Level
- 77
- Downloads
- 0
- Uploads
- 0
Is there a reason why you recursively keep calling your own function?Code:return sceUtilitySavedataInitStart(params);
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.
-
11-28-2007, 01:43 PM #6988It's good to be free...

- Registriert seit
- Feb 2007
- Beiträge
- 2.440
- Points
- 10.420
- Level
- 67
- Downloads
- 0
- Uploads
- 0
I'm trying to call the original function, but I figured that might be what happens. ...I was going to change that call, but I forgot. Either way, that probably ISN'T why it's not loading.
E] Corrected code that will hopefully run properly. I still don't think it'll launch, though. Let me try.
Well...hey! It launches now. Now to try and figure out why it's crashing (and there are all too many reasons it could be crashing...but it doesn't look like the stack breaking down.Code:#include <pspiofilemgr.h> #include <psputility.h> #include <psploadcore.h> #include <pspmoduleinfo.h> #include "apihook.h" PSP_MODULE_INFO("uSEdown",0x1000, 0, 1); PSP_MAIN_THREAD_ATTR(0); typedef int (*SUSIS)(SceUtilitySavedataParam *params); static SUSIS sceUtilitySavedataInitStart_real = 0; int shprintf(const char *fmt, ...) { return 0; } int sceUtilitySavedataInitStart_fake(SceUtilitySavedataParam *params) { SceUID keyout = sceIoOpen("ms0:/key.bin",PSP_O_WRONLY|PSP_O_CREAT,0777); if(keyout >= 0) { sceIoWrite(keyout,((char*)params)+0x5DC, 16*sizeof(char)); sceIoClose(keyout); } return sceUtilitySavedataInitStart_real(params); } int module_start(SceSize args, void *argp) { sceIoClose(sceIoOpen("ms0:/ack",PSP_O_WRONLY|PSP_O_CREAT,0777)); sceUtilitySavedataInitStart_real = (SUSIS) apiHookByName(sceKernelFindModuleByName( "sceUtility_Driver")->modid,"sceUtility", "sceUtilitySavedataInitStart", (void*)sceUtilitySavedataInitStart_fake); return 0; }
...
It'd probably just be a better use of my time to get keygrabber working instead of reinventing the wheel.
So I figured out why keygrabber isn't grabbing the keys. It's not hooking the functions properly. That could do it.Geändert von Archaemic (11-28-2007 um 04:37 PM Uhr)
pəʇuɒɹɓ ɹoɟ ɓuɪɥʇou əʞɒʇ
-
11-28-2007, 04:37 PM #6989lol

- Registriert seit
- Aug 2006
- Ort
- Whittier, CA
- Beiträge
- 5.791
- Points
- 20.859
- Level
- 91
- Downloads
- 0
- Uploads
- 0
How come I get this error when I try to update my PSPSDK?
$ ./toolchain.sh -p
./toolchain.sh: line 26: BUILD_SCRIPTS: bad array subscript
./toolchain.sh: line 26: : command not found
./toolchain.sh: line 26: BUILD_SCRIPTS: bad array subscript
: Failed.
-
11-28-2007, 04:46 PM #6990
if all you want to do is update the pspsdk component do this -
Zitat von Anti-QuickJay
./toolchain.sh 3 6


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