forums.ps2dev.org Forum Index forums.ps2dev.org
Homebrew PS2, PSP & PS3 Development Discussions
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

my prx doesn't printf

 
Post new topic   Reply to topic    forums.ps2dev.org Forum Index -> PSP Development
View previous topic :: View next topic  
Author Message
rus_pa



Joined: 07 Jan 2008
Posts: 13

PostPosted: Sun Feb 03, 2008 4:54 am    Post subject: my prx doesn't printf Reply with quote

hy, I just managed to compile & load successfully a prx :D (got troubles.. anyway)
I exported some functions, the first returns an integer, another writes to screen a junkie text.

calling from the main program, the first writes my integer to screen, the second doesn't do anything, seems to just skip.

the prx code is this

Code:

#include <pspsdk.h>
#include <pspkernel.h>
#include <pspdisplay_kernel.h>
#include <stdio.h>
#include <pspdebug.h>
#include <pspdisplay.h>
#include <pspctrl.h>
#include <stdio.h>
#include <string.h>

PSP_MODULE_INFO("myLib", 0x1006, 1, 1);
PSP_MAIN_THREAD_ATTR(0);

u32 k1;

void write_me(int number){
    k1 = pspSdkSetK1(0);
    printf("(%d)",number);
   
//next line blows up the compile :P   
//pspDebugScreenPrintf("(%d)", number);
   
    pspSdkSetK1(k1);
}

int module_start(SceSize args, void *argp)
{
    printf("PRX module starting...\n");
   return 0;
}

int module_stop()
{
   return 0;
}

int give_me(){

    return 5;
}


neither the "module starting..." is displayed.
Why?
Back to top
View user's profile Send private message
Hellcat



Joined: 24 Jan 2007
Posts: 84

PostPosted: Sun Feb 03, 2008 10:59 pm    Post subject: Re: my prx doesn't printf Reply with quote

rus_pa wrote:
//next line blows up the compile :P
//pspDebugScreenPrintf("(%d)", number);

Because you can't link user functions into kernel mode modules.
Make your kernel PRX return the value to the usermode PRX and output it from there.

I currently don't know how the standard C "printf" is defined on the PSP, but you need to call pspDebugScreenPrintf() to output anything.
Don't forget to init the debug screen first!
Back to top
View user's profile Send private message
PSPfreak!



Joined: 14 Nov 2007
Posts: 34

PostPosted: Tue Feb 05, 2008 8:37 pm    Post subject: Re: my prx doesn't printf Reply with quote

Hellcat wrote:

I currently don't know how the standard C "printf" is defined on the PSP, but you need to call pspDebugScreenPrintf() to output anything.
Don't forget to init the debug screen first!


isnt it
Code:
#define printf  pspDebugScreenPrintf

printf("blah blah blah");
/*prints blah blah blah to the psp screen*/


that works??, isnt that how its defined? or were you meaning something else? lol
Back to top
View user's profile Send private message
jean



Joined: 05 Jan 2008
Posts: 489

PostPosted: Tue Feb 05, 2008 8:46 pm    Post subject: Reply with quote

Quote:
isnt it ...

Yeah....rus_pa didn't quoted it from its source, but i guess it was understood. Anyway, even if printf was defined, initialized and allowed in a kernel prx like that, it's not a good practice to use it that way... return a string and do whatever you want with it in your usermode code
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    forums.ps2dev.org Forum Index -> PSP Development All times are GMT + 10 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group