PS2SDK
PS2 Homebrew Libraries
|
Power-off library. More...
Go to the source code of this file.
Macros | |
#define | POWEROFF_THREAD_PRIORITY 0x70 |
Typedefs | |
typedef void(* | poweroff_callback) (void *arg) |
User defined function for use in poweroffSetCallback() | |
Functions | |
int | poweroffInit (void) |
Initializes the poweroff library. | |
void | poweroffSetCallback (poweroff_callback cb, void *arg) |
Set callback function. | |
void | poweroffShutdown (void) |
Immidiate console shutdown. Do not call it without closing all stuff. | |
void | poweroffChangeThreadPriority (int priority) |
Change thread priority. | |
Power-off library.
Poweroff is a library that substitutes for the missing poweroff functionality in rom0:CDVDMAN, which is offered by newer CDVDMAN modules (i.e. sceCdPoweroff
). Other than allowing the PlayStation 2 to be switched off via software means, this is used to safeguard against the user switching off/resetting the console before data can be completely written to disk.
Definition in file libpwroff.h.
#define POWEROFF_THREAD_PRIORITY 0x70 |
Definition at line 25 of file libpwroff.h.
typedef void(* poweroff_callback) (void *arg) |
User defined function for use in poweroffSetCallback()
In fact there can be anything. This function will be called when power button is pressed. In common cases it should end everything and poweroff console. You should close all files (close(fd)
) and unmount all partitions. If you use PFS, close all files and unmount all partitions.
Shut down DEV9 (Network module), if you used it:
Last function inside callback should be poweroffShutdown().
Definition at line 49 of file libpwroff.h.
|
extern |
Initializes the poweroff library.
A service thread with a default priority of POWEROFF_THREAD_PRIORITY will be created.
Definition at line 64 of file poweroff.c.
Referenced by poweroffSetCallback(), and poweroffShutdown().
|
extern |
Set callback function.
[in] | cb | Function that will be called when power button is pressed. |
[in] | arg | Arguments that are sent to cb function (can be NULL) |
Callback function should be user-defined elsewhere. There are some standart specifications.
Definition at line 103 of file poweroff.c.
References poweroffInit().
|
extern |
Immidiate console shutdown. Do not call it without closing all stuff.
Definition at line 111 of file poweroff.c.
References poweroffInit().
|
extern |
Change thread priority.
The callback thread runs at priority POWEROFF_THREAD_PRIORITY by default. You can change the priority by calling this function after poweroffSetCallback(). You can call this function before poweroffSetCallback() as well (but after poweroffInit() ). In that case poweroffSetCallback() will be registered with the provided priority.
Definition at line 118 of file poweroff.c.