QJ.NET | Videos | Forums | iPhone | MMORPG | Nintendo DS | Wii | PlayStation 3 | PSP | Xbox 360 | PC | Downloads | Contact Us
Forums | Gaming News | Videos | Downloads | Today's Posts | Mark Forums Read | Chat | FAQ | Members List | Contact

QJ.net Game Discussion - PSP, Xbox, Wii, PS3, PSP Homebrew, and PSP Guides

Go Back   QJ.net Game Discussion - PSP, Xbox, Wii, PS3, PSP Homebrew, and PSP Guides > Developers Corner > PSP Development, Hacks, and Homebrew > PSP Development Forum
The above video goes away if you are a member and logged in, so log in now!

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 ...

Reply
 
LinkBack Thread Tools
Old 05-12-2006, 09:09 PM   #241
Art

Bush Programmer
 
Art's Avatar
 
Join Date: Nov 2005
Posts: 3,557
Trader Feedback: 0
Default

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...

Last edited by Art; 05-12-2006 at 09:11 PM..
Art is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old 05-19-2006, 07:25 AM   #242
 
framerate's Avatar
 
Join Date: Aug 2005
Location: Indiana
Posts: 389
Trader Feedback: 0
Default

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:

Code:
nano -w  /usr/local/pspdev/psp/sdk/include/pspgu.h
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.

Happy Coding!
__________________
[URL=http://www.framerate.info/psp][IMG]http://www.framerate.info/_hosted/imageupload/signature.gif[/IMG][/URL]
framerate is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old 05-19-2006, 07:32 AM   #243

...in a dream...
 
SG57's Avatar
 
Join Date: Jul 2005
Posts: 4,957
Trader Feedback: 0
Default

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.
__________________
SG57 is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old 05-20-2006, 02:28 AM   #244

Developer
 
kozine's Avatar
 
Join Date: Mar 2006
Location: Isle of Wight
Posts: 491
Trader Feedback: 0
Default

Ok guys,
Im trying to compile my code, and Cygwin tells me this:

Code:
make: *** No rule to make target 'graphics.o', needed by 'Question.elf'. Stop.
Heres my makefile:

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
Any help is appreciated.
__________________


PM me for a sig like this!

http://dspspforums.com/forums/index.php SIGN UP NOW!
kozine is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old 05-20-2006, 02:45 AM   #245

Developer
 
Join Date: Oct 2005
Posts: 408
Trader Feedback: 0
Default

Put graphics.c in your project folder. Make sure graphics.h, framebuffer.c and framebuffer.h are in there while you're at it.
Samstag is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old 05-20-2006, 02:51 AM   #246

Developer
 
kozine's Avatar
 
Join Date: Mar 2006
Location: Isle of Wight
Posts: 491
Trader Feedback: 0
Default

Cheers! It works
__________________


PM me for a sig like this!

http://dspspforums.com/forums/index.php SIGN UP NOW!
kozine is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old 05-20-2006, 02:58 AM   #247

Developer
 
kozine's Avatar
 
Join Date: Mar 2006
Location: Isle of Wight
Posts: 491
Trader Feedback: 0
Default

Ok sorry for the double post, I have this code:

Code:
if(paddata.Buttons & PSP_CTRL_START) {
break;
}
It compiles fine, but when I press start, it doesnt exit the program.
__________________


PM me for a sig like this!

http://dspspforums.com/forums/index.php SIGN UP NOW!
kozine is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old 05-20-2006, 08:02 AM   #248

Developer
 
Join Date: Oct 2005
Posts: 408
Trader Feedback: 0
Default

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.
Samstag is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old 05-20-2006, 08:18 AM   #249

Developer
 
kozine's Avatar
 
Join Date: Mar 2006
Location: Isle of Wight
Posts: 491
Trader Feedback: 0
Default

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;
}
__________________


PM me for a sig like this!

http://dspspforums.com/forums/index.php SIGN UP NOW!
kozine is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old 05-20-2006, 08:26 AM   #250

Developer
 
Join Date: Oct 2005
Posts: 408
Trader Feedback: 0
Default

Try replacing sceKernelSleepThread() with sceKernelExitGame().
Samstag is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old 05-20-2006, 08:38 AM   #251

Developer
 
kozine's Avatar
 
Join Date: Mar 2006
Location: Isle of Wight
Posts: 491
Trader Feedback: 0
Default

still doesnt work :S Its weird.
__________________


PM me for a sig like this!

http://dspspforums.com/forums/index.php SIGN UP NOW!
kozine is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old 05-20-2006, 09:25 AM   #252

Developer
 
Join Date: Oct 2005
Posts: 408
Trader Feedback: 0
Default

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.
Samstag is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old 05-20-2006, 09:28 AM   #253

Developer
 
kozine's Avatar
 
Join Date: Mar 2006
Location: Isle of Wight
Posts: 491
Trader Feedback: 0
Default

Yea all the other buttons work fine.
__________________


PM me for a sig like this!

http://dspspforums.com/forums/index.php SIGN UP NOW!
kozine is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old 05-20-2006, 09:48 AM   #254

Developer
 
Join Date: Oct 2005
Posts: 408
Trader Feedback: 0
Default

It works fine on my 1.5 when I used sceKernelExitGame(). What firmware are you trying this on?
Samstag is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old 05-20-2006, 10:03 AM   #255

Developer
 
kozine's Avatar
 
Join Date: Mar 2006
Location: Isle of Wight
Posts: 491
Trader Feedback: 0
Default

Im running 2.6 firmware.
__________________


PM me for a sig like this!

http://dspspforums.com/forums/index.php SIGN UP NOW!
kozine is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old 05-20-2006, 10:04 AM   #256
TheMarioKarters
Guest
 
Posts: n/a
Default

Quote:
Originally Posted by Samstag
It works fine on my 1.5 when I used sceKernelExitGame(). What firmware are you trying this on?
That's why it won't work on 2.6
 
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old 05-20-2006, 11:08 AM   #257

...in a dream...
 
SG57's Avatar
 
Join Date: Jul 2005
Posts: 4,957
Trader Feedback: 0
Default

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...
__________________
SG57 is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old 05-20-2006, 11:39 AM   #258

Developer
 
kozine's Avatar
 
Join Date: Mar 2006
Location: Isle of Wight
Posts: 491
Trader Feedback: 0
Default

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.
__________________


PM me for a sig like this!

http://dspspforums.com/forums/index.php SIGN UP NOW!
kozine is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old 05-20-2006, 12:31 PM   #259

Developer
 
Join Date: Oct 2005
Posts: 408
Trader Feedback: 0
Default

Quote:
Originally Posted by TheMarioKarters
Quote:
Originally Posted by Samstag
It works fine on my 1.5 when I used sceKernelExitGame(). What firmware are you trying this on?
That's why it won't work on 2.6
Stick to Lua. Thats not a function that requires kernel access.

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.
Samstag is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old 05-20-2006, 12:32 PM   #260

Developer
 
kozine's Avatar
 
Join Date: Mar 2006
Location: Isle of Wight
Posts: 491
Trader Feedback: 0
Default

Im using the newsest Eload.
__________________


PM me for a sig like this!

http://dspspforums.com/forums/index.php SIGN UP NOW!
kozine is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old 05-20-2006, 12:47 PM   #261

Developer
 
Join Date: Oct 2005
Posts: 408
Trader Feedback: 0
Default

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.
Samstag is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old 05-20-2006, 04:56 PM   #262

...in a dream...
 
SG57's Avatar
 
Join Date: Jul 2005
Posts: 4,957
Trader Feedback: 0
Default

yes... try just 'breaking' the loop, then returning 0 of the main porgram... it should quit on its own...
__________________
SG57 is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old 05-22-2006, 07:43 PM   #263

...in a dream...
 
SG57's Avatar
 
Join Date: Jul 2005
Posts: 4,957
Trader Feedback: 0
Default

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)
__________________
SG57 is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old 05-22-2006, 07:44 PM   #264
 
Join Date: Jan 2006
Posts: 4,288
Trader Feedback: 0
Default

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.
__________________
[URL="http://www.newlilwayne.com"]www.NewLilWayne.com[/URL]
soccerPMN is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old 05-22-2006, 08:33 PM   #265

...in a dream...
 
SG57's Avatar
 
Join Date: Jul 2005
Posts: 4,957
Trader Feedback: 0
Default

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 =(
__________________
SG57 is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old 05-25-2006, 10:23 AM   #266
 
airforce20xx's Avatar
 
Join Date: May 2006
Posts: 6
Trader Feedback: 0
Default

can some one tell me the best way to start programming in c/c++ language
airforce20xx is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old 05-25-2006, 10:45 AM   #267

Developer
 
kozine's Avatar
 
Join Date: Mar 2006
Location: Isle of Wight
Posts: 491
Trader Feedback: 0
Default

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
__________________


PM me for a sig like this!

http://dspspforums.com/forums/index.php SIGN UP NOW!
kozine is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old 05-26-2006, 05:29 AM   #268
 
framerate's Avatar
 
Join Date: Aug 2005
Location: Indiana
Posts: 389
Trader Feedback: 0
Default

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]
framerate is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old 05-26-2006, 07:18 AM   #269
 
airforce20xx's Avatar
 
Join Date: May 2006
Posts: 6
Trader Feedback: 0
Thumbs up

thanks the tutorials are great
airforce20xx is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old 05-30-2006, 01:10 PM   #270

Developer
 
SodR's Avatar
 
Join Date: Sep 2005
Location: Sweden
Posts: 941
Trader Feedback: 0
Default

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!
SodR is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply

Tags
c or c , c++ , c/c++ , code , coding , c_language , programming , psp , psp programming , thread

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off



All times are GMT -8. The time now is 05:11 PM.



Use of this Web site constitutes acceptance of the TERMS & CONDITIONS and PRIVACY POLICY
Copyright © 2009, QJ.NET. All Rights Reserved.
Contact Us