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 myschoo im not using pspdebug altogether #include <pspkernel.h> #include <pspdisplay.h> #include <pspgu.h> #include <stdio.h> #include <pspctrl.h> #include <string.h> ...
-
08-13-2007, 10:04 AM #6031
You cant proceed w/ using blit and USE_KERNEL_LIBS.
Zitat von myschoo
im afraid u might have to ditch status system totally or stop using Kmode only funcs.
-
08-13-2007, 10:11 AM #6032QJ Gamer Green
- Registriert seit
- Jul 2006
- Ort
- Middle Europe
- Beiträge
- 1.281
- Points
- 11.800
- Level
- 71
- Downloads
- 0
- Uploads
- 0
blit.c works with kernel mode... but then when i wanted to use stdio.h file functions, it didnt compile and my problems started -_-
[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]
-
08-13-2007, 11:56 AM #6033I'm back!

- Registriert seit
- Feb 2007
- Ort
- England
- Beiträge
- 902
- Points
- 8.236
- Level
- 61
- Downloads
- 0
- Uploads
- 0
Zitat von myschoo
Have you tried?Code:include# <pspsysmem.h>
This is the header that contains sceKernelMaxFreeMemSize, so it would only be logical to include that if its not working...
-Aura
-
08-13-2007, 12:08 PM #6034QJ Gamer Green
- Registriert seit
- Jul 2006
- Ort
- Middle Europe
- Beiträge
- 1.281
- Points
- 11.800
- Level
- 71
- Downloads
- 0
- Uploads
- 0
yeah i did it... same error... strange
[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]
-
08-13-2007, 12:22 PM #6035It's good to be free...

- Registriert seit
- Feb 2007
- Beiträge
- 2.440
- Points
- 10.420
- Level
- 67
- Downloads
- 0
- Uploads
- 0
-lpspuser
pəʇuɒɹɓ ɹoɟ ɓuɪɥʇou əʞɒʇ
-
08-13-2007, 12:29 PM #6036QJ Gamer Green
- Registriert seit
- Jul 2006
- Ort
- Middle Europe
- Beiträge
- 1.281
- Points
- 11.800
- Level
- 71
- Downloads
- 0
- Uploads
- 0
nope
[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]
-
08-13-2007, 12:33 PM #6037It's good to be free...

- Registriert seit
- Feb 2007
- Beiträge
- 2.440
- Points
- 10.420
- Level
- 67
- Downloads
- 0
- Uploads
- 0
Weird. sceKernelMaxFreeMemSize is in pspuser, so that should have fixed it...
pəʇuɒɹɓ ɹoɟ ɓuɪɥʇou əʞɒʇ
-
08-13-2007, 12:42 PM #6038
Use_kernel_libs flag discards -lpspuser. (=_=)
Zitat von Archaemic
-
08-13-2007, 12:54 PM #6039QJ Gamer Green
- Registriert seit
- Jul 2006
- Ort
- Middle Europe
- Beiträge
- 1.281
- Points
- 11.800
- Level
- 71
- Downloads
- 0
- Uploads
- 0
strange.... i will probably have to rewrite file system to use only sceIo functions :/
[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]
-
08-13-2007, 04:18 PM #6040QJ Gamer Blue
- Registriert seit
- Feb 2007
- Ort
- Florida
- Beiträge
- 214
- Points
- 4.031
- Level
- 40
- Downloads
- 0
- Uploads
- 0
I'm trying to figure out how to make a varible stay 0 ONLY if no buttons are being pressed...I can't figure out how to do that..Can anyone help?
If I try, the varible will always be 0, so there's gotta be someway..
-
08-13-2007, 04:23 PM #6041
Did u miss my post few pages back?
Zitat von MrChaos
-
08-13-2007, 04:39 PM #6042I'm back!

- Registriert seit
- Feb 2007
- Ort
- England
- Beiträge
- 902
- Points
- 8.236
- Level
- 61
- Downloads
- 0
- Uploads
- 0
Zitat von MrChaos
I've been using this in an app I've been working on, not sure if this is what you want though...
-AuraCode:int button; //global SceCtrlData pad; //another global, can be used here, or made local void buttoncheck(SceSize args, void* argp) { //sceCtrlData pad; //un-comment if using as a local while(1){ sceCtrlReadBufferPositive(&pad, 1); if(pad.Buttons & 0xFFFF) button = 1; sceCtrlReadBufferNegatve(&pad, 1); //only use if required if(pad.Buttons & 0xFFFF) button = 0; // || || || || sceKernelDelayThread(10000); //make sure other threads get processing time } } void buttoncheckinit(SceSize args, void* argp) { SceUID buttonchect = sceKernelCreateThread("buttoncheck", buttoncheck, 0x30, 0x10000, 0, NULL); sceKernelStartThread(buttoncheckt, args, argp); } int main(SceSize args, void* argp) { buttoncheckinit(args, argp); //rest of code here }
-
08-14-2007, 05:32 AM #6043QJ Gamer Green
- Registriert seit
- Jul 2006
- Ort
- Middle Europe
- Beiträge
- 1.281
- Points
- 11.800
- Level
- 71
- Downloads
- 0
- Uploads
- 0
code:
result:sprintf(buffer,"Hello");
printf("%s",buffer);
sprintf(buffer,"Hi");
printf("%s",buffer);
Hello
Hillo
but i need:
Hello
Hi
does anyone know how to clear buffer? i tried free(buffer) but that just freezes my app[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]
-
08-14-2007, 05:40 AM #6044I'm back!

- Registriert seit
- Feb 2007
- Ort
- England
- Beiträge
- 902
- Points
- 8.236
- Level
- 61
- Downloads
- 0
- Uploads
- 0
I'm not sure, but putting
Zitat von myschoo
may do the trick, I think you can also NULL it, but again, I'm not totally sure.Code:buffer = "";
Alternatively, you could do...which will only give the first 2 letters, this probably will get tedious and if you're using variable length, then its not going to really be suitable, but I do know for a fact that works.Code:sprintf(buffer,"Hello"); printf("%s",buffer); sprintf(buffer,"Hi"); printf("%0.2s",buffer);
As for free(buffer) not working, thats freeing up the memory, when you then try and sprint, it has nowhere to actually store the value and causes a buffer overflow.
-Aura
-
08-14-2007, 05:47 AM #6045QJ Gamer Green
- Registriert seit
- Jul 2006
- Ort
- Middle Europe
- Beiträge
- 1.281
- Points
- 11.800
- Level
- 71
- Downloads
- 0
- Uploads
- 0
thx i will try it ;)
also tried to use memset and still same problem o_O[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]
-
08-14-2007, 05:54 AM #6046I'm back!

- Registriert seit
- Feb 2007
- Ort
- England
- Beiträge
- 902
- Points
- 8.236
- Level
- 61
- Downloads
- 0
- Uploads
- 0
While I think about it, if you put
Zitat von myschoo
it should also work, seeing as \0 is the NULL flag, and I'm pritty sure variables stop reading once they reach a NULL flag.Code:sprintf(buffer, "Hi\0");
-Aura
-
08-14-2007, 07:50 AM #6047QJ Gamer Blue
- Registriert seit
- Jul 2007
- Beiträge
- 296
- Points
- 3.795
- Level
- 38
- Downloads
- 0
- Uploads
- 0
Code:sprintf(buffer,"Hello"); printf("%s",buffer); memset(buffer, 0, sizeof(buffer)); sprintf(buffer,"Hi"); printf("%s",buffer);
-
08-14-2007, 08:53 AM #6048Heroes never die

- Registriert seit
- Aug 2006
- Ort
- ...........
- Beiträge
- 1.323
- Points
- 8.645
- Level
- 62
- Downloads
- 0
- Uploads
- 0
or bzero(buffer , sizeof(buffer) );
-
08-14-2007, 09:35 AM #6049QJ Gamer Green
- Registriert seit
- Jul 2006
- Ort
- Middle Europe
- Beiträge
- 1.281
- Points
- 11.800
- Level
- 71
- Downloads
- 0
- Uploads
- 0
txh both of u.. it works
[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]
-
08-14-2007, 09:58 AM #6050
u could've just done
Zitat von myschoo
Code:strcpy(buffer,"Hello"); printf("%s",buffer); strcpy(buffer,"Hi"); printf("%s",buffer);Current releases:
Icon Action Replacer v1.5- latest release
Current projects:
PSP C++ IDE - Currently v1.6
RPG Paradise - Latest version at my website
-
08-14-2007, 10:07 AM #6051QJ Gamer Bronze

- Registriert seit
- Jul 2006
- Beiträge
- 90
- Points
- 4.912
- Level
- 44
- Downloads
- 0
- Uploads
- 0
edit: my bad, read wrong >_>, sorry about that
-
08-14-2007, 10:10 AM #6052I'm back!

- Registriert seit
- Feb 2007
- Ort
- England
- Beiträge
- 902
- Points
- 8.236
- Level
- 61
- Downloads
- 0
- Uploads
- 0
If you actually bothered to read both peices of code properly you would notice that the original used sprintf, and that uses strcpy.
Zitat von nataku92
-Aura
-
08-14-2007, 10:35 AM #6053
Zitat von pspballer07
or even simpler:
orCode:printf("%s\n", "Hello"); printf("%s", "Hi");
Code:printf("Hello\n"); printf("Hi");
-
08-14-2007, 10:37 AM #6054I'm back!

- Registriert seit
- Feb 2007
- Ort
- England
- Beiträge
- 902
- Points
- 8.236
- Level
- 61
- Downloads
- 0
- Uploads
- 0
Zitat von califrag
would be even simplier, but I doubt anyone is going to want their program to just sayCode:printf("Hello"); printf("Hi");
Hello
Hi
The string is going to have different values store in it no doubt, which makes both of the above useless.
-Aura
-
08-14-2007, 10:42 AM #6055QJ Gamer Green
- Registriert seit
- Jul 2006
- Ort
- Middle Europe
- Beiträge
- 1.281
- Points
- 11.800
- Level
- 71
- Downloads
- 0
- Uploads
- 0
^^^^^^^^^^^^^^
listen to him ;)
[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]
-
08-14-2007, 12:01 PM #6056I'm back!

- Registriert seit
- Feb 2007
- Ort
- England
- Beiträge
- 902
- Points
- 8.236
- Level
- 61
- Downloads
- 0
- Uploads
- 0
How would I go about streaming an mp3? The only good peice of source code I've found for playing music loads it directly to memory, and needless to say, an mp3 takes a big chunk of the PSPs RAM.
-Aura
-
08-14-2007, 12:15 PM #6057
Manually Keep filling libmad's stream decoding buffer as it exhausts.
Zitat von Auraomega
-4m psp
-
08-14-2007, 12:29 PM #6058
psp-programming.com has a tut for that
Zitat von Auraomega
Current releases:
Icon Action Replacer v1.5- latest release
Current projects:
PSP C++ IDE - Currently v1.6
RPG Paradise - Latest version at my website
-
08-14-2007, 12:32 PM #6059QJ Gamer Blue
- Registriert seit
- Feb 2007
- Ort
- Florida
- Beiträge
- 214
- Points
- 4.031
- Level
- 40
- Downloads
- 0
- Uploads
- 0
That may be what I need, but what would be the use for sceCtrlReadBufferNegative ?
Zitat von Auraomega
-
08-14-2007, 12:36 PM #6060I'm back!

- Registriert seit
- Feb 2007
- Ort
- England
- Beiträge
- 902
- Points
- 8.236
- Level
- 61
- Downloads
- 0
- Uploads
- 0
Zitat von MrChaos
I wasn't sure if you wanted it so that it registers a 1 ONLY when a button is being pressed or not. If you want a 1 to register only when a button is pressed, then when nothing is pressed the negative kicks in, and allows the code under it to run. As I said, only use if you need it
I checked on there about 5 minutes before posting here, the only tutorial I could find was for loading it all into RAM, which isn't really suitable.
Zitat von pspballer07
How would I go about doing that? Limiting how much is read should be easy, but updating everytime its running low, not sure how I should do that...
Zitat von Mr305
-Aura


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