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; what's diffrents with wait(60); = 1 second and your way? I know how I can get nickname, but what do ...
-
04-01-2007, 07:26 AM #3631QJ Gamer Blue
- Registriert seit
- Mar 2007
- Ort
- Holland..
- Beiträge
- 154
- Points
- 4.022
- Level
- 40
- Downloads
- 0
- Uploads
- 0
what's diffrents with wait(60); = 1 second and your way?
I know how I can get nickname, but what do I have to add to:
int menuPrintf(char *string, u32 color) {
pspDebugSetTextColor(colo r);
return printf("%s",string);
}
so I can alsow print nickname; nickname is stored in nameBuffer max 11 chars
Something like: hello, "nickname" welcome to my program,
-
04-01-2007, 07:55 AM #3632Heroes never die

- Registriert seit
- Aug 2006
- Ort
- ...........
- Beiträge
- 1.323
- Points
- 8.645
- Level
- 62
- Downloads
- 0
- Uploads
- 0
Code:void menuPrintf(char *string, u32 color,...) { pspDebugSetTextColor(colo r); va_list arguments; va_start(arguments, text ); printf(string , arguments); va_end( arguments ); }
USE CODE TAGS!!!!!!!!!!!!!!!!
-
04-01-2007, 08:07 AM #3633QJ Gamer Blue
- Registriert seit
- Mar 2007
- Ort
- Holland..
- Beiträge
- 154
- Points
- 4.022
- Level
- 40
- Downloads
- 0
- Uploads
- 0
sorry for not using code taggs,
you code doesn't work
, i am getting some serieus error's
all the va_.. arn't decleared
-
04-01-2007, 08:11 AM #3634Heroes never die

- Registriert seit
- Aug 2006
- Ort
- ...........
- Beiträge
- 1.323
- Points
- 8.645
- Level
- 62
- Downloads
- 0
- Uploads
- 0
#include <stdarg.h>
-
04-01-2007, 08:19 AM #3635QJ Gamer Blue
- Registriert seit
- Mar 2007
- Ort
- Holland..
- Beiträge
- 154
- Points
- 4.022
- Level
- 40
- Downloads
- 0
- Uploads
- 0
ok i'll test it ;)
edit:
it doesn't work
i am getting these errors, they are in dutch but hallo007 you are dutch(belgian) to so you will understand it
Code:[email protected]:~/Projecten/Flash Magic$ make kxploit 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: In functie ‘printc’: main.c:166: fout: ‘text’ is hier niet gedeclareerd (eerste gebruik in deze functie) main.c:166: fout: (Elke niet-gedeclareerde naam wordt slechts één main.c:166: fout: keer vermeld voor elke functie waarin hij staat.) main.c:166: let op: de tweede parameter van ‘va_start’ is niet het laatste benoemde argument main.c: In functie ‘main’: main.c:668: let op: passing argument 2 of ‘printc’ makes integer from pointer without a cast make: *** [main.o] Fout 1 [email protected]:~/Projecten/Flash Magic$ make kxploit 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: In functie ‘printc’: main.c:166: fout: ‘text’ is hier niet gedeclareerd (eerste gebruik in deze functie) main.c:166: fout: (Elke niet-gedeclareerde naam wordt slechts één main.c:166: fout: keer vermeld voor elke functie waarin hij staat.) main.c:166: let op: de tweede parameter van ‘va_start’ is niet het laatste benoemde argument main.c: In functie ‘main’: main.c:668: let op: passing argument 2 of ‘printc’ makes integer from pointer without a cast make: *** [main.o] Fout 1
Geändert von Kwastie (04-01-2007 um 08:35 AM Uhr)
-
04-01-2007, 08:40 AM #3636Heroes never die

- Registriert seit
- Aug 2006
- Ort
- ...........
- Beiträge
- 1.323
- Points
- 8.645
- Level
- 62
- Downloads
- 0
- Uploads
- 0
you use somewhere a variabel text without doing this:
int text
char *text
bool text
char text[]
char *text[]
...
-
04-01-2007, 08:45 AM #3637QJ Gamer Blue
- Registriert seit
- Mar 2007
- Ort
- Holland..
- Beiträge
- 154
- Points
- 4.022
- Level
- 40
- Downloads
- 0
- Uploads
- 0
hmm somewere, everywere.. XD :S lol
-
04-01-2007, 09:08 AM #3638It's good to be free...

- Registriert seit
- Feb 2007
- Beiträge
- 2.440
- Points
- 10.420
- Level
- 67
- Downloads
- 0
- Uploads
- 0
C is strongly typed, so you need to declare all of your variables. Otherwise, it won't know what type they are.
-
04-01-2007, 10:10 AM #3639QJ Gamer Blue
- Registriert seit
- Mar 2007
- Ort
- Holland..
- Beiträge
- 154
- Points
- 4.022
- Level
- 40
- Downloads
- 0
- Uploads
- 0
i realy don't understand it.. are all those C/C++ tutorails wrong .. they never talked about it
-
04-01-2007, 10:15 AM #3640Heroes never die

- Registriert seit
- Aug 2006
- Ort
- ...........
- Beiträge
- 1.323
- Points
- 8.645
- Level
- 62
- Downloads
- 0
- Uploads
- 0
if you dont know that I think you better search another hobby
-
04-01-2007, 11:03 AM #3641QJ Gamer Green
- Registriert seit
- Jul 2006
- Ort
- USA SC/NC
- Beiträge
- 699
- Points
- 5.712
- Level
- 48
- Downloads
- 0
- Uploads
- 0
The tutorials are fine. With that attitude, you wont get anywhere.
Zitat von Kwastie
[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]
-
04-01-2007, 12:42 PM #3642QJ Gamer Blue
- Registriert seit
- Mar 2007
- Ort
- Holland..
- Beiträge
- 154
- Points
- 4.022
- Level
- 40
- Downloads
- 0
- Uploads
- 0
am just started to code 2 or 3 weeks ago, already created theme flasher.. callculator and mp3 player.. but i need some help.. because i don't know all the commands yet i know to little
-
04-01-2007, 12:45 PM #3643QJ Gamer Silver

- Registriert seit
- May 2006
- Ort
- Behind you.
- Beiträge
- 1.814
- Points
- 10.921
- Level
- 69
- Downloads
- 0
- Uploads
- 0
Lol, mp3 player and calculator took me 2 days when i starting learning C. Theme flasher sounds hard though.
Zitat von Kwastie
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...)
-
04-01-2007, 12:51 PM #3644QJ Gamer Blue
- Registriert seit
- Mar 2007
- Ort
- Holland..
- Beiträge
- 154
- Points
- 4.022
- Level
- 40
- Downloads
- 0
- Uploads
- 0
maby you can look at my code.. maby you can find the error
and lol do you think a spend 2-3 weeks @ coding lol i am still going to school and i don't have much spare-time tough..i think i've spended about 40-60 hours total.. on C.. i need to add an nice qui to my program because the menu i am using now SUCKS.. only black with white letters
-
04-01-2007, 12:55 PM #3645QJ Gamer Silver

- Registriert seit
- May 2006
- Ort
- Behind you.
- Beiträge
- 1.814
- Points
- 10.921
- Level
- 69
- Downloads
- 0
- Uploads
- 0
Lol, i don't know what you are talking about, i just looked at one post. Could you tell me what you are talking about?
Zitat von Kwastie
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...)
-
04-01-2007, 01:49 PM #3646QJ Gamer Blue
- Registriert seit
- Mar 2007
- Ort
- Holland..
- Beiträge
- 154
- Points
- 4.022
- Level
- 40
- Downloads
- 0
- Uploads
- 0
theme flasher;)
-
04-01-2007, 01:57 PM #3647QJ Gamer Silver

- Registriert seit
- May 2006
- Ort
- Behind you.
- Beiträge
- 1.814
- Points
- 10.921
- Level
- 69
- Downloads
- 0
- Uploads
- 0
I can't help ya then. Sorry.
Zitat von Kwastie
-= Double Post =-
Is there a function that lets you go on standby? Is there also a function that lets you fully turn off your psp? What are these functions? Also, what do i need to put in the makefile if i need to use these functions.Geändert von SuperBatXS (04-01-2007 um 04:30 PM Uhr) Grund: Automerged Doublepost
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...)
-
04-01-2007, 04:39 PM #3648QJ Gamer Green
- Registriert seit
- Jul 2006
- Ort
- USA SC/NC
- Beiträge
- 699
- Points
- 5.712
- Level
- 48
- Downloads
- 0
- Uploads
- 0
Take a look at psppower.h in the psp sdk
Zitat von TMNT
makefile...
LIBS = -lpsppower[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]
-
04-01-2007, 04:49 PM #3649
Hi,
It's been a while since i developed because i was on vacation earlier this weekend. Anyways, i had a question. What if i wanted to auto-detect if the usb plug is in, and if it is, it would activate usb mode? Using this:
Post some C samples
Do i just do "Activate_usb();" in my function, and it will always keep usb mode on, and auto detect it by itself?
Thanks.
-
04-01-2007, 04:56 PM #3650
How Do I make things happen only 60 times a second w/out Vblank start?
Zitat von MrMrIce
And what's wrong with using it?
"update vars based on frametime value" what does that mean?
-
04-01-2007, 05:02 PM #3651QJ Gamer Silver

- Registriert seit
- May 2006
- Ort
- Behind you.
- Beiträge
- 1.814
- Points
- 10.921
- Level
- 69
- Downloads
- 0
- Uploads
- 0
Make a timer:
Zitat von Mr305
Code:int showTime = 0; for (;;) { showTime++; if (showTime < 60) { // EVERY 60 IS A SECOND // //insert action here } }
Btw, i need help using standby:
It seems to successfully go to standby, but when i turn psp back on, it's in the xmb.Code:#define PSP_POWER_CB_STANDBY 0x00080000 //later if (pad.Buttons & PSP_CTRL_LTRIGGER) { scePowerRequestStandby(); return 0; }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...)
-
04-01-2007, 05:55 PM #3652QJ Gamer Green
- Registriert seit
- Jul 2006
- Ort
- USA SC/NC
- Beiträge
- 699
- Points
- 5.712
- Level
- 48
- Downloads
- 0
- Uploads
- 0
Then its not standby :|
Zitat von TMNT
No offense, but are you really that clueless... Has it crossed your mind that the PSP might be turned off by using that function :|[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]
-
04-01-2007, 05:58 PM #3653QJ Gamer Silver

- Registriert seit
- May 2006
- Ort
- Behind you.
- Beiträge
- 1.814
- Points
- 10.921
- Level
- 69
- Downloads
- 0
- Uploads
- 0
No. When i removed the return0; , it shut off after flashing a couple of times. When i turned it on, it displayed the Sony logo. When i use this function, it goes straight to the XMB. Btw, i have the Sony logo enabled. How do i fix this problem then?
Zitat von Moca
Edit: Let me reword this better-
Without return0; - shut offish turning off (light blinking differently than with return0; ) and sony logo displays when turned on
With return0; - standbyish turning off and xmb displayed when turned back onCalypso - 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...)
-
04-01-2007, 11:37 PM #3654Heroes never die

- Registriert seit
- Aug 2006
- Ort
- ...........
- Beiträge
- 1.323
- Points
- 8.645
- Level
- 62
- Downloads
- 0
- Uploads
- 0
or
Zitat von TMNT
Code:int x = 0; while(x != 60) { //do something sceKerndelDelayThread(1000000/60); x++; }
-
04-02-2007, 06:57 AM #3655
How exactly does WaitVblank start control actual cycles[loops] per second?
Zitat von hallo007
-
04-02-2007, 01:07 PM #3656Your Fate is Grim...

- Registriert seit
- Oct 2005
- Beiträge
- 2.269
- Points
- 11.640
- Level
- 70
- Downloads
- 0
- Uploads
- 0
waitVblankStart simply waits for the psp to finish drawing the current frame. so waitVbalnkStart(60) waits until the frame has been drawn 60 times, which is a seconds at 60FPS. I prefer to use sceKernelDelayThread() though.
Zitat von Mr305
--------------------------------------------------------------------------------------
-
04-02-2007, 02:27 PM #3657Developer

- Registriert seit
- Mar 2006
- Beiträge
- 1.026
- Points
- 7.577
- Level
- 58
- Downloads
- 0
- Uploads
- 0
sceDisplayWaitVblankStart () waits for the vsync of the PSP LCD, which happens to be approximately 60 mhz.

Check out my homebrew & C tutorials at http://insomniac.0x89.org/
Coder formerly known as Insomniac197
tshirtz: what is irshell ??
Atarian_: it's where people who work for the IRS go when they die
-
04-02-2007, 02:51 PM #3658sceKernelExitGame();
- Registriert seit
- Jan 2006
- Ort
- New York
- Beiträge
- 3.126
- Points
- 19.955
- Level
- 89
- Downloads
- 0
- Uploads
- 0
[QUOTE=TMNT]Make a timer:
That is the worst "timer" I have ever seen. That's no even a timer, showTime will increase ever frame, not second. You need an actual timer ;)Code:int showTime = 0; for (;;) { showTime++; if (showTime < 60) { // EVERY 60 IS A SECOND // //insert action here } }
-
04-02-2007, 04:27 PM #3659QJ Gamer Silver

- Registriert seit
- May 2006
- Ort
- Behind you.
- Beiträge
- 1.814
- Points
- 10.921
- Level
- 69
- Downloads
- 0
- Uploads
- 0
[QUOTE=Bronx]
Thanks Bronx. I will mention to Yaustar or Moca that you said that (one of those made it, search in the thread).
Zitat von TMNT
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...)
-
04-02-2007, 04:36 PM #3660QJ Gamer Bronze

- Registriert seit
- Jul 2006
- Beiträge
- 90
- Points
- 4.912
- Level
- 44
- Downloads
- 0
- Uploads
- 0
er you mean Grimfate126 made it:
Zitat von TMNT
Also, he used sceDisplayWaitVblankStart , meaning that his code works, and yours doesn't.
Zitat von Grimfate126


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