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; If you have the SDK downloaded, you can look in the samples folder for samples of most of the functions ...
-
11-26-2008, 08:54 PM #9241QJ Gamer Green
- Registriert seit
- Jan 2008
- Beiträge
- 612
- Points
- 3.721
- Level
- 38
- Downloads
- 0
- Uploads
- 0
If you have the SDK downloaded, you can look in the samples folder for samples of most of the functions in use. There is also extensive documentation here: http://psp.jim.sh/pspsdk-doc/
But do listen to dysfunctional and get acquainted with the language. If you only know two psp-specific functions, you have a long ways to go and should go back to the PC first.
[size=3][url=http://luaplayer.org/forums/index.php?topic=507]Complete Lua development cycle outline[/url][/size]
-
11-26-2008, 09:13 PM #9242QJ Gamer Bronze
- Registriert seit
- Aug 2008
- Ort
- thugz mansion
- Beiträge
- 875
- Points
- 5.594
- Level
- 48
- Downloads
- 0
- Uploads
- 0
i actually know some c programming language and own 4 books and 2 ebooks on the subject i tried doing void function(void) like that but it doesnt compile correctly for me so i usually use #include "function.c" and then call the function from the app but i think it would be more easy to use subs instead. (im used to old school. I still use basic alot
)
anyways i was speaking about what exactly they do if i just look at the header files they usually dont say what they do in lamens terms.
Zitat von SuperBatXS
-
11-26-2008, 09:24 PM #9243QJ Gamer Blue
- Registriert seit
- Jul 2007
- Beiträge
- 296
- Points
- 3.795
- Level
- 38
- Downloads
- 0
- Uploads
- 0
Like I said, you don't know the language. Go read those books.
-
11-27-2008, 06:50 AM #9244QJ Gamer Silver

- Registriert seit
- Jun 2006
- Ort
- UK
- Beiträge
- 2.326
- Points
- 10.263
- Level
- 67
- Downloads
- 0
- Uploads
- 0
Looking at the code snippet you posted, subs are functions, not separate 'apps'. Have a read of this article:
http://www.gamedev.net/reference/art...rticle1798.asp
Here is the C++ equivalent of your Basic code
Code:#include <iostream> #include <string> void thq() { std::cout << "noobs are cool =}" << std::endl; } int main() { std::cout << "hello qj.net this is an example" << std::endl; string input; std::cout << "are you a noob? YES or NO" << std::endl; cin >> input; if( "YES" == input ) { thq(); } else if( "NO" == input ) { std::cout << "thats good for you" << std::endl; } }Geändert von yaustar (11-27-2008 um 07:02 AM Uhr)
[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-27-2008, 07:31 PM #9245
Does anyone know how to fill the screen with a color in a PRX? I'm freezing the game with my hex editor and it causes "sticky printing" because the screen doesn't refresh.
Geändert von Durka Durka Mahn (11-28-2008 um 07:26 AM Uhr)
Atheist, because I just won't believe in what doesn't show itself to me.
-
11-28-2008, 09:42 AM #9246QJ Gamer Bronze
- Registriert seit
- Aug 2008
- Ort
- thugz mansion
- Beiträge
- 875
- Points
- 5.594
- Level
- 48
- Downloads
- 0
- Uploads
- 0
-
11-28-2008, 10:09 AM #9247QJ Gamer Silver

- Registriert seit
- Jun 2006
- Ort
- UK
- Beiträge
- 2.326
- Points
- 10.263
- Level
- 67
- Downloads
- 0
- Uploads
- 0
There is no 'workaround'. That is the actual code for one source file.
If you are going to use multiple files for organisation purposes, then read the previous article I linked to from GameDev.
It is important that you understand the build process of the executable.
http://www.tenouk.com/ModuleW.html
What IDE are you using?[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-2008, 10:17 AM #9248QJ Gamer Bronze
- Registriert seit
- Aug 2008
- Ort
- thugz mansion
- Beiträge
- 875
- Points
- 5.594
- Level
- 48
- Downloads
- 0
- Uploads
- 0
-
11-28-2008, 10:22 AM #9249QJ Gamer Silver

- Registriert seit
- Jun 2006
- Ort
- UK
- Beiträge
- 2.326
- Points
- 10.263
- Level
- 67
- Downloads
- 0
- Uploads
- 0
Then if is even more important to understand the build process and have some knowledge on makefiles.
Also, learn what #include actually does: http://gcc.gnu.org/onlinedocs/cpp/In...lude-Operation
I don't understand why at this stage of learning that you are splitting your source files. As I said, the code I have shown you is for one source file. If you are going to start using multiple files, read the article I linked 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-28-2008, 10:33 AM #9250QJ Gamer Bronze
- Registriert seit
- Aug 2008
- Ort
- thugz mansion
- Beiträge
- 875
- Points
- 5.594
- Level
- 48
- Downloads
- 0
- Uploads
- 0
I know what include does i know it takes the code and adds it to the first source file but cygwin wont compile it when i stick it all in one file i tried putting it in a different order and things like that but it wont work.
i dont know if its just cygwin because ive done it alright with windows pspsdk but i cant install the librarys i use with cygwin on it.
Zitat von SuperBatXS
-
11-28-2008, 11:03 AM #9251
Geändert von Durka Durka Mahn (11-28-2008 um 03:30 PM Uhr) Grund: Automerged Doublepost
Atheist, because I just won't believe in what doesn't show itself to me.
-
11-29-2008, 07:12 AM #9252QJ Gamer Silver

- Registriert seit
- Jun 2006
- Ort
- UK
- Beiträge
- 2.326
- Points
- 10.263
- Level
- 67
- Downloads
- 0
- Uploads
- 0
Telling us cygwin won't compile doesn't help. How did you compile it? What was the exact error message(s)?
If we just talking about developing on the PC for the PC, then download Code::Blocks with mingw. It make your life much easier:
http://www.codeblocks.org/[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-29-2008, 08:01 AM #9253QJ Gamer Green
- Registriert seit
- May 2008
- Ort
- The Netherlands
- Beiträge
- 330
- Points
- 3.567
- Level
- 37
- Downloads
- 0
- Uploads
- 0
I have a menu code but it doesn't work. Can someone help me out with fixing the problem? This is my code:
Code:int menu() // { // // pspDebugScreenClear(); // Clear the Screen // pspDebugScreenSetXY(0 , 0); //Set current pixel to 0,0 // // int currentSelection = 0; SceCtrlData pad; int selecting = true; int loop; char *menuOption[3] = { "START" , "EXIT" }; while(selecting) { pspDebugScreenClear(); for(loop=0; loop<2; loop++) { pspDebugScreenSetXY(16 , 15+loop); if(loop != currentSelection) printf(" %s" , menuOption[loop]); else printf("=> %s" , menuOption[loop]); } while(selecting) { sceCtrlPeekBufferPositive(&pad, 1); if(pad.Buttons & PSP_CTRL_UP) { if(!pressed) { (currentSelection == 0) ? currentSelection = 1 : currentSelection--; buttonPressed = true; break; } } else if(pad.Buttons & PSP_CTRL_DOWN) { if(!pressed) { (currentSelection == 1) ? currentSelection = 0 : currentSelection++; buttonPressed = true; break; } } else if(pad.Buttons & PSP_CTRL_CROSS) { if(currentSelection == 0) { start(); } else if(currentSelection == 1) { exit(); } } else { pressed = false; } }//end while }//end while return 0; // } //By bY
-
11-29-2008, 08:18 AM #9254
What exactly doesn't work..?
Atheist, because I just won't believe in what doesn't show itself to me.
-
11-29-2008, 08:24 AM #9255QJ Gamer Green
- Registriert seit
- May 2008
- Ort
- The Netherlands
- Beiträge
- 330
- Points
- 3.567
- Level
- 37
- Downloads
- 0
- Uploads
- 0
-
11-29-2008, 09:00 AM #9256QJ Gamer Silver
- Registriert seit
- Sep 2006
- Ort
- Perth, Scotland
- Beiträge
- 1.094
- Points
- 8.475
- Level
- 62
- Downloads
- 0
- Uploads
- 0
#include <pspctrl.h>
-
11-29-2008, 09:28 AM #9257QJ Gamer Green
- Registriert seit
- May 2008
- Ort
- The Netherlands
- Beiträge
- 330
- Points
- 3.567
- Level
- 37
- Downloads
- 0
- Uploads
- 0
Still doesn't work:
Here's the error:Code:#include <pspdisplay.h> #include <pspctrl.h> #include <pspkernel.h> #include <pspdebug.h> int menu() // { // // pspDebugScreenClear(); // Clear the Screen // pspDebugScreenSetXY(0 , 0); //Set current pixel to 0,0 // // int currentSelection = 0; SceCtrlData pad; int selecting = true; int loop; char *menuOption[3] = { "START" , "EXIT" }; while(selecting) { pspDebugScreenClear(); for(loop=0; loop<2; loop++) { pspDebugScreenSetXY(16 , 15+loop); if(loop != currentSelection) printf(" %s" , menuOption[loop]); else printf("=> %s" , menuOption[loop]); } while(selecting) { sceCtrlPeekBufferPositive(&pad, 1); if(pad.Buttons & PSP_CTRL_UP) { if(!pressed) { (currentSelection == 0) ? currentSelection = 1 : currentSelection--; buttonPressed = true; break; } } else if(pad.Buttons & PSP_CTRL_DOWN) { if(!pressed) { (currentSelection == 1) ? currentSelection = 0 : currentSelection++; buttonPressed = true; break; } } else if(pad.Buttons & PSP_CTRL_CROSS) { if(currentSelection == 0) { start(); } else if(currentSelection == 1) { exit(); } } else { pressed = false; } }//end while }//end while return 0; // } //By bY

Can someone just post a new menu that works?
-
11-29-2008, 09:37 AM #9258QJ Gamer Bronze
- Registriert seit
- Aug 2008
- Ort
- thugz mansion
- Beiträge
- 875
- Points
- 5.594
- Level
- 48
- Downloads
- 0
- Uploads
- 0
Here ( a project i gave up on.)can someone post a menu that works.
Ohh and thanks yauster i got it working correctly now.Code:#include <pspkernel.h> #include <pspcallbacks.h> #include <pspctrl.h> #include "graphics.h" #include "game.c" #define printf printTextScreen #define RGB(r, g, b) ((r)|((g)<<8)|((b)<<16)) PSP_MODULE_INFO("Menu Example",0,1,1); Color white = RGB(255,255,255), red = RGB(255,0,0), black = RGB(0,0,0); enum {START, CONTROLS, CREDITS, EXTRAS, CONTACT, STORY, MEDALS, EXIT}; char menuItems[8][25] = { {"START"}, {"CONTROLS"}, {"CREDITS"}, {"EXTRAS"}, {"CONTACT"}, {"STORY"}, {"MEDALS"}, {"EXIT"}, }; int timer,select,foo; SceCtrlData pad; void executeMenu(int select) { switch(select) { case START: game(); break; case CONTROLS: break; case CREDITS: break; case EXTRAS: break; case CONTACT: break; case STORY: break; case MEDALS: break; case EXIT: sceKernelExitGame(); break; default: return; } return; // suppress compiler warning } int main() { Image* background = loadImage("Background.png"); initGraphics(); SetupCallbacks(); while(1) { sceCtrlReadBufferPositive(&pad,1); blitAlphaImageToScreen(0,0,480,272,background,0,0); fillScreenRect(white,0,0,480,272); blitAlphaImageToScreen(0,0,480,272,background,0,0); timer++; for(foo=0;foo<10;foo++) {printf(200,foo*8+70,menuItems[foo],black);} printf(201,select*8+70,menuItems[select],red); if((pad.Buttons & PSP_CTRL_UP) && (timer > 6) && (select > 0)) {select--;timer = 0;} else if ((pad.Buttons & PSP_CTRL_DOWN) && (timer > 6) && (select < 7)) {select++;timer = 0;} else if (pad.Buttons & PSP_CTRL_CROSS){executeMenu(select);} flipScreen(); } return 0; }
Zitat von SuperBatXS
-
11-29-2008, 09:37 AM #9259QJ Gamer Blue
- Registriert seit
- Jul 2007
- Beiträge
- 296
- Points
- 3.795
- Level
- 38
- Downloads
- 0
- Uploads
- 0
Can someone stop copying code and try to learn how to program for themselves?
-
11-29-2008, 09:41 AM #9260QJ Gamer Green
- Registriert seit
- May 2008
- Ort
- The Netherlands
- Beiträge
- 330
- Points
- 3.567
- Level
- 37
- Downloads
- 0
- Uploads
- 0
Thanks Blackburd
-
11-29-2008, 09:44 AM #9261QJ Gamer Bronze
- Registriert seit
- Aug 2008
- Ort
- thugz mansion
- Beiträge
- 875
- Points
- 5.594
- Level
- 48
- Downloads
- 0
- Uploads
- 0
Also if you want all the stuff i used with this menu fully compilable you can download it here.
http://www.megaupload.com/?d=NWPJX4ZF
thats the icon0 icon1 and snd0
and the main.c and game.c
Zitat von SuperBatXS
-
11-29-2008, 10:32 AM #9262QJ Gamer Green
- Registriert seit
- May 2008
- Ort
- The Netherlands
- Beiträge
- 330
- Points
- 3.567
- Level
- 37
- Downloads
- 0
- Uploads
- 0
I'll take a look at it.
-
11-29-2008, 11:43 AM #9263
Atheist, because I just won't believe in what doesn't show itself to me.
-
11-29-2008, 11:47 PM #9264
-
11-30-2008, 05:36 AM #9265QJ Gamer Blue
- Registriert seit
- Jul 2007
- Beiträge
- 296
- Points
- 3.795
- Level
- 38
- Downloads
- 0
- Uploads
- 0
Honestly? No.
I've been in this seen far longer than you have and I understand that being nice to people doesn't get anything done. The average noob will rather take code of another noob, instead of listening to my advice.
So, why don't you stop posting obvious trolls just to make it look like you are a badass on QJ. No one cares.
The reason I don't baby people on the internet is because if you do, you will get ignored. If you have such a problem with that, why don't you just work it out in a place i don't have to see it?
The kid above obviously has no knowledge of C, or else he would have at least known to read the errors so gracefully given by the compiler. Giving him code does not solve the problem of him not knowing how to code.
-
11-30-2008, 11:47 AM #9266QJ Gamer Bronze
- Registriert seit
- Aug 2008
- Ort
- thugz mansion
- Beiträge
- 875
- Points
- 5.594
- Level
- 48
- Downloads
- 0
- Uploads
- 0
Excuse me sorry to interupt a fight but im trying to put my psp into sleep mode from a app im making does anyone know if theres a premade function that will do that and if not how would i go about implementing this into my code in (c).
Zitat von SuperBatXS
-
11-30-2008, 04:18 PM #9267I'm Baaaack!

- Registriert seit
- May 2006
- Ort
- Nowhere
- Beiträge
- 2.186
- Points
- 17.067
- Level
- 83
- Downloads
- 0
- Uploads
- 0
No, because he's absolutely right. People need to quit asking for people to write code for them, and get off their ass and do some searching and coding of their own. Programmers are getting lazier every damn day.
The above goes for you. It's really not that hard to find.
http://psp.jim.sh/pspsdk-doc/psppower_8h.html
-
11-30-2008, 06:02 PM #9268QJ Gamer Bronze
- Registriert seit
- Aug 2008
- Ort
- thugz mansion
- Beiträge
- 875
- Points
- 5.594
- Level
- 48
- Downloads
- 0
- Uploads
- 0
i havent asked any one to write anything for me at all i was just asking because i looked through pages of google and maybe i didnt search for it correctly but i couldnt find alot of sites with alot of the usable functions that have sce meaning its from sony. Im sorry if i didnt portray that correctly And thanks that link did help a lilbit.
besides i actually tried this function scePowerRequestStandby(); and including pspkerneltypes.h and it dint work.
it said no such function on cygwin and minimalist pspsdk.
Zitat von SuperBatXS
-
11-30-2008, 06:08 PM #9269QJ Gamer Blue
- Registriert seit
- Jul 2007
- Beiträge
- 296
- Points
- 3.795
- Level
- 38
- Downloads
- 0
- Uploads
- 0
This is what we are talking about. You can't just expect us to write and fix code for you.
Did you even bother to open up pspkerneltypes.h so you could find for yourself that you were including the wrong header? I guess not.
Try psppower.h.
-
11-30-2008, 06:13 PM #9270


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