-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathbuild_games_list.js
209 lines (172 loc) · 5.17 KB
/
build_games_list.js
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
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
const fs = require('fs');
// Data from https://kinnay.github.io/view.html?page=wiiu
const nex = fs.readFileSync('nex/nex.txt').toString();
const nexRanking = fs.readFileSync('nex/nex_ranking.txt').toString();
const nexDataStore = fs.readFileSync('nex/nex_datastore.txt').toString();
const nexMatchMaking = fs.readFileSync('nex/nex_match_making.txt').toString();
const nexMessaging = fs.readFileSync('nex/nex_messaging.txt').toString();
const nexUtility = fs.readFileSync('nex/nex_utility.txt').toString();
const access = fs.readFileSync('./access.txt').toString();
const titleids = fs.readFileSync('./titleids.txt').toString();
const nexLines = nex.split('\n');
const nexRankingLines = nexRanking.split('\n');
const nexDataStoreLines = nexDataStore.split('\n');
const nexMatchMakingLines = nexMatchMaking.split('\n');
const nexMessagingLines = nexMessaging.split('\n');
const nexUtilityLines = nexUtility.split('\n');
const accessLines = access.split('\n');
const titleIdLines = titleids.split('\n');
// * Start the list with the Friends server
// * This is because the Smash 4 access key
// * also works for the friends server
const titles = [
{
name: 'Friends',
access_key: 'ridfebb9',
nex_version: '1.0.0',
title_ids: [
'0004013000003202',
'000500301001500A',
'000500301001510A',
'000500301001520A'
]
}
];
// Fill in title NEX details
for (const line of nexLines) {
// Discard empty lines
if (!line) continue;
const [name, nexVersion] = line.split('|');
const [major, minor, patch] = nexVersion.trim().split('.');
titles.push({
name: name.trim(),
access_key: '',
nex_version: `${major}.${minor}.${patch}`
});
}
// Fill in title NEX additional Ranking versions
for (const line of nexRankingLines) {
// Discard empty lines
if (!line) continue;
const [name, nexVersion] = line.split('|');
const [major, minor, patch] = nexVersion.trim().split('.');
const game = titles.find(game => game.name === name.trim());
if (game) {
game.nex_ranking_version = `${major}.${minor}.${patch}`;
} else {
titles.push({
name: name.trim(),
access_key: '',
nex_version: '0.0.0',
nex_ranking_version: `${major}.${minor}.${patch}`
});
}
}
// Fill in title NEX additional DataStore versions
for (const line of nexDataStoreLines) {
// Discard empty lines
if (!line) continue;
const [name, nexVersion] = line.split('|');
const [major, minor, patch] = nexVersion.trim().split('.');
const game = titles.find(game => game.name === name.trim());
if (game) {
game.nex_datastore_version = `${major}.${minor}.${patch}`;
} else {
titles.push({
name: name.trim(),
access_key: '',
nex_version: '0.0.0',
nex_datastore_version: `${major}.${minor}.${patch}`
});
}
}
// Fill in title NEX additional Matchmaking versions
for (const line of nexMatchMakingLines) {
// Discard empty lines
if (!line) continue;
const [name, nexVersion] = line.split('|');
const [major, minor, patch] = nexVersion.trim().split('.');
const game = titles.find(game => game.name === name.trim());
if (game) {
game.nex_match_making_version = `${major}.${minor}.${patch}`;
} else {
titles.push({
name: name.trim(),
access_key: '',
nex_version: '0.0.0',
nex_match_making_version: `${major}.${minor}.${patch}`
});
}
}
// Fill in title NEX additional Messaging versions
for (const line of nexMessagingLines) {
// Discard empty lines
if (!line) continue;
const [name, nexVersion] = line.split('|');
const [major, minor, patch] = nexVersion.trim().split('.');
const game = titles.find(game => game.name === name.trim());
if (game) {
game.nex_messaging_version = `${major}.${minor}.${patch}`;
} else {
titles.push({
name: name.trim(),
access_key: '',
nex_version: '0.0.0',
nex_messaging_version: `${major}.${minor}.${patch}`
});
}
}
// Fill in title NEX additional Utility versions
for (const line of nexUtilityLines) {
// Discard empty lines
if (!line) continue;
const [name, nexVersion] = line.split('|');
const [major, minor, patch] = nexVersion.trim().split('.');
const game = titles.find(game => game.name === name.trim());
if (game) {
game.nex_utility_version = `${major}.${minor}.${patch}`;
} else {
titles.push({
name: name.trim(),
access_key: '',
nex_version: '0.0.0',
nex_utility_version: `${major}.${minor}.${patch}`
});
}
}
// Match the titles access key
for (const line of accessLines) {
// Discard empty lines
if (!line) continue;
const [name, accessKey] = line.split('|');
const game = titles.find(game => game.name === name.trim());
if (game) {
game.access_key = accessKey.trim();
} else {
titles.push({
name: name.trim(),
access_key: accessKey.trim(),
nex_version: '0.0.0'
});
}
}
// Match the title ids
for (const line of titleIdLines) {
// Discard empty lines
if (!line) continue;
const [name, titleIdData] = line.split('|');
const game = titles.find(game => game.name === name.trim());
const titleIdList = titleIdData.trim().split(', ');
if (game) {
game.title_ids = titleIdList;
} else {
titles.push({
name: name.trim(),
access_key: '',
title_ids: titleIdList,
nex_version: '0.0.0'
});
}
}
fs.writeFileSync('./src/titles.json', JSON.stringify(titles, null, 4));
console.log('Title data built');