-
-
Notifications
You must be signed in to change notification settings - Fork 24
/
gtitles.go
136 lines (127 loc) · 2.79 KB
/
gtitles.go
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
package wiiudownloader
const (
MCP_REGION_JAPAN = 0x01
MCP_REGION_USA = 0x02
MCP_REGION_EUROPE = 0x04
MCP_REGION_CHINA = 0x10
MCP_REGION_KOREA = 0x20
MCP_REGION_TAIWAN = 0x40
)
const (
TITLE_KEY_mypass = iota
TITLE_KEY_nintendo
TITLE_KEY_test
TITLE_KEY_1234567890
TITLE_KEY_Lucy131211
TITLE_KEY_fbf10
TITLE_KEY_5678
TITLE_KEY_1234
TITLE_KEY_
TITLE_KEY_MAGIC
)
const (
TITLE_CATEGORY_GAME = iota
TITLE_CATEGORY_UPDATE
TITLE_CATEGORY_DLC
TITLE_CATEGORY_DEMO
TITLE_CATEGORY_ALL
TITLE_CATEGORY_DISC
)
const (
TID_HIGH_GAME = 0x00050000
TID_HIGH_DEMO = 0x00050002
TID_HIGH_SYSTEM_APP = 0x00050010
TID_HIGH_SYSTEM_DATA = 0x0005001B
TID_HIGH_SYSTEM_APPLET = 0x00050030
TID_HIGH_VWII_IOS = 0x00000007
TID_HIGH_VWII_SYSTEM_APP = 0x00070002
TID_HIGH_VWII_SYSTEM = 0x00070008
TID_HIGH_DLC = 0x0005000C
TID_HIGH_UPDATE = 0x0005000E
)
func GetTitleEntries(category uint8) []TitleEntry {
titleEntries := make([]TitleEntry, 0)
for _, entry := range titleEntry {
if category == TITLE_CATEGORY_ALL || category == entry.Category {
if entry.Category == TITLE_CATEGORY_DISC {
continue
}
titleEntries = append(titleEntries, entry)
}
}
return titleEntries
}
func GetFormattedRegion(region uint8) string {
if region&MCP_REGION_EUROPE != 0 {
if region&MCP_REGION_USA != 0 {
if region&MCP_REGION_JAPAN != 0 {
return "All"
}
return "USA/Europe"
}
if region&MCP_REGION_JAPAN != 0 {
return "Europe/Japan"
}
return "Europe"
}
if region&MCP_REGION_USA != 0 {
if region&MCP_REGION_JAPAN != 0 {
return "USA/Japan"
}
return "USA"
}
if region&MCP_REGION_JAPAN != 0 {
return "Japan"
}
return "Unknown"
}
func GetFormattedKind(titleID uint64) string {
switch titleID >> 32 {
case TID_HIGH_GAME:
return "Game"
case TID_HIGH_DEMO:
return "Demo"
case TID_HIGH_SYSTEM_APP:
return "System App"
case TID_HIGH_SYSTEM_DATA:
return "System Data"
case TID_HIGH_SYSTEM_APPLET:
return "System Applet"
case TID_HIGH_VWII_IOS:
return "vWii IOS"
case TID_HIGH_VWII_SYSTEM_APP:
return "vWii System App"
case TID_HIGH_VWII_SYSTEM:
return "vWii System"
case TID_HIGH_DLC:
return "DLC"
case TID_HIGH_UPDATE:
return "Update"
default:
return "Unknown"
}
}
func GetCategoryFromFormattedCategory(formattedCategory string) uint8 {
switch formattedCategory {
case "Game":
return TITLE_CATEGORY_GAME
case "Update":
return TITLE_CATEGORY_UPDATE
case "DLC":
return TITLE_CATEGORY_DLC
case "Demo":
return TITLE_CATEGORY_DEMO
case "All":
return TITLE_CATEGORY_ALL
default:
return TITLE_CATEGORY_ALL
}
}
func GetTitleEntryFromTid(tid uint64) TitleEntry {
for _, entry := range GetTitleEntries(TITLE_CATEGORY_ALL) {
if entry.TitleID == tid {
return entry
}
}
return TitleEntry{}
}