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 

Make plugin work

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



Joined: 30 Mar 2008
Posts: 261

PostPosted: Mon Mar 30, 2009 6:02 am    Post subject: Make plugin work Reply with quote

I've never writed a plugin before.

I want to know how to make a simple evil :P plugin which makes the power led goes on and off and on and off... So everone got hypnothised by that little led. But it dont work.

Here is my code:

main.c
Code:
#include <pspkernel.h>
#include <pspsyscon.h>

PSP_MODULE_INFO("CrazyLedPlugin", 0x1000, 1, 1);
PSP_MAIN_THREAD_ATTR(0);

int main_thread(SceSize args, void *argp)
{
   int state = 0;
   for(;;)
   {
      sceSysconCtrlLED(SCE_LED_POWER,state);
      if (state) state=0;
      else state=1;
      sceKernelDelayThread(100000);
   }
}

int module_start(SceSize args, void *argp)
{
      // Create a thread
   SceUID thid = sceKernelCreateThread("CrazyLed", main_thread, 25, 64*1024, 0, NULL);
   if(thid >= 0)
   {
      sceKernelStartThread(thid, args, argp);
   }

   return 0;
}


makefile
Code:
TARGET = CrazyLed
OBJS = main.o

INCDIR =
CFLAGS = -O2 -G0 -Wall
CXXFLAGS = $(CFLAGS) -fno-exceptions -fno-rtti
ASFLAGS = $(CFLAGS)

LIBDIR =
LIBS =

USE_KERNEL_LIBC = 1
USE_KERNEL_LIBS = 1

BUILD_PRX = 1

PSPSDK=$(shell psp-config --pspsdk-path)
include $(PSPSDK)/lib/build_prx.mak


Did i do something wrong?
_________________
Code:
int main(){
     SetupCallbacks();
     makeNiceGame();
     sceKernelExitGame();
}
Back to top
View user's profile Send private message
MBx



Joined: 22 Mar 2009
Posts: 35

PostPosted: Mon Mar 30, 2009 6:41 am    Post subject: Reply with quote

I'm not sure but you may want to try Kernel prx instead of a user prx.
Back to top
View user's profile Send private message
Coldbird



Joined: 08 Feb 2007
Posts: 155

PostPosted: Mon Mar 30, 2009 7:00 am    Post subject: Reply with quote

If you didn't notice, he is using a kernel prx already.
_________________
Been gone for some time. Now I'm back. Someone mind getting me up-2-date?
Back to top
View user's profile Send private message MSN Messenger
MBx



Joined: 22 Mar 2009
Posts: 35

PostPosted: Mon Mar 30, 2009 7:08 am    Post subject: Reply with quote

you are right. I'm sorry! :D
Back to top
View user's profile Send private message
jojojoris



Joined: 30 Mar 2008
Posts: 261

PostPosted: Mon Mar 30, 2009 11:52 pm    Post subject: Reply with quote

I think i did nothing wrong. I had it on while i was playing with PSPTube and i saw the wlan-led goes crazy. so i think i made a plugin which made the wrong led blinking.
_________________
Code:
int main(){
     SetupCallbacks();
     makeNiceGame();
     sceKernelExitGame();
}
Back to top
View user's profile Send private message
Torch



Joined: 28 May 2008
Posts: 842

PostPosted: Tue Mar 31, 2009 1:34 am    Post subject: Reply with quote

To clear things up, sceSysconCtrlLED doesn't actually make the LEDs on or off. It only ALLOWS or DISALLOWS the particular LED to be turned on or off by other apps/system.

Suppose you sceSysconCtrlLED(WLAN, 1), the WLAN LED will not turn on. It only ALLOWS the led to blink when connection is active. Similarily sceSysconCtrlLED(MEMSTICK, 1) won't activate the orange led. It only blink when data is transferred. sceSysconCtrlLED(MEMSTICK, 0) will keep it off even during data transfer.
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