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 nataku92 er you mean Grimfate126 made it: Also, he used sceDisplayWaitVblankStart , meaning that his code works, and ...
-
04-02-2007, 05:02 PM #3661QJ Gamer Silver

- Registriert seit
- May 2006
- Ort
- Behind you.
- Beiträge
- 1.814
- Points
- 10.921
- Level
- 69
- Downloads
- 0
- Uploads
- 0
Haha. Lol, thanks for pointing that Grimfate made it. I did indeed put sceDisplayWaitVblankStart in my code i am using, but not in the thread. It was implied to put flipscreen(); and sceDisplayWaitVblankStart ; . Well actually, i did not need it in my function i am using because it was in my main loop. Don't worry about what i am saying, but i was just pointing out that is a way you can make a time by Grimfate. It works for me. ;)
Zitat von nataku92
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, 07:18 PM #3662Your Fate is Grim...

- Registriert seit
- Oct 2005
- Beiträge
- 2.269
- Points
- 11.640
- Level
- 70
- Downloads
- 0
- Uploads
- 0
Yeah, my "example" was made for a specific reason, since somebody wanted to show a picture for 60 seconds. the concept is the same, essentially, be it frames or milliseconds.
--------------------------------------------------------------------------------------
-
04-02-2007, 07:21 PM #3663QJ Gamer Silver

- Registriert seit
- May 2006
- Ort
- Behind you.
- Beiträge
- 1.814
- Points
- 10.921
- Level
- 69
- Downloads
- 0
- Uploads
- 0
How would i add an mp3 to play while each image shows? I can't figure it out....lol. Also, i have 3 different mp3's for 3 different images. Could you help me out?
Zitat von Grimfate126
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, 07:31 PM #3664Your Fate is Grim...

- Registriert seit
- Oct 2005
- Beiträge
- 2.269
- Points
- 11.640
- Level
- 70
- Downloads
- 0
- Uploads
- 0
i really cant help you out there. i havent touched the mp3 player. may i see the functions for it?
Zitat von TMNT
--------------------------------------------------------------------------------------
-
04-02-2007, 07:37 PM #3665QJ Gamer Silver

- Registriert seit
- May 2006
- Ort
- Behind you.
- Beiträge
- 1.814
- Points
- 10.921
- Level
- 69
- Downloads
- 0
- Uploads
- 0
Well i just need to know how i can put this:
Zitat von Grimfate126
I want to make is so that everytime i play an mp3 (each one is different), it doesn't repeat it self (loop), and stops itself once it is finished. How do i put that in this:Code:while(1) { sceCtrlReadBufferPositive(&pad, 1); if (MP3_EndOfStream() == 1) { MP3_Stop(); } }
A different mp3 for each loading screen...btw, basic functions:Code:int credits() { int showTime = 0; Font* myfont1 = Font_Load("./files/Fonts/VERA.TTF"); Font_SetSize(myfont1, 14); Font* myfont2 = Font_Load("./files/Fonts/REN_STIM.TTF"); Font_SetSize(myfont2, 15); Font* myfont3 = Font_Load("./files/Fonts/VERA.TTF"); Font_SetSize(myfont3, 20); Image* credits; Image* credits2; Image* credits3; credits = loadImage("./files/images/superbatxs.png"); credits2 = loadImage("./files/images/bubbles.png"); credits3 = loadImage("./files/images/superbat.png"); for (;;) { showTime++; if (showTime < 240) { // EVERY 60 IS A SECOND // blitAlphaImageToScreen(0, 0 , 480, 272, credits, 0, 0); Font_PrintScreen(myfont3, 135, 125, "SuperbatXS presents...", GU_RGBA(0, 100, 0, 255), getVramDrawBuffer()); flipScreen(); } if ((showTime > 240 && showTime < 330)) { // EVERY 60 IS A SECOND // blitAlphaImageToScreen(0, 0 , 480, 272, credits2, 0, 0); Font_PrintScreen(myfont2, 2, 10, "A shell developed for full homebrew", GU_RGBA(0, 0, 255, 255), getVramDrawBuffer()); Font_PrintScreen(myfont2, 10, 25, "gaming and media experience...", GU_RGBA(0, 0, 255, 255), getVramDrawBuffer()); flipScreen(); } if ((showTime > 480 && showTime < 530)){ // EVERY 60 IS A SECOND // blitAlphaImageToScreen(0, 0 , 480, 272, credits3, 0, 0); Font_PrintScreen(myfont3, 185, 145, "G-Pack", GU_RGBA(0, 0, 255, 255), getVramDrawBuffer()); Font_PrintScreen(myfont3, 267, 145, "v.3", GU_RGBA(255, 215, 0, 255), getVramDrawBuffer()); Font_PrintScreen(myfont2, 20, 200, "Now a completely new experience...", GU_RGBA(255, 239, 219, 255), getVramDrawBuffer()); Font_PrintScreen(myfont1, 2, 225, "Plug in your headphones now for full sound experience!", GU_RGBA(255, 69, 0, 255), getVramDrawBuffer()); flipScreen(); } if (showTime >= 560) { appmain(); } } }
Don't worry about initing the mp3, i did that in the main loop. ;)Code:MP3_Load("test.mp3"); MP3_Play();
Also, the indents aren't the way i put them.
Edit: Chalo mere bhai, jaldi karo na!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, 08:07 PM #3666Your Fate is Grim...

- Registriert seit
- Oct 2005
- Beiträge
- 2.269
- Points
- 11.640
- Level
- 70
- Downloads
- 0
- Uploads
- 0
lol @ edit. i dont really know. i thought it would be something like:
Zitat von TMNT
test = MP3_Load("file");
test.play();
you could load an mp3 in the loop, but thats slow.--------------------------------------------------------------------------------------
-
04-02-2007, 08:28 PM #3667QJ Gamer Silver

- Registriert seit
- May 2006
- Ort
- Behind you.
- Beiträge
- 1.814
- Points
- 10.921
- Level
- 69
- Downloads
- 0
- Uploads
- 0
Ok, then never mind. I bet you probably understood what i typed in orange. ;)
Zitat von Grimfate126
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-03-2007, 02:48 AM #3668QJ Gamer Green
- Registriert seit
- Jan 2007
- Ort
- beside my PC
- Beiträge
- 520
- Points
- 6.446
- Level
- 52
- Downloads
- 0
- Uploads
- 0
Zitat von TMNT
is that code the same asCode:int credits() { int showTime = 0; Font* myfont1 = Font_Load("./files/Fonts/VERA.TTF"); Font_SetSize(myfont1, 14); Font* myfont2 = Font_Load("./files/Fonts/REN_STIM.TTF"); Font_SetSize(myfont2, 15); Font* myfont3 = Font_Load("./files/Fonts/VERA.TTF"); Font_SetSize(myfont3, 20); Image* credits; Image* credits2; Image* credits3; credits = loadImage("./files/images/superbatxs.png"); credits2 = loadImage("./files/images/bubbles.png"); credits3 = loadImage("./files/images/superbat.png"); for (;; showTime++; if (showTime < 240) { // EVERY 60 IS A SECOND // blitAlphaImageToScreen(0, 0 , 480, 272, credits, 0, 0); Font_PrintScreen(myfont3, 135, 125, "SuperbatXS presents...", GU_RGBA(0, 100, 0, 255), getVramDrawBuffer()); flipScreen(); } if ((showTime > 240 && showTime < 330)) { // EVERY 60 IS A SECOND // blitAlphaImageToScreen(0, 0 , 480, 272, credits2, 0, 0); Font_PrintScreen(myfont2, 2, 10, "A shell developed for full homebrew", GU_RGBA(0, 0, 255, 255), getVramDrawBuffer()); Font_PrintScreen(myfont2, 10, 25, "gaming and media experience...", GU_RGBA(0, 0, 255, 255), getVramDrawBuffer()); flipScreen(); } if ((showTime > 480 && showTime < 530)){ // EVERY 60 IS A SECOND // blitAlphaImageToScreen(0, 0 , 480, 272, credits3, 0, 0); Font_PrintScreen(myfont3, 185, 145, "G-Pack", GU_RGBA(0, 0, 255, 255), getVramDrawBuffer()); Font_PrintScreen(myfont3, 267, 145, "v.3", GU_RGBA(255, 215, 0, 255), getVramDrawBuffer()); Font_PrintScreen(myfont2, 20, 200, "Now a completely new experience...", GU_RGBA(255, 239, 219, 255), getVramDrawBuffer()); Font_PrintScreen(myfont1, 2, 225, "Plug in your headphones now for full sound experience!", GU_RGBA(255, 69, 0, 255), getVramDrawBuffer()); flipScreen(); } if (showTime >= 560) { appmain(); } } }
????????????? u know, the spaces.... in LUA it will work.. will it work in C too?
-
04-03-2007, 04:11 AM #3669QJ Gamer Silver

- Registriert seit
- Jun 2006
- Ort
- UK
- Beiträge
- 2.326
- Points
- 10.263
- Level
- 67
- Downloads
- 0
- Uploads
- 0
Whitespace is ignored in C or C++.
[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]
-
04-03-2007, 04:43 AM #3670Heroes never die

- Registriert seit
- Aug 2006
- Ort
- ...........
- Beiträge
- 1.323
- Points
- 8.645
- Level
- 62
- Downloads
- 0
- Uploads
- 0
white space is for making reading/working with a code easier
-
04-03-2007, 12:18 PM #3671
Enuf of 2d Blit...Flip. :ROFL:
Ok. I would like to venture into some 3d and real Gu environment.
What's the trick behind animating 3d objects[ex characters]
Is it that already premoved set of models are loaded and then rendered on screen or is there a way to alter the 3d models using anyother means w/out prerendering?
-
04-03-2007, 01:05 PM #3672Your Fate is Grim...

- Registriert seit
- Oct 2005
- Beiträge
- 2.269
- Points
- 11.640
- Level
- 70
- Downloads
- 0
- Uploads
- 0
in order to do animation, you will need to use a model file, such as md2, md3, etc. the only way you can alter existing models is by purely using the GU. and that means you can rotate it, and scale it, and move it around. basically, if you use the GU, your polygon list stays the same.
Zitat von Mr305
--------------------------------------------------------------------------------------
-
04-03-2007, 03:16 PM #3673QJ Gamer Silver

- Registriert seit
- Jun 2006
- Ort
- UK
- Beiträge
- 2.326
- Points
- 10.263
- Level
- 67
- Downloads
- 0
- Uploads
- 0
Usually 'pre-animated'. However, it is possible to animate a model in code dynamically as shown in games by rag doll physics for example.
Zitat von Mr305
[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]
-
04-03-2007, 05:26 PM #3674
Vertex __attribute__((aligned(16 ))) triangle[3] =
{
{ GU_COLOR( 1.0f, 1.0f, 1.0f, 0.0f ), 0.0f, 1.0f, 0.0f }, // top point
{ GU_COLOR( 1.0f, 1.0f, 1.0f, 0.0f ), 1.0f,-1.0f, 0.0f }, // left point
{ GU_COLOR( 1.0f, 1.0f, 1.0f, 0.0f ),-1.0f,-1.0f, 0.0f } // right point
};
{ 0xFFFFFFFF, 1.0f,-1.0f, 0.0f }, // left point
{ 0xFFFFFFFF,-1.0f,-1.0f, 0.0f } // right point
X Y Z
When it's 1, it should be right. RIght?
-1 left. Right?
Are they misguiding or is it a mistake in typing?
-
04-03-2007, 06:24 PM #3675QJ Gamer Silver

- Registriert seit
- May 2006
- Ort
- Behind you.
- Beiträge
- 1.814
- Points
- 10.921
- Level
- 69
- Downloads
- 0
- Uploads
- 0
What's the code for umd loading? I know that you have to access the flash, but i don't know the code to load umd's. Thanks.
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-03-2007, 06:33 PM #3676
CHECK OUT..the header files..I know its in there...
Zitat von TMNT
牧来栠摩琠敨映汩獥
PSN: youresamFrom Earth the Frozen Ipaqs shall rise and be silenced and all will live free.
--Mike Hollingsworth
-
04-03-2007, 06:40 PM #3677QJ Gamer Silver

- Registriert seit
- May 2006
- Ort
- Behind you.
- Beiträge
- 1.814
- Points
- 10.921
- Level
- 69
- Downloads
- 0
- Uploads
- 0
Lol, nvm. I found it.......very very easy and simple.
Zitat von youresam

Edit: Um, i could use some help. Here is my code:
I did indeed put this in kernel mode (0x1000), but i have a problem. When i press R trigger, the you can hear the umd spin, and the memory stick does flash for a while. Later, my psp freezes (doesn't turn off by itself though, and home doesn't work). What am i doing wrong? Thanks.Code:int i; i = sceUmdCheckMedium(0); if(i == 0) { sceUmdWaitDriveStat(UMD_WAITFORDISC); } //in while loop- if(pad.Buttons & PSP_CTRL_RTRIGGER) { sceUmdActivate(1, "disc0:"); sceUmdWaitDriveStat(UMD_WAITFORINIT); sceKernelLoadExec("disc0:/SYSDIR/eboot.bin", 0); 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-03-2007, 11:02 PM #3678Heroes never die

- Registriert seit
- Aug 2006
- Ort
- ...........
- Beiträge
- 1.323
- Points
- 8.645
- Level
- 62
- Downloads
- 0
- Uploads
- 0
check the hense sdk if you are using custom firmware
-
04-03-2007, 11:57 PM #3679QJ Gamer Silver
- Registriert seit
- Oct 2005
- Ort
- Sheffield, UK
- Beiträge
- 844
- Points
- 8.201
- Level
- 61
- Downloads
- 0
- Uploads
- 0
use sceKernelLoadExecVSHDisc from psploadexec_kernel.h instead of sceKernelLoadExec to load the umd.
-
04-04-2007, 06:44 AM #3680
This is going back to prev page, where it doesn't get noticed... Any answers?
Zitat von Mr305
-
04-04-2007, 06:55 AM #3681QJ Gamer Blue
- Registriert seit
- Mar 2007
- Ort
- Holland..
- Beiträge
- 154
- Points
- 4.022
- Level
- 40
- Downloads
- 0
- Uploads
- 0
can someone help me with this menu:
what's wrong with this menu :Cry:Code:{ SceCtrlData pad; if(tempMenuSelection == 1) { printf("==> menu 1"); printf(" menu 2"); printf(" menu 3"); printf(" menu 4"); printf(" menu 5"); printf(" menu 6"); } if(tempMenuSelection == 2) { printf(" menu 1"); printf(" ==>menu 2"); printf(" menu 3"); printf(" menu 4"); printf(" menu 5"); printf(" menu 6"); } else if(tempMenuSelection == 3) { printf(" menu 1"); printf(" menu 2"); printf("==> menu 3"); printf(" menu 4"); printf(" menu 5"); printf(" menu 6"); } else if(tempMenuSelection == 4) { printf(" menu 1"); printf(" menu 2"); printf(" menu 3"); printf(" ==>menu 4"); printf(" menu 5"); printf(" menu 6"); } else if(tempMenuSelection == 5) { printf(" menu 1"); printf(" menu 2"); printf(" menu 3"); printf(" menu 4"); printf(" ==>menu 5"); printf(" menu 6"); } else if(tempMenuSelection == 6) { printf(" menu 1"); printf(" menu 2"); printf(" menu 3"); printf(" menu 4"); printf(" menu 5"); printf(" ==>menu 6"); } while(1) { sceCtrlReadBufferPositive(&pad, 1); if (pad.Buttons & PSP_CTRL_UP) { // i tempMenuSelection--; // wait(7); //scrollspeed } else if (pad.Buttons & PSP_CTRL_DOWN){ // otherwise if the down button is pressed, tempMenuSelection++; // increment the menu selection. wait(7); //scrollspeed } if (tempMenuSelection > 6) // if the menu selector is past the end of the menu, tempMenuSelection = 1; // move it to the beginning, else if (tempMenuSelection < 1) // otherwise if it is before the beginning, tempMenuSelection = 6; // move it to the end. if(pad.Buttons & PSP_CTRL_CROSS){ if(tempMenuSelection==1) { pspDebugScreenClear(); printf("option 1\n"); wait(140); menu(); } } if(pad.Buttons & PSP_CTRL_CROSS){ if(tempMenuSelection==2) { pspDebugScreenClear(); printf("option 2\n"); wait(140); menu(); } } if(pad.Buttons & PSP_CTRL_CROSS){ if(tempMenuSelection==3){ pspDebugScreenClear(); printf("option 3\n"); wait(140); menu(); } } if(pad.Buttons & PSP_CTRL_CROSS){ if(tempMenuSelection==4){ pspDebugScreenClear(); printf("option 4\n"); wait(140); menu(); } } if(pad.Buttons & PSP_CTRL_CROSS){ if(tempMenuSelection==5){ pspDebugScreenClear(); printf("option 5\n"); wait(140); menu(); } } if(pad.Buttons & PSP_CTRL_CROSS){ if(tempMenuSelection==6){ pspDebugScreenClear(); printf("option 6\n"); wait(140); menu(); } } } }
and something else; how do i get size of font bigger and how do i change the font ??
-
04-04-2007, 06:57 AM #3682Heroes never die

- Registriert seit
- Aug 2006
- Ort
- ...........
- Beiträge
- 1.323
- Points
- 8.645
- Level
- 62
- Downloads
- 0
- Uploads
- 0
got it:)?Code:while() //text while button menuoption++ break;
-
04-04-2007, 08:07 AM #3683QJ Gamer Blue
- Registriert seit
- Mar 2007
- Ort
- Holland..
- Beiträge
- 154
- Points
- 4.022
- Level
- 40
- Downloads
- 0
- Uploads
- 0
wel doesn't work properly.. because it will only refresh if press X ..
edit: It's your 600st post @ qj.net .. up to 1000
-
04-04-2007, 09:34 AM #3684QJ 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
Zitat von Kwastie
not sure, it could be the "wait(#)'s all around, I noticed something a little redundant...
you keep repeating if(pad.Buttons & PSP_CTRL_CROSS){ and you don't need too.. try replacing those with something like this,
your last one should be likeCode:if(pad.Buttons & PSP_CTRL_CROSS) { if(tempMenuSelection==1) { pspDebugScreenClear(); printf("option 1\n"); wait(140); menu(); }else if(tempMenuSelection==2) { pspDebugScreenClear(); printf("option 2\n"); wait(140); menu(); }else if(tempMenuSelection == 3) { pspDebugScreenClear(); printf("option 3\n"); wait(140); menu(); } //etc
Code:}else{ /*the last one, so we don't really need the arguments (tempMenuSelection==6){*\ pspDebugScreenClear(); printf("option 6\n"); wait(140); menu(); } } } }NEWMy New BLOG!NEWThe Wentire Worls in two Sectors....When did I get dev statz?
Spoiler for my PSP homebrewReleases:Spoiler for Great Quotes:
-
04-04-2007, 10:12 AM #3685QJ Gamer Silver

- Registriert seit
- May 2006
- Ort
- Behind you.
- Beiträge
- 1.814
- Points
- 10.921
- Level
- 69
- Downloads
- 0
- Uploads
- 0
Learn this forwards and backwords (expression):
http://www.psp-programming.com/forum...topic,359.html
Don't just copy and paste or learn the full code right in the end. Try to actually understand the concept. If you understand it, you can add more menu options, and turn off/on menu's when you are switching between them. In my menu, i took me a while until i learned how to make a menu that wouldn't crash much, and after experimenting with making menu's, i finally learned how or what the best way was (it just depends on your menu). My point is, learning this tutorial would be the best way for you to learn this quickly and easily. ;)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-04-2007, 10:18 AM #3686QJ 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
learning LUA is what taught me menus, it was really easy to make my first menu in C because of learning it in lua before.
NEWMy New BLOG!NEWThe Wentire Worls in two Sectors....When did I get dev statz?
Spoiler for my PSP homebrewReleases:Spoiler for Great Quotes:
-
04-04-2007, 11:12 AM #3687QJ Gamer Silver

- Registriert seit
- May 2006
- Ort
- Behind you.
- Beiträge
- 1.814
- Points
- 10.921
- Level
- 69
- Downloads
- 0
- Uploads
- 0
Lol, even in lua i couldn't make a proper menu. :ROFL:
Zitat von BlackShark
But seriously, C is pretty cool and addictive. So many things to do.....so many hacks....cool stuff. Mmmm...."i'm lovin' it"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-04-2007, 11:42 AM #3688
A change in username? How?
Zitat von TMNT
-
04-04-2007, 11:47 AM #3689Heroes never die

- Registriert seit
- Aug 2006
- Ort
- ...........
- Beiträge
- 1.323
- Points
- 8.645
- Level
- 62
- Downloads
- 0
- Uploads
- 0
you can change your nickname in vbplaza
anyway making menus for first time is just some think and you make the perfect noobmenu and then everythinbg goes better
just use variables , some printf's and istatements , a while loop and you got it
-
04-04-2007, 11:52 AM #3690QJ Gamer Silver

- Registriert seit
- May 2006
- Ort
- Behind you.
- Beiträge
- 1.814
- Points
- 10.921
- Level
- 69
- Downloads
- 0
- Uploads
- 0
Yea, you just need to know those and have some basic logic. Coding is ALL logic, and copy and paste isn't going to get anyone anywhere.
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...)


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