It's not possible to launch a kernel mode thread from user-mode.
What do you need the kernel mode thread for exactly?
Printable View
It's not possible to launch a kernel mode thread from user-mode.
What do you need the kernel mode thread for exactly?
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.
If you have the source to oslib then patch out the un-needed kernel mode module loading and use the user-mode sceUtilityAvLoadModule().
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);
}
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.
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?
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 ;)
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:
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:
Zitat von Insert_Witty_Name
.___________.
|1.50 ... 3.xx |
|:flame:|
|___________|
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 awsome
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)
bleh IWN already took care of the 1.5 starting issue by putting a nice little message saying please start your game under 3xx kernel
anyways sg57 i'm already on IRC ton's you should join us, it's how IWN helped me with getting circle collision working on my Impact game
which i love the method IWN(and i feel stupid for what i had come up with) i can apply it to nearly any basic geometry shape=-)
anywho hope to see you on irc sg=-)
What channel are you on lol im on psp-programming and pspdev pretty regularly.
o i thought you went to irc.malloc.us, or defiance, etc, etc on #exo (redirection of #psp), bleh but IWN told me that you went on freenode and not the servers i cruise so i'll pop on #psp-programming on freenode from now on
I'm fairly new to c programming (in general) and I want to know how you can give a defined variable a value by reading a .txt file (something like the dofile() function in LUA)
example:I need to give a value to a certain variable (F) I've declared in the program by reading a .txt file that has ,for instance, a line that says F = 1
--swizl
fgets your line of text into a buffer. run atoi or strtoul or its friends at the right offset to the number.... strchr/isspace etc are your friends. or get a string library like bstring.Zitat:
Zitat von swizl
its friends? care to explain?Zitat:
Zitat von _df_
ato_i == integer. it has friends for float..
By 'friends', he/she means 'similar functions'.
hey yauster... nice to see familiar people ;) i dont go much anymore to the gp32x forums... are you mostly working on psp stuff now over gp2x? I think pandora will be out of my price range (and I dont quite like its aesthetics)..
Honestly I am waiting on the Pandora, I am just working on some cross platform stuff at the moment and actual work.
I tried using SG57's fading in and out example(that he gave me a few posts ago) with Psilocybeing's graphics.h and here's what i got:
Spoiler for code:
I have 2 questions and 1 problem:
Question: Is there a better way to do this?
Question: Does graphics.h allow Alpha as part of a color?
Problem: I tried running this code as part of a project I'm helping a friend with and when I try running the program my PSP crashes (yes I've checked if the .png's are interlaced or not(like the last time I had a prob like this))
PLZ HELP
EDIT: Sorry for the code formatting for some reason it's not coming in the spoiler the way it's supposed to.
how can i use a custom module_start in a prx. when i compile it, i get the error "multiple definition of `module_start'"
here is my main.c
Code:#include <pspsdk.h>
#include <pspkernel.h>
#include <pspdebug.h>
#define printf pspDebugScreenPrintf
PSP_MODULE_INFO("prx", 0, 1, 0);
int module_start(SceSize args, void *argp)
{
// variable initialization
return 0;
}
int module_stop(SceSize args, void *argp)
{
return 0;
}
Replace "build.mak" with "build_prx.mak" in the Makefile.
Are you sure that's the code i gave you... I wrote mine in OSlib, and tested it, and it appears that in your attempt to convert it to graphics.h you kinda didn't see what was actually happening :P Try again, it's a good learning experience.btw, use code tags ([code])Zitat:
Zitat von bnc9
thanks :)Zitat:
Zitat von Archaemic
arghh.. still refuses to work I know I should have asked this question earlier but SG57:what is really going on in the code you gave me ?!?
lol I don't have the code i gave you stored, can you PM me it? I'll help you that way a little bit more :)
What do Analog stick values range at?
For Lx & Ly
Correct?Code:0 - 128(in centre) - 255
I think 127 is the center.
But yeah, it's unsigned, so that is indeed the range.
Hello, I am new to programming for the PSP and have started my own game but I want to add sound. Using the library in Lesson 06 of the tutorial (libmad, I think it was) made my game slow.
I want to use the player from this sample code. However when I try to compile the code I get
Any help? What causes this?Code:players/pspaudiolib.o: In function `audioOutpuBlocking':
pspaudiolib.c:(.text+0x80): undefined reference to `sceAudio_E0727056'
players/pspaudiolib.o: In function `pspReleaseAudio':
pspaudiolib.c:(.text+0xa0): undefined reference to `sceAudio_5C37C0AE'
players/pspaudiolib.o: In function `setFrequency':
pspaudiolib.c:(.text+0xb0): undefined reference to `sceAudio_38553111'
players/pspaudiolib.o: In function `pspAudioOutBlocking':
pspaudiolib.c:(.text+0xe8): undefined reference to `sceAudio_E0727056'
players/pspaudiolib.o: In function `AudioChannelThread':
pspaudiolib.c:(.text+0x190): undefined reference to `sceAudio_E0727056'
players/pspaudiolib.o: In function `pspAudioSetFrequency':
pspaudiolib.c:(.text+0x2fc): undefined reference to `sceAudio_5C37C0AE'
pspaudiolib.c:(.text+0x30c): undefined reference to `sceAudio_38553111'
players/pspaudiolib.o: In function `pspAudioEnd':
pspaudiolib.c:(.text+0x3f4): undefined reference to `sceAudio_5C37C0AE'
players/pspaudiolib.o: In function `pspAudioInit':
pspaudiolib.c:(.text+0x4f8): undefined reference to `sceAudio_5C37C0AE'
pspaudiolib.c:(.text+0x508): undefined reference to `sceAudio_38553111'
pspaudiolib.c:(.text+0x778): undefined reference to `sceAudio_5C37C0AE'
players/player.o: In function `audioOutput':
player.c:(.text+0x1c4): undefined reference to `sceAudio_E0727056'
players/player.o: In function `releaseAudio':
player.c:(.text+0x1e4): undefined reference to `sceAudio_5C37C0AE'
players/player.o: In function `setAudioFrequency':
player.c:(.text+0x1f4): undefined reference to `sceAudio_38553111'
/usr/local/pspdev/lib/gcc/psp/4.1.0/../../../../psp/lib/libFLAC.a(ogg_decoder_aspect.o): In function `FLAC__ogg_decoder_aspect_read_callback_wrapper':
ogg_decoder_aspect.c:(.text+0x160): undefined reference to `ogg_sync_buffer'
/usr/local/pspdev/lib/gcc/psp/4.1.0/../../../../psp/lib/libFLAC.a(ogg_decoder_aspect.o): In function `FLAC__ogg_decoder_aspect_finish':
ogg_decoder_aspect.c:(.text+0x33c): undefined reference to `ogg_sync_clear'
ogg_decoder_aspect.c:(.text+0x350): undefined reference to `ogg_stream_clear'
/usr/local/pspdev/lib/gcc/psp/4.1.0/../../../../psp/lib/libFLAC.a(ogg_decoder_aspect.o): In function `FLAC__ogg_decoder_aspect_init':
ogg_decoder_aspect.c:(.text+0x36c): undefined reference to `ogg_stream_init'
ogg_decoder_aspect.c:(.text+0x394): undefined reference to `ogg_sync_init'
collect2: ld returned 1 exit status
make: *** [softwareplayers.elf] Error 1
Thanks a lot,
Justin
Install libogg, and also add -lpspaudio to the LIBS line in your makefile.
Hi. I am trying to start coding in c/c++...
I've finally got the toolchain and stuff setup to compile some stuff successfully.
I followed a short tutorial on writing a Hello World and it compiled and ran fine on the psp.
But I wanted to code in the 3.xx kernel instead of getting into the 1.5 kernel. So, I looked up how to do this and found this http://www.ghoti.nl/PSPtutorialm0.php.
I followed all the instructions and compiled fine, but it wont run on the psp. I'm thinking it's because of this...
Won't having functions that deal with kernel not work in 3.xx?Code:int exit_callback(int arg1, int arg2, void *common) {
sceKernelExitGame();
return 0;
}
/* Callback thread */
int CallbackThread(SceSize args, void *argp) {
int cbid;
cbid = sceKernelCreateCallback("Exit Callback", exit_callback, NULL);
sceKernelRegisterExitCallback(cbid);
sceKernelSleepThreadCB();
return 0;
}
/* Sets up the callback thread and returns its thread id */
int SetupCallbacks(void) {
int thid = 0;
thid = sceKernelCreateThread("update_thread", CallbackThread, 0x11, 0xFA0, 0, 0);
if(thid >= 0) {
sceKernelStartThread(thid, 0, 0);
}
return thid;
}
What would I replace these functions with if this is whats causing the crash?
I'm sorry if this is a stupid question. This is my first time messing with c/c++.
I've been messing with lua, and I use to write Java a bunch (not for psp, for pc), but this is a bit different.
My source code is very simple and short, if this isn't the problem you could take a quick look at it.
main.c
Makefile
I appreciate any help.
Thanks!
Those are all usermode functions. They just call on the kernel to do something.
Describe what is happening chrisp, because if you are running that app in 3.xx kernel it should display "Hello World" and do nothing. You can press home and exit though...
Well, basically nothing is happening. I made the changes that it says to in that page, then I compiled it and stuck it in the GAME folder on my psp and it says the game can't be started. Before I changed it at all, it ran fine. I had it in the GAME folder and it still ran.Zitat:
Zitat von SG57
My psp is fat 3.71-4 m33 with 1.5 kernal 2 on 3.71 kernel.
I moved it to the GAME150 folder and it just freezes in the gameboot.
When I made those changes and compiled, it gave me a prx file, so... maybe I might have to put it in with the game too? I don't think it's the problem but I'll try it.
Edit -
No, it didn't fix it. Does this page say to do everything I need to do? Is it leaving anything out?
Thanks for the help guys.
What is the Fastest way to check if a string has an ending "\n", if not add one? :confused:
I'm doing this:
Code:if(text_lists[currprintnum][strlen(pb_text_lists[currprintnum])-1]!='\n')
Correct? :)
Or Am I supposed to use strcmp?
Can we see your Makefile?Zitat:
Zitat von chrisp6825
Sure..Zitat:
Zitat von Archaemic
Spoiler for Makefile:
And heres the main.c just in case...
Spoiler for main.c:
no. that will fault if your string is ""...Zitat:
Zitat von Mr305
try if(strchr(foo, '\n') != NULL)
I installed libogg by following the directions here but I still get the same ogg errors. Also -lpspaudio is already there.Zitat:
Zitat von Archaemic
Thanks,
Justin