-
Notifications
You must be signed in to change notification settings - Fork 4
/
system_utils.c
128 lines (119 loc) · 2.71 KB
/
system_utils.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
#include <pspsdk.h>
#include <pspkernel.h>
#include <systemctrl.h>
#include <string.h>
#include <stdio.h>
#include "main.h"
#include "utils.h"
#include "translate.h"
int sctrlHENGetMinorVersion();
char get_firmware_buf[256], version_txt_buf[256];
char *GetFirmwareName()
{
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;
sprintf(get_firmware_buf, "%i.%i%i %s", devkit_chr[3], devkit_chr[2], devkit_chr[1], cfwname);
return get_firmware_buf;
}
char *GetVersionTxt()
{
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;
}