Vento
31.01.2021, 21:36
ENG:
Sorry If I write here but this seems the most active community.
I wrote a plugin to keep all leds of, it works and now I'm just fixing some minor stuffs...
This is the code:
#include <pspsyscon.h>
#include "systemctrl.h"
#define UNUSED __attribute__((unused))
#define SYSCON_CTRL_LED_SUCCES 0
#define NO_ERROR 0
PSP_MODULE_INFO("noLED", 0x1000, 1, 0);
PSP_MAIN_THREAD_ATTR(0);
int sceSysconCtrlLED_nop(int SceLED UNUSED, int state UNUSED)
{
return SYSCON_CTRL_LED_SUCCES;
}
int module_start(SceSize args UNUSED, void *argp UNUSED)
{
sceSysconCtrlLED(0, LED_OFF);
sceSysconCtrlLED(1, LED_OFF);
sceSysconCtrlLED(2, LED_OFF);
sceSysconCtrlLED(3, LED_OFF);
u32 address = sctrlHENFindFunction("sceSyscon_driver", "sceSysconCtrlLED", 0x18BFBE65);
if (address)
{
sctrlHENPatchSyscall(address, sceSysconCtrlLED_nop);
}
return NO_ERROR;
}
int module_stop(SceSize args UNUSED, void *argp UNUSED)
{
return NO_ERROR;
}
It simply turn off al leds and redirect all subsequent sceSysconCtrlLED calls to a function that does nothing.
I have 2 question:
Online I see that when some call redirect is done usually the patching process is placed between this code: int intr = sceKernelCpuSuspendIntr(); // suspend interrupts
// < patching code here >
sceKernelDcacheWritebackAll(); // clear cache
sceKernelIcacheClearAll(); // clear cache
sceKernelCpuResumeIntr(intr); // suspend interrupts Why do this?
When I PSP resume after sleep/suspend the patch is "gone"... This should be simple to fix by symply calling the patching code again when the PSP resume from suspend, but I do not know how to do it. I saw some call back example online but nothing on "calling a function" when the PSP resume from sleep.
RUS (Translated with Google Translate):
Извините, если я напишу здесь, но это кажется наиболее активным сообществом.
Я написал плагин, чтобы сохранить все светодиоды, он работает, и теперь я просто исправляю некоторые мелочи ...
Это код:
#include <pspsyscon.h>
#include "systemctrl.h"
#define UNUSED __attribute__((unused))
#define SYSCON_CTRL_LED_SUCCES 0
#define NO_ERROR 0
PSP_MODULE_INFO("noLED", 0x1000, 1, 0);
PSP_MAIN_THREAD_ATTR(0);
int sceSysconCtrlLED_nop(int SceLED UNUSED, int state UNUSED)
{
return SYSCON_CTRL_LED_SUCCES;
}
int module_start(SceSize args UNUSED, void *argp UNUSED)
{
sceSysconCtrlLED(0, LED_OFF);
sceSysconCtrlLED(1, LED_OFF);
sceSysconCtrlLED(2, LED_OFF);
sceSysconCtrlLED(3, LED_OFF);
u32 address = sctrlHENFindFunction("sceSyscon_driver", "sceSysconCtrlLED", 0x18BFBE65);
if (address)
{
sctrlHENPatchSyscall(address, sceSysconCtrlLED_nop);
}
return NO_ERROR;
}
int module_stop(SceSize args UNUSED, void *argp UNUSED)
{
return NO_ERROR;
}
Он просто отключает все светодиоды и перенаправляет все последующие вызовы sceSysconCtrlLED на функцию, которая ничего не делает.
У меня 2 вопроса:
В сети я вижу, что когда выполняется какое-то перенаправление вызовов, обычно процесс исправления помещается между этим кодом: int intr = sceKernelCpuSuspendIntr(); // suspend interrupts
// < patching code here >
sceKernelDcacheWritebackAll(); // clear cache
sceKernelIcacheClearAll(); // clear cache
sceKernelCpuResumeIntr(intr); // suspend interrupts Зачем это нужно?
Когда я возобновляю PSP после сна / приостановки, патч "ушел" ... Это должно быть просто исправить, снова вызывая исправляющий код, когда PSP возобновляет работу из приостановки, но я не знаю, как это сделать. Я видел несколько примеров обратного вызова в сети, но ничего не касалось «вызова функции», когда PSP выходит из спящего режима.
Sorry If I write here but this seems the most active community.
I wrote a plugin to keep all leds of, it works and now I'm just fixing some minor stuffs...
This is the code:
#include <pspsyscon.h>
#include "systemctrl.h"
#define UNUSED __attribute__((unused))
#define SYSCON_CTRL_LED_SUCCES 0
#define NO_ERROR 0
PSP_MODULE_INFO("noLED", 0x1000, 1, 0);
PSP_MAIN_THREAD_ATTR(0);
int sceSysconCtrlLED_nop(int SceLED UNUSED, int state UNUSED)
{
return SYSCON_CTRL_LED_SUCCES;
}
int module_start(SceSize args UNUSED, void *argp UNUSED)
{
sceSysconCtrlLED(0, LED_OFF);
sceSysconCtrlLED(1, LED_OFF);
sceSysconCtrlLED(2, LED_OFF);
sceSysconCtrlLED(3, LED_OFF);
u32 address = sctrlHENFindFunction("sceSyscon_driver", "sceSysconCtrlLED", 0x18BFBE65);
if (address)
{
sctrlHENPatchSyscall(address, sceSysconCtrlLED_nop);
}
return NO_ERROR;
}
int module_stop(SceSize args UNUSED, void *argp UNUSED)
{
return NO_ERROR;
}
It simply turn off al leds and redirect all subsequent sceSysconCtrlLED calls to a function that does nothing.
I have 2 question:
Online I see that when some call redirect is done usually the patching process is placed between this code: int intr = sceKernelCpuSuspendIntr(); // suspend interrupts
// < patching code here >
sceKernelDcacheWritebackAll(); // clear cache
sceKernelIcacheClearAll(); // clear cache
sceKernelCpuResumeIntr(intr); // suspend interrupts Why do this?
When I PSP resume after sleep/suspend the patch is "gone"... This should be simple to fix by symply calling the patching code again when the PSP resume from suspend, but I do not know how to do it. I saw some call back example online but nothing on "calling a function" when the PSP resume from sleep.
RUS (Translated with Google Translate):
Извините, если я напишу здесь, но это кажется наиболее активным сообществом.
Я написал плагин, чтобы сохранить все светодиоды, он работает, и теперь я просто исправляю некоторые мелочи ...
Это код:
#include <pspsyscon.h>
#include "systemctrl.h"
#define UNUSED __attribute__((unused))
#define SYSCON_CTRL_LED_SUCCES 0
#define NO_ERROR 0
PSP_MODULE_INFO("noLED", 0x1000, 1, 0);
PSP_MAIN_THREAD_ATTR(0);
int sceSysconCtrlLED_nop(int SceLED UNUSED, int state UNUSED)
{
return SYSCON_CTRL_LED_SUCCES;
}
int module_start(SceSize args UNUSED, void *argp UNUSED)
{
sceSysconCtrlLED(0, LED_OFF);
sceSysconCtrlLED(1, LED_OFF);
sceSysconCtrlLED(2, LED_OFF);
sceSysconCtrlLED(3, LED_OFF);
u32 address = sctrlHENFindFunction("sceSyscon_driver", "sceSysconCtrlLED", 0x18BFBE65);
if (address)
{
sctrlHENPatchSyscall(address, sceSysconCtrlLED_nop);
}
return NO_ERROR;
}
int module_stop(SceSize args UNUSED, void *argp UNUSED)
{
return NO_ERROR;
}
Он просто отключает все светодиоды и перенаправляет все последующие вызовы sceSysconCtrlLED на функцию, которая ничего не делает.
У меня 2 вопроса:
В сети я вижу, что когда выполняется какое-то перенаправление вызовов, обычно процесс исправления помещается между этим кодом: int intr = sceKernelCpuSuspendIntr(); // suspend interrupts
// < patching code here >
sceKernelDcacheWritebackAll(); // clear cache
sceKernelIcacheClearAll(); // clear cache
sceKernelCpuResumeIntr(intr); // suspend interrupts Зачем это нужно?
Когда я возобновляю PSP после сна / приостановки, патч "ушел" ... Это должно быть просто исправить, снова вызывая исправляющий код, когда PSP возобновляет работу из приостановки, но я не знаю, как это сделать. Я видел несколько примеров обратного вызова в сети, но ничего не касалось «вызова функции», когда PSP выходит из спящего режима.