-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathProgram.cs
More file actions
650 lines (547 loc) · 24.6 KB
/
Program.cs
File metadata and controls
650 lines (547 loc) · 24.6 KB
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
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
// Author: Frederic Dupont <themadsiur@gmail.com>
// Copyright 2017 Frederic Dupont
// This file is part of FF6MMGEN.
// FF6MMGEN is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
// FF6MMGEN is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.See the
// GNU General Public License for more details.
// You should have received a copy of the GNU General Public License
// along with FF6MMGEN. If not, see<http://www.gnu.org/licenses/>.
// This class is based on some code provided by Yousei/Flobbster
// FF3Edit
// Version: 12/6/2000
// Available here: http://www.ff6hacking.com/wiki/doku.php?id=ff3:ff3us:util:start#source_code
using FF6MMGEN.Classes;
using System;
namespace FF6MMGEN
{
class Program
{
struct Trigger
{
public int cx;
public int cy;
}
private static readonly int WOB_TILE_PROPERTIES = 0xEE9B14;
private static readonly int WOR_TILE_PROPERTIES = 0xEE9D14;
private static readonly int WOB_MAP_PTR = 0xEEB20F;
private static readonly int WOR_MAP_PTR = 0xEEB224;
private static readonly int WOB_MINI_MAP_PTR = 0xEEB24B;
private static readonly int WOR_MINI_MAP_PTR = 0xEEB24E;
private static readonly int FALCON_GFX_PTR = 0xEEB251;
private static readonly int ENDING_PAL_PTR = 0xEEB254;
private static readonly int MAP_TRIGGERS = 0xDFBB00;
private static readonly int EVENT_TRIGGERS = 0xC40000;
private static readonly int ASM_CODE_A = 0xEE9B0E;
private static readonly int ASM_CODE_B = 0xEEB1F7;
private static readonly int PALETTE_OFF = 0xD2EEA2;
private static readonly string GAMECODE = "C3F6";
private static readonly int XLEFT = 41;
private static readonly int XRIGHT = 49;
private static readonly int YTOP = 42;
private static readonly int YBOTTOM = 56;
private static readonly byte[] asmA = { 0xEA, 0x20, 0xF7, 0xB1, 0x28, 0x60 };
private static readonly byte[] asmB =
{
0x8F, 0xB0, 0xE1, 0x7E,
0x8F, 0xB2, 0xE1, 0x7E,
0x60
};
private static readonly ushort[] palette = { 0x1084, 0x294A, 0x35AD, 0x4E73, 0x7FFF, 0x294A, 0x35AD, 0x4E73, 0x7FFF, 0x5AD6 };
private static byte[] rom;
private static byte[] wobMap;
private static byte[] worMap;
private static byte[] wobMiniMap;
private static byte[] worMiniMap;
private static ushort[] wobTilesProp;
private static ushort[] worTilesProp;
private static Trigger[] wobTriggers;
private static Trigger[] worTriggers;
private static byte[] falconGfx;
private static byte[] endingPal;
private static string path;
private static int xLeft;
private static int xRight;
private static int yTop;
private static int yBottom;
private static OptionSet options;
private static bool help;
static void Main(string[] args)
{
path = string.Empty;
help = false;
xLeft = xRight = yTop = yBottom = -1;
options = new OptionSet() {
{ "?|help=|h=", "Prints out the options.", h => help = h != null },
{ "r=|rom=", "The ROM path.", r => path = r },
{ "x1=", "1st X coord. from left, 0 to 63. Default: " + XLEFT + ".", x1 => xLeft = validatePosition("x1", x1, 0, 63)},
{ "x2=", "2nd X coord. from left, 1 to 64. Default: " + XRIGHT + ".", x2 => xRight = validatePosition("x2", x2, 1, 64)},
{ "y1=", "1st Y coord. from top, 0 to 63. Default: " + YTOP + ".", y1 => yTop = validatePosition("y1", y1, 0, 63)},
{ "y2=", "2nd Y coord. from top, 1 to 64. Default: " + YBOTTOM + ".", y2 => yBottom = validatePosition("y2", y2, 1, 64)},
};
try
{
options.Parse(args);
}
catch (OptionException)
{
ShowHelp("Error - usage is: ");
}
if(help)
{
ShowHelp("ff6mmgen.exe <[-r|-rom] romname.[smc|sfc]> [-x1 value] [-x2 value] [-y1 value] [-y2 value]. Example: 'ff6mmgen.exe -r ff6.smc -x1 41 -x2 49 -y1 42 -y2 56'.");
}
if(path == null || path == string.Empty)
{
ShowHelp("Rom path (-r|-rom romanme.[smc|sfc]) is an mandatory argument.");
}
if (xLeft == -1 || xRight == -1 || yTop == -1 || yBottom == -1)
{
xLeft = XLEFT;
xRight = XRIGHT;
yTop = YTOP;
yBottom = YBOTTOM;
}
else if (xLeft >= xRight)
{
ShowHelp("x1 must be smaller than x2.");
}
else if (yTop >= yBottom)
{
ShowHelp("y1 must be smaller than y2.");
}
Rom rm = new Rom(path);
if (rm.ReadRom())
{
string gameCode = rm.GetGameCode();
if (gameCode != GAMECODE)
{
Console.WriteLine("Invalid Game code at $C0FFB0: " + gameCode + ". Game code value must be " + GAMECODE);
}
else
{
rom = rm.Content;
try
{
// read the data
wobMap = Decompress(WOB_MAP_PTR);
worMap = Decompress(WOR_MAP_PTR);
wobMiniMap = Decompress(WOB_MINI_MAP_PTR);
worMiniMap = Decompress(WOR_MINI_MAP_PTR);
wobTilesProp = ReadTileProperties(WOB_TILE_PROPERTIES);
worTilesProp = ReadTileProperties(WOR_TILE_PROPERTIES);
wobTriggers = ReadMapTriggers(0);
worTriggers = ReadMapTriggers(1);
// Get data that goes after WOB & WOR Mini-Maps
endingPal = ReadBytesFromPointer(ENDING_PAL_PTR, 256);
falconGfx = ReadBytesFromPointer(FALCON_GFX_PTR, Bits.GetShort(rom, GetOffsetFromPointer(FALCON_GFX_PTR)));
// Generate Mini-Maps
byte[] compWob = WriteMiniMap(true);
byte[] compWor = WriteMiniMap(false);
int wobOff = GetOffsetFromPointer(WOB_MINI_MAP_PTR);
int palOff = GetOffsetFromPointer(ENDING_PAL_PTR);
int totalSize = compWob.Length + compWor.Length + falconGfx.Length + endingPal.Length;
int offset = wobOff;
// Write Data
Bits.SetBytes(rm.Content, offset, compWob);
offset += compWob.Length;
Bits.SetBytes(rm.Content, offset, compWor);
int worPtr = AbsToSmc(offset);
offset += compWor.Length;
Bits.SetBytes(rm.Content, offset, falconGfx);
int falconPtr = AbsToSmc(offset);
offset += falconGfx.Length;
Bits.SetBytes(rm.Content, offset, endingPal);
int palPtr = AbsToSmc(offset);
// Write Pointers
Bits.SetInt24(rm.Content, SmcToAbs(WOR_MINI_MAP_PTR), worPtr);
Bits.SetInt24(rm.Content, SmcToAbs(FALCON_GFX_PTR), falconPtr);
Bits.SetInt24(rm.Content, SmcToAbs(ENDING_PAL_PTR), palPtr);
// Modify palette ASM
Bits.SetBytes(rom, SmcToAbs(ASM_CODE_A), asmA);
Bits.SetBytes(rom, SmcToAbs(ASM_CODE_B), asmB);
// Modify palette
offset = SmcToAbs(PALETTE_OFF);
for(int i = 0; i < palette.Length; i++)
{
Bits.SetShort(rom, offset + i * 2, palette[i]);
}
if (rm.WriteRom())
{
Console.WriteLine("Operation Completed!");
}
}
catch (Exception e)
{
Console.Error.WriteLine("Error! " + e.InnerException.Message);
}
}
}
}
private static int validatePosition(string name, string position, int min, int max)
{
int pos;
if (!int.TryParse(position, out pos))
{
ShowHelp(name + " must be a number.");
}
else
{
pos = pos < min || pos > max ? -1 : pos;
}
if(pos == -1)
{
ShowHelp(name + " must be between " + min + " and " + max + ".");
}
return pos;
}
private static void ShowHelp(string message)
{
Console.Error.WriteLine(message);
options.WriteOptionDescriptions(Console.Error);
Environment.Exit(-1);
}
#region FF3Edit code
public static byte[] WriteMiniMap(bool isWob)
{
byte[] aMap = new byte[4096];
int[] bPix = new int[16];
byte[] map;
byte[] miniMap;
ushort[] tileProperties;
int bAverage;
Trigger pTrigger;
bool tFound;
int y, x, ry, rx;
if(isWob)
{
map = wobMap;
miniMap = wobMiniMap;
tileProperties = wobTilesProp;
}
else
{
map = worMap;
miniMap = worMiniMap;
tileProperties = worTilesProp;
}
for (y = 0; y < 256; y += 4)
{
for (x = 0; x < 256; x += 4)
{
for (int y1 = 0; y1 < 4; y1++)
{
for (int x1 = 0; x1 < 4; x1++)
{
bPix[y1 * 4 + x1] = (tileProperties[map[(y + y1) * 256 + (x + x1)]] & 0x0C) >> 2;
}
}
bAverage = 0;
for (int i = 0; i < 16; i++)
{
bPix[i] *= 16;
bAverage += bPix[i];
}
bAverage /= 16;
if (bAverage == 0) bAverage = 1;
else if (bAverage > 0 && bAverage < 6) bAverage = 2;
else if (bAverage >= 6 && bAverage < 24) bAverage = 3;
else if (bAverage >= 24 && bAverage < 32) bAverage = 4;
else if (bAverage >= 32) bAverage = 10;
tFound = false;
// Set locations on map
for (int y1 = 0; y1 < 4 && !tFound; y1++)
{
for (int x1 = 0; x1 < 4 && !tFound; x1++)
{
pTrigger = GetTrigger(x + x1, y + y1, isWob);
if (pTrigger.cx != -1)
{
bAverage = 5;
tFound = true;
}
}
}
aMap[(y / 4) * 64 + (x / 4)] = (byte)bAverage;
}
}
string s = "22";
s.ToString();
// Sealed Gate continent
if (isWob)
{
for (int y2 = 0; y2 < 64; y2++)
{
for (int x2 = 0; x2 < 64; x2++)
{
if (x2 >= xLeft && x2 < xRight && y2 >= yTop && y2 < yBottom)
{
int offset = y2 * 64 + x2;
byte bAvg = aMap[offset];
if (bAvg == 2) bAvg = 6;
else if (bAvg == 3) bAvg = 7;
else if (bAvg == 4) bAvg = 8;
else if (bAvg == 10) bAvg = 8;
else if (bAvg == 5) bAvg = 9;
aMap[offset] = bAvg;
}
}
}
}
ry = 0;
for (y = 0; y < 8; y += 8, ry += 8)
{
rx = 0;
for (x = 0; x < 64; x += 8, rx += 8)
{
int position = (ry * 32) + (rx * 4);
byte[] bPlanes = new byte[4];
for (int row = 0; row < 8; row++)
{
bPlanes[0] = bPlanes[1] = bPlanes[2] = bPlanes[3] = 0;
for (int col = 0; col < 8; col++)
{
byte bColor = aMap[(y + row) * 64 + (x + col)];
if ((bColor & 1) == 1) bPlanes[0] |= (byte)(1 << (7 - col));
if ((bColor & 2) == 2) bPlanes[1] |= (byte)(1 << (7 - col));
if ((bColor & 4) == 4) bPlanes[2] |= (byte)(1 << (7 - col));
if ((bColor & 8) == 8) bPlanes[3] |= (byte)(1 << (7 - col));
}
miniMap[position + row * 2] = bPlanes[0];
miniMap[position + row * 2 + 1] = bPlanes[1];
miniMap[position + row * 2 + 16] = bPlanes[2];
miniMap[position + row * 2 + 17] = bPlanes[3];
}
}
}
for (y = 16; y < 24; y += 8, ry += 8)
{
rx = 0;
for (x = 0; x < 64; x += 8, rx += 8)
{
int position = (ry * 32) + (rx * 4);
byte[] bPlanes = new byte[4];
for (int row = 0; row < 8; row++)
{
bPlanes[0] = bPlanes[1] = bPlanes[2] = bPlanes[3] = 0;
for (int col = 0; col < 8; col++)
{
byte bColor = aMap[(y + row) * 64 + (x + col)];
if ((bColor & 1) == 1) bPlanes[0] |= (byte)(1 << (7 - col));
if ((bColor & 2) == 2) bPlanes[1] |= (byte)(1 << (7 - col));
if ((bColor & 4) == 4) bPlanes[2] |= (byte)(1 << (7 - col));
if ((bColor & 8) == 8) bPlanes[3] |= (byte)(1 << (7 - col));
}
miniMap[position + row * 2] = bPlanes[0];
miniMap[position + row * 2 + 1] = bPlanes[1];
miniMap[position + row * 2 + 16] = bPlanes[2];
miniMap[position + row * 2 + 17] = bPlanes[3];
}
}
}
for (y = 8; y < 16; y += 8, ry += 8)
{
rx = 0;
for (x = 0; x < 64; x += 8, rx += 8)
{
int position = (ry * 32) + (rx * 4);
byte[] bPlanes = new byte[4];
for (int row = 0; row < 8; row++)
{
bPlanes[0] = bPlanes[1] = bPlanes[2] = bPlanes[3] = 0;
for (int col = 0; col < 8; col++)
{
byte bColor = aMap[(y + row) * 64 + (x + col)];
if ((bColor & 1) == 1) bPlanes[0] |= (byte)(1 << (7 - col));
if ((bColor & 2) == 2) bPlanes[1] |= (byte)(1 << (7 - col));
if ((bColor & 4) == 4) bPlanes[2] |= (byte)(1 << (7 - col));
if ((bColor & 8) == 8) bPlanes[3] |= (byte)(1 << (7 - col));
}
miniMap[position + row * 2] = bPlanes[0];
miniMap[position + row * 2 + 1] = bPlanes[1];
miniMap[position + row * 2 + 16] = bPlanes[2];
miniMap[position + row * 2 + 17] = bPlanes[3];
}
}
}
for (y = 24; y < 40; y += 8, ry += 8)
{
rx = 0;
for (x = 0; x < 64; x += 8, rx += 8)
{
int position = (ry * 32) + (rx * 4);
byte[] bPlanes = new byte[4];
for (int row = 0; row < 8; row++)
{
bPlanes[0] = bPlanes[1] = bPlanes[2] = bPlanes[3] = 0;
for (int col = 0; col < 8; col++)
{
byte bColor = aMap[(y + row) * 64 + (x + col)];
if ((bColor & 1) == 1) bPlanes[0] |= (byte)(1 << (7 - col));
if ((bColor & 2) == 2) bPlanes[1] |= (byte)(1 << (7 - col));
if ((bColor & 4) == 4) bPlanes[2] |= (byte)(1 << (7 - col));
if ((bColor & 8) == 8) bPlanes[3] |= (byte)(1 << (7 - col));
}
miniMap[position + row * 2] = bPlanes[0];
miniMap[position + row * 2 + 1] = bPlanes[1];
miniMap[position + row * 2 + 16] = bPlanes[2];
miniMap[position + row * 2 + 17] = bPlanes[3];
}
}
}
for (y = 48; y < 56; y += 8, ry += 8)
{
rx = 0;
for (x = 0; x < 64; x += 8, rx += 8)
{
int position = (ry * 32) + (rx * 4);
byte[] bPlanes = new byte[4];
for (int row = 0; row < 8; row++)
{
bPlanes[0] = bPlanes[1] = bPlanes[2] = bPlanes[3] = 0;
for (int col = 0; col < 8; col++)
{
byte bColor = aMap[(y + row) * 64 + (x + col)];
if ((bColor & 1) == 1) bPlanes[0] |= (byte)(1 << (7 - col));
if ((bColor & 2) == 2) bPlanes[1] |= (byte)(1 << (7 - col));
if ((bColor & 4) == 4) bPlanes[2] |= (byte)(1 << (7 - col));
if ((bColor & 8) == 8) bPlanes[3] |= (byte)(1 << (7 - col));
}
miniMap[position + row * 2] = bPlanes[0];
miniMap[position + row * 2 + 1] = bPlanes[1];
miniMap[position + row * 2 + 16] = bPlanes[2];
miniMap[position + row * 2 + 17] = bPlanes[3];
}
}
}
for (y = 40; y < 48; y += 8, ry += 8)
{
rx = 0;
for (x = 0; x < 64; x += 8, rx += 8)
{
int position = (ry * 32) + (rx * 4);
byte[] bPlanes = new byte[4];
for (int row = 0; row < 8; row++)
{
bPlanes[0] = bPlanes[1] = bPlanes[2] = bPlanes[3] = 0;
for (int col = 0; col < 8; col++)
{
byte bColor = aMap[(y + row) * 64 + (x + col)];
if ((bColor & 1) == 1) bPlanes[0] |= (byte)(1 << (7 - col));
if ((bColor & 2) == 2) bPlanes[1] |= (byte)(1 << (7 - col));
if ((bColor & 4) == 4) bPlanes[2] |= (byte)(1 << (7 - col));
if ((bColor & 8) == 8) bPlanes[3] |= (byte)(1 << (7 - col));
}
miniMap[position + row * 2] = bPlanes[0];
miniMap[position + row * 2 + 1] = bPlanes[1];
miniMap[position + row * 2 + 16] = bPlanes[2];
miniMap[position + row * 2 + 17] = bPlanes[3];
}
}
}
for (y = 56; y < 64; y += 8, ry += 8)
{
rx = 0;
for (x = 0; x < 64; x += 8, rx += 8)
{
int position = (ry * 32) + (rx * 4);
byte[] bPlanes = new byte[4];
for (int row = 0; row < 8; row++)
{
bPlanes[0] = bPlanes[1] = bPlanes[2] = bPlanes[3] = 0;
for (int col = 0; col < 8; col++)
{
byte bColor = aMap[(y + row) * 64 + (x + col)];
if ((bColor & 1) == 1) bPlanes[0] |= (byte)(1 << (7 - col));
if ((bColor & 2) == 2) bPlanes[1] |= (byte)(1 << (7 - col));
if ((bColor & 4) == 4) bPlanes[2] |= (byte)(1 << (7 - col));
if ((bColor & 8) == 8) bPlanes[3] |= (byte)(1 << (7 - col));
}
miniMap[position + row * 2] = bPlanes[0];
miniMap[position + row * 2 + 1] = bPlanes[1];
miniMap[position + row * 2 + 16] = bPlanes[2];
miniMap[position + row * 2 + 17] = bPlanes[3];
}
}
}
return Compression.Compress(miniMap, 0x800);
}
private static Trigger[] ReadMapTriggers(int mapIndex)
{
int dwEntranceOffset = SmcToAbs(MAP_TRIGGERS) + mapIndex * 2;
int dwEventOffset = SmcToAbs(EVENT_TRIGGERS) + mapIndex * 2;
int wThisOffset = Bits.GetShort(rom, dwEntranceOffset);
int wNextOffset = Bits.GetShort(rom, dwEntranceOffset + 2);
int wThisEventOffset = Bits.GetShort(rom, dwEventOffset);
int wNextEventOffset = Bits.GetShort(rom, dwEventOffset + 2);
int numTriggers = (wNextOffset - wThisOffset) / 6;
int numEvents = (wNextEventOffset - wThisEventOffset) / 5;
Trigger[] triggers = new Trigger[numTriggers + numEvents];
int offset = SmcToAbs(MAP_TRIGGERS) + wThisOffset;
for (int i = 0; i < numTriggers; i++)
{
int x = rom[offset];
int y = rom[offset + 1];
triggers[i] = new Trigger { cx = x, cy = y };
offset += 6;
}
offset = SmcToAbs(EVENT_TRIGGERS) + wThisEventOffset;
int eventEnd = numTriggers + numEvents;
for (int i = numTriggers; i < eventEnd; i++)
{
int x = rom[offset];
int y = rom[offset + 1];
triggers[i] = new Trigger { cx = x, cy = y };
offset += 5;
}
return triggers;
}
#endregion
private static Trigger GetTrigger(int x, int y, bool isWob)
{
Trigger trigger;
int index;
if (isWob)
{
index = Array.FindIndex(wobTriggers, t => t.cx == x && t.cy == y);
trigger = index == -1 ? new Trigger { cx = -1, cy = -1 } : wobTriggers[index];
}
else
{
index = Array.FindIndex(worTriggers, t => t.cx == x && t.cy == y);
trigger = index == -1 ? new Trigger { cx = -1, cy = -1 } : worTriggers[index];
}
return trigger;
}
private static byte[] ReadBytesFromPointer(int pointer, ushort size)
{
int absOffset = GetOffsetFromPointer(pointer);
return Bits.GetBytes(rom, absOffset, size);
}
private static ushort[] ReadTileProperties(int offset)
{
return Bits.GetShorts(rom, SmcToAbs(offset), 256);
}
private static byte[] Decompress(int pointer)
{
int absOffset = GetOffsetFromPointer(pointer);
return Compression.Decompress(rom, absOffset);
}
private static int GetOffsetFromPointer(int pointer)
{
return SmcToAbs(Bits.GetInt24(rom, SmcToAbs(pointer)));
}
private static int SmcToAbs(int offset)
{
return offset - 0xC00000;
}
private static int AbsToSmc(int offset)
{
return offset + 0xC00000;
}
}
}