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; Why are you using OSLib ? o_O And I think the UMD functions in the M33 SDK will be of ...
-
08-09-2009, 07:07 AM #9901Banned for LIFE
- Registriert seit
- Oct 2006
- Ort
- East London, England
- Beiträge
- 2
- Points
- 18.744
- Level
- 86
- Downloads
- 0
- Uploads
- 0
Why are you using OSLib? o_O
And I think the UMD functions in the M33 SDK will be of better use.
-
08-09-2009, 07:21 AM #9902Developer and Tutor.
- Registriert seit
- Jul 2007
- Ort
- Widnes, England
- Beiträge
- 1.649
- Points
- 8.736
- Level
- 62
- My Mood
-
- Downloads
- 0
- Uploads
- 0
------ FaT3oYCG -----
AKA Craig, call me what you want to It's your preference.
My Website: http://www.modern-gamer.co.uk/
Currently working on:
(0) MediaGrab
(0) PGE Gears Of War - On hold (Very large project).
(0) PS???? -On Hold A tactical 2d side scrolling game involving AI and online multiplayer features. - Tile engine nearley finished (1 bug to fix).
-
08-09-2009, 12:02 PM #9903QJ Gamer Gold

- Registriert seit
- Nov 2008
- Ort
- CAD
- Beiträge
- 693
- Points
- 13.372
- Level
- 75
- Downloads
- 19
- Uploads
- 4
I'd say that you're better off with libge.
That epic dude.
-
08-09-2009, 01:06 PM #9904xMod.
- Registriert seit
- Oct 2008
- Ort
- Melbourne, Australia
- Beiträge
- 675
- Points
- 4.576
- Level
- 43
- My Mood
-
- Downloads
- 0
- Uploads
- 0
If thinking when there is no UMD it doesn't return 0 and always executes the else statementif (umdDetectedVariable == 0)
{
oslPrintf_xy(20, 240, "No UMD disc is inserted.");
} else {
oslPrintf_xy(20, 240, "UMD disc is inserted.");
}
-
08-09-2009, 01:44 PM #9905Developer and Tutor.
- Registriert seit
- Jul 2007
- Ort
- Widnes, England
- Beiträge
- 1.649
- Points
- 8.736
- Level
- 62
- My Mood
-
- Downloads
- 0
- Uploads
- 0
i havent compared with my old code and i cant remember what i changed but got it to work now ...
and that is running in usermode as like i said i cant see umd functions being kernelCode:#include <oslib/oslib.h> #include <pspumd.h> PSP_MODULE_INFO("Testing", 0, 1, 0); PSP_MAIN_THREAD_ATTR(THREAD_ATTR_USER | THREAD_ATTR_VFPU); int main() { oslInit(0); oslInitGfx(OSL_PF_8888, 1); oslInitConsole(); while (!osl_quit) { oslStartDrawing(); oslCls(); oslReadKeys(); oslPrintf_xy(20, 20, "Testing"); int umdCheck; umdCheck = sceUmdCheckMedium(); if (umdCheck == 0) { oslPrintf_xy(20, 40, "No UMD present."); } else { oslPrintf_xy(20, 40, "UMD detected."); } if (osl_keys->held.hold) { oslPrintf_xy(20, 250, "Hold Activated!"); } if (osl_keys->pressed.start) { break; } oslEndDrawing(); oslSyncFrame(); } oslEndGfx(); oslQuit(); return 0; }------ FaT3oYCG -----
AKA Craig, call me what you want to It's your preference.
My Website: http://www.modern-gamer.co.uk/
Currently working on:
(0) MediaGrab
(0) PGE Gears Of War - On hold (Very large project).
(0) PS???? -On Hold A tactical 2d side scrolling game involving AI and online multiplayer features. - Tile engine nearley finished (1 bug to fix).
-
08-10-2009, 09:26 AM #9906QJ Gamer Gold

- Registriert seit
- Jul 2005
- Ort
- everywhere
- Beiträge
- 3.526
- Points
- 17.453
- Level
- 84
- Downloads
- 1
- Uploads
- 0
@slasher, the documentation clearly states that 0 is the proper return,
1. Failed....again...
2. http://slicer.gibbocool.com/ stay updated on all my projects
3. it'll be 5 years in june, that's nearly 1/4 of my life on this planet that i've visited these forums, what a ride it has been
-
08-10-2009, 10:52 AM #9907likes kittens....awww....
- Registriert seit
- Sep 2006
- Ort
- Detroit
- Beiträge
- 628
- Points
- 6.975
- Level
- 55
- Downloads
- 0
- Uploads
- 0
Alright guys, n00b question.
Why can't I get the toolchain to install.??
And it skips the svn update.
I used to have all this shiz until my dad deleted it, mistakenly thinking its a virus.
Code:MY [email protected] ~ $ ls psptoolchain MY [email protected] ~ $ cd psptoolchain MY [email protected] ~/psptoolchain $ svn update Skipped '.' MY [email protected] ~/psptoolchain $ ls build depends patches readme.txt scripts toolchain-sudo.sh toolchain.sh MY [email protected] ~/psptoolchain $ ./toolchain.sh ERROR: Set $PSPDEV before continuing. ../depends/check-pspdev.sh: Failed. MY [email protected] ~/psptoolchain $
-
08-10-2009, 11:01 AM #9908No longer a community member.
- Registriert seit
- Dec 2005
- Beiträge
- 22
- Points
- 46.662
- Level
- 100
- Downloads
- 0
- Uploads
- 0
-
08-10-2009, 11:06 AM #9909likes kittens....awww....
- Registriert seit
- Sep 2006
- Ort
- Detroit
- Beiträge
- 628
- Points
- 6.975
- Level
- 55
- Downloads
- 0
- Uploads
- 0
Well how would I do that?
Really I was reading this and it just says:That's because you have to provide it with a URL.
It just says type in svn update and hit enterCode:Due to a recent problem with the toolchain, we need to update everything, so to get the updates and have them modify the toolchain script, you will need to type "svn update" and hit enter.
EDIT: nvm guys lol i just forgot to input this: export PSPDEV=/usr/local/pspdev
export PATH=$PATH:$PSPDEV/binGeändert von psphacker12. (08-10-2009 um 11:41 AM Uhr)
-
08-10-2009, 02:45 PM #9910Bush Programmer

- Registriert seit
- Nov 2005
- Beiträge
- 3.658
- Points
- 60.149
- Level
- 100
- Downloads
- 0
- Uploads
- 0
Quick Question
Hi Guys,
I thought there was a way to check in one operation,
if any buttons were pressed at all.
Rather than checking each button individually.
Anyone know how?
-
08-10-2009, 03:27 PM #9911QJ Gamer Silver
- Registriert seit
- Oct 2005
- Ort
- Sheffield, UK
- Beiträge
- 844
- Points
- 8.201
- Level
- 61
- Downloads
- 0
- Uploads
- 0
-
08-10-2009, 03:47 PM #9912QJ Gamer Gold

- Registriert seit
- Nov 2008
- Ort
- CAD
- Beiträge
- 693
- Points
- 13.372
- Level
- 75
- Downloads
- 19
- Uploads
- 4
hey guys, does any1 know how to blit an image and make it "blink" ?
That epic dude.
-
08-10-2009, 03:53 PM #9913likes kittens....awww....
- Registriert seit
- Sep 2006
- Ort
- Detroit
- Beiträge
- 628
- Points
- 6.975
- Level
- 55
- Downloads
- 0
- Uploads
- 0
I need help I still can't get cygwin to compile !!!
-
08-10-2009, 04:03 PM #9914QJ Gamer Gold

- Registriert seit
- Nov 2008
- Ort
- CAD
- Beiträge
- 693
- Points
- 13.372
- Level
- 75
- Downloads
- 19
- Uploads
- 4
did you install the psptoolchain ? coz it doesn't seem like it
and cygwin sucks, you should better use pspdev or minpspw
btw i still need help with my blinking problemThat epic dude.
-
08-10-2009, 04:05 PM #9915Developer and Tutor.
- Registriert seit
- Jul 2007
- Ort
- Widnes, England
- Beiträge
- 1.649
- Points
- 8.736
- Level
- 62
- My Mood
-
- Downloads
- 0
- Uploads
- 0
blit the image oslib is good to use for most stuff, make a counter, incrememnt the counter, if the counter is less than a certain value then blit the image if it is more then dont, reset the counter when it reaches a certain value.
you could also use a timer to do this, it would be a bit harder but more efficient and not loop dependant.
google: minpspw------ FaT3oYCG -----
AKA Craig, call me what you want to It's your preference.
My Website: http://www.modern-gamer.co.uk/
Currently working on:
(0) MediaGrab
(0) PGE Gears Of War - On hold (Very large project).
(0) PS???? -On Hold A tactical 2d side scrolling game involving AI and online multiplayer features. - Tile engine nearley finished (1 bug to fix).
-
08-10-2009, 04:15 PM #9916likes kittens....awww....
- Registriert seit
- Sep 2006
- Ort
- Detroit
- Beiträge
- 628
- Points
- 6.975
- Level
- 55
- Downloads
- 0
- Uploads
- 0
-
08-10-2009, 04:17 PM #9917Developer and Tutor.
- Registriert seit
- Jul 2007
- Ort
- Widnes, England
- Beiträge
- 1.649
- Points
- 8.736
- Level
- 62
- My Mood
-
- Downloads
- 0
- Uploads
- 0
read up
------ FaT3oYCG -----
AKA Craig, call me what you want to It's your preference.
My Website: http://www.modern-gamer.co.uk/
Currently working on:
(0) MediaGrab
(0) PGE Gears Of War - On hold (Very large project).
(0) PS???? -On Hold A tactical 2d side scrolling game involving AI and online multiplayer features. - Tile engine nearley finished (1 bug to fix).
-
08-10-2009, 04:23 PM #9918QJ Gamer Gold

- Registriert seit
- Nov 2008
- Ort
- CAD
- Beiträge
- 693
- Points
- 13.372
- Level
- 75
- Downloads
- 19
- Uploads
- 4
That epic dude.
-
08-11-2009, 01:40 AM #9919likes kittens....awww....
- Registriert seit
- Sep 2006
- Ort
- Detroit
- Beiträge
- 628
- Points
- 6.975
- Level
- 55
- Downloads
- 0
- Uploads
- 0
Hey guys, I have Minpspw, and Eclipse up and running, and I would like to know how to install libpng and zlib onto it? I have cygwin, and already used svn checkout to get them, I have a libpng folder, and a zlib folder, where do I put them to be able to use with Eclipse?? Thanks
-
08-11-2009, 03:35 AM #9920Developer and Tutor.
- Registriert seit
- Jul 2007
- Ort
- Widnes, England
- Beiträge
- 1.649
- Points
- 8.736
- Level
- 62
- My Mood
-
- Downloads
- 0
- Uploads
- 0
sigh

steps:
1. delete cygwin
2. use windows
3. use any normal text editor
4. read the minpspw documentation
Installed libs on minpspw by default:
by the looks of things im thinking that you havent got a clue what the hell you are doing, nevermind programming in CCode:zlib bzip2 freetype jpeg libbulletml libmad libmikmod libogg libpng libpspvram libTremor libvorbis lua pspgl pspirkeyb sqlite SDL SDL_gfx SDL_image SDL_mixer SDL_ttf smpeg ode libpthreadlite cal3D mikmodlib cpplibs flac giflib libpspmath pthreads-emb tinyxml oslib libcurl intrafont Jello zziplib Mini-XML------ FaT3oYCG -----
AKA Craig, call me what you want to It's your preference.
My Website: http://www.modern-gamer.co.uk/
Currently working on:
(0) MediaGrab
(0) PGE Gears Of War - On hold (Very large project).
(0) PS???? -On Hold A tactical 2d side scrolling game involving AI and online multiplayer features. - Tile engine nearley finished (1 bug to fix).
-
08-11-2009, 03:54 AM #9921likes kittens....awww....
- Registriert seit
- Sep 2006
- Ort
- Detroit
- Beiträge
- 628
- Points
- 6.975
- Level
- 55
- Downloads
- 0
- Uploads
- 0
Erm maybe I d/led an older version? Redownloading minpspw, and deleting cygwin.
AND I NEED TO: :rtfm:
Yup i checked what version i had, i had 0.7.1. the newest one is 0.9.5. So I guess thats why I didn't have the libs?
Either way it should (hopefully) work now.
Okay I read the readme for Minpspw and it says that it is the only thing that I need to create homebrew on the psp, but I can't seem to find a compiler...? Isn't there supposed to be a compiler that comes with the program, I can't find any. I've tried compiling it with the windows cmd, but that doesn't work.
Please don't think that I'm a dumbass...
Geändert von psphacker12. (08-11-2009 um 04:18 AM Uhr)
-
08-11-2009, 05:22 AM #9922Developer and Tutor.
- Registriert seit
- Jul 2007
- Ort
- Widnes, England
- Beiträge
- 1.649
- Points
- 8.736
- Level
- 62
- My Mood
-
- Downloads
- 0
- Uploads
- 0
erm, you cd into the directory of your code when you have a makefile and script with the required libs and then type make
------ FaT3oYCG -----
AKA Craig, call me what you want to It's your preference.
My Website: http://www.modern-gamer.co.uk/
Currently working on:
(0) MediaGrab
(0) PGE Gears Of War - On hold (Very large project).
(0) PS???? -On Hold A tactical 2d side scrolling game involving AI and online multiplayer features. - Tile engine nearley finished (1 bug to fix).
-
08-11-2009, 05:43 AM #9923likes kittens....awww....
- Registriert seit
- Sep 2006
- Ort
- Detroit
- Beiträge
- 628
- Points
- 6.975
- Level
- 55
- Downloads
- 0
- Uploads
- 0
Ok it works when I compile an audio tester, but with hello world it has some errors...?
I attached my files,Code:C:\>cd projects C:\PROJECTS>cd test C:\PROJECTS\TEST>make psp-gcc -I. -IC:/pspsdkdevkit/psp/sdk/include -O2 -G0 -Wall -D_PSP_FW_VERSION=15 0 -c -o main.o main.c main.c:37: warning: data definition has no type or storage class main.c:37: warning: type defaults to 'int' in declaration of 'pspDebugScreenInit ' main.c:37: error: conflicting types for 'pspDebugScreenInit' C:/pspsdkdevkit/psp/sdk/include/pspdebug.h:32: error: previous declaration of 'p spDebugScreenInit' was here main.c:38: warning: data definition has no type or storage class main.c:38: warning: type defaults to 'int' in declaration of 'SetupCallbacks' main.c:39: error: expected declaration specifiers or '...' before string constan t main.c:39: warning: data definition has no type or storage class main.c:39: warning: type defaults to 'int' in declaration of 'pspDebugScreenPrin tf' main.c:39: error: conflicting types for 'pspDebugScreenPrintf' C:/pspsdkdevkit/psp/sdk/include/pspdebug.h:49: error: previous declaration of 'p spDebugScreenPrintf' was here main.c:40: warning: data definition has no type or storage class main.c:40: warning: type defaults to 'int' in declaration of 'sceKernelSleepThre ad' main.c:41: error: expected identifier or '(' before 'return' main.c:42: error: expected identifier or '(' before '}' token make: *** [main.o] Error 1Geändert von psphacker12. (08-11-2009 um 05:55 AM Uhr)
-
08-11-2009, 06:11 AM #9924No longer a community member.
- Registriert seit
- Dec 2005
- Beiträge
- 22
- Points
- 46.662
- Level
- 100
- Downloads
- 0
- Uploads
- 0
-
08-11-2009, 06:19 AM #9925likes kittens....awww....
- Registriert seit
- Sep 2006
- Ort
- Detroit
- Beiträge
- 628
- Points
- 6.975
- Level
- 55
- Downloads
- 0
- Uploads
- 0
Thanks, Hardrive, well I was in a rush when I was copy/pasting it because my dad needed to get on the comp. , so I must've skipped over that part. I may be a n00b , but its a good learning experience.
I deserve a facepalm.
-
08-11-2009, 07:08 AM #9926Developer and Tutor.
- Registriert seit
- Jul 2007
- Ort
- Widnes, England
- Beiträge
- 1.649
- Points
- 8.736
- Level
- 62
- My Mood
-
- Downloads
- 0
- Uploads
- 0
*facepalm* you should really look into the basics of C and how libs work aswell as learning programming logic before you continue.
------ FaT3oYCG -----
AKA Craig, call me what you want to It's your preference.
My Website: http://www.modern-gamer.co.uk/
Currently working on:
(0) MediaGrab
(0) PGE Gears Of War - On hold (Very large project).
(0) PS???? -On Hold A tactical 2d side scrolling game involving AI and online multiplayer features. - Tile engine nearley finished (1 bug to fix).
-
08-11-2009, 08:26 AM #9927likes kittens....awww....
- Registriert seit
- Sep 2006
- Ort
- Detroit
- Beiträge
- 628
- Points
- 6.975
- Level
- 55
- Downloads
- 0
- Uploads
- 0
Umm ok I have one more question, how do you put text over an image that you blitted to the screen? When I try to do it using the font sample included in the samples, It works but The image doesn't show up in the background, and well , the text is parts of the image.
Code:int main(int argc, char **argv) { scePowerSetClockFrequency(333, 333, 166); char buffer[200]; Image* bg; pspDebugScreenInit(); SetupCallbacks(); initGraphics(); SceCtrlData pad; int thid = sceKernelCreateThread("update_thread", CallbackThread, 0x11, 0xFA0, 0, 0); if(thid >= 0) { sceKernelStartThread(thid, 0, 0); } sceGuInit(); sceGuStart(GU_DIRECT, list); sceGuDrawBuffer(GU_PSM_8888,(void*)0,BUF_WIDTH); sceGuDispBuffer(SCR_WIDTH,SCR_HEIGHT,(void*)0x88000,BUF_WIDTH); sceGuDepthBuffer((void*)0x110000,BUF_WIDTH); sceGuOffset(2048 - (SCR_WIDTH/2),2048 - (SCR_HEIGHT/2)); sceGuViewport(2048,2048,SCR_WIDTH,SCR_HEIGHT); sceGuDepthRange(0xc350,0x2710); sceGuScissor(0,0,SCR_WIDTH,SCR_HEIGHT); sceGuEnable(GU_SCISSOR_TEST); sceGuDisable(GU_DEPTH_TEST); sceGuShadeModel(GU_SMOOTH); sceGuEnable(GU_BLEND); sceGuBlendFunc(GU_ADD, GU_SRC_ALPHA, GU_ONE_MINUS_SRC_ALPHA, 0, 0); sceGuEnable(GU_TEXTURE_2D); sceGuTexMode(GU_PSM_8888, 0, 0, 0); sceGuTexImage(0, 256, 128, 256, font); sceGuTexFunc(GU_TFX_MODULATE, GU_TCC_RGBA); sceGuTexEnvColor(0x0); sceGuTexOffset(0.0f, 0.0f); sceGuTexScale(1.0f / 256.0f, 1.0f / 128.0f); sceGuTexWrap(GU_REPEAT, GU_REPEAT); sceGuTexFilter(GU_NEAREST, GU_NEAREST); sceGuFinish(); sceGuSync(0,0); sceGuDisplay(GU_TRUE); sprintf(buffer, "bg.png"); bg = loadImage(buffer); if (!bg) { //Image load failed printf("Image load failed!\n"); } else { int x = 0; int y = 0; sceDisplayWaitVblankStart(); while (x < 480) { while (y < 272) { blitAlphaImageToScreen(0 ,0 ,480 , 272, bg, x, y); y += 272; } x +=480; y = 0; } } flipScreen(); while(1) { sceGuStart(GU_DIRECT, list); sceGuClear(GU_COLOR_BUFFER_BIT); /* No matrixes are needed because the font is drawn with GU_TRANSFORM_2D */ drawString("Hello World in red", 0, 0, 0xFF0000FF, 0); drawString("Hello World in green", 0, 16, 0xFF00FF00, 0); drawString("Hello World in blue", 0, 32, 0xFFFF0000, 0); drawString("Hello World with free char width", 0, 64, 0xFFFFFFFF, 0); drawString("Hello World with block char width 10", 0, 80, 0xFFFFFFFF, 10); drawString("Hello World with block char width 12", 0, 96, 0xFFFFFFFF, 12); drawString("Hello World with opacity 100%", 0, 128, 0xFFFFFFFF, 0); drawString("Hello World with opacity 50%", 0, 144, 0x7FFFFFFF, 0); drawString("Hello World with opacity 10%", 0, 160, 0x18FFFFFF, 0); drawString("Hello World with shadow", 2, 194, 0x40FFFFFF, 0); drawString("Hello World with shadow", 0, 192, 0xFFFFFFFF, 0); static float t = 0.0f; t += 0.1f; unsigned int c = 0xFF000000 | (unsigned int)((sinf(t * 0.393f + 0.086f) / 2.0f + 0.5f) * 255.0f) << 16 | (unsigned int)((sinf(t * 0.444f + 0.854f) / 2.0f + 0.5f) * 255.0f) << 8 | (unsigned int)((sinf(t * 0.117f + 1.337f) / 2.0f + 0.5f) * 255.0f) << 0; drawString("Hello World from pspdev", 0, 224, c, 0); sceGuFinish(); sceGuSync(0, 0); sceDisplayWaitVblankStart(); sceGuSwapBuffers(); } sceGuDisplay(GU_FALSE); sceGuTerm(); flipScreen(); sceDisplayWaitVblankStart(); return 0; }
-
08-11-2009, 08:32 AM #9928Developer and Tutor.
- Registriert seit
- Jul 2007
- Ort
- Widnes, England
- Beiträge
- 1.649
- Points
- 8.736
- Level
- 62
- My Mood
-
- Downloads
- 0
- Uploads
- 0
search about oslib
------ FaT3oYCG -----
AKA Craig, call me what you want to It's your preference.
My Website: http://www.modern-gamer.co.uk/
Currently working on:
(0) MediaGrab
(0) PGE Gears Of War - On hold (Very large project).
(0) PS???? -On Hold A tactical 2d side scrolling game involving AI and online multiplayer features. - Tile engine nearley finished (1 bug to fix).
-
08-11-2009, 09:25 AM #9929QJ Gamer Silver

- Registriert seit
- Jun 2006
- Ort
- UK
- Beiträge
- 2.326
- Points
- 10.263
- Level
- 67
- Downloads
- 0
- Uploads
- 0
[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]
-
08-12-2009, 02:45 AM #9930Developer
- Registriert seit
- May 2009
- Ort
- RetroEmu
- Beiträge
- 116
- Points
- 8.125
- Level
- 60
- My Mood
-
- Downloads
- 0
- Uploads
- 0


LinkBack URL
About LinkBacks
Mit Zitat antworten
and thanks




Hello everyone I am new here and I am glad to be part of this amazing community and I think there...
New to forum