Merge pull request #23 from Oggom/master

Sync with main repo
This commit is contained in:
Twinaphex 2015-04-26 22:01:43 +02:00
commit 56d1471a35
5 changed files with 51 additions and 14 deletions

Binary file not shown.

View File

@ -1519,6 +1519,20 @@ void scd_reset(int hard)
m68k.memory_map[scd.cartridge.boot + 0x02].base = scd.prg_ram;
m68k.memory_map[scd.cartridge.boot + 0x03].base = scd.prg_ram + 0x10000;
/* allow access to PRG-RAM from MAIN-CPU */
m68k.memory_map[scd.cartridge.boot + 0x02].read8 = NULL;
m68k.memory_map[scd.cartridge.boot + 0x03].read8 = NULL;
m68k.memory_map[scd.cartridge.boot + 0x02].read16 = NULL;
m68k.memory_map[scd.cartridge.boot + 0x03].read16 = NULL;
m68k.memory_map[scd.cartridge.boot + 0x02].write8 = NULL;
m68k.memory_map[scd.cartridge.boot + 0x03].write8 = NULL;
m68k.memory_map[scd.cartridge.boot + 0x02].write16 = NULL;
m68k.memory_map[scd.cartridge.boot + 0x03].write16 = NULL;
zbank_memory_map[scd.cartridge.boot + 0x02].read = NULL;
zbank_memory_map[scd.cartridge.boot + 0x03].read = NULL;
zbank_memory_map[scd.cartridge.boot + 0x02].write = NULL;
zbank_memory_map[scd.cartridge.boot + 0x03].write = NULL;
/* reset & halt SUB-CPU */
s68k.cycles = 0;
s68k_pulse_reset();

View File

@ -735,19 +735,21 @@ int load_rom(char *filename)
/* try to load CD BOOTROM */
if (load_bios())
{
char *ptr;
char fname[256];
int len = strlen(filename);
/* boot from cartridge */
scd.cartridge.boot = 0x40;
/* automatically load associated .iso image */
strncpy(fname, filename, 256);
ptr = strchr(fname,'.');
if (ptr && (ptr < &fname[252]))
/* change ROM filename extension to .iso */
while (len && (filename[len-1] != '.')) len--;
if (len < 253)
{
strcpy(ptr+1,"iso");
strncpy(fname, filename, len);
strcpy(&fname[len], "iso");
}
/* automatically load associated .iso image */
cdd_load(fname, (char *)cdc.ram);
}
else

View File

@ -331,7 +331,7 @@ void z80_gg_port_w(unsigned int port, unsigned char data)
}
}
/* full address range is decoded by Game Gear I/O chip (fixes G-Loc) */
/* 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);

View File

@ -283,13 +283,6 @@ void osd_input_update(void)
input.analog[i][0] = ((input_state_cb(player, RETRO_DEVICE_POINTER, 0, RETRO_DEVICE_ID_POINTER_X) + 0x7fff) * bitmap.viewport.w) / 0xfffe;
input.analog[i][1] = ((input_state_cb(player, RETRO_DEVICE_POINTER, 0, RETRO_DEVICE_ID_POINTER_Y) + 0x7fff) * bitmap.viewport.h) / 0xfffe;
if (config.gun_cursor)
{
uint16_t *ptr = (uint16_t *)bitmap.data + ((bitmap.viewport.y + input.analog[i][1]) * bitmap.width) + input.analog[i][0] + bitmap.viewport.x;
ptr[-3*bitmap.width] = ptr[-bitmap.width] = ptr[bitmap.width] = ptr[3*bitmap.width] = ptr[-3] = ptr[-1] = ptr[1] = ptr[3] = (i & 1) ? 0xf800 : 0x001f;
ptr[-2*bitmap.width] = ptr[0] = ptr[2*bitmap.width] = ptr[-2] = ptr[2] = 0xffff;
}
if (input_state_cb(player, RETRO_DEVICE_LIGHTGUN, 0, RETRO_DEVICE_ID_LIGHTGUN_TRIGGER))
temp |= INPUT_A;
if (input_state_cb(player, RETRO_DEVICE_LIGHTGUN, 0, RETRO_DEVICE_ID_LIGHTGUN_TURBO))
@ -432,6 +425,13 @@ void osd_input_update(void)
}
}
static void draw_cursor(int16_t x, int16_t y, uint16_t color)
{
uint16_t *ptr = (uint16_t *)bitmap.data + ((bitmap.viewport.y + y) * bitmap.width) + x + bitmap.viewport.x;
ptr[-3*bitmap.width] = ptr[-bitmap.width] = ptr[bitmap.width] = ptr[3*bitmap.width] = ptr[-3] = ptr[-1] = ptr[1] = ptr[3] = color;
ptr[-2*bitmap.width] = ptr[2*bitmap.width] = ptr[-2] = ptr[2] = ptr[0] = 0xffff;
}
static void init_bitmap(void)
{
memset(&bitmap, 0, sizeof(bitmap));
@ -1880,6 +1880,27 @@ void retro_run(void)
}
}
if (config.gun_cursor)
{
if (input.system[0] == SYSTEM_LIGHTPHASER)
{
draw_cursor(input.analog[0][0], input.analog[0][1], 0x001f);
}
else if (input.dev[4] == DEVICE_LIGHTGUN)
{
draw_cursor(input.analog[4][0], input.analog[4][1], 0x001f);
}
if (input.system[1] == SYSTEM_LIGHTPHASER)
{
draw_cursor(input.analog[4][0], input.analog[4][1], 0xf800);
}
else if (input.dev[5] == DEVICE_LIGHTGUN)
{
draw_cursor(input.analog[5][0], input.analog[5][1], 0xf800);
}
}
video_cb(bitmap.data, vwidth, vheight, 720 * 2);
audio_cb(soundbuffer, audio_update(soundbuffer));