mirror of
https://github.com/ekeeke/Genesis-Plus-GX.git
synced 2024-11-04 18:05:06 +01:00
* added automatic detection for CD games with Justifier/Menacer support
* improved Justifier/Menacer emulation * [Wii only] fixed screen rendering when borders are disabled
This commit is contained in:
parent
8d51460b1d
commit
7026a8445e
@ -350,108 +350,10 @@ void md_cart_init(void)
|
|||||||
m68k.memory_map[0x3a].read16 = svp_read_cell_2;
|
m68k.memory_map[0x3a].read16 = svp_read_cell_2;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**********************************************
|
|
||||||
SPECIFIC PERIPHERAL SUPPORT
|
|
||||||
***********************************************/
|
|
||||||
|
|
||||||
/* default GUN settings */
|
|
||||||
input.x_offset = 0x00;
|
|
||||||
input.y_offset = 0x00;
|
|
||||||
|
|
||||||
/* SEGA Menacer */
|
|
||||||
if (strstr(rominfo.international,"MENACER") != NULL)
|
|
||||||
{
|
|
||||||
/* save current setting */
|
|
||||||
if (old_system[0] == -1)
|
|
||||||
{
|
|
||||||
old_system[0] = input.system[0];
|
|
||||||
}
|
|
||||||
if (old_system[1] == -1)
|
|
||||||
{
|
|
||||||
old_system[1] = input.system[1];
|
|
||||||
}
|
|
||||||
|
|
||||||
input.system[0] = SYSTEM_MD_GAMEPAD;
|
|
||||||
input.system[1] = SYSTEM_MENACER;
|
|
||||||
input.x_offset = 0x52;
|
|
||||||
input.y_offset = 0x00;
|
|
||||||
}
|
|
||||||
else if (strstr(rominfo.international,"T2 ; THE ARCADE GAME") != NULL)
|
|
||||||
{
|
|
||||||
/* save current setting */
|
|
||||||
if (old_system[0] == -1)
|
|
||||||
{
|
|
||||||
old_system[0] = input.system[0];
|
|
||||||
}
|
|
||||||
if (old_system[1] == -1)
|
|
||||||
{
|
|
||||||
old_system[1] = input.system[1];
|
|
||||||
}
|
|
||||||
|
|
||||||
input.system[0] = SYSTEM_MD_GAMEPAD;
|
|
||||||
input.system[1] = SYSTEM_MENACER;
|
|
||||||
input.x_offset = 0x84;
|
|
||||||
input.y_offset = 0x08;
|
|
||||||
}
|
|
||||||
else if (strstr(rominfo.international,"BODY COUNT") != NULL)
|
|
||||||
{
|
|
||||||
/* save current setting */
|
|
||||||
if (old_system[0] == -1)
|
|
||||||
{
|
|
||||||
old_system[0] = input.system[0];
|
|
||||||
}
|
|
||||||
if (old_system[1] == -1)
|
|
||||||
{
|
|
||||||
old_system[1] = input.system[1];
|
|
||||||
}
|
|
||||||
|
|
||||||
input.system[0] = SYSTEM_MOUSE;
|
|
||||||
input.system[1] = SYSTEM_MENACER;
|
|
||||||
input.x_offset = 0x44;
|
|
||||||
input.y_offset = 0x18;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* KONAMI Justifiers */
|
|
||||||
else if (strstr(rominfo.international,"LETHAL ENFORCERSII") != NULL)
|
|
||||||
{
|
|
||||||
/* save current setting */
|
|
||||||
if (old_system[0] == -1)
|
|
||||||
{
|
|
||||||
old_system[0] = input.system[0];
|
|
||||||
}
|
|
||||||
if (old_system[1] == -1)
|
|
||||||
{
|
|
||||||
old_system[1] = input.system[1];
|
|
||||||
}
|
|
||||||
|
|
||||||
input.system[0] = SYSTEM_MD_GAMEPAD;
|
|
||||||
input.system[1] = SYSTEM_JUSTIFIER;
|
|
||||||
input.x_offset = 0x18;
|
|
||||||
input.y_offset = 0x00;
|
|
||||||
}
|
|
||||||
else if (strstr(rominfo.international,"LETHAL ENFORCERS") != NULL)
|
|
||||||
{
|
|
||||||
/* save current setting */
|
|
||||||
if (old_system[0] == -1)
|
|
||||||
{
|
|
||||||
old_system[0] = input.system[0];
|
|
||||||
}
|
|
||||||
if (old_system[1] == -1)
|
|
||||||
{
|
|
||||||
old_system[1] = input.system[1];
|
|
||||||
}
|
|
||||||
|
|
||||||
input.system[0] = SYSTEM_MD_GAMEPAD;
|
|
||||||
input.system[1] = SYSTEM_JUSTIFIER;
|
|
||||||
input.x_offset = 0x00;
|
|
||||||
input.y_offset = 0x00;
|
|
||||||
}
|
|
||||||
|
|
||||||
cart.special = 0;
|
|
||||||
|
|
||||||
/**********************************************
|
/**********************************************
|
||||||
J-CART
|
J-CART
|
||||||
***********************************************/
|
***********************************************/
|
||||||
|
cart.special = 0;
|
||||||
if (((strstr(rominfo.product,"00000000") != NULL) && (rominfo.checksum == 0x168b)) || /* Super Skidmarks, Micro Machines Military */
|
if (((strstr(rominfo.product,"00000000") != NULL) && (rominfo.checksum == 0x168b)) || /* Super Skidmarks, Micro Machines Military */
|
||||||
((strstr(rominfo.product,"00000000") != NULL) && (rominfo.checksum == 0x165e)) || /* Pete Sampras Tennis (1991), Micro Machines 96 */
|
((strstr(rominfo.product,"00000000") != NULL) && (rominfo.checksum == 0x165e)) || /* Pete Sampras Tennis (1991), Micro Machines 96 */
|
||||||
((strstr(rominfo.product,"00000000") != NULL) && (rominfo.checksum == 0xcee0)) || /* Micro Machines Military (bad) */
|
((strstr(rominfo.product,"00000000") != NULL) && (rominfo.checksum == 0xcee0)) || /* Micro Machines Military (bad) */
|
||||||
@ -465,7 +367,7 @@ void md_cart_init(void)
|
|||||||
{
|
{
|
||||||
cart.special |= HW_J_CART;
|
cart.special |= HW_J_CART;
|
||||||
|
|
||||||
/* set default port 1 setting */
|
/* force port 1 setting */
|
||||||
if (input.system[1] != SYSTEM_WAYPLAY)
|
if (input.system[1] != SYSTEM_WAYPLAY)
|
||||||
{
|
{
|
||||||
old_system[1] = input.system[1];
|
old_system[1] = input.system[1];
|
||||||
|
@ -659,25 +659,29 @@ static void gxDrawCrosshair(gx_texture *texture, int x, int y)
|
|||||||
{
|
{
|
||||||
if (texture->data)
|
if (texture->data)
|
||||||
{
|
{
|
||||||
/* load texture object */
|
/* EFB scale & shift */
|
||||||
GXTexObj texObj;
|
int xwidth = square[3] - square[9];
|
||||||
GX_InitTexObj(&texObj, texture->data, texture->width, texture->height, GX_TF_RGBA8, GX_CLAMP, GX_CLAMP, GX_FALSE);
|
int ywidth = square[4] - square[10];
|
||||||
GX_InitTexObjLOD(&texObj,GX_LINEAR,GX_LIN_MIP_LIN,0.0,10.0,0.0,GX_FALSE,GX_TRUE,GX_ANISO_4);
|
int xshift = (square[3] + square[9]) / 2;
|
||||||
GX_LoadTexObj(&texObj, GX_TEXMAP0);
|
int yshift = (square[4] + square[10]) / 2;
|
||||||
GX_InvalidateTexAll();
|
|
||||||
|
|
||||||
/* reset GX rendering */
|
|
||||||
gxResetRendering(1);
|
|
||||||
|
|
||||||
/* adjust texture dimensions to XFB->VI scaling */
|
/* adjust texture dimensions to XFB->VI scaling */
|
||||||
int w = (texture->width * rmode->fbWidth) / (rmode->viWidth);
|
int w = (texture->width * rmode->fbWidth) / (rmode->viWidth);
|
||||||
int h = (texture->height * rmode->efbHeight) / (rmode->viHeight);
|
int h = (texture->height * rmode->efbHeight) / (rmode->viHeight);
|
||||||
|
|
||||||
/* adjust texture coordinates to EFB */
|
/* adjust texture coordinates to EFB */
|
||||||
int fb_w = square[3] - square[9];
|
x = (((x + bitmap.viewport.x) * xwidth) / (bitmap.viewport.w + 2*bitmap.viewport.x)) - w/2 - (xwidth/2) + xshift;
|
||||||
int fb_h = square[4] - square[10];
|
y = (((y + bitmap.viewport.y) * ywidth) / (bitmap.viewport.h + 2*bitmap.viewport.y)) - h/2 - (ywidth/2) + yshift;
|
||||||
x = (((x + bitmap.viewport.x) * fb_w) / (bitmap.viewport.w + 2*bitmap.viewport.x)) - w/2 - (fb_w/2);
|
|
||||||
y = (((y + bitmap.viewport.y) * fb_h) / (bitmap.viewport.h + 2*bitmap.viewport.y)) - h/2 - (fb_h/2);
|
/* reset GX rendering */
|
||||||
|
gxResetRendering(1);
|
||||||
|
|
||||||
|
/* load texture object */
|
||||||
|
GXTexObj texObj;
|
||||||
|
GX_InitTexObj(&texObj, texture->data, texture->width, texture->height, GX_TF_RGBA8, GX_CLAMP, GX_CLAMP, GX_FALSE);
|
||||||
|
GX_InitTexObjLOD(&texObj,GX_LINEAR,GX_LIN_MIP_LIN,0.0,10.0,0.0,GX_FALSE,GX_TRUE,GX_ANISO_4);
|
||||||
|
GX_LoadTexObj(&texObj, GX_TEXMAP0);
|
||||||
|
GX_InvalidateTexAll();
|
||||||
|
|
||||||
/* Draw textured quad */
|
/* Draw textured quad */
|
||||||
GX_Begin(GX_QUADS, GX_VTXFMT0, 4);
|
GX_Begin(GX_QUADS, GX_VTXFMT0, 4);
|
||||||
|
@ -133,8 +133,8 @@ typedef struct
|
|||||||
uint8 dev[MAX_DEVICES]; /* can be one of the DEVICE_* values */
|
uint8 dev[MAX_DEVICES]; /* can be one of the DEVICE_* values */
|
||||||
uint16 pad[MAX_DEVICES]; /* digital inputs (any of INPUT_* values) */
|
uint16 pad[MAX_DEVICES]; /* digital inputs (any of INPUT_* values) */
|
||||||
int16 analog[MAX_DEVICES][2]; /* analog inputs (x/y) */
|
int16 analog[MAX_DEVICES][2]; /* analog inputs (x/y) */
|
||||||
uint8 x_offset; /* gun horizontal offset */
|
int x_offset; /* gun horizontal offset */
|
||||||
uint8 y_offset; /* gun vertical offset */
|
int y_offset; /* gun vertical offset */
|
||||||
} t_input;
|
} t_input;
|
||||||
|
|
||||||
/* Global variables */
|
/* Global variables */
|
||||||
|
@ -92,8 +92,6 @@ static struct
|
|||||||
|
|
||||||
void lightgun_reset(int port)
|
void lightgun_reset(int port)
|
||||||
{
|
{
|
||||||
input.analog[port][0] = bitmap.viewport.w >> 1;
|
|
||||||
input.analog[port][1] = bitmap.viewport.h >> 1;
|
|
||||||
lightgun.State = 0x40;
|
lightgun.State = 0x40;
|
||||||
lightgun.Port = 4;
|
lightgun.Port = 4;
|
||||||
}
|
}
|
||||||
@ -103,32 +101,47 @@ void lightgun_refresh(int port)
|
|||||||
/* Check that lightgun is enabled */
|
/* Check that lightgun is enabled */
|
||||||
if (port == lightgun.Port)
|
if (port == lightgun.Port)
|
||||||
{
|
{
|
||||||
|
/* screen Y position */
|
||||||
|
int y = (input.analog[port][1] + lines_per_frame + input.y_offset) % lines_per_frame;
|
||||||
|
|
||||||
/* check if line falls within current gun Y position */
|
/* check if line falls within current gun Y position */
|
||||||
if ((input.analog[port][1] == v_counter + input.y_offset))
|
if (v_counter == y)
|
||||||
{
|
{
|
||||||
/* HL enabled ? */
|
/* HL enabled ? */
|
||||||
if (io_reg[5] & 0x80)
|
if (io_reg[5] & 0x80)
|
||||||
{
|
{
|
||||||
|
/* screen X position */
|
||||||
|
int x = input.analog[port][0];
|
||||||
|
|
||||||
|
/* Sega Menacer specific */
|
||||||
|
if (input.system[1] == SYSTEM_MENACER)
|
||||||
|
{
|
||||||
|
/* raw position is scaled up by games */
|
||||||
|
if (system_hw == SYSTEM_MCD)
|
||||||
|
{
|
||||||
|
x = (x * 304) / 320;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
x = (x * 289) / 320;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/* External Interrupt ? */
|
/* External Interrupt ? */
|
||||||
if (reg[11] & 0x08)
|
if (reg[11] & 0x08)
|
||||||
{
|
{
|
||||||
m68k_update_irq(2);
|
m68k_update_irq(2);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* HV Counter Latch:
|
/* force HV Counter Latch (some games does not lock HV Counter but instead use larger offset value) */
|
||||||
1) some games does not enable HVC latch but instead use bigger X offset
|
|
||||||
--> we force the HV counter value read by the gun routine
|
|
||||||
2) for games using H40 mode, the gun routine scales up the Hcounter value
|
|
||||||
--> H-Counter range is approx. 290 dot clocks
|
|
||||||
*/
|
|
||||||
hvc_latch = 0x10000 | (v_counter << 8);
|
hvc_latch = 0x10000 | (v_counter << 8);
|
||||||
if (reg[12] & 1)
|
if (reg[12] & 1)
|
||||||
{
|
{
|
||||||
hvc_latch |= hc_320[((input.analog[port][0] * 290) / (2 * 320) + input.x_offset) % 210];
|
hvc_latch |= hc_320[((x / 2) + input.x_offset) % 210];
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
hvc_latch |= hc_256[(input.analog[port][0] / 2 + input.x_offset) % 171];
|
hvc_latch |= hc_256[((x / 2) + input.x_offset) % 171];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
172
source/loadrom.c
172
source/loadrom.c
@ -74,7 +74,7 @@
|
|||||||
#define PMOUSE 8192
|
#define PMOUSE 8192
|
||||||
|
|
||||||
#define MAXCOMPANY 64
|
#define MAXCOMPANY 64
|
||||||
#define MAXPERIPHERALS 14
|
#define MAXPERIPHERALS 15
|
||||||
|
|
||||||
typedef struct
|
typedef struct
|
||||||
{
|
{
|
||||||
@ -190,6 +190,7 @@ static const PERIPHERALINFO peripheralinfo[MAXPERIPHERALS] =
|
|||||||
{"V", "Paddle"},
|
{"V", "Paddle"},
|
||||||
{"C", "CD-ROM"},
|
{"C", "CD-ROM"},
|
||||||
{"M", "Mega Mouse"},
|
{"M", "Mega Mouse"},
|
||||||
|
{"G", "Menacer"},
|
||||||
};
|
};
|
||||||
|
|
||||||
/***************************************************************************
|
/***************************************************************************
|
||||||
@ -771,6 +772,175 @@ int load_rom(char *filename)
|
|||||||
input.system[1] = old_system[1];
|
input.system[1] = old_system[1];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* default gun settings */
|
||||||
|
input.x_offset = (input.system[1] == SYSTEM_MENACER) ? 64 : 0;
|
||||||
|
input.y_offset = 0;
|
||||||
|
|
||||||
|
/* autodetect gun support */
|
||||||
|
if (strstr(rominfo.international,"MENACER") != NULL)
|
||||||
|
{
|
||||||
|
/* save current setting */
|
||||||
|
if (old_system[0] == -1)
|
||||||
|
{
|
||||||
|
old_system[0] = input.system[0];
|
||||||
|
}
|
||||||
|
if (old_system[1] == -1)
|
||||||
|
{
|
||||||
|
old_system[1] = input.system[1];
|
||||||
|
}
|
||||||
|
|
||||||
|
/* force MENACER configuration */
|
||||||
|
input.system[0] = SYSTEM_MD_GAMEPAD;
|
||||||
|
input.system[1] = SYSTEM_MENACER;
|
||||||
|
input.x_offset = 82;
|
||||||
|
input.y_offset = 0;
|
||||||
|
}
|
||||||
|
else if (strstr(rominfo.international,"T2 ; THE ARCADE GAME") != NULL)
|
||||||
|
{
|
||||||
|
/* save current setting */
|
||||||
|
if (old_system[0] == -1)
|
||||||
|
{
|
||||||
|
old_system[0] = input.system[0];
|
||||||
|
}
|
||||||
|
if (old_system[1] == -1)
|
||||||
|
{
|
||||||
|
old_system[1] = input.system[1];
|
||||||
|
}
|
||||||
|
|
||||||
|
/* force MENACER configuration */
|
||||||
|
input.system[0] = SYSTEM_MD_GAMEPAD;
|
||||||
|
input.system[1] = SYSTEM_MENACER;
|
||||||
|
input.x_offset = 133;
|
||||||
|
input.y_offset = -8;
|
||||||
|
}
|
||||||
|
else if (strstr(rominfo.international,"BODY COUNT") != NULL)
|
||||||
|
{
|
||||||
|
/* save current setting */
|
||||||
|
if (old_system[0] == -1)
|
||||||
|
{
|
||||||
|
old_system[0] = input.system[0];
|
||||||
|
}
|
||||||
|
if (old_system[1] == -1)
|
||||||
|
{
|
||||||
|
old_system[1] = input.system[1];
|
||||||
|
}
|
||||||
|
|
||||||
|
/* force MOUSE+MENACER configuration */
|
||||||
|
input.system[0] = SYSTEM_MOUSE;
|
||||||
|
input.system[1] = SYSTEM_MENACER;
|
||||||
|
input.x_offset = 68;
|
||||||
|
input.y_offset = -24;
|
||||||
|
}
|
||||||
|
else if (strstr(rominfo.international,"CORPSE KILLER") != NULL)
|
||||||
|
{
|
||||||
|
/* save current setting */
|
||||||
|
if (old_system[0] == -1)
|
||||||
|
{
|
||||||
|
old_system[0] = input.system[0];
|
||||||
|
}
|
||||||
|
if (old_system[1] == -1)
|
||||||
|
{
|
||||||
|
old_system[1] = input.system[1];
|
||||||
|
}
|
||||||
|
|
||||||
|
/* force MENACER configuration */
|
||||||
|
input.system[0] = SYSTEM_MD_GAMEPAD;
|
||||||
|
input.system[1] = SYSTEM_MENACER;
|
||||||
|
input.x_offset = 64;
|
||||||
|
input.y_offset = -8;
|
||||||
|
}
|
||||||
|
else if (strstr(rominfo.international,"CRIME PATROL") != NULL)
|
||||||
|
{
|
||||||
|
/* save current setting */
|
||||||
|
if (old_system[0] == -1)
|
||||||
|
{
|
||||||
|
old_system[0] = input.system[0];
|
||||||
|
}
|
||||||
|
if (old_system[1] == -1)
|
||||||
|
{
|
||||||
|
old_system[1] = input.system[1];
|
||||||
|
}
|
||||||
|
|
||||||
|
/* force MENACER configuration */
|
||||||
|
input.system[0] = SYSTEM_MD_GAMEPAD;
|
||||||
|
input.system[1] = SYSTEM_MENACER;
|
||||||
|
input.x_offset = 61;
|
||||||
|
input.y_offset = 0;
|
||||||
|
}
|
||||||
|
else if (strstr(rominfo.international,"MAD DOG II THE LOST GOLD") != NULL)
|
||||||
|
{
|
||||||
|
/* save current setting */
|
||||||
|
if (old_system[0] == -1)
|
||||||
|
{
|
||||||
|
old_system[0] = input.system[0];
|
||||||
|
}
|
||||||
|
if (old_system[1] == -1)
|
||||||
|
{
|
||||||
|
old_system[1] = input.system[1];
|
||||||
|
}
|
||||||
|
|
||||||
|
/* force MENACER configuration */
|
||||||
|
input.system[0] = SYSTEM_MD_GAMEPAD;
|
||||||
|
input.system[1] = SYSTEM_MENACER;
|
||||||
|
input.x_offset = 70;
|
||||||
|
input.y_offset = 18;
|
||||||
|
}
|
||||||
|
else if (strstr(rominfo.international,"MAD DOG MCCREE") != NULL)
|
||||||
|
{
|
||||||
|
/* save current setting */
|
||||||
|
if (old_system[0] == -1)
|
||||||
|
{
|
||||||
|
old_system[0] = input.system[0];
|
||||||
|
}
|
||||||
|
if (old_system[1] == -1)
|
||||||
|
{
|
||||||
|
old_system[1] = input.system[1];
|
||||||
|
}
|
||||||
|
|
||||||
|
/* force MENACER configuration */
|
||||||
|
input.system[0] = SYSTEM_MD_GAMEPAD;
|
||||||
|
input.system[1] = SYSTEM_MENACER;
|
||||||
|
input.x_offset = 49;
|
||||||
|
input.y_offset = 0;
|
||||||
|
}
|
||||||
|
else if (strstr(rominfo.international,"WHO SHOT JOHNNY ROCK?") != NULL)
|
||||||
|
{
|
||||||
|
/* save current setting */
|
||||||
|
if (old_system[0] == -1)
|
||||||
|
{
|
||||||
|
old_system[0] = input.system[0];
|
||||||
|
}
|
||||||
|
if (old_system[1] == -1)
|
||||||
|
{
|
||||||
|
old_system[1] = input.system[1];
|
||||||
|
}
|
||||||
|
|
||||||
|
/* force MENACER configuration */
|
||||||
|
input.system[0] = SYSTEM_MD_GAMEPAD;
|
||||||
|
input.system[1] = SYSTEM_MENACER;
|
||||||
|
input.x_offset = 60;
|
||||||
|
input.y_offset = 30;
|
||||||
|
}
|
||||||
|
else if ((strstr(rominfo.international,"LETHAL ENFORCERS") != NULL) ||
|
||||||
|
(strstr(rominfo.international,"SNATCHER") != NULL))
|
||||||
|
{
|
||||||
|
/* save current setting */
|
||||||
|
if (old_system[0] == -1)
|
||||||
|
{
|
||||||
|
old_system[0] = input.system[0];
|
||||||
|
}
|
||||||
|
if (old_system[1] == -1)
|
||||||
|
{
|
||||||
|
old_system[1] = input.system[1];
|
||||||
|
}
|
||||||
|
|
||||||
|
/* force JUSTIFIER configuration */
|
||||||
|
input.system[0] = SYSTEM_MD_GAMEPAD;
|
||||||
|
input.system[1] = SYSTEM_JUSTIFIER;
|
||||||
|
input.x_offset = (strstr(rominfo.international,"GUN FIGHTERS") != NULL) ? 24 : 0;
|
||||||
|
input.y_offset = 0;
|
||||||
|
}
|
||||||
|
|
||||||
return(1);
|
return(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user