Merge pull request #26 from Oggom/master

Sync with main repo
This commit is contained in:
Twinaphex 2015-05-07 14:52:59 +02:00
commit 5b3e8c4b03
10 changed files with 85 additions and 29 deletions

Binary file not shown.

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.7 MiB

After

Width:  |  Height:  |  Size: 3.7 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.8 MiB

After

Width:  |  Height:  |  Size: 3.8 MiB

View File

@ -46,8 +46,6 @@
#include "eeprom_spi.h"
#include "gamepad.h"
#define CART_CNT (55)
/* Cart database entry */
typedef struct
{
@ -92,7 +90,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}},
@ -100,6 +98,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 ?) */
@ -514,7 +514,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) &&
@ -544,7 +544,7 @@ void md_cart_init(void)
}
/* leave loop */
i = CART_CNT;
break;
}
}

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-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:

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-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:
@ -40,7 +40,7 @@
/* CD compatible ROM/RAM cartridge */
typedef struct
{
uint8 area[0x810000]; /* cartridge ROM/RAM area (max. 8MB + 64KB backup) */
uint8 area[0x840000]; /* cartridge ROM/RAM area (max. 8MB ROM / 64KB backup memory + Pro Action Replay 128KB ROM / 64KB RAM) */
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 */

View File

@ -5,7 +5,7 @@
* 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-2014 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:
@ -3881,14 +3881,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)];
@ -3935,14 +3935,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 */

View File

@ -5,7 +5,7 @@
* 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-2014 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:

View File

@ -41,6 +41,7 @@ char GG_ROM[256];
char AR_ROM[256];
char SK_ROM[256];
char SK_UPMEM[256];
char MD_BIOS[256];
char GG_BIOS[256];
char MS_BIOS_EU[256];
char MS_BIOS_JP[256];
@ -154,16 +155,20 @@ int load_archive(char *filename, unsigned char *buffer, int maxsize, char *exten
size = ftell(fd);
/* size limit */
if(size > maxsize)
if (size > MAXROMSIZE)
{
fclose(fd);
if (log_cb)
log_cb(RETRO_LOG_ERROR, "File is too large.\n");
return 0;
}
else if (size > maxsize)
{
size = maxsize;
}
if (log_cb)
log_cb(RETRO_LOG_INFO, "INFORMATION - Loading %d bytes ...\n", size);
log_cb(RETRO_LOG_INFO, "INFORMATION - Loading %d bytes ...\n", size);
/* filename extension */
if (extension)
@ -776,6 +781,24 @@ static void check_variables(void)
}
}
var.key = "genesis_plus_gx_bios";
environ_cb(RETRO_ENVIRONMENT_GET_VARIABLE, &var);
{
orig_value = config.bios;
if (!strcmp(var.value, "enabled"))
config.bios = 3;
else
config.bios = 0;
if (orig_value != config.bios)
{
if (system_hw)
{
reinit = true;
}
}
}
var.key = "genesis_plus_gx_force_dtack";
environ_cb(RETRO_ENVIRONMENT_GET_VARIABLE, &var);
{
@ -924,7 +947,7 @@ static void check_variables(void)
environ_cb(RETRO_ENVIRONMENT_GET_VARIABLE, &var);
{
orig_value = config.render;
if (strcmp(var.value, "normal") == 0)
if (strcmp(var.value, "single field") == 0)
config.render = 0;
else
config.render = 1;
@ -935,7 +958,7 @@ static void check_variables(void)
var.key = "genesis_plus_gx_gun_cursor";
environ_cb(RETRO_ENVIRONMENT_GET_VARIABLE, &var);
{
if (strcmp(var.value, "off") == 0)
if (strcmp(var.value, "no") == 0)
config.gun_cursor = 0;
else
config.gun_cursor = 1;
@ -944,7 +967,7 @@ static void check_variables(void)
var.key = "genesis_plus_gx_invert_mouse";
environ_cb(RETRO_ENVIRONMENT_GET_VARIABLE, &var);
{
if (strcmp(var.value, "off") == 0)
if (strcmp(var.value, "no") == 0)
config.invert_mouse = 0;
else
config.invert_mouse = 1;
@ -1311,6 +1334,7 @@ void retro_set_environment(retro_environment_t cb)
{ "genesis_plus_gx_system_hw", "System hardware; auto|sg-1000|sg-1000 II|mark-III|master system|master system II|game gear|mega drive / genesis" },
{ "genesis_plus_gx_region_detect", "System region; auto|ntsc-u|pal|ntsc-j" },
{ "genesis_plus_gx_force_dtack", "System lockups; enabled|disabled" },
{ "genesis_plus_gx_bios", "System bootrom; disabled|enabled" },
{ "genesis_plus_gx_addr_error", "68k address error; enabled|disabled" },
{ "genesis_plus_gx_lock_on", "Cartridge lock-on; disabled|game genie|action replay (pro)|sonic & knuckles" },
{ "genesis_plus_gx_ym2413", "Master System FM; auto|disabled|enabled" },
@ -1706,6 +1730,11 @@ bool retro_load_game(const struct retro_game_info *info)
snprintf(AR_ROM, sizeof(AR_ROM), "%s%careplay.bin", dir, slash);
snprintf(SK_ROM, sizeof(SK_ROM), "%s%csk.bin", dir, slash);
snprintf(SK_UPMEM, sizeof(SK_UPMEM), "%s%csk2chip.bin", dir, slash);
snprintf(MD_BIOS, sizeof(MD_BIOS), "%s%cbios_MD.bin", dir, slash);
snprintf(GG_BIOS, sizeof(GG_BIOS), "%s%cbios.gg", dir, slash);
snprintf(MS_BIOS_EU, sizeof(MS_BIOS_EU), "%s%cbios_E.sms", dir, slash);
snprintf(MS_BIOS_US, sizeof(MS_BIOS_US), "%s%cbios_U.sms", dir, slash);
snprintf(MS_BIOS_JP, sizeof(MS_BIOS_JP), "%s%cbios_J.sms", dir, slash);
snprintf(CD_BIOS_EU, sizeof(CD_BIOS_EU), "%s%cbios_CD_E.bin", dir, slash);
snprintf(CD_BIOS_US, sizeof(CD_BIOS_US), "%s%cbios_CD_U.bin", dir, slash);
snprintf(CD_BIOS_JP, sizeof(CD_BIOS_JP), "%s%cbios_CD_J.bin", dir, slash);
@ -1719,26 +1748,52 @@ bool retro_load_game(const struct retro_game_info *info)
log_cb(RETRO_LOG_INFO, "Action Replay (Pro) ROM should be located at: %s\n", AR_ROM);
log_cb(RETRO_LOG_INFO, "Sonic & Knuckles (2 MB) ROM should be located at: %s\n", SK_ROM);
log_cb(RETRO_LOG_INFO, "Sonic & Knuckles UPMEM (256 KB) ROM should be located at: %s\n", SK_UPMEM);
log_cb(RETRO_LOG_INFO, "Mega CD PAL BIOS should be located at: %s\n", CD_BIOS_EU);
log_cb(RETRO_LOG_INFO, "Sega CD NTSC-U BIOS should be located at: %s\n", CD_BIOS_US);
log_cb(RETRO_LOG_INFO, "Mega CD NTSC-J BIOS should be located at: %s\n", CD_BIOS_JP);
log_cb(RETRO_LOG_INFO, "Mega CD PAL BRAM is located at: %s\n", CD_BRAM_EU);
log_cb(RETRO_LOG_INFO, "Sega CD NTSC-U BRAM is located at: %s\n", CD_BRAM_US);
log_cb(RETRO_LOG_INFO, "Mega CD NTSC-J BRAM is located at: %s\n", CD_BRAM_JP);
log_cb(RETRO_LOG_INFO, "Mega CD RAM CART is located at: %s\n", CART_BRAM);
log_cb(RETRO_LOG_INFO, "Mega Drive TMSS BOOTROM should be located at: %s\n", MD_BIOS);
log_cb(RETRO_LOG_INFO, "Game Gear TMSS BOOTROM should be located at: %s\n", GG_BIOS);
log_cb(RETRO_LOG_INFO, "Master System (PAL) BOOTROM should be located at: %s\n", MS_BIOS_EU);
log_cb(RETRO_LOG_INFO, "Master System (NTSC-U) BOOTROM should be located at: %s\n", MS_BIOS_US);
log_cb(RETRO_LOG_INFO, "Master System (NTSC-J) BOOTROM should be located at: %s\n", MS_BIOS_JP);
log_cb(RETRO_LOG_INFO, "Mega CD (PAL) BIOS should be located at: %s\n", CD_BIOS_EU);
log_cb(RETRO_LOG_INFO, "Sega CD (NTSC-U) BIOS should be located at: %s\n", CD_BIOS_US);
log_cb(RETRO_LOG_INFO, "Mega CD (NTSC-J) BIOS should be located at: %s\n", CD_BIOS_JP);
log_cb(RETRO_LOG_INFO, "Mega CD (PAL) BRAM is located at: %s\n", CD_BRAM_EU);
log_cb(RETRO_LOG_INFO, "Sega CD (NTSC-U) BRAM is located at: %s\n", CD_BRAM_US);
log_cb(RETRO_LOG_INFO, "Mega CD (NTSC-J) BRAM is located at: %s\n", CD_BRAM_JP);
log_cb(RETRO_LOG_INFO, "Sega/Mega CD RAM CART is located at: %s\n", CART_BRAM);
}
check_variables();
if (!load_rom((char *)info->path))
return false;
if ((config.bios & 1) && !(system_bios & SYSTEM_MD))
{
memset(boot_rom, 0xFF, 0x800);
if (load_archive(MD_BIOS, boot_rom, 0x800, NULL) > 0)
{
if (!memcmp((char *)(boot_rom + 0x120),"GENESIS OS", 10))
{
system_bios |= SYSTEM_MD;
}
#ifdef LSB_FIRST
for (i=0; i<0x800; i+=2)
{
uint8 temp = boot_rom[i];
boot_rom[i] = boot_rom[i+1];
boot_rom[i+1] = temp;
}
#endif
}
}
audio_init(44100, vdp_pal ? pal_fps : ntsc_fps);
system_init();
system_reset();
is_running = false;
if (system_hw == SYSTEM_MCD)
bram_load();
bram_load();
update_viewport();

View File

@ -76,6 +76,7 @@ extern char AR_ROM[256];
extern char SK_ROM[256];
extern char SK_UPMEM[256];
extern char GG_BIOS[256];
extern char MD_BIOS[256];
extern char CD_BIOS_EU[256];
extern char CD_BIOS_US[256];
extern char CD_BIOS_JP[256];