mirror of
https://github.com/joel16/PSP-Everest.git
synced 2024-11-23 03:29:48 +00:00
Fix compilation on new psp toolchain
This commit is contained in:
parent
0bc065b649
commit
c491c231dc
53
.gitignore
vendored
Normal file
53
.gitignore
vendored
Normal file
@ -0,0 +1,53 @@
|
||||
# Prerequisites
|
||||
*.d
|
||||
|
||||
# Object files
|
||||
*.o
|
||||
*.ko
|
||||
*.obj
|
||||
*.elf
|
||||
|
||||
# Linker output
|
||||
*.ilk
|
||||
*.map
|
||||
# *.exp
|
||||
|
||||
# Precompiled Headers
|
||||
*.gch
|
||||
*.pch
|
||||
|
||||
# Libraries
|
||||
*.lib
|
||||
# *.a
|
||||
*.la
|
||||
*.lo
|
||||
|
||||
# Shared objects (inc. Windows DLLs)
|
||||
*.dll
|
||||
*.so
|
||||
*.so.*
|
||||
*.dylib
|
||||
|
||||
# Executables
|
||||
*.exe
|
||||
*.out
|
||||
*.app
|
||||
*.i*86
|
||||
*.x86_64
|
||||
*.hex
|
||||
|
||||
# Debug files
|
||||
*.dSYM/
|
||||
*.su
|
||||
*.idb
|
||||
*.pdb
|
||||
*.PBP
|
||||
|
||||
# Kernel Module Compile Results
|
||||
*.mod*
|
||||
*.cmd
|
||||
.tmp_versions/
|
||||
modules.order
|
||||
Module.symvers
|
||||
Mkfile.old
|
||||
dkms.conf
|
10
Makefile
10
Makefile
@ -1,21 +1,23 @@
|
||||
TARGET = EVEREST
|
||||
OBJS = crt0.o main.o utils.o hardware_utils.o system_utils.o translate.o imports.o everest_kernel/everest_kernel.o kumdman/pspUmdMan_driver.o
|
||||
|
||||
INCDIR = libs/include include
|
||||
CFLAGS = -O2 -G0 -Wall -fshort-wchar -fno-pic -mno-check-zero-division
|
||||
CXXFLAGS = $(CFLAGS) -fno-exceptions -fno-rtti
|
||||
ASFLAGS = $(CFLAGS) -c
|
||||
|
||||
LDFLAGS = -mno-crt0 -nostdlib -nodefaultlibs
|
||||
LDFLAGS = -nostdlib -nodefaultlibs
|
||||
|
||||
STDLIBS = -lpsprtc -lvlfgui -lvlfgu -lvlfutils -lvlflibc -lpsppower -lpspkubridge
|
||||
LIBDIR = libs/lib
|
||||
STDLIBS = -lpspmodinfo -lpsprtc -lvlfgui -lvlfgu -lvlfutils -lvlflibc -lpsppower -lpspkubridge
|
||||
LIBS = $(STDLIBS) -lpspreg
|
||||
|
||||
PSP_FW_VERSION = 271
|
||||
|
||||
EXTRA_TARGETS = EBOOT.PBP
|
||||
PSP_EBOOT_TITLE = PSP EVEREST 2
|
||||
PSP_EBOOT_TITLE = PSP EVEREST 2 Rev6
|
||||
PSP_EBOOT_ICON = ICON0.PNG
|
||||
PSP_EBOOT_PIC1 = PIC1.PNG
|
||||
PSP_EBOOT_PIC1 = PIC1.png
|
||||
|
||||
BUILD_PRX = 1
|
||||
PSP_LARGE_MEMORY = 1
|
||||
|
BIN
PIC1.png
BIN
PIC1.png
Binary file not shown.
Before Width: | Height: | Size: 16 KiB After Width: | Height: | Size: 18 KiB |
14
compile.bat → compile.sh
Normal file → Executable file
14
compile.bat → compile.sh
Normal file → Executable file
@ -1,13 +1,13 @@
|
||||
PATH = c:/pspsdk_old/bin
|
||||
#!/bin/sh
|
||||
|
||||
cd everest_kernel
|
||||
make
|
||||
make clean && make
|
||||
psp-build-exports -s exports.exp
|
||||
bin2c everest_kernel.prx ../everest_kernel_prx.h everest_kernel_prx
|
||||
rm *.o *.elf *.prx
|
||||
|
||||
cd ../kumdman
|
||||
make
|
||||
make clean && make
|
||||
psp-build-exports -s exports.exp
|
||||
bin2c kumdman.prx ../kumdman_prx.h kumdman_prx
|
||||
rm *.o *.elf *.prx
|
||||
@ -17,10 +17,8 @@ bin2c intraFont.prx ../intraFont_prx.h intraFont_prx
|
||||
bin2c vlf.prx ../vlf_prx.h vlf_prx
|
||||
|
||||
cd ..
|
||||
rm *.pbp
|
||||
rm *.PBP
|
||||
bin2c backgrounds.bmp backgrounds_bmp.h backgrounds_bmp
|
||||
make
|
||||
rm *.o *.prx *.elf *.sfo backgrounds_bmp.h everest_kernel_prx.h kumdman_prx.h intraFont_prx.h vlf_prx.h
|
||||
make clean && make
|
||||
rm *.o *.prx *.elf *.SFO backgrounds_bmp.h everest_kernel_prx.h kumdman_prx.h intraFont_prx.h vlf_prx.h
|
||||
rm everest_kernel/everest_kernel.S everest_kernel/everest_kernel.o kumdman/pspUmdMan_driver.S kumdman/pspUmdMan_driver.o
|
||||
|
||||
pause
|
20
crt0.c
20
crt0.c
@ -13,16 +13,11 @@
|
||||
#include "vlf_prx.h"
|
||||
|
||||
extern int app_main(int argc, char *argv[]);
|
||||
int language;
|
||||
|
||||
int SetupCallbacks(void)
|
||||
{
|
||||
int CallbackThread(SceSize args, void *argp)
|
||||
{
|
||||
int exit_callback(int arg1, int arg2, void *common)
|
||||
{
|
||||
int SetupCallbacks(void) {
|
||||
int CallbackThread(SceSize args, void *argp) {
|
||||
int exit_callback(int arg1, int arg2, void *common) {
|
||||
sceKernelExitGame();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -40,8 +35,7 @@ int SetupCallbacks(void)
|
||||
return thid;
|
||||
}
|
||||
|
||||
void LoadStartModuleBuffer(char *path, char *buf, int size, SceSize args, void *argp)
|
||||
{
|
||||
void LoadStartModuleBuffer(char *path, char *buf, int size, SceSize args, void *argp) {
|
||||
SceUID mod, out;
|
||||
|
||||
sceIoRemove(path);
|
||||
@ -54,8 +48,7 @@ void LoadStartModuleBuffer(char *path, char *buf, int size, SceSize args, void *
|
||||
sceIoRemove(path);
|
||||
}
|
||||
|
||||
int start_thread(SceSize args, void *argp)
|
||||
{
|
||||
int start_thread(SceSize args, void *argp) {
|
||||
char *path = (char *)argp;
|
||||
int last_trail = -1;
|
||||
|
||||
@ -83,8 +76,7 @@ int start_thread(SceSize args, void *argp)
|
||||
return sceKernelExitDeleteThread(0);
|
||||
}
|
||||
|
||||
int module_start(SceSize args, void *argp)
|
||||
{
|
||||
int module_start(SceSize args, void *argp) {
|
||||
SetupCallbacks();
|
||||
psp_model = kuKernelGetModel();
|
||||
sceUtilityGetSystemParamInt(PSP_SYSTEMPARAM_ID_INT_LANGUAGE, &language);
|
||||
|
@ -1,21 +1,21 @@
|
||||
#ifndef ___KPSPIDENT_H___
|
||||
#define ___KPSPIDENT_H___
|
||||
|
||||
u32 sceSysconGetBaryonVersion(u32 *baryon);// 0x7EC5A957
|
||||
u32 sceSysconGetPommelVersion(u32 *pommel);// 0xE7E87741
|
||||
u32 sceSysregGetTachyonVersion(void);// 0xE2A5D1EE
|
||||
u64 sceSysregGetFuseId(void);// 0x4F46EEDE
|
||||
u32 sceSysregGetFuseConfig(void);// 0x8F4F4E96
|
||||
u32 pspGetBaryonVersion(u32 *baryon); // 0x7EC5A957
|
||||
u32 pspGetPommelVersion(u32 *pommel); // 0xE7E87741
|
||||
u32 pspGetTachyonVersion(void); // 0xE2A5D1EE
|
||||
u64 pspGetFuseId(void); // 0x4F46EEDE
|
||||
u32 pspGetFuseConfig(void); // 0x8F4F4E96
|
||||
u32 pspGetKirkVersion(void);
|
||||
u32 pspGetSpockVersion(void);
|
||||
u32 pspNandGetScramble(void);
|
||||
int GetRegion(void);
|
||||
char *GetInitialFW(void);
|
||||
int pspGetRegion(void);
|
||||
char *pspGetInitialFW(void);
|
||||
int pspNandGetPageSize(void);
|
||||
int pspNandGetTotalBlocks(void);
|
||||
int pspNandGetPagesPerBlock(void);
|
||||
u8 *GetMACAddress(u8 *buf);
|
||||
int ReadSerial(u16 *pdata);
|
||||
int WriteSerial(u16* serial);
|
||||
u8 *pspGetMACAddress(u8 *buf);
|
||||
int pspReadSerial(u16 *pdata);
|
||||
int pspWriteSerial(u16* serial);
|
||||
|
||||
#endif
|
||||
|
@ -11,9 +11,9 @@ PSP_FW_VERSION = 271
|
||||
BUILD_PRX = 1
|
||||
PRX_EXPORTS = exports.exp
|
||||
|
||||
LDFLAGS = -mno-crt0 -nostartfiles
|
||||
LDFLAGS = -nostartfiles
|
||||
|
||||
LIBS = -lpspkernel -lpspident -lpspnand_driver -lpspwlan
|
||||
LIBS = -lpspkernel -lpspnand_driver -lpspwlan
|
||||
|
||||
PSPSDK=$(shell psp-config --pspsdk-path)
|
||||
include $(PSPSDK)/lib/build.mak
|
||||
|
@ -6,22 +6,22 @@ PSP_BEGIN_EXPORTS
|
||||
PSP_EXPORT_END
|
||||
|
||||
PSP_EXPORT_START(everest_kernel, 0, 0x4001)
|
||||
PSP_EXPORT_FUNC_HASH(sceSysconGetBaryonVersion)
|
||||
PSP_EXPORT_FUNC_HASH(sceSysconGetPommelVersion)
|
||||
PSP_EXPORT_FUNC_HASH(sceSysregGetTachyonVersion)
|
||||
PSP_EXPORT_FUNC_HASH(sceSysregGetFuseId)
|
||||
PSP_EXPORT_FUNC_HASH(sceSysregGetFuseConfig)
|
||||
PSP_EXPORT_FUNC_HASH(pspGetBaryonVersion)
|
||||
PSP_EXPORT_FUNC_HASH(pspGetPommelVersion)
|
||||
PSP_EXPORT_FUNC_HASH(pspGetTachyonVersion)
|
||||
PSP_EXPORT_FUNC_HASH(pspGetFuseId)
|
||||
PSP_EXPORT_FUNC_HASH(pspGetFuseConfig)
|
||||
PSP_EXPORT_FUNC_HASH(pspGetKirkVersion)
|
||||
PSP_EXPORT_FUNC_HASH(pspGetSpockVersion)
|
||||
PSP_EXPORT_FUNC_HASH(pspNandGetScramble)
|
||||
PSP_EXPORT_FUNC_HASH(GetRegion)
|
||||
PSP_EXPORT_FUNC_HASH(GetInitialFW)
|
||||
PSP_EXPORT_FUNC_HASH(pspGetRegion)
|
||||
PSP_EXPORT_FUNC_HASH(pspGetInitialFW)
|
||||
PSP_EXPORT_FUNC_HASH(pspNandGetPageSize)
|
||||
PSP_EXPORT_FUNC_HASH(pspNandGetPagesPerBlock)
|
||||
PSP_EXPORT_FUNC_HASH(pspNandGetTotalBlocks)
|
||||
PSP_EXPORT_FUNC_HASH(GetMACAddress)
|
||||
PSP_EXPORT_FUNC_HASH(WriteSerial)
|
||||
PSP_EXPORT_FUNC_HASH(ReadSerial)
|
||||
PSP_EXPORT_FUNC_HASH(pspGetMACAddress)
|
||||
PSP_EXPORT_FUNC_HASH(pspWriteSerial)
|
||||
PSP_EXPORT_FUNC_HASH(pspReadSerial)
|
||||
PSP_EXPORT_END
|
||||
|
||||
PSP_END_EXPORTS
|
||||
|
@ -11,112 +11,87 @@
|
||||
PSP_MODULE_INFO("EVEREST_KERNEL", 0x1006, 7, 4);
|
||||
PSP_MAIN_THREAD_ATTR(0);
|
||||
|
||||
u32 sceSyscon_driver_7EC5A957(u32 *baryon);// Baryon
|
||||
u32 sceSyscon_driver_E7E87741(u32 *pommel);// Pommel
|
||||
u32 sceSysreg_driver_E2A5D1EE(void);// Tachyon
|
||||
u64 sceSysreg_driver_4F46EEDE(void);// FuseId
|
||||
u32 sceSysreg_driver_8F4F4E96(void);// FuseCfg
|
||||
int sceSysregKirkBusClockEnable(void);// Kirk
|
||||
int sceSysregAtaBusClockEnable(void);// Spock
|
||||
u32 sceSysconGetBaryonVersion(u32 *baryon); // Baryon
|
||||
u32 sceSysconGetPommelVersion(u32 *pommel); // Pommel
|
||||
u64 sceSysreg_driver_4F46EEDE(void); // FuseId
|
||||
u32 sceSysreg_driver_8F4F4E96(void); // FuseCfg
|
||||
int sceSysregKirkBusClockEnable(void); // Kirk
|
||||
int sceSysregAtaBusClockEnable(void); // Spock
|
||||
|
||||
u32 sceSyscon_readbat371(u8 addr);
|
||||
u32 sceSysconCmdExec(void *param, int unk);
|
||||
|
||||
u32 sceSysconGetBaryonVersion(u32 *baryon)
|
||||
{
|
||||
u32 pspGetBaryonVersion(u32 *baryon) {
|
||||
int k1 = pspSdkSetK1(0);
|
||||
|
||||
int err = sceSyscon_driver_7EC5A957(baryon);
|
||||
int err = sceSysconGetBaryonVersion(baryon);
|
||||
pspSdkSetK1(k1);
|
||||
|
||||
return err;
|
||||
}
|
||||
|
||||
u32 sceSysconGetPommelVersion(u32 *pommel)
|
||||
{
|
||||
u32 pspGetPommelVersion(u32 *pommel) {
|
||||
int k1 = pspSdkSetK1(0);
|
||||
|
||||
int err = sceSyscon_driver_E7E87741(pommel);
|
||||
int err = sceSysconGetPommelVersion(pommel);
|
||||
pspSdkSetK1(k1);
|
||||
|
||||
return err;
|
||||
}
|
||||
|
||||
u32 sceSysregGetTachyonVersion(void)
|
||||
{
|
||||
u32 pspGetTachyonVersion(void) {
|
||||
int k1 = pspSdkSetK1(0);
|
||||
|
||||
int err = sceSysreg_driver_E2A5D1EE();
|
||||
|
||||
int err = sceSysregGetTachyonVersion();
|
||||
pspSdkSetK1(k1);
|
||||
|
||||
return err;
|
||||
}
|
||||
|
||||
u64 sceSysregGetFuseId(void)
|
||||
{
|
||||
u64 pspGetFuseId(void) {
|
||||
int k1 = pspSdkSetK1(0);
|
||||
|
||||
u64 err = sceSysreg_driver_4F46EEDE();
|
||||
|
||||
pspSdkSetK1(k1);
|
||||
|
||||
return err;
|
||||
}
|
||||
|
||||
u32 sceSysregGetFuseConfig(void)
|
||||
{
|
||||
u32 pspGetFuseConfig(void) {
|
||||
int k1 = pspSdkSetK1(0);
|
||||
int err = sceSysreg_driver_8F4F4E96();
|
||||
pspSdkSetK1(k1);
|
||||
return err;
|
||||
}
|
||||
|
||||
u32 pspGetKirkVersion(void)
|
||||
{
|
||||
u32 pspGetKirkVersion(void) {
|
||||
int k1 = pspSdkSetK1(0);
|
||||
|
||||
sceSysregKirkBusClockEnable();
|
||||
sceKernelDelayThread(1000);
|
||||
int err = *(u32 *)0xBDE00004;
|
||||
|
||||
pspSdkSetK1(k1);
|
||||
|
||||
return err;
|
||||
}
|
||||
|
||||
u32 pspGetSpockVersion(void)
|
||||
{
|
||||
u32 pspGetSpockVersion(void) {
|
||||
int k1 = pspSdkSetK1(0);
|
||||
|
||||
sceSysregAtaBusClockEnable();
|
||||
sceKernelDelayThread(1000);
|
||||
int err = *(u32 *)0xBDF00004;
|
||||
pspSdkSetK1(k1);
|
||||
|
||||
return err;
|
||||
}
|
||||
|
||||
u32 pspNandGetScramble(void)
|
||||
{
|
||||
u32 pspNandGetScramble(void) {
|
||||
int k1 = pspSdkSetK1(0);
|
||||
|
||||
u32 magic;
|
||||
u32 magic = 0;
|
||||
u32 buf[4];
|
||||
u32 sha[5];
|
||||
|
||||
buf[0] = *(vu32 *)(0xBC100090);
|
||||
buf[1] = *(vu32 *)(0xBC100094);
|
||||
buf[2] = *(vu32 *)(0xBC100090) << 1;
|
||||
buf[3] = 0xD41D8CD9;
|
||||
|
||||
sceKernelUtilsSha1Digest((u8 *)buf, sizeof(buf), (u8 *)sha);
|
||||
magic = (sha[0] ^ sha[3]) + sha[2];
|
||||
pspSdkSetK1(k1);
|
||||
|
||||
return magic;
|
||||
}
|
||||
|
||||
void pspIdStorageLookup(u16 key, u32 offset, void *buf, u32 len)
|
||||
{
|
||||
void pspIdStorageLookup(u16 key, u32 offset, void *buf, u32 len) {
|
||||
int k1 = pspSdkSetK1(0);
|
||||
|
||||
memset(buf, 0, len);
|
||||
@ -138,95 +113,78 @@ void pspIdStorageLookup(u16 key, u32 offset, void *buf, u32 len)
|
||||
0x0C - Russia
|
||||
0x0D - China
|
||||
*/
|
||||
|
||||
int GetRegion(void)
|
||||
{
|
||||
int pspGetRegion(void) {
|
||||
u8 region[1];
|
||||
pspIdStorageLookup(0x100, 0x3D, region, 1);
|
||||
|
||||
if(region[0] == 0x03)//Japan
|
||||
if (region[0] == 0x03)//Japan
|
||||
return 0;
|
||||
else if(region[0] == 0x04)//America
|
||||
else if (region[0] == 0x04)//America
|
||||
return 1;
|
||||
else if(region[0] == 0x09)//Australia
|
||||
else if (region[0] == 0x09)//Australia
|
||||
return 2;
|
||||
else if(region[0] == 0x07)//United Kingdom
|
||||
else if (region[0] == 0x07)//United Kingdom
|
||||
return 3;
|
||||
else if(region[0] == 0x05)//Europe
|
||||
else if (region[0] == 0x05)//Europe
|
||||
return 4;
|
||||
else if(region[0] == 0x06)//Korea
|
||||
else if (region[0] == 0x06)//Korea
|
||||
return 5;
|
||||
else if(region[0] == 0x0A)//Hong-Kong
|
||||
else if (region[0] == 0x0A)//Hong-Kong
|
||||
return 6;
|
||||
else if(region[0] == 0x0B)//Taiwan
|
||||
else if (region[0] == 0x0B)//Taiwan
|
||||
return 7;
|
||||
else if(region[0] == 0x0C)//Russia
|
||||
else if (region[0] == 0x0C)//Russia
|
||||
return 8;
|
||||
else if(region[0] == 0x0D)//China
|
||||
else if (region[0] == 0x0D)//China
|
||||
return 9;
|
||||
else if(region[0] == 0x08)//Mexico
|
||||
else if (region[0] == 0x08)//Mexico
|
||||
return 10;
|
||||
else
|
||||
return -1;
|
||||
}
|
||||
|
||||
char *GetInitialFW(char *buf)
|
||||
{
|
||||
char *pspGetInitialFW(char *buf) {
|
||||
pspIdStorageLookup(0x51, 0, buf, 5);
|
||||
if(buf[0] == 0)
|
||||
|
||||
if (buf[0] == 0)
|
||||
sprintf(buf, "-");
|
||||
|
||||
return buf;
|
||||
}
|
||||
|
||||
int pspNandGetPageSize(void)
|
||||
{
|
||||
int pspNandGetPageSize(void) {
|
||||
int k1 = pspSdkSetK1(0);
|
||||
|
||||
int ret = sceNandGetPageSize();
|
||||
|
||||
pspSdkSetK1(k1);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
int pspNandGetPagesPerBlock(void)
|
||||
{
|
||||
int pspNandGetPagesPerBlock(void) {
|
||||
int k1 = pspSdkSetK1(0);
|
||||
|
||||
int ret = sceNandGetPagesPerBlock();
|
||||
|
||||
pspSdkSetK1(k1);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
int pspNandGetTotalBlocks(void)
|
||||
{
|
||||
int pspNandGetTotalBlocks(void) {
|
||||
int k1 = pspSdkSetK1(0);
|
||||
|
||||
int ret = sceNandGetTotalBlocks();
|
||||
|
||||
pspSdkSetK1(k1);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
u8 *GetMACAddress(u8 *buf)
|
||||
{
|
||||
u8 *pspGetMACAddress(u8 *buf) {
|
||||
sceWlanGetEtherAddr(buf);
|
||||
|
||||
return buf;
|
||||
}
|
||||
|
||||
u32 writeBat(u8 addr, u16 data)
|
||||
{
|
||||
u32 pspWriteBat(u8 addr, u16 data) {
|
||||
int k1 = pspSdkSetK1(0);
|
||||
|
||||
int res;
|
||||
int res = 0;
|
||||
u8 param[0x60];
|
||||
|
||||
if(addr > 0x7F)
|
||||
if (addr > 0x7F)
|
||||
return(0x80000102);
|
||||
|
||||
param[0x0C] = 0x73;
|
||||
@ -237,7 +195,7 @@ u32 writeBat(u8 addr, u16 data)
|
||||
|
||||
res = sceSysconCmdExec(param, 0);
|
||||
|
||||
if(res < 0)
|
||||
if (res < 0)
|
||||
return res;
|
||||
|
||||
pspSdkSetK1(k1);
|
||||
@ -245,22 +203,20 @@ u32 writeBat(u8 addr, u16 data)
|
||||
return 0;
|
||||
}
|
||||
|
||||
int WriteSerial(u16* serial)
|
||||
{
|
||||
int pspWriteSerial(u16 *serial) {
|
||||
int err = 0;
|
||||
|
||||
err = writeBat(0x07, serial[0]);
|
||||
if(!err)
|
||||
err = writeBat(0x09, serial[1]);
|
||||
err = pspWriteBat(0x07, serial[0]);
|
||||
if (!err)
|
||||
err = pspWriteBat(0x09, serial[1]);
|
||||
|
||||
return err;
|
||||
}
|
||||
|
||||
u32 ReadEEPROM(u8 addr)
|
||||
{
|
||||
u32 pspReadEEPROM(u8 addr) {
|
||||
u8 param[0x60];
|
||||
|
||||
if(addr > 0x7F)
|
||||
if (addr > 0x7F)
|
||||
return 0x80000102;
|
||||
|
||||
param[0x0C] = 0x74;
|
||||
@ -268,38 +224,35 @@ u32 ReadEEPROM(u8 addr)
|
||||
param[0x0E] = addr;
|
||||
|
||||
int res = sceSysconCmdExec(param, 0);
|
||||
if(res < 0)
|
||||
if (res < 0)
|
||||
return res;
|
||||
|
||||
return (param[0x21] << 8) | param[0x20];
|
||||
}
|
||||
|
||||
int ReadSerial(u16* pdata)
|
||||
{
|
||||
int pspReadSerial(u16 *pdata) {
|
||||
int err = 0;
|
||||
u32 data;
|
||||
|
||||
u32 k1 = pspSdkSetK1(0);
|
||||
|
||||
int errCheck(u32 chdata)
|
||||
{
|
||||
if((chdata & 0x80250000) == 0x80250000)
|
||||
int pspErrCheck(u32 chdata) {
|
||||
if ((chdata & 0x80250000) == 0x80250000)
|
||||
return -1;
|
||||
else if(chdata & 0xFFFF0000)
|
||||
else if (chdata & 0xFFFF0000)
|
||||
return(chdata & 0xFFFF0000) >> 16;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
data = ReadEEPROM(0x07);
|
||||
err = errCheck(data);
|
||||
data = pspReadEEPROM(0x07);
|
||||
err = pspErrCheck(data);
|
||||
|
||||
if(err >= 0)
|
||||
{
|
||||
if (err >= 0) {
|
||||
pdata[0] = (data & 0xFFFF);
|
||||
data = ReadEEPROM(0x09);
|
||||
err = errCheck(data);
|
||||
if(err >= 0)
|
||||
data = pspReadEEPROM(0x09);
|
||||
err = pspErrCheck(data);
|
||||
if (err >= 0)
|
||||
pdata[1] = (data & 0xFFFF);
|
||||
else
|
||||
err = data;
|
||||
@ -312,12 +265,10 @@ int ReadSerial(u16* pdata)
|
||||
return err;
|
||||
}
|
||||
|
||||
int module_start(SceSize args, void *argp)
|
||||
{
|
||||
int module_start(SceSize args __attribute__((unused)), void *argp __attribute__((unused))) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
int module_stop(void)
|
||||
{
|
||||
int module_stop(void) {
|
||||
return 0;
|
||||
}
|
||||
|
@ -11,10 +11,8 @@
|
||||
|
||||
char macbuf[256];
|
||||
|
||||
int GetFirstSymbolOfModel()
|
||||
{
|
||||
switch(psp_model + 1)
|
||||
{
|
||||
int pspGetFirstSymbolOfModel(void) {
|
||||
switch(psp_model + 1) {
|
||||
case 1:
|
||||
case 5:
|
||||
case 11:
|
||||
@ -36,10 +34,9 @@ int GetFirstSymbolOfModel()
|
||||
return -1;
|
||||
}
|
||||
|
||||
char *GetRegionName()
|
||||
{
|
||||
int region = GetRegion();
|
||||
if(region >= 0 && region < 11)
|
||||
char *pspGetRegionName(void) {
|
||||
int region = pspGetRegion();
|
||||
if (region >= 0 && region < 11)
|
||||
return trans->hardware.regname[region];
|
||||
|
||||
return "-";
|
||||
@ -47,16 +44,14 @@ char *GetRegionName()
|
||||
|
||||
#define UNKNOWN 0x00000000
|
||||
|
||||
typedef struct
|
||||
{
|
||||
typedef struct {
|
||||
u32 tachyon;
|
||||
u32 baryon;
|
||||
u32 pommel;
|
||||
char *mobo_name;
|
||||
} Motherboard;
|
||||
|
||||
Motherboard detmobo[] =
|
||||
{
|
||||
Motherboard detmobo[] = {
|
||||
/* PSP-100x */
|
||||
{ 0x00140000, 0x00030600, 0x00000103, "TA-079v1" },
|
||||
{ 0x00200000, 0x00030600, 0x00000103, "TA-079v2" },
|
||||
@ -94,18 +89,15 @@ Motherboard detmobo[] =
|
||||
{ 0x00100000, UNKNOWN, UNKNOWN, "Devkit" },
|
||||
};
|
||||
|
||||
char *GetMoBoName()
|
||||
{
|
||||
char *pspGetMoBoName(void) {
|
||||
char *ret_mobo = "-";
|
||||
|
||||
int i;
|
||||
for(i = 0; i < sizeof(detmobo) / sizeof(Motherboard); i++)
|
||||
if(detmobo[i].tachyon == tachyon && (detmobo[i].baryon == baryon || detmobo[i].baryon == UNKNOWN) && (detmobo[i].pommel == pommel || detmobo[i].pommel == UNKNOWN))
|
||||
{
|
||||
|
||||
for(int i = 0; i < sizeof(detmobo) / sizeof(Motherboard); i++)
|
||||
if (detmobo[i].tachyon == tachyon && (detmobo[i].baryon == baryon || detmobo[i].baryon == UNKNOWN) && (detmobo[i].pommel == pommel || detmobo[i].pommel == UNKNOWN)) {
|
||||
/* TA-088v1(3.95) / TA-088v2 (4.01) */
|
||||
if(i == 9 /* TA-088v1 */ && !strncmp(GetInitialFW(), "4.01", 4))
|
||||
if (i == 9 /* TA-088v1 */ && !strncmp(pspGetInitialFW(), "4.01", 4))
|
||||
continue;
|
||||
else if(i == 10 /* TA-088v2 */ && strncmp(GetInitialFW(), "3.95", 4))
|
||||
else if (i == 10 /* TA-088v2 */ && strncmp(pspGetInitialFW(), "3.95", 4))
|
||||
ret_mobo = "TA-088v1/v2";
|
||||
|
||||
ret_mobo = detmobo[i].mobo_name;
|
||||
@ -114,28 +106,22 @@ char *GetMoBoName()
|
||||
return ret_mobo;
|
||||
}
|
||||
|
||||
char *GetUMDFWText()
|
||||
{
|
||||
_sceUmdExecInquiryCmd(_sceUmdManGetUmdDrive(0), param, buf);
|
||||
char *pspGetUMDFWText(void) {
|
||||
pspUmdExecInquiryCmd(pspUmdManGetUmdDrive(0), param, buf);
|
||||
memset(outtxt, 0, sizeof(outtxt));
|
||||
memcpy(&ai, buf, sizeof(ATAPI_INQURIY));
|
||||
strncpy(outtxt, ai.sony_spec, 5);
|
||||
|
||||
return outtxt;
|
||||
}
|
||||
|
||||
char *GetMacAddressText()
|
||||
{
|
||||
char *pspGetMacAddressText(void) {
|
||||
u8 macaddr[512];
|
||||
GetMACAddress(macaddr);
|
||||
pspGetMACAddress(macaddr);
|
||||
sprintf(macbuf, "%02X:%02X:%02X:%02X:%02X:%02X", macaddr[0], macaddr[1], macaddr[2], macaddr[3], macaddr[4], macaddr[5]);
|
||||
|
||||
return macbuf;
|
||||
}
|
||||
|
||||
char *GetModelName()
|
||||
{
|
||||
char *pspGetModelName(void) {
|
||||
char *models[] = { "PSP Fat", "PSP Slim", "PSP Brite", "PSP Brite", "PSPgo", "-", "PSP Brite", "-", "PSP Brite", "-", "PSP Street" };
|
||||
|
||||
return models[psp_model];
|
||||
}
|
||||
|
@ -1,11 +1,11 @@
|
||||
#ifndef ___HARDWARE_UTILS_H___
|
||||
#define ___HARDWARE_UTILS_H___
|
||||
|
||||
int GetFirstSymbolOfModel();
|
||||
char *GetRegionName();
|
||||
char *GetMoBoName();
|
||||
char *GetUMDFWText();
|
||||
char *GetMacAddressText();
|
||||
char *GetModelName();
|
||||
int pspGetFirstSymbolOfModel(void);
|
||||
char *pspGetRegionName(void);
|
||||
char *pspGetMoBoName(void);
|
||||
char *pspGetUMDFWText(void);
|
||||
char *pspGetMacAddressText(void);
|
||||
char *pspGetModelName(void);
|
||||
|
||||
#endif
|
||||
|
@ -19,7 +19,7 @@ ATAPI_INQURIY ai;
|
||||
u8 buf[0x38];
|
||||
u8 param[4] = { 0, 0, 0x38, 0 };
|
||||
|
||||
void *_sceUmdManGetUmdDrive(int driveNum);
|
||||
int _sceUmdExecInquiryCmd(void *drive, u8 *param, u8 *buf);
|
||||
void *pspUmdManGetUmdDrive(int driveNum);
|
||||
int pspUmdExecInquiryCmd(void *drive, u8 *param, u8 *buf);
|
||||
|
||||
#endif
|
||||
|
@ -6,8 +6,8 @@ PSP_BEGIN_EXPORTS
|
||||
PSP_EXPORT_END
|
||||
|
||||
PSP_EXPORT_START(pspUmdMan_driver, 0, 0x4001)
|
||||
PSP_EXPORT_FUNC_HASH(_sceUmdExecInquiryCmd)
|
||||
PSP_EXPORT_FUNC_HASH(_sceUmdManGetUmdDrive)
|
||||
PSP_EXPORT_FUNC_HASH(pspUmdExecInquiryCmd)
|
||||
PSP_EXPORT_FUNC_HASH(pspUmdManGetUmdDrive)
|
||||
PSP_EXPORT_END
|
||||
|
||||
PSP_END_EXPORTS
|
@ -7,32 +7,24 @@ PSP_MAIN_THREAD_ATTR(0);
|
||||
int sceUmdManGetUmdDrive(int driveNum);
|
||||
int sceUmdExecInquiryCmd(void *drive, u8 *param, u8 *buf);
|
||||
|
||||
void *_sceUmdManGetUmdDrive(int driveNum)
|
||||
{
|
||||
void *pspUmdManGetUmdDrive(int driveNum) {
|
||||
int k1 = pspSdkSetK1(0);
|
||||
void *drive = (void *)sceUmdManGetUmdDrive(driveNum);
|
||||
|
||||
pspSdkSetK1(k1);
|
||||
|
||||
return drive;
|
||||
}
|
||||
|
||||
int _sceUmdExecInquiryCmd(void *drive, u8 *param, u8 *buf)
|
||||
{
|
||||
int pspUmdExecInquiryCmd(void *drive, u8 *param, u8 *buf) {
|
||||
int k1 = pspSdkSetK1(0);
|
||||
int res = sceUmdExecInquiryCmd(drive, param, buf);
|
||||
|
||||
pspSdkSetK1(k1);
|
||||
|
||||
return(res);
|
||||
}
|
||||
|
||||
int module_start(SceSize args, void *argp)
|
||||
{
|
||||
int module_start(SceSize args __attribute__((unused)), void *argp __attribute__((unused))) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
int module_stop()
|
||||
{
|
||||
int module_stop(void) {
|
||||
return 0;
|
||||
}
|
||||
|
401
libs/include/systemctrl.h
Normal file
401
libs/include/systemctrl.h
Normal file
@ -0,0 +1,401 @@
|
||||
#ifndef __SCTRLLIBRARY_H__
|
||||
#define __SCTRLLIBRARY_H__
|
||||
|
||||
#if defined (__cplusplus)
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <pspsdk.h>
|
||||
#include <pspkernel.h>
|
||||
#include <psploadexec_kernel.h>
|
||||
#include <pspinit.h>
|
||||
|
||||
enum BootLoadFlags
|
||||
{
|
||||
BOOTLOAD_VSH = 1,
|
||||
BOOTLOAD_GAME = 2,
|
||||
BOOTLOAD_UPDATER = 4,
|
||||
BOOTLOAD_POPS = 8,
|
||||
BOOTLOAD_UMDEMU = 64, /* for original NP9660 */
|
||||
};
|
||||
|
||||
/**
|
||||
* Restart the vsh.
|
||||
*
|
||||
* @param param - Pointer to a ::SceKernelLoadExecVSHParam structure, or NULL
|
||||
*
|
||||
* @returns < 0 on some errors.
|
||||
*
|
||||
*/
|
||||
int sctrlKernelExitVSH(struct SceKernelLoadExecVSHParam *param);
|
||||
|
||||
/**
|
||||
* Executes a new executable from a disc.
|
||||
* It is the function used by the firmware to execute the EBOOT.BIN from a disc.
|
||||
*
|
||||
* @param file - The file to execute.
|
||||
* @param param - Pointer to a ::SceKernelLoadExecVSHParam structure, or NULL.
|
||||
*
|
||||
* @returns < 0 on some errors.
|
||||
*/
|
||||
int sctrlKernelLoadExecVSHDisc(const char *file, struct SceKernelLoadExecVSHParam *param);
|
||||
|
||||
/**
|
||||
* Executes a new executable from a disc.
|
||||
* It is the function used by the firmware to execute an updater from a disc.
|
||||
*
|
||||
* @param file - The file to execute.
|
||||
* @param param - Pointer to a ::SceKernelLoadExecVSHParam structure, or NULL.
|
||||
*
|
||||
* @returns < 0 on some errors.
|
||||
*/
|
||||
int sctrlKernelLoadExecVSHDiscUpdater(const char *file, struct SceKernelLoadExecVSHParam *param);
|
||||
|
||||
/**
|
||||
* Executes a new executable from a memory stick.
|
||||
* It is the function used by the firmware to execute an updater from a memory stick.
|
||||
*
|
||||
* @param file - The file to execute.
|
||||
* @param param - Pointer to a ::SceKernelLoadExecVSHParam structure, or NULL.
|
||||
*
|
||||
* @returns < 0 on some errors.
|
||||
*/
|
||||
int sctrlKernelLoadExecVSHMs1(const char *file, struct SceKernelLoadExecVSHParam *param);
|
||||
|
||||
/**
|
||||
* Executes a new executable from a memory stick.
|
||||
* It is the function used by the firmware to execute games (and homebrew :P) from a memory stick.
|
||||
*
|
||||
* @param file - The file to execute.
|
||||
* @param param - Pointer to a ::SceKernelLoadExecVSHParam structure, or NULL.
|
||||
*
|
||||
* @returns < 0 on some errors.
|
||||
*/
|
||||
int sctrlKernelLoadExecVSHMs2(const char *file, struct SceKernelLoadExecVSHParam *param);
|
||||
int sctrlKernelLoadExecVSHEf2(const char *file, struct SceKernelLoadExecVSHParam *param);
|
||||
|
||||
/**
|
||||
* Executes a new executable from a memory stick.
|
||||
* It is the function used by the firmware to execute ... ?
|
||||
*
|
||||
* @param file - The file to execute.
|
||||
* @param param - Pointer to a ::SceKernelLoadExecVSHParam structure, or NULL.
|
||||
*
|
||||
* @returns < 0 on some errors.
|
||||
*/
|
||||
int sctrlKernelLoadExecVSHMs3(const char *file, struct SceKernelLoadExecVSHParam *param);
|
||||
|
||||
/**
|
||||
* Executes a new executable from a memory stick.
|
||||
* It is the function used by the firmware to execute psx games
|
||||
*
|
||||
* @param file - The file to execute.
|
||||
* @param param - Pointer to a ::SceKernelLoadExecVSHParam structure, or NULL.
|
||||
*
|
||||
* @returns < 0 on some errors.
|
||||
*/
|
||||
int sctrlKernelLoadExecVSHMs4(const char *file, struct SceKernelLoadExecVSHParam *param);
|
||||
|
||||
|
||||
/**
|
||||
* Executes a new executable with the specified apitype
|
||||
*
|
||||
* @param apitype - The apitype
|
||||
* @param file - The file to execute.
|
||||
* @param param - Pointer to a ::SceKernelLoadExecVSHParam structure, or NULL.
|
||||
*
|
||||
* @returns < 0 on some errors.
|
||||
*/
|
||||
int sctrlKernelLoadExecVSHWithApitype(int apitype, const char *file, struct SceKernelLoadExecVSHParam *param);
|
||||
|
||||
/**
|
||||
* Sets the api type
|
||||
*
|
||||
* @param apitype - The apitype to set
|
||||
* @returns the previous apitype
|
||||
*
|
||||
* @Note - this will modify also the value of sceKernelBootFrom, since the value of
|
||||
* bootfrom is calculated from the apitype
|
||||
*/
|
||||
int sctrlKernelSetInitApitype(int apitype);
|
||||
|
||||
/**
|
||||
* Sets the filename of the launched executable.
|
||||
*
|
||||
* @param filename - The filename to set
|
||||
* @returns 0 on success
|
||||
*/
|
||||
int sctrlKernelSetInitFileName(char *filename);
|
||||
|
||||
/**
|
||||
* Sets the init key config
|
||||
*
|
||||
* @param key - The key code
|
||||
* @returns the previous key config
|
||||
*/
|
||||
int sctrlKernelSetInitKeyConfig(int key);
|
||||
|
||||
/**
|
||||
* Sets the user level of the current thread
|
||||
*
|
||||
* @param level - The user level
|
||||
* @return the previous user level on success
|
||||
*/
|
||||
int sctrlKernelSetUserLevel(int level);
|
||||
|
||||
/**
|
||||
* Sets the devkit version
|
||||
*
|
||||
* @param version - The devkit version to set
|
||||
* @return the previous devkit version
|
||||
*
|
||||
*/
|
||||
int sctrlKernelSetDevkitVersion(int version);
|
||||
|
||||
/**
|
||||
* Checks if we are in SE.
|
||||
*
|
||||
* @returns 1 if we are in SE-C or later, 0 if we are in HEN-D or later,
|
||||
* and < 0 (a kernel error code) in any other case
|
||||
*/
|
||||
int sctrlHENIsSE();
|
||||
|
||||
/**
|
||||
* Checks if we are in Devhook.
|
||||
*
|
||||
* @returns 1 if we are in SE-C/HEN-D for devhook or later, 0 if we are in normal SE-C/HEN-D or later,
|
||||
* and < 0 (a kernel error code) in any other case
|
||||
*/
|
||||
int sctrlHENIsDevhook();
|
||||
|
||||
/**
|
||||
* Gets the HEN version
|
||||
*
|
||||
* @returns - The HEN version
|
||||
*
|
||||
* HEN D / SE-C : 0x00000400
|
||||
*/
|
||||
int sctrlHENGetVersion();
|
||||
|
||||
/**
|
||||
* Gets the HEN minor version
|
||||
*
|
||||
* @returns - The HEN minor version
|
||||
*/
|
||||
int sctrlHENGetMinorVersion();
|
||||
|
||||
/**
|
||||
* Finds a driver
|
||||
*
|
||||
* @param drvname - The name of the driver (without ":" or numbers)
|
||||
*
|
||||
* @returns the driver if found, NULL otherwise
|
||||
*
|
||||
*/
|
||||
PspIoDrv *sctrlHENFindDriver(char *drvname);
|
||||
|
||||
/**
|
||||
* Finds a function.
|
||||
*
|
||||
* @param modname - The module where to search the function
|
||||
* @param libname - The library name
|
||||
* @nid - The nid of the function
|
||||
*
|
||||
* @returns - The function address or 0 if not found
|
||||
*
|
||||
*/
|
||||
u32 sctrlHENFindFunction(char *modname, char *libname, u32 nid);
|
||||
|
||||
typedef struct SceModule2 {
|
||||
struct SceModule2 *next;
|
||||
unsigned short attribute;
|
||||
unsigned char version[2];
|
||||
char modname[27];
|
||||
char terminal;
|
||||
unsigned int unknown1;
|
||||
unsigned int unknown2;
|
||||
SceUID modid;
|
||||
unsigned int unknown3[2];
|
||||
u32 mpid_text; // 0x38
|
||||
u32 mpid_data; // 0x3C
|
||||
void * ent_top;
|
||||
unsigned int ent_size;
|
||||
void * stub_top;
|
||||
unsigned int stub_size;
|
||||
unsigned int unknown4[5];
|
||||
unsigned int entry_addr;
|
||||
unsigned int gp_value;
|
||||
unsigned int text_addr;
|
||||
unsigned int text_size;
|
||||
unsigned int data_size;
|
||||
unsigned int bss_size;
|
||||
unsigned int nsegment;
|
||||
unsigned int segmentaddr[4];
|
||||
unsigned int segmentsize[4];
|
||||
} SceModule2;
|
||||
|
||||
typedef int (* STMOD_HANDLER)(SceModule2 *);
|
||||
|
||||
/**
|
||||
* Sets a function to be called just before module_start of a module is gonna be called (useful for patching purposes)
|
||||
*
|
||||
* @param handler - The function, that will receive the module structure before the module is started.
|
||||
*
|
||||
* @returns - The previous set function (NULL if none);
|
||||
* @Note: because only one handler function is handled by HEN, you should
|
||||
* call the previous function in your code.
|
||||
*
|
||||
* @Example:
|
||||
*
|
||||
* STMOD_HANDLER previous = NULL;
|
||||
*
|
||||
* int OnModuleStart(SceModule2 *mod);
|
||||
*
|
||||
* void somepointofmycode()
|
||||
* {
|
||||
* previous = sctrlHENSetStartModuleHandler(OnModuleStart);
|
||||
* }
|
||||
*
|
||||
* int OnModuleStart(SceModule2 *mod)
|
||||
* {
|
||||
* if (strcmp(mod->modname, "vsh_module") == 0)
|
||||
* {
|
||||
* // Do something with vsh module here
|
||||
* }
|
||||
*
|
||||
* if (!previous)
|
||||
* return 0;
|
||||
*
|
||||
* // Call previous handler
|
||||
*
|
||||
* return previous(mod);
|
||||
* }
|
||||
*
|
||||
* @Note2: The above example should be compiled with the flag -fno-pic
|
||||
* in order to avoid problems with gp register that may lead to a crash.
|
||||
*
|
||||
*/
|
||||
STMOD_HANDLER sctrlHENSetStartModuleHandler(STMOD_HANDLER handler);
|
||||
|
||||
typedef int (* KDEC_HANDLER)(u32 *buf, int size, int *retSize, int m);
|
||||
typedef int (* MDEC_HANDLER)(u32 *tag, u8 *keys, u32 code, u32 *buf, int size, int *retSize, int m, void *unk0, int unk1, int unk2, int unk3, int unk4);
|
||||
|
||||
/**
|
||||
* Sets the speed (only for kernel usage)
|
||||
*
|
||||
* @param cpu - The cpu speed
|
||||
* @param bus - The bus speed
|
||||
*/
|
||||
void sctrlHENSetSpeed(int cpu, int bus);
|
||||
|
||||
/**
|
||||
* Sets the partition 2 and 8 memory for next loadexec.
|
||||
*
|
||||
* @param p2 - The size in MB for the user partition. Must be > 0
|
||||
* @param p8 - The size in MB for partition 8. Can be 0.
|
||||
*
|
||||
* @returns 0 on success, < 0 on error.
|
||||
* This function is only available in the slim. The function will fail
|
||||
* if p2+p8 > 52 or p2 == 0
|
||||
*/
|
||||
int sctrlHENSetMemory(u32 p2, u32 p8);
|
||||
|
||||
void sctrlHENPatchSyscall(void *addr, void *newaddr);
|
||||
|
||||
int sctrlKernelQuerySystemCall(void *func_addr);
|
||||
|
||||
int sctrlKernelBootFrom(void);
|
||||
|
||||
/**
|
||||
* Patch module by offset
|
||||
*
|
||||
* @param modname - module name
|
||||
* @param inst - instruction
|
||||
* @param offset - module patch offset
|
||||
*
|
||||
* @return < 0 on error
|
||||
*/
|
||||
int sctrlPatchModule(char *modname, u32 inst, u32 offset);
|
||||
|
||||
/**
|
||||
* Get module text address
|
||||
*
|
||||
* @param modname - module name
|
||||
*
|
||||
* @return text address, or 0 if not found
|
||||
*/
|
||||
u32 sctrlModuleTextAddr(char *modname);
|
||||
|
||||
/**
|
||||
* Get sceInit module text address
|
||||
*
|
||||
* @note Only useful before sceInit exits
|
||||
*
|
||||
* @return text address, or 0 if not found
|
||||
*/
|
||||
u32 sctrlGetInitTextAddr(void);
|
||||
|
||||
/**
|
||||
* Set custom start module handler
|
||||
* It can be used to replace a system module
|
||||
*
|
||||
* @note: func returns -1 to ignore the module and load the original module. Or new modid if replace is done.
|
||||
*/
|
||||
void sctrlSetCustomStartModule(int (*func)(int modid, SceSize argsize, void *argp, int *modstatus, SceKernelSMOption *opt));
|
||||
|
||||
/**
|
||||
* Loads a module on next reboot. Only kernel mode.
|
||||
*
|
||||
* @param module_after - The path of the module which is loaded after the module to be loaded.
|
||||
The module passed to this function will be loaded just before that module.
|
||||
* @param buf - The buffer containing the module - Don't deallocate this one. It has to reside in kernel memory.
|
||||
* @param size - The size of the module
|
||||
* @param flags - The modes in which the module should be loaded, one of BootLoadFlags
|
||||
*
|
||||
* @Example:
|
||||
* sctrlHENLoadModuleOnReboot("/kd/usersystemlib.prx", module_buffer, module_size, BOOTLOAD_GAME | BOOTLOAD_POPS | BOOTLOAD_UMDEMU);
|
||||
*
|
||||
* This will load the module contained in module_buffer just before /kd/usersystemlib.prx in the next reboot, if the mode of next reboot is game, pops or umdemu
|
||||
*
|
||||
* @Remarks: Don't use too early modules in first param like "/kd/init.prx" or "/kd/systemctrl.prx", or your module may not load properly
|
||||
* Only one module will be loaded on reboot with this function.
|
||||
* If this function is called many times, only the last one will be considered.
|
||||
* By making a module to load itself using this function, and calling
|
||||
* sctrlHENLoadModuleOnReboot on module_start, a prx can cause itself to be resident in the modes choosen by flags.
|
||||
* If all flags are selected, the module will stay resident until a psp shutdown, or until sctrlHENLoadModuleOnReboot is not called.
|
||||
*/
|
||||
|
||||
void sctrlHENLoadModuleOnReboot(char *module_after, void *buf, int size, int flags);
|
||||
|
||||
/**
|
||||
* Enable/disable NID Resolver on particular library
|
||||
*
|
||||
* @param libname the name of the library to be enabled/disabled
|
||||
* @param enabled 0 - disabled, != 0 - enabled
|
||||
*
|
||||
* @Example:
|
||||
* sctrlKernelSetNidResolver("sceImpose_driver", 0); // disable sceImpose_driver resolving
|
||||
*
|
||||
* @return previous value if set, < 0 on error
|
||||
*/
|
||||
int sctrlKernelSetNidResolver(char *libname, u32 enabled);
|
||||
|
||||
/**
|
||||
* Get a random u32 key from PSP Kirk PRNG
|
||||
*/
|
||||
u32 sctrlKernelRand(void);
|
||||
|
||||
/**
|
||||
* Get the real unspoofed Ethernet (MAC) Address of the systems WLAN chip
|
||||
*
|
||||
* @param mac Out-Buffer (6B) for real MAC Address
|
||||
*
|
||||
* @return 0 on success, < 0 on error
|
||||
*/
|
||||
int sctrlGetRealEthernetAddress(uint8_t * mac);
|
||||
|
||||
#if defined (__cplusplus)
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
2035
libs/include/vlf.h
Normal file
2035
libs/include/vlf.h
Normal file
File diff suppressed because it is too large
Load Diff
BIN
libs/lib/libpspkubridge.a
Normal file
BIN
libs/lib/libpspkubridge.a
Normal file
Binary file not shown.
BIN
libs/lib/libvlfgu.a
Normal file
BIN
libs/lib/libvlfgu.a
Normal file
Binary file not shown.
BIN
libs/lib/libvlfgui.a
Normal file
BIN
libs/lib/libvlfgui.a
Normal file
Binary file not shown.
BIN
libs/lib/libvlflibc.a
Normal file
BIN
libs/lib/libvlflibc.a
Normal file
Binary file not shown.
BIN
libs/lib/libvlfutils.a
Normal file
BIN
libs/lib/libvlfutils.a
Normal file
Binary file not shown.
212
main.c
212
main.c
@ -41,38 +41,39 @@ char kirk[4], spock[4];
|
||||
u32 fusecfg, scramble;
|
||||
u16 bserialdata[2], serialdata[2];
|
||||
u64 fuseid;
|
||||
int psp_model, devkit, language;
|
||||
u32 tachyon, baryon, pommel;
|
||||
|
||||
int scePowerGetBatteryRemainCapacity(void);
|
||||
int scePowerGetBatteryFullCapacity(void);
|
||||
|
||||
void MainMenu(int select);
|
||||
int ExitInMainMenuHardwareInfo(int enter);
|
||||
int ExitInMainMenuBatteryInfo(int enter);
|
||||
int ExitInMainMenuSystemInfo(int enter);
|
||||
void HardwareInfo();
|
||||
void BatteryInfo();
|
||||
void SystemInfo();
|
||||
void HardwareInfo(void);
|
||||
void BatteryInfo(void);
|
||||
void SystemInfo(void);
|
||||
|
||||
void SetBottomDialog(int enter, int back, int (* handler)(int enter), int delete_bd);
|
||||
void SetTitle(char *text);
|
||||
void SetFade();
|
||||
void SetBackground();
|
||||
void SetFade(void);
|
||||
void SetBackground(void);
|
||||
|
||||
int OnMainMenuScreenUp(void *param);
|
||||
int OnMainMenuScreenDown(void *param);
|
||||
|
||||
char *vertxt;
|
||||
|
||||
int OnMainMenu(int enter)
|
||||
{
|
||||
if(enter)
|
||||
{
|
||||
int OnMainMenu(int enter) {
|
||||
if (enter) {
|
||||
vlfGuiRemoveEventHandler(OnMainMenuScreenUp);
|
||||
vlfGuiRemoveEventHandler(OnMainMenuScreenDown);
|
||||
|
||||
int i;
|
||||
for(i = 0; i < NUM_DEL_ITEMS_MAIN; i++)
|
||||
for(int i = 0; i < NUM_DEL_ITEMS_MAIN; i++)
|
||||
vlfGuiRemoveText(main_menu[i]);
|
||||
|
||||
switch(focus)
|
||||
{
|
||||
switch(focus) {
|
||||
case 0:
|
||||
HardwareInfo();
|
||||
break;
|
||||
@ -95,15 +96,12 @@ int OnMainMenu(int enter)
|
||||
return VLF_EV_RET_NOTHING;
|
||||
}
|
||||
|
||||
int ExitInMainMenuHardwareInfo(int enter)
|
||||
{
|
||||
if(!enter)
|
||||
{
|
||||
int i;
|
||||
for(i = 0; i < NUM_DEL_ITEMS_HARDWARE; i++)
|
||||
int ExitInMainMenuHardwareInfo(int enter) {
|
||||
if (!enter) {
|
||||
for(int i = 0; i < NUM_DEL_ITEMS_HARDWARE; i++)
|
||||
vlfGuiRemoveText(text_hardware[i]);
|
||||
|
||||
if(!button_assign)
|
||||
if (!button_assign)
|
||||
vlfGuiBottomDialog(-1, VLF_DI_ENTER, 1, 0, VLF_DEFAULT, NULL);
|
||||
|
||||
vlfGuiCancelBottomDialog();
|
||||
@ -114,12 +112,10 @@ int ExitInMainMenuHardwareInfo(int enter)
|
||||
return VLF_EV_RET_NOTHING;
|
||||
}
|
||||
|
||||
int ExitInMainMenuBatteryInfo(int enter)
|
||||
{
|
||||
if(!enter)
|
||||
{
|
||||
int ExitInMainMenuBatteryInfo(int enter) {
|
||||
if (!enter) {
|
||||
battery_break = 1;
|
||||
if(!button_assign)
|
||||
if (!button_assign)
|
||||
vlfGuiBottomDialog(-1, VLF_DI_ENTER, 1, 0, VLF_DEFAULT, NULL);
|
||||
|
||||
vlfGuiCancelBottomDialog();
|
||||
@ -129,25 +125,20 @@ int ExitInMainMenuBatteryInfo(int enter)
|
||||
return VLF_EV_RET_NOTHING;
|
||||
}
|
||||
|
||||
int ExitInMainMenuSystemInfo(int enter)
|
||||
{
|
||||
if(!enter)
|
||||
{
|
||||
int i;
|
||||
for(i = 0; i < NUM_DEL_ITEMS_SYSTEM; i++)
|
||||
if(text_system[i] != NULL)
|
||||
{
|
||||
int ExitInMainMenuSystemInfo(int enter) {
|
||||
if (!enter) {
|
||||
for(int i = 0; i < NUM_DEL_ITEMS_SYSTEM; i++)
|
||||
if (text_system[i] != NULL) {
|
||||
vlfGuiRemoveText(text_system[i]);
|
||||
text_system[i] = NULL;
|
||||
}
|
||||
|
||||
if(pic_button_assign != NULL)
|
||||
{
|
||||
if (pic_button_assign != NULL) {
|
||||
vlfGuiRemovePicture(pic_button_assign);
|
||||
pic_button_assign = NULL;
|
||||
}
|
||||
|
||||
if(!button_assign)
|
||||
if (!button_assign)
|
||||
vlfGuiBottomDialog(-1, VLF_DI_ENTER, 1, 0, VLF_DEFAULT, NULL);
|
||||
|
||||
vlfGuiCancelBottomDialog();
|
||||
@ -157,9 +148,7 @@ int ExitInMainMenuSystemInfo(int enter)
|
||||
return VLF_EV_RET_NOTHING;
|
||||
}
|
||||
|
||||
void HardwareInfo()
|
||||
{
|
||||
|
||||
void HardwareInfo(void) {
|
||||
SetTitle(trans->hardware_title);
|
||||
|
||||
text_hardware[0] = pspEverestPrintf(10, 40, "Tachyon: 0x%08X", tachyon);
|
||||
@ -170,29 +159,28 @@ void HardwareInfo()
|
||||
text_hardware[5] = pspEverestPrintf(10, 140, "IDScramble: 0x%08X", scramble);
|
||||
text_hardware[6] = pspEverestPrintf(10, 160, "Kirk: %c%c%c%c", kirk[3], kirk[2], kirk[1], kirk[0]);
|
||||
text_hardware[7] = pspEverestPrintf(10, 180, psp_model == 4 ? "Spock: -" : "Spock: %c%c%c%c", spock[3], spock[2], spock[1], spock[0]);
|
||||
text_hardware[8] = pspEverestPrintf(10, 200, GetFirstSymbolOfModel() != -1 ? trans->hardware.model : trans->hardware.no_model, psp_model == 4 ? "N" : psp_model == 10 ? "E" : "", GetFirstSymbolOfModel(), GetRegion() < 10 ? "0" : "", GetRegion(), GetModelName());
|
||||
text_hardware[8] = pspEverestPrintf(10, 200, pspGetFirstSymbolOfModel() != -1 ? trans->hardware.model : trans->hardware.no_model, psp_model == 4 ? "N" : psp_model == 10 ? "E" : "", pspGetFirstSymbolOfModel(), pspGetRegion() < 10 ? "0" : "", pspGetRegion(), pspGetModelName());
|
||||
|
||||
text_hardware[9] = pspEverestPrintf(250, 40, trans->hardware.mobo, GetMoBoName());
|
||||
text_hardware[10] = pspEverestPrintf(250, 60, trans->hardware.region, GetRegionName());
|
||||
text_hardware[9] = pspEverestPrintf(250, 40, trans->hardware.mobo, pspGetMoBoName());
|
||||
text_hardware[10] = pspEverestPrintf(250, 60, trans->hardware.region, pspGetRegionName());
|
||||
text_hardware[11] = pspEverestPrintf(250, 80, trans->hardware.gen, psp_model < 10 ? "0" : "", psp_model + 1);
|
||||
text_hardware[12] = pspEverestPrintf(250, 100, trans->hardware.eeprom, tachyon <= 0x00500000 && tachyon != 0x00100000 && baryon <= 0x0022B200 ? trans->yes : trans->no);
|
||||
text_hardware[13] = pspEverestPrintf(250, 120, trans->hardware.pandora, tachyon <= 0x00500000 ? trans->yes : trans->no);
|
||||
text_hardware[14] = pspEverestPrintf(250, 140, "MAC: %s", GetMacAddressText());
|
||||
text_hardware[15] = pspEverestPrintf(250, 160, trans->hardware.initialfw, GetInitialFW());
|
||||
text_hardware[16] = pspEverestPrintf(250, 180, trans->hardware.umdfw, psp_model == 4 ? "-" : GetUMDFWText());
|
||||
text_hardware[14] = pspEverestPrintf(250, 140, "MAC: %s", pspGetMacAddressText());
|
||||
text_hardware[15] = pspEverestPrintf(250, 160, trans->hardware.initialfw, pspGetInitialFW());
|
||||
text_hardware[16] = pspEverestPrintf(250, 180, trans->hardware.umdfw, psp_model == 4 ? "-" : pspGetUMDFWText());
|
||||
text_hardware[17] = pspEverestPrintf(250, 200, trans->hardware.nandsize, (pspNandGetPageSize() * pspNandGetPagesPerBlock() * pspNandGetTotalBlocks()) / 1024 / 1024);
|
||||
|
||||
SetBottomDialog(0, 1, ExitInMainMenuHardwareInfo, 1);
|
||||
SetFade();
|
||||
}
|
||||
|
||||
void BatteryInfo()
|
||||
{
|
||||
void BatteryInfo(void) {
|
||||
int swbt = 1, checkbt = 0;
|
||||
|
||||
vlfGuiCancelCentralMenu();
|
||||
|
||||
if(button_assign)
|
||||
if (button_assign)
|
||||
vlfGuiBottomDialog(VLF_DI_BACK, -1, 1, 0, 0, NULL);
|
||||
|
||||
vlfGuiCancelBottomDialog();
|
||||
@ -201,11 +189,9 @@ void BatteryInfo()
|
||||
|
||||
battery_fade_ctrl = 0;
|
||||
|
||||
int update, first_cycle = 1;
|
||||
for(update = 0;; update++)
|
||||
{
|
||||
if(update == 25 || battery_fade_ctrl)
|
||||
{
|
||||
int first_cycle = 1;
|
||||
for(int update = 0;; update++) {
|
||||
if (update == 25 || battery_fade_ctrl) {
|
||||
update = 1;
|
||||
first_cycle = (battery_fade_ctrl ? 1 : 0);
|
||||
battery_fade_ctrl = 0;
|
||||
@ -213,12 +199,9 @@ void BatteryInfo()
|
||||
|
||||
vlfGuiDrawFrame();
|
||||
|
||||
if(!first_cycle || update == 0)
|
||||
{
|
||||
int i;
|
||||
for(i = 0; i < NUM_DEL_ITEMS_BATTERY; i++)
|
||||
if(text_battery[i] != NULL)
|
||||
{
|
||||
if (!first_cycle || update == 0) {
|
||||
for(int i = 0; i < NUM_DEL_ITEMS_BATTERY; i++)
|
||||
if (text_battery[i] != NULL) {
|
||||
vlfGuiRemoveText(text_battery[i]);
|
||||
text_battery[i] = NULL;
|
||||
}
|
||||
@ -226,31 +209,30 @@ void BatteryInfo()
|
||||
int battery_percent = scePowerGetBatteryLifePercent();
|
||||
int battery_life_time = scePowerGetBatteryLifeTime();
|
||||
|
||||
if(update != 0 && scePowerIsBatteryExist() && swbt && (psp_model == 0 || (tachyon <= 0x00500000 && baryon == 0x0022B200)))
|
||||
{
|
||||
ReadSerial(bserialdata);
|
||||
if (update != 0 && scePowerIsBatteryExist() && swbt && (psp_model == 0 || (tachyon <= 0x00500000 && baryon == 0x0022B200))) {
|
||||
pspReadSerial(bserialdata);
|
||||
|
||||
u16 wrbuffer[0x80];
|
||||
wrbuffer[0] = 0x5053;
|
||||
if(bserialdata[0] != 0x5058)
|
||||
if (bserialdata[0] != 0x5058)
|
||||
wrbuffer[1] = 0x5058;
|
||||
else
|
||||
wrbuffer[1] = 0x4456;
|
||||
|
||||
WriteSerial(wrbuffer);
|
||||
pspWriteSerial(wrbuffer);
|
||||
|
||||
checkbt = 0;
|
||||
ReadSerial(serialdata);
|
||||
if(serialdata[0] == wrbuffer[0] && serialdata[1] == wrbuffer[1])
|
||||
pspReadSerial(serialdata);
|
||||
if (serialdata[0] == wrbuffer[0] && serialdata[1] == wrbuffer[1])
|
||||
{
|
||||
checkbt = 1;
|
||||
WriteSerial(bserialdata);
|
||||
pspWriteSerial(bserialdata);
|
||||
}
|
||||
|
||||
swbt = 0;
|
||||
}
|
||||
|
||||
if(swbt == 0 && !scePowerIsBatteryExist())
|
||||
if (swbt == 0 && !scePowerIsBatteryExist())
|
||||
swbt = 1;
|
||||
|
||||
text_battery[0] = pspEverestPrintf(15, 70, trans->battery.ex_power, psp_model == 4 ? "-" : scePowerIsPowerOnline() ? trans->yes : trans->no);
|
||||
@ -271,18 +253,14 @@ void BatteryInfo()
|
||||
checkbt && scePowerIsBatteryExist() && (psp_model == 0 || (tachyon <= 0x00500000 && baryon == 0x0022B200)) ? trans->battery.mode_default : "-");
|
||||
}
|
||||
|
||||
if(!update)
|
||||
{
|
||||
if (!update) {
|
||||
SetBottomDialog(0, 1, ExitInMainMenuBatteryInfo, 0);
|
||||
SetFade();
|
||||
}
|
||||
|
||||
if(battery_break)
|
||||
{
|
||||
int i;
|
||||
for(i = 0; i < NUM_DEL_ITEMS_BATTERY; i++)
|
||||
if(text_battery[i] != NULL)
|
||||
{
|
||||
if (battery_break) {
|
||||
for(int i = 0; i < NUM_DEL_ITEMS_BATTERY; i++)
|
||||
if (text_battery[i] != NULL) {
|
||||
vlfGuiRemoveText(text_battery[i]);
|
||||
text_battery[i] = NULL;
|
||||
}
|
||||
@ -294,18 +272,17 @@ void BatteryInfo()
|
||||
}
|
||||
}
|
||||
|
||||
void SystemInfo()
|
||||
{
|
||||
void SystemInfo(void) {
|
||||
char username[32], password[5];;
|
||||
memset(username, 0, sizeof(username));
|
||||
memset(password, 0, sizeof(password));
|
||||
|
||||
SetTitle(trans->system_title);
|
||||
|
||||
text_system[0] = pspEverestPrintf(10, 45, trans->system.fw, GetFirmwareName());
|
||||
text_system[0] = pspEverestPrintf(10, 45, trans->system.fw, pspGetFirmwareName());
|
||||
text_system[1] = pspEverestPrintf(10, 65, trans->system.button_assign);
|
||||
|
||||
if(button_assign)
|
||||
if (button_assign)
|
||||
pic_button_assign = vlfGuiAddPictureResource("system_plugin_fg.rco", "tex_cross", 4, -2);
|
||||
else
|
||||
pic_button_assign = vlfGuiAddPictureResource("system_plugin_fg.rco", "tex_circle", 4, -2);
|
||||
@ -321,8 +298,8 @@ void SystemInfo()
|
||||
text_system[4] = pspEverestPrintf(237, 65, trans->system.password, GetRegistryValue("/CONFIG/SYSTEM/LOCK", "password", &password, sizeof(password), 0));
|
||||
text_system[5] = pspEverestPrintf(10, 120, "version.txt:");
|
||||
|
||||
if(vertxt != NULL)
|
||||
text_system[6] = vlfGuiAddTextF(10, 143, GetVersionTxt());
|
||||
if (vertxt != NULL)
|
||||
text_system[6] = vlfGuiAddTextF(10, 143, pspGetVersionTxt());
|
||||
else
|
||||
text_system[6] = pspEverestPrintf(10, 143, trans->system.vertxterr);
|
||||
|
||||
@ -332,11 +309,9 @@ void SystemInfo()
|
||||
SetFade();
|
||||
}
|
||||
|
||||
void SetBottomDialog(int enter, int back, int (* handler)(int enter), int delete_bd)
|
||||
{
|
||||
if(delete_bd)
|
||||
{
|
||||
if(button_assign)
|
||||
void SetBottomDialog(int enter, int back, int (* handler)(int enter), int delete_bd) {
|
||||
if (delete_bd) {
|
||||
if (button_assign)
|
||||
vlfGuiBottomDialog(back ? VLF_DI_BACK : -1, enter ? VLF_DI_ENTER : -1, 1, 0, 0, NULL);
|
||||
|
||||
vlfGuiCancelBottomDialog();
|
||||
@ -345,12 +320,11 @@ void SetBottomDialog(int enter, int back, int (* handler)(int enter), int delete
|
||||
vlfGuiBottomDialog(back ? VLF_DI_BACK : -1, enter ? VLF_DI_ENTER : -1, 1, 0, VLF_DEFAULT, handler);
|
||||
}
|
||||
|
||||
void SetTitle(char *text)
|
||||
{
|
||||
if(title_text != NULL)
|
||||
void SetTitle(char *text) {
|
||||
if (title_text != NULL)
|
||||
vlfGuiRemoveText(title_text);
|
||||
|
||||
if(title_pic != NULL)
|
||||
if (title_pic != NULL)
|
||||
vlfGuiRemovePicture(title_pic);
|
||||
|
||||
title_text = pspEverestPrintf(30, 1, text);
|
||||
@ -359,18 +333,15 @@ void SetTitle(char *text)
|
||||
vlfGuiSetTitleBar(title_text, title_pic, 1, 0);
|
||||
}
|
||||
|
||||
void SetFade()
|
||||
{
|
||||
if(pic_button_assign != NULL)
|
||||
void SetFade(void) {
|
||||
if (pic_button_assign != NULL)
|
||||
vlfGuiSetPictureFade(pic_button_assign, VLF_FADE_MODE_IN, VLF_FADE_SPEED_FAST, 0);
|
||||
|
||||
vlfGuiSetRectangleFade(0, VLF_TITLEBAR_HEIGHT, 480, 272 - VLF_TITLEBAR_HEIGHT, VLF_FADE_MODE_IN, VLF_FADE_SPEED_FAST, 0, NULL, NULL, 0);
|
||||
}
|
||||
|
||||
int OnMainMenuScreenUp(void *param)
|
||||
{
|
||||
switch(focus)
|
||||
{
|
||||
int OnMainMenuScreenUp(void *param) {
|
||||
switch(focus) {
|
||||
case 1:
|
||||
focus = 0;
|
||||
vlfGuiRemoveTextFocus(main_menu[1], 1);
|
||||
@ -399,10 +370,8 @@ int OnMainMenuScreenUp(void *param)
|
||||
return VLF_EV_RET_NOTHING;
|
||||
}
|
||||
|
||||
int OnMainMenuScreenDown(void *param)
|
||||
{
|
||||
switch(focus)
|
||||
{
|
||||
int OnMainMenuScreenDown(void *param) {
|
||||
switch(focus) {
|
||||
case 0:
|
||||
focus = 1;
|
||||
vlfGuiRemoveTextFocus(main_menu[0], 1);
|
||||
@ -431,23 +400,20 @@ int OnMainMenuScreenDown(void *param)
|
||||
return VLF_EV_RET_NOTHING;
|
||||
}
|
||||
|
||||
void MainMenu(int select)
|
||||
{
|
||||
void MainMenu(int select) {
|
||||
SetTitle("PSP EVEREST 2");
|
||||
SetBottomDialog(1, 0, OnMainMenu, 0);
|
||||
|
||||
focus = select;
|
||||
|
||||
int main_x[4], main_y[4];
|
||||
if(language == PSP_SYSTEMPARAM_LANGUAGE_RUSSIAN)
|
||||
{
|
||||
if (language == PSP_SYSTEMPARAM_LANGUAGE_RUSSIAN) {
|
||||
main_x[0] = 143; main_y[0] = 85;
|
||||
main_x[1] = 141; main_y[1] = 107;
|
||||
main_x[2] = 140; main_y[2] = 129;
|
||||
main_x[3] = 207; main_y[3] = 151;
|
||||
}
|
||||
else
|
||||
{
|
||||
else {
|
||||
main_x[0] = 143; main_y[0] = 85;
|
||||
main_x[1] = 151; main_y[1] = 107;
|
||||
main_x[2] = 151; main_y[2] = 129;
|
||||
@ -466,45 +432,42 @@ void MainMenu(int select)
|
||||
SetFade();
|
||||
}
|
||||
|
||||
void SetBackground()
|
||||
{
|
||||
if(background_number < 0)
|
||||
void SetBackground(void) {
|
||||
if (background_number < 0)
|
||||
background_number = max_background_number;
|
||||
else if(background_number > max_background_number)
|
||||
else if (background_number > max_background_number)
|
||||
background_number = 0;
|
||||
|
||||
vlfGuiSetBackgroundFileBuffer(backgrounds_bmp + background_number * 6176, 6176, 1);
|
||||
SetFade();
|
||||
}
|
||||
|
||||
int app_main(int argc, char *argv[])
|
||||
{
|
||||
int app_main(int argc, char *argv[]) {
|
||||
sceUtilityGetSystemParamInt(PSP_SYSTEMPARAM_ID_INT_LANGUAGE, &language);
|
||||
SetupTranslate();
|
||||
|
||||
if(language == PSP_SYSTEMPARAM_LANGUAGE_RUSSIAN)
|
||||
if (language == PSP_SYSTEMPARAM_LANGUAGE_RUSSIAN)
|
||||
vlfGuiSetLanguage(PSP_SYSTEMPARAM_LANGUAGE_RUSSIAN);
|
||||
else
|
||||
vlfGuiSetLanguage(PSP_SYSTEMPARAM_LANGUAGE_ENGLISH);
|
||||
|
||||
*(u32 *)kirk = pspGetKirkVersion();
|
||||
*(u32 *)spock = pspGetSpockVersion();
|
||||
tachyon = sceSysregGetTachyonVersion();
|
||||
fuseid = sceSysregGetFuseId();
|
||||
fusecfg = sceSysregGetFuseConfig();
|
||||
tachyon = pspGetTachyonVersion();
|
||||
fuseid = pspGetFuseId();
|
||||
fusecfg = pspGetFuseConfig();
|
||||
scramble = pspNandGetScramble();
|
||||
sceSysconGetBaryonVersion(&baryon);
|
||||
sceSysconGetPommelVersion(&pommel);
|
||||
pspGetBaryonVersion(&baryon);
|
||||
pspGetPommelVersion(&pommel);
|
||||
devkit = sceKernelDevkitVersion();
|
||||
|
||||
GetRegistryValue("/CONFIG/SYSTEM/XMB", "button_assign", &button_assign, 4, 1);
|
||||
|
||||
vertxt = GetVersionTxt();
|
||||
vertxt = pspGetVersionTxt();
|
||||
|
||||
vlfGuiSystemSetup(1, 1, 1);
|
||||
|
||||
int OnBackgroundPlus(void *param)
|
||||
{
|
||||
int OnBackgroundPlus(void *param) {
|
||||
background_number++;
|
||||
battery_fade_ctrl = 1;
|
||||
SetBackground();
|
||||
@ -512,8 +475,7 @@ int app_main(int argc, char *argv[])
|
||||
return VLF_EV_RET_NOTHING;
|
||||
}
|
||||
|
||||
int OnBackgroundMinus(void *param)
|
||||
{
|
||||
int OnBackgroundMinus(void *param) {
|
||||
background_number--;
|
||||
battery_fade_ctrl = 1;
|
||||
SetBackground();
|
||||
|
4
main.h
4
main.h
@ -3,7 +3,7 @@
|
||||
|
||||
#include "vlf.h"
|
||||
|
||||
int psp_model, devkit, language;
|
||||
u32 tachyon, baryon, pommel;
|
||||
extern int psp_model, devkit, language;
|
||||
extern u32 tachyon, baryon, pommel;
|
||||
|
||||
#endif
|
||||
|
@ -11,96 +11,86 @@
|
||||
int sctrlHENGetMinorVersion();
|
||||
char get_firmware_buf[256], version_txt_buf[256];
|
||||
|
||||
char *GetFirmwareName()
|
||||
{
|
||||
char *pspGetFirmwareName(void) {
|
||||
char *cfwname = "";
|
||||
int henid = sctrlHENGetVersion();
|
||||
|
||||
if(devkit == 0x05000010)
|
||||
if (devkit == 0x05000010)
|
||||
cfwname = "m33";
|
||||
else if(devkit == 0x05000210)
|
||||
else if (devkit == 0x05000210)
|
||||
cfwname = "GEN";
|
||||
else if(devkit == 0x05000310)
|
||||
{
|
||||
if(henid != 0x8002013A)
|
||||
else if (devkit == 0x05000310) {
|
||||
if (henid != 0x8002013A)
|
||||
cfwname = "GEN/MHU";
|
||||
else
|
||||
cfwname = "GEN/MHU";
|
||||
}
|
||||
else if(devkit == 0x05050010)
|
||||
else if (devkit == 0x05050010)
|
||||
cfwname = "GEN";
|
||||
else if(devkit == 0x06020010)
|
||||
{
|
||||
if(sctrlHENGetMinorVersion() != 0x8002013A)
|
||||
{
|
||||
if(henid == 0x00001001)
|
||||
else if (devkit == 0x06020010) {
|
||||
if (sctrlHENGetMinorVersion() != 0x8002013A) {
|
||||
if (henid == 0x00001001)
|
||||
cfwname = "PRO";
|
||||
else if(henid == 0x00001002)
|
||||
else if (henid == 0x00001002)
|
||||
cfwname = "PRO-B";
|
||||
else if(henid == 0x00001003)
|
||||
else if (henid == 0x00001003)
|
||||
cfwname = "PRO-C";
|
||||
}
|
||||
else if(henid == 0x00001000)
|
||||
else if (henid == 0x00001000)
|
||||
cfwname = "TN-A";
|
||||
else if(henid == 0x00001001)
|
||||
else if (henid == 0x00001001)
|
||||
cfwname = "TN-B";
|
||||
else if(henid == 0x00001002)
|
||||
else if (henid == 0x00001002)
|
||||
cfwname = "TN-C";
|
||||
else if(henid == 0x00001003)
|
||||
else if (henid == 0x00001003)
|
||||
cfwname = "TN-D";
|
||||
else if(henid == 0x00001004)
|
||||
else if (henid == 0x00001004)
|
||||
cfwname = "TN-E";
|
||||
}
|
||||
else if(devkit == 0x06030110)
|
||||
else if (devkit == 0x06030110)
|
||||
cfwname = "PRO HEN";
|
||||
else if(devkit == 0x06030510)
|
||||
{
|
||||
if(sctrlHENGetMinorVersion() != 0x8002013A)
|
||||
{
|
||||
if(henid == 0x00001001)
|
||||
else if (devkit == 0x06030510) {
|
||||
if (sctrlHENGetMinorVersion() != 0x8002013A) {
|
||||
if (henid == 0x00001001)
|
||||
cfwname = "PRO";
|
||||
else if(henid == 0x00001002)
|
||||
else if (henid == 0x00001002)
|
||||
cfwname = "PRO-B";
|
||||
else if(henid == 0x00001003)
|
||||
else if (henid == 0x00001003)
|
||||
cfwname = "PRO-C";
|
||||
}
|
||||
else if(henid == 0x00001000)
|
||||
else if (henid == 0x00001000)
|
||||
cfwname = "Custom";
|
||||
}
|
||||
else if(devkit == 0x06030610)
|
||||
else if (devkit == 0x06030610)
|
||||
cfwname = "PRO HEN";
|
||||
else if(devkit == 0x06030710 && henid == 0x00001000)
|
||||
else if (devkit == 0x06030710 && henid == 0x00001000)
|
||||
cfwname = "ME";
|
||||
else if(devkit == 0x06030810 && henid == 0x00001000)
|
||||
else if (devkit == 0x06030810 && henid == 0x00001000)
|
||||
cfwname = "ME";
|
||||
else if(devkit == 0x06030910)
|
||||
{
|
||||
if(sctrlHENGetMinorVersion() != 0x8002013A)
|
||||
{
|
||||
if(henid == 0x00001001)
|
||||
else if (devkit == 0x06030910) {
|
||||
if (sctrlHENGetMinorVersion() != 0x8002013A) {
|
||||
if (henid == 0x00001001)
|
||||
cfwname = "PRO";
|
||||
else if(henid == 0x00001002)
|
||||
else if (henid == 0x00001002)
|
||||
cfwname = "PRO-B";
|
||||
else if(henid == 0x00001003)
|
||||
else if (henid == 0x00001003)
|
||||
cfwname = "PRO-C";
|
||||
}
|
||||
else if(henid == 0x00001000)
|
||||
else if (henid == 0x00001000)
|
||||
cfwname = "ME";
|
||||
else if(henid == 0x00002000)
|
||||
else if (henid == 0x00002000)
|
||||
cfwname = "TN-A";
|
||||
}
|
||||
else if(devkit == 0x06060010)
|
||||
{
|
||||
if(sctrlHENGetMinorVersion() != 0x8002013A)
|
||||
{
|
||||
if(henid == 0x00001001)
|
||||
else if (devkit == 0x06060010) {
|
||||
if (sctrlHENGetMinorVersion() != 0x8002013A) {
|
||||
if (henid == 0x00001001)
|
||||
cfwname = "PRO";
|
||||
else if(henid == 0x00001002)
|
||||
else if (henid == 0x00001002)
|
||||
cfwname = "PRO-B";
|
||||
else if(henid == 0x00001003)
|
||||
else if (henid == 0x00001003)
|
||||
cfwname = "PRO-C";
|
||||
}
|
||||
else if(henid == 0x00001000)
|
||||
else if (henid == 0x00001000)
|
||||
cfwname = "ME";
|
||||
}
|
||||
|
||||
@ -110,14 +100,12 @@ char *GetFirmwareName()
|
||||
return get_firmware_buf;
|
||||
}
|
||||
|
||||
char *GetVersionTxt()
|
||||
{
|
||||
char *pspGetVersionTxt(void) {
|
||||
memset(version_txt_buf, 0, sizeof(version_txt_buf));
|
||||
SceUID fd = sceIoOpen("flash0:/vsh/etc/version.txt", PSP_O_RDONLY, 777);
|
||||
if(fd >= 0)
|
||||
if (fd >= 0)
|
||||
sceIoRead(fd, version_txt_buf, 255);
|
||||
else
|
||||
{
|
||||
else {
|
||||
sceIoClose(fd);
|
||||
return NULL;
|
||||
}
|
||||
|
@ -1,7 +1,7 @@
|
||||
#ifndef ___SYSTEM_UTILS_H___
|
||||
#define ___SYSTEM_UTILS_H___
|
||||
|
||||
char *GetFirmwareName();
|
||||
char *GetVersionTxt();
|
||||
char *pspGetFirmwareName(void);
|
||||
char *pspGetVersionTxt(void);
|
||||
|
||||
#endif
|
||||
|
56
utils.c
56
utils.c
@ -7,8 +7,7 @@
|
||||
#include <psprtc.h>
|
||||
#include "main.h"
|
||||
|
||||
int GetRegistryValue(const char *dir, const char *name, void *buf, int bufsize, int inttype)
|
||||
{
|
||||
int GetRegistryValue(const char *dir, const char *name, void *buf, int bufsize, int inttype) {
|
||||
int ret = 0;
|
||||
struct RegParam reg;
|
||||
REGHANDLE h;
|
||||
@ -19,17 +18,14 @@ int GetRegistryValue(const char *dir, const char *name, void *buf, int bufsize,
|
||||
reg.unk2 = 1;
|
||||
reg.unk3 = 1;
|
||||
strcpy(reg.name, "/system");
|
||||
if(sceRegOpenRegistry(®, 2, &h) == 0)
|
||||
{
|
||||
if (sceRegOpenRegistry(®, 2, &h) == 0) {
|
||||
REGHANDLE hd;
|
||||
if(!sceRegOpenCategory(h, dir, 2, &hd))
|
||||
{
|
||||
if (!sceRegOpenCategory(h, dir, 2, &hd)) {
|
||||
REGHANDLE hk;
|
||||
unsigned int type, size;
|
||||
|
||||
if(!sceRegGetKeyInfo(hd, name, &hk, &type, &size))
|
||||
if(!sceRegGetKeyValue(hd, hk, buf, bufsize))
|
||||
{
|
||||
if (!sceRegGetKeyInfo(hd, name, &hk, &type, &size))
|
||||
if (!sceRegGetKeyValue(hd, hk, buf, bufsize)) {
|
||||
ret = inttype ? 1 : (int)buf;
|
||||
sceRegFlushCategory(hd);
|
||||
}
|
||||
@ -42,8 +38,7 @@ int GetRegistryValue(const char *dir, const char *name, void *buf, int bufsize,
|
||||
return ret;
|
||||
}
|
||||
|
||||
int Random(int min, int max)
|
||||
{
|
||||
int Random(int min, int max) {
|
||||
u64 tick;
|
||||
SceKernelUtilsMt19937Context ctx;
|
||||
sceRtcGetCurrentTick(&tick);
|
||||
@ -52,27 +47,22 @@ int Random(int min, int max)
|
||||
return min + (sceKernelUtilsMt19937UInt(&ctx) % max);
|
||||
}
|
||||
|
||||
int utf82unicode(wchar_t *dest, char *src)
|
||||
{
|
||||
int utf82unicode(wchar_t *dest, char *src) {
|
||||
int i, x;
|
||||
unsigned char *usrc = (unsigned char *)src;
|
||||
|
||||
for(i = 0, x = 0; usrc[i];)
|
||||
{
|
||||
for(i = 0, x = 0; usrc[i];) {
|
||||
wchar_t ch;
|
||||
|
||||
if((usrc[i] & 0xE0) == 0xE0)
|
||||
{
|
||||
if ((usrc[i] & 0xE0) == 0xE0) {
|
||||
ch = ((usrc[i] & 0x0F) << 12) | ((usrc[i + 1] & 0x3F) << 6) | (usrc[i + 2] & 0x3F);
|
||||
i += 3;
|
||||
}
|
||||
else if((usrc[i] & 0xC0) == 0xC0)
|
||||
{
|
||||
else if ((usrc[i] & 0xC0) == 0xC0) {
|
||||
ch = ((usrc[i] & 0x1F) << 6) | (usrc[i+1] & 0x3F);
|
||||
i += 2;
|
||||
}
|
||||
else
|
||||
{
|
||||
else {
|
||||
ch = usrc[i];
|
||||
i += 1;
|
||||
}
|
||||
@ -85,32 +75,25 @@ int utf82unicode(wchar_t *dest, char *src)
|
||||
return x;
|
||||
}
|
||||
|
||||
void ascii2unicode(char *unicode, const char *ascii)
|
||||
{
|
||||
while(*ascii != '\0')
|
||||
{
|
||||
if((unsigned char)*ascii >= 0xC0)
|
||||
{
|
||||
void ascii2unicode(char *unicode, const char *ascii) {
|
||||
while(*ascii != '\0') {
|
||||
if ((unsigned char)*ascii >= 0xC0) {
|
||||
*unicode++ = (unsigned char)*ascii - 0xB0;
|
||||
*unicode++ = 0x04;
|
||||
}
|
||||
else if((unsigned char)*ascii == 0x99)
|
||||
{
|
||||
else if ((unsigned char)*ascii == 0x99) {
|
||||
*unicode++ = 0x22;
|
||||
*unicode++ = 0x21;
|
||||
}
|
||||
else if((unsigned char)*ascii == 0xB8)
|
||||
{
|
||||
else if ((unsigned char)*ascii == 0xB8) {
|
||||
*unicode++ = 0x51;
|
||||
*unicode++ = 0x04;
|
||||
}
|
||||
else if((unsigned char)*ascii == 0xA8)
|
||||
{
|
||||
else if ((unsigned char)*ascii == 0xA8) {
|
||||
*unicode++ = 0x01;
|
||||
*unicode++ = 0x04;
|
||||
}
|
||||
else
|
||||
{
|
||||
else {
|
||||
*unicode++ = *ascii;
|
||||
*unicode++ = '\0';
|
||||
}
|
||||
@ -122,8 +105,7 @@ void ascii2unicode(char *unicode, const char *ascii)
|
||||
*unicode++ = '\0';
|
||||
}
|
||||
|
||||
VlfText pspEverestPrintf(int x, int y, const char *text, ...)
|
||||
{
|
||||
VlfText pspEverestPrintf(int x, int y, const char *text, ...) {
|
||||
char ascii[256], unicode[256];
|
||||
va_list list;
|
||||
va_start(list, text);
|
||||
|
Loading…
Reference in New Issue
Block a user