mirror of
https://github.com/dborth/snes9xgx.git
synced 2025-01-12 19:29:08 +01:00
delete unused files
This commit is contained in:
parent
92e2777efd
commit
ac3ef1dbb9
File diff suppressed because it is too large
Load Diff
@ -1,821 +0,0 @@
|
||||
/**********************************************************************************
|
||||
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
|
||||
}
|
||||
|
@ -1,403 +0,0 @@
|
||||
@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
|
||||
|
@ -1,193 +0,0 @@
|
||||
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
|
@ -1,429 +0,0 @@
|
||||
/**********************************************************************************
|
||||
Snes9x - Portable Super Nintendo Entertainment System (TM) emulator.
|
||||
|
||||
(c) Copyright 1996 - 2002 Gary Henderson (gary.henderson@ntlworld.com) and
|
||||
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 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
|
||||
zones (kasumitokoduck@yahoo.com)
|
||||
|
||||
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 filter
|
||||
(c) Copyright 2003 Maxim Stepin (maxim@hiend3d.com)
|
||||
|
||||
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.
|
||||
**********************************************************************************/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <time.h>
|
||||
#include <string.h>
|
||||
#include <string>
|
||||
|
||||
#include "conffile.h"
|
||||
|
||||
using namespace std;
|
||||
|
||||
ConfigFile::ConfigFile(void) {
|
||||
data.clear();
|
||||
}
|
||||
|
||||
void ConfigFile::Clear(void){
|
||||
data.clear();
|
||||
}
|
||||
|
||||
bool ConfigFile::LoadFile(const char *filename){
|
||||
STREAM s;
|
||||
bool ret=false;
|
||||
const char *n, *n2;
|
||||
|
||||
if((s=OPEN_STREAM(filename, "r"))){
|
||||
n=filename;
|
||||
n2=strrchr(n, '/'); if(n2!=NULL) n=n2+1;
|
||||
n2=strrchr(n, '\\'); if(n2!=NULL) n=n2+1;
|
||||
LoadFile(new fReader(s), n);
|
||||
CLOSE_STREAM(s);
|
||||
ret = true;
|
||||
} else {
|
||||
fprintf(stderr, "Couldn't open conffile ");
|
||||
perror(filename);
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
void ConfigFile::LoadFile(Reader *r, const char *name){
|
||||
string l, key, val;
|
||||
string section;
|
||||
int i, line, line2;
|
||||
bool eof;
|
||||
|
||||
line=line2=0;
|
||||
section.clear();
|
||||
do {
|
||||
line=line2++;
|
||||
l=r->getline(eof);
|
||||
ConfigEntry::trim(l);
|
||||
if(l.size()==0) continue;
|
||||
|
||||
if(l[0]=='#' || l[0]==';'){
|
||||
// comment
|
||||
continue;
|
||||
}
|
||||
|
||||
if(l[0]=='['){
|
||||
if(*l.rbegin()!=']'){
|
||||
if(name) fprintf(stderr, "%s:", name);
|
||||
fprintf(stderr, "[%d]: Ignoring invalid section header\n", line);
|
||||
continue;
|
||||
}
|
||||
section.assign(l, 1, l.size()-2);
|
||||
continue;
|
||||
}
|
||||
|
||||
while(*l.rbegin()=='\\'){
|
||||
l.erase(l.size()-1);
|
||||
line2++;
|
||||
val=r->getline(eof);
|
||||
if(eof){
|
||||
fprintf(stderr, "Unexpected EOF reading config file");
|
||||
if(name) fprintf(stderr, " '%s'", name);
|
||||
fprintf(stderr, "\n");
|
||||
return;
|
||||
}
|
||||
ConfigEntry::trim(val);
|
||||
l+=val;
|
||||
}
|
||||
i=l.find('=');
|
||||
if(i<0){
|
||||
if(name) fprintf(stderr, "%s:", name);
|
||||
fprintf(stderr, "[%d]: Ignoring invalid entry\n", line);
|
||||
continue;
|
||||
}
|
||||
key=l.substr(0,i); ConfigEntry::trim(key);
|
||||
val=l.substr(i+1); ConfigEntry::trim(val);
|
||||
if(val[0]=='"' && *val.rbegin()=='"') val=val.substr(1, val.size()-2);
|
||||
|
||||
ConfigEntry e(line, section, key, val);
|
||||
data.erase(e);
|
||||
data.insert(e);
|
||||
} while(!eof);
|
||||
}
|
||||
|
||||
bool ConfigFile::SaveTo(const char *filename){
|
||||
string section;
|
||||
FILE *fp;
|
||||
|
||||
if((fp=fopen(filename, "w"))==NULL){
|
||||
fprintf(stderr, "Couldn't write conffile ");
|
||||
perror(filename);
|
||||
return false;
|
||||
}
|
||||
|
||||
section.clear();
|
||||
set<ConfigEntry, ConfigEntry::line_less> tmp;
|
||||
fprintf(fp, "# Config file output by snes9x\n");
|
||||
time_t t=time(NULL);
|
||||
fprintf(fp, "# %s", ctime(&t));
|
||||
for(set<ConfigEntry, ConfigEntry::key_less>::iterator j=data.begin(); ; j++){
|
||||
if(j==data.end() || j->section!=section){
|
||||
if(!tmp.empty()){
|
||||
fprintf(fp, "\n[%s]\n", section.c_str());
|
||||
for(set<ConfigEntry, ConfigEntry::line_less>::iterator i=tmp.begin(); i!=tmp.end(); i++){
|
||||
string o=i->val; ConfigEntry::trim(o);
|
||||
if(o!=i->val) o="\""+i->val+"\"";
|
||||
fprintf(fp, "%s = %s\n", i->key.c_str(), o.c_str());
|
||||
}
|
||||
}
|
||||
if(j==data.end()) break;
|
||||
section=j->section;
|
||||
tmp.clear();
|
||||
}
|
||||
tmp.insert(*j);
|
||||
}
|
||||
|
||||
fclose(fp);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
/***********************************************/
|
||||
|
||||
string ConfigFile::Get(const char *key){
|
||||
set<ConfigEntry, ConfigEntry::key_less>::iterator i;
|
||||
i=data.find(ConfigEntry(key));
|
||||
return i->val;
|
||||
}
|
||||
|
||||
bool ConfigFile::Exists(const char *key){
|
||||
return data.find(ConfigEntry(key))!=data.end();
|
||||
}
|
||||
|
||||
|
||||
string ConfigFile::GetString(const char *key, string def){
|
||||
if(!Exists(key)) return def;
|
||||
return Get(key);
|
||||
}
|
||||
|
||||
char *ConfigFile::GetString(const char *key, char *out, uint32 outlen){
|
||||
if(!Exists(key)) return NULL;
|
||||
ZeroMemory(out, outlen);
|
||||
string o=Get(key);
|
||||
if(outlen>0){
|
||||
outlen--;
|
||||
if(o.size()<outlen) outlen=o.size();
|
||||
memcpy(out, o.data(), outlen);
|
||||
}
|
||||
return out;
|
||||
}
|
||||
|
||||
const char *ConfigFile::GetString(const char *key, const char *def){
|
||||
set<ConfigEntry, ConfigEntry::key_less>::iterator i;
|
||||
i=data.find(ConfigEntry(key));
|
||||
if(i==data.end()) return def;
|
||||
// This should be OK, until this key gets removed
|
||||
return i->val.c_str();
|
||||
}
|
||||
|
||||
char *ConfigFile::GetStringDup(const char *key, const char *def){
|
||||
const char *c=GetString(key, def);
|
||||
if(c==NULL) return NULL;
|
||||
return strdup(c);
|
||||
}
|
||||
|
||||
bool ConfigFile::SetString(const char *key, string val){
|
||||
set<ConfigEntry, ConfigEntry::key_less>::iterator i;
|
||||
bool ret=false;
|
||||
|
||||
ConfigEntry e(key, val);
|
||||
|
||||
i=data.find(e);
|
||||
if(i!=data.end()){
|
||||
e.line=i->line;
|
||||
data.erase(e);
|
||||
ret=true;
|
||||
}
|
||||
data.insert(e);
|
||||
return ret;
|
||||
}
|
||||
|
||||
int32 ConfigFile::GetInt(const char *key, int32 def, bool *bad){
|
||||
if(bad) *bad=false;
|
||||
if(!Exists(key)) return def;
|
||||
char *c;
|
||||
int32 i;
|
||||
string o=Get(key);
|
||||
i=strtol(o.c_str(), &c, 10);
|
||||
if(c!=NULL && *c!='\0'){
|
||||
i=def;
|
||||
if(bad) *bad=true;
|
||||
}
|
||||
return i;
|
||||
}
|
||||
|
||||
bool ConfigFile::SetInt(const char *key, int32 val){
|
||||
char buf[20];
|
||||
snprintf(buf, sizeof(buf), "%d", val);
|
||||
return SetString(key, buf);
|
||||
}
|
||||
|
||||
uint32 ConfigFile::GetUInt(const char *key, uint32 def, int base, bool *bad){
|
||||
if(bad) *bad=false;
|
||||
if(!Exists(key)) return def;
|
||||
if(base!=8 && base!=10 && base!=16) base=0;
|
||||
char *c;
|
||||
uint32 i;
|
||||
string o=Get(key);
|
||||
i=strtol(o.c_str(), &c, base);
|
||||
if(c!=NULL && *c!='\0'){
|
||||
i=def;
|
||||
if(bad) *bad=true;
|
||||
}
|
||||
return i;
|
||||
}
|
||||
|
||||
bool ConfigFile::SetUInt(const char *key, uint32 val, int base){
|
||||
char buf[20];
|
||||
switch(base){
|
||||
case 10:
|
||||
default:
|
||||
snprintf(buf, sizeof(buf), "%u", val);
|
||||
break;
|
||||
case 8:
|
||||
snprintf(buf, sizeof(buf), "%#o", val);
|
||||
break;
|
||||
case 16:
|
||||
snprintf(buf, sizeof(buf), "%#x", val);
|
||||
break;
|
||||
}
|
||||
return SetString(key, buf);
|
||||
}
|
||||
|
||||
bool ConfigFile::GetBool(const char *key, bool def, bool *bad){
|
||||
if(bad) *bad=false;
|
||||
if(!Exists(key)) return def;
|
||||
string o=Get(key);
|
||||
const char *c=o.c_str();
|
||||
if(!strcasecmp(c, "true") || !strcasecmp(c, "1") || !strcasecmp(c, "yes") || !strcasecmp(c, "on")) return true;
|
||||
if(!strcasecmp(c, "false") || !strcasecmp(c, "0") || !strcasecmp(c, "no") || !strcasecmp(c, "off")) return false;
|
||||
if(bad) *bad=true;
|
||||
return def;
|
||||
}
|
||||
|
||||
bool ConfigFile::SetBool(const char *key, bool val, char *true_val, char *false_val){
|
||||
return SetString(key, val?true_val:false_val);
|
||||
}
|
||||
|
||||
bool ConfigFile::DeleteKey(const char *key){
|
||||
return (data.erase(ConfigEntry(key))>0);
|
||||
}
|
||||
|
||||
/***********************************************/
|
||||
|
||||
bool ConfigFile::DeleteSection(const char *section){
|
||||
set<ConfigEntry, ConfigEntry::key_less>::iterator s, e;
|
||||
|
||||
for(s=data.begin(); s!=data.end() && s->section!=section; s++);
|
||||
if(s==data.end()) return false;
|
||||
for(e=s; e!=data.end() && e->section==section; e++);
|
||||
data.erase(s, e);
|
||||
return true;
|
||||
}
|
||||
|
||||
ConfigFile::secvec_t ConfigFile::GetSection(const char *section){
|
||||
secvec_t v;
|
||||
set<ConfigEntry, ConfigEntry::key_less>::iterator i;
|
||||
|
||||
v.clear();
|
||||
for(i=data.begin(); i!=data.end(); i++){
|
||||
if(i->section!=section) continue;
|
||||
v.push_back(std::pair<string,string>(i->key, i->val));
|
||||
}
|
||||
return v;
|
||||
}
|
@ -1,303 +0,0 @@
|
||||
/**********************************************************************************
|
||||
Snes9x - Portable Super Nintendo Entertainment System (TM) emulator.
|
||||
|
||||
(c) Copyright 1996 - 2002 Gary Henderson (gary.henderson@ntlworld.com) and
|
||||
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 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
|
||||
zones (kasumitokoduck@yahoo.com)
|
||||
|
||||
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 filter
|
||||
(c) Copyright 2003 Maxim Stepin (maxim@hiend3d.com)
|
||||
|
||||
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.
|
||||
**********************************************************************************/
|
||||
|
||||
#ifndef CONFIG_H
|
||||
#define CONFIG_H
|
||||
|
||||
#include <set>
|
||||
#include <vector>
|
||||
#include <string>
|
||||
|
||||
#include "port.h"
|
||||
#include "reader.h"
|
||||
|
||||
class ConfigFile {
|
||||
public:
|
||||
ConfigFile(void);
|
||||
|
||||
void Clear(void);
|
||||
|
||||
// return false on failure
|
||||
bool LoadFile(const char *filename);
|
||||
void LoadFile(Reader *r, const char *name=NULL);
|
||||
|
||||
// return false if key does not exist
|
||||
bool Exists(const char *key);
|
||||
|
||||
// return the value / default
|
||||
std::string GetString(const char *key, std::string def);
|
||||
char *GetString(const char *key, char *out, uint32 outlen); // return NULL if it doesn't exist, out not affected
|
||||
const char *GetString(const char *key, const char *def=NULL); // NOTE: returned pointer becomes invalid when key is deleted/modified, or the ConfigFile is Clear()ed or deleted.
|
||||
char *GetStringDup(const char *key, const char *def=NULL); // Much like "strdup(GetString(key, def))"
|
||||
int32 GetInt(const char *key, int32 def=-1, bool *bad=NULL);
|
||||
uint32 GetUInt(const char *key, uint32 def=0, int base=0, bool *bad=NULL); // base = 0, 8, 10, or 16
|
||||
bool GetBool(const char *key, bool def=false, bool *bad=NULL);
|
||||
|
||||
// return true if the key existed prior to setting
|
||||
bool SetString(const char *key, std::string val);
|
||||
bool SetInt(const char *key, int32 val);
|
||||
bool SetUInt(const char *key, uint32 val, int base=10); // base = 8, 10, or 16
|
||||
bool SetBool(const char *key, bool val, char *true_val="TRUE", char *false_val="FALSE");
|
||||
bool DeleteKey(const char *key);
|
||||
|
||||
// Operation on entire sections
|
||||
bool DeleteSection(const char *section);
|
||||
typedef std::vector<std::pair<std::string,std::string> > secvec_t;
|
||||
secvec_t GetSection(const char *section);
|
||||
|
||||
bool SaveTo(const char *filename);
|
||||
|
||||
private:
|
||||
std::string Get(const char *key);
|
||||
|
||||
class ConfigEntry {
|
||||
protected:
|
||||
int line;
|
||||
std::string section;
|
||||
std::string key;
|
||||
std::string val;
|
||||
|
||||
struct key_less {
|
||||
bool operator()(const ConfigEntry &a, const ConfigEntry &b) const{
|
||||
if(a.section!=b.section) return a.section<b.section;
|
||||
return a.key<b.key;
|
||||
}
|
||||
};
|
||||
|
||||
struct line_less {
|
||||
bool operator()(const ConfigEntry &a, const ConfigEntry &b){
|
||||
if(a.line==b.line) return a.key<b.key;
|
||||
if(b.line<0) return true;
|
||||
return a.line<b.line;
|
||||
}
|
||||
};
|
||||
|
||||
static void trim(std::string &s){
|
||||
int i;
|
||||
i=s.find_first_not_of(" \f\n\r\t\v");
|
||||
if(i==-1){
|
||||
s.clear();
|
||||
return;
|
||||
}
|
||||
if(i>0) s.erase(0, i);
|
||||
i=s.find_last_not_of(" \f\n\r\t\v");
|
||||
if(i!=-1) s.erase(i+1);
|
||||
}
|
||||
|
||||
public:
|
||||
ConfigEntry(int l, std::string &s, std::string &k, std::string &v) :
|
||||
line(l), section(s), key(k), val(v) {
|
||||
trim(section);
|
||||
trim(key);
|
||||
}
|
||||
|
||||
void parse_key(std::string &k){
|
||||
int i=k.find("::");
|
||||
if(i==-1){
|
||||
section=""; key=k;
|
||||
} else {
|
||||
section=k.substr(0,i); key=k.substr(i+2);
|
||||
}
|
||||
trim(section);
|
||||
trim(key);
|
||||
}
|
||||
|
||||
ConfigEntry(std::string k){
|
||||
parse_key(k);
|
||||
}
|
||||
|
||||
ConfigEntry(std::string k, std::string &v) : line(-1), val(v) {
|
||||
parse_key(k);
|
||||
}
|
||||
|
||||
friend class ConfigFile;
|
||||
friend struct key_less;
|
||||
friend struct line_less;
|
||||
};
|
||||
std::set<ConfigEntry, ConfigEntry::key_less> data;
|
||||
};
|
||||
|
||||
/* Config file format:
|
||||
*
|
||||
* Comments are any lines whose first non-whitespace character is ';' or '#'.
|
||||
* Note that comments must be on lines by themselves, they cannot "end" a
|
||||
* normal line.
|
||||
*
|
||||
* All parameters fall into sections. To name a section, the first
|
||||
* non-whitespace character on the line will be '[', and the last will be ']'.
|
||||
*
|
||||
* Parameters are simple key=value pairs. Whitespace around the '=', and at the
|
||||
* beginning or end of the line is ignored. Key names may not contain '=' nor
|
||||
* begin with '[', however values can. If the last character of the value is
|
||||
* '\', the next line (sans leading/trailing whitespace) is considered part of
|
||||
* the value as well. Programmatically, the key "K" in section "S" is referred
|
||||
* to as "S::K", much like C++ namespaces. For example:
|
||||
* [Section1]
|
||||
* # this is a comment
|
||||
* foo = bar \
|
||||
* baz\
|
||||
* quux \
|
||||
* # this is not a comment!
|
||||
* means the value of "Section1::foo" is "bar bazquux # this is not a comment!"
|
||||
*
|
||||
* Parameters may be of several types:
|
||||
* String - Bare characters. If the first and last characters are both '"',
|
||||
* they are removed (so just double them if you really want quotes
|
||||
* there)
|
||||
* Int - A decimal number from -2147483648 to 2147483647
|
||||
* UInt - A number in decimal, hex, or octal from 0 to 4294967295 (or
|
||||
* 0xffffffff, or 037777777777)
|
||||
* Bool - true/false, 0/1, on/off, yes/no
|
||||
*
|
||||
* Of course, the actual accepted values for a parameter may be further
|
||||
* restricted ;)
|
||||
*/
|
||||
|
||||
|
||||
/* You must write this for your port */
|
||||
void S9xParsePortConfig(ConfigFile &, int pass);
|
||||
|
||||
/* This may or may not be useful to you */
|
||||
char *S9xParseDisplayConfig(ConfigFile &, int pass);
|
||||
|
||||
#endif
|
@ -1,341 +0,0 @@
|
||||
/**********************************************************************************
|
||||
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.
|
||||
**********************************************************************************/
|
||||
|
||||
|
||||
|
||||
|
||||
#ifdef UNZIP_SUPPORT
|
||||
/**********************************************************************************************/
|
||||
/* Loadzip.CPP */
|
||||
/* This file contains a function for loading a SNES ROM image from a zip file */
|
||||
/**********************************************************************************************/
|
||||
|
||||
#include <string.h>
|
||||
#ifdef HAVE_STRINGS_H
|
||||
#include <strings.h>
|
||||
#endif
|
||||
#include <ctype.h>
|
||||
|
||||
#ifndef NO_INLINE_SET_GET
|
||||
#define NO_INLINE_SET_GET
|
||||
#endif
|
||||
|
||||
#include "snes9x.h"
|
||||
#include "memmap.h"
|
||||
|
||||
#include "unzip/unzip.h"
|
||||
#include <assert.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
bool8 LoadZip(const char* zipname,
|
||||
int32 *TotalFileSize,
|
||||
int32 *headers, uint8* buffer)
|
||||
{
|
||||
*TotalFileSize = 0;
|
||||
*headers = 0;
|
||||
|
||||
unzFile file = unzOpen(zipname);
|
||||
if(file == NULL)
|
||||
return (FALSE);
|
||||
|
||||
// find largest file in zip file (under MAX_ROM_SIZE)
|
||||
// or a file with extension .1
|
||||
char filename[132];
|
||||
int filesize = 0;
|
||||
int port = unzGoToFirstFile(file);
|
||||
unz_file_info info;
|
||||
while(port == UNZ_OK)
|
||||
{
|
||||
char name[132];
|
||||
unzGetCurrentFileInfo(file, &info, name,128, NULL,0, NULL,0);
|
||||
|
||||
#if 0
|
||||
int calc_size = info.uncompressed_size / 0x2000;
|
||||
calc_size *= 0x2000;
|
||||
if(!(info.uncompressed_size - calc_size == 512 || info.uncompressed_size == calc_size))
|
||||
{
|
||||
port = unzGoToNextFile(file);
|
||||
continue;
|
||||
}
|
||||
#endif
|
||||
|
||||
if(info.uncompressed_size > (CMemory::MAX_ROM_SIZE + 512))
|
||||
{
|
||||
port = unzGoToNextFile(file);
|
||||
continue;
|
||||
}
|
||||
|
||||
if ((int) info.uncompressed_size > filesize)
|
||||
{
|
||||
strcpy(filename,name);
|
||||
filesize = info.uncompressed_size;
|
||||
}
|
||||
int len = strlen(name);
|
||||
if(name[len-2] == '.' && name[len-1] == '1')
|
||||
{
|
||||
strcpy(filename,name);
|
||||
filesize = info.uncompressed_size;
|
||||
break;
|
||||
}
|
||||
port = unzGoToNextFile(file);
|
||||
}
|
||||
if( !(port == UNZ_END_OF_LIST_OF_FILE || port == UNZ_OK) || filesize == 0)
|
||||
{
|
||||
assert( unzClose(file) == UNZ_OK );
|
||||
return (FALSE);
|
||||
}
|
||||
|
||||
// Find extension
|
||||
char tmp[2];
|
||||
tmp[0] = tmp[1] = 0;
|
||||
char *ext = strrchr(filename,'.');
|
||||
if(ext) ext++;
|
||||
else ext = tmp;
|
||||
|
||||
uint8 *ptr = buffer;
|
||||
bool8 more = FALSE;
|
||||
|
||||
printf("Using ROM %s in %s\n", filename, zipname);
|
||||
unzLocateFile(file,filename,1);
|
||||
unzGetCurrentFileInfo(file, &info, filename,128, NULL,0, NULL,0);
|
||||
|
||||
if( unzOpenCurrentFile(file) != UNZ_OK )
|
||||
{
|
||||
unzClose(file);
|
||||
return (FALSE);
|
||||
}
|
||||
|
||||
do
|
||||
{
|
||||
assert(info.uncompressed_size <= CMemory::MAX_ROM_SIZE + 512);
|
||||
int FileSize = info.uncompressed_size;
|
||||
|
||||
int l = unzReadCurrentFile(file,ptr,FileSize);
|
||||
if(unzCloseCurrentFile(file) == UNZ_CRCERROR)
|
||||
{
|
||||
unzClose(file);
|
||||
return (FALSE);
|
||||
}
|
||||
|
||||
if(l <= 0 || l != FileSize)
|
||||
{
|
||||
unzClose(file);
|
||||
switch(l)
|
||||
{
|
||||
case UNZ_ERRNO:
|
||||
break;
|
||||
case UNZ_EOF:
|
||||
break;
|
||||
case UNZ_PARAMERROR:
|
||||
break;
|
||||
case UNZ_BADZIPFILE:
|
||||
break;
|
||||
case UNZ_INTERNALERROR:
|
||||
break;
|
||||
case UNZ_CRCERROR:
|
||||
break;
|
||||
}
|
||||
return (FALSE);
|
||||
}
|
||||
|
||||
FileSize = (int)Memory.HeaderRemove((uint32)FileSize, *headers, ptr);
|
||||
ptr += FileSize;
|
||||
(*TotalFileSize) += FileSize;
|
||||
|
||||
int len;
|
||||
if (ptr - Memory.ROM < CMemory::MAX_ROM_SIZE + 0x200 &&
|
||||
(isdigit (ext [0]) && ext [1] == 0 && ext [0] < '9'))
|
||||
{
|
||||
more = TRUE;
|
||||
ext [0]++;
|
||||
}
|
||||
else if (ptr - Memory.ROM < CMemory::MAX_ROM_SIZE + 0x200)
|
||||
{
|
||||
if (ext == tmp) len = strlen (filename);
|
||||
else len = ext - filename - 1;
|
||||
if ((len == 7 || len == 8) &&
|
||||
strncasecmp (filename, "sf", 2) == 0 &&
|
||||
isdigit (filename [2]) && isdigit (filename [3]) && isdigit (filename [4]) &&
|
||||
isdigit (filename [5]) && isalpha (filename [len - 1]))
|
||||
{
|
||||
more = TRUE;
|
||||
filename [len - 1]++;
|
||||
}
|
||||
}
|
||||
else
|
||||
more = FALSE;
|
||||
|
||||
if(more)
|
||||
{
|
||||
if( unzLocateFile(file,filename,1) != UNZ_OK ||
|
||||
unzGetCurrentFileInfo(file, &info, filename,128, NULL,0, NULL,0) != UNZ_OK ||
|
||||
unzOpenCurrentFile(file) != UNZ_OK)
|
||||
break;
|
||||
printf(" ... and %s in %s\n", filename, zipname);
|
||||
}
|
||||
|
||||
} while(more);
|
||||
|
||||
unzClose(file);
|
||||
return (TRUE);
|
||||
}
|
||||
#endif
|
||||
|
@ -1,338 +0,0 @@
|
||||
/**********************************************************************************
|
||||
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.
|
||||
**********************************************************************************/
|
||||
|
||||
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include "snes9x.h"
|
||||
#include "gfx.h"
|
||||
#include "soundux.h"
|
||||
#include "movie.h"
|
||||
#include "display.h"
|
||||
#include "logger.h"
|
||||
|
||||
#if !(defined(__unix) || defined(__linux) || defined(__sun) || defined(__DJGPP))
|
||||
#define __builtin_expect(exp,c) ((exp)!=(c))
|
||||
#endif
|
||||
|
||||
int dumpstreams = 0;
|
||||
int maxframes = -1;
|
||||
|
||||
static int resetno = 0;
|
||||
static int framecounter = 0;
|
||||
|
||||
int fastforwardpoint = -1;
|
||||
int fastforwarddistance = 0;
|
||||
|
||||
int keypressscreen = 0;
|
||||
|
||||
static int drift = 0;
|
||||
|
||||
FILE *video=NULL, *audio=NULL;
|
||||
char autodemo[128] = "";
|
||||
|
||||
int Logger_FrameCounter()
|
||||
{
|
||||
return framecounter;
|
||||
}
|
||||
|
||||
void Logger_NextFrame()
|
||||
{
|
||||
framecounter++;
|
||||
}
|
||||
|
||||
void breakpoint()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void ResetLogger()
|
||||
{
|
||||
char buffer[256*224*4];
|
||||
|
||||
if (!dumpstreams)
|
||||
return;
|
||||
|
||||
framecounter = 0;
|
||||
drift=0;
|
||||
|
||||
if (video)
|
||||
fclose(video);
|
||||
if (audio)
|
||||
fclose(audio);
|
||||
|
||||
sprintf(buffer, "videostream%d.dat", resetno);
|
||||
video = fopen(buffer, "wb");
|
||||
if (!video)
|
||||
{
|
||||
printf("Opening %s failed. Logging cancelled.\n", buffer);
|
||||
return;
|
||||
}
|
||||
|
||||
sprintf(buffer, "audiostream%d.dat", resetno);
|
||||
audio = fopen(buffer, "wb");
|
||||
if (!audio)
|
||||
{
|
||||
printf("Opening %s failed. Logging cancelled.\n", buffer);
|
||||
fclose(video);
|
||||
return;
|
||||
}
|
||||
|
||||
char *logo = getenv("LOGO");
|
||||
if (!logo)
|
||||
logo = "logo.dat";
|
||||
FILE *l = fopen(logo, "rb");
|
||||
if (l)
|
||||
{
|
||||
const int soundsize = (so.sixteen_bit ? 2 : 1)*(so.stereo?2:1)*so.playback_rate * Settings.FrameTime / 1000000;
|
||||
printf("Soundsize: %d\n", soundsize);
|
||||
while (!feof(l))
|
||||
{
|
||||
if (fread(buffer, 1024,224, l) != 224)
|
||||
break;
|
||||
VideoLogger(buffer, 256, 224, 4,1024);
|
||||
memset(buffer, 0, soundsize);
|
||||
AudioLogger(buffer, soundsize);
|
||||
}
|
||||
fclose(l);
|
||||
}
|
||||
resetno++;
|
||||
}
|
||||
|
||||
char message[128];
|
||||
int messageframe;
|
||||
|
||||
|
||||
void VideoLogger(void *pixels, int width, int height, int depth, int bytes_per_line)
|
||||
{
|
||||
int fc = S9xMovieGetFrameCounter();
|
||||
if (fc > 0)
|
||||
framecounter = fc;
|
||||
else
|
||||
framecounter++;
|
||||
|
||||
if (video)
|
||||
{
|
||||
int i;
|
||||
char *data = (char*)pixels;
|
||||
for (i=0; i < height; i++)
|
||||
fwrite(data + i*bytes_per_line, depth, width, video);
|
||||
fflush(video);
|
||||
fflush(audio);
|
||||
drift++;
|
||||
|
||||
if (maxframes > 0 && __builtin_expect(framecounter >= maxframes, 0))
|
||||
{
|
||||
printf("-maxframes hit\ndrift:%d\n",drift);
|
||||
S9xExit();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if (Settings.DisplayPressedKeys==1 || keypressscreen)
|
||||
{
|
||||
uint16 MovieGetJoypad(int i);
|
||||
|
||||
int buttons = MovieGetJoypad(0);
|
||||
static char buffer[128];
|
||||
|
||||
// This string spacing pattern is optimized for the 256 pixel wide screen.
|
||||
sprintf(buffer, "%s %s %s %s %s %s %c%c%c%c%c%c",
|
||||
buttons & SNES_START_MASK ? "Start" : "_____",
|
||||
buttons & SNES_SELECT_MASK ? "Select" : "______",
|
||||
buttons & SNES_UP_MASK ? "Up" : "__",
|
||||
buttons & SNES_DOWN_MASK ? "Down" : "____",
|
||||
buttons & SNES_LEFT_MASK ? "Left" : "____",
|
||||
buttons & SNES_RIGHT_MASK ? "Right" : "_____",
|
||||
buttons & SNES_A_MASK ? 'A':'_',
|
||||
buttons & SNES_B_MASK ? 'B':'_',
|
||||
buttons & SNES_X_MASK ? 'X':'_',
|
||||
buttons & SNES_Y_MASK ? 'Y':'_',
|
||||
buttons & SNES_TL_MASK ? 'L':'_',
|
||||
buttons & SNES_TR_MASK ? 'R':'_'
|
||||
/*framecounter*/);
|
||||
if (Settings.DisplayPressedKeys==1)
|
||||
fprintf(stderr, "%s %d \r", buffer, framecounter);
|
||||
//if (keypressscreen)
|
||||
S9xSetInfoString(buffer);
|
||||
}
|
||||
|
||||
if (__builtin_expect(messageframe >= 0 && framecounter == messageframe, 0))
|
||||
{
|
||||
S9xMessage(S9X_INFO, S9X_MOVIE_INFO, message);
|
||||
GFX.InfoStringTimeout = 300;
|
||||
messageframe = -1;
|
||||
}
|
||||
|
||||
/* if (__builtin_expect(fastforwardpoint >= 0 && framecounter >= fastforwardpoint, 0))
|
||||
{
|
||||
Settings.FramesToSkip = fastforwarddistance;
|
||||
fastforwardpoint = -1;
|
||||
}*/
|
||||
}
|
||||
|
||||
|
||||
void AudioLogger(void *samples, int length)
|
||||
{
|
||||
if (audio)
|
||||
fwrite(samples, 1, length, audio);
|
||||
drift--;
|
||||
}
|
@ -1,178 +0,0 @@
|
||||
/**********************************************************************************
|
||||
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.
|
||||
**********************************************************************************/
|
||||
|
||||
|
||||
|
||||
#ifndef LOGGER_H
|
||||
#define LOGGER_H
|
||||
|
||||
extern int dumpstreams;
|
||||
extern char autodemo[128];
|
||||
extern int maxframes;
|
||||
extern int logger_pivot;
|
||||
|
||||
int Logger_FrameCounter();
|
||||
void Logger_NextFrame();
|
||||
|
||||
void ResetLogger();
|
||||
void VideoLogger(void *pixels, int width, int height, int depth, int bytes_per_row);
|
||||
void AudioLogger(void *samples, int length);
|
||||
|
||||
#endif
|
@ -1,14 +0,0 @@
|
||||
@REM gcc -c -DEXECUTE_SUPERFX_PER_LINE -DMICROSOFT_C -DSPC700_C -DCPU_SHUTDOWN -DSPC700_SHUTDOWN -Ii386 i386/cpuexec.S -o i386/cpuexec.obj
|
||||
@REM gcc -c -DEXECUTE_SUPERFX_PER_LINE -DMICROSOFT_C -DSPC700_C -DCPU_SHUTDOWN -DSPC700_SHUTDOWN -Ii386 i386/cpuops.S -o i386/cpuops.obj
|
||||
@REM gcc -c -DEXECUTE_SUPERFX_PER_LINE -DMICROSOFT_C -DSPC700_C -DCPU_SHUTDOWN -DSPC700_SHUTDOWN -Ii386 i386/sa1ops.S -o i386/sa1ops.obj
|
||||
nasmw -d__DJGPP__=1 -dZSNES_FX -f win32 -i . -i i386 -o i386/zsnes.obj i386/zsnes.asm
|
||||
nasmw -d__DJGPP__=1 -dZSNES_FX -f win32 -i . -i i386 -o i386/fxemu2b.obj i386/fxemu2b.asm
|
||||
nasmw -d__DJGPP__=1 -dZSNES_FX -f win32 -i . -i i386 -o i386/fxtable.obj i386/fxtable.asm
|
||||
nasmw -d__DJGPP__=1 -dZSNES_FX -f win32 -i . -i i386 -o i386/fxemu2.obj i386/fxemu2.asm
|
||||
nasmw -d__DJGPP__=1 -dZSNES_FX -f win32 -i . -i i386 -o i386/fxemu2c.obj i386/fxemu2c.asm
|
||||
nasmw -d__DJGPP__=1 -dZSNES_FX -f win32 -i . -i i386 -o i386/sfxproc.obj i386/sfxproc.asm
|
||||
nasmw -d__DJGPP__=1 -dZSNES_FX -f win32 -i . -i i386 -o i386/spc.obj i386/spc.asm
|
||||
nasmw -d__DJGPP__=1 -dZSNES_FX -f win32 -i . -i i386 -o i386/zsnesc4.obj i386/zsnesc4.asm
|
||||
@REM nasmw -d__DJGPP__=1 -dZSNES_FX -f win32 -i . -i i386 -o i386/c4.obj i386/c4.asm
|
||||
nasmw -d__DJGPP__=1 -dZSNES_FX -f win32 -i . -i i386 -o i386/2xsaimmx.obj i386/2xsaimmx.asm
|
||||
nasmw -d__DJGPP__=1 -dZSNES_FX -f win32 -i . -i i386 -o i386/bilinear.obj i386/bilinear.asm
|
File diff suppressed because it is too large
Load Diff
@ -1,247 +0,0 @@
|
||||
/**********************************************************************************
|
||||
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.
|
||||
**********************************************************************************/
|
||||
|
||||
|
||||
|
||||
// Input recording/playback code
|
||||
// (c) Copyright 2004 blip
|
||||
|
||||
#ifndef _MOVIE_H_
|
||||
#define _MOVIE_H_
|
||||
|
||||
#include <stdio.h>
|
||||
#include <time.h>
|
||||
#include "snes9x.h"
|
||||
|
||||
#ifndef SUCCESS
|
||||
# define SUCCESS 1
|
||||
# define WRONG_FORMAT (-1)
|
||||
# define WRONG_VERSION (-2)
|
||||
# define FILE_NOT_FOUND (-3)
|
||||
#endif
|
||||
|
||||
#define MOVIE_OPT_FROM_SNAPSHOT 0
|
||||
#define MOVIE_OPT_FROM_RESET (1<<0)
|
||||
#define MOVIE_OPT_PAL (1<<1)
|
||||
#define MOVIE_OPT_NOSAVEDATA (1<<2)
|
||||
#define MOVIE_MAX_METADATA 512
|
||||
|
||||
#define MOVIE_SYNC_DATA_EXISTS 0x01
|
||||
#define MOVIE_SYNC_OBSOLETE 0x02
|
||||
#define MOVIE_SYNC_LEFTRIGHT 0x04
|
||||
#define MOVIE_SYNC_VOLUMEENVX 0x08
|
||||
#define MOVIE_SYNC_FAKEMUTE 0x10
|
||||
#define MOVIE_SYNC_SYNCSOUND 0x20
|
||||
#define MOVIE_SYNC_HASROMINFO 0x40
|
||||
#define MOVIE_SYNC_NOCPUSHUTDOWN 0x80
|
||||
|
||||
START_EXTERN_C
|
||||
struct MovieInfo
|
||||
{
|
||||
time_t TimeCreated;
|
||||
uint32 LengthFrames;
|
||||
uint32 RerecordCount;
|
||||
wchar_t Metadata[MOVIE_MAX_METADATA]; // really should be wchar_t
|
||||
uint8 Opts;
|
||||
uint8 ControllersMask;
|
||||
bool8 ReadOnly;
|
||||
uint8 SyncFlags;
|
||||
|
||||
uint32 ROMCRC32;
|
||||
char ROMName [23];
|
||||
|
||||
uint32 LengthSamples;
|
||||
uint8 PortType[2];
|
||||
uint32 Version;
|
||||
};
|
||||
|
||||
// methods used by the user-interface code
|
||||
int S9xMovieOpen (const char* filename, bool8 read_only);
|
||||
int S9xMovieCreate (const char* filename, uint8 controllers_mask, uint8 opts, const wchar_t* metadata, int metadata_length);
|
||||
int S9xMovieGetInfo (const char* filename, struct MovieInfo* info);
|
||||
void S9xMovieStop (bool8 suppress_message);
|
||||
void S9xMovieToggleRecState ();
|
||||
void S9xMovieToggleFrameDisplay ();
|
||||
const char *S9xChooseMovieFilename(bool8 read_only);
|
||||
|
||||
// methods used by the emulation
|
||||
void S9xMovieInit ();
|
||||
void S9xMovieShutdown ();
|
||||
void S9xMovieUpdate (bool addFrame=true);
|
||||
void S9xMovieUpdateOnReset ();
|
||||
//bool8 S9xMovieRewind (uint32 at_frame);
|
||||
void S9xMovieFreeze (uint8** buf, uint32* size);
|
||||
int S9xMovieUnfreeze (const uint8* buf, uint32 size);
|
||||
void S9xUpdateFrameCounter (int offset=0);
|
||||
|
||||
// accessor functions
|
||||
bool8 S9xMovieActive ();
|
||||
bool8 S9xMoviePlaying ();
|
||||
bool8 S9xMovieRecording ();
|
||||
// the following accessors return 0/false if !S9xMovieActive()
|
||||
bool8 S9xMovieReadOnly ();
|
||||
uint32 S9xMovieGetId ();
|
||||
uint32 S9xMovieGetLength ();
|
||||
uint32 S9xMovieGetFrameCounter ();
|
||||
uint8 S9xMovieControllers ();
|
||||
|
||||
END_EXTERN_C
|
||||
|
||||
#endif
|
File diff suppressed because it is too large
Load Diff
@ -1,362 +0,0 @@
|
||||
/**********************************************************************************
|
||||
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.
|
||||
**********************************************************************************/
|
||||
|
||||
|
||||
|
||||
|
||||
#ifndef _NETPLAY_H_
|
||||
#define _NETPLAY_H_
|
||||
|
||||
/*
|
||||
* Client to server joypad update
|
||||
*
|
||||
* magic 1
|
||||
* sequence_no 1
|
||||
* opcode 1
|
||||
* joypad data 4
|
||||
*
|
||||
* Server to client joypad update
|
||||
* magic 1
|
||||
* sequence_no 1
|
||||
* opcode 1 + num joypads (top 3 bits)
|
||||
* joypad data 4 * n
|
||||
*/
|
||||
|
||||
//#define NP_DEBUG 1
|
||||
|
||||
#define NP_VERSION 10
|
||||
#define NP_JOYPAD_HIST_SIZE 120
|
||||
#define NP_DEFAULT_PORT 6096
|
||||
|
||||
#define NP_MAX_CLIENTS 8
|
||||
|
||||
#define NP_SERV_MAGIC 'S'
|
||||
#define NP_CLNT_MAGIC 'C'
|
||||
|
||||
#define NP_CLNT_HELLO 0
|
||||
#define NP_CLNT_JOYPAD 1
|
||||
#define NP_CLNT_RESET 2
|
||||
#define NP_CLNT_PAUSE 3
|
||||
#define NP_CLNT_LOAD_ROM 4
|
||||
#define NP_CLNT_ROM_IMAGE 5
|
||||
#define NP_CLNT_FREEZE_FILE 6
|
||||
#define NP_CLNT_SRAM_DATA 7
|
||||
#define NP_CLNT_READY 8
|
||||
#define NP_CLNT_LOADED_ROM 9
|
||||
#define NP_CLNT_RECEIVED_ROM_IMAGE 10
|
||||
#define NP_CLNT_WAITING_FOR_ROM_IMAGE 11
|
||||
|
||||
#define NP_SERV_HELLO 0
|
||||
#define NP_SERV_JOYPAD 1
|
||||
#define NP_SERV_RESET 2
|
||||
#define NP_SERV_PAUSE 3
|
||||
#define NP_SERV_LOAD_ROM 4
|
||||
#define NP_SERV_ROM_IMAGE 5
|
||||
#define NP_SERV_FREEZE_FILE 6
|
||||
#define NP_SERV_SRAM_DATA 7
|
||||
#define NP_SERV_READY 8
|
||||
|
||||
struct SNPClient
|
||||
{
|
||||
volatile uint8 SendSequenceNum;
|
||||
volatile uint8 ReceiveSequenceNum;
|
||||
volatile bool8 Connected;
|
||||
volatile bool8 SaidHello;
|
||||
volatile bool8 Paused;
|
||||
volatile bool8 Ready;
|
||||
int Socket;
|
||||
char *ROMName;
|
||||
char *HostName;
|
||||
char *Who;
|
||||
};
|
||||
|
||||
enum {
|
||||
NP_SERVER_SEND_ROM_IMAGE,
|
||||
NP_SERVER_SYNC_ALL,
|
||||
NP_SERVER_SYNC_CLIENT,
|
||||
NP_SERVER_SEND_FREEZE_FILE_ALL,
|
||||
NP_SERVER_SEND_ROM_LOAD_REQUEST_ALL,
|
||||
NP_SERVER_RESET_ALL,
|
||||
NP_SERVER_SEND_SRAM_ALL,
|
||||
NP_SERVER_SEND_SRAM
|
||||
};
|
||||
|
||||
#define NP_MAX_TASKS 20
|
||||
|
||||
struct NPServerTask
|
||||
{
|
||||
uint32 Task;
|
||||
void *Data;
|
||||
};
|
||||
|
||||
struct SNPServer
|
||||
{
|
||||
struct SNPClient Clients [NP_MAX_CLIENTS];
|
||||
int NumClients;
|
||||
volatile struct NPServerTask TaskQueue [NP_MAX_TASKS];
|
||||
volatile uint32 TaskHead;
|
||||
volatile uint32 TaskTail;
|
||||
int Socket;
|
||||
uint32 FrameTime;
|
||||
uint32 FrameCount;
|
||||
char ROMName [30];
|
||||
uint32 Joypads [NP_MAX_CLIENTS];
|
||||
bool8 ClientPaused;
|
||||
uint32 Paused;
|
||||
bool8 SendROMImageOnConnect;
|
||||
bool8 SyncByReset;
|
||||
};
|
||||
|
||||
#define NP_MAX_ACTION_LEN 200
|
||||
|
||||
struct SNetPlay
|
||||
{
|
||||
volatile uint8 MySequenceNum;
|
||||
volatile uint8 ServerSequenceNum;
|
||||
volatile bool8 Connected;
|
||||
volatile bool8 Abort;
|
||||
volatile uint8 Player;
|
||||
volatile bool8 ClientsReady [NP_MAX_CLIENTS];
|
||||
volatile bool8 ClientsPaused [NP_MAX_CLIENTS];
|
||||
volatile bool8 Paused;
|
||||
volatile bool8 PendingWait4Sync;
|
||||
volatile uint8 PercentageComplete;
|
||||
volatile bool8 Waiting4EmulationThread;
|
||||
volatile bool8 Answer;
|
||||
#ifdef __WIN32__
|
||||
HANDLE ReplyEvent;
|
||||
#endif
|
||||
volatile int Socket;
|
||||
char *ServerHostName;
|
||||
char *ROMName;
|
||||
int Port;
|
||||
volatile uint32 JoypadWriteInd;
|
||||
volatile uint32 JoypadReadInd;
|
||||
uint32 Joypads [NP_JOYPAD_HIST_SIZE][NP_MAX_CLIENTS];
|
||||
uint32 Frame [NP_JOYPAD_HIST_SIZE];
|
||||
uint32 FrameCount;
|
||||
uint32 MaxFrameSkip;
|
||||
uint32 MaxBehindFrameCount;
|
||||
bool8 JoypadsReady [NP_JOYPAD_HIST_SIZE][NP_MAX_CLIENTS];
|
||||
char ActionMsg [NP_MAX_ACTION_LEN];
|
||||
char ErrorMsg [NP_MAX_ACTION_LEN];
|
||||
char WarningMsg [NP_MAX_ACTION_LEN];
|
||||
};
|
||||
|
||||
extern "C" struct SNetPlay NetPlay;
|
||||
|
||||
//
|
||||
// NETPLAY_CLIENT_HELLO message format:
|
||||
// header
|
||||
// frame_time (4)
|
||||
// ROMName (variable)
|
||||
|
||||
#define WRITE_LONG(p, v) { \
|
||||
*((p) + 0) = (uint8) ((v) >> 24); \
|
||||
*((p) + 1) = (uint8) ((v) >> 16); \
|
||||
*((p) + 2) = (uint8) ((v) >> 8); \
|
||||
*((p) + 3) = (uint8) ((v) >> 0); \
|
||||
}
|
||||
|
||||
#define READ_LONG(p) \
|
||||
((((uint8) *((p) + 0)) << 24) | \
|
||||
(((uint8) *((p) + 1)) << 16) | \
|
||||
(((uint8) *((p) + 2)) << 8) | \
|
||||
(((uint8) *((p) + 3)) << 0))
|
||||
|
||||
bool8 S9xNPConnectToServer (const char *server_name, int port,
|
||||
const char *rom_name);
|
||||
bool8 S9xNPWaitForHeartBeat ();
|
||||
bool8 S9xNPWaitForHeartBeatDelay (uint32 time_msec = 0);
|
||||
bool8 S9xNPCheckForHeartBeat (uint32 time_msec = 0);
|
||||
uint32 S9xNPGetJoypad (int which1);
|
||||
bool8 S9xNPSendJoypadUpdate (uint32 joypad);
|
||||
void S9xNPDisconnect ();
|
||||
bool8 S9xNPInitialise ();
|
||||
bool8 S9xNPSendData (int fd, const uint8 *data, int len);
|
||||
bool8 S9xNPGetData (int fd, uint8 *data, int len);
|
||||
|
||||
void S9xNPSyncClients ();
|
||||
void S9xNPStepJoypadHistory ();
|
||||
|
||||
void S9xNPResetJoypadReadPos ();
|
||||
bool8 S9xNPSendReady (uint8 op = NP_CLNT_READY);
|
||||
bool8 S9xNPSendPause (bool8 pause);
|
||||
void S9xNPReset ();
|
||||
void S9xNPSetAction (const char *action, bool8 force = FALSE);
|
||||
void S9xNPSetError (const char *error);
|
||||
void S9xNPSetWarning (const char *warning);
|
||||
void S9xNPDiscardHeartbeats ();
|
||||
void S9xNPServerQueueSendingFreezeFile (const char *filename);
|
||||
void S9xNPServerQueueSyncAll ();
|
||||
void S9xNPServerQueueSendingROMImage ();
|
||||
void S9xNPServerQueueSendingLoadROMRequest (const char *filename);
|
||||
|
||||
void S9xNPServerAddTask (uint32 task, void *data);
|
||||
|
||||
bool8 S9xNPStartServer (int port);
|
||||
void S9xNPStopServer ();
|
||||
#ifdef __WIN32__
|
||||
#define S9xGetMilliTime timeGetTime
|
||||
#else
|
||||
uint32 S9xGetMilliTime ();
|
||||
#endif
|
||||
#endif
|
||||
|
@ -1,481 +0,0 @@
|
||||
/**********************************************************************************
|
||||
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.
|
||||
**********************************************************************************/
|
||||
|
||||
|
||||
|
||||
|
||||
#include "snes9x.h"
|
||||
#include "65c816.h"
|
||||
#include "memmap.h"
|
||||
#include "ppu.h"
|
||||
#include "apu.h"
|
||||
#include "cpuexec.h"
|
||||
#include "sa1.h"
|
||||
|
||||
#ifndef S9xSTREAM
|
||||
#define S9xSTREAM stdout
|
||||
#endif
|
||||
|
||||
#define OFFSET(N,F) \
|
||||
fprintf (S9xSTREAM, "#define " #N " CPU + %d\n", (int) &((struct SCPUState *) 0)->F);
|
||||
#define OFFSET2(N,F) \
|
||||
fprintf (S9xSTREAM, "#define " #N " Registers + %d\n", (int) &((struct SRegisters *) 0)->F);
|
||||
#define OFFSET3(F) \
|
||||
fprintf (S9xSTREAM, "#define " #F " Memory + %d\n", (int) &((class CMemory *) 0)->F);
|
||||
#define OFFSET4(N,F) \
|
||||
fprintf (S9xSTREAM, "#define " #N " APU + %d\n", (int) &((struct SAPU *) 0)->F);
|
||||
#define OFFSET5(N,F) \
|
||||
fprintf (S9xSTREAM, "#define " #N " IAPU + %d\n", (int) &((struct SIAPU *) 0)->F);
|
||||
#define OFFSET6(N,F) \
|
||||
fprintf (S9xSTREAM, "#define " #N " ICPU + %d\n", (int) &((struct SICPU *) 0)->F);
|
||||
#define OFFSET7(N,F) \
|
||||
fprintf (S9xSTREAM, "#define " #N " Settings + %d\n", (int) &((struct SSettings *) 0)->F);
|
||||
#define OFFSET8(N, F) \
|
||||
fprintf (S9xSTREAM, "#define " #N " APURegisters + %d\n", (int) &((struct SAPURegisters *) 0)->F);
|
||||
|
||||
#define OFFSET9(N, F) \
|
||||
fprintf (S9xSTREAM, "#define " #N " PPU + %d\n", (int) &((struct SPPU *) 0)->F);
|
||||
#define OFFSET10(N, F) \
|
||||
fprintf (S9xSTREAM, "#define " #N " IPPU + %d\n", (int) &((struct InternalPPU *) 0)->F);
|
||||
#define OFFSET11(N, F) \
|
||||
fprintf (S9xSTREAM, "#define " #N " SA1 + %d\n", (int) &((struct SSA1 *) 0)->F);
|
||||
#define OFFSET12(N, F) \
|
||||
fprintf (S9xSTREAM, "#define " #N " SA1Registers + %d\n", (int) &((struct SSA1Registers *) 0)->F);
|
||||
|
||||
int main (int /*argc*/, char ** /*argv*/)
|
||||
{
|
||||
OFFSET(Flags,Flags)
|
||||
OFFSET(BranchSkip,BranchSkip)
|
||||
OFFSET(NMIActive,NMIActive)
|
||||
OFFSET(IRQActive,IRQActive)
|
||||
OFFSET(WaitingForInterrupt,WaitingForInterrupt)
|
||||
OFFSET(InDMA,InDMA)
|
||||
OFFSET(InWRAM_DMA,InWRAM_DMA)
|
||||
OFFSET(WhichEvent,WhichEvent)
|
||||
OFFSET(PCBase,PCBase)
|
||||
OFFSET(PBPCAtOpcodeStart,PBPCAtOpcodeStart)
|
||||
OFFSET(WaitAddress,WaitAddress)
|
||||
OFFSET(WaitCounter,WaitCounter)
|
||||
OFFSET(Cycles,Cycles)
|
||||
OFFSET(NextEvent,NextEvent)
|
||||
OFFSET(V_Counter,V_Counter)
|
||||
OFFSET(MemSpeed,MemSpeed)
|
||||
OFFSET(MemSpeedx2,MemSpeedx2)
|
||||
OFFSET(FastROMSpeed,FastROMSpeed)
|
||||
OFFSET(AutoSaveTimer,AutoSaveTimer)
|
||||
OFFSET(SRAMModified,SRAMModified)
|
||||
OFFSET(BRKTriggered,BRKTriggered)
|
||||
OFFSET(TriedInterleavedMode2,TriedInterleavedMode2)
|
||||
|
||||
OFFSET2(DB,DB)
|
||||
OFFSET2(PP,P.W)
|
||||
OFFSET2(PL,P.W)
|
||||
fprintf (S9xSTREAM, "#define PH PL + 1\n");
|
||||
OFFSET2(AA,A.W)
|
||||
OFFSET2(AL,A.W)
|
||||
fprintf (S9xSTREAM, "#define AH AL + 1\n");
|
||||
OFFSET2(DD,D.W)
|
||||
OFFSET2(DL,D.W)
|
||||
fprintf (S9xSTREAM, "#define DH DL + 1\n");
|
||||
OFFSET2(SS,S.W)
|
||||
OFFSET2(SL,S.W)
|
||||
fprintf (S9xSTREAM, "#define SH SL + 1\n");
|
||||
OFFSET2(XX,X.W)
|
||||
OFFSET2(XL,X.W)
|
||||
fprintf (S9xSTREAM, "#define XH XL + 1\n");
|
||||
OFFSET2(YY,Y.W)
|
||||
OFFSET2(YL,Y.W)
|
||||
fprintf (S9xSTREAM, "#define YH YL + 1\n");
|
||||
OFFSET2(PCR,PC.W.xPC)
|
||||
OFFSET2(PB,PC.B.xPB)
|
||||
|
||||
OFFSET3(RAM)
|
||||
OFFSET3(ROM)
|
||||
OFFSET3(VRAM)
|
||||
OFFSET3(SRAM)
|
||||
OFFSET3(BWRAM)
|
||||
OFFSET3(FillRAM)
|
||||
OFFSET3(C4RAM)
|
||||
OFFSET3(HiROM)
|
||||
OFFSET3(LoROM)
|
||||
OFFSET3(SRAMMask)
|
||||
OFFSET3(SRAMSize)
|
||||
OFFSET3(Map)
|
||||
OFFSET3(WriteMap)
|
||||
OFFSET3(MemorySpeed)
|
||||
OFFSET3(BlockIsRAM)
|
||||
OFFSET3(BlockIsROM)
|
||||
OFFSET3(ROMFilename)
|
||||
|
||||
OFFSET5(APUPCS,PC)
|
||||
OFFSET5(APURAM,RAM)
|
||||
OFFSET5(APUExecuting,APUExecuting)
|
||||
OFFSET5(APUDirectPage,DirectPage)
|
||||
OFFSET5(APUBit,Bit)
|
||||
OFFSET5(APUAddress,Address)
|
||||
OFFSET5(APUWaitAddress1,WaitAddress1)
|
||||
OFFSET5(APUWaitAddress2,WaitAddress2)
|
||||
OFFSET5(APUWaitCounter,WaitCounter)
|
||||
OFFSET5(APUShadowRAM,ShadowRAM)
|
||||
OFFSET5(APUCachedSamples,CachedSamples)
|
||||
OFFSET5(APU_Carry,_Carry)
|
||||
OFFSET5(APU_Zero,_Zero)
|
||||
OFFSET5(APU_Overflow,_Overflow)
|
||||
OFFSET5(APUTimerErrorCounter,TimerErrorCounter)
|
||||
OFFSET5(NextAPUTimerPos,NextAPUTimerPos)
|
||||
|
||||
OFFSET4(APUCycles,Cycles)
|
||||
OFFSET4(APUShowROM,ShowROM)
|
||||
OFFSET4(APUFlags,Flags)
|
||||
OFFSET4(APUKeyedChannels,KeyedChannels)
|
||||
OFFSET4(APUOutPorts,OutPorts)
|
||||
OFFSET4(APUDSP,DSP)
|
||||
OFFSET4(APUExtraRAM,ExtraRAM)
|
||||
OFFSET4(APUTimer,Timer)
|
||||
OFFSET4(APUTimerTarget,TimerTarget)
|
||||
OFFSET4(APUTimerEnabled,TimerEnabled)
|
||||
OFFSET4(TimerValueWritten,TimerValueWritten)
|
||||
|
||||
OFFSET6(CPUSpeed,Speed)
|
||||
OFFSET6(CPUOpcodes,S9xOpcodes)
|
||||
OFFSET6(_Carry,_Carry)
|
||||
OFFSET6(_Zero,_Zero)
|
||||
OFFSET6(_Negative,_Negative)
|
||||
OFFSET6(_Overflow,_Overflow)
|
||||
OFFSET6(ShiftedDB,ShiftedDB)
|
||||
OFFSET6(ShiftedPB,ShiftedPB)
|
||||
OFFSET6(CPUExecuting,CPUExecuting)
|
||||
OFFSET6(Scanline,Scanline)
|
||||
OFFSET6(Frame,Frame)
|
||||
|
||||
OFFSET7(APUEnabled,APUEnabled)
|
||||
OFFSET7(Shutdown,Shutdown)
|
||||
OFFSET7(SoundSkipMethod,SoundSkipMethod)
|
||||
OFFSET7(HDMATimingHack,HDMATimingHack)
|
||||
OFFSET7(DisableIRQ,DisableIRQ)
|
||||
OFFSET7(Paused,Paused)
|
||||
OFFSET7(PAL,PAL)
|
||||
OFFSET7(SoundSync,SoundSync)
|
||||
OFFSET7(SA1Enabled,SA1)
|
||||
OFFSET7(SuperFXEnabled,SuperFX)
|
||||
|
||||
OFFSET8(ApuP,P)
|
||||
OFFSET8(ApuYA,YA.W)
|
||||
OFFSET8(ApuA,YA.B.A)
|
||||
OFFSET8(ApuY,YA.B.Y)
|
||||
OFFSET8(ApuX,X)
|
||||
OFFSET8(ApuS,S)
|
||||
OFFSET8(ApuPC,PC)
|
||||
OFFSET8(APUPCR,PC)
|
||||
|
||||
OFFSET9(BGMode,BGMode)
|
||||
OFFSET9(BG3Priority,BG3Priority)
|
||||
OFFSET9(Brightness,Brightness)
|
||||
OFFSET9(GHight,VMA.High)
|
||||
OFFSET9(GInc,VMA.Increment)
|
||||
OFFSET9(GAddress,VMA.Address)
|
||||
OFFSET9(GMask1,VMA.Mask1)
|
||||
OFFSET9(GFullGraphicCount,VMA.FullGraphicCount)
|
||||
OFFSET9(GShift,VMA.Shift)
|
||||
OFFSET9(CGFLIP,CGFLIP)
|
||||
OFFSET9(CGDATA,CGDATA)
|
||||
OFFSET9(FirstSprite,FirstSprite)
|
||||
OFFSET9(LastSprite,LastSprite)
|
||||
OFFSET9(OBJ,OBJ)
|
||||
OFFSET9(OAMPriorityRotation,OAMPriorityRotation)
|
||||
OFFSET9(OAMAddr,OAMAddr)
|
||||
OFFSET9(OAMFlip,OAMFlip)
|
||||
OFFSET9(OAMTileAddress,OAMTileAddress)
|
||||
OFFSET9(IRQVBeamPos,IRQVBeamPos)
|
||||
OFFSET9(IRQHBeamPos,IRQHBeamPos)
|
||||
OFFSET9(VBeamPosLatched,VBeamPosLatched)
|
||||
OFFSET9(HBeamPosLatched,HBeamPosLatched)
|
||||
OFFSET9(HBeamFlip,HBeamFlip)
|
||||
OFFSET9(VBeamFlip,VBeamFlip)
|
||||
OFFSET9(HVBeamCounterLatched,HVBeamCounterLatched)
|
||||
OFFSET9(MatrixA,MatrixA)
|
||||
OFFSET9(MatrixB,MatrixB)
|
||||
OFFSET9(MatrixC,MatrixC)
|
||||
OFFSET9(MatrixD,MatrixD)
|
||||
OFFSET9(CentreX,CentreX)
|
||||
OFFSET9(CentreY,CentreY)
|
||||
OFFSET9(CGADD,CGADD)
|
||||
OFFSET9(FixedColourGreen,FixedColourGreen)
|
||||
OFFSET9(FixedColourRed,FixedColourRed)
|
||||
OFFSET9(FixedColourBlue,FixedColourBlue)
|
||||
OFFSET9(SavedOAMAddr,SavedOAMAddr)
|
||||
OFFSET9(ScreenHeight,ScreenHeight)
|
||||
OFFSET9(WRAM,WRAM)
|
||||
OFFSET9(BG_Forced,BG_Forced)
|
||||
OFFSET9(ForcedBlanking,ForcedBlanking)
|
||||
OFFSET9(OBJThroughMain,OBJThroughMain)
|
||||
OFFSET9(OBJThroughSub,OBJThroughSub)
|
||||
OFFSET9(OBJSizeSelect,OBJSizeSelect)
|
||||
OFFSET9(OBJNameBase,OBJNameBase)
|
||||
OFFSET9(OAMReadFlip,OAMReadFlip)
|
||||
OFFSET9(OAMData,OAMData)
|
||||
OFFSET9(VTimerEnabled,VTimerEnabled)
|
||||
OFFSET9(HTimerEnabled,HTimerEnabled)
|
||||
OFFSET9(HTimerPosition,HTimerPosition)
|
||||
OFFSET9(Mosaic,Mosaic)
|
||||
OFFSET9(BGMosaic,BGMosaic)
|
||||
OFFSET9(Mode7HFlip,Mode7HFlip)
|
||||
OFFSET9(Mode7VFlip,Mode7VFlip)
|
||||
OFFSET9(Mode7Repeat,Mode7Repeat)
|
||||
OFFSET9(Window1Left,Window1Left)
|
||||
OFFSET9(Window1Right,Window1Right)
|
||||
OFFSET9(Window2Left,Window2Left)
|
||||
OFFSET9(Window2Right,Window2Right)
|
||||
OFFSET9(ClipWindowOverlapLogic,ClipWindowOverlapLogic)
|
||||
OFFSET9(ClipWindow1Enable,ClipWindow1Enable)
|
||||
OFFSET9(ClipWindow2Enable,ClipWindow2Enable)
|
||||
OFFSET9(ClipWindow1Inside,ClipWindow1Inside)
|
||||
OFFSET9(ClipWindow2Inside,ClipWindow2Inside)
|
||||
OFFSET9(RecomputeClipWindows,RecomputeClipWindows)
|
||||
OFFSET9(CGFLIPRead,CGFLIPRead)
|
||||
OFFSET9(OBJNameSelect,OBJNameSelect)
|
||||
OFFSET9(Need16x8Mulitply,Need16x8Mulitply)
|
||||
OFFSET9(RangeTimeOver,RangeTimeOver)
|
||||
|
||||
OFFSET10(ColorsChanged,ColorsChanged)
|
||||
OFFSET10(HDMA,HDMA)
|
||||
OFFSET10(HDMAStarted,HDMAStarted)
|
||||
OFFSET10(MaxBrightness,MaxBrightness)
|
||||
OFFSET10(LatchedBlanking,LatchedBlanking)
|
||||
OFFSET10(OBJChanged,OBJChanged)
|
||||
OFFSET10(RenderThisFrame,RenderThisFrame)
|
||||
OFFSET10(SkippedFrames,SkippedFrames)
|
||||
OFFSET10(FrameSkip,FrameSkip)
|
||||
OFFSET10(TileCache,TileCache)
|
||||
OFFSET10(TileCached,TileCached)
|
||||
#ifdef CORRECT_VRAM_READS
|
||||
OFFSET10(VRAMReadBuffer,VRAMReadBuffer)
|
||||
#else
|
||||
OFFSET10(FirstVRAMRead,FirstVRAMRead)
|
||||
#endif
|
||||
OFFSET10(Interlace,Interlace)
|
||||
OFFSET10(DoubleWidthPixels,DoubleWidthPixels)
|
||||
OFFSET10(RenderedScreenHeight,RenderedScreenHeight)
|
||||
OFFSET10(RenderedScreenWidth,RenderedScreenWidth)
|
||||
OFFSET10(Red,Red)
|
||||
OFFSET10(Green,Green)
|
||||
OFFSET10(Blue,Blue)
|
||||
OFFSET10(XB,XB)
|
||||
OFFSET10(ScreenColors,ScreenColors)
|
||||
OFFSET10(PreviousLine,PreviousLine)
|
||||
OFFSET10(CurrentLine,CurrentLine)
|
||||
OFFSET10(Clip,Clip)
|
||||
|
||||
OFFSET11(SA1Opcodes,S9xOpcodes)
|
||||
OFFSET11(SA1_Carry,_Carry)
|
||||
OFFSET11(SA1_Zero,_Zero)
|
||||
OFFSET11(SA1_Negative,_Negative)
|
||||
OFFSET11(SA1_Overflow,_Overflow)
|
||||
OFFSET11(SA1CPUExecuting,CPUExecuting)
|
||||
OFFSET11(SA1ShiftedPB,ShiftedPB)
|
||||
OFFSET11(SA1ShiftedDB,ShiftedDB)
|
||||
OFFSET11(SA1Flags,Flags)
|
||||
OFFSET11(SA1Executing,Executing)
|
||||
OFFSET11(SA1NMIActive,NMIActive)
|
||||
OFFSET11(SA1IRQActive,IRQActive)
|
||||
OFFSET11(SA1WaitingForInterrupt,WaitingForInterrupt)
|
||||
OFFSET11(SA1PCBase,PCBase)
|
||||
OFFSET11(SA1PBPCAtOpcodeStart,PBPCAtOpcodeStart)
|
||||
OFFSET11(SA1WaitAddress,WaitAddress)
|
||||
OFFSET11(SA1WaitCounter,WaitCounter)
|
||||
OFFSET11(SA1WaitByteAddress1,WaitByteAddress1)
|
||||
OFFSET11(SA1WaitByteAddress2,WaitByteAddress2)
|
||||
OFFSET11(SA1BWRAM,BWRAM)
|
||||
OFFSET11(SA1Map,Map)
|
||||
OFFSET11(SA1WriteMap,WriteMap)
|
||||
OFFSET11(SA1op1,op1)
|
||||
OFFSET11(SA1op2,op2)
|
||||
OFFSET11(SA1arithmetic_op,arithmetic_op)
|
||||
OFFSET11(SA1sum,sum)
|
||||
OFFSET11(SA1overflow,overflow)
|
||||
OFFSET11(VirtualBitmapFormat,VirtualBitmapFormat)
|
||||
OFFSET11(SA1_in_char_dma,in_char_dma)
|
||||
OFFSET11(SA1variable_bit_pos,variable_bit_pos)
|
||||
|
||||
OFFSET12(SA1DB,DB)
|
||||
OFFSET12(SA1PP,P.W)
|
||||
OFFSET12(SA1PL,P.W)
|
||||
fprintf (S9xSTREAM, "#define SA1PH SA1PL + 1\n");
|
||||
OFFSET12(SA1AA,A.W)
|
||||
OFFSET12(SA1AL,A.W)
|
||||
fprintf (S9xSTREAM, "#define SA1AH SA1AL + 1\n");
|
||||
OFFSET12(SA1DD,D.W)
|
||||
OFFSET12(SA1DL,D.W)
|
||||
fprintf (S9xSTREAM, "#define SA1DH SA1DL + 1\n");
|
||||
OFFSET12(SA1SS,S.W)
|
||||
OFFSET12(SA1SL,S.W)
|
||||
fprintf (S9xSTREAM, "#define SA1SH SA1SL + 1\n");
|
||||
OFFSET12(SA1XX,X.W)
|
||||
OFFSET12(SA1XL,X.W)
|
||||
fprintf (S9xSTREAM, "#define SA1XH SA1XL + 1\n");
|
||||
OFFSET12(SA1YY,Y.W)
|
||||
OFFSET12(SA1YL,Y.W)
|
||||
fprintf (S9xSTREAM, "#define SA1YH SA1YL + 1\n");
|
||||
OFFSET12(SA1PB,PC.B.xPB)
|
||||
OFFSET12(SA1PCR,PC.W.xPC)
|
||||
|
||||
return (0);
|
||||
}
|
||||
|
@ -1,289 +0,0 @@
|
||||
/**********************************************************************************
|
||||
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.
|
||||
**********************************************************************************/
|
||||
|
||||
|
||||
|
||||
// Abstract the details of reading from zip files versus FILE *'s.
|
||||
|
||||
#include "reader.h"
|
||||
#include <string.h>
|
||||
|
||||
|
||||
// Generic constructor/destructor
|
||||
|
||||
Reader::Reader(void){}
|
||||
|
||||
Reader::~Reader(){}
|
||||
|
||||
|
||||
// Generic getline function, based on gets. Reimlpement if you can do better.
|
||||
|
||||
char *Reader::getline(void){
|
||||
bool eof;
|
||||
std::string ret;
|
||||
ret=getline(eof);
|
||||
if(ret.size()==0 && eof) return NULL;
|
||||
return strdup(ret.c_str());
|
||||
}
|
||||
|
||||
std::string Reader::getline(bool &eof){
|
||||
char buf[1024];
|
||||
std::string ret;
|
||||
|
||||
eof=false;
|
||||
ret.clear();
|
||||
do {
|
||||
if(gets(buf, sizeof(buf))==NULL){
|
||||
eof=true;
|
||||
break;
|
||||
}
|
||||
ret.append(buf);
|
||||
} while(*ret.rbegin()!='\n');
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
// snes9x.h STREAM reader
|
||||
|
||||
fReader::fReader(STREAM f){
|
||||
fp=f;
|
||||
}
|
||||
|
||||
fReader::~fReader(void){}
|
||||
|
||||
int fReader::get_char(){
|
||||
return GETC_STREAM(fp);
|
||||
}
|
||||
|
||||
char *fReader::gets(char *buf, size_t len){
|
||||
return GETS_STREAM(buf, len, fp);
|
||||
}
|
||||
|
||||
size_t fReader::read(char *buf, size_t len){
|
||||
return READ_STREAM(buf, len, fp);
|
||||
}
|
||||
|
||||
|
||||
// unzip reader
|
||||
#ifdef UNZIP_SUPPORT
|
||||
|
||||
unzReader::unzReader(unzFile &v){
|
||||
file=v;
|
||||
head=NULL;
|
||||
numbytes=0;
|
||||
}
|
||||
|
||||
unzReader::~unzReader(void){}
|
||||
|
||||
int unzReader::get_char(){
|
||||
unsigned char c;
|
||||
|
||||
if(numbytes<=0){
|
||||
numbytes=unzReadCurrentFile(file, buffer, unz_BUFFSIZ);
|
||||
if(numbytes<=0) return (EOF);
|
||||
head=buffer;
|
||||
}
|
||||
|
||||
c=*head;
|
||||
head++;
|
||||
numbytes--;
|
||||
return (int) c;
|
||||
}
|
||||
|
||||
char *unzReader::gets(char *buf, size_t len){
|
||||
size_t i;
|
||||
int c;
|
||||
|
||||
for(i=0; i<len-1; i++){
|
||||
c=get_char();
|
||||
if(c==(EOF)){
|
||||
if(i==0) return NULL;
|
||||
break;
|
||||
}
|
||||
|
||||
buf[i]=(char)c;
|
||||
if(buf[i]=='\n') break;
|
||||
}
|
||||
buf[i]='\0';
|
||||
return buf;
|
||||
}
|
||||
|
||||
size_t unzReader::read(char *buf, size_t len){
|
||||
if(len==0) return len;
|
||||
|
||||
if(len<=numbytes){
|
||||
memcpy(buf, head, len);
|
||||
numbytes-=len;
|
||||
head+=len;
|
||||
return len;
|
||||
}
|
||||
|
||||
size_t numread=0;
|
||||
if(numbytes>0){
|
||||
memcpy(buf, head, numbytes);
|
||||
numread+=numbytes;
|
||||
head=NULL;
|
||||
numbytes=0;
|
||||
}
|
||||
int l=unzReadCurrentFile(file, buf+numread, len-numread);
|
||||
if(l>0) numread+=l;
|
||||
return numread;
|
||||
}
|
||||
#endif
|
@ -1,215 +0,0 @@
|
||||
/**********************************************************************************
|
||||
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.
|
||||
**********************************************************************************/
|
||||
|
||||
|
||||
|
||||
// Abstract the details of reading from zip files versus FILE *'s.
|
||||
|
||||
#ifndef _READER_H_
|
||||
#define _READER_H_
|
||||
|
||||
#include <stdio.h>
|
||||
#include <string>
|
||||
|
||||
#include "snes9x.h"
|
||||
|
||||
class Reader {
|
||||
public:
|
||||
Reader(void);
|
||||
virtual ~Reader();
|
||||
virtual int get_char() = 0;
|
||||
virtual char *gets(char *buf, size_t len) = 0;
|
||||
virtual char *getline(void); // free() when done
|
||||
virtual std::string getline(bool &eof);
|
||||
virtual size_t read(char *buf, size_t len) = 0;
|
||||
};
|
||||
|
||||
class fReader : public Reader {
|
||||
public:
|
||||
fReader(STREAM fp);
|
||||
virtual ~fReader(void);
|
||||
virtual int get_char();
|
||||
virtual char *gets(char *buf, size_t len);
|
||||
virtual size_t read(char *buf, size_t len);
|
||||
private:
|
||||
STREAM fp;
|
||||
};
|
||||
|
||||
#ifdef UNZIP_SUPPORT
|
||||
#include "unzip/unzip.h"
|
||||
|
||||
#define unz_BUFFSIZ 1024
|
||||
|
||||
class unzReader : public Reader {
|
||||
public:
|
||||
unzReader(unzFile &v);
|
||||
virtual ~unzReader(void);
|
||||
virtual int get_char();
|
||||
virtual char *gets(char *buf, size_t len);
|
||||
virtual size_t read(char *buf, size_t len);
|
||||
private:
|
||||
unzFile file;
|
||||
char buffer[unz_BUFFSIZ];
|
||||
char *head;
|
||||
size_t numbytes;
|
||||
};
|
||||
#endif
|
||||
|
||||
#endif /* ndef _READER_H_ */
|
@ -1,304 +0,0 @@
|
||||
/**********************************************************************************
|
||||
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.
|
||||
**********************************************************************************/
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include <config.h>
|
||||
#endif
|
||||
#include <stdio.h>
|
||||
|
||||
#ifndef __WIN32__
|
||||
#include <unistd.h>
|
||||
#else
|
||||
#include <direct.h>
|
||||
#endif
|
||||
#include <string.h>
|
||||
#include <fcntl.h>
|
||||
|
||||
#ifdef HAVE_LIBPNG
|
||||
#include <png.h>
|
||||
#endif
|
||||
|
||||
#include "snes9x.h"
|
||||
#include "memmap.h"
|
||||
#include "display.h"
|
||||
#include "gfx.h"
|
||||
#include "ppu.h"
|
||||
#include "screenshot.h"
|
||||
|
||||
#define ShowFailure() S9xSetInfoString("Failed to take screenshot.")
|
||||
|
||||
bool8 S9xDoScreenshot(int width, int height)
|
||||
{
|
||||
#ifdef HAVE_LIBPNG
|
||||
FILE *fp;
|
||||
png_structp png_ptr;
|
||||
png_infop info_ptr;
|
||||
png_color_8 sig_bit;
|
||||
int imgwidth;
|
||||
int imgheight;
|
||||
const char *fname=S9xGetFilenameInc(".png", SCREENSHOT_DIR);
|
||||
|
||||
Settings.TakeScreenshot=FALSE;
|
||||
|
||||
if((fp=fopen(fname, "wb"))==NULL){
|
||||
ShowFailure();
|
||||
perror("Screenshot failed");
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
png_ptr=png_create_write_struct(PNG_LIBPNG_VER_STRING, NULL, NULL, NULL);
|
||||
if(!png_ptr){
|
||||
fclose(fp);
|
||||
unlink(fname);
|
||||
ShowFailure();
|
||||
return FALSE;
|
||||
}
|
||||
info_ptr=png_create_info_struct(png_ptr);
|
||||
if(!info_ptr){
|
||||
png_destroy_write_struct(&png_ptr, (png_infopp)NULL);
|
||||
fclose(fp);
|
||||
unlink(fname);
|
||||
ShowFailure();
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if(setjmp(png_jmpbuf(png_ptr))){
|
||||
perror("Screenshot: setjmp");
|
||||
png_destroy_write_struct(&png_ptr, &info_ptr);
|
||||
fclose(fp);
|
||||
unlink(fname);
|
||||
ShowFailure();
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
imgwidth=width;
|
||||
imgheight=height;
|
||||
if(Settings.StretchScreenshots==1){
|
||||
if(width<=256 && height>SNES_HEIGHT_EXTENDED) imgwidth=width<<1;
|
||||
if(width>256 && height<=SNES_HEIGHT_EXTENDED) imgheight=height<<1;
|
||||
} else if(Settings.StretchScreenshots==2){
|
||||
if(width<=256) imgwidth=width<<1;
|
||||
if(height<=SNES_HEIGHT_EXTENDED) imgheight=height<<1;
|
||||
}
|
||||
|
||||
png_init_io(png_ptr, fp);
|
||||
png_set_IHDR(png_ptr, info_ptr, imgwidth, imgheight, 8, PNG_COLOR_TYPE_RGB,
|
||||
PNG_INTERLACE_NONE, PNG_COMPRESSION_TYPE_DEFAULT,
|
||||
PNG_FILTER_TYPE_DEFAULT);
|
||||
|
||||
/* 5 bits per color */
|
||||
sig_bit.red=5;
|
||||
sig_bit.green=5;
|
||||
sig_bit.blue=5;
|
||||
png_set_sBIT(png_ptr, info_ptr, &sig_bit);
|
||||
png_set_shift(png_ptr, &sig_bit);
|
||||
|
||||
png_write_info(png_ptr, info_ptr);
|
||||
|
||||
png_set_packing(png_ptr);
|
||||
|
||||
png_byte *row_pointer=new png_byte [png_get_rowbytes(png_ptr, info_ptr)];
|
||||
uint16 *screen=GFX.Screen;
|
||||
for(int y=0; y<height; y++, screen+=GFX.RealPPL){
|
||||
png_byte *rowpix = row_pointer;
|
||||
for(int x=0; x<width; x++){
|
||||
uint32 r, g, b;
|
||||
DECOMPOSE_PIXEL(screen[x], r, g, b);
|
||||
*(rowpix++) = r;
|
||||
*(rowpix++) = g;
|
||||
*(rowpix++) = b;
|
||||
if(imgwidth!=width){
|
||||
*(rowpix++) = r;
|
||||
*(rowpix++) = g;
|
||||
*(rowpix++) = b;
|
||||
}
|
||||
}
|
||||
png_write_row(png_ptr, row_pointer);
|
||||
if(imgheight!=height)
|
||||
png_write_row(png_ptr, row_pointer);
|
||||
}
|
||||
|
||||
delete [] row_pointer;
|
||||
|
||||
png_write_end(png_ptr, info_ptr);
|
||||
png_destroy_write_struct(&png_ptr, &info_ptr);
|
||||
|
||||
fclose(fp);
|
||||
fprintf(stderr, "%s saved.\n", fname);
|
||||
|
||||
{
|
||||
static char str [64];
|
||||
sprintf(str, "Saved screenshot %s", fname + strlen(fname)-7);
|
||||
str[strlen(str)-3] = '\0';
|
||||
S9xSetInfoString(str);
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
#else
|
||||
Settings.TakeScreenshot=FALSE;
|
||||
fprintf(stderr, "Screenshot support not available (libpng was not found at build time)\n");
|
||||
return FALSE;
|
||||
#endif
|
||||
}
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -1,536 +0,0 @@
|
||||
/**********************************************************************************
|
||||
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.
|
||||
**********************************************************************************/
|
||||
|
||||
|
||||
|
||||
#include <string.h>
|
||||
#ifdef HAVE_STRINGS_H
|
||||
#include <strings.h>
|
||||
#endif
|
||||
#include <ctype.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#if defined(__unix) || defined(__linux) || defined(__sun) || defined(__DJGPP)
|
||||
#include <unistd.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
#endif
|
||||
|
||||
#include "snapshot.h"
|
||||
#include "snaporig.h"
|
||||
#include "memmap.h"
|
||||
#include "snes9x.h"
|
||||
#include "65c816.h"
|
||||
#include "ppu.h"
|
||||
#include "cpuexec.h"
|
||||
#include "display.h"
|
||||
#include "apu.h"
|
||||
#include "soundux.h"
|
||||
|
||||
#undef TransferBytes
|
||||
#undef IndirectAddress
|
||||
|
||||
struct SOrigPPU OrigPPU;
|
||||
struct SOrigDMA OrigDMA [8];
|
||||
struct SOrigRegisters OrigRegisters;
|
||||
struct SOrigCPUState OrigCPU;
|
||||
struct SOrigAPU OrigAPU;
|
||||
SOrigSoundData OrigSoundData;
|
||||
struct SOrigAPURegisters OrigAPURegisters;
|
||||
char ROMFilename [1025];
|
||||
|
||||
static int ReadOrigSnapshot (STREAM);
|
||||
|
||||
bool8 S9xLoadOrigSnapshot (const char *filename)
|
||||
{
|
||||
STREAM snapshot = NULL;
|
||||
if (S9xOpenSnapshotFile (filename, TRUE, &snapshot))
|
||||
{
|
||||
int result;
|
||||
if ((result = ReadOrigSnapshot (snapshot)) != SUCCESS)
|
||||
{
|
||||
S9xCloseSnapshotFile (snapshot);
|
||||
return (FALSE);
|
||||
}
|
||||
S9xCloseSnapshotFile (snapshot);
|
||||
return (TRUE);
|
||||
}
|
||||
return (FALSE);
|
||||
}
|
||||
|
||||
static int ReadBlock (const char *key, void *block, int max_len, STREAM snap)
|
||||
{
|
||||
char buffer [20];
|
||||
int len = 0;
|
||||
int rem = 0;
|
||||
|
||||
if (READ_STREAM (buffer, 11, snap) != 11 ||
|
||||
strncmp (buffer, key, 4) != 0 ||
|
||||
(len = atoi (&buffer [4])) == 0)
|
||||
return (WRONG_FORMAT);
|
||||
|
||||
if (len > max_len)
|
||||
{
|
||||
rem = len - max_len;
|
||||
len = max_len;
|
||||
}
|
||||
if (READ_STREAM (block, len, snap) != len)
|
||||
return (WRONG_FORMAT);
|
||||
|
||||
if (rem)
|
||||
{
|
||||
char *junk = new char [rem];
|
||||
READ_STREAM (junk, rem, snap);
|
||||
delete[] junk;
|
||||
}
|
||||
|
||||
return (SUCCESS);
|
||||
}
|
||||
|
||||
static int ReadOrigSnapshot (STREAM snap)
|
||||
{
|
||||
char buffer [_MAX_PATH];
|
||||
char rom_filename [_MAX_PATH];
|
||||
int result;
|
||||
int i;
|
||||
int j;
|
||||
|
||||
int version;
|
||||
int len = strlen (ORIG_SNAPSHOT_MAGIC) + 1 + 4 + 1;
|
||||
if (READ_STREAM (buffer, len, snap) != len)
|
||||
return (WRONG_FORMAT);
|
||||
if (strncmp (buffer, ORIG_SNAPSHOT_MAGIC, strlen (ORIG_SNAPSHOT_MAGIC)) != 0)
|
||||
return (WRONG_FORMAT);
|
||||
if ((version = atoi (&buffer [strlen (SNAPSHOT_MAGIC) + 1])) > ORIG_SNAPSHOT_VERSION)
|
||||
return (WRONG_VERSION);
|
||||
|
||||
if ((result = ReadBlock ("NAM:", rom_filename, _MAX_PATH, snap)) != SUCCESS)
|
||||
return (result);
|
||||
|
||||
if ((result = ReadBlock ("HiR:", buffer, 0x41, snap)) != SUCCESS)
|
||||
return (result);
|
||||
|
||||
if (strcasecmp (rom_filename, Memory.ROMFilename) != 0 &&
|
||||
strcasecmp (S9xBasename (rom_filename), S9xBasename (Memory.ROMFilename)) != 0)
|
||||
{
|
||||
S9xMessage (S9X_WARNING, S9X_FREEZE_ROM_NAME,
|
||||
"Current loaded ROM image doesn't match that required by freeze-game file.");
|
||||
}
|
||||
|
||||
S9xReset ();
|
||||
S9xSetSoundMute (TRUE);
|
||||
if ((result = ReadBlock ("CPU:", &OrigCPU, sizeof (OrigCPU), snap)) != SUCCESS)
|
||||
return (result);
|
||||
OrigCPU.FastROMSpeed = OrigCPU.FastROMSpeed_old;
|
||||
Memory.FixROMSpeed ();
|
||||
if (version == 3)
|
||||
{
|
||||
OrigCPU.Cycles = OrigCPU.Cycles_old;
|
||||
OrigCPU.NextEvent = OrigCPU.NextEvent_old;
|
||||
OrigCPU.V_Counter = OrigCPU.V_Counter_old;
|
||||
OrigCPU.MemSpeed = OrigCPU.MemSpeed_old;
|
||||
OrigCPU.MemSpeedx2 = OrigCPU.MemSpeedx2_old;
|
||||
OrigCPU.FastROMSpeed = OrigCPU.FastROMSpeed_old;
|
||||
}
|
||||
CPU.Flags = OrigCPU.Flags;
|
||||
CPU.BranchSkip = OrigCPU.BranchSkip;
|
||||
CPU.NMIActive = OrigCPU.NMIActive;
|
||||
CPU.IRQActive = OrigCPU.IRQActive;
|
||||
CPU.WaitingForInterrupt = OrigCPU.WaitingForInterrupt;
|
||||
CPU.WhichEvent = OrigCPU.WhichEvent;
|
||||
CPU.Cycles = OrigCPU.Cycles;
|
||||
CPU.NextEvent = OrigCPU.NextEvent;
|
||||
CPU.V_Counter = OrigCPU.V_Counter;
|
||||
CPU.MemSpeed = OrigCPU.MemSpeed;
|
||||
CPU.MemSpeedx2 = OrigCPU.MemSpeedx2;
|
||||
CPU.FastROMSpeed = OrigCPU.FastROMSpeed;
|
||||
|
||||
if ((result = ReadBlock ("REG:", &OrigRegisters, sizeof (OrigRegisters), snap)) != SUCCESS)
|
||||
return (result);
|
||||
|
||||
Registers = *(struct SRegisters *) &OrigRegisters;
|
||||
|
||||
if ((result = ReadBlock ("PPU:", &OrigPPU, sizeof (OrigPPU), snap)) != SUCCESS)
|
||||
return (result);
|
||||
|
||||
if (version == 2)
|
||||
{
|
||||
OrigPPU.OBJNameSelect = OrigPPU.OBJNameSelect_old << 13;
|
||||
OrigPPU.OBJNameBase <<= 1;
|
||||
OrigPPU.OBJNameSelect <<= 13;
|
||||
}
|
||||
PPU.BGMode = OrigPPU.BGMode;
|
||||
PPU.BG3Priority = OrigPPU.BG3Priority;
|
||||
PPU.Brightness = OrigPPU.Brightness;
|
||||
|
||||
PPU.VMA.High = OrigPPU.VMA.High;
|
||||
PPU.VMA.Increment = OrigPPU.VMA.Increment;
|
||||
PPU.VMA.Address = OrigPPU.VMA.Address;
|
||||
PPU.VMA.Mask1 = OrigPPU.VMA.Mask1;
|
||||
PPU.VMA.FullGraphicCount = OrigPPU.VMA.FullGraphicCount;
|
||||
PPU.VMA.Shift = OrigPPU.VMA.Shift;
|
||||
|
||||
for (i = 0; i < 4; i++)
|
||||
{
|
||||
PPU.BG[i].SCBase = OrigPPU.BG[i].SCBase;
|
||||
PPU.BG[i].VOffset = OrigPPU.BG[i].VOffset;
|
||||
PPU.BG[i].HOffset = OrigPPU.BG[i].HOffset;
|
||||
PPU.BG[i].BGSize = OrigPPU.BG[i].BGSize;
|
||||
PPU.BG[i].NameBase = OrigPPU.BG[i].NameBase;
|
||||
PPU.BG[i].SCSize = OrigPPU.BG[i].SCSize;
|
||||
}
|
||||
|
||||
PPU.CGFLIP = OrigPPU.CGFLIP;
|
||||
for (i = 0; i < 256; i++)
|
||||
PPU.CGDATA [i] = OrigPPU.CGDATA [i];
|
||||
PPU.FirstSprite = OrigPPU.FirstSprite;
|
||||
for (i = 0; i < 128; i++)
|
||||
{
|
||||
PPU.OBJ[i].HPos = OrigPPU.OBJ [i].HPos;
|
||||
PPU.OBJ[i].VPos = OrigPPU.OBJ [i].VPos;
|
||||
PPU.OBJ[i].Name = OrigPPU.OBJ [i].Name;
|
||||
PPU.OBJ[i].VFlip = OrigPPU.OBJ [i].VFlip;
|
||||
PPU.OBJ[i].HFlip = OrigPPU.OBJ [i].HFlip;
|
||||
PPU.OBJ[i].Priority = OrigPPU.OBJ [i].Priority;
|
||||
PPU.OBJ[i].Palette = OrigPPU.OBJ [i].Palette;
|
||||
PPU.OBJ[i].Size = OrigPPU.OBJ [i].Size;
|
||||
}
|
||||
PPU.OAMPriorityRotation = OrigPPU.OAMPriorityRotation;
|
||||
PPU.OAMAddr = OrigPPU.OAMAddr;
|
||||
|
||||
PPU.OAMFlip = OrigPPU.OAMFlip;
|
||||
PPU.OAMTileAddress = OrigPPU.OAMTileAddress;
|
||||
PPU.IRQVBeamPos = OrigPPU.IRQVBeamPos;
|
||||
PPU.IRQHBeamPos = OrigPPU.IRQHBeamPos;
|
||||
PPU.VBeamPosLatched = OrigPPU.VBeamPosLatched;
|
||||
PPU.HBeamPosLatched = OrigPPU.HBeamPosLatched;
|
||||
|
||||
PPU.HBeamFlip = OrigPPU.HBeamFlip;
|
||||
PPU.VBeamFlip = OrigPPU.VBeamFlip;
|
||||
PPU.HVBeamCounterLatched = OrigPPU.HVBeamCounterLatched;
|
||||
|
||||
PPU.MatrixA = OrigPPU.MatrixA;
|
||||
PPU.MatrixB = OrigPPU.MatrixB;
|
||||
PPU.MatrixC = OrigPPU.MatrixC;
|
||||
PPU.MatrixD = OrigPPU.MatrixD;
|
||||
PPU.CentreX = OrigPPU.CentreX;
|
||||
PPU.CentreY = OrigPPU.CentreY;
|
||||
|
||||
PPU.CGADD = OrigPPU.CGADD;
|
||||
PPU.FixedColourRed = OrigPPU.FixedColourRed;
|
||||
PPU.FixedColourGreen = OrigPPU.FixedColourGreen;
|
||||
PPU.FixedColourBlue = OrigPPU.FixedColourBlue;
|
||||
PPU.SavedOAMAddr = OrigPPU.SavedOAMAddr;
|
||||
PPU.ScreenHeight = OrigPPU.ScreenHeight;
|
||||
PPU.WRAM = OrigPPU.WRAM;
|
||||
PPU.ForcedBlanking = OrigPPU.ForcedBlanking;
|
||||
PPU.OBJNameSelect = OrigPPU.OBJNameSelect;
|
||||
PPU.OBJSizeSelect = OrigPPU.OBJSizeSelect;
|
||||
PPU.OBJNameBase = OrigPPU.OBJNameBase;
|
||||
PPU.OAMReadFlip = OrigPPU.OAMReadFlip;
|
||||
memmove (PPU.OAMData, OrigPPU.OAMData, sizeof (PPU.OAMData));
|
||||
PPU.VTimerEnabled = OrigPPU.VTimerEnabled;
|
||||
PPU.HTimerEnabled = OrigPPU.HTimerEnabled;
|
||||
PPU.HTimerPosition = OrigPPU.HTimerPosition;
|
||||
PPU.Mosaic = OrigPPU.Mosaic;
|
||||
memmove (PPU.BGMosaic, OrigPPU.BGMosaic, sizeof (PPU.BGMosaic));
|
||||
PPU.Mode7HFlip = OrigPPU.Mode7HFlip;
|
||||
PPU.Mode7VFlip = OrigPPU.Mode7VFlip;
|
||||
PPU.Mode7Repeat = OrigPPU.Mode7Repeat;
|
||||
PPU.Window1Left = OrigPPU.Window1Left;
|
||||
PPU.Window1Right = OrigPPU.Window1Right;
|
||||
PPU.Window2Left = OrigPPU.Window2Left;
|
||||
PPU.Window2Right = OrigPPU.Window2Right;
|
||||
for (i = 0; i < 6; i++)
|
||||
{
|
||||
PPU.ClipWindowOverlapLogic [i] = OrigPPU.ClipWindowOverlapLogic [i];
|
||||
PPU.ClipWindow1Enable [i] = OrigPPU.ClipWindow1Enable [i];
|
||||
PPU.ClipWindow2Enable [i] = OrigPPU.ClipWindow2Enable [i];
|
||||
PPU.ClipWindow1Inside [i] = OrigPPU.ClipWindow1Inside [i];
|
||||
PPU.ClipWindow2Inside [i] = OrigPPU.ClipWindow2Inside [i];
|
||||
}
|
||||
PPU.CGFLIPRead = OrigPPU.CGFLIPRead;
|
||||
PPU.Need16x8Mulitply = OrigPPU.Need16x8Mulitply;
|
||||
|
||||
IPPU.ColorsChanged = TRUE;
|
||||
IPPU.OBJChanged = TRUE;
|
||||
S9xFixColourBrightness ();
|
||||
IPPU.RenderThisFrame = FALSE;
|
||||
|
||||
if ((result = ReadBlock ("DMA:", OrigDMA, sizeof (OrigDMA), snap)) != SUCCESS)
|
||||
return (result);
|
||||
|
||||
for (i = 0; i < 8; i++)
|
||||
{
|
||||
DMA[i].ReverseTransfer = OrigDMA[i].ReverseTransfer;
|
||||
DMA[i].AAddressFixed = OrigDMA[i].AAddressFixed;
|
||||
DMA[i].AAddressDecrement = OrigDMA[i].AAddressDecrement;
|
||||
DMA[i].TransferMode = OrigDMA[i].TransferMode;
|
||||
DMA[i].ABank = OrigDMA[i].ABank;
|
||||
DMA[i].AAddress = OrigDMA[i].AAddress;
|
||||
DMA[i].Address = OrigDMA[i].Address;
|
||||
DMA[i].BAddress = OrigDMA[i].BAddress;
|
||||
DMA[i].HDMAIndirectAddressing = OrigDMA[i].HDMAIndirectAddressing;
|
||||
DMA[i].DMACount_Or_HDMAIndirectAddress = OrigDMA[i].IndirectAddress;
|
||||
DMA[i].IndirectBank = OrigDMA[i].IndirectBank;
|
||||
DMA[i].Repeat = OrigDMA[i].Repeat;
|
||||
DMA[i].LineCount = OrigDMA[i].LineCount;
|
||||
DMA[i].DoTransfer = OrigDMA[i].FirstLine;
|
||||
}
|
||||
|
||||
if ((result = ReadBlock ("VRA:", Memory.VRAM, 0x10000, snap)) != SUCCESS)
|
||||
return (result);
|
||||
if ((result = ReadBlock ("RAM:", Memory.RAM, 0x20000, snap)) != SUCCESS)
|
||||
return (result);
|
||||
if ((result = ReadBlock ("SRA:", Memory.SRAM, 0x10000, snap)) != SUCCESS)
|
||||
return (result);
|
||||
if ((result = ReadBlock ("FIL:", Memory.FillRAM, 0x8000, snap)) != SUCCESS)
|
||||
return (result);
|
||||
if (ReadBlock ("APU:", &OrigAPU, sizeof (OrigAPU), snap) == SUCCESS)
|
||||
{
|
||||
APU = *(struct SAPU *) &OrigAPU;
|
||||
|
||||
if ((result = ReadBlock ("ARE:", &OrigAPURegisters,
|
||||
sizeof (OrigAPURegisters), snap)) != SUCCESS)
|
||||
return (result);
|
||||
APURegisters = *(struct SAPURegisters *) &OrigAPURegisters;
|
||||
if ((result = ReadBlock ("ARA:", IAPU.RAM, 0x10000, snap)) != SUCCESS)
|
||||
return (result);
|
||||
if ((result = ReadBlock ("SOU:", &OrigSoundData,
|
||||
sizeof (SOrigSoundData), snap)) != SUCCESS)
|
||||
return (result);
|
||||
|
||||
SoundData.master_volume_left = OrigSoundData.master_volume_left;
|
||||
SoundData.master_volume_right = OrigSoundData.master_volume_right;
|
||||
SoundData.echo_volume_left = OrigSoundData.echo_volume_left;
|
||||
SoundData.echo_volume_right = OrigSoundData.echo_volume_right;
|
||||
SoundData.echo_enable = OrigSoundData.echo_enable;
|
||||
SoundData.echo_feedback = OrigSoundData.echo_feedback;
|
||||
SoundData.echo_ptr = OrigSoundData.echo_ptr;
|
||||
SoundData.echo_buffer_size = OrigSoundData.echo_buffer_size;
|
||||
SoundData.echo_write_enabled = OrigSoundData.echo_write_enabled;
|
||||
SoundData.echo_channel_enable = OrigSoundData.echo_channel_enable;
|
||||
SoundData.pitch_mod = OrigSoundData.pitch_mod;
|
||||
|
||||
for (i = 0; i < 3; i++)
|
||||
SoundData.dummy [i] = OrigSoundData.dummy [i];
|
||||
for (i = 0; i < NUM_CHANNELS; i++)
|
||||
{
|
||||
SoundData.channels [i].state = OrigSoundData.channels [i].state;
|
||||
SoundData.channels [i].type = OrigSoundData.channels [i].type;
|
||||
SoundData.channels [i].volume_left = OrigSoundData.channels [i].volume_left;
|
||||
SoundData.channels [i].volume_right = OrigSoundData.channels [i].volume_right;
|
||||
SoundData.channels [i].hertz = OrigSoundData.channels [i].frequency;
|
||||
SoundData.channels [i].count = OrigSoundData.channels [i].count;
|
||||
SoundData.channels [i].loop = OrigSoundData.channels [i].loop;
|
||||
SoundData.channels [i].envx = OrigSoundData.channels [i].envx;
|
||||
SoundData.channels [i].left_vol_level = OrigSoundData.channels [i].left_vol_level;
|
||||
SoundData.channels [i].right_vol_level = OrigSoundData.channels [i].right_vol_level;
|
||||
SoundData.channels [i].envx_target = OrigSoundData.channels [i].envx_target;
|
||||
SoundData.channels [i].env_error = OrigSoundData.channels [i].env_error;
|
||||
SoundData.channels [i].erate = OrigSoundData.channels [i].erate;
|
||||
SoundData.channels [i].direction = OrigSoundData.channels [i].direction;
|
||||
SoundData.channels [i].attack_rate = OrigSoundData.channels [i].attack_rate;
|
||||
SoundData.channels [i].decay_rate = OrigSoundData.channels [i].decay_rate;
|
||||
SoundData.channels [i].sustain_rate = OrigSoundData.channels [i].sustain_rate;
|
||||
SoundData.channels [i].release_rate = OrigSoundData.channels [i].release_rate;
|
||||
SoundData.channels [i].sustain_level = OrigSoundData.channels [i].sustain_level;
|
||||
SoundData.channels [i].sample = OrigSoundData.channels [i].sample;
|
||||
for (j = 0; j < 16; j++)
|
||||
SoundData.channels [i].decoded [j] = OrigSoundData.channels [i].decoded [j];
|
||||
|
||||
for (j = 0; j < 2; j++)
|
||||
SoundData.channels [i].previous [j] = OrigSoundData.channels [i].previous [j];
|
||||
|
||||
SoundData.channels [i].sample_number = OrigSoundData.channels [i].sample_number;
|
||||
SoundData.channels [i].last_block = OrigSoundData.channels [i].last_block;
|
||||
SoundData.channels [i].needs_decode = OrigSoundData.channels [i].needs_decode;
|
||||
SoundData.channels [i].block_pointer = OrigSoundData.channels [i].block_pointer;
|
||||
SoundData.channels [i].sample_pointer = OrigSoundData.channels [i].sample_pointer;
|
||||
SoundData.channels [i].mode = OrigSoundData.channels [i].mode;
|
||||
}
|
||||
|
||||
S9xSetSoundMute (FALSE);
|
||||
IAPU.PC = IAPU.RAM + APURegisters.PC;
|
||||
S9xAPUUnpackStatus ();
|
||||
if (APUCheckDirectPage ())
|
||||
IAPU.DirectPage = IAPU.RAM + 0x100;
|
||||
else
|
||||
IAPU.DirectPage = IAPU.RAM;
|
||||
Settings.APUEnabled = TRUE;
|
||||
IAPU.APUExecuting = TRUE;
|
||||
}
|
||||
else
|
||||
{
|
||||
Settings.APUEnabled = FALSE;
|
||||
IAPU.APUExecuting = FALSE;
|
||||
S9xSetSoundMute (TRUE);
|
||||
}
|
||||
S9xFixSoundAfterSnapshotLoad (1);
|
||||
ICPU.ShiftedPB = Registers.PB << 16;
|
||||
ICPU.ShiftedDB = Registers.DB << 16;
|
||||
S9xSetPCBase (Registers.PBPC);
|
||||
S9xUnpackStatus ();
|
||||
S9xFixCycles ();
|
||||
S9xReschedule ();
|
||||
|
||||
return (SUCCESS);
|
||||
}
|
||||
|
@ -1,452 +0,0 @@
|
||||
/**********************************************************************************
|
||||
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.
|
||||
**********************************************************************************/
|
||||
|
||||
|
||||
|
||||
#ifndef _SNAPORIG_H_
|
||||
#define _SNAPORIG_H_
|
||||
|
||||
#define ORIG_SNAPSHOT_MAGIC "#!snes96"
|
||||
#define ORIG_SNAPSHOT_VERSION 4
|
||||
|
||||
EXTERN_C bool8 S9xLoadOrigSnapshot (const char *filename);
|
||||
|
||||
struct SOrigCPUState{
|
||||
uint32 Flags;
|
||||
short Cycles_old;
|
||||
short NextEvent_old;
|
||||
uint8 CurrentFrame;
|
||||
uint8 FastROMSpeed_old_old;
|
||||
uint16 V_Counter_old;
|
||||
bool8 BranchSkip;
|
||||
bool8 NMIActive;
|
||||
bool8 IRQActive;
|
||||
bool8 WaitingForInterrupt;
|
||||
bool8 InDMAorHDMA;
|
||||
uint8 WhichEvent;
|
||||
uint8 *PC;
|
||||
uint8 *PCBase;
|
||||
uint16 MemSpeed_old;
|
||||
uint16 MemSpeedx2_old;
|
||||
uint16 FastROMSpeed_old;
|
||||
bool8 FastDP;
|
||||
uint8 *PCAtOpcodeStart;
|
||||
uint8 *WaitAddress;
|
||||
uint32 WaitCounter;
|
||||
int32 Cycles;
|
||||
int32 NextEvent;
|
||||
int32 V_Counter;
|
||||
int32 MemSpeed;
|
||||
int32 MemSpeedx2;
|
||||
int32 FastROMSpeed;
|
||||
};
|
||||
|
||||
struct SOrigAPU
|
||||
{
|
||||
uint32 Cycles;
|
||||
bool8 ShowROM;
|
||||
uint8 Flags;
|
||||
uint8 KeyedChannels;
|
||||
uint8 OutPorts [4];
|
||||
uint8 DSP [0x80];
|
||||
uint8 ExtraRAM [64];
|
||||
uint16 Timer [3];
|
||||
uint16 TimerTarget [3];
|
||||
bool8 TimerEnabled [3];
|
||||
bool8 TimerValueWritten [3];
|
||||
};
|
||||
|
||||
typedef union
|
||||
{
|
||||
#ifdef LSB_FIRST
|
||||
struct { uint8 A, Y; } B;
|
||||
#else
|
||||
struct { uint8 Y, A; } B;
|
||||
#endif
|
||||
uint16 W;
|
||||
} OrigYAndA;
|
||||
|
||||
struct SOrigAPURegisters{
|
||||
uint8 P;
|
||||
OrigYAndA YA;
|
||||
uint8 X;
|
||||
uint8 S;
|
||||
uint16 PC;
|
||||
};
|
||||
|
||||
#define ORIG_MAX_BUFFER_SIZE (1024 * 4)
|
||||
#define NUM_CHANNELS 8
|
||||
|
||||
typedef struct {
|
||||
int32 state;
|
||||
int32 type;
|
||||
short volume_left;
|
||||
short volume_right;
|
||||
uint32 frequency;
|
||||
uint32 count;
|
||||
signed short wave [ORIG_MAX_BUFFER_SIZE];
|
||||
bool8 loop;
|
||||
int32 envx;
|
||||
short left_vol_level;
|
||||
short right_vol_level;
|
||||
short envx_target;
|
||||
uint32 env_error;
|
||||
uint32 erate;
|
||||
int32 direction;
|
||||
uint32 attack_rate;
|
||||
uint32 decay_rate;
|
||||
uint32 sustain_rate;
|
||||
uint32 release_rate;
|
||||
uint32 sustain_level;
|
||||
signed short sample;
|
||||
signed short decoded [16];
|
||||
signed short previous [2];
|
||||
uint16 sample_number;
|
||||
bool8 last_block;
|
||||
bool8 needs_decode;
|
||||
uint32 block_pointer;
|
||||
uint32 sample_pointer;
|
||||
int32 *echo_buf_ptr;
|
||||
int32 mode;
|
||||
uint32 dummy [8];
|
||||
} OrigChannel;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
short master_volume_left;
|
||||
short master_volume_right;
|
||||
short echo_volume_left;
|
||||
short echo_volume_right;
|
||||
int32 echo_enable;
|
||||
int32 echo_feedback;
|
||||
int32 echo_ptr;
|
||||
int32 echo_buffer_size;
|
||||
int32 echo_write_enabled;
|
||||
int32 echo_channel_enable;
|
||||
int32 pitch_mod;
|
||||
// Just incase they are needed in the future, for snapshot compatibility.
|
||||
uint32 dummy [3];
|
||||
OrigChannel channels [NUM_CHANNELS];
|
||||
} SOrigSoundData;
|
||||
|
||||
struct SOrigOBJ
|
||||
{
|
||||
short HPos;
|
||||
uint16 VPos;
|
||||
uint16 Name;
|
||||
uint8 VFlip;
|
||||
uint8 HFlip;
|
||||
uint8 Priority;
|
||||
uint8 Palette;
|
||||
uint8 Size;
|
||||
uint8 Prev;
|
||||
uint8 Next;
|
||||
};
|
||||
|
||||
struct SOrigPPU {
|
||||
uint8 BGMode;
|
||||
uint8 BG3Priority;
|
||||
uint8 Brightness;
|
||||
|
||||
struct {
|
||||
bool8 High;
|
||||
uint8 Increment;
|
||||
uint16 Address;
|
||||
uint16 Mask1;
|
||||
uint16 FullGraphicCount;
|
||||
uint16 Shift;
|
||||
} VMA;
|
||||
|
||||
struct {
|
||||
uint8 TileSize;
|
||||
uint16 TileAddress;
|
||||
uint8 Width;
|
||||
uint8 Height;
|
||||
uint16 SCBase;
|
||||
uint16 VOffset;
|
||||
uint16 HOffset;
|
||||
bool8 ThroughMain;
|
||||
bool8 ThroughSub;
|
||||
uint8 BGSize;
|
||||
uint16 NameBase;
|
||||
uint16 SCSize;
|
||||
bool8 Addition;
|
||||
} BG [4];
|
||||
|
||||
bool8 CGFLIP;
|
||||
uint16 CGDATA [256];
|
||||
uint8 FirstSprite;
|
||||
uint8 LastSprite;
|
||||
struct SOrigOBJ OBJ [129];
|
||||
uint8 OAMPriorityRotation;
|
||||
uint16 OAMAddr;
|
||||
|
||||
uint8 OAMFlip;
|
||||
uint16 OAMTileAddress;
|
||||
uint16 IRQVBeamPos;
|
||||
uint16 IRQHBeamPos;
|
||||
uint16 VBeamPosLatched;
|
||||
uint16 HBeamPosLatched;
|
||||
|
||||
uint8 HBeamFlip;
|
||||
uint8 VBeamFlip;
|
||||
uint8 HVBeamCounterLatched;
|
||||
|
||||
short MatrixA;
|
||||
short MatrixB;
|
||||
short MatrixC;
|
||||
short MatrixD;
|
||||
short CentreX;
|
||||
short CentreY;
|
||||
uint8 Joypad1ButtonReadPos;
|
||||
uint8 Joypad2ButtonReadPos;
|
||||
|
||||
uint8 CGADD;
|
||||
uint8 FixedColourRed;
|
||||
uint8 FixedColourGreen;
|
||||
uint8 FixedColourBlue;
|
||||
uint16 SavedOAMAddr;
|
||||
uint16 ScreenHeight;
|
||||
uint32 WRAM;
|
||||
uint8 BG_Forced;
|
||||
bool8 ForcedBlanking;
|
||||
bool8 OBJThroughMain;
|
||||
bool8 OBJThroughSub;
|
||||
uint8 OBJSizeSelect;
|
||||
uint8 OBJNameSelect_old;
|
||||
uint16 OBJNameBase;
|
||||
bool8 OBJAddition;
|
||||
uint8 OAMReadFlip;
|
||||
uint8 OAMData [512 + 32];
|
||||
bool8 VTimerEnabled;
|
||||
bool8 HTimerEnabled;
|
||||
short HTimerPosition;
|
||||
uint8 Mosaic;
|
||||
bool8 BGMosaic [4];
|
||||
bool8 Mode7HFlip;
|
||||
bool8 Mode7VFlip;
|
||||
uint8 Mode7Repeat;
|
||||
uint8 Window1Left;
|
||||
uint8 Window1Right;
|
||||
uint8 Window2Left;
|
||||
uint8 Window2Right;
|
||||
uint8 ClipCounts [6];
|
||||
uint8 ClipLeftEdges [3][6];
|
||||
uint8 ClipRightEdges [3][6];
|
||||
uint8 ClipWindowOverlapLogic [6];
|
||||
uint8 ClipWindow1Enable [6];
|
||||
uint8 ClipWindow2Enable [6];
|
||||
bool8 ClipWindow1Inside [6];
|
||||
bool8 ClipWindow2Inside [6];
|
||||
bool8 RecomputeClipWindows;
|
||||
uint8 CGFLIPRead;
|
||||
uint16 OBJNameSelect;
|
||||
bool8 Need16x8Mulitply;
|
||||
uint8 Joypad3ButtonReadPos;
|
||||
uint8 MouseSpeed[2];
|
||||
};
|
||||
|
||||
struct SOrigDMA {
|
||||
bool8 ReverseTransfer;
|
||||
bool8 AAddressFixed;
|
||||
bool8 AAddressDecrement;
|
||||
uint8 TransferMode;
|
||||
|
||||
uint8 ABank;
|
||||
uint16 AAddress;
|
||||
uint16 Address;
|
||||
uint8 BAddress;
|
||||
|
||||
// General DMA only:
|
||||
uint16 TransferBytes;
|
||||
|
||||
// H-DMA only:
|
||||
bool8 HDMAIndirectAddressing;
|
||||
uint16 IndirectAddress;
|
||||
uint8 IndirectBank;
|
||||
uint8 Repeat;
|
||||
uint8 LineCount;
|
||||
uint8 FirstLine;
|
||||
bool8 JustStarted;
|
||||
};
|
||||
|
||||
typedef union
|
||||
{
|
||||
#ifdef LSB_FIRST
|
||||
struct { uint8 l,h; } B;
|
||||
#else
|
||||
struct { uint8 h,l; } B;
|
||||
#endif
|
||||
uint16 W;
|
||||
} OrigPair;
|
||||
|
||||
struct SOrigRegisters{
|
||||
uint8 DB;
|
||||
OrigPair P;
|
||||
OrigPair A;
|
||||
OrigPair D;
|
||||
OrigPair S;
|
||||
OrigPair X;
|
||||
OrigPair Y;
|
||||
PC_t PC;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
@ -1,81 +0,0 @@
|
||||
#---------------------------
|
||||
# Snes9x Configuration file
|
||||
#---------------------------
|
||||
|
||||
[CPU]
|
||||
Cycles =
|
||||
DisableIRQ =
|
||||
|
||||
[ROM]
|
||||
PAL =
|
||||
NTSC =
|
||||
HiROM =
|
||||
LoROM =
|
||||
Header =
|
||||
Interleaved =
|
||||
Interleaved2 =
|
||||
InterleaveGD24 =
|
||||
SuperFX =
|
||||
DSP1 =
|
||||
Cheat =
|
||||
Patch =
|
||||
BS =
|
||||
Filename =
|
||||
|
||||
[Sound]
|
||||
APUEnabled =
|
||||
Sync =
|
||||
Stereo =
|
||||
SixteenBitSound =
|
||||
AltDecode =
|
||||
BufferSize =
|
||||
Echo =
|
||||
FixFrequency =
|
||||
Interpolate =
|
||||
MasterVolume =
|
||||
Rate =
|
||||
SoundSkip =
|
||||
ReverseStereo =
|
||||
EnvelopeHeightReading =
|
||||
FakeMuteFix =
|
||||
SampleCaching =
|
||||
Mute =
|
||||
|
||||
[Display]
|
||||
GraphicWindows =
|
||||
Mode7Interpolate =
|
||||
HiRes =
|
||||
Transparency =
|
||||
MessagesInImage =
|
||||
FrameRate =
|
||||
DisplayInput =
|
||||
DisplayFrameCount =
|
||||
|
||||
[Settings]
|
||||
DisableHDMA =
|
||||
TurboMode =
|
||||
StretchScreenshots =
|
||||
BGLayeringHack =
|
||||
PALFrameTime =
|
||||
NTSCFrameTime =
|
||||
FrameTime =
|
||||
FrameSkip =
|
||||
AutoMaxSkipFramesAtOnce =
|
||||
TurboFrameSkip =
|
||||
AutoSaveDelay =
|
||||
SpeedHacks =
|
||||
|
||||
[Controls]
|
||||
MP5Master =
|
||||
MouseMaster =
|
||||
SuperscopeMaster =
|
||||
JustifierMaster =
|
||||
Port1 =
|
||||
Port2 =
|
||||
Mouse1Crosshair =
|
||||
Mouse2Crosshair =
|
||||
SuperscopeCrosshair =
|
||||
Justifier1Crosshair =
|
||||
Justifier2Crosshair =
|
||||
Joystick =
|
||||
AllowLeftRight =
|
@ -1,356 +0,0 @@
|
||||
/**********************************************************************************
|
||||
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.
|
||||
**********************************************************************************/
|
||||
|
||||
|
||||
|
||||
#ifndef __WIN32__
|
||||
|
||||
#include <devices/ahi.h>
|
||||
#include <exec/exec.h>
|
||||
#include <proto/ahi.h>
|
||||
#include <proto/dos.h>
|
||||
#include <proto/exec.h>
|
||||
#include <clib/ahippc_protos.h>
|
||||
#include <stdio.h>
|
||||
|
||||
#define EQ ==
|
||||
#define MINBUFFLEN 10000
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <errno.h>
|
||||
#include <fcntl.h>
|
||||
|
||||
#include "snes9x.h"
|
||||
#include "soundux.h"
|
||||
|
||||
extern SoundStatus so;
|
||||
|
||||
extern int AudioOpen(unsigned long freq, unsigned long bufsize, unsigned long bitrate, unsigned long stereo);
|
||||
extern void AudioClose(void);
|
||||
|
||||
extern int OpenPrelude(ULONG Type, ULONG DefaultFreq, ULONG MinBuffSize);
|
||||
extern void ClosePrelude(void);
|
||||
|
||||
extern int SoundSignal;
|
||||
unsigned long DoubleBuffer;
|
||||
//extern struct AHISampleInfo Sample0;
|
||||
//extern struct AHISampleInfo Sample1;
|
||||
//extern unsigned long BufferSize;
|
||||
|
||||
struct Library *AHIPPCBase;
|
||||
struct Library *AHIBase;
|
||||
struct MsgPort *AHImp=NULL;
|
||||
struct AHIRequest *AHIio=NULL;
|
||||
BYTE AHIDevice=-1;
|
||||
|
||||
struct AHIData *AHIData;
|
||||
|
||||
unsigned long Frequency = 0;
|
||||
//unsigned long BufferSize = 0;
|
||||
unsigned long BitRate = 0;
|
||||
unsigned long Stereo = 0;
|
||||
//unsigned long AHIError = 9;
|
||||
|
||||
BYTE InternSignal=-1;
|
||||
|
||||
int mixsamples;
|
||||
extern int prelude;
|
||||
|
||||
#define REALSIZE (BitRate*Stereo)
|
||||
|
||||
struct AHIAudioModeRequester *req=NULL;
|
||||
struct AHIAudioCtrl *actrl=NULL;
|
||||
|
||||
ULONG BufferLen=NULL;
|
||||
|
||||
|
||||
/* this really should be dynamically allocated... */
|
||||
#undef MAX_BUFFER_SIZE
|
||||
#define MAX_BUFFER_SIZE 65536
|
||||
#define MIN_BUFFER_SIZE 65536
|
||||
|
||||
#define MODE_MONO 0
|
||||
#define MODE_STEREO 1
|
||||
|
||||
#define QUAL_8BIT 8
|
||||
#define QUAL_16BIT 16
|
||||
|
||||
|
||||
int test=0;
|
||||
int test2=0;
|
||||
|
||||
int AudioOpen(unsigned long freq, unsigned long minbufsize, unsigned long bitrate, unsigned long stereo)
|
||||
{
|
||||
ULONG Type;
|
||||
|
||||
Frequency = freq;
|
||||
|
||||
so.playback_rate = Frequency;
|
||||
|
||||
if(stereo) so.stereo = TRUE;
|
||||
else so.stereo = FALSE;
|
||||
|
||||
switch(bitrate)
|
||||
{
|
||||
case 8:
|
||||
so.sixteen_bit = FALSE;
|
||||
BitRate=1;
|
||||
if(stereo)
|
||||
{
|
||||
Stereo=2;
|
||||
Type = AHIST_S8S;
|
||||
}
|
||||
else
|
||||
{
|
||||
Stereo=1;
|
||||
Type = AHIST_M8S;
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
default: //defaulting to 16bit, because it means it won't crash atleast
|
||||
case QUAL_16BIT:
|
||||
so.sixteen_bit = TRUE;
|
||||
BitRate=2;
|
||||
if(stereo)
|
||||
{
|
||||
Stereo=2;
|
||||
Type = AHIST_S16S;
|
||||
}
|
||||
else
|
||||
{
|
||||
Stereo=1;
|
||||
Type = AHIST_M16S;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
if(prelude) prelude = OpenPrelude(Type, freq, minbufsize);
|
||||
|
||||
|
||||
if(prelude) return 1; else printf("Defaulting to AHI...\n");
|
||||
|
||||
/* only 1 channel right? */
|
||||
/* NOTE: The buffersize will not always be what you requested
|
||||
* it finds the minimun AHI requires and then rounds it up to
|
||||
* nearest 32 bytes. Check AHIData->BufferSize or Samples[n].something_Length
|
||||
*/
|
||||
if(AHIData = OpenAHI(1, Type, AHI_INVALID_ID, AHI_DEFAULT_FREQ, 0, minbufsize))
|
||||
{
|
||||
printf("AHI opened\n");
|
||||
printf("BuffSize %d\n", AHIData->BufferSize);
|
||||
}
|
||||
else
|
||||
{
|
||||
printf("AHI failed to open: %d\n", AHIData);
|
||||
return 0;
|
||||
}
|
||||
|
||||
so.buffer_size = AHIData->BufferSize; // in bytes
|
||||
if (so.buffer_size > MAX_BUFFER_SIZE) so.buffer_size = MAX_BUFFER_SIZE;
|
||||
|
||||
/* Lots of useful fields in the AHIData struct, have a look */
|
||||
AHIBase = AHIData->AHIBase;
|
||||
actrl = AHIData->AudioCtrl;
|
||||
Frequency = AHIData->MixingFreq;
|
||||
|
||||
printf("signal %ld\n", AHIData->SoundFuncSignal);
|
||||
|
||||
Wait(AHIData->SoundFuncSignal);
|
||||
|
||||
/* I don't think it should start playing until there is something
|
||||
* In the buffer, however to set off the SoundFunc it should
|
||||
* probably go through the buffer at least once, just silently.
|
||||
*/
|
||||
AHI_SetFreq(0, Frequency, actrl, AHISF_IMM);
|
||||
|
||||
Wait(AHIData->SoundFuncSignal);
|
||||
|
||||
AHI_SetVol(0, 0x10000, 0x8000, actrl, AHISF_IMM);
|
||||
|
||||
mixsamples=AHIData->BufferSamples;
|
||||
|
||||
SoundSignal = AHIData->SoundFuncSignal;
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
void AudioClose( void )
|
||||
{
|
||||
if(prelude) ClosePrelude();
|
||||
else ;//CloseAHI(AHIData);
|
||||
}
|
||||
|
||||
|
||||
#include <wbstartup.h>
|
||||
|
||||
extern int main(int argc, char **argv);
|
||||
|
||||
void wbmain(struct WBStartup * argmsg)
|
||||
{
|
||||
char argv[1][]={"WarpSNES"};
|
||||
int argc=1;
|
||||
main(argc,(char **)argv);
|
||||
}
|
||||
|
||||
|
||||
#endif
|
@ -1,113 +0,0 @@
|
||||
#! /bin/sh
|
||||
|
||||
# This script is part of the automated Xenofarm testing testing. For
|
||||
# more information about Xenofarm see http://www.lysator.liu.se/xenofarm/
|
||||
|
||||
# $Id: xenofarm.sh,v 1.6 2003/11/09 14:02:39 pbortas Exp $
|
||||
# This file scripts the xenofarm actions and creates a result package
|
||||
# to send back.
|
||||
|
||||
#FIXME: snes9x doesn't really need MAKE_FLAGS. Clean out later.
|
||||
|
||||
BUILDDIR=.
|
||||
#OS=`uname -s -r -m|sed \"s/ /-/g\"|tr \"[A-Z]\" \"[a-z]\"|tr \"/()\" \"___\"`
|
||||
#BUILDDIR=build/$(OS)
|
||||
MAKE=${MAKE-make}
|
||||
PATH=$PATH:/usr/ccs/bin
|
||||
export PATH
|
||||
|
||||
log() {
|
||||
echo $1 | tee -a build/xenofarm/mainlog.txt
|
||||
}
|
||||
|
||||
log_start() {
|
||||
log "BEGIN $1"
|
||||
TZ=GMT date >> build/xenofarm/mainlog.txt
|
||||
}
|
||||
|
||||
log_end() {
|
||||
LASTERR=$1
|
||||
if [ "$1" = "0" ] ; then
|
||||
log "PASS"
|
||||
else
|
||||
log "FAIL"
|
||||
fi
|
||||
TZ=GMT date >> build/xenofarm/mainlog.txt
|
||||
}
|
||||
|
||||
xenofarm_build() {
|
||||
log_start compile
|
||||
"`pwd`/configure" >> build/xenofarm/compilelog.txt 2>&1 &&
|
||||
$MAKE $MAKE_FLAGS >> build/xenofarm/compilelog.txt 2>&1
|
||||
log_end $?
|
||||
[ $LASTERR = 0 ] || return 1
|
||||
}
|
||||
|
||||
xenofarm_post_build() {
|
||||
log_start verify
|
||||
$MAKE $MAKE_FLAGS verify > build/xenofarm/verifylog.txt 2>&1
|
||||
log_end $?
|
||||
[ $LASTERR = 0 ] || return 1
|
||||
|
||||
log_start binrelease
|
||||
$MAKE $MAKE_FLAGS bin-release > build/xenofarm/binreleaselog.txt 2>&1
|
||||
log_end $?
|
||||
[ $LASTERR = 0 ] || return 1
|
||||
}
|
||||
|
||||
fail_builddir() {
|
||||
echo "FATAL: Failed to create build directory!"
|
||||
exit 1
|
||||
}
|
||||
|
||||
# main code
|
||||
|
||||
test -d build || mkdir build 2>&1 &&
|
||||
rm -rf build/xenofarm 2>&1 &&
|
||||
mkdir build/xenofarm 2>&1 || fail_builddir
|
||||
|
||||
LC_CTYPE=C
|
||||
export LC_CTYPE
|
||||
log "FORMAT 2"
|
||||
|
||||
log_start build
|
||||
xenofarm_build
|
||||
log_end $?
|
||||
|
||||
if [ $LASTERR = 0 ]; then
|
||||
log_start post_build
|
||||
xenofarm_post_build
|
||||
log_end $?
|
||||
else :
|
||||
fi
|
||||
|
||||
log_start response_assembly
|
||||
# Basic stuff
|
||||
cp ../buildid.txt build/xenofarm/
|
||||
# Configuration
|
||||
cp "$BUILDDIR/config.info" build/xenofarm/configinfo.txt 2>/dev/null || /bin/true
|
||||
(
|
||||
cd "$BUILDDIR"
|
||||
test -f config.log && cat config.log
|
||||
for f in `find . -name config.log -type f`; do
|
||||
echo
|
||||
echo '###################################################'
|
||||
echo '##' `dirname "$f"`
|
||||
echo
|
||||
cat "$f"
|
||||
done
|
||||
) > build/xenofarm/configlogs.txt
|
||||
cp "$BUILDDIR/config.cache" build/xenofarm/configcache.txt 2>/dev/null || /bin/true;
|
||||
# Core files
|
||||
find . -name "core" -exec \
|
||||
gdb --batch --nx --command=bin/xenofarm_gdb_cmd "$BUILDDIR/pike" {} >> \
|
||||
build/xenofarm/_core.txt ";"
|
||||
find . -name "*.core" -exec \
|
||||
gdb --batch --nx --command=bin/xenofarm_gdb_cmd "$BUILDDIR/pike" {} >> \
|
||||
build/xenofarm/_core.txt ";"
|
||||
find . -name "core.*" -exec \
|
||||
gdb --batch --nx --command=bin/xenofarm_gdb_cmd "$BUILDDIR/pike" {} >> \
|
||||
build/xenofarm/_core.txt ";"
|
||||
log_end $?
|
||||
|
||||
log "END"
|
@ -1,14 +0,0 @@
|
||||
echo \nActive threads\n
|
||||
info threads
|
||||
echo \nBacktrace\n
|
||||
bt
|
||||
echo \nSource code for frame 0\n
|
||||
list
|
||||
echo \nDisassembly of frame 0\n
|
||||
disassemble
|
||||
echo \nSource code for frame 1\n
|
||||
up
|
||||
list
|
||||
echo \nDisassembly of frame 1\n
|
||||
disassemble
|
||||
echo \nEnd of core inspection\n\n\n\n
|
Loading…
x
Reference in New Issue
Block a user