32 Commits

Author SHA1 Message Date
clobber c415a7bcf9 Bump version for sparkle updater 2016-07-01 12:03:10 -05:00
clobber 0d9d9a0279 Limit rewind buffer to 60 seconds to reduce memory use 2016-06-30 01:32:14 -05:00
clobber 62abcc0821 Sync with upstream https://github.com/ekeeke/Genesis-Plus-GX/commit/101afae1373c8fad6477164968f9fa992bc38522 2016-06-28 20:49:27 -05:00
clobber 74518f6ab9 Sync with upstream https://github.com/ekeeke/Genesis-Plus-GX/commit/0b27a42d2fc2def7057b604f12e56ec7603c8ab5 2015-12-15 20:27:44 -06:00
clobber 7604bd4ff2 Clean up state saving and serialization. 2015-12-12 17:01:35 -08:00
clobber a8931b7031 Bump version 2015-12-01 00:40:48 -06:00
clobber 42b6de9d79 Sync with upstream https://github.com/ekeeke/Genesis-Plus-GX/commit/6b1d80b6a000a57a23d9b05da1e98ffdb66613d2 2015-12-01 00:38:20 -06:00
Alexander Strange 4b31ce20c9 Update projects - fix debug builds, make deployment 10.11, enable objc-arc properly, build faster 2015-10-17 13:04:19 -07:00
clobber d85704c3b3 Turn off GCC_NO_COMMON_BLOCKS 2015-10-09 19:33:44 -05:00
Christoph Leimbrock dc6baf1ee8 Fix some warning and adjust project settings. 2015-10-06 22:04:34 +02:00
clobber e44c34df15 Support menacer and justifier 2015-06-15 19:17:49 -05:00
clobber c43bcd75af Force system region to Japan if user locale is Japan and the cart appears to be world/multi-region
This fixes localization issues with games such as Bare Knuckle/Streets of Rage, Senjou no Ookami II/Mercs and Tatsujin/Truxton.
Unfortunately the 'country' header in carts are not very accurate so this is the best we can do without a full list of world/multi-region carts and their hashes in the implementation.
2015-06-12 22:50:45 -05:00
clobber 78a248c4b2 Fix multiplayer input for J-Cart games 2015-06-07 19:05:57 -05:00
clobber 074c0207a1 Automatically enable Multitaps (Sega Team Player/Sega Tap and EA 4-Way Play) and Six Button Controller where supported 2015-06-07 01:25:05 -05:00
clobber 86fad10f9e Temp player 2 input fix 2015-05-30 22:50:18 -05:00
clobber 3c98cd5268 Redo implementation 2015-05-28 22:40:41 -05:00
Kyle Lacy 24fb9ecb1c Add plist properties to support rewinding 2015-03-04 01:18:29 -08:00
Kyle Lacy 5f0157cffb Add state serialization/deserialization 2015-03-04 01:18:17 -08:00
clobber 5feb84d0d3 Fix build error in block.h affecting some 2014-08-18 00:12:24 -05:00
clobber 9126497d1d Use 32BPP rendering 2014-08-12 22:47:32 -05:00
clobber 40d8db80bd Force lowercase block.h 2014-07-29 00:17:43 -05:00
clobber 599dc3eee0 Bump version in order for sparkle updater to work. Core is still 1.7.4 r878 2014-07-26 22:18:17 -05:00
clobber e6d281c9aa Sync with upstream r878 2014-07-26 22:11:18 -05:00
clobber 806a2b3580 Uppercase cheat input 2014-07-16 14:57:27 -05:00
clobber f32a177e71 Use proper biosDirectoryPath 2014-07-16 14:44:40 -05:00
clobber 816e76e4f1 Full enable/disable support for cheats 2014-07-16 02:52:12 -05:00
clobber 7f8027bab7 Bump version in order for sparkle updater to work. Core is still 1.7.4 2014-05-30 15:36:21 -05:00
clobber e1506fed7b Add OEGameCoreOptions for multi-system options and required bios/system files per core
Options:
OEGameCoreHasGlitches - Compatibility and graphics issues; core is WIP. Shows warning at core launch.
OEGameCoreRequiresFiles - Needs bios or system files. Use OERequiredFiles array of dictionaries.
OEGameCoreSaveStatesNotSupported - Save states are not supported. Disables save UI in HUD.
OEGameCoreSupportsCheatCode - Cheat codes are supported. Enables cheat UI in HUD.
2014-05-26 02:05:51 -05:00
clobber d6337fb5b3 Build fix for new compiler/xcode 5.1 2014-04-21 17:59:33 -05:00
clobber 818519ea85 Add error: parameter to -loadFileAtPath: method. 2014-02-08 14:23:46 -08:00
Alexander Strange 7c14330152 Compilation speed: enable modules 2014-01-19 22:36:37 -08:00
clobber 61eb9a6b5d Update spakle update URL and remove DSA key 2013-12-21 21:32:20 -06:00
78 changed files with 6034 additions and 5621 deletions
+1 -2
View File
@@ -1,6 +1,5 @@
/*
Copyright (c) 2009, OpenEmu Team
Copyright (c) 2015, OpenEmu Team
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
+1313 -286
View File
File diff suppressed because it is too large Load Diff
+64 -95
View File
@@ -35,10 +35,10 @@
/* End PBXAggregateTarget section */
/* Begin PBXBuildFile section */
82287C09101E9C2C0072172D /* libz.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = 82287C08101E9C2C0072172D /* libz.dylib */; };
82287C39101E9DB40072172D /* GenPlusGameCore.m in Sources */ = {isa = PBXBuildFile; fileRef = 82287C34101E9DB40072172D /* GenPlusGameCore.m */; };
8230C7F110AFCBA200412F24 /* config.yaml in CopyFiles */ = {isa = PBXBuildFile; fileRef = 8230C7E510AFCB6200412F24 /* config.yaml */; };
8230C81910AFCCB700412F24 /* dsa_pub.pem in Resources */ = {isa = PBXBuildFile; fileRef = 8230C81810AFCCB700412F24 /* dsa_pub.pem */; };
879243AE1C0D044B0064C515 /* xe_1ap.c in Sources */ = {isa = PBXBuildFile; fileRef = 879243AC1C0D044B0064C515 /* xe_1ap.c */; };
879243B11C0D05120064C515 /* graphic_board.c in Sources */ = {isa = PBXBuildFile; fileRef = 879243AF1C0D05120064C515 /* graphic_board.c */; };
87E0514D1B18092700E870E1 /* scrc32.c in Sources */ = {isa = PBXBuildFile; fileRef = 87E0514B1B18092700E870E1 /* scrc32.c */; };
8D5B49B0048680CD000E48DA /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = 089C167DFE841241C02AAC07 /* InfoPlist.strings */; };
8D5B49B4048680CD000E48DA /* Cocoa.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1058C7ADFEA557BF11CA2CBB /* Cocoa.framework */; };
941FF4F9162A4BAE005A9427 /* eeprom_93c.c in Sources */ = {isa = PBXBuildFile; fileRef = 941FF4F3162A4BAE005A9427 /* eeprom_93c.c */; };
@@ -54,7 +54,6 @@
948DA2B615AB93FA00C0EA78 /* terebi_oekaki.c in Sources */ = {isa = PBXBuildFile; fileRef = 948DA2B415AB93FA00C0EA78 /* terebi_oekaki.c */; };
948DA2BC15AB954800C0EA78 /* ym2413.c in Sources */ = {isa = PBXBuildFile; fileRef = 948DA2BA15AB954800C0EA78 /* ym2413.c */; };
948DA2BE15AB98D600C0EA78 /* s68kcpu.c in Sources */ = {isa = PBXBuildFile; fileRef = 948DA2BD15AB98D600C0EA78 /* s68kcpu.c */; };
948DA2CE15ABCFDD00C0EA78 /* libretro.c in Sources */ = {isa = PBXBuildFile; fileRef = 948DA2C615ABC57C00C0EA78 /* libretro.c */; };
94ED8A9214CF933700FF8901 /* areplay.c in Sources */ = {isa = PBXBuildFile; fileRef = 94ED896A14CF933600FF8901 /* areplay.c */; };
94ED8A9414CF933700FF8901 /* ggenie.c in Sources */ = {isa = PBXBuildFile; fileRef = 94ED896E14CF933600FF8901 /* ggenie.c */; };
94ED8A9514CF933700FF8901 /* md_cart.c in Sources */ = {isa = PBXBuildFile; fileRef = 94ED897014CF933600FF8901 /* md_cart.c */; };
@@ -73,7 +72,6 @@
94ED8B1F14CF933800FF8901 /* paddle.c in Sources */ = {isa = PBXBuildFile; fileRef = 94ED8A2014CF933700FF8901 /* paddle.c */; };
94ED8B2014CF933800FF8901 /* sportspad.c in Sources */ = {isa = PBXBuildFile; fileRef = 94ED8A2214CF933700FF8901 /* sportspad.c */; };
94ED8B2114CF933800FF8901 /* teamplayer.c in Sources */ = {isa = PBXBuildFile; fileRef = 94ED8A2414CF933700FF8901 /* teamplayer.c */; };
94ED8B2214CF933800FF8901 /* xe_a1p.c in Sources */ = {isa = PBXBuildFile; fileRef = 94ED8A2614CF933700FF8901 /* xe_a1p.c */; };
94ED8B2314CF933800FF8901 /* io_ctrl.c in Sources */ = {isa = PBXBuildFile; fileRef = 94ED8A2814CF933700FF8901 /* io_ctrl.c */; };
94ED8B2414CF933800FF8901 /* loadrom.c in Sources */ = {isa = PBXBuildFile; fileRef = 94ED8A2A14CF933700FF8901 /* loadrom.c */; };
94ED8B2514CF933800FF8901 /* m68kcpu.c in Sources */ = {isa = PBXBuildFile; fileRef = 94ED8A2F14CF933700FF8901 /* m68kcpu.c */; };
@@ -122,7 +120,6 @@
dstPath = "";
dstSubfolderSpec = 16;
files = (
8230C7F110AFCBA200412F24 /* config.yaml in CopyFiles */,
);
runOnlyForDeploymentPostprocessing = 0;
};
@@ -133,13 +130,17 @@
089C167EFE841241C02AAC07 /* English */ = {isa = PBXFileReference; fileEncoding = 10; lastKnownFileType = text.plist.strings; name = English; path = English.lproj/InfoPlist.strings; sourceTree = "<group>"; };
089C167FFE841241C02AAC07 /* AppKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AppKit.framework; path = /System/Library/Frameworks/AppKit.framework; sourceTree = "<absolute>"; };
1058C7ADFEA557BF11CA2CBB /* Cocoa.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Cocoa.framework; path = /System/Library/Frameworks/Cocoa.framework; sourceTree = "<absolute>"; };
32DBCF630370AF2F00C91783 /* GenesisPlus_Prefix.pch */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GenesisPlus_Prefix.pch; sourceTree = "<group>"; };
82287C08101E9C2C0072172D /* libz.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = libz.dylib; path = usr/lib/libz.dylib; sourceTree = SDKROOT; };
82287C33101E9DB40072172D /* GenPlusGameCore.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GenPlusGameCore.h; sourceTree = "<group>"; };
82287C34101E9DB40072172D /* GenPlusGameCore.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GenPlusGameCore.m; sourceTree = "<group>"; };
8230C7E510AFCB6200412F24 /* config.yaml */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = config.yaml; sourceTree = "<group>"; };
8230C81810AFCCB700412F24 /* dsa_pub.pem */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = dsa_pub.pem; sourceTree = "<group>"; };
825C7E44101FAB7F0072187B /* Carbon.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Carbon.framework; path = System/Library/Frameworks/Carbon.framework; sourceTree = SDKROOT; };
879243AC1C0D044B0064C515 /* xe_1ap.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = xe_1ap.c; sourceTree = "<group>"; };
879243AD1C0D044B0064C515 /* xe_1ap.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = xe_1ap.h; sourceTree = "<group>"; };
879243AF1C0D05120064C515 /* graphic_board.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = graphic_board.c; sourceTree = "<group>"; };
879243B01C0D05120064C515 /* graphic_board.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = graphic_board.h; sourceTree = "<group>"; };
87E0514A1B18092700E870E1 /* osd.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = osd.h; sourceTree = "<group>"; };
87E0514B1B18092700E870E1 /* scrc32.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = scrc32.c; sourceTree = "<group>"; };
87E0514C1B18092700E870E1 /* scrc32.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = scrc32.h; sourceTree = "<group>"; };
8D5B49B6048680CD000E48DA /* GenesisPlus.oecoreplugin */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = GenesisPlus.oecoreplugin; sourceTree = BUILT_PRODUCTS_DIR; };
8D5B49B7048680CD000E48DA /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
941FF4F3162A4BAE005A9427 /* eeprom_93c.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = eeprom_93c.c; sourceTree = "<group>"; };
@@ -168,8 +169,6 @@
948DA2BA15AB954800C0EA78 /* ym2413.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = ym2413.c; sourceTree = "<group>"; };
948DA2BB15AB954800C0EA78 /* ym2413.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ym2413.h; sourceTree = "<group>"; };
948DA2BD15AB98D600C0EA78 /* s68kcpu.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = s68kcpu.c; sourceTree = "<group>"; };
948DA2C615ABC57C00C0EA78 /* libretro.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = libretro.c; path = libretro/libretro.c; sourceTree = SOURCE_ROOT; };
948DA2C715ABC57C00C0EA78 /* libretro.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = libretro.h; path = libretro/libretro.h; sourceTree = SOURCE_ROOT; };
94ED896A14CF933600FF8901 /* areplay.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = areplay.c; sourceTree = "<group>"; };
94ED896B14CF933600FF8901 /* areplay.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = areplay.h; sourceTree = "<group>"; };
94ED896E14CF933600FF8901 /* ggenie.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = ggenie.c; sourceTree = "<group>"; };
@@ -205,8 +204,6 @@
94ED8A2314CF933700FF8901 /* sportspad.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = sportspad.h; sourceTree = "<group>"; };
94ED8A2414CF933700FF8901 /* teamplayer.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = teamplayer.c; sourceTree = "<group>"; };
94ED8A2514CF933700FF8901 /* teamplayer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = teamplayer.h; sourceTree = "<group>"; };
94ED8A2614CF933700FF8901 /* xe_a1p.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = xe_a1p.c; sourceTree = "<group>"; };
94ED8A2714CF933700FF8901 /* xe_a1p.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = xe_a1p.h; sourceTree = "<group>"; };
94ED8A2814CF933700FF8901 /* io_ctrl.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = io_ctrl.c; sourceTree = "<group>"; };
94ED8A2914CF933700FF8901 /* io_ctrl.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = io_ctrl.h; sourceTree = "<group>"; };
94ED8A2A14CF933700FF8901 /* loadrom.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; lineEnding = 2; path = loadrom.c; sourceTree = "<group>"; };
@@ -256,13 +253,6 @@
94ED8A8514CF933700FF8901 /* osd_cpu.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = osd_cpu.h; sourceTree = "<group>"; };
94ED8A8614CF933700FF8901 /* z80.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = z80.c; sourceTree = "<group>"; };
94ED8A8714CF933700FF8901 /* z80.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = z80.h; sourceTree = "<group>"; };
94ED8A8914CF933700FF8901 /* config.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = config.c; sourceTree = "<group>"; };
94ED8A8A14CF933700FF8901 /* config.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = config.h; sourceTree = "<group>"; };
94ED8A8B14CF933700FF8901 /* error.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = error.c; sourceTree = "<group>"; };
94ED8A8C14CF933700FF8901 /* error.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = error.h; sourceTree = "<group>"; };
94ED8A8D14CF933700FF8901 /* fileio.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = fileio.c; sourceTree = "<group>"; };
94ED8A8E14CF933700FF8901 /* fileio.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = fileio.h; sourceTree = "<group>"; };
94ED8A8F14CF933700FF8901 /* osd.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = osd.h; sourceTree = "<group>"; };
C6B948191365164700A425F0 /* OEGenesisSystemResponderClient.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = OEGenesisSystemResponderClient.h; path = ../OpenEmu/Genesis/OEGenesisSystemResponderClient.h; sourceTree = "<group>"; };
C6D120F1171130E700E868A8 /* OpenEmuBase.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; path = OpenEmuBase.framework; sourceTree = BUILT_PRODUCTS_DIR; };
D2F7E65807B2D6F200F64583 /* CoreData.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreData.framework; path = /System/Library/Frameworks/CoreData.framework; sourceTree = "<absolute>"; };
@@ -273,9 +263,8 @@
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
8D5B49B4048680CD000E48DA /* Cocoa.framework in Frameworks */,
82287C09101E9C2C0072172D /* libz.dylib in Frameworks */,
C6D120F2171130E700E868A8 /* OpenEmuBase.framework in Frameworks */,
8D5B49B4048680CD000E48DA /* Cocoa.framework in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
};
@@ -308,8 +297,6 @@
089C167CFE841241C02AAC07 /* Resources */ = {
isa = PBXGroup;
children = (
8230C81810AFCCB700412F24 /* dsa_pub.pem */,
8230C7E510AFCB6200412F24 /* config.yaml */,
8D5B49B7048680CD000E48DA /* Info.plist */,
089C167DFE841241C02AAC07 /* InfoPlist.strings */,
);
@@ -319,8 +306,10 @@
08FB77AFFE84173DC02AAC07 /* Classes */ = {
isa = PBXGroup;
children = (
87E0514A1B18092700E870E1 /* osd.h */,
87E0514B1B18092700E870E1 /* scrc32.c */,
87E0514C1B18092700E870E1 /* scrc32.h */,
94ED896814CF933600FF8901 /* genplusgx_source */,
94ED8A8814CF933700FF8901 /* openemu */,
C6B948191365164700A425F0 /* OEGenesisSystemResponderClient.h */,
946C18AE17148D5200C64BF9 /* OESegaCDSystemResponderClient.h */,
82287C33101E9DB40072172D /* GenPlusGameCore.h */,
@@ -359,7 +348,6 @@
32C88E010371C26100C91783 /* Other Sources */ = {
isa = PBXGroup;
children = (
32DBCF630370AF2F00C91783 /* GenesisPlus_Prefix.pch */,
);
name = "Other Sources";
sourceTree = "<group>";
@@ -386,8 +374,6 @@
94ED896814CF933600FF8901 /* genplusgx_source */ = {
isa = PBXGroup;
children = (
948DA2C615ABC57C00C0EA78 /* libretro.c */,
948DA2C715ABC57C00C0EA78 /* libretro.h */,
94ED896914CF933600FF8901 /* cart_hw */,
948DA2A015AB906400C0EA78 /* cd_hw */,
94ED897D14CF933600FF8901 /* genesis.c */,
@@ -467,6 +453,8 @@
94ED8A1714CF933700FF8901 /* activator.h */,
94ED8A1814CF933700FF8901 /* gamepad.c */,
94ED8A1914CF933700FF8901 /* gamepad.h */,
879243AF1C0D05120064C515 /* graphic_board.c */,
879243B01C0D05120064C515 /* graphic_board.h */,
94ED8A1A14CF933700FF8901 /* input.c */,
94ED8A1B14CF933700FF8901 /* input.h */,
94ED8A1C14CF933700FF8901 /* lightgun.c */,
@@ -481,8 +469,8 @@
94ED8A2514CF933700FF8901 /* teamplayer.h */,
948DA2B415AB93FA00C0EA78 /* terebi_oekaki.c */,
948DA2B515AB93FA00C0EA78 /* terebi_oekaki.h */,
94ED8A2614CF933700FF8901 /* xe_a1p.c */,
94ED8A2714CF933700FF8901 /* xe_a1p.h */,
879243AC1C0D044B0064C515 /* xe_1ap.c */,
879243AD1C0D044B0064C515 /* xe_1ap.h */,
);
path = input_hw;
sourceTree = "<group>";
@@ -548,20 +536,6 @@
path = z80;
sourceTree = "<group>";
};
94ED8A8814CF933700FF8901 /* openemu */ = {
isa = PBXGroup;
children = (
94ED8A8914CF933700FF8901 /* config.c */,
94ED8A8A14CF933700FF8901 /* config.h */,
94ED8A8B14CF933700FF8901 /* error.c */,
94ED8A8C14CF933700FF8901 /* error.h */,
94ED8A8D14CF933700FF8901 /* fileio.c */,
94ED8A8E14CF933700FF8901 /* fileio.h */,
94ED8A8F14CF933700FF8901 /* osd.h */,
);
path = openemu;
sourceTree = "<group>";
};
/* End PBXGroup section */
/* Begin PBXNativeTarget section */
@@ -590,7 +564,7 @@
isa = PBXProject;
attributes = {
BuildIndependentTargetsInParallel = YES;
LastUpgradeCheck = 0430;
LastUpgradeCheck = 0700;
};
buildConfigurationList = 1DEB913E08733D840010E9CD /* Build configuration list for PBXProject "GenesisPlus" */;
compatibilityVersion = "Xcode 3.2";
@@ -616,7 +590,6 @@
buildActionMask = 2147483647;
files = (
8D5B49B0048680CD000E48DA /* InfoPlist.strings in Resources */,
8230C81910AFCCB700412F24 /* dsa_pub.pem in Resources */,
94ED8A9814CF933700FF8901 /* imageformat.txt in Resources */,
94ED8A9B14CF933700FF8901 /* svpdoc.txt in Resources */,
94ED8B2B14CF933800FF8901 /* changes.txt in Resources */,
@@ -663,7 +636,7 @@
buildActionMask = 2147483647;
files = (
82287C39101E9DB40072172D /* GenPlusGameCore.m in Sources */,
948DA2CE15ABCFDD00C0EA78 /* libretro.c in Sources */,
879243B11C0D05120064C515 /* graphic_board.c in Sources */,
94ED8A9214CF933700FF8901 /* areplay.c in Sources */,
94ED8A9414CF933700FF8901 /* ggenie.c in Sources */,
94ED8A9514CF933700FF8901 /* md_cart.c in Sources */,
@@ -686,15 +659,16 @@
94ED8B2014CF933800FF8901 /* sportspad.c in Sources */,
94ED8B2114CF933800FF8901 /* teamplayer.c in Sources */,
948DA2B615AB93FA00C0EA78 /* terebi_oekaki.c in Sources */,
94ED8B2214CF933800FF8901 /* xe_a1p.c in Sources */,
94ED8A9C14CF933700FF8901 /* genesis.c in Sources */,
94ED8B2314CF933800FF8901 /* io_ctrl.c in Sources */,
94ED8B2414CF933800FF8901 /* loadrom.c in Sources */,
879243AE1C0D044B0064C515 /* xe_1ap.c in Sources */,
94ED8B2814CF933800FF8901 /* mem68k.c in Sources */,
94ED8B2914CF933800FF8901 /* membnk.c in Sources */,
94ED8B2A14CF933800FF8901 /* memz80.c in Sources */,
94ED8B3714CF933800FF8901 /* state.c in Sources */,
94ED8B3814CF933800FF8901 /* system.c in Sources */,
87E0514D1B18092700E870E1 /* scrc32.c in Sources */,
94ED8B4D14CF933800FF8901 /* vdp_ctrl.c in Sources */,
94ED8B4E14CF933800FF8901 /* vdp_render.c in Sources */,
94ED8B2514CF933800FF8901 /* m68kcpu.c in Sources */,
@@ -744,35 +718,19 @@
1DEB913B08733D840010E9CD /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = YES;
ALWAYS_SEARCH_USER_PATHS = NO;
CLANG_ENABLE_OBJC_ARC = YES;
COMBINE_HIDPI_IMAGES = YES;
GCC_C_LANGUAGE_STANDARD = gnu99;
HEADER_SEARCH_PATHS = (
"\"$(SRCROOT)/../OpenEmu\"/**",
"\"$(SRCROOT)/openemu\"/**",
"\"$(SRCROOT)/genplusgx_source\"/**",
"\"$(SRCROOT)/genplusgx_source/sound\"/**",
"\"$(SRCROOT)/genplusgx_source/input_hw\"/**",
"\"$(SRCROOT)/genplusgx_source/cart_hw\"/**",
"\"$(SRCROOT)/genplusgx_source/cd_hw\"/**",
"\"$(SRCROOT)/genplusgx_source/cart_hw/svp\"/**",
"\"$(SRCROOT)/genplusgx_source/m68k\"/**",
"\"$(SRCROOT)/genplusgx_source/z80\"/**",
"\"$(SRCROOT)/genplusgx_source/ntsc\"/**",
);
INFOPLIST_FILE = Info.plist;
INSTALL_PATH = "\"$(USER_LIBRARY_DIR)/Application Support/OpenEmu/Cores\"";
OTHER_CFLAGS = (
"-fPIC",
"-DLSB_FIRST",
"-DHAVE_ZLIB",
"-DUSE_15BPP_RENDERING",
"-DNDEBUG",
"-D__LIBRETRO__",
"-DUSE_32BPP_RENDERING",
);
PRODUCT_BUNDLE_IDENTIFIER = "org.openemu.${PRODUCT_NAME:identifier}";
PRODUCT_NAME = GenesisPlus;
SKIP_INSTALL = YES;
USER_HEADER_SEARCH_PATHS = "\"$(PROJECT_DIR)\"";
WRAPPER_EXTENSION = oecoreplugin;
};
name = Debug;
@@ -780,35 +738,19 @@
1DEB913C08733D840010E9CD /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = YES;
ALWAYS_SEARCH_USER_PATHS = NO;
CLANG_ENABLE_OBJC_ARC = YES;
COMBINE_HIDPI_IMAGES = YES;
GCC_C_LANGUAGE_STANDARD = gnu99;
HEADER_SEARCH_PATHS = (
"\"$(SRCROOT)/../OpenEmu\"/**",
"\"$(SRCROOT)/openemu\"/**",
"\"$(SRCROOT)/genplusgx_source\"/**",
"\"$(SRCROOT)/genplusgx_source/sound\"/**",
"\"$(SRCROOT)/genplusgx_source/input_hw\"/**",
"\"$(SRCROOT)/genplusgx_source/cart_hw\"/**",
"\"$(SRCROOT)/genplusgx_source/cd_hw\"/**",
"\"$(SRCROOT)/genplusgx_source/cart_hw/svp\"/**",
"\"$(SRCROOT)/genplusgx_source/m68k\"/**",
"\"$(SRCROOT)/genplusgx_source/z80\"/**",
"\"$(SRCROOT)/genplusgx_source/ntsc\"/**",
);
INFOPLIST_FILE = Info.plist;
INSTALL_PATH = "\"$(USER_LIBRARY_DIR)/Application Support/OpenEmu/Cores\"";
OTHER_CFLAGS = (
"-fPIC",
"-DLSB_FIRST",
"-DHAVE_ZLIB",
"-DUSE_15BPP_RENDERING",
"-DNDEBUG",
"-D__LIBRETRO__",
"-DUSE_32BPP_RENDERING",
);
PRODUCT_BUNDLE_IDENTIFIER = "org.openemu.${PRODUCT_NAME:identifier}";
PRODUCT_NAME = GenesisPlus;
SKIP_INSTALL = YES;
USER_HEADER_SEARCH_PATHS = "\"$(PROJECT_DIR)\"";
WRAPPER_EXTENSION = oecoreplugin;
};
name = Release;
@@ -816,17 +758,32 @@
1DEB913F08733D840010E9CD /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
ARCHS = "$(ARCHS_STANDARD_64_BIT)";
CLANG_ENABLE_MODULES = YES;
CLANG_ENABLE_OBJC_ARC = YES;
CLANG_WARN_BOOL_CONVERSION = YES;
CLANG_WARN_CONSTANT_CONVERSION = YES;
CLANG_WARN_EMPTY_BODY = YES;
CLANG_WARN_ENUM_CONVERSION = YES;
CLANG_WARN_INT_CONVERSION = YES;
CLANG_WARN_UNREACHABLE_CODE = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
DEAD_CODE_STRIPPING = YES;
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
ENABLE_STRICT_OBJC_MSGSEND = YES;
ENABLE_TESTABILITY = NO;
GCC_C_LANGUAGE_STANDARD = c99;
GCC_INCREASE_PRECOMPILED_HEADER_SHARING = YES;
GCC_OPTIMIZATION_LEVEL = 0;
GCC_SYMBOLS_PRIVATE_EXTERN = YES;
GCC_VERSION = com.apple.compilers.llvm.clang.1_0;
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
GCC_WARN_ABOUT_RETURN_TYPE = YES;
GCC_WARN_UNDECLARED_SELECTOR = YES;
GCC_WARN_UNINITIALIZED_AUTOS = YES;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
MACOSX_DEPLOYMENT_TARGET = 10.7;
OTHER_CFLAGS = "-DOSD_CPU_H";
MACOSX_DEPLOYMENT_TARGET = 10.11;
ONLY_ACTIVE_ARCH = YES;
SDKROOT = macosx;
};
name = Debug;
@@ -834,18 +791,31 @@
1DEB914008733D840010E9CD /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
ARCHS = "$(ARCHS_STANDARD_64_BIT)";
CLANG_ENABLE_MODULES = YES;
CLANG_ENABLE_OBJC_ARC = YES;
CLANG_WARN_BOOL_CONVERSION = YES;
CLANG_WARN_CONSTANT_CONVERSION = YES;
CLANG_WARN_EMPTY_BODY = YES;
CLANG_WARN_ENUM_CONVERSION = YES;
CLANG_WARN_INT_CONVERSION = YES;
CLANG_WARN_UNREACHABLE_CODE = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
DEAD_CODE_STRIPPING = YES;
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
ENABLE_STRICT_OBJC_MSGSEND = YES;
ENABLE_TESTABILITY = NO;
GCC_C_LANGUAGE_STANDARD = c99;
GCC_INCREASE_PRECOMPILED_HEADER_SHARING = YES;
GCC_OPTIMIZATION_LEVEL = 3;
GCC_SYMBOLS_PRIVATE_EXTERN = YES;
GCC_VERSION = com.apple.compilers.llvm.clang.1_0;
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
GCC_WARN_ABOUT_RETURN_TYPE = YES;
GCC_WARN_UNDECLARED_SELECTOR = YES;
GCC_WARN_UNINITIALIZED_AUTOS = YES;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
MACOSX_DEPLOYMENT_TARGET = 10.7;
OTHER_CFLAGS = "-DOSD_CPU_H";
MACOSX_DEPLOYMENT_TARGET = 10.11;
SDKROOT = macosx;
};
name = Release;
@@ -880,7 +850,6 @@
8230C7D310AFCB0600412F24 /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
ARCHS = "$(ARCHS_STANDARD_64_BIT)";
INSTALL_PATH = "\"$(USER_LIBRARY_DIR)/Application Support/OpenEmu/Cores\"";
PRODUCT_NAME = Distribution;
SKIP_INSTALL = YES;
+64 -10
View File
@@ -9,7 +9,7 @@
<key>CFBundleIconFile</key>
<string></string>
<key>CFBundleIdentifier</key>
<string>org.openemu.${PRODUCT_NAME:identifier}</string>
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
@@ -19,17 +19,73 @@
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>1.7.4</string>
<string>1.7.4.4</string>
<key>NSPrincipalClass</key>
<string>OEGameCoreController</string>
<key>OEGameCoreClass</key>
<string>GenPlusGameCore</string>
<key>OEGameCoreOptions</key>
<dict>
<key>openemu.system.scd</key>
<dict>
<key>OEGameCoreRequiresFiles</key>
<true/>
<key>OEGameCoreRewindBufferSeconds</key>
<integer>60</integer>
<key>OEGameCoreRewindInterval</key>
<integer>0</integer>
<key>OEGameCoreSupportsCheatCode</key>
<true/>
<key>OEGameCoreSupportsRewinding</key>
<true/>
<key>OERequiredFiles</key>
<array>
<dict>
<key>Description</key>
<string>Mega-CD Model 1 (EU 921027) BIOS 1.00</string>
<key>MD5</key>
<string>e66fa1dc5820d254611fdcdba0662372</string>
<key>Name</key>
<string>BIOS_CD_E.bin</string>
<key>Size</key>
<integer>131072</integer>
</dict>
<dict>
<key>Description</key>
<string>Sega CD Model 1 (US 921011) BIOS 1.10</string>
<key>MD5</key>
<string>2efd74e3232ff260e371b99f84024f7f</string>
<key>Name</key>
<string>BIOS_CD_U.bin</string>
<key>Size</key>
<integer>131072</integer>
</dict>
<dict>
<key>Description</key>
<string>Mega-CD Model 1 (JP 911217) BIOS 1.00p</string>
<key>MD5</key>
<string>278a9397d192149e84e820ac621a8edd</string>
<key>Name</key>
<string>BIOS_CD_J.bin</string>
<key>Size</key>
<integer>131072</integer>
</dict>
</array>
</dict>
<key>openemu.system.sg</key>
<dict>
<key>OEGameCoreRewindBufferSeconds</key>
<integer>60</integer>
<key>OEGameCoreRewindInterval</key>
<integer>0</integer>
<key>OEGameCoreSupportsCheatCode</key>
<true/>
<key>OEGameCoreSupportsRewinding</key>
<true/>
</dict>
</dict>
<key>OEGameCorePlayerCount</key>
<string>2</string>
<key>OEGameCoreRequiresFiles</key>
<true/>
<key>OEGameCoreSupportsCheatCode</key>
<true/>
<string>8</string>
<key>OEProjectURL</key>
<string>http://code.google.com/p/genplus-gx</string>
<key>OESystemIdentifiers</key>
@@ -40,8 +96,6 @@
<key>SUEnableAutomaticChecks</key>
<string>1</string>
<key>SUFeedURL</key>
<string>http://openemu.org/updater/genesisplus_appcast.xml</string>
<key>SUPublicDSAKeyFile</key>
<string>dsa_pub.pem</string>
<string>https://raw.github.com/OpenEmu/OpenEmu-Update/master/genesisplus_appcast.xml</string>
</dict>
</plist>
-10
View File
@@ -1,10 +0,0 @@
build_now: 'YES'
create_core_path: 'YES'
download_base_url: http://github.com/downloads/openemu/openemu/
release_notes_base_url: http://openemu.org/category/releasenotes/genesisplus/
appcast_basefolder: '/Users/jweinberg/Desktop/Appcast'
appcast_xml_name: 'genesisplus_appcast.xml'
keychain_privkey_name: 'Sparkle Private Key'
css_file_name: 'rnotes.css'
bundle_extension: 'oecoreplugin'
-20
View File
@@ -1,20 +0,0 @@
-----BEGIN PUBLIC KEY-----
MIIDOjCCAi0GByqGSM44BAEwggIgAoIBAQD/nSuLzikeU6MrymSPr34AiU2RDJz6
0pm/3PPs27f6QTtbUAvGC13q6XWrE3HJU8Gz7RM0EJZGpiwb86LgqOJhjfQ7WKse
uaGdbHnvJEFsGqpKX7rnUWaWO3HAsKzDx4HzJqKupFEbTbzXl/GT3JMm+a3PXA3S
kyATydRPrX583Ih8iHO1zQs1pwp2AnUvaQXvp4QOLFWheH5napkDZBjc9B7H38dg
f4c0QqEXJw0lJbG26FxhpOWMiXwpWpOHSfb+XtmzpeTDIHxKPLMEdf2wc+xNC/M9
GdVBfM7+hCEhl1JGqNWPpT7ZzciX8Cxg+5/MIfx+BQ7xQ4wo1SN7y1bZAhUAuBcT
+ZsHbLXlR3uGHLIMg8boUKcCggEAGKgD56/tB6siFr5zEY+RTozPLmbBEcvhz5/p
hAQo7z7ODimZAA1MN1J7Hv7o1S5D9dpZuOnGhiXaN3Z50WdePb9LVH7twrB8v3Xn
ZOEHpumYNcYhvXrIx8LbhnMZmU27xSnrOQF9UfokRxGnXkNmlIwjT0NWqZCqQZwM
wVj1Bgld3YV7CpGTF3aGM6a0pk9LBB71PoczXAx0Cum87ouXXy3c8F/82RF9tgXE
ZBQ+7K2QXYPv9smbYDB+ZlsQ4VTOi3AReG5AeHTVWha3uaSFxY5vKpfau31iMRuT
b1VQ2HVynBpemwhAw4FFvj5dm94aN0Rrvq9BKM09DL4zoOlLogOCAQUAAoIBAE8B
I8z38GdbtswSoSV5JZ9z9cBMj/7x/sHi5ED9v1M8MD6AcxJSbo2cbK98xA3A9U22
6XFHthGReVLa0dyN3Ov+GhBdf8b4CBuebAAS4z8du2EvUFtwDUHorLIo2Qtq2SYR
wpznpB9+3g+z+8GZbzZkdm2mFBKa6GItj82qfEHwxB40aEBx7uQXzM3TH0rV8sMq
u91aAVUQuoiG2/IYWc5O34kKMlHUTt6+uuJiSG0ax8ysWE5XltCfSh/VJcGrzKU6
ZjGBzh8j5+KSXgoe9TuKlsnN5HDCZKaFTCvrxq889HJj0/ks4UrIF+meEyJvDt4P
O4HHoKRtUdLEBMcY0JA=
-----END PUBLIC KEY-----
+24 -39
View File
@@ -2,7 +2,7 @@
* Genesis Plus
* Action Replay / Pro Action Replay emulation
*
* Copyright (C) 2009-2011 Eke-Eke (Genesis Plus GX)
* Copyright (C) 2009-2014 Eke-Eke (Genesis Plus GX)
*
* Redistribution and use of this code or any derivative works are permitted
* provided that the following conditions are met:
@@ -60,7 +60,6 @@ static void ar_write_ram_8(uint32 address, uint32 data);
void areplay_init(void)
{
int size;
FILE *f;
memset(&action_replay,0,sizeof(action_replay));
@@ -69,38 +68,33 @@ void areplay_init(void)
action_replay.rom = cart.rom + 0x810000;
action_replay.ram = cart.rom + 0x830000;
/* Open Action Replay ROM */
f = fopen(AR_ROM,"rb");
if (f == NULL) return;
/* ROM size */
fseek(f, 0, SEEK_END);
size = ftell(f);
fseek(f, 0, SEEK_SET);
/* try to load Action Replay ROM file */
size = load_archive(AR_ROM, action_replay.rom, 0x20000, NULL);
/* detect Action Replay board type */
switch (size)
{
case 0x8000:
{
/* normal Action Replay (32K) */
action_replay.enabled = TYPE_AR;
/* internal registers mapped at $010000-$01ffff */
m68k.memory_map[0x01].write16 = ar_write_regs;
break;
if (!memcmp(action_replay.rom + 0x120, "ACTION REPLAY ", 16))
{
/* normal Action Replay (32K) */
action_replay.enabled = TYPE_AR;
/* internal registers mapped at $010000-$01ffff */
m68k.memory_map[0x01].write16 = ar_write_regs;
break;
}
}
case 0x10000:
case 0x20000:
{
/* read Stack Pointer */
uint8 sp[4];
fread(&sp, 4, 1, f);
fseek(f, 0, SEEK_SET);
/* Read stack pointer MSB */
uint8 sp = READ_BYTE(action_replay.rom, 0x01);
/* Detect board version */
if (sp[1] == 0x42)
if ((sp == 0x42) && !memcmp(action_replay.rom + 0x120, "ACTION REPLAY 2 ", 16))
{
/* PRO Action Replay 1 (64/128K) */
action_replay.enabled = TYPE_PRO1;
@@ -108,7 +102,7 @@ void areplay_init(void)
/* internal registers mapped at $010000-$01ffff */
m68k.memory_map[0x01].write16 = ar_write_regs;
}
else if (sp[1] == 0x60)
else if ((sp == 0x60) && !memcmp(action_replay.rom + 0x3c6, "ACTION REPLAY II", 16))
{
/* PRO Action Replay 2 (64K) */
action_replay.enabled = TYPE_PRO2;
@@ -120,11 +114,11 @@ void areplay_init(void)
/* internal RAM (64k), mapped at $420000-$42ffff or $600000-$60ffff */
if (action_replay.enabled)
{
m68k.memory_map[sp[1]].base = action_replay.ram;
m68k.memory_map[sp[1]].read8 = NULL;
m68k.memory_map[sp[1]].read16 = NULL;
m68k.memory_map[sp[1]].write8 = ar_write_ram_8;
m68k.memory_map[sp[1]].write16 = NULL;
m68k.memory_map[sp].base = action_replay.ram;
m68k.memory_map[sp].read8 = NULL;
m68k.memory_map[sp].read16 = NULL;
m68k.memory_map[sp].write8 = ar_write_ram_8;
m68k.memory_map[sp].write16 = NULL;
}
break;
}
@@ -135,16 +129,10 @@ void areplay_init(void)
}
}
#ifdef LSB_FIRST
if (action_replay.enabled)
{
/* Load ROM */
int i = 0;
for (i=0; i<size; i+=0x1000)
{
fread(action_replay.rom + i, 0x1000, 1, f);
}
#ifdef LSB_FIRST
int i;
for (i= 0; i<size; i+=2)
{
/* Byteswap ROM */
@@ -152,11 +140,8 @@ void areplay_init(void)
action_replay.rom[i] = action_replay.rom[i+1];
action_replay.rom[i+1] = temp;
}
#endif
}
/* Close ROM file */
fclose(f);
#endif
}
void areplay_shutdown(void)
+1 -1
View File
@@ -2,7 +2,7 @@
* Genesis Plus
* DATEL Action Replay / Pro Action Replay emulation
*
* Copyright (C) 2009-2011 Eke-Eke (Genesis Plus GX)
* Copyright (C) 2009-2014 Eke-Eke (Genesis Plus GX)
*
* Redistribution and use of this code or any derivative works are permitted
* provided that the following conditions are met:
File diff suppressed because it is too large Load Diff
+2 -2
View File
@@ -1,8 +1,8 @@
/****************************************************************************
* Genesis Plus
* I2C Serial EEPROM (24Cxx) support
* I2C Serial EEPROM (24Cxx) boards
*
* Copyright (C) 2007-2013 Eke-Eke (Genesis Plus GX)
* Copyright (C) 2007-2016 Eke-Eke (Genesis Plus GX)
*
* Redistribution and use of this code or any derivative works are permitted
* provided that the following conditions are met:
+17 -28
View File
@@ -2,7 +2,7 @@
* Genesis Plus
* Game Genie Hardware emulation
*
* Copyright (C) 2009-2011 Eke-Eke (Genesis Plus GX)
* Copyright (C) 2009-2014 Eke-Eke (Genesis Plus GX)
*
* Based on documentation from Charles McDonald
* (http://cgfm2.emuviews.com/txt/genie.txt)
@@ -58,44 +58,33 @@ static void ggenie_write_word(unsigned int address, unsigned int data);
static void ggenie_write_regs(unsigned int offset, unsigned int data);
void ggenie_init(void)
{
int i;
FILE *f;
{
memset(&ggenie,0,sizeof(ggenie));
/* Store Game Genie ROM (32k) above cartridge ROM + SRAM area */
if (cart.romsize > 0x810000) return;
ggenie.rom = cart.rom + 0x810000;
/* Open Game Genie ROM file */
f = fopen(GG_ROM,"rb");
if (f == NULL) return;
/* Load ROM */
for (i=0; i<0x8000; i+=0x1000)
/* Try to load Game Genie ROM file */
if (load_archive(GG_ROM, ggenie.rom, 0x8000, NULL) > 0)
{
fread(ggenie.rom + i, 0x1000, 1, f);
}
/* Close ROM file */
fclose(f);
#ifdef LSB_FIRST
for (i=0; i<0x8000; i+=2)
{
/* Byteswap ROM */
uint8 temp = ggenie.rom[i];
ggenie.rom[i] = ggenie.rom[i+1];
ggenie.rom[i+1] = temp;
}
int i;
for (i=0; i<0x8000; i+=2)
{
/* Byteswap ROM */
uint8 temp = ggenie.rom[i];
ggenie.rom[i] = ggenie.rom[i+1];
ggenie.rom[i+1] = temp;
}
#endif
/* $0000-$7fff mirrored into $8000-$ffff */
memcpy(ggenie.rom + 0x8000, ggenie.rom, 0x8000);
/* $0000-$7fff mirrored into $8000-$ffff */
memcpy(ggenie.rom + 0x8000, ggenie.rom, 0x8000);
/* set flag */
ggenie.enabled = 1;
/* Game Genie hardware is enabled */
ggenie.enabled = 1;
}
}
void ggenie_shutdown(void)
+1 -1
View File
@@ -2,7 +2,7 @@
* Genesis Plus
* Game Genie Hardware emulation
*
* Copyright (C) 2009-2011 Eke-Eke (Genesis Plus GX)
* Copyright (C) 2009-2014 Eke-Eke (Genesis Plus GX)
*
* Based on documentation from Charles McDonald
* (http://cgfm2.emuviews.com/txt/genie.txt)
+129 -122
View File
@@ -2,7 +2,7 @@
* Genesis Plus
* Mega Drive cartridge hardware support
*
* Copyright (C) 2007-2013 Eke-Eke (Genesis Plus GX)
* Copyright (C) 2007-2016 Eke-Eke (Genesis Plus GX)
*
* Many cartridge protections were initially documented by Haze
* (http://haze.mameworld.info/)
@@ -44,9 +44,6 @@
#include "shared.h"
#include "eeprom_i2c.h"
#include "eeprom_spi.h"
#include "gamepad.h"
#define CART_CNT (55)
/* Cart database entry */
typedef struct
@@ -60,6 +57,7 @@ typedef struct
/* Function prototypes */
static void mapper_sega_w(uint32 data);
static void mapper_512k_w(uint32 address, uint32 data);
static void mapper_ssf2_w(uint32 address, uint32 data);
static void mapper_sf001_w(uint32 address, uint32 data);
static void mapper_sf002_w(uint32 address, uint32 data);
@@ -91,7 +89,7 @@ static void tekken_regs_w(uint32 address, uint32 data);
- copy protection device
- custom ROM banking device
*/
static const md_entry_t rom_database[CART_CNT] =
static const md_entry_t rom_database[] =
{
/* Funny World & Balloon Boy */
{0x0000,0x06ab,0x40,0x40,{{0x00,0x00,0x00,0x00},{0xffffff,0xffffff,0xffffff,0xffffff},{0x000000,0x000000,0x000000,0x000000},1,0,NULL,NULL,NULL,mapper_realtec_w}},
@@ -99,6 +97,8 @@ static const md_entry_t rom_database[CART_CNT] =
{0xffff,0xf863,0x40,0x40,{{0x00,0x00,0x00,0x00},{0xffffff,0xffffff,0xffffff,0xffffff},{0x000000,0x000000,0x000000,0x000000},1,0,NULL,NULL,NULL,mapper_realtec_w}},
/* Earth Defense */
{0xffff,0x44fb,0x40,0x40,{{0x00,0x00,0x00,0x00},{0xffffff,0xffffff,0xffffff,0xffffff},{0x000000,0x000000,0x000000,0x000000},1,0,NULL,NULL,NULL,mapper_realtec_w}},
/* Tom Clown */
{0x0000,0xc0cd,0x40,0x40,{{0x00,0x00,0x00,0x00},{0xffffff,0xffffff,0xffffff,0xffffff},{0x000000,0x000000,0x000000,0x000000},1,0,NULL,NULL,NULL,mapper_realtec_w}},
/* RADICA (Volume 1) (bad dump ?) */
@@ -180,6 +180,8 @@ static const md_entry_t rom_database[CART_CNT] =
{0x0000,0x1585,0x40,0x40,{{0x55,0x0f,0xaa,0xf0},{0xffffff,0xffffff,0xffffff,0xffffff},{0x400000,0x400002,0x400004,0x400006},0,0,NULL,NULL,default_regs_r_16,NULL}},
/* Chaoji Puke - Super Poker (correct ROM dump, original release is an overdump) */
{0xffff,0xd7b0,0x40,0x40,{{0x55,0x0f,0xaa,0xf0},{0xffffff,0xffffff,0xffffff,0xffffff},{0x400000,0x400002,0x400004,0x400006},0,0,NULL,NULL,default_regs_r,NULL}},
/* Super Bubble Bobble */
{0x0000,0x16cd,0x40,0x40,{{0x55,0x0f,0x00,0x00},{0xffffff,0xffffff,0xffffff,0xffffff},{0x400000,0x400002,0x000000,0x000000},0,0,NULL,NULL,default_regs_r,NULL}},
/* Tenchi wo Kurau II - The Battle of Red Cliffs (Unl) */
@@ -292,14 +294,6 @@ void md_cart_init(void)
while (cart.romsize > size)
size <<= 1;
/* total ROM size is not a factor of 2 */
/* TODO: handle all possible ROM configurations using cartridge database */
if ((size < MAXROMSIZE) && (cart.romsize < size))
{
/* ROM is padded up to 2^k bytes */
memset(cart.rom + cart.romsize, 0xff, size - cart.romsize);
}
/* Sonic & Knuckles */
if (strstr(rominfo.international,"SONIC & KNUCKLES"))
{
@@ -307,9 +301,28 @@ void md_cart_init(void)
size = 0x400000;
}
/* total ROM size is not a factor of 2 */
/* TODO: handle all possible ROM configurations using cartridge database */
if (cart.romsize < size)
{
if (size < MAXROMSIZE)
{
/* ROM is padded up to 2^k bytes */
memset(cart.rom + cart.romsize, 0xff, size - cart.romsize);
}
else
{
/* ROM is padded up to max ROM size */
memset(cart.rom + cart.romsize, 0xff, MAXROMSIZE - cart.romsize);
}
}
/* ROM is mirrored each 2^k bytes */
cart.mask = size - 1;
/* no special external hardware required by default */
cart.special = 0;
/**********************************************
DEFAULT CARTRIDGE MAPPING
***********************************************/
@@ -364,18 +377,14 @@ void md_cart_init(void)
/* external SRAM */
if (sram.on && !sram.custom)
{
/* disabled on startup if ROM is mapped in same area */
if (cart.romsize <= sram.start)
{
/* initialize m68k bus handlers */
m68k.memory_map[sram.start >> 16].base = sram.sram;
m68k.memory_map[sram.start >> 16].read8 = sram_read_byte;
m68k.memory_map[sram.start >> 16].read16 = sram_read_word;
m68k.memory_map[sram.start >> 16].write8 = sram_write_byte;
m68k.memory_map[sram.start >> 16].write16 = sram_write_word;
zbank_memory_map[sram.start >> 16].read = sram_read_byte;
zbank_memory_map[sram.start >> 16].write = sram_write_byte;
}
/* initialize default memory mapping for SRAM */
m68k.memory_map[sram.start >> 16].base = sram.sram;
m68k.memory_map[sram.start >> 16].read8 = sram_read_byte;
m68k.memory_map[sram.start >> 16].read16 = sram_read_word;
m68k.memory_map[sram.start >> 16].write8 = sram_write_byte;
m68k.memory_map[sram.start >> 16].write16 = sram_write_word;
zbank_memory_map[sram.start >> 16].read = sram_read_byte;
zbank_memory_map[sram.start >> 16].write = sram_write_byte;
}
/**********************************************
@@ -398,38 +407,6 @@ void md_cart_init(void)
m68k.memory_map[0x3a].read16 = svp_read_cell_2;
}
/**********************************************
J-CART
***********************************************/
cart.special = 0;
if ((strstr(rominfo.product,"00000000") && (rominfo.checksum == 0x168b)) || /* Super Skidmarks, Micro Machines Military */
(strstr(rominfo.product,"00000000") && (rominfo.checksum == 0x165e)) || /* Pete Sampras Tennis (1991), Micro Machines 96 */
(strstr(rominfo.product,"00000000") && (rominfo.checksum == 0xcee0)) || /* Micro Machines Military (bad) */
(strstr(rominfo.product,"00000000") && (rominfo.checksum == 0x2c41)) || /* Micro Machines 96 (bad) */
(strstr(rominfo.product,"XXXXXXXX") && (rominfo.checksum == 0xdf39)) || /* Sampras Tennis 96 */
(strstr(rominfo.product,"T-123456") && (rominfo.checksum == 0x1eae)) || /* Sampras Tennis 96 */
(strstr(rominfo.product,"T-120066") && (rominfo.checksum == 0x16a4)) || /* Pete Sampras Tennis (1994)*/
strstr(rominfo.product,"T-120096")) /* Micro Machines 2 */
{
if (cart.romsize <= 0x380000) /* just to be sure (checksum might not be enough) */
{
cart.special |= HW_J_CART;
/* force port 1 setting */
if (input.system[1] != SYSTEM_WAYPLAY)
{
old_system[1] = input.system[1];
input.system[1] = SYSTEM_MD_GAMEPAD;
}
/* extra connectors mapped at $38xxxx or $3Fxxxx */
m68k.memory_map[0x38].read16 = jcart_read;
m68k.memory_map[0x38].write16 = jcart_write;
m68k.memory_map[0x3f].read16 = jcart_read;
m68k.memory_map[0x3f].write16 = jcart_write;
}
}
/**********************************************
LOCK-ON
***********************************************/
@@ -455,54 +432,45 @@ void md_cart_init(void)
case TYPE_SK:
{
FILE *f;
/* store S&K ROM above cartridge ROM (and before backup memory) */
if (cart.romsize > 0x600000) break;
/* load Sonic & Knuckles ROM (2 MB) */
f = fopen(SK_ROM,"rb");
if (!f) break;
for (i=0; i<0x200000; i+=0x1000)
/* try to load Sonic & Knuckles ROM file (2 MB) */
if (load_archive(SK_ROM, cart.rom + 0x600000, 0x200000, NULL) == 0x200000)
{
fread(cart.rom + 0x600000 + i, 0x1000, 1, f);
}
fclose(f);
/* check ROM header */
if (!memcmp(cart.rom + 0x600000 + 0x120, "SONIC & KNUCKLES",16))
{
/* try to load Sonic 2 & Knuckles UPMEM ROM (256 KB) */
if (load_archive(SK_UPMEM, cart.rom + 0x900000, 0x40000, NULL) == 0x40000)
{
/* $000000-$1FFFFF is mapped to S&K ROM */
for (i=0x00; i<0x20; i++)
{
m68k.memory_map[i].base = cart.rom + 0x600000 + (i << 16);
}
/* load Sonic 2 UPMEM ROM (256 KB) */
f = fopen(SK_UPMEM,"rb");
if (!f) break;
for (i=0; i<0x40000; i+=0x1000)
{
fread(cart.rom + 0x900000 + i, 0x1000, 1, f);
}
fclose(f);
#ifdef LSB_FIRST
for (i=0; i<0x200000; i+=2)
{
/* Byteswap ROM */
uint8 temp = cart.rom[i + 0x600000];
cart.rom[i + 0x600000] = cart.rom[i + 0x600000 + 1];
cart.rom[i + 0x600000 + 1] = temp;
}
for (i=0; i<0x40000; i+=2)
{
/* Byteswap ROM */
uint8 temp = cart.rom[i + 0x900000];
cart.rom[i + 0x900000] = cart.rom[i + 0x900000 + 1];
cart.rom[i + 0x900000 + 1] = temp;
}
for (i=0; i<0x200000; i+=2)
{
/* Byteswap ROM */
uint8 temp = cart.rom[i + 0x600000];
cart.rom[i + 0x600000] = cart.rom[i + 0x600000 + 1];
cart.rom[i + 0x600000 + 1] = temp;
}
for (i=0; i<0x40000; i+=2)
{
/* Byteswap ROM */
uint8 temp = cart.rom[i + 0x900000];
cart.rom[i + 0x900000] = cart.rom[i + 0x900000 + 1];
cart.rom[i + 0x900000 + 1] = temp;
}
#endif
/* $000000-$1FFFFF is mapped to S&K ROM */
for (i=0x00; i<0x20; i++)
{
m68k.memory_map[i].base = cart.rom + 0x600000 + (i << 16);
cart.special |= HW_LOCK_ON;
}
}
}
cart.special |= HW_LOCK_ON;
break;
}
@@ -518,7 +486,7 @@ void md_cart_init(void)
memset(&cart.hw, 0, sizeof(cart.hw));
/* search for game into database */
for (i=0; i<CART_CNT; i++)
for (i=0; i<(sizeof(rom_database)/sizeof(md_entry_t)); i++)
{
/* known cart found ! */
if ((rominfo.checksum == rom_database[i].chk_1) &&
@@ -548,7 +516,7 @@ void md_cart_init(void)
}
/* leave loop */
i = CART_CNT;
break;
}
}
@@ -569,13 +537,21 @@ void md_cart_init(void)
}
/* detect specific mappers */
if (strstr(rominfo.domestic,"SUPER STREET FIGHTER2"))
if (strstr(rominfo.consoletype,"SEGA SSF"))
{
/* Everdrive extended SSF mapper */
cart.hw.time_w = mapper_512k_w;
/* cartridge ROM mapping is reinitialized on /VRES */
cart.hw.bankshift = 1;
}
else if (strstr(rominfo.domestic,"SUPER STREET FIGHTER2"))
{
/* SSF2 mapper */
cart.hw.bankshift = 1;
/* specific !TIME handler */
cart.hw.time_w = mapper_ssf2_w;
/* cartridge ROM mapping is reinitialized on /VRES */
cart.hw.bankshift = 1;
}
else if (strstr(rominfo.product,"T-5740"))
{
@@ -600,6 +576,18 @@ void md_cart_init(void)
/* no !TIME handler */
cart.hw.time_w = m68k_unused_8_w;
/* cartridge ROM is mapped to $3C0000-$3FFFFF on reset */
for (i=0x3c; i<0x40; i++)
{
m68k.memory_map[i].base = cart.rom + (i << 16);
m68k.memory_map[i].read8 = NULL;
m68k.memory_map[i].read16 = NULL;
m68k.memory_map[i].write8 = m68k_unused_8_w;
m68k.memory_map[i].write16 = m68k_unused_16_w;
zbank_memory_map[i].read = NULL;
zbank_memory_map[i].write = m68k_unused_8_w;
}
}
else if (strstr(rominfo.ROMType,"SF") && strstr(rominfo.product,"002"))
{
@@ -622,13 +610,13 @@ void md_cart_init(void)
cart.hw.time_r = mapper_sf004_r;
cart.hw.time_w = m68k_unused_8_w;
/* first 256K ROM bank is initially mirrored into $000000-$1FFFFF */
/* first 256K ROM bank is mirrored into $000000-$1FFFFF on reset */
for (i=0x00; i<0x20; i++)
{
m68k.memory_map[i].base = cart.rom + ((i & 0x03) << 16);
}
/* 32K static RAM is mapped to $200000-$2FFFFF (disabled on startup) */
/* 32K static RAM mapped to $200000-$2FFFFF is disabled on reset */
for (i=0x20; i<0x30; i++)
{
m68k.memory_map[i].base = sram.sram;
@@ -685,7 +673,7 @@ void md_cart_init(void)
}
else if (cart.romsize > 0x400000)
{
/* assume linear ROM mapper without bankswitching (max. 10MB) */
/* assume linear ROM mapping by default (max. 10MB) */
for (i=0x40; i<0xA0; i++)
{
m68k.memory_map[i].base = cart.rom + (i<<16);
@@ -913,25 +901,37 @@ static void mapper_sega_w(uint32 data)
}
}
/*
Everdrive extended SSF ROM bankswitch
documented by Krikzz (http://krikzz.com/pub/support/mega-ed/dev/extended_ssf.txt)
*/
static void mapper_512k_w(uint32 address, uint32 data)
{
uint32 i;
/* 512K ROM paging */
uint8 *src = cart.rom + (data << 19);
/* cartridge area ($000000-$3FFFFF) is divided into 8 x 512K banks */
address = (address << 2) & 0x38;
/* remap selected ROM page to selected bank */
for (i=0; i<8; i++)
{
m68k.memory_map[address++].base = src + (i<<16);
}
}
/*
Super Street Fighter 2 ROM bankswitch
documented by Bart Trzynadlowski (http://www.trzy.org/files/ssf2.txt)
documented by Bart Trzynadlowski (http://emu-docs.org/Genesis/ssf2.txt)
*/
static void mapper_ssf2_w(uint32 address, uint32 data)
{
/* 8 x 512k banks */
address = (address << 2) & 0x38;
/* bank 0 remains unchanged */
if (address)
/* only banks 1-7 are remappable, bank 0 remains unchanged */
if (address & 0x0E)
{
uint32 i;
uint8 *src = cart.rom + (data << 19);
for (i=0; i<8; i++)
{
m68k.memory_map[address++].base = src + (i<<16);
}
mapper_512k_w(address, data);
}
}
@@ -1613,15 +1613,22 @@ static uint32 mapper_radica_r(uint32 address)
static void default_time_w(uint32 address, uint32 data)
{
/* enable multi-game cartridge mapper by default */
if (address < 0xa13040)
{
/* unlicensed cartridges mapper (default) */
mapper_64k_multi_w(address);
return;
}
/* official cartridges mapper (default) */
mapper_sega_w(data);
/* enable "official" cartridge mapper by default */
if (address > 0xa130f1)
{
mapper_512k_w(address, data);
}
else
{
mapper_sega_w(data);
}
}
+8 -4
View File
@@ -2,7 +2,7 @@
* Genesis Plus
* Mega Drive cartridge hardware support
*
* Copyright (C) 2007-2013 Eke-Eke (Genesis Plus GX)
* Copyright (C) 2007-2016 Eke-Eke (Genesis Plus GX)
*
* Most cartridge protections were initially documented by Haze
* (http://haze.mameworld.info/)
@@ -44,7 +44,11 @@
#ifndef _MD_CART_H_
#define _MD_CART_H_
#ifdef USE_DYNAMIC_ALLOC
#define cart ext->md_cart
#else
#define cart ext.md_cart
#endif
/* Lock-On cartridge type */
#define TYPE_GG 0x01 /* Game Genie */
@@ -72,12 +76,12 @@ typedef struct
/* Cartridge type */
typedef struct
{
uint8 rom[MAXROMSIZE]; /* ROM area */
uint8 *base; /* ROM base (saved for OS/Cartridge ROM swap) */
uint32 romsize; /* ROM size */
uint32 mask; /* ROM mask */
uint8 special; /* Lock-On, J-Cart or SMS 3-D glasses hardware */
cart_hw_t hw; /* Extra mapping hardware */
uint8 special; /* custom external hardware (Lock-On, J-Cart, 3-D glasses, Terebi Oekaki,...) */
cart_hw_t hw; /* cartridge internal hardware */
uint8 rom[MAXROMSIZE]; /* ROM area */
} md_cart_t;
+382 -307
View File
@@ -2,7 +2,7 @@
* Genesis Plus
* SG-1000, Master System & Game Gear cartridge hardware support
*
* Copyright (C) 2007-2012 Eke-Eke (Genesis Plus GX)
* Copyright (C) 2007-2016 Eke-Eke (Genesis Plus GX)
*
* Redistribution and use of this code or any derivative works are permitted
* provided that the following conditions are met:
@@ -42,20 +42,20 @@
#define MAPPER_NONE (0x00)
#define MAPPER_TEREBI (0x01)
#define MAPPER_RAM_8K_EXT1 (0x02)
#define MAPPER_RAM_8K_EXT2 (0x03)
#define MAPPER_RAM_2K (0x02)
#define MAPPER_RAM_8K_EXT1 (0x03)
#define MAPPER_RAM_8K_EXT2 (0x04)
#define MAPPER_SEGA (0x10)
#define MAPPER_SEGA_X (0x11)
#define MAPPER_93C46 (0x12)
#define MAPPER_CODIES (0x13)
#define MAPPER_MULTI (0x14)
#define MAPPER_MULTI_16K (0x14)
#define MAPPER_KOREA (0x15)
#define MAPPER_KOREA_16K (0x16)
#define MAPPER_KOREA_8K (0x20)
#define MAPPER_MSX (0x21)
#define MAPPER_MSX_NEMESIS (0x22)
#define GAME_DATABASE_CNT (211)
#define MAPPER_MULTI_32K (0x40)
typedef struct
{
@@ -72,260 +72,285 @@ typedef struct
{
uint8 fcr[4];
uint8 mapper;
uint8 pages;
uint16 pages;
} romhw_t;
static const rominfo_t game_list[GAME_DATABASE_CNT] =
static const rominfo_t game_list[] =
{
/* program requiring Mega Drive VDP (Mode 5) */
{0x47FA618D, 0, 1, SYSTEM_MS_GAMEPAD, MAPPER_SEGA, SYSTEM_PBC, REGION_USA}, /* Charles MacDonald's Mode 5 Demo Program */
{0x47FA618D, 0, 1, 0, MAPPER_SEGA, SYSTEM_PBC, REGION_USA}, /* Charles MacDonald's Mode 5 Demo Program */
/* game requiring SEGA mapper */
{0xFF67359B, 0, 0, SYSTEM_MS_GAMEPAD, MAPPER_SEGA, SYSTEM_SMS2, REGION_USA}, /* DataStorm (homebrew) */
{0xFF67359B, 0, 0, 0, MAPPER_SEGA, SYSTEM_SMS2, REGION_USA}, /* DataStorm (homebrew) */
/* games requiring 315-5124 VDP (Mark-III, Master System I) */
{0x32759751, 0, 1, SYSTEM_MS_GAMEPAD, MAPPER_SEGA, SYSTEM_SMS, REGION_JAPAN_NTSC}, /* Y's (J) */
{0x32759751, 0, 1, 0, MAPPER_SEGA, SYSTEM_SMS, REGION_JAPAN_NTSC}, /* Y's (J) */
{0xE8B82066, 0, 1, 0, MAPPER_SEGA, SYSTEM_SMS, REGION_JAPAN_NTSC}, /* Y's (J) [Demo] */
/* games requiring Sega 315-5235 mapper without bank shifting */
{0x23BAC434, 0, 0, SYSTEM_MS_GAMEPAD, MAPPER_SEGA_X, SYSTEM_GG, REGION_USA}, /* Shining Force Gaiden - Final Conflict (JP) [T-Eng] */
{0x23BAC434, 0, 0, 0, MAPPER_SEGA_X, SYSTEM_GG, REGION_USA}, /* Shining Force Gaiden - Final Conflict (JP) [T-Eng] */
/* games using various Korean mappers */
{0x17AB6883, 0, 0, SYSTEM_MS_GAMEPAD, MAPPER_NONE, SYSTEM_SMS, REGION_JAPAN_NTSC}, /* FA Tetris (KR) */
{0x61E8806F, 0, 0, SYSTEM_MS_GAMEPAD, MAPPER_NONE, SYSTEM_SMS, REGION_JAPAN_NTSC}, /* Flash Point (KR) */
{0x445525E2, 0, 0, SYSTEM_MS_GAMEPAD, MAPPER_MSX, SYSTEM_SMS, REGION_JAPAN_NTSC}, /* Penguin Adventure (KR) */
{0x83F0EEDE, 0, 0, SYSTEM_MS_GAMEPAD, MAPPER_MSX, SYSTEM_SMS, REGION_JAPAN_NTSC}, /* Street Master (KR) */
{0xA05258F5, 0, 0, SYSTEM_MS_GAMEPAD, MAPPER_MSX, SYSTEM_SMS, REGION_JAPAN_NTSC}, /* Won-Si-In (KR) */
{0x06965ED9, 0, 0, SYSTEM_MS_GAMEPAD, MAPPER_MSX, SYSTEM_SMS, REGION_JAPAN_NTSC}, /* F-1 Spirit - The way to Formula-1 (KR) */
{0x77EFE84A, 0, 0, SYSTEM_MS_GAMEPAD, MAPPER_MSX, SYSTEM_SMS, REGION_JAPAN_NTSC}, /* Cyborg Z (KR) */
{0xF89AF3CC, 0, 0, SYSTEM_MS_GAMEPAD, MAPPER_MSX, SYSTEM_SMS, REGION_JAPAN_NTSC}, /* Knightmare II - The Maze of Galious (KR) */
{0x9195C34C, 0, 0, SYSTEM_MS_GAMEPAD, MAPPER_MSX, SYSTEM_SMS, REGION_JAPAN_NTSC}, /* Super Boy 3 (KR) */
{0xE316C06D, 0, 0, SYSTEM_MS_GAMEPAD, MAPPER_MSX_NEMESIS, SYSTEM_SMS, REGION_JAPAN_NTSC}, /* Nemesis (KR) */
{0x0A77FA5E, 0, 0, SYSTEM_MS_GAMEPAD, MAPPER_MSX, SYSTEM_SMS, REGION_JAPAN_NTSC}, /* Nemesis 2 (KR) */
{0xA67F2A5C, 0, 0, SYSTEM_MS_GAMEPAD, MAPPER_MULTI, SYSTEM_SMS, REGION_JAPAN_NTSC}, /* 4-Pak All Action (KR) */
{0x89B79E77, 0, 0, SYSTEM_MS_GAMEPAD, MAPPER_KOREA, SYSTEM_SMS, REGION_JAPAN_NTSC}, /* Dodgeball King (KR) */
{0x18FB98A3, 0, 0, SYSTEM_MS_GAMEPAD, MAPPER_KOREA, SYSTEM_SMS, REGION_JAPAN_NTSC}, /* Jang Pung 3 (KR) */
{0x97D03541, 0, 0, SYSTEM_MS_GAMEPAD, MAPPER_KOREA, SYSTEM_SMS, REGION_JAPAN_NTSC}, /* Sangokushi 3 (KR) */
{0x67C2F0FF, 0, 0, SYSTEM_MS_GAMEPAD, MAPPER_KOREA, SYSTEM_SMS, REGION_JAPAN_NTSC}, /* Super Boy 2 (KR) */
{0x192949D5, 0, 0, SYSTEM_MS_GAMEPAD, MAPPER_KOREA_8K, SYSTEM_SMS, REGION_JAPAN_NTSC}, /* Janggun-ui Adeul (KR) */
{0x9FA727A0, 0, 0, SYSTEM_MS_GAMEPAD, MAPPER_KOREA_16K, SYSTEM_GGMS, REGION_USA}, /* Street Hero [Proto 0] [SMS-GG] (US) */
{0xFB481971, 0, 0, SYSTEM_MS_GAMEPAD, MAPPER_KOREA_16K, SYSTEM_GGMS, REGION_USA}, /* Street Hero [Proto 1] [SMS-GG] (US) */
/* games using "Korean" mappers */
{0x445525E2, 0, 0, 0, MAPPER_MSX, SYSTEM_SMS, REGION_JAPAN_NTSC}, /* Penguin Adventure (KR) */
{0x83F0EEDE, 0, 0, 0, MAPPER_MSX, SYSTEM_SMS, REGION_JAPAN_NTSC}, /* Street Master (KR) */
{0xA05258F5, 0, 0, 0, MAPPER_MSX, SYSTEM_SMS, REGION_JAPAN_NTSC}, /* Won-Si-In (KR) */
{0x06965ED9, 0, 0, 0, MAPPER_MSX, SYSTEM_SMS, REGION_JAPAN_NTSC}, /* F-1 Spirit - The way to Formula-1 (KR) */
{0x77EFE84A, 0, 0, 0, MAPPER_MSX, SYSTEM_SMS, REGION_JAPAN_NTSC}, /* Cyborg Z (KR) */
{0xF89AF3CC, 0, 0, 0, MAPPER_MSX, SYSTEM_SMS, REGION_JAPAN_NTSC}, /* Knightmare II - The Maze of Galious (KR) */
{0x9195C34C, 0, 0, 0, MAPPER_MSX, SYSTEM_SMS, REGION_JAPAN_NTSC}, /* Super Boy 3 (KR) */
{0xE316C06D, 0, 0, 0, MAPPER_MSX_NEMESIS, SYSTEM_SMS, REGION_JAPAN_NTSC}, /* Nemesis (KR) */
{0x0A77FA5E, 0, 0, 0, MAPPER_MSX, SYSTEM_SMS, REGION_JAPAN_NTSC}, /* Nemesis 2 (KR) */
{0x89B79E77, 0, 0, 0, MAPPER_KOREA, SYSTEM_SMS, REGION_JAPAN_NTSC}, /* Dodgeball King (KR) */
{0x929222C4, 0, 0, 0, MAPPER_KOREA, SYSTEM_SMS, REGION_JAPAN_NTSC}, /* Jang Pung II (KR) */
{0x18FB98A3, 0, 0, 0, MAPPER_KOREA, SYSTEM_SMS, REGION_JAPAN_NTSC}, /* Jang Pung 3 (KR) */
{0x97D03541, 0, 0, 0, MAPPER_KOREA, SYSTEM_SMS, REGION_JAPAN_NTSC}, /* Sangokushi 3 (KR) */
{0x192949D5, 0, 0, 0, MAPPER_KOREA_8K, SYSTEM_SMS, REGION_JAPAN_NTSC}, /* Janggun-ui Adeul (KR) */
{0x76C5BDFB, 0, 0, 0, MAPPER_KOREA_16K, SYSTEM_GGMS, REGION_JAPAN_NTSC}, /* Jang Pung II [SMS-GG] (KR) */
{0x9FA727A0, 0, 0, 0, MAPPER_KOREA_16K, SYSTEM_GGMS, REGION_USA}, /* Street Hero [Proto 0] [SMS-GG] (US) */
{0xFB481971, 0, 0, 0, MAPPER_KOREA_16K, SYSTEM_GGMS, REGION_USA}, /* Street Hero [Proto 1] [SMS-GG] (US) */
{0xA67F2A5C, 0, 0, 0, MAPPER_MULTI_16K, SYSTEM_SMS, REGION_JAPAN_NTSC}, /* 4-Pak All Action (KR) */
{0x98AF0236, 0, 0, 0, MAPPER_MULTI_32K, SYSTEM_SMS, REGION_JAPAN_NTSC}, /* Hi-Com 3-in-1 The Best Game Collection (Vol. 1) (KR) */
{0x6EBFE1C3, 0, 0, 0, MAPPER_MULTI_32K, SYSTEM_SMS, REGION_JAPAN_NTSC}, /* Hi-Com 3-in-1 The Best Game Collection (Vol. 2) (KR) */
{0x81A36A4F, 0, 0, 0, MAPPER_MULTI_32K, SYSTEM_SMS, REGION_JAPAN_NTSC}, /* Hi-Com 3-in-1 The Best Game Collection (Vol. 3) (KR) */
{0x8D2D695D, 0, 0, 0, MAPPER_MULTI_32K, SYSTEM_SMS, REGION_JAPAN_NTSC}, /* Hi-Com 3-in-1 The Best Game Collection (Vol. 4) (KR) */
{0x82C09B57, 0, 0, 0, MAPPER_MULTI_32K, SYSTEM_SMS, REGION_JAPAN_NTSC}, /* Hi-Com 3-in-1 The Best Game Collection (Vol. 5) (KR) */
{0x4088EEB4, 0, 0, 0, MAPPER_MULTI_32K, SYSTEM_SMS, REGION_JAPAN_NTSC}, /* Hi-Com 3-in-1 The Best Game Collection (Vol. 6) (KR) */
{0xFBA94148, 0, 0, 0, MAPPER_MULTI_32K, SYSTEM_SMS, REGION_JAPAN_NTSC}, /* Hi-Com 8-in-1 The Best Game Collection (Vol. 1) (KR) */
{0x8333C86E, 0, 0, 0, MAPPER_MULTI_32K, SYSTEM_SMS, REGION_JAPAN_NTSC}, /* Hi-Com 8-in-1 The Best Game Collection (Vol. 2) (KR) */
{0x00E9809F, 0, 0, 0, MAPPER_MULTI_32K, SYSTEM_SMS, REGION_JAPAN_NTSC}, /* Hi-Com 8-in-1 The Best Game Collection (Vol. 3) (KR) */
/* games using Codemaster mapper */
{0x29822980, 0, 0, SYSTEM_MS_GAMEPAD, MAPPER_CODIES, SYSTEM_SMS2, REGION_EUROPE}, /* Cosmic Spacehead */
{0x8813514B, 0, 0, SYSTEM_MS_GAMEPAD, MAPPER_CODIES, SYSTEM_SMS2, REGION_EUROPE}, /* Excellent Dizzy Collection, The [Proto] */
{0xB9664AE1, 0, 0, SYSTEM_MS_GAMEPAD, MAPPER_CODIES, SYSTEM_SMS2, REGION_EUROPE}, /* Fantastic Dizzy */
{0xA577CE46, 0, 0, SYSTEM_MS_GAMEPAD, MAPPER_CODIES, SYSTEM_SMS2, REGION_EUROPE}, /* Micro Machines */
{0xEA5C3A6F, 0, 0, SYSTEM_MS_GAMEPAD, MAPPER_CODIES, SYSTEM_SMS2, REGION_USA}, /* Dinobasher - Starring Bignose the Caveman [Proto] */
{0xAA140C9C, 0, 0, SYSTEM_MS_GAMEPAD, MAPPER_CODIES, SYSTEM_GGMS, REGION_USA}, /* Excellent Dizzy Collection, The [SMS-GG] */
{0xC888222B, 0, 0, SYSTEM_MS_GAMEPAD, MAPPER_CODIES, SYSTEM_GGMS, REGION_USA}, /* Fantastic Dizzy [SMS-GG] */
{0x76C5BDFB, 0, 0, SYSTEM_MS_GAMEPAD, MAPPER_CODIES, SYSTEM_GGMS, REGION_USA}, /* Jang Pung 2 [SMS-GG] */
{0x6CAA625B, 0, 0, SYSTEM_MS_GAMEPAD, MAPPER_CODIES, SYSTEM_GG, REGION_USA}, /* Cosmic Spacehead [GG]*/
{0x152F0DCC, 0, 0, SYSTEM_MS_GAMEPAD, MAPPER_CODIES, SYSTEM_GG, REGION_USA}, /* Drop Zone" */
{0x5E53C7F7, 0, 0, SYSTEM_MS_GAMEPAD, MAPPER_CODIES, SYSTEM_GG, REGION_USA}, /* Ernie Els Golf */
{0xD9A7F170, 0, 0, SYSTEM_MS_GAMEPAD, MAPPER_CODIES, SYSTEM_GG, REGION_USA}, /* Man Overboard! */
{0xF7C524F6, 0, 0, SYSTEM_MS_GAMEPAD, MAPPER_CODIES, SYSTEM_GG, REGION_USA}, /* Micro Machines [GG] */
{0xDBE8895C, 0, 0, SYSTEM_MS_GAMEPAD, MAPPER_CODIES, SYSTEM_GG, REGION_USA}, /* Micro Machines 2 - Turbo Tournament */
{0xC1756BEE, 0, 0, SYSTEM_MS_GAMEPAD, MAPPER_CODIES, SYSTEM_GG, REGION_USA}, /* Pete Sampras Tennis */
{0x72981057, 0, 0, SYSTEM_MS_GAMEPAD, MAPPER_CODIES, SYSTEM_GG, REGION_USA}, /* CJ Elephant Fugitive */
{0x29822980, 0, 0, 0, MAPPER_CODIES, SYSTEM_SMS2, REGION_EUROPE}, /* Cosmic Spacehead */
{0x8813514B, 0, 0, 0, MAPPER_CODIES, SYSTEM_SMS2, REGION_EUROPE}, /* Excellent Dizzy Collection, The [Proto] */
{0xB9664AE1, 0, 0, 0, MAPPER_CODIES, SYSTEM_SMS2, REGION_EUROPE}, /* Fantastic Dizzy */
{0xA577CE46, 0, 0, 0, MAPPER_CODIES, SYSTEM_SMS2, REGION_EUROPE}, /* Micro Machines */
{0xEA5C3A6F, 0, 0, 0, MAPPER_CODIES, SYSTEM_SMS2, REGION_USA}, /* Dinobasher - Starring Bignose the Caveman [Proto] */
{0xAA140C9C, 0, 0, 0, MAPPER_CODIES, SYSTEM_GGMS, REGION_USA}, /* Excellent Dizzy Collection, The [SMS-GG] */
{0xC888222B, 0, 0, 0, MAPPER_CODIES, SYSTEM_GGMS, REGION_USA}, /* Fantastic Dizzy [SMS-GG] */
{0x6CAA625B, 0, 0, 0, MAPPER_CODIES, SYSTEM_GG, REGION_USA}, /* Cosmic Spacehead [GG]*/
{0x152F0DCC, 0, 0, 0, MAPPER_CODIES, SYSTEM_GG, REGION_USA}, /* Drop Zone */
{0x5E53C7F7, 0, 0, 0, MAPPER_CODIES, SYSTEM_GG, REGION_USA}, /* Ernie Els Golf */
{0xD9A7F170, 0, 0, 0, MAPPER_CODIES, SYSTEM_GG, REGION_USA}, /* Man Overboard! */
{0xF7C524F6, 0, 0, 0, MAPPER_CODIES, SYSTEM_GG, REGION_USA}, /* Micro Machines [GG] */
{0xDBE8895C, 0, 0, 0, MAPPER_CODIES, SYSTEM_GG, REGION_USA}, /* Micro Machines 2 - Turbo Tournament */
{0xC1756BEE, 0, 0, 0, MAPPER_CODIES, SYSTEM_GG, REGION_USA}, /* Pete Sampras Tennis */
{0x72981057, 0, 0, 0, MAPPER_CODIES, SYSTEM_GG, REGION_USA}, /* CJ Elephant Fugitive */
/* games using serial EEPROM */
{0x36EBCD6D, 0, 0, SYSTEM_MS_GAMEPAD, MAPPER_93C46, SYSTEM_GG, REGION_USA}, /* Majors Pro Baseball */
{0x3D8D0DD6, 0, 0, SYSTEM_MS_GAMEPAD, MAPPER_93C46, SYSTEM_GG, REGION_USA}, /* World Series Baseball [v0] */
{0xBB38CFD7, 0, 0, SYSTEM_MS_GAMEPAD, MAPPER_93C46, SYSTEM_GG, REGION_USA}, /* World Series Baseball [v1] */
{0x578A8A38, 0, 0, SYSTEM_MS_GAMEPAD, MAPPER_93C46, SYSTEM_GG, REGION_USA}, /* World Series Baseball '95 */
{0x36EBCD6D, 0, 0, 0, MAPPER_93C46, SYSTEM_GG, REGION_USA}, /* Majors Pro Baseball */
{0x3D8D0DD6, 0, 0, 0, MAPPER_93C46, SYSTEM_GG, REGION_USA}, /* World Series Baseball [v0] */
{0xBB38CFD7, 0, 0, 0, MAPPER_93C46, SYSTEM_GG, REGION_USA}, /* World Series Baseball [v1] */
{0x578A8A38, 0, 0, 0, MAPPER_93C46, SYSTEM_GG, REGION_USA}, /* World Series Baseball '95 */
/* games using Terebi Oekaki graphic board */
{0xDD4A661B, 0, 0, SYSTEM_MS_GAMEPAD, MAPPER_TEREBI, SYSTEM_SG, REGION_JAPAN_NTSC}, /* Terebi Oekaki */
{0xDD4A661B, 0, 0, 0, MAPPER_TEREBI, SYSTEM_SG, REGION_JAPAN_NTSC}, /* Terebi Oekaki */
/* games requiring 8K RAM extension adapter */
{0xCE5648C3, 0, 0, SYSTEM_MS_GAMEPAD, MAPPER_RAM_8K_EXT1, SYSTEM_SG, REGION_JAPAN_NTSC}, /* Bomberman Special [DahJee] (TW) */
{0x223397A1, 0, 0, SYSTEM_MS_GAMEPAD, MAPPER_RAM_8K_EXT1, SYSTEM_SG, REGION_JAPAN_NTSC}, /* King's Valley (TW) */
{0x281D2888, 0, 0, SYSTEM_MS_GAMEPAD, MAPPER_RAM_8K_EXT1, SYSTEM_SG, REGION_JAPAN_NTSC}, /* Knightmare (TW) */
{0x306D5F78, 0, 0, SYSTEM_MS_GAMEPAD, MAPPER_RAM_8K_EXT1, SYSTEM_SG, REGION_JAPAN_NTSC}, /* Rally-X [DahJee] (TW) */
{0x29E047CC, 0, 0, SYSTEM_MS_GAMEPAD, MAPPER_RAM_8K_EXT1, SYSTEM_SG, REGION_JAPAN_NTSC}, /* Road Fighter (TW) */
{0x5CBD1163, 0, 0, SYSTEM_MS_GAMEPAD, MAPPER_RAM_8K_EXT1, SYSTEM_SG, REGION_JAPAN_NTSC}, /* Tank Battalion (TW) */
{0x2E7166D5, 0, 0, SYSTEM_MS_GAMEPAD, MAPPER_RAM_8K_EXT1, SYSTEM_SG, REGION_JAPAN_NTSC}, /* The Legend of Kage (TW) */
{0xC550B4F0, 0, 0, SYSTEM_MS_GAMEPAD, MAPPER_RAM_8K_EXT1, SYSTEM_SG, REGION_JAPAN_NTSC}, /* TwinBee (TW) */
{0xFC87463C, 0, 0, SYSTEM_MS_GAMEPAD, MAPPER_RAM_8K_EXT1, SYSTEM_SG, REGION_JAPAN_NTSC}, /* Yie Ar Kung-Fu II (TW) */
{0x69FC1494, 0, 0, SYSTEM_MS_GAMEPAD, MAPPER_RAM_8K_EXT2, SYSTEM_SG, REGION_JAPAN_NTSC}, /* Bomberman Special (TW) */
{0xFFC4EE3F, 0, 0, SYSTEM_MS_GAMEPAD, MAPPER_RAM_8K_EXT2, SYSTEM_SG, REGION_JAPAN_NTSC}, /* Magical Kid Wiz (TW) */
{0x2E366CCF, 0, 0, SYSTEM_MS_GAMEPAD, MAPPER_RAM_8K_EXT2, SYSTEM_SG, REGION_JAPAN_NTSC}, /* The Castle (TW) */
{0xAAAC12CF, 0, 0, SYSTEM_MS_GAMEPAD, MAPPER_RAM_8K_EXT2, SYSTEM_SG, REGION_JAPAN_NTSC}, /* Rally-X (TW) */
{0xD2EDD329, 0, 0, SYSTEM_MS_GAMEPAD, MAPPER_RAM_8K_EXT2, SYSTEM_SG, REGION_JAPAN_NTSC}, /* Road Fighter (TW) */
/* games using 2KB external RAM (volatile) */
{0x092F29D6, 0, 0, 0, MAPPER_RAM_2K, SYSTEM_SG, REGION_JAPAN_NTSC}, /* The Castle (J) */
{0xAF4F14BC, 0, 0, 0, MAPPER_RAM_2K, SYSTEM_SG, REGION_JAPAN_NTSC}, /* Othello (J) */
{0x1D1A0CA3, 0, 0, 0, MAPPER_RAM_2K, SYSTEM_SGII, REGION_JAPAN_NTSC}, /* Othello (TW) */
/* games requiring SG-1000 II 8K RAM extension adapter */
{0xCE5648C3, 0, 0, 0, MAPPER_RAM_8K_EXT1, SYSTEM_SGII, REGION_JAPAN_NTSC}, /* Bomberman Special [DahJee] (TW) */
{0x223397A1, 0, 0, 0, MAPPER_RAM_8K_EXT1, SYSTEM_SGII, REGION_JAPAN_NTSC}, /* King's Valley (TW) */
{0x281D2888, 0, 0, 0, MAPPER_RAM_8K_EXT1, SYSTEM_SGII, REGION_JAPAN_NTSC}, /* Knightmare (TW) */
{0x306D5F78, 0, 0, 0, MAPPER_RAM_8K_EXT1, SYSTEM_SGII, REGION_JAPAN_NTSC}, /* Rally-X [DahJee] (TW) */
{0x29E047CC, 0, 0, 0, MAPPER_RAM_8K_EXT1, SYSTEM_SGII, REGION_JAPAN_NTSC}, /* Road Fighter (TW) */
{0x5CBD1163, 0, 0, 0, MAPPER_RAM_8K_EXT1, SYSTEM_SGII, REGION_JAPAN_NTSC}, /* Tank Battalion (TW) */
{0x2E7166D5, 0, 0, 0, MAPPER_RAM_8K_EXT1, SYSTEM_SGII, REGION_JAPAN_NTSC}, /* The Legend of Kage (TW) */
{0xC550B4F0, 0, 0, 0, MAPPER_RAM_8K_EXT1, SYSTEM_SGII, REGION_JAPAN_NTSC}, /* TwinBee (TW) */
{0xFC87463C, 0, 0, 0, MAPPER_RAM_8K_EXT1, SYSTEM_SGII, REGION_JAPAN_NTSC}, /* Yie Ar Kung-Fu II (TW) */
{0x69FC1494, 0, 0, 0, MAPPER_RAM_8K_EXT2, SYSTEM_SGII, REGION_JAPAN_NTSC}, /* Bomberman Special (TW) */
{0xFFC4EE3F, 0, 0, 0, MAPPER_RAM_8K_EXT2, SYSTEM_SGII, REGION_JAPAN_NTSC}, /* Magical Kid Wiz (TW) */
{0x2E366CCF, 0, 0, 0, MAPPER_RAM_8K_EXT2, SYSTEM_SGII, REGION_JAPAN_NTSC}, /* The Castle (TW) */
{0xAAAC12CF, 0, 0, 0, MAPPER_RAM_8K_EXT2, SYSTEM_SGII, REGION_JAPAN_NTSC}, /* Rally-X (TW) */
{0xD2EDD329, 0, 0, 0, MAPPER_RAM_8K_EXT2, SYSTEM_SGII, REGION_JAPAN_NTSC}, /* Road Fighter (TW) */
/* games requiring 2K internal RAM (SG-1000 II clone hardware) */
{0x7F7F009D, 0, 0, 0, MAPPER_NONE, SYSTEM_SGII, REGION_JAPAN_NTSC}, /* Circus Charlie (KR) */
{0x77DB4704, 0, 0, 0, MAPPER_NONE, SYSTEM_SGII, REGION_JAPAN_NTSC}, /* Q*Bert */
{0xC5A67B95, 0, 0, 0, MAPPER_NONE, SYSTEM_SGII, REGION_JAPAN_NTSC}, /* Othello Multivision BIOS */
/* games requiring Japanese region setting */
{0x71DEBA5A, 0, 0, SYSTEM_MS_GAMEPAD, MAPPER_SEGA, SYSTEM_GG, REGION_JAPAN_NTSC}, /* Pop Breaker */
{0xC9DD4E5F, 0, 0, SYSTEM_MS_GAMEPAD, MAPPER_SEGA, SYSTEM_SMS, REGION_JAPAN_NTSC}, /* Woody Pop (Super Arkanoid) */
{0x71DEBA5A, 0, 0, 0, MAPPER_SEGA, SYSTEM_GG, REGION_JAPAN_NTSC}, /* Pop Breaker */
{0xC9DD4E5F, 0, 0, 0, MAPPER_SEGA, SYSTEM_SMS, REGION_JAPAN_NTSC}, /* Woody Pop (Super Arkanoid) */
/* games requiring Mark-III hardware (no Memory Control port) */
{0xBD1CC7DF, 0, 0, SYSTEM_MS_GAMEPAD, MAPPER_SEGA, SYSTEM_MARKIII, REGION_JAPAN_NTSC}, /* Super Tetris (KR) */
{0x6D309AC5, 0, 0, SYSTEM_MS_GAMEPAD, MAPPER_SEGA, SYSTEM_MARKIII, REGION_JAPAN_NTSC}, /* Power Boggle Boggle (KR) */
/* games requiring Japanese Master System I/O chip (315-5297) */
{0xBD1CC7DF, 0, 0, 0, MAPPER_SEGA, SYSTEM_SMS, REGION_JAPAN_NTSC}, /* Super Tetris (KR) */
{0x6D309AC5, 0, 0, 0, MAPPER_SEGA, SYSTEM_SMS, REGION_JAPAN_NTSC}, /* Power Boggle Boggle (KR) */
/* games requiring random RAM pattern initialization */
{0x08BF3DE3, 0, 0, SYSTEM_MS_GAMEPAD, MAPPER_NONE, SYSTEM_MARKIII, REGION_JAPAN_NTSC}, /* Alibaba and 40 Thieves (KR) */
{0x643B6B76, 0, 0, SYSTEM_MS_GAMEPAD, MAPPER_NONE, SYSTEM_MARKIII, REGION_JAPAN_NTSC}, /* Block Hole (KR) */
{0x08BF3DE3, 0, 0, 0, MAPPER_NONE, SYSTEM_MARKIII, REGION_JAPAN_NTSC}, /* Alibaba and 40 Thieves (KR) */
{0x643B6B76, 0, 0, 0, MAPPER_NONE, SYSTEM_MARKIII, REGION_JAPAN_NTSC}, /* Block Hole (KR) */
/* games requiring PAL timings */
{0x72420F38, 0, 0, SYSTEM_MS_GAMEPAD, MAPPER_SEGA, SYSTEM_SMS2, REGION_EUROPE}, /* Addams Familly */
{0x2D48C1D3, 0, 0, SYSTEM_MS_GAMEPAD, MAPPER_SEGA, SYSTEM_SMS2, REGION_EUROPE}, /* Back to the Future Part III */
{0x1CBB7BF1, 0, 0, SYSTEM_MS_GAMEPAD, MAPPER_SEGA, SYSTEM_SMS2, REGION_EUROPE}, /* Battlemaniacs (BR) */
{0x1B10A951, 0, 0, SYSTEM_MS_GAMEPAD, MAPPER_SEGA, SYSTEM_SMS2, REGION_EUROPE}, /* Bram Stoker's Dracula */
{0xC0E25D62, 0, 0, SYSTEM_MS_GAMEPAD, MAPPER_SEGA, SYSTEM_SMS2, REGION_EUROPE}, /* California Games II */
{0x45C50294, 0, 0, SYSTEM_MS_GAMEPAD, MAPPER_SEGA, SYSTEM_SMS2, REGION_EUROPE}, /* Jogos de Verao II (BR) */
{0xC9DBF936, 0, 0, SYSTEM_MS_GAMEPAD, MAPPER_SEGA, SYSTEM_SMS2, REGION_EUROPE}, /* Home Alone */
{0x0047B615, 0, 0, SYSTEM_MS_GAMEPAD, MAPPER_SEGA, SYSTEM_SMS2, REGION_EUROPE}, /* Predator2 */
{0xF42E145C, 0, 0, SYSTEM_MS_GAMEPAD, MAPPER_SEGA, SYSTEM_SMS2, REGION_EUROPE}, /* Quest for the Shaven Yak Starring Ren Hoek & Stimpy (BR) */
{0x9F951756, 0, 0, SYSTEM_MS_GAMEPAD, MAPPER_SEGA, SYSTEM_SMS2, REGION_EUROPE}, /* RoboCop 3 */
{0xF8176918, 0, 0, SYSTEM_MS_GAMEPAD, MAPPER_SEGA, SYSTEM_SMS2, REGION_EUROPE}, /* Sensible Soccer */
{0x1575581D, 0, 0, SYSTEM_MS_GAMEPAD, MAPPER_SEGA, SYSTEM_SMS2, REGION_EUROPE}, /* Shadow of the Beast */
{0x96B3F29E, 0, 0, SYSTEM_MS_GAMEPAD, MAPPER_SEGA, SYSTEM_SMS2, REGION_EUROPE}, /* Sonic Blast (BR) */
{0x5B3B922C, 0, 0, SYSTEM_MS_GAMEPAD, MAPPER_SEGA, SYSTEM_SMS2, REGION_EUROPE}, /* Sonic the Hedgehog 2 [V0] */
{0xD6F2BFCA, 0, 0, SYSTEM_MS_GAMEPAD, MAPPER_SEGA, SYSTEM_SMS2, REGION_EUROPE}, /* Sonic the Hedgehog 2 [V1] */
{0xCA1D3752, 0, 0, SYSTEM_MS_GAMEPAD, MAPPER_SEGA, SYSTEM_SMS2, REGION_EUROPE}, /* Space Harrier [50 Hz] */
{0x85CFC9C9, 0, 0, SYSTEM_MS_GAMEPAD, MAPPER_SEGA, SYSTEM_SMS2, REGION_EUROPE}, /* Taito Chase H.Q. */
{0x332A847D, 0, 0, SYSTEM_MS_GAMEPAD, MAPPER_SEGA, SYSTEM_SMS2, REGION_EUROPE}, /* NBA Jam [Proto] */
{0x72420F38, 0, 0, 0, MAPPER_SEGA, SYSTEM_SMS2, REGION_EUROPE}, /* Addams Familly */
{0x2D48C1D3, 0, 0, 0, MAPPER_SEGA, SYSTEM_SMS2, REGION_EUROPE}, /* Back to the Future Part III */
{0x1CBB7BF1, 0, 0, 0, MAPPER_SEGA, SYSTEM_SMS2, REGION_EUROPE}, /* Battlemaniacs (BR) */
{0x1B10A951, 0, 0, 0, MAPPER_SEGA, SYSTEM_SMS2, REGION_EUROPE}, /* Bram Stoker's Dracula */
{0xC0E25D62, 0, 0, 0, MAPPER_SEGA, SYSTEM_SMS2, REGION_EUROPE}, /* California Games II */
{0x45C50294, 0, 0, 0, MAPPER_SEGA, SYSTEM_SMS2, REGION_EUROPE}, /* Jogos de Verao II (BR) */
{0xC9DBF936, 0, 0, 0, MAPPER_SEGA, SYSTEM_SMS2, REGION_EUROPE}, /* Home Alone */
{0x0047B615, 0, 0, 0, MAPPER_SEGA, SYSTEM_SMS2, REGION_EUROPE}, /* Predator2 */
{0xF42E145C, 0, 0, 0, MAPPER_SEGA, SYSTEM_SMS2, REGION_EUROPE}, /* Quest for the Shaven Yak Starring Ren Hoek & Stimpy (BR) */
{0x9F951756, 0, 0, 0, MAPPER_SEGA, SYSTEM_SMS2, REGION_EUROPE}, /* RoboCop 3 */
{0xF8176918, 0, 0, 0, MAPPER_SEGA, SYSTEM_SMS2, REGION_EUROPE}, /* Sensible Soccer */
{0x1575581D, 0, 0, 0, MAPPER_SEGA, SYSTEM_SMS2, REGION_EUROPE}, /* Shadow of the Beast */
{0x96B3F29E, 0, 0, 0, MAPPER_SEGA, SYSTEM_SMS2, REGION_EUROPE}, /* Sonic Blast (BR) */
{0x5B3B922C, 0, 0, 0, MAPPER_SEGA, SYSTEM_SMS2, REGION_EUROPE}, /* Sonic the Hedgehog 2 [V0] */
{0xD6F2BFCA, 0, 0, 0, MAPPER_SEGA, SYSTEM_SMS2, REGION_EUROPE}, /* Sonic the Hedgehog 2 [V1] */
{0xCA1D3752, 0, 0, 0, MAPPER_SEGA, SYSTEM_SMS2, REGION_EUROPE}, /* Space Harrier [50 Hz] */
{0x85CFC9C9, 0, 0, 0, MAPPER_SEGA, SYSTEM_SMS2, REGION_EUROPE}, /* Taito Chase H.Q. */
{0x332A847D, 0, 0, 0, MAPPER_SEGA, SYSTEM_SMS2, REGION_EUROPE}, /* NBA Jam [Proto] */
/* games running in Game Gear MS compatibility mode */
{0x59840FD6, 0, 0, SYSTEM_MS_GAMEPAD, MAPPER_SEGA, SYSTEM_GGMS, REGION_USA}, /* Castle of Illusion - Starring Mickey Mouse [SMS-GG] */
{0x9C76FB3A, 0, 0, SYSTEM_MS_GAMEPAD, MAPPER_SEGA, SYSTEM_GGMS, REGION_USA}, /* Rastan Saga [SMS-GG] */
{0xC8381DEF, 0, 0, SYSTEM_MS_GAMEPAD, MAPPER_SEGA, SYSTEM_GGMS, REGION_USA}, /* Taito Chase H.Q [SMS-GG] */
{0xDA8E95A9, 0, 0, SYSTEM_MS_GAMEPAD, MAPPER_SEGA, SYSTEM_GGMS, REGION_USA}, /* WWF Wrestlemania Steel Cage Challenge [SMS-GG] */
{0x1D93246E, 0, 0, SYSTEM_MS_GAMEPAD, MAPPER_SEGA, SYSTEM_GGMS, REGION_USA}, /* Olympic Gold [A][SMS-GG] */
{0xA2F9C7AF, 0, 0, SYSTEM_MS_GAMEPAD, MAPPER_SEGA, SYSTEM_GGMS, REGION_USA}, /* Olympic Gold [B][SMS-GG] */
{0x01EAB89D, 0, 0, SYSTEM_MS_GAMEPAD, MAPPER_SEGA, SYSTEM_GGMS, REGION_USA}, /* Out Run Europa [SMS-GG] */
{0xF037EC00, 0, 0, SYSTEM_MS_GAMEPAD, MAPPER_SEGA, SYSTEM_GGMS, REGION_USA}, /* Out Run Europa (US) [SMS-GG] */
{0xE5F789B9, 0, 0, SYSTEM_MS_GAMEPAD, MAPPER_SEGA, SYSTEM_GGMS, REGION_USA}, /* Predator 2 [SMS-GG] */
{0x311D2863, 0, 0, SYSTEM_MS_GAMEPAD, MAPPER_SEGA, SYSTEM_GGMS, REGION_USA}, /* Prince of Persia [A][SMS-GG] */
{0x45F058D6, 0, 0, SYSTEM_MS_GAMEPAD, MAPPER_SEGA, SYSTEM_GGMS, REGION_USA}, /* Prince of Persia [B][SMS-GG] */
{0x56201996, 0, 0, SYSTEM_MS_GAMEPAD, MAPPER_SEGA, SYSTEM_GGMS, REGION_USA}, /* R.C. Grand Prix [SMS-GG] */
{0x10DBBEF4, 0, 0, SYSTEM_MS_GAMEPAD, MAPPER_SEGA, SYSTEM_GGMS, REGION_USA}, /* Super Kick Off [SMS-GG] */
{0x9942B69B, 0, 0, SYSTEM_MS_GAMEPAD, MAPPER_SEGA, SYSTEM_GGMS, REGION_JAPAN_NTSC}, /* Castle of Illusion - Starring Mickey Mouse (J) [SMS-GG] */
{0x7BB81E3D, 0, 0, SYSTEM_MS_GAMEPAD, MAPPER_SEGA, SYSTEM_GGMS, REGION_JAPAN_NTSC}, /* Taito Chase H.Q (J) [SMS-GG] */
{0x6F8E46CF, 0, 0, SYSTEM_MS_GAMEPAD, MAPPER_SEGA, SYSTEM_GGMS, REGION_JAPAN_NTSC}, /* Alex Kidd in Miracle World (TW) [SMS-GG] */
{0x3382D73F, 0, 0, SYSTEM_MS_GAMEPAD, MAPPER_SEGA, SYSTEM_GGMS, REGION_JAPAN_NTSC}, /* Olympic Gold (TW) [SMS-GG] */
{0x59840FD6, 0, 0, 0, MAPPER_SEGA, SYSTEM_GGMS, REGION_USA}, /* Castle of Illusion - Starring Mickey Mouse [SMS-GG] */
{0x9C76FB3A, 0, 0, 0, MAPPER_SEGA, SYSTEM_GGMS, REGION_USA}, /* Rastan Saga [SMS-GG] */
{0xC8381DEF, 0, 0, 0, MAPPER_SEGA, SYSTEM_GGMS, REGION_USA}, /* Taito Chase H.Q [SMS-GG] */
{0xDA8E95A9, 0, 0, 0, MAPPER_SEGA, SYSTEM_GGMS, REGION_USA}, /* WWF Wrestlemania Steel Cage Challenge [SMS-GG] */
{0x1D93246E, 0, 0, 0, MAPPER_SEGA, SYSTEM_GGMS, REGION_USA}, /* Olympic Gold [A][SMS-GG] */
{0xA2F9C7AF, 0, 0, 0, MAPPER_SEGA, SYSTEM_GGMS, REGION_USA}, /* Olympic Gold [B][SMS-GG] */
{0x01EAB89D, 0, 0, 0, MAPPER_SEGA, SYSTEM_GGMS, REGION_USA}, /* Out Run Europa [SMS-GG] */
{0xF037EC00, 0, 0, 0, MAPPER_SEGA, SYSTEM_GGMS, REGION_USA}, /* Out Run Europa (US) [SMS-GG] */
{0xE5F789B9, 0, 0, 0, MAPPER_SEGA, SYSTEM_GGMS, REGION_USA}, /* Predator 2 [SMS-GG] */
{0x311D2863, 0, 0, 0, MAPPER_SEGA, SYSTEM_GGMS, REGION_USA}, /* Prince of Persia [A][SMS-GG] */
{0x45F058D6, 0, 0, 0, MAPPER_SEGA, SYSTEM_GGMS, REGION_USA}, /* Prince of Persia [B][SMS-GG] */
{0x56201996, 0, 0, 0, MAPPER_SEGA, SYSTEM_GGMS, REGION_USA}, /* R.C. Grand Prix [SMS-GG] */
{0x10DBBEF4, 0, 0, 0, MAPPER_SEGA, SYSTEM_GGMS, REGION_USA}, /* Super Kick Off [SMS-GG] */
{0x9942B69B, 0, 0, 0, MAPPER_SEGA, SYSTEM_GGMS, REGION_JAPAN_NTSC}, /* Castle of Illusion - Starring Mickey Mouse (J) [SMS-GG] */
{0x7BB81E3D, 0, 0, 0, MAPPER_SEGA, SYSTEM_GGMS, REGION_JAPAN_NTSC}, /* Taito Chase H.Q (J) [SMS-GG] */
{0x6F8E46CF, 0, 0, 0, MAPPER_SEGA, SYSTEM_GGMS, REGION_JAPAN_NTSC}, /* Alex Kidd in Miracle World (TW) [SMS-GG] */
{0x3382D73F, 0, 0, 0, MAPPER_SEGA, SYSTEM_GGMS, REGION_JAPAN_NTSC}, /* Olympic Gold (TW) [SMS-GG] */
/* games requiring 3-D Glasses */
{0x6BD5C2BF, 1, 1, SYSTEM_MS_GAMEPAD, MAPPER_SEGA, SYSTEM_SMS2, REGION_USA}, /* Space Harrier 3-D */
{0x8ECD201C, 1, 1, SYSTEM_MS_GAMEPAD, MAPPER_SEGA, SYSTEM_SMS2, REGION_USA}, /* Blade Eagle 3-D */
{0xFBF96C81, 1, 1, SYSTEM_MS_GAMEPAD, MAPPER_SEGA, SYSTEM_SMS2, REGION_USA}, /* Blade Eagle 3-D (BR) */
{0x58D5FC48, 1, 1, SYSTEM_MS_GAMEPAD, MAPPER_SEGA, SYSTEM_SMS2, REGION_USA}, /* Blade Eagle 3-D [Proto] */
{0x31B8040B, 1, 1, SYSTEM_MS_GAMEPAD, MAPPER_SEGA, SYSTEM_SMS2, REGION_USA}, /* Maze Hunter 3-D */
{0xABD48AD2, 1, 1, SYSTEM_MS_GAMEPAD, MAPPER_SEGA, SYSTEM_SMS2, REGION_USA}, /* Poseidon Wars 3-D */
{0xA3EF13CB, 1, 1, SYSTEM_MS_GAMEPAD, MAPPER_SEGA, SYSTEM_SMS2, REGION_USA}, /* Zaxxon 3-D */
{0xBBA74147, 1, 1, SYSTEM_MS_GAMEPAD, MAPPER_SEGA, SYSTEM_SMS2, REGION_USA}, /* Zaxxon 3-D [Proto] */
{0xD6F43DDA, 1, 1, SYSTEM_MS_GAMEPAD, MAPPER_SEGA, SYSTEM_SMS2, REGION_USA}, /* Out Run 3-D */
{0x871562b0, 1, 1, SYSTEM_MS_GAMEPAD, MAPPER_SEGA, SYSTEM_SMS, REGION_JAPAN_NTSC}, /* Maze Walker */
{0x156948f9, 1, 1, SYSTEM_MS_GAMEPAD, MAPPER_SEGA, SYSTEM_SMS, REGION_JAPAN_NTSC}, /* Space Harrier 3-D (J) */
{0x6BD5C2BF, 1, 1, 0, MAPPER_SEGA, SYSTEM_SMS, REGION_USA}, /* Space Harrier 3-D */
{0x8ECD201C, 1, 1, 0, MAPPER_SEGA, SYSTEM_SMS, REGION_USA}, /* Blade Eagle 3-D */
{0xFBF96C81, 1, 1, 0, MAPPER_SEGA, SYSTEM_SMS, REGION_USA}, /* Blade Eagle 3-D (BR) */
{0x58D5FC48, 1, 1, 0, MAPPER_SEGA, SYSTEM_SMS, REGION_USA}, /* Blade Eagle 3-D [Proto] */
{0x31B8040B, 1, 1, 0, MAPPER_SEGA, SYSTEM_SMS, REGION_USA}, /* Maze Hunter 3-D */
{0xABD48AD2, 1, 1, 0, MAPPER_SEGA, SYSTEM_SMS, REGION_USA}, /* Poseidon Wars 3-D */
{0xA3EF13CB, 1, 1, 0, MAPPER_SEGA, SYSTEM_SMS, REGION_USA}, /* Zaxxon 3-D */
{0xBBA74147, 1, 1, 0, MAPPER_SEGA, SYSTEM_SMS, REGION_USA}, /* Zaxxon 3-D [Proto] */
{0xD6F43DDA, 1, 1, 0, MAPPER_SEGA, SYSTEM_SMS, REGION_USA}, /* Out Run 3-D */
{0x871562b0, 1, 1, 0, MAPPER_SEGA, SYSTEM_SMS, REGION_JAPAN_NTSC}, /* Maze Walker */
{0x156948f9, 1, 1, 0, MAPPER_SEGA, SYSTEM_SMS, REGION_JAPAN_NTSC}, /* Space Harrier 3-D (J) */
/* games requiring 3-D Glasses & Sega Light Phaser */
{0xFBE5CFBB, 1, 0, SYSTEM_LIGHTPHASER, MAPPER_SEGA, SYSTEM_SMS2, REGION_USA}, /* Missile Defense 3D */
{0xE79BB689, 1, 0, SYSTEM_LIGHTPHASER, MAPPER_SEGA, SYSTEM_SMS2, REGION_USA}, /* Missile Defense 3D [BIOS] */
{0xFBE5CFBB, 1, 0, SYSTEM_LIGHTPHASER, MAPPER_SEGA, SYSTEM_SMS, REGION_USA}, /* Missile Defense 3D */
{0xE79BB689, 1, 0, SYSTEM_LIGHTPHASER, MAPPER_SEGA, SYSTEM_SMS, REGION_USA}, /* Missile Defense 3D [BIOS] */
/* games requiring Sega Light Phaser */
{0x861B6E79, 0, 0, SYSTEM_LIGHTPHASER, MAPPER_SEGA, SYSTEM_SMS2, REGION_USA}, /* Assault City [Light Phaser] */
{0x5FC74D2A, 0, 0, SYSTEM_LIGHTPHASER, MAPPER_SEGA, SYSTEM_SMS2, REGION_USA}, /* Gangster Town */
{0xE167A561, 0, 0, SYSTEM_LIGHTPHASER, MAPPER_SEGA, SYSTEM_SMS2, REGION_USA}, /* Hang-On / Safari Hunt */
{0x91E93385, 0, 0, SYSTEM_LIGHTPHASER, MAPPER_SEGA, SYSTEM_SMS2, REGION_USA}, /* Hang-On / Safari Hunt [BIOS] */
{0xE8EA842C, 0, 0, SYSTEM_LIGHTPHASER, MAPPER_SEGA, SYSTEM_SMS2, REGION_USA}, /* Marksman Shooting / Trap Shooting */
{0xE8215C2E, 0, 0, SYSTEM_LIGHTPHASER, MAPPER_SEGA, SYSTEM_SMS2, REGION_USA}, /* Marksman Shooting / Trap Shooting / Safari Hunt */
{0x205CAAE8, 0, 0, SYSTEM_LIGHTPHASER, MAPPER_SEGA, SYSTEM_SMS2, REGION_USA}, /* Operation Wolf */
{0x23283F37, 0, 0, SYSTEM_LIGHTPHASER, MAPPER_SEGA, SYSTEM_SMS2, REGION_USA}, /* Operation Wolf [A] */
{0xDA5A7013, 0, 0, SYSTEM_LIGHTPHASER, MAPPER_SEGA, SYSTEM_SMS2, REGION_USA}, /* Rambo 3 */
{0x79AC8E7F, 0, 1, SYSTEM_LIGHTPHASER, MAPPER_SEGA, SYSTEM_SMS2, REGION_USA}, /* Rescue Mission */
{0x4B051022, 0, 0, SYSTEM_LIGHTPHASER, MAPPER_SEGA, SYSTEM_SMS2, REGION_USA}, /* Shooting Gallery */
{0xA908CFF5, 0, 0, SYSTEM_LIGHTPHASER, MAPPER_SEGA, SYSTEM_SMS2, REGION_USA}, /* Spacegun */
{0x5359762D, 0, 0, SYSTEM_LIGHTPHASER, MAPPER_SEGA, SYSTEM_SMS2, REGION_USA}, /* Wanted */
{0x0CA95637, 0, 0, SYSTEM_LIGHTPHASER, MAPPER_SEGA, SYSTEM_SMS2, REGION_USA}, /* Laser Ghost */
{0x861B6E79, 0, 0, SYSTEM_LIGHTPHASER, MAPPER_SEGA, SYSTEM_SMS, REGION_USA}, /* Assault City [Light Phaser] */
{0x5FC74D2A, 0, 0, SYSTEM_LIGHTPHASER, MAPPER_SEGA, SYSTEM_SMS, REGION_USA}, /* Gangster Town */
{0xE167A561, 0, 0, SYSTEM_LIGHTPHASER, MAPPER_SEGA, SYSTEM_SMS, REGION_USA}, /* Hang-On / Safari Hunt */
{0x91E93385, 0, 0, SYSTEM_LIGHTPHASER, MAPPER_SEGA, SYSTEM_SMS, REGION_USA}, /* Hang-On / Safari Hunt [BIOS] */
{0xE8EA842C, 0, 0, SYSTEM_LIGHTPHASER, MAPPER_SEGA, SYSTEM_SMS, REGION_USA}, /* Marksman Shooting / Trap Shooting */
{0xE8215C2E, 0, 0, SYSTEM_LIGHTPHASER, MAPPER_SEGA, SYSTEM_SMS, REGION_USA}, /* Marksman Shooting / Trap Shooting / Safari Hunt */
{0x205CAAE8, 0, 0, SYSTEM_LIGHTPHASER, MAPPER_SEGA, SYSTEM_SMS, REGION_USA}, /* Operation Wolf */
{0x23283F37, 0, 0, SYSTEM_LIGHTPHASER, MAPPER_SEGA, SYSTEM_SMS, REGION_USA}, /* Operation Wolf [A] */
{0xDA5A7013, 0, 0, SYSTEM_LIGHTPHASER, MAPPER_SEGA, SYSTEM_SMS, REGION_USA}, /* Rambo 3 */
{0x79AC8E7F, 0, 1, SYSTEM_LIGHTPHASER, MAPPER_SEGA, SYSTEM_SMS, REGION_USA}, /* Rescue Mission */
{0x4B051022, 0, 0, SYSTEM_LIGHTPHASER, MAPPER_SEGA, SYSTEM_SMS, REGION_USA}, /* Shooting Gallery */
{0xA908CFF5, 0, 0, SYSTEM_LIGHTPHASER, MAPPER_SEGA, SYSTEM_SMS, REGION_USA}, /* Spacegun */
{0x5359762D, 0, 0, SYSTEM_LIGHTPHASER, MAPPER_SEGA, SYSTEM_SMS, REGION_USA}, /* Wanted */
{0x0CA95637, 0, 0, SYSTEM_LIGHTPHASER, MAPPER_SEGA, SYSTEM_SMS, REGION_USA}, /* Laser Ghost */
/* games requiring Sega Paddle */
{0xF9DBB533, 0, 1, SYSTEM_PADDLE, MAPPER_SEGA, SYSTEM_SMS, REGION_JAPAN_NTSC}, /* Alex Kidd BMX Trial */
{0xA6FA42D0, 0, 1, SYSTEM_PADDLE, MAPPER_SEGA, SYSTEM_SMS, REGION_JAPAN_NTSC}, /* Galactic Protector */
{0x29BC7FAD, 0, 1, SYSTEM_PADDLE, MAPPER_SEGA, SYSTEM_SMS, REGION_JAPAN_NTSC}, /* Megumi Rescue */
{0x315917D4, 0, 0, SYSTEM_PADDLE, MAPPER_SEGA, SYSTEM_SMS, REGION_JAPAN_NTSC}, /* Woody Pop */
{0xF9DBB533, 0, 1, SYSTEM_PADDLE, MAPPER_SEGA, SYSTEM_SMS, REGION_JAPAN_NTSC}, /* Alex Kidd BMX Trial */
{0xA6FA42D0, 0, 1, SYSTEM_PADDLE, MAPPER_SEGA, SYSTEM_SMS, REGION_JAPAN_NTSC}, /* Galactic Protector */
{0x29BC7FAD, 0, 1, SYSTEM_PADDLE, MAPPER_SEGA, SYSTEM_SMS, REGION_JAPAN_NTSC}, /* Megumi Rescue */
{0x315917D4, 0, 0, SYSTEM_PADDLE, MAPPER_SEGA, SYSTEM_SMS, REGION_JAPAN_NTSC}, /* Woody Pop */
/* games requiring Sega Sport Pad */
{0x0CB7E21F, 0, 0, SYSTEM_SPORTSPAD, MAPPER_SEGA, SYSTEM_SMS2, REGION_USA}, /* Great Ice Hockey */
{0xE42E4998, 0, 0, SYSTEM_SPORTSPAD, MAPPER_SEGA, SYSTEM_SMS2, REGION_USA}, /* Sports Pad Football */
{0x41C948BF, 0, 0, SYSTEM_SPORTSPAD, MAPPER_SEGA, SYSTEM_SMS2, REGION_USA}, /* Sports Pad Soccer */
{0x41C948BF, 0, 0, SYSTEM_SPORTSPAD, MAPPER_SEGA, SYSTEM_SMS, REGION_JAPAN_NTSC}, /* Sports Pad Soccer */
{0x0CB7E21F, 0, 0, SYSTEM_SPORTSPAD, MAPPER_SEGA, SYSTEM_SMS, REGION_USA}, /* Great Ice Hockey */
{0xE42E4998, 0, 0, SYSTEM_SPORTSPAD, MAPPER_SEGA, SYSTEM_SMS, REGION_USA}, /* Sports Pad Football */
/* games requiring Furrtek's Master Tap */
{0xFAB6F52F, 0, 0, SYSTEM_MASTERTAP, MAPPER_NONE, SYSTEM_SMS2, REGION_USA}, /* BOom (v1.0) */
{0x143AB50B, 0, 0, SYSTEM_MASTERTAP, MAPPER_NONE, SYSTEM_SMS2, REGION_USA}, /* BOom (v1.1) */
/* games requiring Sega Graphic Board */
{0x276AA542, 0, 0, SYSTEM_GRAPHIC_BOARD, MAPPER_NONE, SYSTEM_SMS, REGION_USA}, /* Sega Graphic Board v2.0 Software (Prototype) */
/* games supporting YM2413 FM */
{0x1C951F8E, 0, 1, SYSTEM_MS_GAMEPAD, MAPPER_SEGA, SYSTEM_SMS2, REGION_USA}, /* After Burner */
{0xC13896D5, 0, 1, SYSTEM_MS_GAMEPAD, MAPPER_SEGA, SYSTEM_SMS2, REGION_USA}, /* Alex Kidd: The Lost Stars */
{0x5CBFE997, 0, 1, SYSTEM_MS_GAMEPAD, MAPPER_SEGA, SYSTEM_SMS2, REGION_USA}, /* Alien Syndrome */
{0xBBA2FE98, 0, 1, SYSTEM_MS_GAMEPAD, MAPPER_SEGA, SYSTEM_SMS2, REGION_USA}, /* Altered Beast */
{0xFF614EB3, 0, 1, SYSTEM_MS_GAMEPAD, MAPPER_SEGA, SYSTEM_SMS2, REGION_USA}, /* Aztec Adventure */
{0x3084CF11, 0, 1, SYSTEM_MS_GAMEPAD, MAPPER_SEGA, SYSTEM_SMS2, REGION_USA}, /* Bomber Raid */
{0xAC6009A7, 0, 1, SYSTEM_MS_GAMEPAD, MAPPER_SEGA, SYSTEM_SMS2, REGION_USA}, /* California Games */
{0xA4852757, 0, 1, SYSTEM_MS_GAMEPAD, MAPPER_SEGA, SYSTEM_SMS2, REGION_USA}, /* Captain Silver */
{0xB81F6FA5, 0, 1, SYSTEM_MS_GAMEPAD, MAPPER_SEGA, SYSTEM_SMS2, REGION_USA}, /* Captain Silver (U) */
{0x3CFF6E80, 0, 1, SYSTEM_MS_GAMEPAD, MAPPER_SEGA, SYSTEM_SMS2, REGION_USA}, /* Casino Games */
{0xE7F62E6D, 0, 1, SYSTEM_MS_GAMEPAD, MAPPER_SEGA, SYSTEM_SMS2, REGION_USA}, /* Cloud Master */
{0x908E7524, 0, 1, SYSTEM_MS_GAMEPAD, MAPPER_SEGA, SYSTEM_SMS2, REGION_USA}, /* Cyborg Hunter */
{0xA55D89F3, 0, 1, SYSTEM_MS_GAMEPAD, MAPPER_SEGA, SYSTEM_SMS2, REGION_USA}, /* Double Dragon */
{0xB8B141F9, 0, 1, SYSTEM_MS_GAMEPAD, MAPPER_SEGA, SYSTEM_SMS2, REGION_USA}, /* Fantasy Zone II */
{0xD29889AD, 0, 1, SYSTEM_MS_GAMEPAD, MAPPER_SEGA, SYSTEM_SMS2, REGION_USA}, /* Fantasy Zone: The Maze */
{0xA4AC35D8, 0, 1, SYSTEM_MS_GAMEPAD, MAPPER_SEGA, SYSTEM_SMS2, REGION_USA}, /* Galaxy Force */
{0x6C827520, 0, 1, SYSTEM_MS_GAMEPAD, MAPPER_SEGA, SYSTEM_SMS2, REGION_USA}, /* Galaxy Force (U) */
{0x1890F407, 0, 1, SYSTEM_MS_GAMEPAD, MAPPER_SEGA, SYSTEM_SMS2, REGION_USA}, /* Game Box Série Esportes Radicais (BR) */
{0xB746A6F5, 0, 1, SYSTEM_MS_GAMEPAD, MAPPER_SEGA, SYSTEM_SMS2, REGION_USA}, /* Global Defense */
{0x91A0FC4E, 0, 1, SYSTEM_MS_GAMEPAD, MAPPER_SEGA, SYSTEM_SMS2, REGION_USA}, /* Global Defense [Proto] */
{0x48651325, 0, 1, SYSTEM_MS_GAMEPAD, MAPPER_SEGA, SYSTEM_SMS2, REGION_USA}, /* Golfamania */
{0x5DABFDC3, 0, 1, SYSTEM_MS_GAMEPAD, MAPPER_SEGA, SYSTEM_SMS2, REGION_USA}, /* Golfamania [Proto] */
{0xA51376FE, 0, 1, SYSTEM_MS_GAMEPAD, MAPPER_SEGA, SYSTEM_SMS2, REGION_USA}, /* Golvellius - Valley of Doom */
{0x98E4AE4A, 0, 1, SYSTEM_MS_GAMEPAD, MAPPER_SEGA, SYSTEM_SMS2, REGION_USA}, /* Great Golf */
{0x516ED32E, 0, 1, SYSTEM_MS_GAMEPAD, MAPPER_SEGA, SYSTEM_SMS2, REGION_USA}, /* Kenseiden */
{0xE8511B08, 0, 1, SYSTEM_MS_GAMEPAD, MAPPER_SEGA, SYSTEM_SMS2, REGION_USA}, /* Lord of The Sword */
{0x0E333B6E, 0, 1, SYSTEM_MS_GAMEPAD, MAPPER_SEGA, SYSTEM_SMS2, REGION_USA}, /* Miracle Warriors - Seal of The Dark Lord */
{0x301A59AA, 0, 1, SYSTEM_MS_GAMEPAD, MAPPER_SEGA, SYSTEM_SMS2, REGION_USA}, /* Miracle Warriors - Seal of The Dark Lord [Proto] */
{0x01D67C0B, 0, 1, SYSTEM_MS_GAMEPAD, MAPPER_SEGA, SYSTEM_SMS2, REGION_USA}, /* Mônica no Castelo do Dragão (BR) */
{0x5589D8D2, 0, 1, SYSTEM_MS_GAMEPAD, MAPPER_SEGA, SYSTEM_SMS2, REGION_USA}, /* Out Run */
{0xE030E66C, 0, 1, SYSTEM_MS_GAMEPAD, MAPPER_SEGA, SYSTEM_SMS2, REGION_USA}, /* Parlour Games */
{0xF97E9875, 0, 1, SYSTEM_MS_GAMEPAD, MAPPER_SEGA, SYSTEM_SMS2, REGION_USA}, /* Penguin Land */
{0x4077EFD9, 0, 1, SYSTEM_MS_GAMEPAD, MAPPER_SEGA, SYSTEM_SMS2, REGION_USA}, /* Power Strike */
{0xBB54B6B0, 0, 1, SYSTEM_MS_GAMEPAD, MAPPER_SEGA, SYSTEM_SMS2, REGION_USA}, /* R-Type */
{0x42FC47EE, 0, 1, SYSTEM_MS_GAMEPAD, MAPPER_SEGA, SYSTEM_SMS2, REGION_USA}, /* Rampage */
{0xC547EB1B, 0, 1, SYSTEM_MS_GAMEPAD, MAPPER_SEGA, SYSTEM_SMS2, REGION_USA}, /* Rastan */
{0x9A8B28EC, 0, 1, SYSTEM_MS_GAMEPAD, MAPPER_SEGA, SYSTEM_SMS2, REGION_USA}, /* Scramble Spirits */
{0xAAB67EC3, 0, 1, SYSTEM_MS_GAMEPAD, MAPPER_SEGA, SYSTEM_SMS2, REGION_USA}, /* Shanghai */
{0x0C6FAC4E, 0, 1, SYSTEM_MS_GAMEPAD, MAPPER_SEGA, SYSTEM_SMS2, REGION_USA}, /* Shinobi */
{0x4752CAE7, 0, 1, SYSTEM_MS_GAMEPAD, MAPPER_SEGA, SYSTEM_SMS2, REGION_USA}, /* SpellCaster */
{0x1A390B93, 0, 1, SYSTEM_MS_GAMEPAD, MAPPER_SEGA, SYSTEM_SMS2, REGION_USA}, /* Tennis Ace */
{0xAE920E4B, 0, 1, SYSTEM_MS_GAMEPAD, MAPPER_SEGA, SYSTEM_SMS2, REGION_USA}, /* Thunder Blade */
{0x51BD14BE, 0, 1, SYSTEM_MS_GAMEPAD, MAPPER_SEGA, SYSTEM_SMS2, REGION_USA}, /* Time Soldiers */
{0x22CCA9BB, 0, 1, SYSTEM_MS_GAMEPAD, MAPPER_SEGA, SYSTEM_SMS2, REGION_USA}, /* Turma da Mônica em: O Resgate (BR) */
{0xB52D60C8, 0, 1, SYSTEM_MS_GAMEPAD, MAPPER_SEGA, SYSTEM_SMS2, REGION_USA}, /* Ultima IV */
{0xDE9F8517, 0, 1, SYSTEM_MS_GAMEPAD, MAPPER_SEGA, SYSTEM_SMS2, REGION_USA}, /* Ultima IV [Proto] */
{0xDFB0B161, 0, 1, SYSTEM_MS_GAMEPAD, MAPPER_SEGA, SYSTEM_SMS2, REGION_USA}, /* Vigilante */
{0x679E1676, 0, 1, SYSTEM_MS_GAMEPAD, MAPPER_SEGA, SYSTEM_SMS2, REGION_USA}, /* Wonder Boy III: The Dragon's Trap */
{0x8CBEF0C1, 0, 1, SYSTEM_MS_GAMEPAD, MAPPER_SEGA, SYSTEM_SMS2, REGION_USA}, /* Wonder Boy in Monster Land */
{0x2F2E3BC9, 0, 1, SYSTEM_MS_GAMEPAD, MAPPER_SEGA, SYSTEM_SMS2, REGION_USA}, /* Zillion II - The Tri Formation */
{0x48D44A13, 0, 1, SYSTEM_MS_GAMEPAD, MAPPER_NONE, SYSTEM_SMS, REGION_JAPAN_NTSC}, /* BIOS (J) */
{0xD8C4165B, 0, 1, SYSTEM_MS_GAMEPAD, MAPPER_SEGA, SYSTEM_SMS, REGION_JAPAN_NTSC}, /* Aleste */
{0x4CC11DF9, 0, 1, SYSTEM_MS_GAMEPAD, MAPPER_SEGA, SYSTEM_SMS, REGION_JAPAN_NTSC}, /* Alien Syndrome (J) */
{0xE421E466, 0, 1, SYSTEM_MS_GAMEPAD, MAPPER_SEGA, SYSTEM_SMS, REGION_JAPAN_NTSC}, /* Chouon Senshi Borgman */
{0x2BCDB8FA, 0, 1, SYSTEM_MS_GAMEPAD, MAPPER_SEGA, SYSTEM_SMS, REGION_JAPAN_NTSC}, /* Doki Doki Penguin Land - Uchuu-Daibouken */
{0x56BD2455, 0, 1, SYSTEM_MS_GAMEPAD, MAPPER_SEGA, SYSTEM_SMS, REGION_JAPAN_NTSC}, /* Doki Doki Penguin Land - Uchuu-Daibouken [Proto] */
{0xC722FB42, 0, 1, SYSTEM_MS_GAMEPAD, MAPPER_SEGA, SYSTEM_SMS, REGION_JAPAN_NTSC}, /* Fantasy Zone II (J) */
{0x7ABC70E9, 0, 1, SYSTEM_MS_GAMEPAD, MAPPER_SEGA, SYSTEM_SMS, REGION_JAPAN_NTSC}, /* Family Games (Party Games) */
{0x6586BD1F, 0, 1, SYSTEM_MS_GAMEPAD, MAPPER_SEGA, SYSTEM_SMS, REGION_JAPAN_NTSC}, /* Masters Golf */
{0x4847BC91, 0, 1, SYSTEM_MS_GAMEPAD, MAPPER_SEGA, SYSTEM_SMS, REGION_JAPAN_NTSC}, /* Masters Golf [Proto] */
{0xB9FDF6D9, 0, 1, SYSTEM_MS_GAMEPAD, MAPPER_SEGA, SYSTEM_SMS, REGION_JAPAN_NTSC}, /* Haja no Fuuin */
{0x955A009E, 0, 1, SYSTEM_MS_GAMEPAD, MAPPER_SEGA, SYSTEM_SMS, REGION_JAPAN_NTSC}, /* Hoshi wo Sagashite */
{0x05EA5353, 0, 1, SYSTEM_MS_GAMEPAD, MAPPER_SEGA, SYSTEM_SMS, REGION_JAPAN_NTSC}, /* Kenseiden (J) */
{0xD11D32E4, 0, 1, SYSTEM_MS_GAMEPAD, MAPPER_SEGA, SYSTEM_SMS, REGION_JAPAN_NTSC}, /* Kujakuou */
{0xAA7D6F45, 0, 1, SYSTEM_MS_GAMEPAD, MAPPER_SEGA, SYSTEM_SMS, REGION_JAPAN_NTSC}, /* Lord of Sword */
{0xBF0411AD, 0, 1, SYSTEM_MS_GAMEPAD, MAPPER_SEGA, SYSTEM_SMS, REGION_JAPAN_NTSC}, /* Maou Golvellius */
{0x21A21352, 0, 1, SYSTEM_MS_GAMEPAD, MAPPER_SEGA, SYSTEM_SMS, REGION_JAPAN_NTSC}, /* Maou Golvellius [Proto] */
{0x5B5F9106, 0, 1, SYSTEM_MS_GAMEPAD, MAPPER_SEGA, SYSTEM_SMS, REGION_JAPAN_NTSC}, /* Nekyuu Kousien */
{0xBEA27D5C, 0, 1, SYSTEM_MS_GAMEPAD, MAPPER_SEGA, SYSTEM_SMS, REGION_JAPAN_NTSC}, /* Opa Opa */
{0x6605D36A, 0, 1, SYSTEM_MS_GAMEPAD, MAPPER_SEGA, SYSTEM_SMS, REGION_JAPAN_NTSC}, /* Phantasy Star (J) */
{0xE1FFF1BB, 0, 1, SYSTEM_MS_GAMEPAD, MAPPER_SEGA, SYSTEM_SMS, REGION_JAPAN_NTSC}, /* Shinobi (J) */
{0x11645549, 0, 1, SYSTEM_MS_GAMEPAD, MAPPER_SEGA, SYSTEM_SMS, REGION_JAPAN_NTSC}, /* Solomon no Kagi - Oujo Rihita no Namida */
{0x7E0EF8CB, 0, 1, SYSTEM_MS_GAMEPAD, MAPPER_SEGA, SYSTEM_SMS, REGION_JAPAN_NTSC}, /* Super Racing */
{0xB1DA6A30, 0, 1, SYSTEM_MS_GAMEPAD, MAPPER_SEGA, SYSTEM_SMS, REGION_JAPAN_NTSC}, /* Super Wonder Boy Monster World */
{0x8132AB2C, 0, 1, SYSTEM_MS_GAMEPAD, MAPPER_SEGA, SYSTEM_SMS, REGION_JAPAN_NTSC}, /* Tensai Bakabon */
{0xC0CE19B1, 0, 1, SYSTEM_MS_GAMEPAD, MAPPER_SEGA, SYSTEM_SMS, REGION_JAPAN_NTSC}, /* Thunder Blade (J) */
{0x07301F83, 0, 1, SYSTEM_MS_GAMEPAD, MAPPER_SEGA, SYSTEM_PBC, REGION_JAPAN_NTSC} /* Phantasy Star [Megadrive] (J) */
{0x1C951F8E, 0, 1, 0, MAPPER_SEGA, SYSTEM_SMS, REGION_USA}, /* After Burner */
{0xC13896D5, 0, 1, 0, MAPPER_SEGA, SYSTEM_SMS, REGION_USA}, /* Alex Kidd: The Lost Stars */
{0x5CBFE997, 0, 1, 0, MAPPER_SEGA, SYSTEM_SMS, REGION_USA}, /* Alien Syndrome */
{0xBBA2FE98, 0, 1, 0, MAPPER_SEGA, SYSTEM_SMS, REGION_USA}, /* Altered Beast */
{0xFF614EB3, 0, 1, 0, MAPPER_SEGA, SYSTEM_SMS, REGION_USA}, /* Aztec Adventure */
{0x3084CF11, 0, 1, 0, MAPPER_SEGA, SYSTEM_SMS, REGION_USA}, /* Bomber Raid */
{0xAC6009A7, 0, 1, 0, MAPPER_SEGA, SYSTEM_SMS, REGION_USA}, /* California Games */
{0xA4852757, 0, 1, 0, MAPPER_SEGA, SYSTEM_SMS, REGION_USA}, /* Captain Silver */
{0xB81F6FA5, 0, 1, 0, MAPPER_SEGA, SYSTEM_SMS, REGION_USA}, /* Captain Silver (U) */
{0x3CFF6E80, 0, 1, 0, MAPPER_SEGA, SYSTEM_SMS, REGION_USA}, /* Casino Games */
{0xE7F62E6D, 0, 1, 0, MAPPER_SEGA, SYSTEM_SMS, REGION_USA}, /* Cloud Master */
{0x908E7524, 0, 1, 0, MAPPER_SEGA, SYSTEM_SMS, REGION_USA}, /* Cyborg Hunter */
{0xA55D89F3, 0, 1, 0, MAPPER_SEGA, SYSTEM_SMS, REGION_USA}, /* Double Dragon */
{0xB8B141F9, 0, 1, 0, MAPPER_SEGA, SYSTEM_SMS, REGION_USA}, /* Fantasy Zone II */
{0xD29889AD, 0, 1, 0, MAPPER_SEGA, SYSTEM_SMS, REGION_USA}, /* Fantasy Zone: The Maze */
{0xA4AC35D8, 0, 1, 0, MAPPER_SEGA, SYSTEM_SMS, REGION_USA}, /* Galaxy Force */
{0x6C827520, 0, 1, 0, MAPPER_SEGA, SYSTEM_SMS, REGION_USA}, /* Galaxy Force (U) */
{0x1890F407, 0, 1, 0, MAPPER_SEGA, SYSTEM_SMS, REGION_USA}, /* Game Box Série Esportes Radicais (BR) */
{0xB746A6F5, 0, 1, 0, MAPPER_SEGA, SYSTEM_SMS, REGION_USA}, /* Global Defense */
{0x91A0FC4E, 0, 1, 0, MAPPER_SEGA, SYSTEM_SMS, REGION_USA}, /* Global Defense [Proto] */
{0x48651325, 0, 1, 0, MAPPER_SEGA, SYSTEM_SMS, REGION_USA}, /* Golfamania */
{0x5DABFDC3, 0, 1, 0, MAPPER_SEGA, SYSTEM_SMS, REGION_USA}, /* Golfamania [Proto] */
{0xA51376FE, 0, 1, 0, MAPPER_SEGA, SYSTEM_SMS, REGION_USA}, /* Golvellius - Valley of Doom */
{0x98E4AE4A, 0, 1, 0, MAPPER_SEGA, SYSTEM_SMS, REGION_USA}, /* Great Golf */
{0x516ED32E, 0, 1, 0, MAPPER_SEGA, SYSTEM_SMS, REGION_USA}, /* Kenseiden */
{0xE8511B08, 0, 1, 0, MAPPER_SEGA, SYSTEM_SMS, REGION_USA}, /* Lord of The Sword */
{0x0E333B6E, 0, 1, 0, MAPPER_SEGA, SYSTEM_SMS, REGION_USA}, /* Miracle Warriors - Seal of The Dark Lord */
{0x301A59AA, 0, 1, 0, MAPPER_SEGA, SYSTEM_SMS, REGION_USA}, /* Miracle Warriors - Seal of The Dark Lord [Proto] */
{0x01D67C0B, 0, 1, 0, MAPPER_SEGA, SYSTEM_SMS, REGION_USA}, /* Mônica no Castelo do Dragão (BR) */
{0x5589D8D2, 0, 1, 0, MAPPER_SEGA, SYSTEM_SMS, REGION_USA}, /* Out Run */
{0xE030E66C, 0, 1, 0, MAPPER_SEGA, SYSTEM_SMS, REGION_USA}, /* Parlour Games */
{0xF97E9875, 0, 1, 0, MAPPER_SEGA, SYSTEM_SMS, REGION_USA}, /* Penguin Land */
{0x4077EFD9, 0, 1, 0, MAPPER_SEGA, SYSTEM_SMS, REGION_USA}, /* Power Strike */
{0xBB54B6B0, 0, 1, 0, MAPPER_SEGA, SYSTEM_SMS, REGION_USA}, /* R-Type */
{0x42FC47EE, 0, 1, 0, MAPPER_SEGA, SYSTEM_SMS, REGION_USA}, /* Rampage */
{0xC547EB1B, 0, 1, 0, MAPPER_SEGA, SYSTEM_SMS, REGION_USA}, /* Rastan */
{0x9A8B28EC, 0, 1, 0, MAPPER_SEGA, SYSTEM_SMS, REGION_USA}, /* Scramble Spirits */
{0xAAB67EC3, 0, 1, 0, MAPPER_SEGA, SYSTEM_SMS, REGION_USA}, /* Shanghai */
{0x0C6FAC4E, 0, 1, 0, MAPPER_SEGA, SYSTEM_SMS, REGION_USA}, /* Shinobi */
{0x4752CAE7, 0, 1, 0, MAPPER_SEGA, SYSTEM_SMS, REGION_USA}, /* SpellCaster */
{0x1A390B93, 0, 1, 0, MAPPER_SEGA, SYSTEM_SMS, REGION_USA}, /* Tennis Ace */
{0xAE920E4B, 0, 1, 0, MAPPER_SEGA, SYSTEM_SMS, REGION_USA}, /* Thunder Blade */
{0x51BD14BE, 0, 1, 0, MAPPER_SEGA, SYSTEM_SMS, REGION_USA}, /* Time Soldiers */
{0x22CCA9BB, 0, 1, 0, MAPPER_SEGA, SYSTEM_SMS, REGION_USA}, /* Turma da Mônica em: O Resgate (BR) */
{0xB52D60C8, 0, 1, 0, MAPPER_SEGA, SYSTEM_SMS, REGION_USA}, /* Ultima IV */
{0xDE9F8517, 0, 1, 0, MAPPER_SEGA, SYSTEM_SMS, REGION_USA}, /* Ultima IV [Proto] */
{0xDFB0B161, 0, 1, 0, MAPPER_SEGA, SYSTEM_SMS, REGION_USA}, /* Vigilante */
{0x679E1676, 0, 1, 0, MAPPER_SEGA, SYSTEM_SMS, REGION_USA}, /* Wonder Boy III: The Dragon's Trap */
{0x8CBEF0C1, 0, 1, 0, MAPPER_SEGA, SYSTEM_SMS, REGION_USA}, /* Wonder Boy in Monster Land */
{0x2F2E3BC9, 0, 1, 0, MAPPER_SEGA, SYSTEM_SMS, REGION_USA}, /* Zillion II - The Tri Formation */
{0x48D44A13, 0, 1, 0, MAPPER_NONE, SYSTEM_SMS, REGION_JAPAN_NTSC}, /* BIOS (J) */
{0xD8C4165B, 0, 1, 0, MAPPER_SEGA, SYSTEM_SMS, REGION_JAPAN_NTSC}, /* Aleste */
{0x4CC11DF9, 0, 1, 0, MAPPER_SEGA, SYSTEM_SMS, REGION_JAPAN_NTSC}, /* Alien Syndrome (J) */
{0xE421E466, 0, 1, 0, MAPPER_SEGA, SYSTEM_SMS, REGION_JAPAN_NTSC}, /* Chouon Senshi Borgman */
{0x2BCDB8FA, 0, 1, 0, MAPPER_SEGA, SYSTEM_SMS, REGION_JAPAN_NTSC}, /* Doki Doki Penguin Land - Uchuu-Daibouken */
{0x56BD2455, 0, 1, 0, MAPPER_SEGA, SYSTEM_SMS, REGION_JAPAN_NTSC}, /* Doki Doki Penguin Land - Uchuu-Daibouken [Proto] */
{0xC722FB42, 0, 1, 0, MAPPER_SEGA, SYSTEM_SMS, REGION_JAPAN_NTSC}, /* Fantasy Zone II (J) */
{0x7ABC70E9, 0, 1, 0, MAPPER_SEGA, SYSTEM_SMS, REGION_JAPAN_NTSC}, /* Family Games (Party Games) */
{0x6586BD1F, 0, 1, 0, MAPPER_SEGA, SYSTEM_SMS, REGION_JAPAN_NTSC}, /* Masters Golf */
{0x4847BC91, 0, 1, 0, MAPPER_SEGA, SYSTEM_SMS, REGION_JAPAN_NTSC}, /* Masters Golf [Proto] */
{0xB9FDF6D9, 0, 1, 0, MAPPER_SEGA, SYSTEM_SMS, REGION_JAPAN_NTSC}, /* Haja no Fuuin */
{0x955A009E, 0, 1, 0, MAPPER_SEGA, SYSTEM_SMS, REGION_JAPAN_NTSC}, /* Hoshi wo Sagashite */
{0x05EA5353, 0, 1, 0, MAPPER_SEGA, SYSTEM_SMS, REGION_JAPAN_NTSC}, /* Kenseiden (J) */
{0xD11D32E4, 0, 1, 0, MAPPER_SEGA, SYSTEM_SMS, REGION_JAPAN_NTSC}, /* Kujakuou */
{0xAA7D6F45, 0, 1, 0, MAPPER_SEGA, SYSTEM_SMS, REGION_JAPAN_NTSC}, /* Lord of Sword */
{0xBF0411AD, 0, 1, 0, MAPPER_SEGA, SYSTEM_SMS, REGION_JAPAN_NTSC}, /* Maou Golvellius */
{0x21A21352, 0, 1, 0, MAPPER_SEGA, SYSTEM_SMS, REGION_JAPAN_NTSC}, /* Maou Golvellius [Proto] */
{0x5B5F9106, 0, 1, 0, MAPPER_SEGA, SYSTEM_SMS, REGION_JAPAN_NTSC}, /* Nekyuu Kousien */
{0xBEA27D5C, 0, 1, 0, MAPPER_SEGA, SYSTEM_SMS, REGION_JAPAN_NTSC}, /* Opa Opa */
{0x6605D36A, 0, 1, 0, MAPPER_SEGA, SYSTEM_SMS, REGION_JAPAN_NTSC}, /* Phantasy Star (J) */
{0xE1FFF1BB, 0, 1, 0, MAPPER_SEGA, SYSTEM_SMS, REGION_JAPAN_NTSC}, /* Shinobi (J) */
{0x11645549, 0, 1, 0, MAPPER_SEGA, SYSTEM_SMS, REGION_JAPAN_NTSC}, /* Solomon no Kagi - Oujo Rihita no Namida */
{0x7E0EF8CB, 0, 1, 0, MAPPER_SEGA, SYSTEM_SMS, REGION_JAPAN_NTSC}, /* Super Racing */
{0xB1DA6A30, 0, 1, 0, MAPPER_SEGA, SYSTEM_SMS, REGION_JAPAN_NTSC}, /* Super Wonder Boy Monster World */
{0x8132AB2C, 0, 1, 0, MAPPER_SEGA, SYSTEM_SMS, REGION_JAPAN_NTSC}, /* Tensai Bakabon */
{0xC0CE19B1, 0, 1, 0, MAPPER_SEGA, SYSTEM_SMS, REGION_JAPAN_NTSC}, /* Thunder Blade (J) */
{0x07301F83, 0, 1, 0, MAPPER_SEGA, SYSTEM_PBC, REGION_JAPAN_NTSC} /* Phantasy Star [Megadrive] (J) */
};
/* Cartridge & BIOS ROM hardware */
@@ -338,13 +363,14 @@ static struct
uint8 *rom;
uint8 *fcr;
uint8 mapper;
uint8 pages;
uint16 pages;
} slot;
/* Function prototypes */
static void mapper_reset(void);
static void mapper_8k_w(int offset, unsigned int data);
static void mapper_16k_w(int offset, unsigned int data);
static void mapper_8k_w(int offset, unsigned char data);
static void mapper_16k_w(int offset, unsigned char data);
static void mapper_32k_w(unsigned char data);
static void write_mapper_none(unsigned int address, unsigned char data);
static void write_mapper_sega(unsigned int address, unsigned char data);
static void write_mapper_codies(unsigned int address, unsigned char data);
@@ -352,7 +378,8 @@ static void write_mapper_korea(unsigned int address, unsigned char data);
static void write_mapper_korea_8k(unsigned int address, unsigned char data);
static void write_mapper_korea_16k(unsigned int address, unsigned char data);
static void write_mapper_msx(unsigned int address, unsigned char data);
static void write_mapper_multi(unsigned int address, unsigned char data);
static void write_mapper_multi_16k(unsigned int address, unsigned char data);
static void write_mapper_multi_32k(unsigned int address, unsigned char data);
static void write_mapper_93c46(unsigned int address, unsigned char data);
static void write_mapper_terebi(unsigned int address, unsigned char data);
static unsigned char read_mapper_93c46(unsigned int address);
@@ -362,14 +389,11 @@ static unsigned char read_mapper_default(unsigned int address);
void sms_cart_init(void)
{
int i;
int i = sizeof(game_list) / sizeof(rominfo_t) - 1;
/* game CRC */
uint32 crc = crc32(0, cart.rom, cart.romsize);
/* use Master System controller by default */
uint8 device = SYSTEM_MS_GAMEPAD;
/* unmapped memory return $FF on read (mapped to unused cartridge areas $510000-$5103FF & $510400-$5107FF) */
memset(cart.rom + 0x510000, 0xFF, 0x800);
@@ -395,7 +419,7 @@ void sms_cart_init(void)
}
/* auto-detect game settings */
for (i=0; i<GAME_DATABASE_CNT; i++)
do
{
if (crc == game_list[i].crc)
{
@@ -403,7 +427,16 @@ void sms_cart_init(void)
cart_rom.mapper = game_list[i].mapper;
/* auto-detect required peripherals */
device = game_list[i].peripheral;
if (game_list[i].peripheral)
{
/* save current input settings */
if (old_system[0] == -1)
{
old_system[0] = input.system[0];
}
input.system[0] = game_list[i].peripheral;
}
/* auto-detect 3D glasses support */
cart.special = game_list[i].g_3d;
@@ -421,9 +454,10 @@ void sms_cart_init(void)
}
/* game found, leave loop */
i = GAME_DATABASE_CNT;
break;
}
}
while (i--);
/* ROM paging */
if (cart_rom.mapper < MAPPER_SEGA)
@@ -436,6 +470,11 @@ void sms_cart_init(void)
/* 8k ROM banks */
cart_rom.pages = (cart.romsize + (1 << 13) - 1) >> 13;
}
else if (cart_rom.mapper & MAPPER_MULTI_32K)
{
/* 32k ROM banks */
cart_rom.pages = (cart.romsize + (1 << 15) - 1) >> 15;
}
else
{
/* 16k ROM banks */
@@ -460,25 +499,11 @@ void sms_cart_init(void)
/* enable cartridge backup memory by default */
sram.on = 1;
/* save current settings */
if (old_system[0] == -1)
{
old_system[0] = input.system[0];
}
if (old_system[1] == -1)
{
old_system[1] = input.system[1];
}
/* force port A & port B configuration */
input.system[0] = device;
input.system[1] = SYSTEM_MS_GAMEPAD;
/* default gun offset */
/* default gun offset for Light Phaser */
input.x_offset = 20;
input.y_offset = 0;
/* SpaceGun & Gangster Town use different gun offset */
/* SpaceGun & Gangster Town use specific gun offset */
if ((crc == 0x5359762D) || (crc == 0x5FC74D2A))
{
input.x_offset = 16;
@@ -488,7 +513,7 @@ void sms_cart_init(void)
if (config.bios & 1)
{
/* load BIOS file */
int bios_size = load_bios();
int bios_size = load_bios(system_hw);
if (bios_size > 0xC000)
{
@@ -666,7 +691,7 @@ void sms_cart_switch(uint8 mode)
int sms_cart_region_detect(void)
{
int i;
int i = sizeof(game_list) / sizeof(rominfo_t) - 1;
/* compute CRC */
uint32 crc = crc32(0, cart.rom, cart.romsize);
@@ -678,13 +703,14 @@ int sms_cart_region_detect(void)
}
/* game database */
for (i=0; i<GAME_DATABASE_CNT; i++)
do
{
if (crc == game_list[i].crc)
{
return game_list[i].region;
}
}
while(i--);
/* Mark-III hardware */
if (system_hw == SYSTEM_MARKIII)
@@ -715,32 +741,40 @@ static void mapper_reset(void)
{
int i;
/* reset internal RAM mapping */
if (system_hw == SYSTEM_SG)
/* reset $C000-$FFFF mapping */
if (cart_rom.mapper == MAPPER_RAM_8K_EXT2)
{
/* 8k RAM extension adapter (type B) */
if (cart_rom.mapper == MAPPER_RAM_8K_EXT2)
for (i = 0x30; i < 0x40; i++)
{
/* $C000-$FFFF mapped to 8k external RAM (mirrored) */
for (i = 0x30; i < 0x40; i++)
{
z80_readmap[i] = z80_writemap[i] = &work_ram[(i & 0x07) << 10];
}
z80_readmap[i] = z80_writemap[i] = &work_ram[(i & 0x07) << 10];
}
else
}
else if (system_hw == SYSTEM_SGII)
{
/* SG-1000 II clone hardware with 2KB internal RAM */
for (i = 0x30; i < 0x40; i++)
{
/* $C000-$FFFF mapped to 2k mirrored RAM */
for (i = 0x30; i < 0x40; i++)
{
z80_readmap[i] = z80_writemap[i] = &work_ram[(i & 0x01) << 10];
}
/* $C000-$FFFF mapped to 2k internal RAM (mirrored) */
z80_readmap[i] = z80_writemap[i] = &work_ram[(i & 0x01) << 10];
}
}
else if (system_hw == SYSTEM_SG)
{
/* default SG-1000 hardware has only 1KB internal RAM */
for (i = 0x30; i < 0x40; i++)
{
/* $C000-$FFFF mapped to 1k internal RAM (mirrored) */
z80_readmap[i] = z80_writemap[i] = &work_ram[0];
}
}
else
{
/* $C000-$FFFF mapped to 8k internal RAM (mirrored) */
/* Mark III / Master System / Game Gear hardware */
for (i = 0x30; i < 0x40; i++)
{
/* $C000-$FFFF mapped to 8k internal RAM (mirrored) */
z80_readmap[i] = z80_writemap[i] = &work_ram[(i & 0x07) << 10];
}
}
@@ -761,54 +795,45 @@ static void mapper_reset(void)
return;
}
/* reset default $0000-$BFFF mapping */
if (slot.mapper < MAPPER_SEGA)
/* reset $0000-$BFFF mapping */
for (i = 0x00; i < 0x30; i++)
{
/* $0000-$BFFF mapped to ROM (48k) */
for (i = 0x00; i < 0x30; i++)
{
z80_readmap[i] = &slot.rom[i << 10];
z80_writemap[i] = cart.rom + 0x510000; /* unused area */
}
/* cartridge extra RAM enabled by default with 32K ROM */
if (slot.pages <= 0x20)
{
/* $8000-$BFFF mapped to 8k external RAM (mirrored) */
for (i = 0x20; i < 0x30; i++)
{
z80_readmap[i] = z80_writemap[i] = &work_ram[0x2000 + ((i & 0x07) << 10)];
}
}
/* by default, $0000-$BFFF is mapped to cartridge ROM (first 48k) */
z80_readmap[i] = &slot.rom[i << 10];
z80_writemap[i] = cart.rom + 0x510000; /* unused area */
}
/* reset cartridge hardware mapping */
if (slot.mapper == MAPPER_RAM_8K_EXT1)
{
/* 8k RAM extension adapter (type A) */
if (slot.mapper == MAPPER_RAM_8K_EXT1)
for (i = 0x08; i < 0x10; i++)
{
/* $2000-$3FFF mapped to 8k external RAM */
for (i = 0x08; i < 0x10; i++)
{
z80_readmap[i] = z80_writemap[i] = &work_ram[0x2000 + ((i & 0x07) << 10)];
}
z80_readmap[i] = z80_writemap[i] = &work_ram[0x2000 + ((i & 0x07) << 10)];
}
}
else
else if (slot.mapper == MAPPER_RAM_2K)
{
/* $0000-$BFFF mapped to ROM by default */
for (i = 0x00; i < 0x30; i++)
/* 2k on-board RAM (The Castle, Othello) */
for (i = 0x20; i < 0x30; i++)
{
z80_readmap[i] = &slot.rom[i << 10];
z80_writemap[i] = cart.rom + 0x510000; /* unused area */
/* $8000-$BFFF mapped to 2k external RAM (mirrored) */
z80_readmap[i] = z80_writemap[i] = &work_ram[0x2000 + ((i & 0x07) << 10)];
}
/* reset default ROM paging */
}
else if (slot.mapper >= MAPPER_SEGA)
{
/* reset ROM paging hardware */
if (slot.mapper & MAPPER_KOREA_8K)
{
/* 8k pages */
mapper_8k_w(0,slot.fcr[0]);
mapper_8k_w(1,slot.fcr[1]);
mapper_8k_w(2,slot.fcr[2]);
mapper_8k_w(3,slot.fcr[3]);
/* Nemesis special case */
/* "Nemesis" mapper specific */
if (slot.mapper == MAPPER_MSX_NEMESIS)
{
/* first 8k page is mapped to last 8k ROM bank */
@@ -818,8 +843,14 @@ static void mapper_reset(void)
}
}
}
else if (slot.mapper & MAPPER_MULTI_32K)
{
/* 32k pages */
mapper_32k_w(slot.fcr[0]);
}
else
{
/* 16k pages */
mapper_16k_w(0,slot.fcr[0]);
mapper_16k_w(1,slot.fcr[1]);
mapper_16k_w(2,slot.fcr[2]);
@@ -831,6 +862,7 @@ static void mapper_reset(void)
switch (slot.mapper)
{
case MAPPER_NONE:
case MAPPER_RAM_2K:
case MAPPER_RAM_8K_EXT1:
case MAPPER_RAM_8K_EXT2:
z80_readmem = read_mapper_default;
@@ -863,9 +895,14 @@ static void mapper_reset(void)
z80_writemem = write_mapper_msx;
break;
case MAPPER_MULTI:
case MAPPER_MULTI_16K:
z80_readmem = read_mapper_default;
z80_writemem = write_mapper_multi;
z80_writemem = write_mapper_multi_16k;
break;
case MAPPER_MULTI_32K:
z80_readmem = read_mapper_default;
z80_writemem = write_mapper_multi_32k;
break;
case MAPPER_93C46:
@@ -885,12 +922,12 @@ static void mapper_reset(void)
}
}
static void mapper_8k_w(int offset, unsigned int data)
static void mapper_8k_w(int offset, unsigned char data)
{
int i;
/* cartridge ROM page (8k) */
uint8 page = data % slot.pages;
uint8 *page = &slot.rom[(data % slot.pages) << 13];
/* Save frame control register data */
slot.fcr[offset] = data;
@@ -902,7 +939,7 @@ static void mapper_8k_w(int offset, unsigned int data)
{
for (i = 0x20; i < 0x28; i++)
{
z80_readmap[i] = &slot.rom[(page << 13) | ((i & 0x07) << 10)];
z80_readmap[i] = &page[(i & 0x07) << 10];
}
break;
}
@@ -911,7 +948,7 @@ static void mapper_8k_w(int offset, unsigned int data)
{
for (i = 0x28; i < 0x30; i++)
{
z80_readmap[i] = &slot.rom[(page << 13) | ((i & 0x07) << 10)];
z80_readmap[i] = &page[(i & 0x07) << 10];
}
break;
}
@@ -920,7 +957,7 @@ static void mapper_8k_w(int offset, unsigned int data)
{
for (i = 0x10; i < 0x18; i++)
{
z80_readmap[i] = &slot.rom[(page << 13) | ((i & 0x07) << 10)];
z80_readmap[i] = &page[(i & 0x07) << 10];
}
break;
}
@@ -929,7 +966,7 @@ static void mapper_8k_w(int offset, unsigned int data)
{
for (i = 0x18; i < 0x20; i++)
{
z80_readmap[i] = &slot.rom[(page << 13) | ((i & 0x07) << 10)];
z80_readmap[i] = &page[(i & 0x07) << 10];
}
break;
}
@@ -941,7 +978,7 @@ static void mapper_8k_w(int offset, unsigned int data)
#endif
}
static void mapper_16k_w(int offset, unsigned int data)
static void mapper_16k_w(int offset, unsigned char data)
{
int i;
@@ -1010,7 +1047,7 @@ static void mapper_16k_w(int offset, unsigned int data)
case 1: /* cartridge ROM bank (16k) at $0000-$3FFF */
{
/* first 1k is not fixed (CODEMASTER or MULTI mappers only) */
if ((slot.mapper == MAPPER_CODIES) || (slot.mapper == MAPPER_MULTI))
if ((slot.mapper == MAPPER_CODIES) || (slot.mapper == MAPPER_MULTI_16K))
{
z80_readmap[0] = &slot.rom[(page << 14)];
}
@@ -1085,6 +1122,34 @@ static void mapper_16k_w(int offset, unsigned int data)
#endif
}
static void mapper_32k_w(unsigned char data)
{
int i;
/* cartridge ROM page (32k) */
uint8 *page = &slot.rom[(data % slot.pages) << 15];
/* Save frame control register data */
slot.fcr[0] = data;
/* selected page (32k) is mapped at $0000-$7FFF */
for (i = 0x00; i < 0x20; i++)
{
z80_readmap[i] = &page[i << 10];
}
/* first 16K is mirrored at $8000-$BFFF */
for (i = 0x20; i < 0x30; i++)
{
z80_readmap[i] = z80_readmap[i & 0x0F];
}
#ifdef CHEATS_UPDATE
/* update ROM patches when banking has changed */
CHEATS_UPDATE();
#endif
}
static void write_mapper_none(unsigned int address, unsigned char data)
{
z80_writemap[address >> 10][address & 0x03FF] = data;
@@ -1123,7 +1188,7 @@ static void write_mapper_codies(unsigned int address, unsigned char data)
z80_writemap[address >> 10][address & 0x03FF] = data;
}
static void write_mapper_multi(unsigned int address, unsigned char data)
static void write_mapper_multi_16k(unsigned int address, unsigned char data)
{
if (address == 0x3FFE)
{
@@ -1146,6 +1211,16 @@ static void write_mapper_multi(unsigned int address, unsigned char data)
z80_writemap[address >> 10][address & 0x03FF] = data;
}
static void write_mapper_multi_32k(unsigned int address, unsigned char data)
{
if (address == 0xFFFF)
{
mapper_32k_w(data);
}
z80_writemap[address >> 10][address & 0x03FF] = data;
}
static void write_mapper_korea(unsigned int address, unsigned char data)
{
if (address == 0xA000)
+1 -1
View File
@@ -2,7 +2,7 @@
* Genesis Plus
* SG-1000, Master System & Game Gear cartridge hardware support
*
* Copyright (C) 2007-2012 Eke-Eke (Genesis Plus GX)
* Copyright (C) 2007-2016 Eke-Eke (Genesis Plus GX)
*
* Redistribution and use of this code or any derivative works are permitted
* provided that the following conditions are met:
+1 -1
View File
@@ -2,7 +2,7 @@
* Genesis Plus
* CD compatible ROM/RAM cartridge support
*
* Copyright (C) 2012 Eke-Eke (Genesis Plus GX)
* Copyright (C) 2012-2016 Eke-Eke (Genesis Plus GX)
*
* Redistribution and use of this code or any derivative works are permitted
* provided that the following conditions are met:
+2 -2
View File
@@ -2,7 +2,7 @@
* Genesis Plus
* CD compatible ROM/RAM cartridge support
*
* Copyright (C) 2012 Eke-Eke (Genesis Plus GX)
* Copyright (C) 2012-2016 Eke-Eke (Genesis Plus GX)
*
* Redistribution and use of this code or any derivative works are permitted
* provided that the following conditions are met:
@@ -40,7 +40,7 @@
/* CD compatible ROM/RAM cartridge */
typedef struct
{
uint8 area[0x810000]; /* cartridge ROM/RAM area (max. 8MB + 64KB backup) */
uint8 area[0x840080]; /* cartridge ROM/RAM area (max. 8MB ROM + 64KB backup memory + Pro Action Replay 128KB ROM / 64KB RAM + cartridge infos) */
uint8 boot; /* cartridge boot mode (0x00: boot from CD with ROM/RAM cartridge enabled, 0x40: boot from ROM cartridge with CD enabled) */
uint8 id; /* RAM cartridge ID (related to RAM size, 0 if disabled) */
uint8 prot; /* RAM cartridge write protection */
+10 -18
View File
@@ -2,7 +2,7 @@
* Genesis Plus
* CD data controller (LC89510 compatible)
*
* Copyright (C) 2012 Eke-Eke (Genesis Plus GX)
* Copyright (C) 2012-2015 Eke-Eke (Genesis Plus GX)
*
* Redistribution and use of this code or any derivative works are permitted
* provided that the following conditions are met:
@@ -243,7 +243,7 @@ void cdc_dma_update(void)
}
}
int cdc_decoder_update(uint32 header)
void cdc_decoder_update(uint32 header)
{
/* data decoding enabled ? */
if (cdc.ctrl[0] & BIT_DECEN)
@@ -274,7 +274,7 @@ int cdc_decoder_update(uint32 header)
/* buffer RAM write enabled ? */
if (cdc.ctrl[0] & BIT_WRRQ)
{
uint16 offset;
int offset;
/* increment block pointer */
cdc.pt.w += 2352;
@@ -292,19 +292,14 @@ int cdc_decoder_update(uint32 header)
cdd_read_data(cdc.ram + 4 + offset);
/* take care of buffer overrun */
if (offset > (0x4000 - 2048 - 4))
offset = offset + 2048 + 4 - 0x4000;
if (offset > 0)
{
/* data should be written at the start of buffer */
memcpy(cdc.ram, cdc.ram + 0x4000, offset + 2048 + 4 - 0x4000);
memcpy(cdc.ram, cdc.ram + 0x4000, offset);
}
/* read next data block */
return 1;
}
}
/* keep decoding same data block if Buffer Write is disabled */
return 0;
}
void cdc_reg_w(unsigned char data)
@@ -376,8 +371,8 @@ void cdc_reg_w(unsigned char data)
/* start data transfer if data output is enabled */
if (cdc.ifctrl & BIT_DOUTEN)
{
/* set !DTBSY */
cdc.ifstat &= ~BIT_DTBSY;
/* set !DTBSY and !DTEN */
cdc.ifstat &= ~(BIT_DTBSY | BIT_DTEN);
/* clear DBCH bits 4-7 */
cdc.dbc.byte.h &= 0x0f;
@@ -391,10 +386,7 @@ void cdc_reg_w(unsigned char data)
case 2: /* MAIN-CPU host read */
case 3: /* SUB-CPU host read */
{
/* set !DTEN */
cdc.ifstat &= ~BIT_DTEN;
/* set DSR bit (register $04) */
/* set DSR bit (SCD register $04) */
scd.regs[0x04>>1].byte.h |= 0x40;
break;
}
@@ -645,7 +637,7 @@ unsigned char cdc_reg_r(void)
unsigned short cdc_host_r(void)
{
/* check if data is available */
if (!(cdc.ifstat & BIT_DTEN))
if (scd.regs[0x04>>1].byte.h & 0x40)
{
/* read data word from CDC RAM buffer */
uint16 data = *(uint16 *)(cdc.ram + (cdc.dac.w & 0x3ffe));
+2 -2
View File
@@ -2,7 +2,7 @@
* Genesis Plus
* CD data controller (LC89510 compatible)
*
* Copyright (C) 2012 Eke-Eke (Genesis Plus GX)
* Copyright (C) 2012-2015 Eke-Eke (Genesis Plus GX)
*
* Redistribution and use of this code or any derivative works are permitted
* provided that the following conditions are met:
@@ -63,7 +63,7 @@ extern void cdc_reset(void);
extern int cdc_context_save(uint8 *state);
extern int cdc_context_load(uint8 *state);
extern void cdc_dma_update(void);
extern int cdc_decoder_update(uint32 header);
extern void cdc_decoder_update(uint32 header);
extern void cdc_reg_w(unsigned char data);
extern unsigned char cdc_reg_r(void);
extern unsigned short cdc_host_r(void);
File diff suppressed because it is too large Load Diff
+12 -10
View File
@@ -2,7 +2,7 @@
* Genesis Plus
* CD drive processor & CD-DA fader
*
* Copyright (C) 2012-2013 Eke-Eke (Genesis Plus GX)
* Copyright (C) 2012-2016 Eke-Eke (Genesis Plus GX)
*
* Redistribution and use of this code or any derivative works are permitted
* provided that the following conditions are met:
@@ -40,37 +40,38 @@
#include "blip_buf.h"
#ifdef USE_LIBTREMOR
#if defined(USE_LIBVORBIS)
#include <vorbis/vorbisfile.h>
#elif defined(USE_LIBTREMOR)
#include "tremor/ivorbisfile.h"
#endif
#define cdd scd.cdd_hw
/* CDD status */
#define NO_DISC 0x00
#define CD_BUSY 0x00
#define CD_PLAY 0x01
#define CD_SEEK 0x02
#define CD_SCAN 0x03
#define CD_READY 0x04
#define CD_OPEN 0x05 /* similar to 0x0E ? */
#define CD_PAUSE 0x04
#define CD_OPEN 0x05
#define CD_STOP 0x09
#define NO_DISC 0x0B
#define CD_END 0x0C
/* CD blocks scanning speed */
#define CD_SCAN_SPEED 30
#define CD_MAX_TRACKS 100
/* CD track */
typedef struct
{
FILE *fd;
#ifdef USE_LIBTREMOR
#if defined(USE_LIBTREMOR) || defined(USE_LIBVORBIS)
OggVorbis_File vf;
#endif
int offset;
int start;
int end;
int type;
} track_t;
/* CD TOC */
@@ -79,6 +80,7 @@ typedef struct
int end;
int last;
track_t tracks[CD_MAX_TRACKS];
FILE *sub;
} toc_t;
/* CDD hardware */
@@ -98,7 +100,7 @@ typedef struct
} cdd_t;
/* Function prototypes */
extern void cdd_init(blip_t* left, blip_t* right);
extern void cdd_init(int samplerate);
extern void cdd_reset(void);
extern int cdd_context_save(uint8 *state);
extern int cdd_context_load(uint8 *state);
+14 -21
View File
@@ -2,7 +2,7 @@
* Genesis Plus
* PCM sound chip (315-5476A) (RF5C164 compatible)
*
* Copyright (C) 2012 Eke-Eke (Genesis Plus GX)
* Copyright (C) 2012-2014 Eke-Eke (Genesis Plus GX)
*
* Redistribution and use of this code or any derivative works are permitted
* provided that the following conditions are met:
@@ -41,19 +41,12 @@
#define pcm scd.pcm_hw
static blip_t* blip[2];
void pcm_init(blip_t* left, blip_t* right)
void pcm_init(double clock, int samplerate)
{
/* number of SCD master clocks run per second */
double mclk = snd.frame_rate ? (SCYCLES_PER_LINE * (vdp_pal ? 313 : 262) * snd.frame_rate) : SCD_CLOCK;
/* PCM chips is running at original rate and is synchronized with SUB-CPU */
/* PCM chip is running at original rate and is synchronized with SUB-CPU */
/* Chip output is resampled to desired rate using Blip Buffer. */
blip[0] = left;
blip[1] = right;
blip_set_rates(left, mclk / PCM_SCYCLES_RATIO, snd.sample_rate);
blip_set_rates(right, mclk / PCM_SCYCLES_RATIO, snd.sample_rate);
blip_set_rates(snd.blips[1][0], clock / PCM_SCYCLES_RATIO, samplerate);
blip_set_rates(snd.blips[1][1], clock / PCM_SCYCLES_RATIO, samplerate);
}
void pcm_reset(void)
@@ -78,8 +71,8 @@ void pcm_reset(void)
pcm.cycles = 0;
/* clear blip buffers */
blip_clear(blip[0]);
blip_clear(blip[1]);
blip_clear(snd.blips[1][0]);
blip_clear(snd.blips[1][1]);
}
int pcm_context_save(uint8 *state)
@@ -190,14 +183,14 @@ void pcm_run(unsigned int length)
/* check if PCM left output changed */
if (pcm.out[0] != l)
{
blip_add_delta_fast(blip[0], i, l-pcm.out[0]);
blip_add_delta_fast(snd.blips[1][0], i, l-pcm.out[0]);
pcm.out[0] = l;
}
/* check if PCM right output changed */
if (pcm.out[1] != r)
{
blip_add_delta_fast(blip[1], i, r-pcm.out[1]);
blip_add_delta_fast(snd.blips[1][1], i, r-pcm.out[1]);
pcm.out[1] = r;
}
}
@@ -207,21 +200,21 @@ void pcm_run(unsigned int length)
/* check if PCM left output changed */
if (pcm.out[0])
{
blip_add_delta_fast(blip[0], 0, -pcm.out[0]);
blip_add_delta_fast(snd.blips[1][0], 0, -pcm.out[0]);
pcm.out[0] = 0;
}
/* check if PCM right output changed */
if (pcm.out[1])
{
blip_add_delta_fast(blip[1], 0, -pcm.out[1]);
blip_add_delta_fast(snd.blips[1][1], 0, -pcm.out[1]);
pcm.out[1] = 0;
}
}
/* end of blip buffer frame */
blip_end_frame(blip[0], length);
blip_end_frame(blip[1], length);
blip_end_frame(snd.blips[1][0], length);
blip_end_frame(snd.blips[1][1], length);
/* update PCM master clock counter */
pcm.cycles += length * PCM_SCYCLES_RATIO;
@@ -230,7 +223,7 @@ void pcm_run(unsigned int length)
void pcm_update(unsigned int samples)
{
/* get number of internal clocks (samples) needed */
unsigned int clocks = blip_clocks_needed(blip[0], samples);
unsigned int clocks = blip_clocks_needed(snd.blips[1][0], samples);
/* run PCM chip */
if (clocks > 0)
+2 -2
View File
@@ -2,7 +2,7 @@
* Genesis Plus
* PCM sound chip (315-5476A) (RF5C164 compatible)
*
* Copyright (C) 2012 Eke-Eke (Genesis Plus GX)
* Copyright (C) 2012-2014 Eke-Eke (Genesis Plus GX)
*
* Redistribution and use of this code or any derivative works are permitted
* provided that the following conditions are met:
@@ -65,7 +65,7 @@ typedef struct
} pcm_t;
/* Function prototypes */
extern void pcm_init(blip_t* left, blip_t* right);
extern void pcm_init(double clock, int rate);
extern void pcm_reset(void);
extern int pcm_context_save(uint8 *state);
extern int pcm_context_load(uint8 *state);
File diff suppressed because it is too large Load Diff
+12 -7
View File
@@ -2,7 +2,7 @@
* Genesis Plus
* Mega CD / Sega CD hardware
*
* Copyright (C) 2012-2013 Eke-Eke (Genesis Plus GX)
* Copyright (C) 2012-2016 Eke-Eke (Genesis Plus GX)
*
* Redistribution and use of this code or any derivative works are permitted
* provided that the following conditions are met:
@@ -44,14 +44,18 @@
#include "pcm.h"
#include "cd_cart.h"
#ifdef USE_DYNAMIC_ALLOC
#define scd ext->cd_hw
#else
#define scd ext.cd_hw
#endif
/* 5000000 SCD clocks/s = ~3184 clocks/line with a Master Clock of 53.693175 MHz */
/* This would be slightly (~30 clocks) more on PAL systems because of the slower */
/* Master Clock (53.203424 MHz) but not enough to really care about since clocks */
/* are not running in sync anyway. */
/* CD hardware Master Clock (50 MHz) */
#define SCD_CLOCK 50000000
#define SCYCLES_PER_LINE 3184
/* ~3184 SCD clocks/line on NTSC system (53.693175 MHz Master Clock) */
/* ~3214 SCD clocks/line on PAL system (53.203424 MHz Master Clock) */
#define SCYCLES_PER_LINE scd.cycles_per_line
/* Timer & Stopwatch clocks divider */
#define TIMERS_SCYCLES_RATIO (384 * 4)
@@ -66,7 +70,8 @@ typedef struct
uint8 word_ram_2M[0x40000]; /* 256K Word RAM (2M mode) */
uint8 bram[0x2000]; /* 8K Backup RAM */
reg16_t regs[0x100]; /* 256 x 16-bit ASIC registers */
uint32 cycles; /* Master clock counter */
uint32 cycles; /* CD Master clock counter */
uint32 cycles_per_line; /* CD Master clock count per scanline */
int32 stopwatch; /* Stopwatch counter */
int32 timer; /* Timer counter */
uint8 pending; /* Pending interrupts */
+16 -7
View File
@@ -5,7 +5,7 @@
* Support for SG-1000, Mark-III, Master System, Game Gear, Mega Drive & Mega CD hardware
*
* Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003 Charles Mac Donald (original code)
* Copyright (C) 2007-2013 Eke-Eke (Genesis Plus GX)
* Copyright (C) 2007-2014 Eke-Eke (Genesis Plus GX)
*
* Redistribution and use of this code or any derivative works are permitted
* provided that the following conditions are met:
@@ -41,7 +41,11 @@
#include "shared.h"
external_t ext; /* External Hardware (Cartridge, CD unit, ...) */
#ifdef USE_DYNAMIC_ALLOC
external_t *ext;
#else /* External Hardware (Cartridge, CD unit, ...) */
external_t ext;
#endif
uint8 boot_rom[0x800]; /* Genesis BOOT ROM */
uint8 work_ram[0x10000]; /* 68K RAM */
uint8 zram[0x2000]; /* Z80 RAM */
@@ -196,7 +200,7 @@ void gen_init(void)
break;
}
/* Master SYstem hardware */
/* Master System hardware */
case SYSTEM_SMS:
case SYSTEM_SMS2:
{
@@ -215,6 +219,7 @@ void gen_init(void)
/* SG-1000 hardware */
case SYSTEM_SG:
case SYSTEM_SGII:
{
z80_writeport = z80_sg_port_w;
z80_readport = z80_sg_port_r;
@@ -344,11 +349,15 @@ void gen_reset(int hard_reset)
Z80.r = 4;
}
/* Master System specific (when BIOS is disabled) */
else if ((system_hw & SYSTEM_SMS) && (!(config.bios & 1) || !(system_bios & SYSTEM_SMS)))
/* Master System & Game Gear specific */
else if (system_hw & (SYSTEM_SMS | SYSTEM_GG))
{
/* usually done by BIOS & required by some SMS games that don't initialize SP */
Z80.sp.w.l = 0xDFFF;
/* check if BIOS is not being used */
if ((!(config.bios & 1) || !(system_bios & (SYSTEM_SMS | SYSTEM_GG))))
{
/* a few Master System (Ace of Aces, Shadow Dancer) & Game Gear (Ecco the Dolphin, Evander Holyfield Real Deal Boxing) games crash if SP is not properly initialized */
Z80.sp.w.l = 0xDFF0;
}
}
}
}
+5 -1
View File
@@ -5,7 +5,7 @@
* Support for SG-1000, Mark-III, Master System, Game Gear, Mega Drive & Mega CD hardware
*
* Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003 Charles Mac Donald (original code)
* Copyright (C) 2007-2013 Eke-Eke (Genesis Plus GX)
* Copyright (C) 2007-2014 Eke-Eke (Genesis Plus GX)
*
* Redistribution and use of this code or any derivative works are permitted
* provided that the following conditions are met:
@@ -54,7 +54,11 @@ typedef union
} external_t;
/* Global variables */
#ifdef USE_DYNAMIC_ALLOC
extern external_t *ext;
#else
extern external_t ext;
#endif
extern uint8 boot_rom[0x800];
extern uint8 work_ram[0x10000];
extern uint8 zram[0x2000];
+175 -62
View File
@@ -1,9 +1,9 @@
/***************************************************************************************
* Genesis Plus
* 3-Buttons & 6-Buttons pad support
* Support for J-CART & 4-Way Play adapters
* 2-Buttons, 3-Buttons & 6-Buttons controller support
* with support for J-Cart, 4-Way Play & Master Tap adapters
*
* Copyright (C) 2007-2011 Eke-Eke (Genesis Plus GX)
* Copyright (C) 2007-2016 Eke-Eke (Genesis Plus GX)
*
* Redistribution and use of this code or any derivative works are permitted
* provided that the following conditions are met:
@@ -45,9 +45,16 @@ static struct
uint8 State;
uint8 Counter;
uint8 Timeout;
uint32 Latency;
} gamepad[MAX_DEVICES];
static uint8 pad_index;
static struct
{
uint8 Latch;
uint8 Counter;
} flipflop[2];
static uint8 latch;
void gamepad_reset(int port)
@@ -56,9 +63,14 @@ void gamepad_reset(int port)
gamepad[port].State = 0x40;
gamepad[port].Counter = 0;
gamepad[port].Timeout = 0;
gamepad[port].Latency = 0;
/* reset pad index (4-WayPlay) */
pad_index = 0;
/* reset 4-WayPlay latch (controller #0 used by default) */
latch = 0x00;
/* reset Master Tap flip-flop */
flipflop[port>>2].Latch = 0;
flipflop[port>>2].Counter = 0;
}
void gamepad_refresh(int port)
@@ -71,17 +83,43 @@ void gamepad_refresh(int port)
}
}
void gamepad_end_frame(int port, unsigned int cycles)
{
if (gamepad[port].Latency > cycles)
{
/* adjust TH direction switching latency for next frame */
gamepad[port].Latency -= cycles;
}
else
{
/* reset TH direction switching latency */
gamepad[port].Latency = 0;
}
}
INLINE unsigned char gamepad_read(int port)
{
/* bit 7 is latched, returns current TH state */
unsigned int data = (gamepad[port].State & 0x40) | 0x3F;
/* D7 is not connected, D6 returns TH input state */
unsigned int data = gamepad[port].State | 0x3F;
/* pad value */
unsigned int val = input.pad[port];
/* pad state */
unsigned int pad = input.pad[port];
/* get current step (TH state) */
unsigned int step = gamepad[port].Counter | ((data >> 6) & 1);
/* get current TH input pulse counter */
unsigned int step = gamepad[port].Counter | (data >> 6);
/* get current timestamp */
unsigned int cycles = ((system_hw & SYSTEM_PBC) == SYSTEM_MD) ? m68k.cycles : Z80.cycles;
/* TH direction switching latency */
if (cycles < gamepad[port].Latency)
{
/* TH internal state switching has not occured yet (Decap Attack) */
step &= ~1;
}
/* C/B or START/A buttons status is returned on D5-D4 (active low) */
/* D-PAD or extra buttons status is returned on D3-D0 (active low) */
switch (step)
{
case 1: /*** First High ***/
@@ -89,54 +127,58 @@ INLINE unsigned char gamepad_read(int port)
case 5: /*** Third High ***/
{
/* TH = 1 : ?1CBRLDU */
data &= ~(val & 0x3F);
data &= ~(pad & 0x3F);
break;
}
case 0: /*** First low ***/
case 2: /*** Second low ***/
case 0: /*** 3-button only ***/
case 2: /*** First Low ***/
case 4: /*** Second Low ***/
{
/* TH = 0 : ?0SA00DU */
data &= ~(val & 0x03);
data &= ~((val >> 2) & 0x30);
data &= ~0x0C;
data &= ~((pad & 0x03) | ((pad >> 2) & 0x30) | 0x0C);
break;
}
/* 6buttons specific (taken from gen-hw.txt) */
/* A 6-button gamepad allows the extra buttons to be read based on how */
/* many times TH is switched from 1 to 0 (and not 0 to 1). Observe the */
/* following sequence */
/* many times TH is switched from 1 to 0. Observe the following sequence */
/*
TH = 1 : ?1CBRLDU 3-button pad return value
TH = 0 : ?0SA00DU 3-button pad return value
TH = 1 : ?1CBRLDU 3-button pad return value
TH = 0 : ?0SA0000 D3-0 are forced to '0'
TH = 0 : ?0SA00DU 3-button pad return value
TH = 1 : ?1CBRLDU 3-button pad return value
TH = 0 : ?0SA0000 D3-D0 are forced to '0'
TH = 1 : ?1CBMXYZ Extra buttons returned in D3-0
TH = 0 : ?0SA1111 D3-0 are forced to '1'
TH = 0 : ?0SA1111 D3-D0 are forced to '1'
*/
case 4: /*** Third Low ***/
case 6: /*** Third Low ***/
{
/* TH = 0 : ?0SA0000 D3-0 are forced to '0'*/
data &= ~((val >> 2) & 0x30);
data &= ~0x0F;
break;
}
case 6: /*** Fourth Low ***/
{
/* TH = 0 : ?0SA1111 D3-0 are forced to '1'*/
data &= ~((val >> 2) & 0x30);
/* TH = 0 : ?0SA0000 D3-D0 forced to '0' */
data &= ~(((pad >> 2) & 0x30) | 0x0F);
break;
}
case 7: /*** Fourth High ***/
{
/* TH = 1 : ?1CBMXYZ Extra buttons returned in D3-0*/
data &= ~(val & 0x30);
data &= ~((val >> 8) & 0x0F);
/* TH = 1 : ?1CBMXYZ Extra buttons returned in D3-D0 */
data &= ~((pad & 0x30) | ((pad >> 8) & 0x0F));
break;
}
default: /*** D3-D0 forced to '1' ***/
{
if (data & 0x40)
{
/* TH = 1 : ?0CB1111 */
data &= ~(pad & 0x30);
}
else
{
/* TH = 0 : ?0SA1111 */
data &= ~((pad >> 2) & 0x30);
}
}
}
return data;
@@ -144,24 +186,45 @@ INLINE unsigned char gamepad_read(int port)
INLINE void gamepad_write(int port, unsigned char data, unsigned char mask)
{
/* update bits set as output only */
data = (gamepad[port].State & ~mask) | (data & mask);
if (input.dev[port] == DEVICE_PAD6B)
/* Check TH pin direction */
if (mask & 0x40)
{
/* TH=0 to TH=1 transition */
if (!(gamepad[port].State & 0x40) && (data & 0x40))
/* get TH output state */
data &= 0x40;
/* reset TH direction switching latency */
gamepad[port].Latency = 0;
/* 6-Buttons controller specific */
if (input.dev[port] == DEVICE_PAD6B)
{
gamepad[port].Counter = (gamepad[port].Counter + 2) & 6;
gamepad[port].Timeout = 0;
/* TH 1->0 transition */
if (!data && gamepad[port].State)
{
gamepad[port].Counter += 2;
gamepad[port].Timeout = 0;
}
}
}
else
{
/* retrieve current timestamp */
unsigned int cycles = ((system_hw & SYSTEM_PBC) == SYSTEM_MD) ? m68k.cycles : Z80.cycles;
/* TH is pulled high when not configured as output by I/O controller */
data = 0x40;
/* TH 0->1 internal switching does not occur immediately (verified on MK-1650 model) */
if (!gamepad[port].State)
{
gamepad[port].Latency = cycles + 172;
}
}
/* update internal state */
/* update TH input state */
gamepad[port].State = data;
}
/*--------------------------------------------------------------------------*/
/* Default ports handlers */
/*--------------------------------------------------------------------------*/
@@ -192,13 +255,15 @@ void gamepad_2_write(unsigned char data, unsigned char mask)
unsigned char wayplay_1_read(void)
{
if (pad_index < 4)
/* check if latched TH input on port B is HIGH */
if (latch & 0x04)
{
return gamepad_read(pad_index);
/* 4-WayPlay detection : xxxxx00 */
return 0x7C;
}
/* multitap detection */
return 0x70;
/* latched TR & TL input state on port B select controller # (0-3) on port A */
return gamepad_read(latch);
}
unsigned char wayplay_2_read(void)
@@ -208,17 +273,20 @@ unsigned char wayplay_2_read(void)
void wayplay_1_write(unsigned char data, unsigned char mask)
{
if (pad_index < 4)
{
gamepad_write(pad_index, data, mask);
}
/* latched TR & TL input state on port B select controller # (0-3) on port A */
gamepad_write(latch & 0x03, data, mask);
}
void wayplay_2_write(unsigned char data, unsigned char mask)
{
if ((mask & 0x70) == 0x70)
/* pins not configured as output by I/O controller are pulled HIGH */
data |= ~mask;
/* check if both UP & DOWN inputs are LOW */
if (!(data & 0x03))
{
pad_index = (data & 0x70) >> 4;
/* latch TH, TR & TL input state */
latch = (data >> 4) & 0x07;
}
}
@@ -229,13 +297,58 @@ void wayplay_2_write(unsigned char data, unsigned char mask)
unsigned int jcart_read(unsigned int address)
{
/* TH2 output read is fixed to zero (fixes Micro Machines 2) */
return ((gamepad_read(5) & 0x7F) | ((gamepad_read(6) & 0x3F) << 8));
/* D6 returns TH state, D14 is fixed low (fixes Micro Machines 2) */
return (gamepad_read(5) | ((gamepad_read(6) & 0x3F) << 8));
}
void jcart_write(unsigned int address, unsigned int data)
{
gamepad_write(5, (data & 1) << 6, 0x40);
gamepad_write(6, (data & 1) << 6, 0x40);
return;
data = (data & 0x01) << 6;
gamepad_write(5, data, 0x40);
gamepad_write(6, data, 0x40);
}
/*--------------------------------------------------------------------------*/
/* Master Tap ports handler (unofficial, designed by Furrtek) */
/* cf. http://www.smspower.org/uploads/Homebrew/BOoM-SMS-sms4p_2.png */
/*--------------------------------------------------------------------------*/
unsigned char mastertap_1_read(void)
{
return gamepad_read(flipflop[0].Counter);
}
unsigned char mastertap_2_read(void)
{
return gamepad_read(flipflop[1].Counter + 4);
}
void mastertap_1_write(unsigned char data, unsigned char mask)
{
/* update bits set as output only */
data = (flipflop[0].Latch & ~mask) | (data & mask);
/* check TH 1->0 transitions */
if ((flipflop[0].Latch & 0x40) && !(data & 0x40))
{
flipflop[0].Counter = (flipflop[0].Counter + 1) & 0x03;
}
/* update internal state */
flipflop[0].Latch = data;
}
void mastertap_2_write(unsigned char data, unsigned char mask)
{
/* update bits set as output only */
data = (flipflop[1].Latch & ~mask) | (data & mask);
/* check TH 1->0 transition */
if ((flipflop[1].Latch & 0x40) && !(data & 0x40))
{
flipflop[1].Counter = (flipflop[1].Counter + 1) & 0x03;
}
/* update internal state */
flipflop[1].Latch = data;
}
+8 -3
View File
@@ -1,9 +1,9 @@
/***************************************************************************************
* Genesis Plus
* 3-Buttons & 6-Buttons pad support
* Support for J-CART & 4-Way Play adapters
* 2-Buttons, 3-Buttons & 6-Buttons controller support
* with support for J-Cart, 4-Way Play & Master Tap adapters
*
* Copyright (C) 2007-2011 Eke-Eke (Genesis Plus GX)
* Copyright (C) 2007-2016 Eke-Eke (Genesis Plus GX)
*
* Redistribution and use of this code or any derivative works are permitted
* provided that the following conditions are met:
@@ -43,6 +43,7 @@
/* Function prototypes */
extern void gamepad_reset(int port);
extern void gamepad_refresh(int port);
extern void gamepad_end_frame(int port, unsigned int cycles);
extern unsigned char gamepad_1_read(void);
extern unsigned char gamepad_2_read(void);
extern void gamepad_1_write(unsigned char data, unsigned char mask);
@@ -53,5 +54,9 @@ extern void wayplay_1_write(unsigned char data, unsigned char mask);
extern void wayplay_2_write(unsigned char data, unsigned char mask);
extern unsigned int jcart_read(unsigned int address);
extern void jcart_write(unsigned int address, unsigned int data);
extern unsigned char mastertap_1_read(void);
extern unsigned char mastertap_2_read(void);
extern void mastertap_1_write(unsigned char data, unsigned char mask);
extern void mastertap_2_write(unsigned char data, unsigned char mask);
#endif
+111
View File
@@ -0,0 +1,111 @@
/***************************************************************************************
* Genesis Plus
* Sega Graphic Board support
*
* Copyright (C) 2014 Eke-Eke (Genesis Plus GX)
*
* Redistribution and use of this code or any derivative works are permitted
* provided that the following conditions are met:
*
* - Redistributions may not be sold, nor may they be used in a commercial
* product or activity.
*
* - Redistributions that are modified from the original source must include the
* complete source code, including the source code for all components used by a
* binary built from the modified sources. However, as a special exception, the
* source code distributed need not include anything that is normally distributed
* (in either source or binary form) with the major components (compiler, kernel,
* and so on) of the operating system on which the executable runs, unless that
* component itself accompanies the executable.
*
* - Redistributions 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.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "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 THE COPYRIGHT OWNER OR CONTRIBUTORS 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.
*
****************************************************************************************/
#include "shared.h"
static struct
{
uint8 State;
uint8 Counter;
uint8 Port;
} board;
void graphic_board_reset(int port)
{
input.analog[0][0] = 128;
input.analog[0][1] = 128;
board.State = 0x7f;
board.Counter = 0;
board.Port = port;
}
unsigned char graphic_board_read(void)
{
uint8 data;
if (board.State & 0x20)
{
return 0x60;
}
switch (board.Counter & 7)
{
case 0:
data = ~input.pad[board.Port];
break;
case 1:
data = 0x0f;
break;
case 2:
data = 0x0f;
break;
case 3:
data = input.analog[board.Port][0] >> 4;
break;
case 4:
data = input.analog[board.Port][0];
break;
case 5:
data = input.analog[board.Port][1] >> 4;
break;
case 6:
data = input.analog[board.Port][1];
break;
case 7:
data = 0x0f;
break;
}
return (board.State & ~0x1f) | (data & 0x0f);
}
void graphic_board_write(unsigned char data, unsigned char mask)
{
data = (board.State & ~mask) | (data & mask);
if ((data ^ board.State) & 0x20)
{
board.Counter = 0;
}
else if ((data ^ board.State) & 0x40)
{
board.Counter++;
}
board.State = data;
}
+47
View File
@@ -0,0 +1,47 @@
/***************************************************************************************
* Genesis Plus
* Sega Graphic board support
*
* Copyright (C) 2017 Eke-Eke (Genesis Plus GX)
*
* Redistribution and use of this code or any derivative works are permitted
* provided that the following conditions are met:
*
* - Redistributions may not be sold, nor may they be used in a commercial
* product or activity.
*
* - Redistributions that are modified from the original source must include the
* complete source code, including the source code for all components used by a
* binary built from the modified sources. However, as a special exception, the
* source code distributed need not include anything that is normally distributed
* (in either source or binary form) with the major components (compiler, kernel,
* and so on) of the operating system on which the executable runs, unless that
* component itself accompanies the executable.
*
* - Redistributions 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.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "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 THE COPYRIGHT OWNER OR CONTRIBUTORS 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.
*
****************************************************************************************/
#ifndef _GRAPHIC_H_
#define _GRAPHIC_H_
/* Function prototypes */
extern void graphic_board_reset(int port);
extern unsigned char graphic_board_read(void);
extern void graphic_board_write(unsigned char data, unsigned char mask);
#endif
+141 -32
View File
@@ -2,8 +2,8 @@
* Genesis Plus
* Input peripherals support
*
* Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003 Charles Mac Donald (original code)
* Copyright (C) 2007-2013 Eke-Eke (Genesis Plus GX)
* Copyright (C) 1998-2003 Charles Mac Donald (original code)
* Copyright (C) 2007-2016 Eke-Eke (Genesis Plus GX)
*
* Redistribution and use of this code or any derivative works are permitted
* provided that the following conditions are met:
@@ -42,11 +42,12 @@
#include "lightgun.h"
#include "mouse.h"
#include "activator.h"
#include "xe_a1p.h"
#include "xe_1ap.h"
#include "teamplayer.h"
#include "paddle.h"
#include "sportspad.h"
#include "terebi_oekaki.h"
#include "graphic_board.h"
t_input input;
int old_system[2] = {-1,-1};
@@ -54,7 +55,7 @@ int old_system[2] = {-1,-1};
void input_init(void)
{
int i;
int i, padtype;
int player = 0;
for (i=0; i<MAX_DEVICES; i++)
@@ -77,18 +78,31 @@ void input_init(void)
return;
}
/* default gamepad type */
if (romtype & SYSTEM_MD)
{
/* 3-buttons or 6-buttons */
padtype = (rominfo.peripherals & 2) ? DEVICE_PAD6B : DEVICE_PAD3B;
}
else
{
/* 2-buttons */
padtype = DEVICE_PAD2B;
}
switch (input.system[0])
{
case SYSTEM_MS_GAMEPAD:
case SYSTEM_GAMEPAD:
{
input.dev[0] = DEVICE_PAD2B;
player++;
break;
}
case SYSTEM_MD_GAMEPAD:
{
input.dev[0] = config.input[player].padtype;
/* 2-buttons, 3-buttons or 6-buttons control pad */
if (config.input[player].padtype != (DEVICE_PAD2B | DEVICE_PAD3B | DEVICE_PAD6B))
{
input.dev[0] = config.input[player].padtype;
}
else
{
input.dev[0] = padtype;
}
player++;
break;
}
@@ -107,9 +121,9 @@ void input_init(void)
break;
}
case SYSTEM_XE_A1P:
case SYSTEM_XE_1AP:
{
input.dev[0] = DEVICE_XE_A1P;
input.dev[0] = DEVICE_XE_1AP;
player++;
break;
}
@@ -120,7 +134,15 @@ void input_init(void)
{
if (player < MAX_INPUTS)
{
input.dev[i] = config.input[player].padtype;
/* only allow 3-buttons or 6-buttons control pad */
if (config.input[player].padtype != (DEVICE_PAD2B | DEVICE_PAD3B | DEVICE_PAD6B))
{
input.dev[i] = config.input[player].padtype & DEVICE_PAD6B;
}
else
{
input.dev[i] = padtype & DEVICE_PAD6B;
}
player++;
}
}
@@ -133,7 +155,15 @@ void input_init(void)
{
if (player < MAX_INPUTS)
{
input.dev[i] = config.input[player].padtype;
/* only allow 3-buttons or 6-buttons control pad */
if (config.input[player].padtype != (DEVICE_PAD2B | DEVICE_PAD3B | DEVICE_PAD6B))
{
input.dev[i] = config.input[player].padtype & DEVICE_PAD6B;
}
else
{
input.dev[i] = padtype & DEVICE_PAD6B;
}
player++;
}
}
@@ -141,6 +171,19 @@ void input_init(void)
break;
}
case SYSTEM_MASTERTAP:
{
for (i=0; i<4; i++)
{
if (player < MAX_INPUTS)
{
input.dev[i] = DEVICE_PAD2B;
player++;
}
}
break;
}
case SYSTEM_LIGHTPHASER:
{
input.dev[0] = DEVICE_LIGHTGUN;
@@ -161,6 +204,13 @@ void input_init(void)
player++;
break;
}
case SYSTEM_GRAPHIC_BOARD:
{
input.dev[0] = DEVICE_GRAPHIC_BOARD;
player++;
break;
}
}
if (player == MAX_INPUTS)
@@ -170,16 +220,16 @@ void input_init(void)
switch (input.system[1])
{
case SYSTEM_MS_GAMEPAD:
case SYSTEM_GAMEPAD:
{
input.dev[4] = DEVICE_PAD2B;
player++;
break;
}
case SYSTEM_MD_GAMEPAD:
{
input.dev[4] = config.input[player].padtype;
if (config.input[player].padtype != (DEVICE_PAD2B | DEVICE_PAD3B | DEVICE_PAD6B))
{
input.dev[4] = config.input[player].padtype;
}
else
{
input.dev[4] = padtype;
}
player++;
break;
}
@@ -198,9 +248,9 @@ void input_init(void)
break;
}
case SYSTEM_XE_A1P:
case SYSTEM_XE_1AP:
{
input.dev[4] = DEVICE_XE_A1P;
input.dev[4] = DEVICE_XE_1AP;
player++;
break;
}
@@ -231,7 +281,15 @@ void input_init(void)
{
if (player < MAX_INPUTS)
{
input.dev[i] = config.input[player].padtype;
/* only allow 3-buttons or 6-buttons control pad */
if (config.input[player].padtype != (DEVICE_PAD2B | DEVICE_PAD3B | DEVICE_PAD6B))
{
input.dev[i] = config.input[player].padtype & DEVICE_PAD6B;
}
else
{
input.dev[i] = padtype & DEVICE_PAD6B;
}
player++;
}
}
@@ -239,6 +297,19 @@ void input_init(void)
break;
}
case SYSTEM_MASTERTAP:
{
for (i=4; i<8; i++)
{
if (player < MAX_INPUTS)
{
input.dev[i] = DEVICE_PAD2B;
player++;
}
}
break;
}
case SYSTEM_LIGHTPHASER:
{
input.dev[4] = DEVICE_LIGHTGUN;
@@ -259,6 +330,13 @@ void input_init(void)
player++;
break;
}
case SYSTEM_GRAPHIC_BOARD:
{
input.dev[4] = DEVICE_GRAPHIC_BOARD;
player++;
break;
}
}
/* J-CART */
@@ -269,7 +347,15 @@ void input_init(void)
{
if (player < MAX_INPUTS)
{
input.dev[i] = config.input[player].padtype;
/* only allow 3-buttons or 6-buttons control pad */
if (config.input[player].padtype != (DEVICE_PAD2B | DEVICE_PAD3B | DEVICE_PAD6B))
{
input.dev[i] = config.input[player].padtype & DEVICE_PAD6B;
}
else
{
input.dev[i] = padtype & DEVICE_PAD6B;
}
player ++;
}
}
@@ -310,9 +396,9 @@ void input_reset(void)
break;
}
case DEVICE_XE_A1P:
case DEVICE_XE_1AP:
{
xe_a1p_reset(i);
xe_1ap_reset(i);
break;
}
@@ -334,6 +420,12 @@ void input_reset(void)
break;
}
case DEVICE_GRAPHIC_BOARD:
{
graphic_board_reset(i);
break;
}
default:
{
break;
@@ -372,3 +464,20 @@ void input_refresh(void)
}
}
}
void input_end_frame(unsigned int cycles)
{
int i;
for (i=0; i<MAX_DEVICES; i++)
{
switch (input.dev[i])
{
case DEVICE_PAD3B:
case DEVICE_PAD6B:
{
gamepad_end_frame(i, cycles);
break;
}
}
}
}
+43 -33
View File
@@ -2,8 +2,8 @@
* Genesis Plus
* Input peripherals support
*
* Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003 Charles Mac Donald (original code)
* Copyright (C) 2007-2013 Eke-Eke (Genesis Plus GX)
* Copyright (C) 1998-2003 Charles Mac Donald (original code)
* Copyright (C) 2007-2016 Eke-Eke (Genesis Plus GX)
*
* Redistribution and use of this code or any derivative works are permitted
* provided that the following conditions are met:
@@ -44,33 +44,35 @@
#define MAX_DEVICES (8)
/* Ports configuration */
#define NO_SYSTEM (0) /* unconnected port*/
#define SYSTEM_MD_GAMEPAD (1) /* single 3-buttons or 6-buttons Control Pad */
#define SYSTEM_MOUSE (2) /* Sega Mouse */
#define SYSTEM_MENACER (3) /* Sega Menacer (port B only) */
#define SYSTEM_JUSTIFIER (4) /* Konami Justifiers (port B only) */
#define SYSTEM_XE_A1P (5) /* XE-A1P analog controller (port A only) */
#define SYSTEM_ACTIVATOR (6) /* Sega Activator */
#define SYSTEM_MS_GAMEPAD (7) /* single 2-buttons Control Pad (Master System) */
#define SYSTEM_LIGHTPHASER (8) /* Sega Light Phaser (Master System) */
#define SYSTEM_PADDLE (9) /* Sega Paddle Control (Master System) */
#define SYSTEM_SPORTSPAD (10) /* Sega Sports Pad (Master System) */
#define SYSTEM_TEAMPLAYER (11) /* Multi Tap -- Sega TeamPlayer */
#define SYSTEM_WAYPLAY (12) /* Multi Tap -- EA 4-Way Play (use both ports) */
#define NO_SYSTEM (0) /* unconnected port*/
#define SYSTEM_GAMEPAD (1) /* 2-buttons, 3-buttons or 6-buttons Control Pad */
#define SYSTEM_MOUSE (2) /* Sega Mouse (only supported in either port A or port B) */
#define SYSTEM_MENACER (3) /* Sega Menacer (only supported in port B) */
#define SYSTEM_JUSTIFIER (4) /* Konami Justifiers (only supported in port B) */
#define SYSTEM_XE_1AP (5) /* XE-1AP analog controller */
#define SYSTEM_ACTIVATOR (6) /* Sega Activator */
#define SYSTEM_LIGHTPHASER (7) /* Sega Light Phaser */
#define SYSTEM_PADDLE (8) /* Sega Paddle Control */
#define SYSTEM_SPORTSPAD (9) /* Sega Sports Pad */
#define SYSTEM_GRAPHIC_BOARD (10) /* Sega Graphic Board */
#define SYSTEM_MASTERTAP (11) /* Multi Tap -- Furrtek's Master Tap (unofficial) */
#define SYSTEM_TEAMPLAYER (12) /* Multi Tap -- Sega TeamPlayer */
#define SYSTEM_WAYPLAY (13) /* Multi Tap -- EA 4-Way Play (use both ports) */
/* Device type */
#define NO_DEVICE (0xff) /* unconnected device (fixed ID for Team Player) */
#define DEVICE_PAD3B (0x00) /* 3-buttons Control Pad (fixed ID for Team Player)*/
#define DEVICE_PAD6B (0x01) /* 6-buttons Control Pad (fixed ID for Team Player) */
#define DEVICE_PAD2B (0x02) /* 2-buttons Control Pad */
#define DEVICE_MOUSE (0x03) /* Sega Mouse */
#define DEVICE_LIGHTGUN (0x04) /* Sega Light Phaser, Menacer or Konami Justifiers */
#define DEVICE_PADDLE (0x05) /* Sega Paddle Control */
#define DEVICE_SPORTSPAD (0x06) /* Sega Sports Pad */
#define DEVICE_PICO (0x07) /* PICO tablet */
#define DEVICE_TEREBI (0x08) /* Terebi Oekaki tablet */
#define DEVICE_XE_A1P (0x09) /* XE-A1P analog controller */
#define DEVICE_ACTIVATOR (0x0a) /* Activator */
#define NO_DEVICE (0xff) /* unconnected device (fixed ID for Team Player) */
#define DEVICE_PAD3B (0x00) /* 3-buttons Control Pad (fixed ID for Team Player)*/
#define DEVICE_PAD6B (0x01) /* 6-buttons Control Pad (fixed ID for Team Player) */
#define DEVICE_PAD2B (0x02) /* 2-buttons Control Pad */
#define DEVICE_MOUSE (0x03) /* Sega Mouse */
#define DEVICE_LIGHTGUN (0x04) /* Sega Light Phaser, Menacer or Konami Justifiers */
#define DEVICE_PADDLE (0x05) /* Sega Paddle Control */
#define DEVICE_SPORTSPAD (0x06) /* Sega Sports Pad */
#define DEVICE_GRAPHIC_BOARD (0x07) /* Sega Graphic Board */
#define DEVICE_PICO (0x08) /* PICO tablet */
#define DEVICE_TEREBI (0x09) /* Terebi Oekaki tablet */
#define DEVICE_XE_1AP (0x0a) /* XE-1AP analog controller */
#define DEVICE_ACTIVATOR (0x0b) /* Activator */
/* Default Input bitmasks */
#define INPUT_MODE (0x0800)
@@ -100,12 +102,14 @@
#define INPUT_PICO_RED (0x0010)
/* XE-1AP specific bitmask */
#define INPUT_XE_E1 (0x0800)
#define INPUT_XE_E2 (0x0400)
#define INPUT_XE_START (0x0200)
#define INPUT_XE_SELECT (0x0100)
#define INPUT_XE_A (0x0080)
#define INPUT_XE_B (0x0040)
#define INPUT_XE_E1 (0x2000)
#define INPUT_XE_E2 (0x1000)
#define INPUT_XE_START (0x0800)
#define INPUT_XE_SELECT (0x0400)
#define INPUT_XE_A (0x0200)
#define INPUT_XE_B (0x0100)
#define INPUT_XE_A2 (0x0080)
#define INPUT_XE_B2 (0x0040)
#define INPUT_XE_C (0x0020)
#define INPUT_XE_D (0x0010)
@@ -127,6 +131,11 @@
#define INPUT_ACTIVATOR_1U (0x0002)
#define INPUT_ACTIVATOR_1L (0x0001)
/* Graphic Board specific bitmasks */
#define INPUT_GRAPHIC_PEN (0x0004)
#define INPUT_GRAPHIC_DO (0x0002)
#define INPUT_GRAPHIC_MENU (0x0001)
typedef struct
{
uint8 system[2]; /* can be one of the SYSTEM_* values */
@@ -145,5 +154,6 @@ extern int old_system[2];
extern void input_init(void);
extern void input_reset(void);
extern void input_refresh(void);
extern void input_end_frame(unsigned int cycles);
#endif
+24 -23
View File
@@ -2,7 +2,7 @@
* Genesis Plus
* Team Player support
*
* Copyright (C) 2007-2011 Eke-Eke (Genesis Plus GX)
* Copyright (C) 2007-2014 Eke-Eke (Genesis Plus GX)
*
* Redistribution and use of this code or any derivative works are permitted
* provided that the following conditions are met:
@@ -87,18 +87,20 @@ INLINE unsigned int teamplayer_read(int port)
/* acquisition sequence */
switch (counter)
{
case 0: /* initial state: TH = 1, TR = 1 -> RLDU = 0011 */
case 0: /* initial state: xxx0011 */
{
return 0x73;
/* TL should match TR */
return ((teamplayer[port].State & 0x20) >> 1) | 0x03;
}
case 1: /* start request: TH = 0, TR = 1 -> RLDU = 1111 */
case 1: /* start request: xxx1111 */
{
return 0x3F;
/* TL should match TR */
return ((teamplayer[port].State & 0x20) >> 1) | 0x0F;
}
case 2:
case 3: /* ack request: TH=0, TR=0/1 -> RLDU = 0000 */
case 3: /* ack request: xxx0000 */
{
/* TL should match TR */
return ((teamplayer[port].State & 0x20) >> 1);
@@ -107,7 +109,7 @@ INLINE unsigned int teamplayer_read(int port)
case 4:
case 5:
case 6:
case 7: /* PAD type */
case 7: /* PAD type: xxx0000 (3B), xxx0001 (6B) or xxx1111 (NC)*/
{
unsigned int retval = input.dev[(port << 2) + (counter - 4)];
@@ -115,7 +117,7 @@ INLINE unsigned int teamplayer_read(int port)
return (((teamplayer[port].State & 0x20) >> 1) | retval);
}
default: /* PAD status */
default: /* PAD status: xxxRLDU -> xxxSACB -> xxxMXYZ */
{
unsigned int retval = 0x0F;
@@ -136,23 +138,22 @@ INLINE void teamplayer_write(int port, unsigned char data, unsigned char mask)
/* update bits set as output only */
unsigned int state = (teamplayer[port].State & ~mask) | (data & mask);
/* TH & TR handshaking */
if ((teamplayer[port].State ^ state) & 0x60)
/* check if TH is HIGH */
if (state & 0x40)
{
if (state & 0x40)
{
/* TH high -> reset counter */
teamplayer[port].Counter = 0;
}
else
{
/* increment counter */
teamplayer[port].Counter++;
}
/* update internal state */
teamplayer[port].State = state;
/* reset counter */
teamplayer[port].Counter = 0;
}
/* TH & TR handshaking */
else if ((teamplayer[port].State ^ state) & 0x60)
{
/* increment counter */
teamplayer[port].Counter++;
}
/* update internal state */
teamplayer[port].State = state;
}
unsigned char teamplayer_1_read(void)
+1 -1
View File
@@ -2,7 +2,7 @@
* Genesis Plus
* Team Player support
*
* Copyright (C) 2007-2011 Eke-Eke (Genesis Plus GX)
* Copyright (C) 2007-2014 Eke-Eke (Genesis Plus GX)
*
* Redistribution and use of this code or any derivative works are permitted
* provided that the following conditions are met:
+174
View File
@@ -0,0 +1,174 @@
/***************************************************************************************
* Genesis Plus
* XE-1AP analog controller support
*
* Copyright (C) 2011-2015 Eke-Eke (Genesis Plus GX)
*
* Redistribution and use of this code or any derivative works are permitted
* provided that the following conditions are met:
*
* - Redistributions may not be sold, nor may they be used in a commercial
* product or activity.
*
* - Redistributions that are modified from the original source must include the
* complete source code, including the source code for all components used by a
* binary built from the modified sources. However, as a special exception, the
* source code distributed need not include anything that is normally distributed
* (in either source or binary form) with the major components (compiler, kernel,
* and so on) of the operating system on which the executable runs, unless that
* component itself accompanies the executable.
*
* - Redistributions 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.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "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 THE COPYRIGHT OWNER OR CONTRIBUTORS 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.
*
****************************************************************************************/
#include "shared.h"
#define XE_1AP_LATENCY 3
static struct
{
uint8 State;
uint8 Counter;
uint8 Latency;
} xe_1ap[2];
void xe_1ap_reset(int index)
{
input.analog[index][0] = 128;
input.analog[index][1] = 128;
input.analog[index+1][0] = 128;
index >>= 2;
xe_1ap[index].State = 0x40;
xe_1ap[index].Counter = 11;
xe_1ap[index].Latency = 0;
}
INLINE unsigned char xe_1ap_read(int index)
{
unsigned char data;
unsigned int port = index << 2;
/* Current data transfer cycle */
switch (xe_1ap[index].Counter)
{
case 0: /* E1 E2 Start Select buttons status (active low) */
data = (~input.pad[port] >> 10) & 0x0F;
break;
case 1: /* A/A' B/B' C D buttons status (active low) */
data = ((~input.pad[port] >> 4) & 0x0F) & ~((input.pad[port] >> 6) & 0x0C);
break;
case 2: /* CH0 high (Analog Stick Left/Right direction) */
data = (input.analog[port][0] >> 4) & 0x0F;
break;
case 3: /* CH1 high (Analog Stick Up/Down direction) */
data = (input.analog[port][1] >> 4) & 0x0F;
break;
case 4: /* CH2 high (N/A) */
data = 0x0;
break;
case 5: /* CH3 high (Throttle vertical or horizontal direction) */
data = (input.analog[port+1][0] >> 4) & 0x0F;
break;
case 6: /* CH0 low (Analog Stick Left/Right direction) */
data = input.analog[port][0] & 0x0F;
break;
case 7: /* CH1 low (Analog Stick Up/Down direction)*/
data = input.analog[port][1] & 0x0F;
break;
case 8: /* CH2 low (N/A) */
data = 0x0;
break;
case 9: /* CH3 low (Throttle vertical or horizontal direction) */
data = input.analog[port+1][0] & 0x0F;
break;
case 10: /* A B A' B' buttons status (active low) */
data = (~input.pad[port] >> 6) & 0x0F;
break;
default: /* N/A */
data = 0x0F;
break;
}
/* TL indicates current data cycle (0=1st cycle, 1=2nd cycle, etc) */
data |= ((xe_1ap[index].Counter & 1) << 4);
/* TR indicates if data is valid (0=valid, 1=not ready) */
/* Some games expect this bit to switch between 0 and 1 */
/* so we actually keep it high for some reads after the */
/* data cycle has been initialized or incremented */
if (xe_1ap[index].Latency)
{
if (xe_1ap[index].Latency > 1)
{
/* data is not ready */
data |= 0x20;
}
/* decrement internal latency */
xe_1ap[index].Latency--;
}
else if (xe_1ap[index].Counter <= 10)
{
/* next data cycle */
xe_1ap[index].Counter++;
/* reinitialize internal latency */
xe_1ap[index].Latency = XE_1AP_LATENCY;
}
return data;
}
INLINE void xe_1ap_write(int index, unsigned char data, unsigned char mask)
{
/* only update bits set as output */
data = (xe_1ap[index].State & ~mask) | (data & mask);
/* look for TH 1->0 transitions */
if (!(data & 0x40) && (xe_1ap[index].State & 0x40))
{
/* reset data acquisition cycle */
xe_1ap[index].Counter = 0;
/* initialize internal latency */
xe_1ap[index].Latency = XE_1AP_LATENCY;
}
/* update internal state */
xe_1ap[index].State = data;
}
unsigned char xe_1ap_1_read(void)
{
return xe_1ap_read(0);
}
unsigned char xe_1ap_2_read(void)
{
return xe_1ap_read(1);
}
void xe_1ap_1_write(unsigned char data, unsigned char mask)
{
xe_1ap_write(0, data, mask);
}
void xe_1ap_2_write(unsigned char data, unsigned char mask)
{
xe_1ap_write(1, data, mask);
}
@@ -1,8 +1,8 @@
/***************************************************************************************
* Genesis Plus
* XE-A1P analog controller support
* XE-1AP analog controller support
*
* Copyright (C) 2011-2013 Eke-Eke (Genesis Plus GX)
* Copyright (C) 2011-2015 Eke-Eke (Genesis Plus GX)
*
* Redistribution and use of this code or any derivative works are permitted
* provided that the following conditions are met:
@@ -36,14 +36,14 @@
*
****************************************************************************************/
#ifndef _XE_A1PH_
#define _XE_A1PH_
#ifndef _XE_1APH_
#define _XE_1APH_
/* Function prototypes */
extern void xe_a1p_reset(int index);
extern unsigned char xe_a1p_1_read(void);
extern unsigned char xe_a1p_2_read(void);
extern void xe_a1p_1_write(unsigned char data, unsigned char mask);
extern void xe_a1p_2_write(unsigned char data, unsigned char mask);
extern void xe_1ap_reset(int index);
extern unsigned char xe_1ap_1_read(void);
extern unsigned char xe_1ap_2_read(void);
extern void xe_1ap_1_write(unsigned char data, unsigned char mask);
extern void xe_1ap_2_write(unsigned char data, unsigned char mask);
#endif
-182
View File
@@ -1,182 +0,0 @@
/***************************************************************************************
* Genesis Plus
* XE-A1P analog controller support
*
* Copyright (C) 2011-2013 Eke-Eke (Genesis Plus GX)
*
* Redistribution and use of this code or any derivative works are permitted
* provided that the following conditions are met:
*
* - Redistributions may not be sold, nor may they be used in a commercial
* product or activity.
*
* - Redistributions that are modified from the original source must include the
* complete source code, including the source code for all components used by a
* binary built from the modified sources. However, as a special exception, the
* source code distributed need not include anything that is normally distributed
* (in either source or binary form) with the major components (compiler, kernel,
* and so on) of the operating system on which the executable runs, unless that
* component itself accompanies the executable.
*
* - Redistributions 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.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "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 THE COPYRIGHT OWNER OR CONTRIBUTORS 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.
*
****************************************************************************************/
#include "shared.h"
static struct
{
uint8 State;
uint8 Counter;
uint8 Latency;
} xe_a1p[2];
void xe_a1p_reset(int index)
{
input.analog[index][0] = 128;
input.analog[index][1] = 128;
input.analog[index+1][0] = 128;
index >>= 2;
xe_a1p[index].State = 0x40;
xe_a1p[index].Counter = 0;
xe_a1p[index].Latency = 0;
}
INLINE unsigned char xe_a1p_read(int index)
{
unsigned int temp = 0x40;
unsigned int port = index << 2;
/* Left Stick X & Y analog values (bidirectional) */
int x = input.analog[port][0];
int y = input.analog[port][1];
/* Right Stick X or Y value (unidirectional) */
int z = input.analog[port+1][0];
/* Buttons status (active low) */
uint16 pad = ~input.pad[port];
/* Current internal cycle (0-7) */
unsigned int cycle = xe_a1p[index].Counter & 7;
/* Current 4-bit data cycle */
/* There are eight internal data cycle for each 5 acquisition sequence */
/* First 4 return the same 4-bit data, next 4 return next 4-bit data */
switch (xe_a1p[index].Counter >> 2)
{
case 0:
temp |= ((pad >> 8) & 0x0F); /* E1 E2 Start Select */
break;
case 1:
temp |= ((pad >> 4) & 0x0F); /* A B C D */
break;
case 2:
temp |= ((x >> 4) & 0x0F);
break;
case 3:
temp |= ((y >> 4) & 0x0F);
break;
case 4:
break;
case 5:
temp |= ((z >> 4) & 0x0F);
break;
case 6:
temp |= (x & 0x0F);
break;
case 7:
temp |= (y & 0x0F);
break;
case 8:
break;
case 9:
temp |= (z & 0x0F);
break;
}
/* TL indicates which part of data is returned (0=1st part, 1=2nd part) */
temp |= ((cycle & 4) << 2);
/* TR indicates if data is ready (0=ready, 1=not ready) */
/* Fastest One input routine actually expects this bit to switch between 0 & 1 */
/* so we make the first read of a data cycle return 1 then 0 for remaining reads */
temp |= (!(cycle & 3) << 5);
/* Automatically increment data cycle on each read (within current acquisition sequence) */
cycle = (cycle + 1) & 7;
/* Update internal cycle counter */
xe_a1p[index].Counter = (xe_a1p[index].Counter & ~7) | cycle;
/* Update internal latency on each read */
xe_a1p[index].Latency++;
return temp;
}
INLINE void xe_a1p_write(int index, unsigned char data, unsigned char mask)
{
/* update bits set as output only */
data = (xe_a1p[index].State & ~mask) | (data & mask);
/* look for TH 1->0 transitions */
if (!(data & 0x40) && (xe_a1p[index].State & 0x40))
{
/* reset acquisition cycle */
xe_a1p[index].Latency = xe_a1p[index].Counter = 0;
}
else
{
/* some games immediately write new data to TH */
/* so we make sure first sequence has actually been handled */
if (xe_a1p[index].Latency > 2)
{
/* next acquisition sequence */
xe_a1p[index].Counter = (xe_a1p[index].Counter & ~7) + 8;
/* 5 sequence max with 8 cycles each */
if (xe_a1p[index].Counter > 32)
{
xe_a1p[index].Counter = 32;
}
}
}
/* update internal state */
xe_a1p[index].State = data;
}
unsigned char xe_a1p_1_read(void)
{
return xe_a1p_read(0);
}
unsigned char xe_a1p_2_read(void)
{
return xe_a1p_read(1);
}
void xe_a1p_1_write(unsigned char data, unsigned char mask)
{
xe_a1p_write(0, data, mask);
}
void xe_a1p_2_write(unsigned char data, unsigned char mask)
{
xe_a1p_write(1, data, mask);
}
+71 -55
View File
@@ -4,8 +4,8 @@
*
* Support for Master System (315-5216, 315-5237 & 315-5297), Game Gear & Mega Drive I/O chips
*
* Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003 Charles Mac Donald (original code)
* Copyright (C) 2007-2013 Eke-Eke (Genesis Plus GX)
* Copyright (C) 1998-2003 Charles Mac Donald (original code)
* Copyright (C) 2007-2016 Eke-Eke (Genesis Plus GX)
*
* Redistribution and use of this code or any derivative works are permitted
* provided that the following conditions are met:
@@ -44,10 +44,11 @@
#include "lightgun.h"
#include "mouse.h"
#include "activator.h"
#include "xe_a1p.h"
#include "xe_1ap.h"
#include "teamplayer.h"
#include "paddle.h"
#include "sportspad.h"
#include "graphic_board.h"
uint8 io_reg[0x10];
@@ -80,16 +81,9 @@ void io_init(void)
/* Initialize IO Ports handlers & connected peripherals */
switch (input.system[0])
{
case SYSTEM_MS_GAMEPAD:
case SYSTEM_GAMEPAD:
{
port[0].data_w = dummy_write;
port[0].data_r = gamepad_1_read;
break;
}
case SYSTEM_MD_GAMEPAD:
{
port[0].data_w = gamepad_1_write;
port[0].data_w = (input.dev[0] == DEVICE_PAD2B) ? dummy_write : gamepad_1_write;
port[0].data_r = gamepad_1_read;
break;
}
@@ -108,10 +102,10 @@ void io_init(void)
break;
}
case SYSTEM_XE_A1P:
case SYSTEM_XE_1AP:
{
port[0].data_w = xe_a1p_1_write;
port[0].data_r = xe_a1p_1_read;
port[0].data_w = xe_1ap_1_write;
port[0].data_r = xe_1ap_1_read;
break;
}
@@ -129,6 +123,13 @@ void io_init(void)
break;
}
case SYSTEM_MASTERTAP:
{
port[0].data_w = mastertap_1_write;
port[0].data_r = mastertap_1_read;
break;
}
case SYSTEM_LIGHTPHASER:
{
port[0].data_w = dummy_write;
@@ -150,6 +151,13 @@ void io_init(void)
break;
}
case SYSTEM_GRAPHIC_BOARD:
{
port[0].data_w = graphic_board_write;
port[0].data_r = graphic_board_read;
break;
}
default:
{
port[0].data_w = dummy_write;
@@ -160,16 +168,9 @@ void io_init(void)
switch (input.system[1])
{
case SYSTEM_MS_GAMEPAD:
case SYSTEM_GAMEPAD:
{
port[1].data_w = dummy_write;
port[1].data_r = gamepad_2_read;
break;
}
case SYSTEM_MD_GAMEPAD:
{
port[1].data_w = gamepad_2_write;
port[1].data_w = (input.dev[4] == DEVICE_PAD2B) ? dummy_write : gamepad_2_write;
port[1].data_r = gamepad_2_read;
break;
}
@@ -181,10 +182,10 @@ void io_init(void)
break;
}
case SYSTEM_XE_A1P:
case SYSTEM_XE_1AP:
{
port[1].data_w = xe_a1p_2_write;
port[1].data_r = xe_a1p_2_read;
port[1].data_w = xe_1ap_2_write;
port[1].data_r = xe_1ap_2_read;
break;
}
@@ -223,6 +224,13 @@ void io_init(void)
break;
}
case SYSTEM_MASTERTAP:
{
port[1].data_w = mastertap_2_write;
port[1].data_r = mastertap_2_read;
break;
}
case SYSTEM_LIGHTPHASER:
{
port[1].data_w = dummy_write;
@@ -244,6 +252,13 @@ void io_init(void)
break;
}
case SYSTEM_GRAPHIC_BOARD:
{
port[1].data_w = graphic_board_write;
port[1].data_r = graphic_board_read;
break;
}
default:
{
port[1].data_w = dummy_write;
@@ -309,6 +324,12 @@ void io_reset(void)
/* Control registers */
io_reg[0x0E] = 0x00;
io_reg[0x0F] = 0xFF;
/* on SG-1000 & Mark-III, TH is not connected (always return 1) */
if (system_hw < SYSTEM_SMS)
{
io_reg[0x0F] = 0xF5;
}
}
/* Reset connected peripherals */
@@ -397,12 +418,10 @@ unsigned int io_68k_read(unsigned int offset)
void io_z80_write(unsigned int offset, unsigned int data, unsigned int cycles)
{
/* I/O Control register */
if (offset)
{
/* I/O Control register */
if (region_code & REGION_USA)
{
/*
/*
Bit Function
--------------
D7 : Port B TH pin output level (1=high, 0=low)
@@ -413,36 +432,33 @@ void io_z80_write(unsigned int offset, unsigned int data, unsigned int cycles)
D2 : Port B TR pin direction (1=input, 0=output)
D1 : Port A TH pin direction (1=input, 0=output)
D0 : Port A TR pin direction (1=input, 0=output)
*/
*/
/* Send TR/TH state to connected peripherals */
port[0].data_w((data << 1) & 0x60, (~io_reg[0x0F] << 5) & 0x60);
port[1].data_w((data >> 1) & 0x60, (~io_reg[0x0F] << 3) & 0x60);
/* Check for TH low-to-high transitions on both ports */
if ((!(io_reg[0x0F] & 0x80) && (data & 0x80)) ||
(!(io_reg[0x0F] & 0x20) && (data & 0x20)))
{
/* Latch new HVC */
hvc_latch = hctab[cycles % MCYCLES_PER_LINE] | 0x10000;
}
/* Update I/O Control register */
io_reg[0x0F] = data;
}
else
/* Send TR/TH state to connected peripherals */
port[0].data_w((data << 1) & 0x60, (~data << 5) & 0x60);
port[1].data_w((data >> 1) & 0x60, (~data << 3) & 0x60);
/* Check for TH low-to-high transitions on both ports */
if ((!(io_reg[0x0F] & 0x80) && (data & 0x80)) ||
(!(io_reg[0x0F] & 0x20) && (data & 0x20)))
{
/* TH output is fixed to 0 & TR is always an input on japanese hardware */
io_reg[0x0F] = (data | 0x05) & 0x5F;
/* Port $DD bits D4-D5 return D0-D2 (cf. http://www2.odn.ne.jp/~haf09260/Sms/EnrSms.htm) */
io_reg[0x0D] = ((data & 0x01) << 4) | ((data & 0x04) << 3);
/* Latch new HVC */
hvc_latch = hctab[cycles % MCYCLES_PER_LINE] | 0x10000;
}
/* Japanese model specific */
if (region_code == REGION_JAPAN_NTSC)
{
/* Reading TH & TR pins always return 0 when set as output */
data &= 0x0F;
}
/* Update I/O Control register */
io_reg[0x0F] = data;
}
else
{
/* Update Memory Control register */
/* Memory Control register */
io_reg[0x0E] = data;
/* Switch cartridge & BIOS ROM */
+2 -2
View File
@@ -4,8 +4,8 @@
*
* Support for Master System (315-5216, 315-5237 & 315-5297), Game Gear & Mega Drive I/O chips
*
* Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003 Charles Mac Donald (original code)
* Copyright (C) 2007-2013 Eke-Eke (Genesis Plus GX)
* Copyright (C) 1998-2003 Charles Mac Donald (original code)
* Copyright (C) 2007-2016 Eke-Eke (Genesis Plus GX)
*
* Redistribution and use of this code or any derivative works are permitted
* provided that the following conditions are met:
+112 -72
View File
@@ -2,8 +2,8 @@
* Genesis Plus
* ROM Loading Support
*
* Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003 Charles Mac Donald (original code)
* Copyright (C) 2007-2013 Eke-Eke (Genesis Plus GX)
* Copyright (C) 1998-2003 Charles Mac Donald (original code)
* Copyright (C) 2007-2016 Eke-Eke (Genesis Plus GX)
*
* Redistribution and use of this code or any derivative works are permitted
* provided that the following conditions are met:
@@ -389,11 +389,11 @@ void getrominfo(char *romheader)
* Return loaded size (-1 if already loaded)
*
***************************************************************************/
int load_bios(void)
int load_bios(int system)
{
int size = 0;
switch (system_hw)
switch (system)
{
case SYSTEM_MCD:
{
@@ -453,7 +453,7 @@ int load_bios(void)
if (cart.romsize <= 0x400000)
{
/* load Game Gear BOOTROM file */
size = load_archive(GG_BIOS, cart.rom + 0x400000, 0x100000, 0);
size = load_archive(GG_BIOS, cart.rom + 0x400000, 0x400000, 0);
if (size > 0)
{
@@ -512,6 +512,8 @@ int load_bios(void)
default:
{
/* mark all BOOTROM as unloaded */
system_bios &= ~(0x10 | SYSTEM_SMS | SYSTEM_GG);
return 0;
}
}
@@ -529,6 +531,15 @@ int load_rom(char *filename)
{
int i, size;
#ifdef USE_DYNAMIC_ALLOC
if (!ext)
{
/* allocate memory for Cartridge / CD hardware if required */
ext = (external_t *)malloc(sizeof(external_t));
if (!ext) return (0);
}
#endif
/* clear any existing patches */
ggenie_shutdown();
areplay_shutdown();
@@ -540,30 +551,28 @@ int load_rom(char *filename)
cdd.loaded = 0;
}
/* auto-detect CD image files */
/* auto-detect CD image file */
size = cdd_load(filename, (char *)(cart.rom));
if (size < 0)
{
/* error opening file */
return 0;
return (0);
}
if (size > 0)
/* CD image file ? */
if (size)
{
/* CD image file loaded */
/* enable CD hardware */
system_hw = SYSTEM_MCD;
/* boot from CD hardware */
scd.cartridge.boot = 0x00;
}
else
{
/* load file into ROM buffer */
char extension[4];
size = load_archive(filename, cart.rom, sizeof(cart.rom), extension);
if (!size)
{
/* mark all BOOTROM as unloaded since they could have been overwritten */
system_bios &= ~(0x10 | SYSTEM_SMS | SYSTEM_GG);
return 0;
}
size = load_archive(filename, cart.rom, cdd.loaded ? 0x800000 : MAXROMSIZE, extension);
/* mark BOOTROM as unloaded if they have been overwritten by cartridge ROM */
if (size > 0x800000)
@@ -576,8 +585,16 @@ int load_rom(char *filename)
/* Master System or Game Gear BIOS ROM are loaded within $400000-$4FFFFF area */
system_bios &= ~(SYSTEM_SMS | SYSTEM_GG);
}
else if (size <= 0)
{
/* mark all BOOTROM as unloaded since they could have been overwritten */
system_bios &= ~(0x10 | SYSTEM_SMS | SYSTEM_GG);
/* error loading file */
return 0;
}
/* convert lower case to upper case */
/* convert lower case file extension to upper case */
*(uint32 *)(extension) &= 0xdfdfdfdf;
/* auto-detect system hardware from ROM file extension */
@@ -598,7 +615,7 @@ int load_rom(char *filename)
}
else
{
/* Mega Drive hardware (Genesis mode) */
/* default is Mega Drive / Genesis hardware (16-bit mode) */
system_hw = SYSTEM_MD;
/* decode .MDX format */
@@ -631,7 +648,7 @@ int load_rom(char *filename)
size -= 512;
memcpy (cart.rom, cart.rom + 512, size);
/* assume interleaved Genesis ROM format (.smd) */
/* assume interleaved Mega Drive / Genesis ROM format (.smd) */
if (system_hw == SYSTEM_MD)
{
for (i = 0; i < (size / 0x4000); i++)
@@ -651,26 +668,9 @@ int load_rom(char *filename)
/* set console region */
get_region((char *)(cart.rom));
/* CD image file */
if (system_hw == SYSTEM_MCD)
{
/* load CD BOOT ROM */
if (!load_bios())
{
/* unmount CD image */
cdd_unload();
/* error loading CD BOOT ROM */
return (0);
}
/* boot from CD */
scd.cartridge.boot = 0x00;
}
#ifdef LSB_FIRST
/* 16-bit ROM specific */
else if (system_hw == SYSTEM_MD)
if (system_hw == SYSTEM_MD)
{
/* Byteswap ROM to optimize 16-bit access */
for (i = 0; i < cart.romsize; i += 2)
@@ -682,9 +682,6 @@ int load_rom(char *filename)
}
#endif
/* Save auto-detected system hardware */
romtype = system_hw;
/* PICO ROM */
if (strstr(rominfo.consoletype, "SEGA PICO") != NULL)
{
@@ -692,13 +689,30 @@ int load_rom(char *filename)
system_hw = SYSTEM_PICO;
}
/* Save auto-detected system hardware */
romtype = system_hw;
/* CD image file */
if (system_hw == SYSTEM_MCD)
{
/* try to load CD BOOTROM for selected region */
if (!load_bios(SYSTEM_MCD))
{
/* unmount CD image */
cdd_unload();
/* error booting from CD */
return (0);
}
}
/* CD BOOTROM */
else if (strstr(rominfo.ROMType, "BR") != NULL)
{
/* enable CD hardware */
system_hw = SYSTEM_MCD;
/* boot from CD */
/* boot from CD hardware */
scd.cartridge.boot = 0x00;
/* copy ROM to BOOTROM area */
@@ -711,31 +725,50 @@ int load_rom(char *filename)
system_bios = (system_bios & 0xf0) | (region_code >> 4);
}
/* ROM cartridges with CD support */
/* ROM cartridge (max. 8MB) with CD loaded */
else if ((cart.romsize <= 0x800000) && cdd.loaded)
{
/* try to load CD BOOTROM */
if (load_bios(SYSTEM_MCD))
{
/* enable CD hardware */
system_hw = SYSTEM_MCD;
/* boot from cartridge */
scd.cartridge.boot = 0x40;
}
else
{
/* unmount CD image */
cdd_unload();
}
}
/* ROM cartridge with CD support */
else if ((strstr(rominfo.domestic,"FLUX") != NULL) ||
(strstr(rominfo.domestic,"WONDER LIBRARY") != NULL) ||
(strstr(rominfo.product,"T-5740") != NULL))
{
/* check if console hardware is set to AUTO */
if (config.system == 0x00)
if (!config.system)
{
/* auto-enable CD hardware */
system_hw = SYSTEM_MCD;
/* try to load CD BOOTROM */
if (load_bios())
if (load_bios(SYSTEM_MCD))
{
char fname[256];
int len = strlen(filename);
/* automatically try to load associated .iso file */
while ((len && (filename[len] != '.')) || (len > 251)) len--;
strncpy(fname, filename, len);
strcpy(&fname[len], ".iso");
cdd_load(fname, (char *)cdc.ram);
/* enable CD hardware */
system_hw = SYSTEM_MCD;
/* boot from cartridge */
scd.cartridge.boot = 0x40;
/* automatically load associated .iso image */
strncpy(&filename[strlen(filename) - 4], ".iso", 4);
cdd_load(filename, (char *)cdc.ram);
}
else
{
/* if not found, disable CD hardware */
system_hw = SYSTEM_MD;
}
}
}
@@ -790,7 +823,7 @@ int load_rom(char *filename)
}
/* force MENACER configuration */
input.system[0] = SYSTEM_MD_GAMEPAD;
input.system[0] = SYSTEM_GAMEPAD;
input.system[1] = SYSTEM_MENACER;
input.x_offset = 82;
input.y_offset = 0;
@@ -808,7 +841,7 @@ int load_rom(char *filename)
}
/* force MENACER configuration */
input.system[0] = SYSTEM_MD_GAMEPAD;
input.system[0] = SYSTEM_GAMEPAD;
input.system[1] = SYSTEM_MENACER;
input.x_offset = 133;
input.y_offset = -8;
@@ -826,7 +859,7 @@ int load_rom(char *filename)
}
/* force MENACER configuration */
input.system[0] = SYSTEM_MD_GAMEPAD;
input.system[0] = SYSTEM_GAMEPAD;
input.system[1] = SYSTEM_MENACER;
input.x_offset = 68;
input.y_offset = -24;
@@ -844,7 +877,7 @@ int load_rom(char *filename)
}
/* force MENACER configuration */
input.system[0] = SYSTEM_MD_GAMEPAD;
input.system[0] = SYSTEM_GAMEPAD;
input.system[1] = SYSTEM_MENACER;
input.x_offset = 64;
input.y_offset = -8;
@@ -862,7 +895,7 @@ int load_rom(char *filename)
}
/* force MENACER configuration */
input.system[0] = SYSTEM_MD_GAMEPAD;
input.system[0] = SYSTEM_GAMEPAD;
input.system[1] = SYSTEM_MENACER;
input.x_offset = 61;
input.y_offset = 0;
@@ -880,7 +913,7 @@ int load_rom(char *filename)
}
/* force MENACER configuration */
input.system[0] = SYSTEM_MD_GAMEPAD;
input.system[0] = SYSTEM_GAMEPAD;
input.system[1] = SYSTEM_MENACER;
input.x_offset = 70;
input.y_offset = 18;
@@ -898,7 +931,7 @@ int load_rom(char *filename)
}
/* force MENACER configuration */
input.system[0] = SYSTEM_MD_GAMEPAD;
input.system[0] = SYSTEM_GAMEPAD;
input.system[1] = SYSTEM_MENACER;
input.x_offset = 49;
input.y_offset = 0;
@@ -916,7 +949,7 @@ int load_rom(char *filename)
}
/* force MENACER configuration */
input.system[0] = SYSTEM_MD_GAMEPAD;
input.system[0] = SYSTEM_GAMEPAD;
input.system[1] = SYSTEM_MENACER;
input.x_offset = 60;
input.y_offset = 30;
@@ -935,7 +968,7 @@ int load_rom(char *filename)
}
/* force JUSTIFIER configuration */
input.system[0] = SYSTEM_MD_GAMEPAD;
input.system[0] = SYSTEM_GAMEPAD;
input.system[1] = SYSTEM_JUSTIFIER;
input.x_offset = (strstr(rominfo.international,"GUN FIGHTERS") != NULL) ? 24 : 0;
input.y_offset = 0;
@@ -960,19 +993,19 @@ void get_region(char *romheader)
if (system_hw == SYSTEM_MCD)
{
/* security code */
switch (romheader[0x20b])
switch ((unsigned char)romheader[0x20b])
{
case 0x7a:
region_code = REGION_USA;
break;
case 0x64:
region_code = REGION_EUROPE;
break;
default:
case 0xa1:
region_code = REGION_JAPAN_NTSC;
break;
default:
region_code = REGION_USA;
break;
}
}
@@ -989,6 +1022,7 @@ void get_region(char *romheader)
/* from Gens */
if (!memcmp(rominfo.country, "eur", 3)) country |= 8;
else if (!memcmp(rominfo.country, "EUR", 3)) country |= 8;
else if (!memcmp(rominfo.country, "Europe", 3)) country |= 8;
else if (!memcmp(rominfo.country, "jap", 3)) country |= 1;
else if (!memcmp(rominfo.country, "JAP", 3)) country |= 1;
else if (!memcmp(rominfo.country, "usa", 3)) country |= 4;
@@ -1024,6 +1058,7 @@ void get_region(char *romheader)
if (((strstr(rominfo.product,"T-45033") != NULL) && (rominfo.checksum == 0x0F81)) || /* Alisia Dragon (Europe) */
(strstr(rominfo.product,"T-69046-50") != NULL) || /* Back to the Future III (Europe) */
(strstr(rominfo.product,"T-120106-00") != NULL) || /* Brian Lara Cricket (Europe) */
(strstr(rominfo.product,"T-97126 -50") != NULL) || /* Williams Arcade's Greatest Hits (Europe) */
(strstr(rominfo.product,"T-70096 -00") != NULL)) /* Muhammad Ali Heavyweight Boxing (Europe) */
{
/* need PAL settings */
@@ -1070,8 +1105,13 @@ void get_region(char *romheader)
/* force PAL/NTSC master clock if requested */
if (config.master_clock == 1) system_clock = MCLOCK_NTSC;
else if (config.master_clock == 2) system_clock = MCLOCK_PAL;
}
/* reinitialize CD unit master clock count per scanline */
if (system_hw == SYSTEM_MCD)
{
scd.cycles_per_line = (uint32) (MCYCLES_PER_LINE * ((float)SCD_CLOCK / (float)system_clock));
}
}
/****************************************************************************
* get_company (Softdev - 2006)
+5 -3
View File
@@ -2,8 +2,8 @@
* Genesis Plus
* ROM Loading Support
*
* Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003 Charles Mac Donald (original code)
* Copyright (C) 2007-2013 Eke-Eke (Genesis Plus GX)
* Copyright (C) 1998-2003 Charles Mac Donald (original code)
* Copyright (C) 2007-2016 Eke-Eke (Genesis Plus GX)
*
* Redistribution and use of this code or any derivative works are permitted
* provided that the following conditions are met:
@@ -40,7 +40,9 @@
#ifndef _LOADROM_H_
#define _LOADROM_H_
#ifndef MAXROMSIZE
#define MAXROMSIZE 10485760
#endif
typedef struct
{
@@ -64,7 +66,7 @@ extern ROMINFO rominfo;
extern uint8 romtype;
/* Function prototypes */
extern int load_bios(void);
extern int load_bios(int system);
extern int load_rom(char *filename);
extern void get_region(char *romheader);
extern char *get_company(void);
+1 -1
View File
@@ -293,7 +293,7 @@ void m68k_run(unsigned int cycles)
REG_IR = m68ki_read_imm_16();
/* Execute instruction */
m68ki_instruction_jump_table[REG_IR]();
m68ki_instruction_jump_table[REG_IR]();
USE_CYCLES(CYC_INSTRUCTION[REG_IR]);
/* Trace m68k_exception, if necessary */
+1 -1
View File
@@ -257,7 +257,7 @@ void s68k_run(unsigned int cycles)
REG_IR = m68ki_read_imm_16();
/* Execute instruction */
m68ki_instruction_jump_table[REG_IR]();
m68ki_instruction_jump_table[REG_IR]();
USE_CYCLES(CYC_INSTRUCTION[REG_IR]);
/* Trace m68k_exception, if necessary */
+71 -9
View File
@@ -3,7 +3,7 @@
* Main 68k bus handlers
*
* Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003 Charles Mac Donald (original code)
* Copyright (C) 2007-2013 Eke-Eke (Genesis Plus GX)
* Copyright (C) 2007-2015 Eke-Eke (Genesis Plus GX)
*
* Redistribution and use of this code or any derivative works are permitted
* provided that the following conditions are met:
@@ -195,7 +195,7 @@ void z80_write_byte(unsigned int address, unsigned int data)
m68k_lockup_w_8(address, data);
return;
}
default:
{
m68k_unused_8_w(address, data);
@@ -220,7 +220,7 @@ void z80_write_word(unsigned int address, unsigned int data)
/*--------------------------------------------------------------------------*/
/* I/O Control */
/* MAIN-CPU polling detection and SUB-CPU synchronization (MEGA CD mode) */
/*--------------------------------------------------------------------------*/
static void m68k_poll_detect(unsigned int reg_mask)
@@ -292,6 +292,10 @@ static void m68k_poll_sync(unsigned int reg_mask)
m68k.poll.detected &= ~reg_mask;
}
/*--------------------------------------------------------------------------*/
/* I/O Control */
/*--------------------------------------------------------------------------*/
unsigned int ctrl_io_read_byte(unsigned int address)
{
switch ((address >> 8) & 0xFF)
@@ -372,7 +376,7 @@ unsigned int ctrl_io_read_byte(unsigned int address)
{
return scd.regs[index >> 1].byte.l;
}
/* register MSB */
return scd.regs[index >> 1].byte.h;
}
@@ -482,7 +486,7 @@ unsigned int ctrl_io_read_word(unsigned int address)
/* H-INT vector (word access only ?) */
if (index == 0x06)
{
return *(uint16 *)(m68k.memory_map[0].base + 0x72);
return *(uint16 *)(m68k.memory_map[scd.cartridge.boot].base + 0x72);
}
/* Stopwatch counter (word read access only ?) */
@@ -646,6 +650,8 @@ void ctrl_io_write_byte(unsigned int address, unsigned int data)
case 0x01: /* SUB-CPU control */
{
unsigned int halted = s68k.stopped;
/* RESET bit */
if (data & 0x01)
{
@@ -674,6 +680,33 @@ void ctrl_io_write_byte(unsigned int address, unsigned int data)
s68k_pulse_halt();
}
/* check if SUB-CPU halt status has changed */
if (s68k.stopped != halted)
{
/* PRG-RAM (128KB bank) is normally mapped to $020000-$03FFFF (resp. $420000-$43FFFF) */
unsigned int base = scd.cartridge.boot + 0x02;
/* PRG-RAM can only be accessed from MAIN 68K & Z80 when SUB-CPU is halted (Dungeon Explorer USA version) */
if ((data & 0x03) != 0x01)
{
m68k.memory_map[base].read8 = m68k.memory_map[base+1].read8 = NULL;
m68k.memory_map[base].read16 = m68k.memory_map[base+1].read16 = NULL;
m68k.memory_map[base].write8 = m68k.memory_map[base+1].write8 = NULL;
m68k.memory_map[base].write16 = m68k.memory_map[base+1].write16 = NULL;
zbank_memory_map[base].read = zbank_memory_map[base+1].read = NULL;
zbank_memory_map[base].write = zbank_memory_map[base+1].write = NULL;
}
else
{
m68k.memory_map[base].read8 = m68k.memory_map[base+1].read8 = m68k_read_bus_8;
m68k.memory_map[base].read16 = m68k.memory_map[base+1].read16 = m68k_read_bus_16;
m68k.memory_map[base].write8 = m68k.memory_map[base+1].write8 = m68k_unused_8_w;
m68k.memory_map[base].write16 = m68k.memory_map[base+1].write16 = m68k_unused_16_w;
zbank_memory_map[base].read = zbank_memory_map[base+1].read = zbank_unused_r;
zbank_memory_map[base].write = zbank_memory_map[base+1].write = zbank_unused_w;
}
}
scd.regs[0x00].byte.l = data;
return;
}
@@ -724,7 +757,7 @@ void ctrl_io_write_byte(unsigned int address, unsigned int data)
return;
}
}
/* update BK0-1 bits */
scd.regs[0x03>>1].byte.l = (scd.regs[0x02>>1].byte.l & ~0xc0) | (data & 0xc0);
return;
@@ -842,6 +875,8 @@ void ctrl_io_write_word(unsigned int address, unsigned int data)
{
case 0x00: /* SUB-CPU interrupt & control */
{
unsigned int halted = s68k.stopped;
/* RESET bit */
if (data & 0x01)
{
@@ -870,6 +905,33 @@ void ctrl_io_write_word(unsigned int address, unsigned int data)
s68k_pulse_halt();
}
/* check if SUB-CPU halt status has changed */
if (s68k.stopped != halted)
{
/* PRG-RAM (128KB bank) is normally mapped to $020000-$03FFFF (resp. $420000-$43FFFF) */
unsigned int base = scd.cartridge.boot + 0x02;
/* PRG-RAM can only be accessed from MAIN 68K & Z80 when SUB-CPU is halted (Dungeon Explorer USA version) */
if ((data & 0x03) != 0x01)
{
m68k.memory_map[base].read8 = m68k.memory_map[base+1].read8 = NULL;
m68k.memory_map[base].read16 = m68k.memory_map[base+1].read16 = NULL;
m68k.memory_map[base].write8 = m68k.memory_map[base+1].write8 = NULL;
m68k.memory_map[base].write16 = m68k.memory_map[base+1].write16 = NULL;
zbank_memory_map[base].read = zbank_memory_map[base+1].read = NULL;
zbank_memory_map[base].write = zbank_memory_map[base+1].write = NULL;
}
else
{
m68k.memory_map[base].read8 = m68k.memory_map[base+1].read8 = m68k_read_bus_8;
m68k.memory_map[base].read16 = m68k.memory_map[base+1].read16 = m68k_read_bus_16;
m68k.memory_map[base].write8 = m68k.memory_map[base+1].write8 = m68k_unused_8_w;
m68k.memory_map[base].write16 = m68k.memory_map[base+1].write16 = m68k_unused_16_w;
zbank_memory_map[base].read = zbank_memory_map[base+1].read = zbank_unused_r;
zbank_memory_map[base].write = zbank_memory_map[base+1].write = zbank_unused_w;
}
}
/* IFL2 bit */
if (data & 0x100)
{
@@ -932,7 +994,7 @@ void ctrl_io_write_word(unsigned int address, unsigned int data)
return;
}
}
/* update WP0-7 & BK0-1 bits */
scd.regs[0x02>>1].w = (scd.regs[0x02>>1].w & ~0xffc0) | (data & 0xffc0);
return;
@@ -940,7 +1002,7 @@ void ctrl_io_write_word(unsigned int address, unsigned int data)
case 0x06: /* H-INT vector (word access only ?) */
{
*(uint16 *)(m68k.memory_map[0].base + 0x72) = data;
*(uint16 *)(m68k.memory_map[scd.cartridge.boot].base + 0x72) = data;
return;
}
@@ -948,7 +1010,7 @@ void ctrl_io_write_word(unsigned int address, unsigned int data)
{
m68k_poll_sync(1<<0x0e);
/* D8-D15 ignored -> only MAIN-CPU flags are updated (Mortal Kombat) */
/* D8-D15 ignored -> only MAIN-CPU flags are updated (Mortal Kombat) */
scd.regs[0x0e>>1].byte.h = data & 0xff;
return;
}
+1 -1
View File
@@ -3,7 +3,7 @@
* Main 68k bus handlers
*
* Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003 Charles Mac Donald (original code)
* Copyright (C) 2007-2013 Eke-Eke (Genesis Plus GX)
* Copyright (C) 2007-2015 Eke-Eke (Genesis Plus GX)
*
* Redistribution and use of this code or any derivative works are permitted
* provided that the following conditions are met:
+105 -33
View File
@@ -4,8 +4,8 @@
*
* Support for SG-1000, Mark-III, Master System, Game Gear & Mega Drive ports access
*
* Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003 Charles Mac Donald (original code)
* Copyright (C) 2007-2011 Eke-Eke (Genesis Plus GX)
* Copyright (C) 1998-2003 Charles Mac Donald (original code)
* Copyright (C) 2007-2016 Eke-Eke (Genesis Plus GX)
*
* Redistribution and use of this code or any derivative works are permitted
* provided that the following conditions are met:
@@ -251,9 +251,10 @@ void z80_md_port_w(unsigned int port, unsigned char data)
{
port &= 0xFF;
/* write FM chip if enabled */
if ((port >= 0xF0) && (config.ym2413 & 1))
{
fm_write(Z80.cycles, port&3, data);
fm_write(Z80.cycles, port, data);
return;
}
@@ -299,7 +300,7 @@ unsigned char z80_md_port_r(unsigned int port)
/* read FM chip if enabled */
if ((port >= 0xF0) && (config.ym2413 & 1))
{
return YM2413Read(port & 3);
return YM2413Read();
}
return z80_unused_port_r(port);
@@ -328,12 +329,16 @@ void z80_gg_port_w(unsigned int port, unsigned char data)
io_gg_write(port, data);
return;
}
}
z80_unused_port_w(port & 0xFF, data);
/* full address range is decoded by Game Gear I/O chip (fixes G-LOC Air Battle) */
else if ((port == 0x3E) || (port == 0x3F))
{
io_z80_write(port & 1, data, Z80.cycles + SMS_CYCLE_OFFSET);
return;
}
io_z80_write(port & 1, data, Z80.cycles + SMS_CYCLE_OFFSET);
z80_unused_port_w(port, data);
return;
}
@@ -408,6 +413,7 @@ unsigned char z80_gg_port_r(unsigned int port)
{
port &= 0xFF;
/* full address range is decoded by Game Gear I/O chip */
if ((port == 0xC0) || (port == 0xC1) || (port == 0xDC) || (port == 0xDD))
{
return io_z80_read(port & 1);
@@ -430,7 +436,14 @@ void z80_ms_port_w(unsigned int port, unsigned char data)
case 0x00:
case 0x01:
{
io_z80_write(port & 1, data, Z80.cycles + SMS_CYCLE_OFFSET);
/* full address range is decoded by 315-5297 I/O chip (fixes Super Tetris / Power Boggle Boggle) */
if ((region_code != REGION_JAPAN_NTSC) || ((port & 0xFE) == 0x3E))
{
io_z80_write(port & 1, data, Z80.cycles + SMS_CYCLE_OFFSET);
return;
}
z80_unused_port_w(port & 0xFF, data);
return;
}
@@ -455,10 +468,43 @@ void z80_ms_port_w(unsigned int port, unsigned char data)
default:
{
if (!(port & 4) && (config.ym2413 & 1))
/* check if YM2413 chip is enabled */
if (config.ym2413 & 1)
{
fm_write(Z80.cycles, port & 3, data);
return;
if (region_code == REGION_JAPAN_NTSC)
{
/* 315-5297 I/O chip decodes full address range */
port &= 0xFF;
/* internal YM2413 chip */
if ((port == 0xF0) || (port == 0xF1))
{
fm_write(Z80.cycles, port, data);
return;
}
/* Audio control register (315-5297 I/O chip specific) */
if (port == 0xF2)
{
/* D1 D0
-----
0 0 : enable only PSG output (power-on default)
0 1 : enable only FM output
1 0 : disable both PSG & FM output
1 1 : enable both PSG and FM output
*/
SN76489_Config(Z80.cycles, config.psg_preamp, config.psgBoostNoise, ((data + 1) & 0x02) ? 0x00 : 0xFF);
fm_write(Z80.cycles, 0x02, data);
io_reg[6] = data;
return;
}
}
else if (!(port & 4))
{
/* external FM board */
fm_write(Z80.cycles, port, data);
return;
}
}
z80_unused_port_w(port & 0xFF, data);
@@ -499,32 +545,54 @@ unsigned char z80_ms_port_r(unsigned int port)
default:
{
/* read FM chip if enabled */
if (!(port & 4) && (config.ym2413 & 1))
if (region_code == REGION_JAPAN_NTSC)
{
/* check if I/O ports are disabled */
if (io_reg[0x0E] & 0x04)
{
return YM2413Read(port & 3);
}
else
{
return YM2413Read(port & 3) & io_z80_read(port & 1);
}
}
/* 315-5297 I/O chip decodes full address range */
port &= 0xFF;
/* check if I/O ports are enabled */
if (!(io_reg[0x0E] & 0x04))
if (port == 0xF2)
{
/* D7-D5 : C-SYNC counter (not emulated)
D4-D2 : Always zero
D1 : Mute control bit 1
D0 : Mute control bit 0
*/
return io_reg[0x06] & 0x03;
}
if ((port == 0xC0) || (port == 0xC1) || (port == 0xDC) || (port == 0xDD))
{
/* read I/O ports if enabled */
if (!(io_reg[0x0E] & 0x04))
{
return io_z80_read(port & 1);
}
}
return z80_unused_port_r(port);
}
else
{
return io_z80_read(port & 1);
}
uint8 data = 0xFF;
return z80_unused_port_r(port & 0xFF);
/* read FM board if enabled */
if (!(port & 4) && (config.ym2413 & 1))
{
data = YM2413Read();
}
/* read I/O ports if enabled */
if (!(io_reg[0x0E] & 0x04))
{
data &= io_z80_read(port & 1);
}
return data;
}
}
}
}
/*--------------------------------------------------------------------------*/
/* Mark III port handlers */
/*--------------------------------------------------------------------------*/
@@ -536,7 +604,7 @@ void z80_m3_port_w(unsigned int port, unsigned char data)
case 0x00:
case 0x01:
{
z80_unused_port_w(port, data);
z80_unused_port_w(port & 0xFF, data);
return;
}
@@ -561,9 +629,10 @@ void z80_m3_port_w(unsigned int port, unsigned char data)
default:
{
/* write FM chip if enabled */
if (!(port & 4) && (config.ym2413 & 1))
{
fm_write(Z80.cycles, port & 3, data);
fm_write(Z80.cycles, port, data);
return;
}
@@ -608,8 +677,8 @@ unsigned char z80_m3_port_r(unsigned int port)
/* read FM chip if enabled */
if (!(port & 4) && (config.ym2413 & 1))
{
/* I/O ports are automatically disabled */
return YM2413Read(port & 3);
/* I/O ports are automatically disabled by hardware */
return YM2413Read();
}
/* read I/O ports */
@@ -631,6 +700,9 @@ void z80_sg_port_w(unsigned int port, unsigned char data)
case 0x41:
{
SN76489_Write(Z80.cycles, data);
/* Z80 !WAIT input is tied to SN76489AN chip READY pin (held low for 32 clocks after each write access) */
Z80.cycles += (32 * 15);
return;
}
@@ -676,7 +748,7 @@ unsigned char z80_sg_port_r(unsigned int port)
default:
{
return z80_unused_port_r(port);
return z80_unused_port_r(port & 0xFF);
}
}
}
+2 -2
View File
@@ -4,8 +4,8 @@
*
* Support for SG-1000, Mark-III, Master System, Game Gear & Mega Drive ports access
*
* Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003 Charles Mac Donald (original code)
* Copyright (C) 2007-2011 Eke-Eke (Genesis Plus GX)
* Copyright (C) 1998-2003 Charles Mac Donald (original code)
* Copyright (C) 2007-2016 Eke-Eke (Genesis Plus GX)
*
* Redistribution and use of this code or any derivative works are permitted
* provided that the following conditions are met:
+5 -10
View File
@@ -94,14 +94,9 @@ static const uint16 PSGVolumeValues[16] =
static SN76489_Context SN76489;
static blip_t* blip[2];
void SN76489_Init(blip_t* left, blip_t* right, int type)
void SN76489_Init(int type)
{
int i;
blip[0] = left;
blip[1] = right;
for (i=0; i<4; i++)
{
@@ -177,7 +172,7 @@ INLINE void UpdateToneAmplitude(int i, int time)
if (delta != 0)
{
SN76489.ChanOut[i][0] += delta;
blip_add_delta_fast(blip[0], time, delta);
blip_add_delta_fast(snd.blips[0][0], time, delta);
}
/* right output */
@@ -185,7 +180,7 @@ INLINE void UpdateToneAmplitude(int i, int time)
if (delta != 0)
{
SN76489.ChanOut[i][1] += delta;
blip_add_delta_fast(blip[1], time, delta);
blip_add_delta_fast(snd.blips[0][1], time, delta);
}
}
@@ -199,7 +194,7 @@ INLINE void UpdateNoiseAmplitude(int time)
if (delta != 0)
{
SN76489.ChanOut[3][0] += delta;
blip_add_delta_fast(blip[0], time, delta);
blip_add_delta_fast(snd.blips[0][0], time, delta);
}
/* right output */
@@ -207,7 +202,7 @@ INLINE void UpdateNoiseAmplitude(int time)
if (delta != 0)
{
SN76489.ChanOut[3][1] += delta;
blip_add_delta_fast(blip[1], time, delta);
blip_add_delta_fast(snd.blips[0][1], time, delta);
}
}
+1 -1
View File
@@ -12,7 +12,7 @@
#define SN_INTEGRATED 1
/* Function prototypes */
extern void SN76489_Init(blip_t* left, blip_t* right, int type);
extern void SN76489_Init(int type);
extern void SN76489_Reset(void);
extern void SN76489_Config(unsigned int clocks, int preAmp, int boostNoise, int stereo);
extern void SN76489_Write(unsigned int clocks, unsigned int data);
+2
View File
@@ -102,6 +102,7 @@ void sound_init( void )
}
/* Initialize PSG chip */
SN76489_Init((system_hw == SYSTEM_SG) ? SN_DISCRETE : SN_INTEGRATED);
SN76489_Config(0, config.psg_preamp, config.psgBoostNoise, 0xff);
}
@@ -110,6 +111,7 @@ void sound_reset(void)
/* reset sound chips */
YM_Reset();
SN76489_Reset();
SN76489_Config(0, config.psg_preamp, config.psgBoostNoise, 0xff);
/* reset FM buffer ouput */
fm_last[0] = fm_last[1] = 0;
+3 -3
View File
@@ -1658,14 +1658,14 @@ void YM2413Write(unsigned int a, unsigned int v)
}
else
{
/* latched bit (Master System specific) */
/* bit 0 enable/disable FM output (Master System / Mark-III FM adapter specific) */
ym2413.status = v & 0x01;
}
}
unsigned int YM2413Read(unsigned int a)
unsigned int YM2413Read(void)
{
/* D0=latched bit, D1-D2 need to be zero (Master System specific) */
/* bit 0 returns latched FM enable status, bits 1-2 return zero (Master System / Mark-III FM adapter specific) */
return 0xF8 | ym2413.status;
}
+1 -1
View File
@@ -16,7 +16,7 @@ extern void YM2413Init(void);
extern void YM2413ResetChip(void);
extern void YM2413Update(int *buffer, int length);
extern void YM2413Write(unsigned int a, unsigned int v);
extern unsigned int YM2413Read(unsigned int a);
extern unsigned int YM2413Read(void);
extern unsigned char *YM2413GetContextPtr(void);
extern unsigned int YM2413GetContextSize(void);
+4 -6
View File
@@ -2,7 +2,7 @@
* Genesis Plus
* Savestate support
*
* Copyright (C) 2007-2012 Eke-Eke (Genesis Plus GX)
* Copyright (C) 2007-2014 Eke-Eke (Genesis Plus GX)
*
* Redistribution and use of this code or any derivative works are permitted
* provided that the following conditions are met:
@@ -51,8 +51,8 @@ int state_load(unsigned char *state)
return 0;
}
/* version check (keep compatibility with previous & current state version) */
if ((version[11] < 0x31) || (version[13] < 0x37) || (version[15] < 0x31))
/* version check */
if ((version[11] < 0x31) || (version[13] < 0x37) || (version[15] < 0x35))
{
return 0;
}
@@ -110,18 +110,16 @@ int state_load(unsigned char *state)
}
/* VDP */
bufferptr += vdp_context_load(&state[bufferptr], version[15]);
bufferptr += vdp_context_load(&state[bufferptr]);
/* SOUND */
bufferptr += sound_context_load(&state[bufferptr]);
if ((system_hw & SYSTEM_PBC) == SYSTEM_MD)
{
SN76489_Init(snd.blips[0][0], snd.blips[0][1], SN_INTEGRATED);
SN76489_Config(0, config.psg_preamp, config.psgBoostNoise, 0xff);
}
else
{
SN76489_Init(snd.blips[0][0], snd.blips[0][1], (system_hw < SYSTEM_MARKIII) ? SN_DISCRETE : SN_INTEGRATED);
SN76489_Config(0, config.psg_preamp, config.psgBoostNoise, io_reg[6]);
}
+1 -1
View File
@@ -2,7 +2,7 @@
* Genesis Plus
* Savestate support
*
* Copyright (C) 2007-2012 Eke-Eke (Genesis Plus GX)
* Copyright (C) 2007-2014 Eke-Eke (Genesis Plus GX)
*
* Redistribution and use of this code or any derivative works are permitted
* provided that the following conditions are met:
+655 -564
View File
File diff suppressed because it is too large Load Diff
+6 -4
View File
@@ -2,10 +2,10 @@
* Genesis Plus
* Virtual System emulation
*
* Support for "Genesis", "Genesis + CD" & "Master System" modes
* Support for 16-bit & 8-bit hardware modes
*
* Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003 Charles Mac Donald (original code)
* Copyright (C) 2007-2013 Eke-Eke (Genesis Plus GX)
* Copyright (C) 1998-2003 Charles Mac Donald (original code)
* Copyright (C) 2007-2016 Eke-Eke (Genesis Plus GX)
*
* Redistribution and use of this code or any derivative works are permitted
* provided that the following conditions are met:
@@ -46,7 +46,8 @@
/* Supported hardware models */
#define SYSTEM_SG 0x10
#define SYSTEM_MARKIII 0x11
#define SYSTEM_SGII 0x11
#define SYSTEM_MARKIII 0x12
#define SYSTEM_SMS 0x20
#define SYSTEM_SMS2 0x21
#define SYSTEM_GG 0x40
@@ -105,6 +106,7 @@ extern uint32 system_clock;
/* Function prototypes */
extern int audio_init(int samplerate, double framerate);
extern void audio_set_rate(int samplerate, double framerate);
extern void audio_reset(void);
extern void audio_shutdown(void);
extern int audio_update(int16 *buffer);
@@ -18,7 +18,7 @@
#ifndef _V_BLOCK_
#define _V_BLOCK_
//extern void _vorbis_block_ripcord(vorbis_block *vb);
//extern void *_vorbis_block_alloc(vorbis_block *vb,long bytes);
extern void _vorbis_block_ripcord(vorbis_block *vb);
extern void *_vorbis_block_alloc(vorbis_block *vb,long bytes);
#endif
+9 -11
View File
@@ -23,7 +23,7 @@
#include "asm_arm.h"
#include <stdlib.h> /* for abs() */
#ifdef GEKKO
#if defined(GEKKO) && !defined(__LIBRETRO__)
#include <gctypes.h>
#endif
@@ -37,16 +37,6 @@
#include <sys/types.h>
#endif
#if BYTE_ORDER==LITTLE_ENDIAN
union magic {
struct {
ogg_int32_t lo;
ogg_int32_t hi;
} halves;
ogg_int64_t whole;
};
#endif
#if BYTE_ORDER==BIG_ENDIAN
union magic {
struct {
@@ -55,6 +45,14 @@ union magic {
} halves;
ogg_int64_t whole;
};
#elif BYTE_ORDER==LITTLE_ENDIAN
union magic {
struct {
ogg_int32_t lo;
ogg_int32_t hi;
} halves;
ogg_int64_t whole;
};
#endif
STIN ogg_int32_t MULT32(ogg_int32_t x, ogg_int32_t y) {
+2
View File
@@ -41,9 +41,11 @@
# define rint(x) (floor((x)+0.5f))
# define NO_FLOAT_MATH_LIB
# define FAST_HYPOT(a, b) sqrt((a)*(a) + (b)*(b))
#ifndef _XBOX360
# define LITTLE_ENDIAN 1
# define BYTE_ORDER LITTLE_ENDIAN
#endif
#endif
#ifdef HAVE_ALLOCA_H
# include <alloca.h>
+4
View File
@@ -32,7 +32,11 @@
#define _ogg_realloc realloc
#define _ogg_free free
#if defined(_WIN32) && defined(__LIBRETRO__)
#include <stdint.h>
#else
#include <inttypes.h>
#endif
typedef int64_t ogg_int64_t;
typedef int32_t ogg_int32_t;
+33 -34
View File
@@ -34,7 +34,7 @@ int _ilog(unsigned int v){
}
/* 32 bit float (not IEEE; nonnormalized mantissa +
biased exponent) : neeeeeee eeemmmmm mmmmmmmm mmmmmmmm
biased exponent) : neeeeeee eeemmmmm mmmmmmmm mmmmmmmm
Why not IEEE? It's just not that important here. */
#define VQ_FEXP 10
@@ -77,12 +77,12 @@ ogg_uint32_t *_make_words(long *l,long n,long sparsecount){
long length=l[i];
if(length>0){
ogg_uint32_t entry=marker[length];
/* when we claim a node for an entry, we also claim the nodes
below it (pruning off the imagined tree that may have dangled
from it) as well as blocking the use of any nodes directly
above for leaves */
/* update ourself */
if(length<32 && (entry>>length)){
/* error condition; the lengths must specify an overpopulated tree */
@@ -90,12 +90,12 @@ ogg_uint32_t *_make_words(long *l,long n,long sparsecount){
return(NULL);
}
r[count++]=entry;
/* Look to see if the next shorter marker points to the node
above. if so, update it and repeat. */
{
for(j=length;j>0;j--){
if(marker[j]&1){
/* have to jump branches */
if(j==1)
@@ -108,7 +108,7 @@ ogg_uint32_t *_make_words(long *l,long n,long sparsecount){
marker[j]++;
}
}
/* prune the tree; the implicit invariant says all the longer
markers were dangling from our just-taken node. Dangle them
from our *new* node. */
@@ -121,7 +121,7 @@ ogg_uint32_t *_make_words(long *l,long n,long sparsecount){
}else
if(sparsecount==0)count++;
}
/* bitreverse the words because our bitwise packer/unpacker is LSb
endian */
for(i=0,count=0;i<n;i++){
@@ -210,18 +210,18 @@ ogg_int32_t *_book_unquantize(const static_codebook *b,int n,int *sparsemap,
int indexdiv=1;
for(k=0;k<b->dim;k++){
int index= (j/indexdiv)%quantvals;
int point=0;
ogg_int32_t point=0;
int val=VFLOAT_MULTI(delta,delpoint,
abs(b->quantlist[index]),&point);
val=VFLOAT_ADD(mindel,minpoint,val,point,&point);
val=VFLOAT_ADD(last,lastpoint,val,point,&point);
if(b->q_sequencep){
last=val;
last=val;
lastpoint=point;
}
if(sparsemap){
r[sparsemap[count]*b->dim+k]=val;
rp[sparsemap[count]*b->dim+k]=point;
@@ -244,15 +244,15 @@ ogg_int32_t *_book_unquantize(const static_codebook *b,int n,int *sparsemap,
int lastpoint=0;
for(k=0;k<b->dim;k++){
int point=0;
ogg_int32_t point=0;
int val=VFLOAT_MULTI(delta,delpoint,
abs(b->quantlist[j*b->dim+k]),&point);
val=VFLOAT_ADD(mindel,minpoint,val,point,&point);
val=VFLOAT_ADD(last,lastpoint,val,point,&point);
if(b->q_sequencep){
last=val;
last=val;
lastpoint=point;
}
@@ -274,7 +274,7 @@ ogg_int32_t *_book_unquantize(const static_codebook *b,int n,int *sparsemap,
for(j=0;j<n*b->dim;j++)
if(rp[j]<*maxpoint)
r[j]>>=*maxpoint-rp[j];
_ogg_free(rp);
return(r);
}
@@ -324,7 +324,7 @@ int vorbis_book_init_decode(codebook *c,const static_codebook *s){
int i,j,n=0,tabn;
int *sortindex;
memset(c,0,sizeof(*c));
/* count actually used entries */
for(i=0;i<s->entries;i++)
if(s->lengthlist[i]>0)
@@ -335,20 +335,20 @@ int vorbis_book_init_decode(codebook *c,const static_codebook *s){
c->dim=s->dim;
if(n>0){
/* two different remappings go on here.
/* two different remappings go on here.
First, we collapse the likely sparse codebook down only to
actually represented values/words. This collapsing needs to be
indexed as map-valueless books are used to encode original entry
positions as integers.
Second, we reorder all vectors, including the entry index above,
by sorted bitreversed codeword to allow treeless decode. */
/* perform sort */
ogg_uint32_t *codes=_make_words(s->lengthlist,s->entries,c->used_entries);
ogg_uint32_t **codep=(ogg_uint32_t **)alloca(sizeof(*codep)*n);
if(codes==NULL)goto err_out;
for(i=0;i<n;i++){
@@ -369,29 +369,29 @@ int vorbis_book_init_decode(codebook *c,const static_codebook *s){
for(i=0;i<n;i++)
c->codelist[sortindex[i]]=codes[i];
_ogg_free(codes);
c->valuelist=_book_unquantize(s,n,sortindex,&c->binarypoint);
c->dec_index=(int *)_ogg_malloc(n*sizeof(*c->dec_index));
for(n=0,i=0;i<s->entries;i++)
if(s->lengthlist[i]>0)
c->dec_index[sortindex[n++]]=i;
c->dec_codelengths=(char *)_ogg_malloc(n*sizeof(*c->dec_codelengths));
for(n=0,i=0;i<s->entries;i++)
if(s->lengthlist[i]>0)
c->dec_codelengths[sortindex[n++]]=s->lengthlist[i];
c->dec_firsttablen=_ilog(c->used_entries)-4; /* this is magic */
if(c->dec_firsttablen<5)c->dec_firsttablen=5;
if(c->dec_firsttablen>8)c->dec_firsttablen=8;
tabn=1<<c->dec_firsttablen;
c->dec_firsttable=(ogg_uint32_t *)_ogg_calloc(tabn,sizeof(*c->dec_firsttable));
c->dec_maxlength=0;
for(i=0;i<n;i++){
if(c->dec_maxlength<c->dec_codelengths[i])
c->dec_maxlength=c->dec_codelengths[i];
@@ -401,26 +401,26 @@ int vorbis_book_init_decode(codebook *c,const static_codebook *s){
c->dec_firsttable[orig|(j<<c->dec_codelengths[i])]=i+1;
}
}
/* now fill in 'unused' entries in the firsttable with hi/lo search
hints for the non-direct-hits */
{
ogg_uint32_t mask=0xfffffffeUL<<(31-c->dec_firsttablen);
long lo=0,hi=0;
for(i=0;i<tabn;i++){
ogg_uint32_t word=i<<(32-c->dec_firsttablen);
if(c->dec_firsttable[bitreverse(word)]==0){
while((lo+1)<n && c->codelist[lo+1]<=word)lo++;
while( hi<n && word>=(c->codelist[hi]&mask))hi++;
/* we only actually have 15 bits per hint to play with here.
In order to overflow gracefully (nothing breaks, efficiency
just drops), encode as the difference from the extremes. */
{
unsigned long loval=lo;
unsigned long hival=n-hi;
if(loval>0x7fff)loval=0x7fff;
if(hival>0x7fff)hival=0x7fff;
c->dec_firsttable[bitreverse(word)]=
@@ -436,4 +436,3 @@ int vorbis_book_init_decode(codebook *c,const static_codebook *s){
vorbis_book_clear(c);
return(-1);
}
File diff suppressed because it is too large Load Diff
+5 -4
View File
@@ -2,10 +2,10 @@
* Genesis Plus
* Video Display Processor (68k & Z80 CPU interface)
*
* Support for SG-1000, Master System (315-5124 & 315-5246), Game Gear & Mega Drive VDP
* Support for SG-1000 (TMS99xx & 315-5066), Master System (315-5124 & 315-5246), Game Gear & Mega Drive VDP
*
* Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003 Charles Mac Donald (original code)
* Copyright (C) 2007-2013 Eke-Eke (Genesis Plus GX)
* Copyright (C) 1998-2003 Charles Mac Donald (original code)
* Copyright (C) 2007-2016 Eke-Eke (Genesis Plus GX)
*
* Redistribution and use of this code or any derivative works are permitted
* provided that the following conditions are met:
@@ -70,6 +70,7 @@ extern uint8 odd_frame;
extern uint8 im2_flag;
extern uint8 interlaced;
extern uint8 vdp_pal;
extern uint8 h_counter;
extern uint16 v_counter;
extern uint16 vc_max;
extern uint16 vscroll;
@@ -90,7 +91,7 @@ extern unsigned int (*vdp_z80_data_r)(void);
extern void vdp_init(void);
extern void vdp_reset(void);
extern int vdp_context_save(uint8 *state);
extern int vdp_context_load(uint8 *state, uint8 version);
extern int vdp_context_load(uint8 *state);
extern void vdp_dma_update(unsigned int cycles);
extern void vdp_68k_ctrl_w(unsigned int data);
extern void vdp_z80_ctrl_w(unsigned int data);
+121 -103
View File
@@ -1,11 +1,11 @@
/***************************************************************************************
* Genesis Plus
* Video Display Processor (Modes 0, 1, 2, 3, 4 & 5 rendering)
* Video Display Processor (pixel output rendering)
*
* Support for SG-1000, Master System (315-5124 & 315-5246), Game Gear & Mega Drive VDP
* Support for all TMS99xx modes, Mode 4 & Mode 5 rendering
*
* Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003 Charles Mac Donald (original code)
* Copyright (C) 2007-2013 Eke-Eke (Genesis Plus GX)
* Copyright (C) 2007-2016 Eke-Eke (Genesis Plus GX)
*
* Redistribution and use of this code or any derivative works are permitted
* provided that the following conditions are met:
@@ -143,7 +143,7 @@ INLINE void WRITE_LONG(void *address, uint32 data)
atex = atex_table[(ATTR >> 29) & 7]; \
src = (uint32 *)&bg_pattern_cache[((ATTR & 0x03FF0000) >> 9 | (ATTR & 0x18000000) >> 10 | (LINE)) ^ ((ATTR & 0x10000000) >> 22)];
/*
/*
One column = 2 tiles
Two pattern attributes are written in VRAM as two consecutives 16-bit words:
@@ -264,7 +264,7 @@ INLINE void WRITE_LONG(void *address, uint32 data)
/* This might be faster or slower than original method, depending on */
/* architecture (x86, PowerPC), cache size, memory access speed, etc... */
#ifdef LSB_FIRST
#ifdef LSB_FIRST
#define DRAW_BG_TILE(SRC_A, SRC_B) \
*lb++ = table[((SRC_B << 8) & 0xff00) | (SRC_A & 0xff)]; \
*lb++ = table[(SRC_B & 0xff00) | ((SRC_A >> 8) & 0xff)]; \
@@ -279,7 +279,7 @@ INLINE void WRITE_LONG(void *address, uint32 data)
#endif
#ifdef ALIGN_LONG
#ifdef LSB_FIRST
#ifdef LSB_FIRST
#define DRAW_BG_COLUMN(ATTR, LINE, SRC_A, SRC_B) \
GET_LSB_TILE(ATTR, LINE) \
SRC_A = READ_LONG((uint32 *)lb); \
@@ -325,7 +325,7 @@ INLINE void WRITE_LONG(void *address, uint32 data)
DRAW_BG_TILE(SRC_A, SRC_B) \
SRC_A = READ_LONG((uint32 *)lb); \
SRC_B = (src[1] | atex); \
DRAW_BG_TILE(SRC_A, SRC_B)
DRAW_BG_TILE(SRC_A, SRC_B)
#define DRAW_BG_COLUMN_IM2(ATTR, LINE, SRC_A, SRC_B) \
GET_MSB_TILE_IM2(ATTR, LINE) \
SRC_A = READ_LONG((uint32 *)lb); \
@@ -343,7 +343,7 @@ INLINE void WRITE_LONG(void *address, uint32 data)
DRAW_BG_TILE(SRC_A, SRC_B)
#endif
#else /* NOT ALIGNED */
#ifdef LSB_FIRST
#ifdef LSB_FIRST
#define DRAW_BG_COLUMN(ATTR, LINE, SRC_A, SRC_B) \
GET_LSB_TILE(ATTR, LINE) \
SRC_A = *(uint32 *)(lb); \
@@ -470,15 +470,18 @@ INLINE void WRITE_LONG(void *address, uint32 data)
/* 5:5:5 RGB */
#elif defined(USE_15BPP_RENDERING)
#define MAKE_PIXEL(r,g,b) ((r) << 11 | ((r) >> 3) << 10 | (g) << 6 | ((g) >> 3) << 5 | (b) << 1 | (b) >> 3)
#if defined(USE_ABGR)
#define MAKE_PIXEL(r,g,b) ((1 << 15) | (b) << 11 | ((b) >> 3) << 10 | (g) << 6 | ((g) >> 3) << 5 | (r) << 1 | (r) >> 3)
#else
#define MAKE_PIXEL(r,g,b) ((1 << 15) | (r) << 11 | ((r) >> 3) << 10 | (g) << 6 | ((g) >> 3) << 5 | (b) << 1 | (b) >> 3)
#endif
/* 5:6:5 RGB */
#elif defined(USE_16BPP_RENDERING)
#define MAKE_PIXEL(r,g,b) ((r) << 12 | ((r) >> 3) << 11 | (g) << 7 | ((g) >> 2) << 5 | (b) << 1 | (b) >> 3)
/* 8:8:8 RGB */
#elif defined(USE_32BPP_RENDERING)
#define MAKE_PIXEL(r,g,b) ((r) << 20 | (r) << 16 | (g) << 12 | (g) << 8 | (b) << 4 | (b))
#define MAKE_PIXEL(r,g,b) ((0xff << 24) | (r) << 20 | (r) << 16 | (g) << 12 | (g) << 8 | (b) << 4 | (b))
#endif
/* Window & Plane A clipping */
@@ -524,10 +527,10 @@ static const uint8 tms_palette[16] =
#elif defined(USE_15BPP_RENDERING)
static const uint16 tms_palette[16] =
{
0x0000, 0x0000, 0x1308, 0x2F6F,
0x295D, 0x3DDF, 0x6949, 0x23BE,
0x7D4A, 0x7DEF, 0x6B0A, 0x7330,
0x12A7, 0x6177, 0x6739, 0x7FFF
0x8000, 0x8000, 0x9308, 0xAF6F,
0xA95D, 0xBDDF, 0xE949, 0xA3BE,
0xFD4A, 0xFDEF, 0xEB0A, 0xF330,
0x92A7, 0xE177, 0xE739, 0xFFFF
};
#elif defined(USE_16BPP_RENDERING)
@@ -542,10 +545,10 @@ static const uint16 tms_palette[16] =
#elif defined(USE_32BPP_RENDERING)
static const uint32 tms_palette[16] =
{
0x000000, 0x000000, 0x21C842, 0x5EDC78,
0x5455ED, 0x7D76FC, 0xD4524D, 0x42EBF5,
0xFC5554, 0xFF7978, 0xD4C154, 0xE6CE80,
0x21B03B, 0xC95BB4, 0xCCCCCC, 0xFFFFFF
0xFF000000, 0xFF000000, 0xFF21C842, 0xFF5EDC78,
0xFF5455ED, 0xFF7D76FC, 0xFFD4524D, 0xFF42EBF5,
0xFFFC5554, 0xFFFF7978, 0xFFD4C154, 0xFFE6CE80,
0xFF21B03B, 0xFFC95BB4, 0xFFCCCCCC, 0xFFFFFFFF
};
#endif
@@ -573,7 +576,7 @@ static uint8 linebuf[2][0x200];
static uint8 spr_ovr;
/* Sprite parsing lists */
typedef struct
typedef struct
{
uint16 ypos;
uint16 xpos;
@@ -620,7 +623,7 @@ static void make_name_lut(void)
if ((vrow > height) || vcol > width)
{
/* Invalid settings (unused) */
name_lut[i] = -1;
name_lut[i] = -1;
}
else
{
@@ -691,8 +694,8 @@ static uint32 make_lut_bg(uint32 bx, uint32 ax)
int bf = (bx & 0x7F);
int bp = (bx & 0x40);
int b = (bx & 0x0F);
int af = (ax & 0x7F);
int af = (ax & 0x7F);
int ap = (ax & 0x40);
int a = (ax & 0x0F);
@@ -712,8 +715,8 @@ static uint32 make_lut_bg_ste(uint32 bx, uint32 ax)
int bf = (bx & 0x7F);
int bp = (bx & 0x40);
int b = (bx & 0x0F);
int af = (ax & 0x7F);
int af = (ax & 0x7F);
int ap = (ax & 0x40);
int a = (ax & 0x0F);
@@ -761,7 +764,7 @@ static uint32 make_lut_bgobj(uint32 bx, uint32 sx)
int bs = (bx & 0x80);
int bp = (bx & 0x40);
int b = (bx & 0x0F);
int sf = (sx & 0x3F);
int sp = (sx & 0x40);
int s = (sx & 0x0F);
@@ -897,7 +900,7 @@ static uint32 make_lut_bgobj_ste(uint32 bx, uint32 sx)
}
}
else
{
{
c = (bf | bi);
}
}
@@ -914,7 +917,7 @@ static uint32 make_lut_bgobj_ste(uint32 bx, uint32 sx)
static uint32 make_lut_bgobj_m4(uint32 bx, uint32 sx)
{
int c;
int bf = (bx & 0x3F);
int bs = (bx & 0x80);
int bp = (bx & 0x20);
@@ -971,7 +974,7 @@ static void palette_init(void)
/* GG mode : xxxx (0-15) */
/* */
/* with x = original CRAM value (2, 3 or 4-bit) */
/* (*) 2-bit CRAM value is expanded to 4-bit */
/* (*) 2-bit CRAM value is expanded to 4-bit */
/************************************************/
/* Initialize Mode 5 pixel color look-up tables */
@@ -1023,6 +1026,7 @@ void color_update_m4(int index, unsigned int data)
}
case SYSTEM_SG:
case SYSTEM_SGII:
{
/* Fixed TMS99xx palette */
if (index & 0x0F)
@@ -1142,8 +1146,7 @@ void color_update_m5(int index, unsigned int data)
/* Graphics I */
void render_bg_m0(int line)
{
uint8 color, pattern;
uint16 name;
uint8 color, name, pattern;
uint8 *lb = &linebuf[0][0x20];
uint8 *nt = &vram[((reg[2] << 10) & 0x3C00) + ((line & 0xF8) << 2)];
@@ -1190,7 +1193,7 @@ void render_bg_m1(int line)
do
{
pattern = pg[*nt++];
pattern = pg[*nt++ << 3];
*lb++ = 0x10 | ((color >> (((pattern >> 7) & 1) << 2)) & 0x0F);
*lb++ = 0x10 | ((color >> (((pattern >> 6) & 1) << 2)) & 0x0F);
@@ -1298,8 +1301,6 @@ void render_bg_m2(int line)
void render_bg_m3(int line)
{
uint8 color;
uint16 name;
uint8 *lb = &linebuf[0][0x20];
uint8 *nt = &vram[((reg[2] << 10) & 0x3C00) + ((line & 0xF8) << 2)];
uint8 *pg = &vram[((reg[4] << 11) & 0x3800) + ((line >> 2) & 7)];
@@ -1309,9 +1310,8 @@ void render_bg_m3(int line)
do
{
name = *nt++;
color = pg[name << 3];
color = pg[*nt++ << 3];
*lb++ = 0x10 | ((color >> 4) & 0x0F);
*lb++ = 0x10 | ((color >> 4) & 0x0F);
*lb++ = 0x10 | ((color >> 4) & 0x0F);
@@ -1328,7 +1328,6 @@ void render_bg_m3(int line)
void render_bg_m3x(int line)
{
uint8 color;
uint16 name;
uint8 *pg;
uint8 *lb = &linebuf[0][0x20];
@@ -1349,9 +1348,8 @@ void render_bg_m3x(int line)
do
{
name = *nt++;
color = pg[name << 3];
color = pg[*nt++ << 3];
*lb++ = 0x10 | ((color >> 4) & 0x0F);
*lb++ = 0x10 | ((color >> 4) & 0x0F);
*lb++ = 0x10 | ((color >> 4) & 0x0F);
@@ -1399,10 +1397,10 @@ void render_bg_m4(int line)
int column;
uint16 *nt;
uint32 attr, atex, *src;
/* 32 x 8 pixels */
int width = 32;
/* Horizontal scrolling */
int index = ((reg[0] & 0x40) && (line < 0x10)) ? 0x100 : reg[0x08];
int shift = index & 7;
@@ -1427,7 +1425,7 @@ void render_bg_m4(int line)
{
/* Vertical scroll mask */
v_line = v_line % 256;
/* Pattern name Table */
nt = (uint16 *)&vram[(0x3700 & nt_mask) + ((v_line >> 3) << 6)];
}
@@ -1486,7 +1484,7 @@ void render_bg_m4(int line)
src = (uint32 *)&bg_pattern_cache[((attr & 0x7FF) << 6) | (v_line)];
/* Copy left & right half, adding the attribute bits in */
#ifdef ALIGN_DWORD
#ifdef ALIGN_LONG
WRITE_LONG(dst, src[0] | atex);
dst++;
WRITE_LONG(dst, src[1] | atex);
@@ -1732,7 +1730,7 @@ void render_bg_m5_vs(int line)
atbuf = nt[index & pf_col_mask];
DRAW_COLUMN(atbuf, v_line)
}
if (w == (line >= a))
{
/* Window takes up entire line */
@@ -1760,7 +1758,7 @@ void render_bg_m5_vs(int line)
#else
shift = (xscroll >> 16) & 0x0F;
index = pf_col_mask + start + 1 - ((xscroll >> 20) & pf_col_mask);
#endif
#endif
if(shift)
{
@@ -2320,7 +2318,7 @@ void render_bg_m5(int line)
/* Plane B name table */
nt = (uint32 *)&vram[ntbb + (((v_line >> 3) << pf_shift) & 0x1FC0)];
/* Pattern row index */
v_line = (v_line & 7) << 3;
@@ -2335,7 +2333,7 @@ void render_bg_m5(int line)
atbuf = nt[(index-1) & pf_col_mask];
DRAW_BG_COLUMN(atbuf, v_line, xscroll, yscroll)
}
for(column = 0; column < width; column++, index++)
{
atbuf = nt[index & pf_col_mask];
@@ -2560,7 +2558,7 @@ void render_bg_m5_im2(int line)
/* Window vertical range (cell 0-31) */
int a = (reg[18] & 0x1F) << 3;
/* Window position (0=top, 1=bottom) */
int w = (reg[18] >> 7) & 1;
@@ -2719,7 +2717,7 @@ void render_bg_m5_im2_vs(int line)
/* Window vertical range (cell 0-31) */
uint32 a = (reg[18] & 0x1F) << 3;
/* Window position (0=top, 1=bottom) */
uint32 w = (reg[18] >> 7) & 1;
@@ -3042,7 +3040,7 @@ void render_obj_m4(int line)
/* Default sprite width */
int width = 8;
/* Sprite Generator address mask (LSB is masked for 8x16 sprites) */
uint16 sg_mask = (~0x1C0 ^ (reg[6] << 6)) & (~((reg[1] & 0x02) >> 1));
@@ -3104,7 +3102,7 @@ void render_obj_m4(int line)
{
/* Draw sprite pattern (zoomed sprites are rendered at half speed) */
DRAW_SPRITE_TILE_ACCURATE_2X(end,0,lut[5])
/* 315-5124 VDP specific */
if (system_hw < SYSTEM_SMS2)
{
@@ -3702,7 +3700,7 @@ void parse_satb_m4(int line)
/* Y position */
int ypos;
/* Sprite list for next line */
object_info_t *object_info = obj_info[(line + 1) & 1];
@@ -3727,14 +3725,14 @@ void parse_satb_m4(int line)
/* Sprite Y position */
ypos = st[i];
/* Check end of sprite list marker */
if (ypos == (bitmap.viewport.h + 16))
/* Check end of sprite list marker (no effect in extended modes) */
if ((ypos == 208) && (bitmap.viewport.h == 192))
{
break;
}
/* Wrap Y coordinate for sprites > 256-16 */
if (ypos >= 240)
/* Wrap Y coordinate (NB: this is likely not 100% accurate and needs to be verified on real hardware) */
if (ypos > (bitmap.viewport.h + 16))
{
ypos -= 256;
}
@@ -3817,44 +3815,50 @@ void parse_satb_m5(int line)
do
{
/* Read Y position & size from internal SAT */
/* Read Y position from internal SAT cache */
ypos = (q[link] >> im2_flag) & 0x1FF;
size = q[link + 1] >> 8;
/* Sprite height */
height = 8 + ((size & 3) << 3);
/* Y range */
ypos = line - ypos;
/* Sprite is visble on this line ? */
if ((ypos >= 0) && (ypos < height))
/* Check if sprite Y position has been reached */
if (line >= ypos)
{
/* Sprite overflow */
if (count == max)
/* Read sprite size from internal SAT cache */
size = q[link + 1] >> 8;
/* Sprite height */
height = 8 + ((size & 3) << 3);
/* Y range */
ypos = line - ypos;
/* Check if sprite is visible on current line */
if (ypos < height)
{
status |= 0x40;
break;
/* Sprite overflow */
if (count == max)
{
status |= 0x40;
break;
}
/* Update sprite list (only name, attribute & xpos are parsed from VRAM) */
object_info->attr = p[link + 2];
object_info->xpos = p[link + 3] & 0x1ff;
object_info->ypos = ypos;
object_info->size = size & 0x0f;
/* Increment Sprite count */
++count;
/* Next sprite entry */
object_info++;
}
/* Update sprite list (only name, attribute & xpos are parsed from VRAM) */
object_info->attr = p[link + 2];
object_info->xpos = p[link + 3] & 0x1ff;
object_info->ypos = ypos;
object_info->size = size & 0x0f;
/* Increment Sprite count */
++count;
/* Next sprite entry */
object_info++;
}
/* Read link data from internal SAT */
/* Read link data from internal SAT cache */
link = (q[link + 1] & 0x7F) << 2;
/* Last sprite */
if (link == 0) break;
/* Stop parsing if link data points to first entry (#0) or after the last entry (#64 in H32 mode, #80 in H40 mode) */
if ((link == 0) || (link >= bitmap.viewport.w)) break;
}
while (--total);
@@ -3880,14 +3884,14 @@ void update_bg_pattern_cache_m4(int index)
/* Get modified pattern name index */
name = bg_name_list[i];
/* Pattern cache base address */
dst = &bg_pattern_cache[name << 6];
/* Check modified lines */
for(y = 0; y < 8; y++)
{
if(bg_name_dirty[name] & (1 << y))
{
/* Pattern cache base address */
dst = &bg_pattern_cache[name << 6];
/* Byteplane data */
bp01 = *(uint16 *)&vram[(name << 5) | (y << 2) | (0)];
bp23 = *(uint16 *)&vram[(name << 5) | (y << 2) | (2)];
@@ -3934,14 +3938,14 @@ void update_bg_pattern_cache_m5(int index)
/* Get modified pattern name index */
name = bg_name_list[i];
/* Pattern cache base address */
dst = &bg_pattern_cache[name << 6];
/* Check modified lines */
for(y = 0; y < 8; y ++)
{
if(bg_name_dirty[name] & (1 << y))
{
/* Pattern cache base address */
dst = &bg_pattern_cache[name << 6];
/* Byteplane data (one pattern = 4 bytes) */
/* LIT_ENDIAN: byte0 (lsb) p2p3 p0p1 p6p7 p4p5 (msb) byte3 */
/* BIG_ENDIAN: byte0 (msb) p0p1 p2p3 p4p5 p6p7 (lsb) byte3 */
@@ -4109,7 +4113,7 @@ void render_line(int line)
/* Left-most column blanking */
if (reg[0] & 0x20)
{
if (system_hw > SYSTEM_SG)
if (system_hw > SYSTEM_SGII)
{
memset(&linebuf[0][0x20], 0x40, 8);
}
@@ -4122,8 +4126,11 @@ void render_line(int line)
}
/* Horizontal borders */
memset(&linebuf[0][0x20 - bitmap.viewport.x], 0x40, bitmap.viewport.x);
memset(&linebuf[0][0x20 + bitmap.viewport.w], 0x40, bitmap.viewport.x);
if (bitmap.viewport.x > 0)
{
memset(&linebuf[0][0x20 - bitmap.viewport.x], 0x40, bitmap.viewport.x);
memset(&linebuf[0][0x20 + bitmap.viewport.w], 0x40, bitmap.viewport.x);
}
}
else
{
@@ -4172,8 +4179,8 @@ void remap_line(int line)
line = (line * 2) + odd_frame;
}
/* NTSC Filter (only supported for 15 or 16-bit pixels rendering) */
#if defined(USE_15BPP_RENDERING) || defined(USE_16BPP_RENDERING)
/* NTSC Filter (only supported for 15 or 16-bit pixels rendering) */
if (config.ntsc)
{
if (reg[12] & 0x01)
@@ -4188,16 +4195,27 @@ void remap_line(int line)
else
#endif
{
/* Convert VDP pixel data to output pixel format */
#ifdef CUSTOM_BLITTER
CUSTOM_BLITTER(line, width, pixel, src)
#else
PIXEL_OUT_T *dst =((PIXEL_OUT_T *)&bitmap.data[(line * bitmap.pitch)]);
do
/* Convert VDP pixel data to output pixel format */
PIXEL_OUT_T *dst = ((PIXEL_OUT_T *)&bitmap.data[(line * bitmap.pitch)]);
if (config.lcd)
{
*dst++ = pixel[*src++];
do
{
RENDER_PIXEL_LCD(src,dst,pixel,config.lcd);
}
while (--width);
}
while (--width);
#endif
else
{
do
{
*dst++ = pixel[*src++];
}
while (--width);
}
#endif
}
}
+60 -5
View File
@@ -1,11 +1,11 @@
/***************************************************************************************
* Genesis Plus
* Video Display Processor (Modes 0, 1, 2, 3, 4 & 5 rendering)
* Video Display Processor (pixel output rendering)
*
* Support for SG-1000, Master System (315-5124 & 315-5246), Game Gear & Mega Drive VDP
* Support for all TMS99xx modes, Mode 4 & Mode 5 rendering
*
* Copyright (C) 1998-2007 Charles Mac Donald (original code)
* Copyright (C) 2007-2013 Eke-Eke (Genesis Plus GX)
* Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003 Charles Mac Donald (original code)
* Copyright (C) 2007-2016 Eke-Eke (Genesis Plus GX)
*
* Redistribution and use of this code or any derivative works are permitted
* provided that the following conditions are met:
@@ -42,6 +42,62 @@
#ifndef _RENDER_H_
#define _RENDER_H_
/* 3:3:2 RGB */
#if defined(USE_8BPP_RENDERING)
#define PIXEL(r,g,b) (((r) << 5) | ((g) << 2) | (b))
#define GET_R(pixel) (((pixel) & 0xe0) >> 5)
#define GET_G(pixel) (((pixel) & 0x1c) >> 2)
#define GET_B(pixel) (((pixel) & 0x03) >> 0)
/* 5:5:5 RGB */
#elif defined(USE_15BPP_RENDERING)
#if defined(USE_ABGR)
#define PIXEL(r,g,b) ((1 << 15) | ((b) << 10) | ((g) << 5) | (r))
#define GET_B(pixel) (((pixel) & 0x7c00) >> 10)
#define GET_G(pixel) (((pixel) & 0x03e0) >> 5)
#define GET_R(pixel) (((pixel) & 0x001f) >> 0)
#else
#define PIXEL(r,g,b) ((1 << 15) | ((r) << 10) | ((g) << 5) | (b))
#define GET_R(pixel) (((pixel) & 0x7c00) >> 10)
#define GET_G(pixel) (((pixel) & 0x03e0) >> 5)
#define GET_B(pixel) (((pixel) & 0x001f) >> 0)
#endif
/* 5:6:5 RGB */
#elif defined(USE_16BPP_RENDERING)
#define PIXEL(r,g,b) (((r) << 11) | ((g) << 5) | (b))
#define GET_R(pixel) (((pixel) & 0xf800) >> 11)
#define GET_G(pixel) (((pixel) & 0x07e0) >> 5)
#define GET_B(pixel) (((pixel) & 0x001f) >> 0)
/* 8:8:8 RGB */
#elif defined(USE_32BPP_RENDERING)
#define PIXEL(r,g,b) ((0xff << 24) | ((r) << 16) | ((g) << 8) | (b))
#define GET_R(pixel) (((pixel) & 0xff0000) >> 16)
#define GET_G(pixel) (((pixel) & 0x00ff00) >> 8)
#define GET_B(pixel) (((pixel) & 0x0000ff) >> 0)
#endif
/* LCD image persistence (ghosting) filter */
/* Simulates (roughly) the slow decay response time of passive-matrix LCD */
/* Rate value is formatted as 0.8 fixed-point integer (between 0.0 and 0.99609375), a higher value meaning a slower decay */
/* Required for proper display of some effects in a few Game Gear games (James Pond 3, Power Drift, Super Monaco GP II,...) */
#define RENDER_PIXEL_LCD(in,out,table,rate) \
{ \
PIXEL_OUT_T pixel_out = table[*in++]; \
PIXEL_OUT_T pixel_old = *out; \
uint8 r = GET_R(pixel_out); \
uint8 g = GET_G(pixel_out); \
uint8 b = GET_B(pixel_out); \
int r_decay = GET_R(pixel_old) - r; \
int g_decay = GET_G(pixel_old) - g; \
int b_decay = GET_B(pixel_old) - b; \
if (r_decay > 0) r += (rate * r_decay) >> 8; \
if (g_decay > 0) g += (rate * g_decay) >> 8; \
if (b_decay > 0) b += (rate * b_decay) >> 8; \
*out++ = PIXEL(r,g,b); \
}
/* Global variables */
extern uint16 spr_col;
@@ -85,4 +141,3 @@ extern void (*parse_satb)(int line);
extern void (*update_bg_pattern_cache)(int index);
#endif /* _RENDER_H_ */
-1216
View File
File diff suppressed because it is too large Load Diff
-577
View File
@@ -1,577 +0,0 @@
#ifndef LIBRETRO_H__
#define LIBRETRO_H__
#include <stdint.h>
#include <stddef.h>
#include <limits.h>
// Hack applied for MSVC when compiling in C89 mode as it isn't C99 compliant.
#ifdef __cplusplus
extern "C" {
#else
#if defined(_MSC_VER) && !defined(SN_TARGET_PS3) && !defined(__cplusplus)
#define bool unsigned char
#define true 1
#define false 0
#else
#include <stdbool.h>
#endif
#endif
// Used for checking API/ABI mismatches that can break libretro implementations.
// It is not incremented for compatible changes.
#define RETRO_API_VERSION 1
// Libretro's fundamental device abstractions.
#define RETRO_DEVICE_MASK 0xff
#define RETRO_DEVICE_NONE 0
// The JOYPAD is called RetroPad. It is essentially a Super Nintendo controller,
// but with additional L2/R2/L3/R3 buttons, similar to a PS1 DualShock.
#define RETRO_DEVICE_JOYPAD 1
// The mouse is a simple mouse, similar to Super Nintendo's mouse.
// X and Y coordinates are reported relatively to last poll (poll callback).
// It is up to the libretro implementation to keep track of where the mouse pointer is supposed to be on the screen.
// The frontend must make sure not to interfere with its own hardware mouse pointer.
#define RETRO_DEVICE_MOUSE 2
// KEYBOARD device lets one poll for raw key pressed.
// It is poll based, so input callback will return with the current pressed state.
#define RETRO_DEVICE_KEYBOARD 3
// Lightgun X/Y coordinates are reported relatively to last poll, similar to mouse.
#define RETRO_DEVICE_LIGHTGUN 4
// The ANALOG device is an extension to JOYPAD (RetroPad).
// Similar to DualShock it adds two analog sticks.
// This is treated as a separate device type as it returns values in the full analog range
// of [-0x8000, 0x7fff]. Positive X axis is right. Positive Y axis is down.
// Only use ANALOG type when polling for analog values of the axes.
#define RETRO_DEVICE_ANALOG 5
// These device types are specializations of the base types above.
// They should only be used in retro_set_controller_type() to inform libretro implementations
// about use of a very specific device type.
//
// In input state callback, however, only the base type should be used in the 'device' field.
#define RETRO_DEVICE_JOYPAD_MULTITAP ((1 << 8) | RETRO_DEVICE_JOYPAD)
#define RETRO_DEVICE_LIGHTGUN_SUPER_SCOPE ((1 << 8) | RETRO_DEVICE_LIGHTGUN)
#define RETRO_DEVICE_LIGHTGUN_JUSTIFIER ((2 << 8) | RETRO_DEVICE_LIGHTGUN)
#define RETRO_DEVICE_LIGHTGUN_JUSTIFIERS ((3 << 8) | RETRO_DEVICE_LIGHTGUN)
// Buttons for the RetroPad (JOYPAD).
// The placement of these is equivalent to placements on the Super Nintendo controller.
// L2/R2/L3/R3 buttons correspond to the PS1 DualShock.
#define RETRO_DEVICE_ID_JOYPAD_B 0
#define RETRO_DEVICE_ID_JOYPAD_Y 1
#define RETRO_DEVICE_ID_JOYPAD_SELECT 2
#define RETRO_DEVICE_ID_JOYPAD_START 3
#define RETRO_DEVICE_ID_JOYPAD_UP 4
#define RETRO_DEVICE_ID_JOYPAD_DOWN 5
#define RETRO_DEVICE_ID_JOYPAD_LEFT 6
#define RETRO_DEVICE_ID_JOYPAD_RIGHT 7
#define RETRO_DEVICE_ID_JOYPAD_A 8
#define RETRO_DEVICE_ID_JOYPAD_X 9
#define RETRO_DEVICE_ID_JOYPAD_L 10
#define RETRO_DEVICE_ID_JOYPAD_R 11
#define RETRO_DEVICE_ID_JOYPAD_L2 12
#define RETRO_DEVICE_ID_JOYPAD_R2 13
#define RETRO_DEVICE_ID_JOYPAD_L3 14
#define RETRO_DEVICE_ID_JOYPAD_R3 15
// Index / Id values for ANALOG device.
#define RETRO_DEVICE_INDEX_ANALOG_LEFT 0
#define RETRO_DEVICE_INDEX_ANALOG_RIGHT 1
#define RETRO_DEVICE_ID_ANALOG_X 0
#define RETRO_DEVICE_ID_ANALOG_Y 1
// Id values for MOUSE.
#define RETRO_DEVICE_ID_MOUSE_X 0
#define RETRO_DEVICE_ID_MOUSE_Y 1
#define RETRO_DEVICE_ID_MOUSE_LEFT 2
#define RETRO_DEVICE_ID_MOUSE_RIGHT 3
// Id values for LIGHTGUN types.
#define RETRO_DEVICE_ID_LIGHTGUN_X 0
#define RETRO_DEVICE_ID_LIGHTGUN_Y 1
#define RETRO_DEVICE_ID_LIGHTGUN_TRIGGER 2
#define RETRO_DEVICE_ID_LIGHTGUN_CURSOR 3
#define RETRO_DEVICE_ID_LIGHTGUN_TURBO 4
#define RETRO_DEVICE_ID_LIGHTGUN_PAUSE 5
#define RETRO_DEVICE_ID_LIGHTGUN_START 6
// Returned from retro_get_region().
#define RETRO_REGION_NTSC 0
#define RETRO_REGION_PAL 1
// Passed to retro_get_memory_data/size().
// If the memory type doesn't apply to the implementation NULL/0 can be returned.
#define RETRO_MEMORY_MASK 0xff
// Regular save ram. This ram is usually found on a game cartridge, backed up by a battery.
// If save game data is too complex for a single memory buffer,
// the SYSTEM_DIRECTORY environment callback can be used.
#define RETRO_MEMORY_SAVE_RAM 0
// Some games have a built-in clock to keep track of time.
// This memory is usually just a couple of bytes to keep track of time.
#define RETRO_MEMORY_RTC 1
// System ram lets a frontend peek into a game systems main RAM.
#define RETRO_MEMORY_SYSTEM_RAM 2
// Video ram lets a frontend peek into a game systems video RAM (VRAM).
#define RETRO_MEMORY_VIDEO_RAM 3
// Special memory types.
#define RETRO_MEMORY_SNES_BSX_RAM ((1 << 8) | RETRO_MEMORY_SAVE_RAM)
#define RETRO_MEMORY_SNES_BSX_PRAM ((2 << 8) | RETRO_MEMORY_SAVE_RAM)
#define RETRO_MEMORY_SNES_SUFAMI_TURBO_A_RAM ((3 << 8) | RETRO_MEMORY_SAVE_RAM)
#define RETRO_MEMORY_SNES_SUFAMI_TURBO_B_RAM ((4 << 8) | RETRO_MEMORY_SAVE_RAM)
#define RETRO_MEMORY_SNES_GAME_BOY_RAM ((5 << 8) | RETRO_MEMORY_SAVE_RAM)
#define RETRO_MEMORY_SNES_GAME_BOY_RTC ((6 << 8) | RETRO_MEMORY_RTC)
// Special game types passed into retro_load_game_special().
// Only used when multiple ROMs are required.
#define RETRO_GAME_TYPE_BSX 0x101
#define RETRO_GAME_TYPE_BSX_SLOTTED 0x102
#define RETRO_GAME_TYPE_SUFAMI_TURBO 0x103
#define RETRO_GAME_TYPE_SUPER_GAME_BOY 0x104
// Keysyms used for ID in input state callback when polling RETRO_KEYBOARD.
enum retro_key
{
RETROK_UNKNOWN = 0,
RETROK_FIRST = 0,
RETROK_BACKSPACE = 8,
RETROK_TAB = 9,
RETROK_CLEAR = 12,
RETROK_RETURN = 13,
RETROK_PAUSE = 19,
RETROK_ESCAPE = 27,
RETROK_SPACE = 32,
RETROK_EXCLAIM = 33,
RETROK_QUOTEDBL = 34,
RETROK_HASH = 35,
RETROK_DOLLAR = 36,
RETROK_AMPERSAND = 38,
RETROK_QUOTE = 39,
RETROK_LEFTPAREN = 40,
RETROK_RIGHTPAREN = 41,
RETROK_ASTERISK = 42,
RETROK_PLUS = 43,
RETROK_COMMA = 44,
RETROK_MINUS = 45,
RETROK_PERIOD = 46,
RETROK_SLASH = 47,
RETROK_0 = 48,
RETROK_1 = 49,
RETROK_2 = 50,
RETROK_3 = 51,
RETROK_4 = 52,
RETROK_5 = 53,
RETROK_6 = 54,
RETROK_7 = 55,
RETROK_8 = 56,
RETROK_9 = 57,
RETROK_COLON = 58,
RETROK_SEMICOLON = 59,
RETROK_LESS = 60,
RETROK_EQUALS = 61,
RETROK_GREATER = 62,
RETROK_QUESTION = 63,
RETROK_AT = 64,
RETROK_LEFTBRACKET = 91,
RETROK_BACKSLASH = 92,
RETROK_RIGHTBRACKET = 93,
RETROK_CARET = 94,
RETROK_UNDERSCORE = 95,
RETROK_BACKQUOTE = 96,
RETROK_a = 97,
RETROK_b = 98,
RETROK_c = 99,
RETROK_d = 100,
RETROK_e = 101,
RETROK_f = 102,
RETROK_g = 103,
RETROK_h = 104,
RETROK_i = 105,
RETROK_j = 106,
RETROK_k = 107,
RETROK_l = 108,
RETROK_m = 109,
RETROK_n = 110,
RETROK_o = 111,
RETROK_p = 112,
RETROK_q = 113,
RETROK_r = 114,
RETROK_s = 115,
RETROK_t = 116,
RETROK_u = 117,
RETROK_v = 118,
RETROK_w = 119,
RETROK_x = 120,
RETROK_y = 121,
RETROK_z = 122,
RETROK_DELETE = 127,
RETROK_KP0 = 256,
RETROK_KP1 = 257,
RETROK_KP2 = 258,
RETROK_KP3 = 259,
RETROK_KP4 = 260,
RETROK_KP5 = 261,
RETROK_KP6 = 262,
RETROK_KP7 = 263,
RETROK_KP8 = 264,
RETROK_KP9 = 265,
RETROK_KP_PERIOD = 266,
RETROK_KP_DIVIDE = 267,
RETROK_KP_MULTIPLY = 268,
RETROK_KP_MINUS = 269,
RETROK_KP_PLUS = 270,
RETROK_KP_ENTER = 271,
RETROK_KP_EQUALS = 272,
RETROK_UP = 273,
RETROK_DOWN = 274,
RETROK_RIGHT = 275,
RETROK_LEFT = 276,
RETROK_INSERT = 277,
RETROK_HOME = 278,
RETROK_END = 279,
RETROK_PAGEUP = 280,
RETROK_PAGEDOWN = 281,
RETROK_F1 = 282,
RETROK_F2 = 283,
RETROK_F3 = 284,
RETROK_F4 = 285,
RETROK_F5 = 286,
RETROK_F6 = 287,
RETROK_F7 = 288,
RETROK_F8 = 289,
RETROK_F9 = 290,
RETROK_F10 = 291,
RETROK_F11 = 292,
RETROK_F12 = 293,
RETROK_F13 = 294,
RETROK_F14 = 295,
RETROK_F15 = 296,
RETROK_NUMLOCK = 300,
RETROK_CAPSLOCK = 301,
RETROK_SCROLLOCK = 302,
RETROK_RSHIFT = 303,
RETROK_LSHIFT = 304,
RETROK_RCTRL = 305,
RETROK_LCTRL = 306,
RETROK_RALT = 307,
RETROK_LALT = 308,
RETROK_RMETA = 309,
RETROK_LMETA = 310,
RETROK_LSUPER = 311,
RETROK_RSUPER = 312,
RETROK_MODE = 313,
RETROK_COMPOSE = 314,
RETROK_HELP = 315,
RETROK_PRINT = 316,
RETROK_SYSREQ = 317,
RETROK_BREAK = 318,
RETROK_MENU = 319,
RETROK_POWER = 320,
RETROK_EURO = 321,
RETROK_UNDO = 322,
RETROK_LAST
};
// Environment commands.
#define RETRO_ENVIRONMENT_SET_ROTATION 1 // const unsigned * --
// Sets screen rotation of graphics.
// Is only implemented if rotation can be accelerated by hardware.
// Valid values are 0, 1, 2, 3, which rotates screen by 0, 90, 180, 270 degrees
// counter-clockwise respectively.
//
#define RETRO_ENVIRONMENT_GET_OVERSCAN 2 // bool * --
// Boolean value whether or not the implementation should use overscan, or crop away overscan.
//
#define RETRO_ENVIRONMENT_GET_CAN_DUPE 3 // bool * --
// Boolean value whether or not frontend supports frame duping,
// passing NULL to video frame callback.
//
#define RETRO_ENVIRONMENT_GET_VARIABLE 4 // struct retro_variable * --
// Interface to aquire user-defined information from environment
// that cannot feasibly be supported in a multi-system way.
// Mostly used for obscure,
// specific features that the user can tap into when neseccary.
//
#define RETRO_ENVIRONMENT_SET_VARIABLES 5 // const struct retro_variable * --
// Allows an implementation to signal the environment
// which variables it might want to check for later using GET_VARIABLE.
// 'data' points to an array of retro_variable structs terminated by a { NULL, NULL } element.
// retro_variable::value should contain a human readable description of the key.
//
#define RETRO_ENVIRONMENT_SET_MESSAGE 6 // const struct retro_message * --
// Sets a message to be displayed in implementation-specific manner for a certain amount of 'frames'.
// Should not be used for trivial messages, which should simply be logged to stderr.
#define RETRO_ENVIRONMENT_SHUTDOWN 7 // N/A (NULL) --
// Requests the frontend to shutdown.
// Should only be used if game has a specific
// way to shutdown the game from a menu item or similar.
//
#define RETRO_ENVIRONMENT_SET_PERFORMANCE_LEVEL 8
// const unsigned * --
// Gives a hint to the frontend how demanding this implementation
// is on a system. E.g. reporting a level of 2 means
// this implementation should run decently on all frontends
// of level 2 and up.
//
// It can be used by the frontend to potentially warn
// about too demanding implementations.
//
// The levels are "floating", but roughly defined as:
// 0: Low-powered embedded devices such as Raspberry Pi
// 1: 6th generation consoles, such as Wii/Xbox 1, and phones, tablets, etc.
// 2: 7th generation consoles, such as PS3/360, with sub-par CPUs.
// 3: Modern desktop/laptops with reasonably powerful CPUs.
// 4: High-end desktops with very powerful CPUs.
//
// This function can be called on a per-game basis,
// as certain games an implementation can play might be
// particularily demanding.
// If called, it should be called in retro_load_game().
//
#define RETRO_ENVIRONMENT_GET_SYSTEM_DIRECTORY 9
// const char ** --
// Returns the "system" directory of the frontend.
// This directory can be used to store system specific ROMs such as BIOSes, configuration data, etc.
// The returned value can be NULL.
// If so, no such directory is defined,
// and it's up to the implementation to find a suitable directory.
//
#define RETRO_ENVIRONMENT_SET_PIXEL_FORMAT 10
// const enum retro_pixel_format * --
// Sets the internal pixel format used by the implementation.
// The default pixel format is RETRO_PIXEL_FORMAT_0RGB1555.
// This pixel format however, is deprecated (see enum retro_pixel_format).
// If the call returns false, the frontend does not support this pixel format.
// This function should be called inside retro_load_game() or retro_get_system_av_info().
//
#define RETRO_ENVIRONMENT_SET_INPUT_DESCRIPTORS 11
// const struct retro_input_descriptor * --
// Sets an array of retro_input_descriptors.
// It is up to the frontend to present this in a usable way.
// The array is terminated by retro_input_descriptor::description being set to NULL.
// This function can be called at any time, but it is recommended to call it as early as possible.
enum retro_pixel_format
{
// 0RGB1555, native endian. 0 bit must be set to 0.
// This pixel format is default for compatibility concerns only.
// If a 15/16-bit pixel format is desired, consider using RGB565.
RETRO_PIXEL_FORMAT_0RGB1555 = 0,
// XRGB8888, native endian. X bits are ignored.
RETRO_PIXEL_FORMAT_XRGB8888 = 1,
// RGB565, native endian. This pixel format is the recommended format to use if a 15/16-bit format is desired
// as it is the pixel format that is typically available on a wide range of low-power devices.
// It is also natively supported in APIs like OpenGL ES.
RETRO_PIXEL_FORMAT_RGB565 = 2,
// Ensure sizeof() == sizeof(int).
RETRO_PIXEL_FORMAT_UNKNOWN = INT_MAX
};
struct retro_message
{
const char *msg; // Message to be displayed.
unsigned frames; // Duration in frames of message.
};
// Describes how the libretro implementation maps a libretro input bind
// to its internal input system through a human readable string.
// This string can be used to better let a user configure input.
struct retro_input_descriptor
{
// Associates given parameters with a description.
unsigned port;
unsigned device;
unsigned index;
unsigned id;
const char *description; // Human readable description for parameters.
// The pointer must remain valid until retro_unload_game() is called.
};
struct retro_system_info
{
// All pointers are owned by libretro implementation, and pointers must remain valid until retro_deinit() is called.
const char *library_name; // Descriptive name of library. Should not contain any version numbers, etc.
const char *library_version; // Descriptive version of core.
const char *valid_extensions; // A string listing probably rom extensions the core will be able to load, separated with pipe.
// I.e. "bin|rom|iso".
// Typically used for a GUI to filter out extensions.
bool need_fullpath; // If true, retro_load_game() is guaranteed to provide a valid pathname in retro_game_info::path.
// ::data and ::size are both invalid.
// If false, ::data and ::size are guaranteed to be valid, but ::path might not be valid.
// This is typically set to true for libretro implementations that must load from file.
// Implementations should strive for setting this to false, as it allows the frontend to perform patching, etc.
bool block_extract; // If true, the frontend is not allowed to extract any archives before loading the real ROM.
// Necessary for certain libretro implementations that load games from zipped archives.
};
struct retro_game_geometry
{
unsigned base_width; // Nominal video width of game.
unsigned base_height; // Nominal video height of game.
unsigned max_width; // Maximum possible width of game.
unsigned max_height; // Maximum possible height of game.
float aspect_ratio; // Nominal aspect ratio of game. If aspect_ratio is <= 0.0,
// an aspect ratio of base_width / base_height is assumed.
// A frontend could override this setting if desired.
};
struct retro_system_timing
{
double fps; // FPS of video content.
double sample_rate; // Sampling rate of audio.
};
struct retro_system_av_info
{
struct retro_game_geometry geometry;
struct retro_system_timing timing;
};
struct retro_variable
{
const char *key; // Variable to query in RETRO_ENVIRONMENT_GET_VARIABLE.
// If NULL, obtains the complete environment string if more complex parsing is necessary.
// The environment string is formatted as key-value pairs delimited by semicolons as so:
// "key1=value1;key2=value2;..."
const char *value; // Value to be obtained. If key does not exist, it is set to NULL.
};
struct retro_game_info
{
const char *path; // Path to game, UTF-8 encoded. Usually used as a reference.
// May be NULL if rom was loaded from stdin or similar.
// retro_system_info::need_fullpath guaranteed that this path is valid.
const void *data; // Memory buffer of loaded game. Will be NULL if need_fullpath was set.
size_t size; // Size of memory buffer.
const char *meta; // String of implementation specific meta-data.
};
// Callbacks
//
// Environment callback. Gives implementations a way of performing uncommon tasks. Extensible.
typedef bool (*retro_environment_t)(unsigned cmd, void *data);
// Render a frame. Pixel format is 15-bit 0RGB1555 native endian unless changed (see RETRO_ENVIRONMENT_SET_PIXEL_FORMAT).
// Width and height specify dimensions of buffer.
// Pitch specifices length in bytes between two lines in buffer.
// For performance reasons, it is highly recommended to have a frame that is packed in memory, i.e. pitch == width * byte_per_pixel.
// Certain graphic APIs, such as OpenGL ES, do not like textures that are not packed in memory.
typedef void (*retro_video_refresh_t)(const void *data, unsigned width, unsigned height, size_t pitch);
// Renders a single audio frame. Should only be used if implementation generates a single sample at a time.
// Format is signed 16-bit native endian.
typedef void (*retro_audio_sample_t)(int16_t left, int16_t right);
// Renders multiple audio frames in one go. One frame is defined as a sample of left and right channels, interleaved.
// I.e. int16_t buf[4] = { l, r, l, r }; would be 2 frames.
// Only one of the audio callbacks must ever be used.
typedef size_t (*retro_audio_sample_batch_t)(const int16_t *data, size_t frames);
// Polls input.
typedef void (*retro_input_poll_t)(void);
// Queries for input for player 'port'. device will be masked with RETRO_DEVICE_MASK.
// Specialization of devices such as RETRO_DEVICE_JOYPAD_MULTITAP that have been set with retro_set_controller_port_device()
// will still use the higher level RETRO_DEVICE_JOYPAD to request input.
typedef int16_t (*retro_input_state_t)(unsigned port, unsigned device, unsigned index, unsigned id);
// Sets callbacks. retro_set_environment() is guaranteed to be called before retro_init().
// The rest of the set_* functions are guaranteed to have been called before the first call to retro_run() is made.
void retro_set_environment(retro_environment_t);
void retro_set_video_refresh(retro_video_refresh_t);
void retro_set_audio_sample(retro_audio_sample_t);
void retro_set_audio_sample_batch(retro_audio_sample_batch_t);
void retro_set_input_poll(retro_input_poll_t);
void retro_set_input_state(retro_input_state_t);
// Library global initialization/deinitialization.
void retro_init(void);
void retro_deinit(void);
// Must return RETRO_API_VERSION. Used to validate ABI compatibility when the API is revised.
unsigned retro_api_version(void);
// Gets statically known system info. Pointers provided in *info must be statically allocated.
// Can be called at any time, even before retro_init().
void retro_get_system_info(struct retro_system_info *info);
// Gets information about system audio/video timings and geometry.
// Can be called only after retro_load_game() has successfully completed.
// NOTE: The implementation of this function might not initialize every variable if needed.
// E.g. geom.aspect_ratio might not be initialized if core doesn't desire a particular aspect ratio.
void retro_get_system_av_info(struct retro_system_av_info *info);
// Sets device to be used for player 'port'.
void retro_set_controller_port_device(unsigned port, unsigned device);
// Resets the current game.
void retro_reset(void);
// Runs the game for one video frame.
// During retro_run(), input_poll callback must be called at least once.
//
// If a frame is not rendered for reasons where a game "dropped" a frame,
// this still counts as a frame, and retro_run() should explicitly dupe a frame if GET_CAN_DUPE returns true.
// In this case, the video callback can take a NULL argument for data.
void retro_run(void);
// Returns the amount of data the implementation requires to serialize internal state (save states).
// Beetween calls to retro_load_game() and retro_unload_game(), the returned size is never allowed to be larger than a previous returned value, to
// ensure that the frontend can allocate a save state buffer once.
size_t retro_serialize_size(void);
// Serializes internal state. If failed, or size is lower than retro_serialize_size(), it should return false, true otherwise.
bool retro_serialize(void *data, size_t size);
bool retro_unserialize(const void *data, size_t size);
void retro_cheat_reset(void);
void retro_cheat_set(unsigned index, bool enabled, const char *code);
// Loads a game.
bool retro_load_game(const struct retro_game_info *game);
// Loads a "special" kind of game. Should not be used except in extreme cases.
bool retro_load_game_special(
unsigned game_type,
const struct retro_game_info *info, size_t num_info
);
// Unloads a currently loaded game.
void retro_unload_game(void);
// Gets region of game.
unsigned retro_get_region(void);
// Gets region of memory.
void *retro_get_memory_data(unsigned id);
size_t retro_get_memory_size(unsigned id);
#ifdef __cplusplus
}
#endif
#endif
-61
View File
@@ -1,61 +0,0 @@
#include "shared.h"
t_config config;
void set_config_defaults(void)
{
int i;
/* sound options */
config.psg_preamp = 150;
config.fm_preamp = 100;
config.hq_fm = 1;
config.psgBoostNoise = 0;
config.filter = 1;
config.lp_range = 60;
config.low_freq = 200;
config.high_freq = 8000;
config.lg = 1.0;
config.mg = 1.0;
config.hg = 1.0;
config.dac_bits = 14;
config.ym2413 = 2;
/* system options */
config.region_detect = 0;
config.force_dtack = 0;
config.addr_error = 1;
//config.tmss = 0;
config.lock_on = 0;
//config.romtype = 0;
config.hot_swap = 0;
config.bios = 0;
config.system = 0;
config.master_clock = 0;
config.vdp_mode = 0;
/* video options */
config.xshift = 0;
config.yshift = 0;
config.xscale = 0;
config.yscale = 0;
config.aspect = 1;
config.overscan = 1;
config.gg_extra = 0;
config.render = 0;
config.ntsc = 0;
config.bilinear = 0;
/* controllers options */
input.system[0] = SYSTEM_MD_GAMEPAD;
input.system[1] = SYSTEM_MD_GAMEPAD;
config.gun_cursor[0] = 1;
config.gun_cursor[1] = 1;
config.invert_mouse = 0;
for (i=0;i<MAX_INPUTS;i++)
{
config.input[i].padtype = DEVICE_PAD6B;
}
}
-88
View File
@@ -1,88 +0,0 @@
#ifndef _CONFIG_H_
#define _CONFIG_H_
#define uint8 unsigned char
#define uint16 unsigned short
#define uint32 unsigned int
#define int8 signed char
#define int16 signed short
#define int32 signed int
/****************************************************************************
* Config Option
*
****************************************************************************/
typedef struct
{
int8 device;
uint8 port;
uint8 padtype;
} t_input_config;
typedef struct
{
char version[16];
uint8 hq_fm;
uint8 filter;
uint8 psgBoostNoise;
uint8 dac_bits;
uint8 ym2413;
int16 psg_preamp;
int16 fm_preamp;
int16 lp_range;
int16 low_freq;
int16 high_freq;
int16 lg;
int16 mg;
int16 hg;
uint8 region_detect;
uint8 force_dtack;
uint8 addr_error;
uint8 tmss;
uint8 lock_on;
uint8 hot_swap;
uint8 romtype;
uint8 invert_mouse;
uint8 gun_cursor[2];
uint8 overscan;
uint8 gg_extra;
uint8 ntsc;
uint8 render;
uint8 tv_mode;
uint8 bilinear;
uint8 aspect;
int16 xshift;
int16 yshift;
int16 xscale;
int16 yscale;
uint8 system;
uint8 bios;
uint8 master_clock;
uint8 vdp_mode;
#ifdef HW_RVL
uint32 trap;
float gamma;
#endif
t_input_config input[MAX_INPUTS];
uint16 pad_keymap[4][MAX_KEYS];
#ifdef HW_RVL
uint32 wpad_keymap[4*3][MAX_KEYS];
#endif
uint8 autoload;
uint8 autocheat;
uint8 s_auto;
uint8 s_default;
uint8 s_device;
uint8 autocheats;
int8 bg_type;
int8 bg_overlay;
int16 screen_w;
float bgm_volume;
float sfx_volume;
} t_config;
/* Global variables */
extern t_config config;
#endif /* _CONFIG_H_ */
-37
View File
@@ -1,37 +0,0 @@
/*
error.c --
Error logging
*/
#include "osd.h"
#include <stdarg.h>
FILE *error_log;
struct {
int enabled;
int verbose;
FILE *log;
} t_error;
void error_init(void)
{
#ifdef LOGERROR
error_log = fopen("error.log","w");
#endif
}
void error_shutdown(void)
{
if(error_log) fclose(error_log);
}
void error(char *format, ...)
{
//if (!log_error) return;
va_list ap;
va_start(ap, format);
if(error_log) vfprintf(error_log, format, ap);
va_end(ap);
}
-13
View File
@@ -1,13 +0,0 @@
#ifndef _ERROR_H_
#define _ERROR_H_
/* Global variables */
FILE *error_log;
/* Function prototypes */
void error_init(void);
void error_shutdown(void);
void error(char *format, ...);
#endif /* _ERROR_H_ */
-68
View File
@@ -1,68 +0,0 @@
#include "shared.h"
#define CHUNKSIZE (0x10000)
/*
Load a normal file, or ZIP/GZ archive.
Returns NULL if an error occured.
*/
int load_archive(char *filename, unsigned char *buffer, int maxsize)
{
int size = 0;
char in[CHUNKSIZE];
char msg[64] = "Unable to open file";
/* Open file */
FILE *fd = fopen(filename, "rb");
/* Mega CD BIOS are required files */
if (!strcmp(filename,CD_BIOS_US) || !strcmp(filename,CD_BIOS_EU) || !strcmp(filename,CD_BIOS_JP))
{
sprintf(msg,"Unable to open CD BIOS");
}
if (!fd)
{
fprintf(stderr, "ERROR - %s.\n");
return 0;
}
/* Read first chunk */
fread(in, CHUNKSIZE, 1, fd);
{
int left;
/* Get file size */
fseek(fd, 0, SEEK_END);
size = ftell(fd);
fseek(fd, 0, SEEK_SET);
/* size limit */
if(size > maxsize)
{
fclose(fd);
fprintf(stderr, "ERROR - File is too large.\n");
return 0;
}
sprintf((char *)msg,"Loading %d bytes ...", size);
fprintf(stderr, "INFORMATION - %s\n", msg);
/* Read into buffer */
left = size;
while (left > CHUNKSIZE)
{
fread(buffer, CHUNKSIZE, 1, fd);
buffer += CHUNKSIZE;
left -= CHUNKSIZE;
}
/* Read remaining bytes */
fread(buffer, left, 1, fd);
}
/* Close file */
fclose(fd);
/* Return loaded ROM size */
return size;
}
-16
View File
@@ -1,16 +0,0 @@
#ifndef _FILEIO_H_
#define _FILEIO_H_
//#include <zlib.h>
/* Global variables */
extern int cart_size;
extern char cart_name[0x100];
/* Function prototypes */
int load_archive(char *filename, unsigned char *buffer, int maxsize);
uint8 *load_archive(char *filename, int *file_size);
int load_cart(char *filename);
#endif /* _FILEIO_H_ */
+3 -28
View File
@@ -1,19 +1,11 @@
#ifndef _OSD_H
#define _OSD_H
#ifdef _MSC_VER
#include <stdio.h>
typedef unsigned char bool;
#define strncasecmp _strnicmp
#endif
#include <stdint.h>
#include <stdlib.h>
#include <string.h>
#define MAX_INPUTS 8
#define MAX_KEYS 8
#define MAXPATHLEN 1024
#ifndef TRUE
#define TRUE 1
@@ -27,8 +19,6 @@ typedef unsigned char bool;
#define M_PI 3.1415926535897932385
#endif
//#define ALIGN_SND 0xfffffff8 /* 32 bytes aligned sound buffers (8 samples alignment) */
typedef struct
{
int8 device;
@@ -36,7 +26,7 @@ typedef struct
uint8 padtype;
} t_input_config;
typedef struct
struct
{
char version[16];
uint8 hq_fm;
@@ -61,16 +51,13 @@ typedef struct
uint8 addr_error;
uint8 bios;
uint8 lock_on;
uint8 hot_swap;
uint8 overscan;
uint8 gg_extra;
uint8 ntsc;
uint8 lcd;
uint8 render;
t_input_config input[MAX_INPUTS];
} t_config;
/* Global data */
t_config config;
} config;
extern char GG_ROM[256];
extern char AR_ROM[256];
@@ -84,18 +71,6 @@ extern char MS_BIOS_US[256];
extern char MS_BIOS_EU[256];
extern char MS_BIOS_JP[256];
//extern int16 soundbuffer[3068];
extern int16 soundbuffer[2048 * 2]; //3068 1920 ?
//#define SOUND_SAMPLES_SIZE 2048
//n = SOUND_SAMPLES_SIZE * 2 * sizeof(short) * 11;
//sdl_sound.buffer = (char*)malloc(n);
//static short soundframe[SOUND_SAMPLES_SIZE];
//int size = audio_update(soundframe) * 2;
#define VERSION "Genesis Plus GX 1.7.3 (libretro)"
void osd_input_update(void);
int load_archive(char *filename, unsigned char *buffer, int maxsize, char *extension);
View File
View File