rlm@1
|
1 // RomInfo.cpp : implementation file
|
rlm@1
|
2 //
|
rlm@1
|
3
|
rlm@1
|
4 #include "stdafx.h"
|
rlm@1
|
5 #include "resource.h"
|
rlm@1
|
6 #include "RomInfo.h"
|
rlm@1
|
7 #include "WinResUtil.h"
|
rlm@1
|
8
|
rlm@1
|
9 extern int32 gbRomSize;
|
rlm@1
|
10
|
rlm@1
|
11 struct WinGBACompanyName
|
rlm@1
|
12 {
|
rlm@1
|
13 LPCTSTR code;
|
rlm@1
|
14 LPCTSTR name;
|
rlm@1
|
15 };
|
rlm@1
|
16
|
rlm@1
|
17 static WinGBACompanyName winGBARomInfoCompanies[] = {
|
rlm@1
|
18 { "01", "Nintendo" },
|
rlm@1
|
19 { "02", "Rocket Games" },
|
rlm@1
|
20 { "08", "Capcom" },
|
rlm@1
|
21 { "09", "Hot B Co." },
|
rlm@1
|
22 { "0A", "Jaleco" },
|
rlm@1
|
23 { "0B", "Coconuts Japan" },
|
rlm@1
|
24 { "0C", "Coconuts Japan/G.X.Media" },
|
rlm@1
|
25 { "0H", "Starfish" },
|
rlm@1
|
26 { "0L", "Warashi Inc." },
|
rlm@1
|
27 { "0N", "Nowpro" },
|
rlm@1
|
28 { "0P", "Game Village" },
|
rlm@1
|
29 { "13", "Electronic Arts Japan" },
|
rlm@1
|
30 { "18", "Hudson Soft Japan" },
|
rlm@1
|
31 { "19", "S.C.P." },
|
rlm@1
|
32 { "1A", "Yonoman" },
|
rlm@1
|
33 { "1G", "SMDE" },
|
rlm@1
|
34 { "1P", "Creatures Inc." },
|
rlm@1
|
35 { "1Q", "TDK Deep Impresion" },
|
rlm@1
|
36 { "20", "Destination Software" },
|
rlm@1
|
37 { "22", "VR 1 Japan" },
|
rlm@1
|
38 { "25", "San-X" },
|
rlm@1
|
39 { "28", "Kemco Japan" },
|
rlm@1
|
40 { "29", "Seta" },
|
rlm@1
|
41 { "2H", "Ubisoft Japan" },
|
rlm@1
|
42 { "2K", "NEC InterChannel" },
|
rlm@1
|
43 { "2L", "Tam" },
|
rlm@1
|
44 { "2M", "Jordan" },
|
rlm@1
|
45 { "2N", "Smilesoft" },
|
rlm@1
|
46 { "2Q", "Mediakite" },
|
rlm@1
|
47 { "36", "Codemasters" },
|
rlm@1
|
48 { "37", "GAGA Communications" },
|
rlm@1
|
49 { "38", "Laguna" },
|
rlm@1
|
50 { "39", "Telstar Fun and Games" },
|
rlm@1
|
51 { "41", "Ubi Soft Entertainment" },
|
rlm@1
|
52 { "42", "Sunsoft" },
|
rlm@1
|
53 { "47", "Spectrum Holobyte" },
|
rlm@1
|
54 { "49", "IREM" },
|
rlm@1
|
55 { "4D", "Malibu Games" },
|
rlm@1
|
56 { "4F", "Eidos/U.S. Gold" },
|
rlm@1
|
57 { "4J", "Fox Interactive" },
|
rlm@1
|
58 { "4K", "Time Warner Interactive" },
|
rlm@1
|
59 { "4Q", "Disney" },
|
rlm@1
|
60 { "4S", "Black Pearl" },
|
rlm@1
|
61 { "4X", "GT Interactive" },
|
rlm@1
|
62 { "4Y", "RARE" },
|
rlm@1
|
63 { "4Z", "Crave Entertainment" },
|
rlm@1
|
64 { "50", "Absolute Entertainment" },
|
rlm@1
|
65 { "51", "Acclaim" },
|
rlm@1
|
66 { "52", "Activision" },
|
rlm@1
|
67 { "53", "American Sammy Corp." },
|
rlm@1
|
68 { "54", "Take 2 Interactive" },
|
rlm@1
|
69 { "55", "Hi Tech" },
|
rlm@1
|
70 { "56", "LJN LTD." },
|
rlm@1
|
71 { "58", "Mattel" },
|
rlm@1
|
72 { "5A", "Mindscape/Red Orb Ent." },
|
rlm@1
|
73 { "5C", "Taxan" },
|
rlm@1
|
74 { "5D", "Midway" },
|
rlm@1
|
75 { "5F", "American Softworks" },
|
rlm@1
|
76 { "5G", "Majesco Sales Inc" },
|
rlm@1
|
77 { "5H", "3DO" },
|
rlm@1
|
78 { "5K", "Hasbro" },
|
rlm@1
|
79 { "5L", "NewKidCo" },
|
rlm@1
|
80 { "5M", "Telegames" },
|
rlm@1
|
81 { "5N", "Metro3D" },
|
rlm@1
|
82 { "5P", "Vatical Entertainment" },
|
rlm@1
|
83 { "5Q", "LEGO Media" },
|
rlm@1
|
84 { "5S", "Xicat Interactive" },
|
rlm@1
|
85 { "5T", "Cryo Interactive" },
|
rlm@1
|
86 { "5W", "Red Storm Ent./BKN Ent." },
|
rlm@1
|
87 { "5X", "Microids" },
|
rlm@1
|
88 { "5Z", "Conspiracy Entertainment Corp." },
|
rlm@1
|
89 { "60", "Titus Interactive Studios" },
|
rlm@1
|
90 { "61", "Virgin Interactive" },
|
rlm@1
|
91 { "62", "Maxis" },
|
rlm@1
|
92 { "64", "LucasArts Entertainment" },
|
rlm@1
|
93 { "67", "Ocean" },
|
rlm@1
|
94 { "69", "Electronic Arts" },
|
rlm@1
|
95 { "6E", "Elite Systems Ltd." },
|
rlm@1
|
96 { "6F", "Electro Brain" },
|
rlm@1
|
97 { "6G", "The Learning Company" },
|
rlm@1
|
98 { "6H", "BBC" },
|
rlm@1
|
99 { "6J", "Software 2000" },
|
rlm@1
|
100 { "6L", "BAM! Entertainment" },
|
rlm@1
|
101 { "6M", "Studio 3" },
|
rlm@1
|
102 { "6Q", "Classified Games" },
|
rlm@1
|
103 { "6S", "TDK Mediactive" },
|
rlm@1
|
104 { "6U", "DreamCatcher" },
|
rlm@1
|
105 { "6V", "JoWood Productions" },
|
rlm@1
|
106 { "6W", "SEGA" },
|
rlm@1
|
107 { "6X", "Wannado Edition" },
|
rlm@1
|
108 { "6Y", "LSP" },
|
rlm@1
|
109 { "6Z", "ITE Media" },
|
rlm@1
|
110 { "70", "Infogrames" },
|
rlm@1
|
111 { "71", "Interplay" },
|
rlm@1
|
112 { "72", "JVC Musical Industries Inc" },
|
rlm@1
|
113 { "73", "Parker Brothers" },
|
rlm@1
|
114 { "75", "SCI" },
|
rlm@1
|
115 { "78", "THQ" },
|
rlm@1
|
116 { "79", "Accolade" },
|
rlm@1
|
117 { "7A", "Triffix Ent. Inc." },
|
rlm@1
|
118 { "7C", "Microprose Software" },
|
rlm@1
|
119 { "7D", "Universal Interactive Studios" },
|
rlm@1
|
120 { "7F", "Kemco" },
|
rlm@1
|
121 { "7G", "Rage Software" },
|
rlm@1
|
122 { "7H", "Encore" },
|
rlm@1
|
123 { "7J", "Zoo" },
|
rlm@1
|
124 { "7K", "BVM" },
|
rlm@1
|
125 { "7L", "Simon & Schuster Interactive" },
|
rlm@1
|
126 { "7M", "Asmik Ace Entertainment Inc./AIA" },
|
rlm@1
|
127 { "7N", "Empire Interactive" },
|
rlm@1
|
128 { "7Q", "Jester Interactive" },
|
rlm@1
|
129 { "7T", "Scholastic" },
|
rlm@1
|
130 { "7U", "Ignition Entertainment" },
|
rlm@1
|
131 { "7W", "Stadlbauer" },
|
rlm@1
|
132 { "80", "Misawa" },
|
rlm@1
|
133 { "83", "LOZC" },
|
rlm@1
|
134 { "8B", "Bulletproof Software" },
|
rlm@1
|
135 { "8C", "Vic Tokai Inc." },
|
rlm@1
|
136 { "8J", "General Entertainment" },
|
rlm@1
|
137 { "8N", "Success" },
|
rlm@1
|
138 { "8P", "SEGA Japan" },
|
rlm@1
|
139 { "91", "Chun Soft" },
|
rlm@1
|
140 { "92", "Video System" },
|
rlm@1
|
141 { "93", "BEC" },
|
rlm@1
|
142 { "96", "Yonezawa/S'pal" },
|
rlm@1
|
143 { "97", "Kaneko" },
|
rlm@1
|
144 { "99", "Victor Interactive Software" },
|
rlm@1
|
145 { "9A", "Nichibutsu/Nihon Bussan" },
|
rlm@1
|
146 { "9B", "Tecmo" },
|
rlm@1
|
147 { "9C", "Imagineer" },
|
rlm@1
|
148 { "9F", "Nova" },
|
rlm@1
|
149 { "9H", "Bottom Up" },
|
rlm@1
|
150 { "9L", "Hasbro Japan" },
|
rlm@1
|
151 { "9N", "Marvelous Entertainment" },
|
rlm@1
|
152 { "9P", "Keynet Inc." },
|
rlm@1
|
153 { "9Q", "Hands-On Entertainment" },
|
rlm@1
|
154 { "A0", "Telenet" },
|
rlm@1
|
155 { "A1", "Hori" },
|
rlm@1
|
156 { "A4", "Konami" },
|
rlm@1
|
157 { "A6", "Kawada" },
|
rlm@1
|
158 { "A7", "Takara" },
|
rlm@1
|
159 { "A9", "Technos Japan Corp." },
|
rlm@1
|
160 { "AA", "JVC" },
|
rlm@1
|
161 { "AC", "Toei Animation" },
|
rlm@1
|
162 { "AD", "Toho" },
|
rlm@1
|
163 { "AF", "Namco" },
|
rlm@1
|
164 { "AG", "Media Rings Corporation" },
|
rlm@1
|
165 { "AH", "J-Wing" },
|
rlm@1
|
166 { "AK", "KID" },
|
rlm@1
|
167 { "AL", "MediaFactory" },
|
rlm@1
|
168 { "AP", "Infogrames Hudson" },
|
rlm@1
|
169 { "AQ", "Kiratto. Ludic Inc" },
|
rlm@1
|
170 { "B0", "Acclaim Japan" },
|
rlm@1
|
171 { "B1", "ASCII" },
|
rlm@1
|
172 { "B2", "Bandai" },
|
rlm@1
|
173 { "B4", "Enix" },
|
rlm@1
|
174 { "B6", "HAL Laboratory" },
|
rlm@1
|
175 { "B7", "SNK" },
|
rlm@1
|
176 { "B9", "Pony Canyon Hanbai" },
|
rlm@1
|
177 { "BA", "Culture Brain" },
|
rlm@1
|
178 { "BB", "Sunsoft" },
|
rlm@1
|
179 { "BD", "Sony Imagesoft" },
|
rlm@1
|
180 { "BF", "Sammy" },
|
rlm@1
|
181 { "BG", "Magical" },
|
rlm@1
|
182 { "BJ", "Compile" },
|
rlm@1
|
183 { "BL", "MTO Inc." },
|
rlm@1
|
184 { "BN", "Sunrise Interactive" },
|
rlm@1
|
185 { "BP", "Global A Entertainment" },
|
rlm@1
|
186 { "BQ", "Fuuki" },
|
rlm@1
|
187 { "C0", "Taito" },
|
rlm@1
|
188 { "C2", "Kemco" },
|
rlm@1
|
189 { "C3", "Square Soft" },
|
rlm@1
|
190 { "C5", "Data East" },
|
rlm@1
|
191 { "C6", "Tonkin House" },
|
rlm@1
|
192 { "C8", "Koei" },
|
rlm@1
|
193 { "CA", "Konami/Palcom/Ultra" },
|
rlm@1
|
194 { "CB", "Vapinc/NTVIC" },
|
rlm@1
|
195 { "CC", "Use Co.,Ltd." },
|
rlm@1
|
196 { "CD", "Meldac" },
|
rlm@1
|
197 { "CE", "FCI/Pony Canyon" },
|
rlm@1
|
198 { "CF", "Angel" },
|
rlm@1
|
199 { "CM", "Konami Computer Entertainment Osaka" },
|
rlm@1
|
200 { "CP", "Enterbrain" },
|
rlm@1
|
201 { "D1", "Sofel" },
|
rlm@1
|
202 { "D2", "Quest" },
|
rlm@1
|
203 { "D3", "Sigma Enterprises" },
|
rlm@1
|
204 { "D4", "Ask Kodansa" },
|
rlm@1
|
205 { "D6", "Naxat" },
|
rlm@1
|
206 { "D7", "Copya System" },
|
rlm@1
|
207 { "D9", "Banpresto" },
|
rlm@1
|
208 { "DA", "TOMY" },
|
rlm@1
|
209 { "DB", "LJN Japan" },
|
rlm@1
|
210 { "DD", "NCS" },
|
rlm@1
|
211 { "DF", "Altron Corporation" },
|
rlm@1
|
212 { "DH", "Gaps Inc." },
|
rlm@1
|
213 { "DN", "ELF" },
|
rlm@1
|
214 { "E2", "Yutaka" },
|
rlm@1
|
215 { "E3", "Varie" },
|
rlm@1
|
216 { "E5", "Epoch" },
|
rlm@1
|
217 { "E7", "Athena" },
|
rlm@1
|
218 { "E8", "Asmik Ace Entertainment Inc." },
|
rlm@1
|
219 { "E9", "Natsume" },
|
rlm@1
|
220 { "EA", "King Records" },
|
rlm@1
|
221 { "EB", "Atlus" },
|
rlm@1
|
222 { "EC", "Epic/Sony Records" },
|
rlm@1
|
223 { "EE", "IGS" },
|
rlm@1
|
224 { "EL", "Spike" },
|
rlm@1
|
225 { "EM", "Konami Computer Entertainment Tokyo" },
|
rlm@1
|
226 { "EN", "Alphadream Corporation" },
|
rlm@1
|
227 { "F0", "A Wave" },
|
rlm@1
|
228 { "G1", "PCCW" },
|
rlm@1
|
229 { "G4", "KiKi Co Ltd" },
|
rlm@1
|
230 { "G5", "Open Sesame Inc." },
|
rlm@1
|
231 { "G6", "Sims" },
|
rlm@1
|
232 { "G7", "Broccoli" },
|
rlm@1
|
233 { "G8", "Avex" },
|
rlm@1
|
234 { "G9", "D3 Publisher" },
|
rlm@1
|
235 { "GB", "Konami Computer Entertainment Japan" },
|
rlm@1
|
236 { "GD", "Square-Enix" },
|
rlm@1
|
237 { "HY", "Sachen" },
|
rlm@1
|
238 { NULL, NULL }
|
rlm@1
|
239 };
|
rlm@1
|
240
|
rlm@1
|
241 static LPCTSTR winGBARomInfoFindMakerCode(LPCTSTR code)
|
rlm@1
|
242 {
|
rlm@1
|
243 int i = 0;
|
rlm@1
|
244 while (winGBARomInfoCompanies[i].code)
|
rlm@1
|
245 {
|
rlm@1
|
246 if (!strcmp(winGBARomInfoCompanies[i].code, code))
|
rlm@1
|
247 return winGBARomInfoCompanies[i].name;
|
rlm@1
|
248 i++;
|
rlm@1
|
249 }
|
rlm@1
|
250 return (LPCTSTR)winResLoadString(IDS_UNKNOWN);
|
rlm@1
|
251 }
|
rlm@1
|
252
|
rlm@1
|
253 /////////////////////////////////////////////////////////////////////////////
|
rlm@1
|
254 // RomInfoGB dialog
|
rlm@1
|
255
|
rlm@1
|
256 RomInfoGB::RomInfoGB(u8 *rom, CWnd *pParent /*=NULL*/)
|
rlm@1
|
257 : CDialog(RomInfoGB::IDD, pParent)
|
rlm@1
|
258 {
|
rlm@1
|
259 //{{AFX_DATA_INIT(RomInfoGB)
|
rlm@1
|
260 // NOTE: the ClassWizard will add member initialization here
|
rlm@1
|
261 //}}AFX_DATA_INIT
|
rlm@1
|
262 this->rom = rom;
|
rlm@1
|
263 }
|
rlm@1
|
264
|
rlm@1
|
265 void RomInfoGB::DoDataExchange(CDataExchange *pDX)
|
rlm@1
|
266 {
|
rlm@1
|
267 CDialog::DoDataExchange(pDX);
|
rlm@1
|
268 //{{AFX_DATA_MAP(RomInfoGB)
|
rlm@1
|
269 // NOTE: the ClassWizard will add DDX and DDV calls here
|
rlm@1
|
270 //}}AFX_DATA_MAP
|
rlm@1
|
271 }
|
rlm@1
|
272
|
rlm@1
|
273 BEGIN_MESSAGE_MAP(RomInfoGB, CDialog)
|
rlm@1
|
274 //{{AFX_MSG_MAP(RomInfoGB)
|
rlm@1
|
275 ON_BN_CLICKED(ID_OK, OnOk)
|
rlm@1
|
276 //}}AFX_MSG_MAP
|
rlm@1
|
277 END_MESSAGE_MAP()
|
rlm@1
|
278
|
rlm@1
|
279 /////////////////////////////////////////////////////////////////////////////
|
rlm@1
|
280 // RomInfoGB message handlers
|
rlm@1
|
281
|
rlm@1
|
282 void RomInfoGB::OnOk()
|
rlm@1
|
283 {
|
rlm@1
|
284 EndDialog(TRUE);
|
rlm@1
|
285 }
|
rlm@1
|
286
|
rlm@1
|
287 BOOL RomInfoGB::OnInitDialog()
|
rlm@1
|
288 {
|
rlm@1
|
289 CDialog::OnInitDialog();
|
rlm@1
|
290
|
rlm@1
|
291 char buffer[128];
|
rlm@1
|
292
|
rlm@1
|
293 strncpy(buffer, (const char *)&rom[0x134], 15);
|
rlm@1
|
294 buffer[15] = 0;
|
rlm@1
|
295 GetDlgItem(IDC_ROM_TITLE)->SetWindowText(buffer);
|
rlm@1
|
296
|
rlm@1
|
297 sprintf(buffer, "%02x", rom[0x143]);
|
rlm@1
|
298 GetDlgItem(IDC_ROM_COLOR)->SetWindowText(buffer);
|
rlm@1
|
299
|
rlm@1
|
300 strncpy(buffer, (const char *)&rom[0x144], 2);
|
rlm@1
|
301 buffer[2] = 0;
|
rlm@1
|
302 GetDlgItem(IDC_ROM_MAKER_CODE)->SetWindowText(buffer);
|
rlm@1
|
303
|
rlm@1
|
304 if (rom[0x14b] != 0x33)
|
rlm@1
|
305 {
|
rlm@1
|
306 sprintf(buffer, "%02X", rom[0x14b]);
|
rlm@1
|
307 GetDlgItem(IDC_ROM_MAKER_CODE)->SetWindowText(buffer);
|
rlm@1
|
308 }
|
rlm@1
|
309 GetDlgItem(IDC_ROM_MAKER_NAME2)->SetWindowText(winGBARomInfoFindMakerCode(buffer));
|
rlm@1
|
310
|
rlm@1
|
311 sprintf(buffer, "%02x", rom[0x146]);
|
rlm@1
|
312 GetDlgItem(IDC_ROM_UNIT_CODE)->SetWindowText(buffer);
|
rlm@1
|
313
|
rlm@1
|
314 CString type = winResLoadString(IDS_UNKNOWN);
|
rlm@1
|
315 switch (rom[0x147])
|
rlm@1
|
316 {
|
rlm@1
|
317 case 0x00:
|
rlm@1
|
318 type = "ROM";
|
rlm@1
|
319 break;
|
rlm@1
|
320 case 0x01:
|
rlm@1
|
321 type = "ROM+MBC1";
|
rlm@1
|
322 break;
|
rlm@1
|
323 case 0x02:
|
rlm@1
|
324 type = "ROM+MBC1+RAM";
|
rlm@1
|
325 break;
|
rlm@1
|
326 case 0x03:
|
rlm@1
|
327 type = "ROM+MBC1+RAM+BATT";
|
rlm@1
|
328 break;
|
rlm@1
|
329 case 0x05:
|
rlm@1
|
330 type = "ROM+MBC2";
|
rlm@1
|
331 break;
|
rlm@1
|
332 case 0x06:
|
rlm@1
|
333 type = "ROM+MBC2+BATT";
|
rlm@1
|
334 break;
|
rlm@1
|
335 case 0x0f:
|
rlm@1
|
336 type = "ROM+MBC3+TIMER+BATT";
|
rlm@1
|
337 break;
|
rlm@1
|
338 case 0x10:
|
rlm@1
|
339 type = "ROM+MBC3+TIMER+RAM+BATT";
|
rlm@1
|
340 break;
|
rlm@1
|
341 case 0x11:
|
rlm@1
|
342 type = "ROM+MBC3";
|
rlm@1
|
343 break;
|
rlm@1
|
344 case 0x12:
|
rlm@1
|
345 type = "ROM+MBC3+RAM";
|
rlm@1
|
346 break;
|
rlm@1
|
347 case 0x13:
|
rlm@1
|
348 type = "ROM+MBC3+RAM+BATT";
|
rlm@1
|
349 break;
|
rlm@1
|
350 case 0x19:
|
rlm@1
|
351 type = "ROM+MBC5";
|
rlm@1
|
352 break;
|
rlm@1
|
353 case 0x1a:
|
rlm@1
|
354 type = "ROM+MBC5+RAM";
|
rlm@1
|
355 break;
|
rlm@1
|
356 case 0x1b:
|
rlm@1
|
357 type = "ROM+MBC5+RAM+BATT";
|
rlm@1
|
358 break;
|
rlm@1
|
359 case 0x1c:
|
rlm@1
|
360 type = "ROM+MBC5+RUMBLE";
|
rlm@1
|
361 break;
|
rlm@1
|
362 case 0x1d:
|
rlm@1
|
363 type = "ROM+MBC5+RUMBLE+RAM";
|
rlm@1
|
364 break;
|
rlm@1
|
365 case 0x1e:
|
rlm@1
|
366 type = "ROM+MBC5+RUMBLE+RAM+BATT";
|
rlm@1
|
367 break;
|
rlm@1
|
368 case 0x22:
|
rlm@1
|
369 type = "ROM+MBC7+BATT";
|
rlm@1
|
370 break;
|
rlm@1
|
371 case 0xfe:
|
rlm@1
|
372 type = "ROM+HuC-3";
|
rlm@1
|
373 break;
|
rlm@1
|
374 case 0xff:
|
rlm@1
|
375 type = "ROM+HuC-1";
|
rlm@1
|
376 break;
|
rlm@1
|
377 }
|
rlm@1
|
378 sprintf(buffer, "%02x (%s)", rom[0x147], (const char *)type);
|
rlm@1
|
379 GetDlgItem(IDC_ROM_DEVICE_TYPE)->SetWindowText(buffer);
|
rlm@1
|
380
|
rlm@1
|
381 type = winResLoadString(IDS_UNKNOWN);
|
rlm@1
|
382 switch (rom[0x148])
|
rlm@1
|
383 {
|
rlm@1
|
384 case 0:
|
rlm@1
|
385 type = "32K";
|
rlm@1
|
386 break;
|
rlm@1
|
387 case 1:
|
rlm@1
|
388 type = "64K";
|
rlm@1
|
389 break;
|
rlm@1
|
390 case 2:
|
rlm@1
|
391 type = "128K";
|
rlm@1
|
392 break;
|
rlm@1
|
393 case 3:
|
rlm@1
|
394 type = "256K";
|
rlm@1
|
395 break;
|
rlm@1
|
396 case 4:
|
rlm@1
|
397 type = "512K";
|
rlm@1
|
398 break;
|
rlm@1
|
399 case 5:
|
rlm@1
|
400 type = "1M";
|
rlm@1
|
401 break;
|
rlm@1
|
402 case 6:
|
rlm@1
|
403 type = "2M";
|
rlm@1
|
404 break;
|
rlm@1
|
405 case 7:
|
rlm@1
|
406 type = "4M";
|
rlm@1
|
407 break;
|
rlm@1
|
408 }
|
rlm@1
|
409
|
rlm@1
|
410 sprintf(buffer, "%02x (%s)", rom[0x148], (const char *)type);
|
rlm@1
|
411 GetDlgItem(IDC_ROM_SIZE)->SetWindowText(buffer);
|
rlm@1
|
412
|
rlm@1
|
413 type = winResLoadString(IDS_UNKNOWN);
|
rlm@1
|
414 switch (rom[0x149])
|
rlm@1
|
415 {
|
rlm@1
|
416 case 0:
|
rlm@1
|
417 type = winResLoadString(IDS_NONE);
|
rlm@1
|
418 break;
|
rlm@1
|
419 case 1:
|
rlm@1
|
420 type = "2K";
|
rlm@1
|
421 break;
|
rlm@1
|
422 case 2:
|
rlm@1
|
423 type = "8K";
|
rlm@1
|
424 break;
|
rlm@1
|
425 case 3:
|
rlm@1
|
426 type = "32K";
|
rlm@1
|
427 break;
|
rlm@1
|
428 case 4:
|
rlm@1
|
429 type = "128K";
|
rlm@1
|
430 break;
|
rlm@1
|
431 case 5:
|
rlm@1
|
432 type = "64K";
|
rlm@1
|
433 break;
|
rlm@1
|
434 }
|
rlm@1
|
435
|
rlm@1
|
436 sprintf(buffer, "%02x (%s)", rom[0x149], (const char *)type);
|
rlm@1
|
437 GetDlgItem(IDC_ROM_RAM_SIZE)->SetWindowText(buffer);
|
rlm@1
|
438
|
rlm@1
|
439 sprintf(buffer, "%02x", rom[0x14a]);
|
rlm@1
|
440 GetDlgItem(IDC_ROM_DEST_CODE)->SetWindowText(buffer);
|
rlm@1
|
441
|
rlm@1
|
442 sprintf(buffer, "%02x", rom[0x14b]);
|
rlm@1
|
443 GetDlgItem(IDC_ROM_LIC_CODE)->SetWindowText(buffer);
|
rlm@1
|
444
|
rlm@1
|
445 sprintf(buffer, "%02x", rom[0x14c]);
|
rlm@1
|
446 GetDlgItem(IDC_ROM_VERSION)->SetWindowText(buffer);
|
rlm@1
|
447
|
rlm@1
|
448 u8 crc8 = 25;
|
rlm@1
|
449 int i;
|
rlm@1
|
450 for (i = 0x134; i < 0x14d; i++)
|
rlm@1
|
451 {
|
rlm@1
|
452 crc8 = (crc8 + rom[i]) & 0xFF;
|
rlm@1
|
453 }
|
rlm@1
|
454
|
rlm@1
|
455 crc8 = 256 - crc8;
|
rlm@1
|
456
|
rlm@1
|
457 sprintf(buffer, "%02x (%02x)", crc8, rom[0x14d]);
|
rlm@1
|
458 GetDlgItem(IDC_ROM_CRC)->SetWindowText(buffer);
|
rlm@1
|
459
|
rlm@1
|
460 u16 crc16 = 0;
|
rlm@1
|
461 for (i = 0; i < gbRomSize; i++)
|
rlm@1
|
462 {
|
rlm@1
|
463 crc16 = (crc16 + rom[i]) & 0xFFFF;
|
rlm@1
|
464 }
|
rlm@1
|
465
|
rlm@1
|
466 crc16 -= rom[0x14e];
|
rlm@1
|
467 crc16 -= rom[0x14f];
|
rlm@1
|
468 sprintf(buffer, "%04x (%04x)", crc16, (rom[0x14e] << 8) | rom[0x14f]);
|
rlm@1
|
469 GetDlgItem(IDC_ROM_CHECKSUM)->SetWindowText(buffer);
|
rlm@1
|
470
|
rlm@1
|
471 CenterWindow();
|
rlm@1
|
472
|
rlm@1
|
473 return TRUE; // return TRUE unless you set the focus to a control
|
rlm@1
|
474 // EXCEPTION: OCX Property Pages should return FALSE
|
rlm@1
|
475 }
|
rlm@1
|
476
|
rlm@1
|
477 /////////////////////////////////////////////////////////////////////////////
|
rlm@1
|
478 // RomInfoGBA dialog
|
rlm@1
|
479
|
rlm@1
|
480 RomInfoGBA::RomInfoGBA(u8 *rom, CWnd *pParent /*=NULL*/)
|
rlm@1
|
481 : CDialog(RomInfoGBA::IDD, pParent)
|
rlm@1
|
482 {
|
rlm@1
|
483 //{{AFX_DATA_INIT(RomInfoGBA)
|
rlm@1
|
484 // NOTE: the ClassWizard will add member initialization here
|
rlm@1
|
485 //}}AFX_DATA_INIT
|
rlm@1
|
486 this->rom = rom;
|
rlm@1
|
487 }
|
rlm@1
|
488
|
rlm@1
|
489 void RomInfoGBA::DoDataExchange(CDataExchange *pDX)
|
rlm@1
|
490 {
|
rlm@1
|
491 CDialog::DoDataExchange(pDX);
|
rlm@1
|
492 //{{AFX_DATA_MAP(RomInfoGBA)
|
rlm@1
|
493 // NOTE: the ClassWizard will add DDX and DDV calls here
|
rlm@1
|
494 //}}AFX_DATA_MAP
|
rlm@1
|
495 }
|
rlm@1
|
496
|
rlm@1
|
497 BEGIN_MESSAGE_MAP(RomInfoGBA, CDialog)
|
rlm@1
|
498 //{{AFX_MSG_MAP(RomInfoGBA)
|
rlm@1
|
499 ON_BN_CLICKED(ID_OK, OnOk)
|
rlm@1
|
500 //}}AFX_MSG_MAP
|
rlm@1
|
501 END_MESSAGE_MAP()
|
rlm@1
|
502
|
rlm@1
|
503 /////////////////////////////////////////////////////////////////////////////
|
rlm@1
|
504 // RomInfoGBA message handlers
|
rlm@1
|
505
|
rlm@1
|
506 void RomInfoGBA::OnOk()
|
rlm@1
|
507 {
|
rlm@1
|
508 EndDialog(TRUE);
|
rlm@1
|
509 }
|
rlm@1
|
510
|
rlm@1
|
511 BOOL RomInfoGBA::OnInitDialog()
|
rlm@1
|
512 {
|
rlm@1
|
513 CDialog::OnInitDialog();
|
rlm@1
|
514
|
rlm@1
|
515 char buffer[13];
|
rlm@1
|
516
|
rlm@1
|
517 strncpy(buffer, (const char *)&rom[0xa0], 12);
|
rlm@1
|
518 buffer[12] = 0;
|
rlm@1
|
519 GetDlgItem(IDC_ROM_TITLE)->SetWindowText(buffer);
|
rlm@1
|
520
|
rlm@1
|
521 strncpy(buffer, (const char *)&rom[0xac], 4);
|
rlm@1
|
522 buffer[4] = 0;
|
rlm@1
|
523 GetDlgItem(IDC_ROM_GAME_CODE)->SetWindowText(buffer);
|
rlm@1
|
524
|
rlm@1
|
525 strncpy(buffer, (const char *)&rom[0xb0], 2);
|
rlm@1
|
526 buffer[2] = 0;
|
rlm@1
|
527 GetDlgItem(IDC_ROM_MAKER_CODE)->SetWindowText(buffer);
|
rlm@1
|
528
|
rlm@1
|
529 GetDlgItem(IDC_ROM_MAKER_NAME)->SetWindowText(winGBARomInfoFindMakerCode(buffer));
|
rlm@1
|
530
|
rlm@1
|
531 sprintf(buffer, "%02x", rom[0xb3]);
|
rlm@1
|
532 GetDlgItem(IDC_ROM_UNIT_CODE)->SetWindowText(buffer);
|
rlm@1
|
533
|
rlm@1
|
534 sprintf(buffer, "%02x", rom[0xb4]);
|
rlm@1
|
535 GetDlgItem(IDC_ROM_DEVICE_TYPE)->SetWindowText(buffer);
|
rlm@1
|
536
|
rlm@1
|
537 sprintf(buffer, "%02x", rom[0xbc]);
|
rlm@1
|
538 GetDlgItem(IDC_ROM_VERSION)->SetWindowText(buffer);
|
rlm@1
|
539
|
rlm@1
|
540 u8 crc = 0x19;
|
rlm@1
|
541 for (int i = 0xa0; i < 0xbd; i++)
|
rlm@1
|
542 {
|
rlm@1
|
543 crc = (crc + rom[i]) & 0xff;
|
rlm@1
|
544 }
|
rlm@1
|
545
|
rlm@1
|
546 crc = (-crc) & 0xff;
|
rlm@1
|
547
|
rlm@1
|
548 sprintf(buffer, "%02x (%02x)", crc, rom[0xbd]);
|
rlm@1
|
549 GetDlgItem(IDC_ROM_CRC)->SetWindowText(buffer);
|
rlm@1
|
550 CenterWindow();
|
rlm@1
|
551
|
rlm@1
|
552 return TRUE; // return TRUE unless you set the focus to a control
|
rlm@1
|
553 // EXCEPTION: OCX Property Pages should return FALSE
|
rlm@1
|
554 }
|
rlm@1
|
555
|