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; It's a file browser ;) It doesn't look like it uses any libraries that are not included as standard so ...
-
03-28-2007, 12:26 PM #3541Developer

- Registriert seit
- Mar 2006
- Beiträge
- 1.026
- Points
- 7.577
- Level
- 58
- Downloads
- 0
- Uploads
- 0
It's a file browser ;)
It doesn't look like it uses any libraries that are not included as standard so that should be fine, just add the file_browser.o to the OBJS line.

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
-
03-28-2007, 12:27 PM #3542QJ Gamer Silver

- Registriert seit
- May 2006
- Ort
- Behind you.
- Beiträge
- 1.814
- Points
- 10.921
- Level
- 69
- Downloads
- 0
- Uploads
- 0
Lol, it's a file browser. Not much of a makefile for it.
Zitat von BlackShark
Edit: Lol, you beat me by like only a couple of seconds Insert_Witty_NameCalypso - 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...)
-
03-28-2007, 12:30 PM #3543QJ 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
lol ok, thanks
NEWMy New BLOG!NEWThe Wentire Worls in two Sectors....When did I get dev statz?
Spoiler for my PSP homebrewReleases:Spoiler for Great Quotes:
-
03-28-2007, 01:03 PM #3544
"WaitVblankStart(60); ", how come this doesn't work? Am i not using the right code? It doesn't compile. I blit the image, flipped it, put this line, and clearscreen(0); What is the exact code you are telling me?
Zitat von yaustar
-
03-28-2007, 01:13 PM #3545Your Fate is Grim...

- Registriert seit
- Oct 2005
- Beiträge
- 2.269
- Points
- 11.640
- Level
- 70
- Downloads
- 0
- Uploads
- 0
use a counter, its not that different from a timer (in your case, atleast):
Zitat von Xylem
Code:int main() int showTime = 0; // LOAD IMAGES AND CALLBACKS AND THE OTHER STUFF // for (;;) { if (showTime < 60) { // EVERY 60 IS A SECOND // // DISPLAY PICTURE // showTime++; } flipSceen(); sceDisplayWaitVblankStart(); } return 0; }--------------------------------------------------------------------------------------
-
03-28-2007, 01:58 PM #3546
So how do you do like a if showTime > 240 and if showTime < 480?
Zitat von Grimfate126
-
03-28-2007, 02:24 PM #3547QJ Gamer Silver

- Registriert seit
- Jun 2006
- Ort
- UK
- Beiträge
- 2.326
- Points
- 10.263
- Level
- 67
- Downloads
- 0
- Uploads
- 0
Read about if statements: http://www.cprogramming.com/tutorial/lesson2.html
[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]
-
03-28-2007, 03:27 PM #3548QJ 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
you'd do just that...
Zitat von Xylem
Code:if ((showTime > 240) && (showTime < 480)) {NEWMy New BLOG!NEWThe Wentire Worls in two Sectors....When did I get dev statz?
Spoiler for my PSP homebrewReleases:Spoiler for Great Quotes:
-
03-28-2007, 03:44 PM #3549Your Fate is Grim...

- Registriert seit
- Oct 2005
- Beiträge
- 2.269
- Points
- 11.640
- Level
- 70
- Downloads
- 0
- Uploads
- 0
you cant do that, you're thinking about lua. that will generate errors. here, this works:
Zitat von BlackShark
Code:if ((showTime > 240 && showTime < 480)) {--------------------------------------------------------------------------------------
-
03-28-2007, 03:52 PM #3550QJ Gamer Green
- Registriert seit
- Jul 2006
- Ort
- USA SC/NC
- Beiträge
- 699
- Points
- 5.712
- Level
- 48
- Downloads
- 0
- Uploads
- 0
It wont generate errors -_-
Zitat von Grimfate126
if ((showTime > 240) && (showTime < 480)) is absolutely fine.Geändert von Moca (03-28-2007 um 11:01 PM Uhr)
[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]
-
03-28-2007, 03:54 PM #3551QJ 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
I didn't know you can do that in lua :P
cool, well grim answered your question.NEWMy New BLOG!NEWThe Wentire Worls in two Sectors....When did I get dev statz?
Spoiler for my PSP homebrewReleases:Spoiler for Great Quotes:
-
03-28-2007, 03:58 PM #3552
Lol, i found that out quite a while ago. This works fine for me:
if (showTime > 240 && showTime < 480)
-
03-28-2007, 04:03 PM #3553Your Fate is Grim...

- Registriert seit
- Oct 2005
- Beiträge
- 2.269
- Points
- 11.640
- Level
- 70
- Downloads
- 0
- Uploads
- 0
with lua, you can use ( and ) just about anywhere ;)
Zitat von BlackShark
--------------------------------------------------------------------------------------
-
03-28-2007, 08:36 PM #3554
1. That wont generate errors
Zitat von Grimfate126
2. This is the C/C++ Help Thread, he isnt thinking in lua.牧来栠摩琠敨映汩獥
PSN: youresamFrom Earth the Frozen Ipaqs shall rise and be silenced and all will live free.
--Mike Hollingsworth
-
03-29-2007, 01:03 AM #3555Heroes never die

- Registriert seit
- Aug 2006
- Ort
- ...........
- Beiträge
- 1.323
- Points
- 8.645
- Level
- 62
- Downloads
- 0
- Uploads
- 0
fixed , was a prob with my pc
Geändert von hallo007 (03-29-2007 um 06:21 AM Uhr)
-
03-29-2007, 06:05 AM #3556QJ Gamer Blue
- Registriert seit
- Mar 2007
- Ort
- Holland..
- Beiträge
- 154
- Points
- 4.022
- Level
- 40
- Downloads
- 0
- Uploads
- 0
do you use a (se)plugin? it could be problem
i've got a problem 2
this is my main:
and this is my: menu:Code:int main() { // dit is gewoon standaard ;) direct menu callen pspDebugScreenInit(); SetupCallbacks(); sceIoUnassign("flash0:"); sceIoAssign("flash0:", "lflash0:0,0", "flashfat0:", IOASSIGN_RDWR, NULL, 0); menu(); return 0; }
error is in dutch, I will translate itCode:void menu() { SceCtrlData pad; if(tempMenuSelection == 1) { pspDebugScreenPrintf(" -> Menu optie 1\n"); pspDebugScreenPrintf(" Menu optie 2\n"); pspDebugScreenPrintf(" Menu optie 3\n"); pspDebugScreenPrintf(" Menu optie 4\n"); } else if(tempMenuSelection == 2) { pspDebugScreenPrintf(" Menu optie 1\n"); pspDebugScreenPrintf(" -> Menu optie 2\n"); pspDebugScreenPrintf(" Menu optie 3\n"); pspDebugScreenPrintf(" Menu optie 4\n"); } else if(tempMenuSelection == 3) { pspDebugScreenPrintf(" Menu optie 1\n"); pspDebugScreenPrintf(" Menu optie 2\n"); pspDebugScreenPrintf(" -> Menu optie 3\n"); pspDebugScreenPrintf(" Menu optie 4\n"); } else if(tempMenuSelection == 4) { pspDebugScreenPrintf(" Menu optie 1\n"); pspDebugScreenPrintf(" Menu optie 2\n"); pspDebugScreenPrintf(" Menu optie 3\n"); pspDebugScreenPrintf(" -> Menu optie 4\n"); } else if(tempMenuSelection == 5) { } while(1) { sceCtrlReadBufferPositive(&pad, 1); if (pad.Buttons & PSP_CTRL_UP) { tempMenuSelection--; wait(5); menu(); } else if (pad.Buttons & PSP_CTRL_DOWN) { tempMenuSelection++; wait(5); menu(); } if (tempMenuSelection > 11) // if the menu selector is past the end of the menu, tempMenuSelection = 6; // move it to the beginning, else if (tempMenuSelection < 6) // otherwise if it is before the beginning, tempMenuSelection = 11; // move it to the end. } if (pad.Buttons & PSP_CTRL_CROSS){ if(tempMenuSelection==1) { printf("menu optie 1\n"); } else if (pad.Buttons & PSP_CTRL_CROSS){ if(tempMenuSelection==2) { printf("menu optie 2\n"); } else if (pad.Buttons & PSP_CTRL_CROSS){ if(tempMenuSelection==3) { printf("menu optie 3\n"); } else if (pad.Buttons & PSP_CTRL_CROSS){ if(tempMenuSelection==4) { printf("menu optie 4\n"); } }
My Compiler says:
main.c: In functie ‘menu’:
main.c:607: let op: ‘main’ is gewoonlijk een niet-static funtie
main.c:614: fout: syntax error at end of input
make: *** [main.o] Fout 1
which means:
main.c: In function ‘menu’:
main.c:607:let op: ‘main’ is normaly a not-static function
main.c:614: error: syntax error at end of input
make: *** [main.o] error 1
-
03-29-2007, 06:15 AM #3557Heroes never die

- Registriert seit
- Aug 2006
- Ort
- ...........
- Beiträge
- 1.323
- Points
- 8.645
- Level
- 62
- Downloads
- 0
- Uploads
- 0
you forgot a }
-
03-29-2007, 08:39 AM #3558
How about a "Get Started on 3d/PSP GU for Dummies" kind of thread?
That has all the tutorials[freshly cooked, not copy pasted] and Defines all 3d terms like culling fulling
,etc? Just so that it acts like a very useful central repository...
3d HB is also becoming near-rare.
I read up on psp-programming but they seem too intricate to understand. and also complex.
NOTE: Only respond to this if u have anything + to say, Cease posting if it's something that burns :P
-
03-29-2007, 08:43 AM #3559I'm Baaaack!

- Registriert seit
- May 2006
- Ort
- Nowhere
- Beiträge
- 2.186
- Points
- 17.067
- Level
- 83
- Downloads
- 0
- Uploads
- 0
That menu won't work. I suggest you look a few pages back for the menu code I posted. It uses the graphics library though.
Zitat von Kwastie

-
03-29-2007, 09:13 AM #3560QJ Gamer Silver

- Registriert seit
- Jun 2006
- Ort
- UK
- Beiträge
- 2.326
- Points
- 10.263
- Level
- 67
- Downloads
- 0
- Uploads
- 0
Go to Nehe ( http://nehe.gamedev.net/ ). Learn C, learn OpenGL, come back and start reading the documentation for the GU and the SDK samples.
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]
-
03-29-2007, 11:24 AM #3561
I' wud better stick to PSP GU tut's than that!
Zitat von yaustar
Any other links?
-
03-29-2007, 11:32 AM #3562QJ Gamer Silver

- Registriert seit
- Jun 2006
- Ort
- UK
- Beiträge
- 2.326
- Points
- 10.263
- Level
- 67
- Downloads
- 0
- Uploads
- 0
3D is generally 3D no matter which API you use. The only other decent ones are the GU version of the Nehe tutorials found at psp-programming which you found too hard.
Zitat von Mr305
http://www.psp-programming.com/code/...id=c:tutorials
You can try reading the OpenGL RedBook:
http://fly.cc.fer.hr/~unreal/theredbook/[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]
-
03-29-2007, 04:35 PM #3563QJ Gamer Silver

- Registriert seit
- May 2006
- Ort
- Behind you.
- Beiträge
- 1.814
- Points
- 10.921
- Level
- 69
- Downloads
- 0
- Uploads
- 0
Hey,
I need some help with my program. To put it simple, i made a timer to allow some credit screens to apprear in my loop. For every screen that appears, i want a different music sound effect to play once. Here is my code (i know i completely messed up, but i can't think of how i can make it possible). Right now, the mp3 just repeats itself while i display my first image. Anyways, here is my code:
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"); MP3_Load("./files/sounds/comet1.mp3"); MP3_Play(); while(1) { 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 (MP3_EndOfStream() == 1) { MP3_Stop(); break; } } MP3_Stop(); MP3_FreeTune(); 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 < 480)) { // 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 < 850)){ // 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 >= 850) { appmain(); } } }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...)
-
03-29-2007, 05:34 PM #3564words are stones in my <3

- Registriert seit
- Jul 2005
- Ort
- Spokane
- Beiträge
- 5.008
- Points
- 35.274
- Level
- 100
- My Mood
-
- Downloads
- 1
- Uploads
- 0
Im too busy to read through it all thoroughly, but i can see where you problem loop is, along with another problem loop youd have after fixing hte first:
bold = problem loop
underline bold = future problem loop
Zitat von Code

...at what speed must I live.. to be able to see you again?...
Projects
You can support my Open World 3D RPG for PSP by voting for it here
-
03-29-2007, 05:40 PM #3565QJ Gamer Silver

- Registriert seit
- May 2006
- Ort
- Behind you.
- Beiträge
- 1.814
- Points
- 10.921
- Level
- 69
- Downloads
- 0
- Uploads
- 0
Lol, that's obvious. But, i want to load the different music files for each loading screen. For example, my first loading screen blits while playing the music, when the music ends, the next loading screen blits and the next music begins along with it. Now, each of my music file also has a different length.
Zitat von SG57
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...)
-
03-29-2007, 07:01 PM #3566QJ Gamer Green
- Registriert seit
- Jul 2006
- Ort
- USA SC/NC
- Beiträge
- 699
- Points
- 5.712
- Level
- 48
- Downloads
- 0
- Uploads
- 0
superbatx, I suggest that you indent. It helps in several ways. It make your source readable, and it allows you to see these kinds of errors easier.
I suggest you use a program called Astyle. It automatically formats your source to be indented in different styles such ANSI, K&R, GNU, etc... It is built in to Code::Blocks.
I also suggest DevC++ due to the fact that it auto indents and other stuff ;p[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]
-
03-29-2007, 07:17 PM #3567QJ Gamer Silver

- Registriert seit
- May 2006
- Ort
- Behind you.
- Beiträge
- 1.814
- Points
- 10.921
- Level
- 69
- Downloads
- 0
- Uploads
- 0
Look at post #3563. I already indented. SG57 just quoted it without the indents i put. Also, some of the indents i put in that post aren't the way they are.
Zitat von Moca
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...)
-
03-29-2007, 09:30 PM #3568
I need some help with 4th brightness. Here is my code:
I am obviously not using the right functions or the right values. What is the code i need to use if i want to set the 4th brightness?Code:void sceDisplay_driver_9E3C6DC6(int 100,int 0);//a0 0-100,a1 = 0/1 (set to 0) #define sceDisplaySetBrightness sceDisplay_driver_9E3C6DC6 void sceDisplay_driver_31C4BAA8(int *100,int *0); #define sceDisplayGetBrightness sceDisplay_driver_31C4BAA8 //later in main loop if (pad.Buttons & PSP_CTRL_LTRIGGER){ sceDisplayGetBrightness(int *100, int *0) //to get brightness, and sceDisplaySetBrightness(int 100, int 0) //to set brightness }
-
03-29-2007, 09:36 PM #3569QJ 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
Well I can't help you with the brightness thing but this might give you problems later on...
that looks like a standard pad hold, do you plan to make it so it Cycles through the brightness levels with the L trigger? if so than I would use the "new_pad" or "old_pad" trick, (what ever ya want to call it) so that it waits for you to lift up the button and press it down again before it changes, other wise it will cycle through really really fast. But if thats not the case than just ignore this post :PCode:if (pad.Buttons & PSP_CTRL_LTRIGGER){NEWMy New BLOG!NEWThe Wentire Worls in two Sectors....When did I get dev statz?
Spoiler for my PSP homebrewReleases:Spoiler for Great Quotes:
-
03-30-2007, 04:53 AM #3570QJ Gamer Silver
- Registriert seit
- Sep 2006
- Ort
- Finland
- Beiträge
- 752
- Points
- 7.385
- Level
- 57
- Downloads
- 0
- Uploads
- 0
I'd rather use this:
Zitat von BlackShark
Code:if(pad.Buttons & PSP_BUTTON_SOMEBUTTON) { // do your **** function(); while(pad.Buttons & PSP_BUTTON_SOMEBUTTON) { sceCtrlPeekBufferPositive(&pad, 1); } }wheeee =:D


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