mirror of
https://github.com/joel16/PSP-Everest.git
synced 2024-11-23 03:29:48 +00:00
app: Cleanup and c++ify
This commit is contained in:
parent
a183a4c8e0
commit
982f7513c4
12
app/Makefile
12
app/Makefile
@ -2,15 +2,17 @@ TARGET = EVEREST
|
||||
|
||||
SOURCES := data drivers source
|
||||
CFILES := $(foreach dir, $(SOURCES), $(wildcard $(dir)/*.c))
|
||||
CPPFILES := $(foreach dir, $(SOURCES), $(wildcard $(dir)/*.cpp))
|
||||
SFILES := $(foreach dir, $(SOURCES), $(wildcard $(dir)/*.S))
|
||||
GFXFILES := $(foreach dir, $(SOURCES), $(wildcard $(dir)/*.bmp))
|
||||
PRXFILES := $(foreach dir, $(SOURCES), $(wildcard $(dir)/*.prx))
|
||||
|
||||
OBJS := $(addsuffix .o,$(BINFILES)) $(CFILES:.c=.o) $(SFILES:.S=.o) $(GFXFILES:.bmp=.o) $(PRXFILES:.prx=.o)
|
||||
OBJS := $(addsuffix .o,$(BINFILES)) $(CFILES:.c=.o) $(CPPFILES:.cpp=.o) $(SFILES:.S=.o) \
|
||||
$(GFXFILES:.bmp=.o) $(PRXFILES:.prx=.o)
|
||||
|
||||
INCDIR = ../libs/ ../libs/include include
|
||||
CFLAGS = -O2 -G0 -Wall -fshort-wchar -fno-pic -mno-check-zero-division
|
||||
CXXFLAGS = $(CFLAGS) -fno-exceptions -fno-rtti
|
||||
CFLAGS = -O2 -G0 -Wall -fshort-wchar -fno-pic -mno-check-zero-division
|
||||
CXXFLAGS = $(CFLAGS) -fno-exceptions -fno-rtti -std=gnu++17
|
||||
ASFLAGS = $(CFLAGS) -c
|
||||
|
||||
BUILD_PRX = 1
|
||||
@ -18,10 +20,10 @@ PSP_LARGE_MEMORY = 1
|
||||
|
||||
LIBDIR = ../libs/lib
|
||||
LDFLAGS = -nostdlib -nodefaultlibs
|
||||
LIBS = -lpspmodinfo -lpspopenpsid -lpsprtc -lpsppower -lpspreg -lpspkubridge -lvlfgui -lvlfgu -lvlfutils -lvlflibc
|
||||
LIBS = -lpspmodinfo -lpspopenpsid -lpsprtc -lpsppower -lpspreg -lvlfgui -lvlfgu -lvlfutils -lvlflibc
|
||||
|
||||
EXTRA_TARGETS = EBOOT.PBP
|
||||
PSP_EBOOT_TITLE = PSP EVEREST 2 Rev6
|
||||
PSP_EBOOT_TITLE = PSP EVEREST 2 Rev 7
|
||||
PSP_EBOOT_ICON = ICON0.PNG
|
||||
PSP_EBOOT_PIC1 = PIC1.png
|
||||
|
||||
|
@ -1,8 +0,0 @@
|
||||
#pragma once
|
||||
|
||||
#include <pspopenpsid.h>
|
||||
|
||||
const char *pspGetProductCodeInfo(u16 productCode);
|
||||
const char *pspGetProductSubCodeInfo(u16 productSubCode);
|
||||
const char *pspGetFactoryCodeInfo(u16 factoryCode);
|
||||
const char *pspGetPSID(PspOpenPSID *openpsid);
|
10
app/include/consoleidinfo.h
Normal file
10
app/include/consoleidinfo.h
Normal file
@ -0,0 +1,10 @@
|
||||
#pragma once
|
||||
|
||||
#include <pspopenpsid.h>
|
||||
|
||||
namespace ConsoleIdInfo {
|
||||
const char *GetProductCodeInfo(u16 productCode);
|
||||
const char *GetProductSubCodeInfo(u16 productSubCode);
|
||||
const char *GetFactoryCodeInfo(u16 factoryCode);
|
||||
const char *GetPSID(PspOpenPSID *openpsid);
|
||||
}
|
18
app/include/gui.h
Normal file
18
app/include/gui.h
Normal file
@ -0,0 +1,18 @@
|
||||
#pragma once
|
||||
|
||||
#include "vlf.h"
|
||||
|
||||
extern bool battery_fade_ctrl;
|
||||
extern unsigned int button_assign;
|
||||
extern VlfPicture pic_button_assign;
|
||||
|
||||
namespace GUI {
|
||||
void SetBottomDialog(int enter, int back, int (* handler)(int enter), int delete_bd);
|
||||
void SetTitle(const char *text);
|
||||
void SetFade(void);
|
||||
void GenRandomBackground(void);
|
||||
void SetBackground(void);
|
||||
int OnBackgroundPlus(void *param);
|
||||
int OnBackgroundMinus(void *param);
|
||||
VlfText Printf(int x, int y, const char *text, ...);
|
||||
}
|
@ -1,8 +0,0 @@
|
||||
#pragma once
|
||||
|
||||
int pspGetFirstSymbolOfModel(void);
|
||||
const char *pspGetRegionName(void);
|
||||
char *pspGetMoBoName(void);
|
||||
char *pspGetUMDFWText(void);
|
||||
char *pspGetMacAddressText(void);
|
||||
const char *pspGetModelName(void);
|
10
app/include/hardwareinfo.h
Normal file
10
app/include/hardwareinfo.h
Normal file
@ -0,0 +1,10 @@
|
||||
#pragma once
|
||||
|
||||
namespace HardwareInfo {
|
||||
int GetModelSymbol(void);
|
||||
const char *GetRegion(void);
|
||||
char *GetMotherboard(void);
|
||||
char *GetUMDFirmware(void);
|
||||
char *GetMacAddress(void);
|
||||
const char *GetModel(void);
|
||||
}
|
@ -1,5 +1,11 @@
|
||||
#pragma once
|
||||
|
||||
#if defined (__cplusplus)
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <pspsdk.h>
|
||||
|
||||
/**
|
||||
* This structure contains console specific information. It is a subset of the ::SceConsoleId.
|
||||
* Check <openpsid_kernel.h> for possible member values.
|
||||
@ -35,3 +41,8 @@ int pspWriteSerial(u16* serial);
|
||||
int pspChkregGetPsCode(ScePsCode *pPsCode);
|
||||
int pspSysconBatteryGetElec(int *elec);
|
||||
int pspSysconBatteryGetTotalElec(int *elec);
|
||||
int pspGetModel(void);
|
||||
|
||||
#if defined (__cplusplus)
|
||||
}
|
||||
#endif
|
@ -1,5 +1,9 @@
|
||||
#pragma once
|
||||
|
||||
#if defined (__cplusplus)
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
extern char outtxt[0x12];
|
||||
|
||||
typedef struct {
|
||||
@ -20,3 +24,7 @@ extern u8 param[4];
|
||||
|
||||
void *pspUmdManGetUmdDrive(int driveNum);
|
||||
int pspUmdExecInquiryCmd(void *drive, u8 *param, u8 *buf);
|
||||
|
||||
#if defined (__cplusplus)
|
||||
}
|
||||
#endif
|
||||
|
@ -1,4 +0,0 @@
|
||||
#pragma once
|
||||
|
||||
char *pspGetFirmwareName(void);
|
||||
char *pspGetVersionTxt(void);
|
6
app/include/systeminfo.h
Normal file
6
app/include/systeminfo.h
Normal file
@ -0,0 +1,6 @@
|
||||
#pragma once
|
||||
|
||||
namespace SystemInfo {
|
||||
char *GetFirmware(void);
|
||||
char *GetVersionTxt(void);
|
||||
}
|
@ -1,8 +1,8 @@
|
||||
#pragma once
|
||||
|
||||
#include "vlf.h"
|
||||
|
||||
int pspGetRegistryValue(const char *dir, const char *name, void *buf, int bufsize, int inttype);
|
||||
int random(int min, int max);
|
||||
int utf82unicode(wchar_t *dest, char *src);
|
||||
VlfText pspEverestPrintf(int x, int y, const char *text, ...);
|
||||
namespace Utils {
|
||||
int UTF8ToUnicode(wchar_t *dest, char *src);
|
||||
void ASCIIToUnicode(char *unicode, const char *ascii);
|
||||
int Rand(int min, int max);
|
||||
int GetRegistryValue(const char *dir, const char *name, void *buf, int bufsize, int inttype);
|
||||
}
|
||||
|
@ -1,83 +0,0 @@
|
||||
#include <pspsdk.h>
|
||||
#include <stdio.h>
|
||||
|
||||
#include "consoleid_utils.h"
|
||||
|
||||
// Info from https://github.com/CelesteBlue-dev/PS-ConsoleId-wiki/blob/master/PS-ConsoleId-wiki.txt
|
||||
|
||||
const char *pspGetProductCodeInfo(u16 productCode) {
|
||||
const char *product_codes[] = {
|
||||
"Test - Prototype / Test Unit",
|
||||
"Tool - DevKit / Development Tool",
|
||||
"DEX - TestKit / Testing Kit",
|
||||
"CEX - Japan",
|
||||
"CEX - North America",
|
||||
"CEX - Europe/East/Africa",
|
||||
"CEX - Korea",
|
||||
"CEX - Great Britain/United Kingdom",
|
||||
"CEX - Mexico/Latin America",
|
||||
"CEX - Australia/New Zeland",
|
||||
"CEX - Hong Kong/Singapore",
|
||||
"CEX - Taiwan",
|
||||
"CEX - Russia",
|
||||
"CEX - China",
|
||||
"AVTOOL - AV Testing Tool",
|
||||
};
|
||||
|
||||
if ((productCode >= 0x00) && (productCode <= 0x0E))
|
||||
return product_codes[productCode];
|
||||
|
||||
return "-";
|
||||
}
|
||||
|
||||
const char *pspGetProductSubCodeInfo(u16 productSubCode) {
|
||||
const char *product_sub_codes[] = {
|
||||
"-",
|
||||
"TA-079 / TA-081, TMU-002",
|
||||
"TA-082 / TA-086",
|
||||
"TA-085 / TA-088",
|
||||
"TA-090 / TA-092",
|
||||
"TA-091",
|
||||
"TA-093",
|
||||
"TA-094",
|
||||
"TA-095",
|
||||
"TA-096 / TA-097",
|
||||
};
|
||||
|
||||
if ((productSubCode >= 0x01) && (productSubCode <= 0x09))
|
||||
return product_sub_codes[productSubCode];
|
||||
|
||||
return "-";
|
||||
}
|
||||
|
||||
const char *pspGetFactoryCodeInfo(u16 factoryCode) {
|
||||
if (factoryCode == 0) {
|
||||
return "Invalid: PSP Kicho & Dencho Program";
|
||||
}
|
||||
else if (factoryCode == 2) {
|
||||
return "China manufacture 1 (01g)";
|
||||
}
|
||||
else if (factoryCode == 3) {
|
||||
return "China manufacture 2 (02g, 03g, 04g, 05g, 07g, 09g)";
|
||||
}
|
||||
else if (factoryCode == 4) {
|
||||
return "China manufacture 3 (04g and 11g)";
|
||||
}
|
||||
else if (factoryCode == 35) {
|
||||
return "Japan Diagnosis Center 1 (Diag/QA PSP)";
|
||||
}
|
||||
else if (factoryCode == 62) {
|
||||
return "Servicing Center 2 (refurbished 01g)";
|
||||
}
|
||||
|
||||
return "-";
|
||||
}
|
||||
|
||||
const char *pspGetPSID(PspOpenPSID *openpsid) {
|
||||
static char PSID[33];
|
||||
|
||||
for (int i = 0; i < 16; i++)
|
||||
snprintf(&PSID[2 * i], 33, "%02X", openpsid->data[i]);
|
||||
|
||||
return PSID;
|
||||
}
|
87
app/source/consoleidinfo.cpp
Normal file
87
app/source/consoleidinfo.cpp
Normal file
@ -0,0 +1,87 @@
|
||||
#include <pspsdk.h>
|
||||
#include <stdio.h>
|
||||
|
||||
#include "consoleidinfo.h"
|
||||
|
||||
// Info from https://github.com/CelesteBlue-dev/PS-ConsoleId-wiki/blob/master/PS-ConsoleId-wiki.txt
|
||||
namespace ConsoleIdInfo {
|
||||
const char *GetProductCodeInfo(u16 productCode) {
|
||||
const char *product_codes[] = {
|
||||
"Test - Prototype / Test Unit",
|
||||
"Tool - DevKit / Development Tool",
|
||||
"DEX - TestKit / Testing Kit",
|
||||
"CEX - Japan",
|
||||
"CEX - North America",
|
||||
"CEX - Europe/East/Africa",
|
||||
"CEX - Korea",
|
||||
"CEX - Great Britain/United Kingdom",
|
||||
"CEX - Mexico/Latin America",
|
||||
"CEX - Australia/New Zeland",
|
||||
"CEX - Hong Kong/Singapore",
|
||||
"CEX - Taiwan",
|
||||
"CEX - Russia",
|
||||
"CEX - China",
|
||||
"AVTOOL - AV Testing Tool",
|
||||
};
|
||||
|
||||
if ((productCode >= 0x00) && (productCode <= 0x0E)) {
|
||||
return product_codes[productCode];
|
||||
}
|
||||
|
||||
return "-";
|
||||
}
|
||||
|
||||
const char *GetProductSubCodeInfo(u16 productSubCode) {
|
||||
const char *product_sub_codes[] = {
|
||||
"-",
|
||||
"TA-079 / TA-081, TMU-002",
|
||||
"TA-082 / TA-086",
|
||||
"TA-085 / TA-088",
|
||||
"TA-090 / TA-092",
|
||||
"TA-091",
|
||||
"TA-093",
|
||||
"TA-094",
|
||||
"TA-095",
|
||||
"TA-096 / TA-097",
|
||||
};
|
||||
|
||||
if ((productSubCode >= 0x01) && (productSubCode <= 0x09)) {
|
||||
return product_sub_codes[productSubCode];
|
||||
}
|
||||
|
||||
return "-";
|
||||
}
|
||||
|
||||
const char *GetFactoryCodeInfo(u16 factoryCode) {
|
||||
if (factoryCode == 0) {
|
||||
return "Invalid: PSP Kicho & Dencho Program";
|
||||
}
|
||||
else if (factoryCode == 2) {
|
||||
return "China manufacture 1 (01g)";
|
||||
}
|
||||
else if (factoryCode == 3) {
|
||||
return "China manufacture 2 (02g, 03g, 04g, 05g, 07g, 09g)";
|
||||
}
|
||||
else if (factoryCode == 4) {
|
||||
return "China manufacture 3 (04g and 11g)";
|
||||
}
|
||||
else if (factoryCode == 35) {
|
||||
return "Japan Diagnosis Center 1 (Diag/QA PSP)";
|
||||
}
|
||||
else if (factoryCode == 62) {
|
||||
return "Servicing Center 2 (refurbished 01g)";
|
||||
}
|
||||
|
||||
return "-";
|
||||
}
|
||||
|
||||
const char *GetPSID(PspOpenPSID *openpsid) {
|
||||
static char PSID[33];
|
||||
|
||||
for (int i = 0; i < 16; i++) {
|
||||
snprintf(&PSID[2 * i], 33, "%02X", openpsid->data[i]);
|
||||
}
|
||||
|
||||
return PSID;
|
||||
}
|
||||
}
|
@ -1,87 +0,0 @@
|
||||
#include <kubridge.h>
|
||||
#include <pspkernel.h>
|
||||
#include <pspsdk.h>
|
||||
#include <psputility_sysparam.h>
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
#include <vlf.h>
|
||||
|
||||
#include "main.h"
|
||||
|
||||
extern unsigned char everest_kernel_prx_start[], intraFont_prx_start[], kumdman_prx_start[], vlf_prx_start[];
|
||||
extern unsigned int everest_kernel_prx_size, intraFont_prx_size, kumdman_prx_size, vlf_prx_size;
|
||||
|
||||
extern int app_main(int argc, char *argv[]);
|
||||
|
||||
int SetupCallbacks(void) {
|
||||
int CallbackThread(SceSize args, void *argp) {
|
||||
int exit_callback(int arg1, int arg2, void *common) {
|
||||
sceKernelExitGame();
|
||||
return 0;
|
||||
}
|
||||
|
||||
int cbid = sceKernelCreateCallback("Exit Callback", exit_callback, NULL);
|
||||
sceKernelRegisterExitCallback(cbid);
|
||||
sceKernelSleepThreadCB();
|
||||
return 0;
|
||||
}
|
||||
|
||||
int thid = sceKernelCreateThread("PSP_EVEREST_UPDATE_THREAD", CallbackThread, 0x11, 0xFA0, 0, 0);
|
||||
if (thid >= 0)
|
||||
sceKernelStartThread(thid, 0, 0);
|
||||
|
||||
return thid;
|
||||
}
|
||||
|
||||
void LoadStartModuleBuffer(const char *path, const void *buf, int size, SceSize args, void *argp) {
|
||||
SceUID mod = 0, out = 0;
|
||||
|
||||
sceIoRemove(path);
|
||||
out = sceIoOpen(path, PSP_O_WRONLY | PSP_O_CREAT, 0777);
|
||||
sceIoWrite(out, buf, size);
|
||||
sceIoClose(out);
|
||||
|
||||
mod = sceKernelLoadModule(path, 0, NULL);
|
||||
mod = sceKernelStartModule(mod, args, argp, NULL, NULL);
|
||||
sceIoRemove(path);
|
||||
}
|
||||
|
||||
int start_thread(SceSize args, void *argp) {
|
||||
char *path = (char *)argp;
|
||||
int last_trail = -1;
|
||||
|
||||
for(int i = 0; path[i]; i++) {
|
||||
if (path[i] == '/')
|
||||
last_trail = i;
|
||||
}
|
||||
|
||||
if (last_trail >= 0)
|
||||
path[last_trail] = 0;
|
||||
|
||||
sceIoChdir(path);
|
||||
path[last_trail] = '/';
|
||||
|
||||
if (psp_model != 4)
|
||||
LoadStartModuleBuffer("kumdman.prx", kumdman_prx_start, kumdman_prx_size, args, argp);
|
||||
|
||||
strcpy((char *)vlf_prx_start + 0x6D678, "flash0:/font/ltn0.pgf"); // WARNING: Path for font not be more 23 characters!
|
||||
LoadStartModuleBuffer("everest_kernel.prx", everest_kernel_prx_start, everest_kernel_prx_size, args, argp);
|
||||
LoadStartModuleBuffer("intraFont.prx", intraFont_prx_start, intraFont_prx_size, args, argp);
|
||||
LoadStartModuleBuffer("vlf.prx", vlf_prx_start, vlf_prx_size, args, argp);
|
||||
|
||||
vlfGuiInit(-1, app_main);
|
||||
return sceKernelExitDeleteThread(0);
|
||||
}
|
||||
|
||||
int module_start(SceSize args, void *argp) {
|
||||
SetupCallbacks();
|
||||
psp_model = kuKernelGetModel();
|
||||
sceUtilityGetSystemParamInt(PSP_SYSTEMPARAM_ID_INT_LANGUAGE, &language);
|
||||
|
||||
SceUID thid = sceKernelCreateThread("PSP_EVEREST_START_THREAD", start_thread, 0x10, 0x4000, 0, NULL);
|
||||
if (thid < 0)
|
||||
return thid;
|
||||
|
||||
sceKernelStartThread(thid, args, argp);
|
||||
return 0;
|
||||
}
|
113
app/source/crt0.cpp
Normal file
113
app/source/crt0.cpp
Normal file
@ -0,0 +1,113 @@
|
||||
|
||||
#include <pspkernel.h>
|
||||
#include <pspsdk.h>
|
||||
#include <psputility_sysparam.h>
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
#include <vlf.h>
|
||||
|
||||
|
||||
|
||||
#include "main.h"
|
||||
#include "kernel.h"
|
||||
|
||||
extern unsigned char kernel_prx_start[], intraFont_prx_start[], kumdman_prx_start[], vlf_prx_start[];
|
||||
extern unsigned int kernel_prx_size, intraFont_prx_size, kumdman_prx_size, vlf_prx_size;
|
||||
|
||||
namespace Callbacks {
|
||||
int Exit(int arg1, int arg2, void *common) {
|
||||
sceKernelExitGame();
|
||||
return 0;
|
||||
}
|
||||
|
||||
int Thread(SceSize args, void *argp) {
|
||||
int cbid = sceKernelCreateCallback("Exit Callback", Callbacks::Exit, nullptr);
|
||||
sceKernelRegisterExitCallback(cbid);
|
||||
sceKernelSleepThreadCB();
|
||||
return 0;
|
||||
}
|
||||
|
||||
int SetupCallbacks(void) {
|
||||
int thid = sceKernelCreateThread("PSP_EVEREST_UPDATE_THREAD", Callbacks::Thread, 0x11, 0xFA0, 0, 0);
|
||||
if (thid >= 0) {
|
||||
sceKernelStartThread(thid, 0, 0);
|
||||
}
|
||||
|
||||
return thid;
|
||||
}
|
||||
}
|
||||
|
||||
void LoadStartModuleBuffer(const char *path, const void *buf, int size, SceSize args, void *argp) {
|
||||
SceUID modId = 0, fd = 0;
|
||||
|
||||
sceIoRemove(path);
|
||||
fd = sceIoOpen(path, PSP_O_WRONLY | PSP_O_CREAT, 0777);
|
||||
sceIoWrite(fd, buf, size);
|
||||
sceIoClose(fd);
|
||||
|
||||
modId = sceKernelLoadModule(path, 0, nullptr);
|
||||
modId = sceKernelStartModule(modId, args, argp, nullptr, nullptr);
|
||||
sceIoRemove(path);
|
||||
}
|
||||
|
||||
void LoadStartModule(const char *path) {
|
||||
SceUID modId = sceKernelLoadModule(path, 0, nullptr);
|
||||
modId = sceKernelStartModule(modId, 0, nullptr, nullptr, nullptr);
|
||||
}
|
||||
|
||||
#if defined (__cplusplus)
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
extern int app_main(int argc, char *argv[]);
|
||||
|
||||
int start_thread(SceSize args, void *argp) {
|
||||
char *path = static_cast<char *>(argp);
|
||||
int last_trail = -1;
|
||||
|
||||
for(int i = 0; path[i]; i++) {
|
||||
if (path[i] == '/') {
|
||||
last_trail = i;
|
||||
}
|
||||
}
|
||||
|
||||
if (last_trail >= 0)
|
||||
path[last_trail] = 0;
|
||||
|
||||
sceIoChdir(path);
|
||||
path[last_trail] = '/';
|
||||
|
||||
strcpy(reinterpret_cast<char *>(vlf_prx_start) + 0x6D678, "flash0:/font/ltn0.pgf"); // WARNING: Path for font not be more 23 characters!
|
||||
|
||||
LoadStartModuleBuffer("kernel.prx", kernel_prx_start, kernel_prx_size, args, argp);
|
||||
LoadStartModuleBuffer("intraFont.prx", intraFont_prx_start, intraFont_prx_size, args, argp);
|
||||
LoadStartModuleBuffer("vlf.prx", vlf_prx_start, vlf_prx_size, args, argp);
|
||||
|
||||
psp_model = pspGetModel();
|
||||
|
||||
if (psp_model != 4) {
|
||||
LoadStartModuleBuffer("kumdman.prx", kumdman_prx_start, kumdman_prx_size, args, argp);
|
||||
}
|
||||
|
||||
LoadStartModule("flash0:/kd/chkreg.prx");
|
||||
|
||||
vlfGuiInit(-1, app_main);
|
||||
return sceKernelExitDeleteThread(0);
|
||||
}
|
||||
|
||||
int module_start(SceSize args, void *argp) {
|
||||
Callbacks::SetupCallbacks();
|
||||
sceUtilityGetSystemParamInt(PSP_SYSTEMPARAM_ID_INT_LANGUAGE, &language);
|
||||
|
||||
SceUID thid = sceKernelCreateThread("PSP_EVEREST_START_THREAD", start_thread, 0x10, 0x4000, 0, nullptr);
|
||||
if (thid < 0) {
|
||||
return thid;
|
||||
}
|
||||
|
||||
sceKernelStartThread(thid, args, argp);
|
||||
return 0;
|
||||
}
|
||||
|
||||
#if defined (__cplusplus)
|
||||
}
|
||||
#endif
|
94
app/source/gui.cpp
Normal file
94
app/source/gui.cpp
Normal file
@ -0,0 +1,94 @@
|
||||
#include <pspsdk.h>
|
||||
#include <stdarg.h>
|
||||
#include <stdio.h>
|
||||
|
||||
#include "gui.h"
|
||||
#include "utils.h"
|
||||
|
||||
bool battery_fade_ctrl = false;
|
||||
unsigned int button_assign = 0;
|
||||
VlfPicture pic_button_assign;
|
||||
|
||||
extern unsigned char backgrounds_bmp_start[];
|
||||
extern unsigned int backgrounds_bmp_size;
|
||||
|
||||
namespace GUI {
|
||||
static int background_number = 0, max_background_number = 0;
|
||||
static VlfPicture title_pic;
|
||||
static VlfText title_text;
|
||||
|
||||
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, nullptr);
|
||||
}
|
||||
|
||||
vlfGuiCancelBottomDialog();
|
||||
}
|
||||
|
||||
vlfGuiBottomDialog(back ? VLF_DI_BACK : -1, enter ? VLF_DI_ENTER : -1, 1, 0, VLF_DEFAULT, handler);
|
||||
}
|
||||
|
||||
void SetTitle(const char *text) {
|
||||
if (title_text != nullptr) {
|
||||
vlfGuiRemoveText(title_text);
|
||||
}
|
||||
|
||||
if (title_pic != nullptr) {
|
||||
vlfGuiRemovePicture(title_pic);
|
||||
}
|
||||
|
||||
title_text = GUI::Printf(30, 1, text);
|
||||
title_pic = vlfGuiAddPictureResource("ps3scan_plugin.rco", "tex_infobar_icon", 4, -2);
|
||||
vlfGuiSetTitleBarEx(title_text, title_pic, 1, 0, background_number);
|
||||
}
|
||||
|
||||
void SetFade(void) {
|
||||
if (pic_button_assign != nullptr) {
|
||||
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, nullptr, nullptr, 0);
|
||||
}
|
||||
|
||||
void GenRandomBackground(void) {
|
||||
max_background_number = backgrounds_bmp_size / 6176 - 1;
|
||||
background_number = Utils::Rand(0, max_background_number);
|
||||
}
|
||||
|
||||
void SetBackground(void) {
|
||||
if (background_number < 0) {
|
||||
background_number = max_background_number;
|
||||
}
|
||||
else if (background_number > max_background_number) {
|
||||
background_number = 0;
|
||||
}
|
||||
|
||||
vlfGuiSetBackgroundFileBuffer(backgrounds_bmp_start + background_number * 6176, 6176, 1);
|
||||
GUI::SetFade();
|
||||
}
|
||||
|
||||
int OnBackgroundPlus(void *param) {
|
||||
background_number++;
|
||||
battery_fade_ctrl = true;
|
||||
GUI::SetBackground();
|
||||
return VLF_EV_RET_NOTHING;
|
||||
}
|
||||
|
||||
int OnBackgroundMinus(void *param) {
|
||||
background_number--;
|
||||
battery_fade_ctrl = true;
|
||||
GUI::SetBackground();
|
||||
return VLF_EV_RET_NOTHING;
|
||||
}
|
||||
|
||||
VlfText Printf(int x, int y, const char *text, ...) {
|
||||
char ascii[256], unicode[256];
|
||||
va_list list;
|
||||
va_start(list, text);
|
||||
vsnprintf(ascii, 256, text, list);
|
||||
va_end(list);
|
||||
Utils::ASCIIToUnicode(unicode, ascii);
|
||||
return vlfGuiAddTextW(x, y, reinterpret_cast<u16 *>(unicode));
|
||||
}
|
||||
}
|
@ -1,136 +0,0 @@
|
||||
#include <pspkernel.h>
|
||||
#include <pspsdk.h>
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
|
||||
#include "main.h"
|
||||
#include "utils.h"
|
||||
#include "everest_kernel.h"
|
||||
#include "translate.h"
|
||||
#include "kumdman.h"
|
||||
|
||||
ATAPI_INQURIY ai;
|
||||
u8 buf[0x38];
|
||||
u8 param[4] = { 0, 0, 0x38, 0 };
|
||||
char outtxt[0x12];
|
||||
|
||||
int pspGetFirstSymbolOfModel(void) {
|
||||
switch(psp_model + 1) {
|
||||
case 1:
|
||||
case 5:
|
||||
case 11:
|
||||
return 1;
|
||||
|
||||
case 2:
|
||||
return 2;
|
||||
|
||||
case 3:
|
||||
case 4:
|
||||
case 7:
|
||||
case 9:
|
||||
return 3;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
const char *pspGetRegionName(void) {
|
||||
int region = pspGetRegion();
|
||||
|
||||
if (region >= 0 && region < 11)
|
||||
return trans->hardware.regname[region];
|
||||
|
||||
return "-";
|
||||
}
|
||||
|
||||
#define UNKNOWN 0x00000000
|
||||
|
||||
typedef struct {
|
||||
s32 tachyon;
|
||||
s32 baryon;
|
||||
s32 pommel;
|
||||
char *mobo_name;
|
||||
} Motherboard;
|
||||
|
||||
Motherboard detmobo[] = {
|
||||
/* PSP-100x */
|
||||
{ 0x00140000, 0x00030600, 0x00000103, "TA-079v1" },
|
||||
{ 0x00200000, 0x00030600, 0x00000103, "TA-079v2" },
|
||||
{ 0x00200000, 0x00040600, 0x00000103, "TA-079v3" },
|
||||
{ 0x00300000, 0x00040600, 0x00000103, "TA-081v1" },
|
||||
{ 0x00300000, 0x00040600, 0x00000104, "TA-081v2" },
|
||||
{ 0x00400000, 0x00114000, 0x00000112, "TA-082" },
|
||||
{ 0x00400000, 0x00121000, 0x00000112, "TA-086" },
|
||||
|
||||
/* PSP-200x */
|
||||
{ 0x00500000, 0x0022B200, 0x00000123, "TA-085v1" },
|
||||
{ 0x00500000, 0x00234000, 0x00000123, "TA-085v2" },
|
||||
{ 0x00500000, 0x00243000, 0x00000123, "TA-088v1" },// >----| If initial FW: 4.01, skipped TA-088v1...
|
||||
{ 0x00500000, 0x00243000, 0x00000123, "TA-088v2" },// <----| ...and detected TA-088v2.
|
||||
{ 0x00600000, 0x00243000, 0x00000123, "TA-088v3" },
|
||||
{ 0x00500000, 0x00243000, 0x00000132, "TA-090v1" },
|
||||
|
||||
/* PSP-300x */
|
||||
{ 0x00600000, 0x00263100, 0x00000132, "TA-090v2" },
|
||||
{ 0x00600000, 0x00263100, 0x00000133, "TA-090v3" },
|
||||
{ 0x00600000, 0x00285000, 0x00000133, "TA-092" },
|
||||
{ 0x00810000, 0x002C4000, 0x00000141, "TA-093v1" },
|
||||
{ 0x00810000, 0x002C4000, 0x00000143, "TA-093v2" },
|
||||
{ 0x00810000, 0x002E4000, 0x00000154, "TA-095v1" },
|
||||
{ 0x00820000, 0x002E4000, 0x00000154, "TA-095v2" },
|
||||
|
||||
/* PSP-N100x (PSPgo) */
|
||||
{ 0x00720000, 0x00304000, 0x00000133, "TA-091" },
|
||||
{ 0x00800000, 0x002A0000, UNKNOWN, "TA-094" },
|
||||
|
||||
/* PSP-E100x (PSP Essentials aka PSP Street) */
|
||||
{ 0x00900000, 0x00403000, 0x00000154, "TA-096" },
|
||||
|
||||
/* DTP-T1000A */
|
||||
{ 0x00100000, UNKNOWN, UNKNOWN, "Devkit" },
|
||||
};
|
||||
|
||||
char *pspGetMoBoName(void) {
|
||||
char initial_fw[8];
|
||||
char *ret_mobo = "-";
|
||||
|
||||
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(pspGetInitialFW(initial_fw), "4.01", 4))
|
||||
continue;
|
||||
else if (i == 10 /* TA-088v2 */ && strncmp(pspGetInitialFW(initial_fw), "3.95", 4))
|
||||
ret_mobo = "TA-088v1/v2";
|
||||
|
||||
ret_mobo = detmobo[i].mobo_name;
|
||||
}
|
||||
}
|
||||
|
||||
return ret_mobo;
|
||||
}
|
||||
|
||||
char *pspGetUMDFWText(void) {
|
||||
pspUmdExecInquiryCmd(pspUmdManGetUmdDrive(0), param, buf);
|
||||
memset(outtxt, 0, sizeof(outtxt));
|
||||
memcpy(&ai, buf, sizeof(ATAPI_INQURIY));
|
||||
snprintf(outtxt, 5, ai.sony_spec);
|
||||
return outtxt;
|
||||
}
|
||||
|
||||
char *pspGetMacAddressText(void) {
|
||||
u8 macaddr[18];
|
||||
pspGetMACAddress(macaddr);
|
||||
|
||||
static char macbuf[18];
|
||||
snprintf(macbuf, 18, "%02X:%02X:%02X:%02X:%02X:%02X", macaddr[0], macaddr[1], macaddr[2], macaddr[3], macaddr[4], macaddr[5]);
|
||||
|
||||
return macbuf;
|
||||
}
|
||||
|
||||
const char *pspGetModelName(void) {
|
||||
const char *models[] = { "PSP Fat", "PSP Slim", "PSP Brite", "PSP Brite", "PSPgo", "-", "PSP Brite", "-", "PSP Brite", "-", "PSP Street" };
|
||||
return models[psp_model];
|
||||
}
|
141
app/source/hardwareinfo.cpp
Normal file
141
app/source/hardwareinfo.cpp
Normal file
@ -0,0 +1,141 @@
|
||||
#include <pspkernel.h>
|
||||
#include <pspsdk.h>
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
|
||||
#include "kernel.h"
|
||||
#include "kumdman.h"
|
||||
#include "main.h"
|
||||
#include "translate.h"
|
||||
#include "utils.h"
|
||||
|
||||
#define UNKNOWN 0x00000000
|
||||
|
||||
ATAPI_INQURIY ai;
|
||||
u8 buf[0x38];
|
||||
u8 param[4] = { 0, 0, 0x38, 0 };
|
||||
char outtxt[0x12];
|
||||
|
||||
namespace HardwareInfo {
|
||||
typedef struct {
|
||||
s32 tachyon;
|
||||
s32 baryon;
|
||||
s32 pommel;
|
||||
const char *mobo_name;
|
||||
} Motherboard;
|
||||
|
||||
Motherboard detmobo[] = {
|
||||
/* PSP-100x */
|
||||
{ 0x00140000, 0x00030600, 0x00000103, "TA-079v1" },
|
||||
{ 0x00200000, 0x00030600, 0x00000103, "TA-079v2" },
|
||||
{ 0x00200000, 0x00040600, 0x00000103, "TA-079v3" },
|
||||
{ 0x00300000, 0x00040600, 0x00000103, "TA-081v1" },
|
||||
{ 0x00300000, 0x00040600, 0x00000104, "TA-081v2" },
|
||||
{ 0x00400000, 0x00114000, 0x00000112, "TA-082" },
|
||||
{ 0x00400000, 0x00121000, 0x00000112, "TA-086" },
|
||||
|
||||
/* PSP-200x */
|
||||
{ 0x00500000, 0x0022B200, 0x00000123, "TA-085v1" },
|
||||
{ 0x00500000, 0x00234000, 0x00000123, "TA-085v2" },
|
||||
{ 0x00500000, 0x00243000, 0x00000123, "TA-088v1" },// >----| If initial FW: 4.01, skipped TA-088v1...
|
||||
{ 0x00500000, 0x00243000, 0x00000123, "TA-088v2" },// <----| ...and detected TA-088v2.
|
||||
{ 0x00600000, 0x00243000, 0x00000123, "TA-088v3" },
|
||||
{ 0x00500000, 0x00243000, 0x00000132, "TA-090v1" },
|
||||
|
||||
/* PSP-300x */
|
||||
{ 0x00600000, 0x00263100, 0x00000132, "TA-090v2" },
|
||||
{ 0x00600000, 0x00263100, 0x00000133, "TA-090v3" },
|
||||
{ 0x00600000, 0x00285000, 0x00000133, "TA-092" },
|
||||
{ 0x00810000, 0x002C4000, 0x00000141, "TA-093v1" },
|
||||
{ 0x00810000, 0x002C4000, 0x00000143, "TA-093v2" },
|
||||
{ 0x00810000, 0x002E4000, 0x00000154, "TA-095v1" },
|
||||
{ 0x00820000, 0x002E4000, 0x00000154, "TA-095v2" },
|
||||
|
||||
/* PSP-N100x (PSPgo) */
|
||||
{ 0x00720000, 0x00304000, 0x00000133, "TA-091" },
|
||||
{ 0x00800000, 0x002A0000, UNKNOWN, "TA-094" },
|
||||
|
||||
/* PSP-E100x (PSP Essentials aka PSP Street) */
|
||||
{ 0x00900000, 0x00403000, 0x00000154, "TA-096" },
|
||||
|
||||
/* DTP-T1000A */
|
||||
{ 0x00100000, UNKNOWN, UNKNOWN, "Devkit" },
|
||||
};
|
||||
|
||||
int GetModelSymbol(void) {
|
||||
switch(psp_model + 1) {
|
||||
case 1:
|
||||
case 5:
|
||||
case 11:
|
||||
return 1;
|
||||
|
||||
case 2:
|
||||
return 2;
|
||||
|
||||
case 3:
|
||||
case 4:
|
||||
case 7:
|
||||
case 9:
|
||||
return 3;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
const char *GetRegion(void) {
|
||||
int region = pspGetRegion();
|
||||
|
||||
if (region >= 0 && region < 11) {
|
||||
return trans->hardware.regname[region];
|
||||
}
|
||||
|
||||
return "-";
|
||||
}
|
||||
|
||||
char *GetMotherboard(void) {
|
||||
char initial_fw[8];
|
||||
char *ret_mobo = const_cast<char *>("-");
|
||||
|
||||
for(unsigned 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(pspGetInitialFW(initial_fw), "4.01", 4)) {
|
||||
continue;
|
||||
}
|
||||
else if (i == 10 /* TA-088v2 */ && strncmp(pspGetInitialFW(initial_fw), "3.95", 4)) {
|
||||
ret_mobo = const_cast<char *>("TA-088v1/v2");
|
||||
}
|
||||
|
||||
ret_mobo = const_cast<char *>(detmobo[i].mobo_name);
|
||||
}
|
||||
}
|
||||
|
||||
return ret_mobo;
|
||||
}
|
||||
|
||||
char *GetUMDFirmware(void) {
|
||||
pspUmdExecInquiryCmd(pspUmdManGetUmdDrive(0), param, buf);
|
||||
memset(outtxt, 0, sizeof(outtxt));
|
||||
memcpy(&ai, buf, sizeof(ATAPI_INQURIY));
|
||||
snprintf(outtxt, 5, ai.sony_spec);
|
||||
return outtxt;
|
||||
}
|
||||
|
||||
char *GetMacAddress(void) {
|
||||
u8 macaddr[18];
|
||||
pspGetMACAddress(macaddr);
|
||||
|
||||
static char macbuf[18];
|
||||
snprintf(macbuf, 18, "%02X:%02X:%02X:%02X:%02X:%02X", macaddr[0], macaddr[1], macaddr[2], macaddr[3], macaddr[4], macaddr[5]);
|
||||
|
||||
return macbuf;
|
||||
}
|
||||
|
||||
const char *GetModel(void) {
|
||||
const char *models[] = { "PSP Fat", "PSP Slim", "PSP Brite", "PSP Brite", "PSPgo", "-", "PSP Brite", "-", "PSP Brite", "-", "PSP Street" };
|
||||
return models[psp_model];
|
||||
}
|
||||
}
|
@ -1,448 +0,0 @@
|
||||
//>>> PSP_EVEREST 2
|
||||
//Copyright(C) 2022, frostegater, Joel16
|
||||
|
||||
#include <pspctrl.h>
|
||||
#include <pspidstorage.h>
|
||||
#include <pspkernel.h>
|
||||
#include <psppower.h>
|
||||
#include <pspsdk.h>
|
||||
#include <psputility_sysparam.h>
|
||||
#include <stdarg.h>
|
||||
#include <stdbool.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "consoleid_utils.h"
|
||||
#include "everest_kernel.h"
|
||||
#include "hardware_utils.h"
|
||||
#include "main.h"
|
||||
#include "system_utils.h"
|
||||
#include "translate.h"
|
||||
#include "utils.h"
|
||||
#include "vlf.h"
|
||||
|
||||
PSP_MODULE_INFO("PSP EVEREST 2 Rev6", 0, 2, 0);
|
||||
PSP_MAIN_THREAD_ATTR(0);
|
||||
|
||||
#define NUM_DEL_ITEMS_MAIN 5
|
||||
#define NUM_DEL_ITEMS_HARDWARE 19
|
||||
#define NUM_DEL_ITEMS_BATTERY 14
|
||||
#define NUM_DEL_ITEMS_SYSTEM 7
|
||||
#define NUM_DEL_ITEMS_CONSOLEID 8
|
||||
|
||||
#define EVE_ENTER_EN "Enter"
|
||||
#define EVE_BACK_EN "Back"
|
||||
|
||||
extern unsigned char backgrounds_bmp_start[];
|
||||
extern unsigned int backgrounds_bmp_size;
|
||||
|
||||
VlfText main_menu[NUM_DEL_ITEMS_MAIN], text_hardware[NUM_DEL_ITEMS_HARDWARE], text_battery[NUM_DEL_ITEMS_BATTERY],
|
||||
text_system[NUM_DEL_ITEMS_SYSTEM], text_consoleId[NUM_DEL_ITEMS_CONSOLEID], title_text;
|
||||
VlfPicture title_pic, pic_button_assign;
|
||||
|
||||
static int background_number = 0, max_background_number = 0;
|
||||
static bool battery_break = false, battery_fade_ctrl = false;
|
||||
static unsigned int button_assign = 0;
|
||||
static char initial_fw[8], kirk[4], spock[4];
|
||||
static u32 fusecfg = 0, scramble = 0;
|
||||
static u16 bserialdata[2], serialdata[2];
|
||||
static u64 fuseid = 0;
|
||||
static ScePsCode pscode = { 0 };
|
||||
static char *vertxt = NULL;
|
||||
static PspOpenPSID psid = { 0 };
|
||||
|
||||
int psp_model = 0, devkit = 0, language = 0;
|
||||
s32 tachyon = 0, baryon = 0, pommel = 0, polestar = 0;
|
||||
|
||||
void MainMenu(int select);
|
||||
|
||||
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();
|
||||
}
|
||||
|
||||
vlfGuiBottomDialog(back ? VLF_DI_BACK : -1, enter ? VLF_DI_ENTER : -1, 1, 0, VLF_DEFAULT, handler);
|
||||
}
|
||||
|
||||
void SetTitle(const char *text) {
|
||||
if (title_text != NULL)
|
||||
vlfGuiRemoveText(title_text);
|
||||
|
||||
if (title_pic != NULL)
|
||||
vlfGuiRemovePicture(title_pic);
|
||||
|
||||
title_text = pspEverestPrintf(30, 1, text);
|
||||
title_pic = vlfGuiAddPictureResource("ps3scan_plugin.rco", "tex_infobar_icon", 4, -2);
|
||||
vlfGuiSetTitleBarEx(title_text, title_pic, 1, 0, background_number);
|
||||
}
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
void SetBackground(void) {
|
||||
if (background_number < 0)
|
||||
background_number = max_background_number;
|
||||
else if (background_number > max_background_number)
|
||||
background_number = 0;
|
||||
|
||||
vlfGuiSetBackgroundFileBuffer(backgrounds_bmp_start + background_number * 6176, 6176, 1);
|
||||
SetFade();
|
||||
}
|
||||
|
||||
int ExitInMainMenuHardwareInfo(int enter) {
|
||||
if (!enter) {
|
||||
for(int i = 0; i < NUM_DEL_ITEMS_HARDWARE; i++)
|
||||
vlfGuiRemoveText(text_hardware[i]);
|
||||
|
||||
if (!button_assign)
|
||||
vlfGuiBottomDialog(-1, VLF_DI_ENTER, 1, 0, VLF_DEFAULT, NULL);
|
||||
|
||||
vlfGuiCancelBottomDialog();
|
||||
MainMenu(0);
|
||||
}
|
||||
|
||||
return VLF_EV_RET_NOTHING;
|
||||
}
|
||||
|
||||
int ExitInMainMenuBatteryInfo(int enter) {
|
||||
if (!enter) {
|
||||
battery_break = true;
|
||||
|
||||
if (!button_assign)
|
||||
vlfGuiBottomDialog(-1, VLF_DI_ENTER, 1, 0, VLF_DEFAULT, NULL);
|
||||
|
||||
vlfGuiCancelBottomDialog();
|
||||
MainMenu(1);
|
||||
}
|
||||
|
||||
return VLF_EV_RET_NOTHING;
|
||||
}
|
||||
|
||||
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) {
|
||||
vlfGuiRemovePicture(pic_button_assign);
|
||||
pic_button_assign = NULL;
|
||||
}
|
||||
|
||||
if (!button_assign)
|
||||
vlfGuiBottomDialog(-1, VLF_DI_ENTER, 1, 0, VLF_DEFAULT, NULL);
|
||||
|
||||
vlfGuiCancelBottomDialog();
|
||||
MainMenu(2);
|
||||
}
|
||||
|
||||
return VLF_EV_RET_NOTHING;
|
||||
}
|
||||
|
||||
int ExitInMainMenuConsoleIdInfo(int enter) {
|
||||
if (!enter) {
|
||||
for(int i = 0; i < NUM_DEL_ITEMS_CONSOLEID; i++)
|
||||
vlfGuiRemoveText(text_consoleId[i]);
|
||||
|
||||
if (!button_assign)
|
||||
vlfGuiBottomDialog(-1, VLF_DI_ENTER, 1, 0, VLF_DEFAULT, NULL);
|
||||
|
||||
vlfGuiCancelBottomDialog();
|
||||
MainMenu(3);
|
||||
}
|
||||
|
||||
return VLF_EV_RET_NOTHING;
|
||||
}
|
||||
|
||||
void HardwareInfo(void) {
|
||||
SetTitle(trans->hardware_title);
|
||||
|
||||
text_hardware[0] = pspEverestPrintf(10, 40, "Tachyon: 0x%08X", tachyon);
|
||||
text_hardware[1] = pspEverestPrintf(10, 60, "Baryon: 0x%08X", baryon);
|
||||
text_hardware[2] = pspEverestPrintf(10, 80, "Pommel: 0x%08X", pommel);
|
||||
text_hardware[3] = pspEverestPrintf(10, 100, "Polestar: 0x%08X", polestar);
|
||||
text_hardware[4] = pspEverestPrintf(10, 120, "FuseID: 0x%llX", fuseid);
|
||||
text_hardware[5] = pspEverestPrintf(10, 140, "FuseCFG: 0x%08X", fusecfg);
|
||||
text_hardware[6] = pspEverestPrintf(10, 160, "IDScramble: 0x%08X", scramble);
|
||||
text_hardware[7] = pspEverestPrintf(10, 180, "Kirk: %c%c%c%c", kirk[3], kirk[2], kirk[1], kirk[0]);
|
||||
text_hardware[8] = pspEverestPrintf(10, 200, psp_model == 4 ? "Spock: -" : "Spock: %c%c%c%c", spock[3], spock[2], spock[1], spock[0]);
|
||||
text_hardware[9] = pspEverestPrintf(10, 220, 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[10] = pspEverestPrintf(250, 40, trans->hardware.mobo, pspGetMoBoName());
|
||||
text_hardware[11] = pspEverestPrintf(250, 60, trans->hardware.region, pspGetRegionName());
|
||||
text_hardware[12] = pspEverestPrintf(250, 80, trans->hardware.gen, psp_model < 10 ? "0" : "", psp_model + 1);
|
||||
text_hardware[13] = pspEverestPrintf(250, 100, trans->hardware.eeprom, tachyon <= 0x00500000 && tachyon != 0x00100000 && baryon <= 0x0022B200 ? trans->yes : trans->no);
|
||||
text_hardware[14] = pspEverestPrintf(250, 120, trans->hardware.pandora, tachyon <= 0x00500000 ? trans->yes : trans->no);
|
||||
text_hardware[15] = pspEverestPrintf(250, 140, "MAC: %s", pspGetMacAddressText());
|
||||
text_hardware[16] = pspEverestPrintf(250, 160, trans->hardware.initialfw, initial_fw);
|
||||
text_hardware[17] = pspEverestPrintf(250, 180, trans->hardware.umdfw, psp_model == 4 ? "-" : pspGetUMDFWText());
|
||||
text_hardware[18] = pspEverestPrintf(250, 200, trans->hardware.nandsize, (pspNandGetPageSize() * pspNandGetPagesPerBlock() * pspNandGetTotalBlocks()) / 1024 / 1024);
|
||||
|
||||
SetBottomDialog(0, 1, ExitInMainMenuHardwareInfo, 1);
|
||||
SetFade();
|
||||
}
|
||||
|
||||
void BatteryInfo(void) {
|
||||
bool swbt = true, checkbt = false;
|
||||
int elec = 0, total_elec = 0;
|
||||
|
||||
if (button_assign)
|
||||
vlfGuiBottomDialog(VLF_DI_BACK, -1, 1, 0, 0, NULL);
|
||||
|
||||
vlfGuiCancelBottomDialog();
|
||||
SetTitle(trans->battery_title);
|
||||
|
||||
battery_fade_ctrl = false;
|
||||
|
||||
bool first_cycle = true;
|
||||
for(int update = 0;; update++) {
|
||||
if (update == 25 || battery_fade_ctrl) {
|
||||
update = 1;
|
||||
first_cycle = battery_fade_ctrl;
|
||||
battery_fade_ctrl = false;
|
||||
}
|
||||
|
||||
vlfGuiDrawFrame();
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
||||
int battery_percent = scePowerGetBatteryLifePercent();
|
||||
int battery_life_time = scePowerGetBatteryLifeTime();
|
||||
|
||||
if (update != 0 && scePowerIsBatteryExist() && swbt && (psp_model == 0 || (tachyon <= 0x00500000 && baryon == 0x0022B200))) {
|
||||
pspReadSerial(bserialdata);
|
||||
|
||||
u16 wrbuffer[0x80];
|
||||
wrbuffer[0] = 0x5053;
|
||||
|
||||
if (bserialdata[0] != 0x5058)
|
||||
wrbuffer[1] = 0x5058;
|
||||
else
|
||||
wrbuffer[1] = 0x4456;
|
||||
|
||||
pspWriteSerial(wrbuffer);
|
||||
|
||||
checkbt = false;
|
||||
pspReadSerial(serialdata);
|
||||
|
||||
if (serialdata[0] == wrbuffer[0] && serialdata[1] == wrbuffer[1]) {
|
||||
checkbt = true;
|
||||
pspWriteSerial(bserialdata);
|
||||
}
|
||||
|
||||
swbt = false;
|
||||
}
|
||||
|
||||
if (!swbt && !scePowerIsBatteryExist())
|
||||
swbt = true;
|
||||
|
||||
text_battery[0] = pspEverestPrintf(15, 70, trans->battery.ex_power, psp_model == 4 ? "-" : scePowerIsPowerOnline() ? trans->yes : trans->no);
|
||||
text_battery[1] = pspEverestPrintf(15, 90, trans->battery.batt_stat, scePowerIsBatteryExist() ? trans->battery.batt_stat_present : trans->battery.batt_stat_absent);
|
||||
text_battery[2] = pspEverestPrintf(15, 110, trans->battery.charging, scePowerIsBatteryCharging() ? scePowerIsBatteryExist() ? battery_percent == 100 ? trans->battery.charging_cpl : trans->yes : trans->no : trans->no);
|
||||
text_battery[3] = pspEverestPrintf(15, 130, battery_percent > 100 || battery_percent < 0 ? trans->battery.no_charge_lvl : trans->battery.charge_lvl, battery_percent);
|
||||
text_battery[4] = pspEverestPrintf(15, 150, trans->battery.charge_stat, battery_percent >= 0 && battery_percent <= 20 ? trans->battery.charge_stat_low : battery_percent > 20 && battery_percent < 70 ? trans->battery.charge_stat_normal : battery_percent >= 70 && battery_percent <= 100 ? trans->battery.charge_stat_strong : "-");
|
||||
text_battery[5] = pspEverestPrintf(15, 170, battery_life_time < 0 || battery_life_time / 60 > 100 || (battery_life_time / 60 == 0 && battery_life_time - (battery_life_time / 60 * 60) == 0) ? trans->battery.no_left_time : trans->battery.left_time, battery_life_time / 60, battery_life_time - (battery_life_time / 60 * 60));
|
||||
text_battery[6] = pspEverestPrintf(15, 190, pspSysconBatteryGetElec(&elec) < 0? "Elec Charge: -" : "Elec Charge: %d", elec);
|
||||
|
||||
text_battery[7] = pspEverestPrintf(240, 70, scePowerGetBatteryVolt() <= 0 ? trans->battery.no_voltage : trans->battery.voltage, (float)scePowerGetBatteryVolt() / 1000.0);
|
||||
text_battery[8] = pspEverestPrintf(240, 90, scePowerGetBatteryTemp() <= 0 ? trans->battery.no_temperature : trans->battery.temperature, scePowerGetBatteryTemp());
|
||||
text_battery[9] = pspEverestPrintf(240, 110, scePowerGetBatteryRemainCapacity() <= 0 ? trans->battery.no_remain_capacity : trans->battery.remain_capacity, scePowerGetBatteryRemainCapacity());
|
||||
text_battery[10] = pspEverestPrintf(240, 130, scePowerGetBatteryFullCapacity() <= 0 ? trans->battery.no_total_capacity : trans->battery.total_capacity, scePowerGetBatteryFullCapacity());
|
||||
text_battery[11] = pspEverestPrintf(240, 150, scePowerIsBatteryExist() && (psp_model == 0 || (tachyon == 0x00500000 && baryon == 0x0022B200)) && checkbt ? trans->battery.serial : trans->battery.no_serial, bserialdata[0], bserialdata[1]);
|
||||
text_battery[12] = pspEverestPrintf(240, 170, trans->battery.mode,
|
||||
checkbt && scePowerIsBatteryExist() && bserialdata[0] == 0xFFFF && bserialdata[1] == 0xFFFF && (psp_model == 0 || (tachyon <= 0x00500000 && baryon == 0x0022B200)) ? trans->battery.mode_service :
|
||||
checkbt && scePowerIsBatteryExist() && bserialdata[0] == 0x0000 && bserialdata[1] == 0x0000 && (psp_model == 0 || (tachyon <= 0x00500000 && baryon == 0x0022B200)) ? trans->battery.mode_autoboot :
|
||||
checkbt && scePowerIsBatteryExist() && (psp_model == 0 || (tachyon <= 0x00500000 && baryon == 0x0022B200)) ? trans->battery.mode_default : "-");
|
||||
text_battery[13] = pspEverestPrintf(240, 190, pspSysconBatteryGetTotalElec(&total_elec) < 0? "Total Elec Charge: -" : "Total Elec Charge: %d", total_elec);
|
||||
}
|
||||
|
||||
if (!update) {
|
||||
SetBottomDialog(0, 1, ExitInMainMenuBatteryInfo, 0);
|
||||
SetFade();
|
||||
}
|
||||
|
||||
vlfGuiDrawFrame();
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
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, pspGetFirmwareName());
|
||||
text_system[1] = pspEverestPrintf(10, 65, trans->system.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);
|
||||
|
||||
vlfGuiSetPictureXY(pic_button_assign, 131, 68);
|
||||
|
||||
char unicode_username[26];
|
||||
utf82unicode((wchar_t *)unicode_username, (char *)pspGetRegistryValue("/CONFIG/SYSTEM", "owner_name", &username, sizeof(username), 0));
|
||||
|
||||
text_system[2] = pspEverestPrintf(237, 45, trans->system.username);
|
||||
text_system[3] = vlfGuiAddTextW(language == PSP_SYSTEMPARAM_LANGUAGE_RUSSIAN ? 337 : 327, 45, (u16 *)unicode_username);
|
||||
text_system[4] = pspEverestPrintf(237, 65, trans->system.password, pspGetRegistryValue("/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, pspGetVersionTxt());
|
||||
else
|
||||
text_system[6] = pspEverestPrintf(10, 143, trans->system.vertxterr);
|
||||
|
||||
vlfGuiSetTextFontSize(text_system[6], 0.75f);
|
||||
SetBottomDialog(0, 1, ExitInMainMenuSystemInfo, 1);
|
||||
SetFade();
|
||||
}
|
||||
|
||||
void ConsoleIdInfo(void) {
|
||||
text_consoleId[0] = pspEverestPrintf(10, 40, "PSID: %s", pspGetPSID(&psid));
|
||||
|
||||
text_consoleId[1] = pspEverestPrintf(10, 60, "Company Code: %d", pscode.companyCode);
|
||||
|
||||
text_consoleId[2] = pspEverestPrintf(10, 90, "Factory Code: %d", pscode.factoryCode);
|
||||
text_consoleId[3] = pspEverestPrintf(10, 110, pspGetFactoryCodeInfo(pscode.factoryCode));
|
||||
|
||||
text_consoleId[4] = pspEverestPrintf(10, 140, "Product Code: 0x%04X", pscode.productCode);
|
||||
text_consoleId[5] = pspEverestPrintf(10, 160, pspGetProductCodeInfo(pscode.productCode));
|
||||
|
||||
text_consoleId[6] = pspEverestPrintf(10, 190, "Product Sub Code: 0x%04X", pscode.productSubCode);
|
||||
text_consoleId[7] = pspEverestPrintf(10, 210, pspGetProductSubCodeInfo(pscode.productSubCode));
|
||||
|
||||
SetBottomDialog(0, 1, ExitInMainMenuConsoleIdInfo, 1);
|
||||
SetFade();
|
||||
}
|
||||
|
||||
int OnMainMenu(int select) {
|
||||
switch(select) {
|
||||
case 0:
|
||||
vlfGuiCancelCentralMenu();
|
||||
HardwareInfo();
|
||||
break;
|
||||
|
||||
case 1:
|
||||
vlfGuiCancelCentralMenu();
|
||||
battery_break = false;
|
||||
BatteryInfo();
|
||||
break;
|
||||
|
||||
case 2:
|
||||
vlfGuiCancelCentralMenu();
|
||||
SystemInfo();
|
||||
break;
|
||||
|
||||
case 3:
|
||||
vlfGuiCancelCentralMenu();
|
||||
ConsoleIdInfo();
|
||||
break;
|
||||
|
||||
case 4:
|
||||
sceKernelExitGame();
|
||||
break;
|
||||
}
|
||||
|
||||
return VLF_EV_RET_NOTHING;
|
||||
}
|
||||
|
||||
void MainMenu(int select) {
|
||||
SetTitle("PSP EVEREST 2 Rev 6");
|
||||
|
||||
char *main_menu_items[] = {
|
||||
"Hardware Information",
|
||||
"Battery Information",
|
||||
"Software Information",
|
||||
"Console ID Information",
|
||||
"Exit"
|
||||
};
|
||||
|
||||
vlfGuiCentralMenu(NUM_DEL_ITEMS_MAIN, main_menu_items, select, OnMainMenu, 0, 0);
|
||||
SetBottomDialog(1, 0, OnMainMenu, 0);
|
||||
}
|
||||
|
||||
int app_main(int argc, char *argv[]) {
|
||||
sceUtilityGetSystemParamInt(PSP_SYSTEMPARAM_ID_INT_LANGUAGE, &language);
|
||||
SetupTranslate();
|
||||
|
||||
if (language == PSP_SYSTEMPARAM_LANGUAGE_RUSSIAN)
|
||||
vlfGuiSetLanguage(PSP_SYSTEMPARAM_LANGUAGE_RUSSIAN);
|
||||
else
|
||||
vlfGuiSetLanguage(PSP_SYSTEMPARAM_LANGUAGE_ENGLISH);
|
||||
|
||||
*(u32 *)kirk = pspGetKirkVersion();
|
||||
*(u32 *)spock = pspGetSpockVersion();
|
||||
tachyon = pspGetTachyonVersion();
|
||||
fuseid = pspGetFuseId();
|
||||
fusecfg = pspGetFuseConfig();
|
||||
scramble = pspNandGetScramble();
|
||||
pspGetBaryonVersion(&baryon);
|
||||
pspGetPommelVersion(&pommel);
|
||||
pspGetPolestarVersion(&polestar);
|
||||
devkit = sceKernelDevkitVersion();
|
||||
pspGetInitialFW(initial_fw);
|
||||
pspChkregGetPsCode(&pscode);
|
||||
sceOpenPSIDGetOpenPSID(&psid);
|
||||
pspGetRegistryValue("/CONFIG/SYSTEM/XMB", "button_assign", &button_assign, 4, 1);
|
||||
vertxt = pspGetVersionTxt();
|
||||
|
||||
vlfGuiSystemSetup(1, 1, 1);
|
||||
|
||||
int OnBackgroundPlus(void *param) {
|
||||
background_number++;
|
||||
battery_fade_ctrl = true;
|
||||
SetBackground();
|
||||
return VLF_EV_RET_NOTHING;
|
||||
}
|
||||
|
||||
int OnBackgroundMinus(void *param) {
|
||||
background_number--;
|
||||
battery_fade_ctrl = true;
|
||||
SetBackground();
|
||||
return VLF_EV_RET_NOTHING;
|
||||
}
|
||||
|
||||
vlfGuiAddEventHandler(PSP_CTRL_RTRIGGER, -1, OnBackgroundPlus, NULL);
|
||||
vlfGuiAddEventHandler(PSP_CTRL_LTRIGGER, -1, OnBackgroundMinus, NULL);
|
||||
|
||||
max_background_number = backgrounds_bmp_size / 6176 - 1;
|
||||
background_number = random(0, max_background_number);
|
||||
|
||||
SetBackground();
|
||||
MainMenu(0);
|
||||
|
||||
while(1)
|
||||
vlfGuiDrawFrame();
|
||||
|
||||
return 0;
|
||||
}
|
379
app/source/main.cpp
Normal file
379
app/source/main.cpp
Normal file
@ -0,0 +1,379 @@
|
||||
//>>> PSP_EVEREST 2
|
||||
//Copyright(C) 2023, frostegater, Joel16
|
||||
|
||||
#include <pspctrl.h>
|
||||
#include <pspidstorage.h>
|
||||
#include <pspkernel.h>
|
||||
#include <psppower.h>
|
||||
#include <pspsdk.h>
|
||||
#include <psputility_sysparam.h>
|
||||
#include <stdarg.h>
|
||||
#include <stdbool.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "consoleidinfo.h"
|
||||
#include "gui.h"
|
||||
#include "hardwareinfo.h"
|
||||
#include "kernel.h"
|
||||
#include "main.h"
|
||||
#include "systeminfo.h"
|
||||
#include "translate.h"
|
||||
#include "utils.h"
|
||||
#include "vlf.h"
|
||||
|
||||
PSP_MODULE_INFO("PSP EVEREST 2 Rev 7", PSP_MODULE_USER, 2, 7);
|
||||
PSP_MAIN_THREAD_ATTR(0);
|
||||
|
||||
static char initial_fw[8], kirk[4], spock[4];
|
||||
static u32 fusecfg = 0, scramble = 0;
|
||||
static u64 fuseid = 0;
|
||||
static ScePsCode pscode = { 0 };
|
||||
static char *vertxt = nullptr;
|
||||
static PspOpenPSID psid = { 0 };
|
||||
|
||||
int psp_model = 0, devkit = 0, language = 0;
|
||||
s32 tachyon = 0, baryon = 0, pommel = 0, polestar = 0;
|
||||
|
||||
namespace Menus {
|
||||
static constexpr u8 NUM_DEL_ITEMS_MAIN = 5;
|
||||
static constexpr u8 NUM_DEL_ITEMS_HARDWARE = 19;
|
||||
static constexpr u8 NUM_DEL_ITEMS_BATTERY = 14;
|
||||
static constexpr u8 NUM_DEL_ITEMS_SYSTEM = 7;
|
||||
static constexpr u8 NUM_DEL_ITEMS_CONSOLEID = 8;
|
||||
|
||||
static bool battery_break = false;
|
||||
static u16 bserialdata[2], serialdata[2];
|
||||
static VlfText text_hardware[NUM_DEL_ITEMS_HARDWARE], text_battery[NUM_DEL_ITEMS_BATTERY],
|
||||
text_system[NUM_DEL_ITEMS_SYSTEM], text_consoleId[NUM_DEL_ITEMS_CONSOLEID];
|
||||
|
||||
void MainMenu(int select);
|
||||
|
||||
int SubMenuHandler(int enter, bool battery_break, int max_items, VlfText *items, int selection) {
|
||||
if (!enter) {
|
||||
if (!battery_break) {
|
||||
for(int i = 0; i < max_items; i++) {
|
||||
vlfGuiRemoveText(items[i]);
|
||||
}
|
||||
}
|
||||
|
||||
if (!button_assign) {
|
||||
vlfGuiBottomDialog(-1, VLF_DI_ENTER, 1, 0, VLF_DEFAULT, nullptr);
|
||||
}
|
||||
|
||||
vlfGuiCancelBottomDialog();
|
||||
Menus::MainMenu(selection);
|
||||
}
|
||||
|
||||
return VLF_EV_RET_NOTHING;
|
||||
}
|
||||
|
||||
int HardwareInfoHandler(int enter) {
|
||||
return Menus::SubMenuHandler(enter, false, NUM_DEL_ITEMS_HARDWARE, text_hardware, 0);
|
||||
}
|
||||
|
||||
int BatteryInfoHandler(int enter) {
|
||||
battery_break = true;
|
||||
return Menus::SubMenuHandler(enter, battery_break, 0, NULL, 1);
|
||||
}
|
||||
|
||||
int SystemInfoHandler(int enter) {
|
||||
if (pic_button_assign != nullptr) {
|
||||
vlfGuiRemovePicture(pic_button_assign);
|
||||
pic_button_assign = nullptr;
|
||||
}
|
||||
|
||||
return Menus::SubMenuHandler(enter, false, NUM_DEL_ITEMS_SYSTEM, text_system, 2);
|
||||
}
|
||||
|
||||
int ConsoleIdInfoHandler(int enter) {
|
||||
return Menus::SubMenuHandler(enter, false, NUM_DEL_ITEMS_CONSOLEID, text_consoleId, 3);
|
||||
}
|
||||
|
||||
void HardwareInfo(void) {
|
||||
GUI::SetTitle(trans->hardware_title);
|
||||
|
||||
text_hardware[0] = GUI::Printf(10, 40, "Tachyon: 0x%08X", tachyon);
|
||||
text_hardware[1] = GUI::Printf(10, 60, "Baryon: 0x%08X", baryon);
|
||||
text_hardware[2] = GUI::Printf(10, 80, "Pommel: 0x%08X", pommel);
|
||||
text_hardware[3] = GUI::Printf(10, 100, "Polestar: 0x%08X", polestar);
|
||||
text_hardware[4] = GUI::Printf(10, 120, "FuseID: 0x%llX", fuseid);
|
||||
text_hardware[5] = GUI::Printf(10, 140, "FuseCFG: 0x%08X", fusecfg);
|
||||
text_hardware[6] = GUI::Printf(10, 160, "IDScramble: 0x%08X", scramble);
|
||||
text_hardware[7] = GUI::Printf(10, 180, "Kirk: %c%c%c%c", kirk[3], kirk[2], kirk[1], kirk[0]);
|
||||
text_hardware[8] = GUI::Printf(10, 200, psp_model == 4 ? "Spock: -" : "Spock: %c%c%c%c", spock[3], spock[2], spock[1], spock[0]);
|
||||
text_hardware[9] = GUI::Printf(10, 220, HardwareInfo::GetModelSymbol() != -1 ? trans->hardware.model : trans->hardware.no_model, psp_model == 4 ? "N" : psp_model == 10 ? "E" : "", HardwareInfo::GetModelSymbol(), pspGetRegion() < 10 ? "0" : "", pspGetRegion(), HardwareInfo::GetModel());
|
||||
|
||||
text_hardware[10] = GUI::Printf(250, 40, trans->hardware.mobo, HardwareInfo::GetMotherboard());
|
||||
text_hardware[11] = GUI::Printf(250, 60, trans->hardware.region, HardwareInfo::GetRegion());
|
||||
text_hardware[12] = GUI::Printf(250, 80, trans->hardware.gen, psp_model < 10 ? "0" : "", psp_model + 1);
|
||||
text_hardware[13] = GUI::Printf(250, 100, trans->hardware.eeprom, tachyon <= 0x00500000 && tachyon != 0x00100000 && baryon <= 0x0022B200 ? trans->yes : trans->no);
|
||||
text_hardware[14] = GUI::Printf(250, 120, trans->hardware.pandora, tachyon <= 0x00500000 ? trans->yes : trans->no);
|
||||
text_hardware[15] = GUI::Printf(250, 140, "MAC: %s", HardwareInfo::GetMacAddress());
|
||||
text_hardware[16] = GUI::Printf(250, 160, trans->hardware.initialfw, initial_fw);
|
||||
text_hardware[17] = GUI::Printf(250, 180, trans->hardware.umdfw, psp_model == 4 ? "-" : HardwareInfo::GetUMDFirmware());
|
||||
text_hardware[18] = GUI::Printf(250, 200, trans->hardware.nandsize, (pspNandGetPageSize() * pspNandGetPagesPerBlock() * pspNandGetTotalBlocks()) / 1024 / 1024);
|
||||
|
||||
GUI::SetBottomDialog(0, 1, Menus::HardwareInfoHandler, 1);
|
||||
GUI::SetFade();
|
||||
}
|
||||
|
||||
void BatteryInfo(void) {
|
||||
bool swbt = true, checkbt = false;
|
||||
int elec = 0, total_elec = 0;
|
||||
|
||||
if (button_assign) {
|
||||
vlfGuiBottomDialog(VLF_DI_BACK, -1, 1, 0, 0, nullptr);
|
||||
}
|
||||
|
||||
vlfGuiCancelBottomDialog();
|
||||
GUI::SetTitle(trans->battery_title);
|
||||
|
||||
battery_fade_ctrl = false;
|
||||
bool first_cycle = true;
|
||||
|
||||
for(int update = 0;; update++) {
|
||||
if (update == 25 || battery_fade_ctrl) {
|
||||
update = 1;
|
||||
first_cycle = battery_fade_ctrl;
|
||||
battery_fade_ctrl = false;
|
||||
}
|
||||
|
||||
vlfGuiDrawFrame();
|
||||
|
||||
if (!first_cycle || update == 0) {
|
||||
for(int i = 0; i < NUM_DEL_ITEMS_BATTERY; i++) {
|
||||
if (text_battery[i] != nullptr) {
|
||||
vlfGuiRemoveText(text_battery[i]);
|
||||
text_battery[i] = nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
int battery_percent = scePowerGetBatteryLifePercent();
|
||||
int battery_life_time = scePowerGetBatteryLifeTime();
|
||||
|
||||
if (update != 0 && scePowerIsBatteryExist() && swbt && (psp_model == 0 || (tachyon <= 0x00500000 && baryon == 0x0022B200))) {
|
||||
pspReadSerial(bserialdata);
|
||||
|
||||
u16 wrbuffer[0x80];
|
||||
wrbuffer[0] = 0x5053;
|
||||
|
||||
if (bserialdata[0] != 0x5058) {
|
||||
wrbuffer[1] = 0x5058;
|
||||
}
|
||||
else {
|
||||
wrbuffer[1] = 0x4456;
|
||||
}
|
||||
|
||||
pspWriteSerial(wrbuffer);
|
||||
|
||||
checkbt = false;
|
||||
pspReadSerial(serialdata);
|
||||
|
||||
if (serialdata[0] == wrbuffer[0] && serialdata[1] == wrbuffer[1]) {
|
||||
checkbt = true;
|
||||
pspWriteSerial(bserialdata);
|
||||
}
|
||||
|
||||
swbt = false;
|
||||
}
|
||||
|
||||
if (!swbt && !scePowerIsBatteryExist()) {
|
||||
swbt = true;
|
||||
}
|
||||
|
||||
text_battery[0] = GUI::Printf(15, 70, trans->battery.ex_power, psp_model == 4 ? "-" : scePowerIsPowerOnline() ? trans->yes : trans->no);
|
||||
text_battery[1] = GUI::Printf(15, 90, trans->battery.batt_stat, scePowerIsBatteryExist() ? trans->battery.batt_stat_present : trans->battery.batt_stat_absent);
|
||||
text_battery[2] = GUI::Printf(15, 110, trans->battery.charging, scePowerIsBatteryCharging() ? scePowerIsBatteryExist() ? battery_percent == 100 ? trans->battery.charging_cpl : trans->yes : trans->no : trans->no);
|
||||
text_battery[3] = GUI::Printf(15, 130, battery_percent > 100 || battery_percent < 0 ? trans->battery.no_charge_lvl : trans->battery.charge_lvl, battery_percent);
|
||||
text_battery[4] = GUI::Printf(15, 150, trans->battery.charge_stat, battery_percent >= 0 && battery_percent <= 20 ? trans->battery.charge_stat_low : battery_percent > 20 && battery_percent < 70 ? trans->battery.charge_stat_normal : battery_percent >= 70 && battery_percent <= 100 ? trans->battery.charge_stat_strong : "-");
|
||||
text_battery[5] = GUI::Printf(15, 170, battery_life_time < 0 || battery_life_time / 60 > 100 || (battery_life_time / 60 == 0 && battery_life_time - (battery_life_time / 60 * 60) == 0) ? trans->battery.no_left_time : trans->battery.left_time, battery_life_time / 60, battery_life_time - (battery_life_time / 60 * 60));
|
||||
text_battery[6] = GUI::Printf(15, 190, pspSysconBatteryGetElec(&elec) < 0? "Elec Charge: -" : "Elec Charge: %d", elec);
|
||||
|
||||
text_battery[7] = GUI::Printf(240, 70, scePowerGetBatteryVolt() <= 0 ? trans->battery.no_voltage : trans->battery.voltage, (float)scePowerGetBatteryVolt() / 1000.0);
|
||||
text_battery[8] = GUI::Printf(240, 90, scePowerGetBatteryTemp() <= 0 ? trans->battery.no_temperature : trans->battery.temperature, scePowerGetBatteryTemp());
|
||||
text_battery[9] = GUI::Printf(240, 110, scePowerGetBatteryRemainCapacity() <= 0 ? trans->battery.no_remain_capacity : trans->battery.remain_capacity, scePowerGetBatteryRemainCapacity());
|
||||
text_battery[10] = GUI::Printf(240, 130, scePowerGetBatteryFullCapacity() <= 0 ? trans->battery.no_total_capacity : trans->battery.total_capacity, scePowerGetBatteryFullCapacity());
|
||||
text_battery[11] = GUI::Printf(240, 150, scePowerIsBatteryExist() && (psp_model == 0 || (tachyon == 0x00500000 && baryon == 0x0022B200)) && checkbt ? trans->battery.serial : trans->battery.no_serial, bserialdata[0], bserialdata[1]);
|
||||
text_battery[12] = GUI::Printf(240, 170, trans->battery.mode,
|
||||
checkbt && scePowerIsBatteryExist() && bserialdata[0] == 0xFFFF && bserialdata[1] == 0xFFFF && (psp_model == 0 || (tachyon <= 0x00500000 && baryon == 0x0022B200)) ? trans->battery.mode_service :
|
||||
checkbt && scePowerIsBatteryExist() && bserialdata[0] == 0x0000 && bserialdata[1] == 0x0000 && (psp_model == 0 || (tachyon <= 0x00500000 && baryon == 0x0022B200)) ? trans->battery.mode_autoboot :
|
||||
checkbt && scePowerIsBatteryExist() && (psp_model == 0 || (tachyon <= 0x00500000 && baryon == 0x0022B200)) ? trans->battery.mode_default : "-");
|
||||
text_battery[13] = GUI::Printf(240, 190, pspSysconBatteryGetTotalElec(&total_elec) < 0? "Total Elec Charge: -" : "Total Elec Charge: %d", total_elec);
|
||||
}
|
||||
|
||||
if (!update) {
|
||||
GUI::SetBottomDialog(0, 1, Menus::BatteryInfoHandler, 0);
|
||||
GUI::SetFade();
|
||||
}
|
||||
|
||||
vlfGuiDrawFrame();
|
||||
|
||||
if (battery_break) {
|
||||
for(int i = 0; i < NUM_DEL_ITEMS_BATTERY; i++) {
|
||||
if (text_battery[i] != nullptr) {
|
||||
vlfGuiRemoveText(text_battery[i]);
|
||||
text_battery[i] = nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void SystemInfo(void) {
|
||||
char username[32], password[5];;
|
||||
memset(username, 0, sizeof(username));
|
||||
memset(password, 0, sizeof(password));
|
||||
|
||||
GUI::SetTitle(trans->system_title);
|
||||
|
||||
text_system[0] = GUI::Printf(10, 45, trans->system.fw, SystemInfo::GetFirmware());
|
||||
text_system[1] = GUI::Printf(10, 65, trans->system.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);
|
||||
}
|
||||
|
||||
vlfGuiSetPictureXY(pic_button_assign, 131, 68);
|
||||
|
||||
char unicode_username[26];
|
||||
Utils::UTF8ToUnicode(reinterpret_cast<wchar_t *>(unicode_username), reinterpret_cast<char *>(Utils::GetRegistryValue("/CONFIG/SYSTEM", "owner_name", &username, sizeof(username), 0)));
|
||||
|
||||
text_system[2] = GUI::Printf(237, 45, trans->system.username);
|
||||
text_system[3] = vlfGuiAddTextW(language == PSP_SYSTEMPARAM_LANGUAGE_RUSSIAN ? 337 : 327, 45, reinterpret_cast<u16 *>(unicode_username));
|
||||
text_system[4] = GUI::Printf(237, 65, trans->system.password, Utils::GetRegistryValue("/CONFIG/SYSTEM/LOCK", "password", &password, sizeof(password), 0));
|
||||
text_system[5] = GUI::Printf(10, 120, "version.txt:");
|
||||
|
||||
if (vertxt != nullptr) {
|
||||
text_system[6] = vlfGuiAddTextF(10, 143, vertxt);
|
||||
}
|
||||
else {
|
||||
text_system[6] = GUI::Printf(10, 143, trans->system.vertxterr);
|
||||
}
|
||||
|
||||
vlfGuiSetTextFontSize(text_system[6], 0.75f);
|
||||
GUI::SetBottomDialog(0, 1, Menus::SystemInfoHandler, 1);
|
||||
GUI::SetFade();
|
||||
}
|
||||
|
||||
void ConsoleIdInfo(void) {
|
||||
GUI::SetTitle("Console ID Information");
|
||||
|
||||
text_consoleId[0] = GUI::Printf(10, 40, "PSID: %s", ConsoleIdInfo::GetPSID(&psid));
|
||||
|
||||
text_consoleId[1] = GUI::Printf(10, 60, "Company Code: %d", pscode.companyCode);
|
||||
|
||||
text_consoleId[2] = GUI::Printf(10, 90, "Factory Code: %d", pscode.factoryCode);
|
||||
text_consoleId[3] = GUI::Printf(10, 110, ConsoleIdInfo::GetFactoryCodeInfo(pscode.factoryCode));
|
||||
|
||||
text_consoleId[4] = GUI::Printf(10, 140, "Product Code: 0x%04X", pscode.productCode);
|
||||
text_consoleId[5] = GUI::Printf(10, 160, ConsoleIdInfo::GetProductCodeInfo(pscode.productCode));
|
||||
|
||||
text_consoleId[6] = GUI::Printf(10, 190, "Product Sub Code: 0x%04X", pscode.productSubCode);
|
||||
text_consoleId[7] = GUI::Printf(10, 210, ConsoleIdInfo::GetProductSubCodeInfo(pscode.productSubCode));
|
||||
|
||||
GUI::SetBottomDialog(0, 1, Menus::ConsoleIdInfoHandler, 1);
|
||||
GUI::SetFade();
|
||||
}
|
||||
|
||||
int MainMenuHandler(int select) {
|
||||
switch(select) {
|
||||
case 0:
|
||||
vlfGuiCancelCentralMenu();
|
||||
Menus::HardwareInfo();
|
||||
break;
|
||||
|
||||
case 1:
|
||||
vlfGuiCancelCentralMenu();
|
||||
battery_break = false;
|
||||
Menus::BatteryInfo();
|
||||
break;
|
||||
|
||||
case 2:
|
||||
vlfGuiCancelCentralMenu();
|
||||
Menus::SystemInfo();
|
||||
break;
|
||||
|
||||
case 3:
|
||||
vlfGuiCancelCentralMenu();
|
||||
Menus::ConsoleIdInfo();
|
||||
break;
|
||||
|
||||
case 4:
|
||||
sceKernelExitGame();
|
||||
break;
|
||||
}
|
||||
|
||||
return VLF_EV_RET_NOTHING;
|
||||
}
|
||||
|
||||
void MainMenu(int select) {
|
||||
GUI::SetTitle("PSP EVEREST 2 Rev 7");
|
||||
|
||||
const char *main_menu_items[] = {
|
||||
"Hardware Information",
|
||||
"Battery Information",
|
||||
"Software Information",
|
||||
"Console ID Information",
|
||||
"Exit"
|
||||
};
|
||||
|
||||
vlfGuiCentralMenu(NUM_DEL_ITEMS_MAIN, main_menu_items, select, Menus::MainMenuHandler, 0, 0);
|
||||
GUI::SetBottomDialog(1, 0, Menus::MainMenuHandler, 0);
|
||||
}
|
||||
}
|
||||
|
||||
#if defined (__cplusplus)
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
int app_main(int argc, char *argv[]) {
|
||||
sceUtilityGetSystemParamInt(PSP_SYSTEMPARAM_ID_INT_LANGUAGE, &language);
|
||||
SetupTranslate();
|
||||
|
||||
if (language == PSP_SYSTEMPARAM_LANGUAGE_RUSSIAN) {
|
||||
vlfGuiSetLanguage(PSP_SYSTEMPARAM_LANGUAGE_RUSSIAN);
|
||||
}
|
||||
else {
|
||||
vlfGuiSetLanguage(PSP_SYSTEMPARAM_LANGUAGE_ENGLISH);
|
||||
}
|
||||
|
||||
*(u32 *)kirk = pspGetKirkVersion();
|
||||
*(u32 *)spock = pspGetSpockVersion();
|
||||
tachyon = pspGetTachyonVersion();
|
||||
fuseid = pspGetFuseId();
|
||||
fusecfg = pspGetFuseConfig();
|
||||
scramble = pspNandGetScramble();
|
||||
pspGetBaryonVersion(&baryon);
|
||||
pspGetPommelVersion(&pommel);
|
||||
pspGetPolestarVersion(&polestar);
|
||||
devkit = sceKernelDevkitVersion();
|
||||
pspGetInitialFW(initial_fw);
|
||||
pspChkregGetPsCode(&pscode);
|
||||
sceOpenPSIDGetOpenPSID(&psid);
|
||||
Utils::GetRegistryValue("/CONFIG/SYSTEM/XMB", "button_assign", &button_assign, 4, 1);
|
||||
vertxt = SystemInfo::GetVersionTxt();
|
||||
|
||||
vlfGuiSystemSetup(1, 1, 1);
|
||||
vlfGuiAddEventHandler(PSP_CTRL_RTRIGGER, -1, GUI::OnBackgroundPlus, nullptr);
|
||||
vlfGuiAddEventHandler(PSP_CTRL_LTRIGGER, -1, GUI::OnBackgroundMinus, nullptr);
|
||||
|
||||
GUI::GenRandomBackground();
|
||||
GUI::SetBackground();
|
||||
Menus::MainMenu(0);
|
||||
|
||||
while(1) {
|
||||
vlfGuiDrawFrame();
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
#if defined (__cplusplus)
|
||||
}
|
||||
#endif
|
@ -1,115 +0,0 @@
|
||||
#include <pspkernel.h>
|
||||
#include <pspsdk.h>
|
||||
#include <systemctrl.h>
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
|
||||
#include "main.h"
|
||||
#include "utils.h"
|
||||
#include "translate.h"
|
||||
|
||||
int sctrlHENGetMinorVersion();
|
||||
static char get_firmware_buf[22], version_txt_buf[256];
|
||||
|
||||
char *pspGetFirmwareName(void) {
|
||||
char *cfwname = "";
|
||||
int henid = sctrlHENGetVersion();
|
||||
|
||||
if (devkit == 0x05000010)
|
||||
cfwname = "m33";
|
||||
else if (devkit == 0x05000210)
|
||||
cfwname = "GEN";
|
||||
else if (devkit == 0x05000310) {
|
||||
if (henid != 0x8002013A)
|
||||
cfwname = "GEN/MHU";
|
||||
else
|
||||
cfwname = "GEN/MHU";
|
||||
}
|
||||
else if (devkit == 0x05050010)
|
||||
cfwname = "GEN";
|
||||
else if (devkit == 0x06020010) {
|
||||
if (sctrlHENGetMinorVersion() != 0x8002013A) {
|
||||
if (henid == 0x00001001)
|
||||
cfwname = "PRO";
|
||||
else if (henid == 0x00001002)
|
||||
cfwname = "PRO-B";
|
||||
else if (henid == 0x00001003)
|
||||
cfwname = "PRO-C";
|
||||
}
|
||||
else if (henid == 0x00001000)
|
||||
cfwname = "TN-A";
|
||||
else if (henid == 0x00001001)
|
||||
cfwname = "TN-B";
|
||||
else if (henid == 0x00001002)
|
||||
cfwname = "TN-C";
|
||||
else if (henid == 0x00001003)
|
||||
cfwname = "TN-D";
|
||||
else if (henid == 0x00001004)
|
||||
cfwname = "TN-E";
|
||||
}
|
||||
else if (devkit == 0x06030110)
|
||||
cfwname = "PRO HEN";
|
||||
else if (devkit == 0x06030510) {
|
||||
if (sctrlHENGetMinorVersion() != 0x8002013A) {
|
||||
if (henid == 0x00001001)
|
||||
cfwname = "PRO";
|
||||
else if (henid == 0x00001002)
|
||||
cfwname = "PRO-B";
|
||||
else if (henid == 0x00001003)
|
||||
cfwname = "PRO-C";
|
||||
}
|
||||
else if (henid == 0x00001000)
|
||||
cfwname = "Custom";
|
||||
}
|
||||
else if (devkit == 0x06030610)
|
||||
cfwname = "PRO HEN";
|
||||
else if (devkit == 0x06030710 && henid == 0x00001000)
|
||||
cfwname = "ME";
|
||||
else if (devkit == 0x06030810 && henid == 0x00001000)
|
||||
cfwname = "ME";
|
||||
else if (devkit == 0x06030910) {
|
||||
if (sctrlHENGetMinorVersion() != 0x8002013A) {
|
||||
if (henid == 0x00001001)
|
||||
cfwname = "PRO";
|
||||
else if (henid == 0x00001002)
|
||||
cfwname = "PRO-B";
|
||||
else if (henid == 0x00001003)
|
||||
cfwname = "PRO-C";
|
||||
}
|
||||
else if (henid == 0x00001000)
|
||||
cfwname = "ME";
|
||||
else if (henid == 0x00002000)
|
||||
cfwname = "TN-A";
|
||||
}
|
||||
else if (devkit == 0x06060010) {
|
||||
if (sctrlHENGetMinorVersion() != 0x8002013A) {
|
||||
if (henid == 0x00001001)
|
||||
cfwname = "PRO";
|
||||
else if (henid == 0x00001002)
|
||||
cfwname = "PRO-B";
|
||||
else if (henid == 0x00001003)
|
||||
cfwname = "PRO-C";
|
||||
}
|
||||
else if (henid == 0x00001000)
|
||||
cfwname = "ME";
|
||||
}
|
||||
|
||||
char *devkit_chr = (char *)&devkit;
|
||||
snprintf(get_firmware_buf, 22, "%i.%i%i %s", devkit_chr[3], devkit_chr[2], devkit_chr[1], cfwname);
|
||||
return get_firmware_buf;
|
||||
}
|
||||
|
||||
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)
|
||||
sceIoRead(fd, version_txt_buf, 255);
|
||||
else {
|
||||
sceIoClose(fd);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
sceIoClose(fd);
|
||||
return version_txt_buf;
|
||||
}
|
149
app/source/systeminfo.cpp
Normal file
149
app/source/systeminfo.cpp
Normal file
@ -0,0 +1,149 @@
|
||||
#include <pspkernel.h>
|
||||
#include <pspsdk.h>
|
||||
#include <systemctrl.h>
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
|
||||
#include "main.h"
|
||||
#include "utils.h"
|
||||
#include "translate.h"
|
||||
|
||||
int sctrlHENGetMinorVersion();
|
||||
|
||||
namespace SystemInfo {
|
||||
static char get_firmware_buf[22], version_txt_buf[256];
|
||||
|
||||
const char *pspGetCFWName(void) {
|
||||
u32 hen_version = sctrlHENGetVersion();
|
||||
|
||||
if (devkit == 0x05000010) {
|
||||
return "m33";
|
||||
}
|
||||
else if (devkit == 0x05000210) {
|
||||
return "GEN";
|
||||
}
|
||||
else if (devkit == 0x05000310) {
|
||||
if (hen_version != 0x8002013A) {
|
||||
return "GEN/MHU";
|
||||
}
|
||||
else {
|
||||
return "GEN/MHU";
|
||||
}
|
||||
}
|
||||
else if (devkit == 0x05050010) {
|
||||
return "GEN";
|
||||
}
|
||||
else if (devkit == 0x06020010) {
|
||||
if (static_cast<u32>(sctrlHENGetMinorVersion()) != 0x8002013A) {
|
||||
if (hen_version == 0x00001001) {
|
||||
return "PRO";
|
||||
}
|
||||
else if (hen_version == 0x00001002) {
|
||||
return "PRO-B";
|
||||
}
|
||||
else if (hen_version == 0x00001003) {
|
||||
return "PRO-C";
|
||||
}
|
||||
}
|
||||
else if (hen_version == 0x00001000) {
|
||||
return "TN-A";
|
||||
}
|
||||
else if (hen_version == 0x00001001) {
|
||||
return "TN-B";
|
||||
}
|
||||
else if (hen_version == 0x00001002) {
|
||||
return "TN-C";
|
||||
}
|
||||
else if (hen_version == 0x00001003) {
|
||||
return "TN-D";
|
||||
}
|
||||
else if (hen_version == 0x00001004) {
|
||||
return "TN-E";
|
||||
}
|
||||
}
|
||||
else if (devkit == 0x06030110) {
|
||||
return "PRO HEN";
|
||||
}
|
||||
else if (devkit == 0x06030510) {
|
||||
if (static_cast<u32>(sctrlHENGetMinorVersion()) != 0x8002013A) {
|
||||
if (hen_version == 0x00001001) {
|
||||
return "PRO";
|
||||
}
|
||||
else if (hen_version == 0x00001002) {
|
||||
return "PRO-B";
|
||||
}
|
||||
else if (hen_version == 0x00001003) {
|
||||
return "PRO-C";
|
||||
}
|
||||
}
|
||||
else if (hen_version == 0x00001000) {
|
||||
return "Custom";
|
||||
}
|
||||
}
|
||||
else if (devkit == 0x06030610) {
|
||||
return "PRO HEN";
|
||||
}
|
||||
else if (devkit == 0x06030710 && hen_version == 0x00001000) {
|
||||
return "ME";
|
||||
}
|
||||
else if (devkit == 0x06030810 && hen_version == 0x00001000) {
|
||||
return "ME";
|
||||
}
|
||||
else if (devkit == 0x06030910) {
|
||||
if (static_cast<u32>(sctrlHENGetMinorVersion()) != 0x8002013A) {
|
||||
if (hen_version == 0x00001001) {
|
||||
return "PRO";
|
||||
}
|
||||
else if (hen_version == 0x00001002) {
|
||||
return "PRO-B";
|
||||
}
|
||||
else if (hen_version == 0x00001003) {
|
||||
return "PRO-C";
|
||||
}
|
||||
}
|
||||
else if (hen_version == 0x00001000) {
|
||||
return "ME";
|
||||
}
|
||||
else if (hen_version == 0x00002000) {
|
||||
return "TN-A";
|
||||
}
|
||||
}
|
||||
else if (devkit == 0x06060010) {
|
||||
if (static_cast<u32>(sctrlHENGetMinorVersion()) != 0x8002013A) {
|
||||
if (hen_version == 0x00001001) {
|
||||
return "PRO";
|
||||
}
|
||||
else if (hen_version == 0x00001002) {
|
||||
return "PRO-B";
|
||||
}
|
||||
else if (hen_version == 0x00001003) {
|
||||
return "PRO-C";
|
||||
}
|
||||
}
|
||||
else if (hen_version == 0x00001000) {
|
||||
return "ME";
|
||||
}
|
||||
}
|
||||
|
||||
return "";
|
||||
}
|
||||
|
||||
char *GetFirmware(void) {
|
||||
char *devkit_chr = (char *)&devkit;
|
||||
snprintf(get_firmware_buf, 22, "%i.%i%i %s", devkit_chr[3], devkit_chr[2], devkit_chr[1], pspGetCFWName());
|
||||
return get_firmware_buf;
|
||||
}
|
||||
|
||||
char *GetVersionTxt(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) {
|
||||
sceIoRead(fd, version_txt_buf, 255);
|
||||
sceIoClose(fd);
|
||||
return version_txt_buf;
|
||||
}
|
||||
|
||||
return nullptr;
|
||||
}
|
||||
}
|
@ -1,120 +0,0 @@
|
||||
#include <pspkernel.h>
|
||||
#include <pspreg.h>
|
||||
#include <psprtc.h>
|
||||
#include <pspsdk.h>
|
||||
#include <string.h>
|
||||
#include <stdarg.h>
|
||||
#include <stdio.h>
|
||||
|
||||
#include "main.h"
|
||||
#include "vlf.h"
|
||||
|
||||
int pspGetRegistryValue(const char *dir, const char *name, void *buf, int bufsize, int inttype) {
|
||||
int ret = 0;
|
||||
struct RegParam reg;
|
||||
REGHANDLE h;
|
||||
|
||||
memset(®, 0, sizeof(reg));
|
||||
reg.regtype = 1;
|
||||
reg.namelen = strlen("/system");
|
||||
reg.unk2 = 1;
|
||||
reg.unk3 = 1;
|
||||
strncpy(reg.name, "/system", 8);
|
||||
|
||||
if (sceRegOpenRegistry(®, 2, &h) == 0) {
|
||||
REGHANDLE 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)) {
|
||||
ret = inttype ? 1 : (int)buf;
|
||||
sceRegFlushCategory(hd);
|
||||
}
|
||||
}
|
||||
|
||||
sceRegCloseCategory(hd);
|
||||
}
|
||||
|
||||
sceRegFlushRegistry(h);
|
||||
sceRegCloseRegistry(h);
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
int random(int min, int max) {
|
||||
u64 tick = 0;
|
||||
SceKernelUtilsMt19937Context ctx = { 0 };
|
||||
sceRtcGetCurrentTick(&tick);
|
||||
sceKernelUtilsMt19937Init(&ctx, tick);
|
||||
return min + (sceKernelUtilsMt19937UInt(&ctx) % max);
|
||||
}
|
||||
|
||||
int utf82unicode(wchar_t *dest, char *src) {
|
||||
int i, x;
|
||||
unsigned char *usrc = (unsigned char *)src;
|
||||
|
||||
for(i = 0, x = 0; usrc[i];) {
|
||||
wchar_t ch;
|
||||
|
||||
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) {
|
||||
ch = ((usrc[i] & 0x1F) << 6) | (usrc[i+1] & 0x3F);
|
||||
i += 2;
|
||||
}
|
||||
else {
|
||||
ch = usrc[i];
|
||||
i += 1;
|
||||
}
|
||||
|
||||
dest[x++] = ch;
|
||||
}
|
||||
|
||||
dest[x++] = '\0';
|
||||
return x;
|
||||
}
|
||||
|
||||
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) {
|
||||
*unicode++ = 0x22;
|
||||
*unicode++ = 0x21;
|
||||
}
|
||||
else if ((unsigned char)*ascii == 0xB8) {
|
||||
*unicode++ = 0x51;
|
||||
*unicode++ = 0x04;
|
||||
}
|
||||
else if ((unsigned char)*ascii == 0xA8) {
|
||||
*unicode++ = 0x01;
|
||||
*unicode++ = 0x04;
|
||||
}
|
||||
else {
|
||||
*unicode++ = *ascii;
|
||||
*unicode++ = '\0';
|
||||
}
|
||||
|
||||
ascii++;
|
||||
}
|
||||
|
||||
*unicode++ = '\0';
|
||||
*unicode++ = '\0';
|
||||
}
|
||||
|
||||
VlfText pspEverestPrintf(int x, int y, const char *text, ...) {
|
||||
char ascii[256], unicode[256];
|
||||
va_list list;
|
||||
va_start(list, text);
|
||||
vsnprintf(ascii, 256, text, list);
|
||||
va_end(list);
|
||||
ascii2unicode(unicode, ascii);
|
||||
return vlfGuiAddTextW(x, y, (u16 *)unicode);
|
||||
}
|
111
app/source/utils.cpp
Normal file
111
app/source/utils.cpp
Normal file
@ -0,0 +1,111 @@
|
||||
#include <pspkernel.h>
|
||||
#include <pspreg.h>
|
||||
#include <psprtc.h>
|
||||
#include <pspsdk.h>
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
|
||||
#include "main.h"
|
||||
|
||||
namespace Utils {
|
||||
int UTF8ToUnicode(wchar_t *dest, char *src) {
|
||||
int i, x;
|
||||
unsigned char *usrc = reinterpret_cast<unsigned char *>(src);
|
||||
|
||||
for(i = 0, x = 0; usrc[i];) {
|
||||
wchar_t ch;
|
||||
|
||||
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) {
|
||||
ch = ((usrc[i] & 0x1F) << 6) | (usrc[i+1] & 0x3F);
|
||||
i += 2;
|
||||
}
|
||||
else {
|
||||
ch = usrc[i];
|
||||
i += 1;
|
||||
}
|
||||
|
||||
dest[x++] = ch;
|
||||
}
|
||||
|
||||
dest[x++] = '\0';
|
||||
return x;
|
||||
}
|
||||
|
||||
void ASCIIToUnicode(char *unicode, const char *ascii) {
|
||||
while(*ascii != '\0') {
|
||||
if (static_cast<unsigned char>(*ascii) >= 0xC0) {
|
||||
*unicode++ = static_cast<unsigned char>(*ascii) - 0xB0;
|
||||
*unicode++ = 0x04;
|
||||
}
|
||||
else if (static_cast<unsigned char>(*ascii) == 0x99) {
|
||||
*unicode++ = 0x22;
|
||||
*unicode++ = 0x21;
|
||||
}
|
||||
else if (static_cast<unsigned char>(*ascii) == 0xB8) {
|
||||
*unicode++ = 0x51;
|
||||
*unicode++ = 0x04;
|
||||
}
|
||||
else if (static_cast<unsigned char>(*ascii) == 0xA8) {
|
||||
*unicode++ = 0x01;
|
||||
*unicode++ = 0x04;
|
||||
}
|
||||
else {
|
||||
*unicode++ = *ascii;
|
||||
*unicode++ = '\0';
|
||||
}
|
||||
|
||||
ascii++;
|
||||
}
|
||||
|
||||
*unicode++ = '\0';
|
||||
*unicode++ = '\0';
|
||||
}
|
||||
|
||||
int Rand(int min, int max) {
|
||||
u64 tick = 0;
|
||||
SceKernelUtilsMt19937Context ctx = { 0 };
|
||||
sceRtcGetCurrentTick(&tick);
|
||||
sceKernelUtilsMt19937Init(&ctx, tick);
|
||||
return min + (sceKernelUtilsMt19937UInt(&ctx) % max);
|
||||
}
|
||||
|
||||
int GetRegistryValue(const char *dir, const char *name, void *buf, int bufsize, int inttype) {
|
||||
int ret = 0;
|
||||
struct RegParam reg;
|
||||
REGHANDLE h;
|
||||
|
||||
memset(®, 0, sizeof(reg));
|
||||
reg.regtype = 1;
|
||||
reg.namelen = strlen("/system");
|
||||
reg.unk2 = 1;
|
||||
reg.unk3 = 1;
|
||||
strncpy(reg.name, "/system", 8);
|
||||
|
||||
if (sceRegOpenRegistry(®, 2, &h) == 0) {
|
||||
REGHANDLE 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)) {
|
||||
ret = inttype ? 1 : (int)buf;
|
||||
sceRegFlushCategory(hd);
|
||||
}
|
||||
}
|
||||
|
||||
sceRegCloseCategory(hd);
|
||||
}
|
||||
|
||||
sceRegFlushRegistry(h);
|
||||
sceRegCloseRegistry(h);
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user