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 Ignore Raphael about the infinite loop thing. Even though your program does have an infinite loop - ...
-
12-03-2007, 04:49 AM #7021QJ Gamer Silver

- Registriert seit
- Jan 2006
- Ort
- Germany
- Beiträge
- 926
- Points
- 14.087
- Level
- 77
- Downloads
- 0
- Uploads
- 0
Wrong. The PSP is a cooperative multithreading system, hence such loops are very unsure to be able to be forcefully exited.
Zitat von Slasher
And even on a preemtive multithreaded system, I wouldn't advise you to depend on the kernel to forcefully kill your thread, just because you are too lazy to let it properly quit itself when it should.
PS: Ignoring advise is never a good idea. You should at least take the effort to think and maybe research on why you were given that advise, it might contain some truth even if it sounds completely wrong.
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-03-2007, 08:09 AM #7022OMFG

- Registriert seit
- Jul 2005
- Ort
- Toronto
- Beiträge
- 2.814
- Points
- 19.453
- Level
- 88
- Downloads
- 0
- Uploads
- 0
This guy's a beginner, I didn't want to scare him...
:)
-
12-03-2007, 08:11 AM #7023
What a poor excuse! You should at least apologize :Punk:
Zitat von Slasher
Placo23
Why not donate and become part of this selected list?Spoiler for Wanna see my Apps?:Spoiler for Donators:
-
12-03-2007, 08:46 AM #7024
your advise is bad. you should exit the infinite loop before exiting via the HOME screen, thats if you don't want to be stuck at the "PLease Wait" screen, lol
Zitat von Slasher
seriously, thats the whole point of the osl_quit variable in brunni's library
while (!osl_quit)
{
/* do stuff */
}
oslib monitors the callbacks and when you select "Yes" to quit the game in the HOME screen the osl_quit variable is set to TRUE and the loop is ended
-
12-03-2007, 09:18 AM #7025OMFG

- Registriert seit
- Jul 2005
- Ort
- Toronto
- Beiträge
- 2.814
- Points
- 19.453
- Level
- 88
- Downloads
- 0
- Uploads
- 0
I'm dead serious. As much as I respect Raphael and know he's correct, I don't think throwing all these advanced concepts at a noob to coding is exactly the right thing to do. Let him start small and work his way up.
Zitat von placo23
And as for brethren; I've never used oslib, so I wouldn't know why it would hang at the please wait screen. This guy isn't using oslib, so I don't know why you would mention it. In a normal program, sceKernelExitGame is called and that's it - end of story, program exits, bam, kaboom, whoosh - it doesn't hang.Geändert von Slasher (12-03-2007 um 09:52 AM Uhr)
-
12-03-2007, 10:24 AM #7026QJ Gamer Green
- Registriert seit
- Apr 2006
- Ort
- England ~¦¦¦|+|¦¦¦~
- Beiträge
- 1.112
- Points
- 9.165
- Level
- 64
- My Mood
-
- Downloads
- 0
- Uploads
- 0
*advice I believe?
Zitat von Raphael
Usage:
To advise. -> Verb
To give advice. -> Noun...Just Returned To The Scene...
-
12-03-2007, 11:22 AM #7027I'm back!

- Registriert seit
- Feb 2007
- Ort
- England
- Beiträge
- 902
- Points
- 8.236
- Level
- 61
- Downloads
- 0
- Uploads
- 0
Wrong, if you are in a loop taking all the system processes I believe that it does infact hang at the exit screen.
Zitat von Slasher
I'm guessing brethren just dropped that in as an example, the whole point is that when you press yes OSL makes the thread finish taking all the system processes and then it exits without hanging.
And to be honest, I agree with Raphael, I know sometimes he can seem a little harsh, and unhelpful if you don't know what he means, but at the end of the day the advice has always been correct to my knowledge. And personally, I think I'm missing what the advanced concept is? Most of the things asked here are rather basic, using an infinate loop does and will make the system hang, exiting a thread using break; is far from difficult, and there are other ways and means to exiting it cleaner than just hitting the home key. If someone doesn't understand what is meant, they can search on Google, and if then they still don't know, come back here and ask for a more understandable explaination.
-Aura
-
12-03-2007, 11:32 AM #7028
C'mon Slasher I might be a beginner but , I know how to read and even do i don't fully understand don't tell me he's wrong because I didn't catch it.Plus I'd ratter try understanding what Raphael said as its more complex and I won't have to come back on the subject and cause that much trouble.
Free Prizes at Prizerebel Join us!
I already got 11 Gifts. Ask me for details or proof.
-
12-03-2007, 11:36 AM #7029QJ Gamer Silver

- Registriert seit
- Jan 2006
- Ort
- Germany
- Beiträge
- 926
- Points
- 14.087
- Level
- 77
- Downloads
- 0
- Uploads
- 0
Meh, one of my weak spots in english. I always confuse the two :P
Zitat von JaSo PsP
@Slasher: I don't consider this an advanced concept, but rather a basic concept. You need to make sure your loops have a breaking point, else you'll have a lock up in your program sooner or later.
And as said, even though the Home button callback sometimes succeeds to forcefully kill such an infinite loop in your main thread, it will not always. It just depends on the (for a beginner unrecognizable) circumstances (which I didn't try to explain to him, as that would be advanced concepts). So better teach them to do it the correct way from the start.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-04-2007, 12:55 AM #7030
Quickie one not to extend the infinite loop thingy too much.
Just try not to use osl_quit in the loop on your HB. Replacing with 1 for example.
When you push the home button, it'll exit normally....
Yes it will....
But.. as a good example of using the right things where they are meant to be...
Try to run your HB again :ROFL:
Craaaaashhhh!!!!!!
I second what Raphael said. It's better to try to teach in the right way
CheersPlaco23
Why not donate and become part of this selected list?Spoiler for Wanna see my Apps?:Spoiler for Donators:
-
12-04-2007, 02:42 PM #7031I'm back!

- Registriert seit
- Feb 2007
- Ort
- England
- Beiträge
- 902
- Points
- 8.236
- Level
- 61
- Downloads
- 0
- Uploads
- 0
Is there any code out there showing how to load an alternative pspbtcnf.bin file on 3.52 (or any M33 firmware for that matter)? I've tried doing something myself, but I only seem to end up booting the original.
Thanks.
-Aura
-
12-05-2007, 05:09 PM #7032OMFG

- Registriert seit
- Jul 2005
- Ort
- Toronto
- Beiträge
- 2.814
- Points
- 19.453
- Level
- 88
- Downloads
- 0
- Uploads
- 0
Encrypting numbers ~!~
How would I do it? Like say for example I wanted to keep tabs on somebodies score in a text file. But I don't want them to easily change it, because then that would be cheating.
Is there a simple algorithm somebody is aware of? I'm not sure the best way how to go about doing this...
-
12-05-2007, 05:25 PM #7033
I don't exactly know a way, but I used this crappy way one time. I'm assuming since it's a score, it's only numbers. Well, replace all the numbers with and unknown letter. But before you replace them with the letters, take the MD5 sum of the score. Then you could write the 'encrypted' score, along with the MD5 sum. Then, when you load the score, reverse the 'encryption', and make sure the MD5 sum matches. If it doesn't, it's been tampered with.
Zitat von Slasher
[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-05-2007, 05:29 PM #7034QJ Gamer Silver

- Registriert seit
- Jan 2006
- Ort
- Germany
- Beiträge
- 926
- Points
- 14.087
- Level
- 77
- Downloads
- 0
- Uploads
- 0
http://en.wikipedia.org/wiki/Simple_XOR_cipher
EDIT: adding a MD5 checksum is a good idea to make it safer without much expense. You can use the kernels MD5 checksum function.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-05-2007, 05:34 PM #7035OMFG

- Registriert seit
- Jul 2005
- Ort
- Toronto
- Beiträge
- 2.814
- Points
- 19.453
- Level
- 88
- Downloads
- 0
- Uploads
- 0
k I got it working, thanks
-
12-05-2007, 10:42 PM #7036QJ Gamer Bronze

- Registriert seit
- Aug 2007
- Ort
- Australia
- Beiträge
- 659
- Points
- 8.045
- Level
- 60
- Downloads
- 0
- Uploads
- 0
hey
i was just wondering if anyone had a link to VSHBlitter or if they had it on their computer if they could possibly upload it. thanks
-
12-05-2007, 10:47 PM #7037QJ Gamer Silver
- Registriert seit
- Feb 2007
- Ort
- Melbourne, Australia
- Beiträge
- 1.773
- Points
- 8.717
- Level
- 62
- My Mood
-
- Downloads
- 0
- Uploads
- 0
that should be it
Zitat von Xsjado7
WHA!?
-
12-05-2007, 11:35 PM #7038QJ Gamer Bronze

- Registriert seit
- Aug 2007
- Ort
- Australia
- Beiträge
- 659
- Points
- 8.045
- Level
- 60
- Downloads
- 0
- Uploads
- 0
Thank you! your a legend!
-
12-06-2007, 12:26 AM #7039QJ Gamer Silver
- Registriert seit
- Feb 2007
- Ort
- Melbourne, Australia
- Beiträge
- 1.773
- Points
- 8.717
- Level
- 62
- My Mood
-
- Downloads
- 0
- Uploads
- 0
Thats alright :), it has been posted in this thread earlier on anyway!!
Edit: If that one didn't work properly then try thisWHA!?
-
12-06-2007, 01:32 AM #7040QJ Gamer Bronze

- Registriert seit
- Aug 2007
- Ort
- Australia
- Beiträge
- 659
- Points
- 8.045
- Level
- 60
- Downloads
- 0
- Uploads
- 0
im having trouble with my prx. it compiles fine but it the text doesnt show. heres my source:
any idea whats wrong? thanksCode:#include <pspkernel.h> #include <pspthreadman.h> #include <pspmodulemgr.h> #include <pspctrl.h> #include <stdio.h> #include <malloc.h> #include <psppower.h> #include <pspdisplay.h> #include "blit.h" PSP_MODULE_INFO("Hello_World", 0x0800, 0, 1); PSP_MAIN_THREAD_ATTR(0); PSP_HEAP_SIZE_KB(1000); int main_thread(SceSize args, void *argp) { blit_setup(); sceKernelDelayThread(3000000); while(1) { blit_string(13, 45, "HELLO WORLD"); } return 0; } int module_start(SceSize args, void *argp) { int thid; thid = sceKernelCreateThread("Hello_World", main_thread, 0x18, 0x0800, 0, NULL); if(thid >= 0) sceKernelStartThread(thid, args, argp); return 0; }
-
12-06-2007, 01:49 AM #7041QJ Gamer Silver
- Registriert seit
- Feb 2007
- Ort
- Melbourne, Australia
- Beiträge
- 1.773
- Points
- 8.717
- Level
- 62
- My Mood
-
- Downloads
- 0
- Uploads
- 0
-
12-06-2007, 02:00 AM #7042QJ Gamer Bronze

- Registriert seit
- Aug 2007
- Ort
- Australia
- Beiträge
- 659
- Points
- 8.045
- Level
- 60
- Downloads
- 0
- Uploads
- 0
lol, thats what iv been using. i tried it with that source but it still didnt blit
-
12-06-2007, 02:01 AM #7043QJ Gamer Silver
- Registriert seit
- Feb 2007
- Ort
- Melbourne, Australia
- Beiträge
- 1.773
- Points
- 8.717
- Level
- 62
- My Mood
-
- Downloads
- 0
- Uploads
- 0
sceDisplayWaitVblankStart ();
sceKernelDelayThread(1000 );
have you tried adding that?WHA!?
-
12-06-2007, 02:28 AM #7044QJ Gamer Bronze

- Registriert seit
- Aug 2007
- Ort
- Australia
- Beiträge
- 659
- Points
- 8.045
- Level
- 60
- Downloads
- 0
- Uploads
- 0
tried it just then but sadly it didnt work
Code:#include <pspkernel.h> #include <pspthreadman.h> #include <pspmodulemgr.h> #include <pspctrl.h> #include <stdio.h> #include <malloc.h> #include "blit.h" PSP_MODULE_INFO("prx_sample", 0x0800, 0, 1); PSP_MAIN_THREAD_ATTR(0); PSP_HEAP_SIZE_KB(1000); int main_thread(SceSize args, void *argp) { blit_setup(); unsigned int posx = 0; unsigned int posy = 20; while(1) { posx++; blit_string(posx, posy, "HELLO WORLD"); sceDisplayWaitVblankStart(); sceKernelDelayThread(1000); } return 0; } int module_start(SceSize args, void *argp) { int thid; thid = sceKernelCreateThread("prx_sample", main_thread, 0x18, 0x0800, 0, NULL); if(thid >= 0) sceKernelStartThread(thid, args, argp); return 0; }
-
12-06-2007, 02:37 AM #7045
You can try to change this line
PSP_MODULE_INFO("Hello_Wo rld", 0x0800, 0, 1);
for
PSP_MODULE_INFO("Hello_Wo rld", 1, 0, 1);
I guess that might do. Also, how's your make file?Placo23
Why not donate and become part of this selected list?Spoiler for Wanna see my Apps?:Spoiler for Donators:
-
12-06-2007, 02:55 AM #7046QJ Gamer Bronze

- Registriert seit
- Aug 2007
- Ort
- Australia
- Beiträge
- 659
- Points
- 8.045
- Level
- 60
- Downloads
- 0
- Uploads
- 0
[CODE]TARGET = prx
OBJS = main.o blit.o
BUILD_PRX = 1
#USE_PSPSDK_LIBC = 1
INCDIR =
LIBDIR =
LIBS = -lpng -ljpeg -lz -lm
LDFLAGS =
CFLAGS = -Os -G0 -Wall -g
CXXFLAGS = $(CFLAGS) -fno-exceptions -fno-rtti
ASFLAGS = $(CFLAGS)
PSPSDK = $(shell psp-config --pspsdk-path)
include $(PSPSDK)/lib/build_prx.mak[/[CODE]
thanks for the help so far. anyways i desperately need some sleep...
-
12-06-2007, 04:53 AM #7047I'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
-
12-06-2007, 05:48 AM #7048
Zitat von Xsjado7
Ok, go get some sleep, and as soon as I get back home I'll send you a working example using blit.h OK?
Cheers m8!Placo23
Why not donate and become part of this selected list?Spoiler for Wanna see my Apps?:Spoiler for Donators:
-
12-07-2007, 05:10 PM #7049QJ 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
Hey guys! I haven't posted on here in forever.
Ok, here's what I need to know:
How do I access a time related function that I can use to convert frame based animations to time based animations? I have never used any time related functions other than that one that waits for a little bit.
I am aware that I could just tweak my animations to work, but it will be too much work, because my framerate will be changing a lot due to the kinds of changes which will be added to my game. Converting to time based animations is really the best solution.
If anyone has any info, just post here or link me please!
Thanks,
Nicko01
-
12-08-2007, 12:22 AM #7050QJ Gamer Bronze

- Registriert seit
- Aug 2007
- Ort
- Australia
- Beiträge
- 659
- Points
- 8.045
- Level
- 60
- Downloads
- 0
- Uploads
- 0
Hey everyone,
Iv got a problem with pspgu.h. In the XMB im using sceGuDisplay(0) to turn the screen off but when i go to turn it back on with sceGuDisplay(1) the screen just stays off. If anyone could help me that would be awesome, thanks


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