mirror of
https://github.com/joel16/uofw.git
synced 2024-11-23 11:39:50 +00:00
General code/documentation improvements.
This commit is contained in:
parent
7c3f19f730
commit
96de0e11d3
@ -17,7 +17,7 @@
|
||||
*
|
||||
* @return SCE_ERROR_OK, otherwise <0 on error.
|
||||
*/
|
||||
s32 sceClockgenSetup();
|
||||
s32 sceClockgenSetup(void);
|
||||
|
||||
/**
|
||||
* Sets the spectrum spreading mode.
|
||||
@ -35,16 +35,16 @@ s32 sceClockgenSetSpectrumSpreading(s32 mode);
|
||||
*
|
||||
* @return SCE_ERROR_OK, otherwise <0 on error.
|
||||
*/
|
||||
s32 sceClockgenInit();
|
||||
s32 sceClockgenInit(void);
|
||||
|
||||
/**
|
||||
* Deinits the module.
|
||||
* Terminates the module.
|
||||
*
|
||||
* Deletes the mutex and unregisters the sysevent handler.
|
||||
*
|
||||
* @return SCE_ERROR_OK.
|
||||
*/
|
||||
s32 sceClockgenEnd();
|
||||
s32 sceClockgenEnd(void);
|
||||
|
||||
/**
|
||||
* Sets the protocol.
|
||||
@ -63,7 +63,7 @@ s32 sceClockgenSetProtocol(u32 prot);
|
||||
*
|
||||
* @return Likely 3, 4, 7, 8, 9, 10 or 15. Another value may indicate that you work at SCE.
|
||||
*/
|
||||
s32 sceClockgenGetRevision();
|
||||
s32 sceClockgenGetRevision(void);
|
||||
|
||||
/**
|
||||
* Gets the CY27040 hardware register value as stored in memory.
|
||||
@ -88,28 +88,28 @@ s32 sceClockgenAudioClkSetFreq(u32 freq);
|
||||
*
|
||||
* @return SCE_ERROR_OK, otherwise <0.
|
||||
*/
|
||||
s32 sceClockgenAudioClkEnable();
|
||||
s32 sceClockgenAudioClkEnable(void);
|
||||
|
||||
/**
|
||||
* Disables the audio clock.
|
||||
*
|
||||
* @return SCE_ERROR_OK, otherwise <0.
|
||||
*/
|
||||
s32 sceClockgenAudioClkDisable();
|
||||
s32 sceClockgenAudioClkDisable(void);
|
||||
|
||||
/**
|
||||
* Enables the lepton clock (managing the UMD reader).
|
||||
*
|
||||
* @return SCE_ERROR_OK, otherwise <0.
|
||||
*/
|
||||
s32 sceClockgenLeptonClkEnable();
|
||||
s32 sceClockgenLeptonClkEnable(void);
|
||||
|
||||
/**
|
||||
* Disables the lepton clock (managing the UMD reader).
|
||||
*
|
||||
* @return SCE_ERROR_OK, otherwise <0.
|
||||
*/
|
||||
s32 sceClockgenLeptonClkDisable();
|
||||
s32 sceClockgenLeptonClkDisable(void);
|
||||
|
||||
/** @} */
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* Copyright (C) 2011, 2012 The uOFW team
|
||||
/* Copyright (C) 2011, 2012, 2013 The uOFW team
|
||||
See the file COPYING for copying permission.
|
||||
*/
|
||||
|
||||
|
@ -9,6 +9,8 @@
|
||||
#define HW(addr) (*(vs32 *)(addr))
|
||||
#define HWPTR(addr) ((vs32 *)(addr))
|
||||
|
||||
#define RAM_TYPE_32_MB (1)
|
||||
#define RAM_TYPE_64_MB (2)
|
||||
#define HW_RAM_SIZE 0xBC100040
|
||||
|
||||
#define HW_TIMER_0 0xBC500000
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* Copyright (C) 2011, 2012 The uOFW team
|
||||
/* Copyright (C) 2011, 2012, 2013 The uOFW team
|
||||
See the file COPYING for copying permission.
|
||||
*/
|
||||
|
||||
@ -6,17 +6,48 @@
|
||||
# error "Only include common_imp.h or common_header.h!"
|
||||
#endif
|
||||
|
||||
#define SCE_MODULE_NAME_LEN (27)
|
||||
/** The maximum length of a module name. */
|
||||
#define SCE_MODULE_NAME_LEN (27)
|
||||
|
||||
/** SceModuleInfo.modVersion */
|
||||
#define MODULE_VERSION_MINOR (0)
|
||||
#define MODULE_VERSION_MAJOR (1)
|
||||
#define MODULE_VERSION_NUMBER_CATEGORY_SIZE (2) /* current number category size */
|
||||
|
||||
/** Module Info section data. */
|
||||
typedef struct {
|
||||
/**
|
||||
* The attributes of a module. Bitwise OR'ed values from ::SceModuleAttribute
|
||||
* and ::SceModulePrivilegeLevel.
|
||||
*/
|
||||
u16 modAttribute;
|
||||
u8 modVersion[2];
|
||||
/** The module version. Contains two number categories, minor, major. */
|
||||
u8 modVersion[MODULE_VERSION_NUMBER_CATEGORY_SIZE];
|
||||
/** The name of the module. */
|
||||
char modName[SCE_MODULE_NAME_LEN];
|
||||
/** Unknown. */
|
||||
s8 terminal;
|
||||
/** The global pointer of the module. */
|
||||
void *gpValue;
|
||||
/**
|
||||
* Pointer to the first resident library entry table of the module.
|
||||
* This section is known as ".lib.ent".
|
||||
*/
|
||||
void *entTop;
|
||||
/**
|
||||
* Pointer to the last line of the ,lib.ent section. This line is always 0 and
|
||||
* is known as ".lib.ent.btm".
|
||||
*/
|
||||
void *entEnd;
|
||||
/**
|
||||
* Pointer to the first stub library entry table of the module.
|
||||
* This section is known as "lib.stub".
|
||||
*/
|
||||
void *stubTop;
|
||||
/**
|
||||
* Pointer to the last line of the lib.stub section. This line is always 0 and
|
||||
* is known as ".lib.stub.btm".
|
||||
*/
|
||||
void *stubEnd;
|
||||
} SceModuleInfo;
|
||||
|
||||
@ -66,7 +97,9 @@ enum SceModulePrivilegeLevel {
|
||||
SCE_MODULE_MS = 0x0200,
|
||||
/** Module Gamesharing. */
|
||||
SCE_MODULE_USB_WLAN = 0x0400,
|
||||
/** Application module. */
|
||||
SCE_MODULE_APP = 0x0600,
|
||||
/** VSH module. */
|
||||
SCE_MODULE_VSH = 0x0800,
|
||||
/** Highest permission. */
|
||||
SCE_MODULE_KERNEL = 0x1000,
|
||||
@ -76,6 +109,9 @@ enum SceModulePrivilegeLevel {
|
||||
SCE_MODULE_KIRK_SEMAPHORE_LIB = 0x4000,
|
||||
};
|
||||
|
||||
#define SCE_MODINFO_SECTION_NAME ".rodata.sceModuleInfo"
|
||||
|
||||
/** Release X.Y.Z -> 0xXXYYZZZZ */
|
||||
#define SDK_VERSION 0x06060010
|
||||
#define SCE_SDK_VERSION(ver) const int module_sdk_version = ver
|
||||
|
||||
@ -86,7 +122,7 @@ enum SceModulePrivilegeLevel {
|
||||
#define SCE_MODULE_REBOOT_PHASE(name) int module_reboot_phase(void) __attribute__((alias(name)))
|
||||
#define SCE_MODULE_STOP(name) int module_stop(void) __attribute__((alias(name)))
|
||||
|
||||
#define SCE_MODULE_INFO(name, attributes, major_version, minor_version) \
|
||||
#define SCE_MODULE_INFO(name, attributes, majorVersion, minorVersion) \
|
||||
__asm__ ( \
|
||||
" .set push\n" \
|
||||
" .section .lib.ent.top, \"a\", @progbits\n" \
|
||||
@ -111,9 +147,9 @@ enum SceModulePrivilegeLevel {
|
||||
extern char __lib_ent_top[], __lib_ent_bottom[]; \
|
||||
extern char __lib_stub_top[], __lib_stub_bottom[]; \
|
||||
const SceModuleInfo module_info \
|
||||
__attribute__((section(".rodata.sceModuleInfo"), \
|
||||
__attribute__((section(SCE_MODINFO_SECTION_NAME), \
|
||||
aligned(16), unused)) = { \
|
||||
attributes, { minor_version, major_version }, name, 0, _gp, \
|
||||
attributes, { minorVersion, majorVersion }, name, 0, _gp, \
|
||||
__lib_ent_top, __lib_ent_bottom, \
|
||||
__lib_stub_top, __lib_stub_bottom \
|
||||
}
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* Copyright (C) 2011, 2012 The uOFW team
|
||||
/* Copyright (C) 2011, 2012, 2013 The uOFW team
|
||||
See the file COPYING for copying permission.
|
||||
*/
|
||||
|
||||
@ -12,7 +12,7 @@
|
||||
*/
|
||||
|
||||
#ifndef NULL
|
||||
# define NULL ((void*)0)
|
||||
# define NULL ((void*)0)
|
||||
#endif
|
||||
|
||||
/*
|
||||
@ -20,16 +20,16 @@
|
||||
*/
|
||||
|
||||
/* Unsigned */
|
||||
typedef uint8_t u8;
|
||||
typedef uint16_t u16;
|
||||
typedef uint32_t u32;
|
||||
typedef uint64_t u64;
|
||||
typedef uint8_t u8;
|
||||
typedef uint16_t u16;
|
||||
typedef uint32_t u32;
|
||||
typedef uint64_t u64;
|
||||
|
||||
/* Signed */
|
||||
typedef int8_t s8;
|
||||
typedef int16_t s16;
|
||||
typedef int32_t s32;
|
||||
typedef int64_t s64;
|
||||
typedef int8_t s8;
|
||||
typedef int16_t s16;
|
||||
typedef int32_t s32;
|
||||
typedef int64_t s64;
|
||||
|
||||
/* Volatile (should be used for hardware addresses) unsigned */
|
||||
|
||||
@ -49,42 +49,44 @@ typedef volatile int64_t vs64;
|
||||
*/
|
||||
|
||||
/* ID of most kernel objects */
|
||||
typedef s32 SceUID;
|
||||
typedef s32 SceUID;
|
||||
|
||||
/* Size, unsigned or signed (for memory blocks, etc.) */
|
||||
typedef u32 SceSize;
|
||||
typedef s32 SceSSize;
|
||||
typedef u32 SceSize;
|
||||
typedef s32 SceSSize;
|
||||
|
||||
/* Types used by some modules */
|
||||
typedef u8 SceUChar;
|
||||
typedef u8 SceUChar8;
|
||||
typedef u16 SceUShort16;
|
||||
typedef u32 SceUInt;
|
||||
typedef u32 SceUInt32;
|
||||
typedef u64 SceUInt64;
|
||||
typedef u64 SceULong64;
|
||||
typedef u8 SceUChar;
|
||||
typedef u8 SceUChar8;
|
||||
typedef u16 SceUShort16;
|
||||
typedef u32 SceUInt;
|
||||
typedef u32 SceUInt32;
|
||||
typedef u64 SceUInt64;
|
||||
typedef u64 SceULong64;
|
||||
|
||||
typedef u8 SceChar8;
|
||||
typedef u16 SceShort16;
|
||||
typedef u32 SceInt32;
|
||||
typedef s64 SceInt64;
|
||||
typedef s64 SceLong64;
|
||||
typedef u8 SceChar8;
|
||||
typedef u16 SceShort16;
|
||||
typedef u32 SceInt32;
|
||||
typedef s64 SceInt64;
|
||||
typedef s64 SceLong64;
|
||||
|
||||
typedef s32 SceFloat;
|
||||
typedef s32 SceFloat32;
|
||||
typedef s32 SceFloat;
|
||||
typedef s32 SceFloat32;
|
||||
|
||||
typedef u16 SceWChar16;
|
||||
typedef u32 SceWChar32;
|
||||
typedef u16 SceWChar16;
|
||||
typedef u32 SceWChar32;
|
||||
|
||||
typedef s32 SceBool;
|
||||
#define SCE_FALSE (0)
|
||||
#define SCE_TRUE (1)
|
||||
typedef s32 SceBool;
|
||||
|
||||
typedef void SceVoid;
|
||||
typedef void *ScePVoid;
|
||||
typedef void SceVoid;
|
||||
typedef void * ScePVoid;
|
||||
|
||||
/* Permission mode when creating a file (in octal, like the chmod function and UNIX command */
|
||||
typedef s32 SceMode;
|
||||
typedef s32 SceMode;
|
||||
/* An offset inside a file */
|
||||
typedef SceInt64 SceOff;
|
||||
typedef SceInt64 SceOff;
|
||||
|
||||
#endif
|
||||
|
||||
|
@ -96,7 +96,7 @@ typedef struct {
|
||||
/** Unknown. */
|
||||
s32 unk1;
|
||||
/** Unknown. */
|
||||
s32 (*func)(int);
|
||||
s32 (*func)(s32);
|
||||
} SceCtrlUnkStruct;
|
||||
|
||||
/**
|
||||
|
14
include/init.h
Normal file
14
include/init.h
Normal file
@ -0,0 +1,14 @@
|
||||
/** Copyright (C) 2011, 2012, 2013 The uOFW team
|
||||
See the file COPYING for copying permission.\n
|
||||
*/
|
||||
|
||||
#ifndef INIT_H
|
||||
#define INIT_H
|
||||
|
||||
#include "common_imp.h"
|
||||
|
||||
/** The internal name of the INIT module. */
|
||||
#define INIT_MODULE_NAME "sceInit"
|
||||
|
||||
#endif /* INIT_H */
|
||||
|
@ -29,16 +29,16 @@ enum ScePspLedTypes {
|
||||
*/
|
||||
enum SceLedModes {
|
||||
/** Turn a LED OFF. */
|
||||
LED_MODE_OFF = 0,
|
||||
SCE_LED_MODE_OFF = 0,
|
||||
/** Turn a LED ON. */
|
||||
LED_MODE_ON = 1,
|
||||
SCE_LED_MODE_ON = 1,
|
||||
/** Set a blink event for a LED. */
|
||||
LED_MODE_BLINK = 2,
|
||||
SCE_LED_MODE_BLINK = 2,
|
||||
/**
|
||||
* Register LED configuration commands and execute them. Its use is not recommended,
|
||||
* as it is still not completely known how that mode works.
|
||||
*/
|
||||
LED_MODE_SELECTIVE_EXEC = 3
|
||||
SCE_LED_MODE_SELECTIVE_EXEC = 3
|
||||
};
|
||||
|
||||
/**
|
||||
@ -50,45 +50,45 @@ enum SceLedCmds {
|
||||
* Save a LED configuration command for later use. You can only
|
||||
* save one configuration.
|
||||
*/
|
||||
LED_CMD_SAVE_CMD = 1,
|
||||
SCE_LED_CMD_SAVE_CMD = 1,
|
||||
/** Execute a saved LED configuration command. */
|
||||
LED_CMD_EXECUTE_SAVED_CMD = 2,
|
||||
SCE_LED_CMD_EXECUTE_SAVED_CMD = 2,
|
||||
/**
|
||||
* Register a LED configuration to be executed manually by the user.
|
||||
* Upto 4 LED configuration can be registered the same time.
|
||||
*/
|
||||
LED_CMD_REGISTER_CMD = 3,
|
||||
SCE_LED_CMD_REGISTER_CMD = 3,
|
||||
/**
|
||||
* Execute the recently registered LED configuration. Once it has been executed as
|
||||
* many times the user as the user decided,
|
||||
* many times the user decided, the previously registered LED command will be executed.
|
||||
*/
|
||||
LED_CMD_EXECUTE_CMD = 4,
|
||||
SCE_LED_CMD_EXECUTE_CMD = 4,
|
||||
/** Turn ON a specified LED. */
|
||||
LED_CMD_TURN_LED_ON = 16,
|
||||
SCE_LED_CMD_TURN_LED_ON = 16,
|
||||
/** Turn OFF a specified LED. */
|
||||
LED_CMD_TURN_LED_OFF = 17,
|
||||
SCE_LED_CMD_TURN_LED_OFF = 17,
|
||||
/** Switch the state of an LED. ON -> OFF, or OFF -> ON.*/
|
||||
LED_CMD_SWITCH_LED_STATE = 18,
|
||||
SCE_LED_CMD_SWITCH_LED_STATE = 18,
|
||||
/**
|
||||
* Setup a blink event for a LED. The settings for the blink event are set via the
|
||||
* ::SceLedConfiguration.
|
||||
*/
|
||||
LED_CMD_BLINK_LED = 19,
|
||||
SCE_LED_CMD_BLINK_LED = 19,
|
||||
};
|
||||
|
||||
/**
|
||||
* This structure represents a LED blink configuration. It needs to be specified
|
||||
* when using ::sceLedSetMode and the LED_MODE_BLINK / LED_MODE_SELECTIVE_EXEC
|
||||
* when using ::sceLedSetMode and the SCE_LED_MODE_BLINK / SCE_LED_MODE_SELECTIVE_EXEC
|
||||
* setting for the LED mode. A blink event contains an ON-/OFF-time for the target
|
||||
* LED, the total time of the event and the final LED state at the end of the event.
|
||||
*
|
||||
* Note: When using LED_MODE_BLINK, you don't need to set the first four structure
|
||||
* Note: When using SCE:LED_MODE_BLINK, you don't need to set the first four structure
|
||||
* members.
|
||||
*/
|
||||
typedef struct {
|
||||
/** This command should be used to register/execute a custom command. */
|
||||
u8 selectiveCmd;
|
||||
/** The number or executions of the specified <customCmd>.*/
|
||||
/** The number of executions of the specified <customCmd>.*/
|
||||
u8 numExecs;
|
||||
/** The custom LED command to execute. One of ::SceLedCmds. */
|
||||
u8 customCmd;
|
||||
@ -100,21 +100,21 @@ typedef struct {
|
||||
s32 offTime;
|
||||
/** The time of a blink period. Set to -1 for an infinite time period. */
|
||||
s32 blinkTime;
|
||||
/** The state of a LED at the end of the blink period. */
|
||||
/** The state of a LED at the end of the blink period. Either ::SCE_LED_MODE_OFF or ::SCE_LED_MODE_ON. */
|
||||
s32 endBlinkState;
|
||||
} SceLedConfiguration;
|
||||
|
||||
/**
|
||||
* Initialize the LED library, enable the PSP's LEDs and turn them ON.
|
||||
*
|
||||
* @return 0.
|
||||
* @return SCE_ERROR_OK.
|
||||
*/
|
||||
u32 sceLedInit(void);
|
||||
|
||||
/**
|
||||
* Terminate the LED library and disable the PSP's LEDs.
|
||||
*
|
||||
* @return 0.
|
||||
* @return SCE_ERROR_OK.
|
||||
*/
|
||||
u32 sceLedEnd(void);
|
||||
|
||||
@ -124,9 +124,9 @@ u32 sceLedEnd(void);
|
||||
* @param led The LED to set a mode for. One of ::ScePspLedTypes.
|
||||
* @param mode The mode to set for a LED. One of ::SceLedModes.
|
||||
* @param config Configuration settings for a LED. Is only used for the ::SceLedModes
|
||||
* LED_MODE_BLINK and LED_MODE_SELECTIVE_EXEC.
|
||||
* SCE_LED_MODE_BLINK and SCE_LED_MODE_SELECTIVE_EXEC.
|
||||
*
|
||||
* @return 0 on success.
|
||||
* @return SCE_ERROR_OK on success.
|
||||
*/
|
||||
s32 sceLedSetMode(s32 led, s32 mode, SceLedConfiguration *config);
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
/** Copyright (C) 2011, 2012 The uOFW team
|
||||
/** Copyright (C) 2011, 2012, 2013 The uOFW team
|
||||
See the file COPYING for copying permission.\n
|
||||
*/
|
||||
|
||||
@ -22,6 +22,15 @@
|
||||
/** The module is not a resident one, meaning it won't stay in memory and act as a resident library. */
|
||||
#define SCE_KERNEL_NO_RESIDENT (1)
|
||||
|
||||
/** Library number category minor. */
|
||||
#define LIBRARY_VERSION_MINOR (0)
|
||||
|
||||
/** Library number category major. */
|
||||
#define LIBRARY_VERSION_MAJOR (1)
|
||||
|
||||
/** Current number category size for libraries. */
|
||||
#define LIBRARY_VERSION_NUMBER_CATEGORY_SIZE (2)
|
||||
|
||||
/** The length of the old resident library entry table format (without the members unk16 - uk19). */
|
||||
#define LIBRARY_ENTRY_TABLE_OLD_LEN (4)
|
||||
|
||||
@ -157,7 +166,7 @@ typedef struct {
|
||||
* register another version of an already registered resident library, make sure that the new
|
||||
* library has a higher version than all its currently registered versions.
|
||||
*/
|
||||
u8 version[2]; //4
|
||||
u8 version[LIBRARY_VERSION_NUMBER_CATEGORY_SIZE]; //4
|
||||
/** The library's attributes. One or more of ::SceLibAttr. */
|
||||
s16 attribute; //6
|
||||
/**
|
||||
@ -195,7 +204,7 @@ typedef struct {
|
||||
* library shouldn't be higher than the version(s) of the corresponding resident library/libraries.
|
||||
* Linking won't be performed in such a case.
|
||||
*/
|
||||
u8 version[2]; //4
|
||||
u8 version[LIBRARY_VERSION_NUMBER_CATEGORY_SIZE]; //4
|
||||
/** The library's attributes. Can be set to either SCE_LIB_NO_SPECIAL_ATTR or SCE_LIB_WEAK_IMPORT. */
|
||||
u16 attribute; //6
|
||||
/**
|
||||
@ -244,7 +253,7 @@ typedef struct SceStubLibrary {
|
||||
/**
|
||||
* The version of the library. This member is set by the corresponding stub library entry table.
|
||||
*/
|
||||
u8 version[2]; //12
|
||||
u8 version[LIBRARY_VERSION_NUMBER_CATEGORY_SIZE]; //12
|
||||
/**
|
||||
* The library's attributes. This member is set by the corresponding stub library entry table.
|
||||
*/
|
||||
@ -296,7 +305,7 @@ typedef struct SceResidentLibrary {
|
||||
* The version of the library. This member is set by the corresponding resident library entry
|
||||
* table.
|
||||
*/
|
||||
u8 version[2]; //8
|
||||
u8 version[LIBRARY_VERSION_NUMBER_CATEGORY_SIZE]; //8
|
||||
/**
|
||||
* The library's attributes. This member is set by the corresponding resident library entry table.
|
||||
*/
|
||||
@ -399,7 +408,7 @@ typedef struct {
|
||||
/** Attributes. */
|
||||
u32 attr; //16
|
||||
/** Unknown. */
|
||||
s32 unk_20; //20
|
||||
s32 unk20; //20
|
||||
/** The size of the arguments passed to the module's entry function? */
|
||||
u32 argSize; //24
|
||||
SceUID argPartId; //28
|
||||
@ -594,7 +603,7 @@ typedef struct SceModule {
|
||||
* The version of the module. Consists of a major and minor part. There can be several modules
|
||||
* loaded with the same name and version.
|
||||
*/
|
||||
u8 version[2]; //6
|
||||
u8 version[MODULE_VERSION_NUMBER_CATEGORY_SIZE]; //6
|
||||
/** The module's name. There can be several modules loaded with the same name. */
|
||||
char modName[SCE_MODULE_NAME_LEN]; //8
|
||||
/** Unknown. */
|
||||
|
35
include/loadexec.h
Normal file
35
include/loadexec.h
Normal file
@ -0,0 +1,35 @@
|
||||
/* Copyright (C) 2011, 2012, 2013 The uOFW team
|
||||
See the file COPYING for copying permission.
|
||||
*/
|
||||
|
||||
#ifndef LOADEXEC_H
|
||||
#define LOADEXEC_H
|
||||
|
||||
/** Structure for LoadExecVSH* functions */
|
||||
typedef struct
|
||||
{
|
||||
/** Size of the structure in bytes */
|
||||
SceSize size;
|
||||
/** Size of the arguments string */
|
||||
SceSize args;
|
||||
/** Pointer to the arguments strings */
|
||||
void *argp;
|
||||
/** The key, usually "game", "updater" or "vsh" */
|
||||
const char *key;
|
||||
/** The size of the vshmain arguments */
|
||||
u32 vshmainArgs;
|
||||
/** vshmain arguments that will be passed to vshmain after the program has exited */
|
||||
void *vshmainArgp;
|
||||
/** "/kd/pspbtcnf_game.txt" or "/kd/pspbtcnf.txt" if not supplied (max. 256 chars) */
|
||||
char *configFile;
|
||||
/** An unknown string (max. 256 chars) probably used in 2nd stage of loadexec */
|
||||
u32 unk4;
|
||||
/** unknown flag default value = 0x10000 */
|
||||
u32 flags;
|
||||
u32 unkArgs;
|
||||
void *unkArgp;
|
||||
u32 opt11;
|
||||
} SceKernelLoadExecVSHParam;
|
||||
|
||||
#endif /* LOADEXEC_H */
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* Copyright (C) 2011, 2012 The uOFW team
|
||||
/* Copyright (C) 2011, 2012, 2013 The uOFW team
|
||||
See the file COPYING for copying permission.
|
||||
*/
|
||||
|
||||
@ -11,9 +11,8 @@
|
||||
|
||||
#include "common_header.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
/** The internal name of the MEMLMD module. */
|
||||
#define MEMLMD_MODULE_NAME "memlmd"
|
||||
|
||||
/**
|
||||
* Decrypts a module. Asynced mode.
|
||||
@ -86,10 +85,5 @@ s32 memlmd_6192F715(u8 *addr, u32 size);
|
||||
*/
|
||||
s32 memlmd_2F3D7E2D(void);
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* MEMLMD_H */
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* Copyright (C) 2011, 2012 The uOFW team
|
||||
/* Copyright (C) 2011, 2012, 2013 The uOFW team
|
||||
See the file COPYING for copying permission.
|
||||
*/
|
||||
|
||||
@ -14,3 +14,8 @@ enum SceApplicationType {
|
||||
int sceKernelSetInitCallback(void *, int, int);
|
||||
int sceKernelApplicationType(void);
|
||||
|
||||
int sceKernelRegisterChunk(int chunkId, int unk1);
|
||||
int sceKernelGetChunk(int chunkId);
|
||||
|
||||
void *InitForKernel_040C934B(void);
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* Copyright (C) 2011, 2012 The uOFW team
|
||||
/* Copyright (C) 2011, 2012, 2013 The uOFW team
|
||||
See the file COPYING for copying permission.
|
||||
*/
|
||||
|
||||
@ -16,20 +16,5 @@
|
||||
/* Accepts 0x08000000 - 0x0FFFFFFF, 0x48000000 - 0x4FFFFFFF, 0x88000000 - 0x8FFFFFFF and 0xA8000000 - 0xAFFFFFFF */
|
||||
#define ADDR_IS_RAM(addr) ((0x00220202 >> ((addr >> 27) & 0x1F)) & 1)
|
||||
|
||||
enum SceSysMemPartitionId {
|
||||
SCE_KERNEL_UNKNOWN_PARTITION = 0,
|
||||
SCE_KERNEL_PRIMARY_KERNEL_PARTITION = 1,
|
||||
SCE_KERNEL_PRIMARY_USER_PARTITION = 2,
|
||||
};
|
||||
|
||||
enum SceSysMemBlockType {
|
||||
SCE_KERNEL_SMEM_Low = 0,
|
||||
SCE_KERNEL_SMEM_High = 1,
|
||||
SCE_KERNEL_SMEM_Addr = 2
|
||||
};
|
||||
|
||||
SceUID sceKernelAllocPartitionMemory(SceUID partitionid, const char *name, s32 type, SceSize size, void *addr);
|
||||
s32 sceKernelFreePartitionMemory(SceUID uid);
|
||||
|
||||
#endif
|
||||
|
||||
|
@ -9,7 +9,7 @@
|
||||
|
||||
#include "common_header.h"
|
||||
|
||||
#include "sysmem_common.h"
|
||||
#include "sysmem_user.h"
|
||||
#include "loadcore.h"
|
||||
|
||||
typedef struct {
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* Copyright (C) 2011, 2012 The uOFW team
|
||||
/* Copyright (C) 2011, 2012, 2013 The uOFW team
|
||||
See the file COPYING for copying permission.
|
||||
*/
|
||||
|
||||
@ -14,17 +14,18 @@ typedef struct {
|
||||
s32 size;
|
||||
char *name;
|
||||
s32 typeMask;
|
||||
s32 (*handler)(s32 ev_id, char* ev_name, void* param, s32* result);
|
||||
s32 (*handler)(s32 eventId, char* eventName, void *param, s32 *result);
|
||||
s32 gp;
|
||||
s32 busy;
|
||||
SceBool busy;
|
||||
struct SceSysEventHandler *next;
|
||||
s32 reserved[9];
|
||||
} SceSysEventHandler;
|
||||
|
||||
s32 sceKernelUnregisterSysEventHandler(SceSysEventHandler *handler);
|
||||
s32 sceKernelSysEventDispatch(s32 ev_type_mask, s32 ev_id, char* ev_name, void* param, s32* result, s32 break_nonzero, SceSysEventHandler **break_handler);
|
||||
s32 sceKernelSysEventDispatch(s32 eventTypeMask, s32 eventId, char *eventName, void *param, s32 *result, s32 break_nonzero,
|
||||
SceSysEventHandler **break_handler);
|
||||
s32 sceKernelSysEventInit(void);
|
||||
s32 sceKernelIsRegisterSysEventHandler(SceSysEventHandler* handler);
|
||||
s32 sceKernelRegisterSysEventHandler(SceSysEventHandler* handler);
|
||||
s32 sceKernelIsRegisterSysEventHandler(SceSysEventHandler *handler);
|
||||
s32 sceKernelRegisterSysEventHandler(SceSysEventHandler *handler);
|
||||
SceSysEventHandler *sceKernelReferSysEventHandler(void);
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* Copyright (C) 2011, 2012 The uOFW team
|
||||
/* Copyright (C) 2011, 2012, 2013 The uOFW team
|
||||
See the file COPYING for copying permission.
|
||||
*/
|
||||
|
||||
@ -9,15 +9,25 @@
|
||||
|
||||
#include "sysmem_common.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
enum SceSysMemPartitionId {
|
||||
SCE_KERNEL_UNKNOWN_PARTITION = 0,
|
||||
SCE_KERNEL_PRIMARY_KERNEL_PARTITION = 1,
|
||||
SCE_KERNEL_PRIMARY_USER_PARTITION = 2,
|
||||
SCE_KERNEL_PRIMARY_ME_PARTITION = 3,
|
||||
SCE_KERNEL_SECONDARY_KERNEL_PARTITION = 4,
|
||||
SCE_KERNEL_SECONDARY_USER_PARTITION = 5,
|
||||
};
|
||||
|
||||
enum SceSysMemBlockType {
|
||||
SCE_KERNEL_SMEM_Low = 0,
|
||||
SCE_KERNEL_SMEM_High = 1,
|
||||
SCE_KERNEL_SMEM_Addr = 2
|
||||
};
|
||||
|
||||
SceUID sceKernelAllocPartitionMemory(SceUID partitionid, const char *name, s32 type, SceSize size, void *addr);
|
||||
s32 sceKernelFreePartitionMemory(SceUID uid);
|
||||
|
||||
void *sceKernelGetBlockHeadAddr(SceUID uid);
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* SYSMEM_USER_H */
|
||||
|
@ -27,7 +27,7 @@
|
||||
* @param common Pass the common argument specified in ::sceSTimerSetHandler().
|
||||
* @param unk Unknown.
|
||||
*
|
||||
* Typically return -1.
|
||||
* Typically returns -1.
|
||||
*/
|
||||
typedef s32 (*SceSysTimerCb)(s32 timerId, s32 count, void *common, s32 unk);
|
||||
|
||||
@ -87,11 +87,11 @@ s32 sceSTimerStopCount(s32 timerId);
|
||||
|
||||
/**
|
||||
* Set the prescale of a hardware timer. It can be only set on timers which are in the "not in use" state.\n
|
||||
* The input signal is divided into the resulting ratio. The ratio has to be greater than 1/11.
|
||||
* The input signal is divided into the resulting ratio. The ratio has to be less than 1/11.
|
||||
*
|
||||
* @param timerId The ID of the timer to set the prescale.
|
||||
* @param numerator The numerator of the prescale. Must not be 0.
|
||||
* @param denominator The denumerator of the prescale. Must not be 0.
|
||||
* @param denominator The denominator of the prescale. Must not be 0.
|
||||
*
|
||||
* @return SCE_ERROR_OK on success.
|
||||
*/
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* Copyright (C) 2011, 2012 The uOFW team
|
||||
/* Copyright (C) 2011, 2012, 2013 The uOFW team
|
||||
See the file COPYING for copying permission.
|
||||
*/
|
||||
|
||||
@ -17,6 +17,11 @@ typedef struct
|
||||
SceUID stackMpid;
|
||||
} SceKernelThreadOptParam;
|
||||
|
||||
/* thread priority */
|
||||
#define SCE_KERNEL_USER_HIGHEST_PRIORITY 16
|
||||
#define SCE_KERNEL_MODULE_INIT_PRIORITY 32
|
||||
#define SCE_KERNEL_USER_LOWEST_PRIORITY 111
|
||||
|
||||
SceUID sceKernelCreateThread(const char *name, SceKernelThreadEntry entry, int initPriority,
|
||||
int stackSize, SceUInt attr, SceKernelThreadOptParam *option);
|
||||
int sceKernelDeleteThread(SceUID thid);
|
||||
|
@ -54,11 +54,11 @@ SCE_SDK_VERSION(SDK_VERSION);
|
||||
#define PSP_CY27040_REG_COUNT (3)
|
||||
|
||||
/* In reg1, used to manage the audio frequency */
|
||||
#define PSP_CLOCK_AUDIO_FREQ (1)
|
||||
#define PSP_CLOCK_AUDIO_FREQ (1)
|
||||
/* In reg1, used to enable/disable the lepton DSP */
|
||||
#define PSP_CLOCK_LEPTON (8)
|
||||
#define PSP_CLOCK_LEPTON (8)
|
||||
/* In reg1, used to enable/disable audio */
|
||||
#define PSP_CLOCK_AUDIO (16)
|
||||
#define PSP_CLOCK_AUDIO (16)
|
||||
|
||||
//0x000008F0
|
||||
typedef struct {
|
||||
@ -74,6 +74,11 @@ typedef struct {
|
||||
u16 padding;
|
||||
} ClockgenContext;
|
||||
|
||||
static s32 _sceClockgenSysEventHandler(s32 eventId, char *eventName __attribute__((unused)), void *param __attribute__((unused)),
|
||||
s32 *result __attribute__((unused)));
|
||||
static s32 _sceClockgenSetControl1(s32 bus, SceBool mode);
|
||||
static s32 _cy27040_write_register(u8 idx, u8 val);
|
||||
|
||||
ClockgenContext g_Cy27040 = {
|
||||
.mutex = -1,
|
||||
.protocol = 0,
|
||||
@ -85,16 +90,16 @@ ClockgenContext g_Cy27040 = {
|
||||
SceSysEventHandler g_ClockGenSysEv = {
|
||||
.size = sizeof(SceSysEventHandler),
|
||||
.name = "SceClockgen",
|
||||
.typeMask = 0x00FFFF00,
|
||||
.typeMask = SCE_SUSPEND_EVENTS | SCE_RESUME_EVENTS,
|
||||
.handler = _sceClockgenSysEventHandler,
|
||||
.gp = 0,
|
||||
.busy = 0,
|
||||
.busy = SCE_FALSE,
|
||||
.next = NULL,
|
||||
.reserved = {0}
|
||||
};
|
||||
|
||||
//0x00000000
|
||||
s32 sceClockgenSetup() //sceClockgen_driver_50F22765
|
||||
s32 sceClockgenSetup(void)
|
||||
{
|
||||
u8 trsm[16];
|
||||
u8 recv[16];
|
||||
@ -113,16 +118,13 @@ s32 sceClockgenSetup() //sceClockgen_driver_50F22765
|
||||
trsm[0] = PSP_CY27040_CMD_REG(i);
|
||||
|
||||
/* Send and receive data through the I2C bus. */
|
||||
|
||||
//sceI2c_driver_47BDEAAA
|
||||
ret = sceI2cMasterTransmitReceive(
|
||||
PSP_CY27040_I2C_ADDR, trsm, 1,
|
||||
PSP_CY27040_I2C_ADDR, recv, 1
|
||||
);
|
||||
|
||||
if (ret < 0) {
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
}
|
||||
|
||||
g_Cy27040.curReg[i] = recv[0];
|
||||
g_Cy27040.oldReg[i] = recv[0];
|
||||
@ -134,16 +136,13 @@ s32 sceClockgenSetup() //sceClockgen_driver_50F22765
|
||||
trsm[0] = PSP_CY27040_CMD_ALL_REGS;
|
||||
|
||||
/* Send and receive data through the I2C bus. */
|
||||
|
||||
//sceI2c_driver_47BDEAAA
|
||||
ret = sceI2cMasterTransmitReceive(
|
||||
PSP_CY27040_I2C_ADDR, trsm, 1,
|
||||
PSP_CY27040_I2C_ADDR, recv, 16
|
||||
);
|
||||
|
||||
if (ret < 0) {
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
}
|
||||
|
||||
for (i = 0; (i < PSP_CY27040_REG_COUNT) && (i < recv[0]); i++) {
|
||||
g_Cy27040.curReg[i] = recv[i + 1];
|
||||
@ -155,7 +154,7 @@ s32 sceClockgenSetup() //sceClockgen_driver_50F22765
|
||||
}
|
||||
|
||||
//0x000000F8
|
||||
s32 sceClockgenSetSpectrumSpreading(s32 mode) //sceClockgen_driver_C9AF3102
|
||||
s32 sceClockgenSetSpectrumSpreading(s32 mode)
|
||||
{
|
||||
s32 regSS;
|
||||
s32 ret;
|
||||
@ -167,9 +166,8 @@ s32 sceClockgenSetSpectrumSpreading(s32 mode) //sceClockgen_driver_C9AF3102
|
||||
regSS = g_Cy27040.oldReg[PSP_CY27040_REG_SS] & 0x7;
|
||||
ret = mode;
|
||||
|
||||
if (regSS == (g_Cy27040.curReg[PSP_CY27040_REG_SS] & 0x7)) {
|
||||
if (regSS == (g_Cy27040.curReg[PSP_CY27040_REG_SS] & 0x7))
|
||||
return ret;
|
||||
}
|
||||
}
|
||||
else {
|
||||
/* Choose a value according to the Cy27040 revision. */
|
||||
@ -184,20 +182,16 @@ s32 sceClockgenSetSpectrumSpreading(s32 mode) //sceClockgen_driver_C9AF3102
|
||||
if (mode < 2) {
|
||||
regSS = 0;
|
||||
ret = 0;
|
||||
}
|
||||
else if (mode < 7) {
|
||||
} else if (mode < 7) {
|
||||
regSS = 1;
|
||||
ret = 5;
|
||||
}
|
||||
else if (mode < 15) {
|
||||
} else if (mode < 15) {
|
||||
regSS = 2;
|
||||
ret = 10;
|
||||
}
|
||||
else if (mode < 25) {
|
||||
} else if (mode < 25) {
|
||||
regSS = 4;
|
||||
ret = 20;
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
regSS = 6;
|
||||
ret = 30;
|
||||
}
|
||||
@ -206,28 +200,22 @@ s32 sceClockgenSetSpectrumSpreading(s32 mode) //sceClockgen_driver_C9AF3102
|
||||
if (mode < 2) {
|
||||
regSS = 0;
|
||||
ret = 0;
|
||||
}
|
||||
else if (mode < 7) {
|
||||
} else if (mode < 7) {
|
||||
regSS = 1;
|
||||
ret = 5;
|
||||
}
|
||||
else if (mode < 12) {
|
||||
} else if (mode < 12) {
|
||||
regSS = 2;
|
||||
ret = 10;
|
||||
}
|
||||
else if (mode < 17) {
|
||||
} else if (mode < 17) {
|
||||
regSS = 3;
|
||||
ret = 15;
|
||||
}
|
||||
else if (mode < 22) {
|
||||
} else if (mode < 22) {
|
||||
regSS = 4;
|
||||
ret = 20;
|
||||
}
|
||||
else if (mode < 27) {
|
||||
} else if (mode < 27) {
|
||||
regSS = 5;
|
||||
ret = 25;
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
regSS = 6;
|
||||
ret = 30;
|
||||
}
|
||||
@ -240,17 +228,15 @@ s32 sceClockgenSetSpectrumSpreading(s32 mode) //sceClockgen_driver_C9AF3102
|
||||
/* Try to update the spread-spectrum register. */
|
||||
|
||||
res = sceKernelLockMutex(g_Cy27040.mutex, 1, 0);
|
||||
if (res < 0) {
|
||||
if (res < 0)
|
||||
return res;
|
||||
}
|
||||
|
||||
g_Cy27040.curReg[PSP_CY27040_REG_SS] = (regSS & 7) | (g_Cy27040.curReg[PSP_CY27040_REG_SS] & ~7);
|
||||
res = _cy27040_write_register(PSP_CY27040_REG_SS, g_Cy27040.curReg[PSP_CY27040_REG_SS]);
|
||||
|
||||
sceKernelUnlockMutex(g_Cy27040.mutex, 1);
|
||||
if (res < 0) {
|
||||
if (res < 0)
|
||||
return res;
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
@ -277,9 +263,8 @@ s32 _sceClockgenModuleRebootBefore(SceSize args __attribute__((unused)), void *a
|
||||
|
||||
/* Spread-spectrum mode changed since its initial state, restore it */
|
||||
|
||||
if ((curRegSS & 7) != (oldRegSS & 7)) {
|
||||
if ((curRegSS & 7) != (oldRegSS & 7))
|
||||
_cy27040_write_register(PSP_CY27040_REG_SS, (curRegSS & ~7) | (oldRegSS & 7));
|
||||
}
|
||||
|
||||
sceClockgenEnd();
|
||||
|
||||
@ -287,23 +272,18 @@ s32 _sceClockgenModuleRebootBefore(SceSize args __attribute__((unused)), void *a
|
||||
}
|
||||
|
||||
//0x00000398
|
||||
s32 sceClockgenInit() //sceClockgen_driver_29160F5D
|
||||
s32 sceClockgenInit(void)
|
||||
{
|
||||
s32 mutexId;
|
||||
|
||||
/* Set the I2C bus speed */
|
||||
|
||||
//sceI2c_driver_62C7E1E4
|
||||
sceI2cSetClock(4, 4);
|
||||
|
||||
/* Create the mutex and register the sysevent handler */
|
||||
|
||||
//ThreadManForKernel_B7D098C6
|
||||
mutexId = sceKernelCreateMutex("SceClockgen", 1, 0, 0);
|
||||
|
||||
if (mutexId < 0) {
|
||||
if (mutexId < 0)
|
||||
return mutexId;
|
||||
}
|
||||
|
||||
g_Cy27040.mutex = mutexId;
|
||||
|
||||
@ -313,7 +293,7 @@ s32 sceClockgenInit() //sceClockgen_driver_29160F5D
|
||||
}
|
||||
|
||||
//0x000003EC
|
||||
s32 sceClockgenEnd() //sceClockgen_driver_36F9B49D
|
||||
s32 sceClockgenEnd(void)
|
||||
{
|
||||
/* Delete the mutex and unregister the sysevent handler */
|
||||
|
||||
@ -329,7 +309,7 @@ s32 sceClockgenEnd() //sceClockgen_driver_36F9B49D
|
||||
}
|
||||
|
||||
//0x00000438
|
||||
s32 sceClockgenSetProtocol(u32 prot) //sceClockgen_driver_3F6B7C6B
|
||||
s32 sceClockgenSetProtocol(u32 prot)
|
||||
{
|
||||
g_Cy27040.protocol = prot;
|
||||
|
||||
@ -337,23 +317,22 @@ s32 sceClockgenSetProtocol(u32 prot) //sceClockgen_driver_3F6B7C6B
|
||||
}
|
||||
|
||||
//0x00000448
|
||||
s32 sceClockgenGetRevision() //sceClockgen_driver_CE36529C
|
||||
s32 sceClockgenGetRevision(void)
|
||||
{
|
||||
return g_Cy27040.curReg[PSP_CY27040_REG_REVISION];
|
||||
}
|
||||
|
||||
//0x00000454
|
||||
s32 sceClockgenGetRegValue(u32 idx) //sceClockgen_driver_0FD28D8B
|
||||
s32 sceClockgenGetRegValue(u32 idx)
|
||||
{
|
||||
if (idx >= PSP_CY27040_REG_COUNT) {
|
||||
if (idx >= PSP_CY27040_REG_COUNT)
|
||||
return SCE_ERROR_INVALID_INDEX;
|
||||
}
|
||||
|
||||
return g_Cy27040.curReg[idx];
|
||||
}
|
||||
|
||||
//0x0000047C
|
||||
s32 sceClockgenAudioClkSetFreq(u32 freq) //sceClockgen_driver_DAB6E612
|
||||
s32 sceClockgenAudioClkSetFreq(u32 freq)
|
||||
{
|
||||
/* Lower sample rates are supported because they are divisible by these */
|
||||
|
||||
@ -368,54 +347,50 @@ s32 sceClockgenAudioClkSetFreq(u32 freq) //sceClockgen_driver_DAB6E612
|
||||
}
|
||||
|
||||
//0x000004BC
|
||||
s32 sceClockgenAudioClkEnable() //sceClockgen_driver_A1D23B2C
|
||||
s32 sceClockgenAudioClkEnable(void)
|
||||
{
|
||||
return _sceClockgenSetControl1(PSP_CLOCK_AUDIO, 1);
|
||||
}
|
||||
|
||||
//0x000004DC
|
||||
s32 sceClockgenAudioClkDisable() //sceClockgen_driver_DED4C698
|
||||
s32 sceClockgenAudioClkDisable(void)
|
||||
{
|
||||
return _sceClockgenSetControl1(PSP_CLOCK_AUDIO, 0);
|
||||
}
|
||||
|
||||
//0x000004FC
|
||||
s32 sceClockgenLeptonClkEnable() //sceClockgen_driver_7FF82F6F
|
||||
s32 sceClockgenLeptonClkEnable(void)
|
||||
{
|
||||
return _sceClockgenSetControl1(PSP_CLOCK_LEPTON, 1);
|
||||
}
|
||||
|
||||
//0x0000051C
|
||||
s32 sceClockgenLeptonClkDisable() //sceClockgen_driver_DBE5F283
|
||||
s32 sceClockgenLeptonClkDisable(void)
|
||||
{
|
||||
return _sceClockgenSetControl1(PSP_CLOCK_LEPTON, 0);
|
||||
}
|
||||
|
||||
//0x0000053C
|
||||
s32 _sceClockgenSysEventHandler(
|
||||
s32 ev_id,
|
||||
char *ev_name __attribute__((unused)),
|
||||
static s32 _sceClockgenSysEventHandler(
|
||||
s32 eventId,
|
||||
char *eventName __attribute__((unused)),
|
||||
void *param __attribute__((unused)),
|
||||
s32 *result __attribute__((unused)))
|
||||
{
|
||||
if (ev_id == 0x10000) {
|
||||
if (eventId == 0x10000) {
|
||||
/* Sleep event? Spread-spectrum and clock control are blocked. */
|
||||
|
||||
//ThreadManForKernel_0DDCD2C9
|
||||
sceKernelTryLockMutex(g_Cy27040.mutex, 1);
|
||||
|
||||
return SCE_ERROR_OK;
|
||||
}
|
||||
|
||||
if (ev_id < 0x10000) {
|
||||
if (eventId < 0x10000) {
|
||||
/* Unknown event. May be used for debugging. */
|
||||
|
||||
return SCE_ERROR_OK;
|
||||
}
|
||||
|
||||
if (ev_id == 0x100000) {
|
||||
if (eventId == 0x100000) {
|
||||
/* Resume event? Lepton is disabled. Other settings are restored and controls are unblocked. */
|
||||
|
||||
g_Cy27040.curReg[PSP_CY27040_REG_CLOCK] &= ~PSP_CLOCK_LEPTON;
|
||||
|
||||
_cy27040_write_register(PSP_CY27040_REG_CLOCK, g_Cy27040.curReg[PSP_CY27040_REG_CLOCK]);
|
||||
@ -428,17 +403,15 @@ s32 _sceClockgenSysEventHandler(
|
||||
}
|
||||
|
||||
//0x000005DC
|
||||
s32 _sceClockgenSetControl1(s32 bus, SceBool mode)
|
||||
static s32 _sceClockgenSetControl1(s32 bus, SceBool mode)
|
||||
{
|
||||
s32 ret;
|
||||
s32 regClk;
|
||||
|
||||
//ThreadManForKernel_B011B11F
|
||||
ret = sceKernelLockMutex(g_Cy27040.mutex, 1, 0);
|
||||
|
||||
if (ret < 0) {
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
}
|
||||
|
||||
regClk = g_Cy27040.curReg[PSP_CY27040_REG_CLOCK];
|
||||
ret = (regClk & bus) > 0;
|
||||
@ -462,14 +435,13 @@ s32 _sceClockgenSetControl1(s32 bus, SceBool mode)
|
||||
_cy27040_write_register(PSP_CY27040_REG_CLOCK, regClk);
|
||||
}
|
||||
|
||||
//ThreadManForKernel_6B30100F
|
||||
sceKernelUnlockMutex(g_Cy27040.mutex, 1);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
//0x00000680
|
||||
s32 _cy27040_write_register(u8 idx, u8 val)
|
||||
static s32 _cy27040_write_register(u8 idx, u8 val)
|
||||
{
|
||||
u8 trsm[16];
|
||||
s32 ret;
|
||||
@ -479,9 +451,8 @@ s32 _cy27040_write_register(u8 idx, u8 val)
|
||||
trsm[0] = PSP_CY27040_CMD_REG(idx);
|
||||
trsm[1] = val;
|
||||
|
||||
if (idx >= PSP_CY27040_REG_COUNT) {
|
||||
if (idx >= PSP_CY27040_REG_COUNT)
|
||||
return SCE_ERROR_INVALID_INDEX;
|
||||
}
|
||||
|
||||
/* Send data through the I2C bus. */
|
||||
|
||||
@ -490,9 +461,8 @@ s32 _cy27040_write_register(u8 idx, u8 val)
|
||||
PSP_CY27040_I2C_ADDR, trsm, 2
|
||||
);
|
||||
|
||||
if (ret < 0) {
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
}
|
||||
|
||||
return SCE_ERROR_OK;
|
||||
}
|
||||
|
@ -45,9 +45,6 @@ SCE_SDK_VERSION(SDK_VERSION);
|
||||
#define USER_MODE (0)
|
||||
#define KERNEL_MODE (1)
|
||||
|
||||
#define FALSE (0)
|
||||
#define TRUE (1)
|
||||
|
||||
#define SVALALIGN64(v) ((v) - (((((u32)((s32)(v) >> 31)) >> 26) + (v)) & 0xFFFFFFC0))
|
||||
|
||||
/*
|
||||
@ -290,7 +287,7 @@ typedef struct {
|
||||
*/
|
||||
typedef struct {
|
||||
/* Button is newly pressed (it wasn't pressed one frame before the
|
||||
* current one.
|
||||
* current one).
|
||||
*/
|
||||
u32 btnMake;
|
||||
/* Stop of button press. It was pressed one frame before the current
|
||||
@ -359,7 +356,7 @@ typedef struct {
|
||||
u8 sysconBusyIntr2;
|
||||
/** Reserved. */
|
||||
u8 resv[2];
|
||||
/* TRUE = reset the PSP's idle timer, FALSE = don't reset it. */
|
||||
/* SCE_TRUE = reset the PSP's idle timer, SCE_FALSE = don't reset it. */
|
||||
u8 cancelIdleTimer;
|
||||
/* Poll mode of the controller. One of ::SceCtrlPadPollMode. */
|
||||
u8 pollMode;
|
||||
@ -500,7 +497,7 @@ SceSysEventHandler g_ctrlSysEvent = {
|
||||
.typeMask = SCE_SUSPEND_EVENTS | SCE_RESUME_EVENTS,
|
||||
.handler = _sceCtrlSysEventHandler,
|
||||
.gp = 0,
|
||||
.busy = FALSE,
|
||||
.busy = SCE_FALSE,
|
||||
.next = NULL,
|
||||
.reserved = {
|
||||
[0] = 0,
|
||||
@ -1257,8 +1254,8 @@ static s32 _sceCtrlVblankIntr(s32 subIntNm __attribute__((unused)), void *arg __
|
||||
* choice (and not the custom user timer handler).
|
||||
*/
|
||||
if (g_ctrl.updateCycle == 0) {
|
||||
if (g_ctrl.sysconBusyIntr1 == FALSE && g_ctrl.pollMode == SCE_CTRL_POLL_ACTIVE) {
|
||||
g_ctrl.sysconBusyIntr1 = TRUE;
|
||||
if (g_ctrl.sysconBusyIntr1 == SCE_FALSE && g_ctrl.pollMode == SCE_CTRL_POLL_ACTIVE) {
|
||||
g_ctrl.sysconBusyIntr1 = SCE_TRUE;
|
||||
|
||||
/* Specify the requested controller device input data. */
|
||||
if ((g_ctrl.samplingMode[USER_MODE] | g_ctrl.samplingMode[KERNEL_MODE]) == SCE_CTRL_INPUT_DIGITAL_ONLY)
|
||||
@ -1269,14 +1266,14 @@ static s32 _sceCtrlVblankIntr(s32 subIntNm __attribute__((unused)), void *arg __
|
||||
g_ctrl.sysPacket[0].tx[PSP_SYSCON_TX_LEN] = 2;
|
||||
status = sceSysconCmdExecAsync(&g_ctrl.sysPacket[0], 1, _sceCtrlSysconCmdIntr1, NULL);
|
||||
if (status < SCE_ERROR_OK)
|
||||
g_ctrl.sysconBusyIntr1 = FALSE;
|
||||
g_ctrl.sysconBusyIntr1 = SCE_FALSE;
|
||||
}
|
||||
else {
|
||||
sceKernelSetAlarm(CTRL_ALARM_START_TIME, _sceCtrlDummyAlarm, NULL);
|
||||
}
|
||||
}
|
||||
if (g_ctrl.cancelIdleTimer != FALSE) {
|
||||
g_ctrl.cancelIdleTimer = FALSE;
|
||||
if (g_ctrl.cancelIdleTimer != SCE_FALSE) {
|
||||
g_ctrl.cancelIdleTimer = SCE_FALSE;
|
||||
sceKernelPowerTick(SCE_KERNEL_POWER_TICK_DEFAULT);
|
||||
}
|
||||
sceKernelCpuResumeIntr(intrState);
|
||||
@ -1312,8 +1309,8 @@ static s32 _sceCtrlTimerIntr(s32 timerId __attribute__((unused)), s32 unused1 __
|
||||
* (and not the VBlank interrupt handler).
|
||||
*/
|
||||
if (g_ctrl.updateCycle != 0) {
|
||||
if ((g_ctrl.sysconBusyIntr1 == FALSE) && (g_ctrl.pollMode == SCE_CTRL_POLL_ACTIVE)) {
|
||||
g_ctrl.sysconBusyIntr1 = TRUE;
|
||||
if ((g_ctrl.sysconBusyIntr1 == SCE_FALSE) && (g_ctrl.pollMode == SCE_CTRL_POLL_ACTIVE)) {
|
||||
g_ctrl.sysconBusyIntr1 = SCE_TRUE;
|
||||
|
||||
/* Specify the requested controller device input data. */
|
||||
if (g_ctrl.samplingMode[USER_MODE] != SCE_CTRL_INPUT_DIGITAL_ONLY)
|
||||
@ -1322,15 +1319,15 @@ static s32 _sceCtrlTimerIntr(s32 timerId __attribute__((unused)), s32 unused1 __
|
||||
g_ctrl.sysPacket[0].tx[PSP_SYSCON_TX_CMD] = sysconCtrlCmd;
|
||||
status = sceSysconCmdExecAsync(&g_ctrl.sysPacket[0], 1, _sceCtrlSysconCmdIntr1, NULL);
|
||||
if (status < SCE_ERROR_OK)
|
||||
g_ctrl.sysconBusyIntr1 = FALSE;
|
||||
g_ctrl.sysconBusyIntr1 = SCE_FALSE;
|
||||
}
|
||||
else {
|
||||
sceKernelSetAlarm(CTRL_ALARM_START_TIME, _sceCtrlDummyAlarm, NULL);
|
||||
}
|
||||
}
|
||||
|
||||
if (g_ctrl.cancelIdleTimer != FALSE) {
|
||||
g_ctrl.cancelIdleTimer = FALSE;
|
||||
if (g_ctrl.cancelIdleTimer != SCE_FALSE) {
|
||||
g_ctrl.cancelIdleTimer = SCE_FALSE;
|
||||
sceKernelPowerTick(SCE_KERNEL_POWER_TICK_DEFAULT);
|
||||
}
|
||||
|
||||
@ -1359,7 +1356,7 @@ static s32 _sceCtrlSysconCmdIntr1(SceSysconPacket *sysPacket, void *argp __attri
|
||||
u32 idleResetButtons;
|
||||
|
||||
curButtons = 0;
|
||||
g_ctrl.sysconBusyIntr1 = FALSE;
|
||||
g_ctrl.sysconBusyIntr1 = SCE_FALSE;
|
||||
|
||||
if (g_ctrl.sysconTransfersLeft > 0)
|
||||
g_ctrl.sysconTransfersLeft--;
|
||||
@ -1441,7 +1438,7 @@ static s32 _sceCtrlSysconCmdIntr1(SceSysconPacket *sysPacket, void *argp __attri
|
||||
g_ctrl.analogY = analogY;
|
||||
_sceCtrlUpdateButtons(curButtons, analogX, analogY);
|
||||
|
||||
if (g_ctrl.cancelIdleTimer == FALSE) {
|
||||
if (g_ctrl.cancelIdleTimer == SCE_FALSE) {
|
||||
newButtons = prevButtons ^ curButtons;
|
||||
if ((curButtons & SCE_CTRL_HOLD) == 0) {
|
||||
oneTimeIdleResetButtons = g_ctrl.oneTimeIdleResetButtons;
|
||||
@ -1470,25 +1467,25 @@ static s32 _sceCtrlSysconCmdIntr1(SceSysconPacket *sysPacket, void *argp __attri
|
||||
CTRL_ANALOG_PAD_CENTER_VALUE : aYCenterOffset;
|
||||
|
||||
if (aXCenterOffset >= idleVal || aYCenterOffset >= idleVal)
|
||||
g_ctrl.cancelIdleTimer = TRUE;
|
||||
g_ctrl.cancelIdleTimer = SCE_TRUE;
|
||||
}
|
||||
}
|
||||
else {
|
||||
g_ctrl.cancelIdleTimer = TRUE;
|
||||
g_ctrl.cancelIdleTimer = SCE_TRUE;
|
||||
}
|
||||
}
|
||||
sampling = (*(u16 *)g_ctrl.samplingMode) != 0;
|
||||
sampling = (g_ctrl.cableTypeReq != 0) ? (sampling | 2) : sampling;
|
||||
|
||||
if (sampling != g_ctrl.unk15 && (g_ctrl.sysconBusyIntr2 == FALSE)) {
|
||||
g_ctrl.sysconBusyIntr2 = TRUE;
|
||||
if (sampling != g_ctrl.unk15 && (g_ctrl.sysconBusyIntr2 == SCE_FALSE)) {
|
||||
g_ctrl.sysconBusyIntr2 = SCE_TRUE;
|
||||
g_ctrl.sysPacket[1].tx[PSP_SYSCON_TX_CMD] = PSP_SYSCON_CMD_CTRL_ANALOG_XY_POLLING;
|
||||
g_ctrl.sysPacket[1].tx[PSP_SYSCON_TX_LEN] = 3;
|
||||
g_ctrl.sysPacket[1].tx[PSP_SYSCON_TX_DATA(0)] = sampling;
|
||||
|
||||
status = sceSysconCmdExecAsync(&g_ctrl.sysPacket[1], 0, _sceCtrlSysconCmdIntr2, NULL);
|
||||
if (status < SCE_ERROR_OK)
|
||||
g_ctrl.sysconBusyIntr2 = FALSE;
|
||||
g_ctrl.sysconBusyIntr2 = SCE_FALSE;
|
||||
}
|
||||
|
||||
/* Set the event flag to indicate a finished update interval. */
|
||||
@ -1501,7 +1498,7 @@ static s32 _sceCtrlSysconCmdIntr2(SceSysconPacket *packet __attribute__((unused)
|
||||
{
|
||||
g_ctrl.cableTypeReq = 0;
|
||||
g_ctrl.unk15 = g_ctrl.sysPacket[1].tx[PSP_SYSCON_TX_DATA(0)] & 0x1;
|
||||
g_ctrl.sysconBusyIntr2 = FALSE;
|
||||
g_ctrl.sysconBusyIntr2 = SCE_FALSE;
|
||||
|
||||
return SCE_ERROR_OK;
|
||||
}
|
||||
@ -1621,14 +1618,14 @@ static s32 _sceCtrlUpdateButtons(u32 pureButtons, u8 aX, u8 aY)
|
||||
ctrlKernelBufExt->rsrv[1] = -128;
|
||||
}
|
||||
else {
|
||||
if (g_ctrl.cancelIdleTimer == FALSE) {
|
||||
if (g_ctrl.cancelIdleTimer == SCE_FALSE) {
|
||||
res = (ctrlKernelBufExt->buttons ^ g_ctrl.prevKernelButtons[i]) | ctrlKernelBufExt->buttons;
|
||||
res &= 0x1FFFF;
|
||||
g_ctrl.prevKernelButtons[i] = ctrlKernelBufExt->buttons;
|
||||
if (res != 0)
|
||||
g_ctrl.cancelIdleTimer = TRUE;
|
||||
g_ctrl.cancelIdleTimer = SCE_TRUE;
|
||||
}
|
||||
if (g_ctrl.cancelIdleTimer == FALSE && g_ctrl.samplingMode[USER_MODE] == SCE_CTRL_INPUT_DIGITAL_ANALOG) {
|
||||
if (g_ctrl.cancelIdleTimer == SCE_FALSE && g_ctrl.samplingMode[USER_MODE] == SCE_CTRL_INPUT_DIGITAL_ANALOG) {
|
||||
aXCenterOffset = pspMax(ctrlKernelBufExt->aX - CTRL_ANALOG_PAD_CENTER_VALUE,
|
||||
-(ctrlKernelBufExt->aX - CTRL_ANALOG_PAD_CENTER_VALUE));
|
||||
tmpAnalogX = aXCenterOffset;
|
||||
@ -1661,7 +1658,7 @@ static s32 _sceCtrlUpdateButtons(u32 pureButtons, u8 aX, u8 aY)
|
||||
|
||||
if (aYCenterOffset >= minIdleReset || aXCenterOffset >= minIdleReset ||
|
||||
aYCenterOffset2 >= minIdleReset || aXCenterOffset2 >= minIdleReset)
|
||||
g_ctrl.cancelIdleTimer = TRUE;
|
||||
g_ctrl.cancelIdleTimer = SCE_TRUE;
|
||||
}
|
||||
}
|
||||
ctrlUserBufExt = (SceCtrlDataExt *)g_ctrl.userModeData.sceCtrlBuf[1] + i;
|
||||
|
@ -40,8 +40,6 @@ SCE_MODULE_BOOTSTART("_sceLedModuleStart");
|
||||
SCE_MODULE_REBOOT_BEFORE("_sceLedModuleRebootBefore");
|
||||
SCE_SDK_VERSION(SDK_VERSION);
|
||||
|
||||
#define FALSE (0)
|
||||
|
||||
/* Highest possible LED mode. */
|
||||
#define LED_MODE_MAX (3)
|
||||
|
||||
@ -130,7 +128,7 @@ SceSysEventHandler g_LedSysEv = {
|
||||
.typeMask = SCE_SUSPEND_EVENTS | SCE_RESUME_EVENTS,
|
||||
.handler = _sceLedSysEventHandler,
|
||||
.gp = 0,
|
||||
.busy = FALSE,
|
||||
.busy = SCE_FALSE,
|
||||
.next = NULL,
|
||||
.reserved = {
|
||||
[0] = 0,
|
||||
@ -192,7 +190,7 @@ u32 sceLedInit(void)
|
||||
val = (btStatus == 0) ? 0 : val;
|
||||
|
||||
if (val != 0) {
|
||||
sceLedSetMode(PSP_LED_TYPE_BT, LED_MODE_ON, NULL);
|
||||
sceLedSetMode(PSP_LED_TYPE_BT, SCE_LED_MODE_ON, NULL);
|
||||
continue;
|
||||
}
|
||||
else if (g_Led[i].displayMode == LED_ON_ACTIVITY_ON) {
|
||||
@ -215,7 +213,7 @@ u32 sceLedInit(void)
|
||||
|
||||
/* Turn ON all PSP hardware LEDs. */
|
||||
for (i = 0; i < g_iMaxLeds; i++)
|
||||
sceSysconCtrlLED(g_Led[i].ledId, LED_MODE_ON);
|
||||
sceSysconCtrlLED(g_Led[i].ledId, SCE_LED_MODE_ON);
|
||||
|
||||
sceKernelRegisterSubIntrHandler(SCE_VBLANK_INT, 0x19, _sceLedVblankInterrupt, NULL);
|
||||
sceKernelEnableSubIntr(SCE_VBLANK_INT, 0x19);
|
||||
@ -234,7 +232,7 @@ u32 sceLedEnd(void)
|
||||
/* Disable the PSP hardware LEDs. */
|
||||
for (i = 0; i < g_iMaxLeds; i++) {
|
||||
if (i == PSP_LED_TYPE_BT) {
|
||||
if (g_Led[i].activityMode == LED_MODE_ON)
|
||||
if (g_Led[i].activityMode == SCE_LED_MODE_ON)
|
||||
continue;
|
||||
else if (g_Led[i].displayMode == LED_ON_ACTIVITY_ON) {
|
||||
sceGpioPortClear(1 << g_Led[i].gpioPort);
|
||||
@ -282,7 +280,7 @@ static s32 _sceLedVblankInterrupt(s32 subIntNm __attribute__((unused)), void *ar
|
||||
u32 i;
|
||||
|
||||
for (i = 0; i < g_iMaxLeds; i++) {
|
||||
if (g_Led[i].activityMode == LED_MODE_SELECTIVE_EXEC)
|
||||
if (g_Led[i].activityMode == SCE_LED_MODE_SELECTIVE_EXEC)
|
||||
_sceLedSeqExec(&g_Led[i]);
|
||||
}
|
||||
for (i = 0; i < g_iMaxLeds; i++) {
|
||||
@ -294,7 +292,7 @@ static s32 _sceLedVblankInterrupt(s32 subIntNm __attribute__((unused)), void *ar
|
||||
g_Led[i].offTime = 0;
|
||||
|
||||
/* Set the LED endBlinkState. */
|
||||
if (g_Led[i].endBlinkState != LED_MODE_OFF)
|
||||
if (g_Led[i].endBlinkState != SCE_LED_MODE_OFF)
|
||||
g_Led[i].onTime = 1;
|
||||
else
|
||||
g_Led[i].offTime = 1;
|
||||
@ -347,13 +345,13 @@ static u32 _sceLedSeqExec(SceLed *led)
|
||||
case 0:
|
||||
led->config = NULL;
|
||||
return SCE_ERROR_OK;
|
||||
case LED_CMD_SAVE_CMD:
|
||||
case SCE_LED_CMD_SAVE_CMD:
|
||||
led->savedConfig = (SceLedConfiguration *)ptr;
|
||||
break;
|
||||
case LED_CMD_EXECUTE_SAVED_CMD:
|
||||
case SCE_LED_CMD_EXECUTE_SAVED_CMD:
|
||||
ptr = (u8 *)led->savedConfig;
|
||||
break;
|
||||
case LED_CMD_REGISTER_CMD:
|
||||
case SCE_LED_CMD_REGISTER_CMD:
|
||||
if (led->index >= LED_CONFIG_SLOTS) {
|
||||
led->config = NULL;
|
||||
return SCE_ERROR_OK;
|
||||
@ -362,7 +360,7 @@ static u32 _sceLedSeqExec(SceLed *led)
|
||||
led->controlCmds[led->index].customLedCmd = (u32)ptr;
|
||||
led->index++;
|
||||
break;
|
||||
case LED_CMD_EXECUTE_CMD:
|
||||
case SCE_LED_CMD_EXECUTE_CMD:
|
||||
if (led->index <= 0) {
|
||||
led->config = NULL;
|
||||
return SCE_ERROR_OK;
|
||||
@ -370,33 +368,32 @@ static u32 _sceLedSeqExec(SceLed *led)
|
||||
led->controlCmds[led->index - 1].numExecs--;
|
||||
if (led->controlCmds[led->index - 1].numExecs <= 0)
|
||||
led->index--;
|
||||
else {
|
||||
else
|
||||
ptr = (u8 *)led->controlCmds[led->index - 1].customLedCmd;
|
||||
}
|
||||
break;
|
||||
case LED_CMD_TURN_LED_ON:
|
||||
case SCE_LED_CMD_TURN_LED_ON:
|
||||
led->onTime = 1;
|
||||
led->curLedMode = LED_MODE_ON;
|
||||
led->curLedMode = SCE_LED_MODE_ON;
|
||||
led->offTime = 0;
|
||||
break;
|
||||
case LED_CMD_TURN_LED_OFF:
|
||||
case SCE_LED_CMD_TURN_LED_OFF:
|
||||
led->offTime = 1;
|
||||
led->curLedMode = LED_MODE_OFF;
|
||||
led->curLedMode = SCE_LED_MODE_OFF;
|
||||
led->onTime = 0;
|
||||
break;
|
||||
case LED_CMD_SWITCH_LED_STATE:
|
||||
if (led->curLedMode == LED_MODE_ON) {
|
||||
case SCE_LED_CMD_SWITCH_LED_STATE:
|
||||
if (led->curLedMode == SCE_LED_MODE_ON) {
|
||||
led->onTime = 1;
|
||||
led->curLedMode = LED_MODE_OFF;
|
||||
led->curLedMode = SCE_LED_MODE_OFF;
|
||||
led->offTime = 0;
|
||||
} else {
|
||||
led->offTime = 1;
|
||||
led->curLedMode = LED_MODE_ON;
|
||||
led->curLedMode = SCE_LED_MODE_ON;
|
||||
led->onTime = 0;
|
||||
}
|
||||
break;
|
||||
case LED_CMD_BLINK_LED:
|
||||
led->curLedMode = LED_MODE_BLINK;
|
||||
case SCE_LED_CMD_BLINK_LED:
|
||||
led->curLedMode = SCE_LED_MODE_BLINK;
|
||||
led->onTime = *ptr++;
|
||||
led->offTime = *ptr++;
|
||||
break;
|
||||
@ -425,19 +422,19 @@ s32 sceLedSetMode(s32 led, s32 mode, SceLedConfiguration *config)
|
||||
g_Led[led].activityMode = mode;
|
||||
|
||||
/* Turn a LED ON. */
|
||||
if (mode == LED_MODE_ON) {
|
||||
if (mode == SCE_LED_MODE_ON) {
|
||||
g_Led[led].onTime = 1;
|
||||
g_Led[led].offTime = 0;
|
||||
g_Led[led].blinkInterval = 0;
|
||||
} else if (mode == LED_MODE_OFF) {
|
||||
if (mode != LED_MODE_OFF)
|
||||
} else if (mode == SCE_LED_MODE_OFF) {
|
||||
if (mode != SCE_LED_MODE_OFF)
|
||||
return SCE_ERROR_OK;
|
||||
|
||||
/* Turn a LED OFF. */
|
||||
g_Led[led].offTime = 1;
|
||||
g_Led[led].blinkInterval = 0;
|
||||
g_Led[led].onTime = 0;
|
||||
} else if (mode == LED_MODE_BLINK) {
|
||||
} else if (mode == SCE_LED_MODE_BLINK) {
|
||||
if (oldMode != mode)
|
||||
g_Led[led].blinkInterval = 0;
|
||||
|
||||
@ -451,7 +448,7 @@ s32 sceLedSetMode(s32 led, s32 mode, SceLedConfiguration *config)
|
||||
g_Led[led].offTime = config->offTime;
|
||||
g_Led[led].blinkTime = config->blinkTime;
|
||||
g_Led[led].endBlinkState = config->endBlinkState;
|
||||
} else if (mode == LED_MODE_SELECTIVE_EXEC) {
|
||||
} else if (mode == SCE_LED_MODE_SELECTIVE_EXEC) {
|
||||
if (oldMode != mode)
|
||||
g_Led[led].curLedMode = oldMode;
|
||||
|
||||
@ -490,7 +487,7 @@ static u32 _sceLedSuspend(s32 mode)
|
||||
if (mode == 0) {
|
||||
sceGpioPortClear(SCE_GPIO_MASK_LED_MS);
|
||||
sceGpioSetPortMode(SCE_GPIO_PORT_MODE_MS, 2);
|
||||
sceSysconCtrlLED(PSP_SYSCON_LED_WLAN, LED_MODE_OFF);
|
||||
sceSysconCtrlLED(PSP_SYSCON_LED_WLAN, SCE_LED_MODE_OFF);
|
||||
|
||||
status = sceSysconGetWlanPowerCtrl();
|
||||
if (status == 0) {
|
||||
@ -506,7 +503,7 @@ static u32 _sceLedSuspend(s32 mode)
|
||||
if (g_Led[PSP_LED_TYPE_BT].ledId == PSP_SYSCON_LED_MS)
|
||||
return SCE_ERROR_OK;
|
||||
|
||||
sceSysconCtrlLED(PSP_SYSCON_LED_BT, LED_MODE_OFF);
|
||||
sceSysconCtrlLED(PSP_SYSCON_LED_BT, SCE_LED_MODE_OFF);
|
||||
|
||||
status = sceSysconGetBtPowerCtrl();
|
||||
if (status == 0) {
|
||||
@ -525,7 +522,7 @@ static u32 _sceLedSuspend(s32 mode)
|
||||
else {
|
||||
for (i = 0; i < g_iMaxLeds; i++) {
|
||||
if (i == PSP_LED_TYPE_BT) {
|
||||
if (g_Led[i].activityMode == LED_MODE_ON)
|
||||
if (g_Led[i].activityMode == SCE_LED_MODE_ON)
|
||||
continue;
|
||||
|
||||
if (g_Led[i].displayMode == LED_ON_ACTIVITY_ON) {
|
||||
@ -560,12 +557,12 @@ static u32 _sceLedResume(s32 arg0)
|
||||
val = (btStatus == 0) ? 0 : val;
|
||||
|
||||
if (val != 0)
|
||||
sceLedSetMode(PSP_LED_TYPE_BT, LED_MODE_ON, NULL);
|
||||
sceLedSetMode(PSP_LED_TYPE_BT, SCE_LED_MODE_ON, NULL);
|
||||
else
|
||||
sceLedSetMode(PSP_LED_TYPE_BT, LED_MODE_OFF, NULL);
|
||||
sceLedSetMode(PSP_LED_TYPE_BT, SCE_LED_MODE_OFF, NULL);
|
||||
|
||||
sceGpioSetPortMode(g_Led[i].gpioPort, 0);
|
||||
sceSysconCtrlLED(g_Led[i].ledId, LED_MODE_ON);
|
||||
sceSysconCtrlLED(g_Led[i].ledId, SCE_LED_MODE_ON);
|
||||
continue;
|
||||
}
|
||||
if (g_Led[i].displayMode == LED_ON_ACTIVITY_ON)
|
||||
@ -574,7 +571,7 @@ static u32 _sceLedResume(s32 arg0)
|
||||
sceGpioPortSet(1 << g_Led[i].gpioPort);
|
||||
|
||||
sceGpioSetPortMode(g_Led[i].gpioPort, 0);
|
||||
sceSysconCtrlLED(g_Led[i].ledId, LED_MODE_ON);
|
||||
sceSysconCtrlLED(g_Led[i].ledId, SCE_LED_MODE_ON);
|
||||
}
|
||||
sceKernelEnableSubIntr(SCE_VBLANK_INT, 0x19);
|
||||
return SCE_ERROR_OK;
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* Copyright (C) 2011, 2012 The uOFW team
|
||||
/* Copyright (C) 2011, 2012, 2013 The uOFW team
|
||||
See the file COPYING for copying permission.
|
||||
*/
|
||||
|
||||
@ -28,6 +28,7 @@
|
||||
*
|
||||
*/
|
||||
|
||||
#include <init.h>
|
||||
#include <interruptman.h>
|
||||
#include <loadcore.h>
|
||||
#include <memlmd.h>
|
||||
@ -55,13 +56,8 @@ SCE_SDK_VERSION(SDK_VERSION);
|
||||
|
||||
#define SVALALIGN4(v) ((s32)((((u32)((s32)(v) >> 31)) >> 30) + (v)) >> 2)
|
||||
|
||||
#define INIT_MODULE_NAME "sceInit"
|
||||
#define MEMLMD_MODULE_NAME "memlmd"
|
||||
|
||||
#define LOADCORE_CYCLIC_POLYNOMIAL_HASH_RADIAX (5)
|
||||
|
||||
#define RAM_TYPE_32_MB (1)
|
||||
#define RAM_TYPE_64_MB (2)
|
||||
#define RAM_SIZE_32_MB (0x2000000)
|
||||
|
||||
#define LOADCORE_HEAP_SIZE (4096)
|
||||
@ -72,9 +68,6 @@ SCE_SDK_VERSION(SDK_VERSION);
|
||||
#define STUB_LIBRARY_CONTROL_BLOCKS (90)
|
||||
#define TOP_STUB_LIBRARY_CONTROL_BLOCK (STUB_LIBRARY_CONTROL_BLOCKS - 1)
|
||||
|
||||
#define LIBRARY_VERSION_MINOR (0)
|
||||
#define LIBRARY_VERSION_MAJOR (1)
|
||||
|
||||
#define LOADCORE_LIBRARY_NAME "LoadCoreForKernel"
|
||||
#define LOADCORE_EXPORTED_FUNCTIONS (34)
|
||||
#define LOADCORE_EXPORT_TABLE_ENTRIES (LOADCORE_EXPORTED_FUNCTIONS * 2)
|
||||
@ -281,6 +274,8 @@ static SceStubLibrary g_LoadCoreLibStubs[STUB_LIBRARY_CONTROL_BLOCKS]; //0x00008
|
||||
* When freeing a currently used control block g_FreeLibStub is set to
|
||||
* point to that specific control block.
|
||||
*/
|
||||
|
||||
s32 g_SyscallIntrRegSave[7]; //0x000080C0
|
||||
static SceStubLibrary *g_FreeLibStub; //0x000080E4
|
||||
|
||||
s32 g_ToolBreakMode; //0x000083C4
|
||||
@ -496,7 +491,7 @@ static SceResidentLibrary *FreeLibEntCB(SceResidentLibrary *libEntry)
|
||||
{
|
||||
if (libEntry->libNameInHeap) {
|
||||
sceKernelFreeHeapMemory(g_loadCoreHeap(), libEntry->libName);
|
||||
libEntry->libNameInHeap = FALSE;
|
||||
libEntry->libNameInHeap = SCE_FALSE;
|
||||
}
|
||||
if (libEntry >= &g_LoadCoreLibEntries[0] && libEntry <= &g_LoadCoreLibEntries[TOP_RESIDENT_LIBRARY_CONTROL_BLOCK]) { //0x00000170 & 0x0000017C
|
||||
libEntry->next = g_FreeLibEnt;
|
||||
@ -554,9 +549,9 @@ static SceStubLibrary *NewLibStubCB(void)
|
||||
*/
|
||||
static SceStubLibrary *FreeLibStubCB(SceStubLibrary *stubLib)
|
||||
{
|
||||
if (stubLib->libNameInHeap == TRUE) { //0x000002A8
|
||||
if (stubLib->libNameInHeap == SCE_TRUE) { //0x000002A8
|
||||
sceKernelFreeHeapMemory(g_loadCoreHeap(), stubLib->libName2); //0x0000031C
|
||||
stubLib->libNameInHeap = FALSE;
|
||||
stubLib->libNameInHeap = SCE_FALSE;
|
||||
}
|
||||
if (stubLib >= &g_LoadCoreLibStubs[0] && stubLib <= &g_LoadCoreLibStubs[TOP_STUB_LIBRARY_CONTROL_BLOCK]) { //0x000002C0 & 0x000002CC
|
||||
stubLib->next = g_FreeLibStub;
|
||||
@ -731,7 +726,7 @@ s32 loadCoreInit(SceSize argc __attribute__((unused)), void *argp)
|
||||
g_loadCore.sysCallTableSeed = seedPart1 + 0x2000;
|
||||
g_loadCore.secModId = SECONDARY_MODULE_ID_START_VALUE;
|
||||
g_loadCore.loadCoreHeapId = LOADCORE_ERROR;
|
||||
g_loadCore.linkedLoadCoreStubs = FALSE;
|
||||
g_loadCore.linkedLoadCoreStubs = SCE_FALSE;
|
||||
g_loadCore.sysCallTable = NULL;
|
||||
g_loadCore.unk520 = 0;
|
||||
g_loadCore.unLinkedStubLibs = NULL;
|
||||
@ -769,7 +764,7 @@ s32 loadCoreInit(SceSize argc __attribute__((unused)), void *argp)
|
||||
|
||||
linkLibsRes = sceKernelLinkLibraryEntries(sysMemThreadConfig->loadCoreImportTables,
|
||||
sysMemThreadConfig->loadCoreImportTablesSize); //0x00000CD0
|
||||
g_loadCore.linkedLoadCoreStubs = TRUE;
|
||||
g_loadCore.linkedLoadCoreStubs = SCE_TRUE;
|
||||
|
||||
g_UpdateCacheAll = UpdateCacheAllDynamic; //0x00000D1C
|
||||
g_UpdateCacheDataAll = UpdateCacheDataAllDynamic; //0x00000D20
|
||||
@ -967,7 +962,7 @@ s32 sceKernelLoadModuleBootLoadCore(SceLoadCoreBootModuleInfo *bootModInfo, SceL
|
||||
tmpBlockId = 0;
|
||||
|
||||
execInfo->apiType = 0x50; //0x000011DC
|
||||
execInfo->isSignChecked = TRUE;
|
||||
execInfo->isSignChecked = SCE_TRUE;
|
||||
execInfo->topAddr = NULL;
|
||||
execInfo->modeAttribute = 0;
|
||||
|
||||
@ -996,10 +991,10 @@ s32 sceKernelLoadModuleBootLoadCore(SceLoadCoreBootModuleInfo *bootModInfo, SceL
|
||||
//0x0000126C - 0x00001290
|
||||
switch (execInfo->elfType) {
|
||||
case SCE_EXEC_FILE_TYPE_PRX: case SCE_EXEC_FILE_TYPE_PRX_2:
|
||||
isPrx = TRUE; //jumps to 0x00001298
|
||||
isPrx = SCE_TRUE; //jumps to 0x00001298
|
||||
break;
|
||||
default:
|
||||
isPrx = FALSE;
|
||||
isPrx = SCE_FALSE;
|
||||
break;
|
||||
}
|
||||
if (!isPrx)
|
||||
@ -1861,7 +1856,7 @@ static s32 doLinkLibraryEntries(SceStubLibraryEntryTable *stubLibEntryTable, u32
|
||||
{
|
||||
u32 i;
|
||||
s32 status;
|
||||
u32 dupStubLib; /* TRUE = stub library duplicated */
|
||||
u32 dupStubLib; /* SCE_TRUE = stub library duplicated */
|
||||
void *curStubTable;
|
||||
void *stubTableMemRange;
|
||||
SceStubLibrary *stubLib;
|
||||
@ -1905,15 +1900,15 @@ static s32 doLinkLibraryEntries(SceStubLibraryEntryTable *stubLibEntryTable, u32
|
||||
* stub libraries. If this is true, we free the current stub library's
|
||||
* instance. Otherwise, it is added to the linked-list.
|
||||
*/
|
||||
dupStubLib = FALSE;
|
||||
dupStubLib = SCE_FALSE;
|
||||
for (curUnlinkedStubLib = g_loadCore.unLinkedStubLibs; curUnlinkedStubLib;
|
||||
curUnlinkedStubLib = curUnlinkedStubLib->next) {
|
||||
if (curUnlinkedStubLib->libStubTable == stubLib->libStubTable) { //0x00003194
|
||||
FreeLibStubCB(stubLib); //0x00003204
|
||||
dupStubLib = TRUE; //0x0000320C
|
||||
dupStubLib = SCE_TRUE; //0x0000320C
|
||||
}
|
||||
}
|
||||
if (dupStubLib == FALSE) {
|
||||
if (dupStubLib == SCE_FALSE) {
|
||||
stubLib->next = g_loadCore.unLinkedStubLibs; //0x000031B4
|
||||
g_loadCore.unLinkedStubLibs = stubLib; //0x000031BC
|
||||
|
||||
@ -1976,18 +1971,18 @@ static s32 UnLinkLibraryEntry(SceStubLibraryEntryTable *stubLibEntryTable)
|
||||
curLib->stubLibs = curStubLib->next; //0x0000340C
|
||||
}
|
||||
else {
|
||||
stubLibUnlinked = FALSE;
|
||||
stubLibUnlinked = SCE_FALSE;
|
||||
//0x0000338C - 0x000033AC
|
||||
for (curStubLib2 = firstStubLib->next, prevStubLib = firstStubLib; curStubLib2;
|
||||
prevStubLib = curStubLib2, curStubLib2 = curStubLib2->next) {
|
||||
if (curStubLib2 == curStubLib) { //0x0000339C
|
||||
prevStubLib->next = curStubLib->next; //0x000033BC
|
||||
curStubLib->next = NULL; //0x000033C0
|
||||
stubLibUnlinked = TRUE;
|
||||
stubLibUnlinked = SCE_TRUE;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (stubLibUnlinked == FALSE)
|
||||
if (stubLibUnlinked == SCE_FALSE)
|
||||
return SCE_ERROR_KERNEL_ERROR; //0x000033B4
|
||||
}
|
||||
curStubLib->status &= ~(STUB_LIBRARY_LINKED | STUB_LIBRARY_EXCLUSIVE_LINK | 0x4); //0x000033CC
|
||||
@ -2398,7 +2393,7 @@ static s32 CopyLibEnt(SceResidentLibrary *lib, SceResidentLibraryEntryTable *lib
|
||||
*/
|
||||
if (IS_KERNEL_ADDR(libEntryTable->libName)) { //0x00003794
|
||||
lib->libName = (char *)libEntryTable->libName; //0x0000379C
|
||||
lib->libNameInHeap = FALSE;
|
||||
lib->libNameInHeap = SCE_FALSE;
|
||||
lib->sysTableEntryStartIndex = 0;
|
||||
return SCE_ERROR_OK;
|
||||
}
|
||||
@ -2409,7 +2404,7 @@ static s32 CopyLibEnt(SceResidentLibrary *lib, SceResidentLibraryEntryTable *lib
|
||||
return SCE_ERROR_KERNEL_ERROR;
|
||||
|
||||
memcpy(lib->libName, libEntryTable->libName, len + 1); //0x000037F4
|
||||
lib->libNameInHeap = TRUE;
|
||||
lib->libNameInHeap = SCE_TRUE;
|
||||
lib->sysTableEntryStartIndex = 0;
|
||||
|
||||
return SCE_ERROR_OK;
|
||||
@ -2470,7 +2465,7 @@ static s32 CopyLibStub(SceStubLibrary *stubLib, SceStubLibraryEntryTable *stubLi
|
||||
*/
|
||||
if (IS_KERNEL_ADDR(stubLibEntryTable->libName)) {
|
||||
stubLib->libName2 = (char *)stubLibEntryTable->libName; //0x00003930
|
||||
stubLib->libNameInHeap = FALSE;
|
||||
stubLib->libNameInHeap = SCE_FALSE;
|
||||
return SCE_ERROR_OK;
|
||||
}
|
||||
|
||||
@ -2481,7 +2476,7 @@ static s32 CopyLibStub(SceStubLibrary *stubLib, SceStubLibraryEntryTable *stubLi
|
||||
return LOADCORE_ERROR;
|
||||
|
||||
memcpy(stubLib->libName2, stubLibEntryTable->libName, len + 1);
|
||||
stubLib->libNameInHeap = TRUE;
|
||||
stubLib->libNameInHeap = SCE_TRUE;
|
||||
return SCE_ERROR_OK;
|
||||
}
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
# Copyright (C) 2011, 2012 The uOFW team
|
||||
# Copyright (C) 2011, 2012, 2013 The uOFW team
|
||||
# See the file COPYING for copying permission.
|
||||
|
||||
#include "../../include/common/common.S"
|
||||
@ -9,6 +9,7 @@
|
||||
.globl sceLoadCorePrimarySyscallHandler
|
||||
|
||||
.global g_ToolBreakMode
|
||||
.global g_SyscallIntrRegSave
|
||||
|
||||
##
|
||||
# sub_00000000
|
||||
@ -41,11 +42,11 @@ loop2: # Refs: 0x0000001C
|
||||
.ent sceLoadCorePrimarySyscallHandler
|
||||
sceLoadCorePrimarySyscallHandler:
|
||||
lui $v0, %hi(g_ToolBreakMode)
|
||||
lw $v0, %lo(g_ToolBreakMode)($v0) # Data ref 0x000083C4
|
||||
beq $zr, $v0, error # if (g_ToolBreakMode == 0)
|
||||
lw $v0, %lo(g_ToolBreakMode)($v0)
|
||||
beq $zr, $v0, error # if (g_ToolBreakMode == 0) goto error;
|
||||
nop
|
||||
lui $v0, 0x1
|
||||
addiu $v0, $v0, -32576 # Data ref 0x000080C0
|
||||
lui $v0, %hi(g_SyscallIntrRegSave)
|
||||
addiu $v0, $v0, %lo(g_SyscallIntrRegSave)
|
||||
cfc0 $v1, $16 # Get currentTCB
|
||||
sw $v0, 0($v1) # and save it
|
||||
cfc0 $v1, $2 # Get COP 0's Status register
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* Copyright (C) 2011, 2012 The uOFW team
|
||||
/* Copyright (C) 2011, 2012, 2013 The uOFW team
|
||||
See the file COPYING for copying permission.
|
||||
*/
|
||||
|
||||
@ -11,10 +11,6 @@
|
||||
#include <sysmem_user.h>
|
||||
#include "systable.h"
|
||||
|
||||
#define FALSE (0)
|
||||
|
||||
#define TRUE (1)
|
||||
|
||||
#define LOADCORE_ERROR (-1)
|
||||
|
||||
/* The magic number identifying a file as a PSP object file. */
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* Copyright (C) 2011, 2012 The uOFW team
|
||||
/* Copyright (C) 2011, 2012, 2013 The uOFW team
|
||||
See the file COPYING for copying permission.
|
||||
*/
|
||||
|
||||
@ -98,7 +98,7 @@ s32 sceKernelCheckExecFile(u8 *buf, SceLoadCoreExecFileInfo *execInfo)
|
||||
return size;
|
||||
|
||||
if (!(execInfo->modeAttribute & SCE_EXEC_FILE_NO_COMPRESSION)) { //0x00003FF8
|
||||
execInfo->isDecrypted = FALSE; //0x00004008
|
||||
execInfo->isDecrypted = SCE_FALSE; //0x00004008
|
||||
if ((u32)buf & (SCE_HEADER_SIZE - 1)) { //0x00004004
|
||||
execInfo->elfType = SCE_EXEC_FILE_TYPE_INVALID_ELF;
|
||||
return SCE_ERROR_KERNEL_UNSUPPORTED_PRX_TYPE;
|
||||
@ -113,10 +113,10 @@ s32 sceKernelCheckExecFile(u8 *buf, SceLoadCoreExecFileInfo *execInfo)
|
||||
execInfo->decSize = pspHeader->elfSize; //0x000042BC
|
||||
execInfo->execAttribute = pspHeader->compAttribute;
|
||||
execInfo->execSize = pspHeader->pspSize; //0x000042C8
|
||||
execInfo->isKernelMod = FALSE;
|
||||
execInfo->isKernelMod = SCE_FALSE;
|
||||
execInfo->entryAddr = pspHeader->bootEntry; //0x000042D4
|
||||
if (IS_KERNEL_ADDR(pspHeader->modInfoOffset) && pspHeader->decryptMode) //0x000042DC & 0x00004378
|
||||
execInfo->isKernelMod = TRUE; //0x00004384
|
||||
execInfo->isKernelMod = SCE_TRUE; //0x00004384
|
||||
|
||||
execInfo->moduleInfoOffset = pspHeader->modInfoOffset & 0x1FFFFFFF; //0x000042E8
|
||||
execInfo->overlapSize = 0; //0x000042F4
|
||||
@ -149,7 +149,7 @@ s32 sceKernelCheckExecFile(u8 *buf, SceLoadCoreExecFileInfo *execInfo)
|
||||
}
|
||||
//0x0000404C
|
||||
if (execInfo->execAttribute & SCE_EXEC_FILE_COMPRESSED) { //0x00004050
|
||||
execInfo->isCompressed = TRUE; //0x00004060
|
||||
execInfo->isCompressed = SCE_TRUE; //0x00004060
|
||||
buf = execInfo->topAddr;
|
||||
execInfo->fileBase = execInfo->topAddr; //0x00004064
|
||||
}
|
||||
@ -306,10 +306,10 @@ s32 sceKernelProbeExecutableObject(u8 *buf, SceLoadCoreExecFileInfo *execInfo)
|
||||
//0x00004498
|
||||
switch (execInfo->elfType) {
|
||||
case SCE_EXEC_FILE_TYPE_PRX:
|
||||
isPrx = TRUE; //jumps to 0x000044A0
|
||||
isPrx = SCE_TRUE; //jumps to 0x000044A0
|
||||
break;
|
||||
case SCE_EXEC_FILE_TYPE_ELF:
|
||||
isPrx = FALSE; //jumps to 0x000046AC
|
||||
isPrx = SCE_FALSE; //jumps to 0x000046AC
|
||||
break;
|
||||
default:
|
||||
execInfo->elfType = SCE_EXEC_FILE_TYPE_INVALID_ELF; //0x00004528
|
||||
@ -1011,7 +1011,7 @@ static s32 PspUncompress(u8 *modBuf, SceLoadCoreExecFileInfo *execInfo,
|
||||
u8 *tag;
|
||||
u32 i;
|
||||
|
||||
checkCompAttr = FALSE;
|
||||
checkCompAttr = SCE_FALSE;
|
||||
|
||||
/* Permit decryption modes dependent on the module/API type. */
|
||||
switch (execInfo->apiType) {
|
||||
@ -1020,45 +1020,45 @@ static s32 PspUncompress(u8 *modBuf, SceLoadCoreExecFileInfo *execInfo,
|
||||
((header->modAttribute & SCE_PRIVILEGED_MODULES) != SCE_MODULE_KERNEL || header->decryptMode - 1 >= 2) && //0x00005D08
|
||||
(header->modAttribute > SCE_MODULE_VSH || header->decryptMode != 4)) //0x0000578C
|
||||
return SCE_ERROR_KERNEL_UNSUPPORTED_PRX_TYPE;
|
||||
checkCompAttr = TRUE;
|
||||
checkCompAttr = SCE_TRUE;
|
||||
break; //0x0000579C
|
||||
case 3:
|
||||
if ((header->modAttribute & SCE_PRIVILEGED_MODULES) != SCE_MODULE_USER || header->decryptMode != 4) //0x00005DA8 & 0x0000578C
|
||||
return SCE_ERROR_KERNEL_UNSUPPORTED_PRX_TYPE;
|
||||
checkCompAttr = TRUE;
|
||||
checkCompAttr = SCE_TRUE;
|
||||
break; //0x0000579C
|
||||
case 16:
|
||||
if (((header->modAttribute & SCE_PRIVILEGED_MODULES) != SCE_MODULE_KERNEL || header->decryptMode - 1 >= 2) && //0x00005D6C
|
||||
((header->modAttribute & SCE_PRIVILEGED_MODULES) != SCE_MODULE_USER || header->decryptMode != 4)) //0x00005D9C
|
||||
return SCE_ERROR_KERNEL_UNSUPPORTED_PRX_TYPE;
|
||||
checkCompAttr = TRUE;
|
||||
checkCompAttr = SCE_TRUE;
|
||||
break; //0x0000579C
|
||||
case 19:
|
||||
if ((header->modAttribute & SCE_PRIVILEGED_MODULES) != SCE_MODULE_USER || (header->decryptMode != 18 && //0x00005E30
|
||||
(header->decryptMode != 19 || sceKernelIsToolMode() == 0))) //0x00005E50 & 0x00005E38
|
||||
return SCE_ERROR_KERNEL_UNSUPPORTED_PRX_TYPE;
|
||||
checkCompAttr = TRUE;
|
||||
checkCompAttr = SCE_TRUE;
|
||||
break; //0x0000579C
|
||||
case 20:
|
||||
if ((header->modAttribute & SCE_PRIVILEGED_MODULES) != SCE_MODULE_USER || header->decryptMode != 23) //0x00005DEC
|
||||
return SCE_ERROR_KERNEL_UNSUPPORTED_PRX_TYPE;
|
||||
checkCompAttr = TRUE;
|
||||
checkCompAttr = SCE_TRUE;
|
||||
break; //0x0000579C
|
||||
case 17: case 48: case 66:
|
||||
if (((header->modAttribute & SCE_PRIVILEGED_MODULES) == SCE_MODULE_USER && header->decryptMode != 4) && //0x00005D60 & 0x00005790
|
||||
(((header->modAttribute & SCE_PRIVILEGED_MODULES) != SCE_MODULE_KERNEL) || header->decryptMode - 1 >= 2)) //0x00005D6C & 0x00005D14
|
||||
return SCE_ERROR_KERNEL_UNSUPPORTED_PRX_TYPE;
|
||||
checkCompAttr = TRUE;
|
||||
checkCompAttr = SCE_TRUE;
|
||||
break; //0x0000579C
|
||||
case 67:
|
||||
if ((header->modAttribute & SCE_PRIVILEGED_MODULES) != SCE_MODULE_APP || header->decryptMode != 22) //0x00005E1C & 0x00005E28
|
||||
return SCE_ERROR_KERNEL_UNSUPPORTED_PRX_TYPE;
|
||||
checkCompAttr = TRUE;
|
||||
checkCompAttr = SCE_TRUE;
|
||||
break; //0x0000579C
|
||||
case 80:
|
||||
if ((header->modAttribute & SCE_PRIVILEGED_MODULES) != SCE_MODULE_KERNEL || header->decryptMode - 1 >= 2) //0x00005D6C & 0x00005D1C
|
||||
return SCE_ERROR_KERNEL_UNSUPPORTED_PRX_TYPE;
|
||||
checkCompAttr = TRUE;
|
||||
checkCompAttr = SCE_TRUE;
|
||||
break; //0x0000579C
|
||||
case 112:
|
||||
//TODO: Check this.
|
||||
@ -1067,7 +1067,7 @@ static s32 PspUncompress(u8 *modBuf, SceLoadCoreExecFileInfo *execInfo,
|
||||
(header->modAttribute != SCE_MODULE_VSH || header->decryptMode != 3) && (header->modAttribute != 0 ||
|
||||
header->decryptMode != 4)) //0x00005D30
|
||||
return SCE_ERROR_KERNEL_UNSUPPORTED_PRX_TYPE;
|
||||
checkCompAttr = TRUE;
|
||||
checkCompAttr = SCE_TRUE;
|
||||
break; //0x0000579C
|
||||
case 272: case 274:
|
||||
if ((header->modAttribute & SCE_PRIVILEGED_MODULES) != SCE_MODULE_USER || header->decryptMode != 0) //0x00005F7C & 0x00005F88
|
||||
@ -1092,7 +1092,7 @@ static s32 PspUncompress(u8 *modBuf, SceLoadCoreExecFileInfo *execInfo,
|
||||
case 289:
|
||||
if ((header->modAttribute & SCE_PRIVILEGED_MODULES) != SCE_MODULE_VSH || header->decryptMode != 3) //0x00006308 & 0x00005790
|
||||
return SCE_ERROR_KERNEL_UNSUPPORTED_PRX_TYPE;
|
||||
checkCompAttr = TRUE;
|
||||
checkCompAttr = SCE_TRUE;
|
||||
break; //0x0000579C
|
||||
case 290:
|
||||
if (sceKernelIsToolMode() == 0 || (header->modAttribute & SCE_PRIVILEGED_MODULES) != SCE_MODULE_USER || //0x000060C0 & 0x000060D8
|
||||
@ -1103,22 +1103,22 @@ static s32 PspUncompress(u8 *modBuf, SceLoadCoreExecFileInfo *execInfo,
|
||||
if (sceKernelIsToolMode() == 0 || (header->modAttribute & SCE_PRIVILEGED_MODULES) != SCE_MODULE_USB_WLAN || //0x0000617C & 0x00006190
|
||||
(header->decryptMode - 10) >= 2) //0x00005D18
|
||||
return SCE_ERROR_KERNEL_UNSUPPORTED_PRX_TYPE;
|
||||
checkCompAttr = TRUE;
|
||||
checkCompAttr = SCE_TRUE;
|
||||
break; //0x0000579C
|
||||
case 304: case 306:
|
||||
if ((header->modAttribute & SCE_PRIVILEGED_MODULES) != SCE_MODULE_USB_WLAN || header->decryptMode != 10) //0x00006120
|
||||
return SCE_ERROR_KERNEL_UNSUPPORTED_PRX_TYPE;
|
||||
checkCompAttr = TRUE;
|
||||
checkCompAttr = SCE_TRUE;
|
||||
break; //0x00005798
|
||||
case 320:
|
||||
if ((header->modAttribute & SCE_PRIVILEGED_MODULES) != SCE_MODULE_VSH || header->decryptMode != 12) //0x00006244
|
||||
return SCE_ERROR_KERNEL_UNSUPPORTED_PRX_TYPE;
|
||||
checkCompAttr = TRUE;
|
||||
checkCompAttr = SCE_TRUE;
|
||||
break; //0x00005798
|
||||
case 325:
|
||||
if ((header->modAttribute & SCE_PRIVILEGED_MODULES) != SCE_MODULE_MS || header->decryptMode != 21) //0x000062A8 & 0x000062C0/0x00005790
|
||||
return SCE_ERROR_KERNEL_UNSUPPORTED_PRX_TYPE;
|
||||
checkCompAttr = TRUE;
|
||||
checkCompAttr = SCE_TRUE;
|
||||
break; //0x00005798
|
||||
case 323: case 340:
|
||||
if ((header->modAttribute & SCE_PRIVILEGED_MODULES) != SCE_MODULE_APP || header->decryptMode != 14) //0x00006224 & 0x000061F8
|
||||
@ -1127,17 +1127,17 @@ static s32 PspUncompress(u8 *modBuf, SceLoadCoreExecFileInfo *execInfo,
|
||||
status = CheckTick(modBuf); //0x00006200
|
||||
if (status < SCE_ERROR_OK) //0x00006208
|
||||
return status;
|
||||
checkCompAttr = TRUE;
|
||||
checkCompAttr = SCE_TRUE;
|
||||
break; //0x00005798
|
||||
case 324: case 341:
|
||||
if ((header->modAttribute & SCE_PRIVILEGED_MODULES) != SCE_MODULE_MS || header->decryptMode != 20) //0x000061C0
|
||||
return SCE_ERROR_KERNEL_UNSUPPORTED_PRX_TYPE;
|
||||
checkCompAttr = TRUE;
|
||||
checkCompAttr = SCE_TRUE;
|
||||
break; //0x00005790
|
||||
case 342:
|
||||
if ((header->modAttribute & SCE_PRIVILEGED_MODULES) != SCE_MODULE_MS || header->decryptMode != 21) //0x000062B0
|
||||
return SCE_ERROR_KERNEL_UNSUPPORTED_PRX_TYPE;
|
||||
checkCompAttr = TRUE;
|
||||
checkCompAttr = SCE_TRUE;
|
||||
break; //00005790
|
||||
|
||||
//TODO: Check these
|
||||
@ -1148,26 +1148,26 @@ static s32 PspUncompress(u8 *modBuf, SceLoadCoreExecFileInfo *execInfo,
|
||||
case 512: case 528: case 544: case 768:
|
||||
if ((header->modAttribute & SCE_PRIVILEGED_MODULES) != SCE_MODULE_VSH || header->decryptMode != 3) //0x00006314 & 0x00005D30 & 0x00005790
|
||||
return SCE_ERROR_KERNEL_UNSUPPORTED_PRX_TYPE;
|
||||
checkCompAttr = TRUE;
|
||||
checkCompAttr = SCE_TRUE;
|
||||
break; //0x00005798
|
||||
|
||||
default:
|
||||
return SCE_ERROR_KERNEL_UNSUPPORTED_PRX_TYPE;
|
||||
}
|
||||
|
||||
if (checkCompAttr == TRUE && header->compAttribute & SCE_EXEC_FILE_ELF) //0x0000579C
|
||||
if (checkCompAttr == SCE_TRUE && header->compAttribute & SCE_EXEC_FILE_ELF) //0x0000579C
|
||||
return SCE_ERROR_KERNEL_UNSUPPORTED_PRX_TYPE;
|
||||
|
||||
/* Decrypt the executable file. */
|
||||
switch (header->decryptMode) { //0x000057D0
|
||||
case DECRYPT_MODE_NO_EXEC:
|
||||
execInfo->isDecrypted = FALSE; //0x000057D8
|
||||
execInfo->isDecrypted = SCE_FALSE; //0x000057D8
|
||||
break;
|
||||
case DECRYPT_MODE_BOGUS_MODULE: case DECRYPT_MODE_KERNEL_MODULE:
|
||||
if ((header->modAttribute & SCE_PRIVILEGED_MODULES) != SCE_MODULE_KERNEL) //0x000058C8
|
||||
return SCE_ERROR_KERNEL_UNSUPPORTED_PRX_TYPE;
|
||||
|
||||
if (execInfo->isSignChecked == TRUE) { //0x000058D4
|
||||
if (execInfo->isSignChecked == SCE_TRUE) { //0x000058D4
|
||||
if (g_prepareGetLengthFunc(modBuf, execInfo->execSize) != 0) //0x000058F0
|
||||
return SCE_ERROR_KERNEL_UNSUPPORTED_PRX_TYPE;
|
||||
|
||||
@ -1187,7 +1187,7 @@ static s32 PspUncompress(u8 *modBuf, SceLoadCoreExecFileInfo *execInfo,
|
||||
} else if (g_getLengthFunc(modBuf, execInfo->execSize, newSize) != 0) //0x00005958
|
||||
return SCE_ERROR_KERNEL_UNSUPPORTED_PRX_TYPE;
|
||||
|
||||
execInfo->isDecrypted = TRUE;
|
||||
execInfo->isDecrypted = SCE_TRUE;
|
||||
break; //0x000057DC
|
||||
case DECRYPT_MODE_VSH_MODULE:
|
||||
if ((header->modAttribute & SCE_PRIVILEGED_MODULES) != SCE_MODULE_VSH) //0x000059B0
|
||||
@ -1208,7 +1208,7 @@ static s32 PspUncompress(u8 *modBuf, SceLoadCoreExecFileInfo *execInfo,
|
||||
if (sceMesgLed_driver_5C3A61FE(modBuf, execInfo->execSize, newSize) != SCE_ERROR_OK) //0x00005958
|
||||
return SCE_ERROR_KERNEL_UNSUPPORTED_PRX_TYPE;
|
||||
|
||||
execInfo->isDecrypted = TRUE;
|
||||
execInfo->isDecrypted = SCE_TRUE;
|
||||
break; //0x000057DC
|
||||
case DECRYPT_MODE_USER_MODULE:
|
||||
if ((header->modAttribute & SCE_PRIVILEGED_MODULES) != SCE_MODULE_USER) //0x00005A48
|
||||
@ -1229,7 +1229,7 @@ static s32 PspUncompress(u8 *modBuf, SceLoadCoreExecFileInfo *execInfo,
|
||||
if (sceMesgLed_driver_2CB700EC(modBuf, execInfo->execSize, newSize) != SCE_ERROR_OK) //0x00005958
|
||||
return SCE_ERROR_KERNEL_UNSUPPORTED_PRX_TYPE;
|
||||
|
||||
execInfo->isDecrypted = TRUE;
|
||||
execInfo->isDecrypted = SCE_TRUE;
|
||||
break; //0x57DC
|
||||
case DECRYPT_MODE_UMD_GAME_EXEC:
|
||||
if ((header->modAttribute & SCE_PRIVILEGED_MODULES) != SCE_MODULE_USER) //0x00005AE0
|
||||
@ -1238,7 +1238,7 @@ static s32 PspUncompress(u8 *modBuf, SceLoadCoreExecFileInfo *execInfo,
|
||||
if (sceMesgLed_driver_337D0DD3(modBuf, execInfo->execSize, newSize) != SCE_ERROR_OK) //0x00005958
|
||||
return SCE_ERROR_KERNEL_UNSUPPORTED_PRX_TYPE;
|
||||
|
||||
execInfo->isDecrypted = TRUE;
|
||||
execInfo->isDecrypted = SCE_TRUE;
|
||||
break; //0x000057DC
|
||||
case DECRYPT_MODE_GAMESHARING_EXEC:
|
||||
if ((header->modAttribute & SCE_PRIVILEGED_MODULES) != SCE_MODULE_USB_WLAN) //0x00005B0C
|
||||
@ -1247,7 +1247,7 @@ static s32 PspUncompress(u8 *modBuf, SceLoadCoreExecFileInfo *execInfo,
|
||||
if (sceMesgLed_driver_4EAB9850(modBuf, execInfo->execSize, newSize) != SCE_ERROR_OK) //0x00005958
|
||||
return SCE_ERROR_KERNEL_UNSUPPORTED_PRX_TYPE;
|
||||
|
||||
execInfo->isDecrypted = TRUE;
|
||||
execInfo->isDecrypted = SCE_TRUE;
|
||||
break; //0x000057DC
|
||||
case DECRYPT_MODE_UNKNOWN_11:
|
||||
if (sceKernelIsToolMode() != SCE_ERROR_OK) //0x00005B34
|
||||
@ -1259,7 +1259,7 @@ static s32 PspUncompress(u8 *modBuf, SceLoadCoreExecFileInfo *execInfo,
|
||||
if (sceMesgLed_driver_B2CDAC3F(modBuf, execInfo->execSize, newSize) != SCE_ERROR_OK) //0x00005958
|
||||
return SCE_ERROR_KERNEL_UNSUPPORTED_PRX_TYPE;
|
||||
|
||||
execInfo->isDecrypted = TRUE;
|
||||
execInfo->isDecrypted = SCE_TRUE;
|
||||
break; //0x000057DC
|
||||
case DECRYPT_MODE_MS_UPDATER:
|
||||
if ((header->modAttribute & SCE_PRIVILEGED_MODULES) != SCE_MODULE_VSH) //0x00005B74
|
||||
@ -1268,7 +1268,7 @@ static s32 PspUncompress(u8 *modBuf, SceLoadCoreExecFileInfo *execInfo,
|
||||
if (sceMesgLed_driver_C79E3488(modBuf, execInfo->execSize, newSize) != SCE_ERROR_OK) //0x00005958
|
||||
return SCE_ERROR_KERNEL_UNSUPPORTED_PRX_TYPE;
|
||||
|
||||
execInfo->isDecrypted = TRUE;
|
||||
execInfo->isDecrypted = SCE_TRUE;
|
||||
break; //0x000057DC
|
||||
case DECRYPT_MODE_DEMO_EXEC:
|
||||
if ((header->modAttribute & SCE_PRIVILEGED_MODULES) != SCE_MODULE_MS) //0x00005BA0
|
||||
@ -1277,7 +1277,7 @@ static s32 PspUncompress(u8 *modBuf, SceLoadCoreExecFileInfo *execInfo,
|
||||
if (sceMesgLed_driver_21AFFAAC(modBuf, execInfo->execSize, newSize) != SCE_ERROR_OK) //0x00005958
|
||||
return SCE_ERROR_KERNEL_UNSUPPORTED_PRX_TYPE;
|
||||
|
||||
execInfo->isDecrypted = TRUE;
|
||||
execInfo->isDecrypted = SCE_TRUE;
|
||||
break; //0x000057DC
|
||||
case DECRYPT_MODE_APP_MODULE:
|
||||
if ((header->modAttribute & SCE_PRIVILEGED_MODULES) != SCE_MODULE_APP) //0x00005BCC
|
||||
@ -1286,19 +1286,19 @@ static s32 PspUncompress(u8 *modBuf, SceLoadCoreExecFileInfo *execInfo,
|
||||
if (sceMesgLed_driver_C00DAD75(modBuf, execInfo->execSize, newSize) != SCE_ERROR_OK) //0x00005958
|
||||
return SCE_ERROR_KERNEL_UNSUPPORTED_PRX_TYPE;
|
||||
|
||||
execInfo->isDecrypted = TRUE;
|
||||
execInfo->isDecrypted = SCE_TRUE;
|
||||
break; //0x000057DC
|
||||
case DECRYPT_MODE_UNKNOWN_18:
|
||||
if (sceMesgLed_driver_CED2C075(modBuf, execInfo->execSize, newSize, execInfo->unk104) != SCE_ERROR_OK) //0x00005958
|
||||
return SCE_ERROR_KERNEL_UNSUPPORTED_PRX_TYPE;
|
||||
|
||||
execInfo->isDecrypted = TRUE;
|
||||
execInfo->isDecrypted = SCE_TRUE;
|
||||
break; //0x000057DC
|
||||
case DECRYPT_MODE_UNKNOWN_19:
|
||||
if (sceMesgLed_driver_C7D1C16B(modBuf, execInfo->execSize, newSize, execInfo->unk104) != SCE_ERROR_OK) //0x00005958
|
||||
return SCE_ERROR_KERNEL_UNSUPPORTED_PRX_TYPE;
|
||||
|
||||
execInfo->isDecrypted = TRUE;
|
||||
execInfo->isDecrypted = SCE_TRUE;
|
||||
break; //0x000057DC
|
||||
case DECRYPT_MODE_POPS_EXEC:
|
||||
if ((header->modAttribute & SCE_PRIVILEGED_MODULES) != SCE_MODULE_MS) //0x00005C30
|
||||
@ -1307,7 +1307,7 @@ static s32 PspUncompress(u8 *modBuf, SceLoadCoreExecFileInfo *execInfo,
|
||||
if (sceMesgLed_driver_EBB4613D(modBuf, execInfo->execSize, newSize, execInfo->unk104) != SCE_ERROR_OK) //0x00005958
|
||||
return SCE_ERROR_KERNEL_UNSUPPORTED_PRX_TYPE;
|
||||
|
||||
execInfo->isDecrypted = TRUE;
|
||||
execInfo->isDecrypted = SCE_TRUE;
|
||||
break; //0x000057DC
|
||||
case DECRYPT_MODE_UNKNOWN_21:
|
||||
if ((header->modAttribute & SCE_PRIVILEGED_MODULES) != SCE_MODULE_MS) //0x00005C60
|
||||
@ -1316,7 +1316,7 @@ static s32 PspUncompress(u8 *modBuf, SceLoadCoreExecFileInfo *execInfo,
|
||||
if (sceMesgLed_driver_66B348B2(modBuf, execInfo->execSize, newSize, execInfo->unk104) != SCE_ERROR_OK) //0x00005958
|
||||
return SCE_ERROR_KERNEL_UNSUPPORTED_PRX_TYPE;
|
||||
|
||||
execInfo->isDecrypted = TRUE;
|
||||
execInfo->isDecrypted = SCE_TRUE;
|
||||
break; //0x000057DC
|
||||
case DECRYPT_MODE_UNKNOWN_22:
|
||||
if ((header->modAttribute & SCE_PRIVILEGED_MODULES) != SCE_MODULE_APP) //0x00005C90
|
||||
@ -1325,7 +1325,7 @@ static s32 PspUncompress(u8 *modBuf, SceLoadCoreExecFileInfo *execInfo,
|
||||
if (sceMesgLed_driver_B2D95FDF(modBuf, execInfo->execSize, newSize) != SCE_ERROR_OK) //0x00005958
|
||||
return SCE_ERROR_KERNEL_UNSUPPORTED_PRX_TYPE;
|
||||
|
||||
execInfo->isDecrypted = TRUE;
|
||||
execInfo->isDecrypted = SCE_TRUE;
|
||||
break; //0x000057DC
|
||||
case DECRYPT_MODE_UNKNOWN_23:
|
||||
if ((header->modAttribute & SCE_PRIVILEGED_MODULES) != SCE_MODULE_USER) //0x00005CB8
|
||||
@ -1334,7 +1334,7 @@ static s32 PspUncompress(u8 *modBuf, SceLoadCoreExecFileInfo *execInfo,
|
||||
if (sceMesgLed_driver_91E0A9AD(modBuf, execInfo->execSize, newSize, execInfo->unk104) != SCE_ERROR_OK) //0x00005958
|
||||
return SCE_ERROR_KERNEL_UNSUPPORTED_PRX_TYPE;
|
||||
|
||||
execInfo->isDecrypted = TRUE;
|
||||
execInfo->isDecrypted = SCE_TRUE;
|
||||
break; //0x000057DC
|
||||
case DECRYPT_MODE_UNKNOWN_25:
|
||||
if ((header->modAttribute & SCE_PRIVILEGED_MODULES) != SCE_MODULE_USER) //0x00005CE4
|
||||
@ -1343,7 +1343,7 @@ static s32 PspUncompress(u8 *modBuf, SceLoadCoreExecFileInfo *execInfo,
|
||||
if (sceMesgLed_driver_31D6D8AA(modBuf, execInfo->execSize, newSize, execInfo->unk104) != SCE_ERROR_OK) //0x00005958
|
||||
return SCE_ERROR_KERNEL_UNSUPPORTED_PRX_TYPE;
|
||||
|
||||
execInfo->isDecrypted = TRUE;
|
||||
execInfo->isDecrypted = SCE_TRUE;
|
||||
break; //0x000057DC
|
||||
default:
|
||||
return SCE_ERROR_KERNEL_UNSUPPORTED_PRX_TYPE;
|
||||
@ -1384,7 +1384,7 @@ static s32 PspUncompress(u8 *modBuf, SceLoadCoreExecFileInfo *execInfo,
|
||||
if (status < SCE_ERROR_OK) { //0x00005868
|
||||
return status; //0x00005884
|
||||
} else if ((u32)status == execInfo->decSize) { //0x0005874
|
||||
execInfo->isDecompressed = TRUE; //0x00005890
|
||||
execInfo->isDecompressed = SCE_TRUE; //0x00005890
|
||||
return status; //0x00005884
|
||||
}
|
||||
else //0x5884
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* Copyright (C) 2011, 2012 The uOFW team
|
||||
/* Copyright (C) 2011, 2012, 2013 The uOFW team
|
||||
See the file COPYING for copying permission.
|
||||
*/
|
||||
|
||||
@ -35,9 +35,6 @@
|
||||
#define UID_MODULE_DO_INITIALIZE (0xD310D2D9)
|
||||
#define UID_MODULE_DO_DELETE (0x87089863)
|
||||
|
||||
#define MODULE_VERSION_MINOR (0)
|
||||
#define MODULE_VERSION_MAJOR (1)
|
||||
|
||||
#define MODULE_TEMPORARY_UID_NAME "SceModuleTmp"
|
||||
#define MODULE_UID_TYPE_NAME "SceModule"
|
||||
|
||||
|
@ -122,7 +122,7 @@ s32 SyscallTableInit(u32 seed, SceSyscallTable **syscallTable)
|
||||
//0x00000424 - 0x00000440
|
||||
/* Initialize the first SYSCALL table entry. */
|
||||
g_pSysEntControl->next = NULL;
|
||||
g_pSysEntControl->inUse = FALSE;
|
||||
g_pSysEntControl->inUse = SCE_FALSE;
|
||||
g_pSysEntControl->numEntries = SYSCALL_TABLE_DEFAULT_ENTRIES;
|
||||
g_pSysEntControl->startAddr = 0;
|
||||
|
||||
@ -175,7 +175,7 @@ s32 AllocSysTable(u16 numEntries)
|
||||
* used by another request.
|
||||
*/
|
||||
if (sysTableEntry->numEntries == numEntries) { //0x000004F4
|
||||
sysTableEntry->inUse = TRUE;
|
||||
sysTableEntry->inUse = SCE_TRUE;
|
||||
return sysTableEntry->startAddr;
|
||||
}
|
||||
/*
|
||||
@ -196,12 +196,12 @@ s32 AllocSysTable(u16 numEntries)
|
||||
newSysTableEntry = g_pFreeSysEnt; //0x00000544
|
||||
g_pFreeSysEnt = g_pFreeSysEnt->next;
|
||||
}
|
||||
newSysTableEntry->inUse = FALSE; //0x00000550
|
||||
newSysTableEntry->inUse = SCE_FALSE; //0x00000550
|
||||
newSysTableEntry->startAddr = sysTableEntry->startAddr + numEntries; //0x0000055C
|
||||
newSysTableEntry->numEntries = sysTableEntry->numEntries - numEntries;
|
||||
newSysTableEntry->next = sysTableEntry->next;
|
||||
|
||||
sysTableEntry->inUse = TRUE; //0x00000578
|
||||
sysTableEntry->inUse = SCE_TRUE; //0x00000578
|
||||
sysTableEntry->numEntries = numEntries;
|
||||
sysTableEntry->next = newSysTableEntry;
|
||||
|
||||
@ -251,11 +251,11 @@ SceSysCallEntryTable *FreeSysTable(u32 sysTableEntryAddr)
|
||||
curSysTableEntry->startAddr != sysTableEntryAddr; curSysTableEntry = curSysTableEntry->next)
|
||||
prevSysTableEntry = curSysTableEntry;
|
||||
|
||||
if (curSysTableEntry == NULL || curSysTableEntry->inUse == FALSE) //0x00000614 & 0x00000624
|
||||
if (curSysTableEntry == NULL || curSysTableEntry->inUse == SCE_FALSE) //0x00000614 & 0x00000624
|
||||
return NULL;
|
||||
|
||||
/* Once found, mark it as being unused. */
|
||||
curSysTableEntry->inUse = FALSE; //0x00000630 & 0x00000638
|
||||
curSysTableEntry->inUse = SCE_FALSE; //0x00000630 & 0x00000638
|
||||
|
||||
/*
|
||||
* If the previous system-call-entry-table is currently being
|
||||
@ -263,7 +263,7 @@ SceSysCallEntryTable *FreeSysTable(u32 sysTableEntryAddr)
|
||||
* table back into the list of currently free system call
|
||||
* entry-tables if it was unlinked from it during allocation process.
|
||||
*/
|
||||
if (prevSysTableEntry != NULL && prevSysTableEntry->inUse == FALSE) { //0x00000634
|
||||
if (prevSysTableEntry != NULL && prevSysTableEntry->inUse == SCE_FALSE) { //0x00000634
|
||||
prevSysTableEntry->numEntries += curSysTableEntry->numEntries; //0x0000065C & 0x00000664
|
||||
prevSysTableEntry->next = curSysTableEntry->next; //0x0000066C
|
||||
|
||||
|
@ -1,34 +1,9 @@
|
||||
/* Copyright (C) 2011, 2012 The uOFW team
|
||||
/* Copyright (C) 2011, 2012, 2013 The uOFW team
|
||||
See the file COPYING for copying permission.
|
||||
*/
|
||||
|
||||
#include <common_imp.h>
|
||||
|
||||
/** Structure for LoadExecVSH* functions */
|
||||
typedef struct
|
||||
{
|
||||
/** Size of the structure in bytes */
|
||||
SceSize size;
|
||||
/** Size of the arguments string */
|
||||
SceSize args;
|
||||
/** Pointer to the arguments strings */
|
||||
void *argp;
|
||||
/** The key, usually "game", "updater" or "vsh" */
|
||||
const char *key;
|
||||
/** The size of the vshmain arguments */
|
||||
u32 vshmainArgs;
|
||||
/** vshmain arguments that will be passed to vshmain after the program has exited */
|
||||
void *vshmainArgp;
|
||||
/** "/kd/pspbtcnf_game.txt" or "/kd/pspbtcnf.txt" if not supplied (max. 256 chars) */
|
||||
char *configFile;
|
||||
/** An unknown string (max. 256 chars) probably used in 2nd stage of loadexec */
|
||||
u32 unk4;
|
||||
/** unknown flag default value = 0x10000 */
|
||||
u32 flags;
|
||||
u32 unkArgs;
|
||||
void *unkArgp;
|
||||
u32 opt11;
|
||||
} SceKernelLoadExecVSHParam;
|
||||
#include <loadexec.h>
|
||||
|
||||
typedef struct
|
||||
{
|
||||
|
@ -5,7 +5,7 @@
|
||||
/*
|
||||
* uOFW/trunk/src/systimer/systimer.c
|
||||
*
|
||||
* sceSystimer - a library to manage PSP hardware timer.
|
||||
* sceSystimer - a library to manage PSP hardware timers.
|
||||
*
|
||||
* The system timer module's main purpose is to provide service functions
|
||||
* for allocating and freeing hardware timers, registering interrupt handlers,
|
||||
@ -36,26 +36,42 @@ SCE_SDK_VERSION(SDK_VERSION);
|
||||
/* The number of hardware timers to use. */
|
||||
#define TIMER_NUM_HW_TIMERS 4
|
||||
|
||||
/* Indicates that a time-up handler is set for the specific timer. */
|
||||
#define TIMER_STATE_HANDLER_REGISTERED 0x00400000
|
||||
/* Timer modes */
|
||||
#define TIMER_MODE_HANDLER_REGISTERED (1 << 0) /* Indicates that a time-up handler is set for the specific timer. */
|
||||
#define TIMER_MODE_IN_USE (1 << 1) /* Indicates that the timer is in use. */
|
||||
#define TIMER_MODE_UNKNOWN (1 << 9) /* Unknown timer mode. */
|
||||
#define TIMER_MODE_MAX TIMER_MODE_UNKNOWN /* Max timer mode. Keep this the last entry. */
|
||||
|
||||
/* Indicates that the timer is in use. */
|
||||
#define TIMER_STATE_IN_USE 0x00800000
|
||||
|
||||
/* Recieve the counter register value. */
|
||||
/* Receive the counter register value. */
|
||||
#define TIMER_GET_COUNT(data) ((data) & TIMER_MAX_COUNTER_VALUE)
|
||||
|
||||
/* Receive the state of the specific timer. */
|
||||
#define TIMER_GET_STATE(data) ((u32)(data) >> 24)
|
||||
#define TIMER_GET_MODE(data) ((u32)(data) >> 22)
|
||||
|
||||
#define TIMER_SET_COUNT(count) ((count) & TIMER_MAX_COUNTER_VALUE)
|
||||
|
||||
#define TIMER_SET_MODE(mode) ((mode) << 22)
|
||||
|
||||
/*
|
||||
* This structure represents a hardware timer.
|
||||
*/
|
||||
typedef struct {
|
||||
/* Timer data. Includes the timer's state and its counter value. */
|
||||
/*
|
||||
* 31 22 21 0
|
||||
* +------------+--------------+
|
||||
* | TIMER MODE | APPLY TIME |
|
||||
* +------------+--------------+
|
||||
*
|
||||
* Bit 31 - 22:
|
||||
* The current timer mode.
|
||||
*
|
||||
* Bit 21 - 0:
|
||||
* The system time when the timer was stopped. It is overwritten every time
|
||||
* the timer is stopped.
|
||||
*/
|
||||
s32 timerData;
|
||||
/* Unknown. Used to calculate the current counter register value. */
|
||||
s32 unk4;
|
||||
/* Assumed. The base time of the hardware timer. */
|
||||
s32 baseTime;
|
||||
/* The numerator of the timer's prescale. */
|
||||
s32 prsclNumerator;
|
||||
/* The denominator of the timer's prescale. */
|
||||
@ -63,11 +79,19 @@ typedef struct {
|
||||
/* Reserved. */
|
||||
s32 rsrv[240];
|
||||
/*
|
||||
* Timer data. Includes the timer's state and its counter value.
|
||||
* Seems to be the hardware register holding all original count and
|
||||
* timer state data.
|
||||
* 31 22 21 0
|
||||
* +------------+--------------+
|
||||
* | TIMER MODE | APPLY TIME |
|
||||
* +------------+--------------+
|
||||
*
|
||||
* Bit 31 - 22:
|
||||
* The current timer mode.
|
||||
*
|
||||
* Bit 21 - 0:
|
||||
* The current PSP's system time value. A timer's current count is computed
|
||||
* by subtracting the timer's base time (the init time point) from this value.
|
||||
*/
|
||||
s32 data;
|
||||
s32 nowData;
|
||||
} SceHwTimer;
|
||||
|
||||
/* This structure represents a timer connected to a hardware timer. */
|
||||
@ -95,7 +119,19 @@ typedef struct {
|
||||
* so this data can be re-set when the timer is resumed.
|
||||
*/
|
||||
typedef struct {
|
||||
/* Timer data. Includes the timer's state and its counter value. */
|
||||
/*
|
||||
* 31 22 21 0
|
||||
* +------------+--------------+
|
||||
* | TIMER MODE | APPLY TIME |
|
||||
* +------------+--------------+
|
||||
*
|
||||
* Bit 31 - 22:
|
||||
* The saved timer mode.
|
||||
*
|
||||
* Bit 21 - 0:
|
||||
* The saved system time when the timer was stopped. It is set when the
|
||||
* corresponding timer is suspended.
|
||||
*/
|
||||
s32 sTimerData;
|
||||
/* The numerator of the timer's prescale. */
|
||||
s32 sPrsclNumerator;
|
||||
@ -146,7 +182,8 @@ SceSysTimer timers[TIMER_NUM_HW_TIMERS] = {
|
||||
},
|
||||
};
|
||||
|
||||
s32 initVar = 0x00352341;
|
||||
/* The base value for a timer ID. */
|
||||
s32 baseTimerId = 0x00352341;
|
||||
|
||||
/* Collects important data for each individual hardware timer. */
|
||||
SceSysTimerSave STimerRegSave[TIMER_NUM_HW_TIMERS];
|
||||
@ -163,7 +200,7 @@ s32 SysTimerInit(s32 argc __attribute__((unused)), void *argp __attribute__((unu
|
||||
|
||||
s32 i;
|
||||
for (i = 0; i < TIMER_NUM_HW_TIMERS; i++) {
|
||||
timers[i].hw->timerData = 0x80000000;
|
||||
timers[i].hw->timerData = TIMER_SET_MODE(TIMER_MODE_UNKNOWN) | TIMER_SET_COUNT(0);
|
||||
timers[i].hw->prsclNumerator = -1;
|
||||
timers[i].hw->prsclDenominator = -1;
|
||||
//(void)timers[i].hw->unk0;
|
||||
@ -201,7 +238,7 @@ static s32 systimerhandler(s32 arg0 __attribute__((unused)), SceSysTimer *timer,
|
||||
if (timer->cb == NULL)
|
||||
return -1;
|
||||
|
||||
s32 v1 = TIMER_GET_STATE(timer->hw->timerData);
|
||||
s32 v1 = TIMER_GET_MODE(timer->hw->timerData);
|
||||
s32 v2 = TIMER_GET_COUNT(timer->hw->timerData);
|
||||
if (timer->unk12 != 0) {
|
||||
v1--;
|
||||
@ -217,16 +254,18 @@ static s32 systimerhandler(s32 arg0 __attribute__((unused)), SceSysTimer *timer,
|
||||
return -1;
|
||||
}
|
||||
|
||||
/* Stope the hardware timer counting. */
|
||||
/* Stop the hardware timer counting. */
|
||||
static void _sceSTimerStopCount(SceSysTimer *timer)
|
||||
{
|
||||
timer->hw->timerData = timer->hw->data & ~(TIMER_STATE_IN_USE | 0x80000000);
|
||||
//timer->hw->timerData = timer->hw->data & ~(TIMER_MODE_IN_USE | 0x80000000);
|
||||
timer->hw->timerData = TIMER_SET_MODE(TIMER_GET_MODE(timer->hw->nowData) & ~(TIMER_MODE_IN_USE | TIMER_MODE_UNKNOWN));
|
||||
timer->hw->timerData |= TIMER_SET_COUNT(TIMER_GET_COUNT(timer->hw->nowData));
|
||||
}
|
||||
|
||||
/* Get the current value of the hardware timer counter register. */
|
||||
static s32 _sceSTimerGetCount(SceSysTimer *timer)
|
||||
{
|
||||
return (TIMER_GET_COUNT(timer->hw->data) - TIMER_GET_COUNT(timer->hw->unk4));
|
||||
//TODO: timer->hw->ulNowTime - timer->hw->ulBaseTime ?
|
||||
return (TIMER_GET_COUNT(timer->hw->nowData) - TIMER_GET_COUNT(timer->hw->baseTime));
|
||||
}
|
||||
|
||||
/*
|
||||
@ -273,17 +312,17 @@ s32 sceSTimerAlloc(void)
|
||||
for (i = 0; i < TIMER_NUM_HW_TIMERS; i++) {
|
||||
if (timers[i].timerId == -1) {
|
||||
timers[i].cb = NULL;
|
||||
timers[i].hw->timerData = 0x80000000;
|
||||
//timers[i].hw->timerData = 0x80000000;
|
||||
timers[i].hw->timerData = TIMER_SET_MODE(TIMER_MODE_UNKNOWN) | TIMER_SET_COUNT(0);
|
||||
timers[i].hw->prsclNumerator = -1;
|
||||
timers[i].hw->prsclDenominator = -1;
|
||||
//(void)timers[i].hw->unk0;
|
||||
timers[i].timerId = -1;
|
||||
timers[i].unk12 = 0;
|
||||
timers[i].unk16 = 0;
|
||||
timers[i].count = 0;
|
||||
timers[i].common = NULL;
|
||||
timers[i].timerId = ((initVar << 2) | i) & 0x7FFFFFFF;
|
||||
initVar += 7;
|
||||
timers[i].timerId = ((baseTimerId << 2) | i) & 0x7FFFFFFF;
|
||||
baseTimerId += 7;
|
||||
|
||||
sceKernelCpuResumeIntr(oldIntr);
|
||||
return timers[i].timerId;
|
||||
@ -306,7 +345,8 @@ s32 sceSTimerFree(s32 timerId)
|
||||
|
||||
_sceSTimerStopCount(timer);
|
||||
sceKernelDisableIntr(timer->intrNum);
|
||||
timer->hw->timerData = 0x80000000;
|
||||
//timer->hw->timerData = 0x80000000;
|
||||
timer->hw->timerData = TIMER_SET_MODE(TIMER_MODE_UNKNOWN) | TIMER_SET_COUNT(0);
|
||||
timer->hw->prsclNumerator = -1;
|
||||
timer->hw->prsclDenominator = -1;
|
||||
timer->cb = NULL;
|
||||
@ -329,11 +369,12 @@ s32 sceSTimerStartCount(s32 timerId)
|
||||
|
||||
s32 oldIntr = sceKernelCpuSuspendIntr();
|
||||
|
||||
if (timer->hw->data & TIMER_STATE_IN_USE) {
|
||||
if (TIMER_GET_MODE(timer->hw->nowData) & TIMER_MODE_IN_USE) {
|
||||
sceKernelCpuResumeIntr(oldIntr);
|
||||
return SCE_ERROR_KERNEL_TIMER_BUSY;
|
||||
}
|
||||
timer->hw->timerData = timer->hw->data | TIMER_STATE_IN_USE;
|
||||
timer->hw->timerData = TIMER_SET_MODE(TIMER_GET_MODE(timer->hw->nowData) | TIMER_MODE_IN_USE);
|
||||
timer->hw->timerData |= TIMER_SET_COUNT(0);
|
||||
|
||||
sceKernelCpuResumeIntr(oldIntr);
|
||||
return SCE_ERROR_OK;
|
||||
@ -361,7 +402,8 @@ s32 sceSTimerResetCount(s32 timerId)
|
||||
|
||||
s32 oldIntr = sceKernelCpuSuspendIntr();
|
||||
|
||||
timer->hw->timerData |= 0x80000000;
|
||||
//timer->hw->timerData |= 0x80000000;
|
||||
timer->hw->timerData |= TIMER_SET_MODE(TIMER_MODE_UNKNOWN);
|
||||
timer->count = 0;
|
||||
|
||||
sceKernelCpuResumeIntr(oldIntr);
|
||||
@ -396,7 +438,7 @@ s32 sceSTimerSetPrscl(s32 timerId, s32 numerator, s32 denominator)
|
||||
|
||||
s32 oldIntr = sceKernelCpuSuspendIntr();
|
||||
|
||||
if (timer->hw->data & TIMER_STATE_IN_USE) {
|
||||
if (TIMER_GET_MODE(timer->hw->nowData) & TIMER_MODE_IN_USE) {
|
||||
sceKernelCpuResumeIntr(oldIntr);
|
||||
return SCE_ERROR_KERNEL_TIMER_BUSY;
|
||||
}
|
||||
@ -427,9 +469,10 @@ s32 sceSTimerSetHandler(s32 timerId, s32 compareValue, SceSysTimerCb timeUpHandl
|
||||
} else {
|
||||
timer->cb = timeUpHandler;
|
||||
timer->common = common;
|
||||
timer->hw->timerData = timer->hw->data & ~TIMER_MAX_COUNTER_VALUE;
|
||||
//timer->hw->nowData & ~TIMER_MAX_COUNTER_VALUE
|
||||
timer->hw->timerData = TIMER_SET_MODE(TIMER_GET_MODE(timer->hw->nowData)) | TIMER_SET_COUNT(0);
|
||||
timer->hw->timerData |= compareValue;
|
||||
timer->hw->timerData = timer->hw->data | (0x80000000 | TIMER_STATE_HANDLER_REGISTERED);
|
||||
timer->hw->timerData = timer->hw->nowData | TIMER_SET_MODE(TIMER_MODE_UNKNOWN | TIMER_MODE_HANDLER_REGISTERED);
|
||||
sceKernelEnableIntr(timer->intrNum);
|
||||
}
|
||||
sceKernelCpuResumeIntr(oldIntr);
|
||||
@ -445,12 +488,16 @@ s32 sceSTimerSetTMCY(s32 timerId, s32 arg1)
|
||||
s32 oldIntr = sceKernelCpuSuspendIntr();
|
||||
|
||||
s32 val = TIMER_GET_COUNT(timer->hw->data);
|
||||
s32 val2 = TIMER_GET_STATE(timer->hw->data);
|
||||
s32 val2 = TIMER_GET_MODE(timer->hw->data);
|
||||
timer->unk12 = val;
|
||||
timer->unk16 = val2;
|
||||
timer->count += val * (val2 - timer->unk16);
|
||||
timer->hw->timerData = (timer->hw->data & ~TIMER_MAX_COUNTER_VALUE) | ((arg1 - 1 > TIMER_MAX_COUNTER_VALUE)
|
||||
? TIMER_MAX_COUNTER_VALUE : arg1 - 1);
|
||||
|
||||
u32 mode = TIMER_GET_MODE(timer->hw->nowData);
|
||||
if ((arg1 - 1) > TIMER_MAX_COUNTER_VALUE)
|
||||
timer->hw->timerData = TIMER_SET_MODE(mode) | TIMER_SET_COUNT(TIMER_MAX_COUNTER_VALUE);
|
||||
else
|
||||
timer->hw->timerData = TIMER_SET_MODE(mode) | TIMER_SET_COUNT(arg1 - 1);
|
||||
|
||||
sceKernelCpuResumeIntr(oldIntr);
|
||||
return SCE_ERROR_OK;
|
||||
|
@ -16,7 +16,7 @@ SCE_MODULE_INFO(
|
||||
SCE_MODULE_ATTR_CANT_STOP | SCE_MODULE_ATTR_EXCLUSIVE_LOAD | SCE_MODULE_ATTR_EXCLUSIVE_START,
|
||||
1, 6
|
||||
);
|
||||
SCE_MODULE_START_THREAD_PARAMETER(3, 0x20, 0x400, 0);
|
||||
SCE_MODULE_START_THREAD_PARAMETER(3, SCE_KERNEL_MODULE_INIT_PRIORITY, 0x400, 0);
|
||||
SCE_MODULE_BOOTSTART("_UsersystemLibInit");
|
||||
SCE_SDK_VERSION(SDK_VERSION);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user