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; Maybe by the library for handling png files. I was testing it with a custom background that somebody made for ...
-
05-12-2006, 08:09 PM #241Bush Programmer

- Registriert seit
- Nov 2005
- Beiträge
- 3.658
- Points
- 60.149
- Level
- 100
- Downloads
- 0
- Uploads
- 0
Maybe by the library for handling png files.
I was testing it with a custom background that somebody made for my last program.
http://tn3-2.deviantart.com/fs10/300...by_innercy.png
that's about as complicated as a 480x272 png file can get.
There isn't a hardware limitation that prevents the file from working because it can be
used as an icon background.
maybe it's the png.h library...
Geändert von Art (05-12-2006 um 08:11 PM Uhr)
-
05-19-2006, 06:25 AM #242QJ Gamer Green
- Registriert seit
- Aug 2005
- Ort
- Indiana
- Beiträge
- 389
- Points
- 6.450
- Level
- 52
- Downloads
- 0
- Uploads
- 0
I believe when I was testing the PNG limitations I was able to load a PNG into memory about 2x the size of the screen and then scroll it around. But any bigger than that would crash. Plus, if you use libpng and try to draw off the viewable area it will crash. So you have to use it to only draw the part of the image that is currently viewable on the 480x272 you have in front of you.
Don't know if that helps you at all, but it may.
To find out what pspgu.h does, just open it and read it =)
unix command:
will open it in an editor where it is on my system. But to the best of my knowledge, pspgu is a "graphic utility" library enabling you to do various graphics techniques on the PSP hardware.Code:nano -w /usr/local/pspdev/psp/sdk/include/pspgu.h
Happy Coding![URL=http://www.framerate.info/psp][IMG]http://www.framerate.info/_hosted/imageupload/signature.gif[/IMG][/URL]
-
05-19-2006, 06:32 AM #243words 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
yay... rotation is in there also, its just the whole GU library functionality is a little weird like how you have to intiate it, use all those special arguments, etc.

...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
-
05-20-2006, 01:28 AM #244Developer

- Registriert seit
- Mar 2006
- Ort
- Isle of Wight
- Beiträge
- 491
- Points
- 12.360
- Level
- 72
- Downloads
- 0
- Uploads
- 0
Ok guys,
Im trying to compile my code, and Cygwin tells me this:
Heres my makefile:Code:make: *** No rule to make target 'graphics.o', needed by 'Question.elf'. Stop.
Any help is appreciated.Code:TARGET = Question OBJS = main.o graphics.o framebuffer.o callback.o CFLAGS = -O2 -G0 -Wall CXXFLAGS = $(CFLAGS) -fno-exceptions -fno-rtti ASFLAGS = $(CFLAGS) LIBDIR = LIBS = -lpspgu -lpsppower -lpng -lz -lm LDFLAGS = EXTRA_TARGETS = EBOOT.PBP PSP_EBOOT_TITLE = Question PSPSDK=$(shell psp-config --pspsdk-path) include $(PSPSDK)/lib/build.mak
-
05-20-2006, 01:45 AM #245Developer

- Registriert seit
- Oct 2005
- Beiträge
- 408
- Points
- 7.058
- Level
- 55
- Downloads
- 0
- Uploads
- 0
Put graphics.c in your project folder. Make sure graphics.h, framebuffer.c and framebuffer.h are in there while you're at it.
-
05-20-2006, 01:51 AM #246Developer

- Registriert seit
- Mar 2006
- Ort
- Isle of Wight
- Beiträge
- 491
- Points
- 12.360
- Level
- 72
- Downloads
- 0
- Uploads
- 0
Cheers! It works
-
05-20-2006, 01:58 AM #247Developer

- Registriert seit
- Mar 2006
- Ort
- Isle of Wight
- Beiträge
- 491
- Points
- 12.360
- Level
- 72
- Downloads
- 0
- Uploads
- 0
Ok sorry for the double post, I have this code:
It compiles fine, but when I press start, it doesnt exit the program.Code:if(paddata.Buttons & PSP_CTRL_START) { break; }
-
05-20-2006, 07:02 AM #248Developer

- Registriert seit
- Oct 2005
- Beiträge
- 408
- Points
- 7.058
- Level
- 55
- Downloads
- 0
- Uploads
- 0
That isn't enough information. The break will exit the current for or while loop but without seeing more code I can't tell you where this will put you.
-
05-20-2006, 07:18 AM #249Developer

- Registriert seit
- Mar 2006
- Ort
- Isle of Wight
- Beiträge
- 491
- Points
- 12.360
- Level
- 72
- Downloads
- 0
- Uploads
- 0
Code://Question /* Question game? Created by kozine */ #include <pspdebug.h> #include <pspkernel.h> #include <pspctrl.h> #include <pspdisplay.h> #include <stdio.h> #include "callback.c" #include "graphics.h" PSP_MODULE_INFO("PSP Question", 0, 1, 1); //Define pspDebugScreenPrintf to printf #define printf pspDebugScreenPrintf #define RGB(r, g, b) ((r)|((g)<<8)|((b)<<16)) int main() { //Set controller variable SceCtrlData paddata; pspDebugScreenInit(); SetupCallbacks(); initGraphics(); Color red = RGB(255, 0, 0); Color blue = RGB(0, 0, 255); for(;;) { //Read control input sceCtrlReadBufferPositive(&paddata, 1); printTextScreen(10, 20, "Hey F34R! How old am I?", red); printTextScreen(10, 50, "Cross: 10", blue); printTextScreen(10, 60, "Circle: 20", blue); printTextScreen(10, 70, "Triangle: 13", blue); printTextScreen(10, 80, "Square: 16", blue); printTextScreen(10, 200, "Press the button responding to your answer", red); printTextScreen(10, 210, "and see if you are wrong or right!", red); flipScreen(); if(paddata.Buttons & PSP_CTRL_CROSS) { printTextScreen(10, 125, "Wrong! The answer is 13! Press R to exit!", red); } if(paddata.Buttons & PSP_CTRL_CIRCLE) { printTextScreen(10, 125, "Wrong! The answer is 13! Press R to exit!", red); } if(paddata.Buttons & PSP_CTRL_TRIANGLE) { printTextScreen(10, 125, "Correct! Well done, you know my age! Press R to exit", red); } if(paddata.Buttons & PSP_CTRL_SQUARE) { printTextScreen(10, 125, "Wrong! The answer is 13! Press R to exit!", red); } if(paddata.Buttons & PSP_CTRL_START) { break; } } sceKernelSleepThread(); return 0; }
-
05-20-2006, 07:26 AM #250Developer

- Registriert seit
- Oct 2005
- Beiträge
- 408
- Points
- 7.058
- Level
- 55
- Downloads
- 0
- Uploads
- 0
Try replacing sceKernelSleepThread() with sceKernelExitGame().
-
05-20-2006, 07:38 AM #251Developer

- Registriert seit
- Mar 2006
- Ort
- Isle of Wight
- Beiträge
- 491
- Points
- 12.360
- Level
- 72
- Downloads
- 0
- Uploads
- 0
still doesnt work :S Its weird.
-
05-20-2006, 08:25 AM #252Developer

- Registriert seit
- Oct 2005
- Beiträge
- 408
- Points
- 7.058
- Level
- 55
- Downloads
- 0
- Uploads
- 0
Do the other buttons work? I don't see any obvious problems that would prevent it from finishing, but you might try replacing the for(;;) with a while(1). It shouldn't make a difference as far as I know.
-
05-20-2006, 08:28 AM #253Developer

- Registriert seit
- Mar 2006
- Ort
- Isle of Wight
- Beiträge
- 491
- Points
- 12.360
- Level
- 72
- Downloads
- 0
- Uploads
- 0
Yea all the other buttons work fine.
-
05-20-2006, 08:48 AM #254Developer

- Registriert seit
- Oct 2005
- Beiträge
- 408
- Points
- 7.058
- Level
- 55
- Downloads
- 0
- Uploads
- 0
It works fine on my 1.5 when I used sceKernelExitGame(). What firmware are you trying this on?
-
05-20-2006, 09:03 AM #255Developer

- Registriert seit
- Mar 2006
- Ort
- Isle of Wight
- Beiträge
- 491
- Points
- 12.360
- Level
- 72
- Downloads
- 0
- Uploads
- 0
Im running 2.6 firmware.
-
05-20-2006, 09:04 AM #256TheMarioKartersGuest
That's why it won't work on 2.6
Zitat von Samstag
-
05-20-2006, 10:08 AM #257words 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
Also, just thought id add... if you plan on making a question game...its best to have either an array of questions that u can keep track of better and have it easier tell whether they guessed right or wrong (via a bool ex: if Q3guess != answer3 then WRONG! } else { CORRECT } )
Ask around for how to exit out of a 2.6 type program... but why would the KernelSleepThread work while the KernelExitGame wouldnt... unless it didnt work and just returned to nothing...
...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
-
05-20-2006, 10:39 AM #258Developer

- Registriert seit
- Mar 2006
- Ort
- Isle of Wight
- Beiträge
- 491
- Points
- 12.360
- Level
- 72
- Downloads
- 0
- Uploads
- 0
Thanks for the info

Its not a question game its just a mate told me to do it to proove I know at least some C. lol.
-
05-20-2006, 11:31 AM #259Developer

- Registriert seit
- Oct 2005
- Beiträge
- 408
- Points
- 7.058
- Level
- 55
- Downloads
- 0
- Uploads
- 0
Stick to Lua. Thats not a function that requires kernel access.
Zitat von TheMarioKarters
What version of Eloader are you using? The same function worked fine in 2.0 from the Tiff exploit, but I haven't used that since version .08 or so and I haven't kept up with 2.0+ programming. It's possible that you'll need to exit differently under 2.6.
-
05-20-2006, 11:32 AM #260Developer

- Registriert seit
- Mar 2006
- Ort
- Isle of Wight
- Beiträge
- 491
- Points
- 12.360
- Level
- 72
- Downloads
- 0
- Uploads
- 0
Im using the newsest Eload.
-
05-20-2006, 11:47 AM #261Developer

- Registriert seit
- Oct 2005
- Beiträge
- 408
- Points
- 7.058
- Level
- 55
- Downloads
- 0
- Uploads
- 0
Ok sorry I can't find any information about 2.6 requiring a different exit method. Yuo could try using sceKernelExitThread() instead of sceKernelExitGame(). Others you might experiment with:
sceKernelExitDeleteThread ()
_sceKernelExitThread() // note the preceding underscore
Hopefully one of those will work. Or try removing that line entirely and see if that changes anything.
-
05-20-2006, 03:56 PM #262words 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
yes... try just 'breaking' the loop, then returning 0 of the main porgram... it should quit on its own...

...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
-
05-22-2006, 06:43 PM #263words 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
Hey... I need a favor for someone to throw together for im busy... I need a basic I/O FileBrowser... I could make one with enough time... but this application im making takes a tad long... This app will make those LUA users who want to hide there LUA Scripts very easy... I am putting Danzeffs OSK in right now... I still have some bugs to work out, that is why im asking for a very very basic I/O Debug Text Filebrowser... Simple /\ = back, X = Execute (action) I will do the rest after that... So basically im asking for a function that will print out a Filebrowser via a function.. that way i wont have to copy and pate the whole thing into my code... just call teh function...
Thx and as i said... i could do it, and itd be good for me info wise, but im working on getting all the bugs worked out of this first, and if i could get the Filebrowser (basic I/O debug printing) id be very happy and get this LUA coders dream out there...
Please someone take the time to through this together fori have not the time... Atleast not enough to finish my app up quickly and this...
Thx a ton and ill add u to the credits... And ill fill u in on the info about the app via PM... ill even let you see the source if you wish...
Thx a ton u guyz (community)
...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
-
05-22-2006, 06:44 PM #264QJ Gamer Green
- Registriert seit
- Jan 2006
- Beiträge
- 4.289
- Points
- 25.223
- Level
- 95
- Downloads
- 0
- Uploads
- 0
Search these forums for 'stripped file browser' or if that doesn't work 'stripped filebrowser' it should be a thread in the development forum, with no replies, although I downloaded what that guy posted.
QJ loads way 2 slow & the theme is ugly as hell, gone are the glory days
-
05-22-2006, 07:33 PM #265words 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
I know I serached but he took his download down =(
Do you have it Soccer? If you do I'll be very happy =)
P.S. Soccer, want to try it out after im done? So far so good... I have basic input for the filename via 'Enter the Filename Path' and if its in the smae directory then you enter the name... if not then you enter ms0:/ and junk =(
...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
-
05-25-2006, 09:23 AM #266
can some one tell me the best way to start programming in c/c++ language
-
05-25-2006, 09:45 AM #267Developer

- Registriert seit
- Mar 2006
- Ort
- Isle of Wight
- Beiträge
- 491
- Points
- 12.360
- Level
- 72
- Downloads
- 0
- Uploads
- 0
I suggest going to www.psp-programming.com and going to the tuts section. Its where I am learning it from and its a great help
-
05-26-2006, 04:29 AM #268QJ Gamer Green
- Registriert seit
- Aug 2005
- Ort
- Indiana
- Beiträge
- 389
- Points
- 6.450
- Level
- 52
- Downloads
- 0
- Uploads
- 0
A good way to quit a game in any version is inside your controller function, call quit();.
then write a quit(); function that does what you need.. it's easier to keep track of things, At least for me...[URL=http://www.framerate.info/psp][IMG]http://www.framerate.info/_hosted/imageupload/signature.gif[/IMG][/URL]
-
05-26-2006, 06:18 AM #269
thanks the tutorials are great
-
05-30-2006, 12:10 PM #270Developer

- Registriert seit
- Sep 2005
- Ort
- Sweden
- Beiträge
- 941
- Points
- 10.075
- Level
- 67
- Downloads
- 0
- Uploads
- 0
Is there a way to cut images in the "graphics.h library" (or whatever you should call it...). Cause that would make things easier when you animate stuff ( then you could have just 1 image that you could split instead of haveing 6 separate images).
Thanks in advance!


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