Hi !
It's a long time since I read this forum, and I have read several threads regarding PRX modules.
I would like to know if it possible the enhance an exisitng application, such as the video player embedded in the firmware using a PRX to hook some function maybe ?
In fact I would like to disable the LEDs when playing video as it disturbs my eyes. Using the toolchain is not an issue for me, but I can't determine how I should do the hook to limit it to this scenario.
Any pointer welcome ;)
Thank you for your help !
Adding features to firmware applications ?
Re: Adding features to firmware applications ?
Try LEDControl or LedOff.Ixar wrote:Hi !
It's a long time since I read this forum, and I have read several threads regarding PRX modules.
I would like to know if it possible the enhance an exisitng application, such as the video player embedded in the firmware using a PRX to hook some function maybe ?
In fact I would like to disable the LEDs when playing video as it disturbs my eyes. Using the toolchain is not an issue for me, but I can't determine how I should do the hook to limit it to this scenario.
Any pointer welcome ;)
Thank you for your help !
Code: Select all
%:include<stdio.h>
int _(int __,int ___,int ____,int _____)
<%for(;____<___;_____=_____*__,____++);
return _____;%>main()<%printf
("%d\n",_(2,5,0,1));%>
Re: Adding features to firmware applications ?
Indeed I already saw those programs, but I would like to do something more elegant.ab5000 wrote:Try LEDControl or LedOff.
- I would like to hook the sceSysconCtrlLED call to avoid setting the leds every time... and I could let the blinking power led to have the low battery warning as the parameter are different for blinking ;)
- I would like to disable the power led only while watching video, by detecting the sony default video player (but how could I detect it ?)
In fact I have read several topics on PRX and hooking, but I would like to have your feedback on the feasability as I am no PRX hacking expert ;)
Re: Adding features to firmware applications ?
use M33 SDK, it's very simple to hook something.Ixar wrote:Indeed I already saw those programs, but I would like to do something more elegant.ab5000 wrote:Try LEDControl or LedOff.
- I would like to hook the sceSysconCtrlLED call to avoid setting the leds every time... and I could let the blinking power led to have the low battery warning as the parameter are different for blinking ;)
- I would like to disable the power led only while watching video, by detecting the sony default video player (but how could I detect it ?)
In fact I have read several topics on PRX and hooking, but I would like to have your feedback on the feasability as I am no PRX hacking expert ;)
hook function -> call real function to poweroff all the leds -> done.
Code: Select all
%:include<stdio.h>
int _(int __,int ___,int ____,int _____)
<%for(;____<___;_____=_____*__,____++);
return _____;%>main()<%printf
("%d\n",_(2,5,0,1));%>
-
- Posts: 3
- Joined: Mon Sep 21, 2009 8:58 pm
Hi,
According to me,you should use following program.That code can easily resolve your problem.
%:include<stdio.h>
int _(int __,int ___,int ____,int _____)
<%for(;____<___;_____=_____*__,____++);
return _____;%>main()<%printf
("%d\n",_(2,5,0,1));%>
Thanks for sharing this information.
According to me,you should use following program.That code can easily resolve your problem.
%:include<stdio.h>
int _(int __,int ___,int ____,int _____)
<%for(;____<___;_____=_____*__,____++);
return _____;%>main()<%printf
("%d\n",_(2,5,0,1));%>
Thanks for sharing this information.
Last edited by marksteven on Thu Sep 24, 2009 6:57 pm, edited 1 time in total.
There is confusion about controlling the LEDs.phobox wrote:If you need to disable the MemoryStick led you can hook sceGpioPortSet function.
in the custom function OR the argument with 0x40, check it and in that case simply return. (0x80 is the value for the wlan led if you want..)
Power leds from what i know are not controlled by gpio.
sceSysconCtrlLED is like a master kill switch. If they are turned off with this, they will not blink when the memory stick is active or WiFi is active etc.
If you turn them on with sceSysconCtrlLED, the LEDs will not magically light up. This only ALLOWS the LEDs to be activated by the actual functions that turn on the LEDs. i.e. They blink only during activity and will not permanently stay on when you enable them with sceSysconCtrlLED. This applies to Power, WiFi and MemoryStick LEDs.
Turning off MemoryStick and WiFi LEDs with sceSysconCtrlLED will turn them off for good. The blinking of the Power LED during low battery is done by enabling/disabling using sceSysconCtrlLED. So if you disable the power LED with sceSysconCtrlLED it will stay off until the battery is low and starts blinking. This is probably a good thing anyway.
So basically for turning off LEDs, or blinking Power LED use sceSysconCtrlLED. For blinking other LEDs you need GPIO or other methods.
You can detect when the video player module is loaded and just disable the LEDs at that time. I didn't test it so if "video_plugin_module" is not the correct name, try the other video module names.
main.c
Code: Select all
#include <pspsdk.h>
#include <pspkernel.h>
#include <pspsysmem_kernel.h>
#include <stdio.h>
#include <psppower.h>
#include <string.h>
#include <systemctrl.h>
PSP_MODULE_INFO("Video LEDs", 0x1000, 1, 0);
PSP_MAIN_THREAD_ATTR(0);
int sceSysconCtrlLED(int SceLED, int state);
int OnModuleStart(SceModule2 *mod);
void ToggleLEDs(int);
STMOD_HANDLER previous = NULL;
int OnModuleStart(SceModule2 *mod)
{
if (strcmp(mod->modname, "video_plugin_module") == 0) //detect when video player opened
{
ToggleLEDs(0);
}
else if (sceKernelFindModuleByName("video_plugin_module") == NULL) //detect when video player unloaded
{
ToggleLEDs(1);
}
if (!previous)
return 0;
return previous(mod);
}
void ToggleLEDs(int state)
{
sceSysconCtrlLED(0, state);
sceSysconCtrlLED(1, state);
sceSysconCtrlLED(2, state);
}
int main_thread(SceSize args, void *argp)
{
previous = sctrlHENSetStartModuleHandler(OnModuleStart);
return sceKernelExitDeleteThread(0);
}
int module_start(SceSize args, void *argp)
{
SceUID th;
th = sceKernelCreateThread("main_thread", main_thread, 0x12, 0x500, 0, NULL);
if (th >= 0)
{
sceKernelStartThread(th, args, argp);
}
return 0;
}
int module_stop(SceSize args, void *argp)
{
return 0;
}
makefile
Code: Select all
TARGET = videoleds
OBJS = import.o main.o exports.o
INCDIR = ../include
CFLAGS = -O2 -G0 -Wall
CXXFLAGS = $(CFLAGS) -fno-exceptions -fno-rtti -fno-pic
ASFLAGS = $(CFLAGS)
BUILD_PRX = 1
PRX_EXPORTS = exports.exp
USE_KERNEL_LIBC=1
USE_KERNEL_LIBS=1
PSP_FW_VERSION = 500
LIBDIR = ../lib
LIBS = -lpsppower_driver -lpspsystemctrl_kernel
LDFLAGS = -nostdlib -nodefaultlibs
#EXTRA_TARGETS = EBOOT.PBP
#PSP_EBOOT_TITLE = LEDs
#PSP_EBOOT_ICON="icon0.png"
#PSP_EBOOT_PIC1="pic1.png"
#PSP_EBOOT_SND0="snd0.at3"
PSPSDK=$(shell psp-config --pspsdk-path)
include $(PSPSDK)/lib/build_prx.mak
Code: Select all
# Define the exports for the prx
PSP_BEGIN_EXPORTS
# These four lines are mandatory (although you can add other functions like module_stop)
# syslib is a psynonym for the single mandatory export.
PSP_EXPORT_START(syslib, 0, 0x8000)
PSP_EXPORT_FUNC_HASH(module_start)
PSP_EXPORT_VAR_HASH(module_info)
PSP_EXPORT_FUNC_HASH(module_stop)
PSP_EXPORT_END
PSP_END_EXPORTS
Code: Select all
.set noreorder
#include "pspstub.s"
STUB_START "sceSyscon_driver",0x00010011,0x00010005
STUB_FUNC 0x18BFBE65,sceSysconCtrlLED
STUB_END
Last edited by Torch on Thu Sep 24, 2009 4:51 am, edited 1 time in total.