mirror of
https://github.com/dborth/snes9xgx.git
synced 2024-12-28 12:11:51 +01:00
upgrade to snes9x 1.51
This commit is contained in:
parent
59b357a855
commit
785190f0b6
@ -31,6 +31,7 @@ extern int maxfiles;
|
||||
u64 dvddir = 0;
|
||||
u64 dvdrootdir = 0;
|
||||
int dvddirlength = 0;
|
||||
bool isWii = false;
|
||||
|
||||
#ifdef HW_DOL
|
||||
/** DVD I/O Address base **/
|
||||
@ -59,7 +60,7 @@ dvd_read (void *dst, unsigned int len, u64 offset)
|
||||
|
||||
DCInvalidateRange ((void *) buffer, len);
|
||||
|
||||
if(offset < 0x57057C00 || (isWii == true && offset < 0x118244F00LL)) // don't read past the end of the DVD
|
||||
if(offset < 0x57057C00 || (isWii && offset < 0x118244F00LL)) // don't read past the end of the DVD
|
||||
{
|
||||
|
||||
#ifdef HW_DOL
|
||||
@ -542,5 +543,18 @@ int dvd_driveid()
|
||||
|
||||
return (int)inquiry[2];
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
void SetDVDDriveType()
|
||||
{
|
||||
#ifdef HW_RVL
|
||||
isWii = true;
|
||||
#else
|
||||
int drvid = dvd_driveid ();
|
||||
if ( drvid == 4 || drvid == 6 || drvid == 8 )
|
||||
isWii = false;
|
||||
else
|
||||
isWii = true;
|
||||
#endif
|
||||
}
|
||||
|
@ -16,5 +16,6 @@ int LoadDVDFile (unsigned char *buffer);
|
||||
bool TestDVD();
|
||||
int dvd_read (void *dst, unsigned int len, u64 offset);
|
||||
bool SwitchDVDFolder(char dir[]);
|
||||
void SetDVDDriveType();
|
||||
|
||||
#endif
|
||||
|
@ -402,6 +402,9 @@ void CheatMenu()
|
||||
if ( (gc_sx < -70) || (wm_sx < -70) || (wp & WPAD_BUTTON_HOME) || (wp & WPAD_CLASSIC_BUTTON_HOME) )
|
||||
break;
|
||||
|
||||
if ( (p & PAD_BUTTON_B) || (wp & (WPAD_BUTTON_B | WPAD_CLASSIC_BUTTON_B)) )
|
||||
break;
|
||||
|
||||
/*** Check buttons, perform actions ***/
|
||||
if ( (p & PAD_BUTTON_A) || selectit || (wp & (WPAD_BUTTON_A | WPAD_CLASSIC_BUTTON_A)) )
|
||||
{
|
||||
|
@ -472,7 +472,7 @@ DrawMenu (char items[][50], char *title, int maxitems, int selected, int fontsiz
|
||||
int n = 1;
|
||||
int line_height;
|
||||
|
||||
ypos = 65;
|
||||
ypos = 45;
|
||||
|
||||
if (screenheight == 480)
|
||||
ypos += 52;
|
||||
@ -581,7 +581,7 @@ RunMenu (char items[][50], int maxitems, char *title, int fontsize, int x)
|
||||
wm_ay = WPAD_StickY (0,0);
|
||||
wp = WPAD_ButtonsDown (0);
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
VIDEO_WaitVSync(); // slow things down a bit so we don't overread the pads
|
||||
|
||||
|
@ -17,10 +17,7 @@
|
||||
#include "snes9xGX.h"
|
||||
#include "smbop.h"
|
||||
|
||||
START_EXTERN_C
|
||||
struct SGCSettings GCSettings;
|
||||
bool8 isWii;
|
||||
END_EXTERN_C
|
||||
|
||||
void
|
||||
DefaultSettings ()
|
||||
@ -63,25 +60,24 @@ DefaultSettings ()
|
||||
|
||||
/****************** SNES9x Settings ***********************/
|
||||
|
||||
/*** Default ALL to false ***/
|
||||
// Default ALL to false
|
||||
memset (&Settings, 0, sizeof (Settings));
|
||||
|
||||
/*** General ***/
|
||||
|
||||
// General
|
||||
|
||||
Settings.MouseMaster = false;
|
||||
Settings.SuperScopeMaster = false;
|
||||
Settings.MultiPlayer5Master = false;
|
||||
Settings.JustifierMaster = false;
|
||||
Settings.ShutdownMaster = false;
|
||||
Settings.CyclesPercentage = 100; // snes9x 1.50 and earlier
|
||||
//Settings.CyclesPercentage = 100; // snes9x 1.50 and earlier
|
||||
Settings.ApplyCheats = true;
|
||||
|
||||
/* Eke-Eke: specific to snes9x 1.51 */
|
||||
// Settings.BlockInvalidVRAMAccess = true;
|
||||
// Settings.HDMATimingHack = 100;
|
||||
// Specific to snes9x 1.51
|
||||
Settings.BlockInvalidVRAMAccess = true;
|
||||
Settings.HDMATimingHack = 100;
|
||||
|
||||
/*** Sound defaults. On GC this is 32Khz/16bit/Stereo/InterpolatedSound ***/
|
||||
// Sound defaults. On GC this is 32Khz/16bit/Stereo/InterpolatedSound
|
||||
Settings.APUEnabled = true;
|
||||
Settings.NextAPUEnabled = true;
|
||||
Settings.SoundPlaybackRate = 32000;
|
||||
@ -92,19 +88,19 @@ DefaultSettings ()
|
||||
Settings.InterpolatedSound = true;
|
||||
Settings.ReverseStereo = false;
|
||||
|
||||
/*** Graphics ***/
|
||||
// Graphics
|
||||
Settings.Transparency = true;
|
||||
Settings.SupportHiRes = true;
|
||||
Settings.SkipFrames = 10;
|
||||
Settings.TurboSkipFrames = 19;
|
||||
Settings.DisplayFrameRate = false;
|
||||
// Settings.AutoDisplayMessages = 1; /*** eke-eke snes9x 1.51 ***/
|
||||
Settings.AutoDisplayMessages = 1; // SNES9x 1.51
|
||||
|
||||
/* Eke-Eke: frame timings in 50hz and 60hz cpu mode */
|
||||
// Frame timings in 50hz and 60hz cpu mode
|
||||
Settings.FrameTimePAL = 20000;
|
||||
Settings.FrameTimeNTSC = 16667;
|
||||
|
||||
/*** SDD1 - Star Ocean Returns -;) ***/
|
||||
// SDD1 - Star Ocean Returns
|
||||
Settings.SDD1Pack = true;
|
||||
|
||||
Settings.ForceNTSC = 0;
|
||||
|
@ -94,7 +94,11 @@ ConnectShare (bool silent)
|
||||
strlen(GCSettings.smbpwd) == 0 ||
|
||||
strlen(GCSettings.smbshare) == 0 ||
|
||||
strlen(GCSettings.smbip) == 0)
|
||||
{
|
||||
if(!silent)
|
||||
WaitPrompt((char*) "Invalid network settings. Check SNES9xGX.xml.");
|
||||
return false;
|
||||
}
|
||||
|
||||
if(!networkInit)
|
||||
networkInit = InitializeNetwork(silent);
|
||||
|
@ -290,7 +290,7 @@ emulate ()
|
||||
NGCFreezeGame ( GCSettings.SaveMethod, SILENT );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// GUI Stuff
|
||||
/*
|
||||
gui_alloc();
|
||||
@ -404,15 +404,8 @@ main ()
|
||||
DVD_Init ();
|
||||
#endif
|
||||
|
||||
#ifdef FORCE_WII
|
||||
isWii = TRUE;
|
||||
#else
|
||||
int drvid = dvd_driveid ();
|
||||
if ( drvid == 4 || drvid == 6 || drvid == 8 )
|
||||
isWii = FALSE;
|
||||
else
|
||||
isWii = TRUE;
|
||||
#endif
|
||||
// Check if DVD drive belongs to a Wii
|
||||
SetDVDDriveType();
|
||||
|
||||
// Load preferences
|
||||
if(!LoadPrefs())
|
||||
|
@ -58,11 +58,6 @@ struct SGCSettings{
|
||||
int widescreen; // 0 - 4:3 aspect, 1 - 16:9 aspect
|
||||
};
|
||||
|
||||
START_EXTERN_C
|
||||
|
||||
extern struct SGCSettings GCSettings;
|
||||
extern bool8 isWii;
|
||||
|
||||
END_EXTERN_C
|
||||
|
||||
#endif
|
||||
|
@ -1,7 +1,7 @@
|
||||
/**********************************************************************************
|
||||
Snes9x - Portable Super Nintendo Entertainment System (TM) emulator.
|
||||
|
||||
(c) Copyright 1996 - 2002 Gary Henderson (gary.henderson@ntlworld.com) and
|
||||
(c) Copyright 1996 - 2002 Gary Henderson (gary.henderson@ntlworld.com),
|
||||
Jerremy Koot (jkoot@snes9x.com)
|
||||
|
||||
(c) Copyright 2002 - 2004 Matthew Kendora
|
||||
@ -12,12 +12,16 @@
|
||||
|
||||
(c) Copyright 2001 - 2006 John Weidman (jweidman@slip.net)
|
||||
|
||||
(c) Copyright 2002 - 2006 Brad Jorsch (anomie@users.sourceforge.net),
|
||||
funkyass (funkyass@spam.shaw.ca),
|
||||
Kris Bleakley (codeviolation@hotmail.com),
|
||||
Nach (n-a-c-h@users.sourceforge.net), and
|
||||
(c) Copyright 2002 - 2006 funkyass (funkyass@spam.shaw.ca),
|
||||
Kris Bleakley (codeviolation@hotmail.com)
|
||||
|
||||
(c) Copyright 2002 - 2007 Brad Jorsch (anomie@users.sourceforge.net),
|
||||
Nach (n-a-c-h@users.sourceforge.net),
|
||||
zones (kasumitokoduck@yahoo.com)
|
||||
|
||||
(c) Copyright 2006 - 2007 nitsuja
|
||||
|
||||
|
||||
BS-X C emulator code
|
||||
(c) Copyright 2005 - 2006 Dreamer Nom,
|
||||
zones
|
||||
@ -110,17 +114,30 @@
|
||||
2xSaI filter
|
||||
(c) Copyright 1999 - 2001 Derek Liauw Kie Fa
|
||||
|
||||
HQ2x filter
|
||||
HQ2x, HQ3x, HQ4x filters
|
||||
(c) Copyright 2003 Maxim Stepin (maxim@hiend3d.com)
|
||||
|
||||
Win32 GUI code
|
||||
(c) Copyright 2003 - 2006 blip,
|
||||
funkyass,
|
||||
Matthew Kendora,
|
||||
Nach,
|
||||
nitsuja
|
||||
|
||||
Mac OS GUI code
|
||||
(c) Copyright 1998 - 2001 John Stiles
|
||||
(c) Copyright 2001 - 2007 zones
|
||||
|
||||
|
||||
Specific ports contains the works of other authors. See headers in
|
||||
individual files.
|
||||
|
||||
|
||||
Snes9x homepage: http://www.snes9x.com
|
||||
|
||||
Permission to use, copy, modify and/or distribute Snes9x in both binary
|
||||
and source form, for non-commercial purposes, is hereby granted without
|
||||
fee, providing that this license information and copyright notice appear
|
||||
and source form, for non-commercial purposes, is hereby granted without
|
||||
fee, providing that this license information and copyright notice appear
|
||||
with all copies and any derived work.
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
@ -142,6 +159,8 @@
|
||||
**********************************************************************************/
|
||||
|
||||
|
||||
|
||||
|
||||
#ifndef _3D_H_
|
||||
#define _3D_H_
|
||||
|
||||
@ -167,6 +186,7 @@ typedef struct
|
||||
GLint texture_size;
|
||||
uint32 num_textures; // 1 if max_texture_size == 256, 2 otherwise
|
||||
GLuint textures [2];
|
||||
bool8 initialized;
|
||||
} OpenGLData;
|
||||
|
||||
extern OpenGLData OpenGL;
|
||||
|
@ -1,7 +1,7 @@
|
||||
/**********************************************************************************
|
||||
Snes9x - Portable Super Nintendo Entertainment System (TM) emulator.
|
||||
|
||||
(c) Copyright 1996 - 2002 Gary Henderson (gary.henderson@ntlworld.com) and
|
||||
(c) Copyright 1996 - 2002 Gary Henderson (gary.henderson@ntlworld.com),
|
||||
Jerremy Koot (jkoot@snes9x.com)
|
||||
|
||||
(c) Copyright 2002 - 2004 Matthew Kendora
|
||||
@ -12,12 +12,16 @@
|
||||
|
||||
(c) Copyright 2001 - 2006 John Weidman (jweidman@slip.net)
|
||||
|
||||
(c) Copyright 2002 - 2006 Brad Jorsch (anomie@users.sourceforge.net),
|
||||
funkyass (funkyass@spam.shaw.ca),
|
||||
Kris Bleakley (codeviolation@hotmail.com),
|
||||
Nach (n-a-c-h@users.sourceforge.net), and
|
||||
(c) Copyright 2002 - 2006 funkyass (funkyass@spam.shaw.ca),
|
||||
Kris Bleakley (codeviolation@hotmail.com)
|
||||
|
||||
(c) Copyright 2002 - 2007 Brad Jorsch (anomie@users.sourceforge.net),
|
||||
Nach (n-a-c-h@users.sourceforge.net),
|
||||
zones (kasumitokoduck@yahoo.com)
|
||||
|
||||
(c) Copyright 2006 - 2007 nitsuja
|
||||
|
||||
|
||||
BS-X C emulator code
|
||||
(c) Copyright 2005 - 2006 Dreamer Nom,
|
||||
zones
|
||||
@ -110,17 +114,30 @@
|
||||
2xSaI filter
|
||||
(c) Copyright 1999 - 2001 Derek Liauw Kie Fa
|
||||
|
||||
HQ2x filter
|
||||
HQ2x, HQ3x, HQ4x filters
|
||||
(c) Copyright 2003 Maxim Stepin (maxim@hiend3d.com)
|
||||
|
||||
Win32 GUI code
|
||||
(c) Copyright 2003 - 2006 blip,
|
||||
funkyass,
|
||||
Matthew Kendora,
|
||||
Nach,
|
||||
nitsuja
|
||||
|
||||
Mac OS GUI code
|
||||
(c) Copyright 1998 - 2001 John Stiles
|
||||
(c) Copyright 2001 - 2007 zones
|
||||
|
||||
|
||||
Specific ports contains the works of other authors. See headers in
|
||||
individual files.
|
||||
|
||||
|
||||
Snes9x homepage: http://www.snes9x.com
|
||||
|
||||
Permission to use, copy, modify and/or distribute Snes9x in both binary
|
||||
and source form, for non-commercial purposes, is hereby granted without
|
||||
fee, providing that this license information and copyright notice appear
|
||||
and source form, for non-commercial purposes, is hereby granted without
|
||||
fee, providing that this license information and copyright notice appear
|
||||
with all copies and any derived work.
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
@ -142,6 +159,8 @@
|
||||
**********************************************************************************/
|
||||
|
||||
|
||||
|
||||
|
||||
#ifndef _65c816_h_
|
||||
#define _65c816_h_
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
/**********************************************************************************
|
||||
Snes9x - Portable Super Nintendo Entertainment System (TM) emulator.
|
||||
|
||||
(c) Copyright 1996 - 2002 Gary Henderson (gary.henderson@ntlworld.com) and
|
||||
(c) Copyright 1996 - 2002 Gary Henderson (gary.henderson@ntlworld.com),
|
||||
Jerremy Koot (jkoot@snes9x.com)
|
||||
|
||||
(c) Copyright 2002 - 2004 Matthew Kendora
|
||||
@ -12,12 +12,16 @@
|
||||
|
||||
(c) Copyright 2001 - 2006 John Weidman (jweidman@slip.net)
|
||||
|
||||
(c) Copyright 2002 - 2006 Brad Jorsch (anomie@users.sourceforge.net),
|
||||
funkyass (funkyass@spam.shaw.ca),
|
||||
Kris Bleakley (codeviolation@hotmail.com),
|
||||
Nach (n-a-c-h@users.sourceforge.net), and
|
||||
(c) Copyright 2002 - 2006 funkyass (funkyass@spam.shaw.ca),
|
||||
Kris Bleakley (codeviolation@hotmail.com)
|
||||
|
||||
(c) Copyright 2002 - 2007 Brad Jorsch (anomie@users.sourceforge.net),
|
||||
Nach (n-a-c-h@users.sourceforge.net),
|
||||
zones (kasumitokoduck@yahoo.com)
|
||||
|
||||
(c) Copyright 2006 - 2007 nitsuja
|
||||
|
||||
|
||||
BS-X C emulator code
|
||||
(c) Copyright 2005 - 2006 Dreamer Nom,
|
||||
zones
|
||||
@ -110,17 +114,30 @@
|
||||
2xSaI filter
|
||||
(c) Copyright 1999 - 2001 Derek Liauw Kie Fa
|
||||
|
||||
HQ2x filter
|
||||
HQ2x, HQ3x, HQ4x filters
|
||||
(c) Copyright 2003 Maxim Stepin (maxim@hiend3d.com)
|
||||
|
||||
Win32 GUI code
|
||||
(c) Copyright 2003 - 2006 blip,
|
||||
funkyass,
|
||||
Matthew Kendora,
|
||||
Nach,
|
||||
nitsuja
|
||||
|
||||
Mac OS GUI code
|
||||
(c) Copyright 1998 - 2001 John Stiles
|
||||
(c) Copyright 2001 - 2007 zones
|
||||
|
||||
|
||||
Specific ports contains the works of other authors. See headers in
|
||||
individual files.
|
||||
|
||||
|
||||
Snes9x homepage: http://www.snes9x.com
|
||||
|
||||
Permission to use, copy, modify and/or distribute Snes9x in both binary
|
||||
and source form, for non-commercial purposes, is hereby granted without
|
||||
fee, providing that this license information and copyright notice appear
|
||||
and source form, for non-commercial purposes, is hereby granted without
|
||||
fee, providing that this license information and copyright notice appear
|
||||
with all copies and any derived work.
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
@ -142,6 +159,8 @@
|
||||
**********************************************************************************/
|
||||
|
||||
|
||||
|
||||
|
||||
#ifdef __DJGPP
|
||||
#include <allegro.h>
|
||||
#undef TRUE
|
||||
@ -163,7 +182,7 @@ extern int32 env_counter_table[32];
|
||||
|
||||
int spc_is_dumping=0;
|
||||
int spc_is_dumping_temp;
|
||||
uint8 spc_dump_dsp[0x100];
|
||||
uint8 spc_dump_dsp[0x100];
|
||||
|
||||
#ifdef DEBUGGER
|
||||
void S9xTraceSoundDSP (const char *s, int i1 = 0, int i2 = 0, int i3 = 0,
|
||||
@ -173,19 +192,15 @@ void S9xTraceSoundDSP (const char *s, int i1 = 0, int i2 = 0, int i3 = 0,
|
||||
bool8 S9xInitAPU ()
|
||||
{
|
||||
IAPU.RAM = (uint8 *) malloc (0x10000);
|
||||
IAPU.ShadowRAM = (uint8 *) malloc (0x10000);
|
||||
IAPU.CachedSamples = (uint8 *) malloc (0x40000);
|
||||
|
||||
if (!IAPU.RAM || !IAPU.ShadowRAM || !IAPU.CachedSamples)
|
||||
|
||||
if (!IAPU.RAM)
|
||||
{
|
||||
S9xDeinitAPU ();
|
||||
return (FALSE);
|
||||
}
|
||||
|
||||
memset(IAPU.RAM, 0, 0x10000);
|
||||
memset(IAPU.ShadowRAM, 0, 0x10000);
|
||||
memset(IAPU.CachedSamples, 0, 0x40000);
|
||||
|
||||
|
||||
return (TRUE);
|
||||
}
|
||||
|
||||
@ -196,27 +211,19 @@ void S9xDeinitAPU ()
|
||||
free ((char *) IAPU.RAM);
|
||||
IAPU.RAM = NULL;
|
||||
}
|
||||
if (IAPU.ShadowRAM)
|
||||
{
|
||||
free ((char *) IAPU.ShadowRAM);
|
||||
IAPU.ShadowRAM = NULL;
|
||||
}
|
||||
if (IAPU.CachedSamples)
|
||||
{
|
||||
free ((char *) IAPU.CachedSamples);
|
||||
IAPU.CachedSamples = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
EXTERN_C uint8 APUROM [64];
|
||||
|
||||
void S9xResetAPU ()
|
||||
{
|
||||
|
||||
int i;
|
||||
|
||||
Settings.APUEnabled = Settings.NextAPUEnabled;
|
||||
|
||||
if(Settings.APUEnabled)
|
||||
APU.Flags &= ~HALTED_FLAG;
|
||||
|
||||
ZeroMemory(spc_dump_dsp, 0x100);
|
||||
ZeroMemory(IAPU.RAM, 0x100);
|
||||
memset(IAPU.RAM+0x20, 0xFF, 0x20);
|
||||
@ -229,19 +236,17 @@ void S9xResetAPU ()
|
||||
memcpy(IAPU.RAM+(i<<8), IAPU.RAM, 0x100);
|
||||
}
|
||||
|
||||
memcpy (IAPU.ShadowRAM, IAPU.RAM, 0x10000);
|
||||
|
||||
ZeroMemory (IAPU.CachedSamples, 0x40000);
|
||||
ZeroMemory (APU.OutPorts, 4);
|
||||
IAPU.DirectPage = IAPU.RAM;
|
||||
memmove (APU.ExtraRAM, &IAPU.RAM [0xffc0], sizeof (APUROM));
|
||||
memmove (&IAPU.RAM [0xffc0], APUROM, sizeof (APUROM));
|
||||
memmove (APU.ExtraRAM, APUROM, sizeof (APUROM));
|
||||
IAPU.PC = IAPU.RAM + IAPU.RAM [0xfffe] + (IAPU.RAM [0xffff] << 8);
|
||||
APU.Cycles = 0;
|
||||
APU.OldCycles = -99999999; // For shapshot compatibility
|
||||
APURegisters.YA.W = 0;
|
||||
APURegisters.X = 0;
|
||||
APURegisters.S = 0xff;
|
||||
APURegisters.P = 0;
|
||||
APURegisters.S = 0xef;
|
||||
APURegisters.P = 0x02;
|
||||
S9xAPUUnpackStatus ();
|
||||
APURegisters.PC = 0;
|
||||
IAPU.APUExecuting = Settings.APUEnabled;
|
||||
@ -254,7 +259,7 @@ void S9xResetAPU ()
|
||||
IAPU.APUTimerCounter = 0;
|
||||
APU.ShowROM = TRUE;
|
||||
IAPU.RAM [0xf1] = 0x80;
|
||||
|
||||
|
||||
for (i = 0; i < 3; i++)
|
||||
{
|
||||
APU.TimerEnabled [i] = FALSE;
|
||||
@ -264,18 +269,18 @@ void S9xResetAPU ()
|
||||
}
|
||||
for (int j = 0; j < 0x80; j++)
|
||||
APU.DSP [j] = 0;
|
||||
|
||||
|
||||
IAPU.TwoCycles = IAPU.OneCycle * 2;
|
||||
|
||||
|
||||
for (i = 0; i < 256; i++)
|
||||
S9xAPUCycles [i] = S9xAPUCycleLengths [i] * IAPU.OneCycle;
|
||||
|
||||
|
||||
APU.DSP [APU_ENDX] = 0;
|
||||
APU.DSP [APU_KOFF] = 0;
|
||||
APU.DSP [APU_KON] = 0;
|
||||
APU.DSP [APU_FLG] = APU_MUTE | APU_ECHO_DISABLED;
|
||||
APU.KeyedChannels = 0;
|
||||
|
||||
|
||||
S9xResetSound (TRUE);
|
||||
S9xSetEchoEnable (0);
|
||||
}
|
||||
@ -318,7 +323,7 @@ void S9xSetAPUDSP (uint8 byte)
|
||||
}
|
||||
else
|
||||
S9xSetSoundMute (FALSE);
|
||||
|
||||
|
||||
SoundData.noise_rate = env_counter_table[byte & 0x1f];
|
||||
}
|
||||
break;
|
||||
@ -370,7 +375,7 @@ void S9xSetAPUDSP (uint8 byte)
|
||||
{
|
||||
#ifdef DEBUGGER
|
||||
if (Settings.TraceSoundDSP)
|
||||
S9xTraceSoundDSP ("[%d] Master volume left:%d\n",
|
||||
S9xTraceSoundDSP ("[%d] Master volume left:%d\n",
|
||||
ICPU.Scanline, (signed char) byte);
|
||||
#endif
|
||||
S9xSetMasterVolume ((signed char) byte,
|
||||
@ -420,7 +425,7 @@ void S9xSetAPUDSP (uint8 byte)
|
||||
#endif
|
||||
byte = 0;
|
||||
break;
|
||||
|
||||
|
||||
case APU_KOFF:
|
||||
// if (byte)
|
||||
{
|
||||
@ -434,10 +439,10 @@ void S9xSetAPUDSP (uint8 byte)
|
||||
if ((byte & mask) != 0)
|
||||
{
|
||||
#ifdef DEBUGGER
|
||||
|
||||
|
||||
if (Settings.TraceSoundDSP)
|
||||
S9xTraceSoundDSP ("%d,", c);
|
||||
#endif
|
||||
#endif
|
||||
if (APU.KeyedChannels & mask)
|
||||
{
|
||||
{
|
||||
@ -484,7 +489,7 @@ void S9xSetAPUDSP (uint8 byte)
|
||||
{
|
||||
uint8 mask = 1;
|
||||
#ifdef DEBUGGER
|
||||
|
||||
|
||||
if (Settings.TraceSoundDSP)
|
||||
S9xTraceSoundDSP ("[%d] Key on:", ICPU.Scanline);
|
||||
#endif
|
||||
@ -495,7 +500,7 @@ void S9xSetAPUDSP (uint8 byte)
|
||||
#ifdef DEBUGGER
|
||||
if (Settings.TraceSoundDSP)
|
||||
S9xTraceSoundDSP ("%d,", c);
|
||||
#endif
|
||||
#endif
|
||||
// Pac-In-Time requires that channels can be key-on
|
||||
// regardeless of their current state.
|
||||
if((APU.DSP [APU_KOFF] & mask) ==0)
|
||||
@ -517,7 +522,7 @@ void S9xSetAPUDSP (uint8 byte)
|
||||
}
|
||||
spc_is_dumping_temp = byte;
|
||||
return;
|
||||
|
||||
|
||||
case APU_VOL_LEFT + 0x00:
|
||||
case APU_VOL_LEFT + 0x10:
|
||||
case APU_VOL_LEFT + 0x20:
|
||||
@ -531,7 +536,7 @@ void S9xSetAPUDSP (uint8 byte)
|
||||
{
|
||||
#ifdef DEBUGGER
|
||||
if (Settings.TraceSoundDSP)
|
||||
S9xTraceSoundDSP ("[%d] %d volume left: %d\n",
|
||||
S9xTraceSoundDSP ("[%d] %d volume left: %d\n",
|
||||
ICPU.Scanline, reg>>4, (signed char) byte);
|
||||
#endif
|
||||
S9xSetSoundVolume (reg >> 4, (signed char) byte,
|
||||
@ -551,14 +556,14 @@ void S9xSetAPUDSP (uint8 byte)
|
||||
{
|
||||
#ifdef DEBUGGER
|
||||
if (Settings.TraceSoundDSP)
|
||||
S9xTraceSoundDSP ("[%d] %d volume right: %d\n",
|
||||
S9xTraceSoundDSP ("[%d] %d volume right: %d\n",
|
||||
ICPU.Scanline, reg >>4, (signed char) byte);
|
||||
#endif
|
||||
S9xSetSoundVolume (reg >> 4, (signed char) APU.DSP [reg - 1],
|
||||
(signed char) byte);
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
case APU_P_LOW + 0x00:
|
||||
case APU_P_LOW + 0x10:
|
||||
case APU_P_LOW + 0x20:
|
||||
@ -574,7 +579,7 @@ void S9xSetAPUDSP (uint8 byte)
|
||||
#endif
|
||||
S9xSetSoundHertz (reg >> 4, ((byte + (APU.DSP [reg + 1] << 8)) & FREQUENCY_MASK) * 8);
|
||||
break;
|
||||
|
||||
|
||||
case APU_P_HIGH + 0x00:
|
||||
case APU_P_HIGH + 0x10:
|
||||
case APU_P_HIGH + 0x20:
|
||||
@ -588,10 +593,10 @@ void S9xSetAPUDSP (uint8 byte)
|
||||
S9xTraceSoundDSP ("[%d] %d freq high: %d\n",
|
||||
ICPU.Scanline, reg>>4, byte);
|
||||
#endif
|
||||
S9xSetSoundHertz (reg >> 4,
|
||||
S9xSetSoundHertz (reg >> 4,
|
||||
(((byte << 8) + APU.DSP [reg - 1]) & FREQUENCY_MASK) * 8);
|
||||
break;
|
||||
|
||||
|
||||
case APU_SRCN + 0x00:
|
||||
case APU_SRCN + 0x10:
|
||||
case APU_SRCN + 0x20:
|
||||
@ -606,7 +611,7 @@ void S9xSetAPUDSP (uint8 byte)
|
||||
ICPU.Scanline, reg>>4, byte);
|
||||
#endif
|
||||
break;
|
||||
|
||||
|
||||
case APU_ADSR1 + 0x00:
|
||||
case APU_ADSR1 + 0x10:
|
||||
case APU_ADSR1 + 0x20:
|
||||
@ -623,12 +628,12 @@ void S9xSetAPUDSP (uint8 byte)
|
||||
ICPU.Scanline, reg>>4, byte);
|
||||
#endif
|
||||
{
|
||||
S9xFixEnvelope (reg >> 4, APU.DSP [reg + 2], byte,
|
||||
S9xFixEnvelope (reg >> 4, APU.DSP [reg + 2], byte,
|
||||
APU.DSP [reg + 1]);
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
case APU_ADSR2 + 0x00:
|
||||
case APU_ADSR2 + 0x10:
|
||||
case APU_ADSR2 + 0x20:
|
||||
@ -641,7 +646,7 @@ void S9xSetAPUDSP (uint8 byte)
|
||||
{
|
||||
#ifdef DEBUGGER
|
||||
if (Settings.TraceSoundDSP)
|
||||
S9xTraceSoundDSP ("[%d] %d adsr2: %02x\n",
|
||||
S9xTraceSoundDSP ("[%d] %d adsr2: %02x\n",
|
||||
ICPU.Scanline, reg>>4, byte);
|
||||
#endif
|
||||
{
|
||||
@ -650,7 +655,7 @@ void S9xSetAPUDSP (uint8 byte)
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
case APU_GAIN + 0x00:
|
||||
case APU_GAIN + 0x10:
|
||||
case APU_GAIN + 0x20:
|
||||
@ -672,7 +677,7 @@ void S9xSetAPUDSP (uint8 byte)
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
case APU_ENVX + 0x00:
|
||||
case APU_ENVX + 0x10:
|
||||
case APU_ENVX + 0x20:
|
||||
@ -682,7 +687,7 @@ void S9xSetAPUDSP (uint8 byte)
|
||||
case APU_ENVX + 0x60:
|
||||
case APU_ENVX + 0x70:
|
||||
break;
|
||||
|
||||
|
||||
case APU_OUTX + 0x00:
|
||||
case APU_OUTX + 0x10:
|
||||
case APU_OUTX + 0x20:
|
||||
@ -692,7 +697,7 @@ void S9xSetAPUDSP (uint8 byte)
|
||||
case APU_OUTX + 0x60:
|
||||
case APU_OUTX + 0x70:
|
||||
break;
|
||||
|
||||
|
||||
case APU_DIR:
|
||||
#ifdef DEBUGGER
|
||||
if (Settings.TraceSoundDSP)
|
||||
@ -700,7 +705,7 @@ void S9xSetAPUDSP (uint8 byte)
|
||||
ICPU.Scanline, byte);
|
||||
#endif
|
||||
break;
|
||||
|
||||
|
||||
case APU_PMON:
|
||||
if (byte != APU.DSP [APU_PMON])
|
||||
{
|
||||
@ -730,7 +735,7 @@ void S9xSetAPUDSP (uint8 byte)
|
||||
S9xSetFrequencyModulationEnable (byte);
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
case APU_EON:
|
||||
if (byte != APU.DSP [APU_EON])
|
||||
{
|
||||
@ -760,18 +765,18 @@ void S9xSetAPUDSP (uint8 byte)
|
||||
S9xSetEchoEnable (byte);
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
case APU_EFB:
|
||||
S9xSetEchoFeedback ((signed char) byte);
|
||||
break;
|
||||
|
||||
|
||||
case APU_ESA:
|
||||
break;
|
||||
|
||||
|
||||
case APU_EDL:
|
||||
S9xSetEchoDelay (byte & 0xf);
|
||||
break;
|
||||
|
||||
|
||||
case APU_C0:
|
||||
case APU_C1:
|
||||
case APU_C2:
|
||||
@ -787,10 +792,10 @@ void S9xSetAPUDSP (uint8 byte)
|
||||
//printf ("Write %02x to unknown APU register %02x\n", byte, reg);
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
KeyOnPrev|=KeyOn;
|
||||
KeyOn=0;
|
||||
|
||||
|
||||
if (reg < 0x80)
|
||||
APU.DSP [reg] = byte;
|
||||
}
|
||||
@ -856,13 +861,13 @@ void S9xSetAPUControl (uint8 byte)
|
||||
APU.TimerEnabled [0] = byte & 1;
|
||||
APU.TimerEnabled [1] = (byte & 2) >> 1;
|
||||
APU.TimerEnabled [2] = (byte & 4) >> 2;
|
||||
|
||||
|
||||
if (byte & 0x10)
|
||||
IAPU.RAM [0xF4] = IAPU.RAM [0xF5] = 0;
|
||||
|
||||
|
||||
if (byte & 0x20)
|
||||
IAPU.RAM [0xF6] = IAPU.RAM [0xF7] = 0;
|
||||
|
||||
|
||||
if (byte & 0x80)
|
||||
{
|
||||
if (!APU.ShowROM)
|
||||
@ -885,7 +890,7 @@ void S9xSetAPUControl (uint8 byte)
|
||||
void S9xSetAPUTimer (uint16 Address, uint8 byte)
|
||||
{
|
||||
IAPU.RAM [Address] = byte;
|
||||
|
||||
|
||||
switch (Address)
|
||||
{
|
||||
case 0xfa:
|
||||
@ -906,12 +911,21 @@ void S9xSetAPUTimer (uint16 Address, uint8 byte)
|
||||
}
|
||||
}
|
||||
|
||||
void S9xUpdateAPUTimer (void)
|
||||
void S9xAPUExecute (void)
|
||||
{
|
||||
while ((CPU.Cycles << SNES_APUTIMER_ACCURACY) >= IAPU.NextAPUTimerPos)
|
||||
while ((CPU.Cycles << SNES_APU_ACCURACY) >= IAPU.NextAPUTimerPos)
|
||||
{
|
||||
IAPU.NextAPUTimerPos += SNES_APUTIMER2_CYCLE_SHIFT;
|
||||
|
||||
// catch up the APU timers
|
||||
if (IAPU.APUExecuting)
|
||||
{
|
||||
while (APU.Cycles < IAPU.NextAPUTimerPos)
|
||||
APU_EXECUTE1();
|
||||
}
|
||||
else
|
||||
APU.Cycles = IAPU.NextAPUTimerPos;
|
||||
|
||||
IAPU.NextAPUTimerPos += SNES_APUTIMER2_CYCLE_SCALED;
|
||||
|
||||
if (APU.TimerEnabled [2])
|
||||
{
|
||||
APU.Timer [2] ++;
|
||||
@ -919,17 +933,17 @@ void S9xUpdateAPUTimer (void)
|
||||
{
|
||||
IAPU.RAM [0xff] = (IAPU.RAM [0xff] + 1) & 0xf;
|
||||
APU.Timer [2] = 0;
|
||||
#ifdef SPC700_SHUTDOWN
|
||||
#ifdef SPC700_SHUTDOWN
|
||||
IAPU.WaitCounter++;
|
||||
IAPU.APUExecuting = TRUE;
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
if (++IAPU.APUTimerCounter == 8)
|
||||
{
|
||||
IAPU.APUTimerCounter = 0;
|
||||
|
||||
|
||||
if (APU.TimerEnabled [0])
|
||||
{
|
||||
APU.Timer [0]++;
|
||||
@ -937,10 +951,10 @@ void S9xUpdateAPUTimer (void)
|
||||
{
|
||||
IAPU.RAM [0xfd] = (IAPU.RAM [0xfd] + 1) & 0xf;
|
||||
APU.Timer [0] = 0;
|
||||
#ifdef SPC700_SHUTDOWN
|
||||
#ifdef SPC700_SHUTDOWN
|
||||
IAPU.WaitCounter++;
|
||||
IAPU.APUExecuting = TRUE;
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
@ -951,14 +965,23 @@ void S9xUpdateAPUTimer (void)
|
||||
{
|
||||
IAPU.RAM [0xfe] = (IAPU.RAM [0xfe] + 1) & 0xf;
|
||||
APU.Timer [1] = 0;
|
||||
#ifdef SPC700_SHUTDOWN
|
||||
#ifdef SPC700_SHUTDOWN
|
||||
IAPU.WaitCounter++;
|
||||
IAPU.APUExecuting = TRUE;
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// catch up the current cycles
|
||||
if (IAPU.APUExecuting)
|
||||
{
|
||||
while (APU.Cycles < (CPU.Cycles << SNES_APU_ACCURACY))
|
||||
APU_EXECUTE1();
|
||||
}
|
||||
else
|
||||
APU.Cycles = (CPU.Cycles << SNES_APU_ACCURACY);
|
||||
}
|
||||
|
||||
uint8 S9xGetAPUDSP ()
|
||||
@ -981,10 +1004,18 @@ uint8 S9xGetAPUDSP ()
|
||||
case APU_OUTX + 0x50:
|
||||
case APU_OUTX + 0x60:
|
||||
case APU_OUTX + 0x70:
|
||||
if(Settings.FakeMuteFix)
|
||||
{
|
||||
// hack that is off by default: fixes Terranigma desync
|
||||
return (0);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (SoundData.channels [reg >> 4].state == SOUND_SILENT)
|
||||
return (0);
|
||||
return (int8) (SoundData.channels [reg >> 4].out_sample >> 8);
|
||||
|
||||
}
|
||||
|
||||
case APU_ENVX + 0x00:
|
||||
case APU_ENVX + 0x10:
|
||||
case APU_ENVX + 0x20:
|
||||
@ -994,7 +1025,7 @@ uint8 S9xGetAPUDSP ()
|
||||
case APU_ENVX + 0x60:
|
||||
case APU_ENVX + 0x70:
|
||||
return (S9xGetEnvelopeHeight (reg >> 4));
|
||||
|
||||
|
||||
case APU_ENDX:
|
||||
// To fix speech in Magical Drop 2 6/11/00
|
||||
// APU.DSP [APU_ENDX] = 0;
|
||||
@ -1003,6 +1034,6 @@ uint8 S9xGetAPUDSP ()
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
return (byte);
|
||||
}
|
||||
|
@ -1,7 +1,7 @@
|
||||
/**********************************************************************************
|
||||
Snes9x - Portable Super Nintendo Entertainment System (TM) emulator.
|
||||
|
||||
(c) Copyright 1996 - 2002 Gary Henderson (gary.henderson@ntlworld.com) and
|
||||
(c) Copyright 1996 - 2002 Gary Henderson (gary.henderson@ntlworld.com),
|
||||
Jerremy Koot (jkoot@snes9x.com)
|
||||
|
||||
(c) Copyright 2002 - 2004 Matthew Kendora
|
||||
@ -12,12 +12,16 @@
|
||||
|
||||
(c) Copyright 2001 - 2006 John Weidman (jweidman@slip.net)
|
||||
|
||||
(c) Copyright 2002 - 2006 Brad Jorsch (anomie@users.sourceforge.net),
|
||||
funkyass (funkyass@spam.shaw.ca),
|
||||
Kris Bleakley (codeviolation@hotmail.com),
|
||||
Nach (n-a-c-h@users.sourceforge.net), and
|
||||
(c) Copyright 2002 - 2006 funkyass (funkyass@spam.shaw.ca),
|
||||
Kris Bleakley (codeviolation@hotmail.com)
|
||||
|
||||
(c) Copyright 2002 - 2007 Brad Jorsch (anomie@users.sourceforge.net),
|
||||
Nach (n-a-c-h@users.sourceforge.net),
|
||||
zones (kasumitokoduck@yahoo.com)
|
||||
|
||||
(c) Copyright 2006 - 2007 nitsuja
|
||||
|
||||
|
||||
BS-X C emulator code
|
||||
(c) Copyright 2005 - 2006 Dreamer Nom,
|
||||
zones
|
||||
@ -110,17 +114,30 @@
|
||||
2xSaI filter
|
||||
(c) Copyright 1999 - 2001 Derek Liauw Kie Fa
|
||||
|
||||
HQ2x filter
|
||||
HQ2x, HQ3x, HQ4x filters
|
||||
(c) Copyright 2003 Maxim Stepin (maxim@hiend3d.com)
|
||||
|
||||
Win32 GUI code
|
||||
(c) Copyright 2003 - 2006 blip,
|
||||
funkyass,
|
||||
Matthew Kendora,
|
||||
Nach,
|
||||
nitsuja
|
||||
|
||||
Mac OS GUI code
|
||||
(c) Copyright 1998 - 2001 John Stiles
|
||||
(c) Copyright 2001 - 2007 zones
|
||||
|
||||
|
||||
Specific ports contains the works of other authors. See headers in
|
||||
individual files.
|
||||
|
||||
|
||||
Snes9x homepage: http://www.snes9x.com
|
||||
|
||||
Permission to use, copy, modify and/or distribute Snes9x in both binary
|
||||
and source form, for non-commercial purposes, is hereby granted without
|
||||
fee, providing that this license information and copyright notice appear
|
||||
and source form, for non-commercial purposes, is hereby granted without
|
||||
fee, providing that this license information and copyright notice appear
|
||||
with all copies and any derived work.
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
@ -142,6 +159,8 @@
|
||||
**********************************************************************************/
|
||||
|
||||
|
||||
|
||||
|
||||
#ifndef _apu_h_
|
||||
#define _apu_h_
|
||||
|
||||
@ -158,8 +177,8 @@ struct SIAPU
|
||||
uint8 *WaitAddress1;
|
||||
uint8 *WaitAddress2;
|
||||
uint32 WaitCounter;
|
||||
uint8 *ShadowRAM;
|
||||
uint8 *CachedSamples;
|
||||
uint8 *ShadowRAM; // unused
|
||||
uint8 *CachedSamples; // unused
|
||||
uint8 _Carry;
|
||||
uint8 _Zero;
|
||||
uint8 _Overflow;
|
||||
@ -173,7 +192,7 @@ struct SIAPU
|
||||
|
||||
struct SAPU
|
||||
{
|
||||
int32 Cycles;
|
||||
int32 OldCycles; // unused
|
||||
bool8 ShowROM;
|
||||
uint32 Flags;
|
||||
uint8 KeyedChannels;
|
||||
@ -184,6 +203,7 @@ struct SAPU
|
||||
uint16 TimerTarget [3];
|
||||
bool8 TimerEnabled [3];
|
||||
bool8 TimerValueWritten [3];
|
||||
int32 Cycles;
|
||||
};
|
||||
|
||||
EXTERN_C struct SAPU APU;
|
||||
@ -216,7 +236,7 @@ void S9xSetAPUControl (uint8 byte);
|
||||
void S9xSetAPUDSP (uint8 byte);
|
||||
uint8 S9xGetAPUDSP ();
|
||||
void S9xSetAPUTimer (uint16 Address, uint8 byte);
|
||||
void S9xUpdateAPUTimer (void);
|
||||
void S9xAPUExecute (void);
|
||||
bool8 S9xInitSound (int quality, bool8 stereo, int buffer_size);
|
||||
void S9xOpenCloseSoundTracingFile (bool8);
|
||||
void S9xPrintAPUState ();
|
||||
|
@ -1,7 +1,7 @@
|
||||
/**********************************************************************************
|
||||
Snes9x - Portable Super Nintendo Entertainment System (TM) emulator.
|
||||
|
||||
(c) Copyright 1996 - 2002 Gary Henderson (gary.henderson@ntlworld.com) and
|
||||
(c) Copyright 1996 - 2002 Gary Henderson (gary.henderson@ntlworld.com),
|
||||
Jerremy Koot (jkoot@snes9x.com)
|
||||
|
||||
(c) Copyright 2002 - 2004 Matthew Kendora
|
||||
@ -12,12 +12,16 @@
|
||||
|
||||
(c) Copyright 2001 - 2006 John Weidman (jweidman@slip.net)
|
||||
|
||||
(c) Copyright 2002 - 2006 Brad Jorsch (anomie@users.sourceforge.net),
|
||||
funkyass (funkyass@spam.shaw.ca),
|
||||
Kris Bleakley (codeviolation@hotmail.com),
|
||||
Nach (n-a-c-h@users.sourceforge.net), and
|
||||
(c) Copyright 2002 - 2006 funkyass (funkyass@spam.shaw.ca),
|
||||
Kris Bleakley (codeviolation@hotmail.com)
|
||||
|
||||
(c) Copyright 2002 - 2007 Brad Jorsch (anomie@users.sourceforge.net),
|
||||
Nach (n-a-c-h@users.sourceforge.net),
|
||||
zones (kasumitokoduck@yahoo.com)
|
||||
|
||||
(c) Copyright 2006 - 2007 nitsuja
|
||||
|
||||
|
||||
BS-X C emulator code
|
||||
(c) Copyright 2005 - 2006 Dreamer Nom,
|
||||
zones
|
||||
@ -110,17 +114,30 @@
|
||||
2xSaI filter
|
||||
(c) Copyright 1999 - 2001 Derek Liauw Kie Fa
|
||||
|
||||
HQ2x filter
|
||||
HQ2x, HQ3x, HQ4x filters
|
||||
(c) Copyright 2003 Maxim Stepin (maxim@hiend3d.com)
|
||||
|
||||
Win32 GUI code
|
||||
(c) Copyright 2003 - 2006 blip,
|
||||
funkyass,
|
||||
Matthew Kendora,
|
||||
Nach,
|
||||
nitsuja
|
||||
|
||||
Mac OS GUI code
|
||||
(c) Copyright 1998 - 2001 John Stiles
|
||||
(c) Copyright 2001 - 2007 zones
|
||||
|
||||
|
||||
Specific ports contains the works of other authors. See headers in
|
||||
individual files.
|
||||
|
||||
|
||||
Snes9x homepage: http://www.snes9x.com
|
||||
|
||||
Permission to use, copy, modify and/or distribute Snes9x in both binary
|
||||
and source form, for non-commercial purposes, is hereby granted without
|
||||
fee, providing that this license information and copyright notice appear
|
||||
and source form, for non-commercial purposes, is hereby granted without
|
||||
fee, providing that this license information and copyright notice appear
|
||||
with all copies and any derived work.
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
@ -142,85 +159,83 @@
|
||||
**********************************************************************************/
|
||||
|
||||
|
||||
|
||||
|
||||
#include "snes9x.h"
|
||||
#include "spc700.h"
|
||||
#include "apu.h"
|
||||
#include "soundux.h"
|
||||
#include "cpuexec.h"
|
||||
|
||||
#ifdef SPCTOOL
|
||||
#include "spctool/spc700.h"
|
||||
#endif
|
||||
|
||||
#ifdef DEBUGGER
|
||||
extern int32 env_counter_table[32];
|
||||
|
||||
FILE *apu_trace = NULL;
|
||||
|
||||
static char *S9xMnemonics [256] = {
|
||||
"NOP", "TCALL 0", "SET1 $%02X.0", "BBS $%02X.0,$%04X",
|
||||
"OR A,$%02X", "OR A,!$%04X", "OR A,(X)", "OR A,[$%02X+X]",
|
||||
"OR A,#$%02X", "OR $%02X,$%02X", "OR1 C,$%04X.%d", "ASL $%02X",
|
||||
"MOV !$%04X,Y", "PUSH PSW", "TSET1 !$%04X", "BRK",
|
||||
"BPL $%04X", "TCALL 1", "CLR1 $%02X.0", "BBC $%02X.0,$%04X",
|
||||
"OR A,$%02X+X", "OR A,!$%04X+X", "OR A,!$%04X+Y", "OR A,[$%02X]+Y",
|
||||
"OR $%02X,#$%02X", "OR (X),(Y)", "DECW $%02X", "ASL $%02X+X",
|
||||
"ASL A", "DEC X", "CMP X,!$%04X", "JMP [!$%04X+X]",
|
||||
"CLRP", "TCALL 2", "SET1 $%02X.1", "BBS $%02X.1,$%04X",
|
||||
"AND A,$%02X", "AND A,!$%04X", "AND A,(X)", "AND A,[$%02X+X]",
|
||||
"AND A,#$%02X", "AND $%02X,$%02X", "OR1 C,/$%04X.%d", "ROL $%02X",
|
||||
"ROL !$%04X", "PUSH A", "CBNE $%02X,$%04X", "BRA $%04X",
|
||||
"BMI $%04X", "TCALL 3", "CLR1 $%02X.1", "BBC $%02X.1,$%04X",
|
||||
"AND A,$%02X+X", "AND A,!$%04X+X", "AND A,!$%04X+Y", "AND A,[$%02X]+Y",
|
||||
"AND $%02X,#$%02X", "AND (X),(Y)", "INCW $%02X", "ROL $%02X+X",
|
||||
"ROL A", "INC X", "CMP X,$%02X", "CALL !$%04X",
|
||||
"SETP", "TCALL 4", "SET1 $%02X.2", "BBS $%02X.2,$%04X",
|
||||
"EOR A,$%02X", "EOR A,!$%04X", "EOR A,(X)", "EOR A,[$%02X+X]",
|
||||
"EOR A,#$%02X", "EOR $%02X,$%02X", "AND1 C,$%04X.%d", "LSR $%02X",
|
||||
"LSR !$%04X", "PUSH X", "TCLR1 !$%04X", "PCALL $%02X",
|
||||
"BVC $%04X", "TCALL 5", "CLR1 $%02X.2", "BBC $%02X.2,$%04X",
|
||||
"EOR A,$%02X+X", "EOR A,!$%04X+X", "EOR A,!$%04X+Y", "EOR A,[$%02X]+Y",
|
||||
"EOR $%02X,#$%02X", "EOR (X),(Y)", "CMPW YA,$%02X", "LSR $%02X+X",
|
||||
"LSR A", "MOV X,A", "CMP Y,!$%04X", "JMP !$%04X",
|
||||
"CLRC", "TCALL 6", "SET1 $%02X.3", "BBS $%02X.3,$%04X",
|
||||
"CMP A,$%02X", "CMP A,!$%04X", "CMP A,(X)", "CMP A,[$%02X+X]",
|
||||
"CMP A,#$%02X", "CMP $%02X,$%02X", "AND1 C,/$%04X.%d", "ROR $%02X",
|
||||
"ROR !$%04X", "PUSH Y", "DBNZ $%02X,$%04X", "RET",
|
||||
"BVS $%04X", "TCALL 7", "CLR1 $%02X.3", "BBC $%02X.3,$%04X",
|
||||
"CMP A,$%02X+X", "CMP A,!$%04X+X", "CMP A,!$%04X+Y", "CMP A,[$%02X]+Y",
|
||||
"CMP $%02X,#$%02X", "CMP (X),(Y)", "ADDW YA,$%02X", "ROR $%02X+X",
|
||||
"ROR A", "MOV A,X", "CMP Y,$%02X", "RET1",
|
||||
"SETC", "TCALL 8", "SET1 $%02X.4", "BBS $%02X.4,$%04X",
|
||||
"ADC A,$%02X", "ADC A,!$%04X", "ADC A,(X)", "ADC A,[$%02X+X]",
|
||||
"ADC A,#$%02X", "ADC $%02X,$%02X", "EOR1 C,$%04X.%d", "DEC $%02X",
|
||||
"DEC !$%04X", "MOV Y,#$%02X", "POP PSW", "MOV $%02X,#$%02X",
|
||||
"BCC $%04X", "TCALL 9", "CLR1 $%02X.4", "BBC $%02X.4,$%04X",
|
||||
"ADC A,$%02X+X", "ADC A,!$%04X+X", "ADC A,!$%04X+Y", "ADC A,[$%02X]+Y",
|
||||
"ADC $%02X,#$%02X", "ADC (X),(Y)", "SUBW YA,$%02X", "DEC $%02X+X",
|
||||
"DEC A", "MOV X,SP", "DIV YA,X", "XCN A",
|
||||
"EI", "TCALL 10", "SET1 $%02X.5", "BBS $%02X.5,$%04X",
|
||||
"SBC A,$%02X", "SBC A,!$%04X", "SBC A,(X)", "SBC A,[$%02X+X]",
|
||||
"SBC A,#$%02X", "SBC $%02X,$%02X", "MOV1 C,$%04X.%d", "INC $%02X",
|
||||
"INC !$%04X", "CMP Y,#$%02X", "POP A", "MOV (X)+,A",
|
||||
"BCS $%04X", "TCALL 11", "CLR1 $%02X.5", "BBC $%02X.5,$%04X",
|
||||
"SBC A,$%02X+X", "SBC A,!$%04X+X", "SBC A,!$%04X+Y", "SBC A,[$%02X]+Y",
|
||||
"SBC $%02X,#$%02X", "SBC (X),(Y)", "MOVW YA,$%02X", "INC $%02X+X",
|
||||
"INC A", "MOV SP,X", "DAS A", "MOV A,(X)+",
|
||||
"DI", "TCALL 12", "SET1 $%02X.6", "BBS $%02X.6,$%04X",
|
||||
"MOV $%02X,A", "MOV !$%04X,A", "MOV (X),A", "MOV [$%02X+X],A",
|
||||
"CMP X,#$%02X", "MOV !$%04X,X", "MOV1 $%04X.%d,C", "MOV $%02X,Y",
|
||||
"ASL !$%04X", "MOV X,#$%02X", "POP X", "MUL YA",
|
||||
"BNE $%04X", "TCALL 13", "CLR1 $%02X.6", "BBC $%02X.6,$%04X",
|
||||
"MOV $%02X+X,A", "MOV !$%04X+X,A", "MOV !$%04X+Y,A", "MOV [$%02X]+Y,A",
|
||||
"MOV $%02X,X", "MOV $%02X+Y,X", "MOVW $%02X,YA", "MOV $%02X+X,Y",
|
||||
"DEC Y", "MOV A,Y", "CBNE $%02X+X,$%04X", "DAA A",
|
||||
"CLRV", "TCALL 14", "SET1 $%02X.7", "BBS $%02X.7,$%04X",
|
||||
"MOV A,$%02X", "MOV A,!$%04X", "MOV A,(X)", "MOV A,[$%02X+X]",
|
||||
"MOV A,#$%02X", "MOV X,!$%04X", "NOT1 $%04X.%d", "MOV Y,$%02X",
|
||||
"MOV Y,!$%04X", "NOTC", "POP Y", "SLEEP",
|
||||
"BEQ $%04X", "TCALL 15", "CLR1 $%02X.7", "BBC $%02X.7,$%04X",
|
||||
"MOV A,$%02X+X", "MOV A,!$%04X+X", "MOV A,!$%04X+Y", "MOV A,[$%02X]+Y",
|
||||
"MOV X,$%02X", "MOV X,$%02X+Y", "MOV $%02X,$%02X", "MOV Y,$%02X+X",
|
||||
"NOP", "TCALL 0", "SET1 $%02X.0", "BBS $%02X.0,$%04X",
|
||||
"OR A,$%02X", "OR A,!$%04X", "OR A,(X)", "OR A,[$%02X+X]",
|
||||
"OR A,#$%02X", "OR $%02X,$%02X", "OR1 C,$%04X.%d", "ASL $%02X",
|
||||
"MOV !$%04X,Y", "PUSH PSW", "TSET1 !$%04X", "BRK",
|
||||
"BPL $%04X", "TCALL 1", "CLR1 $%02X.0", "BBC $%02X.0,$%04X",
|
||||
"OR A,$%02X+X", "OR A,!$%04X+X", "OR A,!$%04X+Y", "OR A,[$%02X]+Y",
|
||||
"OR $%02X,#$%02X", "OR (X),(Y)", "DECW $%02X", "ASL $%02X+X",
|
||||
"ASL A", "DEC X", "CMP X,!$%04X", "JMP [!$%04X+X]",
|
||||
"CLRP", "TCALL 2", "SET1 $%02X.1", "BBS $%02X.1,$%04X",
|
||||
"AND A,$%02X", "AND A,!$%04X", "AND A,(X)", "AND A,[$%02X+X]",
|
||||
"AND A,#$%02X", "AND $%02X,$%02X", "OR1 C,/$%04X.%d", "ROL $%02X",
|
||||
"ROL !$%04X", "PUSH A", "CBNE $%02X,$%04X", "BRA $%04X",
|
||||
"BMI $%04X", "TCALL 3", "CLR1 $%02X.1", "BBC $%02X.1,$%04X",
|
||||
"AND A,$%02X+X", "AND A,!$%04X+X", "AND A,!$%04X+Y", "AND A,[$%02X]+Y",
|
||||
"AND $%02X,#$%02X", "AND (X),(Y)", "INCW $%02X", "ROL $%02X+X",
|
||||
"ROL A", "INC X", "CMP X,$%02X", "CALL !$%04X",
|
||||
"SETP", "TCALL 4", "SET1 $%02X.2", "BBS $%02X.2,$%04X",
|
||||
"EOR A,$%02X", "EOR A,!$%04X", "EOR A,(X)", "EOR A,[$%02X+X]",
|
||||
"EOR A,#$%02X", "EOR $%02X,$%02X", "AND1 C,$%04X.%d", "LSR $%02X",
|
||||
"LSR !$%04X", "PUSH X", "TCLR1 !$%04X", "PCALL $%02X",
|
||||
"BVC $%04X", "TCALL 5", "CLR1 $%02X.2", "BBC $%02X.2,$%04X",
|
||||
"EOR A,$%02X+X", "EOR A,!$%04X+X", "EOR A,!$%04X+Y", "EOR A,[$%02X]+Y",
|
||||
"EOR $%02X,#$%02X", "EOR (X),(Y)", "CMPW YA,$%02X", "LSR $%02X+X",
|
||||
"LSR A", "MOV X,A", "CMP Y,!$%04X", "JMP !$%04X",
|
||||
"CLRC", "TCALL 6", "SET1 $%02X.3", "BBS $%02X.3,$%04X",
|
||||
"CMP A,$%02X", "CMP A,!$%04X", "CMP A,(X)", "CMP A,[$%02X+X]",
|
||||
"CMP A,#$%02X", "CMP $%02X,$%02X", "AND1 C,/$%04X.%d", "ROR $%02X",
|
||||
"ROR !$%04X", "PUSH Y", "DBNZ $%02X,$%04X", "RET",
|
||||
"BVS $%04X", "TCALL 7", "CLR1 $%02X.3", "BBC $%02X.3,$%04X",
|
||||
"CMP A,$%02X+X", "CMP A,!$%04X+X", "CMP A,!$%04X+Y", "CMP A,[$%02X]+Y",
|
||||
"CMP $%02X,#$%02X", "CMP (X),(Y)", "ADDW YA,$%02X", "ROR $%02X+X",
|
||||
"ROR A", "MOV A,X", "CMP Y,$%02X", "RET1",
|
||||
"SETC", "TCALL 8", "SET1 $%02X.4", "BBS $%02X.4,$%04X",
|
||||
"ADC A,$%02X", "ADC A,!$%04X", "ADC A,(X)", "ADC A,[$%02X+X]",
|
||||
"ADC A,#$%02X", "ADC $%02X,$%02X", "EOR1 C,$%04X.%d", "DEC $%02X",
|
||||
"DEC !$%04X", "MOV Y,#$%02X", "POP PSW", "MOV $%02X,#$%02X",
|
||||
"BCC $%04X", "TCALL 9", "CLR1 $%02X.4", "BBC $%02X.4,$%04X",
|
||||
"ADC A,$%02X+X", "ADC A,!$%04X+X", "ADC A,!$%04X+Y", "ADC A,[$%02X]+Y",
|
||||
"ADC $%02X,#$%02X", "ADC (X),(Y)", "SUBW YA,$%02X", "DEC $%02X+X",
|
||||
"DEC A", "MOV X,SP", "DIV YA,X", "XCN A",
|
||||
"EI", "TCALL 10", "SET1 $%02X.5", "BBS $%02X.5,$%04X",
|
||||
"SBC A,$%02X", "SBC A,!$%04X", "SBC A,(X)", "SBC A,[$%02X+X]",
|
||||
"SBC A,#$%02X", "SBC $%02X,$%02X", "MOV1 C,$%04X.%d", "INC $%02X",
|
||||
"INC !$%04X", "CMP Y,#$%02X", "POP A", "MOV (X)+,A",
|
||||
"BCS $%04X", "TCALL 11", "CLR1 $%02X.5", "BBC $%02X.5,$%04X",
|
||||
"SBC A,$%02X+X", "SBC A,!$%04X+X", "SBC A,!$%04X+Y", "SBC A,[$%02X]+Y",
|
||||
"SBC $%02X,#$%02X", "SBC (X),(Y)", "MOVW YA,$%02X", "INC $%02X+X",
|
||||
"INC A", "MOV SP,X", "DAS A", "MOV A,(X)+",
|
||||
"DI", "TCALL 12", "SET1 $%02X.6", "BBS $%02X.6,$%04X",
|
||||
"MOV $%02X,A", "MOV !$%04X,A", "MOV (X),A", "MOV [$%02X+X],A",
|
||||
"CMP X,#$%02X", "MOV !$%04X,X", "MOV1 $%04X.%d,C", "MOV $%02X,Y",
|
||||
"ASL !$%04X", "MOV X,#$%02X", "POP X", "MUL YA",
|
||||
"BNE $%04X", "TCALL 13", "CLR1 $%02X.6", "BBC $%02X.6,$%04X",
|
||||
"MOV $%02X+X,A", "MOV !$%04X+X,A", "MOV !$%04X+Y,A", "MOV [$%02X]+Y,A",
|
||||
"MOV $%02X,X", "MOV $%02X+Y,X", "MOVW $%02X,YA", "MOV $%02X+X,Y",
|
||||
"DEC Y", "MOV A,Y", "CBNE $%02X+X,$%04X", "DAA A",
|
||||
"CLRV", "TCALL 14", "SET1 $%02X.7", "BBS $%02X.7,$%04X",
|
||||
"MOV A,$%02X", "MOV A,!$%04X", "MOV A,(X)", "MOV A,[$%02X+X]",
|
||||
"MOV A,#$%02X", "MOV X,!$%04X", "NOT1 $%04X.%d", "MOV Y,$%02X",
|
||||
"MOV Y,!$%04X", "NOTC", "POP Y", "SLEEP",
|
||||
"BEQ $%04X", "TCALL 15", "CLR1 $%02X.7", "BBC $%02X.7,$%04X",
|
||||
"MOV A,$%02X+X", "MOV A,!$%04X+X", "MOV A,!$%04X+Y", "MOV A,[$%02X]+Y",
|
||||
"MOV X,$%02X", "MOV X,$%02X+Y", "MOV $%02X,$%02X", "MOV Y,$%02X+X",
|
||||
"INC Y", "MOV Y,A", "DBNZ Y,$%04X", "STOP"
|
||||
};
|
||||
|
||||
@ -331,7 +346,7 @@ void S9xTraceSoundDSP (const char *s, int i1 = 0, int i2 = 0, int i3 = 0,
|
||||
int S9xTraceAPU ()
|
||||
{
|
||||
char buffer [200];
|
||||
|
||||
|
||||
uint8 b = S9xAPUOPrint (buffer, IAPU.PC - IAPU.RAM);
|
||||
if (apu_trace == NULL)
|
||||
apu_trace = fopen ("apu_trace.log", "wb");
|
||||
@ -346,7 +361,7 @@ int S9xAPUOPrint (char *buffer, uint16 Address)
|
||||
uint8 *p = IAPU.RAM + Address;
|
||||
int mode = Modes [*p];
|
||||
int bytes = ModesToBytes [mode];
|
||||
|
||||
|
||||
switch (bytes)
|
||||
{
|
||||
case 1:
|
||||
@ -407,8 +422,8 @@ int S9xAPUOPrint (char *buffer, uint16 Address)
|
||||
APUCheckCarry () ? 'C' : 'c',
|
||||
CPU.V_Counter,
|
||||
CPU.Cycles,
|
||||
APU.Cycles);
|
||||
|
||||
APU.Cycles >> SNES_APU_ACCURACY);
|
||||
|
||||
return (bytes);
|
||||
}
|
||||
|
||||
@ -478,7 +493,7 @@ void S9xPrintAPUState ()
|
||||
printf ("left: %d, right: %d, ",
|
||||
ch->volume_left, ch->volume_right);
|
||||
|
||||
static char* envelope [] =
|
||||
static char* envelope [] =
|
||||
{
|
||||
"silent", "attack", "decay", "sustain", "release", "gain",
|
||||
"inc_lin", "inc_bent", "dec_lin", "dec_exp"
|
||||
|
@ -1,7 +1,7 @@
|
||||
/**********************************************************************************
|
||||
Snes9x - Portable Super Nintendo Entertainment System (TM) emulator.
|
||||
|
||||
(c) Copyright 1996 - 2002 Gary Henderson (gary.henderson@ntlworld.com) and
|
||||
(c) Copyright 1996 - 2002 Gary Henderson (gary.henderson@ntlworld.com),
|
||||
Jerremy Koot (jkoot@snes9x.com)
|
||||
|
||||
(c) Copyright 2002 - 2004 Matthew Kendora
|
||||
@ -12,12 +12,16 @@
|
||||
|
||||
(c) Copyright 2001 - 2006 John Weidman (jweidman@slip.net)
|
||||
|
||||
(c) Copyright 2002 - 2006 Brad Jorsch (anomie@users.sourceforge.net),
|
||||
funkyass (funkyass@spam.shaw.ca),
|
||||
Kris Bleakley (codeviolation@hotmail.com),
|
||||
Nach (n-a-c-h@users.sourceforge.net), and
|
||||
(c) Copyright 2002 - 2006 funkyass (funkyass@spam.shaw.ca),
|
||||
Kris Bleakley (codeviolation@hotmail.com)
|
||||
|
||||
(c) Copyright 2002 - 2007 Brad Jorsch (anomie@users.sourceforge.net),
|
||||
Nach (n-a-c-h@users.sourceforge.net),
|
||||
zones (kasumitokoduck@yahoo.com)
|
||||
|
||||
(c) Copyright 2006 - 2007 nitsuja
|
||||
|
||||
|
||||
BS-X C emulator code
|
||||
(c) Copyright 2005 - 2006 Dreamer Nom,
|
||||
zones
|
||||
@ -110,17 +114,30 @@
|
||||
2xSaI filter
|
||||
(c) Copyright 1999 - 2001 Derek Liauw Kie Fa
|
||||
|
||||
HQ2x filter
|
||||
HQ2x, HQ3x, HQ4x filters
|
||||
(c) Copyright 2003 Maxim Stepin (maxim@hiend3d.com)
|
||||
|
||||
Win32 GUI code
|
||||
(c) Copyright 2003 - 2006 blip,
|
||||
funkyass,
|
||||
Matthew Kendora,
|
||||
Nach,
|
||||
nitsuja
|
||||
|
||||
Mac OS GUI code
|
||||
(c) Copyright 1998 - 2001 John Stiles
|
||||
(c) Copyright 2001 - 2007 zones
|
||||
|
||||
|
||||
Specific ports contains the works of other authors. See headers in
|
||||
individual files.
|
||||
|
||||
|
||||
Snes9x homepage: http://www.snes9x.com
|
||||
|
||||
Permission to use, copy, modify and/or distribute Snes9x in both binary
|
||||
and source form, for non-commercial purposes, is hereby granted without
|
||||
fee, providing that this license information and copyright notice appear
|
||||
and source form, for non-commercial purposes, is hereby granted without
|
||||
fee, providing that this license information and copyright notice appear
|
||||
with all copies and any derived work.
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
@ -142,162 +159,152 @@
|
||||
**********************************************************************************/
|
||||
|
||||
|
||||
|
||||
#ifndef _apumemory_h_
|
||||
#define _apumemory_h_
|
||||
|
||||
START_EXTERN_C
|
||||
extern uint8 W4;
|
||||
extern uint8 APUROM[64];
|
||||
END_EXTERN_C
|
||||
|
||||
static INLINE uint8 apu_get_reg (uint8 Address)
|
||||
{
|
||||
switch (Address)
|
||||
{
|
||||
case 0xf0: // -w TEST
|
||||
return 0;
|
||||
|
||||
case 0xf1: // -w CONTROL
|
||||
return 0;
|
||||
|
||||
case 0xf2: // rw DSPADDR
|
||||
return (IAPU.RAM[Address]);
|
||||
|
||||
case 0xf3: // rw DSPDATA
|
||||
return (S9xGetAPUDSP());
|
||||
|
||||
case 0xf4: // r- CPUI0
|
||||
case 0xf5: // r- CPUI1
|
||||
case 0xf6: // r- CPUI2
|
||||
case 0xf7: // r- CPUI3
|
||||
#ifdef SPC700_SHUTDOWN
|
||||
IAPU.WaitAddress2 = IAPU.WaitAddress1;
|
||||
IAPU.WaitAddress1 = IAPU.PC;
|
||||
#endif
|
||||
return (IAPU.RAM[Address]);
|
||||
|
||||
case 0xf8: // rw - Normal RAM
|
||||
case 0xf9: // rw - Normal RAM
|
||||
return (IAPU.RAM[Address]);
|
||||
|
||||
case 0xfa: // -w T0TARGET
|
||||
case 0xfb: // -w T1TARGET
|
||||
case 0xfc: // -w T2TARGET
|
||||
return 0;
|
||||
|
||||
case 0xfd: // r- T0OUT
|
||||
case 0xfe: // r- T1OUT
|
||||
case 0xff: // r- T2OUT
|
||||
#ifdef SPC700_SHUTDOWN
|
||||
IAPU.WaitAddress2 = IAPU.WaitAddress1;
|
||||
IAPU.WaitAddress1 = IAPU.PC;
|
||||
#endif
|
||||
uint8 t = IAPU.RAM[Address] & 0xF;
|
||||
IAPU.RAM[Address] = 0;
|
||||
return (t);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static INLINE void apu_set_reg (uint8 byte, uint8 Address)
|
||||
{
|
||||
switch (Address)
|
||||
{
|
||||
case 0xf0: // -w TEST
|
||||
//printf("Write %02X to APU 0xF0!\n", byte);
|
||||
return;
|
||||
|
||||
case 0xf1: // -w CONTROL
|
||||
S9xSetAPUControl(byte);
|
||||
return;
|
||||
|
||||
case 0xf2: // rw DSPADDR
|
||||
IAPU.RAM[Address] = byte;
|
||||
return;
|
||||
|
||||
case 0xf3: // rw DSPDATA
|
||||
S9xSetAPUDSP(byte);
|
||||
return;
|
||||
|
||||
case 0xf4: // -w CPUO0
|
||||
case 0xf5: // -w CPUO1
|
||||
case 0xf6: // -w CPUO2
|
||||
case 0xf7: // -w CPUO3
|
||||
APU.OutPorts[Address - 0xf4] = byte;
|
||||
return;
|
||||
|
||||
case 0xf8: // rw - Normal RAM
|
||||
case 0xf9: // rw - Normal RAM
|
||||
IAPU.RAM[Address] = byte;
|
||||
return;
|
||||
|
||||
case 0xfa: // -w T0TARGET
|
||||
case 0xfb: // -w T1TARGET
|
||||
case 0xfc: // -w T2TARGET
|
||||
IAPU.RAM[Address] = byte;
|
||||
if (byte == 0)
|
||||
APU.TimerTarget[Address - 0xfa] = 0x100;
|
||||
else
|
||||
APU.TimerTarget[Address - 0xfa] = byte;
|
||||
return;
|
||||
|
||||
case 0xfd: // r- T0OUT
|
||||
case 0xfe: // r- T1OUT
|
||||
case 0xff: // r- T2OUT
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
INLINE uint8 S9xAPUGetByteZ (uint8 Address)
|
||||
{
|
||||
if (Address >= 0xf0 && IAPU.DirectPage == IAPU.RAM)
|
||||
{
|
||||
if (Address >= 0xf4 && Address <= 0xf7)
|
||||
{
|
||||
#ifdef SPC700_SHUTDOWN
|
||||
IAPU.WaitAddress2 = IAPU.WaitAddress1;
|
||||
IAPU.WaitAddress1 = IAPU.PC;
|
||||
#endif
|
||||
return (IAPU.RAM [Address]);
|
||||
}
|
||||
if (Address >= 0xfd)
|
||||
{
|
||||
#ifdef SPC700_SHUTDOWN
|
||||
IAPU.WaitAddress2 = IAPU.WaitAddress1;
|
||||
IAPU.WaitAddress1 = IAPU.PC;
|
||||
#endif
|
||||
uint8 t = IAPU.RAM [Address];
|
||||
IAPU.RAM [Address] = 0;
|
||||
return (t);
|
||||
}
|
||||
if (Address >= 0xf0 && IAPU.DirectPage == IAPU.RAM)
|
||||
return (apu_get_reg(Address));
|
||||
else
|
||||
if (Address == 0xf3)
|
||||
return (S9xGetAPUDSP ());
|
||||
|
||||
return (IAPU.RAM [Address]);
|
||||
}
|
||||
else
|
||||
return (IAPU.DirectPage [Address]);
|
||||
return (IAPU.DirectPage[Address]);
|
||||
}
|
||||
|
||||
INLINE void S9xAPUSetByteZ (uint8 byte, uint8 Address)
|
||||
{
|
||||
if (Address >= 0xf0 && IAPU.DirectPage == IAPU.RAM)
|
||||
{
|
||||
if (Address == 0xf3)
|
||||
S9xSetAPUDSP (byte);
|
||||
else
|
||||
if (Address >= 0xf4 && Address <= 0xf7)
|
||||
APU.OutPorts [Address - 0xf4] = byte;
|
||||
else
|
||||
if (Address == 0xf1)
|
||||
S9xSetAPUControl (byte);
|
||||
else
|
||||
if (Address < 0xfd)
|
||||
{
|
||||
IAPU.RAM [Address] = byte;
|
||||
if (Address >= 0xfa)
|
||||
{
|
||||
if (byte == 0)
|
||||
APU.TimerTarget [Address - 0xfa] = 0x100;
|
||||
else
|
||||
APU.TimerTarget [Address - 0xfa] = byte;
|
||||
}
|
||||
}
|
||||
}
|
||||
apu_set_reg(byte, Address);
|
||||
else
|
||||
IAPU.DirectPage [Address] = byte;
|
||||
IAPU.DirectPage[Address] = byte;
|
||||
}
|
||||
|
||||
INLINE uint8 S9xAPUGetByte (uint32 Address)
|
||||
{
|
||||
Address &= 0xffff;
|
||||
|
||||
if (Address <= 0xff && Address >= 0xf0)
|
||||
{
|
||||
if (Address >= 0xf4 && Address <= 0xf7)
|
||||
{
|
||||
#ifdef SPC700_SHUTDOWN
|
||||
IAPU.WaitAddress2 = IAPU.WaitAddress1;
|
||||
IAPU.WaitAddress1 = IAPU.PC;
|
||||
#endif
|
||||
return (IAPU.RAM [Address]);
|
||||
}
|
||||
else
|
||||
if (Address == 0xf3)
|
||||
return (S9xGetAPUDSP ());
|
||||
if (Address >= 0xfd)
|
||||
{
|
||||
#ifdef SPC700_SHUTDOWN
|
||||
IAPU.WaitAddress2 = IAPU.WaitAddress1;
|
||||
IAPU.WaitAddress1 = IAPU.PC;
|
||||
#endif
|
||||
uint8 t = IAPU.RAM [Address];
|
||||
IAPU.RAM [Address] = 0;
|
||||
return (t);
|
||||
}
|
||||
return (IAPU.RAM [Address]);
|
||||
}
|
||||
return (apu_get_reg(Address & 0xff));
|
||||
else
|
||||
return (IAPU.RAM [Address]);
|
||||
return (IAPU.RAM[Address]);
|
||||
}
|
||||
|
||||
INLINE void S9xAPUSetByte (uint8 byte, uint32 Address)
|
||||
{
|
||||
Address &= 0xffff;
|
||||
|
||||
if (Address <= 0xff && Address >= 0xf0)
|
||||
{
|
||||
if (Address == 0xf3)
|
||||
S9xSetAPUDSP (byte);
|
||||
apu_set_reg(byte, Address & 0xff);
|
||||
else
|
||||
if (Address >= 0xf4 && Address <= 0xf7)
|
||||
APU.OutPorts [Address - 0xf4] = byte;
|
||||
else
|
||||
if (Address == 0xf1)
|
||||
S9xSetAPUControl (byte);
|
||||
else
|
||||
if (Address < 0xfd)
|
||||
{
|
||||
IAPU.RAM [Address] = byte;
|
||||
if (Address >= 0xfa)
|
||||
{
|
||||
if (byte == 0)
|
||||
APU.TimerTarget [Address - 0xfa] = 0x100;
|
||||
else
|
||||
APU.TimerTarget [Address - 0xfa] = byte;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
#if 0
|
||||
if (Address >= 0x2500 && Address <= 0x2504)
|
||||
printf ("%06d %04x <- %02x\n", ICPU.Scanline, Address, byte);
|
||||
if (Address == 0x26c6)
|
||||
{
|
||||
extern FILE *apu_trace;
|
||||
extern FILE *trace;
|
||||
APU.Flags |= TRACE_FLAG;
|
||||
CPU.Flags |= TRACE_FLAG;
|
||||
if (apu_trace == NULL)
|
||||
apu_trace = fopen ("aputrace.log", "wb");
|
||||
if (trace == NULL)
|
||||
trace = fopen ("trace.log", "wb");
|
||||
printf ("TRACING SWITCHED ON\n");
|
||||
}
|
||||
#endif
|
||||
if (Address < 0xffc0)
|
||||
IAPU.RAM [Address] = byte;
|
||||
IAPU.RAM[Address] = byte;
|
||||
else
|
||||
{
|
||||
APU.ExtraRAM [Address - 0xffc0] = byte;
|
||||
APU.ExtraRAM[Address - 0xffc0] = byte;
|
||||
if (!APU.ShowROM)
|
||||
IAPU.RAM [Address] = byte;
|
||||
IAPU.RAM[Address] = byte;
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif // _apumemory_h_
|
||||
|
@ -1,7 +1,7 @@
|
||||
/**********************************************************************************
|
||||
Snes9x - Portable Super Nintendo Entertainment System (TM) emulator.
|
||||
|
||||
(c) Copyright 1996 - 2002 Gary Henderson (gary.henderson@ntlworld.com) and
|
||||
(c) Copyright 1996 - 2002 Gary Henderson (gary.henderson@ntlworld.com),
|
||||
Jerremy Koot (jkoot@snes9x.com)
|
||||
|
||||
(c) Copyright 2002 - 2004 Matthew Kendora
|
||||
@ -12,12 +12,16 @@
|
||||
|
||||
(c) Copyright 2001 - 2006 John Weidman (jweidman@slip.net)
|
||||
|
||||
(c) Copyright 2002 - 2006 Brad Jorsch (anomie@users.sourceforge.net),
|
||||
funkyass (funkyass@spam.shaw.ca),
|
||||
Kris Bleakley (codeviolation@hotmail.com),
|
||||
Nach (n-a-c-h@users.sourceforge.net), and
|
||||
(c) Copyright 2002 - 2006 funkyass (funkyass@spam.shaw.ca),
|
||||
Kris Bleakley (codeviolation@hotmail.com)
|
||||
|
||||
(c) Copyright 2002 - 2007 Brad Jorsch (anomie@users.sourceforge.net),
|
||||
Nach (n-a-c-h@users.sourceforge.net),
|
||||
zones (kasumitokoduck@yahoo.com)
|
||||
|
||||
(c) Copyright 2006 - 2007 nitsuja
|
||||
|
||||
|
||||
BS-X C emulator code
|
||||
(c) Copyright 2005 - 2006 Dreamer Nom,
|
||||
zones
|
||||
@ -110,17 +114,30 @@
|
||||
2xSaI filter
|
||||
(c) Copyright 1999 - 2001 Derek Liauw Kie Fa
|
||||
|
||||
HQ2x filter
|
||||
HQ2x, HQ3x, HQ4x filters
|
||||
(c) Copyright 2003 Maxim Stepin (maxim@hiend3d.com)
|
||||
|
||||
Win32 GUI code
|
||||
(c) Copyright 2003 - 2006 blip,
|
||||
funkyass,
|
||||
Matthew Kendora,
|
||||
Nach,
|
||||
nitsuja
|
||||
|
||||
Mac OS GUI code
|
||||
(c) Copyright 1998 - 2001 John Stiles
|
||||
(c) Copyright 2001 - 2007 zones
|
||||
|
||||
|
||||
Specific ports contains the works of other authors. See headers in
|
||||
individual files.
|
||||
|
||||
|
||||
Snes9x homepage: http://www.snes9x.com
|
||||
|
||||
Permission to use, copy, modify and/or distribute Snes9x in both binary
|
||||
and source form, for non-commercial purposes, is hereby granted without
|
||||
fee, providing that this license information and copyright notice appear
|
||||
and source form, for non-commercial purposes, is hereby granted without
|
||||
fee, providing that this license information and copyright notice appear
|
||||
with all copies and any derived work.
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
@ -142,6 +159,8 @@
|
||||
**********************************************************************************/
|
||||
|
||||
|
||||
|
||||
|
||||
// Anonymous wrote:
|
||||
// Large thanks to John Weidman for all his initial research
|
||||
// Thanks to Seph3 for his modem notes
|
||||
@ -227,9 +246,9 @@ static int is_bsx(unsigned char *);
|
||||
static void BSX_Map_SNES(void)
|
||||
{
|
||||
// These maps will be partially overwritten
|
||||
|
||||
|
||||
int c;
|
||||
|
||||
|
||||
// Banks 00->3F and 80->BF
|
||||
for (c = 0; c < 0x400; c += 16)
|
||||
{
|
||||
@ -237,7 +256,7 @@ static void BSX_Map_SNES(void)
|
||||
Map[c + 1] = Map[c + 0x801] = RAM;
|
||||
BlockIsRAM[c + 0] = BlockIsRAM[c + 0x800] = TRUE;
|
||||
BlockIsRAM[c + 1] = BlockIsRAM[c + 0x801] = TRUE;
|
||||
|
||||
|
||||
Map[c + 2] = Map[c + 0x802] = (uint8 *) MAP_PPU;
|
||||
Map[c + 3] = Map[c + 0x803] = (uint8 *) MAP_PPU;
|
||||
Map[c + 4] = Map[c + 0x804] = (uint8 *) MAP_CPU;
|
||||
@ -250,9 +269,9 @@ static void BSX_Map_SNES(void)
|
||||
static void BSX_Map_LoROM(void)
|
||||
{
|
||||
// These maps will be partially overwritten
|
||||
|
||||
|
||||
int i, c;
|
||||
|
||||
|
||||
// Banks 00->3F and 80->BF
|
||||
for (c = 0; c < 0x400; c += 16)
|
||||
{
|
||||
@ -263,16 +282,16 @@ static void BSX_Map_LoROM(void)
|
||||
BlockIsROM[i] = BlockIsROM[i + 0x800] = !BSX.write_enable;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Banks 40->7F and C0->FF
|
||||
for (c = 0; c < 0x400; c += 16)
|
||||
{
|
||||
for (i = c; i < c + 8; i++)
|
||||
Map[i + 0x400] = Map[i + 0xC00] = &MapROM[(c << 11) % FlashSize];
|
||||
|
||||
|
||||
for (i = c + 8; i < c + 16; i++)
|
||||
Map[i + 0x400] = Map[i + 0xC00] = &MapROM[(c << 11) % FlashSize] - 0x8000;
|
||||
|
||||
|
||||
for (i = c; i < c + 16; i++)
|
||||
{
|
||||
BlockIsRAM[i + 0x400] = BlockIsRAM[i + 0xC00] = BSX.write_enable;
|
||||
@ -284,9 +303,9 @@ static void BSX_Map_LoROM(void)
|
||||
static void BSX_Map_HiROM(void)
|
||||
{
|
||||
// These maps will be partially overwritten
|
||||
|
||||
|
||||
int i, c;
|
||||
|
||||
|
||||
// Banks 00->3F and 80->BF
|
||||
for (c = 0; c < 0x400; c += 16)
|
||||
{
|
||||
@ -297,7 +316,7 @@ static void BSX_Map_HiROM(void)
|
||||
BlockIsROM[i] = BlockIsROM[i + 0x800] = !BSX.write_enable;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Banks 40->7F and C0->FF
|
||||
for (c = 0; c < 0x400; c += 16)
|
||||
{
|
||||
@ -313,7 +332,7 @@ static void BSX_Map_HiROM(void)
|
||||
static void BSX_Map_MMC(void)
|
||||
{
|
||||
int c;
|
||||
|
||||
|
||||
// Banks 01->0E:5000-5FFF
|
||||
for (c = 0x010; c < 0x0F0; c += 16)
|
||||
{
|
||||
@ -325,7 +344,7 @@ static void BSX_Map_MMC(void)
|
||||
static void BSX_Map_FlashIO(void)
|
||||
{
|
||||
int c;
|
||||
|
||||
|
||||
if (BSX.MMC[0x0C] || BSX.MMC[0x0D])
|
||||
{
|
||||
// Bank C0:0000, 2AAA, 5555, FF00-FF1F
|
||||
@ -341,7 +360,7 @@ static void BSX_Map_FlashIO(void)
|
||||
static void BSX_Map_SRAM(void)
|
||||
{
|
||||
int c;
|
||||
|
||||
|
||||
// Banks 10->17:5000-5FFF
|
||||
for (c = 0x100; c < 0x180; c += 16)
|
||||
{
|
||||
@ -354,9 +373,9 @@ static void BSX_Map_SRAM(void)
|
||||
static void map_psram_mirror_sub(uint32 bank)
|
||||
{
|
||||
int i, c;
|
||||
|
||||
|
||||
bank <<= 4;
|
||||
|
||||
|
||||
if (BSX.MMC[0x02])
|
||||
{
|
||||
for (c = 0; c < 0x100; c += 16)
|
||||
@ -375,10 +394,10 @@ static void map_psram_mirror_sub(uint32 bank)
|
||||
{
|
||||
for (i = c; i < c + 8; i++)
|
||||
Map[i + bank] = &PSRAM[(c << 11) % PSRAM_SIZE];
|
||||
|
||||
|
||||
for (i = c + 8; i < c + 16; i++)
|
||||
Map[i + bank] = &PSRAM[(c << 11) % PSRAM_SIZE] - 0x8000;
|
||||
|
||||
|
||||
for (i = c; i < c + 16; i++)
|
||||
{
|
||||
BlockIsRAM[i + bank] = TRUE;
|
||||
@ -391,7 +410,7 @@ static void map_psram_mirror_sub(uint32 bank)
|
||||
static void BSX_Map_PSRAM(void)
|
||||
{
|
||||
int c;
|
||||
|
||||
|
||||
// Banks 70->77:0000-FFFF
|
||||
// FIXME: could be toggled by $03
|
||||
for (c = 0; c < 0x80; c++)
|
||||
@ -400,7 +419,7 @@ static void BSX_Map_PSRAM(void)
|
||||
BlockIsRAM[c + 0x700] = TRUE;
|
||||
BlockIsROM[c + 0x700] = FALSE;
|
||||
}
|
||||
|
||||
|
||||
// Banks 20->3F:6000-7FFF mirrors 70->77:6000-7FFF
|
||||
for (c = 0x200; c < 0x400; c += 16)
|
||||
{
|
||||
@ -411,15 +430,15 @@ static void BSX_Map_PSRAM(void)
|
||||
BlockIsROM[c + 6] = FALSE;
|
||||
BlockIsROM[c + 7] = FALSE;
|
||||
}
|
||||
|
||||
|
||||
if (!BSX.MMC[0x05])
|
||||
// Banks 40->4F:0000-FFFF mirrors 70->77:0000-7FFF
|
||||
map_psram_mirror_sub(0x40);
|
||||
|
||||
|
||||
if (!BSX.MMC[0x06])
|
||||
// Banks 50->5F:0000-FFFF mirrors 70->77:0000-7FFF
|
||||
map_psram_mirror_sub(0x50);
|
||||
|
||||
|
||||
// FIXME
|
||||
if (!BSX.MMC[0x03])
|
||||
// Banks 60->6F:0000-FFFF mirrors 70->77:0000-7FFF (?)
|
||||
@ -429,7 +448,7 @@ static void BSX_Map_PSRAM(void)
|
||||
static void BSX_Map_BIOS(void)
|
||||
{
|
||||
int i,c;
|
||||
|
||||
|
||||
// Banks 00->1F:8000-FFFF
|
||||
if (BSX.MMC[0x07])
|
||||
{
|
||||
@ -443,7 +462,7 @@ static void BSX_Map_BIOS(void)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Banks 80->9F:8000-FFFF
|
||||
if (BSX.MMC[0x08])
|
||||
{
|
||||
@ -462,7 +481,7 @@ static void BSX_Map_BIOS(void)
|
||||
static void BSX_Map_RAM(void)
|
||||
{
|
||||
int c;
|
||||
|
||||
|
||||
// Banks 7E->7F
|
||||
for (c = 0; c < 16; c++)
|
||||
{
|
||||
@ -478,9 +497,9 @@ static void BSX_Map_RAM(void)
|
||||
static void BSX_Map_Dirty(void)
|
||||
{
|
||||
// for the quick bank change
|
||||
|
||||
|
||||
int i, c;
|
||||
|
||||
|
||||
// Banks 00->1F and 80->9F:8000-FFFF
|
||||
if (BSX.MMC[0x02])
|
||||
{
|
||||
@ -515,21 +534,21 @@ static void BSX_Map(void)
|
||||
for (int i = 0; i < 32; i++)
|
||||
printf("BS: MMC %02X: %d\n", i, BSX.MMC[i]);
|
||||
#endif
|
||||
|
||||
|
||||
memcpy(BSX.prevMMC, BSX.MMC, sizeof(BSX.MMC));
|
||||
|
||||
|
||||
// Do a quick bank change
|
||||
if (BSX.dirty2 && !BSX.dirty)
|
||||
{
|
||||
BSX_Map_Dirty();
|
||||
BSX_Map_BIOS();
|
||||
|
||||
|
||||
BSX.dirty2 = FALSE;
|
||||
|
||||
Memory.WriteProtectROM();
|
||||
|
||||
Memory.map_WriteProtectROM();
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
if (BSX.MMC[0x01])
|
||||
{
|
||||
MapROM = PSRAM;
|
||||
@ -540,27 +559,27 @@ static void BSX_Map(void)
|
||||
MapROM = FlashROM;
|
||||
FlashSize = FLASH_SIZE;
|
||||
}
|
||||
|
||||
|
||||
BSX_Map_SNES();
|
||||
|
||||
|
||||
if (BSX.MMC[0x02])
|
||||
BSX_Map_HiROM();
|
||||
else
|
||||
BSX_Map_LoROM();
|
||||
|
||||
|
||||
BSX_Map_PSRAM();
|
||||
BSX_Map_SRAM();
|
||||
BSX_Map_RAM();
|
||||
|
||||
|
||||
BSX_Map_BIOS();
|
||||
BSX_Map_FlashIO();
|
||||
BSX_Map_MMC();
|
||||
|
||||
|
||||
// Monitor new register changes
|
||||
BSX.dirty = FALSE;
|
||||
BSX.dirty2 = FALSE;
|
||||
|
||||
Memory.WriteProtectROM();
|
||||
|
||||
Memory.map_WriteProtectROM();
|
||||
}
|
||||
|
||||
static uint8 BSX_Get_Bypass_FlashIO(uint16 offset)
|
||||
@ -594,17 +613,17 @@ uint8 S9xGetBSX(uint32 address)
|
||||
uint8 bank = (address >> 16) & 0xFF;
|
||||
uint16 offset = address & 0xFFFF;
|
||||
uint8 t = 0;
|
||||
|
||||
|
||||
// MMC
|
||||
if ((bank >= 0x01 && bank <= 0x0E) && (offset == 0x5000))
|
||||
return BSX.MMC[bank];
|
||||
|
||||
|
||||
// Flash IO
|
||||
if (bank == 0xC0)
|
||||
{
|
||||
// default: read-through mode
|
||||
t = BSX_Get_Bypass_FlashIO(offset);
|
||||
|
||||
|
||||
// note: may be more registers, purposes unknown
|
||||
switch (offset)
|
||||
{
|
||||
@ -612,12 +631,12 @@ uint8 S9xGetBSX(uint32 address)
|
||||
if (BSX.flash_enable)
|
||||
t = 0x80; // status register?
|
||||
break;
|
||||
|
||||
|
||||
case 0x5555:
|
||||
if (BSX.flash_enable)
|
||||
t = 0x80; // ???
|
||||
break;
|
||||
|
||||
|
||||
case 0xFF00:
|
||||
case 0xFF02:
|
||||
case 0xFF04:
|
||||
@ -634,7 +653,7 @@ uint8 S9xGetBSX(uint32 address)
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return t;
|
||||
}
|
||||
|
||||
@ -642,7 +661,7 @@ void S9xSetBSX(uint8 byte, uint32 address)
|
||||
{
|
||||
uint8 bank = (address >> 16) & 0xFF;
|
||||
uint16 offset = address & 0xFFFF;
|
||||
|
||||
|
||||
// MMC
|
||||
if ((bank >= 0x01 && bank <= 0x0E) && (offset == 0x5000))
|
||||
{
|
||||
@ -665,7 +684,7 @@ void S9xSetBSX(uint8 byte, uint32 address)
|
||||
BSX.dirty = TRUE;
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
case 0x07:
|
||||
case 0x08:
|
||||
if (BSX.MMC[bank] != byte)
|
||||
@ -674,7 +693,7 @@ void S9xSetBSX(uint8 byte, uint32 address)
|
||||
BSX.dirty2 = TRUE;
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
case 0x0E:
|
||||
BSX.MMC[bank] = byte;
|
||||
if (byte && (BSX.dirty || BSX.dirty2))
|
||||
@ -682,13 +701,13 @@ void S9xSetBSX(uint8 byte, uint32 address)
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Flash IO
|
||||
if (bank == 0xC0)
|
||||
{
|
||||
BSX.old_write = BSX.new_write;
|
||||
BSX.new_write = address;
|
||||
|
||||
|
||||
// ???: double writes to the desired address will bypass
|
||||
// flash registers
|
||||
if (BSX.old_write == BSX.new_write && BSX.write_enable)
|
||||
@ -696,7 +715,7 @@ void S9xSetBSX(uint8 byte, uint32 address)
|
||||
BSX_Set_Bypass_FlashIO(offset, byte);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
// flash command handling
|
||||
// note: incomplete
|
||||
switch (offset)
|
||||
@ -711,16 +730,16 @@ void S9xSetBSX(uint8 byte, uint32 address)
|
||||
BSX.read_enable = TRUE;
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
case 0x2AAA:
|
||||
BSX.flash_command <<= 8;
|
||||
BSX.flash_command |= byte;
|
||||
break;
|
||||
|
||||
|
||||
case 0x5555:
|
||||
BSX.flash_command <<= 8;
|
||||
BSX.flash_command |= byte;
|
||||
|
||||
|
||||
switch (BSX.flash_command & 0xFFFFFF)
|
||||
{
|
||||
case 0xAA55F0:
|
||||
@ -729,7 +748,7 @@ void S9xSetBSX(uint8 byte, uint32 address)
|
||||
BSX.write_enable = FALSE;
|
||||
BSX.read_enable = FALSE;
|
||||
break;
|
||||
|
||||
|
||||
case 0xAA55A0:
|
||||
// enable writing to flash
|
||||
BSX.old_write = 0;
|
||||
@ -738,20 +757,20 @@ void S9xSetBSX(uint8 byte, uint32 address)
|
||||
BSX.write_enable = TRUE;
|
||||
BSX_Map();
|
||||
break;
|
||||
|
||||
|
||||
case 0xAA5570:
|
||||
// turn on write-protection
|
||||
BSX.write_enable = FALSE;
|
||||
BSX_Map();
|
||||
break;
|
||||
|
||||
|
||||
case 0xAA5580:
|
||||
case 0xAA5510:
|
||||
// ???
|
||||
break;
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -760,7 +779,7 @@ void S9xSetBSX(uint8 byte, uint32 address)
|
||||
uint8 S9xGetBSXPPU(uint16 address)
|
||||
{
|
||||
uint8 t = 0;
|
||||
|
||||
|
||||
if (address >= 0x2188 && address <= 0x219F)
|
||||
{
|
||||
// known read registers
|
||||
@ -770,44 +789,44 @@ uint8 S9xGetBSXPPU(uint16 address)
|
||||
case 0x2188:
|
||||
t = BSX.PPU[0x2188];
|
||||
break;
|
||||
|
||||
|
||||
// Test register high? (r/w)
|
||||
case 0x2189:
|
||||
t = BSX.PPU[0x2189];
|
||||
break;
|
||||
|
||||
|
||||
case 0x218A:
|
||||
t = BSX.PPU[0x218A];
|
||||
break;
|
||||
|
||||
|
||||
case 0x218C:
|
||||
t = BSX.PPU[0x218C];
|
||||
break;
|
||||
|
||||
|
||||
// Transmission number low? (r/w)
|
||||
case 0x218E:
|
||||
t = BSX.PPU[0x218E];
|
||||
break;
|
||||
|
||||
|
||||
// Transmission number high? (r/w)
|
||||
case 0x218F:
|
||||
t = BSX.PPU[0x218F];
|
||||
break;
|
||||
|
||||
|
||||
// Status register? (r)
|
||||
case 0x2190:
|
||||
t = BSX.PPU[0x2190];
|
||||
break;
|
||||
|
||||
|
||||
// Data register? (r/w)
|
||||
case 0x2192:
|
||||
t = BSX.PPU[0x2192];
|
||||
|
||||
|
||||
// test
|
||||
t = BSX.test2192[BSX.out_index++];
|
||||
if (BSX.out_index == 32)
|
||||
BSX.out_index = 0;
|
||||
|
||||
|
||||
BSX_RTC.ticks++;
|
||||
if (BSX_RTC.ticks >= 1000)
|
||||
{
|
||||
@ -826,45 +845,45 @@ uint8 S9xGetBSXPPU(uint16 address)
|
||||
}
|
||||
if (BSX_RTC.hours >= 24)
|
||||
BSX_RTC.hours = 0;
|
||||
|
||||
|
||||
BSX.test2192[10] = BSX_RTC.seconds;
|
||||
BSX.test2192[11] = BSX_RTC.minutes;
|
||||
BSX.test2192[12] = BSX_RTC.hours;
|
||||
|
||||
|
||||
break;
|
||||
|
||||
|
||||
// Transmission status? (r/w)
|
||||
case 0x2193:
|
||||
// Data ready when bits 2/3 clear?
|
||||
t = BSX.PPU[0x2193] & ~0x0C;
|
||||
break;
|
||||
|
||||
|
||||
// Reset? (r/w)
|
||||
case 0x2194:
|
||||
t = BSX.PPU[0x2194];
|
||||
break;
|
||||
|
||||
|
||||
// Unknown (r)
|
||||
case 0x2196:
|
||||
t = BSX.PPU[0x2196];
|
||||
break;
|
||||
|
||||
|
||||
// Unknown (r/w)
|
||||
case 0x2197:
|
||||
t = BSX.PPU[0x2197];
|
||||
break;
|
||||
|
||||
|
||||
// Modem protocol? (r/w)
|
||||
case 0x2199:
|
||||
t = BSX.PPU[0x2199];
|
||||
break;
|
||||
|
||||
|
||||
default:
|
||||
t = OpenBus;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return t;
|
||||
}
|
||||
|
||||
@ -879,68 +898,68 @@ void S9xSetBSXPPU(uint8 byte, uint16 address)
|
||||
case 0x2188:
|
||||
BSX.PPU[0x2188] = byte;
|
||||
break;
|
||||
|
||||
|
||||
// Test register high? (r/w)
|
||||
case 0x2189:
|
||||
BSX.PPU[0x2189] = byte;
|
||||
break;
|
||||
|
||||
|
||||
case 0x218A:
|
||||
BSX.PPU[0x218A] = byte;
|
||||
break;
|
||||
|
||||
|
||||
case 0x218B:
|
||||
BSX.PPU[0x218B] = byte;
|
||||
break;
|
||||
|
||||
|
||||
case 0x218C:
|
||||
BSX.PPU[0x218C] = byte;
|
||||
break;
|
||||
|
||||
|
||||
// Transmission number low? (r/w)
|
||||
case 0x218E:
|
||||
BSX.PPU[0x218E] = byte;
|
||||
break;
|
||||
|
||||
|
||||
// Transmission number high? (r/w)
|
||||
case 0x218F:
|
||||
BSX.PPU[0x218F] = byte;
|
||||
|
||||
|
||||
// ?
|
||||
BSX.PPU[0x218E] >>= 1;
|
||||
BSX.PPU[0x218E] = BSX.PPU[0x218F] - BSX.PPU[0x218E];
|
||||
BSX.PPU[0x218F] >>= 1;
|
||||
|
||||
|
||||
BSX.PPU[0x2190] = 0x80; // ?
|
||||
break;
|
||||
|
||||
|
||||
// Strobe assert? (w)
|
||||
case 0x2191:
|
||||
BSX.PPU[0x2191] = byte;
|
||||
BSX.out_index = 0;
|
||||
break;
|
||||
|
||||
|
||||
// Data register? (r/w)
|
||||
case 0x2192:
|
||||
BSX.PPU[0x2192] = 0x01; // ?
|
||||
BSX.PPU[0x2190] = 0x80; // ?
|
||||
break;
|
||||
|
||||
|
||||
// Transmission status? (r/w)
|
||||
case 0x2193:
|
||||
BSX.PPU[0x2193] = byte;
|
||||
break;
|
||||
|
||||
|
||||
// Reset? (r/w)
|
||||
case 0x2194:
|
||||
BSX.PPU[0x2194] = byte;
|
||||
break;
|
||||
|
||||
|
||||
// Unknown (r/w)
|
||||
case 0x2197:
|
||||
BSX.PPU[0x2197] = byte;
|
||||
break;
|
||||
|
||||
|
||||
// Modem protocol? (r/w)
|
||||
case 0x2199:
|
||||
// Lots of modem strings written here when
|
||||
@ -951,27 +970,34 @@ void S9xSetBSXPPU(uint8 byte, uint16 address)
|
||||
}
|
||||
}
|
||||
|
||||
uint8 * S9xGetPasePointerBSX(uint32 address)
|
||||
uint8 * S9xGetBasePointerBSX(uint32 address)
|
||||
{
|
||||
return MapROM;
|
||||
}
|
||||
|
||||
static bool8 BSX_LoadBIOS(void)
|
||||
{
|
||||
#ifndef NGC
|
||||
FILE *fp;
|
||||
char path[_MAX_PATH + 1];
|
||||
char path[_MAX_PATH + 1], name[_MAX_PATH + 1];
|
||||
bool8 r = FALSE;
|
||||
|
||||
|
||||
strcpy(path, S9xGetDirectory(BIOS_DIR));
|
||||
strcat(path, SLASH_STR);
|
||||
strcat(path, "BS-X.bios");
|
||||
|
||||
fp = fopen(path, "rb");
|
||||
strcpy(name, path);
|
||||
strcat(name, "BS-X.bin");
|
||||
|
||||
fp = fopen(name, "rb");
|
||||
if (!fp)
|
||||
{
|
||||
strcpy(name, path);
|
||||
strcat(name, "BS-X.bios");
|
||||
fp = fopen(name, "rb");
|
||||
}
|
||||
|
||||
if (fp)
|
||||
{
|
||||
size_t size;
|
||||
|
||||
|
||||
size = fread((void *) BIOSROM, 1, BIOS_SIZE, fp);
|
||||
fclose(fp);
|
||||
if (size == BIOS_SIZE)
|
||||
@ -984,65 +1010,61 @@ static bool8 BSX_LoadBIOS(void)
|
||||
else
|
||||
printf("BS: BIOS not found!\n");
|
||||
#endif
|
||||
|
||||
|
||||
return r;
|
||||
#else
|
||||
return false;
|
||||
#endif
|
||||
|
||||
}
|
||||
|
||||
void S9xInitBSX(void)
|
||||
{
|
||||
Settings.BS = FALSE;
|
||||
|
||||
if (!memcmp(&ROM[0x7FC0], "Satellaview BS-X ", 21))
|
||||
|
||||
if (!memcmp(&Memory.ROM[0x7FC0], "Satellaview BS-X ", 21))
|
||||
{
|
||||
// BS-X itself
|
||||
|
||||
|
||||
Settings.BS = TRUE;
|
||||
Settings.BSXItself = TRUE;
|
||||
|
||||
|
||||
Memory.LoROM = TRUE;
|
||||
Memory.HiROM = FALSE;
|
||||
|
||||
memmove(BIOSROM, ROM, BIOS_SIZE);
|
||||
|
||||
|
||||
memmove(BIOSROM, Memory.ROM, BIOS_SIZE);
|
||||
|
||||
FlashMode = FALSE;
|
||||
FlashSize = FLASH_SIZE;
|
||||
|
||||
|
||||
BSX.bootup = TRUE;
|
||||
}
|
||||
else
|
||||
{
|
||||
Settings.BSXItself = FALSE;
|
||||
|
||||
|
||||
int r1, r2;
|
||||
|
||||
r1 = (is_bsx(ROM + 0x7FC0) == 1);
|
||||
r2 = (is_bsx(ROM + 0xFFC0) == 1);
|
||||
|
||||
r1 = (is_bsx(Memory.ROM + 0x7FC0) == 1);
|
||||
r2 = (is_bsx(Memory.ROM + 0xFFC0) == 1);
|
||||
Settings.BS = (r1 | r2) ? TRUE : FALSE;
|
||||
|
||||
|
||||
if (Settings.BS)
|
||||
{
|
||||
// BS games
|
||||
|
||||
|
||||
Memory.LoROM = r1 ? TRUE : FALSE;
|
||||
Memory.HiROM = r2 ? TRUE : FALSE;
|
||||
|
||||
uint8 *header = r1 ? ROM + 0x7FC0 : ROM + 0xFFC0;
|
||||
|
||||
|
||||
uint8 *header = r1 ? Memory.ROM + 0x7FC0 : Memory.ROM + 0xFFC0;
|
||||
|
||||
FlashMode = (header[0x18] & 0xEF) == 0x20 ? FALSE : TRUE;
|
||||
FlashSize = (header[0x19] & 0x20) ? PSRAM_SIZE : FLASH_SIZE;
|
||||
|
||||
|
||||
#ifdef BSX_DEBUG
|
||||
for (int i = 0; i <= 0x1F; i++)
|
||||
printf("BS: ROM Header %02X: %02X\n", i, header[i]);
|
||||
printf("BS: FlashMode: %d, FlashSize: %x\n", FlashMode, FlashSize);
|
||||
#endif
|
||||
|
||||
|
||||
BSX.bootup = Settings.BSXBootup;
|
||||
|
||||
|
||||
if (!BSX_LoadBIOS())
|
||||
{
|
||||
BSX.bootup = FALSE;
|
||||
@ -1050,18 +1072,18 @@ void S9xInitBSX(void)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (Settings.BS)
|
||||
{
|
||||
MapROM = NULL;
|
||||
FlashROM = ROM;
|
||||
|
||||
FlashROM = Memory.ROM;
|
||||
|
||||
time_t t;
|
||||
struct tm *tmr;
|
||||
|
||||
|
||||
time(&t);
|
||||
tmr = localtime(&t);
|
||||
|
||||
|
||||
BSX_RTC.ticks = 0;
|
||||
memcpy(BSX.test2192, init2192, sizeof(init2192));
|
||||
BSX.test2192[10] = BSX_RTC.seconds = tmr->tm_sec;
|
||||
@ -1077,12 +1099,12 @@ void S9xInitBSX(void)
|
||||
void S9xResetBSX(void)
|
||||
{
|
||||
if (Settings.BSXItself)
|
||||
memset(ROM, 0, FLASH_SIZE);
|
||||
|
||||
memset(Memory.ROM, 0, FLASH_SIZE);
|
||||
|
||||
memset(BSX.PPU, 0, sizeof(BSX.PPU));
|
||||
memset(BSX.MMC, 0, sizeof(BSX.MMC));
|
||||
memset(BSX.prevMMC, 0, sizeof(BSX.prevMMC));
|
||||
|
||||
|
||||
BSX.dirty = FALSE;
|
||||
BSX.dirty2 = FALSE;
|
||||
BSX.flash_enable = FALSE;
|
||||
@ -1091,22 +1113,22 @@ void S9xResetBSX(void)
|
||||
BSX.flash_command = 0;
|
||||
BSX.old_write = 0;
|
||||
BSX.new_write = 0;
|
||||
|
||||
|
||||
BSX.out_index = 0;
|
||||
memset(BSX.output, 0, sizeof(BSX.output));
|
||||
|
||||
|
||||
// starting from the bios
|
||||
if (BSX.bootup)
|
||||
BSX.MMC[0x07] = BSX.MMC[0x08] = 0x80;
|
||||
else
|
||||
{
|
||||
BSX.MMC[0x02] = FlashMode ? 0x80: 0;
|
||||
|
||||
|
||||
// per bios: run from psram or flash card
|
||||
if (FlashSize == PSRAM_SIZE)
|
||||
{
|
||||
memcpy(PSRAM, FlashROM, PSRAM_SIZE);
|
||||
|
||||
|
||||
BSX.MMC[0x01] = 0x80;
|
||||
BSX.MMC[0x03] = 0x80;
|
||||
BSX.MMC[0x04] = 0x80;
|
||||
@ -1119,10 +1141,10 @@ void S9xResetBSX(void)
|
||||
BSX.MMC[0x05] = 0x80;
|
||||
BSX.MMC[0x06] = 0x80;
|
||||
}
|
||||
|
||||
|
||||
BSX.MMC[0x0E] = 0x80;
|
||||
}
|
||||
|
||||
|
||||
BSX_Map();
|
||||
}
|
||||
|
||||
@ -1130,17 +1152,17 @@ void S9xFixBSXAfterSnapshotLoad(void)
|
||||
{
|
||||
uint8 temp[16];
|
||||
bool8 pd1, pd2;
|
||||
|
||||
|
||||
pd1 = BSX.dirty;
|
||||
pd2 = BSX.dirty2;
|
||||
memcpy(temp, BSX.MMC, sizeof(BSX.MMC));
|
||||
|
||||
|
||||
memcpy(BSX.MMC, BSX.prevMMC, sizeof(BSX.MMC));
|
||||
BSX_Map();
|
||||
|
||||
|
||||
memcpy(BSX.MMC, temp, sizeof(BSX.MMC));
|
||||
BSX.dirty = pd1;
|
||||
BSX.dirty2 = pd2;
|
||||
BSX.dirty2 = pd2;
|
||||
}
|
||||
|
||||
static bool valid_normal_bank(unsigned char bankbyte)
|
||||
|
@ -1,7 +1,7 @@
|
||||
/**********************************************************************************
|
||||
Snes9x - Portable Super Nintendo Entertainment System (TM) emulator.
|
||||
|
||||
(c) Copyright 1996 - 2002 Gary Henderson (gary.henderson@ntlworld.com) and
|
||||
(c) Copyright 1996 - 2002 Gary Henderson (gary.henderson@ntlworld.com),
|
||||
Jerremy Koot (jkoot@snes9x.com)
|
||||
|
||||
(c) Copyright 2002 - 2004 Matthew Kendora
|
||||
@ -12,12 +12,16 @@
|
||||
|
||||
(c) Copyright 2001 - 2006 John Weidman (jweidman@slip.net)
|
||||
|
||||
(c) Copyright 2002 - 2006 Brad Jorsch (anomie@users.sourceforge.net),
|
||||
funkyass (funkyass@spam.shaw.ca),
|
||||
Kris Bleakley (codeviolation@hotmail.com),
|
||||
Nach (n-a-c-h@users.sourceforge.net), and
|
||||
(c) Copyright 2002 - 2006 funkyass (funkyass@spam.shaw.ca),
|
||||
Kris Bleakley (codeviolation@hotmail.com)
|
||||
|
||||
(c) Copyright 2002 - 2007 Brad Jorsch (anomie@users.sourceforge.net),
|
||||
Nach (n-a-c-h@users.sourceforge.net),
|
||||
zones (kasumitokoduck@yahoo.com)
|
||||
|
||||
(c) Copyright 2006 - 2007 nitsuja
|
||||
|
||||
|
||||
BS-X C emulator code
|
||||
(c) Copyright 2005 - 2006 Dreamer Nom,
|
||||
zones
|
||||
@ -110,17 +114,30 @@
|
||||
2xSaI filter
|
||||
(c) Copyright 1999 - 2001 Derek Liauw Kie Fa
|
||||
|
||||
HQ2x filter
|
||||
HQ2x, HQ3x, HQ4x filters
|
||||
(c) Copyright 2003 Maxim Stepin (maxim@hiend3d.com)
|
||||
|
||||
Win32 GUI code
|
||||
(c) Copyright 2003 - 2006 blip,
|
||||
funkyass,
|
||||
Matthew Kendora,
|
||||
Nach,
|
||||
nitsuja
|
||||
|
||||
Mac OS GUI code
|
||||
(c) Copyright 1998 - 2001 John Stiles
|
||||
(c) Copyright 2001 - 2007 zones
|
||||
|
||||
|
||||
Specific ports contains the works of other authors. See headers in
|
||||
individual files.
|
||||
|
||||
|
||||
Snes9x homepage: http://www.snes9x.com
|
||||
|
||||
Permission to use, copy, modify and/or distribute Snes9x in both binary
|
||||
and source form, for non-commercial purposes, is hereby granted without
|
||||
fee, providing that this license information and copyright notice appear
|
||||
and source form, for non-commercial purposes, is hereby granted without
|
||||
fee, providing that this license information and copyright notice appear
|
||||
with all copies and any derived work.
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
@ -142,6 +159,8 @@
|
||||
**********************************************************************************/
|
||||
|
||||
|
||||
|
||||
|
||||
#ifndef _BSX_H_
|
||||
#define _BSX_H_
|
||||
|
||||
@ -164,15 +183,17 @@ struct SBSX
|
||||
uint8 test2192[32];
|
||||
};
|
||||
|
||||
START_EXTERN_C
|
||||
extern struct SBSX BSX;
|
||||
|
||||
uint8 S9xGetBSX(uint32);
|
||||
void S9xSetBSX(uint8, uint32);
|
||||
uint8 S9xGetBSXPPU(uint16);
|
||||
void S9xSetBSXPPU(uint8, uint16);
|
||||
uint8 * S9xGetPasePointerBSX(uint32);
|
||||
uint8 * S9xGetBasePointerBSX(uint32);
|
||||
void S9xInitBSX(void);
|
||||
void S9xResetBSX(void);
|
||||
void S9xFixBSXAfterSnapshotLoad(void);
|
||||
END_EXTERN_C
|
||||
|
||||
#endif
|
||||
|
@ -1,7 +1,7 @@
|
||||
/**********************************************************************************
|
||||
Snes9x - Portable Super Nintendo Entertainment System (TM) emulator.
|
||||
|
||||
(c) Copyright 1996 - 2002 Gary Henderson (gary.henderson@ntlworld.com) and
|
||||
(c) Copyright 1996 - 2002 Gary Henderson (gary.henderson@ntlworld.com),
|
||||
Jerremy Koot (jkoot@snes9x.com)
|
||||
|
||||
(c) Copyright 2002 - 2004 Matthew Kendora
|
||||
@ -12,12 +12,16 @@
|
||||
|
||||
(c) Copyright 2001 - 2006 John Weidman (jweidman@slip.net)
|
||||
|
||||
(c) Copyright 2002 - 2006 Brad Jorsch (anomie@users.sourceforge.net),
|
||||
funkyass (funkyass@spam.shaw.ca),
|
||||
Kris Bleakley (codeviolation@hotmail.com),
|
||||
Nach (n-a-c-h@users.sourceforge.net), and
|
||||
(c) Copyright 2002 - 2006 funkyass (funkyass@spam.shaw.ca),
|
||||
Kris Bleakley (codeviolation@hotmail.com)
|
||||
|
||||
(c) Copyright 2002 - 2007 Brad Jorsch (anomie@users.sourceforge.net),
|
||||
Nach (n-a-c-h@users.sourceforge.net),
|
||||
zones (kasumitokoduck@yahoo.com)
|
||||
|
||||
(c) Copyright 2006 - 2007 nitsuja
|
||||
|
||||
|
||||
BS-X C emulator code
|
||||
(c) Copyright 2005 - 2006 Dreamer Nom,
|
||||
zones
|
||||
@ -110,17 +114,30 @@
|
||||
2xSaI filter
|
||||
(c) Copyright 1999 - 2001 Derek Liauw Kie Fa
|
||||
|
||||
HQ2x filter
|
||||
HQ2x, HQ3x, HQ4x filters
|
||||
(c) Copyright 2003 Maxim Stepin (maxim@hiend3d.com)
|
||||
|
||||
Win32 GUI code
|
||||
(c) Copyright 2003 - 2006 blip,
|
||||
funkyass,
|
||||
Matthew Kendora,
|
||||
Nach,
|
||||
nitsuja
|
||||
|
||||
Mac OS GUI code
|
||||
(c) Copyright 1998 - 2001 John Stiles
|
||||
(c) Copyright 2001 - 2007 zones
|
||||
|
||||
|
||||
Specific ports contains the works of other authors. See headers in
|
||||
individual files.
|
||||
|
||||
|
||||
Snes9x homepage: http://www.snes9x.com
|
||||
|
||||
Permission to use, copy, modify and/or distribute Snes9x in both binary
|
||||
and source form, for non-commercial purposes, is hereby granted without
|
||||
fee, providing that this license information and copyright notice appear
|
||||
and source form, for non-commercial purposes, is hereby granted without
|
||||
fee, providing that this license information and copyright notice appear
|
||||
with all copies and any derived work.
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
@ -141,6 +158,8 @@
|
||||
Nintendo Co., Limited and its subsidiary companies.
|
||||
**********************************************************************************/
|
||||
|
||||
|
||||
|
||||
#include <math.h>
|
||||
#include <stdlib.h>
|
||||
#include "c4.h"
|
||||
@ -164,22 +183,22 @@ void C4TransfWireFrame ()
|
||||
c4x = (double) C4WFXVal;
|
||||
c4y = (double) C4WFYVal;
|
||||
c4z = (double) C4WFZVal - 0x95;
|
||||
|
||||
|
||||
// Rotate X
|
||||
tanval = -(double) C4WFX2Val * 3.14159265 * 2 / 128;
|
||||
c4y2 = c4y * cos (tanval) - c4z * sin (tanval);
|
||||
c4z2 = c4y * sin (tanval) + c4z * cos (tanval);
|
||||
|
||||
|
||||
// Rotate Y
|
||||
tanval = -(double)C4WFY2Val*3.14159265*2/128;
|
||||
c4x2 = c4x * cos (tanval) + c4z2 * sin (tanval);
|
||||
c4z = c4x * - sin (tanval) + c4z2 * cos (tanval);
|
||||
|
||||
|
||||
// Rotate Z
|
||||
tanval = -(double) C4WFDist * 3.14159265*2 / 128;
|
||||
c4x = c4x2 * cos (tanval) - c4y2 * sin (tanval);
|
||||
c4y = c4x2 * sin (tanval) + c4y2 * cos (tanval);
|
||||
|
||||
|
||||
// Scale
|
||||
C4WFXVal = (short) (c4x*(double)C4WFScale/(0x90*(c4z+0x95))*0x95);
|
||||
C4WFYVal = (short) (c4y*(double)C4WFScale/(0x90*(c4z+0x95))*0x95);
|
||||
@ -190,22 +209,22 @@ void C4TransfWireFrame2 ()
|
||||
c4x = (double)C4WFXVal;
|
||||
c4y = (double)C4WFYVal;
|
||||
c4z = (double)C4WFZVal;
|
||||
|
||||
|
||||
// Rotate X
|
||||
tanval = -(double) C4WFX2Val * 3.14159265 * 2 / 128;
|
||||
c4y2 = c4y * cos (tanval) - c4z * sin (tanval);
|
||||
c4z2 = c4y * sin (tanval) + c4z * cos (tanval);
|
||||
|
||||
|
||||
// Rotate Y
|
||||
tanval = -(double) C4WFY2Val * 3.14159265 * 2 / 128;
|
||||
c4x2 = c4x * cos (tanval) + c4z2 * sin (tanval);
|
||||
c4z = c4x * -sin (tanval) + c4z2 * cos (tanval);
|
||||
|
||||
|
||||
// Rotate Z
|
||||
tanval = -(double)C4WFDist * 3.14159265 * 2 / 128;
|
||||
c4x = c4x2 * cos (tanval) - c4y2 * sin (tanval);
|
||||
c4y = c4x2 * sin (tanval) + c4y2 * cos (tanval);
|
||||
|
||||
|
||||
// Scale
|
||||
C4WFXVal =(short)(c4x * (double)C4WFScale / 0x100);
|
||||
C4WFYVal =(short)(c4y * (double)C4WFScale / 0x100);
|
||||
@ -221,21 +240,21 @@ void C4CalcWireFrame ()
|
||||
C4WFYVal = (short) (256 * (double) C4WFYVal / abs (C4WFXVal));
|
||||
if (C4WFXVal < 0)
|
||||
C4WFXVal = -256;
|
||||
else
|
||||
else
|
||||
C4WFXVal = 256;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (C4WFYVal != 0)
|
||||
if (C4WFYVal != 0)
|
||||
{
|
||||
C4WFDist = abs(C4WFYVal)+1;
|
||||
C4WFXVal = (short) (256 * (double)C4WFXVal / abs (C4WFYVal));
|
||||
if (C4WFYVal < 0)
|
||||
C4WFYVal = -256;
|
||||
else
|
||||
else
|
||||
C4WFYVal = 256;
|
||||
}
|
||||
else
|
||||
else
|
||||
C4WFDist = 0;
|
||||
}
|
||||
}
|
||||
@ -248,19 +267,19 @@ short C41FDistVal;
|
||||
|
||||
void C4Op1F ()
|
||||
{
|
||||
if (C41FXVal == 0)
|
||||
if (C41FXVal == 0)
|
||||
{
|
||||
if (C41FYVal > 0)
|
||||
if (C41FYVal > 0)
|
||||
C41FAngleRes = 0x80;
|
||||
else
|
||||
else
|
||||
C41FAngleRes = 0x180;
|
||||
}
|
||||
else
|
||||
else
|
||||
{
|
||||
tanval = (double) C41FYVal / C41FXVal;
|
||||
C41FAngleRes = (short) (atan (tanval) / (3.141592675 * 2) * 512);
|
||||
C41FAngleRes = C41FAngleRes;
|
||||
if (C41FXVal< 0)
|
||||
if (C41FXVal< 0)
|
||||
C41FAngleRes += 0x100;
|
||||
C41FAngleRes &= 0x1FF;
|
||||
}
|
||||
@ -283,7 +302,7 @@ void C4Op0D()
|
||||
#ifdef ZSNES_C4
|
||||
EXTERN_C void C4LoaDMem(char *C4RAM)
|
||||
{
|
||||
memmove(C4RAM+(READ_WORD(C4RAM+0x1f45)&0x1fff),
|
||||
memmove(C4RAM+(READ_WORD(C4RAM+0x1f45)&0x1fff),
|
||||
C4GetMemPointer(READ_3WORD(C4RAM+0x1f40)),
|
||||
READ_WORD(C4RAM+0x1f43));
|
||||
}
|
||||
|
@ -1,7 +1,7 @@
|
||||
/**********************************************************************************
|
||||
Snes9x - Portable Super Nintendo Entertainment System (TM) emulator.
|
||||
|
||||
(c) Copyright 1996 - 2002 Gary Henderson (gary.henderson@ntlworld.com) and
|
||||
(c) Copyright 1996 - 2002 Gary Henderson (gary.henderson@ntlworld.com),
|
||||
Jerremy Koot (jkoot@snes9x.com)
|
||||
|
||||
(c) Copyright 2002 - 2004 Matthew Kendora
|
||||
@ -12,12 +12,16 @@
|
||||
|
||||
(c) Copyright 2001 - 2006 John Weidman (jweidman@slip.net)
|
||||
|
||||
(c) Copyright 2002 - 2006 Brad Jorsch (anomie@users.sourceforge.net),
|
||||
funkyass (funkyass@spam.shaw.ca),
|
||||
Kris Bleakley (codeviolation@hotmail.com),
|
||||
Nach (n-a-c-h@users.sourceforge.net), and
|
||||
(c) Copyright 2002 - 2006 funkyass (funkyass@spam.shaw.ca),
|
||||
Kris Bleakley (codeviolation@hotmail.com)
|
||||
|
||||
(c) Copyright 2002 - 2007 Brad Jorsch (anomie@users.sourceforge.net),
|
||||
Nach (n-a-c-h@users.sourceforge.net),
|
||||
zones (kasumitokoduck@yahoo.com)
|
||||
|
||||
(c) Copyright 2006 - 2007 nitsuja
|
||||
|
||||
|
||||
BS-X C emulator code
|
||||
(c) Copyright 2005 - 2006 Dreamer Nom,
|
||||
zones
|
||||
@ -110,17 +114,30 @@
|
||||
2xSaI filter
|
||||
(c) Copyright 1999 - 2001 Derek Liauw Kie Fa
|
||||
|
||||
HQ2x filter
|
||||
HQ2x, HQ3x, HQ4x filters
|
||||
(c) Copyright 2003 Maxim Stepin (maxim@hiend3d.com)
|
||||
|
||||
Win32 GUI code
|
||||
(c) Copyright 2003 - 2006 blip,
|
||||
funkyass,
|
||||
Matthew Kendora,
|
||||
Nach,
|
||||
nitsuja
|
||||
|
||||
Mac OS GUI code
|
||||
(c) Copyright 1998 - 2001 John Stiles
|
||||
(c) Copyright 2001 - 2007 zones
|
||||
|
||||
|
||||
Specific ports contains the works of other authors. See headers in
|
||||
individual files.
|
||||
|
||||
|
||||
Snes9x homepage: http://www.snes9x.com
|
||||
|
||||
Permission to use, copy, modify and/or distribute Snes9x in both binary
|
||||
and source form, for non-commercial purposes, is hereby granted without
|
||||
fee, providing that this license information and copyright notice appear
|
||||
and source form, for non-commercial purposes, is hereby granted without
|
||||
fee, providing that this license information and copyright notice appear
|
||||
with all copies and any derived work.
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
@ -141,6 +158,8 @@
|
||||
Nintendo Co., Limited and its subsidiary companies.
|
||||
**********************************************************************************/
|
||||
|
||||
|
||||
|
||||
#ifndef _C4_H_
|
||||
#define _C4_H_
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
/**********************************************************************************
|
||||
Snes9x - Portable Super Nintendo Entertainment System (TM) emulator.
|
||||
|
||||
(c) Copyright 1996 - 2002 Gary Henderson (gary.henderson@ntlworld.com) and
|
||||
(c) Copyright 1996 - 2002 Gary Henderson (gary.henderson@ntlworld.com),
|
||||
Jerremy Koot (jkoot@snes9x.com)
|
||||
|
||||
(c) Copyright 2002 - 2004 Matthew Kendora
|
||||
@ -12,12 +12,16 @@
|
||||
|
||||
(c) Copyright 2001 - 2006 John Weidman (jweidman@slip.net)
|
||||
|
||||
(c) Copyright 2002 - 2006 Brad Jorsch (anomie@users.sourceforge.net),
|
||||
funkyass (funkyass@spam.shaw.ca),
|
||||
Kris Bleakley (codeviolation@hotmail.com),
|
||||
Nach (n-a-c-h@users.sourceforge.net), and
|
||||
(c) Copyright 2002 - 2006 funkyass (funkyass@spam.shaw.ca),
|
||||
Kris Bleakley (codeviolation@hotmail.com)
|
||||
|
||||
(c) Copyright 2002 - 2007 Brad Jorsch (anomie@users.sourceforge.net),
|
||||
Nach (n-a-c-h@users.sourceforge.net),
|
||||
zones (kasumitokoduck@yahoo.com)
|
||||
|
||||
(c) Copyright 2006 - 2007 nitsuja
|
||||
|
||||
|
||||
BS-X C emulator code
|
||||
(c) Copyright 2005 - 2006 Dreamer Nom,
|
||||
zones
|
||||
@ -110,17 +114,30 @@
|
||||
2xSaI filter
|
||||
(c) Copyright 1999 - 2001 Derek Liauw Kie Fa
|
||||
|
||||
HQ2x filter
|
||||
HQ2x, HQ3x, HQ4x filters
|
||||
(c) Copyright 2003 Maxim Stepin (maxim@hiend3d.com)
|
||||
|
||||
Win32 GUI code
|
||||
(c) Copyright 2003 - 2006 blip,
|
||||
funkyass,
|
||||
Matthew Kendora,
|
||||
Nach,
|
||||
nitsuja
|
||||
|
||||
Mac OS GUI code
|
||||
(c) Copyright 1998 - 2001 John Stiles
|
||||
(c) Copyright 2001 - 2007 zones
|
||||
|
||||
|
||||
Specific ports contains the works of other authors. See headers in
|
||||
individual files.
|
||||
|
||||
|
||||
Snes9x homepage: http://www.snes9x.com
|
||||
|
||||
Permission to use, copy, modify and/or distribute Snes9x in both binary
|
||||
and source form, for non-commercial purposes, is hereby granted without
|
||||
fee, providing that this license information and copyright notice appear
|
||||
and source form, for non-commercial purposes, is hereby granted without
|
||||
fee, providing that this license information and copyright notice appear
|
||||
with all copies and any derived work.
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
@ -141,6 +158,9 @@
|
||||
Nintendo Co., Limited and its subsidiary companies.
|
||||
**********************************************************************************/
|
||||
|
||||
|
||||
|
||||
#ifndef ZSNES_C4
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include <config.h>
|
||||
#endif
|
||||
@ -194,7 +214,7 @@ static void C4ConvOAM(void){
|
||||
int16 SprX, SprY;
|
||||
uint8 SprName, SprAttr;
|
||||
uint8 SprCount;
|
||||
|
||||
|
||||
globalX=READ_WORD(Memory.C4RAM+0x0621);
|
||||
globalY=READ_WORD(Memory.C4RAM+0x0623);
|
||||
OAMptr2=Memory.C4RAM+0x200+(Memory.C4RAM[0x626]>>2);
|
||||
@ -208,62 +228,59 @@ static void C4ConvOAM(void){
|
||||
if(Memory.C4RAM[0x0620]!=0){
|
||||
SprCount=128-Memory.C4RAM[0x626];
|
||||
uint8 offset=(Memory.C4RAM[0x626]&3)*2;
|
||||
for(int prio=0x30; prio>=0; prio-=0x10){
|
||||
uint8 *srcptr=Memory.C4RAM+0x220;
|
||||
for(int i=Memory.C4RAM[0x0620]; i>0 && SprCount>0; i--, srcptr+=16){
|
||||
if((srcptr[4]&0x30)!=prio) continue;
|
||||
SprX=READ_WORD(srcptr)-globalX;
|
||||
SprY=READ_WORD(srcptr+2)-globalY;
|
||||
SprName=srcptr[5];
|
||||
SprAttr=srcptr[4] | srcptr[0x06]; // XXX: mask bits?
|
||||
uint8 *srcptr=Memory.C4RAM+0x220;
|
||||
for(int i=Memory.C4RAM[0x0620]; i>0 && SprCount>0; i--, srcptr+=16){
|
||||
SprX=READ_WORD(srcptr)-globalX;
|
||||
SprY=READ_WORD(srcptr+2)-globalY;
|
||||
SprName=srcptr[5];
|
||||
SprAttr=srcptr[4] | srcptr[0x06]; // XXX: mask bits?
|
||||
|
||||
uint8 *sprptr=C4GetMemPointer(READ_3WORD(srcptr+7));
|
||||
if(*sprptr!=0){
|
||||
int16 X, Y;
|
||||
for(int SprCnt=*sprptr++; SprCnt>0 && SprCount>0; SprCnt--, sprptr+=4){
|
||||
X=(int8)sprptr[1];
|
||||
if(SprAttr&0x40){ // flip X
|
||||
X=-X-((sprptr[0]&0x20)?16:8);
|
||||
uint8 *sprptr=C4GetMemPointer(READ_3WORD(srcptr+7));
|
||||
if(*sprptr!=0){
|
||||
int16 X, Y;
|
||||
for(int SprCnt=*sprptr++; SprCnt>0 && SprCount>0; SprCnt--, sprptr+=4){
|
||||
X=(int8)sprptr[1];
|
||||
if(SprAttr&0x40){ // flip X
|
||||
X=-X-((sprptr[0]&0x20)?16:8);
|
||||
}
|
||||
X+=SprX;
|
||||
if(X>=-16 && X<=272){
|
||||
Y=(int8)sprptr[2];
|
||||
if(SprAttr&0x80){
|
||||
Y=-Y-((sprptr[0]&0x20)?16:8);
|
||||
}
|
||||
X+=SprX;
|
||||
if(X>=-16 && X<=272){
|
||||
Y=(int8)sprptr[2];
|
||||
if(SprAttr&0x80){
|
||||
Y=-Y-((sprptr[0]&0x20)?16:8);
|
||||
}
|
||||
Y+=SprY;
|
||||
if(Y>=-16 && Y<=224){
|
||||
OAMptr[0]=X&0xff;
|
||||
OAMptr[1]=(uint8)Y;
|
||||
OAMptr[2]=SprName+sprptr[3];
|
||||
OAMptr[3]=SprAttr^(sprptr[0]&0xc0); // XXX: Carry from SprName addition?
|
||||
*OAMptr2 &= ~(3<<offset);
|
||||
if(X&0x100) *OAMptr2 |= 1<<offset;
|
||||
if(sprptr[0]&0x20) *OAMptr2 |= 2<<offset;
|
||||
OAMptr+=4;
|
||||
SprCount--;
|
||||
offset=(offset+2)&6;
|
||||
if(offset==0) OAMptr2++;
|
||||
}
|
||||
Y+=SprY;
|
||||
if(Y>=-16 && Y<=224){
|
||||
OAMptr[0]=X&0xff;
|
||||
OAMptr[1]=(uint8)Y;
|
||||
OAMptr[2]=SprName+sprptr[3];
|
||||
OAMptr[3]=SprAttr^(sprptr[0]&0xc0); // XXX: Carry from SprName addition?
|
||||
*OAMptr2 &= ~(3<<offset);
|
||||
if(X&0x100) *OAMptr2 |= 1<<offset;
|
||||
if(sprptr[0]&0x20) *OAMptr2 |= 2<<offset;
|
||||
OAMptr+=4;
|
||||
SprCount--;
|
||||
offset=(offset+2)&6;
|
||||
if(offset==0) OAMptr2++;
|
||||
}
|
||||
}
|
||||
} else if(SprCount>0){
|
||||
OAMptr[0]=(uint8)SprX;
|
||||
OAMptr[1]=(uint8)SprY;
|
||||
OAMptr[2]=SprName;
|
||||
OAMptr[3]=SprAttr;
|
||||
*OAMptr2 &= ~(3<<offset);
|
||||
if(SprX&0x100) *OAMptr2 |= 3<<offset;
|
||||
else *OAMptr2 |= 2<<offset;
|
||||
OAMptr+=4;
|
||||
SprCount--;
|
||||
offset=(offset+2)&6;
|
||||
if(offset==0) OAMptr2++;
|
||||
}
|
||||
} else if(SprCount>0){
|
||||
// XXX: Should we be testing -16<=SprX<=272 and -16<=SprY<=224?
|
||||
OAMptr[0]=(uint8)SprX;
|
||||
OAMptr[1]=(uint8)SprY;
|
||||
OAMptr[2]=SprName;
|
||||
OAMptr[3]=SprAttr;
|
||||
*OAMptr2 &= ~(3<<offset);
|
||||
if(SprX&0x100) *OAMptr2 |= 3<<offset;
|
||||
else *OAMptr2 |= 2<<offset;
|
||||
OAMptr+=4;
|
||||
SprCount--;
|
||||
offset=(offset+2)&6;
|
||||
if(offset==0) OAMptr2++;
|
||||
}
|
||||
}
|
||||
}
|
||||
// XXX: Copy to OAM? I doubt it.
|
||||
}
|
||||
|
||||
static void C4DoScaleRotate(int row_padding){
|
||||
@ -334,7 +351,7 @@ static void C4DoScaleRotate(int row_padding){
|
||||
// already have the fractional parts.
|
||||
int32 LineX=(Cx<<12) - Cx*A - Cx*B;
|
||||
int32 LineY=(Cy<<12) - Cy*C - Cy*D;
|
||||
|
||||
|
||||
// Start loop
|
||||
uint32 X, Y;
|
||||
uint8 byte;
|
||||
@ -363,7 +380,7 @@ static void C4DoScaleRotate(int row_padding){
|
||||
bit=0x80;
|
||||
outidx+=32;
|
||||
}
|
||||
|
||||
|
||||
X+=A; // Add 1 to output x => add an A and a C
|
||||
Y+=C;
|
||||
}
|
||||
@ -516,7 +533,7 @@ static void C4BitPlaneWave(){
|
||||
0x0600, 0x0602, 0x0604, 0x0606, 0x0608, 0x060A, 0x060C, 0x060E,
|
||||
0x0800, 0x0802, 0x0804, 0x0806, 0x0808, 0x080A, 0x080C, 0x080E
|
||||
};
|
||||
|
||||
|
||||
uint8 *dst=Memory.C4RAM;
|
||||
uint32 waveptr=Memory.C4RAM[0x1f83];
|
||||
uint16 mask1=0xc0c0;
|
||||
@ -585,7 +602,7 @@ static void C4SprDisintegrate()
|
||||
#ifdef DEBUGGER
|
||||
if((Cx&~1)!=width/2 || (Cy&~1)!=height/2) printf("Center is not middle of image for disintegrate! (%d, %d) != (%d, %d)\n", Cx, Cy, width/2, height/2);
|
||||
#endif
|
||||
|
||||
|
||||
scaleX=(int16)READ_WORD(Memory.C4RAM+0x1f86);
|
||||
scaleY=(int16)READ_WORD(Memory.C4RAM+0x1f8f);
|
||||
StartX=-Cx*scaleX+(Cx<<8);
|
||||
@ -593,7 +610,7 @@ static void C4SprDisintegrate()
|
||||
src=Memory.C4RAM+0x600;
|
||||
|
||||
memset(Memory.C4RAM, 0, width*height/2);
|
||||
|
||||
|
||||
for(uint32 y=StartY, i=0; i<height; i++, y+=scaleY)
|
||||
{
|
||||
for(uint32 x=StartX, j=0; j<width; j++, x+=scaleX)
|
||||
@ -665,7 +682,7 @@ static void S9xC4ProcessSprites()
|
||||
#endif
|
||||
C4BitPlaneWave();
|
||||
break;
|
||||
|
||||
|
||||
default:
|
||||
#ifdef DEBUGGER
|
||||
printf ("Unknown C4 sprite command (%02x)\n", Memory.C4RAM [0x1f4d]);
|
||||
@ -679,7 +696,7 @@ void S9xSetC4 (uint8 byte, uint16 Address)
|
||||
int i;
|
||||
|
||||
Memory.C4RAM [Address-0x6000] = byte;
|
||||
if (Address == 0x7f4f)
|
||||
if (Address == 0x7f4f)
|
||||
{
|
||||
if(Memory.C4RAM[0x1f4d]==0x0e && byte<0x40 && (byte&3)==0)
|
||||
{
|
||||
@ -765,6 +782,7 @@ void S9xSetC4 (uint8 byte, uint16 Address)
|
||||
#endif
|
||||
C41FXVal=READ_WORD(Memory.C4RAM+0x1f80);
|
||||
C41FYVal=READ_WORD(Memory.C4RAM+0x1f83);
|
||||
//C4Op15(); // optimized to:
|
||||
C41FDist=(int16)sqrt((double)C41FXVal*C41FXVal + (double)C41FYVal*C41FYVal);
|
||||
WRITE_WORD(Memory.C4RAM+0x1f80, C41FDist);
|
||||
break;
|
||||
@ -801,10 +819,10 @@ void S9xSetC4 (uint8 byte, uint16 Address)
|
||||
if(y>=0)
|
||||
{
|
||||
left = SAR((int32)tan1*y, 16) -
|
||||
READ_WORD(Memory.C4RAM+0x1f80) +
|
||||
READ_WORD(Memory.C4RAM+0x1f80) +
|
||||
READ_WORD(Memory.C4RAM+0x1f86);
|
||||
right = SAR((int32)tan2*y, 16) -
|
||||
READ_WORD(Memory.C4RAM+0x1f80) +
|
||||
READ_WORD(Memory.C4RAM+0x1f80) +
|
||||
READ_WORD(Memory.C4RAM+0x1f86) +
|
||||
READ_WORD(Memory.C4RAM+0x1f93);
|
||||
|
||||
@ -842,7 +860,7 @@ void S9xSetC4 (uint8 byte, uint16 Address)
|
||||
printf("25 Multiply!\n");
|
||||
if(Memory.C4RAM[0x1f4d]!=2) printf("$7f4d=%02x, expected 02 for command 25 %02x\n", Memory.C4RAM[0x1f4d], Memory.C4RAM[0x1f4d]);
|
||||
#endif
|
||||
{
|
||||
{
|
||||
int32 foo=READ_3WORD(Memory.C4RAM+0x1f80);
|
||||
int32 bar=READ_3WORD(Memory.C4RAM+0x1f83);
|
||||
foo*=bar;
|
||||
@ -928,7 +946,7 @@ void S9xSetC4 (uint8 byte, uint16 Address)
|
||||
if(byte != 0) printf("C4 load: non-0 written to $7f47! Wrote %02x\n", byte);
|
||||
if(READ_WORD(Memory.C4RAM+0x1f45) < 0x6000 || (READ_WORD(Memory.C4RAM+0x1f45) + READ_WORD(Memory.C4RAM+0x1f43)) > 0x6c00) printf("C4 load: Dest unusual! It's %04x\n", READ_WORD(Memory.C4RAM+0x1f45));
|
||||
#endif
|
||||
memmove(Memory.C4RAM+(READ_WORD(Memory.C4RAM+0x1f45)&0x1fff),
|
||||
memmove(Memory.C4RAM+(READ_WORD(Memory.C4RAM+0x1f45)&0x1fff),
|
||||
C4GetMemPointer(READ_3WORD(Memory.C4RAM+0x1f40)),
|
||||
READ_WORD(Memory.C4RAM+0x1f43));
|
||||
}
|
||||
@ -1067,4 +1085,4 @@ int16 C4CosTable[512] = {
|
||||
32138, 32214, 32285, 32351, 32413, 32469, 32521, 32568,
|
||||
32610, 32647, 32679, 32706, 32728, 32745, 32758, 32765
|
||||
};
|
||||
|
||||
#endif
|
||||
|
@ -1,7 +1,7 @@
|
||||
/**********************************************************************************
|
||||
Snes9x - Portable Super Nintendo Entertainment System (TM) emulator.
|
||||
|
||||
(c) Copyright 1996 - 2002 Gary Henderson (gary.henderson@ntlworld.com) and
|
||||
(c) Copyright 1996 - 2002 Gary Henderson (gary.henderson@ntlworld.com),
|
||||
Jerremy Koot (jkoot@snes9x.com)
|
||||
|
||||
(c) Copyright 2002 - 2004 Matthew Kendora
|
||||
@ -12,12 +12,16 @@
|
||||
|
||||
(c) Copyright 2001 - 2006 John Weidman (jweidman@slip.net)
|
||||
|
||||
(c) Copyright 2002 - 2006 Brad Jorsch (anomie@users.sourceforge.net),
|
||||
funkyass (funkyass@spam.shaw.ca),
|
||||
Kris Bleakley (codeviolation@hotmail.com),
|
||||
Nach (n-a-c-h@users.sourceforge.net), and
|
||||
(c) Copyright 2002 - 2006 funkyass (funkyass@spam.shaw.ca),
|
||||
Kris Bleakley (codeviolation@hotmail.com)
|
||||
|
||||
(c) Copyright 2002 - 2007 Brad Jorsch (anomie@users.sourceforge.net),
|
||||
Nach (n-a-c-h@users.sourceforge.net),
|
||||
zones (kasumitokoduck@yahoo.com)
|
||||
|
||||
(c) Copyright 2006 - 2007 nitsuja
|
||||
|
||||
|
||||
BS-X C emulator code
|
||||
(c) Copyright 2005 - 2006 Dreamer Nom,
|
||||
zones
|
||||
@ -110,17 +114,30 @@
|
||||
2xSaI filter
|
||||
(c) Copyright 1999 - 2001 Derek Liauw Kie Fa
|
||||
|
||||
HQ2x filter
|
||||
HQ2x, HQ3x, HQ4x filters
|
||||
(c) Copyright 2003 Maxim Stepin (maxim@hiend3d.com)
|
||||
|
||||
Win32 GUI code
|
||||
(c) Copyright 2003 - 2006 blip,
|
||||
funkyass,
|
||||
Matthew Kendora,
|
||||
Nach,
|
||||
nitsuja
|
||||
|
||||
Mac OS GUI code
|
||||
(c) Copyright 1998 - 2001 John Stiles
|
||||
(c) Copyright 2001 - 2007 zones
|
||||
|
||||
|
||||
Specific ports contains the works of other authors. See headers in
|
||||
individual files.
|
||||
|
||||
|
||||
Snes9x homepage: http://www.snes9x.com
|
||||
|
||||
Permission to use, copy, modify and/or distribute Snes9x in both binary
|
||||
and source form, for non-commercial purposes, is hereby granted without
|
||||
fee, providing that this license information and copyright notice appear
|
||||
and source form, for non-commercial purposes, is hereby granted without
|
||||
fee, providing that this license information and copyright notice appear
|
||||
with all copies and any derived work.
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
@ -141,6 +158,8 @@
|
||||
Nintendo Co., Limited and its subsidiary companies.
|
||||
**********************************************************************************/
|
||||
|
||||
|
||||
|
||||
#include <stdio.h>
|
||||
#include <ctype.h>
|
||||
#include <string.h>
|
||||
@ -201,7 +220,7 @@ const char *S9xGoldFingerToRaw (const char *code, uint32 &address, bool8 &sram,
|
||||
const char *S9xGameGenieToRaw (const char *code, uint32 &address, uint8 &byte)
|
||||
{
|
||||
char new_code [12];
|
||||
|
||||
|
||||
if (strlen (code) != 9 || *(code + 4) != '-' || !S9xAllHex (code, 4) ||
|
||||
!S9xAllHex (code + 5, 4))
|
||||
return ("Invalid Game Genie(tm) code - should be 'xxxx-xxxx'.");
|
||||
@ -212,7 +231,7 @@ const char *S9xGameGenieToRaw (const char *code, uint32 &address, uint8 &byte)
|
||||
|
||||
static char *real_hex = "0123456789ABCDEF";
|
||||
static char *genie_hex = "DF4709156BC8A23E";
|
||||
|
||||
|
||||
for (int i = 2; i < 10; i++)
|
||||
{
|
||||
if (islower (new_code [i]))
|
||||
@ -249,9 +268,7 @@ void S9xStartCheatSearch (SCheatData *d)
|
||||
memmove (d->CWRAM, d->RAM, 0x20000);
|
||||
memmove (d->CSRAM, d->SRAM, 0x10000);
|
||||
memmove (d->CIRAM, &d->FillRAM [0x3000], 0x2000);
|
||||
memset ((char *) d->WRAM_BITS, 0xff, 0x20000 >> 3);
|
||||
memset ((char *) d->SRAM_BITS, 0xff, 0x10000 >> 3);
|
||||
memset ((char *) d->IRAM_BITS, 0xff, 0x2000 >> 3);
|
||||
memset ((char *) d->ALL_BITS, 0xff, 0x32000 >> 3);
|
||||
}
|
||||
|
||||
#define BIT_CLEAR(a,v) \
|
||||
@ -287,7 +304,7 @@ void S9xStartCheatSearch (SCheatData *d)
|
||||
(s) == S9X_24_BITS ? (((int32) ((*((m) + (o)) + (*((m) + (o) + 1) << 8) + (*((m) + (o) + 2) << 16)) << 8)) >> 8): \
|
||||
((int32) (*((m) + (o)) + (*((m) + (o) + 1) << 8) + (*((m) + (o) + 2) << 16) + (*((m) + (o) + 3) << 24))))
|
||||
|
||||
void S9xSearchForChange (SCheatData *d, S9xCheatComparisonType cmp,
|
||||
void S9xSearchForChange (SCheatData *d, S9xCheatComparisonType cmp,
|
||||
S9xCheatDataSize size, bool8 is_signed, bool8 update)
|
||||
{
|
||||
int l;
|
||||
@ -315,7 +332,7 @@ void S9xSearchForChange (SCheatData *d, S9xCheatComparisonType cmp,
|
||||
else
|
||||
BIT_CLEAR (d->WRAM_BITS, i);
|
||||
}
|
||||
|
||||
|
||||
for (i = 0; i < 0x10000 - l; i++)
|
||||
{
|
||||
if (TEST_BIT (d->SRAM_BITS, i) &&
|
||||
@ -327,7 +344,7 @@ void S9xSearchForChange (SCheatData *d, S9xCheatComparisonType cmp,
|
||||
else
|
||||
BIT_CLEAR (d->SRAM_BITS, i);
|
||||
}
|
||||
|
||||
|
||||
for (i = 0; i < 0x2000 - l; i++)
|
||||
{
|
||||
if (TEST_BIT (d->IRAM_BITS, i) &&
|
||||
@ -353,7 +370,7 @@ void S9xSearchForChange (SCheatData *d, S9xCheatComparisonType cmp,
|
||||
else
|
||||
BIT_CLEAR (d->WRAM_BITS, i);
|
||||
}
|
||||
|
||||
|
||||
for (i = 0; i < 0x10000 - l; i++)
|
||||
{
|
||||
if (TEST_BIT (d->SRAM_BITS, i) &&
|
||||
@ -365,7 +382,7 @@ void S9xSearchForChange (SCheatData *d, S9xCheatComparisonType cmp,
|
||||
else
|
||||
BIT_CLEAR (d->SRAM_BITS, i);
|
||||
}
|
||||
|
||||
|
||||
for (i = 0; i < 0x2000 - l; i++)
|
||||
{
|
||||
if (TEST_BIT (d->IRAM_BITS, i) &&
|
||||
@ -378,10 +395,14 @@ void S9xSearchForChange (SCheatData *d, S9xCheatComparisonType cmp,
|
||||
BIT_CLEAR (d->IRAM_BITS, i);
|
||||
}
|
||||
}
|
||||
for (i = 0x20000 - l; i < 0x20000; i++)
|
||||
BIT_CLEAR (d->WRAM_BITS, i);
|
||||
for (i = 0x10000 - l; i < 0x10000; i++)
|
||||
BIT_CLEAR (d->SRAM_BITS, i);
|
||||
}
|
||||
|
||||
void S9xSearchForValue (SCheatData *d, S9xCheatComparisonType cmp,
|
||||
S9xCheatDataSize size, uint32 value,
|
||||
void S9xSearchForValue (SCheatData *d, S9xCheatComparisonType cmp,
|
||||
S9xCheatDataSize size, uint32 value,
|
||||
bool8 is_signed, bool8 update)
|
||||
{
|
||||
int l;
|
||||
@ -410,7 +431,7 @@ void S9xSearchForValue (SCheatData *d, S9xCheatComparisonType cmp,
|
||||
else
|
||||
BIT_CLEAR (d->WRAM_BITS, i);
|
||||
}
|
||||
|
||||
|
||||
for (i = 0; i < 0x10000 - l; i++)
|
||||
{
|
||||
if (TEST_BIT (d->SRAM_BITS, i) &&
|
||||
@ -422,7 +443,7 @@ void S9xSearchForValue (SCheatData *d, S9xCheatComparisonType cmp,
|
||||
else
|
||||
BIT_CLEAR (d->SRAM_BITS, i);
|
||||
}
|
||||
|
||||
|
||||
for (i = 0; i < 0x2000 - l; i++)
|
||||
{
|
||||
if (TEST_BIT (d->IRAM_BITS, i) &&
|
||||
@ -448,7 +469,7 @@ void S9xSearchForValue (SCheatData *d, S9xCheatComparisonType cmp,
|
||||
else
|
||||
BIT_CLEAR (d->WRAM_BITS, i);
|
||||
}
|
||||
|
||||
|
||||
for (i = 0; i < 0x10000 - l; i++)
|
||||
{
|
||||
if (TEST_BIT (d->SRAM_BITS, i) &&
|
||||
@ -460,7 +481,7 @@ void S9xSearchForValue (SCheatData *d, S9xCheatComparisonType cmp,
|
||||
else
|
||||
BIT_CLEAR (d->SRAM_BITS, i);
|
||||
}
|
||||
|
||||
|
||||
for (i = 0; i < 0x2000 - l; i++)
|
||||
{
|
||||
if (TEST_BIT (d->IRAM_BITS, i) &&
|
||||
@ -473,6 +494,70 @@ void S9xSearchForValue (SCheatData *d, S9xCheatComparisonType cmp,
|
||||
BIT_CLEAR (d->IRAM_BITS, i);
|
||||
}
|
||||
}
|
||||
for (i = 0x20000 - l; i < 0x20000; i++)
|
||||
BIT_CLEAR (d->WRAM_BITS, i);
|
||||
for (i = 0x10000 - l; i < 0x10000; i++)
|
||||
BIT_CLEAR (d->SRAM_BITS, i);
|
||||
}
|
||||
|
||||
void S9xSearchForAddress (SCheatData *d, S9xCheatComparisonType cmp,
|
||||
S9xCheatDataSize size, uint32 value, bool8 update)
|
||||
{
|
||||
int l;
|
||||
|
||||
switch (size)
|
||||
{
|
||||
case S9X_8_BITS: l = 0; break;
|
||||
case S9X_16_BITS: l = 1; break;
|
||||
case S9X_24_BITS: l = 2; break;
|
||||
default:
|
||||
case S9X_32_BITS: l = 3; break;
|
||||
}
|
||||
|
||||
int i;
|
||||
|
||||
{
|
||||
|
||||
for (i = 0; i < 0x20000 - l; i++)
|
||||
{
|
||||
if (TEST_BIT (d->WRAM_BITS, i) &&
|
||||
_C(cmp, i, (int)value))
|
||||
{
|
||||
if (update)
|
||||
d->CWRAM [i] = d->RAM [i];
|
||||
}
|
||||
else
|
||||
BIT_CLEAR (d->WRAM_BITS, i);
|
||||
}
|
||||
|
||||
for (i = 0; i < 0x10000 - l; i++)
|
||||
{
|
||||
if (TEST_BIT (d->SRAM_BITS, i) &&
|
||||
_C(cmp, i+0x20000, (int)value))
|
||||
{
|
||||
if (update)
|
||||
d->CSRAM [i] = d->SRAM [i];
|
||||
}
|
||||
else
|
||||
BIT_CLEAR (d->SRAM_BITS, i);
|
||||
}
|
||||
|
||||
for (i = 0; i < 0x2000 - l; i++)
|
||||
{
|
||||
if (TEST_BIT (d->IRAM_BITS, i) &&
|
||||
_C(cmp, i+0x30000, (int)value))
|
||||
{
|
||||
if (update)
|
||||
d->CIRAM [i] = d->FillRAM [i + 0x3000];
|
||||
}
|
||||
else
|
||||
BIT_CLEAR (d->IRAM_BITS, i);
|
||||
}
|
||||
}
|
||||
for (i = 0x20000 - l; i < 0x20000; i++)
|
||||
BIT_CLEAR (d->WRAM_BITS, i);
|
||||
for (i = 0x10000 - l; i < 0x10000; i++)
|
||||
BIT_CLEAR (d->SRAM_BITS, i);
|
||||
}
|
||||
|
||||
void S9xOutputCheatSearchResults (SCheatData *d)
|
||||
|
@ -1,7 +1,7 @@
|
||||
/**********************************************************************************
|
||||
Snes9x - Portable Super Nintendo Entertainment System (TM) emulator.
|
||||
|
||||
(c) Copyright 1996 - 2002 Gary Henderson (gary.henderson@ntlworld.com) and
|
||||
(c) Copyright 1996 - 2002 Gary Henderson (gary.henderson@ntlworld.com),
|
||||
Jerremy Koot (jkoot@snes9x.com)
|
||||
|
||||
(c) Copyright 2002 - 2004 Matthew Kendora
|
||||
@ -12,12 +12,16 @@
|
||||
|
||||
(c) Copyright 2001 - 2006 John Weidman (jweidman@slip.net)
|
||||
|
||||
(c) Copyright 2002 - 2006 Brad Jorsch (anomie@users.sourceforge.net),
|
||||
funkyass (funkyass@spam.shaw.ca),
|
||||
Kris Bleakley (codeviolation@hotmail.com),
|
||||
Nach (n-a-c-h@users.sourceforge.net), and
|
||||
(c) Copyright 2002 - 2006 funkyass (funkyass@spam.shaw.ca),
|
||||
Kris Bleakley (codeviolation@hotmail.com)
|
||||
|
||||
(c) Copyright 2002 - 2007 Brad Jorsch (anomie@users.sourceforge.net),
|
||||
Nach (n-a-c-h@users.sourceforge.net),
|
||||
zones (kasumitokoduck@yahoo.com)
|
||||
|
||||
(c) Copyright 2006 - 2007 nitsuja
|
||||
|
||||
|
||||
BS-X C emulator code
|
||||
(c) Copyright 2005 - 2006 Dreamer Nom,
|
||||
zones
|
||||
@ -110,17 +114,30 @@
|
||||
2xSaI filter
|
||||
(c) Copyright 1999 - 2001 Derek Liauw Kie Fa
|
||||
|
||||
HQ2x filter
|
||||
HQ2x, HQ3x, HQ4x filters
|
||||
(c) Copyright 2003 Maxim Stepin (maxim@hiend3d.com)
|
||||
|
||||
Win32 GUI code
|
||||
(c) Copyright 2003 - 2006 blip,
|
||||
funkyass,
|
||||
Matthew Kendora,
|
||||
Nach,
|
||||
nitsuja
|
||||
|
||||
Mac OS GUI code
|
||||
(c) Copyright 1998 - 2001 John Stiles
|
||||
(c) Copyright 2001 - 2007 zones
|
||||
|
||||
|
||||
Specific ports contains the works of other authors. See headers in
|
||||
individual files.
|
||||
|
||||
|
||||
Snes9x homepage: http://www.snes9x.com
|
||||
|
||||
Permission to use, copy, modify and/or distribute Snes9x in both binary
|
||||
and source form, for non-commercial purposes, is hereby granted without
|
||||
fee, providing that this license information and copyright notice appear
|
||||
and source form, for non-commercial purposes, is hereby granted without
|
||||
fee, providing that this license information and copyright notice appear
|
||||
with all copies and any derived work.
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
@ -141,6 +158,8 @@
|
||||
Nintendo Co., Limited and its subsidiary companies.
|
||||
**********************************************************************************/
|
||||
|
||||
|
||||
|
||||
#ifndef _CHEATS_H_
|
||||
#define _CHEATS_H_
|
||||
|
||||
@ -154,7 +173,7 @@ struct SCheat
|
||||
char name [22];
|
||||
};
|
||||
|
||||
#define MAX_CHEATS 75
|
||||
#define MAX_CHEATS 150
|
||||
|
||||
struct SCheatData
|
||||
{
|
||||
@ -166,11 +185,24 @@ struct SCheatData
|
||||
uint8 *RAM;
|
||||
uint8 *FillRAM;
|
||||
uint8 *SRAM;
|
||||
uint32 WRAM_BITS [0x20000 >> 3];
|
||||
uint32 SRAM_BITS [0x10000 >> 3];
|
||||
uint32 IRAM_BITS [0x2000 >> 3];
|
||||
uint32 ALL_BITS [(0x32000 >> 5)];
|
||||
#define WRAM_BITS ALL_BITS
|
||||
#define SRAM_BITS ALL_BITS + (0x20000 >> 5)
|
||||
#define IRAM_BITS ALL_BITS + (0x30000 >> 5)
|
||||
uint8 CWatchRAM [0x32000];
|
||||
};
|
||||
|
||||
|
||||
struct Watch {
|
||||
bool on;
|
||||
int size;
|
||||
int format;
|
||||
uint32 address;
|
||||
char buf[12];
|
||||
char desc[32];
|
||||
};
|
||||
extern Watch watches [16];
|
||||
|
||||
typedef enum
|
||||
{
|
||||
S9X_LESS_THAN, S9X_GREATER_THAN, S9X_LESS_THAN_OR_EQUAL,
|
||||
@ -207,6 +239,8 @@ void S9xSearchForChange (SCheatData *, S9xCheatComparisonType cmp,
|
||||
void S9xSearchForValue (SCheatData *, S9xCheatComparisonType cmp,
|
||||
S9xCheatDataSize size, uint32 value,
|
||||
bool8 is_signed, bool8 update);
|
||||
void S9xSearchForAddress (SCheatData *, S9xCheatComparisonType cmp,
|
||||
S9xCheatDataSize size, uint32 address, bool8 update);
|
||||
void S9xOutputCheatSearchResults (SCheatData *);
|
||||
|
||||
#endif
|
||||
|
@ -1,7 +1,7 @@
|
||||
/**********************************************************************************
|
||||
Snes9x - Portable Super Nintendo Entertainment System (TM) emulator.
|
||||
|
||||
(c) Copyright 1996 - 2002 Gary Henderson (gary.henderson@ntlworld.com) and
|
||||
(c) Copyright 1996 - 2002 Gary Henderson (gary.henderson@ntlworld.com),
|
||||
Jerremy Koot (jkoot@snes9x.com)
|
||||
|
||||
(c) Copyright 2002 - 2004 Matthew Kendora
|
||||
@ -12,12 +12,16 @@
|
||||
|
||||
(c) Copyright 2001 - 2006 John Weidman (jweidman@slip.net)
|
||||
|
||||
(c) Copyright 2002 - 2006 Brad Jorsch (anomie@users.sourceforge.net),
|
||||
funkyass (funkyass@spam.shaw.ca),
|
||||
Kris Bleakley (codeviolation@hotmail.com),
|
||||
Nach (n-a-c-h@users.sourceforge.net), and
|
||||
(c) Copyright 2002 - 2006 funkyass (funkyass@spam.shaw.ca),
|
||||
Kris Bleakley (codeviolation@hotmail.com)
|
||||
|
||||
(c) Copyright 2002 - 2007 Brad Jorsch (anomie@users.sourceforge.net),
|
||||
Nach (n-a-c-h@users.sourceforge.net),
|
||||
zones (kasumitokoduck@yahoo.com)
|
||||
|
||||
(c) Copyright 2006 - 2007 nitsuja
|
||||
|
||||
|
||||
BS-X C emulator code
|
||||
(c) Copyright 2005 - 2006 Dreamer Nom,
|
||||
zones
|
||||
@ -110,17 +114,30 @@
|
||||
2xSaI filter
|
||||
(c) Copyright 1999 - 2001 Derek Liauw Kie Fa
|
||||
|
||||
HQ2x filter
|
||||
HQ2x, HQ3x, HQ4x filters
|
||||
(c) Copyright 2003 Maxim Stepin (maxim@hiend3d.com)
|
||||
|
||||
Win32 GUI code
|
||||
(c) Copyright 2003 - 2006 blip,
|
||||
funkyass,
|
||||
Matthew Kendora,
|
||||
Nach,
|
||||
nitsuja
|
||||
|
||||
Mac OS GUI code
|
||||
(c) Copyright 1998 - 2001 John Stiles
|
||||
(c) Copyright 2001 - 2007 zones
|
||||
|
||||
|
||||
Specific ports contains the works of other authors. See headers in
|
||||
individual files.
|
||||
|
||||
|
||||
Snes9x homepage: http://www.snes9x.com
|
||||
|
||||
Permission to use, copy, modify and/or distribute Snes9x in both binary
|
||||
and source form, for non-commercial purposes, is hereby granted without
|
||||
fee, providing that this license information and copyright notice appear
|
||||
and source form, for non-commercial purposes, is hereby granted without
|
||||
fee, providing that this license information and copyright notice appear
|
||||
with all copies and any derived work.
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
@ -141,6 +158,8 @@
|
||||
Nintendo Co., Limited and its subsidiary companies.
|
||||
**********************************************************************************/
|
||||
|
||||
|
||||
|
||||
#include <stdio.h>
|
||||
#include <ctype.h>
|
||||
#include <string.h>
|
||||
@ -148,16 +167,40 @@
|
||||
#include "cheats.h"
|
||||
#include "memmap.h"
|
||||
|
||||
#ifndef INLINE
|
||||
#define INLINE inline
|
||||
#endif
|
||||
|
||||
extern SCheatData Cheat;
|
||||
Watch watches [16];
|
||||
|
||||
// read a byte without altering CPU
|
||||
INLINE uint8 S9xGetByteFree (uint32 Address)
|
||||
{
|
||||
uint32 Cycles = CPU.Cycles;
|
||||
uint32 WaitAddress = CPU.WaitAddress;
|
||||
uint8 rv = S9xGetByte (Address);
|
||||
CPU.WaitAddress = WaitAddress;
|
||||
CPU.Cycles = Cycles;
|
||||
return rv;
|
||||
}
|
||||
INLINE void S9xSetByteFree (uint8 Byte, uint32 Address)
|
||||
{
|
||||
uint32 Cycles = CPU.Cycles;
|
||||
uint32 WaitAddress = CPU.WaitAddress;
|
||||
S9xSetByte (Byte, Address);
|
||||
CPU.WaitAddress = WaitAddress;
|
||||
CPU.Cycles = Cycles;
|
||||
}
|
||||
|
||||
void S9xInitCheatData ()
|
||||
{
|
||||
Cheat.RAM = Memory.RAM;
|
||||
Cheat.SRAM = ::SRAM;
|
||||
Cheat.SRAM = Memory.SRAM;
|
||||
Cheat.FillRAM = Memory.FillRAM;
|
||||
}
|
||||
|
||||
void S9xAddCheat (bool8 enable, bool8 save_current_value,
|
||||
void S9xAddCheat (bool8 enable, bool8 save_current_value,
|
||||
uint32 address, uint8 byte)
|
||||
{
|
||||
if (Cheat.num_cheats < sizeof (Cheat.c) / sizeof (Cheat. c [0]))
|
||||
@ -171,7 +214,7 @@ void S9xAddCheat (bool8 enable, bool8 save_current_value,
|
||||
#endif
|
||||
if (save_current_value)
|
||||
{
|
||||
Cheat.c [Cheat.num_cheats].saved_byte = S9xGetByte (address);
|
||||
Cheat.c [Cheat.num_cheats].saved_byte = S9xGetByteFree (address);
|
||||
Cheat.c [Cheat.num_cheats].saved = TRUE;
|
||||
}
|
||||
Cheat.num_cheats++;
|
||||
@ -223,7 +266,7 @@ void S9xRemoveCheat (uint32 which1)
|
||||
|
||||
int block = ((address&0xffffff) >> MEMMAP_SHIFT);
|
||||
uint8 *ptr = Memory.Map [block];
|
||||
|
||||
|
||||
if (ptr >= (uint8 *) CMemory::MAP_LAST)
|
||||
*(ptr + (address & 0xffff)) = Cheat.c [which1].saved_byte;
|
||||
else
|
||||
@ -236,11 +279,11 @@ void S9xApplyCheat (uint32 which1)
|
||||
uint32 address = Cheat.c [which1].address;
|
||||
|
||||
if (!Cheat.c [which1].saved)
|
||||
Cheat.c [which1].saved_byte = S9xGetByte (address);
|
||||
Cheat.c [which1].saved_byte = S9xGetByteFree (address);
|
||||
|
||||
int block = ((address&0xffffff) >> MEMMAP_SHIFT);
|
||||
uint8 *ptr = Memory.Map [block];
|
||||
|
||||
|
||||
if (ptr >= (uint8 *) CMemory::MAP_LAST)
|
||||
*(ptr + (address & 0xffff)) = Cheat.c [which1].byte;
|
||||
else
|
||||
@ -273,7 +316,7 @@ bool8 S9xLoadCheatFile (const char *filename)
|
||||
uint8 data [28];
|
||||
|
||||
if (!fs)
|
||||
return (FALSE);
|
||||
return (FALSE);
|
||||
|
||||
while (fread ((void *) data, 1, 28, fs) == 28)
|
||||
{
|
||||
|
@ -1,7 +1,7 @@
|
||||
/**********************************************************************************
|
||||
Snes9x - Portable Super Nintendo Entertainment System (TM) emulator.
|
||||
|
||||
(c) Copyright 1996 - 2002 Gary Henderson (gary.henderson@ntlworld.com) and
|
||||
(c) Copyright 1996 - 2002 Gary Henderson (gary.henderson@ntlworld.com),
|
||||
Jerremy Koot (jkoot@snes9x.com)
|
||||
|
||||
(c) Copyright 2002 - 2004 Matthew Kendora
|
||||
@ -12,12 +12,16 @@
|
||||
|
||||
(c) Copyright 2001 - 2006 John Weidman (jweidman@slip.net)
|
||||
|
||||
(c) Copyright 2002 - 2006 Brad Jorsch (anomie@users.sourceforge.net),
|
||||
funkyass (funkyass@spam.shaw.ca),
|
||||
Kris Bleakley (codeviolation@hotmail.com),
|
||||
Nach (n-a-c-h@users.sourceforge.net), and
|
||||
(c) Copyright 2002 - 2006 funkyass (funkyass@spam.shaw.ca),
|
||||
Kris Bleakley (codeviolation@hotmail.com)
|
||||
|
||||
(c) Copyright 2002 - 2007 Brad Jorsch (anomie@users.sourceforge.net),
|
||||
Nach (n-a-c-h@users.sourceforge.net),
|
||||
zones (kasumitokoduck@yahoo.com)
|
||||
|
||||
(c) Copyright 2006 - 2007 nitsuja
|
||||
|
||||
|
||||
BS-X C emulator code
|
||||
(c) Copyright 2005 - 2006 Dreamer Nom,
|
||||
zones
|
||||
@ -110,17 +114,30 @@
|
||||
2xSaI filter
|
||||
(c) Copyright 1999 - 2001 Derek Liauw Kie Fa
|
||||
|
||||
HQ2x filter
|
||||
HQ2x, HQ3x, HQ4x filters
|
||||
(c) Copyright 2003 Maxim Stepin (maxim@hiend3d.com)
|
||||
|
||||
Win32 GUI code
|
||||
(c) Copyright 2003 - 2006 blip,
|
||||
funkyass,
|
||||
Matthew Kendora,
|
||||
Nach,
|
||||
nitsuja
|
||||
|
||||
Mac OS GUI code
|
||||
(c) Copyright 1998 - 2001 John Stiles
|
||||
(c) Copyright 2001 - 2007 zones
|
||||
|
||||
|
||||
Specific ports contains the works of other authors. See headers in
|
||||
individual files.
|
||||
|
||||
|
||||
Snes9x homepage: http://www.snes9x.com
|
||||
|
||||
Permission to use, copy, modify and/or distribute Snes9x in both binary
|
||||
and source form, for non-commercial purposes, is hereby granted without
|
||||
fee, providing that this license information and copyright notice appear
|
||||
and source form, for non-commercial purposes, is hereby granted without
|
||||
fee, providing that this license information and copyright notice appear
|
||||
with all copies and any derived work.
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
@ -142,6 +159,8 @@
|
||||
**********************************************************************************/
|
||||
|
||||
|
||||
|
||||
|
||||
#include "snes9x.h"
|
||||
#include "memmap.h"
|
||||
#include "ppu.h"
|
||||
|
@ -1,7 +1,7 @@
|
||||
/**********************************************************************************
|
||||
Snes9x - Portable Super Nintendo Entertainment System (TM) emulator.
|
||||
|
||||
(c) Copyright 1996 - 2002 Gary Henderson (gary.henderson@ntlworld.com) and
|
||||
(c) Copyright 1996 - 2002 Gary Henderson (gary.henderson@ntlworld.com),
|
||||
Jerremy Koot (jkoot@snes9x.com)
|
||||
|
||||
(c) Copyright 2002 - 2004 Matthew Kendora
|
||||
@ -12,12 +12,16 @@
|
||||
|
||||
(c) Copyright 2001 - 2006 John Weidman (jweidman@slip.net)
|
||||
|
||||
(c) Copyright 2002 - 2006 Brad Jorsch (anomie@users.sourceforge.net),
|
||||
funkyass (funkyass@spam.shaw.ca),
|
||||
Kris Bleakley (codeviolation@hotmail.com),
|
||||
Nach (n-a-c-h@users.sourceforge.net), and
|
||||
(c) Copyright 2002 - 2006 funkyass (funkyass@spam.shaw.ca),
|
||||
Kris Bleakley (codeviolation@hotmail.com)
|
||||
|
||||
(c) Copyright 2002 - 2007 Brad Jorsch (anomie@users.sourceforge.net),
|
||||
Nach (n-a-c-h@users.sourceforge.net),
|
||||
zones (kasumitokoduck@yahoo.com)
|
||||
|
||||
(c) Copyright 2006 - 2007 nitsuja
|
||||
|
||||
|
||||
BS-X C emulator code
|
||||
(c) Copyright 2005 - 2006 Dreamer Nom,
|
||||
zones
|
||||
@ -110,17 +114,30 @@
|
||||
2xSaI filter
|
||||
(c) Copyright 1999 - 2001 Derek Liauw Kie Fa
|
||||
|
||||
HQ2x filter
|
||||
HQ2x, HQ3x, HQ4x filters
|
||||
(c) Copyright 2003 Maxim Stepin (maxim@hiend3d.com)
|
||||
|
||||
Win32 GUI code
|
||||
(c) Copyright 2003 - 2006 blip,
|
||||
funkyass,
|
||||
Matthew Kendora,
|
||||
Nach,
|
||||
nitsuja
|
||||
|
||||
Mac OS GUI code
|
||||
(c) Copyright 1998 - 2001 John Stiles
|
||||
(c) Copyright 2001 - 2007 zones
|
||||
|
||||
|
||||
Specific ports contains the works of other authors. See headers in
|
||||
individual files.
|
||||
|
||||
|
||||
Snes9x homepage: http://www.snes9x.com
|
||||
|
||||
Permission to use, copy, modify and/or distribute Snes9x in both binary
|
||||
and source form, for non-commercial purposes, is hereby granted without
|
||||
fee, providing that this license information and copyright notice appear
|
||||
and source form, for non-commercial purposes, is hereby granted without
|
||||
fee, providing that this license information and copyright notice appear
|
||||
with all copies and any derived work.
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
@ -141,6 +158,8 @@
|
||||
Nintendo Co., Limited and its subsidiary companies.
|
||||
**********************************************************************************/
|
||||
|
||||
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
@ -162,7 +181,14 @@
|
||||
#include "cpuexec.h"
|
||||
#include "snapshot.h"
|
||||
#include "spc7110.h"
|
||||
#include "movie.h"
|
||||
//#include "movie.h"
|
||||
#ifdef NETPLAY_SUPPORT
|
||||
#include "netplay.h"
|
||||
#endif
|
||||
|
||||
#ifdef __WIN32__
|
||||
#define snprintf _snprintf // needs ANSI compliant name
|
||||
#endif
|
||||
|
||||
using namespace std;
|
||||
|
||||
@ -190,16 +216,16 @@ static set<uint32> pollmap[NUMCTLS+1];
|
||||
static vector<s9xcommand_t *> multis;
|
||||
struct exemulti {
|
||||
int32 pos;
|
||||
bool data1;
|
||||
bool8 data1;
|
||||
s9xcommand_t *script;
|
||||
};
|
||||
static set<struct exemulti *> exemultis;
|
||||
|
||||
static struct {
|
||||
int16 x, y;
|
||||
int V_adj; bool V_var;
|
||||
int H_adj; bool H_var;
|
||||
bool mapped;
|
||||
int16 V_adj; bool8 V_var;
|
||||
int16 H_adj; bool8 H_var;
|
||||
bool8 mapped;
|
||||
} pseudopointer[8];
|
||||
static uint8 pseudobuttons[256];
|
||||
|
||||
@ -247,7 +273,7 @@ static struct {
|
||||
static struct {
|
||||
int16 x[2], y[2];
|
||||
uint8 buttons;
|
||||
bool offscreen[2];
|
||||
bool8 offscreen[2];
|
||||
uint32 ID[2];
|
||||
struct crosshair crosshair[2];
|
||||
} justifier;
|
||||
@ -257,100 +283,77 @@ static struct {
|
||||
|
||||
uint8 read_idx[2 /* ports */][2 /* per port */];
|
||||
|
||||
bool8 pad_read = 0, pad_read_last = 0;
|
||||
|
||||
#define FLAG_IOBIT0 (Memory.FillRAM[0x4213]&0x40)
|
||||
#define FLAG_IOBIT1 (Memory.FillRAM[0x4213]&0x80)
|
||||
#define FLAG_IOBIT(n) ((n)?(FLAG_IOBIT1):(FLAG_IOBIT0))
|
||||
static bool FLAG_LATCH=false;
|
||||
static int curcontrollers[2]={ NONE, NONE };
|
||||
static int newcontrollers[2]={ JOYPAD0, NONE };
|
||||
static bool8 FLAG_LATCH=false;
|
||||
static int32 curcontrollers[2]={ NONE, NONE };
|
||||
static int32 newcontrollers[2]={ JOYPAD0, NONE };
|
||||
|
||||
/*******************/
|
||||
|
||||
// Note: these should be in asciibetical order!
|
||||
static const char *command_names[]={
|
||||
"BGLayeringHack",
|
||||
"BeginRecordingMovie",
|
||||
"ClipWindows",
|
||||
"Debugger",
|
||||
"DecEmuTurbo",
|
||||
"DecFrameRate",
|
||||
"DecFrameTime",
|
||||
"DecTurboSpeed",
|
||||
"DumpSPC7110Log",
|
||||
"EmuTurbo",
|
||||
"EndRecordingMovie",
|
||||
"ExitEmu",
|
||||
"IncEmuTurbo",
|
||||
"IncFrameRate",
|
||||
"IncFrameTime",
|
||||
"IncTurboSpeed",
|
||||
"InterpolateSound",
|
||||
"LoadFreezeFile",
|
||||
"LoadMovie",
|
||||
"LoadOopsFile",
|
||||
"Mode7Interpolate",
|
||||
"Pause",
|
||||
"QuickLoad000", "QuickLoad001", "QuickLoad002", "QuickLoad003", "QuickLoad004", "QuickLoad005", "QuickLoad006", "QuickLoad007", "QuickLoad008", "QuickLoad009", "QuickLoad010",
|
||||
"QuickSave000", "QuickSave001", "QuickSave002", "QuickSave003", "QuickSave004", "QuickSave005", "QuickSave006", "QuickSave007", "QuickSave008", "QuickSave009", "QuickSave010",
|
||||
"Reset",
|
||||
"SaveFreezeFile",
|
||||
"SaveSPC",
|
||||
"Screenshot",
|
||||
"SoftReset",
|
||||
"SoundChannel0", "SoundChannel1", "SoundChannel2", "SoundChannel3", "SoundChannel4", "SoundChannel5", "SoundChannel6", "SoundChannel7",
|
||||
"SoundChannelsOn",
|
||||
"SwapJoypads",
|
||||
"SynchronizeSound",
|
||||
"ToggleBG0", "ToggleBG1", "ToggleBG2", "ToggleBG3",
|
||||
"ToggleEmuTurbo",
|
||||
"ToggleHDMA",
|
||||
"ToggleSprites",
|
||||
"ToggleTransparency",
|
||||
#define THE_COMMANDS \
|
||||
S(BGLayeringHack), \
|
||||
S(BeginRecordingMovie), \
|
||||
S(ClipWindows), \
|
||||
S(Debugger), \
|
||||
S(DecEmuTurbo), \
|
||||
S(DecFrameRate), \
|
||||
S(DecFrameTime), \
|
||||
S(DecTurboSpeed), \
|
||||
S(DumpSPC7110Log), \
|
||||
S(EmuTurbo), \
|
||||
S(EndRecordingMovie), \
|
||||
S(ExitEmu), \
|
||||
S(IncEmuTurbo), \
|
||||
S(IncFrameRate), \
|
||||
S(IncFrameTime), \
|
||||
S(IncTurboSpeed), \
|
||||
S(InterpolateSound), \
|
||||
S(LoadFreezeFile), \
|
||||
S(LoadMovie), \
|
||||
S(LoadOopsFile), \
|
||||
/* S(Mode7Interpolate),*/ \
|
||||
S(Pause), \
|
||||
S(QuickLoad000), S(QuickLoad001), S(QuickLoad002), S(QuickLoad003), S(QuickLoad004), S(QuickLoad005), S(QuickLoad006), S(QuickLoad007), S(QuickLoad008), S(QuickLoad009), S(QuickLoad010), \
|
||||
S(QuickSave000), S(QuickSave001), S(QuickSave002), S(QuickSave003), S(QuickSave004), S(QuickSave005), S(QuickSave006), S(QuickSave007), S(QuickSave008), S(QuickSave009), S(QuickSave010), \
|
||||
S(Reset), \
|
||||
S(SaveFreezeFile), \
|
||||
S(SaveSPC), \
|
||||
S(Screenshot), \
|
||||
S(SeekToFrame), \
|
||||
S(SoftReset), \
|
||||
S(SoundChannel0), S(SoundChannel1), S(SoundChannel2), S(SoundChannel3), S(SoundChannel4), S(SoundChannel5), S(SoundChannel6), S(SoundChannel7), \
|
||||
S(SoundChannelsOn), \
|
||||
S(SwapJoypads), \
|
||||
S(SynchronizeSound), \
|
||||
S(ToggleBG0), S(ToggleBG1), S(ToggleBG2), S(ToggleBG3), \
|
||||
S(ToggleEmuTurbo), \
|
||||
S(ToggleHDMA), \
|
||||
S(ToggleSprites), \
|
||||
S(ToggleTransparency), \
|
||||
// end
|
||||
|
||||
#define S(x) x
|
||||
|
||||
enum command_numbers {
|
||||
THE_COMMANDS
|
||||
LAST_COMMAND // must be last!
|
||||
};
|
||||
|
||||
#undef S
|
||||
#define S(x) #x
|
||||
|
||||
static const char *command_names[LAST_COMMAND+1]={
|
||||
THE_COMMANDS
|
||||
NULL // This MUST be last!
|
||||
};
|
||||
|
||||
enum command_numbers {
|
||||
BGLayeringHack,
|
||||
BeginRecordingMovie,
|
||||
ClipWindows,
|
||||
Debugger,
|
||||
DecEmuTurbo,
|
||||
DecFrameRate,
|
||||
DecFrameTime,
|
||||
DecTurboSpeed,
|
||||
DumpSPC7110Log,
|
||||
EmuTurbo,
|
||||
EndRecordingMovie,
|
||||
ExitEmu,
|
||||
IncEmuTurbo,
|
||||
IncFrameRate,
|
||||
IncFrameTime,
|
||||
IncTurboSpeed,
|
||||
InterpolateSound,
|
||||
LoadFreezeFile,
|
||||
LoadMovie,
|
||||
LoadOopsFile,
|
||||
Mode7Interpolate,
|
||||
Pause,
|
||||
QuickLoad000, QuickLoad001, QuickLoad002, QuickLoad003, QuickLoad004, QuickLoad005, QuickLoad006, QuickLoad007, QuickLoad008, QuickLoad009, QuickLoad010,
|
||||
QuickSave000, QuickSave001, QuickSave002, QuickSave003, QuickSave004, QuickSave005, QuickSave006, QuickSave007, QuickSave008, QuickSave009, QuickSave010,
|
||||
Reset,
|
||||
SaveFreezeFile,
|
||||
SaveSPC,
|
||||
Screenshot,
|
||||
SoftReset,
|
||||
SoundChannel0, SoundChannel1, SoundChannel2, SoundChannel3, SoundChannel4, SoundChannel5, SoundChannel6, SoundChannel7,
|
||||
SoundChannelsOn,
|
||||
SwapJoypads,
|
||||
SynchronizeSound,
|
||||
ToggleBG0, ToggleBG1, ToggleBG2, ToggleBG3,
|
||||
ToggleEmuTurbo,
|
||||
ToggleHDMA,
|
||||
ToggleSprites,
|
||||
ToggleTransparency,
|
||||
|
||||
LAST_COMMAND // must be last!
|
||||
};
|
||||
#undef S
|
||||
#undef THE_COMMANDS
|
||||
|
||||
static const char *color_names[32]={
|
||||
"Trans", "Black", "25Grey", "50Grey", "75Grey", "White", "Red", "Orange", "Yellow", "Green", "Cyan", "Sky", "Blue", "Violet", "MagicPink", "Purple",
|
||||
@ -451,7 +454,7 @@ void S9xControlsSoftReset(void){
|
||||
|
||||
void S9xUnmapAllControls(void){
|
||||
int i;
|
||||
|
||||
|
||||
S9xControlsReset();
|
||||
keymap.clear();
|
||||
for(i=0; i<(int)multis.size(); i++){
|
||||
@ -478,7 +481,7 @@ void S9xUnmapAllControls(void){
|
||||
mouse[i].cur_x=mouse[i].cur_y=0;
|
||||
mouse[i].buttons=1;
|
||||
mouse[i].ID=InvalidControlID;
|
||||
if(!(mouse[i].crosshair.set&1)) mouse[i].crosshair.img=1;
|
||||
if(!(mouse[i].crosshair.set&1)) mouse[i].crosshair.img=0; // no image for mouse because its only logical position is game-specific, not known by the emulator
|
||||
if(!(mouse[i].crosshair.set&2)) mouse[i].crosshair.fg=5;
|
||||
if(!(mouse[i].crosshair.set&4)) mouse[i].crosshair.bg=1;
|
||||
justifier.x[i]=justifier.y[i]=0;
|
||||
@ -650,9 +653,9 @@ bool S9xVerifyControllers(void){
|
||||
|
||||
void S9xGetController(int port, enum controllers *controller, int8 *id1, int8 *id2, int8 *id3, int8 *id4){
|
||||
int i;
|
||||
|
||||
|
||||
*controller=CTL_NONE;
|
||||
*id1=*id2=*id3=*id4=0;
|
||||
*id1=*id2=*id3=*id4=-1;
|
||||
if(port<0 || port>1) return;
|
||||
switch(i=newcontrollers[port]){
|
||||
case MP5:
|
||||
@ -676,6 +679,7 @@ void S9xGetController(int port, enum controllers *controller, int8 *id1, int8 *i
|
||||
|
||||
case SUPERSCOPE:
|
||||
*controller=CTL_SUPERSCOPE;
|
||||
*id1=1;
|
||||
return;
|
||||
|
||||
case ONE_JUSTIFIER: case TWO_JUSTIFIERS:
|
||||
@ -687,64 +691,61 @@ void S9xGetController(int port, enum controllers *controller, int8 *id1, int8 *i
|
||||
|
||||
void S9xReportControllers(void){
|
||||
int port, i;
|
||||
char buf[79], *c;
|
||||
|
||||
static char buf[128]; // static because S9xMessage keeps our pointer instead of copying
|
||||
char *c=buf;
|
||||
|
||||
S9xVerifyControllers();
|
||||
for(port=0; port<2; port++){
|
||||
sprintf(buf, "Controller Port %d: ", port+1);
|
||||
c=buf+19;
|
||||
c+=sprintf(c, "Port %d: ", port+1);
|
||||
switch(newcontrollers[port]){
|
||||
case NONE:
|
||||
strcat(c, "<none>");
|
||||
c+=sprintf(c, "<none>. ");
|
||||
break;
|
||||
|
||||
case MP5:
|
||||
strcat(c, "MP5 with pads");
|
||||
c+=13;
|
||||
c+=sprintf(c, "MP5 with pads");
|
||||
for(i=0; i<4; i++){
|
||||
if(mp5[port].pads[i]==NONE){
|
||||
strcat(c, " <none>");
|
||||
c+=7;
|
||||
c+=sprintf(c, " <none>. ");
|
||||
} else {
|
||||
sprintf(c, " #%d", mp5[port].pads[i]+1-JOYPAD0);
|
||||
c+=3;
|
||||
c+=sprintf(c, " #%d. ", mp5[port].pads[i]+1-JOYPAD0);
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case JOYPAD0: case JOYPAD1: case JOYPAD2: case JOYPAD3:
|
||||
case JOYPAD4: case JOYPAD5: case JOYPAD6: case JOYPAD7:
|
||||
sprintf(c, "Pad %d", newcontrollers[port]-JOYPAD0+1);
|
||||
c+=sprintf(c, "Pad #%d. ", (int)(newcontrollers[port]-JOYPAD0+1));
|
||||
break;
|
||||
|
||||
case MOUSE0: case MOUSE1:
|
||||
sprintf(c, "Mouse %d", newcontrollers[port]-MOUSE0+1);
|
||||
c+=sprintf(c, "Mouse #%d. ", (int)(newcontrollers[port]-MOUSE0+1));
|
||||
break;
|
||||
|
||||
case SUPERSCOPE:
|
||||
if(port==0) strcat(c, "Superscope (cannot fire)");
|
||||
else strcat(c, "Superscope");
|
||||
if(port==0) c+=sprintf(c, "Superscope (cannot fire). ");
|
||||
else c+=sprintf(c, "Superscope. ");
|
||||
break;
|
||||
|
||||
case ONE_JUSTIFIER:
|
||||
if(port==0) strcat(c, "Blue Justifier (cannot fire)");
|
||||
else strcat(c, "Blue Justifier");
|
||||
if(port==0) c+=sprintf(c, "Blue Justifier (cannot fire). ");
|
||||
else c+=sprintf(c, "Blue Justifier. ");
|
||||
break;
|
||||
|
||||
case TWO_JUSTIFIERS:
|
||||
if(port==0) strcat(c, "Blue and Pink Justifiers (cannot fire)");
|
||||
else strcat(c, "Blue and Pink Justifiers");
|
||||
if(port==0) c+=sprintf(c, "Blue and Pink Justifiers (cannot fire). ");
|
||||
else c+=sprintf(c, "Blue and Pink Justifiers. ");
|
||||
break;
|
||||
}
|
||||
S9xMessage(S9X_INFO, S9X_CONFIG_INFO, buf);
|
||||
}
|
||||
S9xMessage(S9X_INFO, S9X_CONFIG_INFO, buf);
|
||||
}
|
||||
|
||||
|
||||
char *S9xGetCommandName(s9xcommand_t command){
|
||||
string s;
|
||||
char c;
|
||||
|
||||
|
||||
switch(command.type){
|
||||
case S9xButtonJoypad:
|
||||
if(command.button.joypad.buttons==0) return strdup("None");
|
||||
@ -878,7 +879,7 @@ char *S9xGetCommandName(s9xcommand_t command){
|
||||
case S9xAxisPort:
|
||||
case S9xPointerPort:
|
||||
return strdup("BUG: Port should have handled this instead of calling S9xGetCommandName()");
|
||||
|
||||
|
||||
case S9xNoMapping:
|
||||
return strdup("None");
|
||||
|
||||
@ -1182,7 +1183,7 @@ s9xcommand_t S9xGetCommandT(const char *name){
|
||||
i=j+1; n++;
|
||||
} while(name[i]!='\0');
|
||||
c[n].type=S9xNoMapping; c[n].multi_press=3;
|
||||
|
||||
|
||||
multis.push_back(c);
|
||||
cmd.button.multi_idx=multis.size()-1;
|
||||
cmd.type=S9xButtonMulti;
|
||||
@ -1291,7 +1292,8 @@ void S9xReportButton(uint32 id, bool pressed){
|
||||
return;
|
||||
}
|
||||
|
||||
if(keymap[id].button_norpt==pressed) return;
|
||||
if(keymap[id].type==S9xButtonCommand) // skips the "already-pressed check" unless it's a command, as a hack to work around the following problem:
|
||||
if(keymap[id].button_norpt==pressed) return; // FIXME: this makes the controls "stick" after loading a savestate while recording a movie and holding any button
|
||||
keymap[id].button_norpt=pressed;
|
||||
S9xApplyCommand(keymap[id], pressed, 0);
|
||||
}
|
||||
@ -1463,11 +1465,13 @@ void S9xApplyCommand(s9xcommand_t cmd, int16 data1, int16 data2){
|
||||
x=t; t=st; st=x;
|
||||
}
|
||||
if(data1){
|
||||
if(!Settings.UpAndDown) // if up+down isn't allowed AND we are NOT playing a movie,
|
||||
{
|
||||
if(cmd.button.joypad.buttons&(SNES_LEFT_MASK|SNES_RIGHT_MASK)){
|
||||
// if we're pressing left or right, then unpress and unturbo
|
||||
// them both first so we don't end up hittnig left AND right
|
||||
// accidentally. Note though that the user can still do it on
|
||||
// purpose, bu specifying a single button that presses both.
|
||||
// purpose, if Settings.UpAndDown = true.
|
||||
// This is a feature, look up glitches in tLoZ:aLttP to find
|
||||
// out why.
|
||||
joypad[cmd.button.joypad.idx].buttons &= ~(SNES_LEFT_MASK|SNES_RIGHT_MASK);
|
||||
@ -1478,6 +1482,7 @@ void S9xApplyCommand(s9xcommand_t cmd, int16 data1, int16 data2){
|
||||
joypad[cmd.button.joypad.idx].buttons &= ~(SNES_UP_MASK|SNES_DOWN_MASK);
|
||||
joypad[cmd.button.joypad.idx].turbos &= ~(SNES_UP_MASK|SNES_DOWN_MASK);
|
||||
}
|
||||
}//end up+down protection
|
||||
joypad[cmd.button.joypad.idx].buttons |= r;
|
||||
joypad[cmd.button.joypad.idx].turbos |= t;
|
||||
joypad[cmd.button.joypad.idx].buttons ^= s;
|
||||
@ -1490,7 +1495,7 @@ void S9xApplyCommand(s9xcommand_t cmd, int16 data1, int16 data2){
|
||||
}
|
||||
}
|
||||
return;
|
||||
|
||||
|
||||
case S9xButtonMouse:
|
||||
i=0;
|
||||
if(cmd.button.mouse.left) i|=0x40;
|
||||
@ -1501,7 +1506,7 @@ void S9xApplyCommand(s9xcommand_t cmd, int16 data1, int16 data2){
|
||||
mouse[cmd.button.mouse.idx].buttons &= ~i;
|
||||
}
|
||||
return;
|
||||
|
||||
|
||||
case S9xButtonSuperscope:
|
||||
i=0;
|
||||
if(cmd.button.scope.fire) i|=SUPERSCOPE_FIRE;
|
||||
@ -1519,7 +1524,10 @@ void S9xApplyCommand(s9xcommand_t cmd, int16 data1, int16 data2){
|
||||
}
|
||||
}
|
||||
superscope.next_buttons |= i&(SUPERSCOPE_FIRE|SUPERSCOPE_CURSOR|SUPERSCOPE_PAUSE);
|
||||
if((superscope.next_buttons&(SUPERSCOPE_FIRE|SUPERSCOPE_CURSOR)) &&
|
||||
#ifndef NGC
|
||||
if(!S9xMovieActive()) // PPU modification during non-recordable command screws up movie synchronization
|
||||
#endif
|
||||
if((superscope.next_buttons&(SUPERSCOPE_FIRE|SUPERSCOPE_CURSOR)) &&
|
||||
curcontrollers[1]==SUPERSCOPE &&
|
||||
!(superscope.phys_buttons&SUPERSCOPE_OFFSCREEN)){
|
||||
DoGunLatch(superscope.x, superscope.y);
|
||||
@ -1542,7 +1550,7 @@ void S9xApplyCommand(s9xcommand_t cmd, int16 data1, int16 data2){
|
||||
justifier.buttons &= ~i;
|
||||
}
|
||||
return;
|
||||
|
||||
|
||||
case S9xButtonCommand:
|
||||
if(((enum command_numbers)cmd.button.command)>=LAST_COMMAND){
|
||||
fprintf(stderr, "Unknown command %04x\n", cmd.button.command);
|
||||
@ -1563,7 +1571,12 @@ void S9xApplyCommand(s9xcommand_t cmd, int16 data1, int16 data2){
|
||||
S9xReset();
|
||||
break;
|
||||
case SoftReset:
|
||||
S9xSoftReset();
|
||||
#ifndef NGC
|
||||
S9xMovieUpdateOnReset ();
|
||||
if(S9xMoviePlaying())
|
||||
S9xMovieStop (TRUE);
|
||||
#endif
|
||||
S9xSoftReset();
|
||||
break;
|
||||
case EmuTurbo:
|
||||
Settings.TurboMode = TRUE;
|
||||
@ -1700,14 +1713,17 @@ void S9xApplyCommand(s9xcommand_t cmd, int16 data1, int16 data2){
|
||||
#endif
|
||||
}
|
||||
break;
|
||||
case Mode7Interpolate:
|
||||
/* case Mode7Interpolate:
|
||||
Settings.Mode7Interpolate ^= TRUE;
|
||||
S9xDisplayStateChange ("Mode 7 Interpolation",
|
||||
Settings.Mode7Interpolate);
|
||||
break;
|
||||
break;*/
|
||||
case Pause:
|
||||
Settings.Paused ^= 1;
|
||||
S9xDisplayStateChange ("Pause", Settings.Paused);
|
||||
#if defined(NETPLAY_SUPPORT) && !defined(__WIN32__)
|
||||
S9xNPSendPause(Settings.Paused);
|
||||
#endif
|
||||
break;
|
||||
case QuickLoad000: case QuickLoad001: case QuickLoad002: case QuickLoad003: case QuickLoad004: case QuickLoad005: case QuickLoad006: case QuickLoad007: case QuickLoad008: case QuickLoad009: case QuickLoad010:
|
||||
{
|
||||
@ -1716,8 +1732,8 @@ void S9xApplyCommand(s9xcommand_t cmd, int16 data1, int16 data2){
|
||||
char drive [_MAX_DRIVE];
|
||||
char dir [_MAX_DIR];
|
||||
char ext [_MAX_EXT];
|
||||
_splitpath (Memory.ROMFilename, drive, dir, def, ext);
|
||||
|
||||
_splitpath (Memory.ROMFilename, drive, dir, def, ext);
|
||||
sprintf (filename, "%s%s%s.%03d",
|
||||
S9xGetDirectory (SNAPSHOT_DIR), SLASH_STR, def,
|
||||
i - QuickLoad000);
|
||||
@ -1732,7 +1748,6 @@ void S9xApplyCommand(s9xcommand_t cmd, int16 data1, int16 data2){
|
||||
{
|
||||
static char *digits = "t123456789";
|
||||
_splitpath (Memory.ROMFilename, drive, dir, def, ext);
|
||||
|
||||
sprintf (filename, "%s%s%s.zs%c",
|
||||
S9xGetDirectory (SNAPSHOT_DIR), SLASH_STR,
|
||||
def, digits [i - QuickLoad000]);
|
||||
@ -1777,6 +1792,7 @@ void S9xApplyCommand(s9xcommand_t cmd, int16 data1, int16 data2){
|
||||
char drive [_MAX_DRIVE];
|
||||
char dir [_MAX_DIR];
|
||||
char ext [_MAX_EXT];
|
||||
|
||||
_splitpath (Memory.ROMFilename, drive, dir, def, ext);
|
||||
strcpy (ext, "spc");
|
||||
_makepath (filename, drive, S9xGetDirectory (SPC_DIR),
|
||||
@ -1810,24 +1826,24 @@ void S9xApplyCommand(s9xcommand_t cmd, int16 data1, int16 data2){
|
||||
Settings.SoundSync);
|
||||
break;
|
||||
case ToggleBG0:
|
||||
PPU.BG_Forced ^= 1;
|
||||
S9xDisplayStateChange ("BG#0", !(PPU.BG_Forced & 1));
|
||||
Settings.BG_Forced ^= 1;
|
||||
S9xDisplayStateChange ("BG#0", !(Settings.BG_Forced & 1));
|
||||
break;
|
||||
case ToggleBG1:
|
||||
PPU.BG_Forced ^= 2;
|
||||
S9xDisplayStateChange ("BG#1", !(PPU.BG_Forced & 2));
|
||||
Settings.BG_Forced ^= 2;
|
||||
S9xDisplayStateChange ("BG#1", !(Settings.BG_Forced & 2));
|
||||
break;
|
||||
case ToggleBG2:
|
||||
PPU.BG_Forced ^= 4;
|
||||
S9xDisplayStateChange ("BG#2", !(PPU.BG_Forced & 4));
|
||||
Settings.BG_Forced ^= 4;
|
||||
S9xDisplayStateChange ("BG#2", !(Settings.BG_Forced & 4));
|
||||
break;
|
||||
case ToggleBG3:
|
||||
PPU.BG_Forced ^= 8;
|
||||
S9xDisplayStateChange ("BG#3", !(PPU.BG_Forced & 8));
|
||||
Settings.BG_Forced ^= 8;
|
||||
S9xDisplayStateChange ("BG#3", !(Settings.BG_Forced & 8));
|
||||
break;
|
||||
case ToggleSprites:
|
||||
PPU.BG_Forced ^= 16;
|
||||
S9xDisplayStateChange ("Sprites", !(PPU.BG_Forced & 16));
|
||||
Settings.BG_Forced ^= 16;
|
||||
S9xDisplayStateChange ("Sprites", !(Settings.BG_Forced & 16));
|
||||
break;
|
||||
case ToggleHDMA:
|
||||
Settings.DisableHDMA = !Settings.DisableHDMA;
|
||||
@ -1842,10 +1858,11 @@ void S9xApplyCommand(s9xcommand_t cmd, int16 data1, int16 data2){
|
||||
case DumpSPC7110Log:
|
||||
if(Settings.SPC7110) Do7110Logging();
|
||||
break;
|
||||
|
||||
|
||||
case BeginRecordingMovie:
|
||||
#ifndef NGC
|
||||
if(S9xMovieActive()) S9xMovieStop(FALSE);
|
||||
|
||||
S9xMovieCreate(S9xChooseMovieFilename(FALSE),
|
||||
0xFF,
|
||||
//MOVIE_OPT_FROM_SNAPSHOT
|
||||
@ -1853,7 +1870,7 @@ void S9xApplyCommand(s9xcommand_t cmd, int16 data1, int16 data2){
|
||||
NULL, 0);
|
||||
#endif
|
||||
break;
|
||||
|
||||
|
||||
case LoadMovie:
|
||||
#ifndef NGC
|
||||
if(S9xMovieActive()) S9xMovieStop(FALSE);
|
||||
@ -1899,12 +1916,37 @@ void S9xApplyCommand(s9xcommand_t cmd, int16 data1, int16 data2){
|
||||
S9xSetInfoString(buf);
|
||||
break;
|
||||
|
||||
case SeekToFrame: {
|
||||
#ifndef NGC
|
||||
if (!S9xMovieActive())
|
||||
|
||||
{
|
||||
S9xSetInfoString("No movie in progress.");
|
||||
return;
|
||||
}
|
||||
|
||||
char msg[128];
|
||||
sprintf(msg, "Select frame number (current: %d)", S9xMovieGetFrameCounter());
|
||||
|
||||
const char *frameno = S9xStringInput(msg);
|
||||
if (!frameno)
|
||||
return;
|
||||
int frameDest = atoi(frameno);
|
||||
if (frameDest > 0 && frameDest > (int)S9xMovieGetFrameCounter())
|
||||
{
|
||||
int distance = frameDest - S9xMovieGetFrameCounter();
|
||||
Settings.HighSpeedSeek = distance;
|
||||
}
|
||||
#endif
|
||||
} // braces for vlocalitylocality
|
||||
break;
|
||||
|
||||
case LAST_COMMAND: break;
|
||||
/* no default, so we get compiler warnings */
|
||||
}
|
||||
}
|
||||
return;
|
||||
|
||||
|
||||
case S9xPointer:
|
||||
if(cmd.pointer.aim_mouse0){
|
||||
mouse[0].cur_x=data1;
|
||||
@ -1992,10 +2034,10 @@ void S9xApplyCommand(s9xcommand_t cmd, int16 data1, int16 data2){
|
||||
} else {
|
||||
if(cmd.axis.pointer.invert) data1=-data1;
|
||||
if(cmd.axis.pointer.HV){
|
||||
if(!pseudopointer[cmd.axis.pointer.idx].V_adj) pseudopointer[cmd.axis.pointer.idx].V_adj=(int32)data1*ptrspeeds[cmd.axis.pointer.speed_type]/32767;
|
||||
if(!pseudopointer[cmd.axis.pointer.idx].V_adj) pseudopointer[cmd.axis.pointer.idx].V_adj=(int16)((int32)data1*ptrspeeds[cmd.axis.pointer.speed_type]/32767);
|
||||
pseudopointer[cmd.axis.pointer.idx].V_var=(cmd.axis.pointer.speed_type==0);
|
||||
} else {
|
||||
if(!pseudopointer[cmd.axis.pointer.idx].H_adj) pseudopointer[cmd.axis.pointer.idx].H_adj=(int32)data1*ptrspeeds[cmd.axis.pointer.speed_type]/32767;
|
||||
if(!pseudopointer[cmd.axis.pointer.idx].H_adj) pseudopointer[cmd.axis.pointer.idx].H_adj=(int16)((int32)data1*ptrspeeds[cmd.axis.pointer.speed_type]/32767);
|
||||
pseudopointer[cmd.axis.pointer.idx].H_var=(cmd.axis.pointer.speed_type==0);
|
||||
}
|
||||
}
|
||||
@ -2039,12 +2081,14 @@ void S9xApplyCommand(s9xcommand_t cmd, int16 data1, int16 data2){
|
||||
if(i>=0){
|
||||
struct exemulti *e=new struct exemulti;
|
||||
e->pos=i;
|
||||
e->data1=data1;
|
||||
e->data1=data1!=0;
|
||||
e->script=multis[cmd.button.multi_idx];
|
||||
exemultis.insert(e);
|
||||
}
|
||||
return;
|
||||
|
||||
|
||||
|
||||
default:
|
||||
fprintf(stderr, "WARNING: Unknown command type %d\n", cmd.type);
|
||||
return;
|
||||
@ -2056,7 +2100,10 @@ static void do_polling(int mp){
|
||||
set<uint32>::iterator itr;
|
||||
|
||||
if(pollmap[mp].empty()) return;
|
||||
for(itr=pollmap[mp].begin(); itr!=pollmap[mp].end(); itr++){
|
||||
#ifndef NGC
|
||||
if(S9xMoviePlaying()) return;
|
||||
#endif
|
||||
for(itr=pollmap[mp].begin(); itr!=pollmap[mp].end(); itr++){
|
||||
switch(maptype(keymap[*itr].type)){
|
||||
case MAP_BUTTON:
|
||||
bool pressed;
|
||||
@ -2072,13 +2119,45 @@ static void do_polling(int mp){
|
||||
int16 x, y;
|
||||
if(S9xPollPointer(*itr, &x, &y)) S9xReportPointer(*itr, x, y);
|
||||
break;
|
||||
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void UpdatePolledMouse(int i) {
|
||||
int16 j;
|
||||
j=mouse[i-MOUSE0].cur_x-mouse[i-MOUSE0].old_x;
|
||||
if(j<-127){
|
||||
mouse[i-MOUSE0].delta_x=0xff;
|
||||
mouse[i-MOUSE0].old_x-=127;
|
||||
} else if(j<0){
|
||||
mouse[i-MOUSE0].delta_x=0x80 | -j;
|
||||
mouse[i-MOUSE0].old_x=mouse[i-MOUSE0].cur_x;
|
||||
} else if(j>127){
|
||||
mouse[i-MOUSE0].delta_x=0x7f;
|
||||
mouse[i-MOUSE0].old_x+=127;
|
||||
} else {
|
||||
mouse[i-MOUSE0].delta_x=(uint8)j;
|
||||
mouse[i-MOUSE0].old_x=mouse[i-MOUSE0].cur_x;
|
||||
}
|
||||
j=mouse[i-MOUSE0].cur_y-mouse[i-MOUSE0].old_y;
|
||||
if(j<-127){
|
||||
mouse[i-MOUSE0].delta_y=0xff;
|
||||
mouse[i-MOUSE0].old_y-=127;
|
||||
} else if(j<0){
|
||||
mouse[i-MOUSE0].delta_y=0x80 | -j;
|
||||
mouse[i-MOUSE0].old_y=mouse[i-MOUSE0].cur_y;
|
||||
} else if(j>127){
|
||||
mouse[i-MOUSE0].delta_y=0x7f;
|
||||
mouse[i-MOUSE0].old_y+=127;
|
||||
} else {
|
||||
mouse[i-MOUSE0].delta_y=(uint8)j;
|
||||
mouse[i-MOUSE0].old_y=mouse[i-MOUSE0].cur_y;
|
||||
}
|
||||
}
|
||||
|
||||
void S9xSetJoypadLatch(bool latch){
|
||||
if(!latch && FLAG_LATCH){
|
||||
// 1 written, 'plug in' new controllers now
|
||||
@ -2103,37 +2182,13 @@ void S9xSetJoypadLatch(bool latch){
|
||||
case JOYPAD4: case JOYPAD5: case JOYPAD6: case JOYPAD7:
|
||||
do_polling(i);
|
||||
break;
|
||||
|
||||
|
||||
case MOUSE0: case MOUSE1:
|
||||
do_polling(i);
|
||||
j=mouse[i-MOUSE0].cur_x-mouse[i-MOUSE0].old_x;
|
||||
if(j<-127){
|
||||
mouse[i-MOUSE0].delta_x=0xff;
|
||||
mouse[i-MOUSE0].old_x-=127;
|
||||
} else if(j<0){
|
||||
mouse[i-MOUSE0].delta_x=0x80 | -j;
|
||||
mouse[i-MOUSE0].old_x=mouse[i-MOUSE0].cur_x;
|
||||
} else if(j>127){
|
||||
mouse[i-MOUSE0].delta_x=0x7f;
|
||||
mouse[i-MOUSE0].old_x+=127;
|
||||
} else {
|
||||
mouse[i-MOUSE0].delta_x=j;
|
||||
mouse[i-MOUSE0].old_x=mouse[i-MOUSE0].cur_x;
|
||||
}
|
||||
j=mouse[i-MOUSE0].cur_y-mouse[i-MOUSE0].old_y;
|
||||
if(j<-127){
|
||||
mouse[i-MOUSE0].delta_y=0xff;
|
||||
mouse[i-MOUSE0].old_y-=127;
|
||||
} else if(j<0){
|
||||
mouse[i-MOUSE0].delta_y=0x80 | -j;
|
||||
mouse[i-MOUSE0].old_y=mouse[i-MOUSE0].cur_y;
|
||||
} else if(j>127){
|
||||
mouse[i-MOUSE0].delta_y=0x7f;
|
||||
mouse[i-MOUSE0].old_y+=127;
|
||||
} else {
|
||||
mouse[i-MOUSE0].delta_y=j;
|
||||
mouse[i-MOUSE0].old_y=mouse[i-MOUSE0].cur_y;
|
||||
}
|
||||
#ifndef NGC
|
||||
if(!S9xMoviePlaying())
|
||||
#endif
|
||||
UpdatePolledMouse(i);
|
||||
break;
|
||||
case SUPERSCOPE:
|
||||
if(superscope.next_buttons&SUPERSCOPE_FIRE){
|
||||
@ -2165,7 +2220,7 @@ void S9xSetJoypadLatch(bool latch){
|
||||
}
|
||||
|
||||
uint8 S9xReadJOYSERn(int n){
|
||||
int i, j, r;
|
||||
int i, j, r;
|
||||
|
||||
if(n>1) n-=0x4016;
|
||||
assert(n==0 || n==1);
|
||||
@ -2226,7 +2281,7 @@ uint8 S9xReadJOYSERn(int n){
|
||||
} else {
|
||||
read_idx[n][0]++;
|
||||
return bits|1;
|
||||
}
|
||||
}
|
||||
case SUPERSCOPE:
|
||||
if(read_idx[n][0]<8){
|
||||
return bits|((superscope.read_buttons&(0x80>>read_idx[n][0]++))?1:0);
|
||||
@ -2264,10 +2319,12 @@ uint8 S9xReadJOYSERn(int n){
|
||||
|
||||
void S9xDoAutoJoypad(void){
|
||||
int n, i, j;
|
||||
|
||||
|
||||
S9xSetJoypadLatch(1);
|
||||
S9xSetJoypadLatch(0);
|
||||
|
||||
#ifndef NGC
|
||||
S9xMovieUpdate(false);
|
||||
#endif
|
||||
for(n=0; n<2; n++){
|
||||
switch(i=curcontrollers[n]){
|
||||
case MP5:
|
||||
@ -2428,7 +2485,8 @@ do_justifier:
|
||||
#ifndef NGC
|
||||
S9xMovieUpdate();
|
||||
#endif
|
||||
|
||||
pad_read_last = pad_read;
|
||||
pad_read = false;
|
||||
}
|
||||
|
||||
void S9xSetControllerCrosshair(enum crosscontrols ctl, int8 idx, const char *fg, const char *bg){
|
||||
@ -2516,11 +2574,83 @@ void MovieSetJoypad(int i, uint16 buttons){
|
||||
joypad[i].buttons=buttons;
|
||||
}
|
||||
|
||||
// from movie.cpp, used for MovieGetX functions to avoid platform-dependent byte order in the file
|
||||
#ifndef NGC
|
||||
extern void Write16(uint16 v, uint8*& ptr);
|
||||
extern uint16 Read16(const uint8*& ptr);
|
||||
#endif
|
||||
#ifndef NGC
|
||||
bool MovieGetMouse(int i, uint8 out [5]){
|
||||
if(i<0 || i>1 || (curcontrollers[i] != MOUSE0 && curcontrollers[i] != MOUSE1)) return false;
|
||||
const int n = curcontrollers[i]-MOUSE0;
|
||||
uint8* ptr = out;
|
||||
Write16(mouse[n].cur_x, ptr);
|
||||
Write16(mouse[n].cur_y, ptr);
|
||||
*ptr++ = mouse[n].buttons;
|
||||
return true;
|
||||
}
|
||||
|
||||
void MovieSetMouse(int i, const uint8 in [5], bool inPolling){
|
||||
if(i<0 || i>1 || (curcontrollers[i] != MOUSE0 && curcontrollers[i] != MOUSE1)) return;
|
||||
const int n = curcontrollers[i]-MOUSE0;
|
||||
const uint8* ptr = in;
|
||||
mouse[n].cur_x = Read16(ptr);
|
||||
mouse[n].cur_y = Read16(ptr);
|
||||
mouse[n].buttons = *ptr++;
|
||||
if(inPolling)
|
||||
UpdatePolledMouse(curcontrollers[i]);
|
||||
}
|
||||
|
||||
bool MovieGetScope(int i, uint8 out [6]){
|
||||
if(i<0 || i>1 || (curcontrollers[i] != SUPERSCOPE)) return false;
|
||||
uint8* ptr = out;
|
||||
Write16(superscope.x, ptr);
|
||||
Write16(superscope.y, ptr);
|
||||
*ptr++ = superscope.phys_buttons;
|
||||
*ptr++ = superscope.next_buttons;
|
||||
return true;
|
||||
}
|
||||
|
||||
void MovieSetScope(int i, const uint8 in [6]){
|
||||
if(i<0 || i>1 || (curcontrollers[i] != SUPERSCOPE)) return;
|
||||
const uint8* ptr = in;
|
||||
superscope.x = Read16(ptr);
|
||||
superscope.y = Read16(ptr);
|
||||
superscope.phys_buttons = *ptr++;
|
||||
superscope.next_buttons = *ptr++;
|
||||
}
|
||||
|
||||
bool MovieGetJustifier(int i, uint8 out [11]){
|
||||
if(i<0 || i>1 || (curcontrollers[i] != ONE_JUSTIFIER && curcontrollers[i] != TWO_JUSTIFIERS)) return false;
|
||||
uint8* ptr = out;
|
||||
Write16(justifier.x[0], ptr);
|
||||
Write16(justifier.x[1], ptr);
|
||||
Write16(justifier.y[0], ptr);
|
||||
Write16(justifier.y[1], ptr);
|
||||
*ptr++ = justifier.buttons;
|
||||
*ptr++ = justifier.offscreen[0];
|
||||
*ptr++ = justifier.offscreen[1];
|
||||
return true;
|
||||
}
|
||||
|
||||
void MovieSetJustifier(int i, const uint8 in [11]){
|
||||
if(i<0 || i>1 || (curcontrollers[i] != ONE_JUSTIFIER && curcontrollers[i] != TWO_JUSTIFIERS)) return;
|
||||
const uint8* ptr = in;
|
||||
justifier.x[0] = Read16(ptr);
|
||||
justifier.x[1] = Read16(ptr);
|
||||
justifier.y[0] = Read16(ptr);
|
||||
justifier.y[1] = Read16(ptr);
|
||||
justifier.buttons = *ptr++;
|
||||
justifier.offscreen[0] = *ptr++;
|
||||
justifier.offscreen[1] = *ptr++;
|
||||
}
|
||||
#endif
|
||||
|
||||
void S9xControlPreSave(struct SControlSnapshot *s){
|
||||
int i;
|
||||
int i, j;
|
||||
|
||||
ZeroMemory(s, sizeof(*s));
|
||||
s->ver=1;
|
||||
s->ver=3;
|
||||
for(i=0; i<2; i++){
|
||||
s->port1_read_idx[i]=read_idx[0][i];
|
||||
s->port2_read_idx[i]=read_idx[1][i];
|
||||
@ -2529,10 +2659,40 @@ void S9xControlPreSave(struct SControlSnapshot *s){
|
||||
s->mouse_speed[i]=(mouse[i].buttons&0x30)>>4;
|
||||
}
|
||||
s->justifier_select=((justifier.buttons&JUSTIFIER_SELECT)?1:0);
|
||||
|
||||
#define COPY(x) {memcpy((char*)s->internal+i, &(x), sizeof(x)); i+=sizeof(x);}
|
||||
i=0;
|
||||
for(j=0; j<8; j++)
|
||||
COPY(joypad[j].buttons);
|
||||
for(j=0; j<2; j++) {
|
||||
COPY(mouse[j].delta_x);
|
||||
COPY(mouse[j].delta_y);
|
||||
COPY(mouse[j].old_x);
|
||||
COPY(mouse[j].old_y);
|
||||
COPY(mouse[j].cur_x);
|
||||
COPY(mouse[j].cur_y);
|
||||
COPY(mouse[j].buttons);
|
||||
}
|
||||
COPY(superscope.x);
|
||||
COPY(superscope.y);
|
||||
COPY(superscope.phys_buttons);
|
||||
COPY(superscope.next_buttons);
|
||||
COPY(superscope.read_buttons);
|
||||
for(j=0; j<2; j++) COPY(justifier.x[j]);
|
||||
for(j=0; j<2; j++) COPY(justifier.y[j]);
|
||||
COPY(justifier.buttons);
|
||||
for(j=0; j<2; j++) COPY(justifier.offscreen[j]);
|
||||
for(j=0; j<2; j++)
|
||||
for(int k=0; k<2; k++)
|
||||
COPY(mp5[j].pads[k]);
|
||||
assert(i==sizeof(s->internal));
|
||||
#undef COPY
|
||||
s->pad_read=pad_read;
|
||||
s->pad_read_last=pad_read_last;
|
||||
}
|
||||
|
||||
void S9xControlPostLoad(struct SControlSnapshot *s){
|
||||
int i;
|
||||
int i, j;
|
||||
|
||||
if(curcontrollers[0]==MP5 && s->ver<1){
|
||||
// Crap. Old snes9x didn't support this.
|
||||
@ -2553,4 +2713,40 @@ void S9xControlPostLoad(struct SControlSnapshot *s){
|
||||
justifier.buttons&=~JUSTIFIER_SELECT;
|
||||
}
|
||||
FLAG_LATCH=(Memory.FillRAM[0x4016]&1)==1;
|
||||
|
||||
if(s->ver>1)
|
||||
{
|
||||
#define COPY(x) {memcpy(&(x), (char*)s->internal+i, sizeof(x)); i+=sizeof(x);}
|
||||
i=0;
|
||||
for(j=0; j<8; j++)
|
||||
COPY(joypad[j].buttons);
|
||||
for(j=0; j<2; j++) {
|
||||
COPY(mouse[j].delta_x);
|
||||
COPY(mouse[j].delta_y);
|
||||
COPY(mouse[j].old_x);
|
||||
COPY(mouse[j].old_y);
|
||||
COPY(mouse[j].cur_x);
|
||||
COPY(mouse[j].cur_y);
|
||||
COPY(mouse[j].buttons);
|
||||
}
|
||||
COPY(superscope.x);
|
||||
COPY(superscope.y);
|
||||
COPY(superscope.phys_buttons);
|
||||
COPY(superscope.next_buttons);
|
||||
COPY(superscope.read_buttons);
|
||||
for(j=0; j<2; j++) COPY(justifier.x[j]);
|
||||
for(j=0; j<2; j++) COPY(justifier.y[j]);
|
||||
COPY(justifier.buttons);
|
||||
for(j=0; j<2; j++) COPY(justifier.offscreen[j]);
|
||||
for(j=0; j<2; j++)
|
||||
for(int k=0; k<2; k++)
|
||||
COPY(mp5[j].pads[k]);
|
||||
assert(i==sizeof(s->internal));
|
||||
#undef COPY
|
||||
}
|
||||
if(s->ver>2)
|
||||
{
|
||||
pad_read=s->pad_read;
|
||||
pad_read_last=s->pad_read_last;
|
||||
}
|
||||
}
|
||||
|
@ -1,7 +1,7 @@
|
||||
/**********************************************************************************
|
||||
Snes9x - Portable Super Nintendo Entertainment System (TM) emulator.
|
||||
|
||||
(c) Copyright 1996 - 2002 Gary Henderson (gary.henderson@ntlworld.com) and
|
||||
(c) Copyright 1996 - 2002 Gary Henderson (gary.henderson@ntlworld.com),
|
||||
Jerremy Koot (jkoot@snes9x.com)
|
||||
|
||||
(c) Copyright 2002 - 2004 Matthew Kendora
|
||||
@ -12,12 +12,16 @@
|
||||
|
||||
(c) Copyright 2001 - 2006 John Weidman (jweidman@slip.net)
|
||||
|
||||
(c) Copyright 2002 - 2006 Brad Jorsch (anomie@users.sourceforge.net),
|
||||
funkyass (funkyass@spam.shaw.ca),
|
||||
Kris Bleakley (codeviolation@hotmail.com),
|
||||
Nach (n-a-c-h@users.sourceforge.net), and
|
||||
(c) Copyright 2002 - 2006 funkyass (funkyass@spam.shaw.ca),
|
||||
Kris Bleakley (codeviolation@hotmail.com)
|
||||
|
||||
(c) Copyright 2002 - 2007 Brad Jorsch (anomie@users.sourceforge.net),
|
||||
Nach (n-a-c-h@users.sourceforge.net),
|
||||
zones (kasumitokoduck@yahoo.com)
|
||||
|
||||
(c) Copyright 2006 - 2007 nitsuja
|
||||
|
||||
|
||||
BS-X C emulator code
|
||||
(c) Copyright 2005 - 2006 Dreamer Nom,
|
||||
zones
|
||||
@ -110,17 +114,30 @@
|
||||
2xSaI filter
|
||||
(c) Copyright 1999 - 2001 Derek Liauw Kie Fa
|
||||
|
||||
HQ2x filter
|
||||
HQ2x, HQ3x, HQ4x filters
|
||||
(c) Copyright 2003 Maxim Stepin (maxim@hiend3d.com)
|
||||
|
||||
Win32 GUI code
|
||||
(c) Copyright 2003 - 2006 blip,
|
||||
funkyass,
|
||||
Matthew Kendora,
|
||||
Nach,
|
||||
nitsuja
|
||||
|
||||
Mac OS GUI code
|
||||
(c) Copyright 1998 - 2001 John Stiles
|
||||
(c) Copyright 2001 - 2007 zones
|
||||
|
||||
|
||||
Specific ports contains the works of other authors. See headers in
|
||||
individual files.
|
||||
|
||||
|
||||
Snes9x homepage: http://www.snes9x.com
|
||||
|
||||
Permission to use, copy, modify and/or distribute Snes9x in both binary
|
||||
and source form, for non-commercial purposes, is hereby granted without
|
||||
fee, providing that this license information and copyright notice appear
|
||||
and source form, for non-commercial purposes, is hereby granted without
|
||||
fee, providing that this license information and copyright notice appear
|
||||
with all copies and any derived work.
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
@ -141,6 +158,8 @@
|
||||
Nintendo Co., Limited and its subsidiary companies.
|
||||
**********************************************************************************/
|
||||
|
||||
|
||||
|
||||
#ifndef FOO_H
|
||||
#define FOO_H
|
||||
|
||||
@ -183,7 +202,7 @@ typedef struct {
|
||||
uint8 type;
|
||||
uint8 multi_press:2;
|
||||
uint8 button_norpt:1;
|
||||
|
||||
|
||||
union {
|
||||
union {
|
||||
struct {
|
||||
@ -239,7 +258,7 @@ typedef struct {
|
||||
uint8 threshold; // (threshold+1)/256% deflection is a
|
||||
// button press
|
||||
} joypad;
|
||||
|
||||
|
||||
struct {
|
||||
uint8 idx:3; // Pseudo-pointer number 0-7
|
||||
uint8 speed_type:2; // 0=variable, 1=slow, 2=med, 3=fast
|
||||
@ -310,7 +329,7 @@ const char **S9xGetAllSnes9xCommands(void);
|
||||
s9xcommand_t S9xGetMapping(uint32 id);
|
||||
void S9xUnmapID(uint32 id);
|
||||
|
||||
/*
|
||||
/*
|
||||
* Button mapping functions. If a button is mapped with poll=TRUE, then
|
||||
* S9xPollButton will be called whenever snes9x feels a need for that mapping.
|
||||
* Otherwise, snes9x will assume you will call S9xReportButton() whenever the
|
||||
@ -320,7 +339,7 @@ void S9xUnmapID(uint32 id);
|
||||
bool S9xMapButton(uint32 id, s9xcommand_t mapping, bool poll);
|
||||
void S9xReportButton(uint32 id, bool pressed);
|
||||
|
||||
/*
|
||||
/*
|
||||
* Pointer mapping functions. If a button is mapped with poll=TRUE, then
|
||||
* S9xPollPointer will be called whenever snes9x feels a need for that mapping.
|
||||
* Otherwise, snes9x will assume you will call S9xReportPointer() whenever the
|
||||
@ -335,7 +354,7 @@ void S9xReportButton(uint32 id, bool pressed);
|
||||
bool S9xMapPointer(uint32 id, s9xcommand_t mapping, bool poll);
|
||||
void S9xReportPointer(uint32 id, int16 x, int16 y);
|
||||
|
||||
/*
|
||||
/*
|
||||
* Axis mapping functions. If a button is mapped with poll=TRUE, then
|
||||
* S9xPollAxis will be called whenever snes9x feels a need for that mapping.
|
||||
* Otherwise, snes9x will assume you will call S9xReportAxis() whenever the
|
||||
@ -378,6 +397,14 @@ bool S9xPollAxis(uint32 id, int16 *value);
|
||||
*/
|
||||
void S9xHandlePortCommand(s9xcommand_t cmd, int16 data1, int16 data2);
|
||||
|
||||
/*
|
||||
* Called before already-read SNES joypad data is being used by the game
|
||||
* if your port defines SNES_JOY_READ_CALLBACKS
|
||||
*/
|
||||
#ifdef SNES_JOY_READ_CALLBACKS
|
||||
void S9xOnSNESPadRead();
|
||||
#endif
|
||||
|
||||
/* These are for your use */
|
||||
s9xcommand_t S9xGetPortCommandT(const char *name);
|
||||
char *S9xGetPortCommandName(s9xcommand_t command);
|
||||
@ -412,7 +439,9 @@ struct SControlSnapshot {
|
||||
uint8 dummy2[4];
|
||||
uint8 mouse_speed[2];
|
||||
uint8 justifier_select;
|
||||
uint8 dummy3[10];
|
||||
uint8 dummy3[8];
|
||||
bool8 pad_read, pad_read_last;
|
||||
uint8 internal[60]; // yes, we need to save this!
|
||||
};
|
||||
|
||||
void S9xControlPreSave(struct SControlSnapshot *s);
|
||||
|
@ -1,7 +1,7 @@
|
||||
/**********************************************************************************
|
||||
Snes9x - Portable Super Nintendo Entertainment System (TM) emulator.
|
||||
|
||||
(c) Copyright 1996 - 2002 Gary Henderson (gary.henderson@ntlworld.com) and
|
||||
(c) Copyright 1996 - 2002 Gary Henderson (gary.henderson@ntlworld.com),
|
||||
Jerremy Koot (jkoot@snes9x.com)
|
||||
|
||||
(c) Copyright 2002 - 2004 Matthew Kendora
|
||||
@ -12,12 +12,16 @@
|
||||
|
||||
(c) Copyright 2001 - 2006 John Weidman (jweidman@slip.net)
|
||||
|
||||
(c) Copyright 2002 - 2006 Brad Jorsch (anomie@users.sourceforge.net),
|
||||
funkyass (funkyass@spam.shaw.ca),
|
||||
Kris Bleakley (codeviolation@hotmail.com),
|
||||
Nach (n-a-c-h@users.sourceforge.net), and
|
||||
(c) Copyright 2002 - 2006 funkyass (funkyass@spam.shaw.ca),
|
||||
Kris Bleakley (codeviolation@hotmail.com)
|
||||
|
||||
(c) Copyright 2002 - 2007 Brad Jorsch (anomie@users.sourceforge.net),
|
||||
Nach (n-a-c-h@users.sourceforge.net),
|
||||
zones (kasumitokoduck@yahoo.com)
|
||||
|
||||
(c) Copyright 2006 - 2007 nitsuja
|
||||
|
||||
|
||||
BS-X C emulator code
|
||||
(c) Copyright 2005 - 2006 Dreamer Nom,
|
||||
zones
|
||||
@ -110,17 +114,30 @@
|
||||
2xSaI filter
|
||||
(c) Copyright 1999 - 2001 Derek Liauw Kie Fa
|
||||
|
||||
HQ2x filter
|
||||
HQ2x, HQ3x, HQ4x filters
|
||||
(c) Copyright 2003 Maxim Stepin (maxim@hiend3d.com)
|
||||
|
||||
Win32 GUI code
|
||||
(c) Copyright 2003 - 2006 blip,
|
||||
funkyass,
|
||||
Matthew Kendora,
|
||||
Nach,
|
||||
nitsuja
|
||||
|
||||
Mac OS GUI code
|
||||
(c) Copyright 1998 - 2001 John Stiles
|
||||
(c) Copyright 2001 - 2007 zones
|
||||
|
||||
|
||||
Specific ports contains the works of other authors. See headers in
|
||||
individual files.
|
||||
|
||||
|
||||
Snes9x homepage: http://www.snes9x.com
|
||||
|
||||
Permission to use, copy, modify and/or distribute Snes9x in both binary
|
||||
and source form, for non-commercial purposes, is hereby granted without
|
||||
fee, providing that this license information and copyright notice appear
|
||||
and source form, for non-commercial purposes, is hereby granted without
|
||||
fee, providing that this license information and copyright notice appear
|
||||
with all copies and any derived work.
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
@ -141,13 +158,15 @@
|
||||
Nintendo Co., Limited and its subsidiary companies.
|
||||
**********************************************************************************/
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* Snes9x - Portable Super Nintendo Entertainment System (TM) emulator.
|
||||
*
|
||||
* (c) Copyright 1996 - 2001 Gary Henderson (gary.henderson@ntlworld.com) and
|
||||
* Jerremy Koot (jkoot@snes9x.com)
|
||||
*
|
||||
* Super FX C emulator code
|
||||
* Super FX C emulator code
|
||||
* (c) Copyright 1997 - 1999 Ivar (ivar@snes9x.com) and
|
||||
* Gary Henderson.
|
||||
* Super FX assembler emulator code (c) Copyright 1998 zsKnight and _Demo_.
|
||||
|
@ -1,7 +1,7 @@
|
||||
/**********************************************************************************
|
||||
Snes9x - Portable Super Nintendo Entertainment System (TM) emulator.
|
||||
|
||||
(c) Copyright 1996 - 2002 Gary Henderson (gary.henderson@ntlworld.com) and
|
||||
(c) Copyright 1996 - 2002 Gary Henderson (gary.henderson@ntlworld.com),
|
||||
Jerremy Koot (jkoot@snes9x.com)
|
||||
|
||||
(c) Copyright 2002 - 2004 Matthew Kendora
|
||||
@ -12,12 +12,16 @@
|
||||
|
||||
(c) Copyright 2001 - 2006 John Weidman (jweidman@slip.net)
|
||||
|
||||
(c) Copyright 2002 - 2006 Brad Jorsch (anomie@users.sourceforge.net),
|
||||
funkyass (funkyass@spam.shaw.ca),
|
||||
Kris Bleakley (codeviolation@hotmail.com),
|
||||
Nach (n-a-c-h@users.sourceforge.net), and
|
||||
(c) Copyright 2002 - 2006 funkyass (funkyass@spam.shaw.ca),
|
||||
Kris Bleakley (codeviolation@hotmail.com)
|
||||
|
||||
(c) Copyright 2002 - 2007 Brad Jorsch (anomie@users.sourceforge.net),
|
||||
Nach (n-a-c-h@users.sourceforge.net),
|
||||
zones (kasumitokoduck@yahoo.com)
|
||||
|
||||
(c) Copyright 2006 - 2007 nitsuja
|
||||
|
||||
|
||||
BS-X C emulator code
|
||||
(c) Copyright 2005 - 2006 Dreamer Nom,
|
||||
zones
|
||||
@ -110,17 +114,30 @@
|
||||
2xSaI filter
|
||||
(c) Copyright 1999 - 2001 Derek Liauw Kie Fa
|
||||
|
||||
HQ2x filter
|
||||
HQ2x, HQ3x, HQ4x filters
|
||||
(c) Copyright 2003 Maxim Stepin (maxim@hiend3d.com)
|
||||
|
||||
Win32 GUI code
|
||||
(c) Copyright 2003 - 2006 blip,
|
||||
funkyass,
|
||||
Matthew Kendora,
|
||||
Nach,
|
||||
nitsuja
|
||||
|
||||
Mac OS GUI code
|
||||
(c) Copyright 1998 - 2001 John Stiles
|
||||
(c) Copyright 2001 - 2007 zones
|
||||
|
||||
|
||||
Specific ports contains the works of other authors. See headers in
|
||||
individual files.
|
||||
|
||||
|
||||
Snes9x homepage: http://www.snes9x.com
|
||||
|
||||
Permission to use, copy, modify and/or distribute Snes9x in both binary
|
||||
and source form, for non-commercial purposes, is hereby granted without
|
||||
fee, providing that this license information and copyright notice appear
|
||||
and source form, for non-commercial purposes, is hereby granted without
|
||||
fee, providing that this license information and copyright notice appear
|
||||
with all copies and any derived work.
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
@ -142,6 +159,8 @@
|
||||
**********************************************************************************/
|
||||
|
||||
|
||||
|
||||
|
||||
#include "snes9x.h"
|
||||
#include "memmap.h"
|
||||
#include "ppu.h"
|
||||
@ -162,6 +181,9 @@
|
||||
#include "obc1.h"
|
||||
#include "bsx.h"
|
||||
#include "snapshot.h"
|
||||
#ifndef NGC
|
||||
#include "logger.h"
|
||||
#endif
|
||||
|
||||
|
||||
#ifndef ZSNES_FX
|
||||
@ -203,12 +225,17 @@ void S9xSoftResetCPU ()
|
||||
CPU.NMIActive = FALSE;
|
||||
CPU.IRQActive = FALSE;
|
||||
CPU.WaitingForInterrupt = FALSE;
|
||||
CPU.InDMA = CPU.InWRAM_DMA = FALSE;
|
||||
CPU.InDMA = FALSE;
|
||||
CPU.InHDMA = FALSE;
|
||||
CPU.InDMAorHDMA = FALSE;
|
||||
CPU.InWRAMDMAorHDMA = FALSE;
|
||||
CPU.HDMARanInDMA = 0;
|
||||
CPU.PCBase = NULL;
|
||||
CPU.PBPCAtOpcodeStart = 0xffffffff;
|
||||
CPU.WaitAddress = 0xffffffff;
|
||||
CPU.WaitCounter = 0;
|
||||
CPU.Cycles = 182; // Or 188. This is the cycle count just after the jump to the Reset Vector.
|
||||
CPU.PrevCycles = -1;
|
||||
CPU.V_Counter = 0;
|
||||
CPU.MemSpeed = SLOW_ONE_CYCLE;
|
||||
CPU.MemSpeedx2 = SLOW_ONE_CYCLE * 2;
|
||||
@ -216,7 +243,7 @@ void S9xSoftResetCPU ()
|
||||
CPU.AutoSaveTimer = 0;
|
||||
CPU.SRAMModified = FALSE;
|
||||
CPU.BRKTriggered = FALSE;
|
||||
//CPU.TriedInterleavedMode2 = FALSE; // Reset when ROM image loaded
|
||||
CPU.IRQPending = 0;
|
||||
|
||||
Timings.InterlaceField = FALSE;
|
||||
Timings.H_Max = Timings.H_Max_Master;
|
||||
@ -235,7 +262,7 @@ void S9xSoftResetCPU ()
|
||||
ICPU.S9xOpcodes = S9xOpcodesE1;
|
||||
ICPU.S9xOpLengths = S9xOpLengthsM1X1;
|
||||
ICPU.CPUExecuting = TRUE;
|
||||
|
||||
|
||||
S9xUnpackStatus();
|
||||
}
|
||||
|
||||
@ -244,7 +271,10 @@ void S9xResetCPU ()
|
||||
S9xSoftResetCPU ();
|
||||
Registers.SL = 0xFF;
|
||||
Registers.P.W = 0;
|
||||
SetFlags (MemoryFlag | IndexFlag | IRQ | Emulation);
|
||||
Registers.A.W = 0;
|
||||
Registers.X.W = 0;
|
||||
Registers.Y.W = 0;
|
||||
SetFlags (MemoryFlag | IndexFlag | IRQ | Emulation);
|
||||
ClearFlags (Decimal);
|
||||
}
|
||||
|
||||
@ -259,6 +289,7 @@ END_EXTERN_C
|
||||
void S9xReset (void)
|
||||
{
|
||||
#ifndef NGC
|
||||
ResetLogger();
|
||||
S9xResetSaveTimer (FALSE);
|
||||
#endif
|
||||
|
||||
@ -282,7 +313,6 @@ void S9xReset (void)
|
||||
S9xSA1Init ();
|
||||
if (Settings.C4)
|
||||
S9xInitC4 ();
|
||||
|
||||
#ifndef NGC
|
||||
S9xInitCheatData ();
|
||||
#endif
|
||||
|
@ -1,7 +1,7 @@
|
||||
/**********************************************************************************
|
||||
Snes9x - Portable Super Nintendo Entertainment System (TM) emulator.
|
||||
|
||||
(c) Copyright 1996 - 2002 Gary Henderson (gary.henderson@ntlworld.com) and
|
||||
(c) Copyright 1996 - 2002 Gary Henderson (gary.henderson@ntlworld.com),
|
||||
Jerremy Koot (jkoot@snes9x.com)
|
||||
|
||||
(c) Copyright 2002 - 2004 Matthew Kendora
|
||||
@ -12,12 +12,16 @@
|
||||
|
||||
(c) Copyright 2001 - 2006 John Weidman (jweidman@slip.net)
|
||||
|
||||
(c) Copyright 2002 - 2006 Brad Jorsch (anomie@users.sourceforge.net),
|
||||
funkyass (funkyass@spam.shaw.ca),
|
||||
Kris Bleakley (codeviolation@hotmail.com),
|
||||
Nach (n-a-c-h@users.sourceforge.net), and
|
||||
(c) Copyright 2002 - 2006 funkyass (funkyass@spam.shaw.ca),
|
||||
Kris Bleakley (codeviolation@hotmail.com)
|
||||
|
||||
(c) Copyright 2002 - 2007 Brad Jorsch (anomie@users.sourceforge.net),
|
||||
Nach (n-a-c-h@users.sourceforge.net),
|
||||
zones (kasumitokoduck@yahoo.com)
|
||||
|
||||
(c) Copyright 2006 - 2007 nitsuja
|
||||
|
||||
|
||||
BS-X C emulator code
|
||||
(c) Copyright 2005 - 2006 Dreamer Nom,
|
||||
zones
|
||||
@ -110,17 +114,30 @@
|
||||
2xSaI filter
|
||||
(c) Copyright 1999 - 2001 Derek Liauw Kie Fa
|
||||
|
||||
HQ2x filter
|
||||
HQ2x, HQ3x, HQ4x filters
|
||||
(c) Copyright 2003 Maxim Stepin (maxim@hiend3d.com)
|
||||
|
||||
Win32 GUI code
|
||||
(c) Copyright 2003 - 2006 blip,
|
||||
funkyass,
|
||||
Matthew Kendora,
|
||||
Nach,
|
||||
nitsuja
|
||||
|
||||
Mac OS GUI code
|
||||
(c) Copyright 1998 - 2001 John Stiles
|
||||
(c) Copyright 2001 - 2007 zones
|
||||
|
||||
|
||||
Specific ports contains the works of other authors. See headers in
|
||||
individual files.
|
||||
|
||||
|
||||
Snes9x homepage: http://www.snes9x.com
|
||||
|
||||
Permission to use, copy, modify and/or distribute Snes9x in both binary
|
||||
and source form, for non-commercial purposes, is hereby granted without
|
||||
fee, providing that this license information and copyright notice appear
|
||||
and source form, for non-commercial purposes, is hereby granted without
|
||||
fee, providing that this license information and copyright notice appear
|
||||
with all copies and any derived work.
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
@ -142,6 +159,8 @@
|
||||
**********************************************************************************/
|
||||
|
||||
|
||||
|
||||
|
||||
#ifndef _CPUADDR_H_
|
||||
#define _CPUADDR_H_
|
||||
|
||||
@ -283,7 +302,7 @@ STATIC inline uint32 AbsoluteLongSlow (AccessMode a) { // l
|
||||
// JSR l pushes the old bank in the middle of loading the new.
|
||||
// OpenBus needs to be set to account for this.
|
||||
if(a==JSR) OpenBus = Registers.PB;
|
||||
|
||||
|
||||
addr |= Immediate8Slow(a)<<16;
|
||||
return addr;
|
||||
}
|
||||
|
@ -1,7 +1,7 @@
|
||||
/**********************************************************************************
|
||||
Snes9x - Portable Super Nintendo Entertainment System (TM) emulator.
|
||||
|
||||
(c) Copyright 1996 - 2002 Gary Henderson (gary.henderson@ntlworld.com) and
|
||||
(c) Copyright 1996 - 2002 Gary Henderson (gary.henderson@ntlworld.com),
|
||||
Jerremy Koot (jkoot@snes9x.com)
|
||||
|
||||
(c) Copyright 2002 - 2004 Matthew Kendora
|
||||
@ -12,12 +12,16 @@
|
||||
|
||||
(c) Copyright 2001 - 2006 John Weidman (jweidman@slip.net)
|
||||
|
||||
(c) Copyright 2002 - 2006 Brad Jorsch (anomie@users.sourceforge.net),
|
||||
funkyass (funkyass@spam.shaw.ca),
|
||||
Kris Bleakley (codeviolation@hotmail.com),
|
||||
Nach (n-a-c-h@users.sourceforge.net), and
|
||||
(c) Copyright 2002 - 2006 funkyass (funkyass@spam.shaw.ca),
|
||||
Kris Bleakley (codeviolation@hotmail.com)
|
||||
|
||||
(c) Copyright 2002 - 2007 Brad Jorsch (anomie@users.sourceforge.net),
|
||||
Nach (n-a-c-h@users.sourceforge.net),
|
||||
zones (kasumitokoduck@yahoo.com)
|
||||
|
||||
(c) Copyright 2006 - 2007 nitsuja
|
||||
|
||||
|
||||
BS-X C emulator code
|
||||
(c) Copyright 2005 - 2006 Dreamer Nom,
|
||||
zones
|
||||
@ -110,17 +114,30 @@
|
||||
2xSaI filter
|
||||
(c) Copyright 1999 - 2001 Derek Liauw Kie Fa
|
||||
|
||||
HQ2x filter
|
||||
HQ2x, HQ3x, HQ4x filters
|
||||
(c) Copyright 2003 Maxim Stepin (maxim@hiend3d.com)
|
||||
|
||||
Win32 GUI code
|
||||
(c) Copyright 2003 - 2006 blip,
|
||||
funkyass,
|
||||
Matthew Kendora,
|
||||
Nach,
|
||||
nitsuja
|
||||
|
||||
Mac OS GUI code
|
||||
(c) Copyright 1998 - 2001 John Stiles
|
||||
(c) Copyright 2001 - 2007 zones
|
||||
|
||||
|
||||
Specific ports contains the works of other authors. See headers in
|
||||
individual files.
|
||||
|
||||
|
||||
Snes9x homepage: http://www.snes9x.com
|
||||
|
||||
Permission to use, copy, modify and/or distribute Snes9x in both binary
|
||||
and source form, for non-commercial purposes, is hereby granted without
|
||||
fee, providing that this license information and copyright notice appear
|
||||
and source form, for non-commercial purposes, is hereby granted without
|
||||
fee, providing that this license information and copyright notice appear
|
||||
with all copies and any derived work.
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
@ -142,6 +159,8 @@
|
||||
**********************************************************************************/
|
||||
|
||||
|
||||
|
||||
|
||||
#include "snes9x.h"
|
||||
#include "memmap.h"
|
||||
#include "cpuops.h"
|
||||
@ -163,10 +182,17 @@ extern struct FxInit_s SuperFX;
|
||||
|
||||
void S9xMainLoop (void)
|
||||
{
|
||||
if(ICPU.SavedAtOp)
|
||||
{
|
||||
ICPU.SavedAtOp = FALSE;
|
||||
Registers.PCw = CPU.PBPCAtOpcodeStart;
|
||||
if(CPU.PCBase)
|
||||
CPU.Cycles -= CPU.MemSpeed;
|
||||
goto doOp;
|
||||
}
|
||||
|
||||
for (;;)
|
||||
{
|
||||
APU_EXECUTE();
|
||||
|
||||
if (CPU.Flags)
|
||||
{
|
||||
if (CPU.Flags & NMI_FLAG)
|
||||
@ -180,11 +206,11 @@ void S9xMainLoop (void)
|
||||
CPU.WaitingForInterrupt = FALSE;
|
||||
Registers.PCw++;
|
||||
}
|
||||
|
||||
|
||||
S9xOpcode_NMI();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#ifdef DEBUGGER
|
||||
if ((CPU.Flags & BREAK_FLAG) && !(CPU.Flags & SINGLE_STEP_FLAG))
|
||||
{
|
||||
@ -202,26 +228,33 @@ void S9xMainLoop (void)
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
CHECK_SOUND();
|
||||
|
||||
if (CPU.Flags & IRQ_PENDING_FLAG)
|
||||
if (CPU.Flags & IRQ_FLAG)
|
||||
{
|
||||
if (CPU.WaitingForInterrupt)
|
||||
{
|
||||
CPU.WaitingForInterrupt = FALSE;
|
||||
Registers.PCw++;
|
||||
}
|
||||
|
||||
if (CPU.IRQActive && !Settings.DisableIRQ)
|
||||
{
|
||||
if (!CheckFlag(IRQ))
|
||||
S9xOpcode_IRQ();
|
||||
}
|
||||
if (CPU.IRQPending)
|
||||
// FIXME: In case of IRQ during WRAM refresh
|
||||
CPU.IRQPending = 0;
|
||||
else
|
||||
CPU.Flags &= ~IRQ_PENDING_FLAG;
|
||||
{
|
||||
if (CPU.WaitingForInterrupt)
|
||||
{
|
||||
CPU.WaitingForInterrupt = FALSE;
|
||||
Registers.PCw++;
|
||||
}
|
||||
|
||||
if (CPU.IRQActive && !Settings.DisableIRQ)
|
||||
{
|
||||
if (!CheckFlag(IRQ))
|
||||
// in IRQ handler $4211 is supposed to be read, so IRQ_FLAG should be cleared.
|
||||
S9xOpcode_IRQ();
|
||||
}
|
||||
else
|
||||
CPU.Flags &= ~IRQ_FLAG;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (CPU.Flags & SCAN_KEYS_FLAG)
|
||||
break;
|
||||
|
||||
@ -239,14 +272,16 @@ void S9xMainLoop (void)
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
#ifdef CPU_SHUTDOWN
|
||||
CPU.PBPCAtOpcodeStart = Registers.PBPC;
|
||||
#endif
|
||||
|
||||
doOp:
|
||||
register uint8 Op;
|
||||
register struct SOpcodes *Opcodes;
|
||||
|
||||
|
||||
CPU.PrevCycles = CPU.Cycles;
|
||||
|
||||
if (CPU.PCBase)
|
||||
{
|
||||
Op = CPU.PCBase[Registers.PCw];
|
||||
@ -259,7 +294,7 @@ void S9xMainLoop (void)
|
||||
OpenBus = Op;
|
||||
Opcodes = S9xOpcodesSlow;
|
||||
}
|
||||
|
||||
|
||||
if ((Registers.PCw&MEMMAP_MASK) + ICPU.S9xOpLengths[Op] >= MEMMAP_BLOCK_SIZE)
|
||||
{
|
||||
uint8 *oldPCBase = CPU.PCBase;
|
||||
@ -268,23 +303,29 @@ void S9xMainLoop (void)
|
||||
if (oldPCBase!=CPU.PCBase || (Registers.PCw&~MEMMAP_MASK) == (0xffff & ~MEMMAP_MASK))
|
||||
Opcodes = S9xOpcodesSlow;
|
||||
}
|
||||
|
||||
|
||||
Registers.PCw++;
|
||||
(*Opcodes[Op].S9xOpcode)();
|
||||
|
||||
S9xUpdateAPUTimer();
|
||||
|
||||
|
||||
if(ICPU.SavedAtOp)
|
||||
{
|
||||
ICPU.SavedAtOp = false;
|
||||
continue;
|
||||
}
|
||||
|
||||
S9xAPUExecute();
|
||||
|
||||
if (SA1.Executing)
|
||||
S9xSA1MainLoop();
|
||||
|
||||
if (CPU.Cycles >= CPU.NextEvent)
|
||||
|
||||
while (CPU.Cycles >= CPU.NextEvent)
|
||||
S9xDoHEventProcessing();
|
||||
}
|
||||
|
||||
|
||||
S9xPackStatus();
|
||||
APURegisters.PC = IAPU.PC - IAPU.RAM;
|
||||
S9xAPUPackStatus();
|
||||
|
||||
|
||||
if (CPU.Flags & SCAN_KEYS_FLAG)
|
||||
{
|
||||
#ifdef DEBUGGER
|
||||
@ -298,11 +339,11 @@ void S9xMainLoop (void)
|
||||
void S9xSetIRQ (uint32 source)
|
||||
{
|
||||
CPU.IRQActive |= source;
|
||||
CPU.Flags |= IRQ_PENDING_FLAG;
|
||||
|
||||
CPU.Flags |= IRQ_FLAG;
|
||||
|
||||
if (CPU.WaitingForInterrupt)
|
||||
{
|
||||
// Force IRQ to trigger immediately after WAI -
|
||||
// Force IRQ to trigger immediately after WAI -
|
||||
// Final Fantasy Mystic Quest crashes without this.
|
||||
CPU.WaitingForInterrupt = FALSE;
|
||||
Registers.PCw++;
|
||||
@ -316,6 +357,10 @@ void S9xClearIRQ (uint32 source)
|
||||
|
||||
void S9xDoHEventProcessing (void)
|
||||
{
|
||||
#ifdef DEBUGGER
|
||||
char mes[256];
|
||||
#endif
|
||||
|
||||
#ifdef CPU_SHUTDOWN
|
||||
CPU.WaitCounter++;
|
||||
#endif
|
||||
@ -323,17 +368,23 @@ void S9xDoHEventProcessing (void)
|
||||
{
|
||||
case HC_HBLANK_START_EVENT:
|
||||
S9xCheckMissingHTimerPosition(Timings.HBlankStart);
|
||||
|
||||
|
||||
break;
|
||||
|
||||
|
||||
case HC_HDMA_START_EVENT:
|
||||
if (IPPU.HDMA && CPU.V_Counter <= PPU.ScreenHeight)
|
||||
{
|
||||
#ifdef DEBUGGER
|
||||
sprintf(mes, "*** HDMA HC:%04d, Channel:%02x", CPU.Cycles, IPPU.HDMA);
|
||||
S9xTraceMessage(mes);
|
||||
#endif
|
||||
IPPU.HDMA = S9xDoHDMA(IPPU.HDMA);
|
||||
|
||||
}
|
||||
|
||||
S9xCheckMissingHTimerPosition(Timings.HDMAStart);
|
||||
|
||||
|
||||
break;
|
||||
|
||||
|
||||
case HC_HCOUNTER_MAX_EVENT:
|
||||
#ifndef ZSNES_FX
|
||||
if (Settings.SuperFX)
|
||||
@ -352,14 +403,12 @@ void S9xDoHEventProcessing (void)
|
||||
#endif
|
||||
|
||||
CPU.Cycles -= Timings.H_Max;
|
||||
IAPU.NextAPUTimerPos -= (Timings.H_Max << SNES_APUTIMER_ACCURACY);
|
||||
if (IAPU.APUExecuting)
|
||||
APU.Cycles -= Timings.H_Max;
|
||||
else
|
||||
APU.Cycles = 0;
|
||||
IAPU.NextAPUTimerPos -= (Timings.H_Max << SNES_APU_ACCURACY);
|
||||
APU.Cycles -= (Timings.H_Max << SNES_APU_ACCURACY);
|
||||
|
||||
if ((Timings.NMITriggerPos != 0xffff) && (Timings.NMITriggerPos >= Timings.H_Max))
|
||||
Timings.NMITriggerPos -= Timings.H_Max;
|
||||
|
||||
|
||||
ICPU.Scanline++;
|
||||
|
||||
CPU.V_Counter++;
|
||||
@ -367,9 +416,9 @@ void S9xDoHEventProcessing (void)
|
||||
{
|
||||
CPU.V_Counter = 0;
|
||||
Timings.InterlaceField ^= 1;
|
||||
|
||||
|
||||
// From byuu:
|
||||
// [NTSC]
|
||||
// [NTSC]
|
||||
// interlace mode has 525 scanlines: 263 on the even frame, and 262 on the odd.
|
||||
// non-interlace mode has 524 scanlines: 262 scanlines on both even and odd frames.
|
||||
// [PAL] <PAL info is unverified on hardware>
|
||||
@ -379,15 +428,15 @@ void S9xDoHEventProcessing (void)
|
||||
Timings.V_Max = Timings.V_Max_Master + 1; // 263 (NTSC), 313?(PAL)
|
||||
else
|
||||
Timings.V_Max = Timings.V_Max_Master; // 262 (NTSC), 312?(PAL)
|
||||
|
||||
|
||||
Memory.FillRAM[0x213F] ^= 0x80;
|
||||
PPU.RangeTimeOver = 0;
|
||||
|
||||
|
||||
// FIXME: reading $4210 will wait 2 cycles, then perform reading, then wait 4 more cycles.
|
||||
Memory.FillRAM[0x4210] = Model->_5A22;
|
||||
CPU.Flags &= ~NMI_FLAG;
|
||||
Timings.NMITriggerPos = 0xffff;
|
||||
|
||||
|
||||
ICPU.Frame++;
|
||||
PPU.HVBeamCounterLatched = 0;
|
||||
CPU.Flags |= SCAN_KEYS_FLAG;
|
||||
@ -403,7 +452,7 @@ void S9xDoHEventProcessing (void)
|
||||
Timings.H_Max = Timings.H_Max_Master - ONE_DOT_CYCLE; // HC=1360
|
||||
else
|
||||
Timings.H_Max = Timings.H_Max_Master; // HC=1364
|
||||
|
||||
|
||||
if (Model->_5A22 == 2)
|
||||
{
|
||||
if (CPU.V_Counter != 240 || IPPU.Interlace || !Timings.InterlaceField) // V=240
|
||||
@ -416,7 +465,7 @@ void S9xDoHEventProcessing (void)
|
||||
}
|
||||
else
|
||||
Timings.WRAMRefreshPos = SNES_WRAM_REFRESH_HC_v1;
|
||||
|
||||
|
||||
S9xCheckMissingHTimerPosition(0);
|
||||
|
||||
if (CPU.V_Counter == PPU.ScreenHeight + FIRST_VISIBLE_LINE) // VBlank starts from V=225(240).
|
||||
@ -435,7 +484,7 @@ void S9xDoHEventProcessing (void)
|
||||
PPU.OAMAddr = PPU.SavedOAMAddr;
|
||||
|
||||
uint8 tmp = 0;
|
||||
|
||||
|
||||
if (PPU.OAMPriorityRotation)
|
||||
tmp = (PPU.OAMAddr & 0xFE) >> 1;
|
||||
if ((PPU.OAMFlip & 1) || PPU.FirstSprite!=tmp)
|
||||
@ -443,7 +492,7 @@ void S9xDoHEventProcessing (void)
|
||||
PPU.FirstSprite = tmp;
|
||||
IPPU.OBJChanged = TRUE;
|
||||
}
|
||||
|
||||
|
||||
PPU.OAMFlip = 0;
|
||||
}
|
||||
|
||||
@ -458,44 +507,47 @@ void S9xDoHEventProcessing (void)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
if (CPU.V_Counter == PPU.ScreenHeight + 3) // FIXME: not true
|
||||
S9xDoAutoJoypad();
|
||||
|
||||
{
|
||||
if (Memory.FillRAM[0x4200] & 1)
|
||||
S9xDoAutoJoypad();
|
||||
}
|
||||
|
||||
if (CPU.V_Counter == FIRST_VISIBLE_LINE) // V=1
|
||||
S9xStartScreenRefresh();
|
||||
|
||||
|
||||
CPU.NextEvent = -1;
|
||||
|
||||
|
||||
break;
|
||||
|
||||
|
||||
case HC_HDMA_INIT_EVENT:
|
||||
if (CPU.V_Counter == 0)
|
||||
S9xStartHDMA();
|
||||
|
||||
|
||||
S9xCheckMissingHTimerPosition(Timings.HDMAInit);
|
||||
|
||||
|
||||
break;
|
||||
|
||||
|
||||
case HC_RENDER_EVENT:
|
||||
if (CPU.V_Counter >= FIRST_VISIBLE_LINE && CPU.V_Counter <= PPU.ScreenHeight)
|
||||
RenderLine(CPU.V_Counter - FIRST_VISIBLE_LINE);
|
||||
|
||||
RenderLine((uint8)(CPU.V_Counter - FIRST_VISIBLE_LINE));
|
||||
|
||||
S9xCheckMissingHTimerPosition(Timings.RenderPos);
|
||||
|
||||
|
||||
break;
|
||||
|
||||
|
||||
case HC_WRAM_REFRESH_EVENT:
|
||||
if (!CPU.InDMA)
|
||||
{
|
||||
S9xCheckMissingHTimerPositionRange(Timings.WRAMRefreshPos, SNES_WRAM_REFRESH_CYCLES);
|
||||
CPU.Cycles += SNES_WRAM_REFRESH_CYCLES;
|
||||
S9xUpdateAPUTimer();
|
||||
APU_EXECUTE();
|
||||
}
|
||||
else
|
||||
S9xCheckMissingHTimerPosition(Timings.WRAMRefreshPos);
|
||||
|
||||
#ifdef DEBUGGER
|
||||
sprintf(mes, "*** WRAM Refresh HC:%04d", CPU.Cycles);
|
||||
S9xTraceMessage(mes);
|
||||
#endif
|
||||
S9xCheckMissingHTimerHalt(Timings.WRAMRefreshPos, SNES_WRAM_REFRESH_CYCLES);
|
||||
CPU.Cycles += SNES_WRAM_REFRESH_CYCLES;
|
||||
S9xAPUExecute();
|
||||
|
||||
S9xCheckMissingHTimerPosition(Timings.WRAMRefreshPos);
|
||||
|
||||
break;
|
||||
|
||||
case HC_IRQ_1_3_EVENT:
|
||||
@ -509,9 +561,9 @@ void S9xDoHEventProcessing (void)
|
||||
else
|
||||
if (PPU.VTimerEnabled && (CPU.V_Counter == PPU.VTimerPosition))
|
||||
S9xSetIRQ(PPU_V_BEAM_IRQ_SOURCE);
|
||||
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
S9xReschedule();
|
||||
}
|
||||
|
@ -1,7 +1,7 @@
|
||||
/**********************************************************************************
|
||||
Snes9x - Portable Super Nintendo Entertainment System (TM) emulator.
|
||||
|
||||
(c) Copyright 1996 - 2002 Gary Henderson (gary.henderson@ntlworld.com) and
|
||||
(c) Copyright 1996 - 2002 Gary Henderson (gary.henderson@ntlworld.com),
|
||||
Jerremy Koot (jkoot@snes9x.com)
|
||||
|
||||
(c) Copyright 2002 - 2004 Matthew Kendora
|
||||
@ -12,12 +12,16 @@
|
||||
|
||||
(c) Copyright 2001 - 2006 John Weidman (jweidman@slip.net)
|
||||
|
||||
(c) Copyright 2002 - 2006 Brad Jorsch (anomie@users.sourceforge.net),
|
||||
funkyass (funkyass@spam.shaw.ca),
|
||||
Kris Bleakley (codeviolation@hotmail.com),
|
||||
Nach (n-a-c-h@users.sourceforge.net), and
|
||||
(c) Copyright 2002 - 2006 funkyass (funkyass@spam.shaw.ca),
|
||||
Kris Bleakley (codeviolation@hotmail.com)
|
||||
|
||||
(c) Copyright 2002 - 2007 Brad Jorsch (anomie@users.sourceforge.net),
|
||||
Nach (n-a-c-h@users.sourceforge.net),
|
||||
zones (kasumitokoduck@yahoo.com)
|
||||
|
||||
(c) Copyright 2006 - 2007 nitsuja
|
||||
|
||||
|
||||
BS-X C emulator code
|
||||
(c) Copyright 2005 - 2006 Dreamer Nom,
|
||||
zones
|
||||
@ -110,17 +114,30 @@
|
||||
2xSaI filter
|
||||
(c) Copyright 1999 - 2001 Derek Liauw Kie Fa
|
||||
|
||||
HQ2x filter
|
||||
HQ2x, HQ3x, HQ4x filters
|
||||
(c) Copyright 2003 Maxim Stepin (maxim@hiend3d.com)
|
||||
|
||||
Win32 GUI code
|
||||
(c) Copyright 2003 - 2006 blip,
|
||||
funkyass,
|
||||
Matthew Kendora,
|
||||
Nach,
|
||||
nitsuja
|
||||
|
||||
Mac OS GUI code
|
||||
(c) Copyright 1998 - 2001 John Stiles
|
||||
(c) Copyright 2001 - 2007 zones
|
||||
|
||||
|
||||
Specific ports contains the works of other authors. See headers in
|
||||
individual files.
|
||||
|
||||
|
||||
Snes9x homepage: http://www.snes9x.com
|
||||
|
||||
Permission to use, copy, modify and/or distribute Snes9x in both binary
|
||||
and source form, for non-commercial purposes, is hereby granted without
|
||||
fee, providing that this license information and copyright notice appear
|
||||
and source form, for non-commercial purposes, is hereby granted without
|
||||
fee, providing that this license information and copyright notice appear
|
||||
with all copies and any derived work.
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
@ -142,6 +159,8 @@
|
||||
**********************************************************************************/
|
||||
|
||||
|
||||
|
||||
|
||||
#ifndef _CPUEXEC_H_
|
||||
#define _CPUEXEC_H_
|
||||
|
||||
@ -157,7 +176,7 @@ struct SOpcodes {
|
||||
|
||||
struct SICPU
|
||||
{
|
||||
uint8 *Speed;
|
||||
uint8 *Speed; // unused
|
||||
struct SOpcodes *S9xOpcodes;
|
||||
uint8 *S9xOpLengths;
|
||||
uint8 _Carry;
|
||||
@ -170,6 +189,7 @@ struct SICPU
|
||||
uint32 Frame;
|
||||
uint32 Scanline;
|
||||
uint32 FrameAdvanceCount;
|
||||
bool8 SavedAtOp;
|
||||
};
|
||||
|
||||
START_EXTERN_C
|
||||
@ -219,9 +239,9 @@ STATIC inline void CLEAR_IRQ_SOURCE (uint32 M)
|
||||
{
|
||||
CPU.IRQActive &= ~M;
|
||||
if (!CPU.IRQActive)
|
||||
CPU.Flags &= ~IRQ_PENDING_FLAG;
|
||||
CPU.Flags &= ~IRQ_FLAG;
|
||||
}
|
||||
|
||||
|
||||
STATIC inline void S9xFixCycles ()
|
||||
{
|
||||
if (CheckEmulation ())
|
||||
|
@ -1,7 +1,7 @@
|
||||
/**********************************************************************************
|
||||
Snes9x - Portable Super Nintendo Entertainment System (TM) emulator.
|
||||
|
||||
(c) Copyright 1996 - 2002 Gary Henderson (gary.henderson@ntlworld.com) and
|
||||
(c) Copyright 1996 - 2002 Gary Henderson (gary.henderson@ntlworld.com),
|
||||
Jerremy Koot (jkoot@snes9x.com)
|
||||
|
||||
(c) Copyright 2002 - 2004 Matthew Kendora
|
||||
@ -12,12 +12,16 @@
|
||||
|
||||
(c) Copyright 2001 - 2006 John Weidman (jweidman@slip.net)
|
||||
|
||||
(c) Copyright 2002 - 2006 Brad Jorsch (anomie@users.sourceforge.net),
|
||||
funkyass (funkyass@spam.shaw.ca),
|
||||
Kris Bleakley (codeviolation@hotmail.com),
|
||||
Nach (n-a-c-h@users.sourceforge.net), and
|
||||
(c) Copyright 2002 - 2006 funkyass (funkyass@spam.shaw.ca),
|
||||
Kris Bleakley (codeviolation@hotmail.com)
|
||||
|
||||
(c) Copyright 2002 - 2007 Brad Jorsch (anomie@users.sourceforge.net),
|
||||
Nach (n-a-c-h@users.sourceforge.net),
|
||||
zones (kasumitokoduck@yahoo.com)
|
||||
|
||||
(c) Copyright 2006 - 2007 nitsuja
|
||||
|
||||
|
||||
BS-X C emulator code
|
||||
(c) Copyright 2005 - 2006 Dreamer Nom,
|
||||
zones
|
||||
@ -110,17 +114,30 @@
|
||||
2xSaI filter
|
||||
(c) Copyright 1999 - 2001 Derek Liauw Kie Fa
|
||||
|
||||
HQ2x filter
|
||||
HQ2x, HQ3x, HQ4x filters
|
||||
(c) Copyright 2003 Maxim Stepin (maxim@hiend3d.com)
|
||||
|
||||
Win32 GUI code
|
||||
(c) Copyright 2003 - 2006 blip,
|
||||
funkyass,
|
||||
Matthew Kendora,
|
||||
Nach,
|
||||
nitsuja
|
||||
|
||||
Mac OS GUI code
|
||||
(c) Copyright 1998 - 2001 John Stiles
|
||||
(c) Copyright 2001 - 2007 zones
|
||||
|
||||
|
||||
Specific ports contains the works of other authors. See headers in
|
||||
individual files.
|
||||
|
||||
|
||||
Snes9x homepage: http://www.snes9x.com
|
||||
|
||||
Permission to use, copy, modify and/or distribute Snes9x in both binary
|
||||
and source form, for non-commercial purposes, is hereby granted without
|
||||
fee, providing that this license information and copyright notice appear
|
||||
and source form, for non-commercial purposes, is hereby granted without
|
||||
fee, providing that this license information and copyright notice appear
|
||||
with all copies and any derived work.
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
@ -142,6 +159,8 @@
|
||||
**********************************************************************************/
|
||||
|
||||
|
||||
|
||||
|
||||
#ifndef _CPUMACRO_H_
|
||||
#define _CPUMACRO_H_
|
||||
|
||||
@ -226,10 +245,10 @@
|
||||
mOPC(OP, Memory, ADDR, WRAP, FUNC)
|
||||
|
||||
|
||||
#define bOP(OP, COND, CHK, E) \
|
||||
#define bOP(OP, REL, COND, CHK, E) \
|
||||
static void Op##OP (void) { \
|
||||
pair newPC; \
|
||||
newPC.W = Relative(JUMP); \
|
||||
newPC.W = REL(JUMP); \
|
||||
BranchCheck##CHK (); \
|
||||
if(COND){ \
|
||||
AddCycles(ONE_CYCLE); \
|
||||
@ -290,7 +309,7 @@ STATIC inline void ADC (uint8 Work8) {
|
||||
|
||||
ICPU._Carry = Ans16 >= 0x100;
|
||||
|
||||
if (~(Registers.AL ^ Work8) &
|
||||
if (~(Registers.AL ^ Work8) &
|
||||
(Work8 ^ (uint8) Ans16) & 0x80)
|
||||
SetOverflow();
|
||||
else
|
||||
|
@ -1,7 +1,7 @@
|
||||
/**********************************************************************************
|
||||
Snes9x - Portable Super Nintendo Entertainment System (TM) emulator.
|
||||
|
||||
(c) Copyright 1996 - 2002 Gary Henderson (gary.henderson@ntlworld.com) and
|
||||
(c) Copyright 1996 - 2002 Gary Henderson (gary.henderson@ntlworld.com),
|
||||
Jerremy Koot (jkoot@snes9x.com)
|
||||
|
||||
(c) Copyright 2002 - 2004 Matthew Kendora
|
||||
@ -12,12 +12,16 @@
|
||||
|
||||
(c) Copyright 2001 - 2006 John Weidman (jweidman@slip.net)
|
||||
|
||||
(c) Copyright 2002 - 2006 Brad Jorsch (anomie@users.sourceforge.net),
|
||||
funkyass (funkyass@spam.shaw.ca),
|
||||
Kris Bleakley (codeviolation@hotmail.com),
|
||||
Nach (n-a-c-h@users.sourceforge.net), and
|
||||
(c) Copyright 2002 - 2006 funkyass (funkyass@spam.shaw.ca),
|
||||
Kris Bleakley (codeviolation@hotmail.com)
|
||||
|
||||
(c) Copyright 2002 - 2007 Brad Jorsch (anomie@users.sourceforge.net),
|
||||
Nach (n-a-c-h@users.sourceforge.net),
|
||||
zones (kasumitokoduck@yahoo.com)
|
||||
|
||||
(c) Copyright 2006 - 2007 nitsuja
|
||||
|
||||
|
||||
BS-X C emulator code
|
||||
(c) Copyright 2005 - 2006 Dreamer Nom,
|
||||
zones
|
||||
@ -110,17 +114,30 @@
|
||||
2xSaI filter
|
||||
(c) Copyright 1999 - 2001 Derek Liauw Kie Fa
|
||||
|
||||
HQ2x filter
|
||||
HQ2x, HQ3x, HQ4x filters
|
||||
(c) Copyright 2003 Maxim Stepin (maxim@hiend3d.com)
|
||||
|
||||
Win32 GUI code
|
||||
(c) Copyright 2003 - 2006 blip,
|
||||
funkyass,
|
||||
Matthew Kendora,
|
||||
Nach,
|
||||
nitsuja
|
||||
|
||||
Mac OS GUI code
|
||||
(c) Copyright 1998 - 2001 John Stiles
|
||||
(c) Copyright 2001 - 2007 zones
|
||||
|
||||
|
||||
Specific ports contains the works of other authors. See headers in
|
||||
individual files.
|
||||
|
||||
|
||||
Snes9x homepage: http://www.snes9x.com
|
||||
|
||||
Permission to use, copy, modify and/or distribute Snes9x in both binary
|
||||
and source form, for non-commercial purposes, is hereby granted without
|
||||
fee, providing that this license information and copyright notice appear
|
||||
and source form, for non-commercial purposes, is hereby granted without
|
||||
fee, providing that this license information and copyright notice appear
|
||||
with all copies and any derived work.
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
@ -142,6 +159,8 @@
|
||||
**********************************************************************************/
|
||||
|
||||
|
||||
|
||||
|
||||
/*****************************************************************************/
|
||||
/* CPU-S9xOpcodes.CPP */
|
||||
/* This file contains all the opcodes */
|
||||
@ -162,7 +181,7 @@
|
||||
#include "dsp1.h"
|
||||
|
||||
#ifdef SA1_OPCODES
|
||||
#define AddCycles(n)
|
||||
#define AddCycles(n) {}
|
||||
#else
|
||||
#define AddCycles(n) CPU.Cycles+=n
|
||||
#endif
|
||||
@ -811,10 +830,10 @@ static void OpA9M0 (void) {
|
||||
|
||||
static void OpA9Slow (void) {
|
||||
if(CheckMemory()) {
|
||||
Registers.AL = Immediate8(READ);
|
||||
Registers.AL = Immediate8Slow(READ);
|
||||
SetZN(Registers.AL);
|
||||
} else {
|
||||
Registers.A.W = Immediate16(READ);
|
||||
Registers.A.W = Immediate16Slow(READ);
|
||||
SetZN(Registers.A.W);
|
||||
}
|
||||
}
|
||||
@ -1504,51 +1523,39 @@ mOPM (0CSlow, AbsoluteSlow, WRAP_BANK, TSB)
|
||||
#ifndef SA1_OPCODES
|
||||
inline void CPUShutdown()
|
||||
{
|
||||
if (Settings.Shutdown && Registers.PBPC == CPU.WaitAddress)
|
||||
{
|
||||
// Don't skip cycles with a pending NMI or IRQ - could cause delayed
|
||||
// interrupt. Interrupts are delayed for a few cycles already, but
|
||||
// the delay could allow the shutdown code to cycle skip again.
|
||||
// Was causing screen flashing on Top Gear 3000.
|
||||
|
||||
if (CPU.WaitCounter == 0 &&
|
||||
!(CPU.Flags & (IRQ_PENDING_FLAG | NMI_FLAG)))
|
||||
if (Settings.Shutdown && Registers.PBPC == CPU.WaitAddress)
|
||||
{
|
||||
CPU.WaitAddress = 0xffffffff;
|
||||
if (Settings.SA1)
|
||||
S9xSA1ExecuteDuringSleep ();
|
||||
CPU.Cycles = CPU.NextEvent;
|
||||
S9xUpdateAPUTimer();
|
||||
if (IAPU.APUExecuting)
|
||||
{
|
||||
ICPU.CPUExecuting = FALSE;
|
||||
do
|
||||
// Don't skip cycles with a pending NMI or IRQ - could cause delayed interrupt.
|
||||
if (CPU.WaitCounter == 0 && !(CPU.Flags & (IRQ_FLAG | NMI_FLAG)))
|
||||
{
|
||||
APU_EXECUTE1();
|
||||
} while (APU.Cycles < CPU.NextEvent);
|
||||
ICPU.CPUExecuting = TRUE;
|
||||
}
|
||||
CPU.WaitAddress = 0xffffffff;
|
||||
if (Settings.SA1)
|
||||
S9xSA1ExecuteDuringSleep();
|
||||
CPU.Cycles = CPU.NextEvent;
|
||||
ICPU.CPUExecuting = FALSE;
|
||||
S9xAPUExecute();
|
||||
ICPU.CPUExecuting = TRUE;
|
||||
}
|
||||
else
|
||||
if (CPU.WaitCounter >= 2)
|
||||
CPU.WaitCounter = 1;
|
||||
else
|
||||
CPU.WaitCounter--;
|
||||
}
|
||||
else
|
||||
if (CPU.WaitCounter >= 2)
|
||||
CPU.WaitCounter = 1;
|
||||
else
|
||||
CPU.WaitCounter--;
|
||||
}
|
||||
}
|
||||
#else
|
||||
inline void CPUShutdown()
|
||||
{
|
||||
if (Settings.Shutdown && Registers.PBPC == CPU.WaitAddress)
|
||||
{
|
||||
if (CPU.WaitCounter >= 1)
|
||||
if (Settings.Shutdown && Registers.PBPC == CPU.WaitAddress)
|
||||
{
|
||||
SA1.Executing = FALSE;
|
||||
SA1.CPUExecuting = FALSE;
|
||||
if (CPU.WaitCounter >= 1)
|
||||
{
|
||||
SA1.Executing = FALSE;
|
||||
SA1.CPUExecuting = FALSE;
|
||||
}
|
||||
else
|
||||
CPU.WaitCounter++;
|
||||
}
|
||||
else
|
||||
CPU.WaitCounter++;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
#else
|
||||
@ -1556,55 +1563,59 @@ inline void CPUShutdown()
|
||||
#endif
|
||||
|
||||
/* BCC */
|
||||
bOP(90E0, !CheckCarry(), 0, 0)
|
||||
bOP(90E1, !CheckCarry(), 0, 1)
|
||||
bOP(90Slow, !CheckCarry(), 0, CheckEmulation())
|
||||
bOP(90E0, Relative, !CheckCarry(), 0, 0)
|
||||
bOP(90E1, Relative, !CheckCarry(), 0, 1)
|
||||
bOP(90Slow, RelativeSlow, !CheckCarry(), 0, CheckEmulation())
|
||||
|
||||
/* BCS */
|
||||
bOP(B0E0, CheckCarry(), 0, 0)
|
||||
bOP(B0E1, CheckCarry(), 0, 1)
|
||||
bOP(B0Slow, CheckCarry(), 0, CheckEmulation())
|
||||
bOP(B0E0, Relative, CheckCarry(), 0, 0)
|
||||
bOP(B0E1, Relative, CheckCarry(), 0, 1)
|
||||
bOP(B0Slow, RelativeSlow, CheckCarry(), 0, CheckEmulation())
|
||||
|
||||
/* BEQ */
|
||||
bOP(F0E0, CheckZero(), 2, 0)
|
||||
bOP(F0E1, CheckZero(), 2, 1)
|
||||
bOP(F0Slow, CheckZero(), 2, CheckEmulation())
|
||||
bOP(F0E0, Relative, CheckZero(), 2, 0)
|
||||
bOP(F0E1, Relative, CheckZero(), 2, 1)
|
||||
bOP(F0Slow, RelativeSlow, CheckZero(), 2, CheckEmulation())
|
||||
|
||||
/* BMI */
|
||||
bOP(30E0, CheckNegative(), 1, 0)
|
||||
bOP(30E1, CheckNegative(), 1, 1)
|
||||
bOP(30Slow, CheckNegative(), 1, CheckEmulation())
|
||||
bOP(30E0, Relative, CheckNegative(), 1, 0)
|
||||
bOP(30E1, Relative, CheckNegative(), 1, 1)
|
||||
bOP(30Slow, RelativeSlow, CheckNegative(), 1, CheckEmulation())
|
||||
|
||||
/* BNE */
|
||||
bOP(D0E0, !CheckZero(), 1, 0)
|
||||
bOP(D0E1, !CheckZero(), 1, 1)
|
||||
bOP(D0Slow, !CheckZero(), 1, CheckEmulation())
|
||||
bOP(D0E0, Relative, !CheckZero(), 1, 0)
|
||||
bOP(D0E1, Relative, !CheckZero(), 1, 1)
|
||||
bOP(D0Slow, RelativeSlow, !CheckZero(), 1, CheckEmulation())
|
||||
|
||||
/* BPL */
|
||||
bOP(10E0, !CheckNegative(), 1, 0)
|
||||
bOP(10E1, !CheckNegative(), 1, 1)
|
||||
bOP(10Slow, !CheckNegative(), 1, CheckEmulation())
|
||||
bOP(10E0, Relative, !CheckNegative(), 1, 0)
|
||||
bOP(10E1, Relative, !CheckNegative(), 1, 1)
|
||||
bOP(10Slow, RelativeSlow, !CheckNegative(), 1, CheckEmulation())
|
||||
|
||||
/* BRA */
|
||||
bOP(80E0, 1, X, 0)
|
||||
bOP(80E1, 1, X, 1)
|
||||
bOP(80Slow, 1, X, CheckEmulation())
|
||||
bOP(80E0, Relative, 1, X, 0)
|
||||
bOP(80E1, Relative, 1, X, 1)
|
||||
bOP(80Slow, RelativeSlow, 1, X, CheckEmulation())
|
||||
|
||||
/* BVC */
|
||||
bOP(50E0, !CheckOverflow(), 0, 0)
|
||||
bOP(50E1, !CheckOverflow(), 0, 1)
|
||||
bOP(50Slow, !CheckOverflow(), 0, CheckEmulation())
|
||||
bOP(50E0, Relative, !CheckOverflow(), 0, 0)
|
||||
bOP(50E1, Relative, !CheckOverflow(), 0, 1)
|
||||
bOP(50Slow, RelativeSlow, !CheckOverflow(), 0, CheckEmulation())
|
||||
|
||||
/* BVS */
|
||||
bOP(70E0, CheckOverflow(), 0, 0)
|
||||
bOP(70E1, CheckOverflow(), 0, 1)
|
||||
bOP(70Slow, CheckOverflow(), 0, CheckEmulation())
|
||||
bOP(70E0, Relative, CheckOverflow(), 0, 0)
|
||||
bOP(70E1, Relative, CheckOverflow(), 0, 1)
|
||||
bOP(70Slow, RelativeSlow, CheckOverflow(), 0, CheckEmulation())
|
||||
|
||||
/* BRL */
|
||||
static void Op82 (void) {
|
||||
S9xSetPCBase(ICPU.ShiftedPB + RelativeLong(JUMP));
|
||||
}
|
||||
|
||||
static void Op82Slow (void) {
|
||||
S9xSetPCBase(ICPU.ShiftedPB + RelativeLongSlow(JUMP));
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
/* Flag Instructions ******************************************************* */
|
||||
@ -3034,9 +3045,9 @@ static void Op44X0 (void) {
|
||||
static void Op44Slow (void) {
|
||||
uint32 SrcBank;
|
||||
|
||||
OpenBus = Registers.DB = Immediate8(NONE);
|
||||
OpenBus = Registers.DB = Immediate8Slow(NONE);
|
||||
ICPU.ShiftedDB = Registers.DB << 16;
|
||||
OpenBus = SrcBank = Immediate8(NONE);
|
||||
OpenBus = SrcBank = Immediate8Slow(NONE);
|
||||
|
||||
S9xSetByte(OpenBus=S9xGetByte ((SrcBank << 16) + Registers.X.W),
|
||||
ICPU.ShiftedDB + Registers.Y.W);
|
||||
@ -3194,15 +3205,9 @@ static void OpCB (void) {
|
||||
// XXX: FIXME
|
||||
if(Settings.Shutdown){
|
||||
SA1.Cycles = SA1.NextEvent;
|
||||
if (IAPU.APUExecuting)
|
||||
{
|
||||
SA1.Executing = FALSE;
|
||||
do
|
||||
{
|
||||
APU_EXECUTE1 ();
|
||||
} while (APU.Cycles < SA1.NextEvent);
|
||||
SA1.Executing = TRUE;
|
||||
}
|
||||
SA1.Executing = FALSE;
|
||||
//S9xAPUExecute(); // FIXME
|
||||
SA1.Executing = TRUE;
|
||||
}
|
||||
#endif
|
||||
#else // SA1_OPCODES
|
||||
@ -3218,20 +3223,15 @@ static void OpCB (void) {
|
||||
if (Settings.Shutdown)
|
||||
{
|
||||
CPU.Cycles = CPU.NextEvent;
|
||||
S9xUpdateAPUTimer();
|
||||
if (IAPU.APUExecuting)
|
||||
{
|
||||
ICPU.CPUExecuting = FALSE;
|
||||
do
|
||||
{
|
||||
APU_EXECUTE1 ();
|
||||
} while (APU.Cycles < CPU.NextEvent);
|
||||
ICPU.CPUExecuting = TRUE;
|
||||
}
|
||||
} else {
|
||||
AddCycles(TWO_CYCLES);
|
||||
#endif
|
||||
ICPU.CPUExecuting = FALSE;
|
||||
S9xAPUExecute();
|
||||
ICPU.CPUExecuting = TRUE;
|
||||
}
|
||||
else
|
||||
AddCycles(TWO_CYCLES);
|
||||
#else
|
||||
AddCycles(TWO_CYCLES);
|
||||
#endif
|
||||
}
|
||||
#endif // SA1_OPCODES
|
||||
}
|
||||
@ -3248,9 +3248,10 @@ extern FILE *trace;
|
||||
extern FILE *trace2;
|
||||
#endif
|
||||
static void Op42 (void) {
|
||||
#ifndef NGC
|
||||
uint8 byte = S9xGetWord(Registers.PBPC);
|
||||
#ifdef DEBUGGER
|
||||
uint8 byte = (uint8)
|
||||
#endif
|
||||
S9xGetWord(Registers.PBPC);
|
||||
Registers.PCw++;
|
||||
#ifdef DEBUGGER
|
||||
// Hey, let's use this to trigger debug modes
|
||||
@ -3610,7 +3611,7 @@ struct SOpcodes S9xOpcodesSlow[256] = {
|
||||
{Op73Slow}, {Op74Slow}, {Op75Slow}, {Op76Slow}, {Op77Slow},
|
||||
{Op78}, {Op79Slow}, {Op7ASlow}, {Op7B}, {Op7CSlow},
|
||||
{Op7DSlow}, {Op7ESlow}, {Op7FSlow}, {Op80Slow}, {Op81Slow},
|
||||
{Op82}, {Op83Slow}, {Op84Slow}, {Op85Slow}, {Op86Slow},
|
||||
{Op82Slow}, {Op83Slow}, {Op84Slow}, {Op85Slow}, {Op86Slow},
|
||||
{Op87Slow}, {Op88Slow}, {Op89Slow}, {Op8ASlow}, {Op8BSlow},
|
||||
{Op8CSlow}, {Op8DSlow}, {Op8ESlow}, {Op8FSlow}, {Op90Slow},
|
||||
{Op91Slow}, {Op92Slow}, {Op93Slow}, {Op94Slow}, {Op95Slow},
|
||||
|
@ -1,7 +1,7 @@
|
||||
/**********************************************************************************
|
||||
Snes9x - Portable Super Nintendo Entertainment System (TM) emulator.
|
||||
|
||||
(c) Copyright 1996 - 2002 Gary Henderson (gary.henderson@ntlworld.com) and
|
||||
(c) Copyright 1996 - 2002 Gary Henderson (gary.henderson@ntlworld.com),
|
||||
Jerremy Koot (jkoot@snes9x.com)
|
||||
|
||||
(c) Copyright 2002 - 2004 Matthew Kendora
|
||||
@ -12,12 +12,16 @@
|
||||
|
||||
(c) Copyright 2001 - 2006 John Weidman (jweidman@slip.net)
|
||||
|
||||
(c) Copyright 2002 - 2006 Brad Jorsch (anomie@users.sourceforge.net),
|
||||
funkyass (funkyass@spam.shaw.ca),
|
||||
Kris Bleakley (codeviolation@hotmail.com),
|
||||
Nach (n-a-c-h@users.sourceforge.net), and
|
||||
(c) Copyright 2002 - 2006 funkyass (funkyass@spam.shaw.ca),
|
||||
Kris Bleakley (codeviolation@hotmail.com)
|
||||
|
||||
(c) Copyright 2002 - 2007 Brad Jorsch (anomie@users.sourceforge.net),
|
||||
Nach (n-a-c-h@users.sourceforge.net),
|
||||
zones (kasumitokoduck@yahoo.com)
|
||||
|
||||
(c) Copyright 2006 - 2007 nitsuja
|
||||
|
||||
|
||||
BS-X C emulator code
|
||||
(c) Copyright 2005 - 2006 Dreamer Nom,
|
||||
zones
|
||||
@ -110,17 +114,30 @@
|
||||
2xSaI filter
|
||||
(c) Copyright 1999 - 2001 Derek Liauw Kie Fa
|
||||
|
||||
HQ2x filter
|
||||
HQ2x, HQ3x, HQ4x filters
|
||||
(c) Copyright 2003 Maxim Stepin (maxim@hiend3d.com)
|
||||
|
||||
Win32 GUI code
|
||||
(c) Copyright 2003 - 2006 blip,
|
||||
funkyass,
|
||||
Matthew Kendora,
|
||||
Nach,
|
||||
nitsuja
|
||||
|
||||
Mac OS GUI code
|
||||
(c) Copyright 1998 - 2001 John Stiles
|
||||
(c) Copyright 2001 - 2007 zones
|
||||
|
||||
|
||||
Specific ports contains the works of other authors. See headers in
|
||||
individual files.
|
||||
|
||||
|
||||
Snes9x homepage: http://www.snes9x.com
|
||||
|
||||
Permission to use, copy, modify and/or distribute Snes9x in both binary
|
||||
and source form, for non-commercial purposes, is hereby granted without
|
||||
fee, providing that this license information and copyright notice appear
|
||||
and source form, for non-commercial purposes, is hereby granted without
|
||||
fee, providing that this license information and copyright notice appear
|
||||
with all copies and any derived work.
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
@ -142,6 +159,8 @@
|
||||
**********************************************************************************/
|
||||
|
||||
|
||||
|
||||
|
||||
#ifndef _CPUOPS_H_
|
||||
#define _CPUOPS_H_
|
||||
void S9xOpcode_NMI ();
|
||||
|
@ -1,7 +1,7 @@
|
||||
/**********************************************************************************
|
||||
Snes9x - Portable Super Nintendo Entertainment System (TM) emulator.
|
||||
|
||||
(c) Copyright 1996 - 2002 Gary Henderson (gary.henderson@ntlworld.com) and
|
||||
(c) Copyright 1996 - 2002 Gary Henderson (gary.henderson@ntlworld.com),
|
||||
Jerremy Koot (jkoot@snes9x.com)
|
||||
|
||||
(c) Copyright 2002 - 2004 Matthew Kendora
|
||||
@ -12,12 +12,16 @@
|
||||
|
||||
(c) Copyright 2001 - 2006 John Weidman (jweidman@slip.net)
|
||||
|
||||
(c) Copyright 2002 - 2006 Brad Jorsch (anomie@users.sourceforge.net),
|
||||
funkyass (funkyass@spam.shaw.ca),
|
||||
Kris Bleakley (codeviolation@hotmail.com),
|
||||
Nach (n-a-c-h@users.sourceforge.net), and
|
||||
(c) Copyright 2002 - 2006 funkyass (funkyass@spam.shaw.ca),
|
||||
Kris Bleakley (codeviolation@hotmail.com)
|
||||
|
||||
(c) Copyright 2002 - 2007 Brad Jorsch (anomie@users.sourceforge.net),
|
||||
Nach (n-a-c-h@users.sourceforge.net),
|
||||
zones (kasumitokoduck@yahoo.com)
|
||||
|
||||
(c) Copyright 2006 - 2007 nitsuja
|
||||
|
||||
|
||||
BS-X C emulator code
|
||||
(c) Copyright 2005 - 2006 Dreamer Nom,
|
||||
zones
|
||||
@ -110,17 +114,30 @@
|
||||
2xSaI filter
|
||||
(c) Copyright 1999 - 2001 Derek Liauw Kie Fa
|
||||
|
||||
HQ2x filter
|
||||
HQ2x, HQ3x, HQ4x filters
|
||||
(c) Copyright 2003 Maxim Stepin (maxim@hiend3d.com)
|
||||
|
||||
Win32 GUI code
|
||||
(c) Copyright 2003 - 2006 blip,
|
||||
funkyass,
|
||||
Matthew Kendora,
|
||||
Nach,
|
||||
nitsuja
|
||||
|
||||
Mac OS GUI code
|
||||
(c) Copyright 1998 - 2001 John Stiles
|
||||
(c) Copyright 2001 - 2007 zones
|
||||
|
||||
|
||||
Specific ports contains the works of other authors. See headers in
|
||||
individual files.
|
||||
|
||||
|
||||
Snes9x homepage: http://www.snes9x.com
|
||||
|
||||
Permission to use, copy, modify and/or distribute Snes9x in both binary
|
||||
and source form, for non-commercial purposes, is hereby granted without
|
||||
fee, providing that this license information and copyright notice appear
|
||||
and source form, for non-commercial purposes, is hereby granted without
|
||||
fee, providing that this license information and copyright notice appear
|
||||
with all copies and any derived work.
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
@ -141,6 +158,8 @@
|
||||
Nintendo Co., Limited and its subsidiary companies.
|
||||
**********************************************************************************/
|
||||
|
||||
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include <config.h>
|
||||
#endif
|
||||
@ -435,7 +454,7 @@ bool S9xLoadCrosshairFile(int idx, const char *filename){
|
||||
int i, r;
|
||||
char *s;
|
||||
FILE *fp;
|
||||
|
||||
|
||||
if(idx<1 || idx>31) return false;
|
||||
if((s=(char *)calloc(15*15+1, sizeof(char)))==NULL){
|
||||
fprintf(stderr, "S9xLoadCrosshairFile: malloc error while reading ");
|
||||
|
@ -1,7 +1,7 @@
|
||||
/**********************************************************************************
|
||||
Snes9x - Portable Super Nintendo Entertainment System (TM) emulator.
|
||||
|
||||
(c) Copyright 1996 - 2002 Gary Henderson (gary.henderson@ntlworld.com) and
|
||||
(c) Copyright 1996 - 2002 Gary Henderson (gary.henderson@ntlworld.com),
|
||||
Jerremy Koot (jkoot@snes9x.com)
|
||||
|
||||
(c) Copyright 2002 - 2004 Matthew Kendora
|
||||
@ -12,12 +12,16 @@
|
||||
|
||||
(c) Copyright 2001 - 2006 John Weidman (jweidman@slip.net)
|
||||
|
||||
(c) Copyright 2002 - 2006 Brad Jorsch (anomie@users.sourceforge.net),
|
||||
funkyass (funkyass@spam.shaw.ca),
|
||||
Kris Bleakley (codeviolation@hotmail.com),
|
||||
Nach (n-a-c-h@users.sourceforge.net), and
|
||||
(c) Copyright 2002 - 2006 funkyass (funkyass@spam.shaw.ca),
|
||||
Kris Bleakley (codeviolation@hotmail.com)
|
||||
|
||||
(c) Copyright 2002 - 2007 Brad Jorsch (anomie@users.sourceforge.net),
|
||||
Nach (n-a-c-h@users.sourceforge.net),
|
||||
zones (kasumitokoduck@yahoo.com)
|
||||
|
||||
(c) Copyright 2006 - 2007 nitsuja
|
||||
|
||||
|
||||
BS-X C emulator code
|
||||
(c) Copyright 2005 - 2006 Dreamer Nom,
|
||||
zones
|
||||
@ -110,17 +114,30 @@
|
||||
2xSaI filter
|
||||
(c) Copyright 1999 - 2001 Derek Liauw Kie Fa
|
||||
|
||||
HQ2x filter
|
||||
HQ2x, HQ3x, HQ4x filters
|
||||
(c) Copyright 2003 Maxim Stepin (maxim@hiend3d.com)
|
||||
|
||||
Win32 GUI code
|
||||
(c) Copyright 2003 - 2006 blip,
|
||||
funkyass,
|
||||
Matthew Kendora,
|
||||
Nach,
|
||||
nitsuja
|
||||
|
||||
Mac OS GUI code
|
||||
(c) Copyright 1998 - 2001 John Stiles
|
||||
(c) Copyright 2001 - 2007 zones
|
||||
|
||||
|
||||
Specific ports contains the works of other authors. See headers in
|
||||
individual files.
|
||||
|
||||
|
||||
Snes9x homepage: http://www.snes9x.com
|
||||
|
||||
Permission to use, copy, modify and/or distribute Snes9x in both binary
|
||||
and source form, for non-commercial purposes, is hereby granted without
|
||||
fee, providing that this license information and copyright notice appear
|
||||
and source form, for non-commercial purposes, is hereby granted without
|
||||
fee, providing that this license information and copyright notice appear
|
||||
with all copies and any derived work.
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
@ -141,6 +158,8 @@
|
||||
Nintendo Co., Limited and its subsidiary companies.
|
||||
**********************************************************************************/
|
||||
|
||||
|
||||
|
||||
#ifndef CROSSHAIRS_H
|
||||
#define CROSSHAIRS_H
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
/**********************************************************************************
|
||||
Snes9x - Portable Super Nintendo Entertainment System (TM) emulator.
|
||||
|
||||
(c) Copyright 1996 - 2002 Gary Henderson (gary.henderson@ntlworld.com) and
|
||||
(c) Copyright 1996 - 2002 Gary Henderson (gary.henderson@ntlworld.com),
|
||||
Jerremy Koot (jkoot@snes9x.com)
|
||||
|
||||
(c) Copyright 2002 - 2004 Matthew Kendora
|
||||
@ -12,12 +12,16 @@
|
||||
|
||||
(c) Copyright 2001 - 2006 John Weidman (jweidman@slip.net)
|
||||
|
||||
(c) Copyright 2002 - 2006 Brad Jorsch (anomie@users.sourceforge.net),
|
||||
funkyass (funkyass@spam.shaw.ca),
|
||||
Kris Bleakley (codeviolation@hotmail.com),
|
||||
Nach (n-a-c-h@users.sourceforge.net), and
|
||||
(c) Copyright 2002 - 2006 funkyass (funkyass@spam.shaw.ca),
|
||||
Kris Bleakley (codeviolation@hotmail.com)
|
||||
|
||||
(c) Copyright 2002 - 2007 Brad Jorsch (anomie@users.sourceforge.net),
|
||||
Nach (n-a-c-h@users.sourceforge.net),
|
||||
zones (kasumitokoduck@yahoo.com)
|
||||
|
||||
(c) Copyright 2006 - 2007 nitsuja
|
||||
|
||||
|
||||
BS-X C emulator code
|
||||
(c) Copyright 2005 - 2006 Dreamer Nom,
|
||||
zones
|
||||
@ -110,17 +114,30 @@
|
||||
2xSaI filter
|
||||
(c) Copyright 1999 - 2001 Derek Liauw Kie Fa
|
||||
|
||||
HQ2x filter
|
||||
HQ2x, HQ3x, HQ4x filters
|
||||
(c) Copyright 2003 Maxim Stepin (maxim@hiend3d.com)
|
||||
|
||||
Win32 GUI code
|
||||
(c) Copyright 2003 - 2006 blip,
|
||||
funkyass,
|
||||
Matthew Kendora,
|
||||
Nach,
|
||||
nitsuja
|
||||
|
||||
Mac OS GUI code
|
||||
(c) Copyright 1998 - 2001 John Stiles
|
||||
(c) Copyright 2001 - 2007 zones
|
||||
|
||||
|
||||
Specific ports contains the works of other authors. See headers in
|
||||
individual files.
|
||||
|
||||
|
||||
Snes9x homepage: http://www.snes9x.com
|
||||
|
||||
Permission to use, copy, modify and/or distribute Snes9x in both binary
|
||||
and source form, for non-commercial purposes, is hereby granted without
|
||||
fee, providing that this license information and copyright notice appear
|
||||
and source form, for non-commercial purposes, is hereby granted without
|
||||
fee, providing that this license information and copyright notice appear
|
||||
with all copies and any derived work.
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
@ -142,6 +159,8 @@
|
||||
**********************************************************************************/
|
||||
|
||||
|
||||
|
||||
|
||||
#include "snes9x.h"
|
||||
|
||||
uint8 add32_32 [32][32] = {
|
||||
|
@ -1,7 +1,7 @@
|
||||
/**********************************************************************************
|
||||
Snes9x - Portable Super Nintendo Entertainment System (TM) emulator.
|
||||
|
||||
(c) Copyright 1996 - 2002 Gary Henderson (gary.henderson@ntlworld.com) and
|
||||
(c) Copyright 1996 - 2002 Gary Henderson (gary.henderson@ntlworld.com),
|
||||
Jerremy Koot (jkoot@snes9x.com)
|
||||
|
||||
(c) Copyright 2002 - 2004 Matthew Kendora
|
||||
@ -12,12 +12,16 @@
|
||||
|
||||
(c) Copyright 2001 - 2006 John Weidman (jweidman@slip.net)
|
||||
|
||||
(c) Copyright 2002 - 2006 Brad Jorsch (anomie@users.sourceforge.net),
|
||||
funkyass (funkyass@spam.shaw.ca),
|
||||
Kris Bleakley (codeviolation@hotmail.com),
|
||||
Nach (n-a-c-h@users.sourceforge.net), and
|
||||
(c) Copyright 2002 - 2006 funkyass (funkyass@spam.shaw.ca),
|
||||
Kris Bleakley (codeviolation@hotmail.com)
|
||||
|
||||
(c) Copyright 2002 - 2007 Brad Jorsch (anomie@users.sourceforge.net),
|
||||
Nach (n-a-c-h@users.sourceforge.net),
|
||||
zones (kasumitokoduck@yahoo.com)
|
||||
|
||||
(c) Copyright 2006 - 2007 nitsuja
|
||||
|
||||
|
||||
BS-X C emulator code
|
||||
(c) Copyright 2005 - 2006 Dreamer Nom,
|
||||
zones
|
||||
@ -110,17 +114,30 @@
|
||||
2xSaI filter
|
||||
(c) Copyright 1999 - 2001 Derek Liauw Kie Fa
|
||||
|
||||
HQ2x filter
|
||||
HQ2x, HQ3x, HQ4x filters
|
||||
(c) Copyright 2003 Maxim Stepin (maxim@hiend3d.com)
|
||||
|
||||
Win32 GUI code
|
||||
(c) Copyright 2003 - 2006 blip,
|
||||
funkyass,
|
||||
Matthew Kendora,
|
||||
Nach,
|
||||
nitsuja
|
||||
|
||||
Mac OS GUI code
|
||||
(c) Copyright 1998 - 2001 John Stiles
|
||||
(c) Copyright 2001 - 2007 zones
|
||||
|
||||
|
||||
Specific ports contains the works of other authors. See headers in
|
||||
individual files.
|
||||
|
||||
|
||||
Snes9x homepage: http://www.snes9x.com
|
||||
|
||||
Permission to use, copy, modify and/or distribute Snes9x in both binary
|
||||
and source form, for non-commercial purposes, is hereby granted without
|
||||
fee, providing that this license information and copyright notice appear
|
||||
and source form, for non-commercial purposes, is hereby granted without
|
||||
fee, providing that this license information and copyright notice appear
|
||||
with all copies and any derived work.
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
@ -142,6 +159,8 @@
|
||||
**********************************************************************************/
|
||||
|
||||
|
||||
|
||||
|
||||
#include <string.h>
|
||||
#ifdef HAVE_STRINGS_H
|
||||
#include <strings.h>
|
||||
@ -170,12 +189,6 @@ static void WhatsUsed ();
|
||||
EXTERN_C SDMA DMA[8];
|
||||
extern struct SCheatData Cheat;
|
||||
|
||||
#ifdef SPCTOOL
|
||||
#include "spctool/spc700.h"
|
||||
extern "C" void TraceSPC (unsigned char *PC, unsigned short YA, unsigned char X,
|
||||
SPCFlags PS, unsigned char *SP);
|
||||
#endif
|
||||
|
||||
FILE *trace = NULL;
|
||||
FILE *trace2 = NULL;
|
||||
struct SBreakPoint S9xBreakpoint[6];
|
||||
@ -223,7 +236,7 @@ char *HelpMessage[] = {
|
||||
"bs [Number] [Address] - Enable/Disable Breakpoint",
|
||||
" [Enable example: BS #2 $02:8002]",
|
||||
" [Disable example: BS #2]",
|
||||
"c - Dump SNES colour palette",
|
||||
"c - Dump SNES colour palette",
|
||||
"W - Show what SNES hardware features a ROM is using",
|
||||
" which might not be implemented yet.",
|
||||
"w - Show some SNES hardware features used so far in this frame",
|
||||
@ -718,7 +731,7 @@ uint8 S9xOPrint (char *Line, uint8 Bank, uint16 Address)
|
||||
break;
|
||||
}
|
||||
// XXX:
|
||||
sprintf (Line, "%-44s A:%04X X:%04X Y:%04X D:%04X DB:%02X S:%04X P:%c%c%c%c%c%c%c%c%c HC:%03d VC:%03ld %02x",
|
||||
sprintf (Line, "%-44s A:%04X X:%04X Y:%04X D:%04X DB:%02X S:%04X P:%c%c%c%c%c%c%c%c%c HC:%04d VC:%03d FC:%02d %02x",
|
||||
Line, Registers.A.W, Registers.X.W, Registers.Y.W,
|
||||
Registers.D.W, Registers.DB, Registers.S.W,
|
||||
CheckEmulation () ? 'E' : 'e',
|
||||
@ -732,6 +745,7 @@ uint8 S9xOPrint (char *Line, uint8 Bank, uint16 Address)
|
||||
CheckCarry () ? 'C' : 'c',
|
||||
Cycles,
|
||||
CPU.V_Counter,
|
||||
IPPU.FrameCount,
|
||||
CPU.IRQActive);
|
||||
|
||||
CPU.Cycles = Cycles;
|
||||
@ -1229,7 +1243,7 @@ static void ProcessDebugCommand (char *Line)
|
||||
S9xAddCheat (TRUE, TRUE, Address, Byte);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
if (strncasecmp (Line, "dump", 4) == 0)
|
||||
{
|
||||
int Count;
|
||||
@ -1421,18 +1435,11 @@ static void ProcessDebugCommand (char *Line)
|
||||
extern FILE *apu_trace;
|
||||
if (APU.Flags & TRACE_FLAG)
|
||||
{
|
||||
#ifdef SPCTOOL
|
||||
printf ("ENABLED\n");
|
||||
_SetSPCDbg (TraceSPC); //Install debug handler
|
||||
#endif
|
||||
if (apu_trace == NULL)
|
||||
apu_trace = fopen ("aputrace.log", "wb");
|
||||
}
|
||||
else
|
||||
{
|
||||
#ifdef SPCTOOL
|
||||
_SetSPCDbg (NULL);
|
||||
#endif
|
||||
if (apu_trace)
|
||||
{
|
||||
fclose (apu_trace);
|
||||
@ -1460,7 +1467,7 @@ static void ProcessDebugCommand (char *Line)
|
||||
printf ("SPC700 sample addresses at 0x%04x:\n", APU.DSP [APU_DIR] << 8);
|
||||
for (int i = 0; i < 256; i++)
|
||||
{
|
||||
uint8 *dir = IAPU.RAM +
|
||||
uint8 *dir = IAPU.RAM +
|
||||
(((APU.DSP [APU_DIR] << 8) +
|
||||
i * 4) & 0xffff);
|
||||
int addr = *dir + (*(dir + 1) << 8);
|
||||
@ -1499,13 +1506,8 @@ static void ProcessDebugCommand (char *Line)
|
||||
{
|
||||
printf ("APU in-ports: %02X %02X %02X %02X\n",
|
||||
IAPU.RAM [0xF4], IAPU.RAM [0xF5], IAPU.RAM [0xF6], IAPU.RAM [0xF7]);
|
||||
#ifdef SPCTOOL
|
||||
printf ("APU out-ports: %02X %02X %02X %02X\n",
|
||||
_SPCOutP [0], _SPCOutP [1], _SPCOutP [2], _SPCOutP [3]);
|
||||
#else
|
||||
printf ("APU out-ports: %02X %02X %02X %02X\n",
|
||||
APU.OutPorts [0], APU.OutPorts [1], APU.OutPorts [2], APU.OutPorts [3]);
|
||||
#endif
|
||||
printf ("ROM/RAM switch: %s\n", (IAPU.RAM [0xf1] & 0x80) ? "ROM" : "RAM");
|
||||
for (int i = 0; i < 3; i++)
|
||||
if (APU.TimerEnabled [i])
|
||||
@ -1747,7 +1749,7 @@ static void ProcessDebugCommand (char *Line)
|
||||
(Registers.P.W & 1) != 0 ? "C" : "c",
|
||||
(Registers.P.W & 256) != 0 ? "E" : "e");
|
||||
DPrint (String);
|
||||
#endif
|
||||
#endif
|
||||
S9xOPrint (String, Bank, Address);
|
||||
DPrint (String);
|
||||
}
|
||||
@ -1819,7 +1821,7 @@ static void WhatsUsed ()
|
||||
printf ("Screen mode: %d, ", PPU.BGMode);
|
||||
if (PPU.BGMode <= 1 && (Memory.FillRAM [0x2105] & 8))
|
||||
printf ("(BG#2 Priority)");
|
||||
|
||||
|
||||
printf ("Brightness: %d", PPU.Brightness);
|
||||
if (Memory.FillRAM[0x2100] & 0x80)
|
||||
printf (" (screen blanked)");
|
||||
@ -1902,7 +1904,7 @@ static void WhatsUsed ()
|
||||
{
|
||||
printf ("BG%d: VOffset:%d, HOffset:%d, W:%d, H:%d, TS:%d, BA:0x%04x, TA:0x%04X\n",
|
||||
i, PPU.BG[i].VOffset, PPU.BG[i].HOffset,
|
||||
(PPU.BG[i].SCSize & 1) * 32 + 32,
|
||||
(PPU.BG[i].SCSize & 1) * 32 + 32,
|
||||
(PPU.BG[i].SCSize & 2) * 16 + 32,
|
||||
PPU.BG[i].BGSize * 8 + 8,
|
||||
PPU.BG[i].SCBase,
|
||||
@ -1937,7 +1939,7 @@ static void WhatsUsed ()
|
||||
printf ("OBJ,");
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
switch ((Memory.FillRAM [0x2130] & 0x30) >> 4)
|
||||
{
|
||||
case 0: s = "always on"; break;
|
||||
@ -1945,7 +1947,7 @@ static void WhatsUsed ()
|
||||
case 2: s = "outside"; break;
|
||||
case 3: s = "always off"; break;
|
||||
}
|
||||
|
||||
|
||||
printf ("\nSub-screen (%s): ", s);
|
||||
for (i = 0; i < 5; i++)
|
||||
if (Memory.FillRAM[0x212d] & (1 << i))
|
||||
|
@ -1,7 +1,7 @@
|
||||
/**********************************************************************************
|
||||
Snes9x - Portable Super Nintendo Entertainment System (TM) emulator.
|
||||
|
||||
(c) Copyright 1996 - 2002 Gary Henderson (gary.henderson@ntlworld.com) and
|
||||
(c) Copyright 1996 - 2002 Gary Henderson (gary.henderson@ntlworld.com),
|
||||
Jerremy Koot (jkoot@snes9x.com)
|
||||
|
||||
(c) Copyright 2002 - 2004 Matthew Kendora
|
||||
@ -12,12 +12,16 @@
|
||||
|
||||
(c) Copyright 2001 - 2006 John Weidman (jweidman@slip.net)
|
||||
|
||||
(c) Copyright 2002 - 2006 Brad Jorsch (anomie@users.sourceforge.net),
|
||||
funkyass (funkyass@spam.shaw.ca),
|
||||
Kris Bleakley (codeviolation@hotmail.com),
|
||||
Nach (n-a-c-h@users.sourceforge.net), and
|
||||
(c) Copyright 2002 - 2006 funkyass (funkyass@spam.shaw.ca),
|
||||
Kris Bleakley (codeviolation@hotmail.com)
|
||||
|
||||
(c) Copyright 2002 - 2007 Brad Jorsch (anomie@users.sourceforge.net),
|
||||
Nach (n-a-c-h@users.sourceforge.net),
|
||||
zones (kasumitokoduck@yahoo.com)
|
||||
|
||||
(c) Copyright 2006 - 2007 nitsuja
|
||||
|
||||
|
||||
BS-X C emulator code
|
||||
(c) Copyright 2005 - 2006 Dreamer Nom,
|
||||
zones
|
||||
@ -110,17 +114,30 @@
|
||||
2xSaI filter
|
||||
(c) Copyright 1999 - 2001 Derek Liauw Kie Fa
|
||||
|
||||
HQ2x filter
|
||||
HQ2x, HQ3x, HQ4x filters
|
||||
(c) Copyright 2003 Maxim Stepin (maxim@hiend3d.com)
|
||||
|
||||
Win32 GUI code
|
||||
(c) Copyright 2003 - 2006 blip,
|
||||
funkyass,
|
||||
Matthew Kendora,
|
||||
Nach,
|
||||
nitsuja
|
||||
|
||||
Mac OS GUI code
|
||||
(c) Copyright 1998 - 2001 John Stiles
|
||||
(c) Copyright 2001 - 2007 zones
|
||||
|
||||
|
||||
Specific ports contains the works of other authors. See headers in
|
||||
individual files.
|
||||
|
||||
|
||||
Snes9x homepage: http://www.snes9x.com
|
||||
|
||||
Permission to use, copy, modify and/or distribute Snes9x in both binary
|
||||
and source form, for non-commercial purposes, is hereby granted without
|
||||
fee, providing that this license information and copyright notice appear
|
||||
and source form, for non-commercial purposes, is hereby granted without
|
||||
fee, providing that this license information and copyright notice appear
|
||||
with all copies and any derived work.
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
@ -142,6 +159,8 @@
|
||||
**********************************************************************************/
|
||||
|
||||
|
||||
|
||||
|
||||
#ifndef _DEBUG_H_
|
||||
#define _DEBUG_H_
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
/**********************************************************************************
|
||||
Snes9x - Portable Super Nintendo Entertainment System (TM) emulator.
|
||||
|
||||
(c) Copyright 1996 - 2002 Gary Henderson (gary.henderson@ntlworld.com) and
|
||||
(c) Copyright 1996 - 2002 Gary Henderson (gary.henderson@ntlworld.com),
|
||||
Jerremy Koot (jkoot@snes9x.com)
|
||||
|
||||
(c) Copyright 2002 - 2004 Matthew Kendora
|
||||
@ -12,12 +12,16 @@
|
||||
|
||||
(c) Copyright 2001 - 2006 John Weidman (jweidman@slip.net)
|
||||
|
||||
(c) Copyright 2002 - 2006 Brad Jorsch (anomie@users.sourceforge.net),
|
||||
funkyass (funkyass@spam.shaw.ca),
|
||||
Kris Bleakley (codeviolation@hotmail.com),
|
||||
Nach (n-a-c-h@users.sourceforge.net), and
|
||||
(c) Copyright 2002 - 2006 funkyass (funkyass@spam.shaw.ca),
|
||||
Kris Bleakley (codeviolation@hotmail.com)
|
||||
|
||||
(c) Copyright 2002 - 2007 Brad Jorsch (anomie@users.sourceforge.net),
|
||||
Nach (n-a-c-h@users.sourceforge.net),
|
||||
zones (kasumitokoduck@yahoo.com)
|
||||
|
||||
(c) Copyright 2006 - 2007 nitsuja
|
||||
|
||||
|
||||
BS-X C emulator code
|
||||
(c) Copyright 2005 - 2006 Dreamer Nom,
|
||||
zones
|
||||
@ -110,17 +114,30 @@
|
||||
2xSaI filter
|
||||
(c) Copyright 1999 - 2001 Derek Liauw Kie Fa
|
||||
|
||||
HQ2x filter
|
||||
HQ2x, HQ3x, HQ4x filters
|
||||
(c) Copyright 2003 Maxim Stepin (maxim@hiend3d.com)
|
||||
|
||||
Win32 GUI code
|
||||
(c) Copyright 2003 - 2006 blip,
|
||||
funkyass,
|
||||
Matthew Kendora,
|
||||
Nach,
|
||||
nitsuja
|
||||
|
||||
Mac OS GUI code
|
||||
(c) Copyright 1998 - 2001 John Stiles
|
||||
(c) Copyright 2001 - 2007 zones
|
||||
|
||||
|
||||
Specific ports contains the works of other authors. See headers in
|
||||
individual files.
|
||||
|
||||
|
||||
Snes9x homepage: http://www.snes9x.com
|
||||
|
||||
Permission to use, copy, modify and/or distribute Snes9x in both binary
|
||||
and source form, for non-commercial purposes, is hereby granted without
|
||||
fee, providing that this license information and copyright notice appear
|
||||
and source form, for non-commercial purposes, is hereby granted without
|
||||
fee, providing that this license information and copyright notice appear
|
||||
with all copies and any derived work.
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
@ -142,6 +159,8 @@
|
||||
**********************************************************************************/
|
||||
|
||||
|
||||
|
||||
|
||||
#ifndef _DISPLAY_H_
|
||||
#define _DISPLAY_H_
|
||||
|
||||
@ -150,11 +169,11 @@ START_EXTERN_C
|
||||
void S9xSetPalette ();
|
||||
void S9xTextMode ();
|
||||
void S9xGraphicsMode ();
|
||||
void S9xLoadConfigFiles(char **argv, int argc);
|
||||
char *S9xParseArgs (char **argv, int argc);
|
||||
void S9xParseArg (char **argv, int &index, int argc);
|
||||
void S9xExtraUsage ();
|
||||
|
||||
void S9xLoadConfigFiles(char **argv, int argc);
|
||||
char *S9xParseArgs (char **argv, int argc);
|
||||
void S9xUsage ();
|
||||
void S9xInitDisplay (int argc, char **argv);
|
||||
void S9xDeinitDisplay ();
|
||||
@ -171,7 +190,7 @@ void S9xNextController ();
|
||||
bool8 S9xLoadROMImage (const char *string);
|
||||
const char *S9xSelectFilename (const char *def, const char *dir,
|
||||
const char *ext, const char *title);
|
||||
|
||||
const char *S9xStringInput(const char *message);
|
||||
const char *S9xChooseFilename (bool8 read_only);
|
||||
bool8 S9xOpenSnapshotFile (const char *base, bool8 read_only, STREAM *file);
|
||||
void S9xCloseSnapshotFile (STREAM file);
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -1,7 +1,7 @@
|
||||
/**********************************************************************************
|
||||
Snes9x - Portable Super Nintendo Entertainment System (TM) emulator.
|
||||
|
||||
(c) Copyright 1996 - 2002 Gary Henderson (gary.henderson@ntlworld.com) and
|
||||
(c) Copyright 1996 - 2002 Gary Henderson (gary.henderson@ntlworld.com),
|
||||
Jerremy Koot (jkoot@snes9x.com)
|
||||
|
||||
(c) Copyright 2002 - 2004 Matthew Kendora
|
||||
@ -12,12 +12,16 @@
|
||||
|
||||
(c) Copyright 2001 - 2006 John Weidman (jweidman@slip.net)
|
||||
|
||||
(c) Copyright 2002 - 2006 Brad Jorsch (anomie@users.sourceforge.net),
|
||||
funkyass (funkyass@spam.shaw.ca),
|
||||
Kris Bleakley (codeviolation@hotmail.com),
|
||||
Nach (n-a-c-h@users.sourceforge.net), and
|
||||
(c) Copyright 2002 - 2006 funkyass (funkyass@spam.shaw.ca),
|
||||
Kris Bleakley (codeviolation@hotmail.com)
|
||||
|
||||
(c) Copyright 2002 - 2007 Brad Jorsch (anomie@users.sourceforge.net),
|
||||
Nach (n-a-c-h@users.sourceforge.net),
|
||||
zones (kasumitokoduck@yahoo.com)
|
||||
|
||||
(c) Copyright 2006 - 2007 nitsuja
|
||||
|
||||
|
||||
BS-X C emulator code
|
||||
(c) Copyright 2005 - 2006 Dreamer Nom,
|
||||
zones
|
||||
@ -110,17 +114,30 @@
|
||||
2xSaI filter
|
||||
(c) Copyright 1999 - 2001 Derek Liauw Kie Fa
|
||||
|
||||
HQ2x filter
|
||||
HQ2x, HQ3x, HQ4x filters
|
||||
(c) Copyright 2003 Maxim Stepin (maxim@hiend3d.com)
|
||||
|
||||
Win32 GUI code
|
||||
(c) Copyright 2003 - 2006 blip,
|
||||
funkyass,
|
||||
Matthew Kendora,
|
||||
Nach,
|
||||
nitsuja
|
||||
|
||||
Mac OS GUI code
|
||||
(c) Copyright 1998 - 2001 John Stiles
|
||||
(c) Copyright 2001 - 2007 zones
|
||||
|
||||
|
||||
Specific ports contains the works of other authors. See headers in
|
||||
individual files.
|
||||
|
||||
|
||||
Snes9x homepage: http://www.snes9x.com
|
||||
|
||||
Permission to use, copy, modify and/or distribute Snes9x in both binary
|
||||
and source form, for non-commercial purposes, is hereby granted without
|
||||
fee, providing that this license information and copyright notice appear
|
||||
and source form, for non-commercial purposes, is hereby granted without
|
||||
fee, providing that this license information and copyright notice appear
|
||||
with all copies and any derived work.
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
@ -142,6 +159,8 @@
|
||||
**********************************************************************************/
|
||||
|
||||
|
||||
|
||||
|
||||
#ifndef _DMA_H_
|
||||
#define _DMA_H_
|
||||
|
||||
@ -149,7 +168,7 @@ START_EXTERN_C
|
||||
void S9xResetDMA ();
|
||||
uint8 S9xDoHDMA (uint8);
|
||||
void S9xStartHDMA ();
|
||||
void S9xDoDMA (uint8);
|
||||
bool8 S9xDoDMA (uint8);
|
||||
END_EXTERN_C
|
||||
|
||||
#endif
|
||||
|
@ -1,7 +1,7 @@
|
||||
/**********************************************************************************
|
||||
Snes9x - Portable Super Nintendo Entertainment System (TM) emulator.
|
||||
|
||||
(c) Copyright 1996 - 2002 Gary Henderson (gary.henderson@ntlworld.com) and
|
||||
(c) Copyright 1996 - 2002 Gary Henderson (gary.henderson@ntlworld.com),
|
||||
Jerremy Koot (jkoot@snes9x.com)
|
||||
|
||||
(c) Copyright 2002 - 2004 Matthew Kendora
|
||||
@ -12,12 +12,16 @@
|
||||
|
||||
(c) Copyright 2001 - 2006 John Weidman (jweidman@slip.net)
|
||||
|
||||
(c) Copyright 2002 - 2006 Brad Jorsch (anomie@users.sourceforge.net),
|
||||
funkyass (funkyass@spam.shaw.ca),
|
||||
Kris Bleakley (codeviolation@hotmail.com),
|
||||
Nach (n-a-c-h@users.sourceforge.net), and
|
||||
(c) Copyright 2002 - 2006 funkyass (funkyass@spam.shaw.ca),
|
||||
Kris Bleakley (codeviolation@hotmail.com)
|
||||
|
||||
(c) Copyright 2002 - 2007 Brad Jorsch (anomie@users.sourceforge.net),
|
||||
Nach (n-a-c-h@users.sourceforge.net),
|
||||
zones (kasumitokoduck@yahoo.com)
|
||||
|
||||
(c) Copyright 2006 - 2007 nitsuja
|
||||
|
||||
|
||||
BS-X C emulator code
|
||||
(c) Copyright 2005 - 2006 Dreamer Nom,
|
||||
zones
|
||||
@ -110,17 +114,30 @@
|
||||
2xSaI filter
|
||||
(c) Copyright 1999 - 2001 Derek Liauw Kie Fa
|
||||
|
||||
HQ2x filter
|
||||
HQ2x, HQ3x, HQ4x filters
|
||||
(c) Copyright 2003 Maxim Stepin (maxim@hiend3d.com)
|
||||
|
||||
Win32 GUI code
|
||||
(c) Copyright 2003 - 2006 blip,
|
||||
funkyass,
|
||||
Matthew Kendora,
|
||||
Nach,
|
||||
nitsuja
|
||||
|
||||
Mac OS GUI code
|
||||
(c) Copyright 1998 - 2001 John Stiles
|
||||
(c) Copyright 2001 - 2007 zones
|
||||
|
||||
|
||||
Specific ports contains the works of other authors. See headers in
|
||||
individual files.
|
||||
|
||||
|
||||
Snes9x homepage: http://www.snes9x.com
|
||||
|
||||
Permission to use, copy, modify and/or distribute Snes9x in both binary
|
||||
and source form, for non-commercial purposes, is hereby granted without
|
||||
fee, providing that this license information and copyright notice appear
|
||||
and source form, for non-commercial purposes, is hereby granted without
|
||||
fee, providing that this license information and copyright notice appear
|
||||
with all copies and any derived work.
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
@ -141,11 +158,14 @@
|
||||
Nintendo Co., Limited and its subsidiary companies.
|
||||
**********************************************************************************/
|
||||
|
||||
|
||||
|
||||
#include "snes9x.h"
|
||||
#include "dsp1.h"
|
||||
#include "missing.h"
|
||||
#include "memmap.h"
|
||||
#include <math.h>
|
||||
#include <assert.h>
|
||||
|
||||
#include "dsp1emu.c.inc"
|
||||
#include "dsp2emu.c.inc"
|
||||
@ -158,7 +178,7 @@ uint8 (*GetDSP)(uint16)=&DSP1GetByte;
|
||||
void S9xInitDSP1 ()
|
||||
{
|
||||
static bool8 init = FALSE;
|
||||
|
||||
|
||||
if (!init)
|
||||
{
|
||||
InitDSP ();
|
||||
@ -169,14 +189,14 @@ void S9xInitDSP1 ()
|
||||
void S9xResetDSP1 ()
|
||||
{
|
||||
S9xInitDSP1 ();
|
||||
|
||||
|
||||
DSP1.waiting4command = TRUE;
|
||||
DSP1.in_count = 0;
|
||||
DSP1.out_count = 0;
|
||||
DSP1.in_index = 0;
|
||||
DSP1.out_index = 0;
|
||||
DSP1.first_parameter = TRUE;
|
||||
|
||||
|
||||
DSP4.waiting4command = TRUE;
|
||||
//printf("DSP-4 Reset\n");
|
||||
}
|
||||
@ -184,7 +204,7 @@ void S9xResetDSP1 ()
|
||||
uint8 S9xGetDSP (uint16 address)
|
||||
{
|
||||
uint8 t;
|
||||
|
||||
|
||||
#ifdef DEBUGGER
|
||||
if (Settings.TraceDSP)
|
||||
{
|
||||
@ -192,7 +212,7 @@ uint8 S9xGetDSP (uint16 address)
|
||||
S9xMessage (S9X_TRACE, S9X_TRACE_DSP1, String);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
t=(*GetDSP)(address);
|
||||
//DSP1GetByte(address);
|
||||
return (t);
|
||||
@ -214,14 +234,14 @@ void S9xSetDSP (uint8 byte, uint16 address)
|
||||
|
||||
void DSP1SetByte(uint8 byte, uint16 address)
|
||||
{
|
||||
if( (address & 0xf000) == 0x6000 || (address & 0x7fff) < 0x4000 )
|
||||
if (address < DSP1.boundary)
|
||||
{
|
||||
// if ((address & 1) == 0)
|
||||
// {
|
||||
if((DSP1.command==0x0A||DSP1.command==0x1A)&&DSP1.out_count!=0)
|
||||
{
|
||||
DSP1.out_count--;
|
||||
DSP1.out_index++;
|
||||
DSP1.out_index++;
|
||||
return;
|
||||
}
|
||||
else if (DSP1.waiting4command)
|
||||
@ -255,7 +275,7 @@ void DSP1SetByte(uint8 byte, uint16 address)
|
||||
case 0x0a: DSP1.in_count = 1; break;
|
||||
case 0x3a:
|
||||
case 0x2a:
|
||||
case 0x1a:
|
||||
case 0x1a:
|
||||
DSP1. command =0x1a;
|
||||
DSP1.in_count = 1; break;
|
||||
case 0x16:
|
||||
@ -318,7 +338,7 @@ void DSP1SetByte(uint8 byte, uint16 address)
|
||||
DSP1.first_parameter = FALSE;
|
||||
DSP1.in_index++;
|
||||
}
|
||||
|
||||
|
||||
if (DSP1.waiting4command ||
|
||||
(DSP1.first_parameter && byte == 0x80))
|
||||
{
|
||||
@ -349,9 +369,9 @@ void DSP1SetByte(uint8 byte, uint16 address)
|
||||
case 0x00: // Multiple
|
||||
Op00Multiplicand = (int16) (DSP1.parameters [0]|(DSP1.parameters[1]<<8));
|
||||
Op00Multiplier = (int16) (DSP1.parameters [2]|(DSP1.parameters[3]<<8));
|
||||
|
||||
|
||||
DSPOp00 ();
|
||||
|
||||
|
||||
DSP1.out_count = 2;
|
||||
DSP1.output [0] = Op00Result&0xFF;
|
||||
DSP1.output [1] = (Op00Result>>8)&0xFF;
|
||||
@ -360,111 +380,111 @@ void DSP1SetByte(uint8 byte, uint16 address)
|
||||
case 0x20: // Multiple
|
||||
Op20Multiplicand = (int16) (DSP1.parameters [0]|(DSP1.parameters[1]<<8));
|
||||
Op20Multiplier = (int16) (DSP1.parameters [2]|(DSP1.parameters[3]<<8));
|
||||
|
||||
|
||||
DSPOp20 ();
|
||||
|
||||
|
||||
DSP1.out_count = 2;
|
||||
DSP1.output [0] = Op20Result&0xFF;
|
||||
DSP1.output [1] = (Op20Result>>8)&0xFF;
|
||||
break;
|
||||
|
||||
|
||||
case 0x30:
|
||||
case 0x10: // Inverse
|
||||
Op10Coefficient = (int16) (DSP1.parameters [0]|(DSP1.parameters[1]<<8));
|
||||
Op10Exponent = (int16) (DSP1.parameters [2]|(DSP1.parameters[3]<<8));
|
||||
|
||||
|
||||
DSPOp10 ();
|
||||
|
||||
|
||||
DSP1.out_count = 4;
|
||||
DSP1.output [0] = (uint8) (((int16) Op10CoefficientR)&0xFF);
|
||||
DSP1.output [1] = (uint8) ((((int16) Op10CoefficientR)>>8)&0xFF);
|
||||
DSP1.output [2] = (uint8) (((int16) Op10ExponentR)&0xff);
|
||||
DSP1.output [3] = (uint8) ((((int16) Op10ExponentR)>>8)&0xff);
|
||||
break;
|
||||
|
||||
|
||||
case 0x24:
|
||||
case 0x04: // Sin and Cos of angle
|
||||
Op04Angle = (int16) (DSP1.parameters [0]|(DSP1.parameters[1]<<8));
|
||||
Op04Radius = (uint16) (DSP1.parameters [2]|(DSP1.parameters[3]<<8));
|
||||
|
||||
|
||||
DSPOp04 ();
|
||||
|
||||
|
||||
DSP1.out_count = 4;
|
||||
DSP1.output [0] = (uint8) (Op04Sin&0xFF);
|
||||
DSP1.output [1] = (uint8) ((Op04Sin>>8)&0xFF);
|
||||
DSP1.output [2] = (uint8) (Op04Cos&0xFF);
|
||||
DSP1.output [3] = (uint8) ((Op04Cos>>8)&0xFF);
|
||||
break;
|
||||
|
||||
|
||||
case 0x08: // Radius
|
||||
Op08X = (int16) (DSP1.parameters [0]|(DSP1.parameters[1]<<8));
|
||||
Op08Y = (int16) (DSP1.parameters [2]|(DSP1.parameters[3]<<8));
|
||||
Op08Z = (int16) (DSP1.parameters [4]|(DSP1.parameters[5]<<8));
|
||||
|
||||
|
||||
DSPOp08 ();
|
||||
|
||||
|
||||
DSP1.out_count = 4;
|
||||
DSP1.output [0] = (uint8) (((int16) Op08Ll)&0xFF);
|
||||
DSP1.output [1] = (uint8) ((((int16) Op08Ll)>>8)&0xFF);
|
||||
DSP1.output [0] = (uint8) (((int16) Op08Ll)&0xFF);
|
||||
DSP1.output [1] = (uint8) ((((int16) Op08Ll)>>8)&0xFF);
|
||||
DSP1.output [2] = (uint8) (((int16) Op08Lh)&0xFF);
|
||||
DSP1.output [3] = (uint8) ((((int16) Op08Lh)>>8)&0xFF);
|
||||
break;
|
||||
|
||||
|
||||
case 0x18: // Range
|
||||
|
||||
|
||||
Op18X = (int16) (DSP1.parameters [0]|(DSP1.parameters[1]<<8));
|
||||
Op18Y = (int16) (DSP1.parameters [2]|(DSP1.parameters[3]<<8));
|
||||
Op18Z = (int16) (DSP1.parameters [4]|(DSP1.parameters[5]<<8));
|
||||
Op18R = (int16) (DSP1.parameters [6]|(DSP1.parameters[7]<<8));
|
||||
|
||||
|
||||
DSPOp18 ();
|
||||
|
||||
|
||||
DSP1.out_count = 2;
|
||||
DSP1.output [0] = (uint8) (Op18D&0xFF);
|
||||
DSP1.output [1] = (uint8) ((Op18D>>8)&0xFF);
|
||||
break;
|
||||
|
||||
case 0x38: // Range
|
||||
|
||||
|
||||
Op38X = (int16) (DSP1.parameters [0]|(DSP1.parameters[1]<<8));
|
||||
Op38Y = (int16) (DSP1.parameters [2]|(DSP1.parameters[3]<<8));
|
||||
Op38Z = (int16) (DSP1.parameters [4]|(DSP1.parameters[5]<<8));
|
||||
Op38R = (int16) (DSP1.parameters [6]|(DSP1.parameters[7]<<8));
|
||||
|
||||
|
||||
DSPOp38 ();
|
||||
|
||||
|
||||
DSP1.out_count = 2;
|
||||
DSP1.output [0] = (uint8) (Op38D&0xFF);
|
||||
DSP1.output [1] = (uint8) ((Op38D>>8)&0xFF);
|
||||
break;
|
||||
|
||||
|
||||
case 0x28: // Distance (vector length)
|
||||
Op28X = (int16) (DSP1.parameters [0]|(DSP1.parameters[1]<<8));
|
||||
Op28Y = (int16) (DSP1.parameters [2]|(DSP1.parameters[3]<<8));
|
||||
Op28Z = (int16) (DSP1.parameters [4]|(DSP1.parameters[5]<<8));
|
||||
|
||||
|
||||
DSPOp28 ();
|
||||
|
||||
|
||||
DSP1.out_count = 2;
|
||||
DSP1.output [0] = (uint8) (Op28R&0xFF);
|
||||
DSP1.output [1] = (uint8) ((Op28R>>8)&0xFF);
|
||||
break;
|
||||
|
||||
|
||||
case 0x2c:
|
||||
case 0x0c: // Rotate (2D rotate)
|
||||
Op0CA = (int16) (DSP1.parameters [0]|(DSP1.parameters[1]<<8));
|
||||
Op0CX1 = (int16) (DSP1.parameters [2]|(DSP1.parameters[3]<<8));
|
||||
Op0CY1 = (int16) (DSP1.parameters [4]|(DSP1.parameters[5]<<8));
|
||||
|
||||
|
||||
DSPOp0C ();
|
||||
|
||||
|
||||
DSP1.out_count = 4;
|
||||
DSP1.output [0] = (uint8) (Op0CX2&0xFF);
|
||||
DSP1.output [1] = (uint8) ((Op0CX2>>8)&0xFF);
|
||||
DSP1.output [2] = (uint8) (Op0CY2&0xFF);
|
||||
DSP1.output [3] = (uint8) ((Op0CY2>>8)&0xFF);
|
||||
break;
|
||||
|
||||
|
||||
case 0x3c:
|
||||
case 0x1c: // Polar (3D rotate)
|
||||
Op1CZ = (DSP1.parameters [0]|(DSP1.parameters[1]<<8));
|
||||
@ -474,9 +494,9 @@ void DSP1SetByte(uint8 byte, uint16 address)
|
||||
Op1CXBR = (DSP1.parameters [6]|(DSP1.parameters[7]<<8));
|
||||
Op1CYBR = (DSP1.parameters [8]|(DSP1.parameters[9]<<8));
|
||||
Op1CZBR = (DSP1.parameters [10]|(DSP1.parameters[11]<<8));
|
||||
|
||||
|
||||
DSPOp1C ();
|
||||
|
||||
|
||||
DSP1.out_count = 6;
|
||||
DSP1.output [0] = (uint8) (Op1CXAR&0xFF);
|
||||
DSP1.output [1] = (uint8) ((Op1CXAR>>8)&0xFF);
|
||||
@ -485,7 +505,7 @@ void DSP1SetByte(uint8 byte, uint16 address)
|
||||
DSP1.output [4] = (uint8) (Op1CZAR&0xFF);
|
||||
DSP1.output [5] = (uint8) ((Op1CZAR>>8)&0xFF);
|
||||
break;
|
||||
|
||||
|
||||
case 0x32:
|
||||
case 0x22:
|
||||
case 0x12:
|
||||
@ -497,9 +517,9 @@ void DSP1SetByte(uint8 byte, uint16 address)
|
||||
Op02LES = (short)(DSP1.parameters [8]|(DSP1.parameters[9]<<8));
|
||||
Op02AAS = (unsigned short)(DSP1.parameters [10]|(DSP1.parameters[11]<<8));
|
||||
Op02AZS = (unsigned short)(DSP1.parameters [12]|(DSP1.parameters[13]<<8));
|
||||
|
||||
|
||||
DSPOp02 ();
|
||||
|
||||
|
||||
DSP1.out_count = 8;
|
||||
DSP1.output [0] = (uint8) (Op02VOF&0xFF);
|
||||
DSP1.output [1] = (uint8) ((Op02VOF>>8)&0xFF);
|
||||
@ -510,15 +530,15 @@ void DSP1SetByte(uint8 byte, uint16 address)
|
||||
DSP1.output [6] = (uint8) (Op02CY&0xFF);
|
||||
DSP1.output [7] = (uint8) ((Op02CY>>8)&0xFF);
|
||||
break;
|
||||
|
||||
|
||||
case 0x3a: //1a Mirror
|
||||
case 0x2a: //1a Mirror
|
||||
case 0x1a: // Raster mode 7 matrix data
|
||||
case 0x0a:
|
||||
Op0AVS = (short)(DSP1.parameters [0]|(DSP1.parameters[1]<<8));
|
||||
|
||||
|
||||
DSPOp0A ();
|
||||
|
||||
|
||||
DSP1.out_count = 8;
|
||||
DSP1.output [0] = (uint8) (Op0AA&0xFF);
|
||||
DSP1.output [2] = (uint8) (Op0AB&0xFF);
|
||||
@ -530,7 +550,7 @@ void DSP1SetByte(uint8 byte, uint16 address)
|
||||
DSP1.output [7] = (uint8) ((Op0AD>>8)&0xFF);
|
||||
DSP1.in_index=0;
|
||||
break;
|
||||
|
||||
|
||||
case 0x16:
|
||||
case 0x26:
|
||||
case 0x36:
|
||||
@ -538,9 +558,9 @@ void DSP1SetByte(uint8 byte, uint16 address)
|
||||
Op06X = (int16) (DSP1.parameters [0]|(DSP1.parameters[1]<<8));
|
||||
Op06Y = (int16) (DSP1.parameters [2]|(DSP1.parameters[3]<<8));
|
||||
Op06Z = (int16) (DSP1.parameters [4]|(DSP1.parameters[5]<<8));
|
||||
|
||||
|
||||
DSPOp06 ();
|
||||
|
||||
|
||||
DSP1.out_count = 6;
|
||||
DSP1.output [0] = (uint8) (Op06H&0xff);
|
||||
DSP1.output [1] = (uint8) ((Op06H>>8)&0xFF);
|
||||
@ -549,23 +569,23 @@ void DSP1SetByte(uint8 byte, uint16 address)
|
||||
DSP1.output [4] = (uint8) (Op06M&0xFF);
|
||||
DSP1.output [5] = (uint8) ((Op06M>>8)&0xFF);
|
||||
break;
|
||||
|
||||
|
||||
case 0x1e:
|
||||
case 0x2e:
|
||||
case 0x3e:
|
||||
case 0x0e: // Target
|
||||
Op0EH = (int16) (DSP1.parameters [0]|(DSP1.parameters[1]<<8));
|
||||
Op0EV = (int16) (DSP1.parameters [2]|(DSP1.parameters[3]<<8));
|
||||
|
||||
|
||||
DSPOp0E ();
|
||||
|
||||
|
||||
DSP1.out_count = 4;
|
||||
DSP1.output [0] = (uint8) (Op0EX&0xFF);
|
||||
DSP1.output [1] = (uint8) ((Op0EX>>8)&0xFF);
|
||||
DSP1.output [2] = (uint8) (Op0EY&0xFF);
|
||||
DSP1.output [3] = (uint8) ((Op0EY>>8)&0xFF);
|
||||
break;
|
||||
|
||||
|
||||
// Extra commands used by Pilot Wings
|
||||
case 0x05:
|
||||
case 0x35:
|
||||
@ -575,30 +595,30 @@ void DSP1SetByte(uint8 byte, uint16 address)
|
||||
Op01Zr = (int16) (DSP1.parameters [2]|(DSP1.parameters[3]<<8));
|
||||
Op01Yr = (int16) (DSP1.parameters [4]|(DSP1.parameters[5]<<8));
|
||||
Op01Xr = (int16) (DSP1.parameters [6]|(DSP1.parameters[7]<<8));
|
||||
|
||||
|
||||
DSPOp01 ();
|
||||
break;
|
||||
|
||||
case 0x15:
|
||||
|
||||
case 0x15:
|
||||
case 0x11: // Set attitude matrix B
|
||||
Op11m = (int16) (DSP1.parameters [0]|(DSP1.parameters[1]<<8));
|
||||
Op11Zr = (int16) (DSP1.parameters [2]|(DSP1.parameters[3]<<8));
|
||||
Op11Yr = (int16) (DSP1.parameters [4]|(DSP1.parameters[5]<<8));
|
||||
Op11Xr = (int16) (DSP1.parameters [7]|(DSP1.parameters[7]<<8));
|
||||
|
||||
|
||||
DSPOp11 ();
|
||||
break;
|
||||
|
||||
|
||||
case 0x25:
|
||||
case 0x21: // Set attitude matrix C
|
||||
Op21m = (int16) (DSP1.parameters [0]|(DSP1.parameters[1]<<8));
|
||||
Op21Zr = (int16) (DSP1.parameters [2]|(DSP1.parameters[3]<<8));
|
||||
Op21Yr = (int16) (DSP1.parameters [4]|(DSP1.parameters[5]<<8));
|
||||
Op21Xr = (int16) (DSP1.parameters [6]|(DSP1.parameters[7]<<8));
|
||||
|
||||
|
||||
DSPOp21 ();
|
||||
break;
|
||||
|
||||
|
||||
case 0x09:
|
||||
case 0x39:
|
||||
case 0x3d:
|
||||
@ -606,9 +626,9 @@ void DSP1SetByte(uint8 byte, uint16 address)
|
||||
Op0DX = (int16) (DSP1.parameters [0]|(DSP1.parameters[1]<<8));
|
||||
Op0DY = (int16) (DSP1.parameters [2]|(DSP1.parameters[3]<<8));
|
||||
Op0DZ = (int16) (DSP1.parameters [4]|(DSP1.parameters[5]<<8));
|
||||
|
||||
|
||||
DSPOp0D ();
|
||||
|
||||
|
||||
DSP1.out_count = 6;
|
||||
DSP1.output [0] = (uint8) (Op0DF&0xFF);
|
||||
DSP1.output [1] = (uint8) ((Op0DF>>8)&0xFF);
|
||||
@ -617,15 +637,15 @@ void DSP1SetByte(uint8 byte, uint16 address)
|
||||
DSP1.output [4] = (uint8) (Op0DU&0xFF);
|
||||
DSP1.output [5] = (uint8) ((Op0DU>>8)&0xFF);
|
||||
break;
|
||||
|
||||
|
||||
case 0x19:
|
||||
case 0x1d: // Objective matrix B
|
||||
Op1DX = (int16) (DSP1.parameters [0]|(DSP1.parameters[1]<<8));
|
||||
Op1DY = (int16) (DSP1.parameters [2]|(DSP1.parameters[3]<<8));
|
||||
Op1DZ = (int16) (DSP1.parameters [4]|(DSP1.parameters[5]<<8));
|
||||
|
||||
|
||||
DSPOp1D ();
|
||||
|
||||
|
||||
DSP1.out_count = 6;
|
||||
DSP1.output [0] = (uint8) (Op1DF&0xFF);
|
||||
DSP1.output [1] = (uint8) ((Op1DF>>8)&0xFF);
|
||||
@ -634,15 +654,15 @@ void DSP1SetByte(uint8 byte, uint16 address)
|
||||
DSP1.output [4] = (uint8) (Op1DU&0xFF);
|
||||
DSP1.output [5] = (uint8) ((Op1DU>>8)&0xFF);
|
||||
break;
|
||||
|
||||
|
||||
case 0x29:
|
||||
case 0x2d: // Objective matrix C
|
||||
Op2DX = (int16) (DSP1.parameters [0]|(DSP1.parameters[1]<<8));
|
||||
Op2DY = (int16) (DSP1.parameters [2]|(DSP1.parameters[3]<<8));
|
||||
Op2DZ = (int16) (DSP1.parameters [4]|(DSP1.parameters[5]<<8));
|
||||
|
||||
|
||||
DSPOp2D ();
|
||||
|
||||
|
||||
DSP1.out_count = 6;
|
||||
DSP1.output [0] = (uint8) (Op2DF&0xFF);
|
||||
DSP1.output [1] = (uint8) ((Op2DF>>8)&0xFF);
|
||||
@ -651,15 +671,15 @@ void DSP1SetByte(uint8 byte, uint16 address)
|
||||
DSP1.output [4] = (uint8) (Op2DU&0xFF);
|
||||
DSP1.output [5] = (uint8) ((Op2DU>>8)&0xFF);
|
||||
break;
|
||||
|
||||
|
||||
case 0x33:
|
||||
case 0x03: // Subjective matrix A
|
||||
Op03F = (int16) (DSP1.parameters [0]|(DSP1.parameters[1]<<8));
|
||||
Op03L = (int16) (DSP1.parameters [2]|(DSP1.parameters[3]<<8));
|
||||
Op03U = (int16) (DSP1.parameters [4]|(DSP1.parameters[5]<<8));
|
||||
|
||||
|
||||
DSPOp03 ();
|
||||
|
||||
|
||||
DSP1.out_count = 6;
|
||||
DSP1.output [0] = (uint8) (Op03X&0xFF);
|
||||
DSP1.output [1] = (uint8) ((Op03X>>8)&0xFF);
|
||||
@ -668,14 +688,14 @@ void DSP1SetByte(uint8 byte, uint16 address)
|
||||
DSP1.output [4] = (uint8) (Op03Z&0xFF);
|
||||
DSP1.output [5] = (uint8) ((Op03Z>>8)&0xFF);
|
||||
break;
|
||||
|
||||
|
||||
case 0x13: // Subjective matrix B
|
||||
Op13F = (int16) (DSP1.parameters [0]|(DSP1.parameters[1]<<8));
|
||||
Op13L = (int16) (DSP1.parameters [2]|(DSP1.parameters[3]<<8));
|
||||
Op13U = (int16) (DSP1.parameters [4]|(DSP1.parameters[5]<<8));
|
||||
|
||||
|
||||
DSPOp13 ();
|
||||
|
||||
|
||||
DSP1.out_count = 6;
|
||||
DSP1.output [0] = (uint8) (Op13X&0xFF);
|
||||
DSP1.output [1] = (uint8) ((Op13X>>8)&0xFF);
|
||||
@ -684,14 +704,14 @@ void DSP1SetByte(uint8 byte, uint16 address)
|
||||
DSP1.output [4] = (uint8) (Op13Z&0xFF);
|
||||
DSP1.output [5] = (uint8) ((Op13Z>>8)&0xFF);
|
||||
break;
|
||||
|
||||
|
||||
case 0x23: // Subjective matrix C
|
||||
Op23F = (int16) (DSP1.parameters [0]|(DSP1.parameters[1]<<8));
|
||||
Op23L = (int16) (DSP1.parameters [2]|(DSP1.parameters[3]<<8));
|
||||
Op23U = (int16) (DSP1.parameters [4]|(DSP1.parameters[5]<<8));
|
||||
|
||||
|
||||
DSPOp23 ();
|
||||
|
||||
|
||||
DSP1.out_count = 6;
|
||||
DSP1.output [0] = (uint8) (Op23X&0xFF);
|
||||
DSP1.output [1] = (uint8) ((Op23X>>8)&0xFF);
|
||||
@ -700,55 +720,55 @@ void DSP1SetByte(uint8 byte, uint16 address)
|
||||
DSP1.output [4] = (uint8) (Op23Z&0xFF);
|
||||
DSP1.output [5] = (uint8) ((Op23Z>>8)&0xFF);
|
||||
break;
|
||||
|
||||
|
||||
case 0x3b:
|
||||
case 0x0b:
|
||||
Op0BX = (int16) (DSP1.parameters [0]|(DSP1.parameters[1]<<8));
|
||||
Op0BY = (int16) (DSP1.parameters [2]|(DSP1.parameters[3]<<8));
|
||||
Op0BZ = (int16) (DSP1.parameters [4]|(DSP1.parameters[5]<<8));
|
||||
|
||||
|
||||
DSPOp0B ();
|
||||
|
||||
|
||||
DSP1.out_count = 2;
|
||||
DSP1.output [0] = (uint8) (Op0BS&0xFF);
|
||||
DSP1.output [1] = (uint8) ((Op0BS>>8)&0xFF);
|
||||
break;
|
||||
|
||||
|
||||
case 0x1b:
|
||||
Op1BX = (int16) (DSP1.parameters [0]|(DSP1.parameters[1]<<8));
|
||||
Op1BY = (int16) (DSP1.parameters [2]|(DSP1.parameters[3]<<8));
|
||||
Op1BZ = (int16) (DSP1.parameters [4]|(DSP1.parameters[5]<<8));
|
||||
|
||||
|
||||
DSPOp1B ();
|
||||
|
||||
|
||||
DSP1.out_count = 2;
|
||||
DSP1.output [0] = (uint8) (Op1BS&0xFF);
|
||||
DSP1.output [1] = (uint8) ((Op1BS>>8)&0xFF);
|
||||
break;
|
||||
|
||||
|
||||
case 0x2b:
|
||||
Op2BX = (int16) (DSP1.parameters [0]|(DSP1.parameters[1]<<8));
|
||||
Op2BY = (int16) (DSP1.parameters [2]|(DSP1.parameters[3]<<8));
|
||||
Op2BZ = (int16) (DSP1.parameters [4]|(DSP1.parameters[5]<<8));
|
||||
|
||||
|
||||
DSPOp2B ();
|
||||
|
||||
|
||||
DSP1.out_count = 2;
|
||||
DSP1.output [0] = (uint8) (Op2BS&0xFF);
|
||||
DSP1.output [1] = (uint8) ((Op2BS>>8)&0xFF);
|
||||
break;
|
||||
|
||||
|
||||
case 0x34:
|
||||
case 0x14:
|
||||
case 0x14:
|
||||
Op14Zr = (int16) (DSP1.parameters [0]|(DSP1.parameters[1]<<8));
|
||||
Op14Xr = (int16) (DSP1.parameters [2]|(DSP1.parameters[3]<<8));
|
||||
Op14Yr = (int16) (DSP1.parameters [4]|(DSP1.parameters[5]<<8));
|
||||
Op14U = (int16) (DSP1.parameters [6]|(DSP1.parameters[7]<<8));
|
||||
Op14F = (int16) (DSP1.parameters [8]|(DSP1.parameters[9]<<8));
|
||||
Op14L = (int16) (DSP1.parameters [10]|(DSP1.parameters[11]<<8));
|
||||
|
||||
|
||||
DSPOp14 ();
|
||||
|
||||
|
||||
DSP1.out_count = 6;
|
||||
DSP1.output [0] = (uint8) (Op14Zrr&0xFF);
|
||||
DSP1.output [1] = (uint8) ((Op14Zrr>>8)&0xFF);
|
||||
@ -757,30 +777,30 @@ void DSP1SetByte(uint8 byte, uint16 address)
|
||||
DSP1.output [4] = (uint8) (Op14Yrr&0xFF);
|
||||
DSP1.output [5] = (uint8) ((Op14Yrr>>8)&0xFF);
|
||||
break;
|
||||
|
||||
|
||||
case 0x27:
|
||||
case 0x2F:
|
||||
Op2FUnknown = (int16) (DSP1.parameters [0]|(DSP1.parameters[1]<<8));
|
||||
|
||||
|
||||
DSPOp2F ();
|
||||
|
||||
|
||||
DSP1.out_count = 2;
|
||||
DSP1.output [0] = (uint8)(Op2FSize&0xFF);
|
||||
DSP1.output [1] = (uint8)((Op2FSize>>8)&0xFF);
|
||||
break;
|
||||
|
||||
|
||||
|
||||
|
||||
case 0x07:
|
||||
case 0x0F:
|
||||
Op0FRamsize = (int16) (DSP1.parameters [0]|(DSP1.parameters[1]<<8));
|
||||
|
||||
|
||||
DSPOp0F ();
|
||||
|
||||
|
||||
DSP1.out_count = 2;
|
||||
DSP1.output [0] = (uint8)(Op0FPass&0xFF);
|
||||
DSP1.output [1] = (uint8)((Op0FPass>>8)&0xFF);
|
||||
break;
|
||||
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
@ -793,9 +813,7 @@ void DSP1SetByte(uint8 byte, uint16 address)
|
||||
uint8 DSP1GetByte(uint16 address)
|
||||
{
|
||||
uint8 t;
|
||||
if ((address & 0xf000) == 0x6000 ||
|
||||
// (address >= 0x8000 && address < 0xc000))
|
||||
(address&0x7fff) < 0x4000)
|
||||
if (address < DSP1.boundary)
|
||||
{
|
||||
if (DSP1.out_count)
|
||||
{
|
||||
@ -880,7 +898,7 @@ void DSP2SetByte(uint8 byte, uint16 address)
|
||||
// DSP1.first_parameter = FALSE;
|
||||
DSP1.in_index++;
|
||||
}
|
||||
|
||||
|
||||
if (DSP1.in_count==DSP1.in_index)
|
||||
{
|
||||
//DSP1.parameters [DSP1.in_index] |= (byte << 8);
|
||||
@ -1016,7 +1034,7 @@ void DSP4SetByte(uint8 byte, uint16 address)
|
||||
InitDSP4();
|
||||
DSP4_init=TRUE;
|
||||
}
|
||||
if ((address & 0xf000) == 0x6000 || (address >= 0x8000 && address < 0xc000))
|
||||
if (address < DSP1.boundary)
|
||||
{
|
||||
dsp4_byte=byte;
|
||||
dsp4_address=address;
|
||||
@ -1026,7 +1044,7 @@ void DSP4SetByte(uint8 byte, uint16 address)
|
||||
|
||||
uint8 DSP4GetByte(uint16 address)
|
||||
{
|
||||
if ((address & 0xf000) == 0x6000 || (address >= 0x8000 && address < 0xc000))
|
||||
if (address < DSP1.boundary)
|
||||
{
|
||||
dsp4_address=address;
|
||||
DSP4_GetByte();
|
||||
|
@ -1,7 +1,7 @@
|
||||
/**********************************************************************************
|
||||
Snes9x - Portable Super Nintendo Entertainment System (TM) emulator.
|
||||
|
||||
(c) Copyright 1996 - 2002 Gary Henderson (gary.henderson@ntlworld.com) and
|
||||
(c) Copyright 1996 - 2002 Gary Henderson (gary.henderson@ntlworld.com),
|
||||
Jerremy Koot (jkoot@snes9x.com)
|
||||
|
||||
(c) Copyright 2002 - 2004 Matthew Kendora
|
||||
@ -12,12 +12,16 @@
|
||||
|
||||
(c) Copyright 2001 - 2006 John Weidman (jweidman@slip.net)
|
||||
|
||||
(c) Copyright 2002 - 2006 Brad Jorsch (anomie@users.sourceforge.net),
|
||||
funkyass (funkyass@spam.shaw.ca),
|
||||
Kris Bleakley (codeviolation@hotmail.com),
|
||||
Nach (n-a-c-h@users.sourceforge.net), and
|
||||
(c) Copyright 2002 - 2006 funkyass (funkyass@spam.shaw.ca),
|
||||
Kris Bleakley (codeviolation@hotmail.com)
|
||||
|
||||
(c) Copyright 2002 - 2007 Brad Jorsch (anomie@users.sourceforge.net),
|
||||
Nach (n-a-c-h@users.sourceforge.net),
|
||||
zones (kasumitokoduck@yahoo.com)
|
||||
|
||||
(c) Copyright 2006 - 2007 nitsuja
|
||||
|
||||
|
||||
BS-X C emulator code
|
||||
(c) Copyright 2005 - 2006 Dreamer Nom,
|
||||
zones
|
||||
@ -110,17 +114,30 @@
|
||||
2xSaI filter
|
||||
(c) Copyright 1999 - 2001 Derek Liauw Kie Fa
|
||||
|
||||
HQ2x filter
|
||||
HQ2x, HQ3x, HQ4x filters
|
||||
(c) Copyright 2003 Maxim Stepin (maxim@hiend3d.com)
|
||||
|
||||
Win32 GUI code
|
||||
(c) Copyright 2003 - 2006 blip,
|
||||
funkyass,
|
||||
Matthew Kendora,
|
||||
Nach,
|
||||
nitsuja
|
||||
|
||||
Mac OS GUI code
|
||||
(c) Copyright 1998 - 2001 John Stiles
|
||||
(c) Copyright 2001 - 2007 zones
|
||||
|
||||
|
||||
Specific ports contains the works of other authors. See headers in
|
||||
individual files.
|
||||
|
||||
|
||||
Snes9x homepage: http://www.snes9x.com
|
||||
|
||||
Permission to use, copy, modify and/or distribute Snes9x in both binary
|
||||
and source form, for non-commercial purposes, is hereby granted without
|
||||
fee, providing that this license information and copyright notice appear
|
||||
and source form, for non-commercial purposes, is hereby granted without
|
||||
fee, providing that this license information and copyright notice appear
|
||||
with all copies and any derived work.
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
@ -142,6 +159,8 @@
|
||||
**********************************************************************************/
|
||||
|
||||
|
||||
|
||||
|
||||
#ifndef _DSP1_H_
|
||||
#define _DSP1_H_
|
||||
|
||||
@ -161,6 +180,16 @@ void DSP3_Reset();
|
||||
void DSP4SetByte(uint8 byte, uint16 address);
|
||||
uint8 DSP4GetByte(uint16 address);
|
||||
|
||||
enum
|
||||
{
|
||||
M_DSP1_LOROM_S,
|
||||
M_DSP1_LOROM_L,
|
||||
M_DSP1_HIROM,
|
||||
M_DSP2_LOROM,
|
||||
M_DSP3_LOROM,
|
||||
M_DSP4_LOROM
|
||||
};
|
||||
|
||||
struct SDSP1 {
|
||||
uint8 version;
|
||||
bool8 waiting4command;
|
||||
@ -172,14 +201,22 @@ struct SDSP1 {
|
||||
uint32 out_index;
|
||||
uint8 parameters [512];
|
||||
uint8 output [512];
|
||||
|
||||
uint8 temp_save_data [406];
|
||||
uint32 maptype;
|
||||
uint32 boundary;
|
||||
};
|
||||
|
||||
START_EXTERN_C
|
||||
void S9xResetDSP1 ();
|
||||
uint8 S9xGetDSP (uint16 Address);
|
||||
void S9xSetDSP (uint8 Byte, uint16 Address);
|
||||
END_EXTERN_C
|
||||
void S9xPreSaveDSP1();
|
||||
void S9xPostLoadDSP1();
|
||||
|
||||
extern struct SDSP1 DSP1;
|
||||
|
||||
END_EXTERN_C
|
||||
|
||||
|
||||
#endif
|
||||
|
@ -1213,3 +1213,182 @@ void DSPOp2F()
|
||||
{
|
||||
Op2FSize=0x100;
|
||||
}
|
||||
|
||||
|
||||
|
||||
// FIXME: many of these are unnecessary to save. But some of them are necessary, like Matrix* and maybe VPlane_*
|
||||
// TODO: move the necessary ones into a global structure so it's not as ugly to save
|
||||
#define SAVE_OR_LOAD_THE_VARIABLES() \
|
||||
S(Op00Multiplicand); \
|
||||
S(Op00Multiplier); \
|
||||
S(Op00Result); \
|
||||
S(Op20Multiplicand); \
|
||||
S(Op20Multiplier); \
|
||||
S(Op20Result); \
|
||||
S(Op10Coefficient); \
|
||||
S(Op10Exponent); \
|
||||
S(Op10CoefficientR); \
|
||||
S(Op10ExponentR); \
|
||||
S(Op04Angle); \
|
||||
S(Op04Radius); \
|
||||
S(Op04Sin); \
|
||||
S(Op04Cos); \
|
||||
S(Op0CA); \
|
||||
S(Op0CX1); \
|
||||
S(Op0CY1); \
|
||||
S(Op0CX2); \
|
||||
S(Op0CY2); \
|
||||
S(CentreX); \
|
||||
S(CentreY); \
|
||||
S(VOffset); \
|
||||
S(VPlane_C); \
|
||||
S(VPlane_E); \
|
||||
S(SinAas); \
|
||||
S(CosAas); \
|
||||
S(SinAzs); \
|
||||
S(CosAzs); \
|
||||
S(SinAZS); \
|
||||
S(CosAZS); \
|
||||
S(SecAZS_C1); \
|
||||
S(SecAZS_E1); \
|
||||
S(SecAZS_C2); \
|
||||
S(SecAZS_E2); \
|
||||
S(Nx); S(Ny); S(Nz); \
|
||||
S(Gx); S(Gy); S(Gz); \
|
||||
S(C_Les); S(E_Les); S(G_Les); \
|
||||
S(Op02FX); \
|
||||
S(Op02FY); \
|
||||
S(Op02FZ); \
|
||||
S(Op02LFE); \
|
||||
S(Op02LES); \
|
||||
S(Op02AAS); \
|
||||
S(Op02AZS); \
|
||||
S(Op02VOF); \
|
||||
S(Op02VVA); \
|
||||
S(Op02CX); \
|
||||
S(Op02CY); \
|
||||
S(Op0AVS); \
|
||||
S(Op0AA); \
|
||||
S(Op0AB); \
|
||||
S(Op0AC); \
|
||||
S(Op0AD); \
|
||||
S(Op06X); \
|
||||
S(Op06Y); \
|
||||
S(Op06Z); \
|
||||
S(Op06H); \
|
||||
S(Op06V); \
|
||||
S(Op06M); \
|
||||
S(matrixC); \
|
||||
S(matrixB); \
|
||||
S(matrixA); \
|
||||
S(Op01m); \
|
||||
S(Op01Zr); \
|
||||
S(Op01Xr); \
|
||||
S(Op01Yr); \
|
||||
S(Op11m); \
|
||||
S(Op11Zr); \
|
||||
S(Op11Xr); \
|
||||
S(Op11Yr); \
|
||||
S(Op21m); \
|
||||
S(Op21Zr); \
|
||||
S(Op21Xr); \
|
||||
S(Op21Yr); \
|
||||
S(Op0DX); \
|
||||
S(Op0DY); \
|
||||
S(Op0DZ); \
|
||||
S(Op0DF); \
|
||||
S(Op0DL); \
|
||||
S(Op0DU); \
|
||||
S(Op1DX); \
|
||||
S(Op1DY); \
|
||||
S(Op1DZ); \
|
||||
S(Op1DF); \
|
||||
S(Op1DL); \
|
||||
S(Op1DU); \
|
||||
S(Op2DX); \
|
||||
S(Op2DY); \
|
||||
S(Op2DZ); \
|
||||
S(Op2DF); \
|
||||
S(Op2DL); \
|
||||
S(Op2DU); \
|
||||
S(Op03F); \
|
||||
S(Op03L); \
|
||||
S(Op03U); \
|
||||
S(Op03X); \
|
||||
S(Op03Y); \
|
||||
S(Op03Z); \
|
||||
S(Op13F); \
|
||||
S(Op13L); \
|
||||
S(Op13U); \
|
||||
S(Op13X); \
|
||||
S(Op13Y); \
|
||||
S(Op13Z); \
|
||||
S(Op23F); \
|
||||
S(Op23L); \
|
||||
S(Op23U); \
|
||||
S(Op23X); \
|
||||
S(Op23Y); \
|
||||
S(Op23Z); \
|
||||
S(Op14Zr); \
|
||||
S(Op14Xr); \
|
||||
S(Op14Yr); \
|
||||
S(Op14U); \
|
||||
S(Op14F); \
|
||||
S(Op14L); \
|
||||
S(Op14Zrr); \
|
||||
S(Op14Xrr); \
|
||||
S(Op14Yrr); \
|
||||
S(Op0EH); \
|
||||
S(Op0EV); \
|
||||
S(Op0EX); \
|
||||
S(Op0EY); \
|
||||
S(Op0BX); \
|
||||
S(Op0BY); \
|
||||
S(Op0BZ); \
|
||||
S(Op0BS); \
|
||||
S(Op1BX); \
|
||||
S(Op1BY); \
|
||||
S(Op1BZ); \
|
||||
S(Op1BS); \
|
||||
S(Op2BX); \
|
||||
S(Op2BY); \
|
||||
S(Op2BZ); \
|
||||
S(Op2BS); \
|
||||
S(Op08X); S(Op08Y); S(Op08Z); S(Op08Ll); S(Op08Lh); \
|
||||
S(Op18X); S(Op18Y); S(Op18Z); S(Op18R); S(Op18D); \
|
||||
S(Op38X); S(Op38Y); S(Op38Z); S(Op38R); S(Op38D); \
|
||||
S(Op28X); \
|
||||
S(Op28Y); \
|
||||
S(Op28Z); \
|
||||
S(Op28R); \
|
||||
S(Op1CX); S(Op1CY); S(Op1CZ); \
|
||||
S(Op1CXBR); S(Op1CYBR); S(Op1CZBR); S(Op1CXAR); S(Op1CYAR); S(Op1CZAR); \
|
||||
S(Op1CX1); \
|
||||
S(Op1CY1); \
|
||||
S(Op1CZ1); \
|
||||
S(Op1CX2); \
|
||||
S(Op1CY2); \
|
||||
S(Op1CZ2); \
|
||||
S(Op0FRamsize); \
|
||||
S(Op0FPass); \
|
||||
S(Op2FUnknown); \
|
||||
S(Op2FSize); \
|
||||
// end
|
||||
|
||||
void S9xPreSaveDSP1()
|
||||
{
|
||||
int i = 0;
|
||||
#define S(x) {memcpy(DSP1.temp_save_data + i, &(x), sizeof(x)); i += sizeof(x);}
|
||||
SAVE_OR_LOAD_THE_VARIABLES();
|
||||
#undef S
|
||||
assert(i == sizeof(DSP1.temp_save_data));
|
||||
}
|
||||
|
||||
void S9xPostLoadDSP1()
|
||||
{
|
||||
int i = 0;
|
||||
#define S(x) {memcpy(&(x), DSP1.temp_save_data + i, sizeof(x)); i += sizeof(x);}
|
||||
SAVE_OR_LOAD_THE_VARIABLES();
|
||||
#undef S
|
||||
assert(i == sizeof(DSP1.temp_save_data));
|
||||
}
|
||||
|
@ -1,7 +1,7 @@
|
||||
/**********************************************************************************
|
||||
Snes9x - Portable Super Nintendo Entertainment System (TM) emulator.
|
||||
|
||||
(c) Copyright 1996 - 2002 Gary Henderson (gary.henderson@ntlworld.com) and
|
||||
(c) Copyright 1996 - 2002 Gary Henderson (gary.henderson@ntlworld.com),
|
||||
Jerremy Koot (jkoot@snes9x.com)
|
||||
|
||||
(c) Copyright 2002 - 2004 Matthew Kendora
|
||||
@ -12,12 +12,16 @@
|
||||
|
||||
(c) Copyright 2001 - 2006 John Weidman (jweidman@slip.net)
|
||||
|
||||
(c) Copyright 2002 - 2006 Brad Jorsch (anomie@users.sourceforge.net),
|
||||
funkyass (funkyass@spam.shaw.ca),
|
||||
Kris Bleakley (codeviolation@hotmail.com),
|
||||
Nach (n-a-c-h@users.sourceforge.net), and
|
||||
(c) Copyright 2002 - 2006 funkyass (funkyass@spam.shaw.ca),
|
||||
Kris Bleakley (codeviolation@hotmail.com)
|
||||
|
||||
(c) Copyright 2002 - 2007 Brad Jorsch (anomie@users.sourceforge.net),
|
||||
Nach (n-a-c-h@users.sourceforge.net),
|
||||
zones (kasumitokoduck@yahoo.com)
|
||||
|
||||
(c) Copyright 2006 - 2007 nitsuja
|
||||
|
||||
|
||||
BS-X C emulator code
|
||||
(c) Copyright 2005 - 2006 Dreamer Nom,
|
||||
zones
|
||||
@ -110,17 +114,30 @@
|
||||
2xSaI filter
|
||||
(c) Copyright 1999 - 2001 Derek Liauw Kie Fa
|
||||
|
||||
HQ2x filter
|
||||
HQ2x, HQ3x, HQ4x filters
|
||||
(c) Copyright 2003 Maxim Stepin (maxim@hiend3d.com)
|
||||
|
||||
Win32 GUI code
|
||||
(c) Copyright 2003 - 2006 blip,
|
||||
funkyass,
|
||||
Matthew Kendora,
|
||||
Nach,
|
||||
nitsuja
|
||||
|
||||
Mac OS GUI code
|
||||
(c) Copyright 1998 - 2001 John Stiles
|
||||
(c) Copyright 2001 - 2007 zones
|
||||
|
||||
|
||||
Specific ports contains the works of other authors. See headers in
|
||||
individual files.
|
||||
|
||||
|
||||
Snes9x homepage: http://www.snes9x.com
|
||||
|
||||
Permission to use, copy, modify and/or distribute Snes9x in both binary
|
||||
and source form, for non-commercial purposes, is hereby granted without
|
||||
fee, providing that this license information and copyright notice appear
|
||||
and source form, for non-commercial purposes, is hereby granted without
|
||||
fee, providing that this license information and copyright notice appear
|
||||
with all copies and any derived work.
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
@ -143,6 +160,8 @@
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
uint16 DSP2Op09Word1=0;
|
||||
uint16 DSP2Op09Word2=0;
|
||||
bool DSP2Op05HasLen=false;
|
||||
@ -201,7 +220,7 @@ void DSP2_Op01 ()
|
||||
{
|
||||
// Op01 size is always 32 bytes input and output.
|
||||
// The hardware does strange things if you vary the size.
|
||||
|
||||
|
||||
int j;
|
||||
unsigned char c0, c1, c2, c3;
|
||||
unsigned char *p1 = DSP1.parameters;
|
||||
@ -299,7 +318,7 @@ void DSP2_Op0D()
|
||||
if ( (pixel_offset&1) == 0 )
|
||||
pixelarray[i] = DSP1.parameters[pixel_offset>>1] >> 4;
|
||||
else
|
||||
pixelarray[i] = DSP1.parameters[pixel_offset>>1] & 0x0f;
|
||||
pixelarray[i] = DSP1.parameters[pixel_offset>>1] & 0x0f;
|
||||
}
|
||||
|
||||
for ( i=0; i < DSP2Op0DOutLen; i++ )
|
||||
|
@ -1,7 +1,7 @@
|
||||
/**********************************************************************************
|
||||
Snes9x - Portable Super Nintendo Entertainment System (TM) emulator.
|
||||
|
||||
(c) Copyright 1996 - 2002 Gary Henderson (gary.henderson@ntlworld.com) and
|
||||
(c) Copyright 1996 - 2002 Gary Henderson (gary.henderson@ntlworld.com),
|
||||
Jerremy Koot (jkoot@snes9x.com)
|
||||
|
||||
(c) Copyright 2002 - 2004 Matthew Kendora
|
||||
@ -12,12 +12,16 @@
|
||||
|
||||
(c) Copyright 2001 - 2006 John Weidman (jweidman@slip.net)
|
||||
|
||||
(c) Copyright 2002 - 2006 Brad Jorsch (anomie@users.sourceforge.net),
|
||||
funkyass (funkyass@spam.shaw.ca),
|
||||
Kris Bleakley (codeviolation@hotmail.com),
|
||||
Nach (n-a-c-h@users.sourceforge.net), and
|
||||
(c) Copyright 2002 - 2006 funkyass (funkyass@spam.shaw.ca),
|
||||
Kris Bleakley (codeviolation@hotmail.com)
|
||||
|
||||
(c) Copyright 2002 - 2007 Brad Jorsch (anomie@users.sourceforge.net),
|
||||
Nach (n-a-c-h@users.sourceforge.net),
|
||||
zones (kasumitokoduck@yahoo.com)
|
||||
|
||||
(c) Copyright 2006 - 2007 nitsuja
|
||||
|
||||
|
||||
BS-X C emulator code
|
||||
(c) Copyright 2005 - 2006 Dreamer Nom,
|
||||
zones
|
||||
@ -110,17 +114,30 @@
|
||||
2xSaI filter
|
||||
(c) Copyright 1999 - 2001 Derek Liauw Kie Fa
|
||||
|
||||
HQ2x filter
|
||||
HQ2x, HQ3x, HQ4x filters
|
||||
(c) Copyright 2003 Maxim Stepin (maxim@hiend3d.com)
|
||||
|
||||
Win32 GUI code
|
||||
(c) Copyright 2003 - 2006 blip,
|
||||
funkyass,
|
||||
Matthew Kendora,
|
||||
Nach,
|
||||
nitsuja
|
||||
|
||||
Mac OS GUI code
|
||||
(c) Copyright 1998 - 2001 John Stiles
|
||||
(c) Copyright 2001 - 2007 zones
|
||||
|
||||
|
||||
Specific ports contains the works of other authors. See headers in
|
||||
individual files.
|
||||
|
||||
|
||||
Snes9x homepage: http://www.snes9x.com
|
||||
|
||||
Permission to use, copy, modify and/or distribute Snes9x in both binary
|
||||
and source form, for non-commercial purposes, is hereby granted without
|
||||
fee, providing that this license information and copyright notice appear
|
||||
and source form, for non-commercial purposes, is hereby granted without
|
||||
fee, providing that this license information and copyright notice appear
|
||||
with all copies and any derived work.
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
@ -142,6 +159,8 @@
|
||||
**********************************************************************************/
|
||||
|
||||
|
||||
|
||||
|
||||
#ifndef __cplusplus
|
||||
//C++ in C
|
||||
typedef unsigned char bool;
|
||||
@ -1106,9 +1125,7 @@ void DSP3_OP1E_D( int16 move, int16 *lo, int16 *hi )
|
||||
|
||||
void DSP3_OP1E_D1( int16 move, int16 *lo, int16 *hi )
|
||||
{
|
||||
#ifndef NGC
|
||||
uint32 dataOfs = ((move << 1) + 0x03b2) & 0x03ff;
|
||||
#endif
|
||||
//uint32 dataOfs = ((move << 1) + 0x03b2) & 0x03ff;
|
||||
int16 Lo;
|
||||
int16 Hi;
|
||||
|
||||
@ -1232,7 +1249,7 @@ void DSP3_Command()
|
||||
|
||||
void DSP3SetByte(uint8 byte, uint16 address)
|
||||
{
|
||||
if ((address & 0xC000) == 0x8000)
|
||||
if (address < DSP1.boundary)
|
||||
{
|
||||
if (DSP3_SR & 0x04)
|
||||
{
|
||||
@ -1243,20 +1260,20 @@ void DSP3SetByte(uint8 byte, uint16 address)
|
||||
{
|
||||
DSP3_SR ^= 0x10;
|
||||
|
||||
if (DSP3_SR & 0x10)
|
||||
if (DSP3_SR & 0x10)
|
||||
DSP3_DR = (DSP3_DR & 0xff00) + byte;
|
||||
else
|
||||
{
|
||||
DSP3_DR = (DSP3_DR & 0x00ff) + (byte << 8);
|
||||
(*SetDSP3)();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
uint8 DSP3GetByte(uint16 address)
|
||||
{
|
||||
if ((address & 0xC000) == 0x8000)
|
||||
if (address < DSP1.boundary)
|
||||
{
|
||||
uint8 byte;
|
||||
|
||||
@ -1269,7 +1286,7 @@ uint8 DSP3GetByte(uint16 address)
|
||||
{
|
||||
DSP3_SR ^= 0x10;
|
||||
|
||||
if (DSP3_SR & 0x10)
|
||||
if (DSP3_SR & 0x10)
|
||||
byte = (uint8) (DSP3_DR);
|
||||
else
|
||||
{
|
||||
|
@ -1,7 +1,7 @@
|
||||
/**********************************************************************************
|
||||
Snes9x - Portable Super Nintendo Entertainment System (TM) emulator.
|
||||
|
||||
(c) Copyright 1996 - 2002 Gary Henderson (gary.henderson@ntlworld.com) and
|
||||
(c) Copyright 1996 - 2002 Gary Henderson (gary.henderson@ntlworld.com),
|
||||
Jerremy Koot (jkoot@snes9x.com)
|
||||
|
||||
(c) Copyright 2002 - 2004 Matthew Kendora
|
||||
@ -12,12 +12,16 @@
|
||||
|
||||
(c) Copyright 2001 - 2006 John Weidman (jweidman@slip.net)
|
||||
|
||||
(c) Copyright 2002 - 2006 Brad Jorsch (anomie@users.sourceforge.net),
|
||||
funkyass (funkyass@spam.shaw.ca),
|
||||
Kris Bleakley (codeviolation@hotmail.com),
|
||||
Nach (n-a-c-h@users.sourceforge.net), and
|
||||
(c) Copyright 2002 - 2006 funkyass (funkyass@spam.shaw.ca),
|
||||
Kris Bleakley (codeviolation@hotmail.com)
|
||||
|
||||
(c) Copyright 2002 - 2007 Brad Jorsch (anomie@users.sourceforge.net),
|
||||
Nach (n-a-c-h@users.sourceforge.net),
|
||||
zones (kasumitokoduck@yahoo.com)
|
||||
|
||||
(c) Copyright 2006 - 2007 nitsuja
|
||||
|
||||
|
||||
BS-X C emulator code
|
||||
(c) Copyright 2005 - 2006 Dreamer Nom,
|
||||
zones
|
||||
@ -110,17 +114,30 @@
|
||||
2xSaI filter
|
||||
(c) Copyright 1999 - 2001 Derek Liauw Kie Fa
|
||||
|
||||
HQ2x filter
|
||||
HQ2x, HQ3x, HQ4x filters
|
||||
(c) Copyright 2003 Maxim Stepin (maxim@hiend3d.com)
|
||||
|
||||
Win32 GUI code
|
||||
(c) Copyright 2003 - 2006 blip,
|
||||
funkyass,
|
||||
Matthew Kendora,
|
||||
Nach,
|
||||
nitsuja
|
||||
|
||||
Mac OS GUI code
|
||||
(c) Copyright 1998 - 2001 John Stiles
|
||||
(c) Copyright 2001 - 2007 zones
|
||||
|
||||
|
||||
Specific ports contains the works of other authors. See headers in
|
||||
individual files.
|
||||
|
||||
|
||||
Snes9x homepage: http://www.snes9x.com
|
||||
|
||||
Permission to use, copy, modify and/or distribute Snes9x in both binary
|
||||
and source form, for non-commercial purposes, is hereby granted without
|
||||
fee, providing that this license information and copyright notice appear
|
||||
and source form, for non-commercial purposes, is hereby granted without
|
||||
fee, providing that this license information and copyright notice appear
|
||||
with all copies and any derived work.
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
@ -142,6 +159,8 @@
|
||||
**********************************************************************************/
|
||||
|
||||
|
||||
|
||||
|
||||
#include "snes9x.h"
|
||||
#include "memmap.h"
|
||||
#include <string.h>
|
||||
|
@ -1,7 +1,7 @@
|
||||
/**********************************************************************************
|
||||
Snes9x - Portable Super Nintendo Entertainment System (TM) emulator.
|
||||
|
||||
(c) Copyright 1996 - 2002 Gary Henderson (gary.henderson@ntlworld.com) and
|
||||
(c) Copyright 1996 - 2002 Gary Henderson (gary.henderson@ntlworld.com),
|
||||
Jerremy Koot (jkoot@snes9x.com)
|
||||
|
||||
(c) Copyright 2002 - 2004 Matthew Kendora
|
||||
@ -12,12 +12,16 @@
|
||||
|
||||
(c) Copyright 2001 - 2006 John Weidman (jweidman@slip.net)
|
||||
|
||||
(c) Copyright 2002 - 2006 Brad Jorsch (anomie@users.sourceforge.net),
|
||||
funkyass (funkyass@spam.shaw.ca),
|
||||
Kris Bleakley (codeviolation@hotmail.com),
|
||||
Nach (n-a-c-h@users.sourceforge.net), and
|
||||
(c) Copyright 2002 - 2006 funkyass (funkyass@spam.shaw.ca),
|
||||
Kris Bleakley (codeviolation@hotmail.com)
|
||||
|
||||
(c) Copyright 2002 - 2007 Brad Jorsch (anomie@users.sourceforge.net),
|
||||
Nach (n-a-c-h@users.sourceforge.net),
|
||||
zones (kasumitokoduck@yahoo.com)
|
||||
|
||||
(c) Copyright 2006 - 2007 nitsuja
|
||||
|
||||
|
||||
BS-X C emulator code
|
||||
(c) Copyright 2005 - 2006 Dreamer Nom,
|
||||
zones
|
||||
@ -110,17 +114,30 @@
|
||||
2xSaI filter
|
||||
(c) Copyright 1999 - 2001 Derek Liauw Kie Fa
|
||||
|
||||
HQ2x filter
|
||||
HQ2x, HQ3x, HQ4x filters
|
||||
(c) Copyright 2003 Maxim Stepin (maxim@hiend3d.com)
|
||||
|
||||
Win32 GUI code
|
||||
(c) Copyright 2003 - 2006 blip,
|
||||
funkyass,
|
||||
Matthew Kendora,
|
||||
Nach,
|
||||
nitsuja
|
||||
|
||||
Mac OS GUI code
|
||||
(c) Copyright 1998 - 2001 John Stiles
|
||||
(c) Copyright 2001 - 2007 zones
|
||||
|
||||
|
||||
Specific ports contains the works of other authors. See headers in
|
||||
individual files.
|
||||
|
||||
|
||||
Snes9x homepage: http://www.snes9x.com
|
||||
|
||||
Permission to use, copy, modify and/or distribute Snes9x in both binary
|
||||
and source form, for non-commercial purposes, is hereby granted without
|
||||
fee, providing that this license information and copyright notice appear
|
||||
and source form, for non-commercial purposes, is hereby granted without
|
||||
fee, providing that this license information and copyright notice appear
|
||||
with all copies and any derived work.
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
@ -141,6 +158,8 @@
|
||||
Nintendo Co., Limited and its subsidiary companies.
|
||||
**********************************************************************************/
|
||||
|
||||
|
||||
|
||||
static char *font[] = {
|
||||
" . . . . .. . . ",
|
||||
" .#. .#.#. . . ... .#. . . .##. .#. .#. . . . . ",
|
||||
@ -227,7 +246,7 @@ static char *font[] = {
|
||||
" .#.#. .##. .#. .###. .#. .#. .#. .###. .#. .#. .####. .##. .##. ",
|
||||
" .#. .. .#. ... . . . ... . . .... .. .. ",
|
||||
" . . ",
|
||||
//2345678/2345678/2345678/2345678/2345678/2345678/2345678/2345678/2345678/2345678/2345678/2345678/2345678/2345678/2345678/2345678
|
||||
//2345678/2345678/2345678/2345678/2345678/2345678/2345678/2345678/2345678/2345678/2345678/2345678/2345678/2345678/2345678/2345678
|
||||
" .... . . ... . . . .... . . . .. . ..... . . . ",
|
||||
" .####. .#. ..#.. .###. ...#. ..#.. ..#.. .####. .#... .... .#.#. .##..#. .#####. .#... .#. .#. ",
|
||||
" .... ...#. .#. .#####. .#. .#####. .#####. .#####. .#..#. .####. .####. .#####. .. .#. ....#. .#####. .#. .#. ",
|
||||
@ -237,24 +256,24 @@ static char *font[] = {
|
||||
" .#. .#. .##. .#####. .#..#. .#..#. .#. .#. .#. .####. .#. .###. .#. .#. .###. .###. ",
|
||||
" . . .. ..... . . . . . . . .... . ... . . ... ... ",
|
||||
" ",
|
||||
//2345678/2345678/2345678/2345678/2345678/2345678/2345678/2345678/2345678/2345678/2345678/2345678/2345678/2345678/2345678/2345678
|
||||
//2345678/2345678/2345678/2345678/2345678/2345678/2345678/2345678/2345678/2345678/2345678/2345678/2345678/2345678/2345678/2345678
|
||||
" .... .. . . . ... . . ... .... . . . ..... . . ",
|
||||
" .####. ..##. .#.#.#. .###. .#. ..#.. .###. .####. ..#.. .#. . . .#. .. .#####. .#. ..#.. ..... ",
|
||||
" .#..#. .###. .#.#.#. ..... .#. .#####. ... ...#. .#####. .#. .#.#. .#..##. ....#. .#.#. .#####. .#####. ",
|
||||
" .####. ..#. .#.#.#. .#####. .##. ..#.. .#.#. ....#. .#. .#.#. .###.. .#. .#..#. ..#.. .#. ",
|
||||
" .####. ..#. .#.#.#. .#####. .##. ..#.. .#.#. ....#. .#. .#.#. .###.. .#. .#..#. ..#.. .#. ",
|
||||
".#...#. .####. . ..#. ..#.. .#.#. .#. .#. .###. .#. .#. .#. .#.. .#. . .#. .#.#.#. .#.#. ",
|
||||
" . .#. ..#. ...#. .#. .#.. ..#. ..... .#.#. .#.#.#. .#. .#. .#. .#.... ..#. .#. .#.#.#. .#. ",
|
||||
" .#. .##. .###. .#. .#. .##. .#####. .#. .#. ..#.. .#. .#. .#. .####. .##. .#. ..#.. .#. ",
|
||||
" . .. ... . . .. ..... . . . . . . .... .. . . . ",
|
||||
" ",
|
||||
//2345678/2345678/2345678/2345678/2345678/2345678/2345678/2345678/2345678/2345678/2345678/2345678/2345678/2345678/2345678/2345678
|
||||
//2345678/2345678/2345678/2345678/2345678/2345678/2345678/2345678/2345678/2345678/2345678/2345678/2345678/2345678/2345678/2345678
|
||||
" .. . . ... . .... .... . . . . . ..... . . . . ",
|
||||
" .##. .#. .#. .###. .#... ... .####. .####. .#..#. .#.#. .#. ..... .#####. ....#. .#.#. .#. ",
|
||||
" ..#. .#. . .#. .#. .#.##. .###. ...#. ..... .#..#. .#.#. .#. .#####. .#...#. .###.#. .#.#. .#.#. ",
|
||||
" .##. .#. . .#.#. .#####. .##.#. .#. .###. .#####. .#..#. .#.#. .#. . .#...#. . .#. ....#. . . .#. ",
|
||||
" .##. .#. . .#.#. .#####. .##.#. .#. .###. .#####. .#..#. .#.#. .#. . .#...#. . .#. ....#. . . .#. ",
|
||||
" ..#. .#..#. .##. ..#.. .#.#. ..#. ..#. ....#. . .#. .#.#. .#..#. .#...#. .#. .#. . ",
|
||||
" .##. .####. ..#.#. .#.. .#. ...#. ...#. ..#. ..#. .#.#. .#.#. .#####. ..#. ...#. ",
|
||||
" ..#. ...#. .##. . .###. .#. .#####. .####. .##. .##. .#..##. .##. .#...#. .##. .###. ",
|
||||
" ..#. ...#. .##. . .###. .#. .#####. .####. .##. .##. .#..##. .##. .#...#. .##. .###. ",
|
||||
" . . .. ... . ..... .... .. ... . .. .. . . .. ... ",
|
||||
" ",
|
||||
|
||||
@ -279,6 +298,3 @@ static char *font[] = {
|
||||
" "
|
||||
};
|
||||
|
||||
static int font_width = 8;
|
||||
static int font_height = 9;
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
/**********************************************************************************
|
||||
Snes9x - Portable Super Nintendo Entertainment System (TM) emulator.
|
||||
|
||||
(c) Copyright 1996 - 2002 Gary Henderson (gary.henderson@ntlworld.com) and
|
||||
(c) Copyright 1996 - 2002 Gary Henderson (gary.henderson@ntlworld.com),
|
||||
Jerremy Koot (jkoot@snes9x.com)
|
||||
|
||||
(c) Copyright 2002 - 2004 Matthew Kendora
|
||||
@ -12,12 +12,16 @@
|
||||
|
||||
(c) Copyright 2001 - 2006 John Weidman (jweidman@slip.net)
|
||||
|
||||
(c) Copyright 2002 - 2006 Brad Jorsch (anomie@users.sourceforge.net),
|
||||
funkyass (funkyass@spam.shaw.ca),
|
||||
Kris Bleakley (codeviolation@hotmail.com),
|
||||
Nach (n-a-c-h@users.sourceforge.net), and
|
||||
(c) Copyright 2002 - 2006 funkyass (funkyass@spam.shaw.ca),
|
||||
Kris Bleakley (codeviolation@hotmail.com)
|
||||
|
||||
(c) Copyright 2002 - 2007 Brad Jorsch (anomie@users.sourceforge.net),
|
||||
Nach (n-a-c-h@users.sourceforge.net),
|
||||
zones (kasumitokoduck@yahoo.com)
|
||||
|
||||
(c) Copyright 2006 - 2007 nitsuja
|
||||
|
||||
|
||||
BS-X C emulator code
|
||||
(c) Copyright 2005 - 2006 Dreamer Nom,
|
||||
zones
|
||||
@ -110,17 +114,30 @@
|
||||
2xSaI filter
|
||||
(c) Copyright 1999 - 2001 Derek Liauw Kie Fa
|
||||
|
||||
HQ2x filter
|
||||
HQ2x, HQ3x, HQ4x filters
|
||||
(c) Copyright 2003 Maxim Stepin (maxim@hiend3d.com)
|
||||
|
||||
Win32 GUI code
|
||||
(c) Copyright 2003 - 2006 blip,
|
||||
funkyass,
|
||||
Matthew Kendora,
|
||||
Nach,
|
||||
nitsuja
|
||||
|
||||
Mac OS GUI code
|
||||
(c) Copyright 1998 - 2001 John Stiles
|
||||
(c) Copyright 2001 - 2007 zones
|
||||
|
||||
|
||||
Specific ports contains the works of other authors. See headers in
|
||||
individual files.
|
||||
|
||||
|
||||
Snes9x homepage: http://www.snes9x.com
|
||||
|
||||
Permission to use, copy, modify and/or distribute Snes9x in both binary
|
||||
and source form, for non-commercial purposes, is hereby granted without
|
||||
fee, providing that this license information and copyright notice appear
|
||||
and source form, for non-commercial purposes, is hereby granted without
|
||||
fee, providing that this license information and copyright notice appear
|
||||
with all copies and any derived work.
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
@ -142,6 +159,8 @@
|
||||
**********************************************************************************/
|
||||
|
||||
|
||||
|
||||
|
||||
#include "fxemu.h"
|
||||
#include "fxinst.h"
|
||||
#include <stdio.h>
|
||||
@ -173,7 +192,7 @@ extern struct FxRegs_s GSU;
|
||||
in this debug function. (See the diffrence of how the values
|
||||
vPipe1 and vPipe2 are read, compared to the values vByte1 and
|
||||
vByte2)
|
||||
|
||||
|
||||
*/
|
||||
void FxPipeString(char * pvString)
|
||||
{
|
||||
@ -182,11 +201,11 @@ void FxPipeString(char * pvString)
|
||||
const char *m = fx_apvMnemonicTable[vOpcode];
|
||||
uint8 vPipe1,vPipe2,vByte1,vByte2;
|
||||
uint8 vPipeBank = GSU.vPipeAdr >> 16;
|
||||
|
||||
|
||||
/* The next two bytes after the pipe's address */
|
||||
vPipe1 = GSU.apvRomBank[vPipeBank][USEX16(GSU.vPipeAdr+1)];
|
||||
vPipe2 = GSU.apvRomBank[vPipeBank][USEX16(GSU.vPipeAdr+2)];
|
||||
|
||||
|
||||
/* The actual next two bytes to be read */
|
||||
vByte1 = PRGBANK(USEX16(R15));
|
||||
vByte2 = PRGBANK(USEX16(R15+1));
|
||||
@ -195,7 +214,7 @@ void FxPipeString(char * pvString)
|
||||
sprintf(pvString, "%02x:%04x %02x ",
|
||||
USEX8(vPipeBank), USEX16(GSU.vPipeAdr), USEX8(PIPE));
|
||||
p = &pvString[strlen(pvString)];
|
||||
|
||||
|
||||
/* Check if it's a branch instruction */
|
||||
if( PIPE >= 0x05 && PIPE <= 0x0f )
|
||||
{
|
||||
@ -244,7 +263,7 @@ const char *fx_apvMnemonicTable[] =
|
||||
"to r0", "to r1", "to r2", "to r3", "to r4", "to r5", "to r6", "to r7",
|
||||
"to r8", "to r9", "to r10", "to r11", "to r12", "to r13", "to r14", "to r15",
|
||||
/* 20 - 2f */
|
||||
"with r0", "with r1", "with r2", "with r3", "with r4", "with r5", "with r6", "with r7",
|
||||
"with r0", "with r1", "with r2", "with r3", "with r4", "with r5", "with r6", "with r7",
|
||||
"with r8", "with r9", "with r10", "with r11", "with r12", "with r13", "with r14", "with r15",
|
||||
/* 30 - 3f */
|
||||
"stw (r0)","stw (r1)","stw (r2)", "stw (r3)", "stw (r4)", "stw (r5)", "stw (r6)", "stw (r7)",
|
||||
@ -301,7 +320,7 @@ const char *fx_apvMnemonicTable[] =
|
||||
"to r0", "to r1", "to r2", "to r3", "to r4", "to r5", "to r6", "to r7",
|
||||
"to r8", "to r9", "to r10", "to r11", "to r12", "to r13", "to r14", "to r15",
|
||||
/* 20 - 2f */
|
||||
"with r0", "with r1", "with r2", "with r3", "with r4", "with r5", "with r6", "with r7",
|
||||
"with r0", "with r1", "with r2", "with r3", "with r4", "with r5", "with r6", "with r7",
|
||||
"with r8", "with r9", "with r10", "with r11", "with r12", "with r13", "with r14", "with r15",
|
||||
/* 30 - 3f */
|
||||
"stb (r0)","stb (r1)","stb (r2)", "stb (r3)", "stb (r4)", "stb (r5)", "stb (r6)", "stb (r7)",
|
||||
@ -358,7 +377,7 @@ const char *fx_apvMnemonicTable[] =
|
||||
"to r0", "to r1", "to r2", "to r3", "to r4", "to r5", "to r6", "to r7",
|
||||
"to r8", "to r9", "to r10", "to r11", "to r12", "to r13", "to r14", "to r15",
|
||||
/* 20 - 2f */
|
||||
"with r0", "with r1", "with r2", "with r3", "with r4", "with r5", "with r6", "with r7",
|
||||
"with r0", "with r1", "with r2", "with r3", "with r4", "with r5", "with r6", "with r7",
|
||||
"with r8", "with r9", "with r10", "with r11", "with r12", "with r13", "with r14", "with r15",
|
||||
/* 30 - 3f */
|
||||
"stw (r0)","stw (r1)","stw (r2)", "stw (r3)", "stw (r4)", "stw (r5)", "stw (r6)", "stw (r7)",
|
||||
@ -415,7 +434,7 @@ const char *fx_apvMnemonicTable[] =
|
||||
"to r0", "to r1", "to r2", "to r3", "to r4", "to r5", "to r6", "to r7",
|
||||
"to r8", "to r9", "to r10", "to r11", "to r12", "to r13", "to r14", "to r15",
|
||||
/* 20 - 2f */
|
||||
"with r0", "with r1", "with r2", "with r3", "with r4", "with r5", "with r6", "with r7",
|
||||
"with r0", "with r1", "with r2", "with r3", "with r4", "with r5", "with r6", "with r7",
|
||||
"with r8", "with r9", "with r10", "with r11", "with r12", "with r13", "with r14", "with r15",
|
||||
/* 30 - 3f */
|
||||
"stb (r0)","stb (r1)","stb (r2)", "stb (r3)", "stb (r4)", "stb (r5)", "stb (r6)", "stb (r7)",
|
||||
|
@ -1,7 +1,7 @@
|
||||
/**********************************************************************************
|
||||
Snes9x - Portable Super Nintendo Entertainment System (TM) emulator.
|
||||
|
||||
(c) Copyright 1996 - 2002 Gary Henderson (gary.henderson@ntlworld.com) and
|
||||
(c) Copyright 1996 - 2002 Gary Henderson (gary.henderson@ntlworld.com),
|
||||
Jerremy Koot (jkoot@snes9x.com)
|
||||
|
||||
(c) Copyright 2002 - 2004 Matthew Kendora
|
||||
@ -12,12 +12,16 @@
|
||||
|
||||
(c) Copyright 2001 - 2006 John Weidman (jweidman@slip.net)
|
||||
|
||||
(c) Copyright 2002 - 2006 Brad Jorsch (anomie@users.sourceforge.net),
|
||||
funkyass (funkyass@spam.shaw.ca),
|
||||
Kris Bleakley (codeviolation@hotmail.com),
|
||||
Nach (n-a-c-h@users.sourceforge.net), and
|
||||
(c) Copyright 2002 - 2006 funkyass (funkyass@spam.shaw.ca),
|
||||
Kris Bleakley (codeviolation@hotmail.com)
|
||||
|
||||
(c) Copyright 2002 - 2007 Brad Jorsch (anomie@users.sourceforge.net),
|
||||
Nach (n-a-c-h@users.sourceforge.net),
|
||||
zones (kasumitokoduck@yahoo.com)
|
||||
|
||||
(c) Copyright 2006 - 2007 nitsuja
|
||||
|
||||
|
||||
BS-X C emulator code
|
||||
(c) Copyright 2005 - 2006 Dreamer Nom,
|
||||
zones
|
||||
@ -110,17 +114,30 @@
|
||||
2xSaI filter
|
||||
(c) Copyright 1999 - 2001 Derek Liauw Kie Fa
|
||||
|
||||
HQ2x filter
|
||||
HQ2x, HQ3x, HQ4x filters
|
||||
(c) Copyright 2003 Maxim Stepin (maxim@hiend3d.com)
|
||||
|
||||
Win32 GUI code
|
||||
(c) Copyright 2003 - 2006 blip,
|
||||
funkyass,
|
||||
Matthew Kendora,
|
||||
Nach,
|
||||
nitsuja
|
||||
|
||||
Mac OS GUI code
|
||||
(c) Copyright 1998 - 2001 John Stiles
|
||||
(c) Copyright 2001 - 2007 zones
|
||||
|
||||
|
||||
Specific ports contains the works of other authors. See headers in
|
||||
individual files.
|
||||
|
||||
|
||||
Snes9x homepage: http://www.snes9x.com
|
||||
|
||||
Permission to use, copy, modify and/or distribute Snes9x in both binary
|
||||
and source form, for non-commercial purposes, is hereby granted without
|
||||
fee, providing that this license information and copyright notice appear
|
||||
and source form, for non-commercial purposes, is hereby granted without
|
||||
fee, providing that this license information and copyright notice appear
|
||||
with all copies and any derived work.
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
@ -141,6 +158,8 @@
|
||||
Nintendo Co., Limited and its subsidiary companies.
|
||||
**********************************************************************************/
|
||||
|
||||
|
||||
|
||||
#include "fxemu.h"
|
||||
#include "fxinst.h"
|
||||
#include <stdlib.h>
|
||||
@ -234,7 +253,7 @@ static void fx_backupCache()
|
||||
memcpy(t1,&GSU.pvCache[i<<4],a);
|
||||
memcpy(&GSU.avCacheBackup[(i<<4)+a],t2,16-a);
|
||||
memcpy(t2,&GSU.pvCache[(i<<4)+a],16-a);
|
||||
}
|
||||
}
|
||||
}
|
||||
c = USEX16(c+16);
|
||||
v >>= 1;
|
||||
@ -270,7 +289,7 @@ static void fx_restoreCache()
|
||||
memcpy(&GSU.pvCache[i<<4],t1,a);
|
||||
memcpy(t2,&GSU.avCacheBackup[(i<<4)+a],16-a);
|
||||
memcpy(&GSU.pvCache[(i<<4)+a],t2,16-a);
|
||||
}
|
||||
}
|
||||
}
|
||||
c = USEX16(c+16);
|
||||
v >>= 1;
|
||||
@ -326,7 +345,7 @@ static void fx_readRegisterSpace()
|
||||
GSU.vSign = (GSU.vStatusReg & FLG_S) << 12;
|
||||
GSU.vOverflow = (GSU.vStatusReg & FLG_OV) << 16;
|
||||
GSU.vCarry = (GSU.vStatusReg & FLG_CY) >> 2;
|
||||
|
||||
|
||||
/* Set bank pointers */
|
||||
GSU.pvRamBank = GSU.apvRamBank[GSU.vRamBankReg & 0x3];
|
||||
GSU.pvRomBank = GSU.apvRomBank[GSU.vRomBankReg];
|
||||
@ -378,7 +397,7 @@ void fx_dirtySCBR()
|
||||
|
||||
void fx_computeScreenPointers ()
|
||||
{
|
||||
if (GSU.vMode != GSU.vPrevMode ||
|
||||
if (GSU.vMode != GSU.vPrevMode ||
|
||||
GSU.vPrevScreenHeight != GSU.vScreenHeight ||
|
||||
GSU.vSCBRDirty)
|
||||
{
|
||||
@ -476,7 +495,7 @@ void fx_computeScreenPointers ()
|
||||
case 0:
|
||||
for (i = 0; i < 32; i++)
|
||||
{
|
||||
GSU.apvScreen[i] = GSU.pvScreenBase +
|
||||
GSU.apvScreen[i] = GSU.pvScreenBase +
|
||||
((i & 0x10) << 9) + ((i & 0xf) << 8);
|
||||
GSU.x[i] = ((i & 0x10) << 8) + ((i & 0xf) << 4);
|
||||
}
|
||||
@ -484,7 +503,7 @@ void fx_computeScreenPointers ()
|
||||
case 1:
|
||||
for (i = 0; i < 32; i++)
|
||||
{
|
||||
GSU.apvScreen[i] = GSU.pvScreenBase +
|
||||
GSU.apvScreen[i] = GSU.pvScreenBase +
|
||||
((i & 0x10) << 10) + ((i & 0xf) << 9);
|
||||
GSU.x[i] = ((i & 0x10) << 9) + ((i & 0xf) << 5);
|
||||
}
|
||||
@ -493,7 +512,7 @@ void fx_computeScreenPointers ()
|
||||
case 3:
|
||||
for (i = 0; i < 32; i++)
|
||||
{
|
||||
GSU.apvScreen[i] = GSU.pvScreenBase +
|
||||
GSU.apvScreen[i] = GSU.pvScreenBase +
|
||||
((i & 0x10) << 11) + ((i & 0xf) << 10);
|
||||
GSU.x[i] = ((i & 0x10) << 10) + ((i & 0xf) << 6);
|
||||
}
|
||||
@ -510,7 +529,7 @@ static void fx_writeRegisterSpace()
|
||||
{
|
||||
int i;
|
||||
uint8 *p;
|
||||
|
||||
|
||||
p = GSU.pvRegisters;
|
||||
for(i=0; i<16; i++)
|
||||
{
|
||||
@ -527,7 +546,7 @@ static void fx_writeRegisterSpace()
|
||||
else CF(OV);
|
||||
if(GSU.vCarry) SF(CY);
|
||||
else CF(CY);
|
||||
|
||||
|
||||
p = GSU.pvRegisters;
|
||||
p[GSU_SFR] = (uint8)GSU.vStatusReg;
|
||||
p[GSU_SFR+1] = (uint8)(GSU.vStatusReg>>8);
|
||||
@ -536,7 +555,7 @@ static void fx_writeRegisterSpace()
|
||||
p[GSU_RAMBR] = (uint8)GSU.vRamBankReg;
|
||||
p[GSU_CBR] = (uint8)GSU.vCacheBaseReg;
|
||||
p[GSU_CBR+1] = (uint8)(GSU.vCacheBaseReg>>8);
|
||||
|
||||
|
||||
fx_restoreCache();
|
||||
}
|
||||
|
||||
@ -550,7 +569,7 @@ void FxReset(struct FxInit_s *psFxInfo)
|
||||
&fx_a_apfFunctionTable[0],
|
||||
&fx_r_apfFunctionTable[0],
|
||||
&fx_ar_apfFunctionTable[0],
|
||||
#endif
|
||||
#endif
|
||||
};
|
||||
static void (**appfPlot[])() = {
|
||||
&fx_apfPlotTable[0],
|
||||
@ -558,22 +577,22 @@ void FxReset(struct FxInit_s *psFxInfo)
|
||||
&fx_a_apfPlotTable[0],
|
||||
&fx_r_apfPlotTable[0],
|
||||
&fx_ar_apfPlotTable[0],
|
||||
#endif
|
||||
#endif
|
||||
};
|
||||
static void (**appfOpcode[])() = {
|
||||
&fx_apfOpcodeTable[0],
|
||||
#if 0
|
||||
#if 0
|
||||
&fx_a_apfOpcodeTable[0],
|
||||
&fx_r_apfOpcodeTable[0],
|
||||
&fx_ar_apfOpcodeTable[0],
|
||||
#endif
|
||||
#endif
|
||||
};
|
||||
|
||||
/* Get function pointers for the current emulation mode */
|
||||
fx_ppfFunctionTable = appfFunction[psFxInfo->vFlags & 0x3];
|
||||
fx_ppfPlotTable = appfPlot[psFxInfo->vFlags & 0x3];
|
||||
fx_ppfOpcodeTable = appfOpcode[psFxInfo->vFlags & 0x3];
|
||||
|
||||
|
||||
/* Clear all internal variables */
|
||||
memset((uint8*)&GSU,0,sizeof(struct FxRegs_s));
|
||||
|
||||
@ -592,7 +611,7 @@ void FxReset(struct FxInit_s *psFxInfo)
|
||||
/* The GSU can't access more than 2mb (16mbits) */
|
||||
if(GSU.nRomBanks > 0x20)
|
||||
GSU.nRomBanks = 0x20;
|
||||
|
||||
|
||||
/* Clear FxChip register space */
|
||||
memset(GSU.pvRegisters,0,0x300);
|
||||
|
||||
@ -625,7 +644,7 @@ void FxReset(struct FxInit_s *psFxInfo)
|
||||
GSU.apvRamBank[i] = &GSU.pvRam[(i % GSU.nRamBanks) << 16];
|
||||
GSU.apvRomBank[0x70 + i] = GSU.apvRamBank[i];
|
||||
}
|
||||
|
||||
|
||||
/* Start with a nop in the pipe */
|
||||
GSU.vPipe = 0x01;
|
||||
|
||||
@ -640,7 +659,7 @@ static uint8 fx_checkStartAddress()
|
||||
/* Check if we start inside the cache */
|
||||
if(GSU.bCacheActive && R15 >= GSU.vCacheBaseReg && R15 < (GSU.vCacheBaseReg+512))
|
||||
return TRUE;
|
||||
|
||||
|
||||
/* Check if we're in an unused area */
|
||||
#if 0
|
||||
if(GSU.vPrgBankReg < 0x40 && R15 < 0x8000)
|
||||
@ -658,7 +677,7 @@ static uint8 fx_checkStartAddress()
|
||||
/* If not, we're in ROM, so check if the RON flag is set */
|
||||
if(!(SCMR&(1<<4)))
|
||||
return FALSE;
|
||||
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
@ -729,7 +748,7 @@ int FxStepOver(uint32 nInstructions)
|
||||
return 0;
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
if( PIPE >= 0xf0 )
|
||||
GSU.vStepPoint = USEX16(R15+3);
|
||||
else if( (PIPE >= 0x05 && PIPE <= 0x0f) || (PIPE >= 0xa0 && PIPE <= 0xaf) )
|
||||
|
@ -1,7 +1,7 @@
|
||||
/**********************************************************************************
|
||||
Snes9x - Portable Super Nintendo Entertainment System (TM) emulator.
|
||||
|
||||
(c) Copyright 1996 - 2002 Gary Henderson (gary.henderson@ntlworld.com) and
|
||||
(c) Copyright 1996 - 2002 Gary Henderson (gary.henderson@ntlworld.com),
|
||||
Jerremy Koot (jkoot@snes9x.com)
|
||||
|
||||
(c) Copyright 2002 - 2004 Matthew Kendora
|
||||
@ -12,12 +12,16 @@
|
||||
|
||||
(c) Copyright 2001 - 2006 John Weidman (jweidman@slip.net)
|
||||
|
||||
(c) Copyright 2002 - 2006 Brad Jorsch (anomie@users.sourceforge.net),
|
||||
funkyass (funkyass@spam.shaw.ca),
|
||||
Kris Bleakley (codeviolation@hotmail.com),
|
||||
Nach (n-a-c-h@users.sourceforge.net), and
|
||||
(c) Copyright 2002 - 2006 funkyass (funkyass@spam.shaw.ca),
|
||||
Kris Bleakley (codeviolation@hotmail.com)
|
||||
|
||||
(c) Copyright 2002 - 2007 Brad Jorsch (anomie@users.sourceforge.net),
|
||||
Nach (n-a-c-h@users.sourceforge.net),
|
||||
zones (kasumitokoduck@yahoo.com)
|
||||
|
||||
(c) Copyright 2006 - 2007 nitsuja
|
||||
|
||||
|
||||
BS-X C emulator code
|
||||
(c) Copyright 2005 - 2006 Dreamer Nom,
|
||||
zones
|
||||
@ -110,17 +114,30 @@
|
||||
2xSaI filter
|
||||
(c) Copyright 1999 - 2001 Derek Liauw Kie Fa
|
||||
|
||||
HQ2x filter
|
||||
HQ2x, HQ3x, HQ4x filters
|
||||
(c) Copyright 2003 Maxim Stepin (maxim@hiend3d.com)
|
||||
|
||||
Win32 GUI code
|
||||
(c) Copyright 2003 - 2006 blip,
|
||||
funkyass,
|
||||
Matthew Kendora,
|
||||
Nach,
|
||||
nitsuja
|
||||
|
||||
Mac OS GUI code
|
||||
(c) Copyright 1998 - 2001 John Stiles
|
||||
(c) Copyright 2001 - 2007 zones
|
||||
|
||||
|
||||
Specific ports contains the works of other authors. See headers in
|
||||
individual files.
|
||||
|
||||
|
||||
Snes9x homepage: http://www.snes9x.com
|
||||
|
||||
Permission to use, copy, modify and/or distribute Snes9x in both binary
|
||||
and source form, for non-commercial purposes, is hereby granted without
|
||||
fee, providing that this license information and copyright notice appear
|
||||
and source form, for non-commercial purposes, is hereby granted without
|
||||
fee, providing that this license information and copyright notice appear
|
||||
with all copies and any derived work.
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
@ -141,6 +158,8 @@
|
||||
Nintendo Co., Limited and its subsidiary companies.
|
||||
**********************************************************************************/
|
||||
|
||||
|
||||
|
||||
#ifndef _FXEMU_H_
|
||||
#define _FXEMU_H_ 1
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
/**********************************************************************************
|
||||
Snes9x - Portable Super Nintendo Entertainment System (TM) emulator.
|
||||
|
||||
(c) Copyright 1996 - 2002 Gary Henderson (gary.henderson@ntlworld.com) and
|
||||
(c) Copyright 1996 - 2002 Gary Henderson (gary.henderson@ntlworld.com),
|
||||
Jerremy Koot (jkoot@snes9x.com)
|
||||
|
||||
(c) Copyright 2002 - 2004 Matthew Kendora
|
||||
@ -12,12 +12,16 @@
|
||||
|
||||
(c) Copyright 2001 - 2006 John Weidman (jweidman@slip.net)
|
||||
|
||||
(c) Copyright 2002 - 2006 Brad Jorsch (anomie@users.sourceforge.net),
|
||||
funkyass (funkyass@spam.shaw.ca),
|
||||
Kris Bleakley (codeviolation@hotmail.com),
|
||||
Nach (n-a-c-h@users.sourceforge.net), and
|
||||
(c) Copyright 2002 - 2006 funkyass (funkyass@spam.shaw.ca),
|
||||
Kris Bleakley (codeviolation@hotmail.com)
|
||||
|
||||
(c) Copyright 2002 - 2007 Brad Jorsch (anomie@users.sourceforge.net),
|
||||
Nach (n-a-c-h@users.sourceforge.net),
|
||||
zones (kasumitokoduck@yahoo.com)
|
||||
|
||||
(c) Copyright 2006 - 2007 nitsuja
|
||||
|
||||
|
||||
BS-X C emulator code
|
||||
(c) Copyright 2005 - 2006 Dreamer Nom,
|
||||
zones
|
||||
@ -110,17 +114,30 @@
|
||||
2xSaI filter
|
||||
(c) Copyright 1999 - 2001 Derek Liauw Kie Fa
|
||||
|
||||
HQ2x filter
|
||||
HQ2x, HQ3x, HQ4x filters
|
||||
(c) Copyright 2003 Maxim Stepin (maxim@hiend3d.com)
|
||||
|
||||
Win32 GUI code
|
||||
(c) Copyright 2003 - 2006 blip,
|
||||
funkyass,
|
||||
Matthew Kendora,
|
||||
Nach,
|
||||
nitsuja
|
||||
|
||||
Mac OS GUI code
|
||||
(c) Copyright 1998 - 2001 John Stiles
|
||||
(c) Copyright 2001 - 2007 zones
|
||||
|
||||
|
||||
Specific ports contains the works of other authors. See headers in
|
||||
individual files.
|
||||
|
||||
|
||||
Snes9x homepage: http://www.snes9x.com
|
||||
|
||||
Permission to use, copy, modify and/or distribute Snes9x in both binary
|
||||
and source form, for non-commercial purposes, is hereby granted without
|
||||
fee, providing that this license information and copyright notice appear
|
||||
and source form, for non-commercial purposes, is hereby granted without
|
||||
fee, providing that this license information and copyright notice appear
|
||||
with all copies and any derived work.
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
@ -141,6 +158,8 @@
|
||||
Nintendo Co., Limited and its subsidiary companies.
|
||||
**********************************************************************************/
|
||||
|
||||
|
||||
|
||||
#define FX_DO_ROMBUFFER
|
||||
|
||||
#include "fxemu.h"
|
||||
@ -213,7 +232,7 @@ static void fx_cache()
|
||||
memcpy(GSU.pvCache,t1,i);
|
||||
memcpy(&GSU.pvCache[i],t2,512-i);
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
R15++;
|
||||
CLRFLAGS;
|
||||
@ -389,7 +408,7 @@ static void fx_alt2() { SF(ALT2); CF(B); R15++; }
|
||||
|
||||
/* 3f - alt3 - set alt3 mode */
|
||||
static void fx_alt3() { SF(ALT1); SF(ALT2); CF(B); R15++; }
|
||||
|
||||
|
||||
/* 40-4b - ldw (rn) - load word from RAM */
|
||||
#define FX_LDW(reg) uint32 v; \
|
||||
GSU.vLastRamAdr = GSU.avReg[reg]; \
|
||||
@ -450,7 +469,7 @@ static void fx_plot_2bit()
|
||||
c = (x^y)&1 ? (uint8)(GSU.vColorReg>>4) : (uint8)GSU.vColorReg;
|
||||
else
|
||||
c = (uint8)GSU.vColorReg;
|
||||
|
||||
|
||||
if( !(GSU.vPlotOptionReg & 0x01) && !(c & 0xf)) return;
|
||||
a = GSU.apvScreen[y >> 3] + GSU.x[x >> 3] + ((y & 7) << 1);
|
||||
v = 128 >> (x&7);
|
||||
@ -495,7 +514,7 @@ static void fx_plot_4bit()
|
||||
R15++;
|
||||
CLRFLAGS;
|
||||
R1++;
|
||||
|
||||
|
||||
#ifdef CHECK_LIMITS
|
||||
if(y >= GSU.vScreenHeight) return;
|
||||
#endif
|
||||
@ -556,7 +575,7 @@ static void fx_plot_8bit()
|
||||
R15++;
|
||||
CLRFLAGS;
|
||||
R1++;
|
||||
|
||||
|
||||
#ifdef CHECK_LIMITS
|
||||
if(y >= GSU.vScreenHeight) return;
|
||||
#endif
|
||||
@ -1063,7 +1082,7 @@ static void fx_umult_r12() { FX_UMULT(12); }
|
||||
static void fx_umult_r13() { FX_UMULT(13); }
|
||||
static void fx_umult_r14() { FX_UMULT(14); }
|
||||
static void fx_umult_r15() { FX_UMULT(15); }
|
||||
|
||||
|
||||
/* 80-8f(ALT2) - mult #n - 8 bit to 16 bit signed multiply, register * immediate */
|
||||
#define FX_MULT_I(imm) \
|
||||
uint32 v = (uint32) (SEX8(SREG) * ((int32)imm)); \
|
||||
@ -1088,7 +1107,7 @@ static void fx_mult_i12() { FX_MULT_I(12); }
|
||||
static void fx_mult_i13() { FX_MULT_I(13); }
|
||||
static void fx_mult_i14() { FX_MULT_I(14); }
|
||||
static void fx_mult_i15() { FX_MULT_I(15); }
|
||||
|
||||
|
||||
/* 80-8f(ALT3) - umult #n - 8 bit to 16 bit unsigned multiply, register * immediate */
|
||||
#define FX_UMULT_I(imm) \
|
||||
uint32 v = USEX8(SREG) * ((uint32)imm); \
|
||||
@ -1113,7 +1132,7 @@ static void fx_umult_i12() { FX_UMULT_I(12); }
|
||||
static void fx_umult_i13() { FX_UMULT_I(13); }
|
||||
static void fx_umult_i14() { FX_UMULT_I(14); }
|
||||
static void fx_umult_i15() { FX_UMULT_I(15); }
|
||||
|
||||
|
||||
/* 90 - sbk - store word to last accessed RAM address */
|
||||
static void fx_sbk()
|
||||
{
|
||||
@ -1767,7 +1786,7 @@ void (*fx_apfOpcodeTable[])() =
|
||||
&fx_to_r0, &fx_to_r1, &fx_to_r2, &fx_to_r3, &fx_to_r4, &fx_to_r5, &fx_to_r6, &fx_to_r7,
|
||||
&fx_to_r8, &fx_to_r9, &fx_to_r10, &fx_to_r11, &fx_to_r12, &fx_to_r13, &fx_to_r14, &fx_to_r15,
|
||||
/* 20 - 2f */
|
||||
&fx_with_r0, &fx_with_r1, &fx_with_r2, &fx_with_r3, &fx_with_r4, &fx_with_r5, &fx_with_r6, &fx_with_r7,
|
||||
&fx_with_r0, &fx_with_r1, &fx_with_r2, &fx_with_r3, &fx_with_r4, &fx_with_r5, &fx_with_r6, &fx_with_r7,
|
||||
&fx_with_r8, &fx_with_r9, &fx_with_r10, &fx_with_r11, &fx_with_r12, &fx_with_r13, &fx_with_r14, &fx_with_r15,
|
||||
/* 30 - 3f */
|
||||
&fx_stw_r0, &fx_stw_r1, &fx_stw_r2, &fx_stw_r3, &fx_stw_r4, &fx_stw_r5, &fx_stw_r6, &fx_stw_r7,
|
||||
@ -1820,7 +1839,7 @@ void (*fx_apfOpcodeTable[])() =
|
||||
&fx_to_r0, &fx_to_r1, &fx_to_r2, &fx_to_r3, &fx_to_r4, &fx_to_r5, &fx_to_r6, &fx_to_r7,
|
||||
&fx_to_r8, &fx_to_r9, &fx_to_r10, &fx_to_r11, &fx_to_r12, &fx_to_r13, &fx_to_r14, &fx_to_r15,
|
||||
/* 20 - 2f */
|
||||
&fx_with_r0, &fx_with_r1, &fx_with_r2, &fx_with_r3, &fx_with_r4, &fx_with_r5, &fx_with_r6, &fx_with_r7,
|
||||
&fx_with_r0, &fx_with_r1, &fx_with_r2, &fx_with_r3, &fx_with_r4, &fx_with_r5, &fx_with_r6, &fx_with_r7,
|
||||
&fx_with_r8, &fx_with_r9, &fx_with_r10, &fx_with_r11, &fx_with_r12, &fx_with_r13, &fx_with_r14, &fx_with_r15,
|
||||
/* 30 - 3f */
|
||||
&fx_stb_r0, &fx_stb_r1, &fx_stb_r2, &fx_stb_r3, &fx_stb_r4, &fx_stb_r5, &fx_stb_r6, &fx_stb_r7,
|
||||
@ -1873,7 +1892,7 @@ void (*fx_apfOpcodeTable[])() =
|
||||
&fx_to_r0, &fx_to_r1, &fx_to_r2, &fx_to_r3, &fx_to_r4, &fx_to_r5, &fx_to_r6, &fx_to_r7,
|
||||
&fx_to_r8, &fx_to_r9, &fx_to_r10, &fx_to_r11, &fx_to_r12, &fx_to_r13, &fx_to_r14, &fx_to_r15,
|
||||
/* 20 - 2f */
|
||||
&fx_with_r0, &fx_with_r1, &fx_with_r2, &fx_with_r3, &fx_with_r4, &fx_with_r5, &fx_with_r6, &fx_with_r7,
|
||||
&fx_with_r0, &fx_with_r1, &fx_with_r2, &fx_with_r3, &fx_with_r4, &fx_with_r5, &fx_with_r6, &fx_with_r7,
|
||||
&fx_with_r8, &fx_with_r9, &fx_with_r10, &fx_with_r11, &fx_with_r12, &fx_with_r13, &fx_with_r14, &fx_with_r15,
|
||||
/* 30 - 3f */
|
||||
&fx_stw_r0, &fx_stw_r1, &fx_stw_r2, &fx_stw_r3, &fx_stw_r4, &fx_stw_r5, &fx_stw_r6, &fx_stw_r7,
|
||||
@ -1926,7 +1945,7 @@ void (*fx_apfOpcodeTable[])() =
|
||||
&fx_to_r0, &fx_to_r1, &fx_to_r2, &fx_to_r3, &fx_to_r4, &fx_to_r5, &fx_to_r6, &fx_to_r7,
|
||||
&fx_to_r8, &fx_to_r9, &fx_to_r10, &fx_to_r11, &fx_to_r12, &fx_to_r13, &fx_to_r14, &fx_to_r15,
|
||||
/* 20 - 2f */
|
||||
&fx_with_r0, &fx_with_r1, &fx_with_r2, &fx_with_r3, &fx_with_r4, &fx_with_r5, &fx_with_r6, &fx_with_r7,
|
||||
&fx_with_r0, &fx_with_r1, &fx_with_r2, &fx_with_r3, &fx_with_r4, &fx_with_r5, &fx_with_r6, &fx_with_r7,
|
||||
&fx_with_r8, &fx_with_r9, &fx_with_r10, &fx_with_r11, &fx_with_r12, &fx_with_r13, &fx_with_r14, &fx_with_r15,
|
||||
/* 30 - 3f */
|
||||
&fx_stb_r0, &fx_stb_r1, &fx_stb_r2, &fx_stb_r3, &fx_stb_r4, &fx_stb_r5, &fx_stb_r6, &fx_stb_r7,
|
||||
|
@ -1,7 +1,7 @@
|
||||
/**********************************************************************************
|
||||
Snes9x - Portable Super Nintendo Entertainment System (TM) emulator.
|
||||
|
||||
(c) Copyright 1996 - 2002 Gary Henderson (gary.henderson@ntlworld.com) and
|
||||
(c) Copyright 1996 - 2002 Gary Henderson (gary.henderson@ntlworld.com),
|
||||
Jerremy Koot (jkoot@snes9x.com)
|
||||
|
||||
(c) Copyright 2002 - 2004 Matthew Kendora
|
||||
@ -12,12 +12,16 @@
|
||||
|
||||
(c) Copyright 2001 - 2006 John Weidman (jweidman@slip.net)
|
||||
|
||||
(c) Copyright 2002 - 2006 Brad Jorsch (anomie@users.sourceforge.net),
|
||||
funkyass (funkyass@spam.shaw.ca),
|
||||
Kris Bleakley (codeviolation@hotmail.com),
|
||||
Nach (n-a-c-h@users.sourceforge.net), and
|
||||
(c) Copyright 2002 - 2006 funkyass (funkyass@spam.shaw.ca),
|
||||
Kris Bleakley (codeviolation@hotmail.com)
|
||||
|
||||
(c) Copyright 2002 - 2007 Brad Jorsch (anomie@users.sourceforge.net),
|
||||
Nach (n-a-c-h@users.sourceforge.net),
|
||||
zones (kasumitokoduck@yahoo.com)
|
||||
|
||||
(c) Copyright 2006 - 2007 nitsuja
|
||||
|
||||
|
||||
BS-X C emulator code
|
||||
(c) Copyright 2005 - 2006 Dreamer Nom,
|
||||
zones
|
||||
@ -110,17 +114,30 @@
|
||||
2xSaI filter
|
||||
(c) Copyright 1999 - 2001 Derek Liauw Kie Fa
|
||||
|
||||
HQ2x filter
|
||||
HQ2x, HQ3x, HQ4x filters
|
||||
(c) Copyright 2003 Maxim Stepin (maxim@hiend3d.com)
|
||||
|
||||
Win32 GUI code
|
||||
(c) Copyright 2003 - 2006 blip,
|
||||
funkyass,
|
||||
Matthew Kendora,
|
||||
Nach,
|
||||
nitsuja
|
||||
|
||||
Mac OS GUI code
|
||||
(c) Copyright 1998 - 2001 John Stiles
|
||||
(c) Copyright 2001 - 2007 zones
|
||||
|
||||
|
||||
Specific ports contains the works of other authors. See headers in
|
||||
individual files.
|
||||
|
||||
|
||||
Snes9x homepage: http://www.snes9x.com
|
||||
|
||||
Permission to use, copy, modify and/or distribute Snes9x in both binary
|
||||
and source form, for non-commercial purposes, is hereby granted without
|
||||
fee, providing that this license information and copyright notice appear
|
||||
and source form, for non-commercial purposes, is hereby granted without
|
||||
fee, providing that this license information and copyright notice appear
|
||||
with all copies and any derived work.
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
@ -141,6 +158,8 @@
|
||||
Nintendo Co., Limited and its subsidiary companies.
|
||||
**********************************************************************************/
|
||||
|
||||
|
||||
|
||||
#ifndef _FXINST_H_
|
||||
#define _FXINST_H_ 1
|
||||
|
||||
@ -155,20 +174,20 @@
|
||||
* 3004 - R2 pixel plot Y position register
|
||||
* 3006 - R3
|
||||
* 3008 - R4 lower 16 bit result of lmult
|
||||
* 300a - R5
|
||||
* 300a - R5
|
||||
* 300c - R6 multiplier for fmult and lmult
|
||||
* 300e - R7 fixed point texel X position for merge
|
||||
* 3010 - R8 fixed point texel Y position for merge
|
||||
* 3012 - R9
|
||||
* 3014 - R10
|
||||
* 3012 - R9
|
||||
* 3014 - R10
|
||||
* 3016 - R11 return address set by link
|
||||
* 3018 - R12 loop counter
|
||||
* 301a - R13 loop point address
|
||||
* 301c - R14 rom address for getb, getbh, getbl, getbs
|
||||
* 301e - R15 program counter
|
||||
* 301e - R15 program counter
|
||||
*
|
||||
* 3020-302f - unused
|
||||
*
|
||||
*
|
||||
* Other internal registers
|
||||
* 3030 - SFR status flag register (16bit)
|
||||
* 3032 - unused
|
||||
@ -190,21 +209,21 @@
|
||||
* 3100-32ff - CACHERAM 512 bytes of GSU cache memory
|
||||
*
|
||||
* SFR status flag register bits:
|
||||
* 0 -
|
||||
* 0 -
|
||||
* 1 Z Zero flag
|
||||
* 2 CY Carry flag
|
||||
* 3 S Sign flag
|
||||
* 4 OV Overflow flag
|
||||
* 5 G Go flag (set to 1 when the GSU is running)
|
||||
* 6 R Set to 1 when reading ROM using R14 address
|
||||
* 7 -
|
||||
* 7 -
|
||||
* 8 ALT1 Mode set-up flag for the next instruction
|
||||
* 9 ALT2 Mode set-up flag for the next instruction
|
||||
* 10 IL Immediate lower 8-bit flag
|
||||
* 11 IH Immediate higher 8-bit flag
|
||||
* 12 B Set to 1 when the WITH instruction is executed
|
||||
* 13 -
|
||||
* 14 -
|
||||
* 13 -
|
||||
* 14 -
|
||||
* 15 IRQ Set to 1 when GSU caused an interrupt
|
||||
* Set to 0 when read by 658c16
|
||||
*
|
||||
@ -212,13 +231,13 @@
|
||||
* BRAMR = 1, BackupRAM is enabled
|
||||
*
|
||||
* CFGR control flags register bits:
|
||||
* 0 -
|
||||
* 1 -
|
||||
* 2 -
|
||||
* 3 -
|
||||
* 4 -
|
||||
* 0 -
|
||||
* 1 -
|
||||
* 2 -
|
||||
* 3 -
|
||||
* 4 -
|
||||
* 5 MS0 Multiplier speed, 0=standard, 1=high speed
|
||||
* 6 -
|
||||
* 6 -
|
||||
* 7 IRQ Set to 1 when GSU interrupt request is masked
|
||||
*
|
||||
* CLSR clock speed register bits:
|
||||
@ -231,8 +250,8 @@
|
||||
* 3 RAN RAM access control
|
||||
* 4 RON ROM access control
|
||||
* 5 HT1 screen height bit 2
|
||||
* 6 -
|
||||
* 7 -
|
||||
* 6 -
|
||||
* 7 -
|
||||
*
|
||||
* RON = 0 SNES CPU has ROM access
|
||||
* RON = 1 GSU has ROM access
|
||||
@ -295,16 +314,16 @@ struct FxRegs_s
|
||||
uint32 vZero; /* v == 0 */
|
||||
uint32 vCarry; /* a value of 1 or 0 */
|
||||
int32 vOverflow; /* (v >= 0x8000 || v < -0x8000) */
|
||||
|
||||
|
||||
/* Other emulator variables */
|
||||
|
||||
|
||||
int32 vErrorCode;
|
||||
uint32 vIllegalAddress;
|
||||
|
||||
|
||||
uint8 bBreakPoint;
|
||||
uint32 vBreakPoint;
|
||||
uint32 vStepPoint;
|
||||
|
||||
|
||||
uint8 * pvRegisters; /* 768 bytes located in the memory at address 0x3000 */
|
||||
uint32 nRamBanks; /* Number of 64kb-banks in FxRam (Don't confuse it with SNES-Ram!!!) */
|
||||
uint8 * pvRam; /* Pointer to FxRam */
|
||||
@ -315,14 +334,14 @@ struct FxRegs_s
|
||||
uint32 vPrevMode; /* Previous depth */
|
||||
uint8 * pvScreenBase;
|
||||
uint8 * apvScreen[32]; /* Pointer to each of the 32 screen colums */
|
||||
int x[32];
|
||||
int32 x[32];
|
||||
uint32 vScreenHeight; /* 128, 160, 192 or 256 (could be overriden by cmode) */
|
||||
uint32 vScreenRealHeight; /* 128, 160, 192 or 256 */
|
||||
uint32 vPrevScreenHeight;
|
||||
uint32 vScreenSize;
|
||||
void (*pfPlot)();
|
||||
void (*pfRpix)();
|
||||
|
||||
|
||||
uint8 * pvRamBank; /* Pointer to current RAM-bank */
|
||||
uint8 * pvRomBank; /* Pointer to current ROM-bank */
|
||||
uint8 * pvPrgBank; /* Pointer to current program ROM-bank */
|
||||
|
@ -1,7 +1,7 @@
|
||||
/**********************************************************************************
|
||||
Snes9x - Portable Super Nintendo Entertainment System (TM) emulator.
|
||||
|
||||
(c) Copyright 1996 - 2002 Gary Henderson (gary.henderson@ntlworld.com) and
|
||||
(c) Copyright 1996 - 2002 Gary Henderson (gary.henderson@ntlworld.com),
|
||||
Jerremy Koot (jkoot@snes9x.com)
|
||||
|
||||
(c) Copyright 2002 - 2004 Matthew Kendora
|
||||
@ -12,12 +12,16 @@
|
||||
|
||||
(c) Copyright 2001 - 2006 John Weidman (jweidman@slip.net)
|
||||
|
||||
(c) Copyright 2002 - 2006 Brad Jorsch (anomie@users.sourceforge.net),
|
||||
funkyass (funkyass@spam.shaw.ca),
|
||||
Kris Bleakley (codeviolation@hotmail.com),
|
||||
Nach (n-a-c-h@users.sourceforge.net), and
|
||||
(c) Copyright 2002 - 2006 funkyass (funkyass@spam.shaw.ca),
|
||||
Kris Bleakley (codeviolation@hotmail.com)
|
||||
|
||||
(c) Copyright 2002 - 2007 Brad Jorsch (anomie@users.sourceforge.net),
|
||||
Nach (n-a-c-h@users.sourceforge.net),
|
||||
zones (kasumitokoduck@yahoo.com)
|
||||
|
||||
(c) Copyright 2006 - 2007 nitsuja
|
||||
|
||||
|
||||
BS-X C emulator code
|
||||
(c) Copyright 2005 - 2006 Dreamer Nom,
|
||||
zones
|
||||
@ -110,17 +114,30 @@
|
||||
2xSaI filter
|
||||
(c) Copyright 1999 - 2001 Derek Liauw Kie Fa
|
||||
|
||||
HQ2x filter
|
||||
HQ2x, HQ3x, HQ4x filters
|
||||
(c) Copyright 2003 Maxim Stepin (maxim@hiend3d.com)
|
||||
|
||||
Win32 GUI code
|
||||
(c) Copyright 2003 - 2006 blip,
|
||||
funkyass,
|
||||
Matthew Kendora,
|
||||
Nach,
|
||||
nitsuja
|
||||
|
||||
Mac OS GUI code
|
||||
(c) Copyright 1998 - 2001 John Stiles
|
||||
(c) Copyright 2001 - 2007 zones
|
||||
|
||||
|
||||
Specific ports contains the works of other authors. See headers in
|
||||
individual files.
|
||||
|
||||
|
||||
Snes9x homepage: http://www.snes9x.com
|
||||
|
||||
Permission to use, copy, modify and/or distribute Snes9x in both binary
|
||||
and source form, for non-commercial purposes, is hereby granted without
|
||||
fee, providing that this license information and copyright notice appear
|
||||
and source form, for non-commercial purposes, is hereby granted without
|
||||
fee, providing that this license information and copyright notice appear
|
||||
with all copies and any derived work.
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
@ -142,6 +159,8 @@
|
||||
**********************************************************************************/
|
||||
|
||||
|
||||
|
||||
|
||||
#ifndef _GETSET_H_
|
||||
#define _GETSET_H_
|
||||
|
||||
@ -164,7 +183,7 @@ INLINE uint8 S9xGetByte (uint32 Address)
|
||||
int block;
|
||||
uint8 *GetAddress = Memory.Map [block = ((Address&0xffffff) >> MEMMAP_SHIFT)];
|
||||
|
||||
if(!CPU.InDMA)
|
||||
if(!CPU.InDMAorHDMA)
|
||||
CPU.Cycles += Memory.MemorySpeed [block];
|
||||
|
||||
if (GetAddress >= (uint8 *) CMemory::MAP_LAST)
|
||||
@ -175,11 +194,11 @@ INLINE uint8 S9xGetByte (uint32 Address)
|
||||
#endif
|
||||
return (*(GetAddress + (Address & 0xffff)));
|
||||
}
|
||||
|
||||
|
||||
switch ((pint) GetAddress)
|
||||
{
|
||||
case CMemory::MAP_PPU:
|
||||
if(CPU.InDMA && (Address&0xff00)==0x2100) return OpenBus;
|
||||
if(CPU.InDMAorHDMA && (Address&0xff00)==0x2100) return OpenBus;
|
||||
return (S9xGetPPU (Address & 0xffff));
|
||||
case CMemory::MAP_CPU:
|
||||
return (S9xGetCPU (Address & 0xffff));
|
||||
@ -193,6 +212,9 @@ INLINE uint8 S9xGetByte (uint32 Address)
|
||||
//unbound & SRAMMask = Sram offset
|
||||
return (*(Memory.SRAM + ((((Address&0xFF0000)>>1) |(Address&0x7FFF)) &Memory.SRAMMask)));
|
||||
|
||||
case CMemory::MAP_LOROM_SRAM_B:
|
||||
return (*(Multi.sramB + ((((Address&0xFF0000)>>1) |(Address&0x7FFF)) &Multi.sramMaskB)));
|
||||
|
||||
case CMemory::MAP_RONLY_SRAM:
|
||||
case CMemory::MAP_HIROM_SRAM:
|
||||
return (*(Memory.SRAM + (((Address & 0x7fff) - 0x6000 +
|
||||
@ -271,10 +293,10 @@ INLINE uint16 S9xGetWord (uint32 Address, enum s9xwrap_t w=WRAP_NONE)
|
||||
int block;
|
||||
uint8 *GetAddress = Memory.Map [block = ((Address&0xffffff) >> MEMMAP_SHIFT)];
|
||||
|
||||
if(!CPU.InDMA)
|
||||
if(!CPU.InDMAorHDMA)
|
||||
CPU.Cycles += (Memory.MemorySpeed [block]<<1);
|
||||
|
||||
|
||||
|
||||
if (GetAddress >= (uint8 *) CMemory::MAP_LAST)
|
||||
{
|
||||
#ifdef CPU_SHUTDOWN
|
||||
@ -287,7 +309,7 @@ INLINE uint16 S9xGetWord (uint32 Address, enum s9xwrap_t w=WRAP_NONE)
|
||||
switch ((pint) GetAddress)
|
||||
{
|
||||
case CMemory::MAP_PPU:
|
||||
if(CPU.InDMA){
|
||||
if(CPU.InDMAorHDMA){
|
||||
OpenBus=S9xGetByte (Address);
|
||||
return (OpenBus | (S9xGetByte (Address + 1) << 8));
|
||||
}
|
||||
@ -313,11 +335,20 @@ INLINE uint16 S9xGetWord (uint32 Address, enum s9xwrap_t w=WRAP_NONE)
|
||||
} else {
|
||||
/* no READ_WORD here, since if Memory.SRAMMask=0x7ff
|
||||
* then the high byte doesn't follow the low byte. */
|
||||
return
|
||||
return
|
||||
(*(Memory.SRAM + ((((Address&0xFF0000)>>1) |(Address&0x7FFF)) &Memory.SRAMMask)))|
|
||||
((*(Memory.SRAM + (((((Address+1)&0xFF0000)>>1) |((Address+1)&0x7FFF)) &Memory.SRAMMask)))<<8);
|
||||
}
|
||||
|
||||
case CMemory::MAP_LOROM_SRAM_B:
|
||||
if(Multi.sramMaskB>=MEMMAP_MASK){
|
||||
return READ_WORD(Multi.sramB + ((((Address&0xFF0000)>>1) |(Address&0x7FFF)) &Multi.sramMaskB));
|
||||
} else {
|
||||
return
|
||||
(*(Multi.sramB + ((((Address&0xFF0000)>>1) |(Address&0x7FFF)) &Multi.sramMaskB)))|
|
||||
((*(Multi.sramB + (((((Address+1)&0xFF0000)>>1) |((Address+1)&0x7FFF)) &Multi.sramMaskB)))<<8);
|
||||
}
|
||||
|
||||
case CMemory::MAP_RONLY_SRAM:
|
||||
case CMemory::MAP_HIROM_SRAM:
|
||||
if(Memory.SRAMMask>=MEMMAP_MASK){
|
||||
@ -347,7 +378,7 @@ INLINE uint16 S9xGetWord (uint32 Address, enum s9xwrap_t w=WRAP_NONE)
|
||||
printf("reading spc7110 ROM (word) at %06X\n", Address);
|
||||
#endif
|
||||
return (S9xGetSPC7110Byte(Address)|
|
||||
(S9xGetSPC7110Byte (Address+1))<<8);
|
||||
(S9xGetSPC7110Byte (Address+1))<<8);
|
||||
case CMemory::MAP_SPC7110_DRAM:
|
||||
#ifdef SPC7110_DEBUG
|
||||
printf("reading Bank 50 (word)\n");
|
||||
@ -384,10 +415,10 @@ INLINE void S9xSetByte (uint8 Byte, uint32 Address)
|
||||
int block;
|
||||
uint8 *SetAddress = Memory.WriteMap [block = ((Address&0xffffff) >> MEMMAP_SHIFT)];
|
||||
|
||||
if (!CPU.InDMA)
|
||||
if (!CPU.InDMAorHDMA)
|
||||
CPU.Cycles += Memory.MemorySpeed [block];
|
||||
|
||||
|
||||
|
||||
if (SetAddress >= (uint8 *) CMemory::MAP_LAST)
|
||||
{
|
||||
#ifdef CPU_SHUTDOWN
|
||||
@ -404,11 +435,11 @@ INLINE void S9xSetByte (uint8 Byte, uint32 Address)
|
||||
#endif
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
switch ((pint) SetAddress)
|
||||
{
|
||||
case CMemory::MAP_PPU:
|
||||
if(CPU.InDMA && (Address&0xff00)==0x2100) return;
|
||||
if(CPU.InDMAorHDMA && (Address&0xff00)==0x2100) return;
|
||||
S9xSetPPU (Byte, Address & 0xffff);
|
||||
return;
|
||||
|
||||
@ -431,7 +462,15 @@ INLINE void S9xSetByte (uint8 Byte, uint32 Address)
|
||||
}
|
||||
return;
|
||||
|
||||
case CMemory::MAP_HIROM_SRAM:
|
||||
case CMemory::MAP_LOROM_SRAM_B:
|
||||
if (Multi.sramMaskB)
|
||||
{
|
||||
*(Multi.sramB + ((((Address&0xFF0000)>>1)|(Address&0x7FFF))& Multi.sramMaskB))=Byte;
|
||||
CPU.SRAMModified = TRUE;
|
||||
}
|
||||
return;
|
||||
|
||||
case CMemory::MAP_HIROM_SRAM:
|
||||
if (Memory.SRAMMask)
|
||||
{
|
||||
*(Memory.SRAM + (((Address & 0x7fff) - 0x6000 +
|
||||
@ -526,7 +565,7 @@ INLINE void S9xSetWord (uint16 Word, uint32 Address, enum s9xwrap_t w=WRAP_NONE,
|
||||
int block;
|
||||
uint8 *SetAddress = Memory.WriteMap [block = ((Address&0xffffff) >> MEMMAP_SHIFT)];
|
||||
|
||||
if (!CPU.InDMA)
|
||||
if (!CPU.InDMAorHDMA)
|
||||
CPU.Cycles += Memory.MemorySpeed [block] << 1;
|
||||
|
||||
|
||||
@ -550,7 +589,7 @@ INLINE void S9xSetWord (uint16 Word, uint32 Address, enum s9xwrap_t w=WRAP_NONE,
|
||||
switch ((pint) SetAddress)
|
||||
{
|
||||
case CMemory::MAP_PPU:
|
||||
if(CPU.InDMA){
|
||||
if(CPU.InDMAorHDMA){
|
||||
if((Address&0xff00)!=0x2100) S9xSetPPU((uint8)Word, Address&0xffff);
|
||||
if(((Address+1)&0xff00)!=0x2100) S9xSetPPU(Word>>8, (Address+1)&0xffff);
|
||||
return;
|
||||
@ -602,19 +641,32 @@ INLINE void S9xSetWord (uint16 Word, uint32 Address, enum s9xwrap_t w=WRAP_NONE,
|
||||
}
|
||||
return;
|
||||
|
||||
case CMemory::MAP_LOROM_SRAM_B:
|
||||
if (Multi.sramMaskB) {
|
||||
if(Multi.sramMaskB>=MEMMAP_MASK){
|
||||
WRITE_WORD(Multi.sramB + ((((Address&0xFF0000)>>1)|(Address&0x7FFF))&Multi.sramMaskB), Word);
|
||||
} else {
|
||||
*(Multi.sramB + ((((Address&0xFF0000)>>1)|(Address&0x7FFF))& Multi.sramMaskB)) = (uint8) Word;
|
||||
*(Multi.sramB + (((((Address+1)&0xFF0000)>>1)|((Address+1)&0x7FFF))& Multi.sramMaskB)) = Word >> 8;
|
||||
}
|
||||
|
||||
CPU.SRAMModified = TRUE;
|
||||
}
|
||||
return;
|
||||
|
||||
case CMemory::MAP_HIROM_SRAM:
|
||||
if (Memory.SRAMMask) {
|
||||
if(Memory.SRAMMask>=MEMMAP_MASK){
|
||||
WRITE_WORD(Memory.SRAM +
|
||||
WRITE_WORD(Memory.SRAM +
|
||||
(((Address & 0x7fff) - 0x6000 +
|
||||
((Address & 0xf0000) >> 3) & Memory.SRAMMask)), Word);
|
||||
} else {
|
||||
/* no WRITE_WORD here, since if Memory.SRAMMask=0x7ff
|
||||
* then the high byte doesn't follow the low byte. */
|
||||
*(Memory.SRAM +
|
||||
*(Memory.SRAM +
|
||||
(((Address & 0x7fff) - 0x6000 +
|
||||
((Address & 0xf0000) >> 3) & Memory.SRAMMask))) = (uint8) Word;
|
||||
*(Memory.SRAM +
|
||||
*(Memory.SRAM +
|
||||
((((Address + 1) & 0x7fff) - 0x6000 +
|
||||
(((Address + 1) & 0xf0000) >> 3) & Memory.SRAMMask))) = (uint8) (Word >> 8);
|
||||
}
|
||||
@ -714,7 +766,7 @@ INLINE uint8 *GetBasePointer (uint32 Address)
|
||||
// {
|
||||
// return s7r.bank50;
|
||||
// }
|
||||
|
||||
|
||||
case CMemory::MAP_SPC7110_ROM:
|
||||
#ifdef SPC7110_DEBUG
|
||||
printf("Getting Base pointer to SPC7110ROM\n");
|
||||
@ -728,6 +780,10 @@ INLINE uint8 *GetBasePointer (uint32 Address)
|
||||
if((Memory.SRAMMask&MEMMAP_MASK)!=MEMMAP_MASK) return NULL;
|
||||
return (Memory.SRAM + ((((Address&0xFF0000)>>1)|(Address&0x7FFF)) & Memory.SRAMMask) - (Address&0xffff));
|
||||
|
||||
case CMemory::MAP_LOROM_SRAM_B:
|
||||
if((Multi.sramMaskB&MEMMAP_MASK)!=MEMMAP_MASK) return NULL;
|
||||
return (Multi.sramB + ((((Address&0xFF0000)>>1)|(Address&0x7FFF)) & Multi.sramMaskB) - (Address&0xffff));
|
||||
|
||||
case CMemory::MAP_BWRAM:
|
||||
return (Memory.BWRAM - 0x6000 - (Address&0x8000));
|
||||
|
||||
@ -766,7 +822,7 @@ INLINE uint8 *S9xGetMemPointer (uint32 Address)
|
||||
// {
|
||||
// return s7r.bank50 + (Address&0xffff);
|
||||
// }
|
||||
|
||||
|
||||
case CMemory::MAP_SPC7110_ROM:
|
||||
#ifdef SPC7110_DEBUG
|
||||
printf("Getting Mem pointer to SPC7110ROM\n");
|
||||
@ -780,6 +836,10 @@ INLINE uint8 *S9xGetMemPointer (uint32 Address)
|
||||
if((Memory.SRAMMask&MEMMAP_MASK)!=MEMMAP_MASK) return NULL;
|
||||
return (Memory.SRAM + ((((Address&0xFF0000)>>1)|(Address&0x7FFF)) & Memory.SRAMMask));
|
||||
|
||||
case CMemory::MAP_LOROM_SRAM_B:
|
||||
if((Multi.sramMaskB&MEMMAP_MASK)!=MEMMAP_MASK) return NULL;
|
||||
return (Multi.sramB + ((((Address&0xFF0000)>>1)|(Address&0x7FFF)) & Multi.sramMaskB));
|
||||
|
||||
case CMemory::MAP_BWRAM:
|
||||
return (Memory.BWRAM - 0x6000 + (Address&0x7fff));
|
||||
|
||||
@ -829,7 +889,7 @@ INLINE void S9xSetPCBase (uint32 Address)
|
||||
// CPU.PCBase = s7r.bank50;
|
||||
// return;
|
||||
// }
|
||||
|
||||
|
||||
case CMemory::MAP_SPC7110_ROM:
|
||||
#ifdef SPC7110_DEBUG
|
||||
printf("Getting Base pointer to SPC7110ROM\n");
|
||||
@ -849,6 +909,14 @@ INLINE void S9xSetPCBase (uint32 Address)
|
||||
}
|
||||
return;
|
||||
|
||||
case CMemory::MAP_LOROM_SRAM_B:
|
||||
if((Multi.sramMaskB&MEMMAP_MASK)!=MEMMAP_MASK){
|
||||
CPU.PCBase = NULL;
|
||||
} else {
|
||||
CPU.PCBase = (Multi.sramB + ((((Address&0xFF0000)>>1)|(Address&0x7FFF)) & Multi.sramMaskB)) - (Address&0xffff);
|
||||
}
|
||||
return;
|
||||
|
||||
case CMemory::MAP_BWRAM:
|
||||
CPU.PCBase = (Memory.BWRAM - 0x6000 - (Address&0x8000));
|
||||
return;
|
||||
@ -868,9 +936,9 @@ INLINE void S9xSetPCBase (uint32 Address)
|
||||
case CMemory::MAP_OBC_RAM:
|
||||
CPU.PCBase = GetBasePointerOBC1(Address);
|
||||
return;
|
||||
|
||||
|
||||
case CMemory::MAP_BSX:
|
||||
CPU.PCBase = S9xGetPasePointerBSX(Address);
|
||||
CPU.PCBase = S9xGetBasePointerBSX(Address);
|
||||
return;
|
||||
|
||||
case CMemory::MAP_DEBUG:
|
||||
|
@ -1,7 +1,7 @@
|
||||
/**********************************************************************************
|
||||
Snes9x - Portable Super Nintendo Entertainment System (TM) emulator.
|
||||
|
||||
(c) Copyright 1996 - 2002 Gary Henderson (gary.henderson@ntlworld.com) and
|
||||
(c) Copyright 1996 - 2002 Gary Henderson (gary.henderson@ntlworld.com),
|
||||
Jerremy Koot (jkoot@snes9x.com)
|
||||
|
||||
(c) Copyright 2002 - 2004 Matthew Kendora
|
||||
@ -12,12 +12,16 @@
|
||||
|
||||
(c) Copyright 2001 - 2006 John Weidman (jweidman@slip.net)
|
||||
|
||||
(c) Copyright 2002 - 2006 Brad Jorsch (anomie@users.sourceforge.net),
|
||||
funkyass (funkyass@spam.shaw.ca),
|
||||
Kris Bleakley (codeviolation@hotmail.com),
|
||||
Nach (n-a-c-h@users.sourceforge.net), and
|
||||
(c) Copyright 2002 - 2006 funkyass (funkyass@spam.shaw.ca),
|
||||
Kris Bleakley (codeviolation@hotmail.com)
|
||||
|
||||
(c) Copyright 2002 - 2007 Brad Jorsch (anomie@users.sourceforge.net),
|
||||
Nach (n-a-c-h@users.sourceforge.net),
|
||||
zones (kasumitokoduck@yahoo.com)
|
||||
|
||||
(c) Copyright 2006 - 2007 nitsuja
|
||||
|
||||
|
||||
BS-X C emulator code
|
||||
(c) Copyright 2005 - 2006 Dreamer Nom,
|
||||
zones
|
||||
@ -110,12 +114,25 @@
|
||||
2xSaI filter
|
||||
(c) Copyright 1999 - 2001 Derek Liauw Kie Fa
|
||||
|
||||
HQ2x filter
|
||||
HQ2x, HQ3x, HQ4x filters
|
||||
(c) Copyright 2003 Maxim Stepin (maxim@hiend3d.com)
|
||||
|
||||
Win32 GUI code
|
||||
(c) Copyright 2003 - 2006 blip,
|
||||
funkyass,
|
||||
Matthew Kendora,
|
||||
Nach,
|
||||
nitsuja
|
||||
|
||||
Mac OS GUI code
|
||||
(c) Copyright 1998 - 2001 John Stiles
|
||||
(c) Copyright 2001 - 2007 zones
|
||||
|
||||
|
||||
Specific ports contains the works of other authors. See headers in
|
||||
individual files.
|
||||
|
||||
|
||||
Snes9x homepage: http://www.snes9x.com
|
||||
|
||||
Permission to use, copy, modify and/or distribute Snes9x in both binary
|
||||
@ -142,6 +159,8 @@
|
||||
**********************************************************************************/
|
||||
|
||||
|
||||
|
||||
|
||||
#include "snes9x.h"
|
||||
#include "cpuexec.h"
|
||||
#include "gfx.h"
|
||||
@ -153,9 +172,29 @@
|
||||
|
||||
#include "cheats.h"
|
||||
|
||||
static void S9xDisplayString(const char *string);
|
||||
static void S9xDisplayFrameRate();
|
||||
void ComputeClipWindows();
|
||||
#ifndef NGC
|
||||
#include "movie.h"
|
||||
#endif
|
||||
|
||||
#include "font.h"
|
||||
static int font_width = 8;
|
||||
static int font_height = 9;
|
||||
|
||||
// private text-displaying functions
|
||||
static void S9xDisplayPressedKeys ();
|
||||
static void S9xDisplayFrameRate ();
|
||||
static void S9xDisplayString (const char *string, int linesFromBottom=5, int pixelsFromLeft=1, bool allowWrap=true);
|
||||
#ifndef NGC
|
||||
static void S9xDisplayWatchedAddresses ();
|
||||
#endif
|
||||
// shared params for the above functions and DisplayChar
|
||||
uint16* display_screen = NULL;
|
||||
int display_ppl, display_width, display_height;
|
||||
int display_fontwidth = font_width, display_fontheight = font_height, display_hfontaccessscale = 1, display_vfontaccessscale = 1;
|
||||
bool8 display_paramsinited = FALSE;
|
||||
#define DisplayString (S9xCustomDisplayString ? S9xCustomDisplayString : S9xDisplayString)
|
||||
|
||||
void ComputeClipWindows ();
|
||||
|
||||
extern struct SLineData LineData[240];
|
||||
extern struct SLineMatrixData LineMatrixData [240];
|
||||
@ -170,7 +209,7 @@ bool8 S9xGraphicsInit(){
|
||||
|
||||
GFX.DoInterlace=0;
|
||||
GFX.InterlaceFrame=0;
|
||||
PPU.BG_Forced=0;
|
||||
Settings.BG_Forced=0;
|
||||
IPPU.OBJChanged=TRUE;
|
||||
IPPU.DirectColourMapsNeedRebuild=TRUE;
|
||||
GFX.RealPPL=GFX.Pitch>>1;
|
||||
@ -241,6 +280,8 @@ bool8 S9xGraphicsInit(){
|
||||
}
|
||||
}
|
||||
|
||||
GFX.Repainting = FALSE;
|
||||
|
||||
return TRUE;
|
||||
|
||||
FAIL:
|
||||
@ -341,6 +382,7 @@ void S9xStartScreenRefresh(){
|
||||
IPPU.RenderedFramesCount = 0;
|
||||
IPPU.FrameCount = 0;
|
||||
}
|
||||
++IPPU.TotalEmulatedFrames;
|
||||
}
|
||||
|
||||
void RenderLine(uint8 C) {
|
||||
@ -375,12 +417,71 @@ void RenderLine(uint8 C) {
|
||||
}
|
||||
}
|
||||
|
||||
bool watchesCleared=false;
|
||||
#ifndef NGC
|
||||
void S9xDisplayWatchedAddresses ()
|
||||
{
|
||||
if(!watchesCleared)
|
||||
{
|
||||
for(unsigned int i = 0 ; i < sizeof(watches)/sizeof(*watches) ; i++)
|
||||
watches[i].on = false;
|
||||
watchesCleared = true;
|
||||
}
|
||||
|
||||
for(unsigned int i = 0 ; i < sizeof(watches)/sizeof(*watches) ; i++)
|
||||
{
|
||||
if(!watches[i].on)
|
||||
break;
|
||||
|
||||
int32 displayNumber = 0;
|
||||
|
||||
extern struct SCheatData Cheat;
|
||||
for(int r=0;r<watches[i].size;r++)
|
||||
displayNumber+=(Cheat.CWatchRAM[(watches[i].address - 0x7E0000)+r])<<(8*r);
|
||||
|
||||
char buf [32];
|
||||
|
||||
if(watches[i].format==1)
|
||||
sprintf(buf, "%s,%du = %u", watches[i].desc, watches[i].size, (unsigned int)displayNumber);
|
||||
else if(watches[i].format==3)
|
||||
sprintf(buf, "%s,%dx = %X", watches[i].desc, watches[i].size, (unsigned int)displayNumber);
|
||||
else
|
||||
{
|
||||
// signed
|
||||
if(watches[i].size == 1)
|
||||
displayNumber = (int32)((int8)displayNumber);
|
||||
else if(watches[i].size == 2)
|
||||
displayNumber = (int32)((int16)displayNumber);
|
||||
else if(watches[i].size == 3)
|
||||
if(displayNumber >= 8388608)
|
||||
displayNumber -= 16777216;
|
||||
|
||||
sprintf(buf, "%s,%ds = %d", watches[i].desc, watches[i].size, (int)displayNumber);
|
||||
}
|
||||
|
||||
|
||||
DisplayString(buf, 6+i, 1, false);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
void S9xReRefresh ()
|
||||
{
|
||||
if(Settings.StopEmulation)
|
||||
return;
|
||||
|
||||
GFX.Repainting = TRUE;
|
||||
S9xDeinitUpdate (IPPU.RenderedScreenWidth, IPPU.RenderedScreenHeight/*, Settings.SixteenBit*/);
|
||||
GFX.Repainting = FALSE;
|
||||
}
|
||||
|
||||
|
||||
void S9xEndScreenRefresh() {
|
||||
if(IPPU.RenderThisFrame) {
|
||||
FLUSH_REDRAW();
|
||||
if(GFX.DoInterlace && GFX.InterlaceFrame==0){
|
||||
S9xControlEOF();
|
||||
// XXX: Invent S9xContinueUpdate()?
|
||||
S9xContinueUpdate(IPPU.RenderedScreenWidth, IPPU.RenderedScreenHeight);
|
||||
} else {
|
||||
if(IPPU.ColorsChanged) {
|
||||
uint32 saved = PPU.CGDATA[0];
|
||||
@ -389,15 +490,15 @@ void S9xEndScreenRefresh() {
|
||||
PPU.CGDATA[0] = saved;
|
||||
}
|
||||
|
||||
#ifndef NGC
|
||||
#ifndef NGC
|
||||
if(Settings.TakeScreenshot)
|
||||
S9xDoScreenshot(IPPU.RenderedScreenWidth, IPPU.RenderedScreenHeight);
|
||||
#endif
|
||||
#endif
|
||||
S9xControlEOF();
|
||||
if (Settings.DisplayFrameRate)
|
||||
S9xDisplayFrameRate();
|
||||
if (GFX.InfoString)
|
||||
S9xDisplayString(GFX.InfoString);
|
||||
|
||||
if(Settings.AutoDisplayMessages || Settings.OpenGLEnable || Settings.GlideEnable)
|
||||
S9xDisplayMessages(GFX.Screen, GFX.RealPPL, IPPU.RenderedScreenWidth, IPPU.RenderedScreenHeight, 1);
|
||||
|
||||
S9xDeinitUpdate(IPPU.RenderedScreenWidth, IPPU.RenderedScreenHeight);
|
||||
}
|
||||
} else {
|
||||
@ -497,13 +598,13 @@ void S9xSetupOBJ() {
|
||||
} else {
|
||||
GFX.OBJWidths[S]=SmallWidth; Height=SmallHeight;
|
||||
}
|
||||
int HPos=PPU.OBJ[S].HPos; if(HPos==-256) HPos=256;
|
||||
int HPos=PPU.OBJ[S].HPos; if(HPos==-256) HPos=0;
|
||||
if(HPos>-GFX.OBJWidths[S] && HPos<=256)
|
||||
{
|
||||
if(HPos<0){
|
||||
GFX.OBJVisibleTiles[S]=(GFX.OBJWidths[S]+HPos+7)>>3;
|
||||
} else if(HPos+GFX.OBJWidths[S]>=257){
|
||||
GFX.OBJVisibleTiles[S]=(257-HPos+7)>>3;
|
||||
} else if(HPos+GFX.OBJWidths[S]>255){
|
||||
GFX.OBJVisibleTiles[S]=(256-HPos+7)>>3;
|
||||
} else {
|
||||
GFX.OBJVisibleTiles[S]=GFX.OBJWidths[S]>>3;
|
||||
}
|
||||
@ -905,7 +1006,7 @@ static void DrawBackgroundMosaic(int bg, uint8 Zh, uint8 Zl){
|
||||
}
|
||||
|
||||
uint32 Width = Right-Left;
|
||||
uint32 f = 0;
|
||||
HPos&=7;
|
||||
while(Left<Right){
|
||||
uint32 w=PPU.Mosaic-(Left%PPU.Mosaic);
|
||||
if(w>Width) w=Width;
|
||||
@ -923,9 +1024,8 @@ static void DrawBackgroundMosaic(int bg, uint8 Zh, uint8 Zl){
|
||||
}
|
||||
}
|
||||
HPos+=PPU.Mosaic;
|
||||
f+=PPU.Mosaic;
|
||||
while(f>=8){
|
||||
f-=8;
|
||||
while(HPos>=8){
|
||||
HPos-=8;
|
||||
if(BG.TileSizeH==8){
|
||||
t++;
|
||||
if(HTile==31) t=b2;
|
||||
@ -1328,14 +1428,14 @@ static inline void RenderScreen(bool8 sub){
|
||||
GFX.S = GFX.Screen;
|
||||
GFX.DB = GFX.ZBuffer;
|
||||
GFX.Clip = IPPU.Clip[0];
|
||||
BGActive=Memory.FillRAM[0x212c] & ~PPU.BG_Forced;
|
||||
BGActive=Memory.FillRAM[0x212c] & ~Settings.BG_Forced;
|
||||
if(GFX.DoInterlace && GFX.InterlaceFrame) GFX.S+=GFX.RealPPL;
|
||||
D=32;
|
||||
} else {
|
||||
GFX.S = GFX.SubScreen;
|
||||
GFX.DB = GFX.SubZBuffer;
|
||||
GFX.Clip = IPPU.Clip[1];
|
||||
BGActive=Memory.FillRAM[0x212d] & ~PPU.BG_Forced;
|
||||
BGActive=Memory.FillRAM[0x212d] & ~Settings.BG_Forced;
|
||||
D=(Memory.FillRAM[0x2130]&2)<<4; // 'do math' depth flag
|
||||
}
|
||||
|
||||
@ -1519,76 +1619,291 @@ void S9xUpdateScreen() {
|
||||
IPPU.PreviousLine = IPPU.CurrentLine;
|
||||
}
|
||||
|
||||
extern bool unfreezing_from_stream;
|
||||
|
||||
void S9xSetInfoString (const char *string)
|
||||
{
|
||||
GFX.InfoString = string;
|
||||
GFX.InfoStringTimeout = 120;
|
||||
if(Settings.InitialInfoStringTimeout > 0)
|
||||
{
|
||||
GFX.InfoString = string;
|
||||
GFX.InfoStringTimeout = Settings.InitialInfoStringTimeout;
|
||||
|
||||
if (Settings.Paused && !unfreezing_from_stream)
|
||||
{
|
||||
//refresh screen to show new message immediately
|
||||
S9xReRefresh();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#include "font.h"
|
||||
static inline void FontPixToScreen(char p, uint16 *s)
|
||||
{
|
||||
if(p == '#')
|
||||
{
|
||||
*s = Settings.DisplayColor;
|
||||
}
|
||||
else if(p == '.')
|
||||
{
|
||||
static const uint16 black = BUILD_PIXEL(0,0,0);
|
||||
*s = black;
|
||||
}
|
||||
}
|
||||
|
||||
void DisplayChar(uint16 *s, uint8 c) {
|
||||
int line = ((c - 32) >> 4) * font_height;
|
||||
int offset = ((c - 32) & 15) * font_width;
|
||||
int h, w, rws;
|
||||
rws = Settings.OpenGLEnable ? IPPU.RenderedScreenWidth : GFX.RealPPL;
|
||||
for(h=0; h<font_height; h++, line++, s+=rws-font_width) {
|
||||
for(w=0; w<font_width; w++, s++) {
|
||||
uint8 p = font [line][offset + w];
|
||||
|
||||
if(p == '#') {
|
||||
/*
|
||||
if(Memory.Hacked) *s= BUILD_PIXEL(31,0,0);
|
||||
else if(Memory.Iffy) *s= BUILD_PIXEL(31,31,0);
|
||||
else if(Memory.Iformat==1) *s= BUILD_PIXEL(0,31,0);
|
||||
else if(Memory.Iformat==2) *s= BUILD_PIXEL(0,31,31);
|
||||
else *s = 0xffff;
|
||||
*/
|
||||
*s=Settings.DisplayColor;
|
||||
} else {
|
||||
if (p == '.') *s = BUILD_PIXEL(0,0,0);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void S9xDisplayFrameRate() {
|
||||
uint16 *Screen = GFX.Screen + 1 +
|
||||
(IPPU.RenderedScreenHeight - font_height - 1) * GFX.RealPPL;
|
||||
char string [10];
|
||||
int len = 5;
|
||||
|
||||
sprintf (string, "%02d/%02d", IPPU.DisplayedRenderedFrameCount,
|
||||
(int) Memory.ROMFramesPerSecond);
|
||||
|
||||
int i;
|
||||
for(i=0; i<len; i++) {
|
||||
DisplayChar(Screen, string [i]);
|
||||
Screen += font_width-1;
|
||||
}
|
||||
}
|
||||
|
||||
static void S9xDisplayString(const char *string) {
|
||||
uint16 *Screen = GFX.Screen + 1 +
|
||||
(IPPU.RenderedScreenHeight - font_height * 5) * GFX.RealPPL;
|
||||
int len = strlen (string);
|
||||
int max_chars = IPPU.RenderedScreenWidth / (font_width - 1);
|
||||
int char_count = 0;
|
||||
int i;
|
||||
|
||||
for(i=0; i<len; i++, char_count++) {
|
||||
if (char_count >= max_chars || (unsigned char) string [i] < 32) {
|
||||
Screen -= (font_width - 1) * max_chars;
|
||||
Screen += font_height * GFX.RealPPL;
|
||||
if(Screen >= GFX.Screen+GFX.RealPPL*IPPU.RenderedScreenHeight)
|
||||
break;
|
||||
char_count -= max_chars;
|
||||
int line = ((c - 32) >> 4) * display_fontheight;
|
||||
int offset = ((c - 32) & 15) * display_fontwidth;
|
||||
int h, w;
|
||||
if(!display_paramsinited) display_ppl = Settings.OpenGLEnable ? IPPU.RenderedScreenWidth : GFX.RealPPL;
|
||||
if(display_hfontaccessscale == 1 && display_vfontaccessscale == 1) {
|
||||
for(h=0; h<display_fontheight; h++, line++, s+=display_ppl-display_fontwidth)
|
||||
for(w=0; w<display_fontwidth; w++, s++)
|
||||
FontPixToScreen(font [(line)] [(offset + w)], s);
|
||||
} else {
|
||||
for(h=0; h<display_fontheight; h++, line++, s+=display_ppl-display_fontwidth)
|
||||
for(w=0; w<display_fontwidth; w++, s++)
|
||||
FontPixToScreen(font [(line)/display_vfontaccessscale] [(offset + w)/display_hfontaccessscale], s);
|
||||
}
|
||||
if((unsigned char) string[i]<32) continue;
|
||||
DisplayChar(Screen, string [i]);
|
||||
Screen += font_width-1;
|
||||
}
|
||||
}
|
||||
|
||||
static void S9xDisplayFrameRate ()
|
||||
{
|
||||
char string[10];
|
||||
#ifdef DEBUGGER
|
||||
int len = 8;
|
||||
sprintf(string, "%02d/%02d %02d", (int)IPPU.DisplayedRenderedFrameCount, (int)Memory.ROMFramesPerSecond, (int)IPPU.FrameCount);
|
||||
#else
|
||||
int len = 5;
|
||||
sprintf(string, "%02d/%02d", (int)IPPU.DisplayedRenderedFrameCount, (int)Memory.ROMFramesPerSecond);
|
||||
#endif
|
||||
|
||||
DisplayString(string, 1, 1+display_width-display_fontheight*len, false);
|
||||
}
|
||||
|
||||
static void S9xDisplayString (const char *string, int linesFromBottom, int pixelsFromLeft, bool allowWrap)
|
||||
{
|
||||
if(linesFromBottom <= 0)
|
||||
linesFromBottom = 1;
|
||||
|
||||
uint16 *Screen = display_screen // text draw position, starting on the screen
|
||||
+ pixelsFromLeft // with this much horizontal offset
|
||||
// * (Settings.SixteenBit ? 2 : 1)
|
||||
+ (display_height - display_fontheight * linesFromBottom) // and this much vertical offset
|
||||
* display_ppl;
|
||||
|
||||
int len = strlen(string);
|
||||
int max_chars = display_width / (display_fontwidth-display_hfontaccessscale);
|
||||
int char_count = 0;
|
||||
int prev_hfont_access_scale = display_hfontaccessscale;
|
||||
|
||||
// squash if it won't fit on 1 line and we're drawing greater than 1x scale and we're not allowing wrapping
|
||||
while(len > max_chars && !allowWrap && display_hfontaccessscale > 1)
|
||||
{
|
||||
display_fontwidth /= display_hfontaccessscale;
|
||||
display_hfontaccessscale--;
|
||||
display_fontwidth *= display_hfontaccessscale;
|
||||
|
||||
max_chars = display_width / (display_fontwidth-display_hfontaccessscale);
|
||||
}
|
||||
|
||||
// loop through and draw the characters
|
||||
for(int i = 0 ; i < len ; i++, char_count++)
|
||||
{
|
||||
if(char_count >= max_chars || (unsigned char)string[i] < 32)
|
||||
{
|
||||
if(!allowWrap)
|
||||
break;
|
||||
|
||||
Screen -= /*Settings.SixteenBit ? (display_fontwidth-display_hfontaccessscale)*sizeof(uint16)*max_chars :*/ (display_fontwidth-display_hfontaccessscale)*max_chars;
|
||||
Screen += display_fontheight * display_ppl;
|
||||
if(Screen >= display_screen + display_ppl * display_height)
|
||||
break;
|
||||
|
||||
char_count -= max_chars;
|
||||
}
|
||||
if((unsigned char) string[i]<32) continue;
|
||||
|
||||
DisplayChar(Screen, string[i]);
|
||||
Screen += /*Settings.SixteenBit ? (display_fontwidth-display_hfontaccessscale)*sizeof(uint16) :*/ (display_fontwidth-display_hfontaccessscale);
|
||||
}
|
||||
|
||||
// revert temporary change to font scale, if any
|
||||
if(display_hfontaccessscale != prev_hfont_access_scale)
|
||||
{
|
||||
display_hfontaccessscale = prev_hfont_access_scale;
|
||||
display_fontwidth *= display_hfontaccessscale;
|
||||
}
|
||||
}
|
||||
|
||||
// input display
|
||||
static void S9xDisplayPressedKeys ()
|
||||
{
|
||||
#ifndef NGC
|
||||
uint16 MovieGetJoypad(int i);
|
||||
bool MovieGetMouse(int i, uint8 out [5]);
|
||||
bool MovieGetScope(int i, uint8 out [6]);
|
||||
bool MovieGetJustifier(int i, uint8 out [11]);
|
||||
#endif
|
||||
|
||||
enum controllers controller;
|
||||
int8 ids[4];
|
||||
|
||||
int line = 1;
|
||||
#ifndef NGC
|
||||
const static char KeyMap[]= {'0','1','2','R','L','X','A','>','<','v','^','S','s','Y','B'};
|
||||
const 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
|
||||
#endif
|
||||
char string[255];
|
||||
int len;
|
||||
|
||||
S9xGetController(1, &controller, &ids[0],&ids[1],&ids[2],&ids[3]);
|
||||
#ifndef NGC
|
||||
bool singlePlayer = (controller == CTL_NONE || (controller == CTL_JOYPAD && !(MovieGetJoypad(1) & 0xffff)));
|
||||
#else
|
||||
bool singlePlayer = (controller == CTL_NONE || (controller == CTL_JOYPAD));
|
||||
#endif
|
||||
for(int port = 0; port < 2; port++)
|
||||
{
|
||||
S9xGetController(port, &controller, &ids[0],&ids[1],&ids[2],&ids[3]);
|
||||
for(int idid = 0; idid < 4; idid++)
|
||||
{
|
||||
const int id = ids[idid];
|
||||
if(id == -1)
|
||||
continue;
|
||||
|
||||
bool skip = false;
|
||||
switch(controller)
|
||||
{
|
||||
default: {
|
||||
skip = true;
|
||||
} break;
|
||||
|
||||
case CTL_MP5:
|
||||
singlePlayer = false;
|
||||
// no break:
|
||||
case CTL_JOYPAD: {
|
||||
if(line < id+1)
|
||||
line = id+1;
|
||||
#ifndef NGC
|
||||
uint16 tempJoypad = MovieGetJoypad(id);
|
||||
if(!(tempJoypad & 0xffff) && id > 0)
|
||||
skip = true;
|
||||
else
|
||||
{
|
||||
sprintf(string, !singlePlayer?"P%d: ":" ",id+1);
|
||||
|
||||
for (int i=0; i < 15; i++)
|
||||
{
|
||||
int j = KeyOrder[i];
|
||||
int mask = (1 << (j+1));
|
||||
string[strlen("P?: ")+i]= ((tempJoypad & mask)!=0) ? KeyMap[j] : ' ';
|
||||
}
|
||||
}
|
||||
#endif
|
||||
} break;
|
||||
|
||||
case CTL_MOUSE: {
|
||||
#ifndef NGC
|
||||
uint8 buf [5] = {0};
|
||||
MovieGetMouse(id, buf);
|
||||
int16 x = ((uint16*)buf)[0];
|
||||
int16 y = ((uint16*)buf)[1];
|
||||
uint8 buttons = buf[4];
|
||||
//if(delta_x < 0) delta_x = 128|-delta_x;
|
||||
//if(delta_y < 0) delta_y = 128|-delta_y;
|
||||
sprintf(string, "(%4d,%4d) %c%c", x, y, (buttons&0x40)?'L':' ', (buttons&0x80)?'R':' ');
|
||||
#endif
|
||||
} break;
|
||||
|
||||
case CTL_SUPERSCOPE: {
|
||||
#ifndef NGC
|
||||
uint8 buf [6] = {0};
|
||||
MovieGetScope(id, buf);
|
||||
int16 x = ((uint16*)buf)[0];
|
||||
int16 y = ((uint16*)buf)[1];
|
||||
uint8 buttons = buf[4];
|
||||
sprintf(string, "(%3d,%3d) %c%c%c%c", x, y, (buttons&0x80)?'F':' ', (buttons&0x40)?'C':' ', (buttons&0x20)?'T':' ', (buttons&0x10)?'P':' ');
|
||||
#endif
|
||||
} break;
|
||||
|
||||
case CTL_JUSTIFIER: {
|
||||
#ifndef NGC
|
||||
uint8 buf [11] = {0};
|
||||
MovieGetJustifier(port, buf);
|
||||
int16 x1 = ((uint16*)buf)[0];
|
||||
int16 x2 = ((uint16*)buf)[1];
|
||||
int16 y1 = ((uint16*)buf)[2];
|
||||
int16 y2 = ((uint16*)buf)[3];
|
||||
uint8 buttons = buf[8];
|
||||
bool8 offscreen1 = buf[9];
|
||||
bool8 offscreen2 = buf[10];
|
||||
if(id == 1)
|
||||
sprintf(string, "(%3d,%3d) %c%c%c / (%3d,%3d) %c%c%c", x1, y1, (buttons&0x80)?'T':' ', (buttons&0x20)?'S':' ', offscreen1?'O':' ', x2, y2, (buttons&0x40)?'T':' ', (buttons&0x10)?'S':' ', offscreen2?'O':' ');
|
||||
else
|
||||
sprintf(string, "(%3d,%3d) %c%c%c", x1, y1, (buttons&0x80)?'T':' ', (buttons&0x20)?'S':' ', offscreen1?'O':' ');
|
||||
#endif
|
||||
} break;
|
||||
}
|
||||
|
||||
if(skip)
|
||||
continue;
|
||||
|
||||
len=strlen(string);
|
||||
|
||||
DisplayString(string, line, 1, false);
|
||||
|
||||
line++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void S9xDisplayMessages(uint16 *screen, int ppl, int width, int height, int scale)
|
||||
{
|
||||
display_screen = screen;
|
||||
display_ppl = ppl;
|
||||
display_width = width;
|
||||
display_height = height;
|
||||
display_fontwidth = font_width * scale;
|
||||
display_fontheight = font_height * scale;
|
||||
display_hfontaccessscale = scale;
|
||||
display_vfontaccessscale = scale;
|
||||
display_paramsinited = TRUE;
|
||||
|
||||
if (Settings.DisplayFrameRate)
|
||||
S9xDisplayFrameRate();
|
||||
|
||||
if (Settings.DisplayPressedKeys==2)
|
||||
S9xDisplayPressedKeys();
|
||||
|
||||
if (GFX.FrameDisplay
|
||||
#ifndef NGC
|
||||
&& S9xMovieActive()
|
||||
#endif
|
||||
#ifdef NETPLAY_SUPPORT
|
||||
|| Settings.NetPlay
|
||||
#endif
|
||||
)
|
||||
DisplayString(GFX.FrameDisplayString, 4, 1, false);
|
||||
|
||||
if (GFX.InfoString && *GFX.InfoString)
|
||||
DisplayString(GFX.InfoString, 5, 1, !GFX.FrameDisplay
|
||||
#ifndef NGC
|
||||
|| (!S9xMovieActive()
|
||||
#ifdef NETPLAY_SUPPORT
|
||||
&& !Settings.NetPlay
|
||||
#endif
|
||||
)
|
||||
#endif
|
||||
);
|
||||
|
||||
#ifndef NGC
|
||||
if (Settings.DisplayWatchedAddresses)
|
||||
S9xDisplayWatchedAddresses();
|
||||
#endif
|
||||
display_paramsinited = FALSE;
|
||||
display_fontwidth = font_width;
|
||||
display_fontheight = font_height;
|
||||
display_hfontaccessscale = 1;
|
||||
display_vfontaccessscale = 1;
|
||||
}
|
||||
|
||||
#include "crosshairs.h"
|
||||
@ -1609,7 +1924,7 @@ static uint16 get_crosshair_color(uint8 color){
|
||||
case 11: return BUILD_PIXEL(0,23,31); // Sky
|
||||
case 12: return BUILD_PIXEL(0,0,31); // Blue
|
||||
case 13: return BUILD_PIXEL(23,0,31); // Violet
|
||||
case 14: return BUILD_PIXEL(31,0,31); // MagicPink
|
||||
case 14: return BUILD_PIXEL(31,0,31); // Magenta
|
||||
case 15: return BUILD_PIXEL(31,0,16); // Purple
|
||||
}
|
||||
return 0; // stupid compiler warning
|
||||
@ -1623,26 +1938,33 @@ void S9xDrawCrosshair(const char *crosshair, uint8 fgcolor, uint8 bgcolor, int16
|
||||
if(IPPU.DoubleWidthPixels){ cx=2; x*=2; W*=2; }
|
||||
if(IPPU.DoubleHeightPixels){ rx=2; y*=2; H*=2; }
|
||||
if(crosshair==NULL) return;
|
||||
if(GFX.Screen==NULL) return;
|
||||
if(Settings.StopEmulation) return;
|
||||
uint16 fg, bg;
|
||||
fg=get_crosshair_color(fgcolor);
|
||||
bg=get_crosshair_color(bgcolor);
|
||||
uint16 *s = GFX.Screen + y * GFX.RealPPL + x;
|
||||
rws = Settings.OpenGLEnable ? IPPU.RenderedScreenWidth : GFX.RealPPL;
|
||||
for(r=0; r<15*rx; r++, s+=rws-15*cx) {
|
||||
if(y+r<0){ s+=15*cx; continue; }
|
||||
if(y+r>=H) break;
|
||||
for(c=0; c<15*cx; c++, s++) {
|
||||
if(x+c<0) continue;
|
||||
if(x+c>=W){ s+=15*cx-c; break; }
|
||||
uint8 p = crosshair[(r/rx)*15+(c/cx)];
|
||||
#if (defined(__unix) || defined(__linux) || defined(__sun) || defined(__DJGPP)) // XXX: FIXME: why does it crash without this on Linux port? There are no out-of-bound writes without it...
|
||||
if(x >= 0 && y >= 0)
|
||||
#endif
|
||||
{
|
||||
uint16 *s = GFX.Screen + y * GFX.RealPPL + x;
|
||||
rws = Settings.OpenGLEnable ? IPPU.RenderedScreenWidth : GFX.RealPPL;
|
||||
for(r=0; r<15*rx; r++, s+=rws-15*cx) {
|
||||
if(y+r<0){ s+=15*cx; continue; } // if y is negative, skip line
|
||||
if(y+r>=H) break; // if y is past bottom, stop
|
||||
for(c=0; c<15*cx; c++, s++) {
|
||||
if(x+c<0 || s<GFX.Screen) continue; // if x is negative or s is invalid, skip pixel
|
||||
if(x+c>=W){ s+=15*cx-c; break; } // if x is past right, go to next line
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -1740,3 +2062,4 @@ bool8 S9xSetRenderPixelFormat (int format)
|
||||
}
|
||||
#endif
|
||||
|
||||
void (*S9xCustomDisplayString) (const char *string, int linesFromBottom, int pixelsFromLeft, bool allowWrap) = NULL;
|
||||
|
@ -1,7 +1,7 @@
|
||||
/**********************************************************************************
|
||||
Snes9x - Portable Super Nintendo Entertainment System (TM) emulator.
|
||||
|
||||
(c) Copyright 1996 - 2002 Gary Henderson (gary.henderson@ntlworld.com) and
|
||||
(c) Copyright 1996 - 2002 Gary Henderson (gary.henderson@ntlworld.com),
|
||||
Jerremy Koot (jkoot@snes9x.com)
|
||||
|
||||
(c) Copyright 2002 - 2004 Matthew Kendora
|
||||
@ -12,12 +12,16 @@
|
||||
|
||||
(c) Copyright 2001 - 2006 John Weidman (jweidman@slip.net)
|
||||
|
||||
(c) Copyright 2002 - 2006 Brad Jorsch (anomie@users.sourceforge.net),
|
||||
funkyass (funkyass@spam.shaw.ca),
|
||||
Kris Bleakley (codeviolation@hotmail.com),
|
||||
Nach (n-a-c-h@users.sourceforge.net), and
|
||||
(c) Copyright 2002 - 2006 funkyass (funkyass@spam.shaw.ca),
|
||||
Kris Bleakley (codeviolation@hotmail.com)
|
||||
|
||||
(c) Copyright 2002 - 2007 Brad Jorsch (anomie@users.sourceforge.net),
|
||||
Nach (n-a-c-h@users.sourceforge.net),
|
||||
zones (kasumitokoduck@yahoo.com)
|
||||
|
||||
(c) Copyright 2006 - 2007 nitsuja
|
||||
|
||||
|
||||
BS-X C emulator code
|
||||
(c) Copyright 2005 - 2006 Dreamer Nom,
|
||||
zones
|
||||
@ -110,17 +114,30 @@
|
||||
2xSaI filter
|
||||
(c) Copyright 1999 - 2001 Derek Liauw Kie Fa
|
||||
|
||||
HQ2x filter
|
||||
HQ2x, HQ3x, HQ4x filters
|
||||
(c) Copyright 2003 Maxim Stepin (maxim@hiend3d.com)
|
||||
|
||||
Win32 GUI code
|
||||
(c) Copyright 2003 - 2006 blip,
|
||||
funkyass,
|
||||
Matthew Kendora,
|
||||
Nach,
|
||||
nitsuja
|
||||
|
||||
Mac OS GUI code
|
||||
(c) Copyright 1998 - 2001 John Stiles
|
||||
(c) Copyright 2001 - 2007 zones
|
||||
|
||||
|
||||
Specific ports contains the works of other authors. See headers in
|
||||
individual files.
|
||||
|
||||
|
||||
Snes9x homepage: http://www.snes9x.com
|
||||
|
||||
Permission to use, copy, modify and/or distribute Snes9x in both binary
|
||||
and source form, for non-commercial purposes, is hereby granted without
|
||||
fee, providing that this license information and copyright notice appear
|
||||
and source form, for non-commercial purposes, is hereby granted without
|
||||
fee, providing that this license information and copyright notice appear
|
||||
with all copies and any derived work.
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
@ -142,6 +159,8 @@
|
||||
**********************************************************************************/
|
||||
|
||||
|
||||
|
||||
|
||||
#ifndef _GFX_H_
|
||||
#define _GFX_H_
|
||||
|
||||
@ -175,6 +194,9 @@ struct SGFX{
|
||||
uint32 FixedColour;
|
||||
const char *InfoString;
|
||||
uint32 InfoStringTimeout;
|
||||
char FrameDisplayString[256];
|
||||
bool8 FrameDisplay;
|
||||
bool8 Repainting; // True if the frame is being re-drawn
|
||||
uint8 DoInterlace;
|
||||
uint8 InterlaceFrame;
|
||||
uint32 StartY;
|
||||
@ -242,7 +264,7 @@ struct SBG {
|
||||
uint32 PaletteMask;
|
||||
uint8 EnableMath;
|
||||
uint8 InterlaceLine;
|
||||
|
||||
|
||||
uint8 *Buffer, *BufferFlip;
|
||||
uint8 *Buffered, *BufferedFlip;
|
||||
bool8 DirectColourMode;
|
||||
@ -287,7 +309,7 @@ GFX.X2 [((((C1) & RGB_REMOVE_LOW_BITS_MASK) + \
|
||||
(GFX.X2 [((((C1) & RGB_REMOVE_LOW_BITS_MASK) + \
|
||||
((C2) & RGB_REMOVE_LOW_BITS_MASK)) >> 1) + \
|
||||
((C1) & (C2) & RGB_LOW_BITS_MASK)] | \
|
||||
(((C1) ^ (C2)) & RGB_LOW_BITS_MASK))
|
||||
(((C1) ^ (C2)) & RGB_LOW_BITS_MASK))
|
||||
#endif
|
||||
|
||||
#define COLOR_ADD1_2(C1, C2) \
|
||||
@ -314,7 +336,7 @@ inline uint16 COLOR_SUB(uint16 C1, uint16 C2)
|
||||
mC1 = C1 & FIRST_COLOR_MASK;
|
||||
mC2 = C2 & FIRST_COLOR_MASK;
|
||||
if (mC1 > mC2) v += (mC1 - mC2);
|
||||
|
||||
|
||||
mC1 = C1 & SECOND_COLOR_MASK;
|
||||
mC2 = C2 & SECOND_COLOR_MASK;
|
||||
if (mC1 > mC2) v += (mC1 - mC2);
|
||||
@ -322,7 +344,7 @@ inline uint16 COLOR_SUB(uint16 C1, uint16 C2)
|
||||
mC1 = C1 & THIRD_COLOR_MASK;
|
||||
mC2 = C2 & THIRD_COLOR_MASK;
|
||||
if (mC1 > mC2) v += (mC1 - mC2);
|
||||
|
||||
|
||||
return v;
|
||||
}
|
||||
#endif
|
||||
@ -340,17 +362,22 @@ void S9xUpdateScreen ();
|
||||
void RenderLine (uint8 line);
|
||||
void S9xBuildDirectColourMaps ();
|
||||
|
||||
// External port interface which must be implemented or initialised for each
|
||||
// port.
|
||||
void S9xDisplayMessages (uint16 *screen, int ppl, int width, int height, int scale); // called automatically unless Settings.AutoDisplayMessages is false
|
||||
|
||||
extern struct SGFX GFX;
|
||||
|
||||
// External port interface which must be implemented or initialised for each
|
||||
// port.
|
||||
bool8 S9xGraphicsInit ();
|
||||
void S9xGraphicsDeinit();
|
||||
bool8 S9xInitUpdate (void);
|
||||
bool8 S9xDeinitUpdate (int Width, int Height);
|
||||
bool8 S9xContinueUpdate (int Width, int Height);
|
||||
void S9xSetPalette ();
|
||||
void S9xSyncSpeed ();
|
||||
|
||||
extern void (*S9xCustomDisplayString) (const char *string, int linesFromBottom, int pixelsFromLeft, bool allowWrap); // called instead of S9xDisplayString if set to non-NULL
|
||||
|
||||
#ifdef GFX_MULTI_FORMAT
|
||||
bool8 S9xSetRenderPixelFormat (int format);
|
||||
#endif
|
||||
|
@ -1,7 +1,7 @@
|
||||
/**********************************************************************************
|
||||
Snes9x - Portable Super Nintendo Entertainment System (TM) emulator.
|
||||
|
||||
(c) Copyright 1996 - 2002 Gary Henderson (gary.henderson@ntlworld.com) and
|
||||
(c) Copyright 1996 - 2002 Gary Henderson (gary.henderson@ntlworld.com),
|
||||
Jerremy Koot (jkoot@snes9x.com)
|
||||
|
||||
(c) Copyright 2002 - 2004 Matthew Kendora
|
||||
@ -12,12 +12,16 @@
|
||||
|
||||
(c) Copyright 2001 - 2006 John Weidman (jweidman@slip.net)
|
||||
|
||||
(c) Copyright 2002 - 2006 Brad Jorsch (anomie@users.sourceforge.net),
|
||||
funkyass (funkyass@spam.shaw.ca),
|
||||
Kris Bleakley (codeviolation@hotmail.com),
|
||||
Nach (n-a-c-h@users.sourceforge.net), and
|
||||
(c) Copyright 2002 - 2006 funkyass (funkyass@spam.shaw.ca),
|
||||
Kris Bleakley (codeviolation@hotmail.com)
|
||||
|
||||
(c) Copyright 2002 - 2007 Brad Jorsch (anomie@users.sourceforge.net),
|
||||
Nach (n-a-c-h@users.sourceforge.net),
|
||||
zones (kasumitokoduck@yahoo.com)
|
||||
|
||||
(c) Copyright 2006 - 2007 nitsuja
|
||||
|
||||
|
||||
BS-X C emulator code
|
||||
(c) Copyright 2005 - 2006 Dreamer Nom,
|
||||
zones
|
||||
@ -110,12 +114,25 @@
|
||||
2xSaI filter
|
||||
(c) Copyright 1999 - 2001 Derek Liauw Kie Fa
|
||||
|
||||
HQ2x filter
|
||||
HQ2x, HQ3x, HQ4x filters
|
||||
(c) Copyright 2003 Maxim Stepin (maxim@hiend3d.com)
|
||||
|
||||
Win32 GUI code
|
||||
(c) Copyright 2003 - 2006 blip,
|
||||
funkyass,
|
||||
Matthew Kendora,
|
||||
Nach,
|
||||
nitsuja
|
||||
|
||||
Mac OS GUI code
|
||||
(c) Copyright 1998 - 2001 John Stiles
|
||||
(c) Copyright 2001 - 2007 zones
|
||||
|
||||
|
||||
Specific ports contains the works of other authors. See headers in
|
||||
individual files.
|
||||
|
||||
|
||||
Snes9x homepage: http://www.snes9x.com
|
||||
|
||||
Permission to use, copy, modify and/or distribute Snes9x in both binary
|
||||
@ -141,7 +158,8 @@
|
||||
Nintendo Co., Limited and its subsidiary companies.
|
||||
**********************************************************************************/
|
||||
|
||||
#define _GLOBALS_CPP
|
||||
|
||||
|
||||
|
||||
#include "snes9x.h"
|
||||
#include "memmap.h"
|
||||
@ -160,14 +178,12 @@
|
||||
|
||||
#include "sa1.h"
|
||||
#include "bsx.h"
|
||||
|
||||
#include "spc7110.h"
|
||||
#ifdef NETPLAY_SUPPORT
|
||||
#include "netplay.h"
|
||||
#endif
|
||||
|
||||
#include "spc7110.h"
|
||||
|
||||
//START_EXTERN_C
|
||||
START_EXTERN_C
|
||||
char String[513];
|
||||
|
||||
struct Missing missing;
|
||||
@ -196,25 +212,28 @@ struct SSA1 SA1;
|
||||
|
||||
struct SBSX BSX;
|
||||
|
||||
struct SMulti Multi;
|
||||
|
||||
SSoundData SoundData;
|
||||
|
||||
SnesModel M1SNES={1,3,2};
|
||||
SnesModel M2SNES={2,4,3};
|
||||
SnesModel* Model=&M1SNES;
|
||||
|
||||
|
||||
uint8 *SRAM = NULL;
|
||||
#if defined(ZSNES_FX) || defined(ZSNES_C4)
|
||||
uint8 *ROM = NULL;
|
||||
uint8 *SRAM = NULL;
|
||||
uint8 *RegRAM = NULL;
|
||||
#endif
|
||||
|
||||
CMemory Memory;
|
||||
|
||||
SSNESGameFixes SNESGameFixes;
|
||||
struct SSNESGameFixes SNESGameFixes;
|
||||
|
||||
unsigned char OpenBus = 0;
|
||||
|
||||
|
||||
//END_EXTERN_C
|
||||
END_EXTERN_C
|
||||
|
||||
#ifndef ZSNES_FX
|
||||
struct FxInit_s SuperFX;
|
||||
|
@ -1,7 +1,7 @@
|
||||
/**********************************************************************************
|
||||
Snes9x - Portable Super Nintendo Entertainment System (TM) emulator.
|
||||
|
||||
(c) Copyright 1996 - 2002 Gary Henderson (gary.henderson@ntlworld.com) and
|
||||
(c) Copyright 1996 - 2002 Gary Henderson (gary.henderson@ntlworld.com),
|
||||
Jerremy Koot (jkoot@snes9x.com)
|
||||
|
||||
(c) Copyright 2002 - 2004 Matthew Kendora
|
||||
@ -12,12 +12,16 @@
|
||||
|
||||
(c) Copyright 2001 - 2006 John Weidman (jweidman@slip.net)
|
||||
|
||||
(c) Copyright 2002 - 2006 Brad Jorsch (anomie@users.sourceforge.net),
|
||||
funkyass (funkyass@spam.shaw.ca),
|
||||
Kris Bleakley (codeviolation@hotmail.com),
|
||||
Nach (n-a-c-h@users.sourceforge.net), and
|
||||
(c) Copyright 2002 - 2006 funkyass (funkyass@spam.shaw.ca),
|
||||
Kris Bleakley (codeviolation@hotmail.com)
|
||||
|
||||
(c) Copyright 2002 - 2007 Brad Jorsch (anomie@users.sourceforge.net),
|
||||
Nach (n-a-c-h@users.sourceforge.net),
|
||||
zones (kasumitokoduck@yahoo.com)
|
||||
|
||||
(c) Copyright 2006 - 2007 nitsuja
|
||||
|
||||
|
||||
BS-X C emulator code
|
||||
(c) Copyright 2005 - 2006 Dreamer Nom,
|
||||
zones
|
||||
@ -110,17 +114,30 @@
|
||||
2xSaI filter
|
||||
(c) Copyright 1999 - 2001 Derek Liauw Kie Fa
|
||||
|
||||
HQ2x filter
|
||||
HQ2x, HQ3x, HQ4x filters
|
||||
(c) Copyright 2003 Maxim Stepin (maxim@hiend3d.com)
|
||||
|
||||
Win32 GUI code
|
||||
(c) Copyright 2003 - 2006 blip,
|
||||
funkyass,
|
||||
Matthew Kendora,
|
||||
Nach,
|
||||
nitsuja
|
||||
|
||||
Mac OS GUI code
|
||||
(c) Copyright 1998 - 2001 John Stiles
|
||||
(c) Copyright 2001 - 2007 zones
|
||||
|
||||
|
||||
Specific ports contains the works of other authors. See headers in
|
||||
individual files.
|
||||
|
||||
|
||||
Snes9x homepage: http://www.snes9x.com
|
||||
|
||||
Permission to use, copy, modify and/or distribute Snes9x in both binary
|
||||
and source form, for non-commercial purposes, is hereby granted without
|
||||
fee, providing that this license information and copyright notice appear
|
||||
and source form, for non-commercial purposes, is hereby granted without
|
||||
fee, providing that this license information and copyright notice appear
|
||||
with all copies and any derived work.
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
@ -142,22 +159,30 @@
|
||||
**********************************************************************************/
|
||||
|
||||
|
||||
|
||||
|
||||
/* This file is for core emulator messages. Use a port-specific file for *
|
||||
* GUI strings and the like. Thank you. */
|
||||
|
||||
/* Movie Messages */
|
||||
|
||||
#define MOVIE_ERR_SNAPSHOT_WRONG_MOVIE "Snapshot not from this movie"
|
||||
#define MOVIE_ERR_SNAPSHOT_NOT_MOVIE "Not a movie snapshot"
|
||||
#define MOVIE_INFO_REPLAY "Movie replay"
|
||||
#define MOVIE_INFO_RECORD "Movie record"
|
||||
#define MOVIE_INFO_RERECORD "Movie re-record"
|
||||
#define MOVIE_INFO_REWIND "Movie rewind"
|
||||
#define MOVIE_INFO_STOP "Movie stop"
|
||||
#define MOVIE_INFO_END "Movie end"
|
||||
#define MOVIE_INFO_RECORDING_ENABLED "Recording enabled"
|
||||
#define MOVIE_INFO_RECORDING_DISABLED "Recording disabled"
|
||||
#define MOVIE_ERR_SNAPSHOT_WRONG_MOVIE "Snapshot not from this movie"
|
||||
#define MOVIE_ERR_SNAPSHOT_NOT_MOVIE "Not a movie snapshot"
|
||||
#define MOVIE_ERR_COULD_NOT_OPEN "Could not open movie file."
|
||||
#define MOVIE_ERR_NOT_FOUND "File not found."
|
||||
#define MOVIE_ERR_WRONG_FORMAT "File is wrong format."
|
||||
#define MOVIE_ERR_WRONG_VERSION "File is wrong version."
|
||||
#define MOVIE_INFO_SNAPSHOT "Movie snapshot"
|
||||
#define MOVIE_ERR_SNAPSHOT_INCONSISTENT "Snapshot inconsistent with movie"
|
||||
|
||||
/* Snapshot Messages */
|
||||
|
||||
#define SAVE_INFO_SNAPSHOT "Saved"
|
||||
#define SAVE_INFO_LOAD "Loaded"
|
||||
#define SAVE_ERR_WRONG_FORMAT "File not in Snes9x freeze format"
|
||||
#define SAVE_ERR_WRONG_VERSION "Incompatable Snes9x freeze file format version"
|
||||
#define SAVE_ERR_ROM_NOT_FOUND "ROM image \"%s\" for freeze file not found"
|
||||
#define SAVE_ERR_SAVE_NOT_FOUND "Save file %s does not exist."
|
||||
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -1,7 +1,7 @@
|
||||
/**********************************************************************************
|
||||
Snes9x - Portable Super Nintendo Entertainment System (TM) emulator.
|
||||
|
||||
(c) Copyright 1996 - 2002 Gary Henderson (gary.henderson@ntlworld.com) and
|
||||
(c) Copyright 1996 - 2002 Gary Henderson (gary.henderson@ntlworld.com),
|
||||
Jerremy Koot (jkoot@snes9x.com)
|
||||
|
||||
(c) Copyright 2002 - 2004 Matthew Kendora
|
||||
@ -12,12 +12,16 @@
|
||||
|
||||
(c) Copyright 2001 - 2006 John Weidman (jweidman@slip.net)
|
||||
|
||||
(c) Copyright 2002 - 2006 Brad Jorsch (anomie@users.sourceforge.net),
|
||||
funkyass (funkyass@spam.shaw.ca),
|
||||
Kris Bleakley (codeviolation@hotmail.com),
|
||||
Nach (n-a-c-h@users.sourceforge.net), and
|
||||
(c) Copyright 2002 - 2006 funkyass (funkyass@spam.shaw.ca),
|
||||
Kris Bleakley (codeviolation@hotmail.com)
|
||||
|
||||
(c) Copyright 2002 - 2007 Brad Jorsch (anomie@users.sourceforge.net),
|
||||
Nach (n-a-c-h@users.sourceforge.net),
|
||||
zones (kasumitokoduck@yahoo.com)
|
||||
|
||||
(c) Copyright 2006 - 2007 nitsuja
|
||||
|
||||
|
||||
BS-X C emulator code
|
||||
(c) Copyright 2005 - 2006 Dreamer Nom,
|
||||
zones
|
||||
@ -110,17 +114,30 @@
|
||||
2xSaI filter
|
||||
(c) Copyright 1999 - 2001 Derek Liauw Kie Fa
|
||||
|
||||
HQ2x filter
|
||||
HQ2x, HQ3x, HQ4x filters
|
||||
(c) Copyright 2003 Maxim Stepin (maxim@hiend3d.com)
|
||||
|
||||
Win32 GUI code
|
||||
(c) Copyright 2003 - 2006 blip,
|
||||
funkyass,
|
||||
Matthew Kendora,
|
||||
Nach,
|
||||
nitsuja
|
||||
|
||||
Mac OS GUI code
|
||||
(c) Copyright 1998 - 2001 John Stiles
|
||||
(c) Copyright 2001 - 2007 zones
|
||||
|
||||
|
||||
Specific ports contains the works of other authors. See headers in
|
||||
individual files.
|
||||
|
||||
|
||||
Snes9x homepage: http://www.snes9x.com
|
||||
|
||||
Permission to use, copy, modify and/or distribute Snes9x in both binary
|
||||
and source form, for non-commercial purposes, is hereby granted without
|
||||
fee, providing that this license information and copyright notice appear
|
||||
and source form, for non-commercial purposes, is hereby granted without
|
||||
fee, providing that this license information and copyright notice appear
|
||||
with all copies and any derived work.
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
@ -142,191 +159,242 @@
|
||||
**********************************************************************************/
|
||||
|
||||
|
||||
|
||||
#ifndef _memmap_h_
|
||||
#define _memmap_h_
|
||||
|
||||
#include "snes9x.h"
|
||||
|
||||
#define MEMMAP_BLOCK_SIZE (0x1000)
|
||||
#define MEMMAP_NUM_BLOCKS (0x1000000 / MEMMAP_BLOCK_SIZE)
|
||||
#define MEMMAP_BLOCKS_PER_BANK (0x10000 / MEMMAP_BLOCK_SIZE)
|
||||
#define MEMMAP_SHIFT 12
|
||||
#define MEMMAP_MASK (MEMMAP_BLOCK_SIZE - 1)
|
||||
#define MEMMAP_MAX_SDD1_LOGGED_ENTRIES (0x10000 / 8)
|
||||
#define MEMMAP_BLOCK_SIZE (0x1000)
|
||||
#define MEMMAP_NUM_BLOCKS (0x1000000 / MEMMAP_BLOCK_SIZE)
|
||||
#define MEMMAP_SHIFT (12)
|
||||
#define MEMMAP_MASK (MEMMAP_BLOCK_SIZE - 1)
|
||||
#define MEMMAP_MAX_SDD1_LOGGED_ENTRIES (0x10000 / 8)
|
||||
|
||||
//Extended ROM Formats
|
||||
#define NOPE 0
|
||||
#define YEAH 1
|
||||
#define BIGFIRST 2
|
||||
#define SMALLFIRST 3
|
||||
struct CMemory
|
||||
{
|
||||
enum
|
||||
{ MAX_ROM_SIZE = 0x800000 };
|
||||
|
||||
//File Formats go here
|
||||
enum file_formats { FILE_ZIP, FILE_RAR, FILE_JMA, FILE_DEFAULT };
|
||||
enum file_formats
|
||||
{ FILE_ZIP, FILE_JMA, FILE_DEFAULT };
|
||||
|
||||
class CMemory {
|
||||
public:
|
||||
bool8 LoadROM (const char *);
|
||||
uint32 FileLoader (uint8* buffer, const char* filename, int32 maxsize);
|
||||
void InitROM (bool8);
|
||||
bool8 LoadSRAM (const char *);
|
||||
bool8 SaveSRAM (const char *);
|
||||
bool8 Init ();
|
||||
void Deinit ();
|
||||
void FreeSDD1Data ();
|
||||
|
||||
void WriteProtectROM ();
|
||||
void FixROMSpeed ();
|
||||
void MapRAM ();
|
||||
void MapExtraRAM ();
|
||||
char *Safe (const char *);
|
||||
char *SafeANK (const char *);
|
||||
|
||||
void JumboLoROMMap (bool8);
|
||||
void LoROMMap ();
|
||||
void LoROM24MBSMap ();
|
||||
void SRAM512KLoROMMap ();
|
||||
// void SRAM1024KLoROMMap ();
|
||||
void SufamiTurboLoROMMap ();
|
||||
void HiROMMap ();
|
||||
void SuperFXROMMap ();
|
||||
void TalesROMMap (bool8);
|
||||
void AlphaROMMap ();
|
||||
void SA1ROMMap ();
|
||||
void SPC7110HiROMMap();
|
||||
void SPC7110Sram(uint8);
|
||||
void SetaDSPMap();
|
||||
bool8 AllASCII (uint8 *b, int size);
|
||||
int ScoreHiROM (bool8 skip_header, int32 offset=0);
|
||||
int ScoreLoROM (bool8 skip_header, int32 offset=0);
|
||||
#if 0
|
||||
void SufamiTurboAltROMMap();
|
||||
#endif
|
||||
void ApplyROMFixes ();
|
||||
void CheckForIPSPatch (const char *rom_filename, bool8 header,
|
||||
int32 &rom_size);
|
||||
|
||||
const char *TVStandard ();
|
||||
const char *Speed ();
|
||||
const char *StaticRAMSize ();
|
||||
const char *MapType ();
|
||||
const char *MapMode ();
|
||||
const char *KartContents ();
|
||||
const char *Size ();
|
||||
const char *Headers ();
|
||||
const char *ROMID ();
|
||||
const char *CompanyID ();
|
||||
void ParseSNESHeader(uint8*);
|
||||
enum {
|
||||
MAP_PPU, MAP_CPU, MAP_DSP, MAP_LOROM_SRAM, MAP_HIROM_SRAM,
|
||||
MAP_NONE, MAP_DEBUG, MAP_C4, MAP_BWRAM, MAP_BWRAM_BITMAP,
|
||||
MAP_BWRAM_BITMAP2, MAP_SA1RAM, MAP_SPC7110_ROM, MAP_SPC7110_DRAM,
|
||||
MAP_RONLY_SRAM, MAP_OBC_RAM, MAP_SETA_DSP, MAP_SETA_RISC, MAP_BSX, MAP_LAST
|
||||
};
|
||||
enum { MAX_ROM_SIZE = 0x800000 };
|
||||
|
||||
uint8 *RAM;
|
||||
uint8 *ROM;
|
||||
uint8 *VRAM;
|
||||
uint8 *SRAM;
|
||||
uint8 *BWRAM;
|
||||
uint8 *FillRAM;
|
||||
uint8 *C4RAM;
|
||||
bool8 HiROM;
|
||||
bool8 LoROM;
|
||||
uint32 SRAMMask;
|
||||
uint8 SRAMSize;
|
||||
uint8 *Map [MEMMAP_NUM_BLOCKS];
|
||||
uint8 *WriteMap [MEMMAP_NUM_BLOCKS];
|
||||
uint8 MemorySpeed [MEMMAP_NUM_BLOCKS];
|
||||
uint8 BlockIsRAM [MEMMAP_NUM_BLOCKS];
|
||||
uint8 BlockIsROM [MEMMAP_NUM_BLOCKS];
|
||||
char ROMName [ROM_NAME_LEN];
|
||||
char RawROMName [ROM_NAME_LEN];
|
||||
char ROMId [5];
|
||||
char CompanyId [3];
|
||||
uint8 ROMSpeed;
|
||||
uint8 ROMType;
|
||||
uint8 ROMSize;
|
||||
int32 ROMFramesPerSecond;
|
||||
int32 HeaderCount;
|
||||
uint32 CalculatedSize;
|
||||
uint32 CalculatedChecksum;
|
||||
uint32 ROMChecksum;
|
||||
uint32 ROMComplementChecksum;
|
||||
uint8 *SDD1Index;
|
||||
uint8 *SDD1Data;
|
||||
uint32 SDD1Entries;
|
||||
uint32 SDD1LoggedDataCountPrev;
|
||||
uint32 SDD1LoggedDataCount;
|
||||
uint8 SDD1LoggedData [MEMMAP_MAX_SDD1_LOGGED_ENTRIES];
|
||||
char ROMFilename [_MAX_PATH];
|
||||
uint8 ROMRegion;
|
||||
uint32 ROMCRC32;
|
||||
uint8 ExtendedFormat;
|
||||
#if 0
|
||||
bool8 SufamiTurbo;
|
||||
char Slot1Filename [_MAX_PATH];
|
||||
char Slot2Filename [_MAX_PATH];
|
||||
uint8* ROMOffset1;
|
||||
uint8* ROMOffset2;
|
||||
uint8* SRAMOffset1;
|
||||
uint8* SRAMOffset2;
|
||||
uint32 Slot1Size;
|
||||
uint32 Slot2Size;
|
||||
uint32 Slot1SRAMSize;
|
||||
uint32 Slot2SRAMSize;
|
||||
uint8 SlotContents;
|
||||
#endif
|
||||
uint8 *BSRAM;
|
||||
uint8 *BIOSROM;
|
||||
void ResetSpeedMap();
|
||||
#if 0
|
||||
bool8 LoadMulti (const char *,const char *,const char *);
|
||||
#endif
|
||||
enum
|
||||
{ NOPE, YEAH, BIGFIRST, SMALLFIRST };
|
||||
|
||||
enum
|
||||
{ MAP_TYPE_I_O, MAP_TYPE_ROM, MAP_TYPE_RAM };
|
||||
|
||||
enum
|
||||
{
|
||||
MAP_PPU,
|
||||
MAP_CPU,
|
||||
MAP_LOROM_SRAM,
|
||||
MAP_LOROM_SRAM_B,
|
||||
MAP_HIROM_SRAM,
|
||||
MAP_DSP,
|
||||
MAP_C4,
|
||||
MAP_BWRAM,
|
||||
MAP_BWRAM_BITMAP,
|
||||
MAP_BWRAM_BITMAP2,
|
||||
MAP_SA1RAM,
|
||||
MAP_SPC7110_ROM,
|
||||
MAP_SPC7110_DRAM,
|
||||
MAP_RONLY_SRAM,
|
||||
MAP_OBC_RAM,
|
||||
MAP_SETA_DSP,
|
||||
MAP_SETA_RISC,
|
||||
MAP_BSX,
|
||||
MAP_NONE,
|
||||
MAP_DEBUG,
|
||||
MAP_LAST
|
||||
};
|
||||
|
||||
uint8 NSRTHeader[32];
|
||||
int32 HeaderCount;
|
||||
|
||||
uint8 *RAM;
|
||||
uint8 *ROM;
|
||||
uint8 *SRAM;
|
||||
uint8 *VRAM;
|
||||
uint8 *FillRAM;
|
||||
uint8 *BWRAM;
|
||||
uint8 *C4RAM;
|
||||
uint8 *BSRAM;
|
||||
uint8 *BIOSROM;
|
||||
|
||||
uint8 *Map[MEMMAP_NUM_BLOCKS];
|
||||
uint8 *WriteMap[MEMMAP_NUM_BLOCKS];
|
||||
uint8 BlockIsRAM[MEMMAP_NUM_BLOCKS];
|
||||
uint8 BlockIsROM[MEMMAP_NUM_BLOCKS];
|
||||
uint8 MemorySpeed[MEMMAP_NUM_BLOCKS];
|
||||
uint8 ExtendedFormat;
|
||||
|
||||
char ROMFilename[_MAX_PATH + 1];
|
||||
char ROMName[ROM_NAME_LEN];
|
||||
char RawROMName[ROM_NAME_LEN];
|
||||
char ROMId[5];
|
||||
char CompanyId[3];
|
||||
uint8 ROMRegion;
|
||||
uint8 ROMSpeed;
|
||||
uint8 ROMType;
|
||||
uint8 ROMSize;
|
||||
uint32 ROMChecksum;
|
||||
uint32 ROMComplementChecksum;
|
||||
uint32 ROMCRC32;
|
||||
int32 ROMFramesPerSecond;
|
||||
|
||||
bool8 HiROM;
|
||||
bool8 LoROM;
|
||||
uint8 SRAMSize;
|
||||
uint32 SRAMMask;
|
||||
uint32 CalculatedSize;
|
||||
uint32 CalculatedChecksum;
|
||||
|
||||
uint8 *SDD1Index;
|
||||
uint8 *SDD1Data;
|
||||
uint32 SDD1Entries;
|
||||
uint32 SDD1LoggedDataCountPrev;
|
||||
uint32 SDD1LoggedDataCount;
|
||||
uint8 SDD1LoggedData[MEMMAP_MAX_SDD1_LOGGED_ENTRIES];
|
||||
|
||||
// ports can assign this to perform some custom action upon loading a ROM (such as adjusting controls)
|
||||
void (*PostRomInitFunc) ();
|
||||
|
||||
bool8 Init (void);
|
||||
void Deinit (void);
|
||||
void FreeSDD1Data (void);
|
||||
|
||||
int ScoreHiROM (bool8, int32 romoff = 0);
|
||||
int ScoreLoROM (bool8, int32 romoff = 0);
|
||||
uint32 HeaderRemove (uint32, int32 &, uint8 *);
|
||||
uint32 FileLoader (uint8 *, const char *, int32);
|
||||
bool8 LoadROM (const char *);
|
||||
bool8 LoadMultiCart (const char *, const char *);
|
||||
bool8 LoadSufamiTurbo (const char *, const char *);
|
||||
bool8 LoadSameGame (const char *, const char *);
|
||||
bool8 LoadLastROM (void);
|
||||
bool8 LoadSRAM (const char *);
|
||||
bool8 SaveSRAM (const char *);
|
||||
void ClearSRAM (bool8 onlyNonSavedSRAM = 0);
|
||||
|
||||
char * Safe (const char *);
|
||||
char * SafeANK (const char *);
|
||||
void ParseSNESHeader (uint8 *);
|
||||
void InitROM (void);
|
||||
void FixROMSpeed (void);
|
||||
void ResetSpeedMap (void);
|
||||
|
||||
uint32 map_mirror (uint32, uint32);
|
||||
void map_lorom (uint32, uint32, uint32, uint32, uint32);
|
||||
void map_hirom (uint32, uint32, uint32, uint32, uint32);
|
||||
void map_lorom_offset (uint32, uint32, uint32, uint32, uint32, uint32);
|
||||
void map_hirom_offset (uint32, uint32, uint32, uint32, uint32, uint32);
|
||||
void map_space (uint32, uint32, uint32, uint32, uint8 *);
|
||||
void map_index (uint32, uint32, uint32, uint32, int, int);
|
||||
void map_System (void);
|
||||
void map_WRAM (void);
|
||||
void map_LoROMSRAM (void);
|
||||
void map_HiROMSRAM (void);
|
||||
void map_DSP (void);
|
||||
void map_C4 (void);
|
||||
void map_OBC1 (void);
|
||||
void map_SetaRISC (void);
|
||||
void map_SetaDSP (void);
|
||||
void map_WriteProtectROM (void);
|
||||
void Map_Initialize (void);
|
||||
void Map_LoROMMap (void);
|
||||
void Map_NoMAD1LoROMMap (void);
|
||||
void Map_JumboLoROMMap (void);
|
||||
void Map_ROM24MBSLoROMMap (void);
|
||||
void Map_SRAM512KLoROMMap (void);
|
||||
void Map_SufamiTurboLoROMMap (void);
|
||||
void Map_SufamiTurboPseudoLoROMMap (void);
|
||||
void Map_SuperFXLoROMMap (void);
|
||||
void Map_SetaDSPLoROMMap (void);
|
||||
void Map_SDD1LoROMMap (void);
|
||||
void Map_SA1LoROMMap (void);
|
||||
void Map_HiROMMap (void);
|
||||
void Map_ExtendedHiROMMap (void);
|
||||
void Map_SameGameHiROMMap (void);
|
||||
void Map_SPC7110HiROMMap (void);
|
||||
|
||||
uint16 checksum_calc_sum (uint8 *, uint32);
|
||||
uint16 checksum_mirror_sum (uint8 *, uint32 &, uint32 mask = 0x800000);
|
||||
void Checksum_Calculate (void);
|
||||
|
||||
bool8 match_na (const char *);
|
||||
bool8 match_nn (const char *);
|
||||
bool8 match_nc (const char *);
|
||||
bool8 match_id (const char *);
|
||||
void ApplyROMFixes (void);
|
||||
void CheckForIPSPatch (const char *, bool8, int32 &);
|
||||
|
||||
const char * TVStandard (void);
|
||||
const char * MapType (void);
|
||||
const char * MapMode (void);
|
||||
const char * StaticRAMSize (void);
|
||||
const char * Size (void);
|
||||
const char * Revision (void);
|
||||
const char * KartContents (void);
|
||||
};
|
||||
|
||||
struct SMulti
|
||||
{
|
||||
int cartType;
|
||||
int32 cartSizeA, cartSizeB;
|
||||
int32 sramSizeA, sramSizeB;
|
||||
uint32 sramMaskA, sramMaskB;
|
||||
uint32 cartOffsetA, cartOffsetB;
|
||||
uint8 *sramA, *sramB;
|
||||
char fileNameA[_MAX_PATH + 1], fileNameB[_MAX_PATH + 1];
|
||||
};
|
||||
|
||||
START_EXTERN_C
|
||||
extern CMemory Memory;
|
||||
extern uint8 *SRAM;
|
||||
extern uint8 *ROM;
|
||||
extern uint8 *RegRAM;
|
||||
void S9xDeinterleaveMode2 ();
|
||||
bool8 LoadZip(const char* zipname,
|
||||
int32 *TotalFileSize,
|
||||
int32 *headers,
|
||||
uint8 *buffer);
|
||||
extern CMemory Memory;
|
||||
extern SMulti Multi;
|
||||
#if defined(ZSNES_FX) || defined(ZSNES_C4)
|
||||
extern uint8 *ROM;
|
||||
extern uint8 *SRAM;
|
||||
extern uint8 *RegRAM;
|
||||
#endif
|
||||
bool8 LoadZip(const char *, int32 *, int32 *, uint8 *);
|
||||
END_EXTERN_C
|
||||
|
||||
void S9xAutoSaveSRAM ();
|
||||
void S9xAutoSaveSRAM (void);
|
||||
|
||||
|
||||
enum s9xwrap_t {
|
||||
WRAP_NONE,
|
||||
WRAP_BANK,
|
||||
WRAP_PAGE
|
||||
enum s9xwrap_t
|
||||
{
|
||||
WRAP_NONE,
|
||||
WRAP_BANK,
|
||||
WRAP_PAGE
|
||||
};
|
||||
|
||||
enum s9xwriteorder_t {
|
||||
WRITE_01,
|
||||
WRITE_10
|
||||
enum s9xwriteorder_t
|
||||
{
|
||||
WRITE_01,
|
||||
WRITE_10
|
||||
};
|
||||
|
||||
#ifdef NO_INLINE_SET_GET
|
||||
uint8 S9xGetByte (uint32 Address);
|
||||
uint16 S9xGetWord (uint32 Address, enum s9xwrap_t w=WRAP_NONE);
|
||||
void S9xSetByte (uint8 Byte, uint32 Address);
|
||||
void S9xSetWord (uint16 Word, uint32 Address, enum s9xwrap_t w=WRAP_NONE, enum s9xwriteorder_t o=WRITE_01);
|
||||
void S9xSetPCBase (uint32 Address);
|
||||
uint8 *S9xGetMemPointer (uint32 Address);
|
||||
uint8 *GetBasePointer (uint32 Address);
|
||||
|
||||
uint8 S9xGetByte (uint32);
|
||||
uint16 S9xGetWord (uint32, enum s9xwrap_t w = WRAP_NONE);
|
||||
void S9xSetByte (uint8, uint32);
|
||||
void S9xSetWord (uint16, uint32, enum s9xwrap_t w = WRAP_NONE, enum s9xwriteorder_t o = WRITE_01);
|
||||
void S9xSetPCBase (uint32);
|
||||
uint8 * S9xGetMemPointer (uint32);
|
||||
uint8 * GetBasePointer (uint32);
|
||||
|
||||
START_EXTERN_C
|
||||
extern uint8 OpenBus;
|
||||
extern uint8 OpenBus;
|
||||
END_EXTERN_C
|
||||
|
||||
#else
|
||||
|
||||
#define INLINE inline
|
||||
#include "getset.h"
|
||||
|
||||
#endif // NO_INLINE_SET_GET
|
||||
|
||||
#endif // _memmap_h_
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
/**********************************************************************************
|
||||
Snes9x - Portable Super Nintendo Entertainment System (TM) emulator.
|
||||
|
||||
(c) Copyright 1996 - 2002 Gary Henderson (gary.henderson@ntlworld.com) and
|
||||
(c) Copyright 1996 - 2002 Gary Henderson (gary.henderson@ntlworld.com),
|
||||
Jerremy Koot (jkoot@snes9x.com)
|
||||
|
||||
(c) Copyright 2002 - 2004 Matthew Kendora
|
||||
@ -12,12 +12,16 @@
|
||||
|
||||
(c) Copyright 2001 - 2006 John Weidman (jweidman@slip.net)
|
||||
|
||||
(c) Copyright 2002 - 2006 Brad Jorsch (anomie@users.sourceforge.net),
|
||||
funkyass (funkyass@spam.shaw.ca),
|
||||
Kris Bleakley (codeviolation@hotmail.com),
|
||||
Nach (n-a-c-h@users.sourceforge.net), and
|
||||
(c) Copyright 2002 - 2006 funkyass (funkyass@spam.shaw.ca),
|
||||
Kris Bleakley (codeviolation@hotmail.com)
|
||||
|
||||
(c) Copyright 2002 - 2007 Brad Jorsch (anomie@users.sourceforge.net),
|
||||
Nach (n-a-c-h@users.sourceforge.net),
|
||||
zones (kasumitokoduck@yahoo.com)
|
||||
|
||||
(c) Copyright 2006 - 2007 nitsuja
|
||||
|
||||
|
||||
BS-X C emulator code
|
||||
(c) Copyright 2005 - 2006 Dreamer Nom,
|
||||
zones
|
||||
@ -110,17 +114,30 @@
|
||||
2xSaI filter
|
||||
(c) Copyright 1999 - 2001 Derek Liauw Kie Fa
|
||||
|
||||
HQ2x filter
|
||||
HQ2x, HQ3x, HQ4x filters
|
||||
(c) Copyright 2003 Maxim Stepin (maxim@hiend3d.com)
|
||||
|
||||
Win32 GUI code
|
||||
(c) Copyright 2003 - 2006 blip,
|
||||
funkyass,
|
||||
Matthew Kendora,
|
||||
Nach,
|
||||
nitsuja
|
||||
|
||||
Mac OS GUI code
|
||||
(c) Copyright 1998 - 2001 John Stiles
|
||||
(c) Copyright 2001 - 2007 zones
|
||||
|
||||
|
||||
Specific ports contains the works of other authors. See headers in
|
||||
individual files.
|
||||
|
||||
|
||||
Snes9x homepage: http://www.snes9x.com
|
||||
|
||||
Permission to use, copy, modify and/or distribute Snes9x in both binary
|
||||
and source form, for non-commercial purposes, is hereby granted without
|
||||
fee, providing that this license information and copyright notice appear
|
||||
and source form, for non-commercial purposes, is hereby granted without
|
||||
fee, providing that this license information and copyright notice appear
|
||||
with all copies and any derived work.
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
@ -142,6 +159,8 @@
|
||||
**********************************************************************************/
|
||||
|
||||
|
||||
|
||||
|
||||
#ifndef _messages_h_
|
||||
#define _messages_h_
|
||||
|
||||
@ -186,6 +205,7 @@ enum {
|
||||
S9X_MOVIE_INFO,
|
||||
S9X_WRONG_MOVIE_SNAPSHOT,
|
||||
S9X_NOT_A_MOVIE_SNAPSHOT,
|
||||
S9X_SNAPSHOT_INCONSISTENT,
|
||||
S9X_AVI_INFO
|
||||
};
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
/**********************************************************************************
|
||||
Snes9x - Portable Super Nintendo Entertainment System (TM) emulator.
|
||||
|
||||
(c) Copyright 1996 - 2002 Gary Henderson (gary.henderson@ntlworld.com) and
|
||||
(c) Copyright 1996 - 2002 Gary Henderson (gary.henderson@ntlworld.com),
|
||||
Jerremy Koot (jkoot@snes9x.com)
|
||||
|
||||
(c) Copyright 2002 - 2004 Matthew Kendora
|
||||
@ -12,12 +12,16 @@
|
||||
|
||||
(c) Copyright 2001 - 2006 John Weidman (jweidman@slip.net)
|
||||
|
||||
(c) Copyright 2002 - 2006 Brad Jorsch (anomie@users.sourceforge.net),
|
||||
funkyass (funkyass@spam.shaw.ca),
|
||||
Kris Bleakley (codeviolation@hotmail.com),
|
||||
Nach (n-a-c-h@users.sourceforge.net), and
|
||||
(c) Copyright 2002 - 2006 funkyass (funkyass@spam.shaw.ca),
|
||||
Kris Bleakley (codeviolation@hotmail.com)
|
||||
|
||||
(c) Copyright 2002 - 2007 Brad Jorsch (anomie@users.sourceforge.net),
|
||||
Nach (n-a-c-h@users.sourceforge.net),
|
||||
zones (kasumitokoduck@yahoo.com)
|
||||
|
||||
(c) Copyright 2006 - 2007 nitsuja
|
||||
|
||||
|
||||
BS-X C emulator code
|
||||
(c) Copyright 2005 - 2006 Dreamer Nom,
|
||||
zones
|
||||
@ -110,17 +114,30 @@
|
||||
2xSaI filter
|
||||
(c) Copyright 1999 - 2001 Derek Liauw Kie Fa
|
||||
|
||||
HQ2x filter
|
||||
HQ2x, HQ3x, HQ4x filters
|
||||
(c) Copyright 2003 Maxim Stepin (maxim@hiend3d.com)
|
||||
|
||||
Win32 GUI code
|
||||
(c) Copyright 2003 - 2006 blip,
|
||||
funkyass,
|
||||
Matthew Kendora,
|
||||
Nach,
|
||||
nitsuja
|
||||
|
||||
Mac OS GUI code
|
||||
(c) Copyright 1998 - 2001 John Stiles
|
||||
(c) Copyright 2001 - 2007 zones
|
||||
|
||||
|
||||
Specific ports contains the works of other authors. See headers in
|
||||
individual files.
|
||||
|
||||
|
||||
Snes9x homepage: http://www.snes9x.com
|
||||
|
||||
Permission to use, copy, modify and/or distribute Snes9x in both binary
|
||||
and source form, for non-commercial purposes, is hereby granted without
|
||||
fee, providing that this license information and copyright notice appear
|
||||
and source form, for non-commercial purposes, is hereby granted without
|
||||
fee, providing that this license information and copyright notice appear
|
||||
with all copies and any derived work.
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
@ -142,6 +159,8 @@
|
||||
**********************************************************************************/
|
||||
|
||||
|
||||
|
||||
|
||||
#ifndef _MISSING_H_
|
||||
#define _MISSING_H_
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
/**********************************************************************************
|
||||
Snes9x - Portable Super Nintendo Entertainment System (TM) emulator.
|
||||
|
||||
(c) Copyright 1996 - 2002 Gary Henderson (gary.henderson@ntlworld.com) and
|
||||
(c) Copyright 1996 - 2002 Gary Henderson (gary.henderson@ntlworld.com),
|
||||
Jerremy Koot (jkoot@snes9x.com)
|
||||
|
||||
(c) Copyright 2002 - 2004 Matthew Kendora
|
||||
@ -12,12 +12,16 @@
|
||||
|
||||
(c) Copyright 2001 - 2006 John Weidman (jweidman@slip.net)
|
||||
|
||||
(c) Copyright 2002 - 2006 Brad Jorsch (anomie@users.sourceforge.net),
|
||||
funkyass (funkyass@spam.shaw.ca),
|
||||
Kris Bleakley (codeviolation@hotmail.com),
|
||||
Nach (n-a-c-h@users.sourceforge.net), and
|
||||
(c) Copyright 2002 - 2006 funkyass (funkyass@spam.shaw.ca),
|
||||
Kris Bleakley (codeviolation@hotmail.com)
|
||||
|
||||
(c) Copyright 2002 - 2007 Brad Jorsch (anomie@users.sourceforge.net),
|
||||
Nach (n-a-c-h@users.sourceforge.net),
|
||||
zones (kasumitokoduck@yahoo.com)
|
||||
|
||||
(c) Copyright 2006 - 2007 nitsuja
|
||||
|
||||
|
||||
BS-X C emulator code
|
||||
(c) Copyright 2005 - 2006 Dreamer Nom,
|
||||
zones
|
||||
@ -110,17 +114,30 @@
|
||||
2xSaI filter
|
||||
(c) Copyright 1999 - 2001 Derek Liauw Kie Fa
|
||||
|
||||
HQ2x filter
|
||||
HQ2x, HQ3x, HQ4x filters
|
||||
(c) Copyright 2003 Maxim Stepin (maxim@hiend3d.com)
|
||||
|
||||
Win32 GUI code
|
||||
(c) Copyright 2003 - 2006 blip,
|
||||
funkyass,
|
||||
Matthew Kendora,
|
||||
Nach,
|
||||
nitsuja
|
||||
|
||||
Mac OS GUI code
|
||||
(c) Copyright 1998 - 2001 John Stiles
|
||||
(c) Copyright 2001 - 2007 zones
|
||||
|
||||
|
||||
Specific ports contains the works of other authors. See headers in
|
||||
individual files.
|
||||
|
||||
|
||||
Snes9x homepage: http://www.snes9x.com
|
||||
|
||||
Permission to use, copy, modify and/or distribute Snes9x in both binary
|
||||
and source form, for non-commercial purposes, is hereby granted without
|
||||
fee, providing that this license information and copyright notice appear
|
||||
and source form, for non-commercial purposes, is hereby granted without
|
||||
fee, providing that this license information and copyright notice appear
|
||||
with all copies and any derived work.
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
@ -141,6 +158,8 @@
|
||||
Nintendo Co., Limited and its subsidiary companies.
|
||||
**********************************************************************************/
|
||||
|
||||
|
||||
|
||||
#include <string.h>
|
||||
#include "memmap.h"
|
||||
#include "obc1.h"
|
||||
@ -158,18 +177,18 @@ uint8 GetOBC1 (uint16 Address)
|
||||
switch(Address) {
|
||||
case 0x7ff0:
|
||||
return OBC1_RAM[OBC1_BasePtr + (OBC1_Address << 2)];
|
||||
|
||||
|
||||
case 0x7ff1:
|
||||
return OBC1_RAM[OBC1_BasePtr + (OBC1_Address << 2) + 1];
|
||||
|
||||
|
||||
case 0x7ff2:
|
||||
return OBC1_RAM[OBC1_BasePtr + (OBC1_Address << 2) + 2];
|
||||
|
||||
|
||||
case 0x7ff3:
|
||||
return OBC1_RAM[OBC1_BasePtr + (OBC1_Address << 2) + 3];
|
||||
|
||||
|
||||
case 0x7ff4:
|
||||
return OBC1_RAM[OBC1_BasePtr + (OBC1_Address >> 2) + 0x200];
|
||||
return OBC1_RAM[OBC1_BasePtr + (OBC1_Address >> 2) + 0x200];
|
||||
}
|
||||
|
||||
return OBC1_RAM[Address & 0x1fff];
|
||||
@ -183,51 +202,51 @@ void SetOBC1 (uint8 Byte, uint16 Address)
|
||||
OBC1_RAM[OBC1_BasePtr + (OBC1_Address << 2)] = Byte;
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
case 0x7ff1:
|
||||
{
|
||||
OBC1_RAM[OBC1_BasePtr + (OBC1_Address << 2) + 1] = Byte;
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
case 0x7ff2:
|
||||
{
|
||||
OBC1_RAM[OBC1_BasePtr + (OBC1_Address << 2) + 2] = Byte;
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
case 0x7ff3:
|
||||
{
|
||||
OBC1_RAM[OBC1_BasePtr + (OBC1_Address << 2) + 3] = Byte;
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
case 0x7ff4:
|
||||
{
|
||||
unsigned char Temp;
|
||||
|
||||
Temp = OBC1_RAM[OBC1_BasePtr + (OBC1_Address >> 2) + 0x200];
|
||||
Temp = (Temp & ~(3 << OBC1_Shift)) | ((Byte & 3) << OBC1_Shift);
|
||||
Temp = (Temp & ~(3 << OBC1_Shift)) | ((Byte & 3) << OBC1_Shift);
|
||||
OBC1_RAM[OBC1_BasePtr + (OBC1_Address >> 2) + 0x200] = Temp;
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
case 0x7ff5:
|
||||
{
|
||||
if (Byte & 1)
|
||||
if (Byte & 1)
|
||||
OBC1_BasePtr = 0x1800;
|
||||
else
|
||||
OBC1_BasePtr = 0x1c00;
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
case 0x7ff6:
|
||||
{
|
||||
OBC1_Address = Byte & 0x7f;
|
||||
OBC1_Shift = (Byte & 3) << 1;
|
||||
OBC1_Address = Byte & 0x7f;
|
||||
OBC1_Shift = (Byte & 3) << 1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
OBC1_RAM[Address & 0x1fff] = Byte;
|
||||
@ -253,12 +272,12 @@ void ResetOBC1()
|
||||
{
|
||||
OBC1_RAM = &Memory.FillRAM[0x6000];
|
||||
|
||||
if (OBC1_RAM[0x1ff5] & 1)
|
||||
if (OBC1_RAM[0x1ff5] & 1)
|
||||
OBC1_BasePtr = 0x1800;
|
||||
else
|
||||
OBC1_BasePtr = 0x1c00;
|
||||
|
||||
OBC1_Address = OBC1_RAM[0x1ff6] & 0x7f;
|
||||
OBC1_Address = OBC1_RAM[0x1ff6] & 0x7f;
|
||||
OBC1_Shift = (OBC1_RAM[0x1ff6] & 3) << 1;
|
||||
}
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
/**********************************************************************************
|
||||
Snes9x - Portable Super Nintendo Entertainment System (TM) emulator.
|
||||
|
||||
(c) Copyright 1996 - 2002 Gary Henderson (gary.henderson@ntlworld.com) and
|
||||
(c) Copyright 1996 - 2002 Gary Henderson (gary.henderson@ntlworld.com),
|
||||
Jerremy Koot (jkoot@snes9x.com)
|
||||
|
||||
(c) Copyright 2002 - 2004 Matthew Kendora
|
||||
@ -12,12 +12,16 @@
|
||||
|
||||
(c) Copyright 2001 - 2006 John Weidman (jweidman@slip.net)
|
||||
|
||||
(c) Copyright 2002 - 2006 Brad Jorsch (anomie@users.sourceforge.net),
|
||||
funkyass (funkyass@spam.shaw.ca),
|
||||
Kris Bleakley (codeviolation@hotmail.com),
|
||||
Nach (n-a-c-h@users.sourceforge.net), and
|
||||
(c) Copyright 2002 - 2006 funkyass (funkyass@spam.shaw.ca),
|
||||
Kris Bleakley (codeviolation@hotmail.com)
|
||||
|
||||
(c) Copyright 2002 - 2007 Brad Jorsch (anomie@users.sourceforge.net),
|
||||
Nach (n-a-c-h@users.sourceforge.net),
|
||||
zones (kasumitokoduck@yahoo.com)
|
||||
|
||||
(c) Copyright 2006 - 2007 nitsuja
|
||||
|
||||
|
||||
BS-X C emulator code
|
||||
(c) Copyright 2005 - 2006 Dreamer Nom,
|
||||
zones
|
||||
@ -110,17 +114,30 @@
|
||||
2xSaI filter
|
||||
(c) Copyright 1999 - 2001 Derek Liauw Kie Fa
|
||||
|
||||
HQ2x filter
|
||||
HQ2x, HQ3x, HQ4x filters
|
||||
(c) Copyright 2003 Maxim Stepin (maxim@hiend3d.com)
|
||||
|
||||
Win32 GUI code
|
||||
(c) Copyright 2003 - 2006 blip,
|
||||
funkyass,
|
||||
Matthew Kendora,
|
||||
Nach,
|
||||
nitsuja
|
||||
|
||||
Mac OS GUI code
|
||||
(c) Copyright 1998 - 2001 John Stiles
|
||||
(c) Copyright 2001 - 2007 zones
|
||||
|
||||
|
||||
Specific ports contains the works of other authors. See headers in
|
||||
individual files.
|
||||
|
||||
|
||||
Snes9x homepage: http://www.snes9x.com
|
||||
|
||||
Permission to use, copy, modify and/or distribute Snes9x in both binary
|
||||
and source form, for non-commercial purposes, is hereby granted without
|
||||
fee, providing that this license information and copyright notice appear
|
||||
and source form, for non-commercial purposes, is hereby granted without
|
||||
fee, providing that this license information and copyright notice appear
|
||||
with all copies and any derived work.
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
@ -142,6 +159,8 @@
|
||||
**********************************************************************************/
|
||||
|
||||
|
||||
|
||||
|
||||
#ifndef _OBC1_H_
|
||||
#define _OBC1_H_
|
||||
|
||||
@ -151,7 +170,7 @@ void SetOBC1 (uint8 Byte, uint16 Address);
|
||||
uint8 *GetBasePointerOBC1(uint32 Address);
|
||||
uint8 *GetMemPointerOBC1(uint32 Address);
|
||||
void ResetOBC1();//bool8 full);
|
||||
END_EXTERN_C
|
||||
END_EXTERN_C
|
||||
|
||||
#endif
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
/**********************************************************************************
|
||||
Snes9x - Portable Super Nintendo Entertainment System (TM) emulator.
|
||||
|
||||
(c) Copyright 1996 - 2002 Gary Henderson (gary.henderson@ntlworld.com) and
|
||||
(c) Copyright 1996 - 2002 Gary Henderson (gary.henderson@ntlworld.com),
|
||||
Jerremy Koot (jkoot@snes9x.com)
|
||||
|
||||
(c) Copyright 2002 - 2004 Matthew Kendora
|
||||
@ -12,12 +12,16 @@
|
||||
|
||||
(c) Copyright 2001 - 2006 John Weidman (jweidman@slip.net)
|
||||
|
||||
(c) Copyright 2002 - 2006 Brad Jorsch (anomie@users.sourceforge.net),
|
||||
funkyass (funkyass@spam.shaw.ca),
|
||||
Kris Bleakley (codeviolation@hotmail.com),
|
||||
Nach (n-a-c-h@users.sourceforge.net), and
|
||||
(c) Copyright 2002 - 2006 funkyass (funkyass@spam.shaw.ca),
|
||||
Kris Bleakley (codeviolation@hotmail.com)
|
||||
|
||||
(c) Copyright 2002 - 2007 Brad Jorsch (anomie@users.sourceforge.net),
|
||||
Nach (n-a-c-h@users.sourceforge.net),
|
||||
zones (kasumitokoduck@yahoo.com)
|
||||
|
||||
(c) Copyright 2006 - 2007 nitsuja
|
||||
|
||||
|
||||
BS-X C emulator code
|
||||
(c) Copyright 2005 - 2006 Dreamer Nom,
|
||||
zones
|
||||
@ -110,17 +114,30 @@
|
||||
2xSaI filter
|
||||
(c) Copyright 1999 - 2001 Derek Liauw Kie Fa
|
||||
|
||||
HQ2x filter
|
||||
HQ2x, HQ3x, HQ4x filters
|
||||
(c) Copyright 2003 Maxim Stepin (maxim@hiend3d.com)
|
||||
|
||||
Win32 GUI code
|
||||
(c) Copyright 2003 - 2006 blip,
|
||||
funkyass,
|
||||
Matthew Kendora,
|
||||
Nach,
|
||||
nitsuja
|
||||
|
||||
Mac OS GUI code
|
||||
(c) Copyright 1998 - 2001 John Stiles
|
||||
(c) Copyright 2001 - 2007 zones
|
||||
|
||||
|
||||
Specific ports contains the works of other authors. See headers in
|
||||
individual files.
|
||||
|
||||
|
||||
Snes9x homepage: http://www.snes9x.com
|
||||
|
||||
Permission to use, copy, modify and/or distribute Snes9x in both binary
|
||||
and source form, for non-commercial purposes, is hereby granted without
|
||||
fee, providing that this license information and copyright notice appear
|
||||
and source form, for non-commercial purposes, is hereby granted without
|
||||
fee, providing that this license information and copyright notice appear
|
||||
with all copies and any derived work.
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
@ -142,6 +159,8 @@
|
||||
**********************************************************************************/
|
||||
|
||||
|
||||
|
||||
|
||||
#ifndef _PIXFORM_H_
|
||||
#define _PIXFORM_H_
|
||||
|
||||
@ -196,7 +215,7 @@ extern uint32 HIGH_BITS_SHIFTED_TWO_MASK;
|
||||
#define FIRST_COLOR_MASK_RGB565 0xF800
|
||||
#define SECOND_COLOR_MASK_RGB565 0x07E0
|
||||
#define THIRD_COLOR_MASK_RGB565 0x001F
|
||||
#define ALPHA_BITS_MASK_RGB565 0x0000
|
||||
#define ALPHA_BITS_MASK_RGB565 0x0000
|
||||
|
||||
/* RGB555 format */
|
||||
#define BUILD_PIXEL_RGB555(R,G,B) (((int) (R) << 10) | ((int) (G) << 5) | (int) (B))
|
||||
|
@ -1,7 +1,7 @@
|
||||
/**********************************************************************************
|
||||
Snes9x - Portable Super Nintendo Entertainment System (TM) emulator.
|
||||
|
||||
(c) Copyright 1996 - 2002 Gary Henderson (gary.henderson@ntlworld.com) and
|
||||
(c) Copyright 1996 - 2002 Gary Henderson (gary.henderson@ntlworld.com),
|
||||
Jerremy Koot (jkoot@snes9x.com)
|
||||
|
||||
(c) Copyright 2002 - 2004 Matthew Kendora
|
||||
@ -12,12 +12,16 @@
|
||||
|
||||
(c) Copyright 2001 - 2006 John Weidman (jweidman@slip.net)
|
||||
|
||||
(c) Copyright 2002 - 2006 Brad Jorsch (anomie@users.sourceforge.net),
|
||||
funkyass (funkyass@spam.shaw.ca),
|
||||
Kris Bleakley (codeviolation@hotmail.com),
|
||||
Nach (n-a-c-h@users.sourceforge.net), and
|
||||
(c) Copyright 2002 - 2006 funkyass (funkyass@spam.shaw.ca),
|
||||
Kris Bleakley (codeviolation@hotmail.com)
|
||||
|
||||
(c) Copyright 2002 - 2007 Brad Jorsch (anomie@users.sourceforge.net),
|
||||
Nach (n-a-c-h@users.sourceforge.net),
|
||||
zones (kasumitokoduck@yahoo.com)
|
||||
|
||||
(c) Copyright 2006 - 2007 nitsuja
|
||||
|
||||
|
||||
BS-X C emulator code
|
||||
(c) Copyright 2005 - 2006 Dreamer Nom,
|
||||
zones
|
||||
@ -110,17 +114,30 @@
|
||||
2xSaI filter
|
||||
(c) Copyright 1999 - 2001 Derek Liauw Kie Fa
|
||||
|
||||
HQ2x filter
|
||||
HQ2x, HQ3x, HQ4x filters
|
||||
(c) Copyright 2003 Maxim Stepin (maxim@hiend3d.com)
|
||||
|
||||
Win32 GUI code
|
||||
(c) Copyright 2003 - 2006 blip,
|
||||
funkyass,
|
||||
Matthew Kendora,
|
||||
Nach,
|
||||
nitsuja
|
||||
|
||||
Mac OS GUI code
|
||||
(c) Copyright 1998 - 2001 John Stiles
|
||||
(c) Copyright 2001 - 2007 zones
|
||||
|
||||
|
||||
Specific ports contains the works of other authors. See headers in
|
||||
individual files.
|
||||
|
||||
|
||||
Snes9x homepage: http://www.snes9x.com
|
||||
|
||||
Permission to use, copy, modify and/or distribute Snes9x in both binary
|
||||
and source form, for non-commercial purposes, is hereby granted without
|
||||
fee, providing that this license information and copyright notice appear
|
||||
and source form, for non-commercial purposes, is hereby granted without
|
||||
fee, providing that this license information and copyright notice appear
|
||||
with all copies and any derived work.
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
@ -142,6 +159,8 @@
|
||||
**********************************************************************************/
|
||||
|
||||
|
||||
|
||||
|
||||
#ifndef _PORT_H_
|
||||
#define _PORT_H_
|
||||
|
||||
@ -177,17 +196,17 @@
|
||||
#ifdef _C
|
||||
#undef _C
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef _D
|
||||
#undef _D
|
||||
#endif
|
||||
|
||||
|
||||
#define CHECK_SOUND()
|
||||
#define PIXEL_FORMAT RGB555
|
||||
#undef GFX_MULTI_FORMAT
|
||||
#undef USE_X86_ASM
|
||||
#undef _MAX_PATH
|
||||
|
||||
|
||||
#define SET_UI_COLOR(r,g,b) SetInfoDlgColor(r,g,b)
|
||||
void SetInfoDlgColor(unsigned char, unsigned char, unsigned char);
|
||||
|
||||
@ -234,10 +253,16 @@ typedef long long int64;
|
||||
typedef unsigned long long uint64;
|
||||
#else /* __WIN32__ */
|
||||
|
||||
#ifndef PATH_MAX
|
||||
#define PATH_MAX _MAX_PATH
|
||||
#endif
|
||||
|
||||
# ifdef __BORLANDC__
|
||||
# include <systypes.h>
|
||||
# else
|
||||
|
||||
#define SNES_JOY_READ_CALLBACKS
|
||||
|
||||
typedef unsigned char uint8;
|
||||
typedef unsigned short uint16;
|
||||
typedef signed char int8;
|
||||
@ -345,16 +370,12 @@ EXTERN_C void MixSound(void);
|
||||
|
||||
#if defined(__i386__) || defined(__i486__) || defined(__i586__) || \
|
||||
defined(__x86_64__) || defined(__WIN32__) || defined(__alpha__)
|
||||
//#define LSB_FIRST
|
||||
//#define FAST_LSB_WORD_ACCESS
|
||||
#define LSB_FIRST
|
||||
#define FAST_LSB_WORD_ACCESS
|
||||
#else
|
||||
#define MSB_FIRST
|
||||
#endif
|
||||
|
||||
#ifndef MSB_FIRST
|
||||
#define MSB_FIRST
|
||||
#endif
|
||||
|
||||
#ifdef __sun
|
||||
#define TITLE "Snes9X: Solaris"
|
||||
#endif
|
||||
|
@ -1,7 +1,7 @@
|
||||
/**********************************************************************************
|
||||
Snes9x - Portable Super Nintendo Entertainment System (TM) emulator.
|
||||
|
||||
(c) Copyright 1996 - 2002 Gary Henderson (gary.henderson@ntlworld.com) and
|
||||
(c) Copyright 1996 - 2002 Gary Henderson (gary.henderson@ntlworld.com),
|
||||
Jerremy Koot (jkoot@snes9x.com)
|
||||
|
||||
(c) Copyright 2002 - 2004 Matthew Kendora
|
||||
@ -12,12 +12,16 @@
|
||||
|
||||
(c) Copyright 2001 - 2006 John Weidman (jweidman@slip.net)
|
||||
|
||||
(c) Copyright 2002 - 2006 Brad Jorsch (anomie@users.sourceforge.net),
|
||||
funkyass (funkyass@spam.shaw.ca),
|
||||
Kris Bleakley (codeviolation@hotmail.com),
|
||||
Nach (n-a-c-h@users.sourceforge.net), and
|
||||
(c) Copyright 2002 - 2006 funkyass (funkyass@spam.shaw.ca),
|
||||
Kris Bleakley (codeviolation@hotmail.com)
|
||||
|
||||
(c) Copyright 2002 - 2007 Brad Jorsch (anomie@users.sourceforge.net),
|
||||
Nach (n-a-c-h@users.sourceforge.net),
|
||||
zones (kasumitokoduck@yahoo.com)
|
||||
|
||||
(c) Copyright 2006 - 2007 nitsuja
|
||||
|
||||
|
||||
BS-X C emulator code
|
||||
(c) Copyright 2005 - 2006 Dreamer Nom,
|
||||
zones
|
||||
@ -110,17 +114,30 @@
|
||||
2xSaI filter
|
||||
(c) Copyright 1999 - 2001 Derek Liauw Kie Fa
|
||||
|
||||
HQ2x filter
|
||||
HQ2x, HQ3x, HQ4x filters
|
||||
(c) Copyright 2003 Maxim Stepin (maxim@hiend3d.com)
|
||||
|
||||
Win32 GUI code
|
||||
(c) Copyright 2003 - 2006 blip,
|
||||
funkyass,
|
||||
Matthew Kendora,
|
||||
Nach,
|
||||
nitsuja
|
||||
|
||||
Mac OS GUI code
|
||||
(c) Copyright 1998 - 2001 John Stiles
|
||||
(c) Copyright 2001 - 2007 zones
|
||||
|
||||
|
||||
Specific ports contains the works of other authors. See headers in
|
||||
individual files.
|
||||
|
||||
|
||||
Snes9x homepage: http://www.snes9x.com
|
||||
|
||||
Permission to use, copy, modify and/or distribute Snes9x in both binary
|
||||
and source form, for non-commercial purposes, is hereby granted without
|
||||
fee, providing that this license information and copyright notice appear
|
||||
and source form, for non-commercial purposes, is hereby granted without
|
||||
fee, providing that this license information and copyright notice appear
|
||||
with all copies and any derived work.
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
@ -142,6 +159,8 @@
|
||||
**********************************************************************************/
|
||||
|
||||
|
||||
|
||||
|
||||
#include "snes9x.h"
|
||||
#include "memmap.h"
|
||||
#include "ppu.h"
|
||||
@ -152,17 +171,15 @@
|
||||
#include "gfx.h"
|
||||
#include "display.h"
|
||||
#include "sa1.h"
|
||||
|
||||
#ifndef NGC
|
||||
#include "netplay.h"
|
||||
#endif
|
||||
|
||||
#include "sdd1.h"
|
||||
#include "srtc.h"
|
||||
#include "spc7110.h"
|
||||
#include "bsx.h"
|
||||
#include "movie.h"
|
||||
//#include "movie.h"
|
||||
#include "controls.h"
|
||||
#ifdef NETPLAY_SUPPORT
|
||||
#include "netplay.h"
|
||||
#endif
|
||||
|
||||
#ifndef ZSNES_FX
|
||||
#include "fxemu.h"
|
||||
@ -193,23 +210,23 @@ static inline void S9xLatchCounters (bool force)
|
||||
#endif
|
||||
PPU.HVBeamCounterLatched = 1;
|
||||
PPU.VBeamPosLatched = (uint16) CPU.V_Counter;
|
||||
|
||||
|
||||
// From byuu:
|
||||
// All dots are 4 cycles long, except dots 322 and 326. dots 322 and 326 are 6 cycles long.
|
||||
// All dots are 4 cycles long, except dots 322 and 326. dots 322 and 326 are 6 cycles long.
|
||||
// This holds true for all scanlines except scanline 240 on non-interlace odd frames.
|
||||
// The reason for this is because this scanline is only 1360 cycles long,
|
||||
// instead of 1364 like all other scanlines.
|
||||
// This makes the effective range of hscan_pos 0-339 at all times.
|
||||
int32 hc = CPU.Cycles;
|
||||
|
||||
|
||||
if (Timings.H_Max == Timings.H_Max_Master) // 1364
|
||||
{
|
||||
{
|
||||
if (hc >= 1292)
|
||||
hc -= (ONE_DOT_CYCLE / 2);
|
||||
if (hc >= 1308)
|
||||
hc -= (ONE_DOT_CYCLE / 2);
|
||||
}
|
||||
|
||||
|
||||
PPU.HBeamPosLatched = (uint16) (hc / ONE_DOT_CYCLE);
|
||||
|
||||
// Causes screen flicker for Yoshi's Island if uncommented
|
||||
@ -218,7 +235,7 @@ static inline void S9xLatchCounters (bool force)
|
||||
Memory.FillRAM [0x213F] |= 0x40;
|
||||
|
||||
}
|
||||
|
||||
|
||||
if (CPU.V_Counter > PPU.GunVLatch ||
|
||||
(CPU.V_Counter == PPU.GunVLatch && CPU.Cycles >= PPU.GunHLatch * ONE_DOT_CYCLE))
|
||||
{
|
||||
@ -250,7 +267,7 @@ static inline void S9xTryGunLatch (bool force)
|
||||
|
||||
Memory.FillRAM [0x213F] |= 0x40;
|
||||
}
|
||||
|
||||
|
||||
PPU.GunVLatch = 1000;
|
||||
}
|
||||
}
|
||||
@ -267,8 +284,20 @@ void S9xCheckMissingHTimerPosition (int32 hc)
|
||||
}
|
||||
}
|
||||
|
||||
void S9xCheckMissingHTimerPositionRange (int32 hc_from, int32 range)
|
||||
{
|
||||
void S9xCheckMissingHTimerHalt (int32 hc_from, int32 range)
|
||||
{
|
||||
if ((PPU.HTimerPosition >= hc_from) && (PPU.HTimerPosition < (hc_from + range)))
|
||||
{
|
||||
if (PPU.HTimerEnabled && (!PPU.VTimerEnabled || (CPU.V_Counter == PPU.VTimerPosition)))
|
||||
CPU.IRQPending = 1;
|
||||
else
|
||||
if (PPU.VTimerEnabled && (CPU.V_Counter == PPU.VTimerPosition))
|
||||
CPU.IRQPending = 1;
|
||||
}
|
||||
}
|
||||
|
||||
void S9xCheckMissingHTimerRange (int32 hc_from, int32 range)
|
||||
{
|
||||
if ((PPU.HTimerPosition >= hc_from) && (PPU.HTimerPosition < (hc_from + range)))
|
||||
{
|
||||
if (PPU.HTimerEnabled && (!PPU.VTimerEnabled || (CPU.V_Counter == PPU.VTimerPosition)))
|
||||
@ -279,12 +308,6 @@ void S9xCheckMissingHTimerPositionRange (int32 hc_from, int32 range)
|
||||
}
|
||||
}
|
||||
|
||||
void S9xCheckMissingVTimerPosition (void)
|
||||
{
|
||||
if (PPU.VTimerEnabled && !PPU.HTimerEnabled && (CPU.V_Counter == PPU.VTimerPosition) && (CPU.Cycles >= PPU.HTimerPosition))
|
||||
S9xSetIRQ(PPU_V_BEAM_IRQ_SOURCE);
|
||||
}
|
||||
|
||||
void S9xUpdateHVTimerPosition (void)
|
||||
{
|
||||
if (PPU.HTimerEnabled)
|
||||
@ -297,7 +320,7 @@ void S9xUpdateHVTimerPosition (void)
|
||||
// IRQ_read
|
||||
PPU.HTimerPosition = PPU.IRQHBeamPos * ONE_DOT_CYCLE;
|
||||
if (Timings.H_Max == Timings.H_Max_Master) // 1364
|
||||
{
|
||||
{
|
||||
if (PPU.IRQHBeamPos > 322)
|
||||
PPU.HTimerPosition += (ONE_DOT_CYCLE / 2);
|
||||
if (PPU.IRQHBeamPos > 326)
|
||||
@ -319,7 +342,7 @@ void S9xUpdateHVTimerPosition (void)
|
||||
|
||||
if ((PPU.HTimerPosition >= Timings.H_Max) && (PPU.IRQHBeamPos < 340))
|
||||
{
|
||||
PPU.HTimerPosition -= Timings.H_Max;
|
||||
PPU.HTimerPosition -= Timings.H_Max;
|
||||
PPU.VTimerPosition++;
|
||||
// FIXME
|
||||
if (PPU.VTimerPosition >= Timings.V_Max)
|
||||
@ -334,27 +357,27 @@ void S9xUpdateHVTimerPosition (void)
|
||||
CPU.WhichEvent = HC_HDMA_START_EVENT;
|
||||
CPU.NextEvent = Timings.HDMAStart;
|
||||
break;
|
||||
|
||||
|
||||
case HC_IRQ_3_5_EVENT:
|
||||
CPU.WhichEvent = HC_HCOUNTER_MAX_EVENT;
|
||||
CPU.NextEvent = Timings.H_Max;
|
||||
break;
|
||||
|
||||
|
||||
case HC_IRQ_5_7_EVENT:
|
||||
CPU.WhichEvent = HC_HDMA_INIT_EVENT;
|
||||
CPU.NextEvent = Timings.HDMAInit;
|
||||
break;
|
||||
|
||||
|
||||
case HC_IRQ_7_9_EVENT:
|
||||
CPU.WhichEvent = HC_RENDER_EVENT;
|
||||
CPU.NextEvent = Timings.RenderPos;
|
||||
break;
|
||||
|
||||
|
||||
case HC_IRQ_9_A_EVENT:
|
||||
CPU.WhichEvent = HC_WRAM_REFRESH_EVENT;
|
||||
CPU.NextEvent = Timings.WRAMRefreshPos;
|
||||
break;
|
||||
|
||||
|
||||
case HC_IRQ_A_1_EVENT:
|
||||
CPU.WhichEvent = HC_HBLANK_START_EVENT;
|
||||
CPU.NextEvent = Timings.HBlankStart;
|
||||
@ -362,32 +385,32 @@ void S9xUpdateHVTimerPosition (void)
|
||||
}
|
||||
}
|
||||
else
|
||||
if (PPU.HTimerPosition < CPU.NextEvent)
|
||||
if ((PPU.HTimerPosition < CPU.NextEvent) || (!(CPU.WhichEvent & 1) && (PPU.HTimerPosition == CPU.NextEvent)))
|
||||
{
|
||||
CPU.NextEvent = PPU.HTimerPosition;
|
||||
|
||||
|
||||
switch (CPU.WhichEvent)
|
||||
{
|
||||
case HC_HDMA_START_EVENT:
|
||||
CPU.WhichEvent = HC_IRQ_1_3_EVENT;
|
||||
break;
|
||||
|
||||
|
||||
case HC_HCOUNTER_MAX_EVENT:
|
||||
CPU.WhichEvent = HC_IRQ_3_5_EVENT;
|
||||
break;
|
||||
|
||||
|
||||
case HC_HDMA_INIT_EVENT:
|
||||
CPU.WhichEvent = HC_IRQ_5_7_EVENT;
|
||||
break;
|
||||
|
||||
|
||||
case HC_RENDER_EVENT:
|
||||
CPU.WhichEvent = HC_IRQ_7_9_EVENT;
|
||||
break;
|
||||
|
||||
|
||||
case HC_WRAM_REFRESH_EVENT:
|
||||
CPU.WhichEvent = HC_IRQ_9_A_EVENT;
|
||||
break;
|
||||
|
||||
|
||||
case HC_HBLANK_START_EVENT:
|
||||
CPU.WhichEvent = HC_IRQ_A_1_EVENT;
|
||||
break;
|
||||
@ -401,27 +424,27 @@ void S9xUpdateHVTimerPosition (void)
|
||||
CPU.WhichEvent = HC_HDMA_START_EVENT;
|
||||
CPU.NextEvent = Timings.HDMAStart;
|
||||
break;
|
||||
|
||||
|
||||
case HC_IRQ_3_5_EVENT:
|
||||
CPU.WhichEvent = HC_HCOUNTER_MAX_EVENT;
|
||||
CPU.NextEvent = Timings.H_Max;
|
||||
break;
|
||||
|
||||
|
||||
case HC_IRQ_5_7_EVENT:
|
||||
CPU.WhichEvent = HC_HDMA_INIT_EVENT;
|
||||
CPU.NextEvent = Timings.HDMAInit;
|
||||
break;
|
||||
|
||||
|
||||
case HC_IRQ_7_9_EVENT:
|
||||
CPU.WhichEvent = HC_RENDER_EVENT;
|
||||
CPU.NextEvent = Timings.RenderPos;
|
||||
break;
|
||||
|
||||
|
||||
case HC_IRQ_9_A_EVENT:
|
||||
CPU.WhichEvent = HC_WRAM_REFRESH_EVENT;
|
||||
CPU.NextEvent = Timings.WRAMRefreshPos;
|
||||
break;
|
||||
|
||||
|
||||
case HC_IRQ_A_1_EVENT:
|
||||
CPU.WhichEvent = HC_HBLANK_START_EVENT;
|
||||
CPU.NextEvent = Timings.HBlankStart;
|
||||
@ -452,7 +475,7 @@ void S9xSetPPU (uint8 Byte, uint16 Address)
|
||||
// fprintf(stderr, "%03d: %02x to %04x\n", CPU.V_Counter, Byte, Address);
|
||||
|
||||
// Take care of DMA wrapping
|
||||
if(CPU.InDMA && Address>0x21ff) Address=0x2100+(Address&0xff);
|
||||
if(CPU.InDMAorHDMA && Address>0x21ff) Address=0x2100+(Address&0xff);
|
||||
|
||||
if (Address <= 0x219F)
|
||||
{
|
||||
@ -478,6 +501,17 @@ void S9xSetPPU (uint8 Byte, uint16 Address)
|
||||
PPU.ForcedBlanking = (Byte >> 7) & 1;
|
||||
}
|
||||
}
|
||||
if ((Memory.FillRAM[0x2100] & 0x80) && CPU.V_Counter==PPU.ScreenHeight+FIRST_VISIBLE_LINE){
|
||||
PPU.OAMAddr = PPU.SavedOAMAddr;
|
||||
uint8 tmp = 0;
|
||||
if(PPU.OAMPriorityRotation)
|
||||
tmp = (PPU.OAMAddr & 0xFE) >> 1;
|
||||
if((PPU.OAMFlip&1) || PPU.FirstSprite!=tmp){
|
||||
PPU.FirstSprite = tmp;
|
||||
IPPU.OBJChanged = TRUE;
|
||||
}
|
||||
PPU.OAMFlip = 0;
|
||||
}
|
||||
break;
|
||||
|
||||
case 0x2101:
|
||||
@ -650,7 +684,7 @@ void S9xSetPPU (uint8 Byte, uint16 Address)
|
||||
|
||||
case 0x210E:
|
||||
// Yes, the two formulas are supposed to be different.
|
||||
PPU.BG[0].VOffset = (Byte<<8) | (PPU.BGnxOFSbyte&~7) | ((PPU.BG[0].VOffset>>8)&7);
|
||||
PPU.BG[0].VOffset = (Byte<<8) | PPU.BGnxOFSbyte;
|
||||
PPU.M7VOFS = (Byte<<8) | PPU.M7byte;
|
||||
PPU.BGnxOFSbyte = Byte;
|
||||
PPU.M7byte = Byte;
|
||||
@ -662,7 +696,7 @@ void S9xSetPPU (uint8 Byte, uint16 Address)
|
||||
break;
|
||||
|
||||
case 0x2110:
|
||||
PPU.BG[1].VOffset = (Byte<<8) | (PPU.BGnxOFSbyte&~7) | ((PPU.BG[1].VOffset>>8)&7);
|
||||
PPU.BG[1].VOffset = (Byte<<8) | PPU.BGnxOFSbyte;
|
||||
PPU.BGnxOFSbyte = Byte;
|
||||
break;
|
||||
|
||||
@ -672,7 +706,7 @@ void S9xSetPPU (uint8 Byte, uint16 Address)
|
||||
break;
|
||||
|
||||
case 0x2112:
|
||||
PPU.BG[2].VOffset = (Byte<<8) | (PPU.BGnxOFSbyte&~7) | ((PPU.BG[2].VOffset>>8)&7);
|
||||
PPU.BG[2].VOffset = (Byte<<8) | PPU.BGnxOFSbyte;
|
||||
PPU.BGnxOFSbyte = Byte;
|
||||
break;
|
||||
|
||||
@ -682,7 +716,7 @@ void S9xSetPPU (uint8 Byte, uint16 Address)
|
||||
break;
|
||||
|
||||
case 0x2114:
|
||||
PPU.BG[3].VOffset = (Byte<<8) | (PPU.BGnxOFSbyte&~7) | ((PPU.BG[3].VOffset>>8)&7);
|
||||
PPU.BG[3].VOffset = (Byte<<8) | PPU.BGnxOFSbyte;
|
||||
PPU.BGnxOFSbyte = Byte;
|
||||
break;
|
||||
|
||||
@ -1157,37 +1191,33 @@ void S9xSetPPU (uint8 Byte, uint16 Address)
|
||||
case 0x2174: case 0x2175: case 0x2176: case 0x2177:
|
||||
case 0x2178: case 0x2179: case 0x217a: case 0x217b:
|
||||
case 0x217c: case 0x217d: case 0x217e: case 0x217f:
|
||||
#ifdef SPCTOOL
|
||||
_SPCInPB (Address & 3, Byte);
|
||||
#else
|
||||
// CPU.Flags |= DEBUG_MODE_FLAG;
|
||||
Memory.FillRAM [Address] = Byte;
|
||||
IAPU.RAM [(Address & 3) + 0xf4] = Byte;
|
||||
#ifdef SPC700_SHUTDOWN
|
||||
IAPU.APUExecuting = Settings.APUEnabled;
|
||||
IAPU.WaitCounter++;
|
||||
#endif
|
||||
#endif // SPCTOOL
|
||||
S9xAPUExecute();
|
||||
Memory.FillRAM [Address] = Byte;
|
||||
IAPU.RAM [(Address & 3) + 0xf4] = Byte;
|
||||
break;
|
||||
case 0x2180:
|
||||
if(!CPU.InWRAM_DMA){
|
||||
if(!CPU.InWRAMDMAorHDMA){
|
||||
REGISTER_2180(Byte);
|
||||
}
|
||||
break;
|
||||
case 0x2181:
|
||||
if(!CPU.InWRAM_DMA){
|
||||
if(!CPU.InWRAMDMAorHDMA){
|
||||
PPU.WRAM &= 0x1FF00;
|
||||
PPU.WRAM |= Byte;
|
||||
}
|
||||
break;
|
||||
case 0x2182:
|
||||
if(!CPU.InWRAM_DMA){
|
||||
if(!CPU.InWRAMDMAorHDMA){
|
||||
PPU.WRAM &= 0x100FF;
|
||||
PPU.WRAM |= Byte << 8;
|
||||
}
|
||||
break;
|
||||
case 0x2183:
|
||||
if(!CPU.InWRAM_DMA){
|
||||
if(!CPU.InWRAMDMAorHDMA){
|
||||
PPU.WRAM &= 0x0FFFF;
|
||||
PPU.WRAM |= Byte << 16;
|
||||
PPU.WRAM &= 0x1FFFF;
|
||||
@ -1357,7 +1387,7 @@ uint8 S9xGetPPU (uint16 Address)
|
||||
return OpenBus; //treat as unmapped memory returning last byte on the bus
|
||||
|
||||
// Take care of DMA wrapping
|
||||
if(CPU.InDMA && Address>0x21ff) Address=0x2100+(Address&0xff);
|
||||
if(CPU.InDMAorHDMA && Address>0x21ff) Address=0x2100+(Address&0xff);
|
||||
|
||||
if (Address <= 0x219F)
|
||||
{
|
||||
@ -1552,7 +1582,7 @@ uint8 S9xGetPPU (uint16 Address)
|
||||
}
|
||||
else
|
||||
byte = Memory.VRAM[((PPU.VMA.Address << 1) - 2) & 0xffff];
|
||||
|
||||
|
||||
if (!PPU.VMA.High)
|
||||
{
|
||||
PPU.VMA.Address += PPU.VMA.Increment;
|
||||
@ -1618,7 +1648,7 @@ uint8 S9xGetPPU (uint16 Address)
|
||||
|
||||
PPU.CGFLIPRead ^= 1;
|
||||
return (PPU.OpenBus2 = byte);
|
||||
|
||||
|
||||
case 0x213C:
|
||||
// Horizontal counter value 0-339
|
||||
#ifdef DEBUGGER
|
||||
@ -1679,26 +1709,24 @@ uint8 S9xGetPPU (uint16 Address)
|
||||
case 0x2174: case 0x2175: case 0x2176: case 0x2177:
|
||||
case 0x2178: case 0x2179: case 0x217a: case 0x217b:
|
||||
case 0x217c: case 0x217d: case 0x217e: case 0x217f:
|
||||
#ifdef SPCTOOL
|
||||
return ((uint8) _SPCOutP [Address & 3]);
|
||||
#else
|
||||
// CPU.Flags |= DEBUG_MODE_FLAG;
|
||||
#ifdef SPC700_SHUTDOWN
|
||||
#ifdef SPC700_SHUTDOWN
|
||||
IAPU.APUExecuting = Settings.APUEnabled;
|
||||
IAPU.WaitCounter++;
|
||||
#endif
|
||||
if (Settings.APUEnabled)
|
||||
S9xAPUExecute();
|
||||
if (Settings.APUEnabled)
|
||||
{
|
||||
#ifdef CPU_SHUTDOWN
|
||||
// CPU.WaitAddress = CPU.PCAtOpcodeStart;
|
||||
#endif
|
||||
#endif
|
||||
#if 0
|
||||
if (SNESGameFixes.APU_OutPorts_ReturnValueFix &&
|
||||
Address >= 0x2140 && Address <= 0x2143 && !CPU.V_Counter)
|
||||
{
|
||||
return (uint8)((Address & 1) ? ((rand() & 0xff00) >> 8) :
|
||||
return (uint8)((Address & 1) ? ((rand() & 0xff00) >> 8) :
|
||||
(rand() & 0xff));
|
||||
}
|
||||
|
||||
#endif
|
||||
return (APU.OutPorts [Address & 3]);
|
||||
}
|
||||
|
||||
@ -1732,14 +1760,13 @@ uint8 S9xGetPPU (uint16 Address)
|
||||
return ((r >> 3) & 0xff);
|
||||
}
|
||||
return (Memory.FillRAM[Address]);
|
||||
#endif // SPCTOOL
|
||||
|
||||
case 0x2180:
|
||||
// Read WRAM
|
||||
#ifdef DEBUGGER
|
||||
missing.wram_read = 1;
|
||||
#endif
|
||||
if(!CPU.InWRAM_DMA){
|
||||
if(!CPU.InWRAMDMAorHDMA){
|
||||
byte = Memory.RAM [PPU.WRAM++];
|
||||
PPU.WRAM &= 0x1FFFF;
|
||||
} else {
|
||||
@ -1754,7 +1781,7 @@ uint8 S9xGetPPU (uint16 Address)
|
||||
case 0x2186:
|
||||
case 0x2187:
|
||||
return OpenBus;
|
||||
|
||||
|
||||
case 0x2188:
|
||||
case 0x2189:
|
||||
case 0x218a:
|
||||
@ -1813,7 +1840,7 @@ uint8 S9xGetPPU (uint16 Address)
|
||||
if (Settings.SRTC)
|
||||
return (S9xGetSRTC (Address));
|
||||
/*FALL*/
|
||||
|
||||
|
||||
default:
|
||||
#ifdef DEBUGGER
|
||||
missing.unknownppu_read = Address;
|
||||
@ -1826,7 +1853,7 @@ uint8 S9xGetPPU (uint16 Address)
|
||||
return OpenBus;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (!Settings.SuperFX)
|
||||
return OpenBus;
|
||||
#ifdef ZSNES_FX
|
||||
@ -1838,7 +1865,7 @@ uint8 S9xGetPPU (uint16 Address)
|
||||
#ifdef CPU_SHUTDOWN
|
||||
if (Address == 0x3030)
|
||||
CPU.WaitAddress = CPU.PBPCAtOpcodeStart;
|
||||
#endif
|
||||
#endif
|
||||
if (Address == 0x3031)
|
||||
CLEAR_IRQ_SOURCE (GSU_IRQ_SOURCE);
|
||||
#else
|
||||
@ -1904,7 +1931,7 @@ void S9xSetCPU (uint8 byte, uint16 Address)
|
||||
case 0x4200:
|
||||
// NMI, V & H IRQ and joypad reading enable flags
|
||||
pV = PPU.VTimerEnabled;
|
||||
|
||||
|
||||
if (byte & 0x20)
|
||||
{
|
||||
PPU.VTimerEnabled = TRUE;
|
||||
@ -1926,16 +1953,17 @@ void S9xSetCPU (uint8 byte, uint16 Address)
|
||||
}
|
||||
else
|
||||
PPU.HTimerEnabled = FALSE;
|
||||
|
||||
|
||||
S9xUpdateHVTimerPosition();
|
||||
// FIXME
|
||||
if (pV != PPU.VTimerEnabled)
|
||||
S9xCheckMissingVTimerPosition();
|
||||
|
||||
|
||||
// The case that IRQ will trigger in an instruction such as STA $4200
|
||||
// FIXME: not true but good enough for Snes9x, I think.
|
||||
S9xCheckMissingHTimerRange(CPU.PrevCycles, CPU.Cycles - CPU.PrevCycles);
|
||||
|
||||
if (!(byte & 0x30))
|
||||
CLEAR_IRQ_SOURCE (PPU_V_BEAM_IRQ_SOURCE | PPU_H_BEAM_IRQ_SOURCE);
|
||||
|
||||
if ((byte & 0x80) &&
|
||||
if ((byte & 0x80) &&
|
||||
!(Memory.FillRAM [0x4200] & 0x80) &&
|
||||
// NMI can trigger during VBlank as long as NMI_read ($4210) wasn't cleard.
|
||||
// Panic Bomberman clears the NMI pending flag @ scanline 230 before enabling
|
||||
@ -2011,12 +2039,8 @@ void S9xSetCPU (uint8 byte, uint16 Address)
|
||||
missing.virq_pos = PPU.IRQVBeamPos;
|
||||
#endif
|
||||
if (PPU.IRQVBeamPos != d)
|
||||
{
|
||||
S9xUpdateHVTimerPosition();
|
||||
// FIXME
|
||||
S9xCheckMissingVTimerPosition();
|
||||
}
|
||||
|
||||
|
||||
break;
|
||||
|
||||
case 0x420A:
|
||||
@ -2026,22 +2050,18 @@ void S9xSetCPU (uint8 byte, uint16 Address)
|
||||
missing.virq_pos = PPU.IRQVBeamPos;
|
||||
#endif
|
||||
if (PPU.IRQVBeamPos != d)
|
||||
{
|
||||
S9xUpdateHVTimerPosition();
|
||||
// FIXME
|
||||
S9xCheckMissingVTimerPosition();
|
||||
}
|
||||
|
||||
|
||||
break;
|
||||
|
||||
case 0x420B:
|
||||
if(CPU.InDMA) return;
|
||||
if(CPU.InDMAorHDMA) return;
|
||||
#ifdef DEBUGGER
|
||||
missing.dma_this_frame = byte;
|
||||
missing.dma_channels = byte;
|
||||
#endif
|
||||
// XXX: Not quite right...
|
||||
if(byte) CPU.Cycles += 18;
|
||||
if (byte) CPU.Cycles += Timings.DMACPUSync;
|
||||
if ((byte & 0x01) != 0)
|
||||
S9xDoDMA (0);
|
||||
if ((byte & 0x02) != 0)
|
||||
@ -2060,10 +2080,10 @@ void S9xSetCPU (uint8 byte, uint16 Address)
|
||||
S9xDoDMA (7);
|
||||
break;
|
||||
case 0x420C:
|
||||
if(CPU.InDMA) return;
|
||||
if(CPU.InDMAorHDMA) return;
|
||||
#ifdef DEBUGGER
|
||||
missing.hdma_this_frame |= byte;
|
||||
missing.hdma_channels |= byte;
|
||||
missing.hdma_channels |= byte;
|
||||
#endif
|
||||
if (Settings.DisableHDMA)
|
||||
byte = 0;
|
||||
@ -2133,9 +2153,9 @@ void S9xSetCPU (uint8 byte, uint16 Address)
|
||||
case 0x4350:
|
||||
case 0x4360:
|
||||
case 0x4370:
|
||||
if(CPU.InDMA) return;
|
||||
if(CPU.InDMAorHDMA) return;
|
||||
d = (Address >> 4) & 0x7;
|
||||
DMA[d].TransferDirection = (byte&0x80)?1:0;
|
||||
DMA[d].ReverseTransfer = (byte&0x80)?1:0;
|
||||
DMA[d].HDMAIndirectAddressing = (byte&0x40)?1:0;
|
||||
DMA[d].UnusedBit43x0 = (byte&0x20)?1:0;
|
||||
DMA[d].AAddressDecrement = (byte&0x10)?1:0;
|
||||
@ -2151,7 +2171,7 @@ void S9xSetCPU (uint8 byte, uint16 Address)
|
||||
case 0x4351:
|
||||
case 0x4361:
|
||||
case 0x4371:
|
||||
if(CPU.InDMA) return;
|
||||
if(CPU.InDMAorHDMA) return;
|
||||
DMA[((Address >> 4) & 0x7)].BAddress = byte;
|
||||
return;
|
||||
|
||||
@ -2163,7 +2183,7 @@ void S9xSetCPU (uint8 byte, uint16 Address)
|
||||
case 0x4352:
|
||||
case 0x4362:
|
||||
case 0x4372:
|
||||
if(CPU.InDMA) return;
|
||||
if(CPU.InDMAorHDMA) return;
|
||||
d = (Address >> 4) & 0x7;
|
||||
DMA[d].AAddress &= 0xFF00;
|
||||
DMA[d].AAddress |= byte;
|
||||
@ -2177,7 +2197,7 @@ void S9xSetCPU (uint8 byte, uint16 Address)
|
||||
case 0x4353:
|
||||
case 0x4363:
|
||||
case 0x4373:
|
||||
if(CPU.InDMA) return;
|
||||
if(CPU.InDMAorHDMA) return;
|
||||
d = (Address >> 4) & 0x7;
|
||||
DMA[d].AAddress &= 0xFF;
|
||||
DMA[d].AAddress |= byte << 8;
|
||||
@ -2191,7 +2211,7 @@ void S9xSetCPU (uint8 byte, uint16 Address)
|
||||
case 0x4354:
|
||||
case 0x4364:
|
||||
case 0x4374:
|
||||
if(CPU.InDMA) return;
|
||||
if(CPU.InDMAorHDMA) return;
|
||||
DMA[d=((Address >> 4) & 0x7)].ABank = byte;
|
||||
HDMAMemPointers[d]=NULL;
|
||||
return;
|
||||
@ -2204,7 +2224,7 @@ void S9xSetCPU (uint8 byte, uint16 Address)
|
||||
case 0x4355:
|
||||
case 0x4365:
|
||||
case 0x4375:
|
||||
if(CPU.InDMA) return;
|
||||
if(CPU.InDMAorHDMA) return;
|
||||
d = (Address >> 4) & 0x7;
|
||||
DMA[d].DMACount_Or_HDMAIndirectAddress &= 0xff00;
|
||||
DMA[d].DMACount_Or_HDMAIndirectAddress |= byte;
|
||||
@ -2219,7 +2239,7 @@ void S9xSetCPU (uint8 byte, uint16 Address)
|
||||
case 0x4356:
|
||||
case 0x4366:
|
||||
case 0x4376:
|
||||
if(CPU.InDMA) return;
|
||||
if(CPU.InDMAorHDMA) return;
|
||||
d = (Address >> 4) & 0x7;
|
||||
DMA[d].DMACount_Or_HDMAIndirectAddress &= 0xff;
|
||||
DMA[d].DMACount_Or_HDMAIndirectAddress |= byte << 8;
|
||||
@ -2234,7 +2254,7 @@ void S9xSetCPU (uint8 byte, uint16 Address)
|
||||
case 0x4357:
|
||||
case 0x4367:
|
||||
case 0x4377:
|
||||
if(CPU.InDMA) return;
|
||||
if(CPU.InDMAorHDMA) return;
|
||||
DMA[d = ((Address >> 4) & 0x7)].IndirectBank = byte;
|
||||
HDMAMemPointers[d]=NULL;
|
||||
return;
|
||||
@ -2247,7 +2267,7 @@ void S9xSetCPU (uint8 byte, uint16 Address)
|
||||
case 0x4358:
|
||||
case 0x4368:
|
||||
case 0x4378:
|
||||
if(CPU.InDMA) return;
|
||||
if(CPU.InDMAorHDMA) return;
|
||||
d = (Address >> 4) & 7;
|
||||
DMA[d].Address &= 0xff00;
|
||||
DMA[d].Address |= byte;
|
||||
@ -2262,7 +2282,7 @@ void S9xSetCPU (uint8 byte, uint16 Address)
|
||||
case 0x4359:
|
||||
case 0x4369:
|
||||
case 0x4379:
|
||||
if(CPU.InDMA) return;
|
||||
if(CPU.InDMAorHDMA) return;
|
||||
d = (Address >> 4) & 0x7;
|
||||
DMA[d].Address &= 0xff;
|
||||
DMA[d].Address |= byte << 8;
|
||||
@ -2277,7 +2297,7 @@ void S9xSetCPU (uint8 byte, uint16 Address)
|
||||
case 0x435A:
|
||||
case 0x436A:
|
||||
case 0x437A:
|
||||
if(CPU.InDMA) return;
|
||||
if(CPU.InDMAorHDMA) return;
|
||||
d = (Address >> 4) & 0x7;
|
||||
if(byte&0x7f){
|
||||
DMA[d].LineCount = byte & 0x7f;
|
||||
@ -2305,7 +2325,7 @@ void S9xSetCPU (uint8 byte, uint16 Address)
|
||||
case 0x435F:
|
||||
case 0x436F:
|
||||
case 0x437F:
|
||||
if(CPU.InDMA) return;
|
||||
if(CPU.InDMAorHDMA) return;
|
||||
DMA[((Address >> 4) & 0x7)].UnknownByte = byte;
|
||||
return;
|
||||
|
||||
@ -2402,6 +2422,12 @@ uint8 S9xGetCPU (uint16 Address)
|
||||
|
||||
if (Address < 0x4200)
|
||||
{
|
||||
#ifdef SNES_JOY_READ_CALLBACKS
|
||||
extern bool8 pad_read;
|
||||
if(Address==0x4016 || Address==0x4017)
|
||||
S9xOnSNESPadRead(), pad_read = true;
|
||||
#endif
|
||||
|
||||
CPU.Cycles += ONE_CYCLE;
|
||||
switch (Address)
|
||||
{
|
||||
@ -2446,7 +2472,7 @@ uint8 S9xGetCPU (uint16 Address)
|
||||
case 0x4210:
|
||||
#ifdef CPU_SHUTDOWN
|
||||
CPU.WaitAddress = CPU.PBPCAtOpcodeStart;
|
||||
#endif
|
||||
#endif
|
||||
byte = Memory.FillRAM[0x4210];
|
||||
Memory.FillRAM[0x4210] = Model->_5A22;
|
||||
//SNEeSe returns 2 for 5A22 version.
|
||||
@ -2490,6 +2516,13 @@ uint8 S9xGetCPU (uint16 Address)
|
||||
case 0x421d:
|
||||
case 0x421e:
|
||||
case 0x421f:
|
||||
#ifdef SNES_JOY_READ_CALLBACKS
|
||||
{
|
||||
extern bool8 pad_read;
|
||||
if(Memory.FillRAM[0x4200] & 1)
|
||||
S9xOnSNESPadRead(), pad_read = true;
|
||||
}
|
||||
#endif
|
||||
// Joypads 1-4 button and direction state.
|
||||
return (Memory.FillRAM [Address]);
|
||||
|
||||
@ -2501,9 +2534,9 @@ uint8 S9xGetCPU (uint16 Address)
|
||||
case 0x4350:
|
||||
case 0x4360:
|
||||
case 0x4370:
|
||||
if(CPU.InDMA) return OpenBus;
|
||||
if(CPU.InDMAorHDMA) return OpenBus;
|
||||
d = (Address >> 4) & 0x7;
|
||||
return ((DMA[d].TransferDirection?0x80:0x00) |
|
||||
return ((DMA[d].ReverseTransfer?0x80:0x00) |
|
||||
(DMA[d].HDMAIndirectAddressing?0x40:0x00) |
|
||||
(DMA[d].UnusedBit43x0?0x20:0x00) |
|
||||
(DMA[d].AAddressDecrement?0x10:0x00) |
|
||||
@ -2518,7 +2551,7 @@ uint8 S9xGetCPU (uint16 Address)
|
||||
case 0x4351:
|
||||
case 0x4361:
|
||||
case 0x4371:
|
||||
if(CPU.InDMA) return OpenBus;
|
||||
if(CPU.InDMAorHDMA) return OpenBus;
|
||||
return DMA[((Address >> 4) & 0x7)].BAddress;
|
||||
|
||||
case 0x4302:
|
||||
@ -2529,7 +2562,7 @@ uint8 S9xGetCPU (uint16 Address)
|
||||
case 0x4352:
|
||||
case 0x4362:
|
||||
case 0x4372:
|
||||
if(CPU.InDMA) return OpenBus;
|
||||
if(CPU.InDMAorHDMA) return OpenBus;
|
||||
return (DMA[((Address >> 4) & 0x7)].AAddress & 0xFF);
|
||||
|
||||
case 0x4303:
|
||||
@ -2540,7 +2573,7 @@ uint8 S9xGetCPU (uint16 Address)
|
||||
case 0x4353:
|
||||
case 0x4363:
|
||||
case 0x4373:
|
||||
if(CPU.InDMA) return OpenBus;
|
||||
if(CPU.InDMAorHDMA) return OpenBus;
|
||||
return (DMA[((Address >> 4) & 0x7)].AAddress >> 8);
|
||||
|
||||
case 0x4304:
|
||||
@ -2551,7 +2584,7 @@ uint8 S9xGetCPU (uint16 Address)
|
||||
case 0x4354:
|
||||
case 0x4364:
|
||||
case 0x4374:
|
||||
if(CPU.InDMA) return OpenBus;
|
||||
if(CPU.InDMAorHDMA) return OpenBus;
|
||||
return DMA[((Address >> 4) & 0x7)].ABank;
|
||||
|
||||
case 0x4305:
|
||||
@ -2562,7 +2595,7 @@ uint8 S9xGetCPU (uint16 Address)
|
||||
case 0x4355:
|
||||
case 0x4365:
|
||||
case 0x4375:
|
||||
if(CPU.InDMA) return OpenBus;
|
||||
if(CPU.InDMAorHDMA) return OpenBus;
|
||||
return (DMA[((Address >> 4) & 0x7)].DMACount_Or_HDMAIndirectAddress & 0xff);
|
||||
|
||||
case 0x4306:
|
||||
@ -2573,7 +2606,7 @@ uint8 S9xGetCPU (uint16 Address)
|
||||
case 0x4356:
|
||||
case 0x4366:
|
||||
case 0x4376:
|
||||
if(CPU.InDMA) return OpenBus;
|
||||
if(CPU.InDMAorHDMA) return OpenBus;
|
||||
return (DMA[((Address >> 4) & 0x7)].DMACount_Or_HDMAIndirectAddress >> 8);
|
||||
|
||||
case 0x4307:
|
||||
@ -2584,7 +2617,7 @@ uint8 S9xGetCPU (uint16 Address)
|
||||
case 0x4357:
|
||||
case 0x4367:
|
||||
case 0x4377:
|
||||
if(CPU.InDMA) return OpenBus;
|
||||
if(CPU.InDMAorHDMA) return OpenBus;
|
||||
return DMA[((Address >> 4) & 0x7)].IndirectBank;
|
||||
|
||||
case 0x4308:
|
||||
@ -2595,7 +2628,7 @@ uint8 S9xGetCPU (uint16 Address)
|
||||
case 0x4358:
|
||||
case 0x4368:
|
||||
case 0x4378:
|
||||
if(CPU.InDMA) return OpenBus;
|
||||
if(CPU.InDMAorHDMA) return OpenBus;
|
||||
return (DMA[((Address >> 4) & 0x7)].Address & 0xFF);
|
||||
|
||||
case 0x4309:
|
||||
@ -2606,7 +2639,7 @@ uint8 S9xGetCPU (uint16 Address)
|
||||
case 0x4359:
|
||||
case 0x4369:
|
||||
case 0x4379:
|
||||
if(CPU.InDMA) return OpenBus;
|
||||
if(CPU.InDMAorHDMA) return OpenBus;
|
||||
return (DMA[((Address >> 4) & 0x7)].Address >> 8);
|
||||
|
||||
case 0x430A:
|
||||
@ -2617,7 +2650,7 @@ uint8 S9xGetCPU (uint16 Address)
|
||||
case 0x435A:
|
||||
case 0x436A:
|
||||
case 0x437A:
|
||||
if(CPU.InDMA) return OpenBus;
|
||||
if(CPU.InDMAorHDMA) return OpenBus;
|
||||
d = (Address >> 4) & 0x7;
|
||||
return (DMA[d].LineCount ^ (DMA[d].Repeat?0x00:0x80));
|
||||
|
||||
@ -2637,7 +2670,7 @@ uint8 S9xGetCPU (uint16 Address)
|
||||
case 0x435F:
|
||||
case 0x436F:
|
||||
case 0x437F:
|
||||
if(CPU.InDMA) return OpenBus;
|
||||
if(CPU.InDMAorHDMA) return OpenBus;
|
||||
return DMA[((Address >> 4) & 0x7)].UnknownByte;
|
||||
|
||||
default:
|
||||
@ -2648,7 +2681,7 @@ uint8 S9xGetCPU (uint16 Address)
|
||||
sprintf (String, "Unknown register read: $%04X\n", Address);
|
||||
S9xMessage (S9X_TRACE, S9X_PPU_TRACE, String);
|
||||
}
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
if(Address>= 0x4800&&Settings.SPC7110)
|
||||
@ -2668,6 +2701,9 @@ void S9xResetPPU ()
|
||||
S9xSoftResetPPU();
|
||||
S9xControlsReset();
|
||||
IPPU.PreviousLine = IPPU.CurrentLine = 0;
|
||||
PPU.M7HOFS = 0;
|
||||
PPU.M7VOFS = 0;
|
||||
PPU.M7byte = 0;
|
||||
}
|
||||
|
||||
void S9xSoftResetPPU ()
|
||||
@ -2740,8 +2776,8 @@ void S9xSoftResetPPU ()
|
||||
PPU.OAMFlip = 0;
|
||||
PPU.OAMTileAddress = 0;
|
||||
PPU.OAMAddr = 0;
|
||||
PPU.IRQVBeamPos = 0;
|
||||
PPU.IRQHBeamPos = 0;
|
||||
PPU.IRQVBeamPos = 0x1ff;
|
||||
PPU.IRQHBeamPos = 0x1ff;
|
||||
PPU.VBeamPosLatched = 0;
|
||||
PPU.HBeamPosLatched = 0;
|
||||
|
||||
@ -2758,7 +2794,6 @@ void S9xSoftResetPPU ()
|
||||
PPU.SavedOAMAddr = 0;
|
||||
PPU.ScreenHeight = SNES_HEIGHT;
|
||||
PPU.WRAM = 0;
|
||||
PPU.BG_Forced = 0;
|
||||
PPU.ForcedBlanking = TRUE;
|
||||
PPU.OBJThroughMain = FALSE;
|
||||
PPU.OBJThroughSub = FALSE;
|
||||
|
@ -1,7 +1,7 @@
|
||||
/**********************************************************************************
|
||||
Snes9x - Portable Super Nintendo Entertainment System (TM) emulator.
|
||||
|
||||
(c) Copyright 1996 - 2002 Gary Henderson (gary.henderson@ntlworld.com) and
|
||||
(c) Copyright 1996 - 2002 Gary Henderson (gary.henderson@ntlworld.com),
|
||||
Jerremy Koot (jkoot@snes9x.com)
|
||||
|
||||
(c) Copyright 2002 - 2004 Matthew Kendora
|
||||
@ -12,12 +12,16 @@
|
||||
|
||||
(c) Copyright 2001 - 2006 John Weidman (jweidman@slip.net)
|
||||
|
||||
(c) Copyright 2002 - 2006 Brad Jorsch (anomie@users.sourceforge.net),
|
||||
funkyass (funkyass@spam.shaw.ca),
|
||||
Kris Bleakley (codeviolation@hotmail.com),
|
||||
Nach (n-a-c-h@users.sourceforge.net), and
|
||||
(c) Copyright 2002 - 2006 funkyass (funkyass@spam.shaw.ca),
|
||||
Kris Bleakley (codeviolation@hotmail.com)
|
||||
|
||||
(c) Copyright 2002 - 2007 Brad Jorsch (anomie@users.sourceforge.net),
|
||||
Nach (n-a-c-h@users.sourceforge.net),
|
||||
zones (kasumitokoduck@yahoo.com)
|
||||
|
||||
(c) Copyright 2006 - 2007 nitsuja
|
||||
|
||||
|
||||
BS-X C emulator code
|
||||
(c) Copyright 2005 - 2006 Dreamer Nom,
|
||||
zones
|
||||
@ -110,17 +114,30 @@
|
||||
2xSaI filter
|
||||
(c) Copyright 1999 - 2001 Derek Liauw Kie Fa
|
||||
|
||||
HQ2x filter
|
||||
HQ2x, HQ3x, HQ4x filters
|
||||
(c) Copyright 2003 Maxim Stepin (maxim@hiend3d.com)
|
||||
|
||||
Win32 GUI code
|
||||
(c) Copyright 2003 - 2006 blip,
|
||||
funkyass,
|
||||
Matthew Kendora,
|
||||
Nach,
|
||||
nitsuja
|
||||
|
||||
Mac OS GUI code
|
||||
(c) Copyright 1998 - 2001 John Stiles
|
||||
(c) Copyright 2001 - 2007 zones
|
||||
|
||||
|
||||
Specific ports contains the works of other authors. See headers in
|
||||
individual files.
|
||||
|
||||
|
||||
Snes9x homepage: http://www.snes9x.com
|
||||
|
||||
Permission to use, copy, modify and/or distribute Snes9x in both binary
|
||||
and source form, for non-commercial purposes, is hereby granted without
|
||||
fee, providing that this license information and copyright notice appear
|
||||
and source form, for non-commercial purposes, is hereby granted without
|
||||
fee, providing that this license information and copyright notice appear
|
||||
with all copies and any derived work.
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
@ -142,6 +159,8 @@
|
||||
**********************************************************************************/
|
||||
|
||||
|
||||
|
||||
|
||||
#ifndef _PPU_H_
|
||||
#define _PPU_H_
|
||||
|
||||
@ -187,6 +206,7 @@ struct InternalPPU {
|
||||
uint32 FrameCount;
|
||||
uint32 RenderedFramesCount;
|
||||
uint32 DisplayedRenderedFrameCount;
|
||||
uint32 TotalEmulatedFrames;
|
||||
uint32 SkippedFrames;
|
||||
uint32 FrameSkip;
|
||||
uint8 *TileCache [7];
|
||||
@ -215,7 +235,7 @@ struct InternalPPU {
|
||||
|
||||
struct SOBJ
|
||||
{
|
||||
short HPos;
|
||||
int16 HPos;
|
||||
uint16 VPos;
|
||||
uint16 Name;
|
||||
uint8 VFlip;
|
||||
@ -249,7 +269,7 @@ struct SPPU {
|
||||
} BG [4];
|
||||
|
||||
bool8 CGFLIP;
|
||||
uint16 CGDATA [256];
|
||||
uint16 CGDATA [256];
|
||||
uint8 FirstSprite;
|
||||
uint8 LastSprite;
|
||||
struct SOBJ OBJ [128];
|
||||
@ -284,7 +304,6 @@ struct SPPU {
|
||||
uint16 SavedOAMAddr;
|
||||
uint16 ScreenHeight;
|
||||
uint32 WRAM;
|
||||
uint8 BG_Forced;
|
||||
bool8 ForcedBlanking;
|
||||
bool8 OBJThroughMain;
|
||||
bool8 OBJThroughSub;
|
||||
@ -334,7 +353,7 @@ struct SPPU {
|
||||
|
||||
struct SDMA {
|
||||
/* $43x0 */
|
||||
bool8 TransferDirection;
|
||||
bool8 ReverseTransfer;
|
||||
bool8 HDMAIndirectAddressing;
|
||||
bool8 UnusedBit43x0;
|
||||
bool8 AAddressFixed;
|
||||
@ -392,8 +411,8 @@ uint8 *S9xGetBasePointerC4 (uint16 Address);
|
||||
|
||||
void S9xUpdateHVTimerPosition (void);
|
||||
void S9xCheckMissingHTimerPosition (int32);
|
||||
void S9xCheckMissingHTimerPositionRange (int32, int32);
|
||||
void S9xCheckMissingVTimerPosition (void);
|
||||
void S9xCheckMissingHTimerRange (int32, int32);
|
||||
void S9xCheckMissingHTimerHalt (int32, int32);
|
||||
|
||||
extern struct SPPU PPU;
|
||||
extern struct SDMA DMA [8];
|
||||
@ -409,11 +428,11 @@ typedef struct{
|
||||
uint8 _5A22;
|
||||
} SnesModel;
|
||||
|
||||
#ifndef _GLOBALS_CPP
|
||||
START_EXTERN_C
|
||||
extern SnesModel* Model;
|
||||
extern SnesModel M1SNES;
|
||||
extern SnesModel M2SNES;
|
||||
#endif
|
||||
END_EXTERN_C
|
||||
|
||||
#define MAX_5C77_VERSION 0x01
|
||||
#define MAX_5C78_VERSION 0x03
|
||||
@ -426,7 +445,7 @@ STATIC inline uint8 REGISTER_4212()
|
||||
CPU.V_Counter < PPU.ScreenHeight + FIRST_VISIBLE_LINE + 3)
|
||||
GetBank = 1;
|
||||
|
||||
GetBank |= CPU.Cycles >= Timings.HBlankStart ? 0x40 : 0;
|
||||
GetBank |= ((CPU.Cycles < Timings.HBlankEnd) || (CPU.Cycles >= Timings.HBlankStart)) ? 0x40 : 0;
|
||||
if (CPU.V_Counter >= PPU.ScreenHeight + FIRST_VISIBLE_LINE)
|
||||
GetBank |= 0x80; /* XXX: 0x80 or 0xc0 ? */
|
||||
|
||||
@ -526,8 +545,19 @@ STATIC inline void REGISTER_2104 (uint8 byte)
|
||||
Memory.FillRAM [0x2104] = byte;
|
||||
}
|
||||
|
||||
// This code is correct, however due to Snes9x's inaccurate timings, some games might be broken by this chage. :(
|
||||
#define CHECK_INBLANK \
|
||||
{ \
|
||||
if (Settings.BlockInvalidVRAMAccess && !PPU.ForcedBlanking && CPU.V_Counter < PPU.ScreenHeight + FIRST_VISIBLE_LINE) \
|
||||
{ \
|
||||
return; \
|
||||
} \
|
||||
} \
|
||||
|
||||
STATIC inline void REGISTER_2118 (uint8 Byte)
|
||||
{
|
||||
CHECK_INBLANK;
|
||||
|
||||
uint32 address;
|
||||
if (PPU.VMA.FullGraphicCount)
|
||||
{
|
||||
@ -555,13 +585,13 @@ STATIC inline void REGISTER_2118 (uint8 Byte)
|
||||
if (!PPU.VMA.High)
|
||||
{
|
||||
#ifdef DEBUGGER
|
||||
if (Settings.TraceVRAM && !CPU.InDMA)
|
||||
if (Settings.TraceVRAM && !CPU.InDMAorHDMA)
|
||||
{
|
||||
printf ("VRAM write byte: $%04X (%d,%d)\n", PPU.VMA.Address,
|
||||
Memory.FillRAM[0x2115] & 3,
|
||||
(Memory.FillRAM [0x2115] & 0x0c) >> 2);
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
PPU.VMA.Address += PPU.VMA.Increment;
|
||||
}
|
||||
// Memory.FillRAM [0x2118] = Byte;
|
||||
@ -569,6 +599,8 @@ STATIC inline void REGISTER_2118 (uint8 Byte)
|
||||
|
||||
STATIC inline void REGISTER_2118_tile (uint8 Byte)
|
||||
{
|
||||
CHECK_INBLANK;
|
||||
|
||||
uint32 address;
|
||||
uint32 rem = PPU.VMA.Address & PPU.VMA.Mask1;
|
||||
address = (((PPU.VMA.Address & ~PPU.VMA.Mask1) +
|
||||
@ -593,6 +625,8 @@ STATIC inline void REGISTER_2118_tile (uint8 Byte)
|
||||
|
||||
STATIC inline void REGISTER_2118_linear (uint8 Byte)
|
||||
{
|
||||
CHECK_INBLANK;
|
||||
|
||||
uint32 address;
|
||||
Memory.VRAM[address = (PPU.VMA.Address << 1) & 0xFFFF] = Byte;
|
||||
IPPU.TileCached [TILE_2BIT][address >> 4] = FALSE;
|
||||
@ -613,6 +647,8 @@ STATIC inline void REGISTER_2118_linear (uint8 Byte)
|
||||
|
||||
STATIC inline void REGISTER_2119 (uint8 Byte)
|
||||
{
|
||||
CHECK_INBLANK;
|
||||
|
||||
uint32 address;
|
||||
if (PPU.VMA.FullGraphicCount)
|
||||
{
|
||||
@ -640,13 +676,13 @@ STATIC inline void REGISTER_2119 (uint8 Byte)
|
||||
if (PPU.VMA.High)
|
||||
{
|
||||
#ifdef DEBUGGER
|
||||
if (Settings.TraceVRAM && !CPU.InDMA)
|
||||
if (Settings.TraceVRAM && !CPU.InDMAorHDMA)
|
||||
{
|
||||
printf ("VRAM write word: $%04X (%d,%d)\n", PPU.VMA.Address,
|
||||
Memory.FillRAM[0x2115] & 3,
|
||||
(Memory.FillRAM [0x2115] & 0x0c) >> 2);
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
PPU.VMA.Address += PPU.VMA.Increment;
|
||||
}
|
||||
// Memory.FillRAM [0x2119] = Byte;
|
||||
@ -654,6 +690,8 @@ STATIC inline void REGISTER_2119 (uint8 Byte)
|
||||
|
||||
STATIC inline void REGISTER_2119_tile (uint8 Byte)
|
||||
{
|
||||
CHECK_INBLANK;
|
||||
|
||||
uint32 rem = PPU.VMA.Address & PPU.VMA.Mask1;
|
||||
uint32 address = ((((PPU.VMA.Address & ~PPU.VMA.Mask1) +
|
||||
(rem >> PPU.VMA.Shift) +
|
||||
@ -677,6 +715,8 @@ STATIC inline void REGISTER_2119_tile (uint8 Byte)
|
||||
|
||||
STATIC inline void REGISTER_2119_linear (uint8 Byte)
|
||||
{
|
||||
CHECK_INBLANK;
|
||||
|
||||
uint32 address;
|
||||
Memory.VRAM[address = ((PPU.VMA.Address << 1) + 1) & 0xFFFF] = Byte;
|
||||
IPPU.TileCached [TILE_2BIT][address >> 4] = FALSE;
|
||||
|
@ -1,7 +1,7 @@
|
||||
/**********************************************************************************
|
||||
Snes9x - Portable Super Nintendo Entertainment System (TM) emulator.
|
||||
|
||||
(c) Copyright 1996 - 2002 Gary Henderson (gary.henderson@ntlworld.com) and
|
||||
(c) Copyright 1996 - 2002 Gary Henderson (gary.henderson@ntlworld.com),
|
||||
Jerremy Koot (jkoot@snes9x.com)
|
||||
|
||||
(c) Copyright 2002 - 2004 Matthew Kendora
|
||||
@ -12,12 +12,16 @@
|
||||
|
||||
(c) Copyright 2001 - 2006 John Weidman (jweidman@slip.net)
|
||||
|
||||
(c) Copyright 2002 - 2006 Brad Jorsch (anomie@users.sourceforge.net),
|
||||
funkyass (funkyass@spam.shaw.ca),
|
||||
Kris Bleakley (codeviolation@hotmail.com),
|
||||
Nach (n-a-c-h@users.sourceforge.net), and
|
||||
(c) Copyright 2002 - 2006 funkyass (funkyass@spam.shaw.ca),
|
||||
Kris Bleakley (codeviolation@hotmail.com)
|
||||
|
||||
(c) Copyright 2002 - 2007 Brad Jorsch (anomie@users.sourceforge.net),
|
||||
Nach (n-a-c-h@users.sourceforge.net),
|
||||
zones (kasumitokoduck@yahoo.com)
|
||||
|
||||
(c) Copyright 2006 - 2007 nitsuja
|
||||
|
||||
|
||||
BS-X C emulator code
|
||||
(c) Copyright 2005 - 2006 Dreamer Nom,
|
||||
zones
|
||||
@ -110,17 +114,30 @@
|
||||
2xSaI filter
|
||||
(c) Copyright 1999 - 2001 Derek Liauw Kie Fa
|
||||
|
||||
HQ2x filter
|
||||
HQ2x, HQ3x, HQ4x filters
|
||||
(c) Copyright 2003 Maxim Stepin (maxim@hiend3d.com)
|
||||
|
||||
Win32 GUI code
|
||||
(c) Copyright 2003 - 2006 blip,
|
||||
funkyass,
|
||||
Matthew Kendora,
|
||||
Nach,
|
||||
nitsuja
|
||||
|
||||
Mac OS GUI code
|
||||
(c) Copyright 1998 - 2001 John Stiles
|
||||
(c) Copyright 2001 - 2007 zones
|
||||
|
||||
|
||||
Specific ports contains the works of other authors. See headers in
|
||||
individual files.
|
||||
|
||||
|
||||
Snes9x homepage: http://www.snes9x.com
|
||||
|
||||
Permission to use, copy, modify and/or distribute Snes9x in both binary
|
||||
and source form, for non-commercial purposes, is hereby granted without
|
||||
fee, providing that this license information and copyright notice appear
|
||||
and source form, for non-commercial purposes, is hereby granted without
|
||||
fee, providing that this license information and copyright notice appear
|
||||
with all copies and any derived work.
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
@ -142,6 +159,8 @@
|
||||
**********************************************************************************/
|
||||
|
||||
|
||||
|
||||
|
||||
#include "snes9x.h"
|
||||
#include "ppu.h"
|
||||
#include "cpuexec.h"
|
||||
@ -437,7 +456,7 @@ void S9xSA1SetPCBase (uint32 address)
|
||||
#ifdef DEBUGGER
|
||||
printf ("SBP %06x\n", address);
|
||||
#endif
|
||||
|
||||
|
||||
default:
|
||||
case CMemory::MAP_NONE:
|
||||
SA1.PCBase = NULL;
|
||||
@ -476,7 +495,7 @@ void S9xSetSA1MemMap (uint32 which1, uint8 map)
|
||||
for (i = c; i < c + 16; i++)
|
||||
Memory.Map [start + i] = SA1.Map [start + i] = block;
|
||||
}
|
||||
|
||||
|
||||
for (c = 0; c < 0x200; c += 16)
|
||||
{
|
||||
uint8 *block = &Memory.ROM [(map & 7) * 0x100000 + (c << 11) - 0x8000];
|
||||
@ -493,7 +512,7 @@ uint8 S9xGetSA1 (uint32 address)
|
||||
switch (address)
|
||||
{
|
||||
case 0x2300:
|
||||
return ((uint8) ((Memory.FillRAM [0x2209] & 0x5f) |
|
||||
return ((uint8) ((Memory.FillRAM [0x2209] & 0x5f) |
|
||||
(CPU.IRQActive & (SA1_IRQ_SOURCE | SA1_DMA_IRQ_SOURCE))));
|
||||
case 0x2301:
|
||||
return ((Memory.FillRAM [0x2200] & 0xf) |
|
||||
@ -520,7 +539,7 @@ uint8 S9xGetSA1 (uint32 address)
|
||||
}
|
||||
return (byte);
|
||||
}
|
||||
default:
|
||||
default:
|
||||
printf ("R: %04x\n", address);
|
||||
break;
|
||||
}
|
||||
@ -545,7 +564,7 @@ void S9xSetSA1 (uint8 byte, uint32 address)
|
||||
Memory.FillRAM [0x2301] |= 0x80;
|
||||
if (Memory.FillRAM [0x220a] & 0x80)
|
||||
{
|
||||
SA1.Flags |= IRQ_PENDING_FLAG;
|
||||
SA1.Flags |= IRQ_FLAG;
|
||||
SA1.IRQActive |= SNES_IRQ_SOURCE;
|
||||
SA1.Executing = !SA1.Waiting && SA1.S9xOpcodes;
|
||||
}
|
||||
@ -621,21 +640,21 @@ void S9xSetSA1 (uint8 byte, uint32 address)
|
||||
if (((byte ^ Memory.FillRAM [0x220a]) & 0x80) &&
|
||||
(Memory.FillRAM [0x2301] & byte & 0x80))
|
||||
{
|
||||
SA1.Flags |= IRQ_PENDING_FLAG;
|
||||
SA1.Flags |= IRQ_FLAG;
|
||||
SA1.IRQActive |= SNES_IRQ_SOURCE;
|
||||
// SA1.Executing = !SA1.Waiting;
|
||||
}
|
||||
if (((byte ^ Memory.FillRAM [0x220a]) & 0x40) &&
|
||||
(Memory.FillRAM [0x2301] & byte & 0x40))
|
||||
{
|
||||
SA1.Flags |= IRQ_PENDING_FLAG;
|
||||
SA1.Flags |= IRQ_FLAG;
|
||||
SA1.IRQActive |= TIMER_IRQ_SOURCE;
|
||||
// SA1.Executing = !SA1.Waiting;
|
||||
}
|
||||
if (((byte ^ Memory.FillRAM [0x220a]) & 0x20) &&
|
||||
(Memory.FillRAM [0x2301] & byte & 0x20))
|
||||
{
|
||||
SA1.Flags |= IRQ_PENDING_FLAG;
|
||||
SA1.Flags |= IRQ_FLAG;
|
||||
SA1.IRQActive |= DMA_IRQ_SOURCE;
|
||||
// SA1.Executing = !SA1.Waiting;
|
||||
}
|
||||
@ -669,7 +688,7 @@ void S9xSetSA1 (uint8 byte, uint32 address)
|
||||
Memory.FillRAM [0x2301] &= ~0x10;
|
||||
}
|
||||
if (!SA1.IRQActive)
|
||||
SA1.Flags &= ~IRQ_PENDING_FLAG;
|
||||
SA1.Flags &= ~IRQ_FLAG;
|
||||
break;
|
||||
case 0x220c:
|
||||
// printf ("SNES NMI vector: %04x\n", byte | (Memory.FillRAM [0x220d] << 8));
|
||||
@ -693,19 +712,19 @@ void S9xSetSA1 (uint8 byte, uint32 address)
|
||||
#endif
|
||||
break;
|
||||
case 0x2211:
|
||||
printf ("Timer reset\n");
|
||||
// printf ("Timer reset\n");
|
||||
break;
|
||||
case 0x2212:
|
||||
printf ("H-Timer %04x\n", byte | (Memory.FillRAM [0x2213] << 8));
|
||||
// printf ("H-Timer %04x\n", byte | (Memory.FillRAM [0x2213] << 8));
|
||||
break;
|
||||
case 0x2213:
|
||||
printf ("H-Timer %04x\n", (byte << 8) | Memory.FillRAM [0x2212]);
|
||||
// printf ("H-Timer %04x\n", (byte << 8) | Memory.FillRAM [0x2212]);
|
||||
break;
|
||||
case 0x2214:
|
||||
printf ("V-Timer %04x\n", byte | (Memory.FillRAM [0x2215] << 8));
|
||||
// printf ("V-Timer %04x\n", byte | (Memory.FillRAM [0x2215] << 8));
|
||||
break;
|
||||
case 0x2215:
|
||||
printf ("V-Timer %04x\n", (byte << 8) | Memory.FillRAM [0x2214]);
|
||||
// printf ("V-Timer %04x\n", (byte << 8) | Memory.FillRAM [0x2214]);
|
||||
break;
|
||||
case 0x2220:
|
||||
case 0x2221:
|
||||
@ -763,7 +782,7 @@ void S9xSetSA1 (uint8 byte, uint32 address)
|
||||
case 0x2234:
|
||||
Memory.FillRAM [address] = byte;
|
||||
#if 0
|
||||
printf ("DMA source start %06x\n",
|
||||
printf ("DMA source start %06x\n",
|
||||
Memory.FillRAM [0x2232] | (Memory.FillRAM [0x2233] << 8) |
|
||||
(Memory.FillRAM [0x2234] << 16));
|
||||
#endif
|
||||
@ -795,7 +814,7 @@ void S9xSetSA1 (uint8 byte, uint32 address)
|
||||
S9xSA1DMA ();
|
||||
}
|
||||
#if 0
|
||||
printf ("DMA dest address %06x\n",
|
||||
printf ("DMA dest address %06x\n",
|
||||
Memory.FillRAM [0x2235] | (Memory.FillRAM [0x2236] << 8) |
|
||||
(Memory.FillRAM [0x2237] << 16));
|
||||
#endif
|
||||
@ -804,7 +823,7 @@ void S9xSetSA1 (uint8 byte, uint32 address)
|
||||
case 0x2239:
|
||||
Memory.FillRAM [address] = byte;
|
||||
#if 0
|
||||
printf ("DMA length %04x\n",
|
||||
printf ("DMA length %04x\n",
|
||||
Memory.FillRAM [0x2238] | (Memory.FillRAM [0x2239] << 8));
|
||||
#endif
|
||||
break;
|
||||
@ -846,7 +865,7 @@ void S9xSetSA1 (uint8 byte, uint32 address)
|
||||
SA1.sum = 0;
|
||||
SA1.arithmetic_op = byte & 3;
|
||||
break;
|
||||
|
||||
|
||||
case 0x2251:
|
||||
SA1.op1 = (SA1.op1 & 0xff00) | byte;
|
||||
break;
|
||||
@ -987,10 +1006,10 @@ static void S9xSA1DMA ()
|
||||
}
|
||||
memmove (d, s, len);
|
||||
Memory.FillRAM [0x2301] |= 0x20;
|
||||
|
||||
|
||||
if (Memory.FillRAM [0x220a] & 0x20)
|
||||
{
|
||||
SA1.Flags |= IRQ_PENDING_FLAG;
|
||||
SA1.Flags |= IRQ_FLAG;
|
||||
SA1.IRQActive |= DMA_IRQ_SOURCE;
|
||||
// SA1.Executing = !SA1.Waiting;
|
||||
}
|
||||
|
@ -1,7 +1,7 @@
|
||||
/**********************************************************************************
|
||||
Snes9x - Portable Super Nintendo Entertainment System (TM) emulator.
|
||||
|
||||
(c) Copyright 1996 - 2002 Gary Henderson (gary.henderson@ntlworld.com) and
|
||||
(c) Copyright 1996 - 2002 Gary Henderson (gary.henderson@ntlworld.com),
|
||||
Jerremy Koot (jkoot@snes9x.com)
|
||||
|
||||
(c) Copyright 2002 - 2004 Matthew Kendora
|
||||
@ -12,12 +12,16 @@
|
||||
|
||||
(c) Copyright 2001 - 2006 John Weidman (jweidman@slip.net)
|
||||
|
||||
(c) Copyright 2002 - 2006 Brad Jorsch (anomie@users.sourceforge.net),
|
||||
funkyass (funkyass@spam.shaw.ca),
|
||||
Kris Bleakley (codeviolation@hotmail.com),
|
||||
Nach (n-a-c-h@users.sourceforge.net), and
|
||||
(c) Copyright 2002 - 2006 funkyass (funkyass@spam.shaw.ca),
|
||||
Kris Bleakley (codeviolation@hotmail.com)
|
||||
|
||||
(c) Copyright 2002 - 2007 Brad Jorsch (anomie@users.sourceforge.net),
|
||||
Nach (n-a-c-h@users.sourceforge.net),
|
||||
zones (kasumitokoduck@yahoo.com)
|
||||
|
||||
(c) Copyright 2006 - 2007 nitsuja
|
||||
|
||||
|
||||
BS-X C emulator code
|
||||
(c) Copyright 2005 - 2006 Dreamer Nom,
|
||||
zones
|
||||
@ -110,17 +114,30 @@
|
||||
2xSaI filter
|
||||
(c) Copyright 1999 - 2001 Derek Liauw Kie Fa
|
||||
|
||||
HQ2x filter
|
||||
HQ2x, HQ3x, HQ4x filters
|
||||
(c) Copyright 2003 Maxim Stepin (maxim@hiend3d.com)
|
||||
|
||||
Win32 GUI code
|
||||
(c) Copyright 2003 - 2006 blip,
|
||||
funkyass,
|
||||
Matthew Kendora,
|
||||
Nach,
|
||||
nitsuja
|
||||
|
||||
Mac OS GUI code
|
||||
(c) Copyright 1998 - 2001 John Stiles
|
||||
(c) Copyright 2001 - 2007 zones
|
||||
|
||||
|
||||
Specific ports contains the works of other authors. See headers in
|
||||
individual files.
|
||||
|
||||
|
||||
Snes9x homepage: http://www.snes9x.com
|
||||
|
||||
Permission to use, copy, modify and/or distribute Snes9x in both binary
|
||||
and source form, for non-commercial purposes, is hereby granted without
|
||||
fee, providing that this license information and copyright notice appear
|
||||
and source form, for non-commercial purposes, is hereby granted without
|
||||
fee, providing that this license information and copyright notice appear
|
||||
with all copies and any derived work.
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
@ -142,6 +159,8 @@
|
||||
**********************************************************************************/
|
||||
|
||||
|
||||
|
||||
|
||||
#ifndef _sa1_h_
|
||||
#define _sa1_h_
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
/**********************************************************************************
|
||||
Snes9x - Portable Super Nintendo Entertainment System (TM) emulator.
|
||||
|
||||
(c) Copyright 1996 - 2002 Gary Henderson (gary.henderson@ntlworld.com) and
|
||||
(c) Copyright 1996 - 2002 Gary Henderson (gary.henderson@ntlworld.com),
|
||||
Jerremy Koot (jkoot@snes9x.com)
|
||||
|
||||
(c) Copyright 2002 - 2004 Matthew Kendora
|
||||
@ -12,12 +12,16 @@
|
||||
|
||||
(c) Copyright 2001 - 2006 John Weidman (jweidman@slip.net)
|
||||
|
||||
(c) Copyright 2002 - 2006 Brad Jorsch (anomie@users.sourceforge.net),
|
||||
funkyass (funkyass@spam.shaw.ca),
|
||||
Kris Bleakley (codeviolation@hotmail.com),
|
||||
Nach (n-a-c-h@users.sourceforge.net), and
|
||||
(c) Copyright 2002 - 2006 funkyass (funkyass@spam.shaw.ca),
|
||||
Kris Bleakley (codeviolation@hotmail.com)
|
||||
|
||||
(c) Copyright 2002 - 2007 Brad Jorsch (anomie@users.sourceforge.net),
|
||||
Nach (n-a-c-h@users.sourceforge.net),
|
||||
zones (kasumitokoduck@yahoo.com)
|
||||
|
||||
(c) Copyright 2006 - 2007 nitsuja
|
||||
|
||||
|
||||
BS-X C emulator code
|
||||
(c) Copyright 2005 - 2006 Dreamer Nom,
|
||||
zones
|
||||
@ -110,17 +114,30 @@
|
||||
2xSaI filter
|
||||
(c) Copyright 1999 - 2001 Derek Liauw Kie Fa
|
||||
|
||||
HQ2x filter
|
||||
HQ2x, HQ3x, HQ4x filters
|
||||
(c) Copyright 2003 Maxim Stepin (maxim@hiend3d.com)
|
||||
|
||||
Win32 GUI code
|
||||
(c) Copyright 2003 - 2006 blip,
|
||||
funkyass,
|
||||
Matthew Kendora,
|
||||
Nach,
|
||||
nitsuja
|
||||
|
||||
Mac OS GUI code
|
||||
(c) Copyright 1998 - 2001 John Stiles
|
||||
(c) Copyright 2001 - 2007 zones
|
||||
|
||||
|
||||
Specific ports contains the works of other authors. See headers in
|
||||
individual files.
|
||||
|
||||
|
||||
Snes9x homepage: http://www.snes9x.com
|
||||
|
||||
Permission to use, copy, modify and/or distribute Snes9x in both binary
|
||||
and source form, for non-commercial purposes, is hereby granted without
|
||||
fee, providing that this license information and copyright notice appear
|
||||
and source form, for non-commercial purposes, is hereby granted without
|
||||
fee, providing that this license information and copyright notice appear
|
||||
with all copies and any derived work.
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
@ -142,6 +159,8 @@
|
||||
**********************************************************************************/
|
||||
|
||||
|
||||
|
||||
|
||||
#include "snes9x.h"
|
||||
#include "memmap.h"
|
||||
#include "ppu.h"
|
||||
@ -213,7 +232,7 @@ void S9xSA1MainLoop ()
|
||||
S9xSA1Opcode_NMI ();
|
||||
}
|
||||
#endif
|
||||
if (SA1.Flags & IRQ_PENDING_FLAG)
|
||||
if (SA1.Flags & IRQ_FLAG)
|
||||
{
|
||||
if (SA1.IRQActive)
|
||||
{
|
||||
@ -226,7 +245,7 @@ void S9xSA1MainLoop ()
|
||||
S9xSA1Opcode_IRQ ();
|
||||
}
|
||||
else
|
||||
SA1.Flags &= ~IRQ_PENDING_FLAG;
|
||||
SA1.Flags &= ~IRQ_FLAG;
|
||||
}
|
||||
for (i = 0; i < 3 && SA1.Executing; i++)
|
||||
{
|
||||
|
@ -1,7 +1,7 @@
|
||||
/**********************************************************************************
|
||||
Snes9x - Portable Super Nintendo Entertainment System (TM) emulator.
|
||||
|
||||
(c) Copyright 1996 - 2002 Gary Henderson (gary.henderson@ntlworld.com) and
|
||||
(c) Copyright 1996 - 2002 Gary Henderson (gary.henderson@ntlworld.com),
|
||||
Jerremy Koot (jkoot@snes9x.com)
|
||||
|
||||
(c) Copyright 2002 - 2004 Matthew Kendora
|
||||
@ -12,12 +12,16 @@
|
||||
|
||||
(c) Copyright 2001 - 2006 John Weidman (jweidman@slip.net)
|
||||
|
||||
(c) Copyright 2002 - 2006 Brad Jorsch (anomie@users.sourceforge.net),
|
||||
funkyass (funkyass@spam.shaw.ca),
|
||||
Kris Bleakley (codeviolation@hotmail.com),
|
||||
Nach (n-a-c-h@users.sourceforge.net), and
|
||||
(c) Copyright 2002 - 2006 funkyass (funkyass@spam.shaw.ca),
|
||||
Kris Bleakley (codeviolation@hotmail.com)
|
||||
|
||||
(c) Copyright 2002 - 2007 Brad Jorsch (anomie@users.sourceforge.net),
|
||||
Nach (n-a-c-h@users.sourceforge.net),
|
||||
zones (kasumitokoduck@yahoo.com)
|
||||
|
||||
(c) Copyright 2006 - 2007 nitsuja
|
||||
|
||||
|
||||
BS-X C emulator code
|
||||
(c) Copyright 2005 - 2006 Dreamer Nom,
|
||||
zones
|
||||
@ -110,17 +114,30 @@
|
||||
2xSaI filter
|
||||
(c) Copyright 1999 - 2001 Derek Liauw Kie Fa
|
||||
|
||||
HQ2x filter
|
||||
HQ2x, HQ3x, HQ4x filters
|
||||
(c) Copyright 2003 Maxim Stepin (maxim@hiend3d.com)
|
||||
|
||||
Win32 GUI code
|
||||
(c) Copyright 2003 - 2006 blip,
|
||||
funkyass,
|
||||
Matthew Kendora,
|
||||
Nach,
|
||||
nitsuja
|
||||
|
||||
Mac OS GUI code
|
||||
(c) Copyright 1998 - 2001 John Stiles
|
||||
(c) Copyright 2001 - 2007 zones
|
||||
|
||||
|
||||
Specific ports contains the works of other authors. See headers in
|
||||
individual files.
|
||||
|
||||
|
||||
Snes9x homepage: http://www.snes9x.com
|
||||
|
||||
Permission to use, copy, modify and/or distribute Snes9x in both binary
|
||||
and source form, for non-commercial purposes, is hereby granted without
|
||||
fee, providing that this license information and copyright notice appear
|
||||
and source form, for non-commercial purposes, is hereby granted without
|
||||
fee, providing that this license information and copyright notice appear
|
||||
with all copies and any derived work.
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
@ -142,6 +159,8 @@
|
||||
**********************************************************************************/
|
||||
|
||||
|
||||
|
||||
|
||||
#ifndef _SAR_H_
|
||||
#define _SAR_H_
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
/**********************************************************************************
|
||||
Snes9x - Portable Super Nintendo Entertainment System (TM) emulator.
|
||||
|
||||
(c) Copyright 1996 - 2002 Gary Henderson (gary.henderson@ntlworld.com) and
|
||||
(c) Copyright 1996 - 2002 Gary Henderson (gary.henderson@ntlworld.com),
|
||||
Jerremy Koot (jkoot@snes9x.com)
|
||||
|
||||
(c) Copyright 2002 - 2004 Matthew Kendora
|
||||
@ -12,12 +12,16 @@
|
||||
|
||||
(c) Copyright 2001 - 2006 John Weidman (jweidman@slip.net)
|
||||
|
||||
(c) Copyright 2002 - 2006 Brad Jorsch (anomie@users.sourceforge.net),
|
||||
funkyass (funkyass@spam.shaw.ca),
|
||||
Kris Bleakley (codeviolation@hotmail.com),
|
||||
Nach (n-a-c-h@users.sourceforge.net), and
|
||||
(c) Copyright 2002 - 2006 funkyass (funkyass@spam.shaw.ca),
|
||||
Kris Bleakley (codeviolation@hotmail.com)
|
||||
|
||||
(c) Copyright 2002 - 2007 Brad Jorsch (anomie@users.sourceforge.net),
|
||||
Nach (n-a-c-h@users.sourceforge.net),
|
||||
zones (kasumitokoduck@yahoo.com)
|
||||
|
||||
(c) Copyright 2006 - 2007 nitsuja
|
||||
|
||||
|
||||
BS-X C emulator code
|
||||
(c) Copyright 2005 - 2006 Dreamer Nom,
|
||||
zones
|
||||
@ -110,17 +114,30 @@
|
||||
2xSaI filter
|
||||
(c) Copyright 1999 - 2001 Derek Liauw Kie Fa
|
||||
|
||||
HQ2x filter
|
||||
HQ2x, HQ3x, HQ4x filters
|
||||
(c) Copyright 2003 Maxim Stepin (maxim@hiend3d.com)
|
||||
|
||||
Win32 GUI code
|
||||
(c) Copyright 2003 - 2006 blip,
|
||||
funkyass,
|
||||
Matthew Kendora,
|
||||
Nach,
|
||||
nitsuja
|
||||
|
||||
Mac OS GUI code
|
||||
(c) Copyright 1998 - 2001 John Stiles
|
||||
(c) Copyright 2001 - 2007 zones
|
||||
|
||||
|
||||
Specific ports contains the works of other authors. See headers in
|
||||
individual files.
|
||||
|
||||
|
||||
Snes9x homepage: http://www.snes9x.com
|
||||
|
||||
Permission to use, copy, modify and/or distribute Snes9x in both binary
|
||||
and source form, for non-commercial purposes, is hereby granted without
|
||||
fee, providing that this license information and copyright notice appear
|
||||
and source form, for non-commercial purposes, is hereby granted without
|
||||
fee, providing that this license information and copyright notice appear
|
||||
with all copies and any derived work.
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
@ -142,6 +159,8 @@
|
||||
**********************************************************************************/
|
||||
|
||||
|
||||
|
||||
|
||||
#ifndef SCREENSHOT_H
|
||||
#define SCREENSHOT_H
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
/**********************************************************************************
|
||||
Snes9x - Portable Super Nintendo Entertainment System (TM) emulator.
|
||||
|
||||
(c) Copyright 1996 - 2002 Gary Henderson (gary.henderson@ntlworld.com) and
|
||||
(c) Copyright 1996 - 2002 Gary Henderson (gary.henderson@ntlworld.com),
|
||||
Jerremy Koot (jkoot@snes9x.com)
|
||||
|
||||
(c) Copyright 2002 - 2004 Matthew Kendora
|
||||
@ -12,12 +12,16 @@
|
||||
|
||||
(c) Copyright 2001 - 2006 John Weidman (jweidman@slip.net)
|
||||
|
||||
(c) Copyright 2002 - 2006 Brad Jorsch (anomie@users.sourceforge.net),
|
||||
funkyass (funkyass@spam.shaw.ca),
|
||||
Kris Bleakley (codeviolation@hotmail.com),
|
||||
Nach (n-a-c-h@users.sourceforge.net), and
|
||||
(c) Copyright 2002 - 2006 funkyass (funkyass@spam.shaw.ca),
|
||||
Kris Bleakley (codeviolation@hotmail.com)
|
||||
|
||||
(c) Copyright 2002 - 2007 Brad Jorsch (anomie@users.sourceforge.net),
|
||||
Nach (n-a-c-h@users.sourceforge.net),
|
||||
zones (kasumitokoduck@yahoo.com)
|
||||
|
||||
(c) Copyright 2006 - 2007 nitsuja
|
||||
|
||||
|
||||
BS-X C emulator code
|
||||
(c) Copyright 2005 - 2006 Dreamer Nom,
|
||||
zones
|
||||
@ -110,17 +114,30 @@
|
||||
2xSaI filter
|
||||
(c) Copyright 1999 - 2001 Derek Liauw Kie Fa
|
||||
|
||||
HQ2x filter
|
||||
HQ2x, HQ3x, HQ4x filters
|
||||
(c) Copyright 2003 Maxim Stepin (maxim@hiend3d.com)
|
||||
|
||||
Win32 GUI code
|
||||
(c) Copyright 2003 - 2006 blip,
|
||||
funkyass,
|
||||
Matthew Kendora,
|
||||
Nach,
|
||||
nitsuja
|
||||
|
||||
Mac OS GUI code
|
||||
(c) Copyright 1998 - 2001 John Stiles
|
||||
(c) Copyright 2001 - 2007 zones
|
||||
|
||||
|
||||
Specific ports contains the works of other authors. See headers in
|
||||
individual files.
|
||||
|
||||
|
||||
Snes9x homepage: http://www.snes9x.com
|
||||
|
||||
Permission to use, copy, modify and/or distribute Snes9x in both binary
|
||||
and source form, for non-commercial purposes, is hereby granted without
|
||||
fee, providing that this license information and copyright notice appear
|
||||
and source form, for non-commercial purposes, is hereby granted without
|
||||
fee, providing that this license information and copyright notice appear
|
||||
with all copies and any derived work.
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
@ -142,6 +159,8 @@
|
||||
**********************************************************************************/
|
||||
|
||||
|
||||
|
||||
|
||||
#include "snes9x.h"
|
||||
#include "memmap.h"
|
||||
#include "ppu.h"
|
||||
@ -225,7 +244,7 @@ void S9xSDD1LoadLoggedData ()
|
||||
|
||||
if (fs)
|
||||
{
|
||||
int c = fread (Memory.SDD1LoggedData, 8,
|
||||
int c = fread (Memory.SDD1LoggedData, 8,
|
||||
MEMMAP_MAX_SDD1_LOGGED_ENTRIES, fs);
|
||||
|
||||
if (c != EOF)
|
||||
|
@ -1,7 +1,7 @@
|
||||
/**********************************************************************************
|
||||
Snes9x - Portable Super Nintendo Entertainment System (TM) emulator.
|
||||
|
||||
(c) Copyright 1996 - 2002 Gary Henderson (gary.henderson@ntlworld.com) and
|
||||
(c) Copyright 1996 - 2002 Gary Henderson (gary.henderson@ntlworld.com),
|
||||
Jerremy Koot (jkoot@snes9x.com)
|
||||
|
||||
(c) Copyright 2002 - 2004 Matthew Kendora
|
||||
@ -12,12 +12,16 @@
|
||||
|
||||
(c) Copyright 2001 - 2006 John Weidman (jweidman@slip.net)
|
||||
|
||||
(c) Copyright 2002 - 2006 Brad Jorsch (anomie@users.sourceforge.net),
|
||||
funkyass (funkyass@spam.shaw.ca),
|
||||
Kris Bleakley (codeviolation@hotmail.com),
|
||||
Nach (n-a-c-h@users.sourceforge.net), and
|
||||
(c) Copyright 2002 - 2006 funkyass (funkyass@spam.shaw.ca),
|
||||
Kris Bleakley (codeviolation@hotmail.com)
|
||||
|
||||
(c) Copyright 2002 - 2007 Brad Jorsch (anomie@users.sourceforge.net),
|
||||
Nach (n-a-c-h@users.sourceforge.net),
|
||||
zones (kasumitokoduck@yahoo.com)
|
||||
|
||||
(c) Copyright 2006 - 2007 nitsuja
|
||||
|
||||
|
||||
BS-X C emulator code
|
||||
(c) Copyright 2005 - 2006 Dreamer Nom,
|
||||
zones
|
||||
@ -110,17 +114,30 @@
|
||||
2xSaI filter
|
||||
(c) Copyright 1999 - 2001 Derek Liauw Kie Fa
|
||||
|
||||
HQ2x filter
|
||||
HQ2x, HQ3x, HQ4x filters
|
||||
(c) Copyright 2003 Maxim Stepin (maxim@hiend3d.com)
|
||||
|
||||
Win32 GUI code
|
||||
(c) Copyright 2003 - 2006 blip,
|
||||
funkyass,
|
||||
Matthew Kendora,
|
||||
Nach,
|
||||
nitsuja
|
||||
|
||||
Mac OS GUI code
|
||||
(c) Copyright 1998 - 2001 John Stiles
|
||||
(c) Copyright 2001 - 2007 zones
|
||||
|
||||
|
||||
Specific ports contains the works of other authors. See headers in
|
||||
individual files.
|
||||
|
||||
|
||||
Snes9x homepage: http://www.snes9x.com
|
||||
|
||||
Permission to use, copy, modify and/or distribute Snes9x in both binary
|
||||
and source form, for non-commercial purposes, is hereby granted without
|
||||
fee, providing that this license information and copyright notice appear
|
||||
and source form, for non-commercial purposes, is hereby granted without
|
||||
fee, providing that this license information and copyright notice appear
|
||||
with all copies and any derived work.
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
@ -142,6 +159,8 @@
|
||||
**********************************************************************************/
|
||||
|
||||
|
||||
|
||||
|
||||
#ifndef _SDD1_H_
|
||||
#define _SDD1_H_
|
||||
void S9xSetSDD1MemoryMap (uint32 bank, uint32 value);
|
||||
|
@ -1,7 +1,7 @@
|
||||
/**********************************************************************************
|
||||
Snes9x - Portable Super Nintendo Entertainment System (TM) emulator.
|
||||
|
||||
(c) Copyright 1996 - 2002 Gary Henderson (gary.henderson@ntlworld.com) and
|
||||
(c) Copyright 1996 - 2002 Gary Henderson (gary.henderson@ntlworld.com),
|
||||
Jerremy Koot (jkoot@snes9x.com)
|
||||
|
||||
(c) Copyright 2002 - 2004 Matthew Kendora
|
||||
@ -12,12 +12,16 @@
|
||||
|
||||
(c) Copyright 2001 - 2006 John Weidman (jweidman@slip.net)
|
||||
|
||||
(c) Copyright 2002 - 2006 Brad Jorsch (anomie@users.sourceforge.net),
|
||||
funkyass (funkyass@spam.shaw.ca),
|
||||
Kris Bleakley (codeviolation@hotmail.com),
|
||||
Nach (n-a-c-h@users.sourceforge.net), and
|
||||
(c) Copyright 2002 - 2006 funkyass (funkyass@spam.shaw.ca),
|
||||
Kris Bleakley (codeviolation@hotmail.com)
|
||||
|
||||
(c) Copyright 2002 - 2007 Brad Jorsch (anomie@users.sourceforge.net),
|
||||
Nach (n-a-c-h@users.sourceforge.net),
|
||||
zones (kasumitokoduck@yahoo.com)
|
||||
|
||||
(c) Copyright 2006 - 2007 nitsuja
|
||||
|
||||
|
||||
BS-X C emulator code
|
||||
(c) Copyright 2005 - 2006 Dreamer Nom,
|
||||
zones
|
||||
@ -110,17 +114,30 @@
|
||||
2xSaI filter
|
||||
(c) Copyright 1999 - 2001 Derek Liauw Kie Fa
|
||||
|
||||
HQ2x filter
|
||||
HQ2x, HQ3x, HQ4x filters
|
||||
(c) Copyright 2003 Maxim Stepin (maxim@hiend3d.com)
|
||||
|
||||
Win32 GUI code
|
||||
(c) Copyright 2003 - 2006 blip,
|
||||
funkyass,
|
||||
Matthew Kendora,
|
||||
Nach,
|
||||
nitsuja
|
||||
|
||||
Mac OS GUI code
|
||||
(c) Copyright 1998 - 2001 John Stiles
|
||||
(c) Copyright 2001 - 2007 zones
|
||||
|
||||
|
||||
Specific ports contains the works of other authors. See headers in
|
||||
individual files.
|
||||
|
||||
|
||||
Snes9x homepage: http://www.snes9x.com
|
||||
|
||||
Permission to use, copy, modify and/or distribute Snes9x in both binary
|
||||
and source form, for non-commercial purposes, is hereby granted without
|
||||
fee, providing that this license information and copyright notice appear
|
||||
and source form, for non-commercial purposes, is hereby granted without
|
||||
fee, providing that this license information and copyright notice appear
|
||||
with all copies and any derived work.
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
@ -141,14 +158,16 @@
|
||||
Nintendo Co., Limited and its subsidiary companies.
|
||||
**********************************************************************************/
|
||||
|
||||
|
||||
|
||||
/* S-DD1 decompressor
|
||||
*
|
||||
* Based on code and documentation by Andreas Naive, who deserves a great deal
|
||||
* of thanks and credit for figuring this out.
|
||||
*
|
||||
* Andreas says:
|
||||
* The author is greatly indebted with The Dumper, without whose help and
|
||||
* patience providing him with real S-DD1 data the research had never been
|
||||
* The author is greatly indebted with The Dumper, without whose help and
|
||||
* patience providing him with real S-DD1 data the research had never been
|
||||
* possible. He also wish to note that in the very beggining of his research,
|
||||
* Neviksti had done some steps in the right direction. By last, the author is
|
||||
* indirectly indebted to all the people that worked and contributed in the
|
||||
@ -274,7 +293,7 @@ static inline uint8 ProbGetBit(uint8 context){
|
||||
|
||||
static inline uint8 GetBit(uint8 cur_bitplane){
|
||||
uint8 bit;
|
||||
|
||||
|
||||
bit=ProbGetBit(((cur_bitplane&1)<<4)
|
||||
| ((prev_bits[cur_bitplane]&high_context_bits)>>5)
|
||||
| (prev_bits[cur_bitplane]&low_context_bits));
|
||||
@ -289,7 +308,7 @@ void SDD1_decompress(uint8 *out, uint8 *in, int len){
|
||||
uint8 byte1, byte2;
|
||||
|
||||
if(len==0) len=0x10000;
|
||||
|
||||
|
||||
bitplane_type=in[0]>>6;
|
||||
|
||||
switch(in[0]&0x30){
|
||||
@ -412,7 +431,7 @@ void SDD1_init(uint8 *in){
|
||||
uint8 SDD1_get_byte(void){
|
||||
uint8 bit;
|
||||
uint8 byte=0;
|
||||
|
||||
|
||||
switch(bitplane_type){
|
||||
case 0:
|
||||
num_bits+=16;
|
||||
|
@ -1,7 +1,7 @@
|
||||
/**********************************************************************************
|
||||
Snes9x - Portable Super Nintendo Entertainment System (TM) emulator.
|
||||
|
||||
(c) Copyright 1996 - 2002 Gary Henderson (gary.henderson@ntlworld.com) and
|
||||
(c) Copyright 1996 - 2002 Gary Henderson (gary.henderson@ntlworld.com),
|
||||
Jerremy Koot (jkoot@snes9x.com)
|
||||
|
||||
(c) Copyright 2002 - 2004 Matthew Kendora
|
||||
@ -12,12 +12,16 @@
|
||||
|
||||
(c) Copyright 2001 - 2006 John Weidman (jweidman@slip.net)
|
||||
|
||||
(c) Copyright 2002 - 2006 Brad Jorsch (anomie@users.sourceforge.net),
|
||||
funkyass (funkyass@spam.shaw.ca),
|
||||
Kris Bleakley (codeviolation@hotmail.com),
|
||||
Nach (n-a-c-h@users.sourceforge.net), and
|
||||
(c) Copyright 2002 - 2006 funkyass (funkyass@spam.shaw.ca),
|
||||
Kris Bleakley (codeviolation@hotmail.com)
|
||||
|
||||
(c) Copyright 2002 - 2007 Brad Jorsch (anomie@users.sourceforge.net),
|
||||
Nach (n-a-c-h@users.sourceforge.net),
|
||||
zones (kasumitokoduck@yahoo.com)
|
||||
|
||||
(c) Copyright 2006 - 2007 nitsuja
|
||||
|
||||
|
||||
BS-X C emulator code
|
||||
(c) Copyright 2005 - 2006 Dreamer Nom,
|
||||
zones
|
||||
@ -110,17 +114,30 @@
|
||||
2xSaI filter
|
||||
(c) Copyright 1999 - 2001 Derek Liauw Kie Fa
|
||||
|
||||
HQ2x filter
|
||||
HQ2x, HQ3x, HQ4x filters
|
||||
(c) Copyright 2003 Maxim Stepin (maxim@hiend3d.com)
|
||||
|
||||
Win32 GUI code
|
||||
(c) Copyright 2003 - 2006 blip,
|
||||
funkyass,
|
||||
Matthew Kendora,
|
||||
Nach,
|
||||
nitsuja
|
||||
|
||||
Mac OS GUI code
|
||||
(c) Copyright 1998 - 2001 John Stiles
|
||||
(c) Copyright 2001 - 2007 zones
|
||||
|
||||
|
||||
Specific ports contains the works of other authors. See headers in
|
||||
individual files.
|
||||
|
||||
|
||||
Snes9x homepage: http://www.snes9x.com
|
||||
|
||||
Permission to use, copy, modify and/or distribute Snes9x in both binary
|
||||
and source form, for non-commercial purposes, is hereby granted without
|
||||
fee, providing that this license information and copyright notice appear
|
||||
and source form, for non-commercial purposes, is hereby granted without
|
||||
fee, providing that this license information and copyright notice appear
|
||||
with all copies and any derived work.
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
@ -141,6 +158,8 @@
|
||||
Nintendo Co., Limited and its subsidiary companies.
|
||||
**********************************************************************************/
|
||||
|
||||
|
||||
|
||||
#ifndef SDD1EMU_H
|
||||
#define SDD1EMU_H
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
/**********************************************************************************
|
||||
Snes9x - Portable Super Nintendo Entertainment System (TM) emulator.
|
||||
|
||||
(c) Copyright 1996 - 2002 Gary Henderson (gary.henderson@ntlworld.com) and
|
||||
(c) Copyright 1996 - 2002 Gary Henderson (gary.henderson@ntlworld.com),
|
||||
Jerremy Koot (jkoot@snes9x.com)
|
||||
|
||||
(c) Copyright 2002 - 2004 Matthew Kendora
|
||||
@ -12,12 +12,16 @@
|
||||
|
||||
(c) Copyright 2001 - 2006 John Weidman (jweidman@slip.net)
|
||||
|
||||
(c) Copyright 2002 - 2006 Brad Jorsch (anomie@users.sourceforge.net),
|
||||
funkyass (funkyass@spam.shaw.ca),
|
||||
Kris Bleakley (codeviolation@hotmail.com),
|
||||
Nach (n-a-c-h@users.sourceforge.net), and
|
||||
(c) Copyright 2002 - 2006 funkyass (funkyass@spam.shaw.ca),
|
||||
Kris Bleakley (codeviolation@hotmail.com)
|
||||
|
||||
(c) Copyright 2002 - 2007 Brad Jorsch (anomie@users.sourceforge.net),
|
||||
Nach (n-a-c-h@users.sourceforge.net),
|
||||
zones (kasumitokoduck@yahoo.com)
|
||||
|
||||
(c) Copyright 2006 - 2007 nitsuja
|
||||
|
||||
|
||||
BS-X C emulator code
|
||||
(c) Copyright 2005 - 2006 Dreamer Nom,
|
||||
zones
|
||||
@ -110,17 +114,30 @@
|
||||
2xSaI filter
|
||||
(c) Copyright 1999 - 2001 Derek Liauw Kie Fa
|
||||
|
||||
HQ2x filter
|
||||
HQ2x, HQ3x, HQ4x filters
|
||||
(c) Copyright 2003 Maxim Stepin (maxim@hiend3d.com)
|
||||
|
||||
Win32 GUI code
|
||||
(c) Copyright 2003 - 2006 blip,
|
||||
funkyass,
|
||||
Matthew Kendora,
|
||||
Nach,
|
||||
nitsuja
|
||||
|
||||
Mac OS GUI code
|
||||
(c) Copyright 1998 - 2001 John Stiles
|
||||
(c) Copyright 2001 - 2007 zones
|
||||
|
||||
|
||||
Specific ports contains the works of other authors. See headers in
|
||||
individual files.
|
||||
|
||||
|
||||
Snes9x homepage: http://www.snes9x.com
|
||||
|
||||
Permission to use, copy, modify and/or distribute Snes9x in both binary
|
||||
and source form, for non-commercial purposes, is hereby granted without
|
||||
fee, providing that this license information and copyright notice appear
|
||||
and source form, for non-commercial purposes, is hereby granted without
|
||||
fee, providing that this license information and copyright notice appear
|
||||
with all copies and any derived work.
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
@ -141,6 +158,8 @@
|
||||
Nintendo Co., Limited and its subsidiary companies.
|
||||
**********************************************************************************/
|
||||
|
||||
|
||||
|
||||
#include "seta.h"
|
||||
|
||||
void (*SetSETA)(uint32, uint8)=&S9xSetST010;
|
||||
|
@ -1,7 +1,7 @@
|
||||
/**********************************************************************************
|
||||
Snes9x - Portable Super Nintendo Entertainment System (TM) emulator.
|
||||
|
||||
(c) Copyright 1996 - 2002 Gary Henderson (gary.henderson@ntlworld.com) and
|
||||
(c) Copyright 1996 - 2002 Gary Henderson (gary.henderson@ntlworld.com),
|
||||
Jerremy Koot (jkoot@snes9x.com)
|
||||
|
||||
(c) Copyright 2002 - 2004 Matthew Kendora
|
||||
@ -12,12 +12,16 @@
|
||||
|
||||
(c) Copyright 2001 - 2006 John Weidman (jweidman@slip.net)
|
||||
|
||||
(c) Copyright 2002 - 2006 Brad Jorsch (anomie@users.sourceforge.net),
|
||||
funkyass (funkyass@spam.shaw.ca),
|
||||
Kris Bleakley (codeviolation@hotmail.com),
|
||||
Nach (n-a-c-h@users.sourceforge.net), and
|
||||
(c) Copyright 2002 - 2006 funkyass (funkyass@spam.shaw.ca),
|
||||
Kris Bleakley (codeviolation@hotmail.com)
|
||||
|
||||
(c) Copyright 2002 - 2007 Brad Jorsch (anomie@users.sourceforge.net),
|
||||
Nach (n-a-c-h@users.sourceforge.net),
|
||||
zones (kasumitokoduck@yahoo.com)
|
||||
|
||||
(c) Copyright 2006 - 2007 nitsuja
|
||||
|
||||
|
||||
BS-X C emulator code
|
||||
(c) Copyright 2005 - 2006 Dreamer Nom,
|
||||
zones
|
||||
@ -110,17 +114,30 @@
|
||||
2xSaI filter
|
||||
(c) Copyright 1999 - 2001 Derek Liauw Kie Fa
|
||||
|
||||
HQ2x filter
|
||||
HQ2x, HQ3x, HQ4x filters
|
||||
(c) Copyright 2003 Maxim Stepin (maxim@hiend3d.com)
|
||||
|
||||
Win32 GUI code
|
||||
(c) Copyright 2003 - 2006 blip,
|
||||
funkyass,
|
||||
Matthew Kendora,
|
||||
Nach,
|
||||
nitsuja
|
||||
|
||||
Mac OS GUI code
|
||||
(c) Copyright 1998 - 2001 John Stiles
|
||||
(c) Copyright 2001 - 2007 zones
|
||||
|
||||
|
||||
Specific ports contains the works of other authors. See headers in
|
||||
individual files.
|
||||
|
||||
|
||||
Snes9x homepage: http://www.snes9x.com
|
||||
|
||||
Permission to use, copy, modify and/or distribute Snes9x in both binary
|
||||
and source form, for non-commercial purposes, is hereby granted without
|
||||
fee, providing that this license information and copyright notice appear
|
||||
and source form, for non-commercial purposes, is hereby granted without
|
||||
fee, providing that this license information and copyright notice appear
|
||||
with all copies and any derived work.
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
@ -142,6 +159,8 @@
|
||||
**********************************************************************************/
|
||||
|
||||
|
||||
|
||||
|
||||
#ifndef NO_SETA
|
||||
#ifndef _seta_h
|
||||
#define _seta_h
|
||||
|
@ -1,7 +1,7 @@
|
||||
/**********************************************************************************
|
||||
Snes9x - Portable Super Nintendo Entertainment System (TM) emulator.
|
||||
|
||||
(c) Copyright 1996 - 2002 Gary Henderson (gary.henderson@ntlworld.com) and
|
||||
(c) Copyright 1996 - 2002 Gary Henderson (gary.henderson@ntlworld.com),
|
||||
Jerremy Koot (jkoot@snes9x.com)
|
||||
|
||||
(c) Copyright 2002 - 2004 Matthew Kendora
|
||||
@ -12,12 +12,16 @@
|
||||
|
||||
(c) Copyright 2001 - 2006 John Weidman (jweidman@slip.net)
|
||||
|
||||
(c) Copyright 2002 - 2006 Brad Jorsch (anomie@users.sourceforge.net),
|
||||
funkyass (funkyass@spam.shaw.ca),
|
||||
Kris Bleakley (codeviolation@hotmail.com),
|
||||
Nach (n-a-c-h@users.sourceforge.net), and
|
||||
(c) Copyright 2002 - 2006 funkyass (funkyass@spam.shaw.ca),
|
||||
Kris Bleakley (codeviolation@hotmail.com)
|
||||
|
||||
(c) Copyright 2002 - 2007 Brad Jorsch (anomie@users.sourceforge.net),
|
||||
Nach (n-a-c-h@users.sourceforge.net),
|
||||
zones (kasumitokoduck@yahoo.com)
|
||||
|
||||
(c) Copyright 2006 - 2007 nitsuja
|
||||
|
||||
|
||||
BS-X C emulator code
|
||||
(c) Copyright 2005 - 2006 Dreamer Nom,
|
||||
zones
|
||||
@ -110,17 +114,30 @@
|
||||
2xSaI filter
|
||||
(c) Copyright 1999 - 2001 Derek Liauw Kie Fa
|
||||
|
||||
HQ2x filter
|
||||
HQ2x, HQ3x, HQ4x filters
|
||||
(c) Copyright 2003 Maxim Stepin (maxim@hiend3d.com)
|
||||
|
||||
Win32 GUI code
|
||||
(c) Copyright 2003 - 2006 blip,
|
||||
funkyass,
|
||||
Matthew Kendora,
|
||||
Nach,
|
||||
nitsuja
|
||||
|
||||
Mac OS GUI code
|
||||
(c) Copyright 1998 - 2001 John Stiles
|
||||
(c) Copyright 2001 - 2007 zones
|
||||
|
||||
|
||||
Specific ports contains the works of other authors. See headers in
|
||||
individual files.
|
||||
|
||||
|
||||
Snes9x homepage: http://www.snes9x.com
|
||||
|
||||
Permission to use, copy, modify and/or distribute Snes9x in both binary
|
||||
and source form, for non-commercial purposes, is hereby granted without
|
||||
fee, providing that this license information and copyright notice appear
|
||||
and source form, for non-commercial purposes, is hereby granted without
|
||||
fee, providing that this license information and copyright notice appear
|
||||
with all copies and any derived work.
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
@ -141,6 +158,8 @@
|
||||
Nintendo Co., Limited and its subsidiary companies.
|
||||
**********************************************************************************/
|
||||
|
||||
|
||||
|
||||
#include "seta.h"
|
||||
#include "memmap.h"
|
||||
|
||||
@ -307,7 +326,7 @@ short ST010_Cos(short Theta)
|
||||
void ST010_OP01(short x0, short y0, short &x1, short &y1, short &Quadrant, short &Theta)
|
||||
{
|
||||
if ((x0 < 0) && (y0 < 0))
|
||||
{
|
||||
{
|
||||
x1 = -x0;
|
||||
y1 = -y0;
|
||||
Quadrant = -0x8000;
|
||||
@ -327,7 +346,7 @@ void ST010_OP01(short x0, short y0, short &x1, short &y1, short &Quadrant, short
|
||||
else
|
||||
{
|
||||
x1 = x0;
|
||||
y1 = y0;
|
||||
y1 = y0;
|
||||
Quadrant = 0x0000;
|
||||
}
|
||||
|
||||
@ -366,7 +385,7 @@ void SETA_Distance(short Y0, short X0, short &Distance)
|
||||
Distance = ((X0 * 0x7af0) + 0x4000) >> 15;
|
||||
}
|
||||
|
||||
void ST010_SortDrivers(uint16 Positions, uint16 Places[32], uint16 Drivers[32])
|
||||
void ST010_SortDrivers(uint16 Positions, uint16 Places[32], uint16 Drivers[32])
|
||||
{
|
||||
bool Sorted;
|
||||
uint16 Temp;
|
||||
@ -375,7 +394,7 @@ void ST010_SortDrivers(uint16 Positions, uint16 Places[32], uint16 Drivers[32])
|
||||
do {
|
||||
Sorted = true;
|
||||
for (int i = 0; i < Positions - 1; i++)
|
||||
if (Places[i] < Places[i + 1])
|
||||
if (Places[i] < Places[i + 1])
|
||||
{
|
||||
Temp = Places[i + 1];
|
||||
Places[i + 1] = Places[i];
|
||||
@ -425,7 +444,7 @@ void S9xSetST010(uint32 Address, uint8 Byte)
|
||||
case 0x02:
|
||||
{
|
||||
#ifdef FAST_LSB_WORD_ACCESS
|
||||
ST010_SortDrivers(*(short*)&SRAM[0x0024], (uint16*) (SRAM + 0x0040), (uint16*) (SRAM + 0x0080));
|
||||
ST010_SortDrivers(*(uint16*)(Memory.SRAM + 0x0024), (uint16*) (Memory.SRAM + 0x0040), (uint16*) (Memory.SRAM + 0x0080));
|
||||
#else
|
||||
uint16 Places[32];
|
||||
uint16 Positions = ST010_WORD(0x0024);
|
||||
@ -433,25 +452,25 @@ void S9xSetST010(uint32 Address, uint8 Byte)
|
||||
|
||||
Offset = 0;
|
||||
|
||||
for (Pos = 0; Pos < Positions; Pos++)
|
||||
for (Pos = 0; Pos < Positions; Pos++)
|
||||
{
|
||||
Places[Pos] = ST010_WORD(0x0040 + Offset);
|
||||
Offset += 2;
|
||||
}
|
||||
|
||||
ST010_SortDrivers(Positions, Places, (uint16*) (SRAM + 0x0080));
|
||||
ST010_SortDrivers(Positions, Places, (uint16*) (Memory.SRAM + 0x0080));
|
||||
|
||||
Offset = 0;
|
||||
|
||||
for (Pos = 0; Pos < Positions; Pos++)
|
||||
{
|
||||
SRAM[0x0040 + Offset]=(uint8)(Places[Pos]);
|
||||
SRAM[0x0041 + Offset]=(uint8)(Places[Pos] >> 8);
|
||||
Memory.SRAM[0x0040 + Offset]=(uint8)(Places[Pos]);
|
||||
Memory.SRAM[0x0041 + Offset]=(uint8)(Places[Pos] >> 8);
|
||||
Offset += 2;
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
break;
|
||||
|
||||
|
||||
}
|
||||
|
||||
// Two Dimensional Coordinate Scale
|
||||
@ -531,23 +550,23 @@ void S9xSetST010(uint32 Address, uint8 Byte)
|
||||
{
|
||||
// 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);
|
||||
Memory.SRAM[0x0511 + offset]=(uint8)(data >> 8);
|
||||
|
||||
// Calculate Mode 7 Matrix B/C data
|
||||
data = ST010_M7Scale[line] * ST010_Sin(Theta) >> 15;
|
||||
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;
|
||||
}
|
||||
|
||||
@ -655,9 +674,9 @@ void S9xSetST010(uint32 Address, uint8 Byte)
|
||||
int16 xpos_max = ST010_WORD(0x00C2);
|
||||
|
||||
// current coordinates and direction
|
||||
int32 ypos = SRAM[0xC4]|(SRAM[0xC5]<<8)|(SRAM[0xC6]<<16)|(SRAM[0xC7]<<24);
|
||||
int32 xpos = SRAM[0xC8]|(SRAM[0xC9]<<8)|(SRAM[0xCA]<<16)|(SRAM[0xCB]<<24);
|
||||
uint16 rot = SRAM[0xCC]|(SRAM[0xCD]<<8);
|
||||
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);
|
||||
@ -680,10 +699,10 @@ void S9xSetST010(uint32 Address, uint8 Byte)
|
||||
dy = ypos_max-(ypos>>16);
|
||||
|
||||
// quirk: clear and move in9
|
||||
SRAM[0xD2]=0xFF;
|
||||
SRAM[0xD3]=0xFF;
|
||||
SRAM[0xDA]=0;
|
||||
SRAM[0xDB]=0;
|
||||
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);
|
||||
@ -770,24 +789,24 @@ void S9xSetST010(uint32 Address, uint8 Byte)
|
||||
xpos &= 0x1FFFFFFF;
|
||||
ypos &= 0x1FFFFFFF;
|
||||
|
||||
SRAM[0x00C0]=(uint8)(ypos_max);
|
||||
SRAM[0x00C1]=(uint8)(ypos_max >> 8);
|
||||
SRAM[0x00C2]=(uint8)(xpos_max);
|
||||
SRAM[0x00C3]=(uint8)(xpos_max >> 8);
|
||||
SRAM[0x00C4]=(uint8)(ypos);
|
||||
SRAM[0x00C5]=(uint8)(ypos >> 8);
|
||||
SRAM[0x00C6]=(uint8)(ypos >> 16);
|
||||
SRAM[0x00C7]=(uint8)(ypos >> 24);
|
||||
SRAM[0x00C8]=(uint8)(xpos);
|
||||
SRAM[0x00C9]=(uint8)(xpos >> 8);
|
||||
SRAM[0x00CA]=(uint8)(xpos >> 16);
|
||||
SRAM[0x00CB]=(uint8)(xpos >> 24);
|
||||
SRAM[0x00CC]=(uint8)(rot);
|
||||
SRAM[0x00CD]=(uint8)(rot >> 8);
|
||||
SRAM[0x00D4]=(uint8)(speed);
|
||||
SRAM[0x00D5]=(uint8)(speed >> 8);
|
||||
SRAM[0x00DC]=(uint8)(flags);
|
||||
SRAM[0x00DD]=(uint8)(flags >> 8);
|
||||
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;
|
||||
}
|
||||
|
@ -1,7 +1,7 @@
|
||||
/**********************************************************************************
|
||||
Snes9x - Portable Super Nintendo Entertainment System (TM) emulator.
|
||||
|
||||
(c) Copyright 1996 - 2002 Gary Henderson (gary.henderson@ntlworld.com) and
|
||||
(c) Copyright 1996 - 2002 Gary Henderson (gary.henderson@ntlworld.com),
|
||||
Jerremy Koot (jkoot@snes9x.com)
|
||||
|
||||
(c) Copyright 2002 - 2004 Matthew Kendora
|
||||
@ -12,12 +12,16 @@
|
||||
|
||||
(c) Copyright 2001 - 2006 John Weidman (jweidman@slip.net)
|
||||
|
||||
(c) Copyright 2002 - 2006 Brad Jorsch (anomie@users.sourceforge.net),
|
||||
funkyass (funkyass@spam.shaw.ca),
|
||||
Kris Bleakley (codeviolation@hotmail.com),
|
||||
Nach (n-a-c-h@users.sourceforge.net), and
|
||||
(c) Copyright 2002 - 2006 funkyass (funkyass@spam.shaw.ca),
|
||||
Kris Bleakley (codeviolation@hotmail.com)
|
||||
|
||||
(c) Copyright 2002 - 2007 Brad Jorsch (anomie@users.sourceforge.net),
|
||||
Nach (n-a-c-h@users.sourceforge.net),
|
||||
zones (kasumitokoduck@yahoo.com)
|
||||
|
||||
(c) Copyright 2006 - 2007 nitsuja
|
||||
|
||||
|
||||
BS-X C emulator code
|
||||
(c) Copyright 2005 - 2006 Dreamer Nom,
|
||||
zones
|
||||
@ -110,17 +114,30 @@
|
||||
2xSaI filter
|
||||
(c) Copyright 1999 - 2001 Derek Liauw Kie Fa
|
||||
|
||||
HQ2x filter
|
||||
HQ2x, HQ3x, HQ4x filters
|
||||
(c) Copyright 2003 Maxim Stepin (maxim@hiend3d.com)
|
||||
|
||||
Win32 GUI code
|
||||
(c) Copyright 2003 - 2006 blip,
|
||||
funkyass,
|
||||
Matthew Kendora,
|
||||
Nach,
|
||||
nitsuja
|
||||
|
||||
Mac OS GUI code
|
||||
(c) Copyright 1998 - 2001 John Stiles
|
||||
(c) Copyright 2001 - 2007 zones
|
||||
|
||||
|
||||
Specific ports contains the works of other authors. See headers in
|
||||
individual files.
|
||||
|
||||
|
||||
Snes9x homepage: http://www.snes9x.com
|
||||
|
||||
Permission to use, copy, modify and/or distribute Snes9x in both binary
|
||||
and source form, for non-commercial purposes, is hereby granted without
|
||||
fee, providing that this license information and copyright notice appear
|
||||
and source form, for non-commercial purposes, is hereby granted without
|
||||
fee, providing that this license information and copyright notice appear
|
||||
with all copies and any derived work.
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
@ -141,6 +158,8 @@
|
||||
Nintendo Co., Limited and its subsidiary companies.
|
||||
**********************************************************************************/
|
||||
|
||||
|
||||
|
||||
#include <stdio.h>
|
||||
#include "seta.h"
|
||||
#include "memmap.h"
|
||||
@ -171,7 +190,7 @@ uint8 S9xGetST011(uint32 Address)
|
||||
{
|
||||
t = Memory.SRAM[address];
|
||||
}
|
||||
|
||||
|
||||
// debug
|
||||
// if(address<0x150)
|
||||
// printf( "ST011 R: %06X %02X\n", Address, t);
|
||||
@ -260,7 +279,7 @@ void S9xSetST011(uint32 Address, uint8 Byte)
|
||||
break;
|
||||
|
||||
// unknown
|
||||
case 0x05:
|
||||
case 0x05:
|
||||
{
|
||||
// outputs
|
||||
Memory.SRAM[0x12C] = 0x00;
|
||||
|
@ -1,7 +1,7 @@
|
||||
/**********************************************************************************
|
||||
Snes9x - Portable Super Nintendo Entertainment System (TM) emulator.
|
||||
|
||||
(c) Copyright 1996 - 2002 Gary Henderson (gary.henderson@ntlworld.com) and
|
||||
(c) Copyright 1996 - 2002 Gary Henderson (gary.henderson@ntlworld.com),
|
||||
Jerremy Koot (jkoot@snes9x.com)
|
||||
|
||||
(c) Copyright 2002 - 2004 Matthew Kendora
|
||||
@ -12,12 +12,16 @@
|
||||
|
||||
(c) Copyright 2001 - 2006 John Weidman (jweidman@slip.net)
|
||||
|
||||
(c) Copyright 2002 - 2006 Brad Jorsch (anomie@users.sourceforge.net),
|
||||
funkyass (funkyass@spam.shaw.ca),
|
||||
Kris Bleakley (codeviolation@hotmail.com),
|
||||
Nach (n-a-c-h@users.sourceforge.net), and
|
||||
(c) Copyright 2002 - 2006 funkyass (funkyass@spam.shaw.ca),
|
||||
Kris Bleakley (codeviolation@hotmail.com)
|
||||
|
||||
(c) Copyright 2002 - 2007 Brad Jorsch (anomie@users.sourceforge.net),
|
||||
Nach (n-a-c-h@users.sourceforge.net),
|
||||
zones (kasumitokoduck@yahoo.com)
|
||||
|
||||
(c) Copyright 2006 - 2007 nitsuja
|
||||
|
||||
|
||||
BS-X C emulator code
|
||||
(c) Copyright 2005 - 2006 Dreamer Nom,
|
||||
zones
|
||||
@ -110,17 +114,30 @@
|
||||
2xSaI filter
|
||||
(c) Copyright 1999 - 2001 Derek Liauw Kie Fa
|
||||
|
||||
HQ2x filter
|
||||
HQ2x, HQ3x, HQ4x filters
|
||||
(c) Copyright 2003 Maxim Stepin (maxim@hiend3d.com)
|
||||
|
||||
Win32 GUI code
|
||||
(c) Copyright 2003 - 2006 blip,
|
||||
funkyass,
|
||||
Matthew Kendora,
|
||||
Nach,
|
||||
nitsuja
|
||||
|
||||
Mac OS GUI code
|
||||
(c) Copyright 1998 - 2001 John Stiles
|
||||
(c) Copyright 2001 - 2007 zones
|
||||
|
||||
|
||||
Specific ports contains the works of other authors. See headers in
|
||||
individual files.
|
||||
|
||||
|
||||
Snes9x homepage: http://www.snes9x.com
|
||||
|
||||
Permission to use, copy, modify and/or distribute Snes9x in both binary
|
||||
and source form, for non-commercial purposes, is hereby granted without
|
||||
fee, providing that this license information and copyright notice appear
|
||||
and source form, for non-commercial purposes, is hereby granted without
|
||||
fee, providing that this license information and copyright notice appear
|
||||
with all copies and any derived work.
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
@ -141,6 +158,8 @@
|
||||
Nintendo Co., Limited and its subsidiary companies.
|
||||
**********************************************************************************/
|
||||
|
||||
|
||||
|
||||
#include "seta.h"
|
||||
#include "memmap.h"
|
||||
|
||||
@ -173,7 +192,7 @@ uint8 S9xGetST018(uint32 Address)
|
||||
// status register
|
||||
else if (address == 0x3800)
|
||||
t = ST018.status;
|
||||
|
||||
|
||||
printf( "ST018 R: %06X %02X\n", Address, t);
|
||||
|
||||
return t;
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -1,7 +1,7 @@
|
||||
/**********************************************************************************
|
||||
Snes9x - Portable Super Nintendo Entertainment System (TM) emulator.
|
||||
|
||||
(c) Copyright 1996 - 2002 Gary Henderson (gary.henderson@ntlworld.com) and
|
||||
(c) Copyright 1996 - 2002 Gary Henderson (gary.henderson@ntlworld.com),
|
||||
Jerremy Koot (jkoot@snes9x.com)
|
||||
|
||||
(c) Copyright 2002 - 2004 Matthew Kendora
|
||||
@ -12,12 +12,16 @@
|
||||
|
||||
(c) Copyright 2001 - 2006 John Weidman (jweidman@slip.net)
|
||||
|
||||
(c) Copyright 2002 - 2006 Brad Jorsch (anomie@users.sourceforge.net),
|
||||
funkyass (funkyass@spam.shaw.ca),
|
||||
Kris Bleakley (codeviolation@hotmail.com),
|
||||
Nach (n-a-c-h@users.sourceforge.net), and
|
||||
(c) Copyright 2002 - 2006 funkyass (funkyass@spam.shaw.ca),
|
||||
Kris Bleakley (codeviolation@hotmail.com)
|
||||
|
||||
(c) Copyright 2002 - 2007 Brad Jorsch (anomie@users.sourceforge.net),
|
||||
Nach (n-a-c-h@users.sourceforge.net),
|
||||
zones (kasumitokoduck@yahoo.com)
|
||||
|
||||
(c) Copyright 2006 - 2007 nitsuja
|
||||
|
||||
|
||||
BS-X C emulator code
|
||||
(c) Copyright 2005 - 2006 Dreamer Nom,
|
||||
zones
|
||||
@ -110,17 +114,30 @@
|
||||
2xSaI filter
|
||||
(c) Copyright 1999 - 2001 Derek Liauw Kie Fa
|
||||
|
||||
HQ2x filter
|
||||
HQ2x, HQ3x, HQ4x filters
|
||||
(c) Copyright 2003 Maxim Stepin (maxim@hiend3d.com)
|
||||
|
||||
Win32 GUI code
|
||||
(c) Copyright 2003 - 2006 blip,
|
||||
funkyass,
|
||||
Matthew Kendora,
|
||||
Nach,
|
||||
nitsuja
|
||||
|
||||
Mac OS GUI code
|
||||
(c) Copyright 1998 - 2001 John Stiles
|
||||
(c) Copyright 2001 - 2007 zones
|
||||
|
||||
|
||||
Specific ports contains the works of other authors. See headers in
|
||||
individual files.
|
||||
|
||||
|
||||
Snes9x homepage: http://www.snes9x.com
|
||||
|
||||
Permission to use, copy, modify and/or distribute Snes9x in both binary
|
||||
and source form, for non-commercial purposes, is hereby granted without
|
||||
fee, providing that this license information and copyright notice appear
|
||||
and source form, for non-commercial purposes, is hereby granted without
|
||||
fee, providing that this license information and copyright notice appear
|
||||
with all copies and any derived work.
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
@ -141,6 +158,8 @@
|
||||
Nintendo Co., Limited and its subsidiary companies.
|
||||
**********************************************************************************/
|
||||
|
||||
|
||||
|
||||
#ifndef _SNAPSHOT_H_
|
||||
#define _SNAPSHOT_H_
|
||||
|
||||
@ -148,7 +167,7 @@
|
||||
#include "snes9x.h"
|
||||
|
||||
#define SNAPSHOT_MAGIC "#!snes9x"
|
||||
#define SNAPSHOT_VERSION 2
|
||||
#define SNAPSHOT_VERSION 4
|
||||
|
||||
#define SUCCESS 1
|
||||
#define WRONG_FORMAT (-1)
|
||||
@ -156,6 +175,7 @@
|
||||
#define FILE_NOT_FOUND (-3)
|
||||
#define WRONG_MOVIE_SNAPSHOT (-4)
|
||||
#define NOT_A_MOVIE_SNAPSHOT (-5)
|
||||
#define SNAPSHOT_INCONSISTENT (-6)
|
||||
|
||||
START_EXTERN_C
|
||||
void S9xResetSaveTimer(bool8 dontsave);
|
||||
|
@ -1,7 +1,7 @@
|
||||
/**********************************************************************************
|
||||
Snes9x - Portable Super Nintendo Entertainment System (TM) emulator.
|
||||
|
||||
(c) Copyright 1996 - 2002 Gary Henderson (gary.henderson@ntlworld.com) and
|
||||
(c) Copyright 1996 - 2002 Gary Henderson (gary.henderson@ntlworld.com),
|
||||
Jerremy Koot (jkoot@snes9x.com)
|
||||
|
||||
(c) Copyright 2002 - 2004 Matthew Kendora
|
||||
@ -12,12 +12,16 @@
|
||||
|
||||
(c) Copyright 2001 - 2006 John Weidman (jweidman@slip.net)
|
||||
|
||||
(c) Copyright 2002 - 2006 Brad Jorsch (anomie@users.sourceforge.net),
|
||||
funkyass (funkyass@spam.shaw.ca),
|
||||
Kris Bleakley (codeviolation@hotmail.com),
|
||||
Nach (n-a-c-h@users.sourceforge.net), and
|
||||
(c) Copyright 2002 - 2006 funkyass (funkyass@spam.shaw.ca),
|
||||
Kris Bleakley (codeviolation@hotmail.com)
|
||||
|
||||
(c) Copyright 2002 - 2007 Brad Jorsch (anomie@users.sourceforge.net),
|
||||
Nach (n-a-c-h@users.sourceforge.net),
|
||||
zones (kasumitokoduck@yahoo.com)
|
||||
|
||||
(c) Copyright 2006 - 2007 nitsuja
|
||||
|
||||
|
||||
BS-X C emulator code
|
||||
(c) Copyright 2005 - 2006 Dreamer Nom,
|
||||
zones
|
||||
@ -110,17 +114,30 @@
|
||||
2xSaI filter
|
||||
(c) Copyright 1999 - 2001 Derek Liauw Kie Fa
|
||||
|
||||
HQ2x filter
|
||||
HQ2x, HQ3x, HQ4x filters
|
||||
(c) Copyright 2003 Maxim Stepin (maxim@hiend3d.com)
|
||||
|
||||
Win32 GUI code
|
||||
(c) Copyright 2003 - 2006 blip,
|
||||
funkyass,
|
||||
Matthew Kendora,
|
||||
Nach,
|
||||
nitsuja
|
||||
|
||||
Mac OS GUI code
|
||||
(c) Copyright 1998 - 2001 John Stiles
|
||||
(c) Copyright 2001 - 2007 zones
|
||||
|
||||
|
||||
Specific ports contains the works of other authors. See headers in
|
||||
individual files.
|
||||
|
||||
|
||||
Snes9x homepage: http://www.snes9x.com
|
||||
|
||||
Permission to use, copy, modify and/or distribute Snes9x in both binary
|
||||
and source form, for non-commercial purposes, is hereby granted without
|
||||
fee, providing that this license information and copyright notice appear
|
||||
and source form, for non-commercial purposes, is hereby granted without
|
||||
fee, providing that this license information and copyright notice appear
|
||||
with all copies and any derived work.
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
@ -141,6 +158,8 @@
|
||||
Nintendo Co., Limited and its subsidiary companies.
|
||||
**********************************************************************************/
|
||||
|
||||
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <ctype.h>
|
||||
@ -160,7 +179,9 @@
|
||||
|
||||
#ifndef NGC
|
||||
#include "netplay.h"
|
||||
#include "logger.h"
|
||||
#endif
|
||||
#include "gfx.h"
|
||||
|
||||
#ifdef DEBUGGER
|
||||
extern FILE *trace;
|
||||
@ -182,11 +203,10 @@ void S9xUsage ()
|
||||
S9xMessage(S9X_INFO, S9X_USAGE, "-ratio or -ra <num> Ratio of 65c816 to SPC700 instructions (ignored)");
|
||||
#endif
|
||||
S9xMessage(S9X_INFO, S9X_USAGE, "-soundquality, -sq, or -r <num> Set sound playback quality");
|
||||
#ifdef __sgi
|
||||
/* BS: changed the sample rate values to match the IRIX options */
|
||||
#ifndef __MSDOS__
|
||||
S9xMessage (S9X_INFO, S9X_USAGE, "\
|
||||
0 - off, 1 - 8192, 2 - 11025, 3 - 16000,\n\
|
||||
4 - 22050 (default), 5 - 32000, 6 - 44100,\n\
|
||||
4 - 22050, 5 - 32000 (default), 6 - 44100,\n\
|
||||
7 - 48000");
|
||||
#else
|
||||
S9xMessage (S9X_INFO, S9X_USAGE, "\
|
||||
@ -202,8 +222,7 @@ void S9xUsage ()
|
||||
#ifdef USE_THREADS
|
||||
S9xMessage(S9X_INFO, S9X_USAGE, "-threadsound or -ts Use a separate thread to output sound");
|
||||
#endif
|
||||
S9xMessage(S9X_INFO, S9X_USAGE, "-interpolatedsound or -is <0-3> Select sound interpolation method\n\
|
||||
0=none, 1=linear, 2=cubic, 3=gaussian");
|
||||
S9xMessage(S9X_INFO, S9X_USAGE, "-nois Turn off interpolated sound");
|
||||
S9xMessage(S9X_INFO, S9X_USAGE, "-echo or -e Enable DSP echo effects at startup");
|
||||
S9xMessage(S9X_INFO, S9X_USAGE, "-noecho or -ne Disable DSP echo effects at startup");
|
||||
S9xMessage(S9X_INFO, S9X_USAGE, "-envx or -ex Enable volume envelope height reading");
|
||||
@ -211,7 +230,7 @@ void S9xUsage ()
|
||||
S9xMessage(S9X_INFO, S9X_USAGE, "-nomastervolume or -nmv Disable master volume setting");
|
||||
S9xMessage(S9X_INFO, S9X_USAGE, "-fix 'Fix' sound frequencies");
|
||||
S9xMessage(S9X_INFO, S9X_USAGE, "");
|
||||
|
||||
|
||||
/* FEATURE OPTIONS */
|
||||
S9xMessage(S9X_INFO, S9X_USAGE, "-conf <filename> Use specified conf file (after standard files)");
|
||||
S9xMessage(S9X_INFO, S9X_USAGE, "-nostdconf Do not load the standard config files");
|
||||
@ -258,11 +277,17 @@ void S9xUsage ()
|
||||
S9xMessage(S9X_INFO, S9X_USAGE, "-nodsp1 Force detection of no DSP-1 chip");
|
||||
S9xMessage(S9X_INFO, S9X_USAGE, "");
|
||||
|
||||
#ifdef DEBUGGER
|
||||
/* Multi ROMs OPTIONS */
|
||||
S9xMessage(S9X_INFO, S9X_USAGE, "-multi Enable multi cartridge system");
|
||||
S9xMessage(S9X_INFO, S9X_USAGE, "-carta <filename> ROM in slot A. Use with -multi");
|
||||
S9xMessage(S9X_INFO, S9X_USAGE, "-cartb <filename> ROM in slot B. Use with -multi");
|
||||
|
||||
/* OPTIONS FOR DEBUGGING USE */
|
||||
S9xMessage(S9X_INFO, S9X_USAGE, "-cycles or -h <1-199> Percentage of CPU cycles to execute per scanline");
|
||||
S9xMessage(S9X_INFO, S9X_USAGE, "-hdmahacks or -h <1-199> Changes HDMA transfer timing");
|
||||
S9xMessage(S9X_INFO, S9X_USAGE, "-speedhacks or -sh Enable speed hacks");
|
||||
S9xMessage(S9X_INFO, S9X_USAGE, "-nospeedhacks or -nsh Disable speed hacks");
|
||||
S9xMessage(S9X_INFO, S9X_USAGE, "-invalidvramaccess Allow invalid VRAM access");
|
||||
#ifdef DEBUGGER
|
||||
S9xMessage(S9X_INFO, S9X_USAGE, "-debug or -d Set the Debugger flag at startup");
|
||||
S9xMessage(S9X_INFO, S9X_USAGE, "-trace or -t Begin CPU instruction tracing at startup");
|
||||
S9xMessage(S9X_INFO, S9X_USAGE, "-noirq Disable processor IRQ (for debugging)");
|
||||
@ -296,7 +321,7 @@ void S9xUsage ()
|
||||
S9xMessage(S9X_INFO, S9X_USAGE, " one-justifier ditto");
|
||||
S9xMessage(S9X_INFO, S9X_USAGE, " two-justifiers Blue & Pink Justifiers");
|
||||
S9xMessage(S9X_INFO, S9X_USAGE, " mp5:#### MP5 with the 4 named pads (1-8 or n)");
|
||||
|
||||
|
||||
S9xMessage(S9X_INFO, S9X_USAGE, "");
|
||||
|
||||
#ifdef NETPLAY_SUPPORT
|
||||
@ -316,15 +341,24 @@ void S9xUsage ()
|
||||
S9xMessage(S9X_INFO, S9X_USAGE, "-ahiunit <num> Set AHI Unit to <num>");
|
||||
S9xMessage(S9X_INFO, S9X_USAGE, "");
|
||||
#endif
|
||||
|
||||
S9xMessage(S9X_INFO, S9X_USAGE, " DeHackEd's commands:");
|
||||
S9xMessage(S9X_INFO, S9X_USAGE, "-dumpstreams Save audio/video data to disk");
|
||||
S9xMessage(S9X_INFO, S9X_USAGE, "-mute Don't output audio to sound card, use with above.");
|
||||
S9xMessage(S9X_INFO, S9X_USAGE, "-upanddown Override protection from pressing");
|
||||
S9xMessage(S9X_INFO, S9X_USAGE, " left+right or up+down together");
|
||||
S9xMessage(S9X_INFO, S9X_USAGE, "-autodemo Start emulator playing a movie");
|
||||
S9xMessage(S9X_INFO, S9X_USAGE, "-maxframes <num> Stop emulator after playing specified");
|
||||
S9xMessage(S9X_INFO, S9X_USAGE, " number of frames. Requires -dumpstreams");
|
||||
S9xMessage(S9X_INFO, S9X_USAGE, "-oldturbo Turbo button renders all frames, but slower");
|
||||
S9xMessage(S9X_INFO, S9X_USAGE, "");
|
||||
#ifndef NGC
|
||||
S9xExtraUsage();
|
||||
S9xExtraUsage();
|
||||
#endif
|
||||
|
||||
S9xMessage (S9X_INFO, S9X_USAGE, "\
|
||||
\nROM image needs to be in Super MagiCom (*.smc), Super FamiCom (*.sfc),\n\
|
||||
*.fig, or split (*.1, *.2, or sf32527a, sf32527b, etc) format and can be\n\
|
||||
compressed with zip, gzip, or compress.\n");
|
||||
compressed with zip, gzip, JMA, or compress.\n");
|
||||
|
||||
exit (1);
|
||||
}
|
||||
@ -422,13 +456,13 @@ char *S9xParseArgs (char **argv, int argc)
|
||||
S9xUsage ();
|
||||
}
|
||||
else if (strcasecmp (argv [i], "-h") == 0 ||
|
||||
strcasecmp (argv [i], "-cycles") == 0)
|
||||
strcasecmp (argv [i], "-hdmahacks") == 0)
|
||||
{
|
||||
if (i + 1 < argc)
|
||||
{
|
||||
int p = atoi (argv [++i]);
|
||||
if (p > 0 && p < 200)
|
||||
Settings.CyclesPercentage = p;
|
||||
Settings.HDMATimingHack = p;
|
||||
}
|
||||
else
|
||||
S9xUsage ();
|
||||
@ -453,6 +487,10 @@ char *S9xParseArgs (char **argv, int argc)
|
||||
{
|
||||
Settings.ShutdownMaster = TRUE;
|
||||
}
|
||||
else if (strcasecmp (argv [i], "-invalidvramaccess") == 0)
|
||||
{
|
||||
Settings.BlockInvalidVRAMAccess = FALSE;
|
||||
}
|
||||
else if (strcasecmp (argv [i], "-p") == 0 ||
|
||||
strcasecmp (argv [i], "-pal") == 0)
|
||||
{
|
||||
@ -529,7 +567,7 @@ char *S9xParseArgs (char **argv, int argc)
|
||||
Settings.ForceNoTransparency = TRUE;
|
||||
Settings.ForceTransparency = FALSE;
|
||||
}
|
||||
else if (strcasecmp (argv [i], "-hi") == 0 ||
|
||||
else if (strcasecmp (argv [i], "-hi") == 0 ||
|
||||
strcasecmp (argv [i], "-hires") == 0)
|
||||
{
|
||||
Settings.SupportHiRes = TRUE;
|
||||
@ -543,6 +581,8 @@ char *S9xParseArgs (char **argv, int argc)
|
||||
{
|
||||
Settings.DisplayFrameRate = TRUE;
|
||||
}
|
||||
else if (strcasecmp (argv [i], "-nomessagesinimage") == 0)
|
||||
Settings.AutoDisplayMessages = FALSE;
|
||||
else if (strcasecmp (argv [i], "-i") == 0 ||
|
||||
strcasecmp (argv [i], "-interleaved") == 0)
|
||||
Settings.ForceInterleaved = TRUE;
|
||||
@ -669,14 +709,8 @@ char *S9xParseArgs (char **argv, int argc)
|
||||
double ft;
|
||||
if (sscanf (argv [++i], "%lf", &ft) == 1)
|
||||
{
|
||||
#ifdef __WIN32__
|
||||
Settings.FrameTimePAL = (int32) (ft * 1000);
|
||||
Settings.FrameTimeNTSC = (int32) (ft * 1000);
|
||||
#else
|
||||
Settings.FrameTimePAL = (int32) ft;
|
||||
Settings.FrameTimeNTSC = (int32) ft;
|
||||
#endif
|
||||
|
||||
Settings.FrameTimePAL = (int32) ft;
|
||||
Settings.FrameTimeNTSC = (int32) ft;
|
||||
}
|
||||
}
|
||||
else
|
||||
@ -739,10 +773,9 @@ char *S9xParseArgs (char **argv, int argc)
|
||||
Settings.SoundEnvelopeHeightReading = TRUE;
|
||||
Settings.InterpolatedSound = TRUE;
|
||||
}
|
||||
else if (strcasecmp (argv [i], "-interpolatedsound") == 0 ||
|
||||
strcasecmp (argv [i], "-is") == 0)
|
||||
else if (strcasecmp (argv [i], "-nois") == 0)
|
||||
{
|
||||
Settings.InterpolatedSound = TRUE;
|
||||
Settings.InterpolatedSound = FALSE;
|
||||
}
|
||||
#ifdef USE_THREADS
|
||||
else if (strcasecmp (argv [i], "-threadsound") == 0 ||
|
||||
@ -833,6 +866,26 @@ char *S9xParseArgs (char **argv, int argc)
|
||||
}
|
||||
}
|
||||
#endif
|
||||
else if (strcasecmp (argv[i], "-dumpstreams") == 0)
|
||||
dumpstreams = 1;
|
||||
else if (strcasecmp (argv[i], "-maxframes") == 0)
|
||||
maxframes = atoi(argv[++i]);
|
||||
else if (strcasecmp (argv[i], "-mute") == 0)
|
||||
Settings.Mute = 1;
|
||||
else if (strcasecmp (argv[i], "-upanddown") == 0)
|
||||
Settings.UpAndDown = 1;
|
||||
else if (strcasecmp (argv[i], "-oldturbo") == 0)
|
||||
Settings.OldTurbo = 1;
|
||||
else if (strcasecmp(argv[i], "-autodemo") == 0) {
|
||||
i++;
|
||||
if (!argv[i])
|
||||
abort();
|
||||
strcpy(autodemo, argv[i]);
|
||||
}
|
||||
else if (strcasecmp(argv[i], "-keypress") == 0) // videologger output of controller 1
|
||||
Settings.DisplayPressedKeys = 1;
|
||||
else if (strcasecmp(argv[i], "-keypress2") == 0) // S9xDisplayMessages output of all controllers and peripherals
|
||||
Settings.DisplayPressedKeys = 2;
|
||||
else if (strcasecmp (argv [i], "-conf") == 0)
|
||||
{
|
||||
if (++i>=argc) S9xUsage();
|
||||
@ -842,6 +895,33 @@ char *S9xParseArgs (char **argv, int argc)
|
||||
{
|
||||
// Do nothing, S9xLoadConfigFiles() handled it
|
||||
}
|
||||
else if (strcasecmp (argv [i], "-version") == 0)
|
||||
{
|
||||
printf("Snes9X " VERSION "\n");
|
||||
exit(0);
|
||||
}
|
||||
else if (strcasecmp (argv [i], "-help") == 0)
|
||||
{
|
||||
S9xUsage();
|
||||
}
|
||||
else if (strcasecmp (argv [i], "-multi") == 0)
|
||||
{
|
||||
Settings.Multi = TRUE;
|
||||
}
|
||||
else if (strcasecmp (argv [i], "-carta") == 0)
|
||||
{
|
||||
if (i + 1 < argc)
|
||||
{
|
||||
strncpy (Settings.CartAName, argv [++i], _MAX_PATH);
|
||||
}
|
||||
}
|
||||
else if (strcasecmp (argv [i], "-cartb") == 0)
|
||||
{
|
||||
if (i + 1 < argc)
|
||||
{
|
||||
strncpy (Settings.CartBName, argv [++i], _MAX_PATH);
|
||||
}
|
||||
}
|
||||
|
||||
else
|
||||
S9xParseArg (argv, i, argc);
|
||||
@ -855,7 +935,6 @@ char *S9xParseArgs (char **argv, int argc)
|
||||
#endif
|
||||
|
||||
return (rom_filename);
|
||||
|
||||
}
|
||||
|
||||
#ifndef NGC
|
||||
@ -883,7 +962,7 @@ void S9xParseCheatsFile (const char *rom_filename)
|
||||
{
|
||||
while(fgets(buf, 80, f) != NULL)
|
||||
{
|
||||
if ((p = strrchr (buf, '\n')) != NULL)
|
||||
if ((p = strrchr (buf, '\n')) != NULL)
|
||||
*p = '\0';
|
||||
if (((error = S9xGameGenieToRaw (buf, address, byte)) == NULL) ||
|
||||
((error = S9xProActionReplayToRaw (buf, address, byte)) == NULL))
|
||||
@ -954,7 +1033,7 @@ static void parse_crosshair_spec(enum crosscontrols ctl, const char *spec){
|
||||
static bool try_load(const char *fname, ConfigFile &conf){
|
||||
STREAM fp;
|
||||
if((fp=OPEN_STREAM(fname, "r"))!=NULL){
|
||||
fprintf(stderr, "Reading config file %s\n", fname);
|
||||
fprintf(stdout, "Reading config file %s\n", fname);
|
||||
conf.LoadFile(new fReader(fp));
|
||||
CLOSE_STREAM(fp);
|
||||
return true;
|
||||
@ -973,7 +1052,7 @@ void S9xLoadConfigFiles(char **argv, int argc){
|
||||
}
|
||||
}
|
||||
|
||||
ConfigFile conf;
|
||||
static ConfigFile conf; // static because some of its functions return pointers that would otherwise become invalid after this function
|
||||
conf.Clear();
|
||||
|
||||
if(!skip){
|
||||
@ -1009,10 +1088,11 @@ void S9xLoadConfigFiles(char **argv, int argc){
|
||||
/* Parse config file here */
|
||||
Settings.NextAPUEnabled=conf.GetBool("Sound::APUEnabled", Settings.APUEnabled);
|
||||
Settings.SoundSkipMethod=conf.GetInt("Sound::SoundSkip", 0);
|
||||
i=conf.GetInt("CPU::Cycles", 100);
|
||||
if(i>0 && i<200) Settings.CyclesPercentage = i;
|
||||
i=conf.GetInt("CPU::HDMATimingHack", 100);
|
||||
if(i>0 && i<200) Settings.HDMATimingHack = i;
|
||||
Settings.DisableHDMA=conf.GetBool("Settings::DisableHDMA", false);
|
||||
Settings.ShutdownMaster=conf.GetBool("Settings::SpeedHacks", true);
|
||||
Settings.ShutdownMaster=conf.GetBool("Settings::SpeedHacks", false);
|
||||
Settings.BlockInvalidVRAMAccess=conf.GetBool("Settings::BlockInvalidVRAMAccess", true);
|
||||
Settings.ForcePAL=conf.GetBool("ROM::PAL", false);
|
||||
Settings.ForceNTSC=conf.GetBool("ROM::NTSC", false);
|
||||
if(!strcasecmp(conf.GetString("Settings::FrameSkip", "Auto"),"Auto")){
|
||||
@ -1023,6 +1103,7 @@ void S9xLoadConfigFiles(char **argv, int argc){
|
||||
Settings.TurboSkipFrames=conf.GetUInt("Settings::TurboFrameSkip", 15);
|
||||
Settings.TurboMode=conf.GetBool("Settings::TurboMode",false);
|
||||
Settings.StretchScreenshots=conf.GetInt("Settings::StretchScreenshots",1);
|
||||
Settings.InitialInfoStringTimeout=conf.GetInt("Settings::MessageDisplayTime",120);
|
||||
Settings.AutoSaveDelay=conf.GetUInt("Settings::AutoSaveDelay", 30);
|
||||
Settings.ForceHiROM=conf.GetBool("ROM::HiROM", false);
|
||||
Settings.ForceLoROM=conf.GetBool("ROM::LoROM", false);
|
||||
@ -1045,6 +1126,11 @@ void S9xLoadConfigFiles(char **argv, int argc){
|
||||
}
|
||||
Settings.SupportHiRes=conf.GetBool("Display::HiRes", true);
|
||||
Settings.DisplayFrameRate=conf.GetBool("Display::FrameRate", false);
|
||||
if(conf.Exists("Display::DisplayInput"))
|
||||
Settings.DisplayPressedKeys=conf.GetBool("Display::DisplayInput", false)?1:0;
|
||||
// GFX.FrameDisplay=conf.GetBool("Display::DisplayFrameCount", false);
|
||||
GFX.FrameDisplay=TRUE;
|
||||
Settings.AutoDisplayMessages=conf.GetBool("Display::MessagesInImage", true);
|
||||
if(conf.Exists("ROM::Interleaved")){
|
||||
Settings.ForceInterleaved=conf.GetBool("ROM::Interleaved", false);
|
||||
Settings.ForceNotInterleaved=!Settings.ForceInterleaved;
|
||||
@ -1068,14 +1154,8 @@ void S9xLoadConfigFiles(char **argv, int argc){
|
||||
double ft;
|
||||
if (sscanf(conf.GetString("Settings::FrameTime"), "%lf", &ft) == 1)
|
||||
{
|
||||
#ifdef __WIN32__
|
||||
Settings.FrameTimePAL = (int32) (ft * 1000);
|
||||
Settings.FrameTimeNTSC = (int32) (ft * 1000);
|
||||
#else
|
||||
Settings.FrameTimePAL = (int32) ft;
|
||||
Settings.FrameTimeNTSC = (int32) ft;
|
||||
#endif
|
||||
|
||||
}
|
||||
}
|
||||
Settings.FrameTime = Settings.FrameTimeNTSC;
|
||||
@ -1094,7 +1174,7 @@ void S9xLoadConfigFiles(char **argv, int argc){
|
||||
Settings.SoundEnvelopeHeightReading=conf.GetBool("Sound::EnvelopeHeightReading");
|
||||
Settings.DisableSampleCaching=!conf.GetBool("Sound::SampleCaching");
|
||||
Settings.DisableMasterVolume=!conf.GetBool("Sound::MasterVolume");
|
||||
Settings.InterpolatedSound=conf.GetBool("Sound::Interpolate", false);
|
||||
Settings.InterpolatedSound=conf.GetBool("Sound::Interpolate", true);
|
||||
if(conf.Exists("Sound::Sync")){
|
||||
Settings.SoundSync=conf.GetInt("Sound::Sync", 1);
|
||||
if(Settings.SoundSync>2) Settings.SoundSync=1;
|
||||
@ -1147,7 +1227,7 @@ void S9xLoadConfigFiles(char **argv, int argc){
|
||||
Settings.Port = NP_DEFAULT_PORT;
|
||||
if(conf.Exists("Netplay::Port")){
|
||||
Settings.NetPlay = TRUE;
|
||||
Settings.Port = -conf.GetUInt("Netplay::Port");
|
||||
Settings.Port = -(int)conf.GetUInt("Netplay::Port");
|
||||
}
|
||||
Settings.ServerName[0]='\0';
|
||||
if(conf.Exists("Netplay::Server")){
|
||||
@ -1169,6 +1249,12 @@ void S9xLoadConfigFiles(char **argv, int argc){
|
||||
}
|
||||
#endif
|
||||
Settings.JoystickEnabled=conf.GetBool("Controls::Joystick", Settings.JoystickEnabled);
|
||||
Settings.UpAndDown=conf.GetBool("Controls::AllowLeftRight", false);
|
||||
Settings.SnapshotScreenshots=conf.GetBool("Settings::SnapshotScreenshots", true);
|
||||
Settings.MovieTruncate=conf.GetBool("Settings::MovieTruncateAtEnd", false);
|
||||
Settings.MovieNotifyIgnored=conf.GetBool("Settings::MovieNotifyIgnored", false);
|
||||
Settings.DisplayWatchedAddresses=conf.GetBool("Settings::DisplayWatchedAddresses", false);
|
||||
Settings.WrongMovieStateProtection=conf.GetBool("Settings::WrongMovieStateProtection", true);
|
||||
rom_filename=conf.GetStringDup("ROM::Filename", NULL);
|
||||
|
||||
S9xParsePortConfig(conf, 1);
|
||||
|
@ -1,7 +1,7 @@
|
||||
/**********************************************************************************
|
||||
Snes9x - Portable Super Nintendo Entertainment System (TM) emulator.
|
||||
|
||||
(c) Copyright 1996 - 2002 Gary Henderson (gary.henderson@ntlworld.com) and
|
||||
(c) Copyright 1996 - 2002 Gary Henderson (gary.henderson@ntlworld.com),
|
||||
Jerremy Koot (jkoot@snes9x.com)
|
||||
|
||||
(c) Copyright 2002 - 2004 Matthew Kendora
|
||||
@ -12,12 +12,16 @@
|
||||
|
||||
(c) Copyright 2001 - 2006 John Weidman (jweidman@slip.net)
|
||||
|
||||
(c) Copyright 2002 - 2006 Brad Jorsch (anomie@users.sourceforge.net),
|
||||
funkyass (funkyass@spam.shaw.ca),
|
||||
Kris Bleakley (codeviolation@hotmail.com),
|
||||
Nach (n-a-c-h@users.sourceforge.net), and
|
||||
(c) Copyright 2002 - 2006 funkyass (funkyass@spam.shaw.ca),
|
||||
Kris Bleakley (codeviolation@hotmail.com)
|
||||
|
||||
(c) Copyright 2002 - 2007 Brad Jorsch (anomie@users.sourceforge.net),
|
||||
Nach (n-a-c-h@users.sourceforge.net),
|
||||
zones (kasumitokoduck@yahoo.com)
|
||||
|
||||
(c) Copyright 2006 - 2007 nitsuja
|
||||
|
||||
|
||||
BS-X C emulator code
|
||||
(c) Copyright 2005 - 2006 Dreamer Nom,
|
||||
zones
|
||||
@ -110,17 +114,30 @@
|
||||
2xSaI filter
|
||||
(c) Copyright 1999 - 2001 Derek Liauw Kie Fa
|
||||
|
||||
HQ2x filter
|
||||
HQ2x, HQ3x, HQ4x filters
|
||||
(c) Copyright 2003 Maxim Stepin (maxim@hiend3d.com)
|
||||
|
||||
Win32 GUI code
|
||||
(c) Copyright 2003 - 2006 blip,
|
||||
funkyass,
|
||||
Matthew Kendora,
|
||||
Nach,
|
||||
nitsuja
|
||||
|
||||
Mac OS GUI code
|
||||
(c) Copyright 1998 - 2001 John Stiles
|
||||
(c) Copyright 2001 - 2007 zones
|
||||
|
||||
|
||||
Specific ports contains the works of other authors. See headers in
|
||||
individual files.
|
||||
|
||||
|
||||
Snes9x homepage: http://www.snes9x.com
|
||||
|
||||
Permission to use, copy, modify and/or distribute Snes9x in both binary
|
||||
and source form, for non-commercial purposes, is hereby granted without
|
||||
fee, providing that this license information and copyright notice appear
|
||||
and source form, for non-commercial purposes, is hereby granted without
|
||||
fee, providing that this license information and copyright notice appear
|
||||
with all copies and any derived work.
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
@ -141,22 +158,24 @@
|
||||
Nintendo Co., Limited and its subsidiary companies.
|
||||
**********************************************************************************/
|
||||
|
||||
|
||||
|
||||
#ifndef _SNES9X_H_
|
||||
#define _SNES9X_H_
|
||||
|
||||
#define VERSION "1.5"
|
||||
#define VERSION "1.51"
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#ifdef __WIN32__
|
||||
#include "..\wsnes9x.h"
|
||||
#include <windows.h>
|
||||
#ifdef ZLIB
|
||||
#include "..\zlib\zlib.h"
|
||||
#include <zlib.h>
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#include "language.h"
|
||||
//#include "language.h" // files should include this as needed, no need to recompile practically everything when it changes
|
||||
|
||||
#include "port.h"
|
||||
#include "65c816.h"
|
||||
@ -170,9 +189,8 @@
|
||||
|
||||
#ifdef ZLIB
|
||||
#ifndef __WIN32__
|
||||
#include "zlib.h"
|
||||
#include <zlib.h>
|
||||
#endif
|
||||
|
||||
#define STREAM gzFile
|
||||
#define READ_STREAM(p,l,s) gzread (s,p,l)
|
||||
#define WRITE_STREAM(p,l,s) gzwrite (s,p,l)
|
||||
@ -200,8 +218,10 @@
|
||||
#define SNES_WIDTH 256
|
||||
#define SNES_HEIGHT 224
|
||||
#define SNES_HEIGHT_EXTENDED 239
|
||||
#define IMAGE_WIDTH (Settings.SupportHiRes ? SNES_WIDTH * 2 : SNES_WIDTH)
|
||||
#define IMAGE_HEIGHT (Settings.SupportHiRes ? SNES_HEIGHT_EXTENDED * 2 : SNES_HEIGHT_EXTENDED)
|
||||
#define MAX_SNES_WIDTH (SNES_WIDTH * 2)
|
||||
#define MAX_SNES_HEIGHT (SNES_HEIGHT_EXTENDED * 2)
|
||||
#define IMAGE_WIDTH (Settings.SupportHiRes ? MAX_SNES_WIDTH : SNES_WIDTH)
|
||||
#define IMAGE_HEIGHT (Settings.SupportHiRes ? MAX_SNES_HEIGHT : SNES_HEIGHT_EXTENDED)
|
||||
|
||||
#define NTSC_MASTER_CLOCK 21477272.0
|
||||
#define PAL_MASTER_CLOCK 21281370.0
|
||||
@ -228,8 +248,10 @@
|
||||
#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_APUTIMER_ACCURACY 10
|
||||
#define SNES_APUTIMER2_CYCLE_SHIFT ((int32) ((SNES_CYCLES_PER_SCANLINE << SNES_APUTIMER_ACCURACY) * (1.0 / 64000.0) / SNES_SCANLINE_TIME + 0.5))
|
||||
#define SNES_APU_CLOCK 1024000.0 // 1026900.0?
|
||||
#define SNES_APU_ACCURACY 10
|
||||
#define SNES_APU_ONE_CYCLE_SCALED ((int32) (NTSC_MASTER_CLOCK / SNES_APU_CLOCK * (1 << SNES_APU_ACCURACY)))
|
||||
#define SNES_APUTIMER2_CYCLE_SCALED ((int32) (NTSC_MASTER_CLOCK / 64000.0 * (1 << SNES_APU_ACCURACY)))
|
||||
|
||||
|
||||
#define AUTO_FRAMERATE 200
|
||||
@ -258,7 +280,7 @@
|
||||
#define PROCESS_SOUND_FLAG (1 << 8)
|
||||
#define FRAME_ADVANCE_FLAG (1 << 9)
|
||||
#define DELAYED_NMI_FLAG2 (1 << 10)
|
||||
#define IRQ_PENDING_FLAG (1 << 11)
|
||||
#define IRQ_FLAG (1 << 11)
|
||||
#define HALTED_FLAG (1 << 12)
|
||||
|
||||
struct SCPUState{
|
||||
@ -267,8 +289,8 @@ struct SCPUState{
|
||||
bool8 NMIActive;
|
||||
bool8 IRQActive;
|
||||
bool8 WaitingForInterrupt;
|
||||
bool8 InDMA;
|
||||
bool8 InWRAM_DMA;
|
||||
bool8 InDMAorHDMA;
|
||||
bool8 InWRAMDMAorHDMA;
|
||||
uint8 WhichEvent;
|
||||
uint8 *PCBase;
|
||||
uint32 PBPCAtOpcodeStart;
|
||||
@ -284,6 +306,11 @@ struct SCPUState{
|
||||
bool8 SRAMModified;
|
||||
bool8 BRKTriggered;
|
||||
bool8 TriedInterleavedMode2;
|
||||
int32 IRQPending;
|
||||
bool8 InDMA;
|
||||
bool8 InHDMA;
|
||||
uint8 HDMARanInDMA;
|
||||
int32 PrevCycles;
|
||||
};
|
||||
|
||||
struct STimings {
|
||||
@ -299,6 +326,7 @@ struct STimings {
|
||||
int32 WRAMRefreshPos;
|
||||
int32 RenderPos;
|
||||
bool8 InterlaceField;
|
||||
int32 DMACPUSync;
|
||||
};
|
||||
|
||||
enum {
|
||||
@ -321,7 +349,7 @@ struct SSettings{
|
||||
bool8 APUEnabled;
|
||||
bool8 Shutdown;
|
||||
uint8 SoundSkipMethod;
|
||||
int32 CyclesPercentage;
|
||||
int32 HDMATimingHack;
|
||||
bool8 DisableIRQ;
|
||||
bool8 Paused;
|
||||
bool8 ForcedPause;
|
||||
@ -368,7 +396,7 @@ struct SSettings{
|
||||
bool8 ForceSDD1;
|
||||
bool8 ForceNoSDD1;
|
||||
bool8 SRTC;
|
||||
|
||||
|
||||
bool8 ShutdownMaster;
|
||||
bool8 MultiPlayer5Master;
|
||||
bool8 SuperScopeMaster;
|
||||
@ -395,17 +423,22 @@ struct SSettings{
|
||||
bool8 DisableSampleCaching;
|
||||
bool8 DisableMasterVolume;
|
||||
bool8 SoundSync;
|
||||
bool8 FakeMuteFix;
|
||||
bool8 InterpolatedSound;
|
||||
bool8 ThreadSound;
|
||||
bool8 Mute;
|
||||
bool8 NextAPUEnabled;
|
||||
uint8 AltSampleDecode;
|
||||
bool8 FixFrequency;
|
||||
|
||||
|
||||
/* Graphics options */
|
||||
bool8 Transparency;
|
||||
bool8 SupportHiRes;
|
||||
bool8 Mode7Interpolate;
|
||||
bool8 Mode7Interpolate; // no longer used?
|
||||
bool8 AutoDisplayMessages;
|
||||
uint8 BG_Forced;
|
||||
bool8 SnapshotScreenshots;
|
||||
uint32 InitialInfoStringTimeout; // Messages normally display for this many frames
|
||||
|
||||
/* SNES graphics options */
|
||||
bool8 BGLayering;
|
||||
@ -415,6 +448,12 @@ struct SSettings{
|
||||
bool8 DisableHDMA;
|
||||
bool8 DisplayFrameRate;
|
||||
bool8 DisableRangeTimeOver; /* XXX: unused */
|
||||
bool8 DisplayWatchedAddresses;
|
||||
|
||||
/* Multi ROMs */
|
||||
bool8 Multi;
|
||||
char CartAName[_MAX_PATH + 1];
|
||||
char CartBName[_MAX_PATH + 1];
|
||||
|
||||
/* Others */
|
||||
bool8 NetPlay;
|
||||
@ -426,9 +465,16 @@ struct SSettings{
|
||||
int32 AutoSaveDelay; /* Time in seconds before S-RAM auto-saved if modified. */
|
||||
bool8 ApplyCheats;
|
||||
bool8 TurboMode;
|
||||
bool8 OldTurbo;
|
||||
bool8 UpAndDown;
|
||||
uint8 DisplayPressedKeys; // The value indicates how to do it.
|
||||
uint32 HighSpeedSeek;
|
||||
uint32 TurboSkipFrames;
|
||||
uint32 AutoMaxSkipFrames;
|
||||
|
||||
bool8 MovieTruncate;
|
||||
bool8 MovieNotifyIgnored;
|
||||
bool8 WrongMovieStateProtection;
|
||||
|
||||
/* Fixes for individual games */
|
||||
bool8 WinterGold;
|
||||
bool8 BS; /* Japanese Satellite System games. */
|
||||
@ -437,6 +483,7 @@ struct SSettings{
|
||||
uint8 APURAMInitialValue;
|
||||
bool8 SampleCatchup;
|
||||
int8 SETA;
|
||||
bool8 BlockInvalidVRAMAccess;
|
||||
bool8 TakeScreenshot;
|
||||
int8 StretchScreenshots;
|
||||
uint16 DisplayColor;
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -1,7 +1,7 @@
|
||||
/**********************************************************************************
|
||||
Snes9x - Portable Super Nintendo Entertainment System (TM) emulator.
|
||||
|
||||
(c) Copyright 1996 - 2002 Gary Henderson (gary.henderson@ntlworld.com) and
|
||||
(c) Copyright 1996 - 2002 Gary Henderson (gary.henderson@ntlworld.com),
|
||||
Jerremy Koot (jkoot@snes9x.com)
|
||||
|
||||
(c) Copyright 2002 - 2004 Matthew Kendora
|
||||
@ -12,12 +12,16 @@
|
||||
|
||||
(c) Copyright 2001 - 2006 John Weidman (jweidman@slip.net)
|
||||
|
||||
(c) Copyright 2002 - 2006 Brad Jorsch (anomie@users.sourceforge.net),
|
||||
funkyass (funkyass@spam.shaw.ca),
|
||||
Kris Bleakley (codeviolation@hotmail.com),
|
||||
Nach (n-a-c-h@users.sourceforge.net), and
|
||||
(c) Copyright 2002 - 2006 funkyass (funkyass@spam.shaw.ca),
|
||||
Kris Bleakley (codeviolation@hotmail.com)
|
||||
|
||||
(c) Copyright 2002 - 2007 Brad Jorsch (anomie@users.sourceforge.net),
|
||||
Nach (n-a-c-h@users.sourceforge.net),
|
||||
zones (kasumitokoduck@yahoo.com)
|
||||
|
||||
(c) Copyright 2006 - 2007 nitsuja
|
||||
|
||||
|
||||
BS-X C emulator code
|
||||
(c) Copyright 2005 - 2006 Dreamer Nom,
|
||||
zones
|
||||
@ -110,17 +114,30 @@
|
||||
2xSaI filter
|
||||
(c) Copyright 1999 - 2001 Derek Liauw Kie Fa
|
||||
|
||||
HQ2x filter
|
||||
HQ2x, HQ3x, HQ4x filters
|
||||
(c) Copyright 2003 Maxim Stepin (maxim@hiend3d.com)
|
||||
|
||||
Win32 GUI code
|
||||
(c) Copyright 2003 - 2006 blip,
|
||||
funkyass,
|
||||
Matthew Kendora,
|
||||
Nach,
|
||||
nitsuja
|
||||
|
||||
Mac OS GUI code
|
||||
(c) Copyright 1998 - 2001 John Stiles
|
||||
(c) Copyright 2001 - 2007 zones
|
||||
|
||||
|
||||
Specific ports contains the works of other authors. See headers in
|
||||
individual files.
|
||||
|
||||
|
||||
Snes9x homepage: http://www.snes9x.com
|
||||
|
||||
Permission to use, copy, modify and/or distribute Snes9x in both binary
|
||||
and source form, for non-commercial purposes, is hereby granted without
|
||||
fee, providing that this license information and copyright notice appear
|
||||
and source form, for non-commercial purposes, is hereby granted without
|
||||
fee, providing that this license information and copyright notice appear
|
||||
with all copies and any derived work.
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
@ -142,6 +159,8 @@
|
||||
**********************************************************************************/
|
||||
|
||||
|
||||
|
||||
|
||||
#ifndef _SOUND_H_
|
||||
#define _SOUND_H_
|
||||
|
||||
@ -230,7 +249,7 @@ typedef struct {
|
||||
int32 envx; // ** unused
|
||||
short left_vol_level; // ** unused
|
||||
short right_vol_level; // ** unused
|
||||
short envx_target; // ** unused
|
||||
short envx_target; // ** unused
|
||||
uint32 env_error; // ** unused
|
||||
uint32 erate; // ** unused
|
||||
int32 direction; // ** unused
|
||||
|
@ -1,7 +1,7 @@
|
||||
/**********************************************************************************
|
||||
Snes9x - Portable Super Nintendo Entertainment System (TM) emulator.
|
||||
|
||||
(c) Copyright 1996 - 2002 Gary Henderson (gary.henderson@ntlworld.com) and
|
||||
(c) Copyright 1996 - 2002 Gary Henderson (gary.henderson@ntlworld.com),
|
||||
Jerremy Koot (jkoot@snes9x.com)
|
||||
|
||||
(c) Copyright 2002 - 2004 Matthew Kendora
|
||||
@ -12,12 +12,16 @@
|
||||
|
||||
(c) Copyright 2001 - 2006 John Weidman (jweidman@slip.net)
|
||||
|
||||
(c) Copyright 2002 - 2006 Brad Jorsch (anomie@users.sourceforge.net),
|
||||
funkyass (funkyass@spam.shaw.ca),
|
||||
Kris Bleakley (codeviolation@hotmail.com),
|
||||
Nach (n-a-c-h@users.sourceforge.net), and
|
||||
(c) Copyright 2002 - 2006 funkyass (funkyass@spam.shaw.ca),
|
||||
Kris Bleakley (codeviolation@hotmail.com)
|
||||
|
||||
(c) Copyright 2002 - 2007 Brad Jorsch (anomie@users.sourceforge.net),
|
||||
Nach (n-a-c-h@users.sourceforge.net),
|
||||
zones (kasumitokoduck@yahoo.com)
|
||||
|
||||
(c) Copyright 2006 - 2007 nitsuja
|
||||
|
||||
|
||||
BS-X C emulator code
|
||||
(c) Copyright 2005 - 2006 Dreamer Nom,
|
||||
zones
|
||||
@ -110,17 +114,30 @@
|
||||
2xSaI filter
|
||||
(c) Copyright 1999 - 2001 Derek Liauw Kie Fa
|
||||
|
||||
HQ2x filter
|
||||
HQ2x, HQ3x, HQ4x filters
|
||||
(c) Copyright 2003 Maxim Stepin (maxim@hiend3d.com)
|
||||
|
||||
Win32 GUI code
|
||||
(c) Copyright 2003 - 2006 blip,
|
||||
funkyass,
|
||||
Matthew Kendora,
|
||||
Nach,
|
||||
nitsuja
|
||||
|
||||
Mac OS GUI code
|
||||
(c) Copyright 1998 - 2001 John Stiles
|
||||
(c) Copyright 2001 - 2007 zones
|
||||
|
||||
|
||||
Specific ports contains the works of other authors. See headers in
|
||||
individual files.
|
||||
|
||||
|
||||
Snes9x homepage: http://www.snes9x.com
|
||||
|
||||
Permission to use, copy, modify and/or distribute Snes9x in both binary
|
||||
and source form, for non-commercial purposes, is hereby granted without
|
||||
fee, providing that this license information and copyright notice appear
|
||||
and source form, for non-commercial purposes, is hereby granted without
|
||||
fee, providing that this license information and copyright notice appear
|
||||
with all copies and any derived work.
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
@ -141,6 +158,8 @@
|
||||
Nintendo Co., Limited and its subsidiary companies.
|
||||
**********************************************************************************/
|
||||
|
||||
|
||||
|
||||
#include "snes9x.h"
|
||||
#include "spc700.h"
|
||||
#include "memmap.h"
|
||||
@ -180,24 +199,21 @@ END_EXTERN_C
|
||||
|
||||
#ifdef SPC700_SHUTDOWN
|
||||
#define APUShutdown() \
|
||||
if (Settings.Shutdown && (IAPU.PC == IAPU.WaitAddress1 || IAPU.PC == IAPU.WaitAddress2)) \
|
||||
{ \
|
||||
if (Settings.Shutdown && (IAPU.PC == IAPU.WaitAddress1 || IAPU.PC == IAPU.WaitAddress2)) \
|
||||
{ \
|
||||
if (IAPU.WaitCounter == 0) \
|
||||
{ \
|
||||
if (!ICPU.CPUExecuting) \
|
||||
{ \
|
||||
APU.Cycles = CPU.Cycles = CPU.NextEvent; \
|
||||
S9xUpdateAPUTimer(); \
|
||||
} \
|
||||
else \
|
||||
IAPU.APUExecuting = FALSE; \
|
||||
if (!ICPU.CPUExecuting) \
|
||||
S9xAPUExecute(); \
|
||||
else \
|
||||
IAPU.APUExecuting = FALSE; \
|
||||
} \
|
||||
else \
|
||||
if (IAPU.WaitCounter >= 2) \
|
||||
IAPU.WaitCounter = 1; \
|
||||
IAPU.WaitCounter = 1; \
|
||||
else \
|
||||
IAPU.WaitCounter--; \
|
||||
}
|
||||
IAPU.WaitCounter--; \
|
||||
}
|
||||
#else
|
||||
#define APUShutdown()
|
||||
#endif
|
||||
@ -225,6 +241,7 @@ void STOP (char *s)
|
||||
WARN(s);
|
||||
APU.TimerEnabled[0] = APU.TimerEnabled[1] = APU.TimerEnabled[2] = FALSE;
|
||||
IAPU.APUExecuting = FALSE;
|
||||
Settings.APUEnabled = FALSE; // re-enabled on next APU reset
|
||||
#ifdef DEBUGGER
|
||||
CPU.Flags |= DEBUG_MODE_FLAG;
|
||||
#else
|
||||
@ -302,7 +319,7 @@ APUSetZN8 ((uint8) Int16);
|
||||
#define PushW(w)\
|
||||
if(APURegisters.S==0){ \
|
||||
*(IAPU.RAM + 0x1ff) = (w);\
|
||||
*(IAPU.RAM + 0x100) = (w >> 8);\
|
||||
*(IAPU.RAM + 0x100) = ((w) >> 8);\
|
||||
} else { \
|
||||
*(uint16 *) (IAPU.RAM + 0xff + APURegisters.S) = (w);\
|
||||
} \
|
||||
@ -316,7 +333,7 @@ APUSetZN8 ((uint8) Int16);
|
||||
}
|
||||
#else
|
||||
#define PushW(w)\
|
||||
*(IAPU.RAM + 0x100 + APURegisters.S--) = (w >> 8);\
|
||||
*(IAPU.RAM + 0x100 + APURegisters.S--) = ((w) >> 8);\
|
||||
*(IAPU.RAM + 0x100 + APURegisters.S--) = (w);
|
||||
#define PopW(w)\
|
||||
APURegisters.S += 2;\
|
||||
@ -930,7 +947,7 @@ void Apu0E ()
|
||||
Absolute ();
|
||||
Work8 = S9xAPUGetByte (IAPU.Address);
|
||||
S9xAPUSetByte (Work8 | APURegisters.YA.B.A, IAPU.Address);
|
||||
Work8 &= APURegisters.YA.B.A;
|
||||
Work8 = APURegisters.YA.B.A - Work8;
|
||||
APUSetZN8 (Work8);
|
||||
IAPU.PC += 3;
|
||||
}
|
||||
@ -941,7 +958,7 @@ void Apu4E ()
|
||||
Absolute ();
|
||||
Work8 = S9xAPUGetByte (IAPU.Address);
|
||||
S9xAPUSetByte (Work8 & ~APURegisters.YA.B.A, IAPU.Address);
|
||||
Work8 &= APURegisters.YA.B.A;
|
||||
Work8 = APURegisters.YA.B.A - Work8;
|
||||
APUSetZN8 (Work8);
|
||||
IAPU.PC += 3;
|
||||
}
|
||||
@ -978,6 +995,7 @@ void ApuFF ()
|
||||
APU.Flags |= HALTED_FLAG;
|
||||
APU.TimerEnabled[0] = APU.TimerEnabled[1] = APU.TimerEnabled[2] = FALSE;
|
||||
IAPU.APUExecuting = FALSE;
|
||||
Settings.APUEnabled = FALSE; // re-enabled on next APU reset
|
||||
}
|
||||
|
||||
void Apu10 ()
|
||||
@ -1543,7 +1561,7 @@ void Apu2E ()
|
||||
// CBNE dp,rel
|
||||
Work8 = OP1;
|
||||
Relative2 ();
|
||||
|
||||
|
||||
if (S9xAPUGetByteZ (Work8) != APURegisters.YA.B.A)
|
||||
{
|
||||
IAPU.PC = IAPU.RAM + (uint16) Int16;
|
||||
|
@ -1,7 +1,7 @@
|
||||
/**********************************************************************************
|
||||
Snes9x - Portable Super Nintendo Entertainment System (TM) emulator.
|
||||
|
||||
(c) Copyright 1996 - 2002 Gary Henderson (gary.henderson@ntlworld.com) and
|
||||
(c) Copyright 1996 - 2002 Gary Henderson (gary.henderson@ntlworld.com),
|
||||
Jerremy Koot (jkoot@snes9x.com)
|
||||
|
||||
(c) Copyright 2002 - 2004 Matthew Kendora
|
||||
@ -12,12 +12,16 @@
|
||||
|
||||
(c) Copyright 2001 - 2006 John Weidman (jweidman@slip.net)
|
||||
|
||||
(c) Copyright 2002 - 2006 Brad Jorsch (anomie@users.sourceforge.net),
|
||||
funkyass (funkyass@spam.shaw.ca),
|
||||
Kris Bleakley (codeviolation@hotmail.com),
|
||||
Nach (n-a-c-h@users.sourceforge.net), and
|
||||
(c) Copyright 2002 - 2006 funkyass (funkyass@spam.shaw.ca),
|
||||
Kris Bleakley (codeviolation@hotmail.com)
|
||||
|
||||
(c) Copyright 2002 - 2007 Brad Jorsch (anomie@users.sourceforge.net),
|
||||
Nach (n-a-c-h@users.sourceforge.net),
|
||||
zones (kasumitokoduck@yahoo.com)
|
||||
|
||||
(c) Copyright 2006 - 2007 nitsuja
|
||||
|
||||
|
||||
BS-X C emulator code
|
||||
(c) Copyright 2005 - 2006 Dreamer Nom,
|
||||
zones
|
||||
@ -110,17 +114,30 @@
|
||||
2xSaI filter
|
||||
(c) Copyright 1999 - 2001 Derek Liauw Kie Fa
|
||||
|
||||
HQ2x filter
|
||||
HQ2x, HQ3x, HQ4x filters
|
||||
(c) Copyright 2003 Maxim Stepin (maxim@hiend3d.com)
|
||||
|
||||
Win32 GUI code
|
||||
(c) Copyright 2003 - 2006 blip,
|
||||
funkyass,
|
||||
Matthew Kendora,
|
||||
Nach,
|
||||
nitsuja
|
||||
|
||||
Mac OS GUI code
|
||||
(c) Copyright 1998 - 2001 John Stiles
|
||||
(c) Copyright 2001 - 2007 zones
|
||||
|
||||
|
||||
Specific ports contains the works of other authors. See headers in
|
||||
individual files.
|
||||
|
||||
|
||||
Snes9x homepage: http://www.snes9x.com
|
||||
|
||||
Permission to use, copy, modify and/or distribute Snes9x in both binary
|
||||
and source form, for non-commercial purposes, is hereby granted without
|
||||
fee, providing that this license information and copyright notice appear
|
||||
and source form, for non-commercial purposes, is hereby granted without
|
||||
fee, providing that this license information and copyright notice appear
|
||||
with all copies and any derived work.
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
@ -141,16 +158,11 @@
|
||||
Nintendo Co., Limited and its subsidiary companies.
|
||||
**********************************************************************************/
|
||||
|
||||
|
||||
|
||||
#ifndef _SPC700_H_
|
||||
#define _SPC700_H_
|
||||
|
||||
#ifdef SPCTOOL
|
||||
#define NO_CHANNEL_STRUCT
|
||||
#include "spctool/dsp.h"
|
||||
#include "spctool/spc700.h"
|
||||
#include "spctool/soundmod.h"
|
||||
#endif
|
||||
|
||||
#define Carry 1
|
||||
#define Zero 2
|
||||
#define Interrupt 4
|
||||
@ -206,54 +218,20 @@ struct SAPURegisters{
|
||||
|
||||
EXTERN_C struct SAPURegisters APURegisters;
|
||||
|
||||
// Needed by ILLUSION OF GAIA
|
||||
//#define ONE_APU_CYCLE 14
|
||||
#define ONE_APU_CYCLE 21
|
||||
|
||||
// Needed by all games written by the software company called Human
|
||||
//#define ONE_APU_CYCLE_HUMAN 17
|
||||
#define ONE_APU_CYCLE_HUMAN 21
|
||||
|
||||
// 1.953us := 1.024065.54MHz
|
||||
|
||||
#ifdef SPCTOOL
|
||||
EXTERN_C int32 ESPC (int32);
|
||||
|
||||
#define APU_EXECUTE() \
|
||||
{ \
|
||||
int32 l = (CPU.Cycles - APU.Cycles) / 14; \
|
||||
if (l > 0) \
|
||||
{ \
|
||||
l -= _EmuSPC(l); \
|
||||
APU.Cycles += l * 14; \
|
||||
} \
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
#ifdef DEBUGGER
|
||||
#define APU_EXECUTE1() \
|
||||
{ \
|
||||
if (APU.Flags & TRACE_FLAG) \
|
||||
S9xTraceAPU ();\
|
||||
APU.Cycles += S9xAPUCycles [*IAPU.PC]; \
|
||||
(*S9xApuOpcodes[*IAPU.PC]) (); \
|
||||
if (APU.Flags & TRACE_FLAG) \
|
||||
S9xTraceAPU (); \
|
||||
APU.Cycles += S9xAPUCycles [*IAPU.PC]; \
|
||||
(*S9xApuOpcodes[*IAPU.PC]) (); \
|
||||
}
|
||||
#else
|
||||
#define APU_EXECUTE1() \
|
||||
{ \
|
||||
APU.Cycles += S9xAPUCycles [*IAPU.PC]; \
|
||||
(*S9xApuOpcodes[*IAPU.PC]) (); \
|
||||
}
|
||||
#endif
|
||||
|
||||
#define APU_EXECUTE() \
|
||||
if (IAPU.APUExecuting) \
|
||||
{\
|
||||
while (APU.Cycles <= CPU.Cycles) \
|
||||
APU_EXECUTE1(); \
|
||||
APU.Cycles += S9xAPUCycles [*IAPU.PC]; \
|
||||
(*S9xApuOpcodes[*IAPU.PC]) (); \
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
/**********************************************************************************
|
||||
Snes9x - Portable Super Nintendo Entertainment System (TM) emulator.
|
||||
|
||||
(c) Copyright 1996 - 2002 Gary Henderson (gary.henderson@ntlworld.com) and
|
||||
(c) Copyright 1996 - 2002 Gary Henderson (gary.henderson@ntlworld.com),
|
||||
Jerremy Koot (jkoot@snes9x.com)
|
||||
|
||||
(c) Copyright 2002 - 2004 Matthew Kendora
|
||||
@ -12,12 +12,16 @@
|
||||
|
||||
(c) Copyright 2001 - 2006 John Weidman (jweidman@slip.net)
|
||||
|
||||
(c) Copyright 2002 - 2006 Brad Jorsch (anomie@users.sourceforge.net),
|
||||
funkyass (funkyass@spam.shaw.ca),
|
||||
Kris Bleakley (codeviolation@hotmail.com),
|
||||
Nach (n-a-c-h@users.sourceforge.net), and
|
||||
(c) Copyright 2002 - 2006 funkyass (funkyass@spam.shaw.ca),
|
||||
Kris Bleakley (codeviolation@hotmail.com)
|
||||
|
||||
(c) Copyright 2002 - 2007 Brad Jorsch (anomie@users.sourceforge.net),
|
||||
Nach (n-a-c-h@users.sourceforge.net),
|
||||
zones (kasumitokoduck@yahoo.com)
|
||||
|
||||
(c) Copyright 2006 - 2007 nitsuja
|
||||
|
||||
|
||||
BS-X C emulator code
|
||||
(c) Copyright 2005 - 2006 Dreamer Nom,
|
||||
zones
|
||||
@ -110,17 +114,30 @@
|
||||
2xSaI filter
|
||||
(c) Copyright 1999 - 2001 Derek Liauw Kie Fa
|
||||
|
||||
HQ2x filter
|
||||
HQ2x, HQ3x, HQ4x filters
|
||||
(c) Copyright 2003 Maxim Stepin (maxim@hiend3d.com)
|
||||
|
||||
Win32 GUI code
|
||||
(c) Copyright 2003 - 2006 blip,
|
||||
funkyass,
|
||||
Matthew Kendora,
|
||||
Nach,
|
||||
nitsuja
|
||||
|
||||
Mac OS GUI code
|
||||
(c) Copyright 1998 - 2001 John Stiles
|
||||
(c) Copyright 2001 - 2007 zones
|
||||
|
||||
|
||||
Specific ports contains the works of other authors. See headers in
|
||||
individual files.
|
||||
|
||||
|
||||
Snes9x homepage: http://www.snes9x.com
|
||||
|
||||
Permission to use, copy, modify and/or distribute Snes9x in both binary
|
||||
and source form, for non-commercial purposes, is hereby granted without
|
||||
fee, providing that this license information and copyright notice appear
|
||||
and source form, for non-commercial purposes, is hereby granted without
|
||||
fee, providing that this license information and copyright notice appear
|
||||
with all copies and any derived work.
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
@ -142,6 +159,8 @@
|
||||
**********************************************************************************/
|
||||
|
||||
|
||||
|
||||
|
||||
//#define SPC7110_DEBUG
|
||||
|
||||
#include "spc7110.h"
|
||||
@ -152,11 +171,12 @@
|
||||
//Windows includes
|
||||
#ifdef __WIN32__
|
||||
#ifndef _XBOX // chdir and getcwd not supported on Xbox hardware
|
||||
#include "win32/wsnes9x.h" // FIXME: shouldn't be necessary
|
||||
#include <direct.h>
|
||||
#define chdir _chdir
|
||||
#define getcwd _getcwd
|
||||
#endif
|
||||
#define FREEZEFOLDER GUI.FreezeFileDir
|
||||
#undef PATH_MAX
|
||||
//zinx suggested this, for *nix compatibility
|
||||
#define PATH_MAX MAX_PATH
|
||||
#else // Unix
|
||||
@ -164,8 +184,6 @@
|
||||
#include <unistd.h>
|
||||
#ifdef __MACOSX__
|
||||
const char * S9xGetSPC7110Directory(void);
|
||||
#else
|
||||
#define FREEZEFOLDER S9xGetDirectory (PATCH_DIR)
|
||||
#endif
|
||||
#endif
|
||||
#include "display.h"
|
||||
@ -173,7 +191,6 @@ const char * S9xGetSPC7110Directory(void);
|
||||
#ifndef NGC
|
||||
extern "C" char *osd_GetPackDir();
|
||||
#endif
|
||||
|
||||
//really not needed, but usually MS adds the _ to POSIX functions,
|
||||
//while *nix doesn't, so this was to "un-M$" the function.
|
||||
#define splitpath _splitpath
|
||||
@ -189,6 +206,8 @@ void (*CleanUp7110)(void)=NULL;
|
||||
void (*LoadUp7110)(char*)=&SPC7110Load;
|
||||
void (*Copy7110)(void)=NULL;
|
||||
|
||||
static void SetSPC7110SRAMMap (uint8);
|
||||
|
||||
//size and offset of the pack data
|
||||
//offset and size of reads from pack
|
||||
typedef struct SPC7110DecompressionLocationStruct
|
||||
@ -279,9 +298,9 @@ void S9xSpc7110Init()
|
||||
s7r.offset_add=0;
|
||||
s7r.AlignBy=1;
|
||||
|
||||
#ifndef NGC
|
||||
#ifndef NGC
|
||||
(*LoadUp7110)(osd_GetPackDir());
|
||||
#endif
|
||||
#endif
|
||||
|
||||
if(Settings.SPC7110RTC)
|
||||
Settings.TurboMode=false;
|
||||
@ -301,26 +320,26 @@ void MovePackData()
|
||||
log->used_len=s7r.bank50Internal;
|
||||
log->used_offset=decompack->last_offset;
|
||||
}
|
||||
|
||||
|
||||
//set up for next logging
|
||||
decompack->last_offset=(s7r.reg4805)|(s7r.reg4806<<8);
|
||||
|
||||
|
||||
decompack->last_idx=s7r.reg4804;
|
||||
|
||||
//start decompression
|
||||
int table=(s7r.reg4803<<16)|(s7r.reg4802<<8)|s7r.reg4801;
|
||||
|
||||
|
||||
//the table is a offset multiplier byte and a big-endian pointer
|
||||
int j= 4*s7r.reg4804;
|
||||
j+=s7r.DataRomOffset;
|
||||
j+=table;
|
||||
|
||||
|
||||
//set proper offsetting.
|
||||
if(s7r.reg480B==0)
|
||||
s7r.AlignBy=0;
|
||||
else
|
||||
{
|
||||
switch(ROM[j])
|
||||
switch(Memory.ROM[j])
|
||||
{
|
||||
case 0x03:
|
||||
s7r.AlignBy=8;
|
||||
@ -385,7 +404,7 @@ void ReadPackData()
|
||||
static int table_age_3;
|
||||
static int table_age_4;
|
||||
static int table_age_5;
|
||||
|
||||
|
||||
int table=(s7r.reg4803<<16)|(s7r.reg4802<<8)|s7r.reg4801;
|
||||
|
||||
if(table==0)
|
||||
@ -402,20 +421,20 @@ void ReadPackData()
|
||||
log->used_len=s7r.bank50Internal;
|
||||
log->used_offset=decompack->last_offset;
|
||||
}
|
||||
|
||||
|
||||
decompack->last_offset=(s7r.reg4805)|(s7r.reg4806<<8);
|
||||
|
||||
|
||||
decompack->last_idx=s7r.reg4804;
|
||||
|
||||
|
||||
int j= 4*s7r.reg4804;
|
||||
j+=s7r.DataRomOffset;
|
||||
j+=table;
|
||||
|
||||
|
||||
if(s7r.reg480B==0)
|
||||
s7r.AlignBy=0;
|
||||
else
|
||||
{
|
||||
switch(ROM[j])
|
||||
switch(Memory.ROM[j])
|
||||
{
|
||||
case 0x03:
|
||||
s7r.AlignBy=8;
|
||||
@ -461,10 +480,10 @@ void ReadPackData()
|
||||
table_age_4=table_age_3;
|
||||
table_age_3=table_age_2;
|
||||
table_age_2=decompack->idx;
|
||||
|
||||
|
||||
#ifdef __MACOSX__
|
||||
char name[PATH_MAX + 1], bfname[11];
|
||||
strcpy(name, S9xGetSPC7110Directory());
|
||||
strcpy(name, S9xGetSPC7110Directory());
|
||||
sprintf(bfname, "%06X.bin", table);
|
||||
strcat(name, bfname);
|
||||
#else
|
||||
@ -474,10 +493,11 @@ void ReadPackData()
|
||||
char dir [_MAX_DIR + 1];
|
||||
char fname [_MAX_FNAME + 1];
|
||||
char ext [_MAX_EXT + 1];
|
||||
if (strlen (FREEZEFOLDER))
|
||||
const char* patchDir = S9xGetDirectory (PATCH_DIR);
|
||||
if (patchDir && strlen (patchDir))
|
||||
{
|
||||
//splitpath (Memory.ROMFilename, drive, dir, fname, ext);
|
||||
strcpy (name, FREEZEFOLDER);
|
||||
strcpy (name, patchDir);
|
||||
strcat (name, "/");
|
||||
}
|
||||
else
|
||||
@ -543,21 +563,21 @@ void GetPackData()
|
||||
log->used_len=s7r.bank50Internal;
|
||||
log->used_offset=decompack->last_offset;
|
||||
}
|
||||
|
||||
|
||||
decompack->last_offset=(s7r.reg4805)|(s7r.reg4806<<8);
|
||||
|
||||
|
||||
decompack->last_idx=s7r.reg4804;
|
||||
int table=(s7r.reg4803<<16)|(s7r.reg4802<<8)|s7r.reg4801;
|
||||
|
||||
|
||||
int j= 4*s7r.reg4804;
|
||||
j+=s7r.DataRomOffset;
|
||||
j+=table;
|
||||
|
||||
|
||||
if(s7r.reg480B==0)
|
||||
s7r.AlignBy=0;
|
||||
else
|
||||
{
|
||||
switch(ROM[j])
|
||||
switch(Memory.ROM[j])
|
||||
{
|
||||
case 0x03:
|
||||
s7r.AlignBy=8;
|
||||
@ -641,7 +661,7 @@ uint8 S9xGetSPC7110(uint16 Address)
|
||||
i+=s7r.bank50Internal;
|
||||
i%=DECOMP_BUFFER_SIZE;
|
||||
s7r.reg4800=s7r.bank50[i];
|
||||
|
||||
|
||||
s7r.bank50Internal++;
|
||||
s7r.bank50Internal%=DECOMP_BUFFER_SIZE;
|
||||
#ifdef SPC7110_DEBUG
|
||||
@ -678,10 +698,10 @@ uint8 S9xGetSPC7110(uint16 Address)
|
||||
case 0x480B:
|
||||
return s7r.reg480B;
|
||||
//decompression finished: just emulated by switching each read.
|
||||
case 0x480C:
|
||||
case 0x480C:
|
||||
s7r.reg480C^=0x80;
|
||||
return s7r.reg480C^0x80;
|
||||
|
||||
|
||||
//Data access port
|
||||
//reads from the data ROM (anywhere over the first 8 mbits
|
||||
//behavior is complex, will document later,
|
||||
@ -714,13 +734,13 @@ uint8 S9xGetSPC7110(uint16 Address)
|
||||
else r4814=0;
|
||||
s7r.reg4815=(uint8)(r4814>>8);
|
||||
s7r.reg4814=(uint8)(r4814&0x00FF);
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
i+=s7r.DataRomOffset;
|
||||
uint8 tmp=ROM[i];
|
||||
uint8 tmp=Memory.ROM[i];
|
||||
i=(s7r.reg4813<<16)|(s7r.reg4812<<8)|s7r.reg4811;
|
||||
|
||||
|
||||
if(s7r.reg4818&0x02)
|
||||
{
|
||||
}
|
||||
@ -730,7 +750,7 @@ uint8 S9xGetSPC7110(uint16 Address)
|
||||
{
|
||||
signed short inc;
|
||||
inc=(s7r.reg4817<<8)|s7r.reg4816;
|
||||
|
||||
|
||||
if(!(s7r.reg4818&0x10))
|
||||
i+=inc;
|
||||
else
|
||||
@ -750,7 +770,7 @@ uint8 S9xGetSPC7110(uint16 Address)
|
||||
r4814+=inc;
|
||||
s7r.reg4815=(r4814&0xFF00)>>8;
|
||||
s7r.reg4814=r4814&0xFF;
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
//is signed
|
||||
@ -778,7 +798,7 @@ uint8 S9xGetSPC7110(uint16 Address)
|
||||
r4814+=inc;
|
||||
s7r.reg4815=(r4814&0xFF00)>>8;
|
||||
s7r.reg4814=r4814&0xFF;
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -804,15 +824,15 @@ uint8 S9xGetSPC7110(uint16 Address)
|
||||
r4814+=1;
|
||||
s7r.reg4815=(r4814&0xFF00)>>8;
|
||||
s7r.reg4814=r4814&0xFF;
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#ifdef SPC7110_DEBUG
|
||||
printf("Returned %02X\n", tmp);
|
||||
#endif
|
||||
|
||||
|
||||
i%=s7r.DataRomSize;
|
||||
s7r.reg4811=i&0x00FF;
|
||||
s7r.reg4812=(i&0x00FF00)>>8;
|
||||
@ -857,15 +877,15 @@ uint8 S9xGetSPC7110(uint16 Address)
|
||||
adj=(s7r.reg4815<<8)|s7r.reg4814;
|
||||
i+=adj;
|
||||
}
|
||||
|
||||
|
||||
i%=s7r.DataRomSize;
|
||||
i+=s7r.DataRomOffset;
|
||||
uint8 tmp=ROM[i];
|
||||
uint8 tmp=Memory.ROM[i];
|
||||
i=((s7r.reg4813<<16)|(s7r.reg4812<<8)|s7r.reg4811);
|
||||
if(0x60==(s7r.reg4818&0x60))
|
||||
{
|
||||
i=((s7r.reg4813<<16)|(s7r.reg4812<<8)|s7r.reg4811);
|
||||
|
||||
|
||||
if(!(s7r.reg4818&0x10))
|
||||
{
|
||||
if(s7r.reg4818&0x08)
|
||||
@ -911,7 +931,7 @@ uint8 S9xGetSPC7110(uint16 Address)
|
||||
return tmp;
|
||||
}
|
||||
else return 0;
|
||||
|
||||
|
||||
//multiplicand low or dividend lowest
|
||||
case 0x4820: return s7r.reg4820;
|
||||
//multiplicand high or divdend lower
|
||||
@ -928,7 +948,7 @@ uint8 S9xGetSPC7110(uint16 Address)
|
||||
case 0x4826: return s7r.reg4826;
|
||||
//divisor high
|
||||
case 0x4827: return s7r.reg4827;
|
||||
|
||||
|
||||
//result lowest
|
||||
case 0x4828:
|
||||
return s7r.reg4828;
|
||||
@ -1070,16 +1090,16 @@ void S9xSetSPC7110 (uint8 data, uint16 Address)
|
||||
{
|
||||
s7r.reg480B=data;
|
||||
int table=(s7r.reg4803<<16)|(s7r.reg4802<<8)|s7r.reg4801;
|
||||
|
||||
|
||||
int j= 4*s7r.reg4804;
|
||||
j+=s7r.DataRomOffset;
|
||||
j+=table;
|
||||
|
||||
|
||||
if(s7r.reg480B==0)
|
||||
s7r.AlignBy=0;
|
||||
else
|
||||
{
|
||||
switch(ROM[j])
|
||||
switch(Memory.ROM[j])
|
||||
{
|
||||
case 0x03:
|
||||
s7r.AlignBy=8;
|
||||
@ -1179,13 +1199,13 @@ void S9xSetSPC7110 (uint8 data, uint16 Address)
|
||||
s7r.reg4813=((i&0xFF0000)>>16);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
s7r.written|=0x08;
|
||||
break;
|
||||
|
||||
|
||||
//data port adjust high (has a funky immediate increment mode)
|
||||
case 0x4815:
|
||||
s7r.reg4815=data;
|
||||
@ -1202,7 +1222,7 @@ void S9xSetSPC7110 (uint8 data, uint16 Address)
|
||||
else
|
||||
{
|
||||
uint32 i=(s7r.reg4813<<16)|(s7r.reg4812<<8)|s7r.reg4811;
|
||||
|
||||
|
||||
if(s7r.reg4818&0x08)
|
||||
{
|
||||
i+=(signed char)s7r.reg4814;
|
||||
@ -1297,7 +1317,7 @@ void S9xSetSPC7110 (uint8 data, uint16 Address)
|
||||
int mul;
|
||||
short m1=(short)((s7r.reg4824)|(s7r.reg4825<<8));
|
||||
short m2=(short)((s7r.reg4820)|(s7r.reg4821<<8));
|
||||
|
||||
|
||||
mul=m1*m2;
|
||||
s7r.reg4828=(uint8)(mul&0x000000FF);
|
||||
s7r.reg4829=(uint8)((mul&0x0000FF00)>>8);
|
||||
@ -1309,7 +1329,7 @@ void S9xSetSPC7110 (uint8 data, uint16 Address)
|
||||
uint32 mul;
|
||||
uint16 m1=(uint16)((s7r.reg4824)|(s7r.reg4825<<8));
|
||||
uint16 m2=(uint16)((s7r.reg4820)|(s7r.reg4821<<8));
|
||||
|
||||
|
||||
mul=m1*m2;
|
||||
s7r.reg4828=(uint8)(mul&0x000000FF);
|
||||
s7r.reg4829=(uint8)((mul&0x0000FF00)>>8);
|
||||
@ -1386,7 +1406,7 @@ void S9xSetSPC7110 (uint8 data, uint16 Address)
|
||||
|
||||
//SRAM toggle
|
||||
case 0x4830:
|
||||
Memory.SPC7110Sram(data);
|
||||
SetSPC7110SRAMMap(data);
|
||||
s7r.reg4830=data;
|
||||
break;
|
||||
//Bank DX mapping
|
||||
@ -1439,7 +1459,7 @@ void S9xSetSPC7110 (uint8 data, uint16 Address)
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
|
||||
if(0x0D==rtc_f9.index)
|
||||
{
|
||||
if(data&0x08)
|
||||
@ -1530,7 +1550,7 @@ uint8 S9xGetSPC7110Byte(uint32 Address)
|
||||
}
|
||||
i+=Address&0x000FFFFF;
|
||||
i+=s7r.DataRomOffset;
|
||||
return ROM[i];
|
||||
return Memory.ROM[i];
|
||||
}
|
||||
}
|
||||
/**********************************************************************************************/
|
||||
@ -1541,7 +1561,7 @@ uint8 S9xGetSPC7110Byte(uint32 Address)
|
||||
int S9xRTCDaysInMonth( int month, int year )
|
||||
{
|
||||
int mdays;
|
||||
|
||||
|
||||
switch ( month )
|
||||
{
|
||||
case 2:
|
||||
@ -1550,19 +1570,19 @@ int S9xRTCDaysInMonth( int month, int year )
|
||||
else
|
||||
mdays = 28;
|
||||
break;
|
||||
|
||||
|
||||
case 4:
|
||||
case 6:
|
||||
case 9:
|
||||
case 11:
|
||||
mdays = 30;
|
||||
break;
|
||||
|
||||
|
||||
default: // months 1,3,5,7,8,10,12
|
||||
mdays = 31;
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
return mdays;
|
||||
}
|
||||
|
||||
@ -1581,22 +1601,22 @@ void S9xUpdateRTC ()
|
||||
{
|
||||
time_t cur_systime;
|
||||
long time_diff;
|
||||
|
||||
|
||||
// Keep track of game time by computing the number of seconds that pass on the system
|
||||
// clock and adding the same number of seconds to the RTC clock structure.
|
||||
|
||||
|
||||
if (rtc_f9.init && 0==(rtc_f9.reg[0x0D]&0x01) && 0==(rtc_f9.reg[0x0F]&0x03))
|
||||
{
|
||||
cur_systime = time (NULL);
|
||||
|
||||
|
||||
// This method assumes one time_t clock tick is one second
|
||||
// which should work on PCs and GNU systems.
|
||||
// If your tick interval is different adjust the
|
||||
// DAYTICK, HOURTICK, and MINUTETICK defines
|
||||
|
||||
|
||||
time_diff = (long) (cur_systime - rtc_f9.last_used);
|
||||
rtc_f9.last_used = cur_systime;
|
||||
|
||||
|
||||
if ( time_diff > 0 )
|
||||
{
|
||||
int seconds;
|
||||
@ -1606,12 +1626,12 @@ void S9xUpdateRTC ()
|
||||
int month;
|
||||
int year;
|
||||
int temp_days;
|
||||
|
||||
|
||||
int year_hundreds;
|
||||
int year_tens;
|
||||
int year_ones;
|
||||
|
||||
|
||||
|
||||
|
||||
if ( time_diff > DAYTICKS )
|
||||
{
|
||||
days = time_diff / DAYTICKS;
|
||||
@ -1621,7 +1641,7 @@ void S9xUpdateRTC ()
|
||||
{
|
||||
days = 0;
|
||||
}
|
||||
|
||||
|
||||
if ( time_diff > HOURTICKS )
|
||||
{
|
||||
hours = time_diff / HOURTICKS;
|
||||
@ -1631,7 +1651,7 @@ void S9xUpdateRTC ()
|
||||
{
|
||||
hours = 0;
|
||||
}
|
||||
|
||||
|
||||
if ( time_diff > MINUTETICKS )
|
||||
{
|
||||
minutes = time_diff / MINUTETICKS;
|
||||
@ -1641,7 +1661,7 @@ void S9xUpdateRTC ()
|
||||
{
|
||||
minutes = 0;
|
||||
}
|
||||
|
||||
|
||||
if ( time_diff > 0 )
|
||||
{
|
||||
seconds = time_diff;
|
||||
@ -1650,29 +1670,29 @@ void S9xUpdateRTC ()
|
||||
{
|
||||
seconds = 0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
seconds += (rtc_f9.reg[1]*10 + rtc_f9.reg[0]);
|
||||
if ( seconds >= 60 )
|
||||
{
|
||||
seconds -= 60;
|
||||
minutes += 1;
|
||||
}
|
||||
|
||||
|
||||
minutes += (rtc_f9.reg[3]*10 + rtc_f9.reg[2]);
|
||||
if ( minutes >= 60 )
|
||||
{
|
||||
minutes -= 60;
|
||||
hours += 1;
|
||||
}
|
||||
|
||||
|
||||
hours += (rtc_f9.reg[5]*10 + rtc_f9.reg[4]);
|
||||
if ( hours >= 24 )
|
||||
{
|
||||
hours -= 24;
|
||||
days += 1;
|
||||
}
|
||||
|
||||
|
||||
year = rtc_f9.reg[11]*10 + rtc_f9.reg[10];
|
||||
year += ( 1900 );
|
||||
month = rtc_f9.reg[8]+10*rtc_f9.reg[9];
|
||||
@ -1696,7 +1716,7 @@ void S9xUpdateRTC ()
|
||||
year_ones = year_tens % 10;
|
||||
year_tens /= 10;
|
||||
year_hundreds = (year - 1000) / 100;
|
||||
|
||||
|
||||
rtc_f9.reg[0] = seconds % 10;
|
||||
rtc_f9.reg[1] = seconds / 10;
|
||||
rtc_f9.reg[2] = minutes % 10;
|
||||
@ -1734,7 +1754,7 @@ uint8* Get7110BasePtr(uint32 Address)
|
||||
default:i=0;
|
||||
}
|
||||
i+=Address&0x000F0000;
|
||||
return &ROM[i];
|
||||
return &Memory.ROM[i];
|
||||
}
|
||||
//end extern
|
||||
}
|
||||
@ -1773,7 +1793,7 @@ bool Load7110Index(char* filename)
|
||||
decompack->tableEnts[i].location[index].size=size;
|
||||
decompack->tableEnts[i].location[index].used_len=0;
|
||||
decompack->tableEnts[i].location[index].used_offset=0;
|
||||
|
||||
|
||||
}
|
||||
while(!feof(fp));
|
||||
fclose(fp);
|
||||
@ -1784,7 +1804,6 @@ bool Load7110Index(char* filename)
|
||||
//Cache 1 load function
|
||||
void SPC7110Load(char* dirname)
|
||||
{
|
||||
#ifndef NGC
|
||||
char temp_path[PATH_MAX];
|
||||
int i=0;
|
||||
|
||||
@ -1795,15 +1814,13 @@ void SPC7110Load(char* dirname)
|
||||
#endif
|
||||
|
||||
ZeroMemory(decompack, sizeof(Pack7110));
|
||||
|
||||
#ifndef _XBOX
|
||||
#ifndef NGC
|
||||
|
||||
#ifndef _XBOX
|
||||
if(-1==chdir(dirname))
|
||||
{
|
||||
S9xMessage(0,0,"Graphics Pack not found!");
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifndef _XBOX
|
||||
Load7110Index("index.bin");
|
||||
@ -1823,11 +1840,8 @@ void SPC7110Load(char* dirname)
|
||||
sprintf(binname,"%s%06X.bin",filename,decompack->tableEnts[i].table);
|
||||
#endif
|
||||
struct stat buf;
|
||||
|
||||
#ifndef NGC
|
||||
if(-1!=stat(binname, &buf))
|
||||
decompack->binfiles[i]=new uint8[buf.st_size];
|
||||
#endif
|
||||
FILE* fp=fopen(binname, "rb");
|
||||
if(fp)
|
||||
{
|
||||
@ -1837,10 +1851,8 @@ void SPC7110Load(char* dirname)
|
||||
}
|
||||
}
|
||||
|
||||
#ifndef _XBOX
|
||||
#ifndef NGC
|
||||
#ifndef _XBOX
|
||||
chdir(temp_path);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
Copy7110=&MovePackData;
|
||||
@ -1865,7 +1877,7 @@ void SPC7110Open(char* dirname)
|
||||
#endif
|
||||
|
||||
ZeroMemory(decompack, sizeof(Pack7110));
|
||||
|
||||
|
||||
#ifndef _XBOX
|
||||
if(-1==chdir(dirname))
|
||||
{
|
||||
@ -1915,7 +1927,7 @@ void SPC7110Grab(char* dirname)
|
||||
|
||||
ZeroMemory(decompack, sizeof(Pack7110));
|
||||
#ifndef _XBOX
|
||||
|
||||
|
||||
if(-1==chdir(dirname))
|
||||
{
|
||||
S9xMessage(0,0,"Graphics Pack not found!");
|
||||
@ -1941,8 +1953,6 @@ void SPC7110Grab(char* dirname)
|
||||
#endif
|
||||
struct stat buf;
|
||||
//add load/no load calculations here
|
||||
|
||||
#ifndef NGC
|
||||
if(-1!=stat(binname, &buf))
|
||||
{
|
||||
if(buf.st_size<buffer_size)
|
||||
@ -1965,8 +1975,6 @@ void SPC7110Grab(char* dirname)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
@ -1983,9 +1991,6 @@ void SPC7110Grab(char* dirname)
|
||||
EnableMenuItem(GUI.hMenu, IDM_LOG_7110, MF_ENABLED);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
}
|
||||
|
||||
//Cache 1 clean up function
|
||||
@ -2151,14 +2156,14 @@ void Do7110Logging()
|
||||
uint8 ent_temp;
|
||||
FILE* flog;
|
||||
int entries=0;
|
||||
|
||||
|
||||
if(Settings.SPC7110)
|
||||
{
|
||||
//flush last read into logging
|
||||
(*Copy7110)();
|
||||
|
||||
|
||||
#ifdef __MACOSX__
|
||||
char name[PATH_MAX + 1];
|
||||
char name[PATH_MAX + 1];
|
||||
strcpy(name, S9xGetFilename(".dat", DEFAULT_DIR));
|
||||
flog = fopen(name, "rb");
|
||||
#else
|
||||
@ -2203,7 +2208,7 @@ void Do7110Logging()
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
if(flog)
|
||||
{
|
||||
uint8 buffer[8];
|
||||
@ -2236,11 +2241,11 @@ void Do7110Logging()
|
||||
while(!feof(flog));
|
||||
fclose(flog);
|
||||
}
|
||||
|
||||
|
||||
#ifdef __MACOSX__
|
||||
strcpy(name, S9xGetFilename(".dat", DEFAULT_DIR));
|
||||
flog = fopen(name, "rb");
|
||||
#else
|
||||
#else
|
||||
if(!strncmp((char*)&Memory.ROM [0xffc0], "SUPER POWER LEAG 4 ", 21))
|
||||
{
|
||||
#ifdef _XBOX // cwd could be the dvd-rom, so write to T:\\ which is storage region for each title
|
||||
@ -2310,14 +2315,14 @@ void Do7110Logging()
|
||||
fwrite(&temp,1,4,flog);
|
||||
fwrite(&temp,1,4,flog);
|
||||
fwrite(&temp,1,4,flog);
|
||||
|
||||
|
||||
ent_temp=0;
|
||||
fwrite(&ent_temp,1,1,flog);
|
||||
ent_temp=0;
|
||||
fwrite(&ent_temp,1,1,flog);
|
||||
ent_temp=0;
|
||||
fwrite(&ent_temp,1,1,flog);
|
||||
|
||||
|
||||
for(j=0;j<MAX_TABLES;j++)
|
||||
{
|
||||
for(int k=0;k<256;k++)
|
||||
@ -2333,7 +2338,7 @@ void Do7110Logging()
|
||||
ent_temp=k&0xFF;
|
||||
fwrite(&ent_temp,1,1,flog);//804
|
||||
ent_temp=decompack->tableEnts[j].location[k].used_len&0xFF;
|
||||
fwrite(&ent_temp,1,1,flog);//lsb of
|
||||
fwrite(&ent_temp,1,1,flog);//lsb of
|
||||
ent_temp=(decompack->tableEnts[j].location[k].used_len>>8)&0xFF;
|
||||
fwrite(&ent_temp,1,1,flog);//msb of
|
||||
ent_temp=(decompack->tableEnts[j].location[k].used_offset)&0xFF;
|
||||
@ -2349,6 +2354,25 @@ void Do7110Logging()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void SetSPC7110SRAMMap (uint8 newstate)
|
||||
{
|
||||
if (newstate & 0x80)
|
||||
{
|
||||
Memory.Map[0x006] = (uint8 *) Memory.MAP_HIROM_SRAM;
|
||||
Memory.Map[0x007] = (uint8 *) Memory.MAP_HIROM_SRAM;
|
||||
Memory.Map[0x306] = (uint8 *) Memory.MAP_HIROM_SRAM;
|
||||
Memory.Map[0x307] = (uint8 *) Memory.MAP_HIROM_SRAM;
|
||||
}
|
||||
else
|
||||
{
|
||||
Memory.Map[0x006] = (uint8 *) Memory.MAP_RONLY_SRAM;
|
||||
Memory.Map[0x007] = (uint8 *) Memory.MAP_RONLY_SRAM;
|
||||
Memory.Map[0x306] = (uint8 *) Memory.MAP_RONLY_SRAM;
|
||||
Memory.Map[0x307] = (uint8 *) Memory.MAP_RONLY_SRAM;
|
||||
}
|
||||
}
|
||||
|
||||
bool8 S9xSaveSPC7110RTC (S7RTC *rtc_f9)
|
||||
{
|
||||
FILE* fp;
|
||||
@ -2396,7 +2420,7 @@ bool8 S9xLoadSPC7110RTC (S7RTC *rtc_f9)
|
||||
rtc_f9->index|=(temp<<8);
|
||||
fread(&rtc_f9->control,1,1,fp);
|
||||
fread(&rtc_f9->init,1,1,fp);
|
||||
|
||||
|
||||
fread(&temp,1,1,fp);
|
||||
rtc_f9->last_used=temp;
|
||||
fread(&temp,1,1,fp);
|
||||
|
@ -1,7 +1,7 @@
|
||||
/**********************************************************************************
|
||||
Snes9x - Portable Super Nintendo Entertainment System (TM) emulator.
|
||||
|
||||
(c) Copyright 1996 - 2002 Gary Henderson (gary.henderson@ntlworld.com) and
|
||||
(c) Copyright 1996 - 2002 Gary Henderson (gary.henderson@ntlworld.com),
|
||||
Jerremy Koot (jkoot@snes9x.com)
|
||||
|
||||
(c) Copyright 2002 - 2004 Matthew Kendora
|
||||
@ -12,12 +12,16 @@
|
||||
|
||||
(c) Copyright 2001 - 2006 John Weidman (jweidman@slip.net)
|
||||
|
||||
(c) Copyright 2002 - 2006 Brad Jorsch (anomie@users.sourceforge.net),
|
||||
funkyass (funkyass@spam.shaw.ca),
|
||||
Kris Bleakley (codeviolation@hotmail.com),
|
||||
Nach (n-a-c-h@users.sourceforge.net), and
|
||||
(c) Copyright 2002 - 2006 funkyass (funkyass@spam.shaw.ca),
|
||||
Kris Bleakley (codeviolation@hotmail.com)
|
||||
|
||||
(c) Copyright 2002 - 2007 Brad Jorsch (anomie@users.sourceforge.net),
|
||||
Nach (n-a-c-h@users.sourceforge.net),
|
||||
zones (kasumitokoduck@yahoo.com)
|
||||
|
||||
(c) Copyright 2006 - 2007 nitsuja
|
||||
|
||||
|
||||
BS-X C emulator code
|
||||
(c) Copyright 2005 - 2006 Dreamer Nom,
|
||||
zones
|
||||
@ -110,17 +114,30 @@
|
||||
2xSaI filter
|
||||
(c) Copyright 1999 - 2001 Derek Liauw Kie Fa
|
||||
|
||||
HQ2x filter
|
||||
HQ2x, HQ3x, HQ4x filters
|
||||
(c) Copyright 2003 Maxim Stepin (maxim@hiend3d.com)
|
||||
|
||||
Win32 GUI code
|
||||
(c) Copyright 2003 - 2006 blip,
|
||||
funkyass,
|
||||
Matthew Kendora,
|
||||
Nach,
|
||||
nitsuja
|
||||
|
||||
Mac OS GUI code
|
||||
(c) Copyright 1998 - 2001 John Stiles
|
||||
(c) Copyright 2001 - 2007 zones
|
||||
|
||||
|
||||
Specific ports contains the works of other authors. See headers in
|
||||
individual files.
|
||||
|
||||
|
||||
Snes9x homepage: http://www.snes9x.com
|
||||
|
||||
Permission to use, copy, modify and/or distribute Snes9x in both binary
|
||||
and source form, for non-commercial purposes, is hereby granted without
|
||||
fee, providing that this license information and copyright notice appear
|
||||
and source form, for non-commercial purposes, is hereby granted without
|
||||
fee, providing that this license information and copyright notice appear
|
||||
with all copies and any derived work.
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
@ -141,6 +158,8 @@
|
||||
Nintendo Co., Limited and its subsidiary companies.
|
||||
**********************************************************************************/
|
||||
|
||||
|
||||
|
||||
#ifndef _spc7110_h
|
||||
#define _spc7110_h
|
||||
#include "port.h"
|
||||
|
@ -1,7 +1,7 @@
|
||||
/**********************************************************************************
|
||||
Snes9x - Portable Super Nintendo Entertainment System (TM) emulator.
|
||||
|
||||
(c) Copyright 1996 - 2002 Gary Henderson (gary.henderson@ntlworld.com) and
|
||||
(c) Copyright 1996 - 2002 Gary Henderson (gary.henderson@ntlworld.com),
|
||||
Jerremy Koot (jkoot@snes9x.com)
|
||||
|
||||
(c) Copyright 2002 - 2004 Matthew Kendora
|
||||
@ -12,12 +12,16 @@
|
||||
|
||||
(c) Copyright 2001 - 2006 John Weidman (jweidman@slip.net)
|
||||
|
||||
(c) Copyright 2002 - 2006 Brad Jorsch (anomie@users.sourceforge.net),
|
||||
funkyass (funkyass@spam.shaw.ca),
|
||||
Kris Bleakley (codeviolation@hotmail.com),
|
||||
Nach (n-a-c-h@users.sourceforge.net), and
|
||||
(c) Copyright 2002 - 2006 funkyass (funkyass@spam.shaw.ca),
|
||||
Kris Bleakley (codeviolation@hotmail.com)
|
||||
|
||||
(c) Copyright 2002 - 2007 Brad Jorsch (anomie@users.sourceforge.net),
|
||||
Nach (n-a-c-h@users.sourceforge.net),
|
||||
zones (kasumitokoduck@yahoo.com)
|
||||
|
||||
(c) Copyright 2006 - 2007 nitsuja
|
||||
|
||||
|
||||
BS-X C emulator code
|
||||
(c) Copyright 2005 - 2006 Dreamer Nom,
|
||||
zones
|
||||
@ -110,17 +114,30 @@
|
||||
2xSaI filter
|
||||
(c) Copyright 1999 - 2001 Derek Liauw Kie Fa
|
||||
|
||||
HQ2x filter
|
||||
HQ2x, HQ3x, HQ4x filters
|
||||
(c) Copyright 2003 Maxim Stepin (maxim@hiend3d.com)
|
||||
|
||||
Win32 GUI code
|
||||
(c) Copyright 2003 - 2006 blip,
|
||||
funkyass,
|
||||
Matthew Kendora,
|
||||
Nach,
|
||||
nitsuja
|
||||
|
||||
Mac OS GUI code
|
||||
(c) Copyright 1998 - 2001 John Stiles
|
||||
(c) Copyright 2001 - 2007 zones
|
||||
|
||||
|
||||
Specific ports contains the works of other authors. See headers in
|
||||
individual files.
|
||||
|
||||
|
||||
Snes9x homepage: http://www.snes9x.com
|
||||
|
||||
Permission to use, copy, modify and/or distribute Snes9x in both binary
|
||||
and source form, for non-commercial purposes, is hereby granted without
|
||||
fee, providing that this license information and copyright notice appear
|
||||
and source form, for non-commercial purposes, is hereby granted without
|
||||
fee, providing that this license information and copyright notice appear
|
||||
with all copies and any derived work.
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
@ -141,6 +158,8 @@
|
||||
Nintendo Co., Limited and its subsidiary companies.
|
||||
**********************************************************************************/
|
||||
|
||||
|
||||
|
||||
#include <string.h>
|
||||
#include "snes9x.h"
|
||||
#include "srtc.h"
|
||||
@ -191,7 +210,7 @@ static int month_keys[12] = { 1, 4, 4, 0, 2, 5, 0, 3, 6, 1, 4, 6 };
|
||||
*
|
||||
* restore the rtc data structure
|
||||
* rtc.system_timestamp = time (NULL);
|
||||
*
|
||||
*
|
||||
*
|
||||
*********************************************************************************************/
|
||||
|
||||
@ -309,7 +328,7 @@ void S9xUpdateSrtcTime ()
|
||||
|
||||
time_diff = (long) (cur_systime - rtc.system_timestamp);
|
||||
rtc.system_timestamp = cur_systime;
|
||||
|
||||
|
||||
if ( time_diff > 0 )
|
||||
{
|
||||
int seconds;
|
||||
@ -578,25 +597,23 @@ void S9xSRTCPreSaveState ()
|
||||
if (s > 0x20000)
|
||||
s = 0x20000;
|
||||
|
||||
SRAM [s + 0] = rtc.needs_init;
|
||||
SRAM [s + 1] = rtc.count_enable;
|
||||
memmove (&SRAM [s + 2], rtc.data, MAX_RTC_INDEX + 1);
|
||||
SRAM [s + 3 + MAX_RTC_INDEX] = rtc.index;
|
||||
SRAM [s + 4 + MAX_RTC_INDEX] = rtc.mode;
|
||||
Memory.SRAM [s + 0] = rtc.needs_init;
|
||||
Memory.SRAM [s + 1] = rtc.count_enable;
|
||||
memmove (&Memory.SRAM [s + 2], rtc.data, MAX_RTC_INDEX + 1);
|
||||
Memory.SRAM [s + 3 + MAX_RTC_INDEX] = rtc.index;
|
||||
Memory.SRAM [s + 4 + MAX_RTC_INDEX] = rtc.mode;
|
||||
|
||||
#ifdef LSB_FIRST
|
||||
memmove (&SRAM [s + 5 + MAX_RTC_INDEX], &rtc.system_timestamp, 8);
|
||||
memmove (&Memory.SRAM [s + 5 + MAX_RTC_INDEX], &rtc.system_timestamp, 8);
|
||||
#else
|
||||
#ifndef NGC
|
||||
SRAM [s + 5 + MAX_RTC_INDEX] = (uint8) (rtc.system_timestamp >> 0);
|
||||
SRAM [s + 6 + MAX_RTC_INDEX] = (uint8) (rtc.system_timestamp >> 8);
|
||||
SRAM [s + 7 + MAX_RTC_INDEX] = (uint8) (rtc.system_timestamp >> 16);
|
||||
SRAM [s + 8 + MAX_RTC_INDEX] = (uint8) (rtc.system_timestamp >> 24);
|
||||
SRAM [s + 9 + MAX_RTC_INDEX] = (uint8) (rtc.system_timestamp >> 32);
|
||||
SRAM [s + 10 + MAX_RTC_INDEX] = (uint8) (rtc.system_timestamp >> 40);
|
||||
SRAM [s + 11 + MAX_RTC_INDEX] = (uint8) (rtc.system_timestamp >> 48);
|
||||
SRAM [s + 12 + MAX_RTC_INDEX] = (uint8) (rtc.system_timestamp >> 56);
|
||||
#endif
|
||||
Memory.SRAM [s + 5 + MAX_RTC_INDEX] = (uint8) (rtc.system_timestamp >> 0);
|
||||
Memory.SRAM [s + 6 + MAX_RTC_INDEX] = (uint8) (rtc.system_timestamp >> 8);
|
||||
Memory.SRAM [s + 7 + MAX_RTC_INDEX] = (uint8) (rtc.system_timestamp >> 16);
|
||||
Memory.SRAM [s + 8 + MAX_RTC_INDEX] = (uint8) (rtc.system_timestamp >> 24);
|
||||
Memory.SRAM [s + 9 + MAX_RTC_INDEX] = (uint8) (rtc.system_timestamp >> 32);
|
||||
Memory.SRAM [s + 10 + MAX_RTC_INDEX] = (uint8) (rtc.system_timestamp >> 40);
|
||||
Memory.SRAM [s + 11 + MAX_RTC_INDEX] = (uint8) (rtc.system_timestamp >> 48);
|
||||
Memory.SRAM [s + 12 + MAX_RTC_INDEX] = (uint8) (rtc.system_timestamp >> 56);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
@ -610,25 +627,23 @@ void S9xSRTCPostLoadState ()
|
||||
if (s > 0x20000)
|
||||
s = 0x20000;
|
||||
|
||||
rtc.needs_init = SRAM [s + 0];
|
||||
rtc.count_enable = SRAM [s + 1];
|
||||
memmove (rtc.data, &SRAM [s + 2], MAX_RTC_INDEX + 1);
|
||||
rtc.index = SRAM [s + 3 + MAX_RTC_INDEX];
|
||||
rtc.mode = SRAM [s + 4 + MAX_RTC_INDEX];
|
||||
rtc.needs_init = Memory.SRAM [s + 0];
|
||||
rtc.count_enable = Memory.SRAM [s + 1];
|
||||
memmove (rtc.data, &Memory.SRAM [s + 2], MAX_RTC_INDEX + 1);
|
||||
rtc.index = Memory.SRAM [s + 3 + MAX_RTC_INDEX];
|
||||
rtc.mode = Memory.SRAM [s + 4 + MAX_RTC_INDEX];
|
||||
|
||||
#ifdef LSB_FIRST
|
||||
memmove (&rtc.system_timestamp, &SRAM [s + 5 + MAX_RTC_INDEX], 8);
|
||||
memmove (&rtc.system_timestamp, &Memory.SRAM [s + 5 + MAX_RTC_INDEX], 8);
|
||||
#else
|
||||
#ifndef NGC
|
||||
rtc.system_timestamp |= (SRAM [s + 5 + MAX_RTC_INDEX] << 0);
|
||||
rtc.system_timestamp |= (SRAM [s + 6 + MAX_RTC_INDEX] << 8);
|
||||
rtc.system_timestamp |= (SRAM [s + 7 + MAX_RTC_INDEX] << 16);
|
||||
rtc.system_timestamp |= (SRAM [s + 8 + MAX_RTC_INDEX] << 24);
|
||||
rtc.system_timestamp |= (SRAM [s + 9 + MAX_RTC_INDEX] << 32);
|
||||
rtc.system_timestamp |= (SRAM [s + 10 + MAX_RTC_INDEX] << 40);
|
||||
rtc.system_timestamp |= (SRAM [s + 11 + MAX_RTC_INDEX] << 48);
|
||||
rtc.system_timestamp |= (SRAM [s + 12 + MAX_RTC_INDEX] << 56);
|
||||
#endif
|
||||
rtc.system_timestamp |= (Memory.SRAM [s + 5 + MAX_RTC_INDEX] << 0);
|
||||
rtc.system_timestamp |= (Memory.SRAM [s + 6 + MAX_RTC_INDEX] << 8);
|
||||
rtc.system_timestamp |= (Memory.SRAM [s + 7 + MAX_RTC_INDEX] << 16);
|
||||
rtc.system_timestamp |= (Memory.SRAM [s + 8 + MAX_RTC_INDEX] << 24);
|
||||
rtc.system_timestamp |= (Memory.SRAM [s + 9 + MAX_RTC_INDEX] << 32);
|
||||
rtc.system_timestamp |= (Memory.SRAM [s + 10 + MAX_RTC_INDEX] << 40);
|
||||
rtc.system_timestamp |= (Memory.SRAM [s + 11 + MAX_RTC_INDEX] << 48);
|
||||
rtc.system_timestamp |= (Memory.SRAM [s + 12 + MAX_RTC_INDEX] << 56);
|
||||
#endif
|
||||
S9xUpdateSrtcTime ();
|
||||
}
|
||||
|
@ -1,7 +1,7 @@
|
||||
/**********************************************************************************
|
||||
Snes9x - Portable Super Nintendo Entertainment System (TM) emulator.
|
||||
|
||||
(c) Copyright 1996 - 2002 Gary Henderson (gary.henderson@ntlworld.com) and
|
||||
(c) Copyright 1996 - 2002 Gary Henderson (gary.henderson@ntlworld.com),
|
||||
Jerremy Koot (jkoot@snes9x.com)
|
||||
|
||||
(c) Copyright 2002 - 2004 Matthew Kendora
|
||||
@ -12,12 +12,16 @@
|
||||
|
||||
(c) Copyright 2001 - 2006 John Weidman (jweidman@slip.net)
|
||||
|
||||
(c) Copyright 2002 - 2006 Brad Jorsch (anomie@users.sourceforge.net),
|
||||
funkyass (funkyass@spam.shaw.ca),
|
||||
Kris Bleakley (codeviolation@hotmail.com),
|
||||
Nach (n-a-c-h@users.sourceforge.net), and
|
||||
(c) Copyright 2002 - 2006 funkyass (funkyass@spam.shaw.ca),
|
||||
Kris Bleakley (codeviolation@hotmail.com)
|
||||
|
||||
(c) Copyright 2002 - 2007 Brad Jorsch (anomie@users.sourceforge.net),
|
||||
Nach (n-a-c-h@users.sourceforge.net),
|
||||
zones (kasumitokoduck@yahoo.com)
|
||||
|
||||
(c) Copyright 2006 - 2007 nitsuja
|
||||
|
||||
|
||||
BS-X C emulator code
|
||||
(c) Copyright 2005 - 2006 Dreamer Nom,
|
||||
zones
|
||||
@ -110,17 +114,30 @@
|
||||
2xSaI filter
|
||||
(c) Copyright 1999 - 2001 Derek Liauw Kie Fa
|
||||
|
||||
HQ2x filter
|
||||
HQ2x, HQ3x, HQ4x filters
|
||||
(c) Copyright 2003 Maxim Stepin (maxim@hiend3d.com)
|
||||
|
||||
Win32 GUI code
|
||||
(c) Copyright 2003 - 2006 blip,
|
||||
funkyass,
|
||||
Matthew Kendora,
|
||||
Nach,
|
||||
nitsuja
|
||||
|
||||
Mac OS GUI code
|
||||
(c) Copyright 1998 - 2001 John Stiles
|
||||
(c) Copyright 2001 - 2007 zones
|
||||
|
||||
|
||||
Specific ports contains the works of other authors. See headers in
|
||||
individual files.
|
||||
|
||||
|
||||
Snes9x homepage: http://www.snes9x.com
|
||||
|
||||
Permission to use, copy, modify and/or distribute Snes9x in both binary
|
||||
and source form, for non-commercial purposes, is hereby granted without
|
||||
fee, providing that this license information and copyright notice appear
|
||||
and source form, for non-commercial purposes, is hereby granted without
|
||||
fee, providing that this license information and copyright notice appear
|
||||
with all copies and any derived work.
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
@ -141,6 +158,8 @@
|
||||
Nintendo Co., Limited and its subsidiary companies.
|
||||
**********************************************************************************/
|
||||
|
||||
|
||||
|
||||
#ifndef _srtc_h_
|
||||
#define _srtc_h_
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
/**********************************************************************************
|
||||
Snes9x - Portable Super Nintendo Entertainment System (TM) emulator.
|
||||
|
||||
(c) Copyright 1996 - 2002 Gary Henderson (gary.henderson@ntlworld.com) and
|
||||
(c) Copyright 1996 - 2002 Gary Henderson (gary.henderson@ntlworld.com),
|
||||
Jerremy Koot (jkoot@snes9x.com)
|
||||
|
||||
(c) Copyright 2002 - 2004 Matthew Kendora
|
||||
@ -12,12 +12,16 @@
|
||||
|
||||
(c) Copyright 2001 - 2006 John Weidman (jweidman@slip.net)
|
||||
|
||||
(c) Copyright 2002 - 2006 Brad Jorsch (anomie@users.sourceforge.net),
|
||||
funkyass (funkyass@spam.shaw.ca),
|
||||
Kris Bleakley (codeviolation@hotmail.com),
|
||||
Nach (n-a-c-h@users.sourceforge.net), and
|
||||
(c) Copyright 2002 - 2006 funkyass (funkyass@spam.shaw.ca),
|
||||
Kris Bleakley (codeviolation@hotmail.com)
|
||||
|
||||
(c) Copyright 2002 - 2007 Brad Jorsch (anomie@users.sourceforge.net),
|
||||
Nach (n-a-c-h@users.sourceforge.net),
|
||||
zones (kasumitokoduck@yahoo.com)
|
||||
|
||||
(c) Copyright 2006 - 2007 nitsuja
|
||||
|
||||
|
||||
BS-X C emulator code
|
||||
(c) Copyright 2005 - 2006 Dreamer Nom,
|
||||
zones
|
||||
@ -110,17 +114,30 @@
|
||||
2xSaI filter
|
||||
(c) Copyright 1999 - 2001 Derek Liauw Kie Fa
|
||||
|
||||
HQ2x filter
|
||||
HQ2x, HQ3x, HQ4x filters
|
||||
(c) Copyright 2003 Maxim Stepin (maxim@hiend3d.com)
|
||||
|
||||
Win32 GUI code
|
||||
(c) Copyright 2003 - 2006 blip,
|
||||
funkyass,
|
||||
Matthew Kendora,
|
||||
Nach,
|
||||
nitsuja
|
||||
|
||||
Mac OS GUI code
|
||||
(c) Copyright 1998 - 2001 John Stiles
|
||||
(c) Copyright 2001 - 2007 zones
|
||||
|
||||
|
||||
Specific ports contains the works of other authors. See headers in
|
||||
individual files.
|
||||
|
||||
|
||||
Snes9x homepage: http://www.snes9x.com
|
||||
|
||||
Permission to use, copy, modify and/or distribute Snes9x in both binary
|
||||
and source form, for non-commercial purposes, is hereby granted without
|
||||
fee, providing that this license information and copyright notice appear
|
||||
and source form, for non-commercial purposes, is hereby granted without
|
||||
fee, providing that this license information and copyright notice appear
|
||||
with all copies and any derived work.
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
@ -142,6 +159,8 @@
|
||||
**********************************************************************************/
|
||||
|
||||
|
||||
|
||||
|
||||
// This file includes itself multiple times. The other option would be to have
|
||||
// 4 files, where A includes B, and B includes C 3 times, and C includes D 5
|
||||
// times. Look for the following marker to find where the divisions are.
|
||||
|
@ -1,7 +1,7 @@
|
||||
/**********************************************************************************
|
||||
Snes9x - Portable Super Nintendo Entertainment System (TM) emulator.
|
||||
|
||||
(c) Copyright 1996 - 2002 Gary Henderson (gary.henderson@ntlworld.com) and
|
||||
(c) Copyright 1996 - 2002 Gary Henderson (gary.henderson@ntlworld.com),
|
||||
Jerremy Koot (jkoot@snes9x.com)
|
||||
|
||||
(c) Copyright 2002 - 2004 Matthew Kendora
|
||||
@ -12,12 +12,16 @@
|
||||
|
||||
(c) Copyright 2001 - 2006 John Weidman (jweidman@slip.net)
|
||||
|
||||
(c) Copyright 2002 - 2006 Brad Jorsch (anomie@users.sourceforge.net),
|
||||
funkyass (funkyass@spam.shaw.ca),
|
||||
Kris Bleakley (codeviolation@hotmail.com),
|
||||
Nach (n-a-c-h@users.sourceforge.net), and
|
||||
(c) Copyright 2002 - 2006 funkyass (funkyass@spam.shaw.ca),
|
||||
Kris Bleakley (codeviolation@hotmail.com)
|
||||
|
||||
(c) Copyright 2002 - 2007 Brad Jorsch (anomie@users.sourceforge.net),
|
||||
Nach (n-a-c-h@users.sourceforge.net),
|
||||
zones (kasumitokoduck@yahoo.com)
|
||||
|
||||
(c) Copyright 2006 - 2007 nitsuja
|
||||
|
||||
|
||||
BS-X C emulator code
|
||||
(c) Copyright 2005 - 2006 Dreamer Nom,
|
||||
zones
|
||||
@ -110,17 +114,30 @@
|
||||
2xSaI filter
|
||||
(c) Copyright 1999 - 2001 Derek Liauw Kie Fa
|
||||
|
||||
HQ2x filter
|
||||
HQ2x, HQ3x, HQ4x filters
|
||||
(c) Copyright 2003 Maxim Stepin (maxim@hiend3d.com)
|
||||
|
||||
Win32 GUI code
|
||||
(c) Copyright 2003 - 2006 blip,
|
||||
funkyass,
|
||||
Matthew Kendora,
|
||||
Nach,
|
||||
nitsuja
|
||||
|
||||
Mac OS GUI code
|
||||
(c) Copyright 1998 - 2001 John Stiles
|
||||
(c) Copyright 2001 - 2007 zones
|
||||
|
||||
|
||||
Specific ports contains the works of other authors. See headers in
|
||||
individual files.
|
||||
|
||||
|
||||
Snes9x homepage: http://www.snes9x.com
|
||||
|
||||
Permission to use, copy, modify and/or distribute Snes9x in both binary
|
||||
and source form, for non-commercial purposes, is hereby granted without
|
||||
fee, providing that this license information and copyright notice appear
|
||||
and source form, for non-commercial purposes, is hereby granted without
|
||||
fee, providing that this license information and copyright notice appear
|
||||
with all copies and any derived work.
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
@ -141,6 +158,8 @@
|
||||
Nintendo Co., Limited and its subsidiary companies.
|
||||
**********************************************************************************/
|
||||
|
||||
|
||||
|
||||
#ifndef _TILE_H_
|
||||
#define _TILE_H_
|
||||
|
||||
|
1305
source/snes9x/unused/2xsai.cpp
Normal file
1305
source/snes9x/unused/2xsai.cpp
Normal file
File diff suppressed because it is too large
Load Diff
821
source/snes9x/unused/2xsaiwin.cpp
Normal file
821
source/snes9x/unused/2xsaiwin.cpp
Normal file
@ -0,0 +1,821 @@
|
||||
/**********************************************************************************
|
||||
Snes9x - Portable Super Nintendo Entertainment System (TM) emulator.
|
||||
|
||||
(c) Copyright 1996 - 2002 Gary Henderson (gary.henderson@ntlworld.com),
|
||||
Jerremy Koot (jkoot@snes9x.com)
|
||||
|
||||
(c) Copyright 2002 - 2004 Matthew Kendora
|
||||
|
||||
(c) Copyright 2002 - 2005 Peter Bortas (peter@bortas.org)
|
||||
|
||||
(c) Copyright 2004 - 2005 Joel Yliluoma (http://iki.fi/bisqwit/)
|
||||
|
||||
(c) Copyright 2001 - 2006 John Weidman (jweidman@slip.net)
|
||||
|
||||
(c) Copyright 2002 - 2006 funkyass (funkyass@spam.shaw.ca),
|
||||
Kris Bleakley (codeviolation@hotmail.com)
|
||||
|
||||
(c) Copyright 2002 - 2007 Brad Jorsch (anomie@users.sourceforge.net),
|
||||
Nach (n-a-c-h@users.sourceforge.net),
|
||||
zones (kasumitokoduck@yahoo.com)
|
||||
|
||||
(c) Copyright 2006 - 2007 nitsuja
|
||||
|
||||
|
||||
BS-X C emulator code
|
||||
(c) Copyright 2005 - 2006 Dreamer Nom,
|
||||
zones
|
||||
|
||||
C4 x86 assembler and some C emulation code
|
||||
(c) Copyright 2000 - 2003 _Demo_ (_demo_@zsnes.com),
|
||||
Nach,
|
||||
zsKnight (zsknight@zsnes.com)
|
||||
|
||||
C4 C++ code
|
||||
(c) Copyright 2003 - 2006 Brad Jorsch,
|
||||
Nach
|
||||
|
||||
DSP-1 emulator code
|
||||
(c) Copyright 1998 - 2006 _Demo_,
|
||||
Andreas Naive (andreasnaive@gmail.com)
|
||||
Gary Henderson,
|
||||
Ivar (ivar@snes9x.com),
|
||||
John Weidman,
|
||||
Kris Bleakley,
|
||||
Matthew Kendora,
|
||||
Nach,
|
||||
neviksti (neviksti@hotmail.com)
|
||||
|
||||
DSP-2 emulator code
|
||||
(c) Copyright 2003 John Weidman,
|
||||
Kris Bleakley,
|
||||
Lord Nightmare (lord_nightmare@users.sourceforge.net),
|
||||
Matthew Kendora,
|
||||
neviksti
|
||||
|
||||
|
||||
DSP-3 emulator code
|
||||
(c) Copyright 2003 - 2006 John Weidman,
|
||||
Kris Bleakley,
|
||||
Lancer,
|
||||
z80 gaiden
|
||||
|
||||
DSP-4 emulator code
|
||||
(c) Copyright 2004 - 2006 Dreamer Nom,
|
||||
John Weidman,
|
||||
Kris Bleakley,
|
||||
Nach,
|
||||
z80 gaiden
|
||||
|
||||
OBC1 emulator code
|
||||
(c) Copyright 2001 - 2004 zsKnight,
|
||||
pagefault (pagefault@zsnes.com),
|
||||
Kris Bleakley,
|
||||
Ported from x86 assembler to C by sanmaiwashi
|
||||
|
||||
SPC7110 and RTC C++ emulator code
|
||||
(c) Copyright 2002 Matthew Kendora with research by
|
||||
zsKnight,
|
||||
John Weidman,
|
||||
Dark Force
|
||||
|
||||
S-DD1 C emulator code
|
||||
(c) Copyright 2003 Brad Jorsch with research by
|
||||
Andreas Naive,
|
||||
John Weidman
|
||||
|
||||
S-RTC C emulator code
|
||||
(c) Copyright 2001-2006 byuu,
|
||||
John Weidman
|
||||
|
||||
ST010 C++ emulator code
|
||||
(c) Copyright 2003 Feather,
|
||||
John Weidman,
|
||||
Kris Bleakley,
|
||||
Matthew Kendora
|
||||
|
||||
Super FX x86 assembler emulator code
|
||||
(c) Copyright 1998 - 2003 _Demo_,
|
||||
pagefault,
|
||||
zsKnight,
|
||||
|
||||
Super FX C emulator code
|
||||
(c) Copyright 1997 - 1999 Ivar,
|
||||
Gary Henderson,
|
||||
John Weidman
|
||||
|
||||
Sound DSP emulator code is derived from SNEeSe and OpenSPC:
|
||||
(c) Copyright 1998 - 2003 Brad Martin
|
||||
(c) Copyright 1998 - 2006 Charles Bilyue'
|
||||
|
||||
SH assembler code partly based on x86 assembler code
|
||||
(c) Copyright 2002 - 2004 Marcus Comstedt (marcus@mc.pp.se)
|
||||
|
||||
2xSaI filter
|
||||
(c) Copyright 1999 - 2001 Derek Liauw Kie Fa
|
||||
|
||||
HQ2x, HQ3x, HQ4x filters
|
||||
(c) Copyright 2003 Maxim Stepin (maxim@hiend3d.com)
|
||||
|
||||
Win32 GUI code
|
||||
(c) Copyright 2003 - 2006 blip,
|
||||
funkyass,
|
||||
Matthew Kendora,
|
||||
Nach,
|
||||
nitsuja
|
||||
|
||||
Mac OS GUI code
|
||||
(c) Copyright 1998 - 2001 John Stiles
|
||||
(c) Copyright 2001 - 2007 zones
|
||||
|
||||
|
||||
Specific ports contains the works of other authors. See headers in
|
||||
individual files.
|
||||
|
||||
|
||||
Snes9x homepage: http://www.snes9x.com
|
||||
|
||||
Permission to use, copy, modify and/or distribute Snes9x in both binary
|
||||
and source form, for non-commercial purposes, is hereby granted without
|
||||
fee, providing that this license information and copyright notice appear
|
||||
with all copies and any derived work.
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
warranty. In no event shall the authors be held liable for any damages
|
||||
arising from the use of this software or it's derivatives.
|
||||
|
||||
Snes9x is freeware for PERSONAL USE only. Commercial users should
|
||||
seek permission of the copyright holders first. Commercial use includes,
|
||||
but is not limited to, charging money for Snes9x or software derived from
|
||||
Snes9x, including Snes9x or derivatives in commercial game bundles, and/or
|
||||
using Snes9x as a promotion for your commercial product.
|
||||
|
||||
The copyright holders request that bug fixes and improvements to the code
|
||||
should be forwarded to them so everyone can benefit from the modifications
|
||||
in future versions.
|
||||
|
||||
Super NES and Super Nintendo Entertainment System are trademarks of
|
||||
Nintendo Co., Limited and its subsidiary companies.
|
||||
**********************************************************************************/
|
||||
|
||||
|
||||
|
||||
|
||||
//#define MMX
|
||||
|
||||
#include "snes9x/snes9x.h"
|
||||
#include "snes9x/port.h"
|
||||
#include "snes9x/gfx.h"
|
||||
|
||||
#ifdef MMX
|
||||
EXTERN_C void _2xSaILine (uint8 *srcPtr, uint8 *deltaPtr, uint32 srcPitch, uint32 width,
|
||||
uint8 *dstPtr, uint32 dstPitch);
|
||||
EXTERN_C void _2xSaISuperEagleLine (uint8 *srcPtr, uint8 *deltaPtr, uint32 srcPitch, uint32 width,
|
||||
uint8 *dstPtr, uint32 dstPitch);
|
||||
EXTERN_C int Init_2xSaIMMX (uint32 BitFormat);
|
||||
#endif
|
||||
|
||||
bool mmx_cpu = false;
|
||||
|
||||
static uint32 colorMask = 0xF7DEF7DE;
|
||||
static uint32 lowPixelMask = 0x08210821;
|
||||
static uint32 qcolorMask = 0xE79CE79C;
|
||||
static uint32 qlowpixelMask = 0x18631863;
|
||||
|
||||
|
||||
int Init_2xSaI(uint32 BitFormat)
|
||||
{
|
||||
if (BitFormat == 565)
|
||||
{
|
||||
colorMask = 0xF7DEF7DE;
|
||||
lowPixelMask = 0x08210821;
|
||||
qcolorMask = 0xE79CE79C;
|
||||
qlowpixelMask = 0x18631863;
|
||||
}
|
||||
else
|
||||
if (BitFormat == 555)
|
||||
{
|
||||
colorMask = 0x7BDE7BDE;
|
||||
lowPixelMask = 0x04210421;
|
||||
qcolorMask = 0x739C739C;
|
||||
qlowpixelMask = 0x0C630C63;
|
||||
}
|
||||
else
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
#ifdef MMX
|
||||
Init_2xSaIMMX(BitFormat);
|
||||
#endif
|
||||
return 1;
|
||||
}
|
||||
|
||||
STATIC inline int GetResult1(uint32 A, uint32 B, uint32 C, uint32 D, uint32 E)
|
||||
{
|
||||
int x = 0;
|
||||
int y = 0;
|
||||
int r = 0;
|
||||
if (A == C) x+=1; else if (B == C) y+=1;
|
||||
if (A == D) x+=1; else if (B == D) y+=1;
|
||||
if (x <= 1) r+=1;
|
||||
if (y <= 1) r-=1;
|
||||
return r;
|
||||
}
|
||||
|
||||
STATIC inline int GetResult2(uint32 A, uint32 B, uint32 C, uint32 D, uint32 E)
|
||||
{
|
||||
int x = 0;
|
||||
int y = 0;
|
||||
int r = 0;
|
||||
if (A == C) x+=1; else if (B == C) y+=1;
|
||||
if (A == D) x+=1; else if (B == D) y+=1;
|
||||
if (x <= 1) r-=1;
|
||||
if (y <= 1) r+=1;
|
||||
return r;
|
||||
}
|
||||
|
||||
|
||||
STATIC inline int GetResult(uint32 A, uint32 B, uint32 C, uint32 D)
|
||||
{
|
||||
int x = 0;
|
||||
int y = 0;
|
||||
int r = 0;
|
||||
if (A == C) x+=1; else if (B == C) y+=1;
|
||||
if (A == D) x+=1; else if (B == D) y+=1;
|
||||
if (x <= 1) r+=1;
|
||||
if (y <= 1) r-=1;
|
||||
return r;
|
||||
}
|
||||
|
||||
|
||||
STATIC inline uint32 INTERPOLATE(uint32 A, uint32 B)
|
||||
{
|
||||
if (A !=B)
|
||||
{
|
||||
return ( ((A & colorMask) >> 1) + ((B & colorMask) >> 1) + (A & B & lowPixelMask) );
|
||||
}
|
||||
else return A;
|
||||
}
|
||||
|
||||
|
||||
STATIC inline uint32 Q_INTERPOLATE(uint32 A, uint32 B, uint32 C, uint32 D)
|
||||
{
|
||||
register uint32 x = ((A & qcolorMask) >> 2) +
|
||||
((B & qcolorMask) >> 2) +
|
||||
((C & qcolorMask) >> 2) +
|
||||
((D & qcolorMask) >> 2);
|
||||
register uint32 y = (A & qlowpixelMask) +
|
||||
(B & qlowpixelMask) +
|
||||
(C & qlowpixelMask) +
|
||||
(D & qlowpixelMask);
|
||||
y = (y>>2) & qlowpixelMask;
|
||||
return x+y;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
#define HOR
|
||||
#define VER
|
||||
void Super2xSaI(uint8 *srcPtr, uint32 srcPitch,
|
||||
uint8 *deltaPtr,
|
||||
uint8 *dstPtr, uint32 dstPitch, int width, int height)
|
||||
{
|
||||
uint32 *dP;
|
||||
uint16 *bP;
|
||||
|
||||
#ifdef MMX_BLA //no MMX version yet
|
||||
if (cpu_mmx && width != 512)
|
||||
{
|
||||
for (height; height; height-=1)
|
||||
{
|
||||
bP = (uint16 *) srcPtr;
|
||||
xP = (uint16 *) deltaPtr;
|
||||
dP = (uint32 *) dstPtr;
|
||||
_2xSaISuperEagleLine ((uint8 *) bP, (uint8 *) xP, srcPitch, width, (uint8 *) dP, dstPitch);
|
||||
dstPtr += dstPitch << 1;
|
||||
srcPtr += srcPitch;
|
||||
deltaPtr += srcPitch;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
#endif
|
||||
uint32 Nextline = srcPitch >> 1;
|
||||
|
||||
for (height; height; height-=1)
|
||||
{
|
||||
bP = (uint16 *) srcPtr;
|
||||
dP = (uint32 *) dstPtr;
|
||||
for (uint32 finish = width; finish; finish -= 1 )
|
||||
{
|
||||
uint32 color4, color5, color6;
|
||||
uint32 color1, color2, color3;
|
||||
uint32 colorA0, colorA1, colorA2, colorA3,
|
||||
colorB0, colorB1, colorB2, colorB3,
|
||||
colorS1, colorS2;
|
||||
uint32 product1a, product1b,
|
||||
product2a, product2b;
|
||||
|
||||
//--------------------------------------- B1 B2
|
||||
// 4 5 6 S2
|
||||
// 1 2 3 S1
|
||||
// A1 A2
|
||||
|
||||
colorB0 = *(bP- Nextline - 1);
|
||||
colorB1 = *(bP- Nextline);
|
||||
colorB2 = *(bP- Nextline + 1);
|
||||
colorB3 = *(bP- Nextline + 2);
|
||||
|
||||
color4 = *(bP - 1);
|
||||
color5 = *(bP);
|
||||
color6 = *(bP + 1);
|
||||
colorS2 = *(bP + 2);
|
||||
|
||||
color1 = *(bP + Nextline - 1);
|
||||
color2 = *(bP + Nextline);
|
||||
color3 = *(bP + Nextline + 1);
|
||||
colorS1 = *(bP + Nextline + 2);
|
||||
|
||||
colorA0 = *(bP + Nextline + Nextline - 1);
|
||||
colorA1 = *(bP + Nextline + Nextline);
|
||||
colorA2 = *(bP + Nextline + Nextline + 1);
|
||||
colorA3 = *(bP + Nextline + Nextline + 2);
|
||||
|
||||
|
||||
//--------------------------------------
|
||||
if (color2 == color6 && color5 != color3)
|
||||
{
|
||||
product2b = product1b = color2;
|
||||
}
|
||||
else
|
||||
if (color5 == color3 && color2 != color6)
|
||||
{
|
||||
product2b = product1b = color5;
|
||||
}
|
||||
else
|
||||
if (color5 == color3 && color2 == color6 && color5 != color6)
|
||||
{
|
||||
register int r = 0;
|
||||
|
||||
r += GetResult (color6, color5, color1, colorA1);
|
||||
r += GetResult (color6, color5, color4, colorB1);
|
||||
r += GetResult (color6, color5, colorA2, colorS1);
|
||||
r += GetResult (color6, color5, colorB2, colorS2);
|
||||
|
||||
if (r > 0)
|
||||
product2b = product1b = color6;
|
||||
else
|
||||
if (r < 0)
|
||||
product2b = product1b = color5;
|
||||
else
|
||||
{
|
||||
product2b = product1b = INTERPOLATE (color5, color6);
|
||||
}
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
#ifdef VER
|
||||
if (color6 == color3 && color3 == colorA1 && color2 != colorA2 && color3 != colorA0)
|
||||
product2b = Q_INTERPOLATE (color3, color3, color3, color2);
|
||||
else
|
||||
if (color5 == color2 && color2 == colorA2 && colorA1 != color3 && color2 != colorA3)
|
||||
product2b = Q_INTERPOLATE (color2, color2, color2, color3);
|
||||
else
|
||||
#endif
|
||||
product2b = INTERPOLATE (color2, color3);
|
||||
|
||||
#ifdef VER
|
||||
if (color6 == color3 && color6 == colorB1 && color5 != colorB2 && color6 != colorB0)
|
||||
product1b = Q_INTERPOLATE (color6, color6, color6, color5);
|
||||
else
|
||||
if (color5 == color2 && color5 == colorB2 && colorB1 != color6 && color5 != colorB3)
|
||||
product1b = Q_INTERPOLATE (color6, color5, color5, color5);
|
||||
else
|
||||
#endif
|
||||
product1b = INTERPOLATE (color5, color6);
|
||||
}
|
||||
|
||||
#ifdef HOR
|
||||
if (color5 == color3 && color2 != color6 && color4 == color5 && color5 != colorA2)
|
||||
product2a = INTERPOLATE (color2, color5);
|
||||
else
|
||||
if (color5 == color1 && color6 == color5 && color4 != color2 && color5 != colorA0)
|
||||
product2a = INTERPOLATE(color2, color5);
|
||||
else
|
||||
#endif
|
||||
product2a = color2;
|
||||
|
||||
#ifdef HOR
|
||||
if (color2 == color6 && color5 != color3 && color1 == color2 && color2 != colorB2)
|
||||
product1a = INTERPOLATE (color2, color5);
|
||||
else
|
||||
if (color4 == color2 && color3 == color2 && color1 != color5 && color2 != colorB0)
|
||||
product1a = INTERPOLATE(color2, color5);
|
||||
else
|
||||
#endif
|
||||
product1a = color5;
|
||||
|
||||
|
||||
product1a = product1a | (product1b << 16);
|
||||
product2a = product2a | (product2b << 16);
|
||||
|
||||
*(dP) = product1a;
|
||||
*(dP+(dstPitch>>2)) = product2a;
|
||||
|
||||
bP += 1;
|
||||
dP += 1;
|
||||
}//end of for ( finish= width etc..)
|
||||
|
||||
dstPtr += dstPitch << 1;
|
||||
srcPtr += srcPitch;
|
||||
deltaPtr += srcPitch;
|
||||
}; //endof: for (height; height; height--)
|
||||
#ifdef MMX_BLA
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/*ONLY use with 640x480x16 or higher resolutions*/
|
||||
/*Only use this if 2*width * 2*height fits on the current screen*/
|
||||
void SuperEagle(uint8 *srcPtr, uint32 srcPitch,
|
||||
uint8 *deltaPtr,
|
||||
uint8 *dstPtr, uint32 dstPitch, int width, int height)
|
||||
{
|
||||
uint32 *dP;
|
||||
uint16 *bP;
|
||||
uint16 *xP;
|
||||
|
||||
#ifdef MMX
|
||||
if (mmx_cpu && width != 512)
|
||||
{
|
||||
for (height; height; height-=1)
|
||||
{
|
||||
bP = (uint16 *) srcPtr;
|
||||
xP = (uint16 *) deltaPtr;
|
||||
dP = (uint32 *) dstPtr;
|
||||
_2xSaISuperEagleLine ((uint8 *) bP, (uint8 *) xP, srcPitch, width, (uint8 *)dP, dstPitch);
|
||||
dstPtr += dstPitch << 1;
|
||||
srcPtr += srcPitch;
|
||||
deltaPtr += srcPitch;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
#endif
|
||||
uint32 Nextline = srcPitch >> 1;
|
||||
|
||||
for (height; height; height-=1)
|
||||
{
|
||||
bP = (uint16 *) srcPtr;
|
||||
dP = (uint32 *) dstPtr;
|
||||
for (uint32 finish = width; finish; finish -= 1 )
|
||||
{
|
||||
|
||||
uint32 color4, color5, color6;
|
||||
uint32 color1, color2, color3;
|
||||
uint32 colorA0, colorA1, colorA2, colorA3,
|
||||
colorB0, colorB1, colorB2, colorB3,
|
||||
colorS1, colorS2;
|
||||
uint32 product1a, product1b,
|
||||
product2a, product2b;
|
||||
|
||||
colorB0 = *(bP- Nextline - 1);
|
||||
colorB1 = *(bP- Nextline);
|
||||
colorB2 = *(bP- Nextline + 1);
|
||||
colorB3 = *(bP- Nextline + 2);
|
||||
|
||||
color4 = *(bP - 1);
|
||||
color5 = *(bP);
|
||||
color6 = *(bP + 1);
|
||||
colorS2 = *(bP + 2);
|
||||
|
||||
color1 = *(bP + Nextline - 1);
|
||||
color2 = *(bP + Nextline);
|
||||
color3 = *(bP + Nextline + 1);
|
||||
colorS1 = *(bP + Nextline + 2);
|
||||
|
||||
colorA0 = *(bP + Nextline + Nextline - 1);
|
||||
colorA1 = *(bP + Nextline + Nextline);
|
||||
colorA2 = *(bP + Nextline + Nextline + 1);
|
||||
colorA3 = *(bP + Nextline + Nextline + 2);
|
||||
|
||||
|
||||
//--------------------------------------
|
||||
if (color2 == color6 && color5 != color3)
|
||||
{
|
||||
product1b = product2a = color2;
|
||||
if ((color1 == color2 && color6 == colorS2) ||
|
||||
(color2 == colorA1 && color6 == colorB2))
|
||||
{
|
||||
product1a = INTERPOLATE (color2, color5);
|
||||
product1a = INTERPOLATE (color2, product1a);
|
||||
product2b = INTERPOLATE (color2, color3);
|
||||
product2b = INTERPOLATE (color2, product2b);
|
||||
// product1a = color2;
|
||||
// product2b = color2;
|
||||
}
|
||||
else
|
||||
{
|
||||
product1a = INTERPOLATE (color5, color6);
|
||||
product2b = INTERPOLATE (color2, color3);
|
||||
}
|
||||
}
|
||||
else
|
||||
if (color5 == color3 && color2 != color6)
|
||||
{
|
||||
product2b = product1a = color5;
|
||||
if ((colorB1 == color5 && color3 == colorA2) ||
|
||||
(color4 == color5 && color3 == colorS1))
|
||||
{
|
||||
product1b = INTERPOLATE (color5, color6);
|
||||
product1b = INTERPOLATE (color5, product1b);
|
||||
product2a = INTERPOLATE (color5, color2);
|
||||
product2a = INTERPOLATE (color5, product2a);
|
||||
// product1b = color5;
|
||||
// product2a = color5;
|
||||
}
|
||||
else
|
||||
{
|
||||
product1b = INTERPOLATE (color5, color6);
|
||||
product2a = INTERPOLATE (color2, color3);
|
||||
}
|
||||
}
|
||||
else
|
||||
if (color5 == color3 && color2 == color6 && color5 != color6)
|
||||
{
|
||||
register int r = 0;
|
||||
|
||||
r += GetResult (color6, color5, color1, colorA1);
|
||||
r += GetResult (color6, color5, color4, colorB1);
|
||||
r += GetResult (color6, color5, colorA2, colorS1);
|
||||
r += GetResult (color6, color5, colorB2, colorS2);
|
||||
|
||||
if (r > 0)
|
||||
{
|
||||
product1b = product2a = color2;
|
||||
product1a = product2b = INTERPOLATE (color5, color6);
|
||||
}
|
||||
else
|
||||
if (r < 0)
|
||||
{
|
||||
product2b = product1a = color5;
|
||||
product1b = product2a = INTERPOLATE (color5, color6);
|
||||
}
|
||||
else
|
||||
{
|
||||
product2b = product1a = color5;
|
||||
product1b = product2a = color2;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
if ((color2 == color5) || (color3 == color6))
|
||||
{
|
||||
product1a = color5;
|
||||
product2a = color2;
|
||||
product1b = color6;
|
||||
product2b = color3;
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
product1b = product1a = INTERPOLATE (color5, color6);
|
||||
product1a = INTERPOLATE (color5, product1a);
|
||||
product1b = INTERPOLATE (color6, product1b);
|
||||
|
||||
product2a = product2b = INTERPOLATE (color2, color3);
|
||||
product2a = INTERPOLATE (color2, product2a);
|
||||
product2b = INTERPOLATE (color3, product2b);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
product1a = product1a | (product1b << 16);
|
||||
product2a = product2a | (product2b << 16);
|
||||
|
||||
*(dP) = product1a;
|
||||
*(dP+(dstPitch>>2)) = product2a;
|
||||
|
||||
bP += 1;
|
||||
dP += 1;
|
||||
}//end of for ( finish= width etc..)
|
||||
|
||||
dstPtr += dstPitch << 1;
|
||||
srcPtr += srcPitch;
|
||||
deltaPtr += srcPitch;
|
||||
}; //endof: for (height; height; height--)
|
||||
#ifdef MMX
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*ONLY use with 640x480x16 or higher resolutions*/
|
||||
/*Only use this if 2*width * 2*height fits on the current screen*/
|
||||
void _2xSaI(uint8 *srcPtr, uint32 srcPitch,
|
||||
uint8 *deltaPtr,
|
||||
uint8 *dstPtr, uint32 dstPitch, int width, int height)
|
||||
{
|
||||
uint32 *dP;
|
||||
uint16 *bP;
|
||||
uint16 *xP;
|
||||
|
||||
#ifdef MMX
|
||||
if (mmx_cpu && width != 512)
|
||||
{
|
||||
for (height; height; height-=1)
|
||||
{
|
||||
|
||||
bP = (uint16 *) srcPtr;
|
||||
xP = (uint16 *) deltaPtr;
|
||||
dP = (uint32 *) dstPtr;
|
||||
_2xSaILine ((uint8 *) bP, (uint8 *) xP, srcPitch, width, (uint8 *)dP, dstPitch);
|
||||
dstPtr += dstPitch << 1;
|
||||
srcPtr += srcPitch;
|
||||
deltaPtr += srcPitch;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
#endif
|
||||
uint32 Nextline = srcPitch >> 1;
|
||||
|
||||
for (height; height; height-=1)
|
||||
{
|
||||
bP = (uint16 *) srcPtr;
|
||||
dP = (uint32 *) dstPtr;
|
||||
for (uint32 finish = width; finish; finish -= 1 )
|
||||
{
|
||||
|
||||
|
||||
register uint32 colorA, colorB;
|
||||
uint32 colorC, colorD,
|
||||
colorE, colorF, colorG, colorH,
|
||||
colorI, colorJ, colorK, colorL,
|
||||
colorM, colorN, colorO, colorP;
|
||||
uint32 product, product1, product2;
|
||||
|
||||
|
||||
//---------------------------------------
|
||||
// Map of the pixels: I|E F|J
|
||||
// G|A B|K
|
||||
// H|C D|L
|
||||
// M|N O|P
|
||||
colorI = *(bP- Nextline - 1);
|
||||
colorE = *(bP- Nextline);
|
||||
colorF = *(bP- Nextline + 1);
|
||||
colorJ = *(bP- Nextline + 2);
|
||||
|
||||
colorG = *(bP - 1);
|
||||
colorA = *(bP);
|
||||
colorB = *(bP + 1);
|
||||
colorK = *(bP + 2);
|
||||
|
||||
colorH = *(bP + Nextline - 1);
|
||||
colorC = *(bP + Nextline);
|
||||
colorD = *(bP + Nextline + 1);
|
||||
colorL = *(bP + Nextline + 2);
|
||||
|
||||
colorM = *(bP + Nextline + Nextline - 1);
|
||||
colorN = *(bP + Nextline + Nextline);
|
||||
colorO = *(bP + Nextline + Nextline + 1);
|
||||
colorP = *(bP + Nextline + Nextline + 2);
|
||||
|
||||
if ((colorA == colorD) && (colorB != colorC))
|
||||
{
|
||||
if ( ((colorA == colorE) && (colorB == colorL)) ||
|
||||
((colorA == colorC) && (colorA == colorF) && (colorB != colorE) && (colorB == colorJ)) )
|
||||
{
|
||||
product = colorA;
|
||||
}
|
||||
else
|
||||
{
|
||||
product = INTERPOLATE(colorA, colorB);
|
||||
}
|
||||
|
||||
if (((colorA == colorG) && (colorC == colorO)) ||
|
||||
((colorA == colorB) && (colorA == colorH) && (colorG != colorC) && (colorC == colorM)) )
|
||||
{
|
||||
product1 = colorA;
|
||||
}
|
||||
else
|
||||
{
|
||||
product1 = INTERPOLATE(colorA, colorC);
|
||||
}
|
||||
product2 = colorA;
|
||||
}
|
||||
else
|
||||
if ((colorB == colorC) && (colorA != colorD))
|
||||
{
|
||||
if (((colorB == colorF) && (colorA == colorH)) ||
|
||||
((colorB == colorE) && (colorB == colorD) && (colorA != colorF) && (colorA == colorI)) )
|
||||
{
|
||||
product = colorB;
|
||||
}
|
||||
else
|
||||
{
|
||||
product = INTERPOLATE(colorA, colorB);
|
||||
}
|
||||
|
||||
if (((colorC == colorH) && (colorA == colorF)) ||
|
||||
((colorC == colorG) && (colorC == colorD) && (colorA != colorH) && (colorA == colorI)) )
|
||||
{
|
||||
product1 = colorC;
|
||||
}
|
||||
else
|
||||
{
|
||||
product1 = INTERPOLATE(colorA, colorC);
|
||||
}
|
||||
product2 = colorB;
|
||||
}
|
||||
else
|
||||
if ((colorA == colorD) && (colorB == colorC))
|
||||
{
|
||||
if (colorA == colorB)
|
||||
{
|
||||
product = colorA;
|
||||
product1 = colorA;
|
||||
product2 = colorA;
|
||||
}
|
||||
else
|
||||
{
|
||||
register int r = 0;
|
||||
product1 = INTERPOLATE(colorA, colorC);
|
||||
product = INTERPOLATE(colorA, colorB);
|
||||
|
||||
r += GetResult1 (colorA, colorB, colorG, colorE, colorI);
|
||||
r += GetResult2 (colorB, colorA, colorK, colorF, colorJ);
|
||||
r += GetResult2 (colorB, colorA, colorH, colorN, colorM);
|
||||
r += GetResult1 (colorA, colorB, colorL, colorO, colorP);
|
||||
|
||||
if (r > 0)
|
||||
product2 = colorA;
|
||||
else
|
||||
if (r < 0)
|
||||
product2 = colorB;
|
||||
else
|
||||
{
|
||||
product2 = Q_INTERPOLATE(colorA, colorB, colorC, colorD);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
product2 = Q_INTERPOLATE(colorA, colorB, colorC, colorD);
|
||||
|
||||
if ((colorA == colorC) && (colorA == colorF) && (colorB != colorE) && (colorB == colorJ))
|
||||
{
|
||||
product = colorA;
|
||||
}
|
||||
else
|
||||
if ((colorB == colorE) && (colorB == colorD) && (colorA != colorF) && (colorA == colorI))
|
||||
{
|
||||
product = colorB;
|
||||
}
|
||||
else
|
||||
{
|
||||
product = INTERPOLATE(colorA, colorB);
|
||||
}
|
||||
|
||||
if ((colorA == colorB) && (colorA == colorH) && (colorG != colorC) && (colorC == colorM))
|
||||
{
|
||||
product1 = colorA;
|
||||
}
|
||||
else
|
||||
if ((colorC == colorG) && (colorC == colorD) && (colorA != colorH) && (colorA == colorI))
|
||||
{
|
||||
product1 = colorC;
|
||||
}
|
||||
else
|
||||
{
|
||||
product1 = INTERPOLATE(colorA, colorC);
|
||||
}
|
||||
}
|
||||
product = colorA | (product << 16);
|
||||
product1 = product1 | (product2 << 16);
|
||||
*(dP) = product;
|
||||
*(dP+(dstPitch>>2)) = product1;
|
||||
|
||||
bP += 1;
|
||||
dP += 1;
|
||||
}//end of for ( finish= width etc..)
|
||||
|
||||
dstPtr += dstPitch << 1;
|
||||
srcPtr += srcPitch;
|
||||
deltaPtr += srcPitch;
|
||||
}; //endof: for (height; height; height--)
|
||||
#ifdef MMX
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
403
source/snes9x/unused/Makefile.in
Normal file
403
source/snes9x/unused/Makefile.in
Normal file
@ -0,0 +1,403 @@
|
||||
@ZSNESFX@
|
||||
@ZSNESC4@
|
||||
@ASMCPU@
|
||||
@SPC700ASM@
|
||||
@NETPLAY@
|
||||
UNZIP=1
|
||||
@JMA@
|
||||
@GLIDE@
|
||||
@OPENGL@
|
||||
@AIDO@
|
||||
#GUI=0
|
||||
@THREAD_SOUND@
|
||||
@ASMKREED@
|
||||
@SDD1_DECOMP@
|
||||
@CORRECT_VRAM_READS@
|
||||
@DREAMCAST@
|
||||
CHEATS=1
|
||||
2XSAI=1
|
||||
|
||||
#Fairly good and special-char-safe descriptor of the os being built on.
|
||||
OS=`uname -s -r -m|sed \"s/ /-/g\"|tr \"[A-Z]\" \"[a-z]\"|tr \"/()\" \"___\"`
|
||||
BUILDDIR=.
|
||||
#BUILDDIR=build/$(OS)
|
||||
|
||||
ifdef DREAMCAST
|
||||
CPU=sh
|
||||
ASMCPU=1
|
||||
CHEATS=0
|
||||
2XSAI=0
|
||||
else
|
||||
CPU=i386
|
||||
endif
|
||||
|
||||
ifdef ZSNESFX
|
||||
FXOBJ=$(CPU)/fxemu2b.o $(CPU)/fxemu2.o $(CPU)/fxemu2c.o $(CPU)/fxtable.o $(CPU)/sfxproc.o $(CPU)/ZSNES.O
|
||||
FXDEFINES=-DZSNES_FX -DEXECUTE_SUPERFX_PER_LINE
|
||||
FXDEPENDS=zsnes_fx
|
||||
FXNO_DEPENDS=c_fx
|
||||
else
|
||||
FXOBJ=fxinst.o fxemu.o fxdbg.o
|
||||
FXDEFINES=
|
||||
FXDEPENDS=c_fx
|
||||
FXNO_DEPENDS=zsnes_fx
|
||||
endif
|
||||
|
||||
ifdef ZSNESC4
|
||||
C4OBJ=$(CPU)/C4.O $(CPU)/zsnesc4.o c4.o
|
||||
C4DEFINES=-DZSNES_C4
|
||||
C4DEPENDS=zsnes_c4
|
||||
C4NO_DEPENDS=c_c4
|
||||
else
|
||||
C4OBJ=c4.o c4emu.o
|
||||
C4DEFINES=
|
||||
C4DEPENDS=c_c4
|
||||
C4NO_DEPENDS=zsnes_c4
|
||||
endif
|
||||
|
||||
SOUNDOBJ=spc700.o soundux.o apu.o @I386SPC@
|
||||
SOUNDDEFINES=-DSPC700_C
|
||||
|
||||
ifdef ASMCPU
|
||||
CPUOBJ=$(CPU)/cpuops.o $(CPU)/cpuexec.o $(CPU)/sa1ops.o
|
||||
else
|
||||
CPUOBJ=cpuops.o cpuexec.o sa1cpu.o
|
||||
endif
|
||||
|
||||
ifdef DREAMCAST
|
||||
PLATFORMOBJ=dc/input.o dc/display.o dc/sound.o \
|
||||
dc/dc.o dc/menu.o dc/trace.o dc/lcd.o \
|
||||
dc/lain_blanker.o dc/td.o dc/md5.o
|
||||
else
|
||||
PLATFORMOBJ=unix/unix.o
|
||||
endif
|
||||
|
||||
ifdef CHEATS
|
||||
CHEATOBJ=cheats.o cheats2.o
|
||||
endif
|
||||
|
||||
ifndef DREAMCAST
|
||||
SNAPOBJ = snaporig.o snapshot.o
|
||||
SCREENSHOTOBJ = screenshot.o
|
||||
MOVIEOBJ = movie.o
|
||||
endif
|
||||
|
||||
ifdef 2XSAI
|
||||
ifdef ASMKREED
|
||||
KREEDOBJ=$(CPU)/2XSAIMMX.O $(CPU)/bilinear.o 2xsai.o
|
||||
KREEDDEFINES=-DMMX
|
||||
else
|
||||
KREEDOBJ=2xsai.o
|
||||
endif
|
||||
endif
|
||||
|
||||
ifdef SDD1_DECOMP
|
||||
SDD1OBJ=sdd1emu.o
|
||||
ifdef SDD1_VERIFY
|
||||
SDD1DEFINES=-DSDD1_DECOMP -DSDD1_VERIFY
|
||||
else
|
||||
SDD1DEFINES=-DSDD1_DECOMP
|
||||
endif
|
||||
endif
|
||||
|
||||
ifdef CORRECT_VRAM_READS
|
||||
CORRVRAMDEFINES=-DCORRECT_VRAM_READS
|
||||
endif
|
||||
|
||||
SPC7110OBJ=spc7110.o
|
||||
OBC1OBJ=obc1.o
|
||||
SETAOBJ=seta.o seta010.o seta011.o seta018.o
|
||||
|
||||
OBJECTS=$(CPUOBJ) $(SOUNDOBJ) apudebug.o $(FXOBJ) $(C4OBJ) \
|
||||
controls.o crosshairs.o cpu.o sa1.o debug.o sdd1.o tile.o srtc.o gfx.o \
|
||||
memmap.o clip.o dsp1.o ppu.o dma.o snes9x.o data.o globals.o reader.o \
|
||||
conffile.o bsx.o logger.o \
|
||||
$(SPC7110OBJ) $(OBC1OBJ) $(SETAOBJ) $(KREEDOBJ) $(SDD1OBJ) \
|
||||
$(CHEATOBJ) $(PLATFORMOBJ) $(SNAPOBJ) $(SCREENSHOTOBJ) $(MOVIEOBJ)
|
||||
|
||||
ifdef NETPLAY
|
||||
OBJECTS += netplay.o server.o
|
||||
NETPLAYDEFINES=-DNETPLAY_SUPPORT
|
||||
SERVER_OBJECTS=server.o unix/server_main.o globals.o netplay.o
|
||||
endif
|
||||
|
||||
ifdef UNZIP
|
||||
OBJECTS += loadzip.o unzip/unzip.o unzip/explode.o unzip/unreduce.o unzip/unshrink.o
|
||||
UNZIPDEFINES=-DUNZIP_SUPPORT
|
||||
endif
|
||||
|
||||
ifdef JMA
|
||||
OBJECTS += jma/s9x-jma.o jma/7zlzma.o jma/crc32.o jma/iiostrm.o jma/inbyte.o jma/jma.o jma/lzma.o jma/lzmadec.o jma/winout.o
|
||||
JMADEFINES = -DJMA_SUPPORT
|
||||
endif
|
||||
|
||||
ifdef THREAD_SOUND
|
||||
CPUDEFINES += -DUSE_THREADS
|
||||
EXTRALIBS += -lpthread
|
||||
endif
|
||||
|
||||
ifdef GLIDE
|
||||
GLIDEOBJS = unix/glide.o
|
||||
GLIDEDEFINES = -DUSE_GLIDE -I/usr/include/glide
|
||||
GLIDELIBS = -lglide2x
|
||||
endif
|
||||
|
||||
ifdef OPENGL
|
||||
OPENGLOBJS = unix/opengl.o
|
||||
OPENGLDEFINES = -DUSE_OPENGL
|
||||
OPENGLLIBS = -lGL -lGLU -ldl
|
||||
endif
|
||||
|
||||
ifdef AIDO
|
||||
AIDOOBJS = unix/aido.o
|
||||
AIDODEFINES = -DUSE_AIDO
|
||||
endif
|
||||
|
||||
JOYDEFINES = @JOYDEFINES@
|
||||
|
||||
ifdef DREAMCAST
|
||||
CCC = sh-elf-c++ -fno-rtti
|
||||
CC = sh-elf-gcc
|
||||
NASM = fail
|
||||
GASM = fail
|
||||
else
|
||||
CCC = @CXX@ @RTTIFLAG@
|
||||
CC = @CC@
|
||||
NASM = @NASM@
|
||||
GASM = @CXX@
|
||||
endif
|
||||
|
||||
#INCLUDES = -I../zlib @X_INCLUDES@
|
||||
ifdef DREAMCAST
|
||||
INCLUDES = -Idc
|
||||
DEFS = -DDC
|
||||
else
|
||||
INCLUDES = @X_INCLUDES@
|
||||
DEFS = -DMITSHM
|
||||
endif
|
||||
|
||||
INCLUDES += -I. -Iunzip @CPUINC@
|
||||
|
||||
ifdef DREAMCAST
|
||||
OPTIMISE=-O4 -ffreestanding -ffast-math -fschedule-insns2 -fomit-frame-pointer -fno-inline-functions -fno-defer-pop -fforce-addr -fstrict-aliasing -funroll-loops -fdelete-null-pointer-checks -fno-exceptions
|
||||
CPUFLAGS=-ml -m4-single-only
|
||||
else
|
||||
OPTIMISE = @OPTIMIZE@
|
||||
endif
|
||||
|
||||
DEFS += \
|
||||
-DCPU_SHUTDOWN \
|
||||
-DSPC700_SHUTDOWN \
|
||||
$(FXDEFINES) \
|
||||
$(C4DEFINES) \
|
||||
$(CPUDEFINES) \
|
||||
$(SOUNDDEFINES) \
|
||||
$(NETPLAYDEFINES) \
|
||||
$(UNZIPDEFINES) \
|
||||
$(JMADEFINES) \
|
||||
$(GLIDEDEFINES) \
|
||||
$(OPENGLDEFINES) \
|
||||
$(AIDODEFINES) \
|
||||
$(KREEDDEFINES) \
|
||||
$(SDD1DEFINES) \
|
||||
$(CORRVRAMDEFINES) \
|
||||
$(JOYDEFINES) \
|
||||
-DNO_INLINE_SET_GET @SYSDEFINES@
|
||||
|
||||
CCFLAGS = $(OPTIMISE) $(CPUFLAGS) $(INCLUDES) $(DEFS)
|
||||
|
||||
CFLAGS=$(CCFLAGS)
|
||||
|
||||
.SUFFIXES: .o .cpp .c .cc .h .m .i .S .asm .obj .O .CPP .C .ASM
|
||||
#FIXME: Why is this set statically?
|
||||
#LDLIBS = -L/usr/X11R6/lib
|
||||
# -L../zlib
|
||||
|
||||
ifdef GLIDE
|
||||
all: Makefile configure gsnes9x
|
||||
else
|
||||
ifdef OPENGL
|
||||
all: Makefile configure osnes9x
|
||||
else
|
||||
all: Makefile configure snes9x
|
||||
endif
|
||||
endif
|
||||
|
||||
Makefile: configure Makefile.in
|
||||
@echo "Makefile is older than configure or in-file. Run configure or touch Makefile."
|
||||
exit 1
|
||||
|
||||
configure: configure.in
|
||||
@echo "configure is older than in-file. Run autoconf or touch configure."
|
||||
exit 1
|
||||
|
||||
#ggisnes9x
|
||||
#xf86snes9x
|
||||
|
||||
ifdef ASMCPU
|
||||
OFFSET=offsets
|
||||
else
|
||||
OFFSET=
|
||||
endif
|
||||
|
||||
offsets: offsets.o
|
||||
$(CCC) $(INCLUDES) -o $@ offsets.o
|
||||
./offsets >$(CPU)/offsets.h
|
||||
|
||||
#../zlib/libz.a:
|
||||
# cd ../zlib && sh ./configure && make
|
||||
|
||||
snes9x: $(OBJECTS) unix/x11.o $(AIDOOBJS) $(OFFSET)
|
||||
$(CCC) $(INCLUDES) -o $@ $(OBJECTS) $(AIDOOBJS) $(GLIDEOBJS) $(OPENGLOBJS) unix/x11.o $(LDLIBS) $(GLIDELIBS) $(OPENGLLIBS) @SYSLIBS@ -lXext -lX11 $(EXTRALIBS) -lm
|
||||
|
||||
unix/svga_keynames.h: unix/svga_get_keynames.pl
|
||||
unix/svga_get_keynames.pl /usr/include/vgakeyboard.h > unix/svga_keynames.h
|
||||
|
||||
unix/svga.o: unix/svga_keynames.h
|
||||
|
||||
ssnes9x: $(OBJECTS) unix/svga.o
|
||||
$(CCC) $(INCLUDES) -o $@ $(OBJECTS) $(GLIDEOBJS) unix/svga.o $(LDLIBS) $(GLIDELIBS) @SYSLIBS@ -lvga -lvgagl $(EXTRALIBS) -lm
|
||||
|
||||
gsnes9x: $(OBJECTS) $(GLIDEOBJS)
|
||||
$(CCC) $(INCLUDES) -o $@ $(OBJECTS) $(GLIDEOBJS) $(LDLIBS) @SYSLIBS@ -lglide $(EXTRALIBS) -lm
|
||||
|
||||
ggisnes9x: $(OBJECTS) unix/ggi.o
|
||||
$(CCC) $(INCLUDES) -o $@ $(OBJECTS) unix/ggi.o $(LDLIBS) @SYSLIBS@ -lggi $(EXTRALIBS) -lm
|
||||
|
||||
osnes9x: $(OBJECTS) unix/x11.o $(OPENGLOBJS)
|
||||
$(CCC) $(INCLUDES) -o $@ $(OBJECTS) unix/x11.o $(OPENGLOBJS) $(LDLIBS) $(OPENGLLIBS) @SYSLIBS@ -lXext -lX11 $(EXTRALIBS) -lm
|
||||
|
||||
s9xserver: $(SERVER_OBJECTS)
|
||||
$(CCC) $(INCLUDES) -o $@ $(SERVER_OBJECTS)
|
||||
|
||||
jma/s9x-jma.o: jma/s9x-jma.cpp
|
||||
$(CCC) $(INCLUDES) -c $(CCFLAGS) -fexceptions $*.cpp -o $@
|
||||
jma/7zlzma.o: jma/7zlzma.cpp
|
||||
$(CCC) $(INCLUDES) -c $(CCFLAGS) -fexceptions $*.cpp -o $@
|
||||
jma/crc32.o: jma/crc32.cpp
|
||||
$(CCC) $(INCLUDES) -c $(CCFLAGS) -fexceptions $*.cpp -o $@
|
||||
jma/iiostrm.o: jma/iiostrm.cpp
|
||||
$(CCC) $(INCLUDES) -c $(CCFLAGS) -fexceptions $*.cpp -o $@
|
||||
jma/inbyte.o: jma/inbyte.cpp
|
||||
$(CCC) $(INCLUDES) -c $(CCFLAGS) -fexceptions $*.cpp -o $@
|
||||
jma/jma.o: jma/jma.cpp
|
||||
$(CCC) $(INCLUDES) -c $(CCFLAGS) -fexceptions $*.cpp -o $@
|
||||
jma/lzma.o: jma/lzma.cpp
|
||||
$(CCC) $(INCLUDES) -c $(CCFLAGS) -fexceptions $*.cpp -o $@
|
||||
jma/lzmadec.o: jma/lzmadec.cpp
|
||||
$(CCC) $(INCLUDES) -c $(CCFLAGS) -fexceptions $*.cpp -o $@
|
||||
jma/winout.o: jma/winout.cpp
|
||||
$(CCC) $(INCLUDES) -c $(CCFLAGS) -fexceptions $*.cpp -o $@
|
||||
|
||||
.cpp.o:
|
||||
$(CCC) $(INCLUDES) -c $(CCFLAGS) $*.cpp -o $@
|
||||
|
||||
.c.o:
|
||||
$(CC) $(INCLUDES) -c $(CCFLAGS) $*.c -o $@
|
||||
|
||||
.cpp.S:
|
||||
$(GASM) $(INCLUDES) -S $(CCFLAGS) $*.cpp -o $@
|
||||
|
||||
.cpp.i:
|
||||
$(GASM) $(INCLUDES) -E $(CCFLAGS) $*.cpp -o $@
|
||||
|
||||
.S.o:
|
||||
$(GASM) $(INCLUDES) -c $(CCFLAGS) $*.S -o $@
|
||||
|
||||
.S.i:
|
||||
$(GASM) $(INCLUDES) -c -E $(CCFLAGS) $*.S -o $@
|
||||
|
||||
.s.o:
|
||||
@echo Compiling $*.s
|
||||
sh-elf-as -little $*.s -o $@
|
||||
|
||||
.asm.o:
|
||||
$(NASM) -f elf -DELF $(FXDEFINES) -i. -ii386 -o $@ $*.asm
|
||||
|
||||
.obj.o:
|
||||
cp $*.obj $*.o
|
||||
|
||||
.CPP.O:
|
||||
$(CCC) $(INCLUDES) -c $(CCFLAGS) -x c++ $*.CPP -o $@
|
||||
|
||||
.C.O:
|
||||
$(CC) $(INCLUDES) -c $(CCFLAGS) $*.C -o $@
|
||||
|
||||
.ASM.O:
|
||||
$(NASM) -f elf -DELF $(FXDEFINES) -i . -i i386 $*.ASM -o $@
|
||||
|
||||
unix/moc_snes9x_gui.cpp: unix/snes9x_gui.h
|
||||
$(MOC) unix/snes9x_gui.h -o $@
|
||||
|
||||
clean:
|
||||
rm -f $(OBJECTS) offsets.o unix/svga.o unix/aido.o unix/x11.o unix/ggi.o unix/xf86.o unix/glide.o
|
||||
|
||||
#release: CCFLAGS += -DNO_DEBUGGER
|
||||
|
||||
_bin-package:
|
||||
RELNR=`grep "#define VERSION" snes9x.h | sed -e 's/"//g' | awk '{ print $$3 }'` && \
|
||||
echo $$RELNR && \
|
||||
RELNAME=snes9x-$${RELNR} && export RELNAME && \
|
||||
test \! -f $${RELNAME}.tar.gz && \
|
||||
DISTDIR=disttmp/$${RELNAME}/ && \
|
||||
rm -rf disttmp && \
|
||||
mkdir disttmp && \
|
||||
mkdir $${DISTDIR} && \
|
||||
cp snes9x $${DISTDIR} && \
|
||||
cp config.info hardware.txt problems.txt changes.txt ../faqs.txt ../readme.txt ../readme.unix $${DISTDIR} && \
|
||||
(cd disttmp && tar cvf - $${RELNAME}) | gzip -c > $${RELNAME}.tar.gz &&\
|
||||
rm -rf disttmp
|
||||
|
||||
#FIXME: Should possibly have clean, but not in xenofarm build
|
||||
bin-release: snes9x _bin-package
|
||||
|
||||
#FIXME: Intelligent messages when bailing out.
|
||||
#FIXME: See those ls:s? Don't look to closely at the statements...
|
||||
_src-package:
|
||||
RELNR=`grep "#define VERSION" snes9x.h | sed -e 's/"//g' | awk '{ print $$3 }'` && \
|
||||
echo $$RELNR && \
|
||||
RELNAME=snes9x-$${RELNR}-src && \
|
||||
test \! -f $${RELNAME}.tar.gz && \
|
||||
test \! `ls *~` && \
|
||||
test \! `ls *.o` && \
|
||||
test \! -f snes9x && \
|
||||
export RELNR && export RELNAME && \
|
||||
(cd .. && PWD=`pwd` && SNESDIR=`basename $$PWD` && cd .. && \
|
||||
DISTDIR=disttmp/$${RELNAME} && \
|
||||
rm -rf disttmp && \
|
||||
mkdir disttmp && \
|
||||
cp -r $${SNESDIR} $${DISTDIR} && \
|
||||
rm -f $${DISTDIR}/snes9x/config.* 2>/dev/null && \
|
||||
rm -f $${DISTDIR}/snes9x/conftezt.out.* 2>/dev/null && \
|
||||
rm -rf $${DISTDIR}/snes9x/autom4te.cache 2>/dev/null && \
|
||||
rm $${DISTDIR}/snes9x/Makefile && \
|
||||
find disttmp -name CVS -type f -exec rm "{}" \; && \
|
||||
find disttmp -name CVS -type d -exec rm "{}" \; && \
|
||||
(cd disttmp && tar cvf - $${RELNAME}) | gzip -c > $${RELNAME}.tar.gz && \
|
||||
mv $${RELNAME}.tar.gz $${SNESDIR}/snes9x/ ) && \
|
||||
rm -rf disttmp
|
||||
|
||||
#Requires:
|
||||
# 1. Prestine checkout
|
||||
# 2. `autoconf`
|
||||
# 3. `./configure`
|
||||
src-release: depend _src-package
|
||||
|
||||
xenofarm:
|
||||
./xenofarm.sh
|
||||
cd build/xenofarm && tar cf - . > ../../../xenofarm_result.tar
|
||||
gzip -f9 ../xenofarm_result.tar
|
||||
|
||||
# And now for the impressive testsuite:
|
||||
verify: snes9x
|
||||
./snes9x --selftest
|
||||
|
||||
#FIXME: Make a auto-self-reference.
|
||||
depend:
|
||||
$(CC) $(CFLAGS) -MM -MG \
|
||||
`find . '(' -name '*.c' -o -name '*.cpp' -o -name '*.S' ')' -print -o -name msdos -prune` \
|
||||
| sed -e 's@^[^ :]*: *\([^ ]*/\)[^ /]*@\1&@' \
|
||||
>dependencies
|
||||
|
||||
include dependencies
|
||||
|
193
source/snes9x/unused/Makefile.mingw
Normal file
193
source/snes9x/unused/Makefile.mingw
Normal file
@ -0,0 +1,193 @@
|
||||
ASM=nasm
|
||||
OBJFIX=win32/objfix.exe
|
||||
|
||||
CFLAGSORIG=-Wall -I../zlib -I -I../FMOD/api/inc -DSPC700_SHUTDOWN -DNETPLAY_SUPPORT \
|
||||
-DCPU_SHUTDOWN -DZLIB -DVAR_CYCLES -DEXECUTE_SUPERFX_PER_LINE -D__WIN32__ -DUSE_OPENGL \
|
||||
-DUNZIP_SUPPORT -DHAVE_LIBPNG -DSDD1_DECOMP -DCORRECT_VRAM_READS -DNEW_COLOUR_BLENDING \
|
||||
-DWIN32 -D_WINDOWS -DSPC700_C -DJMA_SUPPORT -DZSNES_FX -DZSNES_C4 -DHAVE_STDINT_H -D_WIN32_IE=0x0501
|
||||
#-DFMOD_SUPPORT -DUSE_GLIDE
|
||||
|
||||
|
||||
ifeq (${DEBUG},yes)
|
||||
CFLAGS= ${CFLAGSORIG} -ggdb3
|
||||
else
|
||||
CFLAGS= ${CFLAGSORIG} -O3 -DNDEBUG
|
||||
endif
|
||||
|
||||
|
||||
ifeq (${CROSS},yes)
|
||||
CC=i586-mingw32-gcc
|
||||
CPPC=i586-mingw32-g++
|
||||
WINDRES=i586-mingw32-windres
|
||||
DEL=rm -f
|
||||
SLASH=/
|
||||
else
|
||||
CC=gcc
|
||||
CPPC=g++
|
||||
WINDRES=windres
|
||||
DEL=del
|
||||
SLASH=\${blahblahblahblah}
|
||||
endif
|
||||
|
||||
LINK=-lkernel32 -luser32 -lgdi32 -lwinspool -lcomdlg32 -ladvapi32 -lshell32 -lole32 -loleaut32 -luuid -lodbc32 -lodbccp32 -lz -lpng -lcomctl32 -lwinmm -lopengl32 -lglu32 -lwsock32 -lddraw -ldsound -ldxguid -lvfw32 -mwindows
|
||||
#-L..\..\FMOD\api\lib -lfmodvc -lglide2x -ldelayimp
|
||||
|
||||
OBJS= 2xsai.obj apu.obj apudebug.obj bsx.obj c4.obj c4emu.obj cheats.obj cheats2.obj \
|
||||
clip.obj conffile.obj controls.obj cpu.obj cpuexec.obj cpuops.obj crosshairs.obj data.obj \
|
||||
debug.obj dma.obj dsp1.obj fxdbg.obj fxemu.obj fxinst.obj gfx.obj globals.obj loadzip.obj \
|
||||
logger.obj memmap.obj movie.obj netplay.obj obc1.obj ppu.obj reader.obj sa1.obj sa1cpu.obj \
|
||||
screenshot.obj sdd1.obj sdd1emu.obj server.obj seta.obj seta010.obj seta011.obj seta018.obj \
|
||||
snaporig.obj snapshot.obj snes9x.obj sound.obj soundux.obj spc700.obj spc7110.obj srtc.obj \
|
||||
tile.obj unzip/unreduce.obj i386/ZSNES.obj i386/fxemu2b.obj i386/fxtable.obj i386/fxemu2.obj \
|
||||
i386/fxemu2c.obj i386/sfxproc.obj i386/SPC.obj i386/zsnesc4.obj i386/C4.obj i386/2XSAIMMX.obj \
|
||||
i386/bilinear.obj jma/7zlzma.obj jma/crc32.obj jma/iiostrm.obj jma/inbyte.obj jma/jma.obj \
|
||||
jma/lzma.obj jma/lzmadec.obj jma/s9x-jma.obj jma/winout.obj unzip/unshrink.obj unzip/unzip.obj \
|
||||
unzip/explode.obj win32/auxmath.obj win32/AVIOutput.obj win32/directx.obj win32/InputCustom.obj \
|
||||
win32/render.obj win32/win32.obj win32/wconfig.obj win32/wsnes9x.obj win32/snes9x.obj
|
||||
|
||||
#adler32.obj compress.obj deflate.obj emucrc32.obj gzio.obj infback.obj \
|
||||
#inffast.obj inflate.obj inftrees.obj minigzip.obj trees.obj uncompr.obj zutil.obj
|
||||
#png.obj pngerror.obj pnggccrd.obj pngget.obj pngmem.obj \
|
||||
#pngpread.obj pngread.obj pngrio.obj pngrtran.obj pngrutil.obj pngset.obj pngtrans.obj \
|
||||
#pngvcrd.obj pngwio.obj pngwrite.obj pngwtran.obj pngwutil.obj
|
||||
|
||||
.SUFFIXES: .c .cpp .asm .ASM
|
||||
|
||||
%.obj: %.c
|
||||
${CC} ${CFLAGS} -o $@ -c $<
|
||||
|
||||
%.obj: %.cpp
|
||||
${CPPC} ${CFLAGS} -o $@ -c $<
|
||||
|
||||
%.obj: %.asm
|
||||
${ASM} -d__DJGPP__=1 -dZSNES_FX -f win32 -i . -i i386 -o $@ $<
|
||||
${OBJFIX} $@
|
||||
|
||||
%.obj: %.ASM
|
||||
${ASM} -d__DJGPP__=1 -dZSNES_FX -f win32 -i . -i i386 -o $@ $<
|
||||
${OBJFIX} $@
|
||||
|
||||
all: ${OBJFIX} ${OBJS}
|
||||
ifeq (${DEBUG},yes)
|
||||
${CPPC} -ggdb3 -osnes9x-debug.exe ${OBJS} ${LINK}
|
||||
else
|
||||
${CPPC} -s -osnes9x.exe ${OBJS} ${LINK}
|
||||
endif
|
||||
|
||||
${OBJFIX}: win32/objfix.c
|
||||
gcc -O3 -s -o $@ win32/objfix.c
|
||||
2xsai.obj: 2xsai.cpp
|
||||
apu.obj: apu.cpp
|
||||
apudebug.obj: apudebug.cpp
|
||||
bsx.obj: bsx.cpp
|
||||
c4.obj: c4.cpp
|
||||
c4emu.obj: c4emu.cpp
|
||||
cheats.obj: cheats.cpp
|
||||
cheats2.obj: cheats2.cpp
|
||||
clip.obj: clip.cpp
|
||||
conffile.obj: conffile.cpp
|
||||
controls.obj: controls.cpp
|
||||
cpu.obj: cpu.cpp
|
||||
cpuexec.obj: cpuexec.cpp
|
||||
cpuops.obj: cpuops.cpp
|
||||
crosshairs.obj: crosshairs.cpp
|
||||
data.obj: data.cpp
|
||||
debug.obj: debug.cpp
|
||||
dma.obj: dma.cpp
|
||||
dsp1.obj: dsp1.cpp
|
||||
fxdbg.obj: fxdbg.cpp
|
||||
fxemu.obj: fxemu.cpp
|
||||
fxinst.obj: fxinst.cpp
|
||||
gfx.obj: gfx.cpp
|
||||
globals.obj: globals.cpp
|
||||
loadzip.obj: loadzip.cpp
|
||||
logger.obj: logger.cpp
|
||||
memmap.obj: memmap.cpp
|
||||
movie.obj: movie.cpp
|
||||
netplay.obj: netplay.cpp
|
||||
obc1.obj: obc1.cpp
|
||||
ppu.obj: ppu.cpp
|
||||
reader.obj: reader.cpp
|
||||
sa1.obj: sa1.cpp
|
||||
sa1cpu.obj: sa1cpu.cpp
|
||||
screenshot.obj: screenshot.cpp
|
||||
sdd1.obj: sdd1.cpp
|
||||
sdd1emu.obj: sdd1emu.cpp
|
||||
server.obj: server.cpp
|
||||
seta.obj: seta.cpp
|
||||
seta010.obj: seta010.cpp
|
||||
seta011.obj: seta011.cpp
|
||||
seta018.obj: seta018.cpp
|
||||
snaporig.obj: snaporig.cpp
|
||||
snapshot.obj: snapshot.cpp
|
||||
snes9x.obj: snes9x.cpp
|
||||
sound.obj: sound.cpp
|
||||
soundux.obj: soundux.cpp
|
||||
spc700.obj: spc700.cpp
|
||||
spc7110.obj: spc7110.cpp
|
||||
srtc.obj: srtc.cpp
|
||||
tile.obj: tile.cpp
|
||||
unzip/unreduce.obj: unzip/unreduce.c
|
||||
unzip/unshrink.obj: unzip/unshrink.c
|
||||
unzip/unzip.obj: unzip/unzip.c
|
||||
unzip/explode.obj: unzip/explode.c
|
||||
jma/7zlzma.obj: jma/7zlzma.cpp
|
||||
jma/crc32.obj: jma/crc32.cpp
|
||||
jma/iiostrm.obj: jma/iiostrm.cpp
|
||||
jma/inbyte.obj: jma/inbyte.cpp
|
||||
jma/jma.obj: jma/jma.cpp
|
||||
jma/lzma.obj: jma/lzma.cpp
|
||||
jma/lzmadec.obj: jma/lzmadec.cpp
|
||||
jma/s9x-jma.obj: jma/s9x-jma.cpp
|
||||
jma/winout.obj: jma/winout.cpp
|
||||
win32/auxmath.obj: win32/auxmath.cpp
|
||||
win32/AVIOutput.obj: win32/AVIOutput.cpp
|
||||
win32/directx.obj: win32/directx.cpp
|
||||
win32/InputCustom.obj: win32/InputCustom.cpp
|
||||
win32/render.obj: win32/render.cpp
|
||||
win32/wconfig.obj: win32/wconfig.cpp
|
||||
win32/win32.obj: win32/win32.cpp
|
||||
win32/wsnes9x.obj: win32/wsnes9x.cpp
|
||||
win32/snes9x.obj: win32/rsrc/snes9x.rc
|
||||
${WINDRES} --include-dir win32/rsrc --language=0x413 -D_WIN32_IE=0x0501 win32/rsrc/snes9x.rc -owin32/snes9x.obj
|
||||
#--language=0x809
|
||||
|
||||
#adler32.obj: ../zlib/adler32.c
|
||||
#compress.obj: ../zlib/compress.c
|
||||
#deflate.obj: ../zlib/deflate.c
|
||||
#emucrc32.obj: ../zlib/emucrc32.c
|
||||
#gzio.obj: ../zlib/gzio.c
|
||||
#infback.obj: ../zlib/infback.c
|
||||
#inffast.obj: ../zlib/inffast.c
|
||||
#inflate.obj: ../zlib/inflate.c
|
||||
#inftrees.obj: ../zlib/inftrees.c
|
||||
#minigzip.obj: ../zlib/minigzip.c
|
||||
#trees.obj: ../zlib/trees.c
|
||||
#uncompr.obj: ../zlib/uncompr.c
|
||||
#zutil.obj: ../zlib/zutil.c
|
||||
|
||||
#png.obj: ../libpng/src/png.c
|
||||
#pngerror.obj: ../libpng/src/pngerror.c
|
||||
#pnggccrd.obj: ../libpng/src/pnggccrd.c
|
||||
#pngget.obj: ../libpng/src/pngget.c
|
||||
#pngmem.obj: ../libpng/src/pngmem.c
|
||||
#pngpread.obj: ../libpng/src/pngpread.c
|
||||
#pngread.obj: ../libpng/src/pngread.c
|
||||
#pngrio.obj: ../libpng/src/pngrio.c
|
||||
#pngrtran.obj: ../libpng/src/pngrtran.c
|
||||
#pngrutil.obj: ../libpng/src/pngrutil.c
|
||||
#pngset.obj: ../libpng/src/pngset.c
|
||||
#pngtrans.obj: ../libpng/src/pngtrans.c
|
||||
#pngvcrd.obj: ../libpng/src/pngvcrd.c
|
||||
#pngwio.obj: ../libpng/src/pngwio.c
|
||||
#pngwrite.obj: ../libpng/src/pngwrite.c
|
||||
#pngwtran.obj: ../libpng/src/pngwtran.c
|
||||
#pngwutil.obj: ../libpng/src/pngwutil.c
|
||||
|
||||
clean:
|
||||
${DEL} *.obj
|
||||
${DEL} snes9x.exe
|
||||
${DEL} i386${SLASH}*.obj
|
||||
${DEL} jma${SLASH}*.obj
|
||||
${DEL} unzip${SLASH}*.obj
|
||||
${DEL} win32${SLASH}*.obj
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user