-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathhardware_utils.c
141 lines (114 loc) · 3.32 KB
/
hardware_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
129
130
131
132
133
134
135
136
137
138
139
140
141
#include <pspsdk.h>
#include <pspkernel.h>
#include <string.h>
#include <stdio.h>
#include "main.h"
#include "utils.h"
#include "everest_kernel.h"
#include "translate.h"
#include "kumdman.h"
char macbuf[256];
int GetFirstSymbolOfModel()
{
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;
}
char *GetRegionName()
{
int region = GetRegion();
if(region >= 0 && region < 11)
return trans->hardware.regname[region];
return "-";
}
#define UNKNOWN 0x00000000
typedef struct
{
u32 tachyon;
u32 baryon;
u32 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 *GetMoBoName()
{
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))
{
/* TA-088v1(3.95) / TA-088v2 (4.01) */
if(i == 9 /* TA-088v1 */ && !strncmp(GetInitialFW(), "4.01", 4))
continue;
else if(i == 10 /* TA-088v2 */ && strncmp(GetInitialFW(), "3.95", 4))
ret_mobo = "TA-088v1/v2";
ret_mobo = detmobo[i].mobo_name;
}
return ret_mobo;
}
char *GetUMDFWText()
{
_sceUmdExecInquiryCmd(_sceUmdManGetUmdDrive(0), param, buf);
memset(outtxt, 0, sizeof(outtxt));
memcpy(&ai, buf, sizeof(ATAPI_INQURIY));
strncpy(outtxt, ai.sony_spec, 5);
return outtxt;
}
char *GetMacAddressText()
{
u8 macaddr[512];
GetMACAddress(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 *models[] = { "PSP Fat", "PSP Slim", "PSP Brite", "PSP Brite", "PSPgo", "-", "PSP Brite", "-", "PSP Brite", "-", "PSP Street" };
return models[psp_model];
}