-
Notifications
You must be signed in to change notification settings - Fork 12
/
Copy pathGenPlusGameCore.m
1803 lines (1582 loc) · 66.6 KB
/
GenPlusGameCore.m
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
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
/*
Copyright (c) 2022, OpenEmu Team
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
* Neither the name of the OpenEmu Team nor the
names of its contributors may be used to endorse or promote products
derived from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY OpenEmu Team ''AS IS'' AND ANY
EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL OpenEmu Team BE LIABLE FOR ANY
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#import "GenPlusGameCore.h"
#import <OpenEmuBase/OERingBuffer.h>
#import "OESMSSystemResponderClient.h"
#import "OEGGSystemResponderClient.h"
#import "OESG1000SystemResponderClient.h"
#import "OEGenesisSystemResponderClient.h"
#import "OESegaCDSystemResponderClient.h"
#import <OpenGL/gl.h>
#include "shared.h"
#define OptionDefault(_NAME_, _PREFKEY_) @{ OEGameCoreDisplayModeNameKey : _NAME_, OEGameCoreDisplayModePrefKeyNameKey : _PREFKEY_, OEGameCoreDisplayModeStateKey : @YES, }
#define Option(_NAME_, _PREFKEY_) @{ OEGameCoreDisplayModeNameKey : _NAME_, OEGameCoreDisplayModePrefKeyNameKey : _PREFKEY_, OEGameCoreDisplayModeStateKey : @NO, }
#define OptionIndented(_NAME_, _PREFKEY_) @{ OEGameCoreDisplayModeNameKey : _NAME_, OEGameCoreDisplayModePrefKeyNameKey : _PREFKEY_, OEGameCoreDisplayModeStateKey : @NO, OEGameCoreDisplayModeIndentationLevelKey : @(1), }
#define OptionToggleable(_NAME_, _PREFKEY_) @{ OEGameCoreDisplayModeNameKey : _NAME_, OEGameCoreDisplayModePrefKeyNameKey : _PREFKEY_, OEGameCoreDisplayModeStateKey : @NO, OEGameCoreDisplayModeAllowsToggleKey : @YES, }
#define OptionToggleableNoSave(_NAME_, _PREFKEY_) @{ OEGameCoreDisplayModeNameKey : _NAME_, OEGameCoreDisplayModePrefKeyNameKey : _PREFKEY_, OEGameCoreDisplayModeStateKey : @NO, OEGameCoreDisplayModeAllowsToggleKey : @YES, OEGameCoreDisplayModeDisallowPrefSaveKey : @YES, }
#define Label(_NAME_) @{ OEGameCoreDisplayModeLabelKey : _NAME_, }
#define SeparatorItem() @{ OEGameCoreDisplayModeSeparatorItemKey : @"",}
static const double pal_fps = 53203424.0 / (3420.0 * 313.0);
static const double ntsc_fps = 53693175.0 / (3420.0 * 262.0);
t_config config;
char GG_ROM[256];
char AR_ROM[256];
char SK_ROM[256];
char SK_UPMEM[256];
char MD_BIOS[256];
char GG_BIOS[256];
char MS_BIOS_EU[256];
char MS_BIOS_JP[256];
char MS_BIOS_US[256];
char CD_BIOS_EU[256];
char CD_BIOS_US[256];
char CD_BIOS_JP[256];
char CD_BRAM_JP[256];
char CD_BRAM_US[256];
char CD_BRAM_EU[256];
char CART_BRAM[256];
// Mega CD backup RAM stuff
static uint32_t brm_crc[2];
static uint8_t brm_format[0x40] =
{
0x5f,0x5f,0x5f,0x5f,0x5f,0x5f,0x5f,0x5f,0x5f,0x5f,0x5f,0x00,0x00,0x00,0x00,0x40,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x53,0x45,0x47,0x41,0x5f,0x43,0x44,0x5f,0x52,0x4f,0x4d,0x00,0x01,0x00,0x00,0x00,
0x52,0x41,0x4d,0x5f,0x43,0x41,0x52,0x54,0x52,0x49,0x44,0x47,0x45,0x5f,0x5f,0x5f
};
// Cheat Support
#define MAX_CHEATS (150)
#define MAX_DESC_LENGTH (63)
typedef struct
{
char code[12];
char text[MAX_DESC_LENGTH];
uint8_t enable;
uint16_t data;
uint16_t old;
uint32_t address;
uint8_t *prev;
} CHEATENTRY;
static int maxcheats = 0;
static int maxROMcheats = 0;
static int maxRAMcheats = 0;
static CHEATENTRY cheatlist[MAX_CHEATS];
static uint8_t cheatIndexes[MAX_CHEATS];
static char ggvalidchars[] = "ABCDEFGHJKLMNPRSTVWXYZ0123456789";
static char arvalidchars[] = "0123456789ABCDEF";
typedef NS_ENUM(NSInteger, MultiTapType)
{
MultiTapTypeNone,
TeamPlayerPort1, // 1-4 players: TeamPlayer in Port 1
GamepadPort1TeamPlayerPort2, // 1-4 players: Gamepad Port 1, TeamPlayer Port 2
TeamPlayerPort1TeamPlayerPort2, // 1-8 players: TeamPlayer in Port 1, TeamPlayer Port 2
EA4WayPlay // 1-4 players: EA 4-Way Play
};
@interface GenPlusGameCore () <OEGenesisSystemResponderClient, OESegaCDSystemResponderClient>
{
uint8_t *_videoBuffer;
int16_t *_soundBuffer;
NSMutableDictionary<NSString *, NSNumber *> *_cheatList;
NSMutableArray <NSMutableDictionary <NSString *, id> *> *_availableDisplayModes;
NSURL *_romFile;
MultiTapType _multiTapType;
}
- (void)applyCheat:(NSString *)code;
- (void)resetCheats;
- (void)configureOptions;
- (void)configureInput;
@end
@implementation GenPlusGameCore
static __weak GenPlusGameCore *_current;
- (id)init
{
if((self = [super init]))
{
_videoBuffer = (uint8_t *)malloc(720 * 576 * sizeof(uint32_t));
_soundBuffer = (int16_t *)malloc(2048 * 2 * sizeof(int16_t));
_cheatList = [NSMutableDictionary dictionary];
}
_current = self;
return self;
}
- (void)dealloc
{
free(_videoBuffer);
free(_soundBuffer);
}
# pragma mark - Execution
- (BOOL)loadFileAtPath:(NSString *)path error:(NSError **)error
{
_romFile = [NSURL fileURLWithPath:path];
// Set CD BIOS and BRAM/RAM Cart paths
snprintf(CD_BIOS_EU, sizeof(CD_BIOS_EU), "%s%sbios_CD_E.bin", self.biosDirectoryPath.fileSystemRepresentation, "/");
snprintf(CD_BIOS_US, sizeof(CD_BIOS_US), "%s%sbios_CD_U.bin", self.biosDirectoryPath.fileSystemRepresentation, "/");
snprintf(CD_BIOS_JP, sizeof(CD_BIOS_JP), "%s%sbios_CD_J.bin", self.biosDirectoryPath.fileSystemRepresentation, "/");
snprintf(CD_BRAM_EU, sizeof(CD_BRAM_EU), "%s%sscd_E.brm", self.batterySavesDirectoryPath.fileSystemRepresentation, "/");
snprintf(CD_BRAM_US, sizeof(CD_BRAM_US), "%s%sscd_U.brm", self.batterySavesDirectoryPath.fileSystemRepresentation, "/");
snprintf(CD_BRAM_JP, sizeof(CD_BRAM_JP), "%s%sscd_J.brm", self.batterySavesDirectoryPath.fileSystemRepresentation, "/");
snprintf(CART_BRAM, sizeof(CART_BRAM), "%s%scart.brm", self.batterySavesDirectoryPath.fileSystemRepresentation, "/");
[self configureOptions];
if (!load_rom((char *)path.fileSystemRepresentation))
return NO;
if([self.systemIdentifier isEqualToString:@"openemu.system.sg"] || [self.systemIdentifier isEqualToString:@"openemu.system.scd"] || [self.systemIdentifier isEqualToString:@"openemu.system.sms"])
{
// Force system region to Japan if user locale is Japan and the cart appears to be world/multi-region
if((strstr((const char*)rominfo.country, "EJ") ||
strstr((const char*)rominfo.country, "JE") ||
strstr((const char*)rominfo.country, "JU") ||
strstr((const char*)rominfo.country, "UJ") ||
strstr(rominfo.country, "SMS Export") != NULL)
&& [self.systemRegion isEqualToString: @"Japan"])
{
config.region_detect = 3;
region_code = REGION_JAPAN_NTSC;
NSLog(@"[Genesis Plus GX] Forcing region to Japan for multi-region cart");
}
}
[self configureInput];
audio_init(48000, vdp_pal ? pal_fps : ntsc_fps);
system_init();
system_reset();
if (system_hw == SYSTEM_MCD)
bram_load();
// Set battery saves dir and load sram
NSString *extensionlessFilename = _romFile.lastPathComponent.stringByDeletingPathExtension;
NSURL *batterySavesDirectory = [NSURL fileURLWithPath:self.batterySavesDirectoryPath];
[NSFileManager.defaultManager createDirectoryAtURL:batterySavesDirectory withIntermediateDirectories:YES attributes:nil error:nil];
NSURL *saveFile = [batterySavesDirectory URLByAppendingPathComponent:[extensionlessFilename stringByAppendingPathExtension:@"sav"]];
if ([saveFile checkResourceIsReachableAndReturnError:nil])
{
NSData *saveData = [NSData dataWithContentsOfURL:saveFile];
memcpy(sram.sram, saveData.bytes, 0x10000);
sram.crc = crc32(0, sram.sram, 0x10000);
NSLog(@"[Genesis Plus GX] Loaded sram");
}
if([self.systemIdentifier isEqualToString:@"openemu.system.sg"] || [self.systemIdentifier isEqualToString:@"openemu.system.scd"])
{
// Set initial viewport size because the system briefly outputs 256x192 when it boots
bitmap.viewport.w = 292;
bitmap.viewport.h = 224;
}
return YES;
}
- (void)executeFrame
{
if (system_hw == SYSTEM_MCD)
system_frame_scd(0);
else if ((system_hw & SYSTEM_PBC) == SYSTEM_MD)
system_frame_gen(0);
else
system_frame_sms(0);
int samples = audio_update(_soundBuffer);
[[self audioBufferAtIndex:0] write:_soundBuffer maxLength:samples << 2];
}
- (void)resetEmulation
{
system_reset();
}
- (void)stopEmulation
{
if (sram.on)
{
// max. supported SRAM size
unsigned long filesize = 0x10000;
// only save modified SRAM size
do
{
if (sram.sram[filesize-1] != 0xff)
break;
}
while (--filesize > 0);
// only save if SRAM has been modified
if ((filesize != 0) || (crc32(0, &sram.sram[0], 0x10000) != sram.crc))
{
NSError *error = nil;
NSString *extensionlessFilename = _romFile.lastPathComponent.stringByDeletingPathExtension;
NSURL *batterySavesDirectory = [NSURL fileURLWithPath:self.batterySavesDirectoryPath];
NSURL *saveFile = [batterySavesDirectory URLByAppendingPathComponent:[extensionlessFilename stringByAppendingPathExtension:@"sav"]];
// copy SRAM data
NSData *saveData = [NSData dataWithBytes:sram.sram length:filesize];
[saveData writeToURL:saveFile options:NSDataWritingAtomic error:&error];
// update CRC
sram.crc = crc32(0, sram.sram, 0x10000);
if (error)
NSLog(@"[Genesis Plus GX] Error writing sram file: %@", error);
else
NSLog(@"[Genesis Plus GX] Saved sram file: %@", saveFile);
}
}
if (system_hw == SYSTEM_MCD)
bram_save();
audio_shutdown();
[super stopEmulation];
}
- (NSTimeInterval)frameInterval
{
return vdp_pal ? pal_fps : ntsc_fps;
}
# pragma mark - Video
- (const void *)getVideoBufferWithHint:(void *)hint
{
if (!hint) {
hint = _videoBuffer;
}
return bitmap.data = (uint8_t*)hint;
}
- (OEIntRect)screenRect
{
if([self.systemIdentifier isEqualToString:@"openemu.system.gg"])
{
return OEIntRectMake(0, 0, 160, 144);
}
else
{
return OEIntRectMake(bitmap.viewport.x, bitmap.viewport.y, bitmap.viewport.w, bitmap.viewport.h);
}
}
- (OEIntSize)bufferSize
{
return OEIntSizeMake(bitmap.width, bitmap.height);
}
- (OEIntSize)aspectSize
{
if([self.systemIdentifier isEqualToString:@"openemu.system.gg"])
{
return OEIntSizeMake(160, 144);
}
else if([self.systemIdentifier isEqualToString:@"openemu.system.sms"] || [self.systemIdentifier isEqualToString:@"openemu.system.sg1000"])
{
return OEIntSizeMake(256 * (8.0/7.0), 192);
}
else
{
// H32 mode (256px * 8:7 PAR)
// H40 mode (320px * 32:35 PAR)
return OEIntSizeMake(292, 224);
}
}
- (GLenum)pixelFormat
{
return GL_BGRA;
}
- (GLenum)pixelType
{
return GL_UNSIGNED_INT_8_8_8_8_REV;
}
# pragma mark - Audio
- (double)audioSampleRate
{
return 48000;
}
- (NSUInteger)channelCount
{
return 2;
}
# pragma mark - Save States
- (void)saveStateToFileAtPath:(NSString *)fileName completionHandler:(void (^)(BOOL, NSError *))block
{
int serial_size = STATE_SIZE;
NSMutableData *stateData = [NSMutableData dataWithLength:serial_size];
if(!state_save(stateData.mutableBytes))
{
NSError *error = [NSError errorWithDomain:OEGameCoreErrorDomain code:OEGameCoreCouldNotSaveStateError userInfo:@{
NSLocalizedDescriptionKey : @"Save state data could not be written",
NSLocalizedRecoverySuggestionErrorKey : @"The emulator could not write the state data."
}];
block(NO, error);
return;
}
__autoreleasing NSError *error = nil;
BOOL success = [stateData writeToFile:fileName options:NSDataWritingAtomic error:&error];
block(success, success ? nil : error);
}
- (void)loadStateFromFileAtPath:(NSString *)fileName completionHandler:(void (^)(BOOL, NSError *))block
{
__autoreleasing NSError *error = nil;
NSData *data = [NSData dataWithContentsOfFile:fileName options:NSDataReadingMappedIfSafe | NSDataReadingUncached error:&error];
if(data == nil)
{
block(NO, error);
return;
}
int serial_size = STATE_SIZE;
if(serial_size != data.length)
{
NSError *error = [NSError errorWithDomain:OEGameCoreErrorDomain code:OEGameCoreStateHasWrongSizeError userInfo:@{
NSLocalizedDescriptionKey : @"Save state has wrong file size.",
NSLocalizedRecoverySuggestionErrorKey : [NSString stringWithFormat:@"The size of the file %@ does not have the right size, %d expected, got: %ld.", fileName, serial_size, data.length],
}];
block(NO, error);
return;
}
if(!state_load((uint8_t *)data.bytes))
{
NSError *error = [NSError errorWithDomain:OEGameCoreErrorDomain code:OEGameCoreCouldNotLoadStateError userInfo:@{
NSLocalizedDescriptionKey : @"The save state data could not be read",
NSLocalizedRecoverySuggestionErrorKey : [NSString stringWithFormat:@"Could not read the file state in %@.", fileName]
}];
block(NO, error);
return;
}
block(YES, nil);
}
- (NSData *)serializeStateWithError:(NSError **)outError
{
size_t length = STATE_SIZE;
NSMutableData *data = [NSMutableData dataWithLength:length];
if(state_save(data.mutableBytes))
return data;
if (outError) {
*outError = [NSError errorWithDomain:OEGameCoreErrorDomain code:OEGameCoreCouldNotSaveStateError userInfo:@{
NSLocalizedDescriptionKey : @"Save state data could not be written",
NSLocalizedRecoverySuggestionErrorKey : @"The emulator could not write the state data."
}];
}
return nil;
}
- (BOOL)deserializeState:(NSData *)state withError:(NSError **)outError
{
const void *bytes = state.bytes;
size_t length = state.length;
size_t serialSize = STATE_SIZE;
if(serialSize != length) {
if (outError) {
*outError = [NSError errorWithDomain:OEGameCoreErrorDomain code:OEGameCoreStateHasWrongSizeError userInfo:@{
NSLocalizedDescriptionKey : @"Save state has wrong file size.",
NSLocalizedRecoverySuggestionErrorKey : [NSString stringWithFormat:@"The size of the save state does not have the right size, %lu expected, got: %ld.", serialSize, state.length],
}];
}
return NO;
}
if(state_load((uint8_t *)bytes))
return YES;
if (outError) {
*outError = [NSError errorWithDomain:OEGameCoreErrorDomain code:OEGameCoreCouldNotLoadStateError userInfo:@{
NSLocalizedDescriptionKey : @"The save state data could not be read",
NSLocalizedRecoverySuggestionErrorKey : @"Could not load data from the save state"
}];
}
return NO;
}
# pragma mark - Input
const int GenesisMap[] = {INPUT_UP, INPUT_DOWN, INPUT_LEFT, INPUT_RIGHT, INPUT_A, INPUT_B, INPUT_C, INPUT_X, INPUT_Y, INPUT_Z, INPUT_START, INPUT_MODE};
const int GameGearMap[] = {INPUT_UP, INPUT_DOWN, INPUT_LEFT, INPUT_RIGHT, INPUT_B, INPUT_C, INPUT_START};
const int MasterSystemMap[] = {INPUT_UP, INPUT_DOWN, INPUT_LEFT, INPUT_RIGHT, INPUT_BUTTON1, INPUT_BUTTON2, INPUT_START};
- (oneway void)didPushGenesisButton:(OEGenesisButton)button forPlayer:(NSUInteger)player
{
if (_multiTapType == GamepadPort1TeamPlayerPort2 || cart.special & HW_J_CART)
{
NSUInteger offset = (player == 1) ? 0 : player + 2;
input.pad[offset] |= GenesisMap[button];
}
else if (_multiTapType == TeamPlayerPort1 || _multiTapType == TeamPlayerPort1TeamPlayerPort2 || _multiTapType == EA4WayPlay)
{
input.pad[player-1] |= GenesisMap[button];
}
else
{
input.pad[(player-1) * 4] |= GenesisMap[button];
}
}
- (oneway void)didReleaseGenesisButton:(OEGenesisButton)button forPlayer:(NSUInteger)player
{
if (_multiTapType == GamepadPort1TeamPlayerPort2 || cart.special & HW_J_CART)
{
NSUInteger offset = (player == 1) ? 0 : player + 2;
input.pad[offset] &= ~GenesisMap[button];
}
else if (_multiTapType == TeamPlayerPort1 || _multiTapType == TeamPlayerPort1TeamPlayerPort2 || _multiTapType == EA4WayPlay)
{
input.pad[player-1] &= ~GenesisMap[button];
}
else
input.pad[(player-1) * 4] &= ~GenesisMap[button];
}
- (oneway void)didPushSegaCDButton:(OESegaCDButton)button forPlayer:(NSUInteger)player
{
if (_multiTapType == GamepadPort1TeamPlayerPort2)
{
NSUInteger offset = (player == 1) ? 0 : player + 2;
input.pad[offset] |= GenesisMap[button];
}
else if (_multiTapType == TeamPlayerPort1 || _multiTapType == TeamPlayerPort1TeamPlayerPort2 || _multiTapType == EA4WayPlay)
{
input.pad[player-1] |= GenesisMap[button];
}
else
input.pad[(player-1) * 4] |= GenesisMap[button];
}
- (oneway void)didReleaseSegaCDButton:(OESegaCDButton)button forPlayer:(NSUInteger)player
{
if (_multiTapType == GamepadPort1TeamPlayerPort2)
{
NSUInteger offset = (player == 1) ? 0 : player + 2;
input.pad[offset] &= ~GenesisMap[button];
}
else if (_multiTapType == TeamPlayerPort1 || _multiTapType == TeamPlayerPort1TeamPlayerPort2 || _multiTapType == EA4WayPlay)
{
input.pad[player-1] &= ~GenesisMap[button];
}
else
input.pad[(player-1) * 4] &= ~GenesisMap[button];
}
- (oneway void)didPushGGButton:(OEGGButton)button
{
input.pad[0] |= GameGearMap[button];
}
- (oneway void)didReleaseGGButton:(OEGGButton)button
{
input.pad[0] &= ~GameGearMap[button];
}
- (oneway void)didPushSMSButton:(OESMSButton)button forPlayer:(NSUInteger)player
{
input.pad[(player-1) * 4] |= MasterSystemMap[button];
}
- (oneway void)didReleaseSMSButton:(OESMSButton)button forPlayer:(NSUInteger)player
{
input.pad[(player-1) * 4] &= ~MasterSystemMap[button];
}
- (oneway void)didPushSMSStartButton
{
[self didPushSMSButton:OESMSButtonStart forPlayer:1];
}
- (oneway void)didReleaseSMSStartButton
{
[self didReleaseSMSButton:OESMSButtonStart forPlayer:1];
}
- (oneway void)didPushSMSResetButton
{
}
- (oneway void)didReleaseSMSResetButton
{
}
- (oneway void)didPushSG1000Button:(OESG1000Button)button forPlayer:(NSUInteger)player
{
input.pad[(player-1) * 4] |= MasterSystemMap[button];
}
- (oneway void)didReleaseSG1000Button:(OESG1000Button)button forPlayer:(NSUInteger)player
{
input.pad[(player-1) * 4] &= ~MasterSystemMap[button];
}
- (oneway void)mouseMovedAtPoint:(OEIntPoint)aPoint
{
// TODO handle Sega Mouse
if (input.dev[4] == DEVICE_LIGHTGUN)
{
// Handle screen resolution changes
if (bitmap.viewport.w == 320)
{
input.analog[4][0] = aPoint.x;
input.analog[4][1] = aPoint.y * 0.912500;
}
else // w == 256
{
input.analog[4][0] = aPoint.x * 0.876712;
input.analog[4][1] = aPoint.y;
}
}
else if (input.system[0] == SYSTEM_LIGHTPHASER)
{
input.analog[0][0] = aPoint.x * 0.876712;
input.analog[0][1] = aPoint.y;
}
}
- (oneway void)leftMouseDownAtPoint:(OEIntPoint)aPoint
{
if (input.dev[4] == DEVICE_LIGHTGUN)
{
[self mouseMovedAtPoint:aPoint];
input.pad[4] |= INPUT_A; // menacer button A / justifier trigger
}
else if (input.system[0] == SYSTEM_LIGHTPHASER)
{
[self mouseMovedAtPoint:aPoint];
input.pad[0] |= INPUT_A; // light phaser trigger
}
}
- (oneway void)leftMouseUp
{
if (input.dev[4] == DEVICE_LIGHTGUN)
{
input.pad[4] &= ~INPUT_A; // menacer button A / justifier trigger
}
else if (input.system[0] == SYSTEM_LIGHTPHASER)
{
input.pad[0] &= ~INPUT_A; // light phaser trigger
}
}
- (oneway void)rightMouseDownAtPoint:(OEIntPoint)aPoint
{
if (input.dev[4] == DEVICE_LIGHTGUN)
{
[self mouseMovedAtPoint:aPoint];
if (input.system[1] == SYSTEM_MENACER)
input.pad[4] |= INPUT_B; // menacer button B
else
input.pad[4] |= INPUT_START; // justifier start
}
}
- (oneway void)rightMouseUp
{
if (input.dev[4] == DEVICE_LIGHTGUN)
{
if (input.system[1] == SYSTEM_MENACER)
input.pad[4] &= ~INPUT_B; // menacer button B
else
input.pad[4] &= ~INPUT_START; // justifier start
}
}
#pragma mark - Cheats
- (void)setCheat:(NSString *)code setType:(NSString *)type setEnabled:(BOOL)enabled
{
// Sanitize
code = [code stringByTrimmingCharactersInSet:NSCharacterSet.whitespaceAndNewlineCharacterSet];
// Genesis Plus GX expects cheats UPPERCASE
code = code.uppercaseString;
// Remove any spaces
code = [code stringByReplacingOccurrencesOfString:@" " withString:@""];
if (enabled)
_cheatList[code] = @YES;
else
[_cheatList removeObjectForKey:code];
[self resetCheats];
NSArray<NSString *> *multipleCodes = [NSArray array];
// Apply enabled cheats found in dictionary
for (NSString *key in _cheatList)
{
if ([_cheatList[key] boolValue])
{
// Handle multi-line cheats
multipleCodes = [key componentsSeparatedByString:@"+"];
for (NSString *singleCode in multipleCodes) {
[self applyCheat:singleCode];
}
}
}
}
# pragma mark - Display Mode
- (NSArray <NSDictionary <NSString *, id> *> *)displayModes
{
if (![self.systemIdentifier isEqualToString:@"openemu.system.gg"])
return nil;
if (_availableDisplayModes.count == 0)
{
_availableDisplayModes = [NSMutableArray array];
NSArray <NSDictionary <NSString *, id> *> *availableModesWithDefault =
@[
Label(@"Screen"),
OptionToggleable(@"LCD Ghosting", @"ggLCDFilter"),
];
// Deep mutable copy
_availableDisplayModes = (NSMutableArray *)CFBridgingRelease(CFPropertyListCreateDeepCopy(kCFAllocatorDefault, (CFArrayRef)availableModesWithDefault, kCFPropertyListMutableContainers));
}
return [_availableDisplayModes copy];
}
- (void)changeDisplayWithMode:(NSString *)displayMode
{
if (_availableDisplayModes.count == 0)
[self displayModes];
// First check if 'displayMode' is valid
BOOL isDisplayModeToggleable = NO;
BOOL isValidDisplayMode = NO;
BOOL displayModeState = NO;
NSString *displayModePrefKey;
for (NSDictionary *modeDict in _availableDisplayModes) {
if ([modeDict[OEGameCoreDisplayModeNameKey] isEqualToString:displayMode]) {
displayModeState = [modeDict[OEGameCoreDisplayModeStateKey] boolValue];
displayModePrefKey = modeDict[OEGameCoreDisplayModePrefKeyNameKey];
isDisplayModeToggleable = [modeDict[OEGameCoreDisplayModeAllowsToggleKey] boolValue];
isValidDisplayMode = YES;
break;
}
}
// Disallow a 'displayMode' not found in _availableDisplayModes
if (!isValidDisplayMode)
return;
// Handle option state changes
for (NSMutableDictionary *optionDict in _availableDisplayModes) {
NSString *modeName = optionDict[OEGameCoreDisplayModeNameKey];
NSString *prefKey = optionDict[OEGameCoreDisplayModePrefKeyNameKey];
if (!modeName)
continue;
// Mutually exclusive option state change
else if ([modeName isEqualToString:displayMode] && !isDisplayModeToggleable)
optionDict[OEGameCoreDisplayModeStateKey] = @YES;
// Reset mutually exclusive options that are the same prefs group as 'displayMode'
else if (!isDisplayModeToggleable && [prefKey isEqualToString:displayModePrefKey])
optionDict[OEGameCoreDisplayModeStateKey] = @NO;
// Toggleable option state change
else if ([modeName isEqualToString:displayMode] && isDisplayModeToggleable)
optionDict[OEGameCoreDisplayModeStateKey] = @(!displayModeState);
}
// Game Gear: LCD ghosting / motion blur
// Required for proper display of some effects in a few games (James Pond 3, Power Drift, Super Monaco GP II)
if ([displayMode isEqualToString:@"LCD Ghosting"])
{
if (!displayModeState)
config.lcd = (uint8)(0.80 * 256);
else
config.lcd = 0;
}
}
# pragma mark - Misc Helper Methods
- (void)applyCheat:(NSString *)code
{
/* clear existing ROM patches */
clear_cheats();
/* interpret code and give it an index */
decode_cheat((char *)code.UTF8String, maxcheats);
// Enable the cheat by default
cheatlist[maxcheats].enable = 1;
/* increment cheat count */
maxcheats++;
/* apply ROM patches */
apply_cheats();
}
- (void)resetCheats
{
/* clear existing ROM patches */
clear_cheats();
/* delete all cheats */
maxcheats = maxROMcheats = maxRAMcheats = 0;
memset(cheatlist, 0, sizeof(cheatlist));
}
- (void)configureOptions
{
/* sound options */
config.psg_preamp = 150;
config.fm_preamp = 100;
config.cdda_volume = 100;
config.pcm_volume = 100;
config.hq_fm = 1; /* high-quality FM resampling (slower) */
config.hq_psg = 1; /* high-quality PSG resampling (slower) */
config.filter = 1; /* single-pole low-pass filter (6 dB/octave) */
config.lp_range = 0x9999; /* 0.6 in 0.16 fixed point */
config.low_freq = 880; // 200
config.high_freq = 5000; // 8000
config.lg = 100;
config.mg = 100;
config.hg = 100;
config.ym2612 = YM2612_DISCRETE;
config.ym2413 = 2; /* AUTO */
config.mono = 0; /* STEREO output */
#ifdef HAVE_YM3438_CORE
config.ym3438 = 0;
#endif
#ifdef HAVE_OPLL_CORE
config.opll = 0;
#endif
/* system options */
config.system = 0; /* AUTO */
config.region_detect = 0; /* AUTO */
config.vdp_mode = 0; /* AUTO */
config.master_clock = 0; /* AUTO */
config.force_dtack = 0;
config.addr_error = 1;
config.bios = 0;
config.lock_on = 0;
config.add_on = 0; /* = HW_ADDON_AUTO (or HW_ADDON_MEGACD, HW_ADDON_MEGASD & HW_ADDON_NONE) */
config.cd_latency = 1;
/* video options */
config.overscan = 0; /* 3 == FULL */
config.gg_extra = 0; /* 1 = show extended Game Gear screen (256x192) */
config.ntsc = 0;
// Only temporary, so core doesn't crash on an older OpenEmu version
if ([self respondsToSelector:@selector(displayModeInfo)]) {
BOOL isLCDFilterEnabled = [self.displayModeInfo[@"ggLCDFilter"] boolValue];
if (isLCDFilterEnabled)
[self changeDisplayWithMode:@"LCD Ghosting"];
else
config.lcd = 0; /* 0.8 fixed point */
}
else
config.lcd = 0;
config.render = 0; /* 1 = double resolution output (only when interlaced mode 2 is enabled) */
config.enhanced_vscroll = 0;
config.enhanced_vscroll_limit = 8;
/* initialize bitmap */
memset(&bitmap, 0, sizeof(bitmap));
bitmap.width = 720;
bitmap.height = 576;
bitmap.pitch = bitmap.width * sizeof(uint32_t);
bitmap.data = (uint8_t *)_videoBuffer;
}
- (void)configureInput
{
_multiTapType = MultiTapTypeNone;
// Overrides: Six button controller-supported games missing '6' byte in cart header, so they cannot be auto-detected
NSArray<NSString *> *pad6Buttons = @[
@"b04c06df1009c60182df902a4ec7c959", // Batman Forever (World)
@"7b144947f6e8842dd4419d5166cddff6", // Boogerman - A Pick and Flick Adventure (Europe)
@"265a10bf2ea2d1ee30e6cde631d54474", // Boogerman - A Pick and Flick Adventure (USA)
@"ac51f4585a42cba91d04f667dd1fd60a", // Coach K College Basketball (USA)
@"e68281bee6a4e9620d306b197860a506", // Comix Zone (USA) (Beta)
@"a9b4642a5b5d22f565222d2d8a4e04f9", // Davis Cup Tennis ~ Davis Cup World Tour (USA, Europe) (June 1993)
@"d1acc657850f56f19d0a027e8ea54a75", // Davis Cup Tennis ~ Davis Cup World Tour (USA, Europe) (July 1993)
@"c2789976bfa41f1e617589db9043e3a2", // Davis Cup II (USA) (Proto)
@"ae9347eeea41c1a02565a187a4bf28f7", // Dragon Ball Z - Buyuu Retsuden (Japan)
@"9386f82fc9ab95294ca35961db80d0b9", // Dragon Ball Z - L'Appel du Destin (France)
@"5093ad6641abb0c3757d24da094a51e6", // Duke Nukem 3D (Brazil)
@"6ba9e256579f0cbfa18abb96acc5b24d", // Greatest Heavyweights (Europe)
@"8662fc03ecb681fb5a463a2e9bb2ae41", // Greatest Heavyweights (Japan)
@"a2319592a31d22d9ec4501ce4c188152", // Greatest Heavyweights (USA)
@"a8dcb5476855a83702e2f49ebd4e2d57", // Lost Vikings, The (USA) (November, 1993)
@"8335ca918a503047fc9cde6a0b082308", // Lost Vikings, The (USA) (October, 1995)
@"7914adf64ff1156c767ae550334c44b5", // Marsupilami (Europe) (En,Fr,De,Es,It)
@"9cf141681e68407d1e5279f7a35d6d53", // Marsupilami (USA) (En,Fr,De,Es,It)
@"a1dd8a3e4b8c98dee49d5e90d6b87903", // Mortal Kombat (World)
@"e0bb4d00ea95b75aac52851fb4d8ee47", // Mortal Kombat (World) (v1.1)
@"697fe71f7c6601b80ff486297124d301", // Nightmare Circus (Brazil)
@"6e325bc3fe03b2bbcd39e667cf0b567a", // Nightmare Circus (Brazil) (Beta)
@"72b5848612f80d14bc51807f8c7e239e", // Shaq-Fu (USA, Europe)
@"5a8f7c6437d239690b4a15287d841c26", // Shinobi III - Return of the Ninja Master (Europe)
@"691eeff9c5741724a8751ec0fa9cfbf0", // Shinobi III - Return of the Ninja Master (USA)
@"6ce59f3e7ee52dc8c6df7b4d8a166826", // Super Shinobi II, The (Japan, Korea)
@"7ded2700acc1715153f630fa266e0e89", // Skeleton Krew (Europe)
@"7e9a79a887c4edf56574d7a1cd72c5fd", // Skeleton Krew (USA)
@"c2967c23e72387743911bb28beb6f144", // Street Racer (Europe)
@"4cd30f3ad42b0354659d128bdcd61a6c", // TechnoClash (USA, Europe)
@"0f0be2db4084822d5514f8e34a0d1488", // Urban Strike (USA, Europe)
@"8d83131da5dfe5a1e83e4390e7777064", // WWF Royal Rumble (World)
];
// Different port configurations and multitap devices are used depending on the game
// NOTE: J-Cart games are automatically handled.
// TODO: Identify supported Sega CD games by rominfo.domestic/rominfo.international?
NSDictionary<NSString *, NSNumber *> *multiTapGames =
@{
//@"3cc6df243e714097f1599cf618f94d0b" : @(TeamPlayerPort1), // Aq Renkan Awa (Taiwan) (Unl)
@"2b27a61cdae4492044bd273c5807de75" : @(TeamPlayerPort1), // Barkley Shut Up and Jam! (USA, Europe)
@"952e40844509c5739f1e84ea7f9dfd90" : @(TeamPlayerPort1), // Barkley Shut Up and Jam 2 (USA)
@"76aab0e8bc8e670a347676aaf0a0aea3" : @(TeamPlayerPort1), // College Football's National Championship (USA)
@"d608a160eda8597113b3cdf92941a048" : @(TeamPlayerPort1), // College Football's National Championship II (USA)
@"a279a2fa2317f9081ba02226cce6b1ed" : @(TeamPlayerPort1), // Dragon - The Bruce Lee Story (Europe)
@"94ebb9a19bbb7b5749bf07ab3ce8fbb9" : @(TeamPlayerPort1), // Dragon - The Bruce Lee Story (USA)
@"817fceb36d9a454c59253be990779f99" : @(TeamPlayerPort1), // From TV Animation Slam Dunk - Kyougou Makkou Taiketsu! (Japan)
@"9aad96cc5364d2289f470b75c59907a5" : @(TeamPlayerPort1), // Gauntlet (Japan) (En,Ja)
@"5e8ec4c047ef4af15027e93b5358858f" : @(TeamPlayerPort1), // Gauntlet IV (Japan) (En,Ja)
@"840f9f6fd4f22686b89cfd9a9ade105a" : @(TeamPlayerPort1), // Gauntlet IV (USA, Europe) (En,Ja)
@"1f8e7897522b6e645f4b8123bff23654" : @(TeamPlayerPort1), // J. League Pro Striker Final Stage (Japan)
@"44752b050421c4e51d1bee96b3fed44e" : @(TeamPlayerPort1), // Lost Vikings, The (Europe)
@"a8dcb5476855a83702e2f49ebd4e2d57" : @(TeamPlayerPort1), // Lost Vikings, The (USA) (November, 1993)
@"8335ca918a503047fc9cde6a0b082308" : @(TeamPlayerPort1), // Lost Vikings, The (USA) (October, 1995)
@"5a94b1e8792bb3572db92c2019d99377" : @(TeamPlayerPort1), // Mega Bomberman (Europe, Korea) (En)
@"514f6cad98f5f632d680983a050fffc4" : @(TeamPlayerPort1), // Mega Bomberman (USA)
@"f9a4e85931dcaaceded19c0c2a7aace1" : @(TeamPlayerPort1), // NBA Hang Time (Europe)
@"a2dddb13539df45f45ff4061cd6caacd" : @(TeamPlayerPort1), // NBA Hang Time (USA)
@"d72f13bc94ad76c90deef86d5a138ff6" : @(TeamPlayerPort1), // NBA Jam (Japan)
@"234bf02f7f7b6fdad65890424d3a8a8f" : @(TeamPlayerPort1), // NBA Jam (USA, Europe) (Rev 1)
@"338b8ed45e02d96f1ed31eaab59eaf43" : @(TeamPlayerPort1), // NBA Jam (USA, Europe)
@"edeb01f0aa8aed3868db1179670db22f" : @(TeamPlayerPort1), // NBA Jam - Tournament Edition (World)
//@"b465081da2e268a1c045c1b0615bed75" : @(TeamPlayerPort1), // NBA Pro Basketball '94 (Japan)
@"3d3c4c2dcc8631373b73cf11170dd4d7" : @(TeamPlayerPort1), // NCAA Final Four Basketball (USA)
@"6e38acfb80ed7e0b1343fa4ffdc6477d" : @(TeamPlayerPort1), // NCAA Football (USA)
@"035283320f792caa2b55129db21f0265" : @(TeamPlayerPort1), // NFL '95 (USA, Europe)
@"80652330e1b3e2892785e27413691e4e" : @(TeamPlayerPort1), // NFL 98 (USA)
@"0faab2309047b85de82a62e0230ec9f4" : @(TeamPlayerPort1), // Pele II - World Tournament Soccer (USA, Europe)
@"15a8114b96afcabcb2bd08acbc7a11c0" : @(TeamPlayerPort1), // Prime Time NFL Starring Deion Sanders (USA)
@"a0003ccd281f9cc74aa2ef97fe23c2fc" : @(TeamPlayerPort1), // Puzzle & Action - Ichidanto-R (Japan)
@"15ee1db49894b798155ae60eaa2dd961" : @(TeamPlayerPort1), // Puzzle & Action - Ichidanto-R (World) (Ja) (Sega Ages)
@"16b0f48a07baf1fa0df27453b7f008d4" : @(TeamPlayerPort1), // Puzzle & Action - Tanto-R (Japan)
//@"4abb0405b270695261494720a2af0783" : @(TeamPlayerPort1), // Shi Jie Zhi Bang Zheng Ba Zhan - World Pro Baseball 94 (Taiwan) (Unl)
@"abddd42b2548e9b708991f689d726c9a" : @(TeamPlayerPort1), // Tiny Toon Adventures - Acme All-Stars (Europe)
@"1def1d7dbe4ab6b9e1fc90093292de6a" : @(TeamPlayerPort1), // Tiny Toon Adventures - Acme All-Stars (USA, Korea)
@"f314fe624d288b4e1228ae759bae1d86" : @(TeamPlayerPort1), // Unnecessary Roughness '95 (USA)
@"8be67519c2417d36ca51576ff1ab043b" : @(TeamPlayerPort1), // World Championship Soccer II (Europe)
@"d0686cf7c1851ebc960c08c9f9908a31" : @(TeamPlayerPort1), // World Championship Soccer II (USA)
@"d97666f8f935e50284026d442d9c5e6e" : @(TeamPlayerPort1), // World Cup USA 94 (USA, Europe)
@"296f057959c1c545178cc5c07f64877c" : @(TeamPlayerPort1), // WWF Raw (World)
@"8130283788f82677ec583b7f627dbf0c" : @(TeamPlayerPort1), // Yu Yu Hakusho - Makyou Toitsusen (Japan)
@"2a2165b2be91810f5b97e8d7d2f76ad5" : @(TeamPlayerPort1), // YuYu Hakusho - Sunset Fighters (Brazil)
// 1-4 Players
@"2dbad2e514d043d27340d640d9b138ac" : @(GamepadPort1TeamPlayerPort2), // ATP Tour (Europe)
@"723db55d679ef169b8210764a5f76c4d" : @(GamepadPort1TeamPlayerPort2), // ATP Tour Championship Tennis (USA)
@"5481f0cbab22ca071dad31dd3ca4f884" : @(GamepadPort1TeamPlayerPort2), // College Slam (USA)
@"6a492e2983b2bc306eec905411ee24a8" : @(GamepadPort1TeamPlayerPort2), // Dino Dini's Soccer (Europe)
@"dea9dd7a01d774ccdfe68c835fe55a8a" : @(GamepadPort1TeamPlayerPort2), // J. League Pro Striker (Japan)
@"f5f52249a5dc851864254935e185ea72" : @(GamepadPort1TeamPlayerPort2), // J. League Pro Striker (Japan) (v1.3)
@"ada241db25d7832866b1e58af2038bc6" : @(GamepadPort1TeamPlayerPort2), // J. League Pro Striker 2 (Japan)
@"a7046120d2a4b40949994c71177aec3c" : @(GamepadPort1TeamPlayerPort2), // J. League Pro Striker Perfect (Japan)
@"6f8cddb3775b588b49d13e7c62d08e86" : @(GamepadPort1TeamPlayerPort2), // Pepenga Pengo (Japan)
@"61c6f43629f218f75e9e78ff2e59bf55" : @(GamepadPort1TeamPlayerPort2), // Sega Sports 1 (Europe)
@"7bb99ff11b04544600ffe56dc79d72b3" : @(GamepadPort1TeamPlayerPort2), // Wimbledon Championship Tennis (Europe)
@"dd43c4cfd5958baeb9b4ddd5619f7255" : @(GamepadPort1TeamPlayerPort2), // Wimbledon Championship Tennis (Japan)
@"7978bb18dc7c6269f6b5c2178b93b407" : @(GamepadPort1TeamPlayerPort2), // Wimbledon Championship Tennis (USA)
// 1-5 Players
@"441b7e9c9811e22458660eb73975569c" : @(GamepadPort1TeamPlayerPort2), // Columns III (USA)
@"eeb557cd38ad00d6b4df48585098269a" : @(GamepadPort1TeamPlayerPort2), // Columns III - Taiketsu! Columns World (Japan, Korea)
@"b3ed61c2da404c31d2a5b6f6ada7b7ff" : @(GamepadPort1TeamPlayerPort2), // NBA Action '94 (USA)
@"dc9117965c0c3fcb9d28eb826082b223" : @(GamepadPort1TeamPlayerPort2), // NBA Action '95 Starring David Robinson (USA, Europe)
@"8147342e86d065fc240f09c803eb81b9" : @(TeamPlayerPort1TeamPlayerPort2), // NFL Quarterback Club (World)
@"8b99a84e9e661dccf4f79dbd7b149953" : @(TeamPlayerPort1TeamPlayerPort2), // NFL Quarterback Club 96 (USA, Europe)
@"b21b69f718115b502d10481e1f6ecc0b" : @(GamepadPort1TeamPlayerPort2), // Party Quiz Mega Q (Japan)
// 1-8 Players
@"a2b23303055f28e68afce7b7e2ea9edf" : @(TeamPlayerPort1TeamPlayerPort2), // Double Dribble - The Playoff Edition (USA)
@"a4a4e29f3540d3a11cdd8ee391069841" : @(TeamPlayerPort1TeamPlayerPort2), // Fever Pitch Soccer (Europe) (En,Fr,De,Es,It)
@"fb303d5d08b2ea748fe7aced9c0100fd" : @(TeamPlayerPort1TeamPlayerPort2), // Head-On Soccer (USA)
@"8bc39c10ed8d26d53a0f24f5daca81c8" : @(TeamPlayerPort1TeamPlayerPort2), // Hyper Dunk (Europe)
@"008bcd6a3fc35015df0851e996ce80b4" : @(TeamPlayerPort1TeamPlayerPort2), // Hyper Dunk - The Playoff Edition (Japan)
@"494d00e7c0a3ee5448e6b82fa091bac8" : @(TeamPlayerPort1TeamPlayerPort2), // International Superstar Soccer Deluxe (Europe)
@"e4392bd5e77321e8ec6e76a142e9536b" : @(TeamPlayerPort1TeamPlayerPort2), // Mega Bomberman - Special 8-Player-Demo (Europe) (Proto)
@"3426fc8802e1a385dc227b9dde59cbe4" : @(TeamPlayerPort1TeamPlayerPort2), // Ultimate Soccer (Europe) (En,Fr,De,Es,It)
// 1-4 Players EA 4-Way Play
@"29d948108a1c768c20af6796ab9ffc47" : @(EA4WayPlay), // Australian Rugby League (Europe)
@"1d51bbd116b76c6fdd6b7dd4c80e4957" : @(EA4WayPlay), // Bill Walsh College Football (USA, Europe)
@"585030d462ab6de4c79dc434141d16e2" : @(EA4WayPlay), // Bill Walsh College Football 95 (USA)
@"ac51f4585a42cba91d04f667dd1fd60a" : @(EA4WayPlay), // Coach K College Basketball (USA)
@"f54889e7ce17227d398669f9f4e7881d" : @(EA4WayPlay), // College Football USA 96 (USA)
@"dcb35bb9064171f07bb8b49d43c24d5b" : @(EA4WayPlay), // College Football USA 97 (USA)
@"64c2a99aba71e7796fd12546071592cc" : @(EA4WayPlay), // Elitserien 95 (Sweden)
@"add607e0dd5b9f294bb5a246d8946aed" : @(EA4WayPlay), // Elitserien 96 (Sweden)
@"22db8020749dd63b14c382b198ee1422" : @(EA4WayPlay), // ESPN National Hockey Night (USA)
@"3c7380bea3c1d479e5604006eab86961" : @(EA4WayPlay), // FIFA 98 - Road to World Cup (Europe) (En,Fr,Es,It,Sv)
@"a1546250206aafa61536b434e31cd568" : @(EA4WayPlay), // FIFA International Soccer (Japan) (En,Ja)
@"8a53e4db0da7ee312c1e89d449eb7b1e" : @(EA4WayPlay), // FIFA International Soccer (USA, Europe) (En,Fr,De,Es)