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; Sry, pspflashsystem. I cannot help you on that. For I have my own question: Ok, I downloaded Super Patrick II ...
-
04-24-2008, 11:04 AM #8461QJ Gamer Bronze
- Registriert seit
- Jul 2006
- Beiträge
- 12
- Points
- 3.830
- Level
- 39
- My Mood
-
- Downloads
- 0
- Uploads
- 0
...
Sry, pspflashsystem. I cannot help you on that. For I have my own question:
Ok, I downloaded Super Patrick II from here: http://oslib.palib.info/samples/
I am sorta new but not really to the whole C/C++ Dev thing.
Anyway I have compiled my own C programs using OSLib, under the same settings I'm using now.
This is what I get when I try to compile Super Patrick II:
The above is a C++ program, if that matters.
Zitat von The "Super Patrick II" sample
I now tryed to compile the other samples and here are the results:
The above was a success.
Zitat von The "Sprite sample"
The above says something I don't really understand.
Zitat von The "Maps and sound sample"
The above gave a warning but, did compile.
Zitat von The "OSLib splash screen" sample
Any help would be greatly appreciated.
Thanks for reading this.
Geändert von CT_Bolt (04-24-2008 um 11:24 AM Uhr)
-
04-24-2008, 11:28 AM #8462QJ Gamer Silver

- Registriert seit
- Jun 2006
- Ort
- UK
- Beiträge
- 2.326
- Points
- 10.263
- Level
- 67
- Downloads
- 0
- Uploads
- 0
Super Patrick II: Missing a library / libraries in the wrong order.
Maps and sound sample: I have to look at the source for the answer, I am guessing bad alignment or cast?
OSLib splash screen: Need to the see the warning and the code that it is referring to.
The code for OSLib and the samples are not great and have some seriously bad coding practises that would work in C(?) but not in C++. For the PC port I had to fix a lot of the headers to get it to even compile which was a pain.[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]
-
04-24-2008, 04:42 PM #8463QJ Gamer Bronze
- Registriert seit
- Jul 2006
- Beiträge
- 12
- Points
- 3.830
- Level
- 39
- My Mood
-
- Downloads
- 0
- Uploads
- 0
ok
Oh ok... so OSLib is not that great for coding.
Could you show me some good places & examples on how to start coding a 2D Game from scratch with out using OSLib? Coding in C.
Like how to use graphics(*.png), sounds(*.wav), & music(*.mp3).
Thanks for the reply.
PS. How would I fix the order of the libraries or update them?
I currently am using a single pspdev folder with the sdk inside (C:/pspdev/psp/sdk).Geändert von CT_Bolt (04-24-2008 um 04:54 PM Uhr)
-
04-25-2008, 12:10 AM #8464Developer

- Registriert seit
- Mar 2006
- Beiträge
- 1.026
- Points
- 7.577
- Level
- 58
- Downloads
- 0
- Uploads
- 0
Super Patrick II: Update your SDK, you're missing libpspaudiocodec and newer updates to libpsputility.
Maps and sound sample: Change the -G4 in your CFLAGS line in the makefile to -G0.
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
-
04-25-2008, 02:50 AM #8465QJ Gamer Silver

- Registriert seit
- Jun 2006
- Ort
- UK
- Beiträge
- 2.326
- Points
- 10.263
- Level
- 67
- Downloads
- 0
- Uploads
- 0
It isn't bad, I have seen much worse APIs/libraries that you can use. Just be wary that it is heavily C based.
Zitat von CT_Bolt
[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]
-
04-25-2008, 10:15 AM #8466QJ Gamer Bronze
- Registriert seit
- Jul 2006
- Beiträge
- 12
- Points
- 3.830
- Level
- 39
- My Mood
-
- Downloads
- 0
- Uploads
- 0
Ok...
Thank you both for replying. I'll try to figure out how to update it.
Oh I C so it's mostly for C, that's great for me. Cuz that's what I use (for psp, I do C++ on the PC.).
You guy's(yaustar, Insert_Witty_Name) rule!
Edit:
I tryed to compile Maps & Sound Sample after changing G4 to G0 and...
Zitat von Maps & Sound sample
Geändert von CT_Bolt (04-25-2008 um 10:27 AM Uhr)
-
04-25-2008, 04:18 PM #8467QJ Gamer Silver

- Registriert seit
- May 2006
- Ort
- Behind you.
- Beiträge
- 1.814
- Points
- 10.921
- Level
- 69
- Downloads
- 0
- Uploads
- 0
Yes...it is heavily C based, but not everyone codes in C++...don't make assumptions now.
Zitat von yaustar
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...)
-
04-25-2008, 04:52 PM #8468lol

- Registriert seit
- Aug 2006
- Ort
- Whittier, CA
- Beiträge
- 5.791
- Points
- 20.859
- Level
- 91
- Downloads
- 0
- Uploads
- 0
He wasn't.
Zitat von SuperBatXS
-
04-25-2008, 04:57 PM #8469words 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
Hypocrite?
Zitat von SuperBatXS

...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
-
04-25-2008, 07:47 PM #8470QJ Gamer Bronze
- Registriert seit
- Jul 2006
- Beiträge
- 12
- Points
- 3.830
- Level
- 39
- My Mood
-
- Downloads
- 0
- Uploads
- 0
...
Hahaha yeah... he kinda was being a hypocrite.
Anyway... c'mon people plz tell me how to update my sdk. An easy way perferably.
Again heres a lil' info on the way I code:
I'm using a single pspdev folder with the sdk inside (C:/pspdev/psp/sdk).
-
04-26-2008, 09:03 AM #8471
uninstall it and install this newer version
Zitat von CT_Bolt
http://sourceforge.net/project/showf...roup_id=223830
-
04-26-2008, 12:00 PM #8472QJ Gamer Bronze
- Registriert seit
- Jul 2006
- Beiträge
- 12
- Points
- 3.830
- Level
- 39
- My Mood
-
- Downloads
- 0
- Uploads
- 0
Thanx.
Hey, thank you brethren. I will try this. Let'cha know how it goes when it's done. Again many thanks for replying. :Punk:
-
04-27-2008, 08:32 AM #8473QJ Gamer Gold

- Registriert seit
- Jul 2005
- Ort
- everywhere
- Beiträge
- 3.526
- Points
- 17.453
- Level
- 84
- Downloads
- 1
- Uploads
- 0
hey everone got a question with the oslib, i'm trying to load in mp3's and i'm following the Super Patrick II sample, and i've even attempted to compile the sample and it gives me back the same error:
Code:/usr/local/pspdev/psp/sdk/lib/libosl.a(media.o): In function `oslLoadSoundFileAT 3': audio/media.c:285: undefined reference to `sceAudiocodecCheckNeedMem' audio/media.c:258: undefined reference to `sceAudiocodecCheckNeedMem' /usr/local/pspdev/psp/sdk/lib/libosl.a(media.o): In function `osl_mp3Load': audio/media.c:149: undefined reference to `sceAudiocodecCheckNeedMem' collect2: ld returned 1 exit status
Spoiler for full output:
am i forgetting a library in the makefile? or.....?Geändert von slicer4ever (04-27-2008 um 08:56 AM Uhr)
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
-
04-27-2008, 10:49 AM #8474QJ Gamer Bronze
- Registriert seit
- Jul 2006
- Beiträge
- 12
- Points
- 3.830
- Level
- 39
- My Mood
-
- Downloads
- 0
- Uploads
- 0
lol...
lol, look at the few posts above, from the time I started to post. :ROFL:
I almost had the same exact question.
Start here:
http://forums.qj.net/f-psp-developme...4/page847.html
-
04-27-2008, 10:52 AM #8475QJ Gamer Gold

- Registriert seit
- Jul 2005
- Ort
- everywhere
- Beiträge
- 3.526
- Points
- 17.453
- Level
- 84
- Downloads
- 1
- Uploads
- 0
yes well i figured it out, just had to update my sdk...thanks insertwittyname=-)
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
-
04-27-2008, 01:31 PM #8476QJ Gamer Bronze
- Registriert seit
- Jul 2006
- Beiträge
- 12
- Points
- 3.830
- Level
- 39
- My Mood
-
- Downloads
- 0
- Uploads
- 0
Thank you all!
YAY! I got it working. Thank's to everyone who helped. Especially brethren for the linkage. You are all so great.
:Punk:
-
04-29-2008, 07:45 AM #8477
no problem, just make sure you periodically check for updates to keep your sdk up to date;)
Zitat von CT_Bolt
btw the latest version 0.7.3 released yesterday:)
-
04-29-2008, 01:19 PM #8478QJ Gamer Bronze
- Registriert seit
- Jul 2006
- Beiträge
- 12
- Points
- 3.830
- Level
- 39
- My Mood
-
- Downloads
- 0
- Uploads
- 0
ok.
Oh, ok I will keep that in mind. Thanks again.
-
05-01-2008, 02:13 PM #8479QJ Gamer Gold

- Registriert seit
- Jul 2005
- Ort
- everywhere
- Beiträge
- 3.526
- Points
- 17.453
- Level
- 84
- Downloads
- 1
- Uploads
- 0
quick question ppl=-) and i hope sg57 well respond as he's the one that gave me the idea:
anyway sg57 told me that in order to get 3.xx kernel to work i need to start in user mode and than create a thread that is in kernel mode, load w/e i need from kernel mode than go back to user and i thought the following would work:
anyways this doesn't rly crash my psp, it just kinda stays on, doesn't shut down, but i have to do a full shutdown in order to get off or pull out the batteryCode:int KernelMode(void){ sceIoChdir(startpath); //unsure if this is needed i'm not to familar with creating threads but it was needed when going from kernel->user mode oslInitAudioME(OSL_FMT_ALL); return 0; } int main(int argc, char**argv){ sceIoGetThreadCwd(sceKernelGetThreadId(), startpath, sizeof(startpath)); //thus far i've followed exaclty as if creating a user thread but instead set the thread arguments to 0 for kernel SceUID thid = sceKernelCreateThread("Kernel Mode Thread", (int (*)(SceSize, void*))KernelMode, 0x12, 256 * 1024, 0, NULL); sceKernelStartThread(thid, 0, 0); sceKernelWaitThreadEnd(thid, NULL); //user code return 0; }
any help would be much appreciated1. 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
-
05-01-2008, 09:00 PM #8480words 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
slicer - Threads aren't automatically ended when the pointer to the function they are passed returns, I believe it runs the function again starting at hte top of hte scope (not 100% on that but fairly certain, it'd explain your problem with it hanging (trying to init ME more then once))
Also, i dont know if you're supposed to end the ME-init thread, but I'm pretty sure oslib's init me function just loads modules and whatnot required,after that it can be used whenever so it should be ok, if not then we'll find a way around it :) (gonna have to myself a little later)Geändert von SG57 (05-01-2008 um 09:14 PM Uhr)

...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-02-2008, 01:40 AM #8481Developer

- Registriert seit
- Mar 2006
- Beiträge
- 1.026
- Points
- 7.577
- Level
- 58
- Downloads
- 0
- Uploads
- 0
It's not possible to launch a kernel mode thread from user-mode.
What do you need the kernel mode thread for exactly?
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
-
05-02-2008, 05:02 PM #8482words 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
To load some modules (atleast assuming that's what OSlib's ME initialization is doing).
As of now, starting in kernel mode, initializing the ME then starting a user mode thread to be the app/game/w.e.
...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-03-2008, 01:55 AM #8483Developer

- Registriert seit
- Mar 2006
- Beiträge
- 1.026
- Points
- 7.577
- Level
- 58
- Downloads
- 0
- Uploads
- 0
If you have the source to oslib then patch out the un-needed kernel mode module loading and use the user-mode sceUtilityAvLoadModule().

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
-
05-03-2008, 11:12 AM #8484words 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
Is the kernel mode you're running in affect the firmware version returned by getDevKitVersion?Code:SceUID LoadStartAudioModule(char *modname, int partition){ SceKernelLMOption option; SceUID modid; memset(&option, 0, sizeof(option)); option.size = sizeof(option); option.mpidtext = partition; option.mpiddata = partition; option.position = 0; option.access = 1; modid = sceKernelLoadModule(modname, 0, &option); if (modid < 0) return modid; return sceKernelStartModule(modid, 0, NULL, NULL, NULL); } ... if (sceKernelDevkitVersion() == 0x01050001) { LoadStartAudioModule("flash0:/kd/me_for_vsh.prx", PSP_MEMORY_PARTITION_KERNEL); LoadStartAudioModule("flash0:/kd/audiocodec.prx", PSP_MEMORY_PARTITION_KERNEL); } else { sceUtilityLoadAvModule(PSP_AV_MODULE_AVCODEC); }
...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-03-2008, 12:54 PM #8485Developer

- Registriert seit
- Mar 2006
- Beiträge
- 1.026
- Points
- 7.577
- Level
- 58
- Downloads
- 0
- Uploads
- 0
Of course.
If you're running under 1.5 under custom firmware, it will return 0x01050001.
I would remove all the 1.5 support from OSLib if I were you. 1.5 kernel programming is dead, the sooner everyone moves onto 3xx kernel programming the better.
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
-
05-03-2008, 01:16 PM #8486words 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
lol I love you IWN ;) I take it you're an anti-3.51 oe-user (or w/e firmware it was that was that doesn't have 3.xx kernel)
I'll give that a try, but hey do you have a link to all the user mode equivalent kernel mode functions? Or should I just drop by IRC and question you if anything pops up?
...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-03-2008, 01:54 PM #8487Developer

- Registriert seit
- Mar 2006
- Beiträge
- 1.026
- Points
- 7.577
- Level
- 58
- Downloads
- 0
- Uploads
- 0
Drop by IRC mate, I should be around for a bit tonight.
Most of the kernel level calls are pretty easy to spot once you know what you're looking for.
I'm not anti 1.5 either. I programmed under that kernel for a long time.
The only reason I advocate moving to 3xx is because it works on both slim/fat and doesn't require any add-on installs or anything like that.
Along with that I can see it will only be a matter of time before there is no 1.5 kernel subset. The 1.5 kernel that comes with custom firmware is just that, a subset. It doesn't contain all needed modules for 100% 1.5 kernel compatibility. For instance the dialogs don't work under the 1.5 subset on custom firmware as the VSH modules aren't included, which the dialogs rely on.
Finally, 3xx kernel gives you a lot of user mode functions that allow you to do things that would require kernel mode on 1.5, such as module loading etc.
Everyone should move to 3xx, Jesus would want you to ;)
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
-
05-03-2008, 02:09 PM #8488QJ Gamer Bronze
- Registriert seit
- Jul 2006
- Beiträge
- 12
- Points
- 3.830
- Level
- 39
- My Mood
-
- Downloads
- 0
- Uploads
- 0
I was just wondering if there is a good up to date OSLib that doesn't use 1.5 support, like it would use other ways of getting the job done.
Zitat von Insert_Witty_Name
If there is could someone give a link to it. If there isn't, and someone knows how to do it that would be great too. Cuz I know I sure don't know how.
Truer words were never spoken. :)
Zitat von Insert_Witty_Name
.___________.
|1.50 ... 3.xx |
|:flame:|
|___________|
-
05-03-2008, 03:34 PM #8489QJ Gamer Gold

- Registriert seit
- Jul 2005
- Ort
- everywhere
- Beiträge
- 3.526
- Points
- 17.453
- Level
- 84
- Downloads
- 1
- Uploads
- 0
woo back=-)
also IWN, thanks for the knowledge that you can't do it in reverse order of thread creation, anyways sg57 just told me that the ME init, can be ran from user mode on 3xx fw, so i'll simple release 2 vers, 1 with 1.5 support and 1 with 3xx support, even if 1.5 kernel is dead the few rare users won't miss out
however i would love to learn more about sceUtilityLoadAvModule and such commands for future refrence but i can't find them anywhere in the sdk documentation, i've checked several times but if anyone could point me to an actual page on the doc that'd be awsomeGeändert von slicer4ever (05-03-2008 um 04:05 PM Uhr)
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
-
05-03-2008, 11:14 PM #8490words 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
slicer - I told IWN that i'd just drop by IRC later tonight when ever i run into a kernel function and I don't already know the usermode equivalent, you should consider the same if you need to know them and can't find them whilst googling.
IWN - Now don't be bringing religion into any of this ;)
EDIT
Wow, it would seem Brunni did a sorta pspsdk-stdlib emulator lol. He made stdlib equivalent functions for sceIo, sceKernelDcacheXXXX, etc. etc. He also made it user mode compatible already, it would seem starting in kernel mode under 1.5 is pointless when working with oslib. Just start up in user mode and set your attributes and you're golden :)
And ya IWN, when i run my game under 1.5, it crashes when trying to load the browser :O I wonder what would happen if i tried to run Bugz under 1.5... Hey do you think it's possible to include the modules with the game? lol I bet there is a huge tree of them required for it to run (and some hex editing of addresses to them) might as well include a subset of the firmware :P)Geändert von SG57 (05-04-2008 um 12:24 AM Uhr)

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


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