Make plugin work

Discuss the development of new homebrew software, tools and libraries.

Moderators: cheriff, TyRaNiD

Post Reply
jojojoris
Posts: 255
Joined: Sun Mar 30, 2008 4:06 am

Make plugin work

Post by jojojoris »

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: Select all

#include <pspkernel.h>
#include <pspsyscon.h>

PSP_MODULE_INFO&#40;"CrazyLedPlugin", 0x1000, 1, 1&#41;;
PSP_MAIN_THREAD_ATTR&#40;0&#41;;

int main_thread&#40;SceSize args, void *argp&#41;
&#123;
	int state = 0;
	for&#40;;;&#41;
	&#123;
		sceSysconCtrlLED&#40;SCE_LED_POWER,state&#41;;
		if &#40;state&#41; state=0;
		else state=1;
		sceKernelDelayThread&#40;100000&#41;;
	&#125;
&#125;

int module_start&#40;SceSize args, void *argp&#41;
&#123;
		// Create a thread
	SceUID thid = sceKernelCreateThread&#40;"CrazyLed", main_thread, 25, 64*1024, 0, NULL&#41;;
	if&#40;thid >= 0&#41;
	&#123;
		sceKernelStartThread&#40;thid, args, argp&#41;;
	&#125;

	return 0;
&#125;
makefile

Code: Select all

TARGET = CrazyLed
OBJS = main.o

INCDIR = 
CFLAGS = -O2 -G0 -Wall
CXXFLAGS = $&#40;CFLAGS&#41; -fno-exceptions -fno-rtti
ASFLAGS = $&#40;CFLAGS&#41;

LIBDIR =
LIBS = 

USE_KERNEL_LIBC = 1
USE_KERNEL_LIBS = 1

BUILD_PRX = 1

PSPSDK=$&#40;shell psp-config --pspsdk-path&#41;
include $&#40;PSPSDK&#41;/lib/build_prx.mak
Did i do something wrong?

Code: Select all

int main&#40;&#41;&#123;
     SetupCallbacks&#40;&#41;;
     makeNiceGame&#40;&#41;;
     sceKernelExitGame&#40;&#41;;
&#125;
MBx
Posts: 35
Joined: Sun Mar 22, 2009 12:52 am

Post by MBx »

I'm not sure but you may want to try Kernel prx instead of a user prx.
User avatar
Coldbird
Posts: 97
Joined: Thu Feb 08, 2007 7:22 am

Post by Coldbird »

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?
MBx
Posts: 35
Joined: Sun Mar 22, 2009 12:52 am

Post by MBx »

you are right. I'm sorry! :D
jojojoris
Posts: 255
Joined: Sun Mar 30, 2008 4:06 am

Post by jojojoris »

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: Select all

int main&#40;&#41;&#123;
     SetupCallbacks&#40;&#41;;
     makeNiceGame&#40;&#41;;
     sceKernelExitGame&#40;&#41;;
&#125;
User avatar
Torch
Posts: 825
Joined: Wed May 28, 2008 2:50 am

Post by Torch »

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