mirror of
https://github.com/dborth/snes9xgx.git
synced 2025-02-17 11:56:25 +01:00
Unzip from SMB works now
Pref XML now formatted
This commit is contained in:
parent
402da070a2
commit
fad4a5a114
@ -468,7 +468,7 @@ LoadDVDFile (unsigned char *buffer)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
return UnZipBuffer (buffer, discoffset, 1, NULL); // unzip from dvd
|
return UnZipFile (buffer, discoffset); // unzip from dvd
|
||||||
}
|
}
|
||||||
return dvddirlength;
|
return dvddirlength;
|
||||||
}
|
}
|
||||||
|
@ -199,25 +199,20 @@ LoadFATFile (char *filename, int length)
|
|||||||
|
|
||||||
if (IsZipFile (zipbuffer))
|
if (IsZipFile (zipbuffer))
|
||||||
{
|
{
|
||||||
// Unzip the ROM
|
size = UnZipFile (rbuffer, handle); // unzip from FAT
|
||||||
size = UnZipBuffer (rbuffer, 0, 0, handle); // unzip from FAT
|
|
||||||
|
|
||||||
fclose (handle);
|
|
||||||
return size;
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// Just load the file up
|
// Just load the file up
|
||||||
|
|
||||||
fseek(handle, 0, SEEK_END);
|
fseek(handle, 0, SEEK_END);
|
||||||
length = ftell(handle); // get filesize
|
length = ftell(handle); // get filesize
|
||||||
fseek(handle, 2048, SEEK_SET); // seek back to point where we left off
|
fseek(handle, 2048, SEEK_SET); // seek back to point where we left off
|
||||||
memcpy (rbuffer, zipbuffer, 2048); // copy what we already read
|
memcpy (rbuffer, zipbuffer, 2048); // copy what we already read
|
||||||
fread (rbuffer + 2048, 1, length - 2048, handle);
|
fread (rbuffer + 2048, 1, length - 2048, handle);
|
||||||
fclose (handle);
|
size = length;
|
||||||
|
|
||||||
return length;
|
|
||||||
}
|
}
|
||||||
|
fclose (handle);
|
||||||
|
return size;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -31,7 +31,7 @@
|
|||||||
#include "snapshot.h"
|
#include "snapshot.h"
|
||||||
#include "srtc.h"
|
#include "srtc.h"
|
||||||
|
|
||||||
#include "Snes9xGx.h"
|
#include "Snes9xGX.h"
|
||||||
#include "images/saveicon.h"
|
#include "images/saveicon.h"
|
||||||
#include "freeze.h"
|
#include "freeze.h"
|
||||||
#include "filesel.h"
|
#include "filesel.h"
|
||||||
@ -41,6 +41,7 @@
|
|||||||
#include "memcardop.h"
|
#include "memcardop.h"
|
||||||
|
|
||||||
#define MEMBUFFER (512 * 1024)
|
#define MEMBUFFER (512 * 1024)
|
||||||
|
#define VERSIONSTRFREEZE = "Snes9x GX 005 Freeze"
|
||||||
|
|
||||||
extern void S9xSRTCPreSaveState ();
|
extern void S9xSRTCPreSaveState ();
|
||||||
extern void NGCFreezeStruct ();
|
extern void NGCFreezeStruct ();
|
||||||
@ -50,7 +51,7 @@ extern unsigned char savebuffer[];
|
|||||||
static int bufoffset;
|
static int bufoffset;
|
||||||
static char membuffer[MEMBUFFER];
|
static char membuffer[MEMBUFFER];
|
||||||
|
|
||||||
char freezecomment[2][32] = { {"Snes9x GX 005 Freeze"}, {"Freeze"} };
|
char freezecomment[2][32];
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -175,7 +176,8 @@ NGCFreezeGame (int method, bool8 silent)
|
|||||||
memcpy (savebuffer, saveicon, woffset);
|
memcpy (savebuffer, saveicon, woffset);
|
||||||
|
|
||||||
/*** And the freezecomment ***/
|
/*** And the freezecomment ***/
|
||||||
sprintf (freezecomment[1], "%s", Memory.ROMName);
|
sprintf (freezecomment[0], "%s Freeze", VERSIONSTR);
|
||||||
|
sprintf (freezecomment[1], Memory.ROMName);
|
||||||
memcpy (savebuffer + woffset, freezecomment, 64);
|
memcpy (savebuffer + woffset, freezecomment, 64);
|
||||||
woffset += 64;
|
woffset += 64;
|
||||||
|
|
||||||
|
@ -118,7 +118,7 @@ s8 WPAD_StickX(u8 chan,u8 right)
|
|||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* calculate X value (angle need to be converted into radian) */
|
/* calculate X value (angle need to be converted into radian) */
|
||||||
if (mag > 1.0) mag = 1.0;
|
if (mag > 1.0) mag = 1.0;
|
||||||
else if (mag < -1.0) mag = -1.0;
|
else if (mag < -1.0) mag = -1.0;
|
||||||
@ -166,7 +166,7 @@ s8 WPAD_StickY(u8 chan, u8 right)
|
|||||||
else if (mag < -1.0) mag = -1.0;
|
else if (mag < -1.0) mag = -1.0;
|
||||||
double val = mag * cos((PI * ang)/180.0f);
|
double val = mag * cos((PI * ang)/180.0f);
|
||||||
|
|
||||||
return (s8)(val * 128.0f);
|
return (s8)(val * 128.0f);
|
||||||
}
|
}
|
||||||
|
|
||||||
// hold superscope/mouse/justifier cursor positions
|
// hold superscope/mouse/justifier cursor positions
|
||||||
@ -176,7 +176,7 @@ static int cursor_y[5] = {0,0,0,0,0};
|
|||||||
void UpdateCursorPosition (int pad, int &pos_x, int &pos_y)
|
void UpdateCursorPosition (int pad, int &pos_x, int &pos_y)
|
||||||
{
|
{
|
||||||
#define SCOPEPADCAL 20
|
#define SCOPEPADCAL 20
|
||||||
|
|
||||||
// gc left joystick
|
// gc left joystick
|
||||||
signed char pad_x = PAD_StickX (pad);
|
signed char pad_x = PAD_StickX (pad);
|
||||||
signed char pad_y = PAD_StickY (pad);
|
signed char pad_y = PAD_StickY (pad);
|
||||||
@ -241,20 +241,19 @@ void decodepad (int pad)
|
|||||||
{
|
{
|
||||||
int i, offset;
|
int i, offset;
|
||||||
float t;
|
float t;
|
||||||
|
|
||||||
signed char wm_ax = 0;
|
|
||||||
signed char wm_ay = 0;
|
|
||||||
u32 wp = 0;
|
|
||||||
|
|
||||||
signed char pad_x = PAD_StickX (pad);
|
signed char pad_x = PAD_StickX (pad);
|
||||||
signed char pad_y = PAD_StickY (pad);
|
signed char pad_y = PAD_StickY (pad);
|
||||||
u32 jp = PAD_ButtonsHeld (pad);
|
u32 jp = PAD_ButtonsHeld (pad);
|
||||||
|
|
||||||
#ifdef HW_RVL
|
#ifdef HW_RVL
|
||||||
|
signed char wm_ax = 0;
|
||||||
|
signed char wm_ay = 0;
|
||||||
|
u32 wp = 0;
|
||||||
wm_ax = WPAD_StickX ((u8)pad, 0);
|
wm_ax = WPAD_StickX ((u8)pad, 0);
|
||||||
wm_ay = WPAD_StickY ((u8)pad, 0);
|
wm_ay = WPAD_StickY ((u8)pad, 0);
|
||||||
wp = WPAD_ButtonsHeld (pad);
|
wp = WPAD_ButtonsHeld (pad);
|
||||||
|
|
||||||
u32 exp_type;
|
u32 exp_type;
|
||||||
if ( WPAD_Probe(pad, &exp_type) != 0 ) exp_type = WPAD_EXP_NONE;
|
if ( WPAD_Probe(pad, &exp_type) != 0 ) exp_type = WPAD_EXP_NONE;
|
||||||
#endif
|
#endif
|
||||||
@ -433,7 +432,7 @@ void NGCReportButtons ()
|
|||||||
{
|
{
|
||||||
s8 gc_px = PAD_SubStickX (0);
|
s8 gc_px = PAD_SubStickX (0);
|
||||||
s8 gc_py = PAD_SubStickY (0);
|
s8 gc_py = PAD_SubStickY (0);
|
||||||
|
|
||||||
u16 gc_pb = PAD_ButtonsHeld (0);
|
u16 gc_pb = PAD_ButtonsHeld (0);
|
||||||
|
|
||||||
#ifdef HW_RVL
|
#ifdef HW_RVL
|
||||||
|
@ -18,7 +18,7 @@
|
|||||||
#include "memmap.h"
|
#include "memmap.h"
|
||||||
#include "srtc.h"
|
#include "srtc.h"
|
||||||
|
|
||||||
#include "snes9xGx.h"
|
#include "snes9xGX.h"
|
||||||
#include "images/saveicon.h"
|
#include "images/saveicon.h"
|
||||||
#include "menudraw.h"
|
#include "menudraw.h"
|
||||||
#include "memcardop.h"
|
#include "memcardop.h"
|
||||||
@ -36,10 +36,8 @@ extern unsigned int ccpadmap[];
|
|||||||
extern unsigned int ncpadmap[];
|
extern unsigned int ncpadmap[];
|
||||||
|
|
||||||
#define PREFS_FILE_NAME "SNES9xGX.xml"
|
#define PREFS_FILE_NAME "SNES9xGX.xml"
|
||||||
#define PREFSVERSTRING "Snes9x GX 005 Prefs"
|
|
||||||
#define VERSIONSTRING "005"
|
|
||||||
|
|
||||||
char prefscomment[2][32] = { {PREFSVERSTRING}, {"Preferences"} };
|
char prefscomment[2][32];
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Prepare Preferences Data
|
* Prepare Preferences Data
|
||||||
@ -90,6 +88,34 @@ void createXMLController(unsigned int controller[], const char * name, const cha
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const char * XMLSaveCallback(mxml_node_t *node, int where)
|
||||||
|
{
|
||||||
|
const char *name;
|
||||||
|
|
||||||
|
name = node->value.element.name;
|
||||||
|
|
||||||
|
if(where == MXML_WS_BEFORE_CLOSE)
|
||||||
|
{
|
||||||
|
if(!strcmp(name, "file") || !strcmp(name, "section"))
|
||||||
|
return ("\n");
|
||||||
|
else if(!strcmp(name, "controller"))
|
||||||
|
return ("\n\t");
|
||||||
|
}
|
||||||
|
if (where == MXML_WS_BEFORE_OPEN)
|
||||||
|
{
|
||||||
|
if(!strcmp(name, "file"))
|
||||||
|
return ("\n");
|
||||||
|
else if(!strcmp(name, "section"))
|
||||||
|
return ("\n\n");
|
||||||
|
else if(!strcmp(name, "setting") || !strcmp(name, "controller"))
|
||||||
|
return ("\n\t");
|
||||||
|
else if(!strcmp(name, "button"))
|
||||||
|
return ("\n\t\t");
|
||||||
|
}
|
||||||
|
return (NULL);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
int
|
int
|
||||||
preparePrefsData (int method)
|
preparePrefsData (int method)
|
||||||
{
|
{
|
||||||
@ -105,14 +131,17 @@ preparePrefsData (int method)
|
|||||||
memcpy (savebuffer, saveicon, offset);
|
memcpy (savebuffer, saveicon, offset);
|
||||||
|
|
||||||
// And the comments
|
// And the comments
|
||||||
|
sprintf (prefscomment[0], "%s Prefs", VERSIONSTR);
|
||||||
|
sprintf (prefscomment[1], "Preferences");
|
||||||
memcpy (savebuffer + offset, prefscomment, 64);
|
memcpy (savebuffer + offset, prefscomment, 64);
|
||||||
offset += 64;
|
offset += 64;
|
||||||
}
|
}
|
||||||
|
|
||||||
xml = mxmlNewXML("1.0");
|
xml = mxmlNewXML("1.0");
|
||||||
|
mxmlSetWrapMargin(0); // disable line wrapping
|
||||||
|
|
||||||
data = mxmlNewElement(xml, "file");
|
data = mxmlNewElement(xml, "file");
|
||||||
mxmlElementSetAttr(data, "version",VERSIONSTRING);
|
mxmlElementSetAttr(data, "version",VERSIONSTR);
|
||||||
|
|
||||||
createXMLSection("File", "File Settings");
|
createXMLSection("File", "File Settings");
|
||||||
|
|
||||||
@ -154,7 +183,7 @@ preparePrefsData (int method)
|
|||||||
createXMLController(ncpadmap, "ncpadmap", "Nunchuk");
|
createXMLController(ncpadmap, "ncpadmap", "Nunchuk");
|
||||||
|
|
||||||
memset (savebuffer + offset, 0, SAVEBUFFERSIZE);
|
memset (savebuffer + offset, 0, SAVEBUFFERSIZE);
|
||||||
int datasize = mxmlSaveString(xml, (char *)savebuffer, SAVEBUFFERSIZE, MXML_NO_CALLBACK);
|
int datasize = mxmlSaveString(xml, (char *)savebuffer, SAVEBUFFERSIZE, XMLSaveCallback);
|
||||||
|
|
||||||
mxmlDelete(xml);
|
mxmlDelete(xml);
|
||||||
|
|
||||||
|
@ -12,148 +12,6 @@
|
|||||||
* The defaults used here are taken directly from porting.html
|
* The defaults used here are taken directly from porting.html
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
/****************************************************************************
|
|
||||||
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 <gccore.h>
|
#include <gccore.h>
|
||||||
#include "snes9x.h"
|
#include "snes9x.h"
|
||||||
#include "snes9xGX.h"
|
#include "snes9xGX.h"
|
||||||
|
@ -11,148 +11,6 @@
|
|||||||
* The defaults used here are taken directly from porting.html
|
* The defaults used here are taken directly from porting.html
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
/****************************************************************************
|
|
||||||
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 _S9XCONFIG_
|
#ifndef _S9XCONFIG_
|
||||||
|
|
||||||
#define _S9XCONFIG_
|
#define _S9XCONFIG_
|
||||||
|
@ -21,12 +21,11 @@
|
|||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
|
|
||||||
#include "memmap.h"
|
#include "memmap.h"
|
||||||
|
#include "smbop.h"
|
||||||
#include "unzip.h"
|
#include "unzip.h"
|
||||||
#include "video.h"
|
#include "video.h"
|
||||||
#include "menudraw.h"
|
#include "menudraw.h"
|
||||||
#include "filesel.h"
|
#include "filesel.h"
|
||||||
#include "smbop.h"
|
|
||||||
#include "Snes9xGx.h"
|
#include "Snes9xGx.h"
|
||||||
|
|
||||||
bool networkInit = false;
|
bool networkInit = false;
|
||||||
@ -217,9 +216,6 @@ ParseSMBdirectory ()
|
|||||||
int
|
int
|
||||||
LoadSMBFile (char *filename, int length)
|
LoadSMBFile (char *filename, int length)
|
||||||
{
|
{
|
||||||
unsigned char *rbuffer;
|
|
||||||
rbuffer = (unsigned char *) Memory.ROM;
|
|
||||||
int boffset;
|
|
||||||
char filepath[MAXPATHLEN];
|
char filepath[MAXPATHLEN];
|
||||||
|
|
||||||
/* Check filename length */
|
/* Check filename length */
|
||||||
@ -231,19 +227,7 @@ LoadSMBFile (char *filename, int length)
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
boffset = LoadBufferFromSMB((char *)rbuffer, SMBPath(filepath), NOTSILENT);
|
return LoadBufferFromSMB((char *)Memory.ROM, SMBPath(filepath), NOTSILENT);
|
||||||
|
|
||||||
if(boffset > 0)
|
|
||||||
{
|
|
||||||
if(IsZipFile ((char *)rbuffer))
|
|
||||||
{
|
|
||||||
//return UnZipBuffer(rbuffer, 0, 2, NULL);
|
|
||||||
// UNZIP currently crashes - FIX ME
|
|
||||||
WaitPrompt((char*) "Zipped files are currently not supported over SMB!");
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return boffset;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
@ -327,9 +311,18 @@ LoadBufferFromSMB (char * sbuffer, char *filepath, bool8 silent)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
while ((ret = SMB_ReadFile (sbuffer + boffset, 1024, boffset, smbfile)) > 0)
|
ret = SMB_ReadFile (sbuffer, 1024, boffset, smbfile);
|
||||||
boffset += ret;
|
|
||||||
|
|
||||||
|
if (IsZipFile (sbuffer))
|
||||||
|
{
|
||||||
|
boffset = UnZipFile ((unsigned char *)sbuffer, smbfile); // unzip from SMB
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// Just load the file up
|
||||||
|
while ((ret = SMB_ReadFile (sbuffer + boffset, 1024, boffset, smbfile)) > 0)
|
||||||
|
boffset += ret;
|
||||||
|
}
|
||||||
SMB_CloseFile (smbfile);
|
SMB_CloseFile (smbfile);
|
||||||
|
|
||||||
return boffset;
|
return boffset;
|
||||||
|
@ -5,163 +5,19 @@
|
|||||||
* softdev July 2006
|
* softdev July 2006
|
||||||
* crunchy2 May 2007-July 2007
|
* crunchy2 May 2007-July 2007
|
||||||
*
|
*
|
||||||
* snes9xGX.cpp
|
* snes9xGX.h
|
||||||
*
|
*
|
||||||
* This file controls overall program flow. Most things start and end here!
|
* This file controls overall program flow. Most things start and end here!
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
/****************************************************************************
|
|
||||||
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 _SNES9XGX_H_
|
#ifndef _SNES9XGX_H_
|
||||||
#define _SNES9XGX_H_
|
#define _SNES9XGX_H_
|
||||||
|
|
||||||
#include <gccore.h>
|
#include <gccore.h>
|
||||||
#include "snes9x.h"
|
#include "snes9x.h"
|
||||||
|
|
||||||
// FIX: these are unused, but could be... must also change "freezecomment", PREFSVERSTRING, and "sramcomment"
|
#define VERSIONNUM "005"
|
||||||
//#define GCVERSION "002"
|
#define VERSIONSTR "Snes9x GX 005"
|
||||||
//#define GCVERSIONSTRING "Snes9x 1.5 v002"
|
|
||||||
|
|
||||||
#define NOTSILENT 0
|
#define NOTSILENT 0
|
||||||
#define SILENT 1
|
#define SILENT 1
|
||||||
|
@ -29,7 +29,7 @@ extern unsigned char savebuffer[];
|
|||||||
extern int padcal;
|
extern int padcal;
|
||||||
extern unsigned short gcpadmap[];
|
extern unsigned short gcpadmap[];
|
||||||
|
|
||||||
char sramcomment[2][32] = { {"Snes9x GX 005 SRAM"}, {"Savegame"} };
|
char sramcomment[2][32];
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Prepare Memory Card SRAM Save Data
|
* Prepare Memory Card SRAM Save Data
|
||||||
@ -48,7 +48,8 @@ prepareMCsavedata ()
|
|||||||
memcpy (savebuffer, saveicon, offset);
|
memcpy (savebuffer, saveicon, offset);
|
||||||
|
|
||||||
/*** And the sramcomments ***/
|
/*** And the sramcomments ***/
|
||||||
sprintf (sramcomment[1], "%s", Memory.ROMName);
|
sprintf (sramcomment[0], "%s SRAM", VERSIONSTR);
|
||||||
|
sprintf (sramcomment[1], Memory.ROMName);
|
||||||
memcpy (savebuffer + offset, sramcomment, 64);
|
memcpy (savebuffer + offset, sramcomment, 64);
|
||||||
offset += 64;
|
offset += 64;
|
||||||
|
|
||||||
|
@ -73,9 +73,12 @@ IsZipFile (char *buffer)
|
|||||||
*
|
*
|
||||||
* It should be noted that there is a limit of 5MB total size for any ROM
|
* It should be noted that there is a limit of 5MB total size for any ROM
|
||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
|
FILE* fatfile; // FAT
|
||||||
|
u64 discoffset; // DVD
|
||||||
|
SMBFILE smbfile; // SMB
|
||||||
|
|
||||||
int
|
int
|
||||||
UnZipBuffer (unsigned char *outbuffer, u64 inoffset, short where, FILE* filehandle)
|
UnZipBuffer (unsigned char *outbuffer, short where)
|
||||||
{
|
{
|
||||||
PKZIPHEADER pkzip;
|
PKZIPHEADER pkzip;
|
||||||
int zipoffset = 0;
|
int zipoffset = 0;
|
||||||
@ -84,6 +87,7 @@ UnZipBuffer (unsigned char *outbuffer, u64 inoffset, short where, FILE* filehand
|
|||||||
z_stream zs;
|
z_stream zs;
|
||||||
int res;
|
int res;
|
||||||
int bufferoffset = 0;
|
int bufferoffset = 0;
|
||||||
|
int readoffset = 0;
|
||||||
int have = 0;
|
int have = 0;
|
||||||
char readbuffer[ZIPCHUNK];
|
char readbuffer[ZIPCHUNK];
|
||||||
char msg[128];
|
char msg[128];
|
||||||
@ -92,16 +96,16 @@ UnZipBuffer (unsigned char *outbuffer, u64 inoffset, short where, FILE* filehand
|
|||||||
switch (where)
|
switch (where)
|
||||||
{
|
{
|
||||||
case 0: // SD Card
|
case 0: // SD Card
|
||||||
fseek(filehandle, 0, SEEK_SET);
|
fseek(fatfile, 0, SEEK_SET);
|
||||||
fread (readbuffer, 1, ZIPCHUNK, filehandle);
|
fread (readbuffer, 1, ZIPCHUNK, fatfile);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 1: // DVD
|
case 1: // DVD
|
||||||
dvd_read (readbuffer, ZIPCHUNK, inoffset);
|
dvd_read (readbuffer, ZIPCHUNK, discoffset);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 2: // From buffer
|
case 2: // From SMB
|
||||||
memcpy(readbuffer, outbuffer, ZIPCHUNK);
|
SMB_ReadFile(readbuffer, ZIPCHUNK, 0, smbfile);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -168,18 +172,18 @@ UnZipBuffer (unsigned char *outbuffer, u64 inoffset, short where, FILE* filehand
|
|||||||
|
|
||||||
switch (where)
|
switch (where)
|
||||||
{
|
{
|
||||||
case 0: // SD Card
|
case 0: // SD Card
|
||||||
fread (readbuffer, 1, ZIPCHUNK, filehandle);
|
fread (readbuffer, 1, ZIPCHUNK, fatfile);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 1: // DVD
|
case 1: // DVD
|
||||||
inoffset += ZIPCHUNK;
|
readoffset += ZIPCHUNK;
|
||||||
dvd_read (readbuffer, ZIPCHUNK, inoffset);
|
dvd_read (readbuffer, ZIPCHUNK, discoffset+readoffset);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 2: // From buffer
|
case 2: // From SMB
|
||||||
inoffset += ZIPCHUNK;
|
readoffset += ZIPCHUNK;
|
||||||
memcpy(readbuffer, outbuffer+inoffset, ZIPCHUNK);
|
SMB_ReadFile(readbuffer, ZIPCHUNK, readoffset, smbfile);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -197,3 +201,24 @@ UnZipBuffer (unsigned char *outbuffer, u64 inoffset, short where, FILE* filehand
|
|||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
// Reading from FAT
|
||||||
|
int
|
||||||
|
UnZipFile (unsigned char *outbuffer, FILE* infile)
|
||||||
|
{
|
||||||
|
fatfile = infile;
|
||||||
|
return UnZipBuffer(outbuffer, 0);
|
||||||
|
}
|
||||||
|
// Reading from DVD
|
||||||
|
int
|
||||||
|
UnZipFile (unsigned char *outbuffer, u64 inoffset)
|
||||||
|
{
|
||||||
|
discoffset = inoffset;
|
||||||
|
return UnZipBuffer(outbuffer, 1);
|
||||||
|
}
|
||||||
|
// Reading from SMB
|
||||||
|
int
|
||||||
|
UnZipFile (unsigned char *outbuffer, SMBFILE infile)
|
||||||
|
{
|
||||||
|
smbfile = infile;
|
||||||
|
return UnZipBuffer(outbuffer, 2);
|
||||||
|
}
|
||||||
|
@ -8,9 +8,14 @@
|
|||||||
#ifndef _UNZIP_
|
#ifndef _UNZIP_
|
||||||
#define _UNZIP_
|
#define _UNZIP_
|
||||||
|
|
||||||
|
#include <smb.h>
|
||||||
|
|
||||||
extern int IsZipFile (char *buffer);
|
extern int IsZipFile (char *buffer);
|
||||||
int UnZipBuffer(unsigned char *outbuffer, unsigned char *inbuffer);
|
|
||||||
int UnZipBuffer (unsigned char *outbuffer, u64 discoffset, short where, FILE* filehandle);
|
int UnZipFile (unsigned char *outbuffer, FILE* infile); // Reading from FAT
|
||||||
|
int UnZipFile (unsigned char *outbuffer, u64 inoffset); // Reading from DVD
|
||||||
|
int UnZipFile (unsigned char *outbuffer, SMBFILE infile); // Reading from SMB
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Zip file header definition
|
* Zip file header definition
|
||||||
*/
|
*/
|
||||||
|
Loading…
x
Reference in New Issue
Block a user