upgrade core to 1.57

This commit is contained in:
Daryl Borth 2018-11-11 18:31:52 -07:00
parent 2fc86568c5
commit 8b73ba1913
70 changed files with 3937 additions and 3238 deletions

View File

@ -17,13 +17,20 @@
(c) Copyright 2002 - 2010 Brad Jorsch (anomie@users.sourceforge.net), (c) Copyright 2002 - 2010 Brad Jorsch (anomie@users.sourceforge.net),
Nach (n-a-c-h@users.sourceforge.net), Nach (n-a-c-h@users.sourceforge.net),
zones (kasumitokoduck@yahoo.com)
(c) Copyright 2002 - 2011 zones (kasumitokoduck@yahoo.com)
(c) Copyright 2006 - 2007 nitsuja (c) Copyright 2006 - 2007 nitsuja
(c) Copyright 2009 - 2010 BearOso, (c) Copyright 2009 - 2018 BearOso,
OV2 OV2
(c) Copyright 2017 qwertymodo
(c) Copyright 2011 - 2017 Hans-Kristian Arntzen,
Daniel De Matteis
(Under no circumstances will commercial rights be given)
BS-X C emulator code BS-X C emulator code
(c) Copyright 2005 - 2006 Dreamer Nom, (c) Copyright 2005 - 2006 Dreamer Nom,
@ -117,6 +124,9 @@
Sound emulator code used in 1.52+ Sound emulator code used in 1.52+
(c) Copyright 2004 - 2007 Shay Green (gblargg@gmail.com) (c) Copyright 2004 - 2007 Shay Green (gblargg@gmail.com)
S-SMP emulator code used in 1.54+
(c) Copyright 2016 byuu
SH assembler code partly based on x86 assembler code SH assembler code partly based on x86 assembler code
(c) Copyright 2002 - 2004 Marcus Comstedt (marcus@mc.pp.se) (c) Copyright 2002 - 2004 Marcus Comstedt (marcus@mc.pp.se)
@ -130,7 +140,7 @@
(c) Copyright 2006 - 2007 Shay Green (c) Copyright 2006 - 2007 Shay Green
GTK+ GUI code GTK+ GUI code
(c) Copyright 2004 - 2010 BearOso (c) Copyright 2004 - 2018 BearOso
Win32 GUI code Win32 GUI code
(c) Copyright 2003 - 2006 blip, (c) Copyright 2003 - 2006 blip,
@ -138,11 +148,16 @@
Matthew Kendora, Matthew Kendora,
Nach, Nach,
nitsuja nitsuja
(c) Copyright 2009 - 2010 OV2 (c) Copyright 2009 - 2018 OV2
Mac OS GUI code Mac OS GUI code
(c) Copyright 1998 - 2001 John Stiles (c) Copyright 1998 - 2001 John Stiles
(c) Copyright 2001 - 2010 zones (c) Copyright 2001 - 2011 zones
Libretro port
(c) Copyright 2011 - 2017 Hans-Kristian Arntzen,
Daniel De Matteis
(Under no circumstances will commercial rights be given)
Specific ports contains the works of other authors. See headers in Specific ports contains the works of other authors. See headers in

View File

@ -17,13 +17,20 @@
(c) Copyright 2002 - 2010 Brad Jorsch (anomie@users.sourceforge.net), (c) Copyright 2002 - 2010 Brad Jorsch (anomie@users.sourceforge.net),
Nach (n-a-c-h@users.sourceforge.net), Nach (n-a-c-h@users.sourceforge.net),
zones (kasumitokoduck@yahoo.com)
(c) Copyright 2002 - 2011 zones (kasumitokoduck@yahoo.com)
(c) Copyright 2006 - 2007 nitsuja (c) Copyright 2006 - 2007 nitsuja
(c) Copyright 2009 - 2010 BearOso, (c) Copyright 2009 - 2018 BearOso,
OV2 OV2
(c) Copyright 2017 qwertymodo
(c) Copyright 2011 - 2017 Hans-Kristian Arntzen,
Daniel De Matteis
(Under no circumstances will commercial rights be given)
BS-X C emulator code BS-X C emulator code
(c) Copyright 2005 - 2006 Dreamer Nom, (c) Copyright 2005 - 2006 Dreamer Nom,
@ -117,6 +124,9 @@
Sound emulator code used in 1.52+ Sound emulator code used in 1.52+
(c) Copyright 2004 - 2007 Shay Green (gblargg@gmail.com) (c) Copyright 2004 - 2007 Shay Green (gblargg@gmail.com)
S-SMP emulator code used in 1.54+
(c) Copyright 2016 byuu
SH assembler code partly based on x86 assembler code SH assembler code partly based on x86 assembler code
(c) Copyright 2002 - 2004 Marcus Comstedt (marcus@mc.pp.se) (c) Copyright 2002 - 2004 Marcus Comstedt (marcus@mc.pp.se)
@ -130,7 +140,7 @@
(c) Copyright 2006 - 2007 Shay Green (c) Copyright 2006 - 2007 Shay Green
GTK+ GUI code GTK+ GUI code
(c) Copyright 2004 - 2010 BearOso (c) Copyright 2004 - 2018 BearOso
Win32 GUI code Win32 GUI code
(c) Copyright 2003 - 2006 blip, (c) Copyright 2003 - 2006 blip,
@ -138,11 +148,16 @@
Matthew Kendora, Matthew Kendora,
Nach, Nach,
nitsuja nitsuja
(c) Copyright 2009 - 2010 OV2 (c) Copyright 2009 - 2018 OV2
Mac OS GUI code Mac OS GUI code
(c) Copyright 1998 - 2001 John Stiles (c) Copyright 1998 - 2001 John Stiles
(c) Copyright 2001 - 2010 zones (c) Copyright 2001 - 2011 zones
Libretro port
(c) Copyright 2011 - 2017 Hans-Kristian Arntzen,
Daniel De Matteis
(Under no circumstances will commercial rights be given)
Specific ports contains the works of other authors. See headers in Specific ports contains the works of other authors. See headers in
@ -294,7 +309,6 @@ void C4Op1F (void)
{ {
tanval = (double) C41FYVal / C41FXVal; tanval = (double) C41FYVal / C41FXVal;
C41FAngleRes = (int16) (atan(tanval) / (C4_PI * 2) * 512); C41FAngleRes = (int16) (atan(tanval) / (C4_PI * 2) * 512);
C41FAngleRes = C41FAngleRes;
if (C41FXVal< 0) if (C41FXVal< 0)
C41FAngleRes += 0x100; C41FAngleRes += 0x100;
C41FAngleRes &= 0x1FF; C41FAngleRes &= 0x1FF;

View File

@ -17,13 +17,20 @@
(c) Copyright 2002 - 2010 Brad Jorsch (anomie@users.sourceforge.net), (c) Copyright 2002 - 2010 Brad Jorsch (anomie@users.sourceforge.net),
Nach (n-a-c-h@users.sourceforge.net), Nach (n-a-c-h@users.sourceforge.net),
zones (kasumitokoduck@yahoo.com)
(c) Copyright 2002 - 2011 zones (kasumitokoduck@yahoo.com)
(c) Copyright 2006 - 2007 nitsuja (c) Copyright 2006 - 2007 nitsuja
(c) Copyright 2009 - 2010 BearOso, (c) Copyright 2009 - 2018 BearOso,
OV2 OV2
(c) Copyright 2017 qwertymodo
(c) Copyright 2011 - 2017 Hans-Kristian Arntzen,
Daniel De Matteis
(Under no circumstances will commercial rights be given)
BS-X C emulator code BS-X C emulator code
(c) Copyright 2005 - 2006 Dreamer Nom, (c) Copyright 2005 - 2006 Dreamer Nom,
@ -117,6 +124,9 @@
Sound emulator code used in 1.52+ Sound emulator code used in 1.52+
(c) Copyright 2004 - 2007 Shay Green (gblargg@gmail.com) (c) Copyright 2004 - 2007 Shay Green (gblargg@gmail.com)
S-SMP emulator code used in 1.54+
(c) Copyright 2016 byuu
SH assembler code partly based on x86 assembler code SH assembler code partly based on x86 assembler code
(c) Copyright 2002 - 2004 Marcus Comstedt (marcus@mc.pp.se) (c) Copyright 2002 - 2004 Marcus Comstedt (marcus@mc.pp.se)
@ -130,7 +140,7 @@
(c) Copyright 2006 - 2007 Shay Green (c) Copyright 2006 - 2007 Shay Green
GTK+ GUI code GTK+ GUI code
(c) Copyright 2004 - 2010 BearOso (c) Copyright 2004 - 2018 BearOso
Win32 GUI code Win32 GUI code
(c) Copyright 2003 - 2006 blip, (c) Copyright 2003 - 2006 blip,
@ -138,11 +148,16 @@
Matthew Kendora, Matthew Kendora,
Nach, Nach,
nitsuja nitsuja
(c) Copyright 2009 - 2010 OV2 (c) Copyright 2009 - 2018 OV2
Mac OS GUI code Mac OS GUI code
(c) Copyright 1998 - 2001 John Stiles (c) Copyright 1998 - 2001 John Stiles
(c) Copyright 2001 - 2010 zones (c) Copyright 2001 - 2011 zones
Libretro port
(c) Copyright 2011 - 2017 Hans-Kristian Arntzen,
Daniel De Matteis
(Under no circumstances will commercial rights be given)
Specific ports contains the works of other authors. See headers in Specific ports contains the works of other authors. See headers in

View File

@ -17,13 +17,20 @@
(c) Copyright 2002 - 2010 Brad Jorsch (anomie@users.sourceforge.net), (c) Copyright 2002 - 2010 Brad Jorsch (anomie@users.sourceforge.net),
Nach (n-a-c-h@users.sourceforge.net), Nach (n-a-c-h@users.sourceforge.net),
zones (kasumitokoduck@yahoo.com)
(c) Copyright 2002 - 2011 zones (kasumitokoduck@yahoo.com)
(c) Copyright 2006 - 2007 nitsuja (c) Copyright 2006 - 2007 nitsuja
(c) Copyright 2009 - 2010 BearOso, (c) Copyright 2009 - 2018 BearOso,
OV2 OV2
(c) Copyright 2017 qwertymodo
(c) Copyright 2011 - 2017 Hans-Kristian Arntzen,
Daniel De Matteis
(Under no circumstances will commercial rights be given)
BS-X C emulator code BS-X C emulator code
(c) Copyright 2005 - 2006 Dreamer Nom, (c) Copyright 2005 - 2006 Dreamer Nom,
@ -117,6 +124,9 @@
Sound emulator code used in 1.52+ Sound emulator code used in 1.52+
(c) Copyright 2004 - 2007 Shay Green (gblargg@gmail.com) (c) Copyright 2004 - 2007 Shay Green (gblargg@gmail.com)
S-SMP emulator code used in 1.54+
(c) Copyright 2016 byuu
SH assembler code partly based on x86 assembler code SH assembler code partly based on x86 assembler code
(c) Copyright 2002 - 2004 Marcus Comstedt (marcus@mc.pp.se) (c) Copyright 2002 - 2004 Marcus Comstedt (marcus@mc.pp.se)
@ -130,7 +140,7 @@
(c) Copyright 2006 - 2007 Shay Green (c) Copyright 2006 - 2007 Shay Green
GTK+ GUI code GTK+ GUI code
(c) Copyright 2004 - 2010 BearOso (c) Copyright 2004 - 2018 BearOso
Win32 GUI code Win32 GUI code
(c) Copyright 2003 - 2006 blip, (c) Copyright 2003 - 2006 blip,
@ -138,11 +148,16 @@
Matthew Kendora, Matthew Kendora,
Nach, Nach,
nitsuja nitsuja
(c) Copyright 2009 - 2010 OV2 (c) Copyright 2009 - 2018 OV2
Mac OS GUI code Mac OS GUI code
(c) Copyright 1998 - 2001 John Stiles (c) Copyright 1998 - 2001 John Stiles
(c) Copyright 2001 - 2010 zones (c) Copyright 2001 - 2011 zones
Libretro port
(c) Copyright 2011 - 2017 Hans-Kristian Arntzen,
Daniel De Matteis
(Under no circumstances will commercial rights be given)
Specific ports contains the works of other authors. See headers in Specific ports contains the works of other authors. See headers in
@ -1192,10 +1207,11 @@ void S9xSetC4 (uint8 byte, uint16 Address)
if (Memory.C4RAM[0x1f4d] != 0x0e) if (Memory.C4RAM[0x1f4d] != 0x0e)
printf("$7f4d=%02x, expected 0e for command 54 %02x\n", Memory.C4RAM[0x1f4d], Memory.C4RAM[0x1f4d]); printf("$7f4d=%02x, expected 0e for command 54 %02x\n", Memory.C4RAM[0x1f4d], Memory.C4RAM[0x1f4d]);
#endif #endif
int64 a = SAR((int64) READ_3WORD(Memory.C4RAM + 0x1f80) << 40, 40); int64 b = (int64) READ_3WORD(Memory.C4RAM + 0x1f80);
//printf("%08X%08X\n", (uint32) (a>>32), (uint32) (a&0xFFFFFFFF)); int64 c = b << 40;
int64 a = SAR(c, 30);
a = SAR(c, 10);
a *= a; a *= a;
//printf("%08X%08X\n", (uint32) (a>>32), (uint32) (a&0xFFFFFFFF));
WRITE_3WORD(Memory.C4RAM + 0x1f83, a); WRITE_3WORD(Memory.C4RAM + 0x1f83, a);
WRITE_3WORD(Memory.C4RAM + 0x1f86, (a >> 24)); WRITE_3WORD(Memory.C4RAM + 0x1f86, (a >> 24));
break; break;

View File

@ -607,6 +607,7 @@ int S9xAddCheatGroup (const char *name, const char *cheat)
return -1; return -1;
Cheat.g.push_back (g); Cheat.g.push_back (g);
return Cheat.g.size () - 1; return Cheat.g.size () - 1;
} }

View File

@ -17,13 +17,20 @@
(c) Copyright 2002 - 2010 Brad Jorsch (anomie@users.sourceforge.net), (c) Copyright 2002 - 2010 Brad Jorsch (anomie@users.sourceforge.net),
Nach (n-a-c-h@users.sourceforge.net), Nach (n-a-c-h@users.sourceforge.net),
zones (kasumitokoduck@yahoo.com)
(c) Copyright 2002 - 2011 zones (kasumitokoduck@yahoo.com)
(c) Copyright 2006 - 2007 nitsuja (c) Copyright 2006 - 2007 nitsuja
(c) Copyright 2009 - 2010 BearOso, (c) Copyright 2009 - 2018 BearOso,
OV2 OV2
(c) Copyright 2017 qwertymodo
(c) Copyright 2011 - 2017 Hans-Kristian Arntzen,
Daniel De Matteis
(Under no circumstances will commercial rights be given)
BS-X C emulator code BS-X C emulator code
(c) Copyright 2005 - 2006 Dreamer Nom, (c) Copyright 2005 - 2006 Dreamer Nom,
@ -117,6 +124,9 @@
Sound emulator code used in 1.52+ Sound emulator code used in 1.52+
(c) Copyright 2004 - 2007 Shay Green (gblargg@gmail.com) (c) Copyright 2004 - 2007 Shay Green (gblargg@gmail.com)
S-SMP emulator code used in 1.54+
(c) Copyright 2016 byuu
SH assembler code partly based on x86 assembler code SH assembler code partly based on x86 assembler code
(c) Copyright 2002 - 2004 Marcus Comstedt (marcus@mc.pp.se) (c) Copyright 2002 - 2004 Marcus Comstedt (marcus@mc.pp.se)
@ -130,7 +140,7 @@
(c) Copyright 2006 - 2007 Shay Green (c) Copyright 2006 - 2007 Shay Green
GTK+ GUI code GTK+ GUI code
(c) Copyright 2004 - 2010 BearOso (c) Copyright 2004 - 2018 BearOso
Win32 GUI code Win32 GUI code
(c) Copyright 2003 - 2006 blip, (c) Copyright 2003 - 2006 blip,
@ -138,11 +148,16 @@
Matthew Kendora, Matthew Kendora,
Nach, Nach,
nitsuja nitsuja
(c) Copyright 2009 - 2010 OV2 (c) Copyright 2009 - 2018 OV2
Mac OS GUI code Mac OS GUI code
(c) Copyright 1998 - 2001 John Stiles (c) Copyright 1998 - 2001 John Stiles
(c) Copyright 2001 - 2010 zones (c) Copyright 2001 - 2011 zones
Libretro port
(c) Copyright 2011 - 2017 Hans-Kristian Arntzen,
Daniel De Matteis
(Under no circumstances will commercial rights be given)
Specific ports contains the works of other authors. See headers in Specific ports contains the works of other authors. See headers in

View File

@ -3085,6 +3085,16 @@ void S9xSetJoypadLatch (bool latch)
FLAG_LATCH = latch; FLAG_LATCH = latch;
} }
// prevent read_idx from overflowing (only latching resets it)
// otherwise $4016/7 reads will start returning input data again
static inline uint8 IncreaseReadIdxPost(uint8 &var)
{
uint8 oldval = var;
if (var < 255)
var++;
return oldval;
}
uint8 S9xReadJOYSERn (int n) uint8 S9xReadJOYSERn (int n)
{ {
int i, j, r; int i, j, r;
@ -3139,7 +3149,7 @@ uint8 S9xReadJOYSERn (int n)
switch (i = curcontrollers[n]) switch (i = curcontrollers[n])
{ {
case MP5: case MP5:
r = read_idx[n][FLAG_IOBIT(n) ? 0 : 1]++; r = IncreaseReadIdxPost(read_idx[n][FLAG_IOBIT(n) ? 0 : 1]);
j = FLAG_IOBIT(n) ? 0 : 2; j = FLAG_IOBIT(n) ? 0 : 2;
for (i = 0; i < 2; i++, j++) for (i = 0; i < 2; i++, j++)
@ -3164,64 +3174,64 @@ uint8 S9xReadJOYSERn (int n)
case JOYPAD7: case JOYPAD7:
if (read_idx[n][0] >= 16) if (read_idx[n][0] >= 16)
{ {
read_idx[n][0]++; IncreaseReadIdxPost(read_idx[n][0]);
return (bits | 1); return (bits | 1);
} }
else else
return (bits | ((joypad[i - JOYPAD0].buttons & (0x8000 >> read_idx[n][0]++)) ? 1 : 0)); return (bits | ((joypad[i - JOYPAD0].buttons & (0x8000 >> IncreaseReadIdxPost(read_idx[n][0]))) ? 1 : 0));
case MOUSE0: case MOUSE0:
case MOUSE1: case MOUSE1:
if (read_idx[n][0] < 8) if (read_idx[n][0] < 8)
{ {
read_idx[n][0]++; IncreaseReadIdxPost(read_idx[n][0]);
return (bits); return (bits);
} }
else else
if (read_idx[n][0] < 16) if (read_idx[n][0] < 16)
return (bits | ((mouse[i - MOUSE0].buttons & (0x8000 >> read_idx[n][0]++)) ? 1 : 0)); return (bits | ((mouse[i - MOUSE0].buttons & (0x8000 >> IncreaseReadIdxPost(read_idx[n][0]))) ? 1 : 0));
else else
if (read_idx[n][0] < 24) if (read_idx[n][0] < 24)
return (bits | ((mouse[i - MOUSE0].delta_y & (0x800000 >> read_idx[n][0]++)) ? 1 : 0)); return (bits | ((mouse[i - MOUSE0].delta_y & (0x800000 >> IncreaseReadIdxPost(read_idx[n][0]))) ? 1 : 0));
else else
if (read_idx[n][0] < 32) if (read_idx[n][0] < 32)
return (bits | ((mouse[i - MOUSE0].delta_x & (0x80000000 >> read_idx[n][0]++)) ? 1 : 0)); return (bits | ((mouse[i - MOUSE0].delta_x & (0x80000000 >> IncreaseReadIdxPost(read_idx[n][0]))) ? 1 : 0));
else else
{ {
read_idx[n][0]++; IncreaseReadIdxPost(read_idx[n][0]);
return (bits | 1); return (bits | 1);
} }
case SUPERSCOPE: case SUPERSCOPE:
if (read_idx[n][0] < 8) if (read_idx[n][0] < 8)
return (bits | ((superscope.read_buttons & (0x80 >> read_idx[n][0]++)) ? 1 : 0)); return (bits | ((superscope.read_buttons & (0x80 >> IncreaseReadIdxPost(read_idx[n][0]))) ? 1 : 0));
else else
{ {
read_idx[n][0]++; IncreaseReadIdxPost(read_idx[n][0]);
return (bits | 1); return (bits | 1);
} }
case ONE_JUSTIFIER: case ONE_JUSTIFIER:
if (read_idx[n][0] < 24) if (read_idx[n][0] < 24)
return (bits | ((0xaa7000 >> read_idx[n][0]++) & 1)); return (bits | ((0xaa7000 >> IncreaseReadIdxPost(read_idx[n][0])) & 1));
else else
if (read_idx[n][0] < 32) if (read_idx[n][0] < 32)
return (bits | ((justifier.buttons & (JUSTIFIER_TRIGGER | JUSTIFIER_START | JUSTIFIER_SELECT) & (0x80000000 >> read_idx[n][0]++)) ? 1 : 0)); return (bits | ((justifier.buttons & (JUSTIFIER_TRIGGER | JUSTIFIER_START | JUSTIFIER_SELECT) & (0x80000000 >> IncreaseReadIdxPost(read_idx[n][0]))) ? 1 : 0));
else else
{ {
read_idx[n][0]++; IncreaseReadIdxPost(read_idx[n][0]);
return (bits | 1); return (bits | 1);
} }
case TWO_JUSTIFIERS: case TWO_JUSTIFIERS:
if (read_idx[n][0] < 24) if (read_idx[n][0] < 24)
return (bits | ((0xaa7000 >> read_idx[n][0]++) & 1)); return (bits | ((0xaa7000 >> IncreaseReadIdxPost(read_idx[n][0])) & 1));
else else
if (read_idx[n][0] < 32) if (read_idx[n][0] < 32)
return (bits | ((justifier.buttons & (0x80000000 >> read_idx[n][0]++)) ? 1 : 0)); return (bits | ((justifier.buttons & (0x80000000 >> IncreaseReadIdxPost(read_idx[n][0]))) ? 1 : 0));
else else
{ {
read_idx[n][0]++; IncreaseReadIdxPost(read_idx[n][0]);
return (bits | 1); return (bits | 1);
} }
@ -3230,7 +3240,7 @@ uint8 S9xReadJOYSERn (int n)
return (bits | ((macsrifle.buttons & 0x01) ? 1 : 0)); return (bits | ((macsrifle.buttons & 0x01) ? 1 : 0));
default: default:
read_idx[n][0]++; IncreaseReadIdxPost(read_idx[n][0]);
return (bits); return (bits);
} }
} }
@ -3912,3 +3922,4 @@ void MovieSetMacsRifle (int i, uint8 in[5])
macsrifle.y = READ_WORD(ptr); ptr += 2; macsrifle.y = READ_WORD(ptr); ptr += 2;
macsrifle.buttons = *ptr; macsrifle.buttons = *ptr;
} }

View File

@ -289,7 +289,7 @@ void S9xReset (void)
memset(Memory.RAM, 0x55, 0x20000); memset(Memory.RAM, 0x55, 0x20000);
memset(Memory.VRAM, 0x00, 0x10000); memset(Memory.VRAM, 0x00, 0x10000);
ZeroMemory(Memory.FillRAM, 0x8000); memset(Memory.FillRAM, 0, 0x8000);
S9xResetBSX(); S9xResetBSX();
S9xResetCPU(); S9xResetCPU();
@ -324,7 +324,7 @@ void S9xSoftReset (void)
{ {
S9xResetSaveTimer(FALSE); S9xResetSaveTimer(FALSE);
ZeroMemory(Memory.FillRAM, 0x8000); memset(Memory.FillRAM, 0, 0x8000);
if (Settings.BS) if (Settings.BS)
S9xResetBSX(); S9xResetBSX();

View File

@ -17,13 +17,20 @@
(c) Copyright 2002 - 2010 Brad Jorsch (anomie@users.sourceforge.net), (c) Copyright 2002 - 2010 Brad Jorsch (anomie@users.sourceforge.net),
Nach (n-a-c-h@users.sourceforge.net), Nach (n-a-c-h@users.sourceforge.net),
zones (kasumitokoduck@yahoo.com)
(c) Copyright 2002 - 2011 zones (kasumitokoduck@yahoo.com)
(c) Copyright 2006 - 2007 nitsuja (c) Copyright 2006 - 2007 nitsuja
(c) Copyright 2009 - 2010 BearOso, (c) Copyright 2009 - 2018 BearOso,
OV2 OV2
(c) Copyright 2017 qwertymodo
(c) Copyright 2011 - 2017 Hans-Kristian Arntzen,
Daniel De Matteis
(Under no circumstances will commercial rights be given)
BS-X C emulator code BS-X C emulator code
(c) Copyright 2005 - 2006 Dreamer Nom, (c) Copyright 2005 - 2006 Dreamer Nom,
@ -117,6 +124,9 @@
Sound emulator code used in 1.52+ Sound emulator code used in 1.52+
(c) Copyright 2004 - 2007 Shay Green (gblargg@gmail.com) (c) Copyright 2004 - 2007 Shay Green (gblargg@gmail.com)
S-SMP emulator code used in 1.54+
(c) Copyright 2016 byuu
SH assembler code partly based on x86 assembler code SH assembler code partly based on x86 assembler code
(c) Copyright 2002 - 2004 Marcus Comstedt (marcus@mc.pp.se) (c) Copyright 2002 - 2004 Marcus Comstedt (marcus@mc.pp.se)
@ -130,7 +140,7 @@
(c) Copyright 2006 - 2007 Shay Green (c) Copyright 2006 - 2007 Shay Green
GTK+ GUI code GTK+ GUI code
(c) Copyright 2004 - 2010 BearOso (c) Copyright 2004 - 2018 BearOso
Win32 GUI code Win32 GUI code
(c) Copyright 2003 - 2006 blip, (c) Copyright 2003 - 2006 blip,
@ -138,11 +148,16 @@
Matthew Kendora, Matthew Kendora,
Nach, Nach,
nitsuja nitsuja
(c) Copyright 2009 - 2010 OV2 (c) Copyright 2009 - 2018 OV2
Mac OS GUI code Mac OS GUI code
(c) Copyright 1998 - 2001 John Stiles (c) Copyright 1998 - 2001 John Stiles
(c) Copyright 2001 - 2010 zones (c) Copyright 2001 - 2011 zones
Libretro port
(c) Copyright 2011 - 2017 Hans-Kristian Arntzen,
Daniel De Matteis
(Under no circumstances will commercial rights be given)
Specific ports contains the works of other authors. See headers in Specific ports contains the works of other authors. See headers in
@ -287,6 +302,8 @@ static inline uint32 AbsoluteIndexedIndirectSlow (AccessMode a) // (a,X)
static inline uint32 AbsoluteIndexedIndirect (AccessMode a) // (a,X) static inline uint32 AbsoluteIndexedIndirect (AccessMode a) // (a,X)
{ {
uint16 addr = Immediate16Slow(READ); uint16 addr = Immediate16Slow(READ);
AddCycles(ONE_CYCLE);
addr += Registers.X.W; addr += Registers.X.W;
// Address load wraps within the bank // Address load wraps within the bank

View File

@ -315,57 +315,40 @@ static inline void ADC (uint16 Work16)
{ {
if (CheckDecimal()) if (CheckDecimal())
{ {
uint16 A1 = Registers.A.W & 0x000F; uint32 result;
uint16 A2 = Registers.A.W & 0x00F0; uint32 carry = CheckCarry();
uint16 A3 = Registers.A.W & 0x0F00;
uint32 A4 = Registers.A.W & 0xF000;
uint16 W1 = Work16 & 0x000F;
uint16 W2 = Work16 & 0x00F0;
uint16 W3 = Work16 & 0x0F00;
uint16 W4 = Work16 & 0xF000;
A1 += W1 + CheckCarry(); result = (Registers.A.W & 0x000F) + (Work16 & 0x000F) + carry;
if (A1 > 0x0009) if (result > 0x0009)
{ result += 0x0006;
A1 -= 0x000A; carry = (result > 0x000F);
A1 &= 0x000F;
A2 += 0x0010;
}
A2 += W2; result = (Registers.A.W & 0x00F0) + (Work16 & 0x00F0) + (result & 0x000F) + carry * 0x10;
if (A2 > 0x0090) if (result > 0x009F)
{ result += 0x0060;
A2 -= 0x00A0; carry = (result > 0x00FF);
A2 &= 0x00F0;
A3 += 0x0100;
}
A3 += W3; result = (Registers.A.W & 0x0F00) + (Work16 & 0x0F00) + (result & 0x00FF) + carry * 0x100;
if (A3 > 0x0900) if (result > 0x09FF)
{ result += 0x0600;
A3 -= 0x0A00; carry = (result > 0x0FFF);
A3 &= 0x0F00;
A4 += 0x1000;
}
A4 += W4; result = (Registers.A.W & 0xF000) + (Work16 & 0xF000) + (result & 0x0FFF) + carry * 0x1000;
if (A4 > 0x9000)
{
A4 -= 0xA000;
A4 &= 0xF000;
SetCarry();
}
else
ClearCarry();
uint16 Ans16 = A4 | A3 | A2 | A1; if ((Registers.A.W & 0x8000) == (Work16 & 0x8000) && (Registers.A.W & 0x8000) != (result & 0x8000))
if (~(Registers.A.W ^ Work16) & (Work16 ^ Ans16) & 0x8000)
SetOverflow(); SetOverflow();
else else
ClearOverflow(); ClearOverflow();
Registers.A.W = Ans16; if (result > 0x9FFF)
result += 0x6000;
if (result > 0xFFFF)
SetCarry();
else
ClearCarry();
Registers.A.W = result & 0xFFFF;
SetZN(Registers.A.W); SetZN(Registers.A.W);
} }
else else
@ -388,37 +371,30 @@ static inline void ADC (uint8 Work8)
{ {
if (CheckDecimal()) if (CheckDecimal())
{ {
uint8 A1 = Registers.A.W & 0x0F; uint32 result;
uint16 A2 = Registers.A.W & 0xF0; uint32 carry = CheckCarry();
uint8 W1 = Work8 & 0x0F;
uint8 W2 = Work8 & 0xF0;
A1 += W1 + CheckCarry(); result = (Registers.AL & 0x0F) + (Work8 & 0x0F) + carry;
if (A1 > 0x09) if ( result > 0x09 )
{ result += 0x06;
A1 -= 0x0A; carry = (result > 0x0F);
A1 &= 0x0F;
A2 += 0x10;
}
A2 += W2; result = (Registers.AL & 0xF0) + (Work8 & 0xF0) + (result & 0x0F) + (carry * 0x10);
if (A2 > 0x90)
{
A2 -= 0xA0;
A2 &= 0xF0;
SetCarry();
}
else
ClearCarry();
uint8 Ans8 = A2 | A1; if ((Registers.AL & 0x80) == (Work8 & 0x80) && (Registers.AL & 0x80) != (result & 0x80))
if (~(Registers.AL ^ Work8) & (Work8 ^ Ans8) & 0x80)
SetOverflow(); SetOverflow();
else else
ClearOverflow(); ClearOverflow();
Registers.AL = Ans8; if (result > 0x9F)
result += 0x60;
if (result > 0xFF)
SetCarry();
else
ClearCarry();
Registers.AL = result & 0xFF;
SetZN(Registers.AL); SetZN(Registers.AL);
} }
else else
@ -691,58 +667,42 @@ static inline void SBC (uint16 Work16)
{ {
if (CheckDecimal()) if (CheckDecimal())
{ {
uint16 A1 = Registers.A.W & 0x000F; int result;
uint16 A2 = Registers.A.W & 0x00F0; int carry = CheckCarry();
uint16 A3 = Registers.A.W & 0x0F00;
uint32 A4 = Registers.A.W & 0xF000;
uint16 W1 = Work16 & 0x000F;
uint16 W2 = Work16 & 0x00F0;
uint16 W3 = Work16 & 0x0F00;
uint16 W4 = Work16 & 0xF000;
A1 -= W1 + !CheckCarry(); Work16 ^= 0xFFFF;
A2 -= W2;
A3 -= W3;
A4 -= W4;
if (A1 > 0x000F) result = (Registers.A.W & 0x000F) + (Work16 & 0x000F) + carry;
{ if (result < 0x0010)
A1 += 0x000A; result -= 0x0006;
A1 &= 0x000F; carry = (result > 0x000F);
A2 -= 0x0010;
}
if (A2 > 0x00F0) result = (Registers.A.W & 0x00F0) + (Work16 & 0x00F0) + (result & 0x000F) + carry * 0x10;
{ if (result < 0x0100)
A2 += 0x00A0; result -= 0x0060;
A2 &= 0x00F0; carry = (result > 0x00FF);
A3 -= 0x0100;
}
if (A3 > 0x0F00) result = (Registers.A.W & 0x0F00) + (Work16 & 0x0F00) + (result & 0x00FF) + carry * 0x100;
{ if (result < 0x1000)
A3 += 0x0A00; result -= 0x0600;
A3 &= 0x0F00; carry = (result > 0x0FFF);
A4 -= 0x1000;
}
if (A4 > 0xF000) result = (Registers.A.W & 0xF000) + (Work16 & 0xF000) + (result & 0x0FFF) + carry * 0x1000;
{
A4 += 0xA000;
A4 &= 0xF000;
ClearCarry();
}
else
SetCarry();
uint16 Ans16 = A4 | A3 | A2 | A1; if (((Registers.A.W ^ Work16) & 0x8000) == 0 && ((Registers.A.W ^ result) & 0x8000))
if ((Registers.A.W ^ Work16) & (Registers.A.W ^ Ans16) & 0x8000)
SetOverflow(); SetOverflow();
else else
ClearOverflow(); ClearOverflow();
Registers.A.W = Ans16; if (result < 0x10000)
result -= 0x6000;
if (result > 0xFFFF)
SetCarry();
else
ClearCarry();
Registers.A.W = result & 0xFFFF;
SetZN(Registers.A.W); SetZN(Registers.A.W);
} }
else else
@ -765,38 +725,32 @@ static inline void SBC (uint8 Work8)
{ {
if (CheckDecimal()) if (CheckDecimal())
{ {
uint8 A1 = Registers.A.W & 0x0F; int result;
uint16 A2 = Registers.A.W & 0xF0; int carry = CheckCarry();
uint8 W1 = Work8 & 0x0F;
uint8 W2 = Work8 & 0xF0;
A1 -= W1 + !CheckCarry(); Work8 ^= 0xFF;
A2 -= W2;
if (A1 > 0x0F) result = (Registers.AL & 0x0F) + (Work8 & 0x0F) + carry;
{ if (result < 0x10)
A1 += 0x0A; result -= 0x06;
A1 &= 0x0F; carry = (result > 0x0F);
A2 -= 0x10;
}
if (A2 > 0xF0) result = (Registers.AL & 0xF0) + (Work8 & 0xF0) + (result & 0x0F) + carry * 0x10;
{
A2 += 0xA0;
A2 &= 0xF0;
ClearCarry();
}
else
SetCarry();
uint8 Ans8 = A2 | A1; if ((Registers.AL & 0x80) == (Work8 & 0x80) && (Registers.AL & 0x80) != (result & 0x80))
if ((Registers.AL ^ Work8) & (Registers.AL ^ Ans8) & 0x80)
SetOverflow(); SetOverflow();
else else
ClearOverflow(); ClearOverflow();
Registers.AL = Ans8; if (result < 0x100 )
result -= 0x60;
if (result > 0xFF)
SetCarry();
else
ClearCarry();
Registers.AL = result & 0xFF;
SetZN(Registers.AL); SetZN(Registers.AL);
} }
else else

View File

@ -17,13 +17,20 @@
(c) Copyright 2002 - 2010 Brad Jorsch (anomie@users.sourceforge.net), (c) Copyright 2002 - 2010 Brad Jorsch (anomie@users.sourceforge.net),
Nach (n-a-c-h@users.sourceforge.net), Nach (n-a-c-h@users.sourceforge.net),
zones (kasumitokoduck@yahoo.com)
(c) Copyright 2002 - 2011 zones (kasumitokoduck@yahoo.com)
(c) Copyright 2006 - 2007 nitsuja (c) Copyright 2006 - 2007 nitsuja
(c) Copyright 2009 - 2010 BearOso, (c) Copyright 2009 - 2018 BearOso,
OV2 OV2
(c) Copyright 2017 qwertymodo
(c) Copyright 2011 - 2017 Hans-Kristian Arntzen,
Daniel De Matteis
(Under no circumstances will commercial rights be given)
BS-X C emulator code BS-X C emulator code
(c) Copyright 2005 - 2006 Dreamer Nom, (c) Copyright 2005 - 2006 Dreamer Nom,
@ -117,6 +124,9 @@
Sound emulator code used in 1.52+ Sound emulator code used in 1.52+
(c) Copyright 2004 - 2007 Shay Green (gblargg@gmail.com) (c) Copyright 2004 - 2007 Shay Green (gblargg@gmail.com)
S-SMP emulator code used in 1.54+
(c) Copyright 2016 byuu
SH assembler code partly based on x86 assembler code SH assembler code partly based on x86 assembler code
(c) Copyright 2002 - 2004 Marcus Comstedt (marcus@mc.pp.se) (c) Copyright 2002 - 2004 Marcus Comstedt (marcus@mc.pp.se)
@ -130,7 +140,7 @@
(c) Copyright 2006 - 2007 Shay Green (c) Copyright 2006 - 2007 Shay Green
GTK+ GUI code GTK+ GUI code
(c) Copyright 2004 - 2010 BearOso (c) Copyright 2004 - 2018 BearOso
Win32 GUI code Win32 GUI code
(c) Copyright 2003 - 2006 blip, (c) Copyright 2003 - 2006 blip,
@ -138,11 +148,16 @@
Matthew Kendora, Matthew Kendora,
Nach, Nach,
nitsuja nitsuja
(c) Copyright 2009 - 2010 OV2 (c) Copyright 2009 - 2018 OV2
Mac OS GUI code Mac OS GUI code
(c) Copyright 1998 - 2001 John Stiles (c) Copyright 1998 - 2001 John Stiles
(c) Copyright 2001 - 2010 zones (c) Copyright 2001 - 2011 zones
Libretro port
(c) Copyright 2011 - 2017 Hans-Kristian Arntzen,
Daniel De Matteis
(Under no circumstances will commercial rights be given)
Specific ports contains the works of other authors. See headers in Specific ports contains the works of other authors. See headers in

View File

@ -17,13 +17,20 @@
(c) Copyright 2002 - 2010 Brad Jorsch (anomie@users.sourceforge.net), (c) Copyright 2002 - 2010 Brad Jorsch (anomie@users.sourceforge.net),
Nach (n-a-c-h@users.sourceforge.net), Nach (n-a-c-h@users.sourceforge.net),
zones (kasumitokoduck@yahoo.com)
(c) Copyright 2002 - 2011 zones (kasumitokoduck@yahoo.com)
(c) Copyright 2006 - 2007 nitsuja (c) Copyright 2006 - 2007 nitsuja
(c) Copyright 2009 - 2010 BearOso, (c) Copyright 2009 - 2018 BearOso,
OV2 OV2
(c) Copyright 2017 qwertymodo
(c) Copyright 2011 - 2017 Hans-Kristian Arntzen,
Daniel De Matteis
(Under no circumstances will commercial rights be given)
BS-X C emulator code BS-X C emulator code
(c) Copyright 2005 - 2006 Dreamer Nom, (c) Copyright 2005 - 2006 Dreamer Nom,
@ -117,6 +124,9 @@
Sound emulator code used in 1.52+ Sound emulator code used in 1.52+
(c) Copyright 2004 - 2007 Shay Green (gblargg@gmail.com) (c) Copyright 2004 - 2007 Shay Green (gblargg@gmail.com)
S-SMP emulator code used in 1.54+
(c) Copyright 2016 byuu
SH assembler code partly based on x86 assembler code SH assembler code partly based on x86 assembler code
(c) Copyright 2002 - 2004 Marcus Comstedt (marcus@mc.pp.se) (c) Copyright 2002 - 2004 Marcus Comstedt (marcus@mc.pp.se)
@ -130,7 +140,7 @@
(c) Copyright 2006 - 2007 Shay Green (c) Copyright 2006 - 2007 Shay Green
GTK+ GUI code GTK+ GUI code
(c) Copyright 2004 - 2010 BearOso (c) Copyright 2004 - 2018 BearOso
Win32 GUI code Win32 GUI code
(c) Copyright 2003 - 2006 blip, (c) Copyright 2003 - 2006 blip,
@ -138,11 +148,16 @@
Matthew Kendora, Matthew Kendora,
Nach, Nach,
nitsuja nitsuja
(c) Copyright 2009 - 2010 OV2 (c) Copyright 2009 - 2018 OV2
Mac OS GUI code Mac OS GUI code
(c) Copyright 1998 - 2001 John Stiles (c) Copyright 1998 - 2001 John Stiles
(c) Copyright 2001 - 2010 zones (c) Copyright 2001 - 2011 zones
Libretro port
(c) Copyright 2011 - 2017 Hans-Kristian Arntzen,
Daniel De Matteis
(Under no circumstances will commercial rights be given)
Specific ports contains the works of other authors. See headers in Specific ports contains the works of other authors. See headers in

View File

@ -17,13 +17,20 @@
(c) Copyright 2002 - 2010 Brad Jorsch (anomie@users.sourceforge.net), (c) Copyright 2002 - 2010 Brad Jorsch (anomie@users.sourceforge.net),
Nach (n-a-c-h@users.sourceforge.net), Nach (n-a-c-h@users.sourceforge.net),
zones (kasumitokoduck@yahoo.com)
(c) Copyright 2002 - 2011 zones (kasumitokoduck@yahoo.com)
(c) Copyright 2006 - 2007 nitsuja (c) Copyright 2006 - 2007 nitsuja
(c) Copyright 2009 - 2010 BearOso, (c) Copyright 2009 - 2018 BearOso,
OV2 OV2
(c) Copyright 2017 qwertymodo
(c) Copyright 2011 - 2017 Hans-Kristian Arntzen,
Daniel De Matteis
(Under no circumstances will commercial rights be given)
BS-X C emulator code BS-X C emulator code
(c) Copyright 2005 - 2006 Dreamer Nom, (c) Copyright 2005 - 2006 Dreamer Nom,
@ -117,6 +124,9 @@
Sound emulator code used in 1.52+ Sound emulator code used in 1.52+
(c) Copyright 2004 - 2007 Shay Green (gblargg@gmail.com) (c) Copyright 2004 - 2007 Shay Green (gblargg@gmail.com)
S-SMP emulator code used in 1.54+
(c) Copyright 2016 byuu
SH assembler code partly based on x86 assembler code SH assembler code partly based on x86 assembler code
(c) Copyright 2002 - 2004 Marcus Comstedt (marcus@mc.pp.se) (c) Copyright 2002 - 2004 Marcus Comstedt (marcus@mc.pp.se)
@ -130,7 +140,7 @@
(c) Copyright 2006 - 2007 Shay Green (c) Copyright 2006 - 2007 Shay Green
GTK+ GUI code GTK+ GUI code
(c) Copyright 2004 - 2010 BearOso (c) Copyright 2004 - 2018 BearOso
Win32 GUI code Win32 GUI code
(c) Copyright 2003 - 2006 blip, (c) Copyright 2003 - 2006 blip,
@ -138,11 +148,16 @@
Matthew Kendora, Matthew Kendora,
Nach, Nach,
nitsuja nitsuja
(c) Copyright 2009 - 2010 OV2 (c) Copyright 2009 - 2018 OV2
Mac OS GUI code Mac OS GUI code
(c) Copyright 1998 - 2001 John Stiles (c) Copyright 1998 - 2001 John Stiles
(c) Copyright 2001 - 2010 zones (c) Copyright 2001 - 2011 zones
Libretro port
(c) Copyright 2011 - 2017 Hans-Kristian Arntzen,
Daniel De Matteis
(Under no circumstances will commercial rights be given)
Specific ports contains the works of other authors. See headers in Specific ports contains the works of other authors. See headers in

View File

@ -17,13 +17,20 @@
(c) Copyright 2002 - 2010 Brad Jorsch (anomie@users.sourceforge.net), (c) Copyright 2002 - 2010 Brad Jorsch (anomie@users.sourceforge.net),
Nach (n-a-c-h@users.sourceforge.net), Nach (n-a-c-h@users.sourceforge.net),
zones (kasumitokoduck@yahoo.com)
(c) Copyright 2002 - 2011 zones (kasumitokoduck@yahoo.com)
(c) Copyright 2006 - 2007 nitsuja (c) Copyright 2006 - 2007 nitsuja
(c) Copyright 2009 - 2010 BearOso, (c) Copyright 2009 - 2018 BearOso,
OV2 OV2
(c) Copyright 2017 qwertymodo
(c) Copyright 2011 - 2017 Hans-Kristian Arntzen,
Daniel De Matteis
(Under no circumstances will commercial rights be given)
BS-X C emulator code BS-X C emulator code
(c) Copyright 2005 - 2006 Dreamer Nom, (c) Copyright 2005 - 2006 Dreamer Nom,
@ -117,6 +124,9 @@
Sound emulator code used in 1.52+ Sound emulator code used in 1.52+
(c) Copyright 2004 - 2007 Shay Green (gblargg@gmail.com) (c) Copyright 2004 - 2007 Shay Green (gblargg@gmail.com)
S-SMP emulator code used in 1.54+
(c) Copyright 2016 byuu
SH assembler code partly based on x86 assembler code SH assembler code partly based on x86 assembler code
(c) Copyright 2002 - 2004 Marcus Comstedt (marcus@mc.pp.se) (c) Copyright 2002 - 2004 Marcus Comstedt (marcus@mc.pp.se)
@ -130,7 +140,7 @@
(c) Copyright 2006 - 2007 Shay Green (c) Copyright 2006 - 2007 Shay Green
GTK+ GUI code GTK+ GUI code
(c) Copyright 2004 - 2010 BearOso (c) Copyright 2004 - 2018 BearOso
Win32 GUI code Win32 GUI code
(c) Copyright 2003 - 2006 blip, (c) Copyright 2003 - 2006 blip,
@ -138,11 +148,16 @@
Matthew Kendora, Matthew Kendora,
Nach, Nach,
nitsuja nitsuja
(c) Copyright 2009 - 2010 OV2 (c) Copyright 2009 - 2018 OV2
Mac OS GUI code Mac OS GUI code
(c) Copyright 1998 - 2001 John Stiles (c) Copyright 1998 - 2001 John Stiles
(c) Copyright 2001 - 2010 zones (c) Copyright 2001 - 2011 zones
Libretro port
(c) Copyright 2011 - 2017 Hans-Kristian Arntzen,
Daniel De Matteis
(Under no circumstances will commercial rights be given)
Specific ports contains the works of other authors. See headers in Specific ports contains the works of other authors. See headers in
@ -881,9 +896,9 @@ static void DSP1_Project (int16 X, int16 Y, int16 Z, int16 *H, int16 *V, int16 *
Py = DSP1_ShiftR(Py, E - refE); Py = DSP1_ShiftR(Py, E - refE);
Pz = DSP1_ShiftR(Pz, E3 - refE); Pz = DSP1_ShiftR(Pz, E3 - refE);
C11 =- (Px * DSP1.Nx >> 15); C11 = -(Px * DSP1.Nx >> 15);
C8 =- (Py * DSP1.Ny >> 15); C8 = -(Py * DSP1.Ny >> 15);
C9 =- (Pz * DSP1.Nz >> 15); C9 = -(Pz * DSP1.Nz >> 15);
C12 = C11 + C8 + C9; // this cannot overflow! C12 = C11 + C8 + C9; // this cannot overflow!
aux4 = C12; // de-normalization with 32-bits arithmetic aux4 = C12; // de-normalization with 32-bits arithmetic
@ -1354,7 +1369,7 @@ void DSP1SetByte (uint8 byte, uint16 address)
case 0x17: case 0x17:
case 0x37: case 0x37:
case 0x3F: case 0x3F:
DSP1.command = 0x1f; DSP1.command = 0x1f; // Fall through
case 0x1f: DSP1.in_count = 1; break; case 0x1f: DSP1.in_count = 1; break;
default: default:
#ifdef DEBUGGER #ifdef DEBUGGER
@ -1885,7 +1900,7 @@ uint8 DSP1GetByte (uint16 address)
DSP1.waiting4command = TRUE; DSP1.waiting4command = TRUE;
} }
else else
t = 0xff; t = 0x80;
} }
else else
t = 0x80; t = 0x80;

View File

@ -17,13 +17,20 @@
(c) Copyright 2002 - 2010 Brad Jorsch (anomie@users.sourceforge.net), (c) Copyright 2002 - 2010 Brad Jorsch (anomie@users.sourceforge.net),
Nach (n-a-c-h@users.sourceforge.net), Nach (n-a-c-h@users.sourceforge.net),
zones (kasumitokoduck@yahoo.com)
(c) Copyright 2002 - 2011 zones (kasumitokoduck@yahoo.com)
(c) Copyright 2006 - 2007 nitsuja (c) Copyright 2006 - 2007 nitsuja
(c) Copyright 2009 - 2010 BearOso, (c) Copyright 2009 - 2018 BearOso,
OV2 OV2
(c) Copyright 2017 qwertymodo
(c) Copyright 2011 - 2017 Hans-Kristian Arntzen,
Daniel De Matteis
(Under no circumstances will commercial rights be given)
BS-X C emulator code BS-X C emulator code
(c) Copyright 2005 - 2006 Dreamer Nom, (c) Copyright 2005 - 2006 Dreamer Nom,
@ -117,6 +124,9 @@
Sound emulator code used in 1.52+ Sound emulator code used in 1.52+
(c) Copyright 2004 - 2007 Shay Green (gblargg@gmail.com) (c) Copyright 2004 - 2007 Shay Green (gblargg@gmail.com)
S-SMP emulator code used in 1.54+
(c) Copyright 2016 byuu
SH assembler code partly based on x86 assembler code SH assembler code partly based on x86 assembler code
(c) Copyright 2002 - 2004 Marcus Comstedt (marcus@mc.pp.se) (c) Copyright 2002 - 2004 Marcus Comstedt (marcus@mc.pp.se)
@ -130,7 +140,7 @@
(c) Copyright 2006 - 2007 Shay Green (c) Copyright 2006 - 2007 Shay Green
GTK+ GUI code GTK+ GUI code
(c) Copyright 2004 - 2010 BearOso (c) Copyright 2004 - 2018 BearOso
Win32 GUI code Win32 GUI code
(c) Copyright 2003 - 2006 blip, (c) Copyright 2003 - 2006 blip,
@ -138,11 +148,16 @@
Matthew Kendora, Matthew Kendora,
Nach, Nach,
nitsuja nitsuja
(c) Copyright 2009 - 2010 OV2 (c) Copyright 2009 - 2018 OV2
Mac OS GUI code Mac OS GUI code
(c) Copyright 1998 - 2001 John Stiles (c) Copyright 1998 - 2001 John Stiles
(c) Copyright 2001 - 2010 zones (c) Copyright 2001 - 2011 zones
Libretro port
(c) Copyright 2011 - 2017 Hans-Kristian Arntzen,
Daniel De Matteis
(Under no circumstances will commercial rights be given)
Specific ports contains the works of other authors. See headers in Specific ports contains the works of other authors. See headers in

View File

@ -17,13 +17,20 @@
(c) Copyright 2002 - 2010 Brad Jorsch (anomie@users.sourceforge.net), (c) Copyright 2002 - 2010 Brad Jorsch (anomie@users.sourceforge.net),
Nach (n-a-c-h@users.sourceforge.net), Nach (n-a-c-h@users.sourceforge.net),
zones (kasumitokoduck@yahoo.com)
(c) Copyright 2002 - 2011 zones (kasumitokoduck@yahoo.com)
(c) Copyright 2006 - 2007 nitsuja (c) Copyright 2006 - 2007 nitsuja
(c) Copyright 2009 - 2010 BearOso, (c) Copyright 2009 - 2018 BearOso,
OV2 OV2
(c) Copyright 2017 qwertymodo
(c) Copyright 2011 - 2017 Hans-Kristian Arntzen,
Daniel De Matteis
(Under no circumstances will commercial rights be given)
BS-X C emulator code BS-X C emulator code
(c) Copyright 2005 - 2006 Dreamer Nom, (c) Copyright 2005 - 2006 Dreamer Nom,
@ -117,6 +124,9 @@
Sound emulator code used in 1.52+ Sound emulator code used in 1.52+
(c) Copyright 2004 - 2007 Shay Green (gblargg@gmail.com) (c) Copyright 2004 - 2007 Shay Green (gblargg@gmail.com)
S-SMP emulator code used in 1.54+
(c) Copyright 2016 byuu
SH assembler code partly based on x86 assembler code SH assembler code partly based on x86 assembler code
(c) Copyright 2002 - 2004 Marcus Comstedt (marcus@mc.pp.se) (c) Copyright 2002 - 2004 Marcus Comstedt (marcus@mc.pp.se)
@ -130,7 +140,7 @@
(c) Copyright 2006 - 2007 Shay Green (c) Copyright 2006 - 2007 Shay Green
GTK+ GUI code GTK+ GUI code
(c) Copyright 2004 - 2010 BearOso (c) Copyright 2004 - 2018 BearOso
Win32 GUI code Win32 GUI code
(c) Copyright 2003 - 2006 blip, (c) Copyright 2003 - 2006 blip,
@ -138,11 +148,16 @@
Matthew Kendora, Matthew Kendora,
Nach, Nach,
nitsuja nitsuja
(c) Copyright 2009 - 2010 OV2 (c) Copyright 2009 - 2018 OV2
Mac OS GUI code Mac OS GUI code
(c) Copyright 1998 - 2001 John Stiles (c) Copyright 1998 - 2001 John Stiles
(c) Copyright 2001 - 2010 zones (c) Copyright 2001 - 2011 zones
Libretro port
(c) Copyright 2011 - 2017 Hans-Kristian Arntzen,
Daniel De Matteis
(Under no circumstances will commercial rights be given)
Specific ports contains the works of other authors. See headers in Specific ports contains the works of other authors. See headers in
@ -1139,7 +1154,7 @@ static void DSP3_OP10 (void)
DSP3_Reset(); DSP3_Reset();
else else
// absorb 2 bytes // absorb 2 bytes
DSP3.DR = DSP3.DR; DSP3.DR = DSP3.DR; // FIXME?
} }
/* /*

View File

@ -17,13 +17,20 @@
(c) Copyright 2002 - 2010 Brad Jorsch (anomie@users.sourceforge.net), (c) Copyright 2002 - 2010 Brad Jorsch (anomie@users.sourceforge.net),
Nach (n-a-c-h@users.sourceforge.net), Nach (n-a-c-h@users.sourceforge.net),
zones (kasumitokoduck@yahoo.com)
(c) Copyright 2002 - 2011 zones (kasumitokoduck@yahoo.com)
(c) Copyright 2006 - 2007 nitsuja (c) Copyright 2006 - 2007 nitsuja
(c) Copyright 2009 - 2010 BearOso, (c) Copyright 2009 - 2018 BearOso,
OV2 OV2
(c) Copyright 2017 qwertymodo
(c) Copyright 2011 - 2017 Hans-Kristian Arntzen,
Daniel De Matteis
(Under no circumstances will commercial rights be given)
BS-X C emulator code BS-X C emulator code
(c) Copyright 2005 - 2006 Dreamer Nom, (c) Copyright 2005 - 2006 Dreamer Nom,
@ -117,6 +124,9 @@
Sound emulator code used in 1.52+ Sound emulator code used in 1.52+
(c) Copyright 2004 - 2007 Shay Green (gblargg@gmail.com) (c) Copyright 2004 - 2007 Shay Green (gblargg@gmail.com)
S-SMP emulator code used in 1.54+
(c) Copyright 2016 byuu
SH assembler code partly based on x86 assembler code SH assembler code partly based on x86 assembler code
(c) Copyright 2002 - 2004 Marcus Comstedt (marcus@mc.pp.se) (c) Copyright 2002 - 2004 Marcus Comstedt (marcus@mc.pp.se)
@ -130,7 +140,7 @@
(c) Copyright 2006 - 2007 Shay Green (c) Copyright 2006 - 2007 Shay Green
GTK+ GUI code GTK+ GUI code
(c) Copyright 2004 - 2010 BearOso (c) Copyright 2004 - 2018 BearOso
Win32 GUI code Win32 GUI code
(c) Copyright 2003 - 2006 blip, (c) Copyright 2003 - 2006 blip,
@ -138,11 +148,16 @@
Matthew Kendora, Matthew Kendora,
Nach, Nach,
nitsuja nitsuja
(c) Copyright 2009 - 2010 OV2 (c) Copyright 2009 - 2018 OV2
Mac OS GUI code Mac OS GUI code
(c) Copyright 1998 - 2001 John Stiles (c) Copyright 1998 - 2001 John Stiles
(c) Copyright 2001 - 2010 zones (c) Copyright 2001 - 2011 zones
Libretro port
(c) Copyright 2011 - 2017 Hans-Kristian Arntzen,
Daniel De Matteis
(Under no circumstances will commercial rights be given)
Specific ports contains the works of other authors. See headers in Specific ports contains the works of other authors. See headers in

View File

@ -17,13 +17,20 @@
(c) Copyright 2002 - 2010 Brad Jorsch (anomie@users.sourceforge.net), (c) Copyright 2002 - 2010 Brad Jorsch (anomie@users.sourceforge.net),
Nach (n-a-c-h@users.sourceforge.net), Nach (n-a-c-h@users.sourceforge.net),
zones (kasumitokoduck@yahoo.com)
(c) Copyright 2002 - 2011 zones (kasumitokoduck@yahoo.com)
(c) Copyright 2006 - 2007 nitsuja (c) Copyright 2006 - 2007 nitsuja
(c) Copyright 2009 - 2010 BearOso, (c) Copyright 2009 - 2018 BearOso,
OV2 OV2
(c) Copyright 2017 qwertymodo
(c) Copyright 2011 - 2017 Hans-Kristian Arntzen,
Daniel De Matteis
(Under no circumstances will commercial rights be given)
BS-X C emulator code BS-X C emulator code
(c) Copyright 2005 - 2006 Dreamer Nom, (c) Copyright 2005 - 2006 Dreamer Nom,
@ -117,6 +124,9 @@
Sound emulator code used in 1.52+ Sound emulator code used in 1.52+
(c) Copyright 2004 - 2007 Shay Green (gblargg@gmail.com) (c) Copyright 2004 - 2007 Shay Green (gblargg@gmail.com)
S-SMP emulator code used in 1.54+
(c) Copyright 2016 byuu
SH assembler code partly based on x86 assembler code SH assembler code partly based on x86 assembler code
(c) Copyright 2002 - 2004 Marcus Comstedt (marcus@mc.pp.se) (c) Copyright 2002 - 2004 Marcus Comstedt (marcus@mc.pp.se)
@ -130,7 +140,7 @@
(c) Copyright 2006 - 2007 Shay Green (c) Copyright 2006 - 2007 Shay Green
GTK+ GUI code GTK+ GUI code
(c) Copyright 2004 - 2010 BearOso (c) Copyright 2004 - 2018 BearOso
Win32 GUI code Win32 GUI code
(c) Copyright 2003 - 2006 blip, (c) Copyright 2003 - 2006 blip,
@ -138,11 +148,16 @@
Matthew Kendora, Matthew Kendora,
Nach, Nach,
nitsuja nitsuja
(c) Copyright 2009 - 2010 OV2 (c) Copyright 2009 - 2018 OV2
Mac OS GUI code Mac OS GUI code
(c) Copyright 1998 - 2001 John Stiles (c) Copyright 1998 - 2001 John Stiles
(c) Copyright 2001 - 2010 zones (c) Copyright 2001 - 2011 zones
Libretro port
(c) Copyright 2011 - 2017 Hans-Kristian Arntzen,
Daniel De Matteis
(Under no circumstances will commercial rights be given)
Specific ports contains the works of other authors. See headers in Specific ports contains the works of other authors. See headers in

View File

@ -213,8 +213,9 @@ void S9xInitSuperFX (void)
void S9xResetSuperFX (void) void S9xResetSuperFX (void)
{ {
// FIXME: Snes9x can't execute CPU and SuperFX at a time. Don't ask me what is 0.417 :P // FIXME: Snes9x only runs the SuperFX at the end of every line.
SuperFX.speedPerLine = (uint32) (0.417 * 10.5e6 * ((1.0 / (float) Memory.ROMFramesPerSecond) / ((float) (Timings.V_Max)))); // 5823405 is a magic number that seems to work for most games.
SuperFX.speedPerLine = (uint32) (5823405 * ((1.0 / (float) Memory.ROMFramesPerSecond) / ((float) (Timings.V_Max))));
SuperFX.oneLineDone = FALSE; SuperFX.oneLineDone = FALSE;
SuperFX.vFlags = 0; SuperFX.vFlags = 0;
CPU.IRQExternal = FALSE; CPU.IRQExternal = FALSE;

View File

@ -17,13 +17,20 @@
(c) Copyright 2002 - 2010 Brad Jorsch (anomie@users.sourceforge.net), (c) Copyright 2002 - 2010 Brad Jorsch (anomie@users.sourceforge.net),
Nach (n-a-c-h@users.sourceforge.net), Nach (n-a-c-h@users.sourceforge.net),
zones (kasumitokoduck@yahoo.com)
(c) Copyright 2002 - 2011 zones (kasumitokoduck@yahoo.com)
(c) Copyright 2006 - 2007 nitsuja (c) Copyright 2006 - 2007 nitsuja
(c) Copyright 2009 - 2010 BearOso, (c) Copyright 2009 - 2018 BearOso,
OV2 OV2
(c) Copyright 2017 qwertymodo
(c) Copyright 2011 - 2017 Hans-Kristian Arntzen,
Daniel De Matteis
(Under no circumstances will commercial rights be given)
BS-X C emulator code BS-X C emulator code
(c) Copyright 2005 - 2006 Dreamer Nom, (c) Copyright 2005 - 2006 Dreamer Nom,
@ -117,6 +124,9 @@
Sound emulator code used in 1.52+ Sound emulator code used in 1.52+
(c) Copyright 2004 - 2007 Shay Green (gblargg@gmail.com) (c) Copyright 2004 - 2007 Shay Green (gblargg@gmail.com)
S-SMP emulator code used in 1.54+
(c) Copyright 2016 byuu
SH assembler code partly based on x86 assembler code SH assembler code partly based on x86 assembler code
(c) Copyright 2002 - 2004 Marcus Comstedt (marcus@mc.pp.se) (c) Copyright 2002 - 2004 Marcus Comstedt (marcus@mc.pp.se)
@ -130,7 +140,7 @@
(c) Copyright 2006 - 2007 Shay Green (c) Copyright 2006 - 2007 Shay Green
GTK+ GUI code GTK+ GUI code
(c) Copyright 2004 - 2010 BearOso (c) Copyright 2004 - 2018 BearOso
Win32 GUI code Win32 GUI code
(c) Copyright 2003 - 2006 blip, (c) Copyright 2003 - 2006 blip,
@ -138,11 +148,16 @@
Matthew Kendora, Matthew Kendora,
Nach, Nach,
nitsuja nitsuja
(c) Copyright 2009 - 2010 OV2 (c) Copyright 2009 - 2018 OV2
Mac OS GUI code Mac OS GUI code
(c) Copyright 1998 - 2001 John Stiles (c) Copyright 1998 - 2001 John Stiles
(c) Copyright 2001 - 2010 zones (c) Copyright 2001 - 2011 zones
Libretro port
(c) Copyright 2011 - 2017 Hans-Kristian Arntzen,
Daniel De Matteis
(Under no circumstances will commercial rights be given)
Specific ports contains the works of other authors. See headers in Specific ports contains the works of other authors. See headers in

View File

@ -17,13 +17,20 @@
(c) Copyright 2002 - 2010 Brad Jorsch (anomie@users.sourceforge.net), (c) Copyright 2002 - 2010 Brad Jorsch (anomie@users.sourceforge.net),
Nach (n-a-c-h@users.sourceforge.net), Nach (n-a-c-h@users.sourceforge.net),
zones (kasumitokoduck@yahoo.com)
(c) Copyright 2002 - 2011 zones (kasumitokoduck@yahoo.com)
(c) Copyright 2006 - 2007 nitsuja (c) Copyright 2006 - 2007 nitsuja
(c) Copyright 2009 - 2010 BearOso, (c) Copyright 2009 - 2018 BearOso,
OV2 OV2
(c) Copyright 2017 qwertymodo
(c) Copyright 2011 - 2017 Hans-Kristian Arntzen,
Daniel De Matteis
(Under no circumstances will commercial rights be given)
BS-X C emulator code BS-X C emulator code
(c) Copyright 2005 - 2006 Dreamer Nom, (c) Copyright 2005 - 2006 Dreamer Nom,
@ -117,6 +124,9 @@
Sound emulator code used in 1.52+ Sound emulator code used in 1.52+
(c) Copyright 2004 - 2007 Shay Green (gblargg@gmail.com) (c) Copyright 2004 - 2007 Shay Green (gblargg@gmail.com)
S-SMP emulator code used in 1.54+
(c) Copyright 2016 byuu
SH assembler code partly based on x86 assembler code SH assembler code partly based on x86 assembler code
(c) Copyright 2002 - 2004 Marcus Comstedt (marcus@mc.pp.se) (c) Copyright 2002 - 2004 Marcus Comstedt (marcus@mc.pp.se)
@ -130,7 +140,7 @@
(c) Copyright 2006 - 2007 Shay Green (c) Copyright 2006 - 2007 Shay Green
GTK+ GUI code GTK+ GUI code
(c) Copyright 2004 - 2010 BearOso (c) Copyright 2004 - 2018 BearOso
Win32 GUI code Win32 GUI code
(c) Copyright 2003 - 2006 blip, (c) Copyright 2003 - 2006 blip,
@ -138,11 +148,16 @@
Matthew Kendora, Matthew Kendora,
Nach, Nach,
nitsuja nitsuja
(c) Copyright 2009 - 2010 OV2 (c) Copyright 2009 - 2018 OV2
Mac OS GUI code Mac OS GUI code
(c) Copyright 1998 - 2001 John Stiles (c) Copyright 1998 - 2001 John Stiles
(c) Copyright 2001 - 2010 zones (c) Copyright 2001 - 2011 zones
Libretro port
(c) Copyright 2011 - 2017 Hans-Kristian Arntzen,
Daniel De Matteis
(Under no circumstances will commercial rights be given)
Specific ports contains the works of other authors. See headers in Specific ports contains the works of other authors. See headers in
@ -891,14 +906,14 @@ static void fx_plot_2bit (void)
return; return;
#endif #endif
if (!(GSU.vPlotOptionReg & 0x01) && !(COLR & 0xf))
return;
if (GSU.vPlotOptionReg & 0x02) if (GSU.vPlotOptionReg & 0x02)
c = (x ^ y) & 1 ? (uint8) (GSU.vColorReg >> 4) : (uint8) GSU.vColorReg; c = ((x ^ y) & 1) ? (uint8) (GSU.vColorReg >> 4) : (uint8) GSU.vColorReg;
else else
c = (uint8) GSU.vColorReg; c = (uint8) GSU.vColorReg;
if (!(GSU.vPlotOptionReg & 0x01) && !(c & 0xf))
return;
a = GSU.apvScreen[y >> 3] + GSU.x[x >> 3] + ((y & 7) << 1); a = GSU.apvScreen[y >> 3] + GSU.x[x >> 3] + ((y & 7) << 1);
v = 128 >> (x & 7); v = 128 >> (x & 7);
@ -955,14 +970,14 @@ static void fx_plot_4bit (void)
return; return;
#endif #endif
if (!(GSU.vPlotOptionReg & 0x01) && !(COLR & 0xf))
return;
if (GSU.vPlotOptionReg & 0x02) if (GSU.vPlotOptionReg & 0x02)
c = (x ^ y) & 1 ? (uint8) (GSU.vColorReg >> 4) : (uint8) GSU.vColorReg; c = ((x ^ y) & 1) ? (uint8) (GSU.vColorReg >> 4) : (uint8) GSU.vColorReg;
else else
c = (uint8) GSU.vColorReg; c = (uint8) GSU.vColorReg;
if (!(GSU.vPlotOptionReg & 0x01) && !(c & 0xf))
return;
a = GSU.apvScreen[y >> 3] + GSU.x[x >> 3] + ((y & 7) << 1); a = GSU.apvScreen[y >> 3] + GSU.x[x >> 3] + ((y & 7) << 1);
v = 128 >> (x & 7); v = 128 >> (x & 7);
@ -1034,7 +1049,7 @@ static void fx_plot_8bit (void)
c = (uint8) GSU.vColorReg; c = (uint8) GSU.vColorReg;
if (!(GSU.vPlotOptionReg & 0x10)) if (!(GSU.vPlotOptionReg & 0x10))
{ {
if (!(GSU.vPlotOptionReg & 0x01) && !(c & 0xf)) if (!(GSU.vPlotOptionReg & 0x01) && (!c || ((GSU.vPlotOptionReg & 0x08) && !(c & 0xf))))
return; return;
} }
else else
@ -4137,7 +4152,6 @@ static void fx_sm_r15 (void)
uint32 fx_run (uint32 nInstructions) uint32 fx_run (uint32 nInstructions)
{ {
GSU.vCounter = nInstructions; GSU.vCounter = nInstructions;
READR14;
while (TF(G) && (GSU.vCounter-- > 0)) while (TF(G) && (GSU.vCounter-- > 0))
FX_STEP; FX_STEP;
#if 0 #if 0

View File

@ -17,13 +17,20 @@
(c) Copyright 2002 - 2010 Brad Jorsch (anomie@users.sourceforge.net), (c) Copyright 2002 - 2010 Brad Jorsch (anomie@users.sourceforge.net),
Nach (n-a-c-h@users.sourceforge.net), Nach (n-a-c-h@users.sourceforge.net),
zones (kasumitokoduck@yahoo.com)
(c) Copyright 2002 - 2011 zones (kasumitokoduck@yahoo.com)
(c) Copyright 2006 - 2007 nitsuja (c) Copyright 2006 - 2007 nitsuja
(c) Copyright 2009 - 2010 BearOso, (c) Copyright 2009 - 2018 BearOso,
OV2 OV2
(c) Copyright 2017 qwertymodo
(c) Copyright 2011 - 2017 Hans-Kristian Arntzen,
Daniel De Matteis
(Under no circumstances will commercial rights be given)
BS-X C emulator code BS-X C emulator code
(c) Copyright 2005 - 2006 Dreamer Nom, (c) Copyright 2005 - 2006 Dreamer Nom,
@ -117,6 +124,9 @@
Sound emulator code used in 1.52+ Sound emulator code used in 1.52+
(c) Copyright 2004 - 2007 Shay Green (gblargg@gmail.com) (c) Copyright 2004 - 2007 Shay Green (gblargg@gmail.com)
S-SMP emulator code used in 1.54+
(c) Copyright 2016 byuu
SH assembler code partly based on x86 assembler code SH assembler code partly based on x86 assembler code
(c) Copyright 2002 - 2004 Marcus Comstedt (marcus@mc.pp.se) (c) Copyright 2002 - 2004 Marcus Comstedt (marcus@mc.pp.se)
@ -130,7 +140,7 @@
(c) Copyright 2006 - 2007 Shay Green (c) Copyright 2006 - 2007 Shay Green
GTK+ GUI code GTK+ GUI code
(c) Copyright 2004 - 2010 BearOso (c) Copyright 2004 - 2018 BearOso
Win32 GUI code Win32 GUI code
(c) Copyright 2003 - 2006 blip, (c) Copyright 2003 - 2006 blip,
@ -138,11 +148,16 @@
Matthew Kendora, Matthew Kendora,
Nach, Nach,
nitsuja nitsuja
(c) Copyright 2009 - 2010 OV2 (c) Copyright 2009 - 2018 OV2
Mac OS GUI code Mac OS GUI code
(c) Copyright 1998 - 2001 John Stiles (c) Copyright 1998 - 2001 John Stiles
(c) Copyright 2001 - 2010 zones (c) Copyright 2001 - 2011 zones
Libretro port
(c) Copyright 2011 - 2017 Hans-Kristian Arntzen,
Daniel De Matteis
(Under no circumstances will commercial rights be given)
Specific ports contains the works of other authors. See headers in Specific ports contains the works of other authors. See headers in

View File

@ -885,8 +885,7 @@ inline void S9xSetPCBase (uint32 Address)
Registers.PBPC = Address & 0xffffff; Registers.PBPC = Address & 0xffffff;
ICPU.ShiftedPB = Address & 0xff0000; ICPU.ShiftedPB = Address & 0xff0000;
int block; uint8 *GetAddress = Memory.Map[(int)((Address & 0xffffff) >> MEMMAP_SHIFT)];
uint8 *GetAddress = Memory.Map[block = ((Address & 0xffffff) >> MEMMAP_SHIFT)];
CPU.MemSpeed = memory_speed(Address); CPU.MemSpeed = memory_speed(Address);
CPU.MemSpeedx2 = CPU.MemSpeed << 1; CPU.MemSpeedx2 = CPU.MemSpeed << 1;

View File

@ -17,13 +17,20 @@
(c) Copyright 2002 - 2010 Brad Jorsch (anomie@users.sourceforge.net), (c) Copyright 2002 - 2010 Brad Jorsch (anomie@users.sourceforge.net),
Nach (n-a-c-h@users.sourceforge.net), Nach (n-a-c-h@users.sourceforge.net),
zones (kasumitokoduck@yahoo.com)
(c) Copyright 2002 - 2011 zones (kasumitokoduck@yahoo.com)
(c) Copyright 2006 - 2007 nitsuja (c) Copyright 2006 - 2007 nitsuja
(c) Copyright 2009 - 2010 BearOso, (c) Copyright 2009 - 2018 BearOso,
OV2 OV2
(c) Copyright 2017 qwertymodo
(c) Copyright 2011 - 2017 Hans-Kristian Arntzen,
Daniel De Matteis
(Under no circumstances will commercial rights be given)
BS-X C emulator code BS-X C emulator code
(c) Copyright 2005 - 2006 Dreamer Nom, (c) Copyright 2005 - 2006 Dreamer Nom,
@ -117,6 +124,9 @@
Sound emulator code used in 1.52+ Sound emulator code used in 1.52+
(c) Copyright 2004 - 2007 Shay Green (gblargg@gmail.com) (c) Copyright 2004 - 2007 Shay Green (gblargg@gmail.com)
S-SMP emulator code used in 1.54+
(c) Copyright 2016 byuu
SH assembler code partly based on x86 assembler code SH assembler code partly based on x86 assembler code
(c) Copyright 2002 - 2004 Marcus Comstedt (marcus@mc.pp.se) (c) Copyright 2002 - 2004 Marcus Comstedt (marcus@mc.pp.se)
@ -130,7 +140,7 @@
(c) Copyright 2006 - 2007 Shay Green (c) Copyright 2006 - 2007 Shay Green
GTK+ GUI code GTK+ GUI code
(c) Copyright 2004 - 2010 BearOso (c) Copyright 2004 - 2018 BearOso
Win32 GUI code Win32 GUI code
(c) Copyright 2003 - 2006 blip, (c) Copyright 2003 - 2006 blip,
@ -138,11 +148,16 @@
Matthew Kendora, Matthew Kendora,
Nach, Nach,
nitsuja nitsuja
(c) Copyright 2009 - 2010 OV2 (c) Copyright 2009 - 2018 OV2
Mac OS GUI code Mac OS GUI code
(c) Copyright 1998 - 2001 John Stiles (c) Copyright 1998 - 2001 John Stiles
(c) Copyright 2001 - 2010 zones (c) Copyright 2001 - 2011 zones
Libretro port
(c) Copyright 2011 - 2017 Hans-Kristian Arntzen,
Daniel De Matteis
(Under no circumstances will commercial rights be given)
Specific ports contains the works of other authors. See headers in Specific ports contains the works of other authors. See headers in
@ -215,7 +230,7 @@ static uint16 get_crosshair_color (uint8);
bool8 S9xGraphicsInit (void) bool8 S9xGraphicsInit (void)
{ {
S9xInitTileRenderer(); S9xInitTileRenderer();
ZeroMemory(BlackColourMap, 256 * sizeof(uint16)); memset(BlackColourMap, 0, 256 * sizeof(uint16));
#ifdef GFX_MULTI_FORMAT #ifdef GFX_MULTI_FORMAT
if (GFX.BuildPixel == NULL) if (GFX.BuildPixel == NULL)
@ -226,9 +241,9 @@ bool8 S9xGraphicsInit (void)
GFX.InterlaceFrame = 0; GFX.InterlaceFrame = 0;
GFX.RealPPL = GFX.Pitch >> 1; GFX.RealPPL = GFX.Pitch >> 1;
IPPU.OBJChanged = TRUE; IPPU.OBJChanged = TRUE;
IPPU.DirectColourMapsNeedRebuild = TRUE;
Settings.BG_Forced = 0; Settings.BG_Forced = 0;
S9xFixColourBrightness(); S9xFixColourBrightness();
S9xBuildDirectColourMaps();
GFX.X2 = (uint16 *) malloc(sizeof(uint16) * 0x10000); GFX.X2 = (uint16 *) malloc(sizeof(uint16) * 0x10000);
GFX.ZERO = (uint16 *) malloc(sizeof(uint16) * 0x10000); GFX.ZERO = (uint16 *) malloc(sizeof(uint16) * 0x10000);
@ -245,7 +260,7 @@ bool8 S9xGraphicsInit (void)
} }
// Lookup table for color addition // Lookup table for color addition
ZeroMemory(GFX.X2, 0x10000 * sizeof(uint16)); memset(GFX.X2, 0, 0x10000 * sizeof(uint16));
for (uint32 r = 0; r <= MAX_RED; r++) for (uint32 r = 0; r <= MAX_RED; r++)
{ {
uint32 r2 = r << 1; uint32 r2 = r << 1;
@ -271,7 +286,7 @@ bool8 S9xGraphicsInit (void)
} }
// Lookup table for 1/2 color subtraction // Lookup table for 1/2 color subtraction
ZeroMemory(GFX.ZERO, 0x10000 * sizeof(uint16)); memset(GFX.ZERO, 0, 0x10000 * sizeof(uint16));
for (uint32 r = 0; r <= MAX_RED; r++) for (uint32 r = 0; r <= MAX_RED; r++)
{ {
uint32 r2 = r; uint32 r2 = r;
@ -314,6 +329,48 @@ void S9xGraphicsDeinit (void)
if (GFX.SubZBuffer) { free(GFX.SubZBuffer); GFX.SubZBuffer = NULL; } if (GFX.SubZBuffer) { free(GFX.SubZBuffer); GFX.SubZBuffer = NULL; }
} }
void S9xGraphicsScreenResize (void)
{
IPPU.MaxBrightness = PPU.Brightness;
IPPU.Interlace = Memory.FillRAM[0x2133] & 1;
IPPU.InterlaceOBJ = Memory.FillRAM[0x2133] & 2;
IPPU.PseudoHires = Memory.FillRAM[0x2133] & 8;
if (Settings.SupportHiRes && (PPU.BGMode == 5 || PPU.BGMode == 6 || IPPU.PseudoHires))
{
GFX.RealPPL = GFX.Pitch >> 1;
IPPU.DoubleWidthPixels = TRUE;
IPPU.RenderedScreenWidth = SNES_WIDTH << 1;
}
else
{
#ifdef USE_OPENGL
if (Settings.OpenGLEnable)
GFX.RealPPL = SNES_WIDTH;
else
#endif
GFX.RealPPL = GFX.Pitch >> 1;
IPPU.DoubleWidthPixels = FALSE;
IPPU.RenderedScreenWidth = SNES_WIDTH;
}
if (Settings.SupportHiRes && IPPU.Interlace)
{
GFX.PPL = GFX.RealPPL << 1;
IPPU.DoubleHeightPixels = TRUE;
IPPU.RenderedScreenHeight = PPU.ScreenHeight << 1;
GFX.DoInterlace++;
}
else
{
GFX.PPL = GFX.RealPPL;
IPPU.DoubleHeightPixels = FALSE;
IPPU.RenderedScreenHeight = PPU.ScreenHeight;
}
}
void S9xBuildDirectColourMaps (void) void S9xBuildDirectColourMaps (void)
{ {
IPPU.XB = mul_brightness[PPU.Brightness]; IPPU.XB = mul_brightness[PPU.Brightness];
@ -321,15 +378,14 @@ void S9xBuildDirectColourMaps (void)
for (uint32 p = 0; p < 8; p++) for (uint32 p = 0; p < 8; p++)
for (uint32 c = 0; c < 256; c++) for (uint32 c = 0; c < 256; c++)
DirectColourMaps[p][c] = BUILD_PIXEL(IPPU.XB[((c & 7) << 2) | ((p & 1) << 1)], IPPU.XB[((c & 0x38) >> 1) | (p & 2)], IPPU.XB[((c & 0xc0) >> 3) | (p & 4)]); DirectColourMaps[p][c] = BUILD_PIXEL(IPPU.XB[((c & 7) << 2) | ((p & 1) << 1)], IPPU.XB[((c & 0x38) >> 1) | (p & 2)], IPPU.XB[((c & 0xc0) >> 3) | (p & 4)]);
IPPU.DirectColourMapsNeedRebuild = FALSE;
} }
void S9xStartScreenRefresh (void) void S9xStartScreenRefresh (void)
{ {
GFX.InterlaceFrame = !GFX.InterlaceFrame;
if (IPPU.RenderThisFrame) if (IPPU.RenderThisFrame)
{ {
GFX.InterlaceFrame = !GFX.InterlaceFrame;
if (!GFX.DoInterlace || !GFX.InterlaceFrame) if (!GFX.DoInterlace || !GFX.InterlaceFrame)
{ {
if (!S9xInitUpdate()) if (!S9xInitUpdate())
@ -341,43 +397,7 @@ void S9xStartScreenRefresh (void)
if (GFX.DoInterlace) if (GFX.DoInterlace)
GFX.DoInterlace--; GFX.DoInterlace--;
IPPU.MaxBrightness = PPU.Brightness; S9xGraphicsScreenResize();
IPPU.Interlace = Memory.FillRAM[0x2133] & 1;
IPPU.InterlaceOBJ = Memory.FillRAM[0x2133] & 2;
IPPU.PseudoHires = Memory.FillRAM[0x2133] & 8;
if (Settings.SupportHiRes && (PPU.BGMode == 5 || PPU.BGMode == 6 || IPPU.PseudoHires))
{
GFX.RealPPL = GFX.Pitch >> 1;
IPPU.DoubleWidthPixels = TRUE;
IPPU.RenderedScreenWidth = SNES_WIDTH << 1;
}
else
{
#ifdef USE_OPENGL
if (Settings.OpenGLEnable)
GFX.RealPPL = SNES_WIDTH;
else
#endif
GFX.RealPPL = GFX.Pitch >> 1;
IPPU.DoubleWidthPixels = FALSE;
IPPU.RenderedScreenWidth = SNES_WIDTH;
}
if (Settings.SupportHiRes && IPPU.Interlace)
{
GFX.PPL = GFX.RealPPL << 1;
IPPU.DoubleHeightPixels = TRUE;
IPPU.RenderedScreenHeight = PPU.ScreenHeight << 1;
GFX.DoInterlace++;
}
else
{
GFX.PPL = GFX.RealPPL;
IPPU.DoubleHeightPixels = FALSE;
IPPU.RenderedScreenHeight = PPU.ScreenHeight;
}
IPPU.RenderedFramesCount++; IPPU.RenderedFramesCount++;
} }
@ -386,8 +406,8 @@ void S9xStartScreenRefresh (void)
PPU.RecomputeClipWindows = TRUE; PPU.RecomputeClipWindows = TRUE;
IPPU.PreviousLine = IPPU.CurrentLine = 0; IPPU.PreviousLine = IPPU.CurrentLine = 0;
ZeroMemory(GFX.ZBuffer, GFX.ScreenSize); memset(GFX.ZBuffer, 0, GFX.ScreenSize);
ZeroMemory(GFX.SubZBuffer, GFX.ScreenSize); memset(GFX.SubZBuffer, 0, GFX.ScreenSize);
} }
if (++IPPU.FrameCount % Memory.ROMFramesPerSecond == 0) if (++IPPU.FrameCount % Memory.ROMFramesPerSecond == 0)
@ -671,7 +691,7 @@ void S9xUpdateScreen (void)
{ {
if (!IPPU.DoubleWidthPixels && (PPU.BGMode == 5 || PPU.BGMode == 6 || IPPU.PseudoHires)) if (!IPPU.DoubleWidthPixels && (PPU.BGMode == 5 || PPU.BGMode == 6 || IPPU.PseudoHires))
{ {
#ifdef USE_OPENGL #ifdef USE_OPENGL
if (Settings.OpenGLEnable && GFX.RealPPL == 256) if (Settings.OpenGLEnable && GFX.RealPPL == 256)
{ {
// Have to back out of the speed up hack where the low res. // Have to back out of the speed up hack where the low res.
@ -691,42 +711,30 @@ void S9xUpdateScreen (void)
GFX.PPL = GFX.RealPPL; // = GFX.Pitch >> 1 above GFX.PPL = GFX.RealPPL; // = GFX.Pitch >> 1 above
} }
else else
#endif #endif
// Have to back out of the regular speed hack
for (register uint32 y = 0; y < GFX.StartY; y++)
{ {
// Have to back out of the regular speed hack register uint16 *p = GFX.Screen + y * GFX.PPL + 255;
for (register uint32 y = 0; y < GFX.StartY; y++) register uint16 *q = GFX.Screen + y * GFX.PPL + 510;
{
register uint16 *p = GFX.Screen + y * GFX.PPL + 255;
register uint16 *q = GFX.Screen + y * GFX.PPL + 510;
for (register int x = 255; x >= 0; x--, p--, q -= 2) for (register int x = 255; x >= 0; x--, p--, q -= 2)
*q = *(q + 1) = *p; *q = *(q + 1) = *p;
}
} }
IPPU.DoubleWidthPixels = TRUE; IPPU.DoubleWidthPixels = TRUE;
IPPU.RenderedScreenWidth = 512; IPPU.RenderedScreenWidth = 512;
} }
if (!IPPU.DoubleHeightPixels && IPPU.Interlace) if (!IPPU.DoubleHeightPixels && IPPU.Interlace && (PPU.BGMode == 5 || PPU.BGMode == 6))
{ {
IPPU.DoubleHeightPixels = TRUE; IPPU.DoubleHeightPixels = TRUE;
IPPU.RenderedScreenHeight = PPU.ScreenHeight << 1; IPPU.RenderedScreenHeight = PPU.ScreenHeight << 1;
GFX.PPL = GFX.RealPPL << 1; GFX.PPL = GFX.RealPPL << 1;
GFX.DoInterlace = 2; GFX.DoInterlace = 2;
for (register int32 y = (int32) GFX.StartY - 1; y >= 0; y--) for (register int32 y = (int32) GFX.StartY - 2; y >= 0; y--)
memmove(GFX.Screen + y * GFX.PPL, GFX.Screen + y * GFX.RealPPL, IPPU.RenderedScreenWidth * sizeof(uint16)); memmove(GFX.Screen + (y + 1) * GFX.PPL, GFX.Screen + y * GFX.RealPPL, GFX.PPL * sizeof(uint16));
}
else if (IPPU.DoubleHeightPixels && !IPPU.Interlace)
{
for (register int32 y = 0; y < (int32) GFX.StartY; y++)
memmove(GFX.Screen + y * GFX.RealPPL, GFX.Screen + y * GFX.PPL, IPPU.RenderedScreenWidth * sizeof(uint16));
IPPU.DoubleHeightPixels = FALSE;
IPPU.RenderedScreenHeight = PPU.ScreenHeight;
GFX.PPL = GFX.RealPPL;
GFX.DoInterlace = 0;
} }
} }
@ -819,12 +827,12 @@ static void SetupOBJ (void)
if (!PPU.OAMPriorityRotation || !(PPU.OAMFlip & PPU.OAMAddr & 1)) // normal case if (!PPU.OAMPriorityRotation || !(PPU.OAMFlip & PPU.OAMAddr & 1)) // normal case
{ {
uint8 LineOBJ[SNES_HEIGHT_EXTENDED]; uint8 LineOBJ[SNES_HEIGHT_EXTENDED];
ZeroMemory(LineOBJ, sizeof(LineOBJ)); memset(LineOBJ, 0, sizeof(LineOBJ));
for (int i = 0; i < SNES_HEIGHT_EXTENDED; i++) for (int i = 0; i < SNES_HEIGHT_EXTENDED; i++)
{ {
GFX.OBJLines[i].RTOFlags = 0; GFX.OBJLines[i].RTOFlags = 0;
GFX.OBJLines[i].Tiles = 34; GFX.OBJLines[i].Tiles = Settings.MaxSpriteTilesPerLine;
for (int j = 0; j < 32; j++) for (int j = 0; j < 32; j++)
GFX.OBJLines[i].OBJ[j].Sprite = -1; GFX.OBJLines[i].OBJ[j].Sprite = -1;
} }
@ -895,8 +903,14 @@ static void SetupOBJ (void)
else // evil FirstSprite+Y case else // evil FirstSprite+Y case
{ {
// First, find out which sprites are on which lines // First, find out which sprites are on which lines
uint8 OBJOnLine[SNES_HEIGHT_EXTENDED][128]; uint8 OBJOnLine[SNES_HEIGHT_EXTENDED][128];
ZeroMemory(OBJOnLine, sizeof(OBJOnLine)); // memset(OBJOnLine, 0, sizeof(OBJOnLine));
/* Hold on here, that's a lot of bytes to initialise at once!
* So we only initialise them per line, as needed. [Neb]
* Bonus: We can quickly avoid looping if a line has no OBJs.
*/
bool8 AnyOBJOnLine[SNES_HEIGHT_EXTENDED];
memset(AnyOBJOnLine, FALSE, sizeof(AnyOBJOnLine)); // better
for (S = 0; S < 128; S++) for (S = 0; S < 128; S++)
{ {
@ -930,6 +944,11 @@ static void SetupOBJ (void)
if (Y >= SNES_HEIGHT_EXTENDED) if (Y >= SNES_HEIGHT_EXTENDED)
continue; continue;
if (!AnyOBJOnLine[Y]) {
memset(OBJOnLine[Y], 0, sizeof(OBJOnLine[Y]));
AnyOBJOnLine[Y] = TRUE;
}
if (PPU.OBJ[S].VFlip) if (PPU.OBJ[S].VFlip)
// Yes, Width not Height. It so happens that the // Yes, Width not Height. It so happens that the
// sprites with H=2*W flip as two WxW sprites. // sprites with H=2*W flip as two WxW sprites.
@ -945,31 +964,34 @@ static void SetupOBJ (void)
for (int Y = 0; Y < SNES_HEIGHT_EXTENDED; Y++) for (int Y = 0; Y < SNES_HEIGHT_EXTENDED; Y++)
{ {
GFX.OBJLines[Y].RTOFlags = Y ? GFX.OBJLines[Y - 1].RTOFlags : 0; GFX.OBJLines[Y].RTOFlags = Y ? GFX.OBJLines[Y - 1].RTOFlags : 0;
GFX.OBJLines[Y].Tiles = 34; GFX.OBJLines[Y].Tiles = Settings.MaxSpriteTilesPerLine;
uint8 FirstSprite = (PPU.FirstSprite + Y) & 0x7f; uint8 FirstSprite = (PPU.FirstSprite + Y) & 0x7f;
S = FirstSprite; S = FirstSprite;
j = 0; j = 0;
do if (AnyOBJOnLine[Y])
{ {
if (OBJOnLine[Y][S]) do
{ {
if (j >= 32) if (OBJOnLine[Y][S])
{ {
GFX.OBJLines[Y].RTOFlags |= 0x40; if (j >= 32)
break; {
GFX.OBJLines[Y].RTOFlags |= 0x40;
break;
}
GFX.OBJLines[Y].Tiles -= GFX.OBJVisibleTiles[S];
if (GFX.OBJLines[Y].Tiles < 0)
GFX.OBJLines[Y].RTOFlags |= 0x80;
GFX.OBJLines[Y].OBJ[j].Sprite = S;
GFX.OBJLines[Y].OBJ[j++].Line = OBJOnLine[Y][S] & ~0x80;
} }
GFX.OBJLines[Y].Tiles -= GFX.OBJVisibleTiles[S]; S = (S + 1) & 0x7f;
if (GFX.OBJLines[Y].Tiles < 0) } while (S != FirstSprite);
GFX.OBJLines[Y].RTOFlags |= 0x80; }
GFX.OBJLines[Y].OBJ[j].Sprite = S;
GFX.OBJLines[Y].OBJ[j++].Line = OBJOnLine[Y][S] & ~0x80;
}
S = (S + 1) & 0x7f;
} while (S != FirstSprite);
if (j < 32) if (j < 32)
GFX.OBJLines[Y].OBJ[j].Sprite = -1; GFX.OBJLines[Y].OBJ[j].Sprite = -1;
@ -979,6 +1001,8 @@ static void SetupOBJ (void)
IPPU.OBJChanged = FALSE; IPPU.OBJChanged = FALSE;
} }
#pragma GCC push_options
#pragma GCC optimize ("no-tree-vrp")
static void DrawOBJS (int D) static void DrawOBJS (int D)
{ {
void (*DrawTile) (uint32, uint32, uint32, uint32) = NULL; void (*DrawTile) (uint32, uint32, uint32, uint32) = NULL;
@ -1071,6 +1095,8 @@ static void DrawOBJS (int D)
} }
} }
} }
#pragma GCC pop_options
static void DrawBackground (int bg, uint8 Zh, uint8 Zl) static void DrawBackground (int bg, uint8 Zh, uint8 Zl)
{ {
@ -1329,8 +1355,8 @@ static void DrawBackgroundMosaic (int bg, uint8 Zh, uint8 Zl)
for (uint32 Y = GFX.StartY - MosaicStart; Y <= GFX.EndY; Y += PPU.Mosaic) for (uint32 Y = GFX.StartY - MosaicStart; Y <= GFX.EndY; Y += PPU.Mosaic)
{ {
uint32 Y2 = HiresInterlace ? Y * 2 : Y; uint32 Y2 = HiresInterlace ? Y * 2 : Y;
uint32 VOffset = LineData[Y].BG[bg].VOffset + (HiresInterlace ? 1 : 0); uint32 VOffset = LineData[Y + MosaicStart].BG[bg].VOffset + (HiresInterlace ? 1 : 0);
uint32 HOffset = LineData[Y].BG[bg].HOffset; uint32 HOffset = LineData[Y + MosaicStart].BG[bg].HOffset;
Lines = PPU.Mosaic - MosaicStart; Lines = PPU.Mosaic - MosaicStart;
if (Y + MosaicStart + Lines > GFX.EndY) if (Y + MosaicStart + Lines > GFX.EndY)
@ -1493,7 +1519,6 @@ static void DrawBackgroundOffset (int bg, uint8 Zh, uint8 Zl, int VOffOff)
int PixWidth = IPPU.DoubleWidthPixels ? 2 : 1; int PixWidth = IPPU.DoubleWidthPixels ? 2 : 1;
bool8 HiresInterlace = IPPU.Interlace && IPPU.DoubleWidthPixels; bool8 HiresInterlace = IPPU.Interlace && IPPU.DoubleWidthPixels;
void (*DrawTile) (uint32, uint32, uint32, uint32);
void (*DrawClippedTile) (uint32, uint32, uint32, uint32, uint32, uint32); void (*DrawClippedTile) (uint32, uint32, uint32, uint32, uint32, uint32);
for (int clip = 0; clip < GFX.Clip[bg].Count; clip++) for (int clip = 0; clip < GFX.Clip[bg].Count; clip++)
@ -1502,12 +1527,10 @@ static void DrawBackgroundOffset (int bg, uint8 Zh, uint8 Zl, int VOffOff)
if (BG.EnableMath && (GFX.Clip[bg].DrawMode[clip] & 2)) if (BG.EnableMath && (GFX.Clip[bg].DrawMode[clip] & 2))
{ {
DrawTile = GFX.DrawTileMath;
DrawClippedTile = GFX.DrawClippedTileMath; DrawClippedTile = GFX.DrawClippedTileMath;
} }
else else
{ {
DrawTile = GFX.DrawTileNomath;
DrawClippedTile = GFX.DrawClippedTileNomath; DrawClippedTile = GFX.DrawClippedTileNomath;
} }
@ -1539,8 +1562,8 @@ static void DrawBackgroundOffset (int bg, uint8 Zh, uint8 Zl, int VOffOff)
uint32 Left = GFX.Clip[bg].Left[clip]; uint32 Left = GFX.Clip[bg].Left[clip];
uint32 Right = GFX.Clip[bg].Right[clip]; uint32 Right = GFX.Clip[bg].Right[clip];
uint32 Offset = Left * PixWidth + Y * GFX.PPL; uint32 Offset = Left * PixWidth + Y * GFX.PPL;
uint32 LineHOffset = LineData[Y].BG[bg].HOffset; uint32 HScroll = LineData[Y].BG[bg].HOffset;
bool8 left_edge = (Left < (8 - (LineHOffset & 7))); bool8 left_edge = (Left < (8 - (HScroll & 7)));
uint32 Width = Right - Left; uint32 Width = Right - Left;
while (Left < Right) while (Left < Right)
@ -1551,12 +1574,12 @@ static void DrawBackgroundOffset (int bg, uint8 Zh, uint8 Zl, int VOffOff)
{ {
// SNES cannot do OPT for leftmost tile column // SNES cannot do OPT for leftmost tile column
VOffset = LineData[Y].BG[bg].VOffset; VOffset = LineData[Y].BG[bg].VOffset;
HOffset = LineHOffset; HOffset = HScroll;
left_edge = FALSE; left_edge = FALSE;
} }
else else
{ {
int HOffTile = ((HOff + Left - 1) & Offset2Mask) >> 3; int HOffTile = ((HOff + Left - 1) & Offset2Mask) >> 3;
if (BG.OffsetSizeH == 8) if (BG.OffsetSizeH == 8)
{ {
@ -1595,9 +1618,9 @@ static void DrawBackgroundOffset (int bg, uint8 Zh, uint8 Zl, int VOffOff)
VOffset = LineData[Y].BG[bg].VOffset; VOffset = LineData[Y].BG[bg].VOffset;
if (HCellOffset & OffsetEnableMask) if (HCellOffset & OffsetEnableMask)
HOffset = (HCellOffset & ~7) | (LineHOffset & 7); HOffset = (HCellOffset & ~7) | (HScroll & 7);
else else
HOffset = LineHOffset; HOffset = HScroll;
} }
if (HiresInterlace) if (HiresInterlace)
@ -1719,7 +1742,6 @@ static void DrawBackgroundOffsetMosaic (int bg, uint8 Zh, uint8 Zl, int VOffOff)
int Lines; int Lines;
int OffsetMask = (BG.TileSizeH == 16) ? 0x3ff : 0x1ff; int OffsetMask = (BG.TileSizeH == 16) ? 0x3ff : 0x1ff;
int OffsetShift = (BG.TileSizeV == 16) ? 4 : 3; int OffsetShift = (BG.TileSizeV == 16) ? 4 : 3;
int Offset2Mask = (BG.OffsetSizeH == 16) ? 0x3ff : 0x1ff;
int Offset2Shift = (BG.OffsetSizeV == 16) ? 4 : 3; int Offset2Shift = (BG.OffsetSizeV == 16) ? 4 : 3;
int OffsetEnableMask = 0x2000 << bg; int OffsetEnableMask = 0x2000 << bg;
int PixWidth = IPPU.DoubleWidthPixels ? 2 : 1; int PixWidth = IPPU.DoubleWidthPixels ? 2 : 1;
@ -1741,8 +1763,8 @@ static void DrawBackgroundOffsetMosaic (int bg, uint8 Zh, uint8 Zl, int VOffOff)
for (uint32 Y = GFX.StartY - MosaicStart; Y <= GFX.EndY; Y += PPU.Mosaic) for (uint32 Y = GFX.StartY - MosaicStart; Y <= GFX.EndY; Y += PPU.Mosaic)
{ {
uint32 Y2 = HiresInterlace ? Y * 2 : Y; uint32 Y2 = HiresInterlace ? Y * 2 : Y;
uint32 VOff = LineData[Y].BG[2].VOffset - 1; uint32 VOff = LineData[Y + MosaicStart].BG[2].VOffset - 1;
uint32 HOff = LineData[Y].BG[2].HOffset; uint32 HOff = LineData[Y + MosaicStart].BG[2].HOffset;
Lines = PPU.Mosaic - MosaicStart; Lines = PPU.Mosaic - MosaicStart;
if (Y + MosaicStart + Lines > GFX.EndY) if (Y + MosaicStart + Lines > GFX.EndY)
@ -1771,24 +1793,22 @@ static void DrawBackgroundOffsetMosaic (int bg, uint8 Zh, uint8 Zl, int VOffOff)
uint32 Left = GFX.Clip[bg].Left[clip]; uint32 Left = GFX.Clip[bg].Left[clip];
uint32 Right = GFX.Clip[bg].Right[clip]; uint32 Right = GFX.Clip[bg].Right[clip];
uint32 Offset = Left * PixWidth + (Y + MosaicStart) * GFX.PPL; uint32 Offset = Left * PixWidth + (Y + MosaicStart) * GFX.PPL;
uint32 LineHOffset = LineData[Y].BG[bg].HOffset; uint32 HScroll = LineData[Y + MosaicStart].BG[bg].HOffset;
bool8 left_edge = (Left < (8 - (LineHOffset & 7)));
uint32 Width = Right - Left; uint32 Width = Right - Left;
while (Left < Right) while (Left < Right)
{ {
uint32 VOffset, HOffset; uint32 VOffset, HOffset;
if (left_edge) if (Left < (8 - (HScroll & 7)))
{ {
// SNES cannot do OPT for leftmost tile column // SNES cannot do OPT for leftmost tile column
VOffset = LineData[Y].BG[bg].VOffset; VOffset = LineData[Y + MosaicStart].BG[bg].VOffset;
HOffset = LineHOffset; HOffset = HScroll;
left_edge = FALSE;
} }
else else
{ {
int HOffTile = ((HOff + Left - 1) & Offset2Mask) >> 3; int HOffTile = (((Left + (HScroll & 7)) - 8) + (HOff & ~7)) >> 3;
if (BG.OffsetSizeH == 8) if (BG.OffsetSizeH == 8)
{ {
@ -1824,12 +1844,12 @@ static void DrawBackgroundOffsetMosaic (int bg, uint8 Zh, uint8 Zl, int VOffOff)
if (VCellOffset & OffsetEnableMask) if (VCellOffset & OffsetEnableMask)
VOffset = VCellOffset + 1; VOffset = VCellOffset + 1;
else else
VOffset = LineData[Y].BG[bg].VOffset; VOffset = LineData[Y + MosaicStart].BG[bg].VOffset;
if (HCellOffset & OffsetEnableMask) if (HCellOffset & OffsetEnableMask)
HOffset = (HCellOffset & ~7) | (LineHOffset & 7); HOffset = (HCellOffset & ~7) | (HScroll & 7);
else else
HOffset = LineHOffset; HOffset = HScroll;
} }
if (HiresInterlace) if (HiresInterlace)
@ -2052,7 +2072,7 @@ static void DisplayPressedKeys (void)
static int KeyOrder[] = { 8, 10, 7, 9, 0, 6, 14, 13, 5, 1, 4, 3, 2, 11, 12 }; // < ^ > v A B Y X L R S s static int KeyOrder[] = { 8, 10, 7, 9, 0, 6, 14, 13, 5, 1, 4, 3, 2, 11, 12 }; // < ^ > v A B Y X L R S s
enum controllers controller; enum controllers controller;
int line = 1; int line = Settings.DisplayMovieFrame && S9xMovieActive() ? 2 : 1;
int8 ids[4]; int8 ids[4];
char string[255]; char string[255];
@ -2267,43 +2287,37 @@ void S9xDrawCrosshair (const char *crosshair, uint8 fgcolor, uint8 bgcolor, int1
fg = get_crosshair_color(fgcolor); fg = get_crosshair_color(fgcolor);
bg = get_crosshair_color(bgcolor); bg = get_crosshair_color(bgcolor);
// XXX: FIXME: why does it crash without this on Linux port? There are no out-of-bound writes without it... uint16 *s = GFX.Screen + y * (int32)GFX.RealPPL + x;
#if (defined(__unix) || defined(__linux) || defined(__sun) || defined(__DJGPP))
if (x >= 0 && y >= 0) for (r = 0; r < 15 * rx; r++, s += GFX.RealPPL - 15 * cx)
#endif
{ {
uint16 *s = GFX.Screen + y * GFX.RealPPL + x; if (y + r < 0)
for (r = 0; r < 15 * rx; r++, s += GFX.RealPPL - 15 * cx)
{ {
if (y + r < 0) s += 15 * cx;
{ continue;
s += 15 * cx; }
if (y + r >= H)
break;
for (c = 0; c < 15 * cx; c++, s++)
{
if (x + c < 0 || s < GFX.Screen)
continue; continue;
}
if (y + r >= H) if (x + c >= W)
break;
for (c = 0; c < 15 * cx; c++, s++)
{ {
if (x + c < 0 || s < GFX.Screen) s += 15 * cx - c;
continue; break;
if (x + c >= W)
{
s += 15 * cx - c;
break;
}
uint8 p = crosshair[(r / rx) * 15 + (c / cx)];
if (p == '#' && fgcolor)
*s = (fgcolor & 0x10) ? COLOR_ADD1_2(fg, *s) : fg;
else
if (p == '.' && bgcolor)
*s = (bgcolor & 0x10) ? COLOR_ADD1_2(*s, bg) : bg;
} }
uint8 p = crosshair[(r / rx) * 15 + (c / cx)];
if (p == '#' && fgcolor)
*s = (fgcolor & 0x10) ? COLOR_ADD1_2(fg, *s) : fg;
else
if (p == '.' && bgcolor)
*s = (bgcolor & 0x10) ? COLOR_ADD1_2(*s, bg) : bg;
} }
} }
} }

View File

@ -17,13 +17,20 @@
(c) Copyright 2002 - 2010 Brad Jorsch (anomie@users.sourceforge.net), (c) Copyright 2002 - 2010 Brad Jorsch (anomie@users.sourceforge.net),
Nach (n-a-c-h@users.sourceforge.net), Nach (n-a-c-h@users.sourceforge.net),
zones (kasumitokoduck@yahoo.com)
(c) Copyright 2002 - 2011 zones (kasumitokoduck@yahoo.com)
(c) Copyright 2006 - 2007 nitsuja (c) Copyright 2006 - 2007 nitsuja
(c) Copyright 2009 - 2010 BearOso, (c) Copyright 2009 - 2018 BearOso,
OV2 OV2
(c) Copyright 2017 qwertymodo
(c) Copyright 2011 - 2017 Hans-Kristian Arntzen,
Daniel De Matteis
(Under no circumstances will commercial rights be given)
BS-X C emulator code BS-X C emulator code
(c) Copyright 2005 - 2006 Dreamer Nom, (c) Copyright 2005 - 2006 Dreamer Nom,
@ -117,6 +124,9 @@
Sound emulator code used in 1.52+ Sound emulator code used in 1.52+
(c) Copyright 2004 - 2007 Shay Green (gblargg@gmail.com) (c) Copyright 2004 - 2007 Shay Green (gblargg@gmail.com)
S-SMP emulator code used in 1.54+
(c) Copyright 2016 byuu
SH assembler code partly based on x86 assembler code SH assembler code partly based on x86 assembler code
(c) Copyright 2002 - 2004 Marcus Comstedt (marcus@mc.pp.se) (c) Copyright 2002 - 2004 Marcus Comstedt (marcus@mc.pp.se)
@ -130,7 +140,7 @@
(c) Copyright 2006 - 2007 Shay Green (c) Copyright 2006 - 2007 Shay Green
GTK+ GUI code GTK+ GUI code
(c) Copyright 2004 - 2010 BearOso (c) Copyright 2004 - 2018 BearOso
Win32 GUI code Win32 GUI code
(c) Copyright 2003 - 2006 blip, (c) Copyright 2003 - 2006 blip,
@ -138,11 +148,16 @@
Matthew Kendora, Matthew Kendora,
Nach, Nach,
nitsuja nitsuja
(c) Copyright 2009 - 2010 OV2 (c) Copyright 2009 - 2018 OV2
Mac OS GUI code Mac OS GUI code
(c) Copyright 1998 - 2001 John Stiles (c) Copyright 1998 - 2001 John Stiles
(c) Copyright 2001 - 2010 zones (c) Copyright 2001 - 2011 zones
Libretro port
(c) Copyright 2011 - 2017 Hans-Kristian Arntzen,
Daniel De Matteis
(Under no circumstances will commercial rights be given)
Specific ports contains the works of other authors. See headers in Specific ports contains the works of other authors. See headers in
@ -344,6 +359,7 @@ void S9xBuildDirectColourMaps (void);
void RenderLine (uint8); void RenderLine (uint8);
void S9xComputeClipWindows (void); void S9xComputeClipWindows (void);
void S9xDisplayChar (uint16 *, uint8); void S9xDisplayChar (uint16 *, uint8);
void S9xGraphicsScreenResize (void);
// called automatically unless Settings.AutoDisplayMessages is false // called automatically unless Settings.AutoDisplayMessages is false
void S9xDisplayMessages (uint16 *, int, int, int, int); void S9xDisplayMessages (uint16 *, int, int, int, int);
#ifdef GFX_MULTI_FORMAT #ifdef GFX_MULTI_FORMAT

View File

@ -17,13 +17,20 @@
(c) Copyright 2002 - 2010 Brad Jorsch (anomie@users.sourceforge.net), (c) Copyright 2002 - 2010 Brad Jorsch (anomie@users.sourceforge.net),
Nach (n-a-c-h@users.sourceforge.net), Nach (n-a-c-h@users.sourceforge.net),
zones (kasumitokoduck@yahoo.com)
(c) Copyright 2002 - 2011 zones (kasumitokoduck@yahoo.com)
(c) Copyright 2006 - 2007 nitsuja (c) Copyright 2006 - 2007 nitsuja
(c) Copyright 2009 - 2010 BearOso, (c) Copyright 2009 - 2018 BearOso,
OV2 OV2
(c) Copyright 2017 qwertymodo
(c) Copyright 2011 - 2017 Hans-Kristian Arntzen,
Daniel De Matteis
(Under no circumstances will commercial rights be given)
BS-X C emulator code BS-X C emulator code
(c) Copyright 2005 - 2006 Dreamer Nom, (c) Copyright 2005 - 2006 Dreamer Nom,
@ -117,6 +124,9 @@
Sound emulator code used in 1.52+ Sound emulator code used in 1.52+
(c) Copyright 2004 - 2007 Shay Green (gblargg@gmail.com) (c) Copyright 2004 - 2007 Shay Green (gblargg@gmail.com)
S-SMP emulator code used in 1.54+
(c) Copyright 2016 byuu
SH assembler code partly based on x86 assembler code SH assembler code partly based on x86 assembler code
(c) Copyright 2002 - 2004 Marcus Comstedt (marcus@mc.pp.se) (c) Copyright 2002 - 2004 Marcus Comstedt (marcus@mc.pp.se)
@ -130,7 +140,7 @@
(c) Copyright 2006 - 2007 Shay Green (c) Copyright 2006 - 2007 Shay Green
GTK+ GUI code GTK+ GUI code
(c) Copyright 2004 - 2010 BearOso (c) Copyright 2004 - 2018 BearOso
Win32 GUI code Win32 GUI code
(c) Copyright 2003 - 2006 blip, (c) Copyright 2003 - 2006 blip,
@ -138,11 +148,16 @@
Matthew Kendora, Matthew Kendora,
Nach, Nach,
nitsuja nitsuja
(c) Copyright 2009 - 2010 OV2 (c) Copyright 2009 - 2018 OV2
Mac OS GUI code Mac OS GUI code
(c) Copyright 1998 - 2001 John Stiles (c) Copyright 1998 - 2001 John Stiles
(c) Copyright 2001 - 2010 zones (c) Copyright 2001 - 2011 zones
Libretro port
(c) Copyright 2011 - 2017 Hans-Kristian Arntzen,
Daniel De Matteis
(Under no circumstances will commercial rights be given)
Specific ports contains the works of other authors. See headers in Specific ports contains the works of other authors. See headers in

View File

@ -17,13 +17,20 @@
(c) Copyright 2002 - 2010 Brad Jorsch (anomie@users.sourceforge.net), (c) Copyright 2002 - 2010 Brad Jorsch (anomie@users.sourceforge.net),
Nach (n-a-c-h@users.sourceforge.net), Nach (n-a-c-h@users.sourceforge.net),
zones (kasumitokoduck@yahoo.com)
(c) Copyright 2002 - 2011 zones (kasumitokoduck@yahoo.com)
(c) Copyright 2006 - 2007 nitsuja (c) Copyright 2006 - 2007 nitsuja
(c) Copyright 2009 - 2010 BearOso, (c) Copyright 2009 - 2018 BearOso,
OV2 OV2
(c) Copyright 2017 qwertymodo
(c) Copyright 2011 - 2017 Hans-Kristian Arntzen,
Daniel De Matteis
(Under no circumstances will commercial rights be given)
BS-X C emulator code BS-X C emulator code
(c) Copyright 2005 - 2006 Dreamer Nom, (c) Copyright 2005 - 2006 Dreamer Nom,
@ -117,6 +124,9 @@
Sound emulator code used in 1.52+ Sound emulator code used in 1.52+
(c) Copyright 2004 - 2007 Shay Green (gblargg@gmail.com) (c) Copyright 2004 - 2007 Shay Green (gblargg@gmail.com)
S-SMP emulator code used in 1.54+
(c) Copyright 2016 byuu
SH assembler code partly based on x86 assembler code SH assembler code partly based on x86 assembler code
(c) Copyright 2002 - 2004 Marcus Comstedt (marcus@mc.pp.se) (c) Copyright 2002 - 2004 Marcus Comstedt (marcus@mc.pp.se)
@ -130,7 +140,7 @@
(c) Copyright 2006 - 2007 Shay Green (c) Copyright 2006 - 2007 Shay Green
GTK+ GUI code GTK+ GUI code
(c) Copyright 2004 - 2010 BearOso (c) Copyright 2004 - 2018 BearOso
Win32 GUI code Win32 GUI code
(c) Copyright 2003 - 2006 blip, (c) Copyright 2003 - 2006 blip,
@ -138,11 +148,16 @@
Matthew Kendora, Matthew Kendora,
Nach, Nach,
nitsuja nitsuja
(c) Copyright 2009 - 2010 OV2 (c) Copyright 2009 - 2018 OV2
Mac OS GUI code Mac OS GUI code
(c) Copyright 1998 - 2001 John Stiles (c) Copyright 1998 - 2001 John Stiles
(c) Copyright 2001 - 2010 zones (c) Copyright 2001 - 2011 zones
Libretro port
(c) Copyright 2011 - 2017 Hans-Kristian Arntzen,
Daniel De Matteis
(Under no circumstances will commercial rights be given)
Specific ports contains the works of other authors. See headers in Specific ports contains the works of other authors. See headers in
@ -195,7 +210,7 @@
#define SAVE_INFO_LOAD "Loaded" #define SAVE_INFO_LOAD "Loaded"
#define SAVE_INFO_OOPS "Auto-saving 'oops' snapshot" #define SAVE_INFO_OOPS "Auto-saving 'oops' snapshot"
#define SAVE_ERR_WRONG_FORMAT "File not in Snes9x snapshot format" #define SAVE_ERR_WRONG_FORMAT "File not in Snes9x snapshot format"
#define SAVE_ERR_WRONG_VERSION "Incompatable snapshot version" #define SAVE_ERR_WRONG_VERSION "Incompatible snapshot version"
#define SAVE_ERR_ROM_NOT_FOUND "ROM image \"%s\" for snapshot not found" #define SAVE_ERR_ROM_NOT_FOUND "ROM image \"%s\" for snapshot not found"
#define SAVE_ERR_SAVE_NOT_FOUND "Snapshot %s does not exist" #define SAVE_ERR_SAVE_NOT_FOUND "Snapshot %s does not exist"

View File

@ -17,13 +17,20 @@
(c) Copyright 2002 - 2010 Brad Jorsch (anomie@users.sourceforge.net), (c) Copyright 2002 - 2010 Brad Jorsch (anomie@users.sourceforge.net),
Nach (n-a-c-h@users.sourceforge.net), Nach (n-a-c-h@users.sourceforge.net),
zones (kasumitokoduck@yahoo.com)
(c) Copyright 2002 - 2011 zones (kasumitokoduck@yahoo.com)
(c) Copyright 2006 - 2007 nitsuja (c) Copyright 2006 - 2007 nitsuja
(c) Copyright 2009 - 2010 BearOso, (c) Copyright 2009 - 2018 BearOso,
OV2 OV2
(c) Copyright 2017 qwertymodo
(c) Copyright 2011 - 2017 Hans-Kristian Arntzen,
Daniel De Matteis
(Under no circumstances will commercial rights be given)
BS-X C emulator code BS-X C emulator code
(c) Copyright 2005 - 2006 Dreamer Nom, (c) Copyright 2005 - 2006 Dreamer Nom,
@ -117,6 +124,9 @@
Sound emulator code used in 1.52+ Sound emulator code used in 1.52+
(c) Copyright 2004 - 2007 Shay Green (gblargg@gmail.com) (c) Copyright 2004 - 2007 Shay Green (gblargg@gmail.com)
S-SMP emulator code used in 1.54+
(c) Copyright 2016 byuu
SH assembler code partly based on x86 assembler code SH assembler code partly based on x86 assembler code
(c) Copyright 2002 - 2004 Marcus Comstedt (marcus@mc.pp.se) (c) Copyright 2002 - 2004 Marcus Comstedt (marcus@mc.pp.se)
@ -130,7 +140,7 @@
(c) Copyright 2006 - 2007 Shay Green (c) Copyright 2006 - 2007 Shay Green
GTK+ GUI code GTK+ GUI code
(c) Copyright 2004 - 2010 BearOso (c) Copyright 2004 - 2018 BearOso
Win32 GUI code Win32 GUI code
(c) Copyright 2003 - 2006 blip, (c) Copyright 2003 - 2006 blip,
@ -138,11 +148,16 @@
Matthew Kendora, Matthew Kendora,
Nach, Nach,
nitsuja nitsuja
(c) Copyright 2009 - 2010 OV2 (c) Copyright 2009 - 2018 OV2
Mac OS GUI code Mac OS GUI code
(c) Copyright 1998 - 2001 John Stiles (c) Copyright 1998 - 2001 John Stiles
(c) Copyright 2001 - 2010 zones (c) Copyright 2001 - 2011 zones
Libretro port
(c) Copyright 2011 - 2017 Hans-Kristian Arntzen,
Daniel De Matteis
(Under no circumstances will commercial rights be given)
Specific ports contains the works of other authors. See headers in Specific ports contains the works of other authors. See headers in

View File

@ -17,13 +17,20 @@
(c) Copyright 2002 - 2010 Brad Jorsch (anomie@users.sourceforge.net), (c) Copyright 2002 - 2010 Brad Jorsch (anomie@users.sourceforge.net),
Nach (n-a-c-h@users.sourceforge.net), Nach (n-a-c-h@users.sourceforge.net),
zones (kasumitokoduck@yahoo.com)
(c) Copyright 2002 - 2011 zones (kasumitokoduck@yahoo.com)
(c) Copyright 2006 - 2007 nitsuja (c) Copyright 2006 - 2007 nitsuja
(c) Copyright 2009 - 2010 BearOso, (c) Copyright 2009 - 2018 BearOso,
OV2 OV2
(c) Copyright 2017 qwertymodo
(c) Copyright 2011 - 2017 Hans-Kristian Arntzen,
Daniel De Matteis
(Under no circumstances will commercial rights be given)
BS-X C emulator code BS-X C emulator code
(c) Copyright 2005 - 2006 Dreamer Nom, (c) Copyright 2005 - 2006 Dreamer Nom,
@ -117,6 +124,9 @@
Sound emulator code used in 1.52+ Sound emulator code used in 1.52+
(c) Copyright 2004 - 2007 Shay Green (gblargg@gmail.com) (c) Copyright 2004 - 2007 Shay Green (gblargg@gmail.com)
S-SMP emulator code used in 1.54+
(c) Copyright 2016 byuu
SH assembler code partly based on x86 assembler code SH assembler code partly based on x86 assembler code
(c) Copyright 2002 - 2004 Marcus Comstedt (marcus@mc.pp.se) (c) Copyright 2002 - 2004 Marcus Comstedt (marcus@mc.pp.se)
@ -130,7 +140,7 @@
(c) Copyright 2006 - 2007 Shay Green (c) Copyright 2006 - 2007 Shay Green
GTK+ GUI code GTK+ GUI code
(c) Copyright 2004 - 2010 BearOso (c) Copyright 2004 - 2018 BearOso
Win32 GUI code Win32 GUI code
(c) Copyright 2003 - 2006 blip, (c) Copyright 2003 - 2006 blip,
@ -138,11 +148,16 @@
Matthew Kendora, Matthew Kendora,
Nach, Nach,
nitsuja nitsuja
(c) Copyright 2009 - 2010 OV2 (c) Copyright 2009 - 2018 OV2
Mac OS GUI code Mac OS GUI code
(c) Copyright 1998 - 2001 John Stiles (c) Copyright 1998 - 2001 John Stiles
(c) Copyright 2001 - 2010 zones (c) Copyright 2001 - 2011 zones
Libretro port
(c) Copyright 2011 - 2017 Hans-Kristian Arntzen,
Daniel De Matteis
(Under no circumstances will commercial rights be given)
Specific ports contains the works of other authors. See headers in Specific ports contains the works of other authors. See headers in

View File

@ -1401,6 +1401,20 @@ int CMemory::ScoreLoROM (bool8 skip_header, int32 romoff)
return (score); return (score);
} }
int CMemory::First512BytesCountZeroes() const
{
const uint8 *buf = ROM;
int zeroCount = 0;
for (int i = 0; i < 512; i++)
{
if (buf[i] == 0)
{
zeroCount++;
}
}
return zeroCount;
}
uint32 CMemory::HeaderRemove (uint32 size, uint8 *buf) uint32 CMemory::HeaderRemove (uint32 size, uint8 *buf)
{ {
uint32 calc_size = (size / 0x2000) * 0x2000; uint32 calc_size = (size / 0x2000) * 0x2000;
@ -1616,13 +1630,21 @@ bool8 CMemory::LoadROMInt (int32 ROMfillSize)
ExtendedFormat = NOPE; ExtendedFormat = NOPE;
int hi_score, lo_score; int hi_score, lo_score;
int score_headered;
int score_nonheadered;
hi_score = ScoreHiROM(FALSE); hi_score = ScoreHiROM(FALSE);
lo_score = ScoreLoROM(FALSE); lo_score = ScoreLoROM(FALSE);
score_nonheadered = max(hi_score, lo_score);
score_headered = max(ScoreHiROM(TRUE), ScoreLoROM(TRUE));
if (HeaderCount == 0 && !Settings.ForceNoHeader && bool size_is_likely_headered = ((ROMfillSize - 512) & 0xFFFF) == 0;
((hi_score > lo_score && ScoreHiROM(TRUE) > hi_score) || if (size_is_likely_headered) { score_headered += 2; } else { score_headered -= 2; }
(hi_score <= lo_score && ScoreLoROM(TRUE) > lo_score))) if (First512BytesCountZeroes() >= 0x1E0) { score_headered += 2; } else { score_headered -= 2; }
bool headered_score_highest = score_headered > score_nonheadered;
if (HeaderCount == 0 && !Settings.ForceNoHeader && headered_score_highest)
{ {
memmove(ROM, ROM + 512, ROMfillSize - 512); memmove(ROM, ROM + 512, ROMfillSize - 512);
ROMfillSize -= 512; ROMfillSize -= 512;
@ -3850,7 +3872,7 @@ void CMemory::ApplyROMFixes (void)
Timings.HDMAStart = SNES_HDMA_START_HC + Settings.HDMATimingHack - 100; Timings.HDMAStart = SNES_HDMA_START_HC + Settings.HDMATimingHack - 100;
Timings.HBlankStart = SNES_HBLANK_START_HC + Timings.HDMAStart - SNES_HDMA_START_HC; Timings.HBlankStart = SNES_HBLANK_START_HC + Timings.HDMAStart - SNES_HDMA_START_HC;
Timings.IRQTriggerCycles = 10; Timings.IRQTriggerCycles = 14;
if (!Settings.DisableGameSpecificHacks) if (!Settings.DisableGameSpecificHacks)
{ {

View File

@ -294,6 +294,7 @@ struct CMemory
int ScoreHiROM (bool8, int32 romoff = 0); int ScoreHiROM (bool8, int32 romoff = 0);
int ScoreLoROM (bool8, int32 romoff = 0); int ScoreLoROM (bool8, int32 romoff = 0);
int First512BytesCountZeroes() const;
uint32 HeaderRemove (uint32, uint8 *); uint32 HeaderRemove (uint32, uint8 *);
uint32 FileLoader (uint8 *, const char *, uint32); uint32 FileLoader (uint8 *, const char *, uint32);
uint32 MemLoader (uint8 *, const char*, uint32); uint32 MemLoader (uint8 *, const char*, uint32);

View File

@ -17,13 +17,20 @@
(c) Copyright 2002 - 2010 Brad Jorsch (anomie@users.sourceforge.net), (c) Copyright 2002 - 2010 Brad Jorsch (anomie@users.sourceforge.net),
Nach (n-a-c-h@users.sourceforge.net), Nach (n-a-c-h@users.sourceforge.net),
zones (kasumitokoduck@yahoo.com)
(c) Copyright 2002 - 2011 zones (kasumitokoduck@yahoo.com)
(c) Copyright 2006 - 2007 nitsuja (c) Copyright 2006 - 2007 nitsuja
(c) Copyright 2009 - 2010 BearOso, (c) Copyright 2009 - 2018 BearOso,
OV2 OV2
(c) Copyright 2017 qwertymodo
(c) Copyright 2011 - 2017 Hans-Kristian Arntzen,
Daniel De Matteis
(Under no circumstances will commercial rights be given)
BS-X C emulator code BS-X C emulator code
(c) Copyright 2005 - 2006 Dreamer Nom, (c) Copyright 2005 - 2006 Dreamer Nom,
@ -117,6 +124,9 @@
Sound emulator code used in 1.52+ Sound emulator code used in 1.52+
(c) Copyright 2004 - 2007 Shay Green (gblargg@gmail.com) (c) Copyright 2004 - 2007 Shay Green (gblargg@gmail.com)
S-SMP emulator code used in 1.54+
(c) Copyright 2016 byuu
SH assembler code partly based on x86 assembler code SH assembler code partly based on x86 assembler code
(c) Copyright 2002 - 2004 Marcus Comstedt (marcus@mc.pp.se) (c) Copyright 2002 - 2004 Marcus Comstedt (marcus@mc.pp.se)
@ -130,7 +140,7 @@
(c) Copyright 2006 - 2007 Shay Green (c) Copyright 2006 - 2007 Shay Green
GTK+ GUI code GTK+ GUI code
(c) Copyright 2004 - 2010 BearOso (c) Copyright 2004 - 2018 BearOso
Win32 GUI code Win32 GUI code
(c) Copyright 2003 - 2006 blip, (c) Copyright 2003 - 2006 blip,
@ -138,11 +148,16 @@
Matthew Kendora, Matthew Kendora,
Nach, Nach,
nitsuja nitsuja
(c) Copyright 2009 - 2010 OV2 (c) Copyright 2009 - 2018 OV2
Mac OS GUI code Mac OS GUI code
(c) Copyright 1998 - 2001 John Stiles (c) Copyright 1998 - 2001 John Stiles
(c) Copyright 2001 - 2010 zones (c) Copyright 2001 - 2011 zones
Libretro port
(c) Copyright 2011 - 2017 Hans-Kristian Arntzen,
Daniel De Matteis
(Under no circumstances will commercial rights be given)
Specific ports contains the works of other authors. See headers in Specific ports contains the works of other authors. See headers in

View File

@ -17,13 +17,20 @@
(c) Copyright 2002 - 2010 Brad Jorsch (anomie@users.sourceforge.net), (c) Copyright 2002 - 2010 Brad Jorsch (anomie@users.sourceforge.net),
Nach (n-a-c-h@users.sourceforge.net), Nach (n-a-c-h@users.sourceforge.net),
zones (kasumitokoduck@yahoo.com)
(c) Copyright 2002 - 2011 zones (kasumitokoduck@yahoo.com)
(c) Copyright 2006 - 2007 nitsuja (c) Copyright 2006 - 2007 nitsuja
(c) Copyright 2009 - 2010 BearOso, (c) Copyright 2009 - 2018 BearOso,
OV2 OV2
(c) Copyright 2017 qwertymodo
(c) Copyright 2011 - 2017 Hans-Kristian Arntzen,
Daniel De Matteis
(Under no circumstances will commercial rights be given)
BS-X C emulator code BS-X C emulator code
(c) Copyright 2005 - 2006 Dreamer Nom, (c) Copyright 2005 - 2006 Dreamer Nom,
@ -117,6 +124,9 @@
Sound emulator code used in 1.52+ Sound emulator code used in 1.52+
(c) Copyright 2004 - 2007 Shay Green (gblargg@gmail.com) (c) Copyright 2004 - 2007 Shay Green (gblargg@gmail.com)
S-SMP emulator code used in 1.54+
(c) Copyright 2016 byuu
SH assembler code partly based on x86 assembler code SH assembler code partly based on x86 assembler code
(c) Copyright 2002 - 2004 Marcus Comstedt (marcus@mc.pp.se) (c) Copyright 2002 - 2004 Marcus Comstedt (marcus@mc.pp.se)
@ -130,7 +140,7 @@
(c) Copyright 2006 - 2007 Shay Green (c) Copyright 2006 - 2007 Shay Green
GTK+ GUI code GTK+ GUI code
(c) Copyright 2004 - 2010 BearOso (c) Copyright 2004 - 2018 BearOso
Win32 GUI code Win32 GUI code
(c) Copyright 2003 - 2006 blip, (c) Copyright 2003 - 2006 blip,
@ -138,11 +148,16 @@
Matthew Kendora, Matthew Kendora,
Nach, Nach,
nitsuja nitsuja
(c) Copyright 2009 - 2010 OV2 (c) Copyright 2009 - 2018 OV2
Mac OS GUI code Mac OS GUI code
(c) Copyright 1998 - 2001 John Stiles (c) Copyright 1998 - 2001 John Stiles
(c) Copyright 2001 - 2010 zones (c) Copyright 2001 - 2011 zones
Libretro port
(c) Copyright 2011 - 2017 Hans-Kristian Arntzen,
Daniel De Matteis
(Under no circumstances will commercial rights be given)
Specific ports contains the works of other authors. See headers in Specific ports contains the works of other authors. See headers in

View File

@ -17,13 +17,20 @@
(c) Copyright 2002 - 2010 Brad Jorsch (anomie@users.sourceforge.net), (c) Copyright 2002 - 2010 Brad Jorsch (anomie@users.sourceforge.net),
Nach (n-a-c-h@users.sourceforge.net), Nach (n-a-c-h@users.sourceforge.net),
zones (kasumitokoduck@yahoo.com)
(c) Copyright 2002 - 2011 zones (kasumitokoduck@yahoo.com)
(c) Copyright 2006 - 2007 nitsuja (c) Copyright 2006 - 2007 nitsuja
(c) Copyright 2009 - 2010 BearOso, (c) Copyright 2009 - 2018 BearOso,
OV2 OV2
(c) Copyright 2017 qwertymodo
(c) Copyright 2011 - 2017 Hans-Kristian Arntzen,
Daniel De Matteis
(Under no circumstances will commercial rights be given)
BS-X C emulator code BS-X C emulator code
(c) Copyright 2005 - 2006 Dreamer Nom, (c) Copyright 2005 - 2006 Dreamer Nom,
@ -117,6 +124,9 @@
Sound emulator code used in 1.52+ Sound emulator code used in 1.52+
(c) Copyright 2004 - 2007 Shay Green (gblargg@gmail.com) (c) Copyright 2004 - 2007 Shay Green (gblargg@gmail.com)
S-SMP emulator code used in 1.54+
(c) Copyright 2016 byuu
SH assembler code partly based on x86 assembler code SH assembler code partly based on x86 assembler code
(c) Copyright 2002 - 2004 Marcus Comstedt (marcus@mc.pp.se) (c) Copyright 2002 - 2004 Marcus Comstedt (marcus@mc.pp.se)
@ -130,7 +140,7 @@
(c) Copyright 2006 - 2007 Shay Green (c) Copyright 2006 - 2007 Shay Green
GTK+ GUI code GTK+ GUI code
(c) Copyright 2004 - 2010 BearOso (c) Copyright 2004 - 2018 BearOso
Win32 GUI code Win32 GUI code
(c) Copyright 2003 - 2006 blip, (c) Copyright 2003 - 2006 blip,
@ -138,11 +148,16 @@
Matthew Kendora, Matthew Kendora,
Nach, Nach,
nitsuja nitsuja
(c) Copyright 2009 - 2010 OV2 (c) Copyright 2009 - 2018 OV2
Mac OS GUI code Mac OS GUI code
(c) Copyright 1998 - 2001 John Stiles (c) Copyright 1998 - 2001 John Stiles
(c) Copyright 2001 - 2010 zones (c) Copyright 2001 - 2011 zones
Libretro port
(c) Copyright 2011 - 2017 Hans-Kristian Arntzen,
Daniel De Matteis
(Under no circumstances will commercial rights be given)
Specific ports contains the works of other authors. See headers in Specific ports contains the works of other authors. See headers in
@ -437,14 +452,14 @@ static void reset_controllers (void)
MovieSetJoypad(i, 0); MovieSetJoypad(i, 0);
uint8 clearedMouse[MOUSE_DATA_SIZE]; uint8 clearedMouse[MOUSE_DATA_SIZE];
ZeroMemory(clearedMouse, MOUSE_DATA_SIZE); memset(clearedMouse, 0, MOUSE_DATA_SIZE);
clearedMouse[4] = 1; clearedMouse[4] = 1;
uint8 clearedScope[SCOPE_DATA_SIZE]; uint8 clearedScope[SCOPE_DATA_SIZE];
ZeroMemory(clearedScope, SCOPE_DATA_SIZE); memset(clearedScope, 0, SCOPE_DATA_SIZE);
uint8 clearedJustifier[JUSTIFIER_DATA_SIZE]; uint8 clearedJustifier[JUSTIFIER_DATA_SIZE];
ZeroMemory(clearedJustifier, JUSTIFIER_DATA_SIZE); memset(clearedJustifier, 0, JUSTIFIER_DATA_SIZE);
for (int p = 0; p < 2; p++) for (int p = 0; p < 2; p++)
{ {
@ -639,7 +654,7 @@ static void write_movie_header (FILE *fd, SMovie *movie)
{ {
uint8 buf[SMV_HEADER_SIZE], *ptr = buf; uint8 buf[SMV_HEADER_SIZE], *ptr = buf;
ZeroMemory(buf, sizeof(buf)); memset(buf, 0, sizeof(buf));
Write32(SMV_MAGIC, ptr); Write32(SMV_MAGIC, ptr);
Write32(SMV_VERSION, ptr); Write32(SMV_VERSION, ptr);
@ -771,7 +786,8 @@ int S9xMovieUnfreeze (uint8 *buf, uint32 size)
} }
else else
{ {
if (current_frame > Movie.MaxFrame || current_sample > Movie.MaxSample || memcmp(Movie.InputBuffer, ptr, space_needed)) uint32 space_processed = (Movie.BytesPerSample * (current_sample + 1));
if (current_frame > Movie.MaxFrame || current_sample > Movie.MaxSample || memcmp(Movie.InputBuffer, ptr, space_processed))
return (SNAPSHOT_INCONSISTENT); return (SNAPSHOT_INCONSISTENT);
change_state(MOVIE_STATE_PLAY); change_state(MOVIE_STATE_PLAY);
@ -812,14 +828,16 @@ int S9xMovieOpen (const char *filename, bool8 read_only)
read_movie_extrarominfo(fd, &Movie); read_movie_extrarominfo(fd, &Movie);
fn = dup(fileno(fd)); fflush(fd);
fclose(fd); fn = fileno(fd);
store_previous_settings(); store_previous_settings();
restore_movie_settings(); restore_movie_settings();
lseek(fn, Movie.SaveStateOffset, SEEK_SET); lseek(fn, Movie.SaveStateOffset, SEEK_SET);
stream = REOPEN_STREAM(fn, "rb");
// reopen stream to access as gzipped data
stream = REOPEN_STREAM(fn, "rb");
if (!stream) if (!stream)
return (FILE_NOT_FOUND); return (FILE_NOT_FOUND);
@ -832,7 +850,11 @@ int S9xMovieOpen (const char *filename, bool8 read_only)
else else
result = S9xUnfreezeFromStream(stream); result = S9xUnfreezeFromStream(stream);
CLOSE_STREAM(stream); // do not close stream but close FILE *
// (msvcrt will try to close all open FILE *handles on exit - if we do CLOSE_STREAM here
// the underlying file will be closed by zlib, causing problems when msvcrt tries to do it)
delete stream;
fclose(fd);
if (result != SUCCESS) if (result != SUCCESS)
return (result); return (result);
@ -846,7 +868,10 @@ int S9xMovieOpen (const char *filename, bool8 read_only)
} }
if (fseek(fd, Movie.ControllerDataOffset, SEEK_SET)) if (fseek(fd, Movie.ControllerDataOffset, SEEK_SET))
{
fclose(fd);
return (WRONG_FORMAT); return (WRONG_FORMAT);
}
Movie.File = fd; Movie.File = fd;
Movie.BytesPerSample = bytes_per_sample(); Movie.BytesPerSample = bytes_per_sample();
@ -879,7 +904,6 @@ int S9xMovieCreate (const char *filename, uint8 controllers_mask, uint8 opts, co
{ {
FILE *fd; FILE *fd;
STREAM stream; STREAM stream;
int fn;
if (controllers_mask == 0) if (controllers_mask == 0)
return (WRONG_FORMAT); return (WRONG_FORMAT);
@ -928,10 +952,9 @@ int S9xMovieCreate (const char *filename, uint8 controllers_mask, uint8 opts, co
write_movie_extrarominfo(fd, &Movie); write_movie_extrarominfo(fd, &Movie);
fn = dup(fileno(fd));
fclose(fd); fclose(fd);
stream = REOPEN_STREAM(fn, "ab"); stream = OPEN_STREAM(filename, "ab");
if (!stream) if (!stream)
return (FILE_NOT_FOUND); return (FILE_NOT_FOUND);
@ -989,14 +1012,17 @@ int S9xMovieGetInfo (const char *filename, struct MovieInfo *info)
flush_movie(); flush_movie();
ZeroMemory(info, sizeof(*info)); memset(info, 0, sizeof(*info));
if (!(fd = fopen(filename, "rb"))) if (!(fd = fopen(filename, "rb")))
return (FILE_NOT_FOUND); return (FILE_NOT_FOUND);
result = read_movie_header(fd, &local_movie); result = read_movie_header(fd, &local_movie);
if (result != SUCCESS) if (result != SUCCESS)
{
fclose(fd);
return (result); return (result);
}
info->TimeCreated = (time_t) local_movie.MovieId; info->TimeCreated = (time_t) local_movie.MovieId;
info->Version = local_movie.Version; info->Version = local_movie.Version;
@ -1035,9 +1061,10 @@ int S9xMovieGetInfo (const char *filename, struct MovieInfo *info)
strncpy(info->ROMName, local_movie.ROMName, 23); strncpy(info->ROMName, local_movie.ROMName, 23);
fclose(fd); fclose(fd);
if ((fd = fopen(filename, "r+")) == NULL)
if (access(filename, W_OK))
info->ReadOnly = true; info->ReadOnly = true;
else
fclose(fd);
return (SUCCESS); return (SUCCESS);
} }
@ -1117,7 +1144,7 @@ void S9xMovieUpdateOnReset (void)
void S9xMovieInit (void) void S9xMovieInit (void)
{ {
ZeroMemory(&Movie, sizeof(Movie)); memset(&Movie, 0, sizeof(Movie));
Movie.State = MOVIE_STATE_NONE; Movie.State = MOVIE_STATE_NONE;
} }

View File

@ -17,13 +17,20 @@
(c) Copyright 2002 - 2010 Brad Jorsch (anomie@users.sourceforge.net), (c) Copyright 2002 - 2010 Brad Jorsch (anomie@users.sourceforge.net),
Nach (n-a-c-h@users.sourceforge.net), Nach (n-a-c-h@users.sourceforge.net),
zones (kasumitokoduck@yahoo.com)
(c) Copyright 2002 - 2011 zones (kasumitokoduck@yahoo.com)
(c) Copyright 2006 - 2007 nitsuja (c) Copyright 2006 - 2007 nitsuja
(c) Copyright 2009 - 2010 BearOso, (c) Copyright 2009 - 2018 BearOso,
OV2 OV2
(c) Copyright 2017 qwertymodo
(c) Copyright 2011 - 2017 Hans-Kristian Arntzen,
Daniel De Matteis
(Under no circumstances will commercial rights be given)
BS-X C emulator code BS-X C emulator code
(c) Copyright 2005 - 2006 Dreamer Nom, (c) Copyright 2005 - 2006 Dreamer Nom,
@ -117,6 +124,9 @@
Sound emulator code used in 1.52+ Sound emulator code used in 1.52+
(c) Copyright 2004 - 2007 Shay Green (gblargg@gmail.com) (c) Copyright 2004 - 2007 Shay Green (gblargg@gmail.com)
S-SMP emulator code used in 1.54+
(c) Copyright 2016 byuu
SH assembler code partly based on x86 assembler code SH assembler code partly based on x86 assembler code
(c) Copyright 2002 - 2004 Marcus Comstedt (marcus@mc.pp.se) (c) Copyright 2002 - 2004 Marcus Comstedt (marcus@mc.pp.se)
@ -130,7 +140,7 @@
(c) Copyright 2006 - 2007 Shay Green (c) Copyright 2006 - 2007 Shay Green
GTK+ GUI code GTK+ GUI code
(c) Copyright 2004 - 2010 BearOso (c) Copyright 2004 - 2018 BearOso
Win32 GUI code Win32 GUI code
(c) Copyright 2003 - 2006 blip, (c) Copyright 2003 - 2006 blip,
@ -138,11 +148,16 @@
Matthew Kendora, Matthew Kendora,
Nach, Nach,
nitsuja nitsuja
(c) Copyright 2009 - 2010 OV2 (c) Copyright 2009 - 2018 OV2
Mac OS GUI code Mac OS GUI code
(c) Copyright 1998 - 2001 John Stiles (c) Copyright 1998 - 2001 John Stiles
(c) Copyright 2001 - 2010 zones (c) Copyright 2001 - 2011 zones
Libretro port
(c) Copyright 2011 - 2017 Hans-Kristian Arntzen,
Daniel De Matteis
(Under no circumstances will commercial rights be given)
Specific ports contains the works of other authors. See headers in Specific ports contains the works of other authors. See headers in
@ -184,10 +199,8 @@
#define MOVIE_OPT_NOSAVEDATA (1 << 2) #define MOVIE_OPT_NOSAVEDATA (1 << 2)
#define MOVIE_SYNC_DATA_EXISTS 0x01 #define MOVIE_SYNC_DATA_EXISTS 0x01
#define MOVIE_SYNC_OBSOLETE 0x02 #define MOVIE_SYNC_OBSOLETE 0x02
#define MOVIE_SYNC_LEFTRIGHT 0x04
#define MOVIE_SYNC_VOLUMEENVX 0x08 #define MOVIE_SYNC_VOLUMEENVX 0x08
#define MOVIE_SYNC_FAKEMUTE 0x10 #define MOVIE_SYNC_FAKEMUTE 0x10
#define MOVIE_SYNC_SYNCSOUND 0x20
#define MOVIE_SYNC_HASROMINFO 0x40 #define MOVIE_SYNC_HASROMINFO 0x40
#define MOVIE_SYNC_NOCPUSHUTDOWN 0x80 #define MOVIE_SYNC_NOCPUSHUTDOWN 0x80
#define MOVIE_MAX_METADATA 512 #define MOVIE_MAX_METADATA 512

View File

@ -22,10 +22,12 @@
(c) Copyright 2006 - 2007 nitsuja (c) Copyright 2006 - 2007 nitsuja
(c) Copyright 2009 - 2016 BearOso, (c) Copyright 2009 - 2018 BearOso,
OV2 OV2
(c) Copyright 2011 - 2016 Hans-Kristian Arntzen, (c) Copyright 2017 qwertymodo
(c) Copyright 2011 - 2017 Hans-Kristian Arntzen,
Daniel De Matteis Daniel De Matteis
(Under no circumstances will commercial rights be given) (Under no circumstances will commercial rights be given)
@ -138,7 +140,7 @@
(c) Copyright 2006 - 2007 Shay Green (c) Copyright 2006 - 2007 Shay Green
GTK+ GUI code GTK+ GUI code
(c) Copyright 2004 - 2016 BearOso (c) Copyright 2004 - 2018 BearOso
Win32 GUI code Win32 GUI code
(c) Copyright 2003 - 2006 blip, (c) Copyright 2003 - 2006 blip,
@ -146,14 +148,14 @@
Matthew Kendora, Matthew Kendora,
Nach, Nach,
nitsuja nitsuja
(c) Copyright 2009 - 2016 OV2 (c) Copyright 2009 - 2018 OV2
Mac OS GUI code Mac OS GUI code
(c) Copyright 1998 - 2001 John Stiles (c) Copyright 1998 - 2001 John Stiles
(c) Copyright 2001 - 2011 zones (c) Copyright 2001 - 2011 zones
Libretro port Libretro port
(c) Copyright 2011 - 2016 Hans-Kristian Arntzen, (c) Copyright 2011 - 2017 Hans-Kristian Arntzen,
Daniel De Matteis Daniel De Matteis
(Under no circumstances will commercial rights be given) (Under no circumstances will commercial rights be given)
@ -190,12 +192,14 @@
Nintendo Co., Limited and its subsidiary companies. Nintendo Co., Limited and its subsidiary companies.
***********************************************************************************/ ***********************************************************************************/
#include "msu1.h" #include "snes9x.h"
#include "display.h"
#include "filebrowser.h"
#include "memmap.h" #include "memmap.h"
#include "snes9xgx.h" #include "display.h"
#include "msu1.h"
#include "apu/blargg_endian.h" #include "apu/blargg_endian.h"
#include "snes9xgx.h"
#include <fstream>
#include <sys/stat.h>
STREAM dataStream = NULL; STREAM dataStream = NULL;
STREAM audioStream = NULL; STREAM audioStream = NULL;
@ -241,9 +245,12 @@ static int unzFindExtension(unzFile &file, const char *ext, bool restart = TRUE,
STREAM S9xMSU1OpenFile(const char *msu_ext, bool skip_unpacked) STREAM S9xMSU1OpenFile(const char *msu_ext, bool skip_unpacked)
{ {
char filename[MAXPATHLEN]; #ifdef GEKKO
char filename[MAXPATHLEN];
sprintf(filename, "%s%s%s", Memory.ROMFilePath, Memory.ROMFilename, msu_ext); sprintf(filename, "%s%s%s", Memory.ROMFilePath, Memory.ROMFilename, msu_ext);
#else
const char *filename = S9xGetFilename(msu_ext, ROMFILENAME_DIR);
#endif
STREAM file = 0; STREAM file = 0;
if (!skip_unpacked) if (!skip_unpacked)
@ -257,10 +264,15 @@ STREAM S9xMSU1OpenFile(const char *msu_ext, bool skip_unpacked)
// look for msu1 pack file in the rom or patch dir if msu data file not found in rom dir // look for msu1 pack file in the rom or patch dir if msu data file not found in rom dir
if (!file) if (!file)
{ {
char zip_filename[MAXPATHLEN]; const char *zip_filename = S9xGetFilename(".msu1", ROMFILENAME_DIR);
sprintf(zip_filename, "%s%s.msu1", Memory.ROMFilePath, Memory.ROMFilename);
unzFile unzFile = unzOpen(zip_filename); unzFile unzFile = unzOpen(zip_filename);
if (!unzFile)
{
zip_filename = S9xGetFilename(".msu1", PATCH_DIR);
unzFile = unzOpen(zip_filename);
}
if (unzFile) if (unzFile)
{ {
int port = unzFindExtension(unzFile, msu_ext, true, true, true); int port = unzFindExtension(unzFile, msu_ext, true, true, true);
@ -313,7 +325,7 @@ static bool AudioOpen()
audioLoopPos <<= 2; audioLoopPos <<= 2;
audioLoopPos += 8; audioLoopPos += 8;
MSU1.MSU1_AUDIO_POS = 8; MSU1.MSU1_AUDIO_POS = 8;
MSU1.MSU1_STATUS &= ~AudioError; MSU1.MSU1_STATUS &= ~AudioError;
return true; return true;
@ -381,7 +393,6 @@ void S9xMSU1DeInit(void)
AudioClose(); AudioClose();
} }
bool S9xMSU1ROMExists(void) bool S9xMSU1ROMExists(void)
{ {
STREAM s = S9xMSU1OpenFile(".msu"); STREAM s = S9xMSU1OpenFile(".msu");
@ -391,9 +402,15 @@ bool S9xMSU1ROMExists(void)
return true; return true;
} }
#ifdef UNZIP_SUPPORT #ifdef UNZIP_SUPPORT
char fname[MAXPATHLEN]; char drive[_MAX_DRIVE + 1], dir[_MAX_DIR + 1], def[_MAX_FNAME + 1], ext[_MAX_EXT + 1];
sprintf(fname, "%s%s.msu1", Memory.ROMFilePath, Memory.ROMFilename); _splitpath(Memory.ROMFilename, drive, dir, def, ext);
unzFile unzFile = unzOpen(fname); if (!strcasecmp(ext, ".msu1"))
return true;
unzFile unzFile = unzOpen(S9xGetFilename(".msu1", ROMFILENAME_DIR));
if(!unzFile)
unzFile = unzOpen(S9xGetFilename(".msu1", PATCH_DIR));
if (unzFile) if (unzFile)
{ {
@ -416,14 +433,15 @@ void S9xMSU1Generate(size_t sample_count)
int16* left = (int16*)&sample; int16* left = (int16*)&sample;
int16* right = left + 1; int16* right = left + 1;
int bytes_read = READ_STREAM((char *)&sample, 4, audioStream); int bytes_read = READ_STREAM((char *)&sample, 4, audioStream);
if (bytes_read == 4) if (bytes_read == 4)
{ {
*left = ((int32)(int16)GET_LE16(left) * MSU1.MSU1_VOLUME / 255); *left = ((int32)(int16)GET_LE16(left) * MSU1.MSU1_VOLUME / 255);
*right = ((int32)(int16)GET_LE16(right) * MSU1.MSU1_VOLUME / 255); *right = ((int32)(int16)GET_LE16(right) * MSU1.MSU1_VOLUME / 255);
*(bufPos++) = *left; *(bufPos++) = *left;
*(bufPos++) = *right; *(bufPos++) = *right;
MSU1.MSU1_AUDIO_POS += 4; MSU1.MSU1_AUDIO_POS += 4;
partial_frames -= 3204; partial_frames -= 3204;
} }
@ -433,12 +451,12 @@ void S9xMSU1Generate(size_t sample_count)
if (MSU1.MSU1_STATUS & AudioRepeating) if (MSU1.MSU1_STATUS & AudioRepeating)
{ {
MSU1.MSU1_AUDIO_POS = audioLoopPos; MSU1.MSU1_AUDIO_POS = audioLoopPos;
REVERT_STREAM(audioStream, MSU1.MSU1_AUDIO_POS, 0); REVERT_STREAM(audioStream, MSU1.MSU1_AUDIO_POS, 0);
} }
else else
{ {
MSU1.MSU1_STATUS &= ~(AudioPlaying | AudioRepeating); MSU1.MSU1_STATUS &= ~(AudioPlaying | AudioRepeating);
REVERT_STREAM(audioStream, 8, 0); REVERT_STREAM(audioStream, 8, 0);
} }
} }
else else

View File

@ -22,10 +22,12 @@
(c) Copyright 2006 - 2007 nitsuja (c) Copyright 2006 - 2007 nitsuja
(c) Copyright 2009 - 2016 BearOso, (c) Copyright 2009 - 2018 BearOso,
OV2 OV2
(c) Copyright 2011 - 2016 Hans-Kristian Arntzen, (c) Copyright 2017 qwertymodo
(c) Copyright 2011 - 2017 Hans-Kristian Arntzen,
Daniel De Matteis Daniel De Matteis
(Under no circumstances will commercial rights be given) (Under no circumstances will commercial rights be given)
@ -138,7 +140,7 @@
(c) Copyright 2006 - 2007 Shay Green (c) Copyright 2006 - 2007 Shay Green
GTK+ GUI code GTK+ GUI code
(c) Copyright 2004 - 2016 BearOso (c) Copyright 2004 - 2018 BearOso
Win32 GUI code Win32 GUI code
(c) Copyright 2003 - 2006 blip, (c) Copyright 2003 - 2006 blip,
@ -146,14 +148,14 @@
Matthew Kendora, Matthew Kendora,
Nach, Nach,
nitsuja nitsuja
(c) Copyright 2009 - 2016 OV2 (c) Copyright 2009 - 2018 OV2
Mac OS GUI code Mac OS GUI code
(c) Copyright 1998 - 2001 John Stiles (c) Copyright 1998 - 2001 John Stiles
(c) Copyright 2001 - 2011 zones (c) Copyright 2001 - 2011 zones
Libretro port Libretro port
(c) Copyright 2011 - 2016 Hans-Kristian Arntzen, (c) Copyright 2011 - 2017 Hans-Kristian Arntzen,
Daniel De Matteis Daniel De Matteis
(Under no circumstances will commercial rights be given) (Under no circumstances will commercial rights be given)
@ -193,8 +195,6 @@
#ifndef _MSU1_H_ #ifndef _MSU1_H_
#define _MSU1_H_ #define _MSU1_H_
#include "snes9x.h" #include "snes9x.h"
#include <stdint.h>
#include <sys/stat.h>
#define MSU1_REVISION 0x02 #define MSU1_REVISION 0x02
@ -215,8 +215,8 @@ struct SMSU1
enum SMSU1_FLAG { enum SMSU1_FLAG {
Revision = 0x07, // bitmask, not the actual version number Revision = 0x07, // bitmask, not the actual version number
AudioError = 0x08, AudioError = 0x08,
AudioPlaying = 0x10, AudioPlaying = 0x10,
AudioRepeating = 0x20, AudioRepeating = 0x20,
AudioBusy = 0x40, AudioBusy = 0x40,
DataBusy = 0x80 DataBusy = 0x80
}; };

View File

@ -17,13 +17,20 @@
(c) Copyright 2002 - 2010 Brad Jorsch (anomie@users.sourceforge.net), (c) Copyright 2002 - 2010 Brad Jorsch (anomie@users.sourceforge.net),
Nach (n-a-c-h@users.sourceforge.net), Nach (n-a-c-h@users.sourceforge.net),
zones (kasumitokoduck@yahoo.com)
(c) Copyright 2002 - 2011 zones (kasumitokoduck@yahoo.com)
(c) Copyright 2006 - 2007 nitsuja (c) Copyright 2006 - 2007 nitsuja
(c) Copyright 2009 - 2010 BearOso, (c) Copyright 2009 - 2018 BearOso,
OV2 OV2
(c) Copyright 2017 qwertymodo
(c) Copyright 2011 - 2017 Hans-Kristian Arntzen,
Daniel De Matteis
(Under no circumstances will commercial rights be given)
BS-X C emulator code BS-X C emulator code
(c) Copyright 2005 - 2006 Dreamer Nom, (c) Copyright 2005 - 2006 Dreamer Nom,
@ -117,6 +124,9 @@
Sound emulator code used in 1.52+ Sound emulator code used in 1.52+
(c) Copyright 2004 - 2007 Shay Green (gblargg@gmail.com) (c) Copyright 2004 - 2007 Shay Green (gblargg@gmail.com)
S-SMP emulator code used in 1.54+
(c) Copyright 2016 byuu
SH assembler code partly based on x86 assembler code SH assembler code partly based on x86 assembler code
(c) Copyright 2002 - 2004 Marcus Comstedt (marcus@mc.pp.se) (c) Copyright 2002 - 2004 Marcus Comstedt (marcus@mc.pp.se)
@ -130,7 +140,7 @@
(c) Copyright 2006 - 2007 Shay Green (c) Copyright 2006 - 2007 Shay Green
GTK+ GUI code GTK+ GUI code
(c) Copyright 2004 - 2010 BearOso (c) Copyright 2004 - 2018 BearOso
Win32 GUI code Win32 GUI code
(c) Copyright 2003 - 2006 blip, (c) Copyright 2003 - 2006 blip,
@ -138,11 +148,16 @@
Matthew Kendora, Matthew Kendora,
Nach, Nach,
nitsuja nitsuja
(c) Copyright 2009 - 2010 OV2 (c) Copyright 2009 - 2018 OV2
Mac OS GUI code Mac OS GUI code
(c) Copyright 1998 - 2001 John Stiles (c) Copyright 1998 - 2001 John Stiles
(c) Copyright 2001 - 2010 zones (c) Copyright 2001 - 2011 zones
Libretro port
(c) Copyright 2011 - 2017 Hans-Kristian Arntzen,
Daniel De Matteis
(Under no circumstances will commercial rights be given)
Specific ports contains the works of other authors. See headers in Specific ports contains the works of other authors. See headers in

View File

@ -17,13 +17,20 @@
(c) Copyright 2002 - 2010 Brad Jorsch (anomie@users.sourceforge.net), (c) Copyright 2002 - 2010 Brad Jorsch (anomie@users.sourceforge.net),
Nach (n-a-c-h@users.sourceforge.net), Nach (n-a-c-h@users.sourceforge.net),
zones (kasumitokoduck@yahoo.com)
(c) Copyright 2002 - 2011 zones (kasumitokoduck@yahoo.com)
(c) Copyright 2006 - 2007 nitsuja (c) Copyright 2006 - 2007 nitsuja
(c) Copyright 2009 - 2010 BearOso, (c) Copyright 2009 - 2018 BearOso,
OV2 OV2
(c) Copyright 2017 qwertymodo
(c) Copyright 2011 - 2017 Hans-Kristian Arntzen,
Daniel De Matteis
(Under no circumstances will commercial rights be given)
BS-X C emulator code BS-X C emulator code
(c) Copyright 2005 - 2006 Dreamer Nom, (c) Copyright 2005 - 2006 Dreamer Nom,
@ -117,6 +124,9 @@
Sound emulator code used in 1.52+ Sound emulator code used in 1.52+
(c) Copyright 2004 - 2007 Shay Green (gblargg@gmail.com) (c) Copyright 2004 - 2007 Shay Green (gblargg@gmail.com)
S-SMP emulator code used in 1.54+
(c) Copyright 2016 byuu
SH assembler code partly based on x86 assembler code SH assembler code partly based on x86 assembler code
(c) Copyright 2002 - 2004 Marcus Comstedt (marcus@mc.pp.se) (c) Copyright 2002 - 2004 Marcus Comstedt (marcus@mc.pp.se)
@ -130,7 +140,7 @@
(c) Copyright 2006 - 2007 Shay Green (c) Copyright 2006 - 2007 Shay Green
GTK+ GUI code GTK+ GUI code
(c) Copyright 2004 - 2010 BearOso (c) Copyright 2004 - 2018 BearOso
Win32 GUI code Win32 GUI code
(c) Copyright 2003 - 2006 blip, (c) Copyright 2003 - 2006 blip,
@ -138,11 +148,16 @@
Matthew Kendora, Matthew Kendora,
Nach, Nach,
nitsuja nitsuja
(c) Copyright 2009 - 2010 OV2 (c) Copyright 2009 - 2018 OV2
Mac OS GUI code Mac OS GUI code
(c) Copyright 1998 - 2001 John Stiles (c) Copyright 1998 - 2001 John Stiles
(c) Copyright 2001 - 2010 zones (c) Copyright 2001 - 2011 zones
Libretro port
(c) Copyright 2011 - 2017 Hans-Kristian Arntzen,
Daniel De Matteis
(Under no circumstances will commercial rights be given)
Specific ports contains the works of other authors. See headers in Specific ports contains the works of other authors. See headers in

View File

@ -17,13 +17,20 @@
(c) Copyright 2002 - 2010 Brad Jorsch (anomie@users.sourceforge.net), (c) Copyright 2002 - 2010 Brad Jorsch (anomie@users.sourceforge.net),
Nach (n-a-c-h@users.sourceforge.net), Nach (n-a-c-h@users.sourceforge.net),
zones (kasumitokoduck@yahoo.com)
(c) Copyright 2002 - 2011 zones (kasumitokoduck@yahoo.com)
(c) Copyright 2006 - 2007 nitsuja (c) Copyright 2006 - 2007 nitsuja
(c) Copyright 2009 - 2010 BearOso, (c) Copyright 2009 - 2018 BearOso,
OV2 OV2
(c) Copyright 2017 qwertymodo
(c) Copyright 2011 - 2017 Hans-Kristian Arntzen,
Daniel De Matteis
(Under no circumstances will commercial rights be given)
BS-X C emulator code BS-X C emulator code
(c) Copyright 2005 - 2006 Dreamer Nom, (c) Copyright 2005 - 2006 Dreamer Nom,
@ -117,6 +124,9 @@
Sound emulator code used in 1.52+ Sound emulator code used in 1.52+
(c) Copyright 2004 - 2007 Shay Green (gblargg@gmail.com) (c) Copyright 2004 - 2007 Shay Green (gblargg@gmail.com)
S-SMP emulator code used in 1.54+
(c) Copyright 2016 byuu
SH assembler code partly based on x86 assembler code SH assembler code partly based on x86 assembler code
(c) Copyright 2002 - 2004 Marcus Comstedt (marcus@mc.pp.se) (c) Copyright 2002 - 2004 Marcus Comstedt (marcus@mc.pp.se)
@ -130,7 +140,7 @@
(c) Copyright 2006 - 2007 Shay Green (c) Copyright 2006 - 2007 Shay Green
GTK+ GUI code GTK+ GUI code
(c) Copyright 2004 - 2010 BearOso (c) Copyright 2004 - 2018 BearOso
Win32 GUI code Win32 GUI code
(c) Copyright 2003 - 2006 blip, (c) Copyright 2003 - 2006 blip,
@ -138,11 +148,16 @@
Matthew Kendora, Matthew Kendora,
Nach, Nach,
nitsuja nitsuja
(c) Copyright 2009 - 2010 OV2 (c) Copyright 2009 - 2018 OV2
Mac OS GUI code Mac OS GUI code
(c) Copyright 1998 - 2001 John Stiles (c) Copyright 1998 - 2001 John Stiles
(c) Copyright 2001 - 2010 zones (c) Copyright 2001 - 2011 zones
Libretro port
(c) Copyright 2011 - 2017 Hans-Kristian Arntzen,
Daniel De Matteis
(Under no circumstances will commercial rights be given)
Specific ports contains the works of other authors. See headers in Specific ports contains the works of other authors. See headers in

View File

@ -17,13 +17,20 @@
(c) Copyright 2002 - 2010 Brad Jorsch (anomie@users.sourceforge.net), (c) Copyright 2002 - 2010 Brad Jorsch (anomie@users.sourceforge.net),
Nach (n-a-c-h@users.sourceforge.net), Nach (n-a-c-h@users.sourceforge.net),
zones (kasumitokoduck@yahoo.com)
(c) Copyright 2002 - 2011 zones (kasumitokoduck@yahoo.com)
(c) Copyright 2006 - 2007 nitsuja (c) Copyright 2006 - 2007 nitsuja
(c) Copyright 2009 - 2010 BearOso, (c) Copyright 2009 - 2018 BearOso,
OV2 OV2
(c) Copyright 2017 qwertymodo
(c) Copyright 2011 - 2017 Hans-Kristian Arntzen,
Daniel De Matteis
(Under no circumstances will commercial rights be given)
BS-X C emulator code BS-X C emulator code
(c) Copyright 2005 - 2006 Dreamer Nom, (c) Copyright 2005 - 2006 Dreamer Nom,
@ -117,6 +124,9 @@
Sound emulator code used in 1.52+ Sound emulator code used in 1.52+
(c) Copyright 2004 - 2007 Shay Green (gblargg@gmail.com) (c) Copyright 2004 - 2007 Shay Green (gblargg@gmail.com)
S-SMP emulator code used in 1.54+
(c) Copyright 2016 byuu
SH assembler code partly based on x86 assembler code SH assembler code partly based on x86 assembler code
(c) Copyright 2002 - 2004 Marcus Comstedt (marcus@mc.pp.se) (c) Copyright 2002 - 2004 Marcus Comstedt (marcus@mc.pp.se)
@ -130,7 +140,7 @@
(c) Copyright 2006 - 2007 Shay Green (c) Copyright 2006 - 2007 Shay Green
GTK+ GUI code GTK+ GUI code
(c) Copyright 2004 - 2010 BearOso (c) Copyright 2004 - 2018 BearOso
Win32 GUI code Win32 GUI code
(c) Copyright 2003 - 2006 blip, (c) Copyright 2003 - 2006 blip,
@ -138,11 +148,16 @@
Matthew Kendora, Matthew Kendora,
Nach, Nach,
nitsuja nitsuja
(c) Copyright 2009 - 2010 OV2 (c) Copyright 2009 - 2018 OV2
Mac OS GUI code Mac OS GUI code
(c) Copyright 1998 - 2001 John Stiles (c) Copyright 1998 - 2001 John Stiles
(c) Copyright 2001 - 2010 zones (c) Copyright 2001 - 2011 zones
Libretro port
(c) Copyright 2011 - 2017 Hans-Kristian Arntzen,
Daniel De Matteis
(Under no circumstances will commercial rights be given)
Specific ports contains the works of other authors. See headers in Specific ports contains the works of other authors. See headers in
@ -192,7 +207,7 @@
#include <sys/types.h> #include <sys/types.h>
#ifdef __WIN32__ #ifdef __WIN32__
#define NOMINMAX #define NOMINMAX 1
#include <windows.h> #include <windows.h>
#endif #endif
@ -201,7 +216,14 @@
#define RIGHTSHIFT_int8_IS_SAR #define RIGHTSHIFT_int8_IS_SAR
#define RIGHTSHIFT_int16_IS_SAR #define RIGHTSHIFT_int16_IS_SAR
#define RIGHTSHIFT_int32_IS_SAR #define RIGHTSHIFT_int32_IS_SAR
#ifndef GEKKO
#define SNES_JOY_READ_CALLBACKS #define SNES_JOY_READ_CALLBACKS
#define GFX_MULTI_FORMAT
#endif
#endif
#ifdef __LIBRETRO__
#define GFX_MULTI_FORMAT
#endif #endif
#ifdef __MACOSX__ #ifdef __MACOSX__
@ -230,30 +252,22 @@ typedef uint64_t uint64;
#else // HAVE_STDINT_H #else // HAVE_STDINT_H
#ifdef __WIN32__ #ifdef __WIN32__
typedef intptr_t pint; typedef intptr_t pint;
#else // __WIN32__
#ifdef PTR_NOT_INT
typedef long pint;
#else
typedef int pint;
#endif
#endif // __WIN32__
#ifdef __WIN32__
#ifdef __BORLANDC__
#include <systypes.h>
#else
typedef signed char int8; typedef signed char int8;
typedef unsigned char uint8; typedef unsigned char uint8;
typedef signed short int16; typedef signed short int16;
typedef unsigned short uint16; typedef unsigned short uint16;
#ifndef WSAAP typedef signed int int32;
// winsock2.h typedefs int32 as well
typedef signed int int32;
#endif
typedef unsigned int uint32; typedef unsigned int uint32;
#endif
typedef unsigned char uint8_t;
typedef signed __int64 int64; typedef signed __int64 int64;
typedef unsigned __int64 uint64; typedef unsigned __int64 uint64;
typedef int8 int8_t;
typedef uint8 uint8_t;
typedef int16 int16_t;
typedef uint16 uint16_t;
typedef int32 int32_t;
typedef uint32 uint32_t;
typedef int64 int64_t;
typedef uint64 uint64_t;
typedef int socklen_t; typedef int socklen_t;
#else // __WIN32__ #else // __WIN32__
typedef signed char int8; typedef signed char int8;
@ -268,6 +282,11 @@ __extension__
#endif #endif
typedef long long int64; typedef long long int64;
typedef unsigned long long uint64; typedef unsigned long long uint64;
#ifdef PTR_NOT_INT
typedef size_t pint;
#else // __PTR_NOT_INT
typedef size_t pint;
#endif // __PTR_NOT_INT
#endif // __WIN32__ #endif // __WIN32__
#endif // HAVE_STDINT_H #endif // HAVE_STDINT_H
#endif // snes9x_types_defined #endif // snes9x_types_defined
@ -298,21 +317,24 @@ typedef unsigned long long uint64;
#endif #endif
#ifndef __WIN32__ #ifndef __WIN32__
#define ZeroMemory(a, b) memset((a), 0, (b))
void _splitpath (const char *, char *, char *, char *, char *); void _splitpath (const char *, char *, char *, char *, char *);
void _makepath (char *, const char *, const char *, const char *, const char *); void _makepath (char *, const char *, const char *, const char *, const char *);
#define S9xDisplayString DisplayStringFromBottom #define S9xDisplayString DisplayStringFromBottom
#else #else // __WIN32__
#define snprintf _snprintf #define snprintf _snprintf
#define strcasecmp stricmp #define strcasecmp stricmp
#define strncasecmp strnicmp #define strncasecmp strnicmp
#ifndef __LIBRETRO__
void WinDisplayStringFromBottom(const char *string, int linesFromBottom, int pixelsFromLeft, bool allowWrap); void WinDisplayStringFromBottom(const char *string, int linesFromBottom, int pixelsFromLeft, bool allowWrap);
#define S9xDisplayString WinDisplayStringFromBottom #define S9xDisplayString WinDisplayStringFromBottom
void SetInfoDlgColor(unsigned char, unsigned char, unsigned char); void SetInfoDlgColor(unsigned char, unsigned char, unsigned char);
#define SET_UI_COLOR(r,g,b) SetInfoDlgColor(r,g,b) #define SET_UI_COLOR(r,g,b) SetInfoDlgColor(r,g,b)
#endif #else // __LIBRETRO__
#define S9xDisplayString DisplayStringFromBottom
#endif // __LIBRETRO__
#endif // __WIN32__
#ifdef __DJGPP #if defined(__DJGPP) || defined(__WIN32__)
#define SLASH_STR "\\" #define SLASH_STR "\\"
#define SLASH_CHAR '\\' #define SLASH_CHAR '\\'
#else #else
@ -333,7 +355,7 @@ void SetInfoDlgColor(unsigned char, unsigned char, unsigned char);
#define TITLE "Snes9x" #define TITLE "Snes9x"
#endif #endif
#if defined(__i386__) || defined(__i486__) || defined(__i586__) || defined(__i686__) || defined(__x86_64__) || defined(__alpha__) || defined(__MIPSEL__) || defined(_M_IX86) || defined(_M_X64) #if defined(__i386__) || defined(__i486__) || defined(__i586__) || defined(__i686__) || defined(__x86_64__) || defined(__alpha__) || defined(__MIPSEL__) || defined(_M_IX86) || defined(_M_X64) || defined(_XBOX1) || defined(__arm__) || defined(ANDROID) || defined(__aarch64__) || (defined(__BYTE_ORDER__) && __BYTE_ORDER == __ORDER_LITTLE_ENDIAN__)
#define LSB_FIRST #define LSB_FIRST
#define FAST_LSB_WORD_ACCESS #define FAST_LSB_WORD_ACCESS
#else #else

View File

@ -341,9 +341,9 @@ void S9xUpdateIRQPositions (bool initial)
else if (!PPU.HTimerEnabled && PPU.VTimerEnabled) else if (!PPU.HTimerEnabled && PPU.VTimerEnabled)
{ {
if (CPU.V_Counter == PPU.VTimerPosition && initial) if (CPU.V_Counter == PPU.VTimerPosition && initial)
Timings.NextIRQTimer = CPU.Cycles + Timings.IRQTriggerCycles; Timings.NextIRQTimer = CPU.Cycles + Timings.IRQTriggerCycles - ONE_DOT_CYCLE;
else else
Timings.NextIRQTimer = CyclesUntilNext (Timings.IRQTriggerCycles, PPU.VTimerPosition); Timings.NextIRQTimer = CyclesUntilNext (Timings.IRQTriggerCycles - ONE_DOT_CYCLE, PPU.VTimerPosition);
} }
else else
{ {
@ -716,15 +716,7 @@ void S9xSetPPU (uint8 Byte, uint16 Address)
PPU.VMA.Address &= 0xff00; PPU.VMA.Address &= 0xff00;
PPU.VMA.Address |= Byte; PPU.VMA.Address |= Byte;
if (PPU.VMA.FullGraphicCount) S9xUpdateVRAMReadBuffer();
{
uint32 addr = PPU.VMA.Address;
uint32 rem = addr & PPU.VMA.Mask1;
uint32 address = (addr & ~PPU.VMA.Mask1) + (rem >> PPU.VMA.Shift) + ((rem & (PPU.VMA.FullGraphicCount - 1)) << 3);
IPPU.VRAMReadBuffer = READ_WORD(Memory.VRAM + ((address << 1) & 0xffff));
}
else
IPPU.VRAMReadBuffer = READ_WORD(Memory.VRAM + ((PPU.VMA.Address << 1) & 0xffff));
break; break;
@ -732,15 +724,7 @@ void S9xSetPPU (uint8 Byte, uint16 Address)
PPU.VMA.Address &= 0x00ff; PPU.VMA.Address &= 0x00ff;
PPU.VMA.Address |= Byte << 8; PPU.VMA.Address |= Byte << 8;
if (PPU.VMA.FullGraphicCount) S9xUpdateVRAMReadBuffer();
{
uint32 addr = PPU.VMA.Address;
uint32 rem = addr & PPU.VMA.Mask1;
uint32 address = (addr & ~PPU.VMA.Mask1) + (rem >> PPU.VMA.Shift) + ((rem & (PPU.VMA.FullGraphicCount - 1)) << 3);
IPPU.VRAMReadBuffer = READ_WORD(Memory.VRAM + ((address << 1) & 0xffff));
}
else
IPPU.VRAMReadBuffer = READ_WORD(Memory.VRAM + ((PPU.VMA.Address << 1) & 0xffff));
break; break;
@ -1308,18 +1292,10 @@ uint8 S9xGetPPU (uint16 Address)
return (PPU.OpenBus1 = byte); return (PPU.OpenBus1 = byte);
case 0x2139: // VMDATALREAD case 0x2139: // VMDATALREAD
byte = IPPU.VRAMReadBuffer & 0xff; byte = PPU.VRAMReadBuffer & 0xff;
if (!PPU.VMA.High) if (!PPU.VMA.High)
{ {
if (PPU.VMA.FullGraphicCount) S9xUpdateVRAMReadBuffer();
{
uint32 addr = PPU.VMA.Address;
uint32 rem = addr & PPU.VMA.Mask1;
uint32 address = (addr & ~PPU.VMA.Mask1) + (rem >> PPU.VMA.Shift) + ((rem & (PPU.VMA.FullGraphicCount - 1)) << 3);
IPPU.VRAMReadBuffer = READ_WORD(Memory.VRAM + ((address << 1) & 0xffff));
}
else
IPPU.VRAMReadBuffer = READ_WORD(Memory.VRAM + ((PPU.VMA.Address << 1) & 0xffff));
PPU.VMA.Address += PPU.VMA.Increment; PPU.VMA.Address += PPU.VMA.Increment;
} }
@ -1330,18 +1306,10 @@ uint8 S9xGetPPU (uint16 Address)
return (PPU.OpenBus1 = byte); return (PPU.OpenBus1 = byte);
case 0x213a: // VMDATAHREAD case 0x213a: // VMDATAHREAD
byte = (IPPU.VRAMReadBuffer >> 8) & 0xff; byte = (PPU.VRAMReadBuffer >> 8) & 0xff;
if (PPU.VMA.High) if (PPU.VMA.High)
{ {
if (PPU.VMA.FullGraphicCount) S9xUpdateVRAMReadBuffer();
{
uint32 addr = PPU.VMA.Address;
uint32 rem = addr & PPU.VMA.Mask1;
uint32 address = (addr & ~PPU.VMA.Mask1) + (rem >> PPU.VMA.Shift) + ((rem & (PPU.VMA.FullGraphicCount - 1)) << 3);
IPPU.VRAMReadBuffer = READ_WORD(Memory.VRAM + ((address << 1) & 0xffff));
}
else
IPPU.VRAMReadBuffer = READ_WORD(Memory.VRAM + ((PPU.VMA.Address << 1) & 0xffff));
PPU.VMA.Address += PPU.VMA.Increment; PPU.VMA.Address += PPU.VMA.Increment;
} }
@ -1598,7 +1566,8 @@ void S9xSetCPU (uint8 Byte, uint16 Address)
CPU.IRQTransition = FALSE; CPU.IRQTransition = FALSE;
} }
S9xUpdateIRQPositions(true); if ((Byte & 0x30) != (Memory.FillRAM[0x4200] & 0x30))
S9xUpdateIRQPositions(true);
// NMI can trigger immediately during VBlank as long as NMI_read ($4210) wasn't cleard. // NMI can trigger immediately during VBlank as long as NMI_read ($4210) wasn't cleard.
if ((Byte & 0x80) && !(Memory.FillRAM[0x4200] & 0x80) && if ((Byte & 0x80) && !(Memory.FillRAM[0x4200] & 0x80) &&
@ -1752,6 +1721,8 @@ void S9xSetCPU (uint8 Byte, uint16 Address)
} }
else else
CPU.FastROMSpeed = SLOW_ONE_CYCLE; CPU.FastROMSpeed = SLOW_ONE_CYCLE;
// we might currently be in FastROMSpeed region, S9xSetPCBase will update CPU.MemSpeed
S9xSetPCBase(Registers.PBPC);
} }
break; break;
@ -2095,7 +2066,7 @@ void S9xSoftResetPPU (void)
memset(IPPU.TileCached[TILE_2BIT_ODD], 0, MAX_2BIT_TILES); memset(IPPU.TileCached[TILE_2BIT_ODD], 0, MAX_2BIT_TILES);
memset(IPPU.TileCached[TILE_4BIT_EVEN], 0, MAX_4BIT_TILES); memset(IPPU.TileCached[TILE_4BIT_EVEN], 0, MAX_4BIT_TILES);
memset(IPPU.TileCached[TILE_4BIT_ODD], 0, MAX_4BIT_TILES); memset(IPPU.TileCached[TILE_4BIT_ODD], 0, MAX_4BIT_TILES);
IPPU.VRAMReadBuffer = 0; // XXX: FIXME: anything better? PPU.VRAMReadBuffer = 0; // XXX: FIXME: anything better?
GFX.InterlaceFrame = 0; GFX.InterlaceFrame = 0;
IPPU.Interlace = FALSE; IPPU.Interlace = FALSE;
IPPU.InterlaceOBJ = FALSE; IPPU.InterlaceOBJ = FALSE;

View File

@ -225,10 +225,8 @@ struct InternalPPU
struct ClipData Clip[2][6]; struct ClipData Clip[2][6];
bool8 ColorsChanged; bool8 ColorsChanged;
bool8 OBJChanged; bool8 OBJChanged;
bool8 DirectColourMapsNeedRebuild;
uint8 *TileCache[7]; uint8 *TileCache[7];
uint8 *TileCached[7]; uint8 *TileCached[7];
uint16 VRAMReadBuffer;
bool8 Interlace; bool8 Interlace;
bool8 InterlaceOBJ; bool8 InterlaceOBJ;
bool8 PseudoHires; bool8 PseudoHires;
@ -295,6 +293,7 @@ struct SPPU
bool8 CGFLIP; bool8 CGFLIP;
uint8 CGFLIPRead; uint8 CGFLIPRead;
uint8 CGADD; uint8 CGADD;
uint8 CGSavedByte;
uint16 CGDATA[256]; uint16 CGDATA[256];
struct SOBJ OBJ[128]; struct SOBJ OBJ[128];
@ -378,6 +377,8 @@ struct SPPU
uint8 OpenBus1; uint8 OpenBus1;
uint8 OpenBus2; uint8 OpenBus2;
uint16 VRAMReadBuffer;
}; };
extern uint16 SignExtend[2]; extern uint16 SignExtend[2];
@ -419,6 +420,19 @@ static inline void FLUSH_REDRAW (void)
S9xUpdateScreen(); S9xUpdateScreen();
} }
static inline void S9xUpdateVRAMReadBuffer()
{
if (PPU.VMA.FullGraphicCount)
{
uint32 addr = PPU.VMA.Address;
uint32 rem = addr & PPU.VMA.Mask1;
uint32 address = (addr & ~PPU.VMA.Mask1) + (rem >> PPU.VMA.Shift) + ((rem & (PPU.VMA.FullGraphicCount - 1)) << 3);
PPU.VRAMReadBuffer = READ_WORD(Memory.VRAM + ((address << 1) & 0xffff));
}
else
PPU.VRAMReadBuffer = READ_WORD(Memory.VRAM + ((PPU.VMA.Address << 1) & 0xffff));
}
static inline void REGISTER_2104 (uint8 Byte) static inline void REGISTER_2104 (uint8 Byte)
{ {
if (!(PPU.OAMFlip & 1)) if (!(PPU.OAMFlip & 1))
@ -720,12 +734,12 @@ static inline void REGISTER_2122 (uint8 Byte)
{ {
if (PPU.CGFLIP) if (PPU.CGFLIP)
{ {
if ((Byte & 0x7f) != (PPU.CGDATA[PPU.CGADD] >> 8)) if ((Byte & 0x7f) != (PPU.CGDATA[PPU.CGADD] >> 8) || PPU.CGSavedByte != (uint8) (PPU.CGDATA[PPU.CGADD] & 0xff))
{ {
FLUSH_REDRAW(); FLUSH_REDRAW();
PPU.CGDATA[PPU.CGADD] &= 0x00ff; PPU.CGDATA[PPU.CGADD] = (Byte & 0x7f) << 8 | PPU.CGSavedByte;
PPU.CGDATA[PPU.CGADD] |= (Byte & 0x7f) << 8;
IPPU.ColorsChanged = TRUE; IPPU.ColorsChanged = TRUE;
IPPU.Red[PPU.CGADD] = IPPU.XB[PPU.CGSavedByte & 0x1f];
IPPU.Blue[PPU.CGADD] = IPPU.XB[(Byte >> 2) & 0x1f]; IPPU.Blue[PPU.CGADD] = IPPU.XB[(Byte >> 2) & 0x1f];
IPPU.Green[PPU.CGADD] = IPPU.XB[(PPU.CGDATA[PPU.CGADD] >> 5) & 0x1f]; IPPU.Green[PPU.CGADD] = IPPU.XB[(PPU.CGDATA[PPU.CGADD] >> 5) & 0x1f];
IPPU.ScreenColors[PPU.CGADD] = (uint16) BUILD_PIXEL(IPPU.Red[PPU.CGADD], IPPU.Green[PPU.CGADD], IPPU.Blue[PPU.CGADD]); IPPU.ScreenColors[PPU.CGADD] = (uint16) BUILD_PIXEL(IPPU.Red[PPU.CGADD], IPPU.Green[PPU.CGADD], IPPU.Blue[PPU.CGADD]);
@ -735,16 +749,7 @@ static inline void REGISTER_2122 (uint8 Byte)
} }
else else
{ {
if (Byte != (uint8) (PPU.CGDATA[PPU.CGADD] & 0xff)) PPU.CGSavedByte = Byte;
{
FLUSH_REDRAW();
PPU.CGDATA[PPU.CGADD] &= 0x7f00;
PPU.CGDATA[PPU.CGADD] |= Byte;
IPPU.ColorsChanged = TRUE;
IPPU.Red[PPU.CGADD] = IPPU.XB[Byte & 0x1f];
IPPU.Green[PPU.CGADD] = IPPU.XB[(PPU.CGDATA[PPU.CGADD] >> 5) & 0x1f];
IPPU.ScreenColors[PPU.CGADD] = (uint16) BUILD_PIXEL(IPPU.Red[PPU.CGADD], IPPU.Green[PPU.CGADD], IPPU.Blue[PPU.CGADD]);
}
} }
PPU.CGFLIP ^= 1; PPU.CGFLIP ^= 1;

View File

@ -229,7 +229,7 @@ void S9xSA1Init (void)
SA1.op2 = 0; SA1.op2 = 0;
SA1.sum = 0; SA1.sum = 0;
SA1.overflow = FALSE; SA1.overflow = FALSE;
SA1.VirtualBitmapFormat = 0; SA1.VirtualBitmapFormat = 4;
SA1.variable_bit_pos = 0; SA1.variable_bit_pos = 0;
SA1Registers.PBPC = 0; SA1Registers.PBPC = 0;
@ -303,6 +303,10 @@ void S9xSA1PostLoadState (void)
SA1.VirtualBitmapFormat = (Memory.FillRAM[0x223f] & 0x80) ? 2 : 4; SA1.VirtualBitmapFormat = (Memory.FillRAM[0x223f] & 0x80) ? 2 : 4;
Memory.BWRAM = Memory.SRAM + (Memory.FillRAM[0x2224] & 7) * 0x2000; Memory.BWRAM = Memory.SRAM + (Memory.FillRAM[0x2224] & 7) * 0x2000;
S9xSA1SetBWRAMMemMap(Memory.FillRAM[0x2225]); S9xSA1SetBWRAMMemMap(Memory.FillRAM[0x2225]);
S9xSetSA1(Memory.FillRAM[0x2220], 0x2220);
S9xSetSA1(Memory.FillRAM[0x2221], 0x2221);
S9xSetSA1(Memory.FillRAM[0x2222], 0x2222);
S9xSetSA1(Memory.FillRAM[0x2223], 0x2223);
} }
static void S9xSetSA1MemMap (uint32 which1, uint8 map) static void S9xSetSA1MemMap (uint32 which1, uint8 map)

View File

@ -17,13 +17,20 @@
(c) Copyright 2002 - 2010 Brad Jorsch (anomie@users.sourceforge.net), (c) Copyright 2002 - 2010 Brad Jorsch (anomie@users.sourceforge.net),
Nach (n-a-c-h@users.sourceforge.net), Nach (n-a-c-h@users.sourceforge.net),
zones (kasumitokoduck@yahoo.com)
(c) Copyright 2002 - 2011 zones (kasumitokoduck@yahoo.com)
(c) Copyright 2006 - 2007 nitsuja (c) Copyright 2006 - 2007 nitsuja
(c) Copyright 2009 - 2010 BearOso, (c) Copyright 2009 - 2018 BearOso,
OV2 OV2
(c) Copyright 2017 qwertymodo
(c) Copyright 2011 - 2017 Hans-Kristian Arntzen,
Daniel De Matteis
(Under no circumstances will commercial rights be given)
BS-X C emulator code BS-X C emulator code
(c) Copyright 2005 - 2006 Dreamer Nom, (c) Copyright 2005 - 2006 Dreamer Nom,
@ -117,6 +124,9 @@
Sound emulator code used in 1.52+ Sound emulator code used in 1.52+
(c) Copyright 2004 - 2007 Shay Green (gblargg@gmail.com) (c) Copyright 2004 - 2007 Shay Green (gblargg@gmail.com)
S-SMP emulator code used in 1.54+
(c) Copyright 2016 byuu
SH assembler code partly based on x86 assembler code SH assembler code partly based on x86 assembler code
(c) Copyright 2002 - 2004 Marcus Comstedt (marcus@mc.pp.se) (c) Copyright 2002 - 2004 Marcus Comstedt (marcus@mc.pp.se)
@ -130,7 +140,7 @@
(c) Copyright 2006 - 2007 Shay Green (c) Copyright 2006 - 2007 Shay Green
GTK+ GUI code GTK+ GUI code
(c) Copyright 2004 - 2010 BearOso (c) Copyright 2004 - 2018 BearOso
Win32 GUI code Win32 GUI code
(c) Copyright 2003 - 2006 blip, (c) Copyright 2003 - 2006 blip,
@ -138,11 +148,16 @@
Matthew Kendora, Matthew Kendora,
Nach, Nach,
nitsuja nitsuja
(c) Copyright 2009 - 2010 OV2 (c) Copyright 2009 - 2018 OV2
Mac OS GUI code Mac OS GUI code
(c) Copyright 1998 - 2001 John Stiles (c) Copyright 1998 - 2001 John Stiles
(c) Copyright 2001 - 2010 zones (c) Copyright 2001 - 2011 zones
Libretro port
(c) Copyright 2011 - 2017 Hans-Kristian Arntzen,
Daniel De Matteis
(Under no circumstances will commercial rights be given)
Specific ports contains the works of other authors. See headers in Specific ports contains the works of other authors. See headers in

View File

@ -17,13 +17,20 @@
(c) Copyright 2002 - 2010 Brad Jorsch (anomie@users.sourceforge.net), (c) Copyright 2002 - 2010 Brad Jorsch (anomie@users.sourceforge.net),
Nach (n-a-c-h@users.sourceforge.net), Nach (n-a-c-h@users.sourceforge.net),
zones (kasumitokoduck@yahoo.com)
(c) Copyright 2002 - 2011 zones (kasumitokoduck@yahoo.com)
(c) Copyright 2006 - 2007 nitsuja (c) Copyright 2006 - 2007 nitsuja
(c) Copyright 2009 - 2010 BearOso, (c) Copyright 2009 - 2018 BearOso,
OV2 OV2
(c) Copyright 2017 qwertymodo
(c) Copyright 2011 - 2017 Hans-Kristian Arntzen,
Daniel De Matteis
(Under no circumstances will commercial rights be given)
BS-X C emulator code BS-X C emulator code
(c) Copyright 2005 - 2006 Dreamer Nom, (c) Copyright 2005 - 2006 Dreamer Nom,
@ -117,6 +124,9 @@
Sound emulator code used in 1.52+ Sound emulator code used in 1.52+
(c) Copyright 2004 - 2007 Shay Green (gblargg@gmail.com) (c) Copyright 2004 - 2007 Shay Green (gblargg@gmail.com)
S-SMP emulator code used in 1.54+
(c) Copyright 2016 byuu
SH assembler code partly based on x86 assembler code SH assembler code partly based on x86 assembler code
(c) Copyright 2002 - 2004 Marcus Comstedt (marcus@mc.pp.se) (c) Copyright 2002 - 2004 Marcus Comstedt (marcus@mc.pp.se)
@ -130,7 +140,7 @@
(c) Copyright 2006 - 2007 Shay Green (c) Copyright 2006 - 2007 Shay Green
GTK+ GUI code GTK+ GUI code
(c) Copyright 2004 - 2010 BearOso (c) Copyright 2004 - 2018 BearOso
Win32 GUI code Win32 GUI code
(c) Copyright 2003 - 2006 blip, (c) Copyright 2003 - 2006 blip,
@ -138,11 +148,16 @@
Matthew Kendora, Matthew Kendora,
Nach, Nach,
nitsuja nitsuja
(c) Copyright 2009 - 2010 OV2 (c) Copyright 2009 - 2018 OV2
Mac OS GUI code Mac OS GUI code
(c) Copyright 1998 - 2001 John Stiles (c) Copyright 1998 - 2001 John Stiles
(c) Copyright 2001 - 2010 zones (c) Copyright 2001 - 2011 zones
Libretro port
(c) Copyright 2011 - 2017 Hans-Kristian Arntzen,
Daniel De Matteis
(Under no circumstances will commercial rights be given)
Specific ports contains the works of other authors. See headers in Specific ports contains the works of other authors. See headers in

View File

@ -17,13 +17,20 @@
(c) Copyright 2002 - 2010 Brad Jorsch (anomie@users.sourceforge.net), (c) Copyright 2002 - 2010 Brad Jorsch (anomie@users.sourceforge.net),
Nach (n-a-c-h@users.sourceforge.net), Nach (n-a-c-h@users.sourceforge.net),
zones (kasumitokoduck@yahoo.com)
(c) Copyright 2002 - 2011 zones (kasumitokoduck@yahoo.com)
(c) Copyright 2006 - 2007 nitsuja (c) Copyright 2006 - 2007 nitsuja
(c) Copyright 2009 - 2010 BearOso, (c) Copyright 2009 - 2018 BearOso,
OV2 OV2
(c) Copyright 2017 qwertymodo
(c) Copyright 2011 - 2017 Hans-Kristian Arntzen,
Daniel De Matteis
(Under no circumstances will commercial rights be given)
BS-X C emulator code BS-X C emulator code
(c) Copyright 2005 - 2006 Dreamer Nom, (c) Copyright 2005 - 2006 Dreamer Nom,
@ -117,6 +124,9 @@
Sound emulator code used in 1.52+ Sound emulator code used in 1.52+
(c) Copyright 2004 - 2007 Shay Green (gblargg@gmail.com) (c) Copyright 2004 - 2007 Shay Green (gblargg@gmail.com)
S-SMP emulator code used in 1.54+
(c) Copyright 2016 byuu
SH assembler code partly based on x86 assembler code SH assembler code partly based on x86 assembler code
(c) Copyright 2002 - 2004 Marcus Comstedt (marcus@mc.pp.se) (c) Copyright 2002 - 2004 Marcus Comstedt (marcus@mc.pp.se)
@ -130,7 +140,7 @@
(c) Copyright 2006 - 2007 Shay Green (c) Copyright 2006 - 2007 Shay Green
GTK+ GUI code GTK+ GUI code
(c) Copyright 2004 - 2010 BearOso (c) Copyright 2004 - 2018 BearOso
Win32 GUI code Win32 GUI code
(c) Copyright 2003 - 2006 blip, (c) Copyright 2003 - 2006 blip,
@ -138,11 +148,16 @@
Matthew Kendora, Matthew Kendora,
Nach, Nach,
nitsuja nitsuja
(c) Copyright 2009 - 2010 OV2 (c) Copyright 2009 - 2018 OV2
Mac OS GUI code Mac OS GUI code
(c) Copyright 1998 - 2001 John Stiles (c) Copyright 1998 - 2001 John Stiles
(c) Copyright 2001 - 2010 zones (c) Copyright 2001 - 2011 zones
Libretro port
(c) Copyright 2011 - 2017 Hans-Kristian Arntzen,
Daniel De Matteis
(Under no circumstances will commercial rights be given)
Specific ports contains the works of other authors. See headers in Specific ports contains the works of other authors. See headers in

View File

@ -17,13 +17,20 @@
(c) Copyright 2002 - 2010 Brad Jorsch (anomie@users.sourceforge.net), (c) Copyright 2002 - 2010 Brad Jorsch (anomie@users.sourceforge.net),
Nach (n-a-c-h@users.sourceforge.net), Nach (n-a-c-h@users.sourceforge.net),
zones (kasumitokoduck@yahoo.com)
(c) Copyright 2002 - 2011 zones (kasumitokoduck@yahoo.com)
(c) Copyright 2006 - 2007 nitsuja (c) Copyright 2006 - 2007 nitsuja
(c) Copyright 2009 - 2010 BearOso, (c) Copyright 2009 - 2018 BearOso,
OV2 OV2
(c) Copyright 2017 qwertymodo
(c) Copyright 2011 - 2017 Hans-Kristian Arntzen,
Daniel De Matteis
(Under no circumstances will commercial rights be given)
BS-X C emulator code BS-X C emulator code
(c) Copyright 2005 - 2006 Dreamer Nom, (c) Copyright 2005 - 2006 Dreamer Nom,
@ -117,6 +124,9 @@
Sound emulator code used in 1.52+ Sound emulator code used in 1.52+
(c) Copyright 2004 - 2007 Shay Green (gblargg@gmail.com) (c) Copyright 2004 - 2007 Shay Green (gblargg@gmail.com)
S-SMP emulator code used in 1.54+
(c) Copyright 2016 byuu
SH assembler code partly based on x86 assembler code SH assembler code partly based on x86 assembler code
(c) Copyright 2002 - 2004 Marcus Comstedt (marcus@mc.pp.se) (c) Copyright 2002 - 2004 Marcus Comstedt (marcus@mc.pp.se)
@ -130,7 +140,7 @@
(c) Copyright 2006 - 2007 Shay Green (c) Copyright 2006 - 2007 Shay Green
GTK+ GUI code GTK+ GUI code
(c) Copyright 2004 - 2010 BearOso (c) Copyright 2004 - 2018 BearOso
Win32 GUI code Win32 GUI code
(c) Copyright 2003 - 2006 blip, (c) Copyright 2003 - 2006 blip,
@ -138,11 +148,16 @@
Matthew Kendora, Matthew Kendora,
Nach, Nach,
nitsuja nitsuja
(c) Copyright 2009 - 2010 OV2 (c) Copyright 2009 - 2018 OV2
Mac OS GUI code Mac OS GUI code
(c) Copyright 1998 - 2001 John Stiles (c) Copyright 1998 - 2001 John Stiles
(c) Copyright 2001 - 2010 zones (c) Copyright 2001 - 2011 zones
Libretro port
(c) Copyright 2011 - 2017 Hans-Kristian Arntzen,
Daniel De Matteis
(Under no circumstances will commercial rights be given)
Specific ports contains the works of other authors. See headers in Specific ports contains the works of other authors. See headers in

View File

@ -17,13 +17,20 @@
(c) Copyright 2002 - 2010 Brad Jorsch (anomie@users.sourceforge.net), (c) Copyright 2002 - 2010 Brad Jorsch (anomie@users.sourceforge.net),
Nach (n-a-c-h@users.sourceforge.net), Nach (n-a-c-h@users.sourceforge.net),
zones (kasumitokoduck@yahoo.com)
(c) Copyright 2002 - 2011 zones (kasumitokoduck@yahoo.com)
(c) Copyright 2006 - 2007 nitsuja (c) Copyright 2006 - 2007 nitsuja
(c) Copyright 2009 - 2010 BearOso, (c) Copyright 2009 - 2018 BearOso,
OV2 OV2
(c) Copyright 2017 qwertymodo
(c) Copyright 2011 - 2017 Hans-Kristian Arntzen,
Daniel De Matteis
(Under no circumstances will commercial rights be given)
BS-X C emulator code BS-X C emulator code
(c) Copyright 2005 - 2006 Dreamer Nom, (c) Copyright 2005 - 2006 Dreamer Nom,
@ -117,6 +124,9 @@
Sound emulator code used in 1.52+ Sound emulator code used in 1.52+
(c) Copyright 2004 - 2007 Shay Green (gblargg@gmail.com) (c) Copyright 2004 - 2007 Shay Green (gblargg@gmail.com)
S-SMP emulator code used in 1.54+
(c) Copyright 2016 byuu
SH assembler code partly based on x86 assembler code SH assembler code partly based on x86 assembler code
(c) Copyright 2002 - 2004 Marcus Comstedt (marcus@mc.pp.se) (c) Copyright 2002 - 2004 Marcus Comstedt (marcus@mc.pp.se)
@ -130,7 +140,7 @@
(c) Copyright 2006 - 2007 Shay Green (c) Copyright 2006 - 2007 Shay Green
GTK+ GUI code GTK+ GUI code
(c) Copyright 2004 - 2010 BearOso (c) Copyright 2004 - 2018 BearOso
Win32 GUI code Win32 GUI code
(c) Copyright 2003 - 2006 blip, (c) Copyright 2003 - 2006 blip,
@ -138,11 +148,16 @@
Matthew Kendora, Matthew Kendora,
Nach, Nach,
nitsuja nitsuja
(c) Copyright 2009 - 2010 OV2 (c) Copyright 2009 - 2018 OV2
Mac OS GUI code Mac OS GUI code
(c) Copyright 1998 - 2001 John Stiles (c) Copyright 1998 - 2001 John Stiles
(c) Copyright 2001 - 2010 zones (c) Copyright 2001 - 2011 zones
Libretro port
(c) Copyright 2011 - 2017 Hans-Kristian Arntzen,
Daniel De Matteis
(Under no circumstances will commercial rights be given)
Specific ports contains the works of other authors. See headers in Specific ports contains the works of other authors. See headers in

View File

@ -17,13 +17,20 @@
(c) Copyright 2002 - 2010 Brad Jorsch (anomie@users.sourceforge.net), (c) Copyright 2002 - 2010 Brad Jorsch (anomie@users.sourceforge.net),
Nach (n-a-c-h@users.sourceforge.net), Nach (n-a-c-h@users.sourceforge.net),
zones (kasumitokoduck@yahoo.com)
(c) Copyright 2002 - 2011 zones (kasumitokoduck@yahoo.com)
(c) Copyright 2006 - 2007 nitsuja (c) Copyright 2006 - 2007 nitsuja
(c) Copyright 2009 - 2010 BearOso, (c) Copyright 2009 - 2018 BearOso,
OV2 OV2
(c) Copyright 2017 qwertymodo
(c) Copyright 2011 - 2017 Hans-Kristian Arntzen,
Daniel De Matteis
(Under no circumstances will commercial rights be given)
BS-X C emulator code BS-X C emulator code
(c) Copyright 2005 - 2006 Dreamer Nom, (c) Copyright 2005 - 2006 Dreamer Nom,
@ -117,6 +124,9 @@
Sound emulator code used in 1.52+ Sound emulator code used in 1.52+
(c) Copyright 2004 - 2007 Shay Green (gblargg@gmail.com) (c) Copyright 2004 - 2007 Shay Green (gblargg@gmail.com)
S-SMP emulator code used in 1.54+
(c) Copyright 2016 byuu
SH assembler code partly based on x86 assembler code SH assembler code partly based on x86 assembler code
(c) Copyright 2002 - 2004 Marcus Comstedt (marcus@mc.pp.se) (c) Copyright 2002 - 2004 Marcus Comstedt (marcus@mc.pp.se)
@ -130,7 +140,7 @@
(c) Copyright 2006 - 2007 Shay Green (c) Copyright 2006 - 2007 Shay Green
GTK+ GUI code GTK+ GUI code
(c) Copyright 2004 - 2010 BearOso (c) Copyright 2004 - 2018 BearOso
Win32 GUI code Win32 GUI code
(c) Copyright 2003 - 2006 blip, (c) Copyright 2003 - 2006 blip,
@ -138,11 +148,16 @@
Matthew Kendora, Matthew Kendora,
Nach, Nach,
nitsuja nitsuja
(c) Copyright 2009 - 2010 OV2 (c) Copyright 2009 - 2018 OV2
Mac OS GUI code Mac OS GUI code
(c) Copyright 1998 - 2001 John Stiles (c) Copyright 1998 - 2001 John Stiles
(c) Copyright 2001 - 2010 zones (c) Copyright 2001 - 2011 zones
Libretro port
(c) Copyright 2011 - 2017 Hans-Kristian Arntzen,
Daniel De Matteis
(Under no circumstances will commercial rights be given)
Specific ports contains the works of other authors. See headers in Specific ports contains the works of other authors. See headers in

View File

@ -17,13 +17,20 @@
(c) Copyright 2002 - 2010 Brad Jorsch (anomie@users.sourceforge.net), (c) Copyright 2002 - 2010 Brad Jorsch (anomie@users.sourceforge.net),
Nach (n-a-c-h@users.sourceforge.net), Nach (n-a-c-h@users.sourceforge.net),
zones (kasumitokoduck@yahoo.com)
(c) Copyright 2002 - 2011 zones (kasumitokoduck@yahoo.com)
(c) Copyright 2006 - 2007 nitsuja (c) Copyright 2006 - 2007 nitsuja
(c) Copyright 2009 - 2010 BearOso, (c) Copyright 2009 - 2018 BearOso,
OV2 OV2
(c) Copyright 2017 qwertymodo
(c) Copyright 2011 - 2017 Hans-Kristian Arntzen,
Daniel De Matteis
(Under no circumstances will commercial rights be given)
BS-X C emulator code BS-X C emulator code
(c) Copyright 2005 - 2006 Dreamer Nom, (c) Copyright 2005 - 2006 Dreamer Nom,
@ -117,6 +124,9 @@
Sound emulator code used in 1.52+ Sound emulator code used in 1.52+
(c) Copyright 2004 - 2007 Shay Green (gblargg@gmail.com) (c) Copyright 2004 - 2007 Shay Green (gblargg@gmail.com)
S-SMP emulator code used in 1.54+
(c) Copyright 2016 byuu
SH assembler code partly based on x86 assembler code SH assembler code partly based on x86 assembler code
(c) Copyright 2002 - 2004 Marcus Comstedt (marcus@mc.pp.se) (c) Copyright 2002 - 2004 Marcus Comstedt (marcus@mc.pp.se)
@ -130,7 +140,7 @@
(c) Copyright 2006 - 2007 Shay Green (c) Copyright 2006 - 2007 Shay Green
GTK+ GUI code GTK+ GUI code
(c) Copyright 2004 - 2010 BearOso (c) Copyright 2004 - 2018 BearOso
Win32 GUI code Win32 GUI code
(c) Copyright 2003 - 2006 blip, (c) Copyright 2003 - 2006 blip,
@ -138,11 +148,16 @@
Matthew Kendora, Matthew Kendora,
Nach, Nach,
nitsuja nitsuja
(c) Copyright 2009 - 2010 OV2 (c) Copyright 2009 - 2018 OV2
Mac OS GUI code Mac OS GUI code
(c) Copyright 1998 - 2001 John Stiles (c) Copyright 1998 - 2001 John Stiles
(c) Copyright 2001 - 2010 zones (c) Copyright 2001 - 2011 zones
Libretro port
(c) Copyright 2011 - 2017 Hans-Kristian Arntzen,
Daniel De Matteis
(Under no circumstances will commercial rights be given)
Specific ports contains the works of other authors. See headers in Specific ports contains the works of other authors. See headers in

View File

@ -17,13 +17,20 @@
(c) Copyright 2002 - 2010 Brad Jorsch (anomie@users.sourceforge.net), (c) Copyright 2002 - 2010 Brad Jorsch (anomie@users.sourceforge.net),
Nach (n-a-c-h@users.sourceforge.net), Nach (n-a-c-h@users.sourceforge.net),
zones (kasumitokoduck@yahoo.com)
(c) Copyright 2002 - 2011 zones (kasumitokoduck@yahoo.com)
(c) Copyright 2006 - 2007 nitsuja (c) Copyright 2006 - 2007 nitsuja
(c) Copyright 2009 - 2010 BearOso, (c) Copyright 2009 - 2018 BearOso,
OV2 OV2
(c) Copyright 2017 qwertymodo
(c) Copyright 2011 - 2017 Hans-Kristian Arntzen,
Daniel De Matteis
(Under no circumstances will commercial rights be given)
BS-X C emulator code BS-X C emulator code
(c) Copyright 2005 - 2006 Dreamer Nom, (c) Copyright 2005 - 2006 Dreamer Nom,
@ -117,6 +124,9 @@
Sound emulator code used in 1.52+ Sound emulator code used in 1.52+
(c) Copyright 2004 - 2007 Shay Green (gblargg@gmail.com) (c) Copyright 2004 - 2007 Shay Green (gblargg@gmail.com)
S-SMP emulator code used in 1.54+
(c) Copyright 2016 byuu
SH assembler code partly based on x86 assembler code SH assembler code partly based on x86 assembler code
(c) Copyright 2002 - 2004 Marcus Comstedt (marcus@mc.pp.se) (c) Copyright 2002 - 2004 Marcus Comstedt (marcus@mc.pp.se)
@ -130,7 +140,7 @@
(c) Copyright 2006 - 2007 Shay Green (c) Copyright 2006 - 2007 Shay Green
GTK+ GUI code GTK+ GUI code
(c) Copyright 2004 - 2010 BearOso (c) Copyright 2004 - 2018 BearOso
Win32 GUI code Win32 GUI code
(c) Copyright 2003 - 2006 blip, (c) Copyright 2003 - 2006 blip,
@ -138,11 +148,16 @@
Matthew Kendora, Matthew Kendora,
Nach, Nach,
nitsuja nitsuja
(c) Copyright 2009 - 2010 OV2 (c) Copyright 2009 - 2018 OV2
Mac OS GUI code Mac OS GUI code
(c) Copyright 1998 - 2001 John Stiles (c) Copyright 1998 - 2001 John Stiles
(c) Copyright 2001 - 2010 zones (c) Copyright 2001 - 2011 zones
Libretro port
(c) Copyright 2011 - 2017 Hans-Kristian Arntzen,
Daniel De Matteis
(Under no circumstances will commercial rights be given)
Specific ports contains the works of other authors. See headers in Specific ports contains the works of other authors. See headers in

View File

@ -17,13 +17,20 @@
(c) Copyright 2002 - 2010 Brad Jorsch (anomie@users.sourceforge.net), (c) Copyright 2002 - 2010 Brad Jorsch (anomie@users.sourceforge.net),
Nach (n-a-c-h@users.sourceforge.net), Nach (n-a-c-h@users.sourceforge.net),
zones (kasumitokoduck@yahoo.com)
(c) Copyright 2002 - 2011 zones (kasumitokoduck@yahoo.com)
(c) Copyright 2006 - 2007 nitsuja (c) Copyright 2006 - 2007 nitsuja
(c) Copyright 2009 - 2010 BearOso, (c) Copyright 2009 - 2018 BearOso,
OV2 OV2
(c) Copyright 2017 qwertymodo
(c) Copyright 2011 - 2017 Hans-Kristian Arntzen,
Daniel De Matteis
(Under no circumstances will commercial rights be given)
BS-X C emulator code BS-X C emulator code
(c) Copyright 2005 - 2006 Dreamer Nom, (c) Copyright 2005 - 2006 Dreamer Nom,
@ -117,6 +124,9 @@
Sound emulator code used in 1.52+ Sound emulator code used in 1.52+
(c) Copyright 2004 - 2007 Shay Green (gblargg@gmail.com) (c) Copyright 2004 - 2007 Shay Green (gblargg@gmail.com)
S-SMP emulator code used in 1.54+
(c) Copyright 2016 byuu
SH assembler code partly based on x86 assembler code SH assembler code partly based on x86 assembler code
(c) Copyright 2002 - 2004 Marcus Comstedt (marcus@mc.pp.se) (c) Copyright 2002 - 2004 Marcus Comstedt (marcus@mc.pp.se)
@ -130,7 +140,7 @@
(c) Copyright 2006 - 2007 Shay Green (c) Copyright 2006 - 2007 Shay Green
GTK+ GUI code GTK+ GUI code
(c) Copyright 2004 - 2010 BearOso (c) Copyright 2004 - 2018 BearOso
Win32 GUI code Win32 GUI code
(c) Copyright 2003 - 2006 blip, (c) Copyright 2003 - 2006 blip,
@ -138,11 +148,16 @@
Matthew Kendora, Matthew Kendora,
Nach, Nach,
nitsuja nitsuja
(c) Copyright 2009 - 2010 OV2 (c) Copyright 2009 - 2018 OV2
Mac OS GUI code Mac OS GUI code
(c) Copyright 1998 - 2001 John Stiles (c) Copyright 1998 - 2001 John Stiles
(c) Copyright 2001 - 2010 zones (c) Copyright 2001 - 2011 zones
Libretro port
(c) Copyright 2011 - 2017 Hans-Kristian Arntzen,
Daniel De Matteis
(Under no circumstances will commercial rights be given)
Specific ports contains the works of other authors. See headers in Specific ports contains the works of other authors. See headers in

View File

@ -17,13 +17,20 @@
(c) Copyright 2002 - 2010 Brad Jorsch (anomie@users.sourceforge.net), (c) Copyright 2002 - 2010 Brad Jorsch (anomie@users.sourceforge.net),
Nach (n-a-c-h@users.sourceforge.net), Nach (n-a-c-h@users.sourceforge.net),
zones (kasumitokoduck@yahoo.com)
(c) Copyright 2002 - 2011 zones (kasumitokoduck@yahoo.com)
(c) Copyright 2006 - 2007 nitsuja (c) Copyright 2006 - 2007 nitsuja
(c) Copyright 2009 - 2010 BearOso, (c) Copyright 2009 - 2018 BearOso,
OV2 OV2
(c) Copyright 2017 qwertymodo
(c) Copyright 2011 - 2017 Hans-Kristian Arntzen,
Daniel De Matteis
(Under no circumstances will commercial rights be given)
BS-X C emulator code BS-X C emulator code
(c) Copyright 2005 - 2006 Dreamer Nom, (c) Copyright 2005 - 2006 Dreamer Nom,
@ -117,6 +124,9 @@
Sound emulator code used in 1.52+ Sound emulator code used in 1.52+
(c) Copyright 2004 - 2007 Shay Green (gblargg@gmail.com) (c) Copyright 2004 - 2007 Shay Green (gblargg@gmail.com)
S-SMP emulator code used in 1.54+
(c) Copyright 2016 byuu
SH assembler code partly based on x86 assembler code SH assembler code partly based on x86 assembler code
(c) Copyright 2002 - 2004 Marcus Comstedt (marcus@mc.pp.se) (c) Copyright 2002 - 2004 Marcus Comstedt (marcus@mc.pp.se)
@ -130,7 +140,7 @@
(c) Copyright 2006 - 2007 Shay Green (c) Copyright 2006 - 2007 Shay Green
GTK+ GUI code GTK+ GUI code
(c) Copyright 2004 - 2010 BearOso (c) Copyright 2004 - 2018 BearOso
Win32 GUI code Win32 GUI code
(c) Copyright 2003 - 2006 blip, (c) Copyright 2003 - 2006 blip,
@ -138,11 +148,16 @@
Matthew Kendora, Matthew Kendora,
Nach, Nach,
nitsuja nitsuja
(c) Copyright 2009 - 2010 OV2 (c) Copyright 2009 - 2018 OV2
Mac OS GUI code Mac OS GUI code
(c) Copyright 1998 - 2001 John Stiles (c) Copyright 1998 - 2001 John Stiles
(c) Copyright 2001 - 2010 zones (c) Copyright 2001 - 2011 zones
Libretro port
(c) Copyright 2011 - 2017 Hans-Kristian Arntzen,
Daniel De Matteis
(Under no circumstances will commercial rights be given)
Specific ports contains the works of other authors. See headers in Specific ports contains the works of other authors. See headers in
@ -216,72 +231,72 @@ static const int16 ST010_SinTable[256] =
-0x18f8, -0x15e2, -0x12c8, -0x0fab, -0x0c8b, -0x096a, -0x0647, -0x0324 -0x18f8, -0x15e2, -0x12c8, -0x0fab, -0x0c8b, -0x096a, -0x0647, -0x0324
}; };
static const uint8 ST010_ArcTan[32][32] = static const uint8 ST010_ArcTan[32][32] =
{ {
{ 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80 }, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
{ 0x80, 0xa0, 0xad, 0xb3, 0xb6, 0xb8, 0xb9, 0xba, 0xbb, 0xbb, 0xbc, 0xbc, 0xbd, 0xbd, 0xbd, 0xbd, { 0x40, 0x20, 0x13, 0x0D, 0x0A, 0x08, 0x07, 0x06, 0x05, 0x05, 0x04, 0x04, 0x03, 0x03, 0x03, 0x03,
0xbd, 0xbe, 0xbe, 0xbe, 0xbe, 0xbe, 0xbe, 0xbe, 0xbe, 0xbe, 0xbe, 0xbe, 0xbf, 0xbf, 0xbf, 0xbf }, 0x03, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x01, 0x01, 0x01, 0x01 },
{ 0x80, 0x93, 0xa0, 0xa8, 0xad, 0xb0, 0xb3, 0xb5, 0xb6, 0xb7, 0xb8, 0xb9, 0xb9, 0xba, 0xba, 0xbb, { 0x40, 0x2D, 0x20, 0x18, 0x13, 0x10, 0x0D, 0x0B, 0x0A, 0x09, 0x08, 0x07, 0x07, 0x06, 0x06, 0x05,
0xbb, 0xbb, 0xbb, 0xbc, 0xbc, 0xbc, 0xbc, 0xbc, 0xbd, 0xbd, 0xbd, 0xbd, 0xbd, 0xbd, 0xbd, 0xbd }, 0x05, 0x05, 0x05, 0x04, 0x04, 0x04, 0x04, 0x04, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03 },
{ 0x80, 0x8d, 0x98, 0xa0, 0xa6, 0xaa, 0xad, 0xb0, 0xb1, 0xb3, 0xb4, 0xb5, 0xb6, 0xb7, 0xb7, 0xb8, { 0x40, 0x33, 0x28, 0x20, 0x1A, 0x16, 0x13, 0x10, 0x0F, 0x0D, 0x0C, 0x0B, 0x0A, 0x09, 0x09, 0x08,
0xb8, 0xb9, 0xb9, 0xba, 0xba, 0xba, 0xba, 0xbb, 0xbb, 0xbb, 0xbb, 0xbb, 0xbc, 0xbc, 0xbc, 0xbc }, 0x08, 0x07, 0x07, 0x06, 0x06, 0x06, 0x06, 0x05, 0x05, 0x05, 0x05, 0x05, 0x04, 0x04, 0x04, 0x04 },
{ 0x80, 0x8a, 0x93, 0x9a, 0xa0, 0xa5, 0xa8, 0xab, 0xad, 0xaf, 0xb0, 0xb2, 0xb3, 0xb4, 0xb5, 0xb5, { 0x40, 0x36, 0x2D, 0x26, 0x20, 0x1B, 0x18, 0x15, 0x13, 0x11, 0x10, 0x0E, 0x0D, 0x0C, 0x0B, 0x0B,
0xb6, 0xb7, 0xb7, 0xb8, 0xb8, 0xb8, 0xb9, 0xb9, 0xb9, 0xba, 0xba, 0xba, 0xba, 0xba, 0xbb, 0xbb }, 0x0A, 0x09, 0x09, 0x08, 0x08, 0x08, 0x07, 0x07, 0x07, 0x06, 0x06, 0x06, 0x06, 0x06, 0x05, 0x05 },
{ 0x80, 0x88, 0x90, 0x96, 0x9b, 0xa0, 0xa4, 0xa7, 0xa9, 0xab, 0xad, 0xaf, 0xb0, 0xb1, 0xb2, 0xb3, { 0x40, 0x38, 0x30, 0x2A, 0x25, 0x20, 0x1C, 0x19, 0x17, 0x15, 0x13, 0x11, 0x10, 0x0F, 0x0E, 0x0D,
0xb4, 0xb4, 0xb5, 0xb6, 0xb6, 0xb6, 0xb7, 0xb7, 0xb8, 0xb8, 0xb8, 0xb9, 0xb9, 0xb9, 0xb9, 0xb9 }, 0x0C, 0x0C, 0x0B, 0x0A, 0x0A, 0x0A, 0x09, 0x09, 0x08, 0x08, 0x08, 0x07, 0x07, 0x07, 0x07, 0x07 },
{ 0x80, 0x87, 0x8d, 0x93, 0x98, 0x9c, 0xa0, 0xa3, 0xa6, 0xa8, 0xaa, 0xac, 0xad, 0xae, 0xb0, 0xb0, { 0x40, 0x39, 0x33, 0x2D, 0x28, 0x24, 0x20, 0x1D, 0x1A, 0x18, 0x16, 0x14, 0x13, 0x12, 0x10, 0x10,
0xb1, 0xb2, 0xb3, 0xb4, 0xb4, 0xb5, 0xb5, 0xb6, 0xb6, 0xb6, 0xb7, 0xb7, 0xb7, 0xb8, 0xb8, 0xb8 }, 0x0F, 0x0E, 0x0D, 0x0C, 0x0C, 0x0B, 0x0B, 0x0A, 0x0A, 0x0A, 0x09, 0x09, 0x09, 0x08, 0x08, 0x08 },
{ 0x80, 0x86, 0x8b, 0x90, 0x95, 0x99, 0x9d, 0xa0, 0xa3, 0xa5, 0xa7, 0xa9, 0xaa, 0xac, 0xad, 0xae, { 0x40, 0x3A, 0x35, 0x30, 0x2B, 0x27, 0x23, 0x20, 0x1D, 0x1B, 0x19, 0x17, 0x16, 0x14, 0x13, 0x12,
0xaf, 0xb0, 0xb1, 0xb2, 0xb2, 0xb3, 0xb3, 0xb4, 0xb4, 0xb5, 0xb5, 0xb6, 0xb6, 0xb6, 0xb7, 0xb7 }, 0x11, 0x10, 0x0F, 0x0E, 0x0E, 0x0D, 0x0D, 0x0C, 0x0C, 0x0B, 0x0B, 0x0A, 0x0A, 0x0A, 0x09, 0x09 },
{ 0x80, 0x85, 0x8a, 0x8f, 0x93, 0x97, 0x9a, 0x9d, 0xa0, 0xa2, 0xa5, 0xa6, 0xa8, 0xaa, 0xab, 0xac, { 0x40, 0x3B, 0x36, 0x31, 0x2D, 0x29, 0x26, 0x23, 0x20, 0x1E, 0x1B, 0x1A, 0x18, 0x16, 0x15, 0x14,
0xad, 0xae, 0xaf, 0xb0, 0xb0, 0xb1, 0xb2, 0xb2, 0xb3, 0xb3, 0xb4, 0xb4, 0xb5, 0xb5, 0xb5, 0xb5 }, 0x13, 0x12, 0x11, 0x10, 0x10, 0x0F, 0x0E, 0x0E, 0x0D, 0x0D, 0x0C, 0x0C, 0x0B, 0x0B, 0x0B, 0x0A },
{ 0x80, 0x85, 0x89, 0x8d, 0x91, 0x95, 0x98, 0x9b, 0x9e, 0xa0, 0xa0, 0xa4, 0xa6, 0xa7, 0xa9, 0xaa, { 0x40, 0x3B, 0x37, 0x33, 0x2F, 0x2B, 0x28, 0x25, 0x22, 0x20, 0x1E, 0x1C, 0x1A, 0x19, 0x17, 0x16,
0xab, 0xac, 0xad, 0xae, 0xaf, 0xb0, 0xb0, 0xb1, 0xb1, 0xb2, 0xb2, 0xb3, 0xb3, 0xb4, 0xb4, 0xb4 }, 0x15, 0x14, 0x13, 0x12, 0x11, 0x10, 0x10, 0x0F, 0x0F, 0x0E, 0x0E, 0x0D, 0x0D, 0x0C, 0x0C, 0x0C },
{ 0x80, 0x84, 0x88, 0x8c, 0x90, 0x93, 0x96, 0x99, 0x9b, 0x9e, 0xa0, 0xa2, 0xa4, 0xa5, 0xa7, 0xa8, { 0x40, 0x3C, 0x38, 0x34, 0x30, 0x2D, 0x2A, 0x27, 0x25, 0x20, 0x20, 0x1E, 0x1C, 0x1B, 0x19, 0x18,
0xa9, 0xaa, 0xab, 0xac, 0xad, 0xae, 0xaf, 0xaf, 0xb0, 0xb0, 0xb1, 0xb2, 0xb2, 0xb2, 0xb3, 0xb3 }, 0x17, 0x16, 0x15, 0x14, 0x13, 0x12, 0x11, 0x11, 0x10, 0x10, 0x0F, 0x0E, 0x0E, 0x0E, 0x0D, 0x0D },
{ 0x80, 0x84, 0x87, 0x8b, 0x8e, 0x91, 0x94, 0x97, 0x9a, 0x9c, 0x9e, 0xa0, 0xa2, 0xa3, 0xa5, 0xa6, { 0x40, 0x3C, 0x39, 0x35, 0x32, 0x2F, 0x2C, 0x29, 0x26, 0x24, 0x22, 0x20, 0x1E, 0x1D, 0x1B, 0x1A,
0xa7, 0xa9, 0xaa, 0xab, 0xac, 0xac, 0xad, 0xae, 0xae, 0xaf, 0xb0, 0xb0, 0xb1, 0xb1, 0xb2, 0xb2 }, 0x19, 0x17, 0x16, 0x15, 0x14, 0x14, 0x13, 0x12, 0x12, 0x11, 0x10, 0x10, 0x0F, 0x0F, 0x0E, 0x0E },
{ 0x80, 0x83, 0x87, 0x8a, 0x8d, 0x90, 0x93, 0x96, 0x98, 0x9a, 0x9c, 0x9e, 0xa0, 0xa2, 0xa3, 0xa5, { 0x40, 0x3D, 0x39, 0x36, 0x33, 0x30, 0x2D, 0x2A, 0x28, 0x26, 0x24, 0x22, 0x20, 0x1E, 0x1D, 0x1B,
0xa6, 0xa7, 0xa8, 0xa9, 0xaa, 0xab, 0xac, 0xac, 0xad, 0xae, 0xae, 0xaf, 0xb0, 0xb0, 0xb0, 0xb1 }, 0x1A, 0x19, 0x18, 0x17, 0x16, 0x15, 0x14, 0x14, 0x13, 0x12, 0x12, 0x11, 0x10, 0x10, 0x10, 0x0F },
{ 0x80, 0x83, 0x86, 0x89, 0x8c, 0x8f, 0x92, 0x94, 0x96, 0x99, 0x9b, 0x9d, 0x9e, 0xa0, 0xa2, 0xa3, { 0x40, 0x3D, 0x3A, 0x37, 0x34, 0x31, 0x2E, 0x2C, 0x2A, 0x27, 0x25, 0x23, 0x22, 0x20, 0x1E, 0x1D,
0xa4, 0xa5, 0xa7, 0xa8, 0xa9, 0xa9, 0xaa, 0xab, 0xac, 0xac, 0xad, 0xae, 0xae, 0xaf, 0xaf, 0xb0 }, 0x1C, 0x1B, 0x19, 0x18, 0x17, 0x17, 0x16, 0x15, 0x14, 0x14, 0x13, 0x12, 0x12, 0x11, 0x11, 0x10 },
{ 0x80, 0x83, 0x86, 0x89, 0x8b, 0x8e, 0x90, 0x93, 0x95, 0x97, 0x99, 0x9b, 0x9d, 0x9e, 0xa0, 0xa1, { 0x40, 0x3D, 0x3A, 0x37, 0x35, 0x32, 0x30, 0x2D, 0x2B, 0x29, 0x27, 0x25, 0x23, 0x22, 0x20, 0x1F,
0xa3, 0xa4, 0xa5, 0xa6, 0xa7, 0xa8, 0xa9, 0xaa, 0xaa, 0xab, 0xac, 0xad, 0xad, 0xae, 0xae, 0xaf }, 0x1D, 0x1C, 0x1B, 0x1A, 0x19, 0x18, 0x17, 0x16, 0x16, 0x15, 0x14, 0x13, 0x13, 0x12, 0x12, 0x11 },
{ 0x80, 0x83, 0x85, 0x88, 0x8b, 0x8d, 0x90, 0x92, 0x94, 0x96, 0x98, 0x9a, 0x9b, 0x9d, 0x9f, 0xa0, { 0x40, 0x3D, 0x3B, 0x38, 0x35, 0x33, 0x30, 0x2E, 0x2C, 0x2A, 0x28, 0x26, 0x25, 0x23, 0x21, 0x20,
0xa1, 0xa3, 0xa4, 0xa5, 0xa6, 0xa7, 0xa8, 0xa8, 0xa9, 0xaa, 0xab, 0xab, 0xac, 0xad, 0xad, 0xae }, 0x1F, 0x1D, 0x1C, 0x1B, 0x1A, 0x19, 0x18, 0x18, 0x17, 0x16, 0x15, 0x15, 0x14, 0x13, 0x13, 0x12 },
{ 0x80, 0x83, 0x85, 0x88, 0x8a, 0x8c, 0x8f, 0x91, 0x93, 0x95, 0x97, 0x99, 0x9a, 0x9c, 0x9d, 0x9f, { 0x40, 0x3D, 0x3B, 0x38, 0x36, 0x34, 0x31, 0x2F, 0x2D, 0x2B, 0x29, 0x27, 0x26, 0x24, 0x23, 0x21,
0xa0, 0xa1, 0xa2, 0xa3, 0xa5, 0xa5, 0xa6, 0xa7, 0xa8, 0xa9, 0xaa, 0xaa, 0xab, 0xab, 0xac, 0xad }, 0x20, 0x1F, 0x1E, 0x1D, 0x1B, 0x1B, 0x1A, 0x19, 0x18, 0x17, 0x16, 0x16, 0x15, 0x15, 0x14, 0x13 },
{ 0x80, 0x82, 0x85, 0x87, 0x89, 0x8c, 0x8e, 0x90, 0x92, 0x94, 0x96, 0x97, 0x99, 0x9b, 0x9c, 0x9d, { 0x40, 0x3E, 0x3B, 0x39, 0x37, 0x34, 0x32, 0x30, 0x2E, 0x2C, 0x2A, 0x29, 0x27, 0x25, 0x24, 0x23,
0x9f, 0xa0, 0xa1, 0xa2, 0xa3, 0xa4, 0xa5, 0xa6, 0xa7, 0xa8, 0xa8, 0xa9, 0xaa, 0xaa, 0xab, 0xac }, 0x21, 0x20, 0x1F, 0x1E, 0x1D, 0x1C, 0x1B, 0x1A, 0x19, 0x18, 0x18, 0x17, 0x16, 0x16, 0x15, 0x14 },
{ 0x80, 0x82, 0x85, 0x87, 0x89, 0x8b, 0x8d, 0x8f, 0x91, 0x93, 0x95, 0x96, 0x98, 0x99, 0x9b, 0x9c, { 0x40, 0x3E, 0x3B, 0x39, 0x37, 0x35, 0x33, 0x31, 0x2F, 0x2D, 0x2B, 0x2A, 0x28, 0x27, 0x25, 0x24,
0x9e, 0x9f, 0xa0, 0xa1, 0xa2, 0xa3, 0xa4, 0xa5, 0xa6, 0xa7, 0xa7, 0xa8, 0xa9, 0xa9, 0xaa, 0xab }, 0x22, 0x21, 0x20, 0x1F, 0x1E, 0x1D, 0x1C, 0x1B, 0x1A, 0x19, 0x19, 0x18, 0x17, 0x17, 0x16, 0x15 },
{ 0x80, 0x82, 0x84, 0x86, 0x88, 0x8a, 0x8c, 0x8e, 0x90, 0x92, 0x94, 0x95, 0x97, 0x98, 0x9a, 0x9b, { 0x40, 0x3E, 0x3C, 0x3A, 0x38, 0x36, 0x34, 0x32, 0x30, 0x2E, 0x2C, 0x2B, 0x29, 0x28, 0x26, 0x25,
0x9d, 0x9e, 0x9f, 0xa0, 0xa1, 0xa2, 0xa3, 0xa4, 0xa5, 0xa6, 0xa6, 0xa7, 0xa8, 0xa8, 0xa9, 0xaa }, 0x23, 0x22, 0x21, 0x20, 0x1F, 0x1E, 0x1D, 0x1C, 0x1B, 0x1A, 0x1A, 0x19, 0x18, 0x18, 0x17, 0x16 },
{ 0x80, 0x82, 0x84, 0x86, 0x88, 0x8a, 0x8c, 0x8e, 0x90, 0x91, 0x93, 0x94, 0x96, 0x97, 0x99, 0x9a, { 0x40, 0x3E, 0x3C, 0x3A, 0x38, 0x36, 0x34, 0x32, 0x30, 0x2F, 0x2D, 0x2C, 0x2A, 0x29, 0x27, 0x26,
0x9b, 0x9d, 0x9e, 0x9f, 0xa0, 0xa1, 0xa2, 0xa3, 0xa4, 0xa5, 0xa5, 0xa6, 0xa7, 0xa7, 0xa8, 0xa9 }, 0x25, 0x23, 0x22, 0x21, 0x20, 0x1F, 0x1E, 0x1D, 0x1C, 0x1B, 0x1B, 0x1A, 0x19, 0x19, 0x18, 0x17 },
{ 0x80, 0x82, 0x84, 0x86, 0x88, 0x8a, 0x8b, 0x8d, 0x8f, 0x90, 0x92, 0x94, 0x95, 0x97, 0x98, 0x99, { 0x40, 0x3E, 0x3C, 0x3A, 0x38, 0x36, 0x35, 0x33, 0x31, 0x30, 0x2E, 0x2C, 0x2B, 0x29, 0x28, 0x27,
0x9b, 0x9c, 0x9d, 0x9e, 0x9f, 0xa0, 0xa1, 0xa2, 0xa3, 0xa4, 0xa4, 0xa5, 0xa6, 0xa6, 0xa7, 0xa8 }, 0x25, 0x24, 0x23, 0x22, 0x21, 0x20, 0x1F, 0x1E, 0x1D, 0x1C, 0x1C, 0x1B, 0x1A, 0x1A, 0x19, 0x18 },
{ 0x80, 0x82, 0x84, 0x86, 0x87, 0x89, 0x8b, 0x8d, 0x8e, 0x90, 0x91, 0x93, 0x94, 0x96, 0x97, 0x98, { 0x40, 0x3E, 0x3C, 0x3A, 0x39, 0x37, 0x35, 0x33, 0x32, 0x30, 0x2F, 0x2D, 0x2C, 0x2A, 0x29, 0x28,
0x9a, 0x9b, 0x9c, 0x9d, 0x9e, 0x9f, 0xa0, 0xa1, 0xa2, 0xa3, 0xa3, 0xa4, 0xa5, 0xa6, 0xa6, 0xa7 }, 0x26, 0x25, 0x24, 0x23, 0x22, 0x21, 0x20, 0x1F, 0x1E, 0x1D, 0x1D, 0x1C, 0x1B, 0x1A, 0x1A, 0x19 },
{ 0x80, 0x82, 0x84, 0x85, 0x87, 0x89, 0x8a, 0x8c, 0x8e, 0x8f, 0x91, 0x92, 0x94, 0x95, 0x96, 0x98, { 0x40, 0x3E, 0x3C, 0x3B, 0x39, 0x37, 0x36, 0x34, 0x32, 0x31, 0x2F, 0x2E, 0x2C, 0x2B, 0x2A, 0x28,
0x99, 0x9a, 0x9b, 0x9c, 0x9d, 0x9e, 0x9f, 0xa0, 0xa1, 0xa2, 0xa2, 0xa3, 0xa4, 0xa5, 0xa5, 0xa6 }, 0x27, 0x26, 0x25, 0x24, 0x23, 0x22, 0x21, 0x20, 0x1F, 0x1E, 0x1E, 0x1D, 0x1C, 0x1B, 0x1B, 0x1A },
{ 0x80, 0x82, 0x83, 0x85, 0x87, 0x88, 0x8a, 0x8c, 0x8d, 0x8f, 0x90, 0x92, 0x93, 0x94, 0x96, 0x97, { 0x40, 0x3E, 0x3D, 0x3B, 0x39, 0x38, 0x36, 0x34, 0x33, 0x31, 0x30, 0x2E, 0x2D, 0x2C, 0x2A, 0x29,
0x98, 0x99, 0x9a, 0x9b, 0x9c, 0x9d, 0x9e, 0x9f, 0xa0, 0xa1, 0xa2, 0xa2, 0xa3, 0xa4, 0xa5, 0xa5 }, 0x28, 0x27, 0x26, 0x25, 0x24, 0x23, 0x22, 0x21, 0x20, 0x1F, 0x1E, 0x1E, 0x1D, 0x1C, 0x1B, 0x1B },
{ 0x80, 0x82, 0x83, 0x85, 0x86, 0x88, 0x8a, 0x8b, 0x8d, 0x8e, 0x90, 0x91, 0x92, 0x94, 0x95, 0x96, { 0x40, 0x3E, 0x3D, 0x3B, 0x3A, 0x38, 0x36, 0x35, 0x33, 0x32, 0x30, 0x2F, 0x2E, 0x2C, 0x2B, 0x2A,
0x97, 0x98, 0x99, 0x9a, 0x9b, 0x9c, 0x9d, 0x9e, 0x9f, 0xa0, 0xa1, 0xa2, 0xa2, 0xa3, 0xa4, 0xa4 }, 0x29, 0x28, 0x27, 0x26, 0x25, 0x24, 0x23, 0x22, 0x21, 0x20, 0x1F, 0x1E, 0x1E, 0x1D, 0x1C, 0x1C },
{ 0x80, 0x82, 0x83, 0x85, 0x86, 0x88, 0x89, 0x8b, 0x8c, 0x8e, 0x8f, 0x90, 0x92, 0x93, 0x94, 0x95, { 0x40, 0x3E, 0x3D, 0x3B, 0x3A, 0x38, 0x37, 0x35, 0x34, 0x32, 0x31, 0x30, 0x2E, 0x2D, 0x2C, 0x2B,
0x96, 0x98, 0x99, 0x9a, 0x9b, 0x9c, 0x9d, 0x9e, 0x9e, 0x9f, 0xa0, 0xa1, 0xa2, 0xa2, 0xa3, 0xa4 }, 0x2A, 0x28, 0x27, 0x26, 0x25, 0x24, 0x23, 0x22, 0x22, 0x21, 0x20, 0x1F, 0x1E, 0x1E, 0x1D, 0x1C },
{ 0x80, 0x82, 0x83, 0x85, 0x86, 0x87, 0x89, 0x8a, 0x8c, 0x8d, 0x8e, 0x90, 0x91, 0x92, 0x93, 0x95, { 0x40, 0x3E, 0x3D, 0x3B, 0x3A, 0x39, 0x37, 0x36, 0x34, 0x33, 0x32, 0x30, 0x2F, 0x2E, 0x2D, 0x2B,
0x96, 0x97, 0x98, 0x99, 0x9a, 0x9b, 0x9c, 0x9d, 0x9e, 0x9e, 0x9f, 0xa0, 0xa1, 0xa1, 0xa2, 0xa3 }, 0x2A, 0x29, 0x28, 0x27, 0x26, 0x25, 0x24, 0x23, 0x22, 0x22, 0x21, 0x20, 0x1F, 0x1F, 0x1E, 0x1D },
{ 0x80, 0x81, 0x83, 0x84, 0x86, 0x87, 0x89, 0x8a, 0x8b, 0x8d, 0x8e, 0x8f, 0x90, 0x92, 0x93, 0x94, { 0x40, 0x3F, 0x3D, 0x3C, 0x3A, 0x39, 0x37, 0x36, 0x35, 0x33, 0x32, 0x31, 0x30, 0x2E, 0x2D, 0x2C,
0x95, 0x96, 0x97, 0x98, 0x99, 0x9a, 0x9b, 0x9c, 0x9d, 0x9e, 0x9e, 0x9f, 0xa0, 0xa1, 0xa1, 0xa2 }, 0x2B, 0x2A, 0x29, 0x28, 0x27, 0x26, 0x25, 0x24, 0x23, 0x22, 0x22, 0x21, 0x20, 0x1F, 0x1F, 0x1E },
{ 0x80, 0x81, 0x83, 0x84, 0x86, 0x87, 0x88, 0x8a, 0x8b, 0x8c, 0x8e, 0x8f, 0x90, 0x91, 0x92, 0x93, { 0x40, 0x3F, 0x3D, 0x3C, 0x3A, 0x39, 0x38, 0x36, 0x35, 0x34, 0x32, 0x31, 0x30, 0x2F, 0x2E, 0x2D,
0x95, 0x96, 0x97, 0x98, 0x99, 0x9a, 0x9a, 0x9b, 0x9c, 0x9d, 0x9e, 0x9f, 0x9f, 0xa0, 0xa1, 0xa1 }, 0x2B, 0x2A, 0x29, 0x28, 0x27, 0x26, 0x26, 0x25, 0x24, 0x23, 0x22, 0x21, 0x21, 0x20, 0x1F, 0x1F },
{ 0x80, 0x81, 0x83, 0x84, 0x85, 0x87, 0x88, 0x89, 0x8b, 0x8c, 0x8d, 0x8e, 0x90, 0x91, 0x92, 0x93, { 0x40, 0x3F, 0x3D, 0x3C, 0x3B, 0x39, 0x38, 0x37, 0x35, 0x34, 0x33, 0x32, 0x30, 0x2F, 0x2E, 0x2D,
0x94, 0x95, 0x96, 0x97, 0x98, 0x99, 0x9a, 0x9b, 0x9b, 0x9c, 0x9d, 0x9e, 0x9f, 0x9f, 0xa0, 0xa1 }, 0x2C, 0x2B, 0x2A, 0x29, 0x28, 0x27, 0x26, 0x25, 0x25, 0x24, 0x23, 0x22, 0x21, 0x21, 0x20, 0x1F },
{ 0x80, 0x81, 0x83, 0x84, 0x85, 0x87, 0x88, 0x89, 0x8a, 0x8c, 0x8d, 0x8e, 0x8f, 0x90, 0x91, 0x92, { 0x40, 0x3F, 0x3D, 0x3C, 0x3B, 0x39, 0x38, 0x37, 0x35, 0x34, 0x33, 0x32, 0x31, 0x30, 0x2F, 0x2E,
0x93, 0x94, 0x95, 0x96, 0x97, 0x98, 0x99, 0x9a, 0x9b, 0x9c, 0x9c, 0x9d, 0x9e, 0x9f, 0x9f, 0xa0 } 0x2D, 0x2C, 0x2B, 0x2A, 0x29, 0x28, 0x27, 0x26, 0x25, 0x24, 0x24, 0x23, 0x22, 0x21, 0x21, 0x20 }
}; };
// Mode 7 scaling constants for all raster lines // Mode 7 scaling constants for all raster lines
@ -316,6 +331,7 @@ static const int16 ST010_M7Scale[176] =
#endif #endif
#define ST010_WORD(offset) (Memory.SRAM[offset + 1] << 8) | Memory.SRAM[offset] #define ST010_WORD(offset) (Memory.SRAM[offset + 1] << 8) | Memory.SRAM[offset]
#define ST010_DWORD(offset) (Memory.SRAM[offset + 3] << 24) | (Memory.SRAM[offset + 2] << 16) | (Memory.SRAM[offset + 1] << 8) | Memory.SRAM[offset]
static int16 ST010_Sin (int16 Theta) static int16 ST010_Sin (int16 Theta)
@ -328,47 +344,43 @@ static int16 ST010_Cos (int16 Theta)
return (ST010_SinTable[((Theta + 0x4000) >> 8) & 0xff]); return (ST010_SinTable[((Theta + 0x4000) >> 8) & 0xff]);
} }
static void ST010_OP01 (int16 x0, int16 y0, int16 &x1, int16 &y1, int16 &Quadrant, int16 &Theta) void ST010_Compass(int16 x0, int16 y0, int16 &x1, int16 &y1, int16 &Quadrant, int16 &Theta)
{ {
if ((x0 < 0) && (y0 < 0)) if ((x0 <= 0) && (y0 < 0))
{ {
x1 = -x0; x1 = -x0;
y1 = -y0; y1 = -y0;
Quadrant = -0x8000; Quadrant = -0x8000;
} }
else else if (x0 < 0)
if (x0 < 0)
{ {
x1 = y0; x1 = y0;
y1 = -x0; y1 = -x0;
Quadrant = -0x4000; Quadrant = -0x4000;
} }
else else if (y0 < 0)
if (y0 < 0)
{ {
x1 = -y0; x1 = -y0;
y1 = x0; y1 = x0;
Quadrant = 0x4000; Quadrant = 0x4000;
} }
else else
{ {
x1 = x0; x1 = x0;
y1 = y0; y1 = y0;
Quadrant = 0x0000; Quadrant = 0x0000;
} }
while ((x1 > 0x1f) || (y1 > 0x1f)) while ((x1 > 0x1f) || (y1 > 0x1f))
{ {
if (x1 > 1) if (x1 > 1) x1 >>= 1;
x1 >>= 1; if (y1 > 1) y1 >>= 1;
if (y1 > 1)
y1 >>= 1;
} }
if (y1 == 0) Theta = ST010_ArcTan[x1 & 0x1f][y1 & 0x1f] << 8;
Quadrant += 0x4000; Theta = (Theta | Quadrant) ^ 0x8000;
Theta = (ST010_ArcTan[y1][x1] << 8) ^ Quadrant; if ((x0 == 0) && (y0 < 0)) Quadrant = 0x4000;
} }
static void ST010_Scale (int16 Multiplier, int16 X0, int16 Y0, int32 &X1, int32 &Y1) static void ST010_Scale (int16 Multiplier, int16 X0, int16 Y0, int32 &X1, int32 &Y1)
@ -421,17 +433,108 @@ static void ST010_SortDrivers (uint16 Positions, uint16 Places[32], uint16 Drive
} }
} }
/* static void ST010_Raster(int16 Theta)
static void SETA_Distance (int16 Y0, int16 X0, int16 &Distance)
{ {
if (X0 < 0) int16 data;
X0 = -X0; int offset = 0;
if (Y0 < 0)
Y0 = -Y0;
Distance = ((X0 * 0x7af0) + 0x4000) >> 15; for (int i = 0; i < 176; i++)
{
data = ST010_M7Scale[i] * ST010_Cos(Theta) >> 15;
Memory.SRAM[0x00f0 + offset] = data;
Memory.SRAM[0x00f1 + offset] = data >> 8;
Memory.SRAM[0x0510 + offset] = data;
Memory.SRAM[0x0511 + offset] = data >> 8;
data = ST010_M7Scale[i] * ST010_Sin(Theta) >> 15;
Memory.SRAM[0x0250 + offset] = data;
Memory.SRAM[0x0251 + offset] = data >> 8;
if (data) data = ~data;
Memory.SRAM[0x03b0 + offset] = data;
Memory.SRAM[0x03b1 + offset] = data >> 8;
offset += 2;
}
}
static void ST010_Distance(int16 x0, int16 y0, int16 &Distance)
{
int32 Product;
x0 = (x0 < 0) ? -x0 : x0;
y0 = (y0 < 0) ? -y0 : y0;
if((uint16) x0 >= ((uint16) y0))
Product = ((x0 * 0x3d78 << 1) + (y0 * 0x1976 << 1)) << 1;
else
Product = ((y0 * 0x3d78 << 1) + (x0 * 0x1976 << 1)) << 1;
Distance = (Product + 0x8000) >> 16;
}
static void ST010_Navigation(int16 &MaxX, int16 &MaxY, int32 &x0, int32 &y0, int16 &Theta0, int16 &Theta1, int16 &x1, int16 &y1, uint16 &Radius, uint16 Increment, uint16 MaxRadius, int16 &Compass, int16 &Flags, int16 NewMaxX, int16 NewMaxY)
{
int16 dummy1,dummy2,dummy3;
uint16 utemp16;
int32 temp32;
x1 = MaxX - (x0 >> 16);
y1 = MaxY - (y0 >> 16);
ST010_Compass(x1, y1, dummy1, dummy2, dummy3, Theta1);
Theta1 -= Theta0;
if (Theta1 & 0xff00)
Theta0 += (Theta1 & 0x8000) ? 0xfd80 : 0x0280;
// compiler notice: -0x8000 ==> +0x8000
utemp16 = ((Theta1 < 0) ? (int16) -Theta1 : Theta1) >> 4;
if (utemp16 < 0x0100)
{
temp32 = Radius + Increment;
Radius = (temp32 >= MaxRadius) ? MaxRadius : (uint16) temp32;
}
else
{
temp32 = Radius - utemp16;
Radius = (temp32 <= 0) ? 0 : (uint16) temp32;
}
x0 -= ((ST010_Sin(Theta0) >> 5) * (Radius >> 8)) << 1;
y0 -= ((ST010_Cos(Theta0) >> 5) * (Radius >> 8)) << 1;
x0 &= 0x1fffffff;
y0 &= 0x1fffffff;
int16 MaxRadiusX, MaxRadiusY;
if (Compass & 0x8000)
{
MaxRadiusX = 0x0008;
MaxRadiusY = 0x0080;
}
else
{
MaxRadiusX = 0x0080;
MaxRadiusY = 0x0008;
}
if ((abs(x1) < MaxRadiusX) && (abs(y1) < MaxRadiusY))
{
MaxX = NewMaxX;
MaxY = NewMaxY & 0x0fff;
Compass = (NewMaxY & 0x8000) ? 0xffff : 0x0000;
Flags |= 0x0008;
}
} }
*/
uint8 S9xGetST010 (uint32 Address) uint8 S9xGetST010 (uint32 Address)
{ {
@ -471,16 +574,32 @@ void S9xSetST010 (uint32 Address, uint8 Byte)
{ {
switch (ST010.op_reg) switch (ST010.op_reg)
{ {
// Heading
case 0x01:
{
Memory.SRAM[0x0006] = Memory.SRAM[0x0002];
Memory.SRAM[0x0007] = Memory.SRAM[0x0003];
#ifdef FAST_LSB_WORD_ACCESS
ST010_Compass(*(int16 *) &Memory.SRAM[0x0000], *(int16 *) &Memory.SRAM[0x0002], (int16 &) Memory.SRAM[0x0000], (int16 &) Memory.SRAM[0x0002], (int16 &) Memory.SRAM[0x0004], (int16 &) Memory.SRAM[0x0010]);
#else
int16 x1, y1, Quadrant, Theta;
ST010_Compass(ST010_WORD(0x0000), ST010_WORD(0x0002), x1, y1, Quadrant, Theta);
Memory.SRAM[0x0000] = (uint8) (x1);
Memory.SRAM[0x0001] = (uint8) (x1 >> 8);
Memory.SRAM[0x0002] = (uint8) (y1);
Memory.SRAM[0x0003] = (uint8) (y1 >> 8);
Memory.SRAM[0x0004] = (uint8) (Quadrant);
Memory.SRAM[0x0005] = (uint8) (Quadrant >> 8);
Memory.SRAM[0x0010] = (uint8) (Theta);
Memory.SRAM[0x0011] = (uint8) (Theta >> 8);
#endif
break;
}
// Sorts Driver Placements // Sorts Driver Placements
//
// Input
// 0x0024-0x0025 : Positions
// 0x0040-0x007f : Places
// 0x0080-0x00ff : Drivers
// Output
// 0x0040-0x007f : Places
// 0x0080-0x00ff : Drivers
//
case 0x02: case 0x02:
{ {
#ifdef FAST_LSB_WORD_ACCESS #ifdef FAST_LSB_WORD_ACCESS
@ -513,15 +632,6 @@ void S9xSetST010 (uint32 Address, uint8 Byte)
} }
// Two Dimensional Coordinate Scale // Two Dimensional Coordinate Scale
//
// Input
// 0x0000-0x0001 : X0 (signed)
// 0x0002-0x0003 : Y0 (signed)
// 0x0004-0x0005 : Multiplier (signed)
// Output
// 0x0010-0x0013 : X1 (signed)
// 0x0014-0x0017 : Y1 (signed)
//
case 0x03: case 0x03:
{ {
#ifdef FAST_LSB_WORD_ACCESS #ifdef FAST_LSB_WORD_ACCESS
@ -543,14 +653,74 @@ void S9xSetST010 (uint32 Address, uint8 Byte)
break; break;
} }
// calculate the vector length of (x, y)
case 0x04:
{
#ifdef FAST_LSB_WORD_ACCESS
ST010_Distance(*(int16 *) &Memory.SRAM[0x0000], *(int16 *) &Memory.SRAM[0x0002], (int16 &) Memory.SRAM[0x0010]);
#else
int16 square;
ST010_Distance(ST010_WORD(0x0000), ST010_WORD(0x0002), square);
Memory.SRAM[0x10] = (uint8) (square);
Memory.SRAM[0x11] = (uint8) (square >> 8);
#endif
break;
}
// calculate AI orientation based on specific guidelines
case 0x05:
{
#ifdef FAST_LSB_WORD_ACCESS
ST010_Navigation((int16 &) Memory.SRAM[0x00c0], (int16 &) Memory.SRAM[0x00c2], (int32 &) Memory.SRAM[0x00c4], (int32 &) Memory.SRAM[0x00c8], (int16 &) Memory.SRAM[0x00cc], (int16 &) Memory.SRAM[0x00ce], (int16 &) Memory.SRAM[0x00d0], (int16 &) Memory.SRAM[0x00d2], (uint16 &) Memory.SRAM[0x00d4], *(uint16 *) &Memory.SRAM[0x00d6], *(uint16 *) &Memory.SRAM[0x00d8], (int16 &) Memory.SRAM[0x00da], (int16 &) Memory.SRAM[0x00dc], *(int16 *) &Memory.SRAM[0x00de], *(int16 *) &Memory.SRAM[0x00e0]);
#else
int32 x0,y0;
int16 MaxX,MaxY,Theta0,Theta1,x1,y1,Compass,Flags;
uint16 Radius;
MaxX = ST010_WORD(0x00c0);
MaxY = ST010_WORD(0x00c2);
x0 = ST010_DWORD(0x00c4);
y0 = ST010_DWORD(0x00c8);
Theta0 = ST010_WORD(0x00cc);
Radius = ST010_WORD(0x00d4);
Compass = ST010_WORD(0x00da);
Flags = ST010_WORD(0x00dc);
ST010_Navigation(MaxX, MaxY, x0, y0, Theta0, Theta1, x1, y1, Radius, ST010_WORD(0x00d6), ST010_WORD(0x00d8), Compass, Flags, ST010_WORD(0x00de), ST010_WORD(0x00e0));
Memory.SRAM[0x00c0] = (uint8) (MaxX);
Memory.SRAM[0x00c1] = (uint8) (MaxX >> 8);
Memory.SRAM[0x00c2] = (uint8) (MaxY);
Memory.SRAM[0x00c3] = (uint8) (MaxY >> 8);
Memory.SRAM[0x00c4] = (uint8) (x0);
Memory.SRAM[0x00c5] = (uint8) (x0 >> 8);
Memory.SRAM[0x00c6] = (uint8) (x0 >> 16);
Memory.SRAM[0x00c7] = (uint8) (x0 >> 24);
Memory.SRAM[0x00c8] = (uint8) (y0);
Memory.SRAM[0x00c9] = (uint8) (y0 >> 8);
Memory.SRAM[0x00ca] = (uint8) (y0 >> 16);
Memory.SRAM[0x00cb] = (uint8) (y0 >> 24);
Memory.SRAM[0x00cc] = (uint8) (Theta0);
Memory.SRAM[0x00cd] = (uint8) (Theta0 >> 8);
Memory.SRAM[0x00ce] = (uint8) (Theta1);
Memory.SRAM[0x00cf] = (uint8) (Theta1 >> 8);
Memory.SRAM[0x00d0] = (uint8) (x1);
Memory.SRAM[0x00d1] = (uint8) (x1 >> 8);
Memory.SRAM[0x00d2] = (uint8) (y1);
Memory.SRAM[0x00d3] = (uint8) (y1 >> 8);
Memory.SRAM[0x00d4] = (uint8) (Radius);
Memory.SRAM[0x00d5] = (uint8) (Radius >> 8);
Memory.SRAM[0x00da] = (uint8) (Compass);
Memory.SRAM[0x00db] = (uint8) (Compass >> 8);
Memory.SRAM[0x00dc] = (uint8) (Flags);
Memory.SRAM[0x00dd] = (uint8) (Flags >> 8);
#endif
break;
}
// 16-bit Multiplication // 16-bit Multiplication
//
// Input
// 0x0000-0x0001 : Multiplcand (signed)
// 0x0002-0x0003 : Multiplier (signed)
// Output
// 0x0010-0x0013 : Product (signed)
//
case 0x06: case 0x06:
{ {
#ifdef FAST_LSB_WORD_ACCESS #ifdef FAST_LSB_WORD_ACCESS
@ -569,45 +739,13 @@ void S9xSetST010 (uint32 Address, uint8 Byte)
} }
// Mode 7 Raster Data Calculation // Mode 7 Raster Data Calculation
//
// Input
// 0x0000-0x0001 : Angle (signed)
// Output
// 0x00f0-0x024f : Mode 7 Matrix A
// 0x0250-0x03af : Mode 7 Matrix B
// 0x03b0-0x050f : Mode 7 Matrix C
// 0x0510-0x066f : Mode 7 Matrix D
//
case 0x07: case 0x07:
{ {
int16 data; #ifdef FAST_LSB_WORD_ACCESS
int32 offset = 0; ST010_Raster(*(int16 *) &Memory.SRAM[0x0000]);
int16 Theta = ST010_WORD(0x0000); #else
ST010_Raster(ST010_WORD(0x0000));
for (int32 line = 0; line < 176; line++) #endif
{
// Calculate Mode 7 Matrix A/D data
data = ST010_M7Scale[line] * ST010_Cos(Theta) >> 15;
Memory.SRAM[0x00f0 + offset] = (uint8) (data);
Memory.SRAM[0x00f1 + offset] = (uint8) (data >> 8);
Memory.SRAM[0x0510 + offset] = (uint8) (data);
Memory.SRAM[0x0511 + offset] = (uint8) (data >> 8);
// Calculate Mode 7 Matrix B/C data
data = ST010_M7Scale[line] * ST010_Sin(Theta) >> 15;
Memory.SRAM[0x0250 + offset] = (uint8) (data);
Memory.SRAM[0x0251 + offset] = (uint8) (data >> 8);
if (data)
data = ~data;
Memory.SRAM[0x03b0 + offset] = (uint8) (data);
Memory.SRAM[0x03b1 + offset] = (uint8) (data >> 8);
offset += 2;
}
// Shift Angle for use with Lookup table // Shift Angle for use with Lookup table
Memory.SRAM[0x00] = Memory.SRAM[0x01]; Memory.SRAM[0x00] = Memory.SRAM[0x01];
@ -617,15 +755,6 @@ void S9xSetST010 (uint32 Address, uint8 Byte)
} }
// Two dimensional Coordinate Rotation // Two dimensional Coordinate Rotation
//
// Input
// 0x0000-0x0001 : X0 (signed)
// 0x0002-0x0003 : Y0 (signed)
// 0x0004-0x0005 : Angle (signed)
// Output
// 0x0010-0x0011 : X1 (signed)
// 0x0012-0x0013 : Y1 (signed)
//
case 0x08: case 0x08:
{ {
#ifdef FAST_LSB_WORD_ACCESS #ifdef FAST_LSB_WORD_ACCESS
@ -643,212 +772,6 @@ void S9xSetST010 (uint32 Address, uint8 Byte)
break; break;
} }
// Input
// 0x0000-0x0001 : DX (signed)
// 0x0002-0x0003 : DY (signed)
// Output
// 0x0010-0x0011 : Angle (signed)
//
case 0x01:
{
Memory.SRAM[0x0006] = Memory.SRAM[0x0002];
Memory.SRAM[0x0007] = Memory.SRAM[0x0003];
#ifdef FAST_LSB_WORD_ACCESS
ST010_OP01(*(int16 *) &Memory.SRAM[0x0000], *(int16 *) &Memory.SRAM[0x0002], (int16 &) Memory.SRAM[0x0000], (int16 &) Memory.SRAM[0x0002], (int16 &) Memory.SRAM[0x0004], (int16 &) Memory.SRAM[0x0010]);
#else
int16 x1, y1, Quadrant, Theta;
ST010_OP01(ST010_WORD(0x0000), ST010_WORD(0x0002), x1, y1, Quadrant, Theta);
Memory.SRAM[0x0000] = (uint8) (x1);
Memory.SRAM[0x0001] = (uint8) (x1 >> 8);
Memory.SRAM[0x0002] = (uint8) (y1);
Memory.SRAM[0x0003] = (uint8) (y1 >> 8);
Memory.SRAM[0x0004] = (uint8) (Quadrant);
Memory.SRAM[0x0005] = (uint8) (Quadrant >> 8);
Memory.SRAM[0x0010] = (uint8) (Theta);
Memory.SRAM[0x0011] = (uint8) (Theta >> 8);
#endif
break;
}
// calculate the vector length of (x, y)
case 0x04:
{
int16 square, x, y;
#ifdef FAST_LSB_WORD_ACCESS
x = *((int16 *) Memory.SRAM);
y = *((int16 *) &Memory.SRAM[2]);
#else
x = Memory.SRAM[0] | (Memory.SRAM[1] << 8);
y = Memory.SRAM[2] | (Memory.SRAM[3] << 8);
#endif
square = (int16) sqrt((double) (y * y + x * x));
//SETA_Distance(x, y, square);
#ifdef FAST_LSB_WORD_ACCESS
*((int16 *) &Memory.SRAM[0x10]) = square;
#else
Memory.SRAM[0x10] = (uint8) (square);
Memory.SRAM[0x11] = (uint8) (square >> 8);
#endif
break;
}
// calculate AI orientation based on specific guidelines
case 0x05:
{
int32 dx, dy;
int16 a1, b1, c1;
uint16 o1;
bool wrap = false;
// target (x, y) coordinates
int16 ypos_max = ST010_WORD(0x00C0);
int16 xpos_max = ST010_WORD(0x00C2);
// current coordinates and direction
int32 ypos = Memory.SRAM[0xC4] | (Memory.SRAM[0xC5] << 8) | (Memory.SRAM[0xC6] << 16) | (Memory.SRAM[0xC7] << 24);
int32 xpos = Memory.SRAM[0xC8] | (Memory.SRAM[0xC9] << 8) | (Memory.SRAM[0xCA] << 16) | (Memory.SRAM[0xCB] << 24);
uint16 rot = Memory.SRAM[0xCC] | (Memory.SRAM[0xCD] << 8);
// physics
uint16 speed = ST010_WORD(0x00D4);
uint16 accel = ST010_WORD(0x00D6);
uint16 speed_max = ST010_WORD(0x00D8);
// special condition acknowledgment
int16 system = ST010_WORD(0x00DA);
int16 flags = ST010_WORD(0x00DC);
// new target coordinates
int16 ypos_new = ST010_WORD(0x00DE);
int16 xpos_new = ST010_WORD(0x00E0);
// mask upper bit
xpos_new &= 0x7FFF;
// get the current distance
dx = xpos_max - (xpos >> 16);
dy = ypos_max - (ypos >> 16);
// quirk: clear and move in9
Memory.SRAM[0xD2] = 0xFF;
Memory.SRAM[0xD3] = 0xFF;
Memory.SRAM[0xDA] = 0;
Memory.SRAM[0xDB] = 0;
// grab the target angle
ST010_OP01(dy, dx, a1, b1, c1, (int16 &) o1);
// check for wrapping
//if ((o1 < 0x6000 && rot > 0xA000) || (rot < 0x6000 && o1 > 0xA000))
//if (o1 < rot)
if (abs(o1 - rot) > 0x8000)
{
o1 += 0x8000;
rot += 0x8000;
wrap = true;
}
//o1 = 0x0000;
//rot = 0xFF00;
uint16 old_speed;
old_speed = speed;
// special case
if (abs(o1 - rot) == 0x8000)
speed = 0x100;
// slow down for sharp curves
else
if (abs(o1 - rot) >= 0x1000)
{
uint32 slow = abs(o1 - rot);
slow >>= 4; // scaling
speed -= slow;
}
// otherwise accelerate
else
{
speed += accel;
if (speed > speed_max)
{
// clip speed
speed = speed_max;
}
}
// prevent negative/positive overflow
if (abs(old_speed - speed) > 0x8000)
{
if (old_speed < speed)
speed = 0;
else
speed = 0xff00;
}
// adjust direction by so many degrees
// be careful of negative adjustments
if ((o1 > rot && (o1 - rot) > 0x80) || (o1 < rot && (rot - o1) >= 0x80))
{
if (o1 < rot)
rot -= 0x280;
else
if (o1 > rot)
rot += 0x280;
}
// turn off wrapping
if (wrap)
rot -= 0x8000;
// now check the distances (store for later)
dx = (xpos_max << 16) - xpos;
dy = (ypos_max << 16) - ypos;
dx >>= 16;
dy >>= 16;
// if we're in so many units of the target, signal it
if ((system && (dy <= 6 && dy >= -8) && (dx <= 126 && dx >= -128)) || (!system && (dx <= 6 && dx >= -8) && (dy <= 126 && dy >= -128)))
{
// announce our new destination and flag it
xpos_max = xpos_new & 0x7FFF;
ypos_max = ypos_new;
flags |= 0x08;
}
// update position
xpos -= (ST010_Cos(rot) * 0x400 >> 15) * (speed >> 8) << 1;
ypos -= (ST010_Sin(rot) * 0x400 >> 15) * (speed >> 8) << 1;
// quirk: mask upper byte
xpos &= 0x1FFFFFFF;
ypos &= 0x1FFFFFFF;
Memory.SRAM[0x00C0] = (uint8) (ypos_max);
Memory.SRAM[0x00C1] = (uint8) (ypos_max >> 8);
Memory.SRAM[0x00C2] = (uint8) (xpos_max);
Memory.SRAM[0x00C3] = (uint8) (xpos_max >> 8);
Memory.SRAM[0x00C4] = (uint8) (ypos);
Memory.SRAM[0x00C5] = (uint8) (ypos >> 8);
Memory.SRAM[0x00C6] = (uint8) (ypos >> 16);
Memory.SRAM[0x00C7] = (uint8) (ypos >> 24);
Memory.SRAM[0x00C8] = (uint8) (xpos);
Memory.SRAM[0x00C9] = (uint8) (xpos >> 8);
Memory.SRAM[0x00CA] = (uint8) (xpos >> 16);
Memory.SRAM[0x00CB] = (uint8) (xpos >> 24);
Memory.SRAM[0x00CC] = (uint8) (rot);
Memory.SRAM[0x00CD] = (uint8) (rot >> 8);
Memory.SRAM[0x00D4] = (uint8) (speed);
Memory.SRAM[0x00D5] = (uint8) (speed >> 8);
Memory.SRAM[0x00DC] = (uint8) (flags);
Memory.SRAM[0x00DD] = (uint8) (flags >> 8);
break;
}
default: default:
#ifdef DEBUGGER #ifdef DEBUGGER
printf("Unknown Op\n"); printf("Unknown Op\n");

View File

@ -17,13 +17,20 @@
(c) Copyright 2002 - 2010 Brad Jorsch (anomie@users.sourceforge.net), (c) Copyright 2002 - 2010 Brad Jorsch (anomie@users.sourceforge.net),
Nach (n-a-c-h@users.sourceforge.net), Nach (n-a-c-h@users.sourceforge.net),
zones (kasumitokoduck@yahoo.com)
(c) Copyright 2002 - 2011 zones (kasumitokoduck@yahoo.com)
(c) Copyright 2006 - 2007 nitsuja (c) Copyright 2006 - 2007 nitsuja
(c) Copyright 2009 - 2010 BearOso, (c) Copyright 2009 - 2018 BearOso,
OV2 OV2
(c) Copyright 2017 qwertymodo
(c) Copyright 2011 - 2017 Hans-Kristian Arntzen,
Daniel De Matteis
(Under no circumstances will commercial rights be given)
BS-X C emulator code BS-X C emulator code
(c) Copyright 2005 - 2006 Dreamer Nom, (c) Copyright 2005 - 2006 Dreamer Nom,
@ -117,6 +124,9 @@
Sound emulator code used in 1.52+ Sound emulator code used in 1.52+
(c) Copyright 2004 - 2007 Shay Green (gblargg@gmail.com) (c) Copyright 2004 - 2007 Shay Green (gblargg@gmail.com)
S-SMP emulator code used in 1.54+
(c) Copyright 2016 byuu
SH assembler code partly based on x86 assembler code SH assembler code partly based on x86 assembler code
(c) Copyright 2002 - 2004 Marcus Comstedt (marcus@mc.pp.se) (c) Copyright 2002 - 2004 Marcus Comstedt (marcus@mc.pp.se)
@ -130,7 +140,7 @@
(c) Copyright 2006 - 2007 Shay Green (c) Copyright 2006 - 2007 Shay Green
GTK+ GUI code GTK+ GUI code
(c) Copyright 2004 - 2010 BearOso (c) Copyright 2004 - 2018 BearOso
Win32 GUI code Win32 GUI code
(c) Copyright 2003 - 2006 blip, (c) Copyright 2003 - 2006 blip,
@ -138,11 +148,16 @@
Matthew Kendora, Matthew Kendora,
Nach, Nach,
nitsuja nitsuja
(c) Copyright 2009 - 2010 OV2 (c) Copyright 2009 - 2018 OV2
Mac OS GUI code Mac OS GUI code
(c) Copyright 1998 - 2001 John Stiles (c) Copyright 1998 - 2001 John Stiles
(c) Copyright 2001 - 2010 zones (c) Copyright 2001 - 2011 zones
Libretro port
(c) Copyright 2011 - 2017 Hans-Kristian Arntzen,
Daniel De Matteis
(Under no circumstances will commercial rights be given)
Specific ports contains the works of other authors. See headers in Specific ports contains the works of other authors. See headers in

View File

@ -17,13 +17,20 @@
(c) Copyright 2002 - 2010 Brad Jorsch (anomie@users.sourceforge.net), (c) Copyright 2002 - 2010 Brad Jorsch (anomie@users.sourceforge.net),
Nach (n-a-c-h@users.sourceforge.net), Nach (n-a-c-h@users.sourceforge.net),
zones (kasumitokoduck@yahoo.com)
(c) Copyright 2002 - 2011 zones (kasumitokoduck@yahoo.com)
(c) Copyright 2006 - 2007 nitsuja (c) Copyright 2006 - 2007 nitsuja
(c) Copyright 2009 - 2010 BearOso, (c) Copyright 2009 - 2018 BearOso,
OV2 OV2
(c) Copyright 2017 qwertymodo
(c) Copyright 2011 - 2017 Hans-Kristian Arntzen,
Daniel De Matteis
(Under no circumstances will commercial rights be given)
BS-X C emulator code BS-X C emulator code
(c) Copyright 2005 - 2006 Dreamer Nom, (c) Copyright 2005 - 2006 Dreamer Nom,
@ -117,6 +124,9 @@
Sound emulator code used in 1.52+ Sound emulator code used in 1.52+
(c) Copyright 2004 - 2007 Shay Green (gblargg@gmail.com) (c) Copyright 2004 - 2007 Shay Green (gblargg@gmail.com)
S-SMP emulator code used in 1.54+
(c) Copyright 2016 byuu
SH assembler code partly based on x86 assembler code SH assembler code partly based on x86 assembler code
(c) Copyright 2002 - 2004 Marcus Comstedt (marcus@mc.pp.se) (c) Copyright 2002 - 2004 Marcus Comstedt (marcus@mc.pp.se)
@ -130,7 +140,7 @@
(c) Copyright 2006 - 2007 Shay Green (c) Copyright 2006 - 2007 Shay Green
GTK+ GUI code GTK+ GUI code
(c) Copyright 2004 - 2010 BearOso (c) Copyright 2004 - 2018 BearOso
Win32 GUI code Win32 GUI code
(c) Copyright 2003 - 2006 blip, (c) Copyright 2003 - 2006 blip,
@ -138,11 +148,16 @@
Matthew Kendora, Matthew Kendora,
Nach, Nach,
nitsuja nitsuja
(c) Copyright 2009 - 2010 OV2 (c) Copyright 2009 - 2018 OV2
Mac OS GUI code Mac OS GUI code
(c) Copyright 1998 - 2001 John Stiles (c) Copyright 1998 - 2001 John Stiles
(c) Copyright 2001 - 2010 zones (c) Copyright 2001 - 2011 zones
Libretro port
(c) Copyright 2011 - 2017 Hans-Kristian Arntzen,
Daniel De Matteis
(Under no circumstances will commercial rights be given)
Specific ports contains the works of other authors. See headers in Specific ports contains the works of other authors. See headers in

View File

@ -13,8 +13,9 @@
*********************************************************************/ *********************************************************************/
/*************************** HEADER FILES ***************************/ /*************************** HEADER FILES ***************************/
#include <stdint.h>
#include <stdlib.h> #include <stdlib.h>
#include <memory.h> #include <string.h>
/****************************** MACROS ******************************/ /****************************** MACROS ******************************/
#define ROTLEFT(a,b) (((a) << (b)) | ((a) >> (32-(b)))) #define ROTLEFT(a,b) (((a) << (b)) | ((a) >> (32-(b))))
@ -35,7 +36,7 @@ typedef unsigned int WORD; /* 32-bit word, change to "long" for 16-
typedef struct { typedef struct {
BYTE data[64]; BYTE data[64];
WORD datalen; WORD datalen;
unsigned long long bitlen; uint64_t bitlen;
WORD state[8]; WORD state[8];
} SHA256_CTX; } SHA256_CTX;

View File

@ -204,6 +204,7 @@
#include "movie.h" #include "movie.h"
#include "display.h" #include "display.h"
#include "language.h" #include "language.h"
#include "gfx.h"
#ifndef min #ifndef min
#define min(a,b) (((a) < (b)) ? (a) : (b)) #define min(a,b) (((a) < (b)) ? (a) : (b))
@ -433,6 +434,7 @@ static FreezeData SnapPPU[] =
INT_ENTRY(6, CGFLIP), INT_ENTRY(6, CGFLIP),
INT_ENTRY(6, CGFLIPRead), INT_ENTRY(6, CGFLIPRead),
INT_ENTRY(6, CGADD), INT_ENTRY(6, CGADD),
INT_ENTRY(11, CGSavedByte),
ARRAY_ENTRY(6, CGDATA, 256, uint16_ARRAY_V), ARRAY_ENTRY(6, CGDATA, 256, uint16_ARRAY_V),
#define O(N) \ #define O(N) \
INT_ENTRY(6, OBJ[N].HPos), \ INT_ENTRY(6, OBJ[N].HPos), \
@ -529,7 +531,8 @@ static FreezeData SnapPPU[] =
INT_ENTRY(6, HDMA), INT_ENTRY(6, HDMA),
INT_ENTRY(6, HDMAEnded), INT_ENTRY(6, HDMAEnded),
INT_ENTRY(6, OpenBus1), INT_ENTRY(6, OpenBus1),
INT_ENTRY(6, OpenBus2) INT_ENTRY(6, OpenBus2),
INT_ENTRY(11, VRAMReadBuffer)
}; };
#undef STRUCT #undef STRUCT
@ -599,7 +602,8 @@ static FreezeData SnapTimings[] =
INT_ENTRY(6, IRQFlagChanging), INT_ENTRY(6, IRQFlagChanging),
INT_ENTRY(6, APUSpeedup), INT_ENTRY(6, APUSpeedup),
INT_ENTRY(7, IRQTriggerCycles), INT_ENTRY(7, IRQTriggerCycles),
INT_ENTRY(7, APUAllowTimeOverflow) INT_ENTRY(7, APUAllowTimeOverflow),
INT_ENTRY(11, NextIRQTimer)
}; };
#undef STRUCT #undef STRUCT
@ -1825,11 +1829,13 @@ int S9xUnfreezeFromStream (STREAM stream)
ICPU.ShiftedDB = Registers.DB << 16; ICPU.ShiftedDB = Registers.DB << 16;
S9xSetPCBase(Registers.PBPC); S9xSetPCBase(Registers.PBPC);
S9xUnpackStatus(); S9xUnpackStatus();
S9xUpdateIRQPositions(false); if(version < SNAPSHOT_VERSION_IRQ_2018)
S9xUpdateIRQPositions(false); // calculate the new trigger pos from saved PPU data
S9xFixCycles(); S9xFixCycles();
for (int d = 0; d < 8; d++) for (int d = 0; d < 8; d++)
DMA[d] = dma_snap.dma[d]; DMA[d] = dma_snap.dma[d];
// TODO: these should already be correct since they are stored in the snapshot
CPU.InDMA = CPU.InHDMA = FALSE; CPU.InDMA = CPU.InHDMA = FALSE;
CPU.InDMAorHDMA = CPU.InWRAMDMAorHDMA = FALSE; CPU.InDMAorHDMA = CPU.InWRAMDMAorHDMA = FALSE;
CPU.HDMARanInDMA = 0; CPU.HDMARanInDMA = 0;
@ -1840,8 +1846,17 @@ int S9xUnfreezeFromStream (STREAM stream)
IPPU.OBJChanged = TRUE; IPPU.OBJChanged = TRUE;
IPPU.RenderThisFrame = TRUE; IPPU.RenderThisFrame = TRUE;
uint8 hdma_byte = Memory.FillRAM[0x420c]; GFX.InterlaceFrame = Timings.InterlaceField;
S9xSetCPU(hdma_byte, 0x420c); GFX.DoInterlace = 0;
S9xGraphicsScreenResize();
if (Settings.FastSavestates == 0)
memset(GFX.Screen,0,GFX.Pitch * MAX_SNES_HEIGHT);
// TODO: this seems to be a relic from 1.43 changes, completely remove if no issues in the future
/*uint8 hdma_byte = Memory.FillRAM[0x420c];
S9xSetCPU(hdma_byte, 0x420c);*/
S9xControlPostLoadState(&ctl_snap); S9xControlPostLoadState(&ctl_snap);
@ -1935,12 +1950,6 @@ int S9xUnfreezeFromStream (STREAM stream)
delete ssi; delete ssi;
} }
else
{
// couldn't load graphics, so black out the screen instead
for (uint32 y = 0; y < (uint32) (IMAGE_HEIGHT); y++)
memset(GFX.Screen + y * GFX.RealPPL, 0, GFX.RealPPL * 2);
}
} }
if (local_cpu) delete [] local_cpu; if (local_cpu) delete [] local_cpu;

View File

@ -196,9 +196,10 @@
#include "snes9x.h" #include "snes9x.h"
#define SNAPSHOT_MAGIC "#!s9xsnp" #define SNAPSHOT_MAGIC "#!s9xsnp"
#define SNAPSHOT_VERSION_IRQ 7 #define SNAPSHOT_VERSION_IRQ 7
#define SNAPSHOT_VERSION_BAPU 8 #define SNAPSHOT_VERSION_BAPU 8
#define SNAPSHOT_VERSION 10 #define SNAPSHOT_VERSION_IRQ_2018 11 // irq changes were introduced earlier, since this we store NextIRQTimer directly
#define SNAPSHOT_VERSION 11
#define SUCCESS 1 #define SUCCESS 1
#define WRONG_FORMAT (-1) #define WRONG_FORMAT (-1)

View File

@ -194,7 +194,7 @@
#define _SNES9X_H_ #define _SNES9X_H_
#ifndef VERSION #ifndef VERSION
#define VERSION "1.56.2" #define VERSION "1.57"
#endif #endif
#include "port.h" #include "port.h"
@ -276,7 +276,7 @@
#define SNES_HDMA_START_HC 1106 // FIXME: not true #define SNES_HDMA_START_HC 1106 // FIXME: not true
#define SNES_HBLANK_END_HC 4 // H=1 #define SNES_HBLANK_END_HC 4 // H=1
#define SNES_HDMA_INIT_HC 20 // FIXME: not true #define SNES_HDMA_INIT_HC 20 // FIXME: not true
#define SNES_RENDER_START_HC (48 * ONE_DOT_CYCLE) // FIXME: Snes9x renders a line at a time. #define SNES_RENDER_START_HC (128 * ONE_DOT_CYCLE) // FIXME: Snes9x renders a line at a time.
#define SNES_TR_MASK (1 << 4) #define SNES_TR_MASK (1 << 4)
#define SNES_TL_MASK (1 << 5) #define SNES_TL_MASK (1 << 5)

View File

@ -17,13 +17,20 @@
(c) Copyright 2002 - 2010 Brad Jorsch (anomie@users.sourceforge.net), (c) Copyright 2002 - 2010 Brad Jorsch (anomie@users.sourceforge.net),
Nach (n-a-c-h@users.sourceforge.net), Nach (n-a-c-h@users.sourceforge.net),
zones (kasumitokoduck@yahoo.com)
(c) Copyright 2002 - 2011 zones (kasumitokoduck@yahoo.com)
(c) Copyright 2006 - 2007 nitsuja (c) Copyright 2006 - 2007 nitsuja
(c) Copyright 2009 - 2010 BearOso, (c) Copyright 2009 - 2018 BearOso,
OV2 OV2
(c) Copyright 2017 qwertymodo
(c) Copyright 2011 - 2017 Hans-Kristian Arntzen,
Daniel De Matteis
(Under no circumstances will commercial rights be given)
BS-X C emulator code BS-X C emulator code
(c) Copyright 2005 - 2006 Dreamer Nom, (c) Copyright 2005 - 2006 Dreamer Nom,
@ -117,6 +124,9 @@
Sound emulator code used in 1.52+ Sound emulator code used in 1.52+
(c) Copyright 2004 - 2007 Shay Green (gblargg@gmail.com) (c) Copyright 2004 - 2007 Shay Green (gblargg@gmail.com)
S-SMP emulator code used in 1.54+
(c) Copyright 2016 byuu
SH assembler code partly based on x86 assembler code SH assembler code partly based on x86 assembler code
(c) Copyright 2002 - 2004 Marcus Comstedt (marcus@mc.pp.se) (c) Copyright 2002 - 2004 Marcus Comstedt (marcus@mc.pp.se)
@ -130,7 +140,7 @@
(c) Copyright 2006 - 2007 Shay Green (c) Copyright 2006 - 2007 Shay Green
GTK+ GUI code GTK+ GUI code
(c) Copyright 2004 - 2010 BearOso (c) Copyright 2004 - 2018 BearOso
Win32 GUI code Win32 GUI code
(c) Copyright 2003 - 2006 blip, (c) Copyright 2003 - 2006 blip,
@ -138,11 +148,16 @@
Matthew Kendora, Matthew Kendora,
Nach, Nach,
nitsuja nitsuja
(c) Copyright 2009 - 2010 OV2 (c) Copyright 2009 - 2018 OV2
Mac OS GUI code Mac OS GUI code
(c) Copyright 1998 - 2001 John Stiles (c) Copyright 1998 - 2001 John Stiles
(c) Copyright 2001 - 2010 zones (c) Copyright 2001 - 2011 zones
Libretro port
(c) Copyright 2011 - 2017 Hans-Kristian Arntzen,
Daniel De Matteis
(Under no circumstances will commercial rights be given)
Specific ports contains the works of other authors. See headers in Specific ports contains the works of other authors. See headers in

View File

@ -17,13 +17,20 @@
(c) Copyright 2002 - 2010 Brad Jorsch (anomie@users.sourceforge.net), (c) Copyright 2002 - 2010 Brad Jorsch (anomie@users.sourceforge.net),
Nach (n-a-c-h@users.sourceforge.net), Nach (n-a-c-h@users.sourceforge.net),
zones (kasumitokoduck@yahoo.com)
(c) Copyright 2002 - 2011 zones (kasumitokoduck@yahoo.com)
(c) Copyright 2006 - 2007 nitsuja (c) Copyright 2006 - 2007 nitsuja
(c) Copyright 2009 - 2010 BearOso, (c) Copyright 2009 - 2018 BearOso,
OV2 OV2
(c) Copyright 2017 qwertymodo
(c) Copyright 2011 - 2017 Hans-Kristian Arntzen,
Daniel De Matteis
(Under no circumstances will commercial rights be given)
BS-X C emulator code BS-X C emulator code
(c) Copyright 2005 - 2006 Dreamer Nom, (c) Copyright 2005 - 2006 Dreamer Nom,
@ -117,6 +124,9 @@
Sound emulator code used in 1.52+ Sound emulator code used in 1.52+
(c) Copyright 2004 - 2007 Shay Green (gblargg@gmail.com) (c) Copyright 2004 - 2007 Shay Green (gblargg@gmail.com)
S-SMP emulator code used in 1.54+
(c) Copyright 2016 byuu
SH assembler code partly based on x86 assembler code SH assembler code partly based on x86 assembler code
(c) Copyright 2002 - 2004 Marcus Comstedt (marcus@mc.pp.se) (c) Copyright 2002 - 2004 Marcus Comstedt (marcus@mc.pp.se)
@ -130,7 +140,7 @@
(c) Copyright 2006 - 2007 Shay Green (c) Copyright 2006 - 2007 Shay Green
GTK+ GUI code GTK+ GUI code
(c) Copyright 2004 - 2010 BearOso (c) Copyright 2004 - 2018 BearOso
Win32 GUI code Win32 GUI code
(c) Copyright 2003 - 2006 blip, (c) Copyright 2003 - 2006 blip,
@ -138,11 +148,16 @@
Matthew Kendora, Matthew Kendora,
Nach, Nach,
nitsuja nitsuja
(c) Copyright 2009 - 2010 OV2 (c) Copyright 2009 - 2018 OV2
Mac OS GUI code Mac OS GUI code
(c) Copyright 1998 - 2001 John Stiles (c) Copyright 1998 - 2001 John Stiles
(c) Copyright 2001 - 2010 zones (c) Copyright 2001 - 2011 zones
Libretro port
(c) Copyright 2011 - 2017 Hans-Kristian Arntzen,
Daniel De Matteis
(Under no circumstances will commercial rights be given)
Specific ports contains the works of other authors. See headers in Specific ports contains the works of other authors. See headers in

View File

@ -498,7 +498,7 @@ void SPC7110Decomp::reset() {
} }
SPC7110Decomp::SPC7110Decomp() { SPC7110Decomp::SPC7110Decomp() {
decomp_buffer = new uint8_t[decomp_buffer_size]; decomp_buffer = new uint8[decomp_buffer_size];
reset(); reset();
//initialize reverse morton lookup tables //initialize reverse morton lookup tables

View File

@ -17,13 +17,20 @@
(c) Copyright 2002 - 2010 Brad Jorsch (anomie@users.sourceforge.net), (c) Copyright 2002 - 2010 Brad Jorsch (anomie@users.sourceforge.net),
Nach (n-a-c-h@users.sourceforge.net), Nach (n-a-c-h@users.sourceforge.net),
zones (kasumitokoduck@yahoo.com)
(c) Copyright 2002 - 2011 zones (kasumitokoduck@yahoo.com)
(c) Copyright 2006 - 2007 nitsuja (c) Copyright 2006 - 2007 nitsuja
(c) Copyright 2009 - 2010 BearOso, (c) Copyright 2009 - 2018 BearOso,
OV2 OV2
(c) Copyright 2017 qwertymodo
(c) Copyright 2011 - 2017 Hans-Kristian Arntzen,
Daniel De Matteis
(Under no circumstances will commercial rights be given)
BS-X C emulator code BS-X C emulator code
(c) Copyright 2005 - 2006 Dreamer Nom, (c) Copyright 2005 - 2006 Dreamer Nom,
@ -117,6 +124,9 @@
Sound emulator code used in 1.52+ Sound emulator code used in 1.52+
(c) Copyright 2004 - 2007 Shay Green (gblargg@gmail.com) (c) Copyright 2004 - 2007 Shay Green (gblargg@gmail.com)
S-SMP emulator code used in 1.54+
(c) Copyright 2016 byuu
SH assembler code partly based on x86 assembler code SH assembler code partly based on x86 assembler code
(c) Copyright 2002 - 2004 Marcus Comstedt (marcus@mc.pp.se) (c) Copyright 2002 - 2004 Marcus Comstedt (marcus@mc.pp.se)
@ -130,7 +140,7 @@
(c) Copyright 2006 - 2007 Shay Green (c) Copyright 2006 - 2007 Shay Green
GTK+ GUI code GTK+ GUI code
(c) Copyright 2004 - 2010 BearOso (c) Copyright 2004 - 2018 BearOso
Win32 GUI code Win32 GUI code
(c) Copyright 2003 - 2006 blip, (c) Copyright 2003 - 2006 blip,
@ -138,11 +148,16 @@
Matthew Kendora, Matthew Kendora,
Nach, Nach,
nitsuja nitsuja
(c) Copyright 2009 - 2010 OV2 (c) Copyright 2009 - 2018 OV2
Mac OS GUI code Mac OS GUI code
(c) Copyright 1998 - 2001 John Stiles (c) Copyright 1998 - 2001 John Stiles
(c) Copyright 2001 - 2010 zones (c) Copyright 2001 - 2011 zones
Libretro port
(c) Copyright 2011 - 2017 Hans-Kristian Arntzen,
Daniel De Matteis
(Under no circumstances will commercial rights be given)
Specific ports contains the works of other authors. See headers in Specific ports contains the works of other authors. See headers in

View File

@ -17,13 +17,20 @@
(c) Copyright 2002 - 2010 Brad Jorsch (anomie@users.sourceforge.net), (c) Copyright 2002 - 2010 Brad Jorsch (anomie@users.sourceforge.net),
Nach (n-a-c-h@users.sourceforge.net), Nach (n-a-c-h@users.sourceforge.net),
zones (kasumitokoduck@yahoo.com)
(c) Copyright 2002 - 2011 zones (kasumitokoduck@yahoo.com)
(c) Copyright 2006 - 2007 nitsuja (c) Copyright 2006 - 2007 nitsuja
(c) Copyright 2009 - 2010 BearOso, (c) Copyright 2009 - 2018 BearOso,
OV2 OV2
(c) Copyright 2017 qwertymodo
(c) Copyright 2011 - 2017 Hans-Kristian Arntzen,
Daniel De Matteis
(Under no circumstances will commercial rights be given)
BS-X C emulator code BS-X C emulator code
(c) Copyright 2005 - 2006 Dreamer Nom, (c) Copyright 2005 - 2006 Dreamer Nom,
@ -117,6 +124,9 @@
Sound emulator code used in 1.52+ Sound emulator code used in 1.52+
(c) Copyright 2004 - 2007 Shay Green (gblargg@gmail.com) (c) Copyright 2004 - 2007 Shay Green (gblargg@gmail.com)
S-SMP emulator code used in 1.54+
(c) Copyright 2016 byuu
SH assembler code partly based on x86 assembler code SH assembler code partly based on x86 assembler code
(c) Copyright 2002 - 2004 Marcus Comstedt (marcus@mc.pp.se) (c) Copyright 2002 - 2004 Marcus Comstedt (marcus@mc.pp.se)
@ -130,7 +140,7 @@
(c) Copyright 2006 - 2007 Shay Green (c) Copyright 2006 - 2007 Shay Green
GTK+ GUI code GTK+ GUI code
(c) Copyright 2004 - 2010 BearOso (c) Copyright 2004 - 2018 BearOso
Win32 GUI code Win32 GUI code
(c) Copyright 2003 - 2006 blip, (c) Copyright 2003 - 2006 blip,
@ -138,11 +148,16 @@
Matthew Kendora, Matthew Kendora,
Nach, Nach,
nitsuja nitsuja
(c) Copyright 2009 - 2010 OV2 (c) Copyright 2009 - 2018 OV2
Mac OS GUI code Mac OS GUI code
(c) Copyright 1998 - 2001 John Stiles (c) Copyright 1998 - 2001 John Stiles
(c) Copyright 2001 - 2010 zones (c) Copyright 2001 - 2011 zones
Libretro port
(c) Copyright 2011 - 2017 Hans-Kristian Arntzen,
Daniel De Matteis
(Under no circumstances will commercial rights be given)
Specific ports contains the works of other authors. See headers in Specific ports contains the works of other authors. See headers in

View File

@ -253,6 +253,24 @@ std::string Stream::getline (bool &eof)
return (ret); return (ret);
} }
size_t Stream::pos_from_origin_offset(uint8 origin, int32 offset)
{
size_t position = 0;
switch (origin)
{
case SEEK_SET:
position = offset;
break;
case SEEK_END:
position = size() + offset;
break;
case SEEK_CUR:
position = pos() + offset;
break;
}
return position;
}
// snes9x.h FSTREAM Stream // snes9x.h FSTREAM Stream
fStream::fStream (FSTREAM f) fStream::fStream (FSTREAM f)
@ -299,9 +317,9 @@ size_t fStream::size (void)
return sz; return sz;
} }
int fStream::revert (size_t from, size_t offset) int fStream::revert (uint8 origin, int32 offset)
{ {
return (REVERT_FSTREAM(fp, offset, from)); return (REVERT_FSTREAM(fp, offset, origin));
} }
void fStream::closeStream() void fStream::closeStream()
@ -428,9 +446,9 @@ size_t unzStream::size (void)
return info.uncompressed_size; return info.uncompressed_size;
} }
int unzStream::revert (size_t from, size_t offset) int unzStream::revert (uint8 origin, int32 offset)
{ {
size_t target_pos = from + offset; size_t target_pos = pos_from_origin_offset(origin, offset);
// new pos inside buffered data // new pos inside buffered data
if (target_pos >= buf_pos_in_unzipped && target_pos < buf_pos_in_unzipped + bytes_in_buf) if (target_pos >= buf_pos_in_unzipped && target_pos < buf_pos_in_unzipped + bytes_in_buf)
@ -547,9 +565,9 @@ size_t memStream::size (void)
return msize; return msize;
} }
int memStream::revert (size_t from, size_t offset) int memStream::revert (uint8 origin, int32 offset)
{ {
size_t pos = from + offset; size_t pos = pos_from_origin_offset(origin, offset);
if(pos > msize) if(pos > msize)
return -1; return -1;
@ -610,9 +628,10 @@ size_t nulStream::size (void)
return bytes_written; return bytes_written;
} }
int nulStream::revert (size_t from, size_t offset) int nulStream::revert (uint8 origin, int32 offset)
{ {
bytes_written = from + offset; size_t target_pos = pos_from_origin_offset(origin, offset);
bytes_written = target_pos;
return 0; return 0;
} }

View File

@ -208,8 +208,11 @@ class Stream
virtual size_t write (void *, size_t) = 0; virtual size_t write (void *, size_t) = 0;
virtual size_t pos (void) = 0; virtual size_t pos (void) = 0;
virtual size_t size (void) = 0; virtual size_t size (void) = 0;
virtual int revert (size_t from, size_t offset) = 0; virtual int revert (uint8 origin, int32 offset) = 0;
virtual void closeStream() = 0; virtual void closeStream() = 0;
protected:
size_t pos_from_origin_offset(uint8 origin, int32 offset);
}; };
class fStream : public Stream class fStream : public Stream
@ -223,7 +226,7 @@ class fStream : public Stream
virtual size_t write (void *, size_t); virtual size_t write (void *, size_t);
virtual size_t pos (void); virtual size_t pos (void);
virtual size_t size (void); virtual size_t size (void);
virtual int revert (size_t from, size_t offset); virtual int revert (uint8 origin, int32 offset);
virtual void closeStream(); virtual void closeStream();
private: private:
@ -250,7 +253,7 @@ class unzStream : public Stream
virtual size_t write (void *, size_t); virtual size_t write (void *, size_t);
virtual size_t pos (void); virtual size_t pos (void);
virtual size_t size (void); virtual size_t size (void);
virtual int revert (size_t from, size_t offset); virtual int revert (uint8 origin, int32 offset);
virtual void closeStream(); virtual void closeStream();
private: private:
@ -279,7 +282,7 @@ class memStream : public Stream
virtual size_t write (void *, size_t); virtual size_t write (void *, size_t);
virtual size_t pos (void); virtual size_t pos (void);
virtual size_t size (void); virtual size_t size (void);
virtual int revert (size_t from, size_t offset); virtual int revert (uint8 origin, int32 offset);
virtual void closeStream(); virtual void closeStream();
private: private:
@ -304,7 +307,7 @@ class nulStream : public Stream
virtual size_t write (void *, size_t); virtual size_t write (void *, size_t);
virtual size_t pos (void); virtual size_t pos (void);
virtual size_t size (void); virtual size_t size (void);
virtual int revert (size_t from, size_t offset); virtual int revert (uint8 origin, int32 offset);
virtual void closeStream(); virtual void closeStream();
private: private:

View File

@ -17,13 +17,20 @@
(c) Copyright 2002 - 2010 Brad Jorsch (anomie@users.sourceforge.net), (c) Copyright 2002 - 2010 Brad Jorsch (anomie@users.sourceforge.net),
Nach (n-a-c-h@users.sourceforge.net), Nach (n-a-c-h@users.sourceforge.net),
zones (kasumitokoduck@yahoo.com)
(c) Copyright 2002 - 2011 zones (kasumitokoduck@yahoo.com)
(c) Copyright 2006 - 2007 nitsuja (c) Copyright 2006 - 2007 nitsuja
(c) Copyright 2009 - 2010 BearOso, (c) Copyright 2009 - 2018 BearOso,
OV2 OV2
(c) Copyright 2017 qwertymodo
(c) Copyright 2011 - 2017 Hans-Kristian Arntzen,
Daniel De Matteis
(Under no circumstances will commercial rights be given)
BS-X C emulator code BS-X C emulator code
(c) Copyright 2005 - 2006 Dreamer Nom, (c) Copyright 2005 - 2006 Dreamer Nom,
@ -117,6 +124,9 @@
Sound emulator code used in 1.52+ Sound emulator code used in 1.52+
(c) Copyright 2004 - 2007 Shay Green (gblargg@gmail.com) (c) Copyright 2004 - 2007 Shay Green (gblargg@gmail.com)
S-SMP emulator code used in 1.54+
(c) Copyright 2016 byuu
SH assembler code partly based on x86 assembler code SH assembler code partly based on x86 assembler code
(c) Copyright 2002 - 2004 Marcus Comstedt (marcus@mc.pp.se) (c) Copyright 2002 - 2004 Marcus Comstedt (marcus@mc.pp.se)
@ -130,7 +140,7 @@
(c) Copyright 2006 - 2007 Shay Green (c) Copyright 2006 - 2007 Shay Green
GTK+ GUI code GTK+ GUI code
(c) Copyright 2004 - 2010 BearOso (c) Copyright 2004 - 2018 BearOso
Win32 GUI code Win32 GUI code
(c) Copyright 2003 - 2006 blip, (c) Copyright 2003 - 2006 blip,
@ -138,11 +148,16 @@
Matthew Kendora, Matthew Kendora,
Nach, Nach,
nitsuja nitsuja
(c) Copyright 2009 - 2010 OV2 (c) Copyright 2009 - 2018 OV2
Mac OS GUI code Mac OS GUI code
(c) Copyright 1998 - 2001 John Stiles (c) Copyright 1998 - 2001 John Stiles
(c) Copyright 2001 - 2010 zones (c) Copyright 2001 - 2011 zones
Libretro port
(c) Copyright 2011 - 2017 Hans-Kristian Arntzen,
Daniel De Matteis
(Under no circumstances will commercial rights be given)
Specific ports contains the works of other authors. See headers in Specific ports contains the works of other authors. See headers in
@ -474,7 +489,6 @@ static uint8 ConvertTile4h_even (uint8 *pCache, uint32 TileAddr, uint32 Tile)
#undef DOBIT #undef DOBIT
// First-level include: Get all the renderers. // First-level include: Get all the renderers.
#include "tile.cpp" #include "tile.cpp"
// Functions to select which converter and renderer to use. // Functions to select which converter and renderer to use.
@ -697,13 +711,11 @@ void S9xSelectTileConverter (int depth, bool8 hires, bool8 sub, bool8 mosaic)
} }
#define IS_BLANK_TILE() \ #define IS_BLANK_TILE() \
(BG.Buffered[TileNumber] == BLANK_TILE) ( ( (Tile & H_FLIP) ? BG.BufferedFlip[TileNumber] : BG.Buffered[TileNumber]) == BLANK_TILE)
#define SELECT_PALETTE() \ #define SELECT_PALETTE() \
if (BG.DirectColourMode) \ if (BG.DirectColourMode) \
{ \ { \
if (IPPU.DirectColourMapsNeedRebuild) \
S9xBuildDirectColourMaps(); \
GFX.RealScreenColors = DirectColourMaps[(Tile >> 10) & 7]; \ GFX.RealScreenColors = DirectColourMaps[(Tile >> 10) & 7]; \
} \ } \
else \ else \
@ -749,6 +761,7 @@ void S9xSelectTileConverter (int depth, bool8 hires, bool8 sub, bool8 mosaic)
if (!(Tile & (V_FLIP | H_FLIP))) \ if (!(Tile & (V_FLIP | H_FLIP))) \
{ \ { \
bp = pCache + BPSTART; \ bp = pCache + BPSTART; \
OFFSET_IN_LINE; \
for (l = LineCount; l > 0; l--, bp += 8 * PITCH, Offset += GFX.PPL) \ for (l = LineCount; l > 0; l--, bp += 8 * PITCH, Offset += GFX.PPL) \
{ \ { \
DRAW_PIXEL(0, Pix = bp[0]); \ DRAW_PIXEL(0, Pix = bp[0]); \
@ -765,6 +778,7 @@ void S9xSelectTileConverter (int depth, bool8 hires, bool8 sub, bool8 mosaic)
if (!(Tile & V_FLIP)) \ if (!(Tile & V_FLIP)) \
{ \ { \
bp = pCache + BPSTART; \ bp = pCache + BPSTART; \
OFFSET_IN_LINE; \
for (l = LineCount; l > 0; l--, bp += 8 * PITCH, Offset += GFX.PPL) \ for (l = LineCount; l > 0; l--, bp += 8 * PITCH, Offset += GFX.PPL) \
{ \ { \
DRAW_PIXEL(0, Pix = bp[7]); \ DRAW_PIXEL(0, Pix = bp[7]); \
@ -781,6 +795,7 @@ void S9xSelectTileConverter (int depth, bool8 hires, bool8 sub, bool8 mosaic)
if (!(Tile & H_FLIP)) \ if (!(Tile & H_FLIP)) \
{ \ { \
bp = pCache + 56 - BPSTART; \ bp = pCache + 56 - BPSTART; \
OFFSET_IN_LINE; \
for (l = LineCount; l > 0; l--, bp -= 8 * PITCH, Offset += GFX.PPL) \ for (l = LineCount; l > 0; l--, bp -= 8 * PITCH, Offset += GFX.PPL) \
{ \ { \
DRAW_PIXEL(0, Pix = bp[0]); \ DRAW_PIXEL(0, Pix = bp[0]); \
@ -796,6 +811,7 @@ void S9xSelectTileConverter (int depth, bool8 hires, bool8 sub, bool8 mosaic)
else \ else \
{ \ { \
bp = pCache + 56 - BPSTART; \ bp = pCache + 56 - BPSTART; \
OFFSET_IN_LINE; \
for (l = LineCount; l > 0; l--, bp -= 8 * PITCH, Offset += GFX.PPL) \ for (l = LineCount; l > 0; l--, bp -= 8 * PITCH, Offset += GFX.PPL) \
{ \ { \
DRAW_PIXEL(0, Pix = bp[7]); \ DRAW_PIXEL(0, Pix = bp[7]); \
@ -840,18 +856,19 @@ void S9xSelectTileConverter (int depth, bool8 hires, bool8 sub, bool8 mosaic)
if (!(Tile & (V_FLIP | H_FLIP))) \ if (!(Tile & (V_FLIP | H_FLIP))) \
{ \ { \
bp = pCache + BPSTART; \ bp = pCache + BPSTART; \
OFFSET_IN_LINE; \
for (l = LineCount; l > 0; l--, bp += 8 * PITCH, Offset += GFX.PPL) \ for (l = LineCount; l > 0; l--, bp += 8 * PITCH, Offset += GFX.PPL) \
{ \ { \
w = Width; \ w = Width; \
switch (StartPixel) \ switch (StartPixel) \
{ \ { \
case 0: DRAW_PIXEL(0, Pix = bp[0]); if (!--w) break; \ case 0: DRAW_PIXEL(0, Pix = bp[0]); if (!--w) break; /* Fall through */ \
case 1: DRAW_PIXEL(1, Pix = bp[1]); if (!--w) break; \ case 1: DRAW_PIXEL(1, Pix = bp[1]); if (!--w) break; /* Fall through */ \
case 2: DRAW_PIXEL(2, Pix = bp[2]); if (!--w) break; \ case 2: DRAW_PIXEL(2, Pix = bp[2]); if (!--w) break; /* Fall through */ \
case 3: DRAW_PIXEL(3, Pix = bp[3]); if (!--w) break; \ case 3: DRAW_PIXEL(3, Pix = bp[3]); if (!--w) break; /* Fall through */ \
case 4: DRAW_PIXEL(4, Pix = bp[4]); if (!--w) break; \ case 4: DRAW_PIXEL(4, Pix = bp[4]); if (!--w) break; /* Fall through */ \
case 5: DRAW_PIXEL(5, Pix = bp[5]); if (!--w) break; \ case 5: DRAW_PIXEL(5, Pix = bp[5]); if (!--w) break; /* Fall through */ \
case 6: DRAW_PIXEL(6, Pix = bp[6]); if (!--w) break; \ case 6: DRAW_PIXEL(6, Pix = bp[6]); if (!--w) break; /* Fall through */ \
case 7: DRAW_PIXEL(7, Pix = bp[7]); break; \ case 7: DRAW_PIXEL(7, Pix = bp[7]); break; \
} \ } \
} \ } \
@ -860,18 +877,19 @@ void S9xSelectTileConverter (int depth, bool8 hires, bool8 sub, bool8 mosaic)
if (!(Tile & V_FLIP)) \ if (!(Tile & V_FLIP)) \
{ \ { \
bp = pCache + BPSTART; \ bp = pCache + BPSTART; \
OFFSET_IN_LINE; \
for (l = LineCount; l > 0; l--, bp += 8 * PITCH, Offset += GFX.PPL) \ for (l = LineCount; l > 0; l--, bp += 8 * PITCH, Offset += GFX.PPL) \
{ \ { \
w = Width; \ w = Width; \
switch (StartPixel) \ switch (StartPixel) \
{ \ { \
case 0: DRAW_PIXEL(0, Pix = bp[7]); if (!--w) break; \ case 0: DRAW_PIXEL(0, Pix = bp[7]); if (!--w) break; /* Fall through */ \
case 1: DRAW_PIXEL(1, Pix = bp[6]); if (!--w) break; \ case 1: DRAW_PIXEL(1, Pix = bp[6]); if (!--w) break; /* Fall through */ \
case 2: DRAW_PIXEL(2, Pix = bp[5]); if (!--w) break; \ case 2: DRAW_PIXEL(2, Pix = bp[5]); if (!--w) break; /* Fall through */ \
case 3: DRAW_PIXEL(3, Pix = bp[4]); if (!--w) break; \ case 3: DRAW_PIXEL(3, Pix = bp[4]); if (!--w) break; /* Fall through */ \
case 4: DRAW_PIXEL(4, Pix = bp[3]); if (!--w) break; \ case 4: DRAW_PIXEL(4, Pix = bp[3]); if (!--w) break; /* Fall through */ \
case 5: DRAW_PIXEL(5, Pix = bp[2]); if (!--w) break; \ case 5: DRAW_PIXEL(5, Pix = bp[2]); if (!--w) break; /* Fall through */ \
case 6: DRAW_PIXEL(6, Pix = bp[1]); if (!--w) break; \ case 6: DRAW_PIXEL(6, Pix = bp[1]); if (!--w) break; /* Fall through */ \
case 7: DRAW_PIXEL(7, Pix = bp[0]); break; \ case 7: DRAW_PIXEL(7, Pix = bp[0]); break; \
} \ } \
} \ } \
@ -880,18 +898,19 @@ void S9xSelectTileConverter (int depth, bool8 hires, bool8 sub, bool8 mosaic)
if (!(Tile & H_FLIP)) \ if (!(Tile & H_FLIP)) \
{ \ { \
bp = pCache + 56 - BPSTART; \ bp = pCache + 56 - BPSTART; \
OFFSET_IN_LINE; \
for (l = LineCount; l > 0; l--, bp -= 8 * PITCH, Offset += GFX.PPL) \ for (l = LineCount; l > 0; l--, bp -= 8 * PITCH, Offset += GFX.PPL) \
{ \ { \
w = Width; \ w = Width; \
switch (StartPixel) \ switch (StartPixel) \
{ \ { \
case 0: DRAW_PIXEL(0, Pix = bp[0]); if (!--w) break; \ case 0: DRAW_PIXEL(0, Pix = bp[0]); if (!--w) break; /* Fall through */ \
case 1: DRAW_PIXEL(1, Pix = bp[1]); if (!--w) break; \ case 1: DRAW_PIXEL(1, Pix = bp[1]); if (!--w) break; /* Fall through */ \
case 2: DRAW_PIXEL(2, Pix = bp[2]); if (!--w) break; \ case 2: DRAW_PIXEL(2, Pix = bp[2]); if (!--w) break; /* Fall through */ \
case 3: DRAW_PIXEL(3, Pix = bp[3]); if (!--w) break; \ case 3: DRAW_PIXEL(3, Pix = bp[3]); if (!--w) break; /* Fall through */ \
case 4: DRAW_PIXEL(4, Pix = bp[4]); if (!--w) break; \ case 4: DRAW_PIXEL(4, Pix = bp[4]); if (!--w) break; /* Fall through */ \
case 5: DRAW_PIXEL(5, Pix = bp[5]); if (!--w) break; \ case 5: DRAW_PIXEL(5, Pix = bp[5]); if (!--w) break; /* Fall through */ \
case 6: DRAW_PIXEL(6, Pix = bp[6]); if (!--w) break; \ case 6: DRAW_PIXEL(6, Pix = bp[6]); if (!--w) break; /* Fall through */ \
case 7: DRAW_PIXEL(7, Pix = bp[7]); break; \ case 7: DRAW_PIXEL(7, Pix = bp[7]); break; \
} \ } \
} \ } \
@ -899,18 +918,19 @@ void S9xSelectTileConverter (int depth, bool8 hires, bool8 sub, bool8 mosaic)
else \ else \
{ \ { \
bp = pCache + 56 - BPSTART; \ bp = pCache + 56 - BPSTART; \
OFFSET_IN_LINE; \
for (l = LineCount; l > 0; l--, bp -= 8 * PITCH, Offset += GFX.PPL) \ for (l = LineCount; l > 0; l--, bp -= 8 * PITCH, Offset += GFX.PPL) \
{ \ { \
w = Width; \ w = Width; \
switch (StartPixel) \ switch (StartPixel) \
{ \ { \
case 0: DRAW_PIXEL(0, Pix = bp[7]); if (!--w) break; \ case 0: DRAW_PIXEL(0, Pix = bp[7]); if (!--w) break; /* Fall through */ \
case 1: DRAW_PIXEL(1, Pix = bp[6]); if (!--w) break; \ case 1: DRAW_PIXEL(1, Pix = bp[6]); if (!--w) break; /* Fall through */ \
case 2: DRAW_PIXEL(2, Pix = bp[5]); if (!--w) break; \ case 2: DRAW_PIXEL(2, Pix = bp[5]); if (!--w) break; /* Fall through */ \
case 3: DRAW_PIXEL(3, Pix = bp[4]); if (!--w) break; \ case 3: DRAW_PIXEL(3, Pix = bp[4]); if (!--w) break; /* Fall through */ \
case 4: DRAW_PIXEL(4, Pix = bp[3]); if (!--w) break; \ case 4: DRAW_PIXEL(4, Pix = bp[3]); if (!--w) break; /* Fall through */ \
case 5: DRAW_PIXEL(5, Pix = bp[2]); if (!--w) break; \ case 5: DRAW_PIXEL(5, Pix = bp[2]); if (!--w) break; /* Fall through */ \
case 6: DRAW_PIXEL(6, Pix = bp[1]); if (!--w) break; \ case 6: DRAW_PIXEL(6, Pix = bp[1]); if (!--w) break; /* Fall through */ \
case 7: DRAW_PIXEL(7, Pix = bp[0]); break; \ case 7: DRAW_PIXEL(7, Pix = bp[0]); break; \
} \ } \
} \ } \
@ -955,6 +975,7 @@ void S9xSelectTileConverter (int depth, bool8 hires, bool8 sub, bool8 mosaic)
\ \
if (Pix) \ if (Pix) \
{ \ { \
OFFSET_IN_LINE; \
for (l = LineCount; l > 0; l--, Offset += GFX.PPL) \ for (l = LineCount; l > 0; l--, Offset += GFX.PPL) \
{ \ { \
for (w = Width - 1; w >= 0; w--) \ for (w = Width - 1; w >= 0; w--) \
@ -991,6 +1012,7 @@ void S9xSelectTileConverter (int depth, bool8 hires, bool8 sub, bool8 mosaic)
GFX.RealScreenColors = IPPU.ScreenColors; \ GFX.RealScreenColors = IPPU.ScreenColors; \
GFX.ScreenColors = GFX.ClipColors ? BlackColourMap : GFX.RealScreenColors; \ GFX.ScreenColors = GFX.ClipColors ? BlackColourMap : GFX.RealScreenColors; \
\ \
OFFSET_IN_LINE; \
for (l = GFX.StartY; l <= GFX.EndY; l++, Offset += GFX.PPL) \ for (l = GFX.StartY; l <= GFX.EndY; l++, Offset += GFX.PPL) \
{ \ { \
for (x = Left; x < Right; x++) \ for (x = Left; x < Right; x++) \
@ -1036,8 +1058,6 @@ extern struct SLineMatrixData LineMatrixData[240];
\ \
if (DCMODE) \ if (DCMODE) \
{ \ { \
if (IPPU.DirectColourMapsNeedRebuild) \
S9xBuildDirectColourMaps(); \
GFX.RealScreenColors = DirectColourMaps[0]; \ GFX.RealScreenColors = DirectColourMaps[0]; \
} \ } \
else \ else \
@ -1051,6 +1071,7 @@ extern struct SLineMatrixData LineMatrixData[240];
uint32 Offset = GFX.StartY * GFX.PPL; \ uint32 Offset = GFX.StartY * GFX.PPL; \
struct SLineMatrixData *l = &LineMatrixData[GFX.StartY]; \ struct SLineMatrixData *l = &LineMatrixData[GFX.StartY]; \
\ \
OFFSET_IN_LINE; \
for (uint32 Line = GFX.StartY; Line <= GFX.EndY; Line++, Offset += GFX.PPL, l++) \ for (uint32 Line = GFX.StartY; Line <= GFX.EndY; Line++, Offset += GFX.PPL, l++) \
{ \ { \
int yy, starty; \ int yy, starty; \
@ -1133,8 +1154,6 @@ extern struct SLineMatrixData LineMatrixData[240];
\ \
if (DCMODE) \ if (DCMODE) \
{ \ { \
if (IPPU.DirectColourMapsNeedRebuild) \
S9xBuildDirectColourMaps(); \
GFX.RealScreenColors = DirectColourMaps[0]; \ GFX.RealScreenColors = DirectColourMaps[0]; \
} \ } \
else \ else \
@ -1166,6 +1185,7 @@ extern struct SLineMatrixData LineMatrixData[240];
uint32 Offset = StartY * GFX.PPL; \ uint32 Offset = StartY * GFX.PPL; \
struct SLineMatrixData *l = &LineMatrixData[StartY]; \ struct SLineMatrixData *l = &LineMatrixData[StartY]; \
\ \
OFFSET_IN_LINE; \
for (uint32 Line = StartY; Line <= GFX.EndY; Line += VMosaic, Offset += VMosaic * GFX.PPL, l += VMosaic) \ for (uint32 Line = StartY; Line <= GFX.EndY; Line += VMosaic, Offset += VMosaic * GFX.PPL, l += VMosaic) \
{ \ { \
if (Line + VMosaic > GFX.EndY) \ if (Line + VMosaic > GFX.EndY) \
@ -1341,6 +1361,7 @@ extern struct SLineMatrixData LineMatrixData[240];
// The 1x1 pixel plotter, for speedhacking modes. // The 1x1 pixel plotter, for speedhacking modes.
#define OFFSET_IN_LINE
#define DRAW_PIXEL(N, M) \ #define DRAW_PIXEL(N, M) \
if (Z1 > GFX.DB[Offset + N] && (M)) \ if (Z1 > GFX.DB[Offset + N] && (M)) \
{ \ { \
@ -1375,6 +1396,7 @@ extern struct SLineMatrixData LineMatrixData[240];
#undef NAME2 #undef NAME2
#undef DRAW_PIXEL #undef DRAW_PIXEL
#undef OFFSET_IN_LINE
// Hires pixel plotter, this combines the main and subscreen pixels as appropriate to render hires or pseudo-hires images. // Hires pixel plotter, this combines the main and subscreen pixels as appropriate to render hires or pseudo-hires images.
// Use it only on the main screen, subscreen should use Normal2x1 instead. // Use it only on the main screen, subscreen should use Normal2x1 instead.
@ -1388,11 +1410,16 @@ extern struct SLineMatrixData LineMatrixData[240];
#define DRAW_PIXEL_H2x1(N, M) \ #define DRAW_PIXEL_H2x1(N, M) \
if (Z1 > GFX.DB[Offset + 2 * N] && (M)) \ if (Z1 > GFX.DB[Offset + 2 * N] && (M)) \
{ \ { \
GFX.S[Offset + 2 * N] = MATH((GFX.ClipColors ? 0 : GFX.SubScreen[Offset + 2 * N]), GFX.RealScreenColors[Pix], GFX.SubZBuffer[Offset + 2 * N]); \
GFX.S[Offset + 2 * N + 1] = MATH(GFX.ScreenColors[Pix], GFX.SubScreen[Offset + 2 * N], GFX.SubZBuffer[Offset + 2 * N]); \ GFX.S[Offset + 2 * N + 1] = MATH(GFX.ScreenColors[Pix], GFX.SubScreen[Offset + 2 * N], GFX.SubZBuffer[Offset + 2 * N]); \
if ((OffsetInLine + 2 * N ) != (SNES_WIDTH - 1) << 1) \
GFX.S[Offset + 2 * N + 2] = MATH((GFX.ClipColors ? 0 : GFX.SubScreen[Offset + 2 * N + 2]), GFX.RealScreenColors[Pix], GFX.SubZBuffer[Offset + 2 * N]); \
if ((OffsetInLine + 2 * N) == 0 || (OffsetInLine + 2 * N) == GFX.RealPPL) \
GFX.S[Offset + 2 * N] = MATH((GFX.ClipColors ? 0 : GFX.SubScreen[Offset + 2 * N]), GFX.RealScreenColors[Pix], GFX.SubZBuffer[Offset + 2 * N]); \
GFX.DB[Offset + 2 * N] = GFX.DB[Offset + 2 * N + 1] = Z2; \ GFX.DB[Offset + 2 * N] = GFX.DB[Offset + 2 * N + 1] = Z2; \
} }
#define OFFSET_IN_LINE \
uint32 OffsetInLine = Offset % GFX.RealPPL;
#define DRAW_PIXEL(N, M) DRAW_PIXEL_H2x1(N, M) #define DRAW_PIXEL(N, M) DRAW_PIXEL_H2x1(N, M)
#define NAME2 Hires #define NAME2 Hires
@ -1402,6 +1429,7 @@ extern struct SLineMatrixData LineMatrixData[240];
#undef NAME2 #undef NAME2
#undef DRAW_PIXEL #undef DRAW_PIXEL
#undef OFFSET_IN_LINE
// Interlace: Only draw every other line, so we'll redefine BPSTART and PITCH to do so. // Interlace: Only draw every other line, so we'll redefine BPSTART and PITCH to do so.
// Otherwise, it's the same as Normal2x1/Hires2x1. // Otherwise, it's the same as Normal2x1/Hires2x1.
@ -1414,6 +1442,7 @@ extern struct SLineMatrixData LineMatrixData[240];
#ifndef NO_INTERLACE #ifndef NO_INTERLACE
#define OFFSET_IN_LINE
#define DRAW_PIXEL(N, M) DRAW_PIXEL_N2x1(N, M) #define DRAW_PIXEL(N, M) DRAW_PIXEL_N2x1(N, M)
#define NAME2 Interlace #define NAME2 Interlace
@ -1423,7 +1452,10 @@ extern struct SLineMatrixData LineMatrixData[240];
#undef NAME2 #undef NAME2
#undef DRAW_PIXEL #undef DRAW_PIXEL
#undef OFFSET_IN_LINE
#define OFFSET_IN_LINE \
uint32 OffsetInLine = Offset % GFX.RealPPL;
#define DRAW_PIXEL(N, M) DRAW_PIXEL_H2x1(N, M) #define DRAW_PIXEL(N, M) DRAW_PIXEL_H2x1(N, M)
#define NAME2 HiresInterlace #define NAME2 HiresInterlace
@ -1433,6 +1465,7 @@ extern struct SLineMatrixData LineMatrixData[240];
#undef NAME2 #undef NAME2
#undef DRAW_PIXEL #undef DRAW_PIXEL
#undef OFFSET_IN_LINE
#endif #endif

View File

@ -17,13 +17,20 @@
(c) Copyright 2002 - 2010 Brad Jorsch (anomie@users.sourceforge.net), (c) Copyright 2002 - 2010 Brad Jorsch (anomie@users.sourceforge.net),
Nach (n-a-c-h@users.sourceforge.net), Nach (n-a-c-h@users.sourceforge.net),
zones (kasumitokoduck@yahoo.com)
(c) Copyright 2002 - 2011 zones (kasumitokoduck@yahoo.com)
(c) Copyright 2006 - 2007 nitsuja (c) Copyright 2006 - 2007 nitsuja
(c) Copyright 2009 - 2010 BearOso, (c) Copyright 2009 - 2018 BearOso,
OV2 OV2
(c) Copyright 2017 qwertymodo
(c) Copyright 2011 - 2017 Hans-Kristian Arntzen,
Daniel De Matteis
(Under no circumstances will commercial rights be given)
BS-X C emulator code BS-X C emulator code
(c) Copyright 2005 - 2006 Dreamer Nom, (c) Copyright 2005 - 2006 Dreamer Nom,
@ -117,6 +124,9 @@
Sound emulator code used in 1.52+ Sound emulator code used in 1.52+
(c) Copyright 2004 - 2007 Shay Green (gblargg@gmail.com) (c) Copyright 2004 - 2007 Shay Green (gblargg@gmail.com)
S-SMP emulator code used in 1.54+
(c) Copyright 2016 byuu
SH assembler code partly based on x86 assembler code SH assembler code partly based on x86 assembler code
(c) Copyright 2002 - 2004 Marcus Comstedt (marcus@mc.pp.se) (c) Copyright 2002 - 2004 Marcus Comstedt (marcus@mc.pp.se)
@ -130,7 +140,7 @@
(c) Copyright 2006 - 2007 Shay Green (c) Copyright 2006 - 2007 Shay Green
GTK+ GUI code GTK+ GUI code
(c) Copyright 2004 - 2010 BearOso (c) Copyright 2004 - 2018 BearOso
Win32 GUI code Win32 GUI code
(c) Copyright 2003 - 2006 blip, (c) Copyright 2003 - 2006 blip,
@ -138,11 +148,16 @@
Matthew Kendora, Matthew Kendora,
Nach, Nach,
nitsuja nitsuja
(c) Copyright 2009 - 2010 OV2 (c) Copyright 2009 - 2018 OV2
Mac OS GUI code Mac OS GUI code
(c) Copyright 1998 - 2001 John Stiles (c) Copyright 1998 - 2001 John Stiles
(c) Copyright 2001 - 2010 zones (c) Copyright 2001 - 2011 zones
Libretro port
(c) Copyright 2011 - 2017 Hans-Kristian Arntzen,
Daniel De Matteis
(Under no circumstances will commercial rights be given)
Specific ports contains the works of other authors. See headers in Specific ports contains the works of other authors. See headers in