Page 1 of 3

Looking for a C++ example of a PSPSDK/MinPSPW program

Posted: Tue Mar 01, 2011 8:48 pm
by TheBeginner
I feel very foolish in asking this, but is there an example C++ program (like a hello world) that compiles using either the PSPSDK or the MinPSPw?

I ask this question because every example I have seen that is used in various tutorials on the web has been based off of C. As a novice C++ only programmer, C code is as confusing as heck. I'm not looking to create the next Wagic or what not. I just want to learn where I can start.

So, is there a tutorial out there that shows an extremely basic C++ program for the PSP, or if not, can anyone help me on my way?

Thank you in advance.

Re: Looking for a C++ example of a PSPSDK/MinPSPW program

Posted: Tue Mar 01, 2011 9:00 pm
by kidz axe
TheBeginner wrote:I feel very foolish in asking this, but is there an example C++ program (like a hello world) that compiles using either the PSPSDK or the MinPSPw?

I ask this question because every example I have seen that is used in various tutorials on the web has been based off of C. As a novice C++ only programmer, C code is as confusing as heck. I'm not looking to create the next Wagic or what not. I just want to learn where I can start.

So, is there a tutorial out there that shows an extremely basic C++ program for the PSP, or if not, can anyone help me on my way?

Thank you in advance.
Ive been pondering about this for a while too, google didn't turn up good results, all on C...

Re: Looking for a C++ example of a PSPSDK/MinPSPW program

Posted: Tue Mar 01, 2011 10:20 pm
by ChaoticXSinZ
There is a tutorial here: http://www.psp-programming.com/tutorials/

Here's some more links:
http://www.psp-programming.com/forums/i ... ments;id=1
http://forums.psp-hacks.com/f141/the-ps ... d-t219475/ This one lists MANY other tutorials.

Also, minpspw is basically the pspsdk. It's just prepackaged and also provides a script to easily compile the pspsdk.

Re: Looking for a C++ example of a PSPSDK/MinPSPW program

Posted: Tue Mar 01, 2011 10:30 pm
by juggernaut6613
You need to Study C language...

I'm like you in a way, I've learned C++ first than C, then I realized that I need C so I scratched C++ and went to C language...

Trust me the concept is just the same but C is more powerful I guess...
m0skit0 even said that C language is also known as a high level assembly language...

If you want to study C then got here:
http://cprogramming.com/

But I think you can use other language as well like C++ and LUA when programming on the psp...

Re: Looking for a C++ example of a PSPSDK/MinPSPW program

Posted: Tue Mar 01, 2011 10:59 pm
by m0skit0
No, C++ is more powerful than C, because it can do everything C does + OOP. That's why it's ++ :mrgreen:

Maybe you should look at Wagic's source code, it's written in C++ IIRC.

Re: Looking for a C++ example of a PSPSDK/MinPSPW program

Posted: Tue Mar 01, 2011 11:56 pm
by juggernaut6613
m0skit0 wrote:No, C++ is more powerful than C, because it can do everything C does + OOP. That's why it's ++ :mrgreen:

Maybe you should look at Wagic's source code, it's written in C++ IIRC.
:lol: hehehe C++ is an enhancement of C... my bad...
But I find C language better for some reason... :oops:
And a lot of programmers always suggests to study C before C++ so I kinda thought of that the other way. :lol:
Thanks for Correcting me m0skit0 :D

Re: Looking for a C++ example of a PSPSDK/MinPSPW program

Posted: Wed Mar 02, 2011 12:07 am
by TheBeginner
I've been looking into the Cprogramming.com site, (thanks juggernaut), and the basics seem pretty similar to C++. I'm picking it up okay, but I just wish I could program in my "native tongue" :P.

So, it seems that the majority of the PSP dev community is using C, so that's going to be my focus over the next couple of weeks. I'm the kind of person who likes a physical copy of my instruction texts (like a textbook of sorts). Since most, if not all, of you are programmers, are there any books on the C language that you would recommend? I don't need a complete beginner book because I understand many topics already, but I'd still like to get the syntax down, and possibly reinforce my knowledge. Any suggestions?

Re: Looking for a C++ example of a PSPSDK/MinPSPW program

Posted: Wed Mar 02, 2011 1:02 am
by juggernaut6613
No worries mate :D

Syntax Reference can be found at the same site I posted which is:
http://www.cprogramming.com/reference/

There are tons of Ebooks from the net... I don't know what's the best but just use google to look for them... :D
Or try asking m0skit0 :)

Have fun Coding mate! :D

Re: Looking for a C++ example of a PSPSDK/MinPSPW program

Posted: Wed Mar 02, 2011 9:11 am
by JJS
I am sorry, but I fail to see how you could write a simple hello world in C++ that would not be a C program with minor corrections.

The usual hello world in C++ just replaces printf("hello world") with cout << "hello world". And this would not even work on the PSP because you would have to first create your own class that can write to the debug screen. A simple #define printf pspDebugScreenPrintf doesn't cut it in that case.

I mean you can get all fancy with classes in the core of your application, but there is really no point for the low level stuff like the home button callback as they have to interface with the firmware functions that are written in C anyway (at the top of my head I cannot really tell if you can have a static member function as the callback or if it has to be a function outside a class, but I think it is the latter).


Side note: Every C++ program has at least one C style function, namely main(). Other OOP languages like Java encapsulate everything in classes while C++ shows its C roots there. Writing this I am wondering if you can have no entry point and instead declare one globally declared object that has a constructor serving as the (pseudo) entry point. I guess if that is possible depends on the underlying runtime system.

Re: Looking for a C++ example of a PSPSDK/MinPSPW program

Posted: Wed Mar 02, 2011 11:11 am
by TheBeginner
JJS wrote:I am sorry, but I fail to see how you could write a simple hello world in C++ that would not be a C program with minor corrections.
I see your point.

juggernaut6613 wrote:Syntax Reference can be found at the same site I posted which is:
http://www.cprogramming.com/reference/
Thanks again for the links and the help.

I guess learning C is not so bad of an idea after all. I still have to "unlearn" my OOP. That's going to be fun. :P