mirror of https://github.com/snes9xgit/snes9x.git
Bringing together snes9x-sdl fork from @domaemon into current snes9x master
This commit is contained in:
parent
3351c3b820
commit
483e2a5bbd
Binary file not shown.
|
@ -0,0 +1,147 @@
|
|||
|
||||
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 - 2010 Brad Jorsch (anomie@users.sourceforge.net),
|
||||
Nach (n-a-c-h@users.sourceforge.net),
|
||||
|
||||
(c) Copyright 2002 - 2011 zones (kasumitokoduck@yahoo.com)
|
||||
|
||||
(c) Copyright 2006 - 2007 nitsuja
|
||||
|
||||
(c) Copyright 2009 - 2011 BearOso,
|
||||
OV2
|
||||
|
||||
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 used in 1.39-1.51
|
||||
(c) Copyright 2002 Matthew Kendora with research by
|
||||
zsKnight,
|
||||
John Weidman,
|
||||
Dark Force
|
||||
|
||||
SPC7110 and RTC C++ emulator code used in 1.52+
|
||||
(c) Copyright 2009 byuu,
|
||||
neviksti
|
||||
|
||||
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 emulator code used in 1.5-1.51
|
||||
(c) Copyright 1998 - 2003 Brad Martin
|
||||
(c) Copyright 1998 - 2006 Charles Bilyue'
|
||||
|
||||
Sound emulator code used in 1.52+
|
||||
(c) Copyright 2004 - 2007 Shay Green (gblargg@gmail.com)
|
||||
|
||||
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)
|
||||
|
||||
NTSC filter
|
||||
(c) Copyright 2006 - 2007 Shay Green
|
||||
|
||||
GTK+ GUI code
|
||||
(c) Copyright 2004 - 2011 BearOso
|
||||
|
||||
Win32 GUI code
|
||||
(c) Copyright 2003 - 2006 blip,
|
||||
funkyass,
|
||||
Matthew Kendora,
|
||||
Nach,
|
||||
nitsuja
|
||||
(c) Copyright 2009 - 2011 OV2
|
||||
|
||||
Mac OS GUI code
|
||||
(c) Copyright 1998 - 2001 John Stiles
|
||||
(c) Copyright 2001 - 2011 zones
|
||||
|
||||
|
|
@ -0,0 +1,96 @@
|
|||
@S9XDEBUGGER@
|
||||
@S9XNETPLAY@
|
||||
@S9XZIP@
|
||||
@S9XJMA@
|
||||
|
||||
# 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 = .
|
||||
|
||||
OBJECTS = ../apu/apu.o ../apu/SNES_SPC.o ../apu/SNES_SPC_misc.o ../apu/SNES_SPC_state.o ../apu/SPC_DSP.o ../apu/SPC_Filter.o ../bsx.o ../c4.o ../c4emu.o ../cheats.o ../cheats2.o ../clip.o ../conffile.o ../controls.o ../cpu.o ../cpuexec.o ../cpuops.o ../crosshairs.o ../dma.o ../dsp.o ../dsp1.o ../dsp2.o ../dsp3.o ../dsp4.o ../fxinst.o ../fxemu.o ../gfx.o ../globals.o ../logger.o ../memmap.o ../movie.o ../obc1.o ../ppu.o ../reader.o ../sa1.o ../sa1cpu.o ../screenshot.o ../sdd1.o ../sdd1emu.o ../seta.o ../seta010.o ../seta011.o ../seta018.o ../snapshot.o ../snes9x.o ../spc7110.o ../srtc.o ../tile.o ../filter/2xsai.o ../filter/blit.o ../filter/epx.o ../filter/hq2x.o ../filter/snes_ntsc.o sdlmain.o sdlinput.o sdlvideo.o sdlaudio.o
|
||||
|
||||
ifdef S9XDEBUGGER
|
||||
OBJECTS += ../debug.o ../fxdbg.o
|
||||
endif
|
||||
|
||||
ifdef S9XNETPLAY
|
||||
OBJECTS += ../netplay.o ../server.o
|
||||
endif
|
||||
|
||||
ifdef S9XZIP
|
||||
OBJECTS += ../loadzip.o ../unzip/ioapi.o ../unzip/unzip.o
|
||||
endif
|
||||
|
||||
ifdef S9XJMA
|
||||
OBJECTS += ../jma/7zlzma.o ../jma/crc32.o ../jma/iiostrm.o ../jma/inbyte.o ../jma/jma.o ../jma/lzma.o ../jma/lzmadec.o ../jma/s9x-jma.o ../jma/winout.o
|
||||
endif
|
||||
|
||||
CCC = @CXX@
|
||||
CC = @CC@
|
||||
GASM = @CXX@
|
||||
INCLUDES = -I. -I.. -I../apu/ -I../unzip/ -I../jma/ -I../filter/
|
||||
|
||||
CCFLAGS = @S9XFLGS@ @S9XDEFS@ $(DEFS)
|
||||
CFLAGS = $(CCFLAGS)
|
||||
|
||||
.SUFFIXES: .o .cpp .c .cc .h .m .i .s .obj
|
||||
|
||||
all: Makefile configure snes9x-sdl
|
||||
|
||||
Makefile: configure Makefile.in
|
||||
@echo "Makefile is older than configure or in-file. Run configure or touch Makefile."
|
||||
exit 1
|
||||
|
||||
configure: configure.ac
|
||||
@echo "configure is older than in-file. Run autoconf or touch configure."
|
||||
exit 1
|
||||
|
||||
snes9x-sdl: $(OBJECTS)
|
||||
$(CCC) $(INCLUDES) -o $@ $(OBJECTS) -lm @S9XLIBS@
|
||||
|
||||
../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 $@
|
||||
|
||||
.obj.o:
|
||||
cp $*.obj $*.o
|
||||
|
||||
clean:
|
||||
rm -f $(OBJECTS)
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,403 @@
|
|||
AC_PREREQ([2.60])
|
||||
AC_INIT([Snes9x], [1.53], [], [snes9x])
|
||||
AC_REVISION([$Revision: 1.53 $])
|
||||
|
||||
AC_CONFIG_SRCDIR([sdlmain.cpp])
|
||||
|
||||
AC_CANONICAL_TARGET
|
||||
|
||||
AC_PROG_CC
|
||||
AC_PROG_CXX
|
||||
AC_LANG([C++])
|
||||
|
||||
S9XFLGS=""
|
||||
S9XDEFS=""
|
||||
S9XLIBS=""
|
||||
|
||||
AC_DEFUN([AC_S9X_COMPILER_FLAG],
|
||||
[
|
||||
AC_MSG_CHECKING([whether g++ accepts $1])
|
||||
|
||||
AC_CACHE_VAL([snes9x_cv_option_$2],
|
||||
[
|
||||
OLD_CXXFLAGS="[$]CXXFLAGS"
|
||||
CXXFLAGS="[$]OLD_CXXFLAGS $1"
|
||||
|
||||
AC_TRY_RUN(
|
||||
[
|
||||
int foo;
|
||||
|
||||
int main (int argc, char **argv)
|
||||
{
|
||||
/* The following code triggs gcc:s generation of aline opcodes,
|
||||
which some versions of as does not support. */
|
||||
|
||||
if (argc > 0)
|
||||
argc = 0;
|
||||
|
||||
return (argc);
|
||||
}
|
||||
],
|
||||
[snes9x_cv_option_$2="yes"], [snes9x_cv_option_$2="no"])
|
||||
])
|
||||
|
||||
CXXFLAGS="[$]OLD_CXXFLAGS"
|
||||
|
||||
if test "x[$]snes9x_cv_option_$2" = "xyes"; then
|
||||
S9XFLGS="[$]S9XFLGS $1"
|
||||
AC_MSG_RESULT([yes])
|
||||
else
|
||||
AC_MSG_RESULT([no])
|
||||
$3
|
||||
fi
|
||||
])
|
||||
|
||||
# *****************************
|
||||
# *** Execution begins here ***
|
||||
# *****************************
|
||||
|
||||
# Remove -g and -O2 flags manually.
|
||||
|
||||
if test "x$CFLAGS" != "x"; then
|
||||
CFLAGS="`echo \"$CFLAGS\" | sed -e 's/-g//'`"
|
||||
CFLAGS="`echo \"$CFLAGS\" | sed -e 's/-O2//'`"
|
||||
fi
|
||||
|
||||
if test "x$CXXFLAGS" != "x"; then
|
||||
CXXFLAGS="`echo \"$CXXFLAGS\" | sed -e 's/-g//'`"
|
||||
CXXFLAGS="`echo \"$CXXFLAGS\" | sed -e 's/-O2//'`"
|
||||
fi
|
||||
|
||||
# Test what compiler flags we should use.
|
||||
|
||||
AC_ARG_ENABLE([debug],
|
||||
[AS_HELP_STRING([--enable-debug],
|
||||
[leave debug information in the final binary (default: no)])],
|
||||
[], [enable_debug="no"])
|
||||
|
||||
if test "x$enable_debug" = "xyes"; then
|
||||
AC_S9X_COMPILER_FLAG([-g], [g])
|
||||
AC_S9X_COMPILER_FLAG([-O0], [o0])
|
||||
else
|
||||
AC_S9X_COMPILER_FLAG([-O3], [o3], [
|
||||
AC_S9X_COMPILER_FLAG([-O2], [o2], [
|
||||
AC_S9X_COMPILER_FLAG([-O1], [o1])])])
|
||||
AC_S9X_COMPILER_FLAG([-fomit-frame-pointer], [omit_frame_pointer])
|
||||
fi
|
||||
|
||||
# <domaemon>: --enable-neon
|
||||
|
||||
AC_ARG_ENABLE([neon],
|
||||
[AS_HELP_STRING([--enable-neon],
|
||||
[use the optimisation flag to enable NEON instructions (default: no)])],
|
||||
[], [enable_neon="no"])
|
||||
|
||||
if test "x$enable_neon" != "xno"; then
|
||||
AC_S9X_COMPILER_FLAG(["-mfpu=neon"], [mfpu],
|
||||
[
|
||||
AC_MSG_ERROR(["NEON optimisation flag was not accepted."])
|
||||
])
|
||||
|
||||
AC_S9X_COMPILER_FLAG(["-Wa,-march=armv7a"], [march])
|
||||
AC_S9X_COMPILER_FLAG(["-fprefetch-loop-arrays"], [prefetch])
|
||||
fi
|
||||
|
||||
# </domaemon>
|
||||
|
||||
AC_S9X_COMPILER_FLAG([-fno-exceptions], [no_exceptions])
|
||||
AC_S9X_COMPILER_FLAG([-fno-rtti], [no_rtti])
|
||||
AC_S9X_COMPILER_FLAG([-pedantic], [pedantic])
|
||||
AC_S9X_COMPILER_FLAG([-Wall], [Wall])
|
||||
AC_S9X_COMPILER_FLAG([-W], [W])
|
||||
AC_S9X_COMPILER_FLAG([-Wno-unused-parameter], [Wno_unused_parameter])
|
||||
|
||||
# Enable debugger.
|
||||
|
||||
S9XDEBUGGER="#S9XDEBUGGER=1"
|
||||
|
||||
AC_ARG_ENABLE([debugger],
|
||||
[AS_HELP_STRING([--enable-debugger],
|
||||
[enable debugger (default: no)])],
|
||||
[], [enable_debugger="no"])
|
||||
|
||||
if test "x$enable_debugger" = "xyes"; then
|
||||
S9XDEBUGGER="S9XDEBUGGER=1"
|
||||
S9XDEFS="$S9XDEFS -DDEBUGGER"
|
||||
fi
|
||||
|
||||
# Enable netplay support if requested.
|
||||
|
||||
S9XNETPLAY="#S9XNETPLAY=1"
|
||||
|
||||
AC_ARG_ENABLE([netplay],
|
||||
[AS_HELP_STRING([--enable-netplay],
|
||||
[enable netplay support (default: no)])],
|
||||
[], [enable_netplay="no"])
|
||||
|
||||
if test "x$enable_netplay" = "xyes"; then
|
||||
S9XNETPLAY="S9XNETPLAY=1"
|
||||
S9XDEFS="$S9XDEFS -DNETPLAY_SUPPORT"
|
||||
fi
|
||||
|
||||
# Enable GZIP support through zlib.
|
||||
|
||||
AC_CACHE_VAL([snes9x_cv_zlib],
|
||||
[
|
||||
AC_CHECK_HEADER([zlib.h],
|
||||
[AC_CHECK_LIB([z], [gzread], [snes9x_cv_zlib="yes"], [snes9x_cv_zlib="no"])],
|
||||
[snes9x_cv_zlib="no"])
|
||||
])
|
||||
|
||||
AC_ARG_ENABLE([gzip],
|
||||
[AS_HELP_STRING([--enable-gzip],
|
||||
[enable GZIP support through zlib (default: yes)])],
|
||||
[], [enable_gzip="yes"])
|
||||
|
||||
if test "x$enable_gzip" = "xyes"; then
|
||||
if test "x$snes9x_cv_zlib" = "xyes"; then
|
||||
S9XDEFS="$S9XDEFS -DZLIB"
|
||||
S9XLIBS="$S9XLIBS -lz"
|
||||
else
|
||||
AC_MSG_WARN([zlib not found. Build without GZIP support.])
|
||||
enable_gzip="no"
|
||||
fi
|
||||
fi
|
||||
|
||||
# Enable ZIP support through zlib.
|
||||
|
||||
S9XZIP="#S9XZIP=1"
|
||||
|
||||
AC_ARG_ENABLE([zip],
|
||||
[AS_HELP_STRING([--enable-zip],
|
||||
[enable ZIP support through zlib (default: yes)])],
|
||||
[], [enable_zip="yes"])
|
||||
|
||||
if test "x$enable_zip" = "xyes"; then
|
||||
if test "x$snes9x_cv_zlib" = "xyes"; then
|
||||
S9XZIP="S9XZIP=1"
|
||||
S9XDEFS="$S9XDEFS -DUNZIP_SUPPORT"
|
||||
if test "x$enable_gzip" = "xno"; then
|
||||
S9XLIBS="$S9XLIBS -lz"
|
||||
fi
|
||||
else
|
||||
AC_MSG_WARN([zlib not found. Build without ZIP support.])
|
||||
enable_zip="no"
|
||||
fi
|
||||
fi
|
||||
|
||||
# Enable JMA support.
|
||||
|
||||
S9XJMA="#S9XJMA=1"
|
||||
|
||||
AC_ARG_ENABLE([jma],
|
||||
[AS_HELP_STRING([--enable-jma],
|
||||
[enable JMA support (default: yes)])],
|
||||
[], [enable_jma="yes"])
|
||||
|
||||
if test "x$enable_jma" = "xyes"; then
|
||||
S9XJMA="S9XJMA=1"
|
||||
S9XDEFS="$S9XDEFS -DJMA_SUPPORT"
|
||||
fi
|
||||
|
||||
# Enable screenshot support through libpng.
|
||||
|
||||
AC_CACHE_VAL([snes9x_cv_libpng],
|
||||
[
|
||||
AC_CHECK_HEADER([png.h],
|
||||
[AC_CHECK_LIB([png], [png_init_io], [snes9x_cv_libpng="yes"], [snes9x_cv_libpng="no"])],
|
||||
[snes9x_cv_libpng="no"])
|
||||
])
|
||||
|
||||
AC_ARG_ENABLE([screenshot],
|
||||
[AS_HELP_STRING([--enable-screenshot],
|
||||
[enable screenshot support through libpng (default: yes)])],
|
||||
[], [enable_screenshot="yes"])
|
||||
|
||||
if test "x$enable_screenshot" = "xyes"; then
|
||||
if test "x$snes9x_cv_libpng" = "xyes"; then
|
||||
S9XDEFS="$S9XDEFS -DHAVE_LIBPNG"
|
||||
S9XLIBS="$S9XLIBS -lpng"
|
||||
else
|
||||
AC_MSG_WARN([libpng not found. Build without screenshot support.])
|
||||
enable_screenshot="no"
|
||||
fi
|
||||
fi
|
||||
|
||||
# Check for functions
|
||||
|
||||
AC_CHECK_FUNC([mkstemp],
|
||||
[
|
||||
S9XDEFS="$S9XDEFS -DHAVE_MKSTEMP"
|
||||
])
|
||||
|
||||
# <domaemon>: Check SDL, messy.
|
||||
|
||||
AC_CACHE_VAL([snes9x_cv_sdl],
|
||||
[
|
||||
AC_CHECK_HEADER([SDL/SDL.h],
|
||||
[AC_CHECK_LIB([SDL], [SDL_Init], [snes9x_cv_sdl="yes"], [snes9x_cv_sdl="no"])],
|
||||
[snes9x_cv_sdl="no"])
|
||||
])
|
||||
|
||||
if test "x$snes9x_cv_sdl" = "xyes"; then
|
||||
S9XFLGS="$S9XFLGS `sdl-config --cflags`"
|
||||
S9XLIBS="$S9XLIBS `sdl-config --libs`"
|
||||
else
|
||||
AC_MSG_ERROR([SDL is required.])
|
||||
fi
|
||||
|
||||
###
|
||||
|
||||
|
||||
# </domaemon>
|
||||
|
||||
# Check for headers
|
||||
|
||||
snes9x_have_stdint_h="";
|
||||
|
||||
AC_CHECK_HEADER([strings.h],
|
||||
[
|
||||
S9XDEFS="$S9XDEFS -DHAVE_STRINGS_H"
|
||||
])
|
||||
|
||||
AC_CHECK_HEADER([sys/ioctl.h],
|
||||
[
|
||||
S9XDEFS="$S9XDEFS -DHAVE_SYS_IOCTL_H"
|
||||
])
|
||||
|
||||
AC_CHECK_HEADER([stdint.h],
|
||||
[
|
||||
S9XDEFS="$S9XDEFS -DHAVE_STDINT_H"
|
||||
snes9x_have_stdint_h="-DHAVE_STDINT_H"
|
||||
])
|
||||
|
||||
AC_CHECK_HEADERS([unistd.h sys/socket.h])
|
||||
|
||||
# Check whether the size of pointer is int.
|
||||
|
||||
if test "x$snes9x_have_stdint_h" = "x"; then
|
||||
AC_MSG_CHECKING([whether the size of pointer is int])
|
||||
|
||||
AC_TRY_RUN(
|
||||
[
|
||||
int main (void)
|
||||
{
|
||||
return (!(sizeof(void *) == sizeof(int)));
|
||||
}
|
||||
],
|
||||
[snes9x_ptr_is_int="yes"], [snes9x_ptr_is_int="no"])
|
||||
|
||||
if test "x$snes9x_ptr_is_int" = "xyes"; then
|
||||
AC_MSG_RESULT(yes)
|
||||
else
|
||||
AC_MSG_RESULT(no)
|
||||
S9XDEFS="$S9XDEFS -DPTR_NOT_INT"
|
||||
fi
|
||||
fi
|
||||
|
||||
# Check whether right shift is arithmetic or not
|
||||
|
||||
AC_DEFUN([AC_S9X_CHECK_SAR],
|
||||
[
|
||||
AC_MSG_CHECKING([whether right shift $1 is arithmetic])
|
||||
|
||||
OLD_CXXFLAGS="[$]CXXFLAGS"
|
||||
CXXFLAGS="[$]OLD_CXXFLAGS $snes9x_have_stdint_h"
|
||||
|
||||
AC_TRY_RUN(
|
||||
[
|
||||
#ifdef HAVE_STDINT_H
|
||||
#include <stdint.h>
|
||||
typedef int8_t int8;
|
||||
typedef int16_t int16;
|
||||
typedef int32_t int32;
|
||||
typedef int64_t int64;
|
||||
#else
|
||||
typedef signed char int8;
|
||||
typedef signed short int16;
|
||||
typedef signed int int32;
|
||||
#ifdef __GNUC__
|
||||
__extension__
|
||||
#endif
|
||||
typedef long long int64;
|
||||
#endif
|
||||
|
||||
int main (void)
|
||||
{
|
||||
$1 i;
|
||||
|
||||
i = -1;
|
||||
i >>= 1;
|
||||
|
||||
return (i < 0 ? 0 : 1);
|
||||
}
|
||||
],
|
||||
[snes9x_sar_$1="yes"], [snes9x_sar_$1="no"])
|
||||
|
||||
CXXFLAGS="[$]OLD_CXXFLAGS"
|
||||
|
||||
if test "x$snes9x_sar_$1" = "xno"; then
|
||||
AC_MSG_RESULT([no])
|
||||
else
|
||||
S9XDEFS="$S9XDEFS -DRIGHTSHIFT_$1_IS_SAR"
|
||||
AC_MSG_RESULT([yes])
|
||||
fi
|
||||
])
|
||||
|
||||
AC_S9X_CHECK_SAR([int8])
|
||||
AC_S9X_CHECK_SAR([int16])
|
||||
AC_S9X_CHECK_SAR([int32])
|
||||
AC_S9X_CHECK_SAR([int64])
|
||||
|
||||
if test "x$snes9x_sar_int8" = "xyes" -a "x$snes9x_sar_int16" = "xyes" -a "x$snes9x_sar_int32" = "xyes" -a "x$snes9x_sar_int64" = "xyes"; then
|
||||
S9XDEFS="`echo \"$S9XDEFS\" | sed -e 's/-DRIGHTSHIFT_int8_IS_SAR//'`"
|
||||
S9XDEFS="`echo \"$S9XDEFS\" | sed -e 's/-DRIGHTSHIFT_int16_IS_SAR//'`"
|
||||
S9XDEFS="`echo \"$S9XDEFS\" | sed -e 's/-DRIGHTSHIFT_int32_IS_SAR//'`"
|
||||
S9XDEFS="`echo \"$S9XDEFS\" | sed -e 's/-DRIGHTSHIFT_int64_IS_SAR//'`"
|
||||
S9XDEFS="$S9XDEFS -DRIGHTSHIFT_IS_SAR"
|
||||
fi
|
||||
|
||||
# Output.
|
||||
|
||||
S9XFLGS="$CXXFLAGS $CPPFLAGS $LDFLAGS $S9XFLGS"
|
||||
S9XLIBS="$LIBS $S9XLIBS"
|
||||
|
||||
S9XFLGS="`echo \"$S9XFLGS\" | sed -e 's/ */ /g'`"
|
||||
S9XDEFS="`echo \"$S9XDEFS\" | sed -e 's/ */ /g'`"
|
||||
S9XLIBS="`echo \"$S9XLIBS\" | sed -e 's/ */ /g'`"
|
||||
S9XFLGS="`echo \"$S9XFLGS\" | sed -e 's/^ *//'`"
|
||||
S9XDEFS="`echo \"$S9XDEFS\" | sed -e 's/^ *//'`"
|
||||
S9XLIBS="`echo \"$S9XLIBS\" | sed -e 's/^ *//'`"
|
||||
|
||||
AC_SUBST(S9XFLGS)
|
||||
AC_SUBST(S9XDEFS)
|
||||
AC_SUBST(S9XLIBS)
|
||||
AC_SUBST(S9XDEBUGGER)
|
||||
AC_SUBST(S9XNETPLAY)
|
||||
AC_SUBST(S9XZIP)
|
||||
AC_SUBST(S9XJMA)
|
||||
|
||||
rm config.info 2>/dev/null
|
||||
|
||||
cat >config.info <<EOF
|
||||
|
||||
build information:
|
||||
cc...............,,,. $CC
|
||||
c++.................. $CXX
|
||||
options.............. $S9XFLGS
|
||||
defines.............. $S9XDEFS
|
||||
libs................. $S9XLIBS
|
||||
|
||||
features:
|
||||
screenshot support... $enable_screenshot
|
||||
netplay support...... $enable_netplay
|
||||
GZIP support......... $enable_gzip
|
||||
ZIP support.......... $enable_zip
|
||||
JMA support.......... $enable_jma
|
||||
debugger............. $enable_debugger
|
||||
|
||||
EOF
|
||||
|
||||
cat config.info
|
||||
|
||||
AC_OUTPUT(Makefile)
|
|
@ -0,0 +1,113 @@
|
|||
Control-input for snes9x-sdl
|
||||
makoto.sugano@gmail.com
|
||||
|
||||
This document is based on snes9x/doc/control*
|
||||
It is recommended to read controls.txt and control-inputs.txt
|
||||
to gain the basic understandings over how the control inputs are handled in
|
||||
general in sne9x.
|
||||
|
||||
Compared to the snes9x/unix/x11.cpp, the supported inputs are
|
||||
reduced in snes9x-sdl by default. This is to simplify the design and the make
|
||||
the porting to other platforms even easier. Additionally, keyboard identifier
|
||||
has been changed to ease the SDL coding.
|
||||
|
||||
The following features are either removed or not tested.
|
||||
|
||||
- Joystick MOD keys.
|
||||
- Mouse pointer input.
|
||||
- Port specific commands
|
||||
|
||||
The following features are added/modified on the unix/x11.cpp
|
||||
|
||||
+ <keyname> is now SDL_keysym (see the /usr/include/SDL/SDL_keysym.h).
|
||||
|
||||
================================================================================
|
||||
Unix/SDL
|
||||
================================================================================
|
||||
|
||||
Joystick Input:
|
||||
|
||||
Jxx:Hat{Up,Down,Left,Right} Hats direction on joystick xx.
|
||||
Jxx:Axis# Axis # on joystick xx. Axis0 may be
|
||||
Up/Down, and Axis1 Left/Right.
|
||||
Jxx:B# Button # on joystick xx.
|
||||
|
||||
Keyboard Input:
|
||||
|
||||
K00:<keyname> Key names are as recognized by SDL_keysym.
|
||||
K00:<mods>+<keyname> Keyboard modifiers are S=Shift, C=Control,
|
||||
A=Alt, M=Meta. Combine them in order,
|
||||
i.e. all 4 would be "SCAM".
|
||||
|
||||
Pointer Input:
|
||||
|
||||
M00:Pointer Map the mouse pointer. If someone has a mouse
|
||||
M00:B# Mouse buttons.
|
||||
|
||||
================================================================================
|
||||
S9xMapButton/S9xMapAxis/S9xMapPointer ID structure
|
||||
================================================================================
|
||||
|
||||
MapButton ID is a 32bit integer value to inform the button ID to the snes9x engine
|
||||
from the frontend.
|
||||
|
||||
=== S9xMapButton (id, command, poll); Keyboard and Joystick. ===
|
||||
|
||||
id is a 32 bit integer that follows the below protocol.
|
||||
|
||||
|AB|CD|EF|GH|
|
||||
|
||||
switch A (4 bit)
|
||||
case 0: keyboard device
|
||||
case 8: joystick device
|
||||
|
||||
switch B (4 bit)
|
||||
case 0: the 1st keyboard/joystick
|
||||
case 1: the 2nd joystick
|
||||
...
|
||||
case 7: the 8th joystick
|
||||
|
||||
#if (keyboard)
|
||||
|
||||
switch ABCD (16 bit)
|
||||
case KMOD_x: MOD key masks.
|
||||
|
||||
switch FGH (12 bit)
|
||||
case SDLK_a: SDL_keysym (e.g. SDLK_a)
|
||||
|
||||
#elif (joystick)
|
||||
|
||||
switch FGH (12 bit)
|
||||
event.jbutton.button (0, 1, 2...)
|
||||
|
||||
#endif
|
||||
|
||||
=== S9xMapAxis (id, command, poll); Joystick only. ===
|
||||
|
||||
id is a 32 bit integer that follows the below protocol.
|
||||
|
||||
|AB|CD|EF|GH|
|
||||
|
||||
switch A (4 bit)
|
||||
case 8: J device
|
||||
|
||||
switch B (4 bit)
|
||||
case 0: the 1st joystick
|
||||
case 1: the 2nd joystick
|
||||
...
|
||||
case 7: the 8th joystick
|
||||
|
||||
switch E (upper 1 bit)
|
||||
case 8: Axis mode
|
||||
|
||||
switch FGH (12 bit)
|
||||
case d: event.jaxis.axis (left/right or up/down)
|
||||
|
||||
=== S9xMapPointer (id, command, poll); Mouse only. ===
|
||||
|
||||
switch A (4 bit)
|
||||
case 4: M device
|
||||
|
||||
switch B (4 bit)
|
||||
case 0: the 1st mouse
|
||||
|
|
@ -0,0 +1,808 @@
|
|||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
|
||||
<html lang="en-US">
|
||||
<head>
|
||||
<meta http-equiv="content-type" content="text/html;charset=iso-8859-1">
|
||||
<meta http-equiv="content-style-type" content="text/css">
|
||||
<meta name="description" content="Snes9x for Unix">
|
||||
<style type="text/css">
|
||||
<!-- ul { list-style-type:none } h2 { margin-top:3em } h3 { margin-top:3em } -->
|
||||
</style>
|
||||
<title>Snes9x for Unix</title>
|
||||
</head>
|
||||
<body>
|
||||
<div style="text-align:center"><h1>Snes9x for Unix</h1></div>
|
||||
<h2>Introduction</h2>
|
||||
<h3>What is Snes9x?</h3>
|
||||
<p>
|
||||
Snes9x is a portable, freeware Super Nintendo Entertainment System (SNES) emulator. It basically allows you to play most games designed for the SNES and Super Famicom Nintendo game systems on your Mac, Linux, Windows and so on. The games include some real gems that were only ever released in Japan.
|
||||
</p>
|
||||
<p>
|
||||
The original Snes9x project was founded by Gary Henderson and Jerremy Koot as a collaboration of their earlier attempts at SNES emulation (Snes96 and Snes97.) Over the years the project has grown and has collected some of the greatest talent in the emulation community (at least of the SNES variety) some of which have been listed in the credits section, others have helped but have been loss in the course of time.
|
||||
</p>
|
||||
<h3>Why Emulate the SNES?</h3>
|
||||
<p>
|
||||
Well, there are many reasons for this. The main reason is for nostalgic purposes. In this day and age, it's hard to find an SNES and many good games. Plus, many of us over the course of time have lost our beloved consoles (may they R.I.P) but still have our original carts. With no other means to play them, we turn to emulators. Besides this there are many conveniences of doing this on the computer instead of dragging out your old system.
|
||||
</p>
|
||||
<h4>Advantages consist of :</h4>
|
||||
<ul style="list-style-type:disc">
|
||||
<li>ability to save in any location of the game, despite how the game was designed. It's amazingly useful when you don't want to redo the same level over and over.</li>
|
||||
<li>built-in peripherals. This is anything from multi-taps, to super scopes, to cheat devices.</li>
|
||||
<li>ability to rip sprites and music for your own personal use.</li>
|
||||
<li>easier to organize and no stacks of cartridges.</li>
|
||||
<li>filters can be used to enhance graphics and sounds on old games.</li>
|
||||
</ul>
|
||||
<h4>As with all things there are disadvantages though :</h4>
|
||||
<ul style="list-style-type:disc">
|
||||
<li>if you have an ancient computer, you aren't likely to get a playable experience.</li>
|
||||
<li>some games are still unemulated (though this a very tiny minority.)</li>
|
||||
<li>the emulator can be difficult for new users to configure.</li>
|
||||
</ul>
|
||||
<h2>Getting Started</h2>
|
||||
<p>
|
||||
Usage:
|
||||
</p>
|
||||
<ul>
|
||||
<li><code>snes9x [options] <ROM image file></code></li>
|
||||
</ul>
|
||||
<p>
|
||||
Use <code>-help</code> option to see available options.
|
||||
</p>
|
||||
<p>
|
||||
SNES ROM images come in lots of different formats. Snes9x supports zipped ROMs as long as there is only 1 per zip file. Also Snes9x can open gzip and jma compressed files.
|
||||
</p>
|
||||
<h3>Game Color System</h3>
|
||||
<p>
|
||||
By default, Snes9x displays the ROM information when a ROM is first loaded. Depending on the colors used you can tell whether or not a ROM is a good working ROM, or if it's been altered or is corrupted.
|
||||
</p>
|
||||
<ul>
|
||||
<li><table summary="text color">
|
||||
<tbody>
|
||||
<tr valign="top">
|
||||
<td style="width:15em">white</td>
|
||||
<td>the ROM should be a perfect working copy.</td>
|
||||
</tr>
|
||||
<tr valign="top">
|
||||
<td style="width:15em">green</td>
|
||||
<td>the ROM is mode 1 interleaved.</td>
|
||||
</tr>
|
||||
<tr valign="top">
|
||||
<td style="width:15em">orange</td>
|
||||
<td>the ROM is mode 2 interleaved.</td>
|
||||
</tr>
|
||||
<tr valign="top">
|
||||
<td style="width:15em">aqua</td>
|
||||
<td>the ROM is Game Doctor 24M interleaved.</td>
|
||||
</tr>
|
||||
<tr valign="top">
|
||||
<td style="width:15em">yellow</td>
|
||||
<td>the ROM has probably been altered. Either it's a translation, PD ROM, hacked, or possibly a bad ROM. It may also be an overdumped ROM.</td>
|
||||
</tr>
|
||||
<tr valign="top">
|
||||
<td style="width:15em">red</td>
|
||||
<td>the ROM is definitely hacked and that a proper version should be exist. Some ROM Tools such as NSRT can also fix these ROMs.</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table></li>
|
||||
</ul>
|
||||
<p>
|
||||
When asking for help on the Snes9x forums, please list the color and CRC32 that is displayed. This will help to find out what the problem is.
|
||||
</p>
|
||||
<p>
|
||||
These colors do NOT signify whether a game will work or not. It is just a means for reference so we can understand what may or may not be a problem. Most often the problem with games that don't work it's because they are corrupt or are a bad dump and should be redumped.
|
||||
</p>
|
||||
<h3>SNES Joypad Emulation</h3>
|
||||
<p>
|
||||
The default key mapping for joypad 1 is as follows:
|
||||
</p>
|
||||
<ul>
|
||||
<li><table summary="default key mapping 1P">
|
||||
<tbody>
|
||||
<tr valign="top">
|
||||
<td style="width:15em">U or Up</td>
|
||||
<td>Up direction</td>
|
||||
</tr>
|
||||
<tr valign="top">
|
||||
<td style="width:15em">J or Down</td>
|
||||
<td>Down direction</td>
|
||||
</tr>
|
||||
<tr valign="top">
|
||||
<td style="width:15em">H or Left</td>
|
||||
<td>Left direction</td>
|
||||
</tr>
|
||||
<tr valign="top">
|
||||
<td style="width:15em">K or Right</td>
|
||||
<td>Right direction</td>
|
||||
</tr>
|
||||
<tr valign="top">
|
||||
<td style="width:15em">D</td>
|
||||
<td>A button</td>
|
||||
</tr>
|
||||
<tr valign="top">
|
||||
<td style="width:15em">C</td>
|
||||
<td>B button</td>
|
||||
</tr>
|
||||
<tr valign="top">
|
||||
<td style="width:15em">S</td>
|
||||
<td>X button</td>
|
||||
</tr>
|
||||
<tr valign="top">
|
||||
<td style="width:15em">X</td>
|
||||
<td>Y button</td>
|
||||
</tr>
|
||||
<tr valign="top">
|
||||
<td style="width:15em">A</td>
|
||||
<td>L button</td>
|
||||
</tr>
|
||||
<tr valign="top">
|
||||
<td style="width:15em">Z</td>
|
||||
<td>R button</td>
|
||||
</tr>
|
||||
<tr valign="top">
|
||||
<td style="width:15em">Space</td>
|
||||
<td>Select button</td>
|
||||
</tr>
|
||||
<tr valign="top">
|
||||
<td style="width:15em">Return</td>
|
||||
<td>Start button</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table></li>
|
||||
</ul>
|
||||
<p>
|
||||
And the default key mapping for joypad 2 is as follows:
|
||||
</p>
|
||||
<ul>
|
||||
<li><table summary="default key mapping 2P">
|
||||
<tbody>
|
||||
<tr valign="top">
|
||||
<td style="width:15em">Keypad 8</td>
|
||||
<td>Up direction</td>
|
||||
</tr>
|
||||
<tr valign="top">
|
||||
<td style="width:15em">Keypad 2</td>
|
||||
<td>Down direction</td>
|
||||
</tr>
|
||||
<tr valign="top">
|
||||
<td style="width:15em">Keypad 4</td>
|
||||
<td>Left direction</td>
|
||||
</tr>
|
||||
<tr valign="top">
|
||||
<td style="width:15em">Keypad 6</td>
|
||||
<td>Right direction</td>
|
||||
</tr>
|
||||
<tr valign="top">
|
||||
<td style="width:15em">Page Up</td>
|
||||
<td>A button</td>
|
||||
</tr>
|
||||
<tr valign="top">
|
||||
<td style="width:15em">Page Down</td>
|
||||
<td>B button</td>
|
||||
</tr>
|
||||
<tr valign="top">
|
||||
<td style="width:15em">Home</td>
|
||||
<td>X button</td>
|
||||
</tr>
|
||||
<tr valign="top">
|
||||
<td style="width:15em">End</td>
|
||||
<td>Y button</td>
|
||||
</tr>
|
||||
<tr valign="top">
|
||||
<td style="width:15em">Insert</td>
|
||||
<td>L button</td>
|
||||
</tr>
|
||||
<tr valign="top">
|
||||
<td style="width:15em">Delete</td>
|
||||
<td>R button</td>
|
||||
</tr>
|
||||
<tr valign="top">
|
||||
<td style="width:15em">Keypad +</td>
|
||||
<td>Select button</td>
|
||||
</tr>
|
||||
<tr valign="top">
|
||||
<td style="width:15em">Keypad Enter</td>
|
||||
<td>Start button</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table></li>
|
||||
</ul>
|
||||
<h3>Pausing and Quitting the Game</h3>
|
||||
<p>
|
||||
Don't forget how to pause the game and quit Snes9x.
|
||||
</p>
|
||||
<ul>
|
||||
<li><table summary="essential keys">
|
||||
<tbody>
|
||||
<tr valign="top">
|
||||
<td style="width:15em">ESC</td>
|
||||
<td>quits Snes9x.</td>
|
||||
</tr>
|
||||
<tr valign="top">
|
||||
<td style="width:15em">Pause or Scroll Lock</td>
|
||||
<td>pauses the game.</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table></li>
|
||||
</ul>
|
||||
<h2>Requirements</h2>
|
||||
<h3>System Requirements</h3>
|
||||
<p>
|
||||
Relatively fast CPU like Pentium 2 or PowerPC G3 300MHz or higher, and 16MB memory or more.<br>
|
||||
Certain games use added hardware which will require a faster machine. The specs listed above is the minimum to use Snes9x in any playable form. It is recommended that you get a semi-modern machine with a 800MHz CPU if you want good results. A 1GHz CPU is recommended for those that want a near perfect experience.
|
||||
</p>
|
||||
<p>
|
||||
X Window System with 15, 16, 24 or 32-bit color depth. For maximum emulation speed, have the X server switched to 15 or 16-bit.
|
||||
</p>
|
||||
<h3>Software</h3>
|
||||
<p>
|
||||
You will need access to SNES ROM images otherwise you will have nothing to run! Some home-brewed ROM images can be downloaded from <a href="http://www.zophar.com/">http://www.zophar.com/</a>.<br>
|
||||
Please note, it is illegal in most countries to have commercial ROM images without also owning the actual SNES ROM cartridges, and even then you may be liable under various EULAs.
|
||||
</p>
|
||||
<h2>Controllers Support</h2>
|
||||
<h3>Input Devices</h3>
|
||||
<p>
|
||||
The real SNES has two ports to connect input devices. Usually 1P and 2P SNES joypads are connected but various devices and adopters can be plugged.
|
||||
</p>
|
||||
<p>
|
||||
Use <code>-port1</code> and/or <code>-port2</code> options to specify which input device to be emulated in each port.
|
||||
</p>
|
||||
<ul>
|
||||
<li><table summary="input devices">
|
||||
<tbody>
|
||||
<tr valign="top">
|
||||
<td style="width:15em">Multi Player 5</td>
|
||||
<td>known as Multi Tap; a five player adapter, allowing up to five people to play at once on games that supported it.</td>
|
||||
</tr>
|
||||
<tr valign="top">
|
||||
<td style="width:15em">SNES Mouse</td>
|
||||
<td>a 2-button mouse, originally supplied with a paint program.</td>
|
||||
</tr>
|
||||
<tr valign="top">
|
||||
<td style="width:15em">Super Scope</td>
|
||||
<td>a light-gun; it used infrared to provide wireless communication between the gun and the console unit.</td>
|
||||
</tr>
|
||||
<tr valign="top">
|
||||
<td style="width:15em">Justifier</td>
|
||||
<td>a gun similar to Super Scope, supported with one gun-shooting game.</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table></li>
|
||||
</ul>
|
||||
<p>
|
||||
Snes9x can emulate those input devices with the keyboard and mouse. The default mapping is as follows:
|
||||
</p>
|
||||
<ul>
|
||||
<li><table summary="input device key mapping">
|
||||
<tbody>
|
||||
<tr valign="top">
|
||||
<td style="width:15em">Mouse Left</td>
|
||||
<td>SNES Mouse Left button / SuperScope Fire button / Justifier trigger</td>
|
||||
</tr>
|
||||
<tr valign="top">
|
||||
<td style="width:15em">Mouse Right</td>
|
||||
<td>SNES Mouse Right button / SuperScope Cursor button / Justifier Start button</td>
|
||||
</tr>
|
||||
<tr valign="top">
|
||||
<td style="width:15em">Mouse Center</td>
|
||||
<td>when you want to shot offscreen, fire with pressing this button.</td>
|
||||
</tr>
|
||||
<tr valign="top">
|
||||
<td style="width:15em">`</td>
|
||||
<td>SuperScope Turbo toggle switch</td>
|
||||
</tr>
|
||||
<tr valign="top">
|
||||
<td style="width:15em">/</td>
|
||||
<td>SuperScope Pause button</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table></li>
|
||||
</ul>
|
||||
<h2>Peripherals Support</h2>
|
||||
<h3>Satellaview</h3>
|
||||
<p>
|
||||
Snes9x partially emulates Satellaview system, so-called BS-X. To play BS games or read BS magazines with the BS-X base cartridge, do the following.
|
||||
</p>
|
||||
<ul style="list-style-type:disc">
|
||||
<li>If you have .srm files of BS games which were created by Snes9x 1.43 or earlier, trash them first.</li>
|
||||
<li>Prepare the BS-X ROM image. Make sure the file is uncompressed and doesn't have a header.</li>
|
||||
<li>Rename the BS-X ROM image to 'BS-X.bin'.</li>
|
||||
<li>Put BS-X.bin in the proper directory. ~/.snes9x/bios by default.</li>
|
||||
<li>Launch BS-X.bin as you usually play SNES games.</li>
|
||||
<li>Set your name and gender.</li>
|
||||
<li>Launch a BS game. The game is launched for the first time and its .srm doesn't exist, so BS-X.srm is loaded instead.</li>
|
||||
<li>Once you launched the game, its .srm is created and loaded from the next time.</li>
|
||||
</ul>
|
||||
<p>
|
||||
If you launch a BS game for the first time without BS-X.srm, maybe the game doesn't work properly.<br>
|
||||
To boot up BS games from BS-X town, use <code>-bsxbootup</code> option.
|
||||
</p>
|
||||
<h3>Sufami Turbo</h3>
|
||||
<p>
|
||||
To play Sufami Turbo games, do the following.
|
||||
</p>
|
||||
<ul style="list-style-type:disc">
|
||||
<li>Prepare the Sufami Turbo base cartridge ROM image. Make sure the file is uncompressed and doesn't have a header.</li>
|
||||
<li>Rename the base cartridge ROM image to 'STBIOS.bin'.</li>
|
||||
<li>Put STBIOS.bin in the proper directory. ~/.snes9x/bios by default.</li>
|
||||
<li>Use <code>-multi</code>, <code>-carta</code> and <code>-cartb</code> options to play games.
|
||||
<dl>
|
||||
<dt><code>-multi</code></dt>
|
||||
<dd>BIOS only</dd>
|
||||
<dt><code>-multi -carta game1.smc</code></dt>
|
||||
<dd>BIOS + game1.smc in Slot A</dd>
|
||||
<dt><code>-multi -cartb game2.smc</code></dt>
|
||||
<dd>BIOS + game2.smc in Slot B</dd>
|
||||
<dt><code>-multi -carta game1.smc -cartb game2.smc</code></dt>
|
||||
<dd>BIOS + game1.smc in Slot A + game2.smc in Slot B</dd>
|
||||
</dl></li>
|
||||
</ul>
|
||||
<p>
|
||||
Note that the base cartridge can initialize SRAM for only the game in slot A, so you have to set every game in slot A and launch at least once.<br>
|
||||
If no games are set in the slots, only the base cartridge runs.<br>
|
||||
If you have a combined ROM image, split it to each games and the base cartridge. NSRT will help you.
|
||||
</p>
|
||||
<h3>Other Multiple Cartridge Games</h3>
|
||||
<p>
|
||||
Use <code>-multi</code> option as follows:
|
||||
</p>
|
||||
<ul>
|
||||
<li><code>-multi -carta maincart.smc -cartb addon.smc</code></li>
|
||||
</ul>
|
||||
<p>
|
||||
Currently supported: Same Game
|
||||
</p>
|
||||
<h2>Game Saving</h2>
|
||||
<p>
|
||||
Many SNES games take a very long time to complete from start to finish, so they allowed your progress to be saved at the predefined places chosen by the game designers. The game cartridge contains a battery-backed RAM, known as SRAM, and your save data remain in this SRAM until the battery shutoff.
|
||||
</p>
|
||||
<p>
|
||||
Snes9x has two methods for saving games. One is the same as of the real SNES shown above; emulating SRAM. The SRAM contents are saved into a file (.srm) so you don't need to be worried about the battery shutoff. The other is more convenient way than the real SNES; 'freezing' or 'snapshotting' the game. It means saving the whole game state anywhere you want, beyond the game designers' intent - ideal for saving your game just before a tricky bit!
|
||||
</p>
|
||||
<h3>Using the SRAM File</h3>
|
||||
<p>
|
||||
It's easy enough, just save the game as you do with the real SNES. Snes9x outputs the contents of the emulated SRAM into a file (.srm) when you load a new game or quit Snes9x. This file is automatically loaded the next time you play the game. Files are stored in ~/.snes9x/sram by default.
|
||||
</p>
|
||||
<h3>Freezing and Defrosting the Game State</h3>
|
||||
<p>
|
||||
Snes9x provides 9 slots for freezing the whole of your game state. During the game, press Shift + F1 to F9 to save the state, and just F1 to F9 to load it again later. Files are stored in ~/.snes9x/savestate by default.
|
||||
</p>
|
||||
<h3>Real-Time Clock Emulation</h3>
|
||||
<p>
|
||||
Some games have a battery-backed real-time clock (RTC) in their cartridge to bring a real-time event in the game. Snes9x saves the state of RTC into a file (.rtc), stored in ~/.snes9x/sram by default, and also into a freeze file.<br>
|
||||
Note that because it's a 'real-time' clock, when these files are loaded, the emulated clock is automatically advanced in reference to your system's time and date.
|
||||
</p>
|
||||
<h3>Fool-Proof System</h3>
|
||||
<p>
|
||||
If you quit the game by error without saving your long-time progress, try to press F10 key and find '.oops' file in the same directory as freeze files. It's a freeze file automatically generated if you don't save anything for a long time.
|
||||
</p>
|
||||
<h2>Cheat Support</h2>
|
||||
<p>
|
||||
Cheat codes allow you to cheat at games. They might give you more lives, infinite health, enable special powers normally only activated when a special item is found, and etc. Three major formats are well-known: Game Genie, Pro-Action Reply (PAR) and Gold Finger. Many existing codes can be found via Internet.
|
||||
</p>
|
||||
<p>
|
||||
Snes9x supports all the three formats. Cheats are saved in .cht files and are automatically loaded the next time a game with the same filename is loaded.
|
||||
</p>
|
||||
<p>
|
||||
Technically, a cheat code consists of two elements; an address in SNES memory map where you want to overwrite, and a value which is overwritten on the address.<br>
|
||||
Beware of cheat codes designed for a ROM from a different region compared to the one you are playing or for a different version of the ROM; the source of the cheats should tell you which region and for which version of the game they were designed for. If you use a code designed for a different region or version of your game, the game might crash or do other weird things because the cheat address might be different between regions and versions.
|
||||
</p>
|
||||
<h3>How to Enter Cheat Code</h3>
|
||||
<p>
|
||||
Use <code>-gamegenie</code>, <code>-actionreplay</code> and <code>-goldfinger</code> options to enter your cheat code. Files are stored in ~/.snes9x/cheat by default.
|
||||
</p>
|
||||
<h2>Movie Support</h2>
|
||||
<p>
|
||||
Movie support allows you to record your actions while playing a game. This can be used for your own personal playback or to show other people that you can do something without them having to be around when you did it.
|
||||
</p>
|
||||
<h3>Recording the Movie</h3>
|
||||
<p>
|
||||
Press Shift + 1 to begin recording and Shift + 2 to stop recording. Also you can use <code>-recordmovie</code> option to record from the start of the game.
|
||||
</p>
|
||||
<h3>Playing Back the Movie</h3>
|
||||
<p>
|
||||
Press Shift + 3 and enter the movie filename (.smv) to play the movie. Also you can use <code>-playmovie</code> option to play the movie recorded from the start of the game.
|
||||
</p>
|
||||
<h2>Miscellaneous</h2>
|
||||
<h3>Where the Files are Stored</h3>
|
||||
<p>
|
||||
By default, ~/.snes9x is used to load/save files related to Snes9x. The subdirectories Snes9x refers to are as follows:
|
||||
</p>
|
||||
<ul>
|
||||
<li><table summary="directories">
|
||||
<tbody>
|
||||
<tr valign="top">
|
||||
<td style="width:15em">rom</td>
|
||||
<td>ROM image files</td>
|
||||
</tr>
|
||||
<tr valign="top">
|
||||
<td style="width:15em">sram</td>
|
||||
<td>SRAM files (.srm), RTC files (.rtc)</td>
|
||||
</tr>
|
||||
<tr valign="top">
|
||||
<td style="width:15em">savestate</td>
|
||||
<td>freeze (snapshot, savestate) files</td>
|
||||
</tr>
|
||||
<tr valign="top">
|
||||
<td style="width:15em">screenshot</td>
|
||||
<td>screenshot files</td>
|
||||
</tr>
|
||||
<tr valign="top">
|
||||
<td style="width:15em">spc</td>
|
||||
<td>SPC files (.spc)</td>
|
||||
</tr>
|
||||
<tr valign="top">
|
||||
<td style="width:15em">cheat</td>
|
||||
<td>cheat files (.cht)</td>
|
||||
</tr>
|
||||
<tr valign="top">
|
||||
<td style="width:15em">patch</td>
|
||||
<td>IPS files (.ips)</td>
|
||||
</tr>
|
||||
<tr valign="top">
|
||||
<td style="width:15em">bios</td>
|
||||
<td>BIOS image files</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table></li>
|
||||
</ul>
|
||||
<h3>Using IPS or UPS Patch</h3>
|
||||
<p>
|
||||
Snes9x automatically patches without overwriting the ROM image.
|
||||
</p>
|
||||
<ul style="list-style-type:disc">
|
||||
<li>Put the IPS or UPS file into the proper directory. ~/.snes9x/patch by default.</li>
|
||||
<li>Rename the name to the same as the ROM image (except extension, it is '.ips' or '.ups').</li>
|
||||
<li>(IPS only) If you want to use multiple IPS files at a time, set their extensions to '.000.ips', '.001.ips', ...</li>
|
||||
<li>Open and load the ROM image.</li>
|
||||
</ul>
|
||||
<h3>SPC File Dumping</h3>
|
||||
<p>
|
||||
SPC file (.spc) is the freeze state of only sound part, so it is known as SNES music data file. Dump the SPC file by Snes9x and play the file by SPC players.
|
||||
</p>
|
||||
<p>
|
||||
Press Alt/Control + F1 to dump a SPC file. It's stored in ~/.snes9x/spc by default.<br>
|
||||
Note that the actual dumping occurs at the next note-on event so that you can dump the BGM from just the beginning.
|
||||
</p>
|
||||
<h3>Additional Keyboard Controls</h3>
|
||||
<p>
|
||||
Snes9x has various functions to play games with fun. The default mapping is as follows:
|
||||
</p>
|
||||
<ul>
|
||||
<li><table summary="special keys">
|
||||
<tbody>
|
||||
<tr valign="top">
|
||||
<td style="width:15em">Control + Shift + ESC</td>
|
||||
<td>hardware reset as you turn off and on the power switch.</td>
|
||||
</tr>
|
||||
<tr valign="top">
|
||||
<td style="width:15em">Shift + ESC</td>
|
||||
<td>software reset as you press the reset button.</td>
|
||||
</tr>
|
||||
<tr valign="top">
|
||||
<td style="width:15em">F12</td>
|
||||
<td>saves the freeze file you specify.</td>
|
||||
</tr>
|
||||
<tr valign="top">
|
||||
<td style="width:15em">F11</td>
|
||||
<td>loads the freeze file you specify.</td>
|
||||
</tr>
|
||||
<tr valign="top">
|
||||
<td style="width:15em">Shift + F1-F9</td>
|
||||
<td>quickly saves a freeze file into the slot 1-9.</td>
|
||||
</tr>
|
||||
<tr valign="top">
|
||||
<td style="width:15em">F1-F9</td>
|
||||
<td>quickly loads a freeze file from the slot 1-9.</td>
|
||||
</tr>
|
||||
<tr valign="top">
|
||||
<td style="width:15em">F10</td>
|
||||
<td>tries to load the fool-proof freeze file you specify.</td>
|
||||
</tr>
|
||||
<tr valign="top">
|
||||
<td style="width:15em">Alt/Control + F1</td>
|
||||
<td>dumps a SPC file.</td>
|
||||
</tr>
|
||||
<tr valign="top">
|
||||
<td style="width:15em">Print Screen</td>
|
||||
<td>takes a screenshot.</td>
|
||||
</tr>
|
||||
<tr valign="top">
|
||||
<td style="width:15em">Shift + 1</td>
|
||||
<td>begins recording a movie.</td>
|
||||
</tr>
|
||||
<tr valign="top">
|
||||
<td style="width:15em">Shift + 2</td>
|
||||
<td>ends recording a movie.</td>
|
||||
</tr>
|
||||
<tr valign="top">
|
||||
<td style="width:15em">Shift + 3</td>
|
||||
<td>plays the movie you specify.</td>
|
||||
</tr>
|
||||
<tr valign="top">
|
||||
<td style="width:15em">Tab</td>
|
||||
<td>turbo mode while pressing.</td>
|
||||
</tr>
|
||||
<tr valign="top">
|
||||
<td style="width:15em">Shift + Tab</td>
|
||||
<td>toggles turbo mode on/off.</td>
|
||||
</tr>
|
||||
<tr valign="top">
|
||||
<td style="width:15em">=</td>
|
||||
<td>increases frame skip rate / switches to auto-frame rate adjustment.</td>
|
||||
</tr>
|
||||
<tr valign="top">
|
||||
<td style="width:15em">-</td>
|
||||
<td>decreases frame skip rate / switches to auto-frame rate adjustment.</td>
|
||||
</tr>
|
||||
<tr valign="top">
|
||||
<td style="width:15em">Shift + =</td>
|
||||
<td>increases frame time in 1ms steps: works only with auto-frame rate adjustment.</td>
|
||||
</tr>
|
||||
<tr valign="top">
|
||||
<td style="width:15em">Shift + -</td>
|
||||
<td>decreases frame time in 1ms steps: works only with auto-frame rate adjustment.</td>
|
||||
</tr>
|
||||
<tr valign="top">
|
||||
<td style="width:15em">Alt + =</td>
|
||||
<td>increases frame skip rate in turbo mode.</td>
|
||||
</tr>
|
||||
<tr valign="top">
|
||||
<td style="width:15em">Alt + -</td>
|
||||
<td>decreases frame skip rate in turbo mode.</td>
|
||||
</tr>
|
||||
<tr valign="top">
|
||||
<td style="width:15em">Control + =</td>
|
||||
<td>increases speed in turbo mode.</td>
|
||||
</tr>
|
||||
<tr valign="top">
|
||||
<td style="width:15em">Control + -</td>
|
||||
<td>decreases speed in turbo mode.</td>
|
||||
</tr>
|
||||
<tr valign="top">
|
||||
<td style="width:15em">6</td>
|
||||
<td>toggles swapping of joypad one and two.</td>
|
||||
</tr>
|
||||
<tr valign="top">
|
||||
<td style="width:15em">Alt/Control + F4-F11</td>
|
||||
<td>toggles sound channel 1-8 on/off.</td>
|
||||
</tr>
|
||||
<tr valign="top">
|
||||
<td style="width:15em">Alt/Control + F12</td>
|
||||
<td>enables all sound channels.</td>
|
||||
</tr>
|
||||
<tr valign="top">
|
||||
<td style="width:15em">1-4</td>
|
||||
<td>toggles background 1-4 on/off.</td>
|
||||
</tr>
|
||||
<tr valign="top">
|
||||
<td style="width:15em">5</td>
|
||||
<td>toggles sprites on/off.</td>
|
||||
</tr>
|
||||
<tr valign="top">
|
||||
<td style="width:15em">9</td>
|
||||
<td>(not recommended) toggles transparency effects on/off.</td>
|
||||
</tr>
|
||||
<tr valign="top">
|
||||
<td style="width:15em">Backspace</td>
|
||||
<td>(not recommended) toggles emulation of graphics window effects on/off.</td>
|
||||
</tr>
|
||||
<tr valign="top">
|
||||
<td style="width:15em">0</td>
|
||||
<td>(not recommended) toggles H-DMA emulation on/off.</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table></li>
|
||||
</ul>
|
||||
<h3>Gamepad Support</h3>
|
||||
<p>
|
||||
The Linux port makes use of the v1.x joystick kernel drivers written by Vojtech Pavlik to allow the use of a wide variety of different gamepad types to control SNES games.<br>
|
||||
If you are still using the older versions of the drivers, you can download the latest driver version from <a href="http://atrey.karlin.mff.cuni.cz/%7Evojtech/joystick/">http://atrey.karlin.mff.cuni.cz/~vojtech/joystick/</a>.<br>
|
||||
Refer to the documentation that comes with the drivers to enable support for your type of gamepad in Snes9x.
|
||||
</p>
|
||||
<h3>Configuring Settings and Key Mapping</h3>
|
||||
<p>
|
||||
The Unix port of Snes9x reads the preferences file snes9x.conf when launching, if it exists.<br>
|
||||
To make your snes9x.conf, copy the template file snes9x.conf.default, rename it to 'snes9x.conf', put it in the proper directory (~/.snes9x by default), and edit it as you like. The document control-inputs.txt will help you to edit the keyboard/gamepad mapping.
|
||||
</p>
|
||||
<h3>Building Snes9x from Source</h3>
|
||||
<p>
|
||||
The source release of Snes9x comes with a configure file that will try to make a Makefile suitable for your system. To invoke it go into the snes9x/unix directory inside the distribution:<br>
|
||||
</p>
|
||||
<ul>
|
||||
<li><code>cd snes9x-1.xx-src/snes9x/unix</code></li>
|
||||
</ul>
|
||||
<p>
|
||||
Then run configure and finish with running make if it went well.
|
||||
</p>
|
||||
<ul>
|
||||
<li><code>./configure<br>
|
||||
make</code></li>
|
||||
</ul>
|
||||
<p>
|
||||
configure takes several arguments. Further documentation about this is available by running <code>./configure --help</code>.
|
||||
</p>
|
||||
<h2>Compatibility</h2>
|
||||
<h3>Compatibility with Other Ports</h3>
|
||||
<p>
|
||||
All the files generated by Snes9x are compatible between platforms, except for the extension of the freeze files.
|
||||
</p>
|
||||
<h3>Compatibility with Other SNES Emulators</h3>
|
||||
<p>
|
||||
Cheat files (.cht) are common between Snes9x and ZSNES. RTC files (.rtc) are common between Snes9x and bsnes. SRAM files (.srm) should be common among all SNES emulators.
|
||||
</p>
|
||||
<h2>Problems</h2>
|
||||
<h3>Problems with ROMs</h3>
|
||||
<p>
|
||||
If Snes9x just displays a black screen for over 10 seconds after you've loaded a ROM image, then one of the following could be true:
|
||||
</p>
|
||||
<ul style="list-style-type:disc">
|
||||
<li>You just loaded some random ROM image and it isn't even a SNES game or you only have part of the image. Snes9x only emulates games designed for the Super NES, not NES, or Master System, or Game Boy, or <insert your favorite old games system here>.</li>
|
||||
<li>Someone has edited the Nintendo ROM information area inside the ROM image and Snes9x can't work out what format the ROM image is in. Try playing around with the ROM format options.</li>
|
||||
<li>The ROM image is corrupt. If you're loading from CD, I know it might sound silly, but is the CD dirty? Clean, unhacked ROM images will display [checksum ok] when first loaded, corrupt or hacked ROMs display [bad checksum].</li>
|
||||
<li>The original SNES ROM cartridge had additional hardware inside that is not emulated yet and might never be.</li>
|
||||
<li>You might be using a file that is compressed in a way Snes9x does not understand.</li>
|
||||
</ul>
|
||||
<p>
|
||||
The following ROMs are known to currently not to work with any version of Snes9x:
|
||||
</p>
|
||||
<ul>
|
||||
<li><table summary="not emulated chips">
|
||||
<tbody>
|
||||
<tr valign="top">
|
||||
<td style="width:18em">SD Gundam GX</td>
|
||||
<td>DSP-3</td>
|
||||
</tr>
|
||||
<tr valign="top">
|
||||
<td style="width:18em">Hayazashi Nidan Morita Shougi</td>
|
||||
<td>Seta-11</td>
|
||||
</tr>
|
||||
<tr valign="top">
|
||||
<td style="width:18em">Hayazashi Nidan Morita Shougi 2</td>
|
||||
<td>Seta-18</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table></li>
|
||||
</ul>
|
||||
<h3>Problems with Sounds</h3>
|
||||
<p>
|
||||
If you hear crackling noise during the game, try these options to eliminate the noise.
|
||||
</p>
|
||||
<ul>
|
||||
<li><dl>
|
||||
<dt><code>-buffersize</code></dt>
|
||||
<dd>Sound generating buffer size in millisecond. Larger value will be safe from crackling noise, but may cause lag.</dd>
|
||||
<dt><code>-fragmentsize</code></dt>
|
||||
<dd>Fragment size of the system sound driver in byte. It must be a power of 2, and must be the value the driver accepts.</dd>
|
||||
<dt><code>-soundsync</code></dt>
|
||||
<dd>When this option is on, Snes9x tries and ensures all available samples are buffered so there are no overruns.</dd>
|
||||
<dt><code>-inputrate</code></dt>
|
||||
<dd>Adjusts the sound rate through resampling. For every <code>-inputrate</code> samples generated by the SNES, <code>-playbackrate</code> samples will be produced.</dd>
|
||||
</dl></li>
|
||||
</ul>
|
||||
<h2>Technical Information</h2>
|
||||
<h3>What's Emulated?</h3>
|
||||
<ul style="list-style-type:disc">
|
||||
<li>65c816 main CPU.</li>
|
||||
<li>Variable length machine cycles.</li>
|
||||
<li>8 channel DMA and H-DMA.</li>
|
||||
<li>H-IRQ, V-IRQ and NMI.</li>
|
||||
<li>Sony SPC700 sound CPU.</li>
|
||||
<li>Sound DSP, with eight 16-bit, stereo channels, compressed samples, hardware envelope processing, echo, pitch modulation and digital FIR sound filter.</li>
|
||||
<li>SRAM, a battery-backed RAM.</li>
|
||||
<li>All background modes, 0 to 7.</li>
|
||||
<li>All screen resolutions including interlace mode.</li>
|
||||
<li>Pseudo hi-res mode.</li>
|
||||
<li>8x8, 16x8 and 16x16 tile sizes, flipped in either direction.</li>
|
||||
<li>32x32, 32x64, 64x32 and 64x64 screen tile sizes.</li>
|
||||
<li>Vertical and horizontal offset-per-tile.</li>
|
||||
<li>128 8x8, 16x16, 32x32 and 64x64 sprites, flipped in either direction.</li>
|
||||
<li>Sub-screen and fixed color blending effects.</li>
|
||||
<li>Mosaic effects.</li>
|
||||
<li>Mode 7 screen rotation, scaling and screen flipping.</li>
|
||||
<li>Single and dual graphic clip windows, with all four logic combination modes.</li>
|
||||
<li>Color blending effects only inside or outside a window.</li>
|
||||
<li>Palette changes during frame.</li>
|
||||
<li>Direct color mode - uses tile and palette-group data directly as RGB value.</li>
|
||||
<li>SNES Mouse.</li>
|
||||
<li>Super Scope, emulated using computer mouse.</li>
|
||||
<li>Justifier, by Konami, similar to the Super Scope and used only in Lethal Enforcers.</li>
|
||||
<li>Multi Player 5, allowing up to five people to play games simultaneously on games that support that many players.</li>
|
||||
<li>Super FX, a fast RISC CPU used in several games.</li>
|
||||
<li>SA-1, a faster version of main CPU with some functions, used in several games.</li>
|
||||
<li>DSP-1, a custom chip used in several games, mainly racing games.</li>
|
||||
<li>DSP-2, a custom chip used only in Dungeon Master.</li>
|
||||
<li>DSP-4, a custom chip used only in Top Gear 3000.</li>
|
||||
<li>C4, a sprite scaler/rotator/line drawer/simple maths co-processor chip used only in Megaman X2 and X3.</li>
|
||||
<li>Seta-10, a custom chip used only in F1 Race of Champions 2.</li>
|
||||
<li>OBC1, a sprite management chip used only in Metal Combat.</li>
|
||||
<li>S-DD1, a data decompression chip used only in Star Ocean and Street Fighter 2 Alpha.</li>
|
||||
<li>SPC7110, similar in use to S-DD1, used in a few Hadoson games.</li>
|
||||
<li>S-RTC, a real-time clock chip, used only in Dai Kaijyu Monogatari 2.</li>
|
||||
<li>Satellaview and BS-X, only partially.</li>
|
||||
</ul>
|
||||
<h3>What's Not?</h3>
|
||||
<ul style="list-style-type:disc">
|
||||
<li>Exact sub-cycle timings of communication among most of parts - main CPU, sound CPU, DMA, H-DMA, IRQ, NMI, and so on. Snes9x cannot run games that require severe timings!</li>
|
||||
<li>Any other odd chips that manufactures sometimes placed inside the cartridge to enhance games and as a nice side-effect, also act as an anti-piracy measure. (DSP-3, Seta-11 and Seta-18, as examples)</li>
|
||||
<li>The expansion slot found in many carts.</li>
|
||||
</ul>
|
||||
<h3>Custom Chips</h3>
|
||||
<h4>Super FX</h4>
|
||||
<p>
|
||||
The Super FX is a 10.5/21MHz RISC CPU developed by Argonaut Software used as a game enhancer by several game titles. Released SNES Super FX games included Yoshi's Island, Doom, Winter Gold, Dirt Trax FX, StarFox, Stunt Race FX and Vortex.
|
||||
</p>
|
||||
<h4>SA-1</h4>
|
||||
<p>
|
||||
The SA-1 is a fast, custom 65c816 8/16-bit processor, the same as inside the SNES itself, but clocked at 10MHz compared to a maximum of 3.58MHz for the CPU inside the SNES. The SA-1 isn't just a CPU; it also contains some extra circuits developed by Nintendo which includes some very fast RAM, a memory mapper, DMA and, several real-time timers.
|
||||
</p>
|
||||
<h4>C4</h4>
|
||||
<p>
|
||||
The C4 is custom Capcom chip used only in the Megaman X2 and Megaman X3 games. It can scale and rotate images, draw line-vector objects and do some simple maths to rotate them.
|
||||
</p>
|
||||
<h4>S-DD1</h4>
|
||||
<p>
|
||||
The S-DD1 is a custom data decompression chip that can decompress data in real-time as the SNES DMA's data from the ROM to RAM. Only two games use the chip: Star Ocean and Street Fighter Alpha 2.
|
||||
</p>
|
||||
<h4>SPC7110</h4>
|
||||
<p>
|
||||
The SPC7110 is a compression and memory mapping chip. It provides a few extra features as well. It functions as an RTC interface, and has a multiply/divide unit that has more precision than the SNES. The SPC7110 is found only in 4 games: Super Power League 4, Far East of Eden Zero, Far East of Eden Zero - Shounen Jump no Shou and Momotaro Dentetsu Happy.
|
||||
</p>
|
||||
<h4>Others</h4>
|
||||
<p>
|
||||
Other known custom chips: DSP-1, DSP-2, DSP-3, DSP-4, Seta-10, Seta-11, Seta-18, OBC1 and S-RTC.
|
||||
</p>
|
||||
<h2>Credits</h2>
|
||||
<ul style="list-style-type:disc">
|
||||
<li>Jerremy Koot for all his hard work on previous versions of Snes96, Snes97 and Snes9x.</li>
|
||||
<li>Ivar for the original Super FX C emulation, DSP-1 emulation work and information on both chips.</li>
|
||||
<li>zsKnight and _Demo_ for the Intel Super FX assembler, DSP-1 and C4 emulation code.</li>
|
||||
<li>zsKnight and _Demo_ for all the other ideas and code I've nicked off them; they've nicked lots of my ideas and information too!</li>
|
||||
<li>John Weidman and Darkforce for the S-RTC emulation information and code.</li>
|
||||
<li>Kreed and Maxim Stepin for excellent image enhancer routines.</li>
|
||||
<li>Nose000 for code changes to support various Japanese SNES games.</li>
|
||||
<li>Neill Corlett for the IPS patching support code.</li>
|
||||
<li>DiskDude's SNES Kart v1.6 document for the Game Genie(TM) and Pro-Action Replay cheat system information.</li>
|
||||
<li>Lord ESNES for some nice chats and generally useful stuff.</li>
|
||||
<li>Lee Hyde (lee@jlp1.demon.co.uk) for his quest for sound information and the Windows 95 icon.</li>
|
||||
<li>Shawn Hargreaves for the rather good Allegro 3.0 DOS library.</li>
|
||||
<li>Robert Grubbs for the SideWinder information - although I didn't use his actual driver in the end.</li>
|
||||
<li>Steve Snake for his insights into SNES sound sample decompression.</li>
|
||||
<li>Vojtech Pavlik for the Linux joystick driver patches.</li>
|
||||
<li>Maciej Babinski for the basics of Linux's DGA X server extensions.</li>
|
||||
<li>Alexander Larsson for the GGI Linux port code.</li>
|
||||
<li>Harald Fielker for the original sound interpolation code (never used directly due to problems).</li>
|
||||
<li>Takehiro TOMINAGA for many speed up suggestions and bug fixes.</li>
|
||||
<li>Predicador for the Windows icon.</li>
|
||||
<li>Lindsey Dubb for the mode 7 bi-linear filter code and the improved color addition and subtraction code.</li>
|
||||
<li>Anti Resonance for his super-human efforts to help get his fast sound CPU core and sound DSP core working in Snes9x.</li>
|
||||
<li>Brad Martin and TRAC for better and refined sound emulation.</li>
|
||||
<li>ernstp and entonne for patches and testing on Linux PPC.</li>
|
||||
<li>byuu for the most exact timing information and tons of the newest technical findings.</li>
|
||||
<li>Blargg for the most accurate timings between sound CPU and DSP and exact sound emulation codes.</li>
|
||||
<li>pagefault, TRAC, Dark Force, byuu, and others who have donated ideas and/or code to the project.</li>
|
||||
</ul>
|
||||
<div style="margin-top:3em"><p>
|
||||
Nintendo is a trademark.<br>
|
||||
Super NES, Super Famicon, Super Scope and Super FX are trademarks of Nintendo.<br>
|
||||
Sufami Turbo is a trademark of Bandai Co., Ltd.<br>
|
||||
Game Genie is a trademark of Lewis Galoob Toys, Inc.<br>
|
||||
Pro Action Replay is a trademark of Datel Inc.<br>
|
||||
Macintosh, Mac and Mac OS X are trademarks of Apple Computer, Inc.<br>
|
||||
UNIX is a trademark of The Open Group.<br>
|
||||
Linux is a trademark of Linus Torvalds.<br>
|
||||
Windows is a trademark of Microsoft Corp.<br>
|
||||
Intel is a trademark of Intel Corp.<br>
|
||||
PowerPC is a trademark of International Business Machines Corp.<br>
|
||||
Sony is a trademark of Sony Corp.<br>
|
||||
Konami and Justifier are trademarks of Konami Corp.<br>
|
||||
Hudson is a trademark of Husdon Soft Co., Ltd.<br>
|
||||
Capcom is a trademark of Capcom Co., Ltd.
|
||||
</p></div>
|
||||
<div style="margin-top:3em"><p>
|
||||
Gary Henderson
|
||||
</p></div>
|
||||
<p>
|
||||
Edited for Unix port by: zones (kasumitokoduck@yahoo.com)<br>
|
||||
Updated most recently by: 2011/04/10 zones
|
||||
</p>
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,121 @@
|
|||
#-----------------------------------------
|
||||
# snes9x-sdl.conf : snes9x-sdl Configuration file
|
||||
#-----------------------------------------
|
||||
|
||||
[ROM]
|
||||
# Filename =
|
||||
LoROM = FALSE
|
||||
HiROM = FALSE
|
||||
PAL = FALSE
|
||||
NTSC = FALSE
|
||||
# Header = TRUE/FALSE to ForceHeader or ForceNoHeader
|
||||
# Interleaved = TRUE/FALSE to ForceInterleaved or ForceNoInterleaved
|
||||
Interleaved2 = FALSE
|
||||
InterleaveGD24 = FALSE
|
||||
Cheat = FALSE
|
||||
Patch = TRUE
|
||||
|
||||
[Sound]
|
||||
Sync = FALSE
|
||||
16BitSound = TRUE
|
||||
Stereo = TRUE
|
||||
ReverseStereo = FALSE
|
||||
Rate = 32000
|
||||
InputRate = 32000
|
||||
Mute = FALSE
|
||||
|
||||
[Display]
|
||||
HiRes = TRUE
|
||||
Transparency = TRUE
|
||||
GraphicWindows = TRUE
|
||||
DisplayFrameRate = FALSE
|
||||
DisplayWatchedAddresses = FALSE
|
||||
DisplayInput = FALSE
|
||||
DisplayFrameCount = FALSE
|
||||
MessagesInImage = TRUE
|
||||
MessageDisplayTime = 120
|
||||
|
||||
[Settings]
|
||||
BSXBootup = FALSE
|
||||
# FrameTime =
|
||||
FrameSkip = Auto
|
||||
TurboMode = FALSE
|
||||
TurboFrameSkip = 15
|
||||
MovieTruncateAtEnd = FALSE
|
||||
MovieNotifyIgnored = FALSE
|
||||
WrongMovieStateProtection = TRUE
|
||||
StretchScreenshots = 1
|
||||
SnapshotScreenshots = TRUE
|
||||
DontSaveOopsSnapshot = FALSE
|
||||
AutoSaveDelay = 0
|
||||
|
||||
[Controls]
|
||||
MouseMaster = TRUE
|
||||
SuperscopeMaster = TRUE
|
||||
JustifierMaster = TRUE
|
||||
MP5Master = TRUE
|
||||
AllowLeftRight = FALSE
|
||||
Port1 = pad1
|
||||
Port2 = none
|
||||
Mouse1Crosshair = 1 White/Black
|
||||
Mouse2Crosshair = 1 White/Black
|
||||
SuperscopeCrosshair = 2 White/Black
|
||||
Justifier1Crosshair = 4 Blue/Black
|
||||
Justifier2Crosshair = 4 MagicPink/Black
|
||||
|
||||
[Hack]
|
||||
EnableGameSpecificHacks = TRUE
|
||||
AllowInvalidVRAMAccess = FALSE
|
||||
SpeedHacks = FALSE
|
||||
HDMATiming = 100
|
||||
|
||||
[Netplay]
|
||||
Enable = FALSE
|
||||
Port = 6096
|
||||
Server = ""
|
||||
|
||||
[DEBUG]
|
||||
Debugger = FALSE
|
||||
Trace = FALSE
|
||||
|
||||
[Unix]
|
||||
# BaseDir = ~/.snes9x
|
||||
# SnapshotFilename =
|
||||
# PlayMovieFilename =
|
||||
# RecordMovieFilename =
|
||||
SoundBufferSize = 100
|
||||
ClearAllControls = FALSE
|
||||
|
||||
[Unix/SDL]
|
||||
# SetKeyRepeat = TRUE
|
||||
VideoMode = 1
|
||||
|
||||
[Unix/SDL Controls]
|
||||
J00:Axis1 = Joypad1 Axis Up/Down T=50%
|
||||
J00:Axis0 = Joypad1 Axis Left/Right T=50%
|
||||
J00:B1 = Joypad1 A
|
||||
J00:B2 = Joypad1 B
|
||||
J00:B0 = Joypad1 X
|
||||
J00:B3 = Joypad1 Y
|
||||
J00:B6 = Joypad1 L
|
||||
J00:B7 = Joypad1 R
|
||||
J00:B8 = Joypad1 Select
|
||||
J00:B11 = Joypad1 Start
|
||||
K00:Up = Joypad1 Up
|
||||
K00:Down = Joypad1 Down
|
||||
K00:Left = Joypad1 Left
|
||||
K00:Right = Joypad1 Right
|
||||
K00:d = Joypad1 A
|
||||
K00:c = Joypad1 B
|
||||
K00:s = Joypad1 X
|
||||
K00:x = Joypad1 Y
|
||||
K00:a = Joypad1 L
|
||||
K00:z = Joypad1 R
|
||||
K00:space = Joypad1 Select
|
||||
K00:Return = Joypad1 Start
|
||||
K00:Escape = ExitEmu
|
||||
K00:Pause = Pause
|
||||
M00:Pointer = Pointer Mouse1+Superscope+Justifier1
|
||||
M00:B0 = {Mouse1 L,Superscope Fire,Justifier1 Trigger}
|
||||
M00:B2 = {Mouse1 R,Superscope Cursor,Justifier1 Start}
|
||||
M00:B1 = {Justifier1 AimOffscreen Trigger,Superscope AimOffscreen}
|
|
@ -0,0 +1,323 @@
|
|||
#!/bin/sh
|
||||
# install - install a program, script, or datafile
|
||||
|
||||
scriptversion=2005-05-14.22
|
||||
|
||||
# This originates from X11R5 (mit/util/scripts/install.sh), which was
|
||||
# later released in X11R6 (xc/config/util/install.sh) with the
|
||||
# following copyright and license.
|
||||
#
|
||||
# Copyright (C) 1994 X Consortium
|
||||
#
|
||||
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
# of this software and associated documentation files (the "Software"), to
|
||||
# deal in the Software without restriction, including without limitation the
|
||||
# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
|
||||
# sell copies of the Software, and to permit persons to whom the Software is
|
||||
# furnished to do so, subject to the following conditions:
|
||||
#
|
||||
# The above copyright notice and this permission notice shall be included in
|
||||
# all copies or substantial portions of the Software.
|
||||
#
|
||||
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
# X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
|
||||
# AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNEC-
|
||||
# TION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
#
|
||||
# Except as contained in this notice, the name of the X Consortium shall not
|
||||
# be used in advertising or otherwise to promote the sale, use or other deal-
|
||||
# ings in this Software without prior written authorization from the X Consor-
|
||||
# tium.
|
||||
#
|
||||
#
|
||||
# FSF changes to this file are in the public domain.
|
||||
#
|
||||
# Calling this script install-sh is preferred over install.sh, to prevent
|
||||
# `make' implicit rules from creating a file called install from it
|
||||
# when there is no Makefile.
|
||||
#
|
||||
# This script is compatible with the BSD install script, but was written
|
||||
# from scratch. It can only install one file at a time, a restriction
|
||||
# shared with many OS's install programs.
|
||||
|
||||
# set DOITPROG to echo to test this script
|
||||
|
||||
# Don't use :- since 4.3BSD and earlier shells don't like it.
|
||||
doit="${DOITPROG-}"
|
||||
|
||||
# put in absolute paths if you don't have them in your path; or use env. vars.
|
||||
|
||||
mvprog="${MVPROG-mv}"
|
||||
cpprog="${CPPROG-cp}"
|
||||
chmodprog="${CHMODPROG-chmod}"
|
||||
chownprog="${CHOWNPROG-chown}"
|
||||
chgrpprog="${CHGRPPROG-chgrp}"
|
||||
stripprog="${STRIPPROG-strip}"
|
||||
rmprog="${RMPROG-rm}"
|
||||
mkdirprog="${MKDIRPROG-mkdir}"
|
||||
|
||||
chmodcmd="$chmodprog 0755"
|
||||
chowncmd=
|
||||
chgrpcmd=
|
||||
stripcmd=
|
||||
rmcmd="$rmprog -f"
|
||||
mvcmd="$mvprog"
|
||||
src=
|
||||
dst=
|
||||
dir_arg=
|
||||
dstarg=
|
||||
no_target_directory=
|
||||
|
||||
usage="Usage: $0 [OPTION]... [-T] SRCFILE DSTFILE
|
||||
or: $0 [OPTION]... SRCFILES... DIRECTORY
|
||||
or: $0 [OPTION]... -t DIRECTORY SRCFILES...
|
||||
or: $0 [OPTION]... -d DIRECTORIES...
|
||||
|
||||
In the 1st form, copy SRCFILE to DSTFILE.
|
||||
In the 2nd and 3rd, copy all SRCFILES to DIRECTORY.
|
||||
In the 4th, create DIRECTORIES.
|
||||
|
||||
Options:
|
||||
-c (ignored)
|
||||
-d create directories instead of installing files.
|
||||
-g GROUP $chgrpprog installed files to GROUP.
|
||||
-m MODE $chmodprog installed files to MODE.
|
||||
-o USER $chownprog installed files to USER.
|
||||
-s $stripprog installed files.
|
||||
-t DIRECTORY install into DIRECTORY.
|
||||
-T report an error if DSTFILE is a directory.
|
||||
--help display this help and exit.
|
||||
--version display version info and exit.
|
||||
|
||||
Environment variables override the default commands:
|
||||
CHGRPPROG CHMODPROG CHOWNPROG CPPROG MKDIRPROG MVPROG RMPROG STRIPPROG
|
||||
"
|
||||
|
||||
while test -n "$1"; do
|
||||
case $1 in
|
||||
-c) shift
|
||||
continue;;
|
||||
|
||||
-d) dir_arg=true
|
||||
shift
|
||||
continue;;
|
||||
|
||||
-g) chgrpcmd="$chgrpprog $2"
|
||||
shift
|
||||
shift
|
||||
continue;;
|
||||
|
||||
--help) echo "$usage"; exit $?;;
|
||||
|
||||
-m) chmodcmd="$chmodprog $2"
|
||||
shift
|
||||
shift
|
||||
continue;;
|
||||
|
||||
-o) chowncmd="$chownprog $2"
|
||||
shift
|
||||
shift
|
||||
continue;;
|
||||
|
||||
-s) stripcmd=$stripprog
|
||||
shift
|
||||
continue;;
|
||||
|
||||
-t) dstarg=$2
|
||||
shift
|
||||
shift
|
||||
continue;;
|
||||
|
||||
-T) no_target_directory=true
|
||||
shift
|
||||
continue;;
|
||||
|
||||
--version) echo "$0 $scriptversion"; exit $?;;
|
||||
|
||||
*) # When -d is used, all remaining arguments are directories to create.
|
||||
# When -t is used, the destination is already specified.
|
||||
test -n "$dir_arg$dstarg" && break
|
||||
# Otherwise, the last argument is the destination. Remove it from $@.
|
||||
for arg
|
||||
do
|
||||
if test -n "$dstarg"; then
|
||||
# $@ is not empty: it contains at least $arg.
|
||||
set fnord "$@" "$dstarg"
|
||||
shift # fnord
|
||||
fi
|
||||
shift # arg
|
||||
dstarg=$arg
|
||||
done
|
||||
break;;
|
||||
esac
|
||||
done
|
||||
|
||||
if test -z "$1"; then
|
||||
if test -z "$dir_arg"; then
|
||||
echo "$0: no input file specified." >&2
|
||||
exit 1
|
||||
fi
|
||||
# It's OK to call `install-sh -d' without argument.
|
||||
# This can happen when creating conditional directories.
|
||||
exit 0
|
||||
fi
|
||||
|
||||
for src
|
||||
do
|
||||
# Protect names starting with `-'.
|
||||
case $src in
|
||||
-*) src=./$src ;;
|
||||
esac
|
||||
|
||||
if test -n "$dir_arg"; then
|
||||
dst=$src
|
||||
src=
|
||||
|
||||
if test -d "$dst"; then
|
||||
mkdircmd=:
|
||||
chmodcmd=
|
||||
else
|
||||
mkdircmd=$mkdirprog
|
||||
fi
|
||||
else
|
||||
# Waiting for this to be detected by the "$cpprog $src $dsttmp" command
|
||||
# might cause directories to be created, which would be especially bad
|
||||
# if $src (and thus $dsttmp) contains '*'.
|
||||
if test ! -f "$src" && test ! -d "$src"; then
|
||||
echo "$0: $src does not exist." >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if test -z "$dstarg"; then
|
||||
echo "$0: no destination specified." >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
dst=$dstarg
|
||||
# Protect names starting with `-'.
|
||||
case $dst in
|
||||
-*) dst=./$dst ;;
|
||||
esac
|
||||
|
||||
# If destination is a directory, append the input filename; won't work
|
||||
# if double slashes aren't ignored.
|
||||
if test -d "$dst"; then
|
||||
if test -n "$no_target_directory"; then
|
||||
echo "$0: $dstarg: Is a directory" >&2
|
||||
exit 1
|
||||
fi
|
||||
dst=$dst/`basename "$src"`
|
||||
fi
|
||||
fi
|
||||
|
||||
# This sed command emulates the dirname command.
|
||||
dstdir=`echo "$dst" | sed -e 's,/*$,,;s,[^/]*$,,;s,/*$,,;s,^$,.,'`
|
||||
|
||||
# Make sure that the destination directory exists.
|
||||
|
||||
# Skip lots of stat calls in the usual case.
|
||||
if test ! -d "$dstdir"; then
|
||||
defaultIFS='
|
||||
'
|
||||
IFS="${IFS-$defaultIFS}"
|
||||
|
||||
oIFS=$IFS
|
||||
# Some sh's can't handle IFS=/ for some reason.
|
||||
IFS='%'
|
||||
set x `echo "$dstdir" | sed -e 's@/@%@g' -e 's@^%@/@'`
|
||||
shift
|
||||
IFS=$oIFS
|
||||
|
||||
pathcomp=
|
||||
|
||||
while test $# -ne 0 ; do
|
||||
pathcomp=$pathcomp$1
|
||||
shift
|
||||
if test ! -d "$pathcomp"; then
|
||||
$mkdirprog "$pathcomp"
|
||||
# mkdir can fail with a `File exist' error in case several
|
||||
# install-sh are creating the directory concurrently. This
|
||||
# is OK.
|
||||
test -d "$pathcomp" || exit
|
||||
fi
|
||||
pathcomp=$pathcomp/
|
||||
done
|
||||
fi
|
||||
|
||||
if test -n "$dir_arg"; then
|
||||
$doit $mkdircmd "$dst" \
|
||||
&& { test -z "$chowncmd" || $doit $chowncmd "$dst"; } \
|
||||
&& { test -z "$chgrpcmd" || $doit $chgrpcmd "$dst"; } \
|
||||
&& { test -z "$stripcmd" || $doit $stripcmd "$dst"; } \
|
||||
&& { test -z "$chmodcmd" || $doit $chmodcmd "$dst"; }
|
||||
|
||||
else
|
||||
dstfile=`basename "$dst"`
|
||||
|
||||
# Make a couple of temp file names in the proper directory.
|
||||
dsttmp=$dstdir/_inst.$$_
|
||||
rmtmp=$dstdir/_rm.$$_
|
||||
|
||||
# Trap to clean up those temp files at exit.
|
||||
trap 'ret=$?; rm -f "$dsttmp" "$rmtmp" && exit $ret' 0
|
||||
trap '(exit $?); exit' 1 2 13 15
|
||||
|
||||
# Copy the file name to the temp name.
|
||||
$doit $cpprog "$src" "$dsttmp" &&
|
||||
|
||||
# and set any options; do chmod last to preserve setuid bits.
|
||||
#
|
||||
# If any of these fail, we abort the whole thing. If we want to
|
||||
# ignore errors from any of these, just make sure not to ignore
|
||||
# errors from the above "$doit $cpprog $src $dsttmp" command.
|
||||
#
|
||||
{ test -z "$chowncmd" || $doit $chowncmd "$dsttmp"; } \
|
||||
&& { test -z "$chgrpcmd" || $doit $chgrpcmd "$dsttmp"; } \
|
||||
&& { test -z "$stripcmd" || $doit $stripcmd "$dsttmp"; } \
|
||||
&& { test -z "$chmodcmd" || $doit $chmodcmd "$dsttmp"; } &&
|
||||
|
||||
# Now rename the file to the real destination.
|
||||
{ $doit $mvcmd -f "$dsttmp" "$dstdir/$dstfile" 2>/dev/null \
|
||||
|| {
|
||||
# The rename failed, perhaps because mv can't rename something else
|
||||
# to itself, or perhaps because mv is so ancient that it does not
|
||||
# support -f.
|
||||
|
||||
# Now remove or move aside any old file at destination location.
|
||||
# We try this two ways since rm can't unlink itself on some
|
||||
# systems and the destination file might be busy for other
|
||||
# reasons. In this case, the final cleanup might fail but the new
|
||||
# file should still install successfully.
|
||||
{
|
||||
if test -f "$dstdir/$dstfile"; then
|
||||
$doit $rmcmd -f "$dstdir/$dstfile" 2>/dev/null \
|
||||
|| $doit $mvcmd -f "$dstdir/$dstfile" "$rmtmp" 2>/dev/null \
|
||||
|| {
|
||||
echo "$0: cannot unlink or rename $dstdir/$dstfile" >&2
|
||||
(exit 1); exit 1
|
||||
}
|
||||
else
|
||||
:
|
||||
fi
|
||||
} &&
|
||||
|
||||
# Now rename the file to the real destination.
|
||||
$doit $mvcmd "$dsttmp" "$dstdir/$dstfile"
|
||||
}
|
||||
}
|
||||
fi || { (exit 1); exit 1; }
|
||||
done
|
||||
|
||||
# The final little trick to "correctly" pass the exit status to the exit trap.
|
||||
{
|
||||
(exit 0); exit 0
|
||||
}
|
||||
|
||||
# Local variables:
|
||||
# eval: (add-hook 'write-file-hooks 'time-stamp)
|
||||
# time-stamp-start: "scriptversion="
|
||||
# time-stamp-format: "%:y-%02m-%02d.%02H"
|
||||
# time-stamp-end: "$"
|
||||
# End:
|
|
@ -0,0 +1,10 @@
|
|||
#include <SDL/SDL.h>
|
||||
#include "port.h"
|
||||
#include "conffile.h"
|
||||
|
||||
typedef std::pair<std::string, std::string> strpair_t;
|
||||
extern ConfigFile::secvec_t keymaps;
|
||||
|
||||
|
||||
|
||||
|
|
@ -0,0 +1,142 @@
|
|||
/***********************************************************************************
|
||||
Snes9x - Portable Super Nintendo Entertainment System (TM) emulator.
|
||||
|
||||
See CREDITS file to find the copyright owners of this file.
|
||||
|
||||
SDL Input/Audio/Video code (many lines of code come from snes9x & drnoksnes)
|
||||
(c) Copyright 2011 Makoto Sugano (makoto.sugano@gmail.com)
|
||||
|
||||
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 HAVE_SDL 1
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <unistd.h>
|
||||
#include <ctype.h>
|
||||
#include <fcntl.h>
|
||||
#include <dirent.h>
|
||||
#include <signal.h>
|
||||
#include <errno.h>
|
||||
#include <string.h>
|
||||
|
||||
#ifdef HAVE_STRINGS_H
|
||||
#include <strings.h>
|
||||
#endif
|
||||
|
||||
#include <sys/stat.h>
|
||||
#include <sys/types.h>
|
||||
|
||||
#include "snes9x.h"
|
||||
#include "memmap.h"
|
||||
#include "apu/apu.h"
|
||||
#include "gfx.h"
|
||||
#include "snapshot.h"
|
||||
#include "controls.h"
|
||||
#include "cheats.h"
|
||||
#include "movie.h"
|
||||
#include "logger.h"
|
||||
#include "display.h"
|
||||
#include "conffile.h"
|
||||
|
||||
#ifdef DEBUGGER
|
||||
#include "debug.h"
|
||||
#endif
|
||||
|
||||
#include <SDL/SDL.h>
|
||||
//#include "sdl_snes9x.h"
|
||||
|
||||
SDL_AudioSpec *audiospec;
|
||||
uint32 sound_buffer_size;
|
||||
|
||||
void S9xToggleSoundChannel (int c)
|
||||
{
|
||||
static uint8 sound_switch = 255;
|
||||
|
||||
if (c == 8)
|
||||
sound_switch = 255;
|
||||
else
|
||||
sound_switch ^= 1 << c;
|
||||
|
||||
S9xSetSoundControl(sound_switch);
|
||||
}
|
||||
|
||||
static void
|
||||
sdl_audio_callback (void *userdata, Uint8 *stream, int len)
|
||||
{
|
||||
SDL_LockAudio ();
|
||||
S9xMixSamples (stream, len >> (Settings.SixteenBitSound ? 1 : 0));
|
||||
SDL_UnlockAudio ();
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
static void
|
||||
samples_available (void *data)
|
||||
{
|
||||
SDL_LockAudio ();
|
||||
S9xFinalizeSamples ();
|
||||
SDL_UnlockAudio ();
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
bool8 S9xOpenSoundDevice (void)
|
||||
{
|
||||
#ifdef HAVE_SDL
|
||||
SDL_InitSubSystem (SDL_INIT_AUDIO);
|
||||
|
||||
audiospec = (SDL_AudioSpec *) malloc (sizeof (SDL_AudioSpec));
|
||||
|
||||
audiospec->freq = Settings.SoundPlaybackRate;
|
||||
audiospec->channels = Settings.Stereo ? 2 : 1;
|
||||
audiospec->format = Settings.SixteenBitSound ? AUDIO_S16SYS : AUDIO_U8;
|
||||
audiospec->samples = (sound_buffer_size * audiospec->freq / 1000) >> 1;
|
||||
audiospec->callback = sdl_audio_callback;
|
||||
|
||||
printf ("SDL sound driver initializing...\n");
|
||||
printf (" --> (Frequency: %dhz, Latency: %dms)...",
|
||||
audiospec->freq,
|
||||
(audiospec->samples * 1000 / audiospec->freq) << 1);
|
||||
|
||||
if (SDL_OpenAudio (audiospec, NULL) < 0)
|
||||
{
|
||||
printf ("Failed\n");
|
||||
|
||||
free (audiospec);
|
||||
audiospec = NULL;
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
printf ("OK\n");
|
||||
|
||||
SDL_PauseAudio (0);
|
||||
|
||||
S9xSetSamplesAvailableCallback (samples_available, NULL);
|
||||
#endif
|
||||
|
||||
return (TRUE);
|
||||
}
|
|
@ -0,0 +1,568 @@
|
|||
/***********************************************************************************
|
||||
Snes9x - Portable Super Nintendo Entertainment System (TM) emulator.
|
||||
|
||||
See CREDITS file to find the copyright owners of this file.
|
||||
|
||||
SDL Input/Audio/Video code (many lines of code come from snes9x & drnoksnes)
|
||||
(c) Copyright 2011 Makoto Sugano (makoto.sugano@gmail.com)
|
||||
|
||||
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 "sdl_snes9x.h"
|
||||
|
||||
#include "snes9x.h"
|
||||
#include "port.h"
|
||||
#include "controls.h"
|
||||
|
||||
using namespace std;
|
||||
std::map <string, int> name_sdlkeysym;
|
||||
|
||||
ConfigFile::secvec_t keymaps;
|
||||
|
||||
s9xcommand_t S9xInitCommandT (const char *n)
|
||||
{
|
||||
s9xcommand_t cmd;
|
||||
|
||||
cmd.type = S9xBadMapping;
|
||||
cmd.multi_press = 0;
|
||||
cmd.button_norpt = 0;
|
||||
cmd.port[0] = 0xff;
|
||||
cmd.port[1] = 0;
|
||||
cmd.port[2] = 0;
|
||||
cmd.port[3] = 0;
|
||||
|
||||
return (cmd);
|
||||
}
|
||||
|
||||
char * S9xGetDisplayCommandName (s9xcommand_t cmd)
|
||||
{
|
||||
return (strdup("None"));
|
||||
}
|
||||
|
||||
void S9xHandleDisplayCommand (s9xcommand_t cmd, int16 data1, int16 data2)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
// domaemon: 2) here we send the keymapping request to the SNES9X
|
||||
// domaemon: MapInput (J, K, M)
|
||||
bool8 S9xMapInput (const char *n, s9xcommand_t *cmd)
|
||||
{
|
||||
int i, j, d;
|
||||
char *c;
|
||||
|
||||
// domaemon: linking PseudoPointer# and command
|
||||
if (!strncmp(n, "PseudoPointer", 13))
|
||||
{
|
||||
if (n[13] >= '1' && n[13] <= '8' && n[14] == '\0')
|
||||
{
|
||||
return (S9xMapPointer(PseudoPointerBase + (n[13] - '1'), *cmd, false));
|
||||
}
|
||||
else
|
||||
{
|
||||
goto unrecog;
|
||||
}
|
||||
}
|
||||
|
||||
// domaemon: linking PseudoButton# and command
|
||||
if (!strncmp(n, "PseudoButton", 12))
|
||||
{
|
||||
if (isdigit(n[12]) && (j = strtol(n + 12, &c, 10)) < 256 && (c == NULL || *c == '\0'))
|
||||
{
|
||||
return (S9xMapButton(PseudoButtonBase + j, *cmd, false));
|
||||
}
|
||||
else
|
||||
{
|
||||
goto unrecog;
|
||||
}
|
||||
}
|
||||
|
||||
if (!(isdigit(n[1]) && isdigit(n[2]) && n[3] == ':'))
|
||||
goto unrecog;
|
||||
|
||||
switch (n[0])
|
||||
{
|
||||
case 'J': // domaemon: joysticks input mapping
|
||||
{
|
||||
d = ((n[1] - '0') * 10 + (n[2] - '0')) << 24;
|
||||
d |= 0x80000000;
|
||||
i = 4;
|
||||
|
||||
if (!strncmp(n + i, "Axis", 4)) // domaemon: joystick axis
|
||||
{
|
||||
d |= 0x8000; // Axis mode
|
||||
i += 4;
|
||||
}
|
||||
else if (n[i] == 'B') // domaemon: joystick button
|
||||
{
|
||||
i++;
|
||||
}
|
||||
else
|
||||
{
|
||||
goto unrecog;
|
||||
}
|
||||
|
||||
d |= j = strtol(n + i, &c, 10); // Axis or Button id
|
||||
if ((c != NULL && *c != '\0') || j > 0x3fff)
|
||||
goto unrecog;
|
||||
|
||||
if (d & 0x8000)
|
||||
return (S9xMapAxis(d, *cmd, false));
|
||||
|
||||
return (S9xMapButton(d, *cmd, false));
|
||||
}
|
||||
|
||||
case 'K':
|
||||
{
|
||||
d = 0x00000000;
|
||||
|
||||
for (i = 4; n[i] != '\0' && n[i] != '+'; i++) ;
|
||||
|
||||
if (n[i] == '\0' || i == 4) {
|
||||
// domaemon: if no mod keys are found.
|
||||
i = 4;
|
||||
}
|
||||
else
|
||||
{
|
||||
// domaemon: mod keys are not supported now.
|
||||
goto unrecog;
|
||||
}
|
||||
|
||||
string keyname (n + i); // domaemon: SDL_keysym in string format.
|
||||
|
||||
d |= name_sdlkeysym[keyname];
|
||||
return (S9xMapButton(d, *cmd, false));
|
||||
}
|
||||
|
||||
case 'M':
|
||||
{
|
||||
d = 0x40000000;
|
||||
|
||||
if (!strncmp(n + 4, "Pointer", 7))
|
||||
{
|
||||
d |= 0x8000;
|
||||
|
||||
if (n[11] == '\0')
|
||||
return (S9xMapPointer(d, *cmd, true));
|
||||
|
||||
i = 11;
|
||||
}
|
||||
else if (n[4] == 'B')
|
||||
{
|
||||
i = 5;
|
||||
}
|
||||
else
|
||||
{
|
||||
goto unrecog;
|
||||
}
|
||||
|
||||
d |= j = strtol(n + i, &c, 10);
|
||||
|
||||
if ((c != NULL && *c != '\0') || j > 0x7fff)
|
||||
goto unrecog;
|
||||
|
||||
if (d & 0x8000)
|
||||
return (S9xMapPointer(d, *cmd, true));
|
||||
|
||||
return (S9xMapButton(d, *cmd, false));
|
||||
}
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
unrecog:
|
||||
char *err = new char[strlen(n) + 34];
|
||||
|
||||
sprintf(err, "Unrecognized input device name '%s'", n);
|
||||
perror(err);
|
||||
delete [] err;
|
||||
|
||||
return (false);
|
||||
}
|
||||
|
||||
// domaemon: SetupDefaultKeymap -> MapInput (JS) -> MapDisplayInput (KB)
|
||||
void S9xSetupDefaultKeymap (void)
|
||||
{
|
||||
s9xcommand_t cmd;
|
||||
|
||||
S9xUnmapAllControls();
|
||||
|
||||
for (ConfigFile::secvec_t::iterator i = keymaps.begin(); i != keymaps.end(); i++)
|
||||
{
|
||||
cmd = S9xInitCommandT(i->second.c_str());
|
||||
|
||||
if (cmd.type == S9xBadMapping)
|
||||
{
|
||||
cmd = S9xGetCommandT(i->second.c_str());
|
||||
if (cmd.type == S9xBadMapping)
|
||||
{
|
||||
std::string s("Unrecognized command '");
|
||||
s += i->second + "'";
|
||||
perror(s.c_str());
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
if (!S9xMapInput(i->first.c_str(), &cmd))
|
||||
{
|
||||
std::string s("Could not map '");
|
||||
s += i->second + "' to '" + i->first + "'";
|
||||
perror(s.c_str());
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
keymaps.clear();
|
||||
}
|
||||
|
||||
// domaemon: FIXME, just collecting the essentials.
|
||||
// domaemon: *) here we define the keymapping.
|
||||
void S9xParseInputConfig (ConfigFile &conf, int pass)
|
||||
{
|
||||
keymaps.clear();
|
||||
if (!conf.GetBool("Unix::ClearAllControls", false))
|
||||
{
|
||||
// Using 'Joypad# Axis'
|
||||
keymaps.push_back(strpair_t("J00:Axis0", "Joypad1 Axis Left/Right T=50%"));
|
||||
keymaps.push_back(strpair_t("J00:Axis1", "Joypad1 Axis Up/Down T=50%"));
|
||||
|
||||
keymaps.push_back(strpair_t("J00:B0", "Joypad1 X"));
|
||||
keymaps.push_back(strpair_t("J00:B1", "Joypad1 A"));
|
||||
keymaps.push_back(strpair_t("J00:B2", "Joypad1 B"));
|
||||
keymaps.push_back(strpair_t("J00:B3", "Joypad1 Y"));
|
||||
|
||||
keymaps.push_back(strpair_t("J00:B6", "Joypad1 L"));
|
||||
keymaps.push_back(strpair_t("J00:B7", "Joypad1 R"));
|
||||
keymaps.push_back(strpair_t("J00:B8", "Joypad1 Select"));
|
||||
keymaps.push_back(strpair_t("J00:B11", "Joypad1 Start"));
|
||||
keymaps.push_back(strpair_t("K00:SDLK_RIGHT", "Joypad1 Right"));
|
||||
keymaps.push_back(strpair_t("K00:SDLK_LEFT", "Joypad1 Left"));
|
||||
keymaps.push_back(strpair_t("K00:SDLK_DOWN", "Joypad1 Down"));
|
||||
keymaps.push_back(strpair_t("K00:SDLK_UP", "Joypad1 Up"));
|
||||
keymaps.push_back(strpair_t("K00:SDLK_RETURN", "Joypad1 Start"));
|
||||
keymaps.push_back(strpair_t("K00:SDLK_SPACE", "Joypad1 Select"));
|
||||
keymaps.push_back(strpair_t("K00:SDLK_d", "Joypad1 A"));
|
||||
keymaps.push_back(strpair_t("K00:SDLK_c", "Joypad1 B"));
|
||||
keymaps.push_back(strpair_t("K00:SDLK_s", "Joypad1 X"));
|
||||
keymaps.push_back(strpair_t("K00:SDLK_x", "Joypad1 Y"));
|
||||
keymaps.push_back(strpair_t("K00:SDLK_a", "Joypad1 L"));
|
||||
keymaps.push_back(strpair_t("K00:SDLK_z", "Joypad1 R"));
|
||||
|
||||
// domaemon: *) GetSDLKeyFromName().
|
||||
name_sdlkeysym["SDLK_s"] = SDLK_s;
|
||||
name_sdlkeysym["SDLK_d"] = SDLK_d;
|
||||
name_sdlkeysym["SDLK_x"] = SDLK_x;
|
||||
name_sdlkeysym["SDLK_c"] = SDLK_c;
|
||||
name_sdlkeysym["SDLK_a"] = SDLK_a;
|
||||
name_sdlkeysym["SDLK_z"] = SDLK_z;
|
||||
name_sdlkeysym["SDLK_UP"] = SDLK_UP;
|
||||
name_sdlkeysym["SDLK_DOWN"] = SDLK_DOWN;
|
||||
name_sdlkeysym["SDLK_RIGHT"] = SDLK_RIGHT;
|
||||
name_sdlkeysym["SDLK_LEFT"] = SDLK_LEFT;
|
||||
name_sdlkeysym["SDLK_RETURN"] = SDLK_RETURN;
|
||||
name_sdlkeysym["SDLK_SPACE"] = SDLK_SPACE;
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
void S9xInitInputDevices (void)
|
||||
{
|
||||
SDL_Joystick * joystick[4] = {NULL, NULL, NULL, NULL};
|
||||
|
||||
// domaemon: 1) initializing the joystic subsystem
|
||||
SDL_InitSubSystem (SDL_INIT_JOYSTICK);
|
||||
|
||||
/*
|
||||
* domaemon: 2) check how may joysticks are connected
|
||||
* domaemon: 3) relate paddev1 to SDL_Joystick[0], paddev2 to SDL_Joystick[1]...
|
||||
* domaemon: 4) print out the joystick name and capabilities
|
||||
*/
|
||||
|
||||
int num_joysticks = SDL_NumJoysticks();
|
||||
|
||||
if (num_joysticks == 0)
|
||||
{
|
||||
fprintf(stderr, "joystick: No joystick found.\n");
|
||||
}
|
||||
else
|
||||
{
|
||||
SDL_JoystickEventState (SDL_ENABLE);
|
||||
|
||||
// domaemon: FIXME should check if num_joysticks is below 4..
|
||||
for (int i = 0; i < num_joysticks; i++)
|
||||
{
|
||||
joystick[i] = SDL_JoystickOpen (i);
|
||||
printf (" %s\n", SDL_JoystickName(i));
|
||||
printf (" %d-axis %d-buttons %d-balls %d-hats \n",
|
||||
SDL_JoystickNumAxes(joystick[i]),
|
||||
SDL_JoystickNumButtons(joystick[i]),
|
||||
SDL_JoystickNumBalls(joystick[i]),
|
||||
SDL_JoystickNumHats(joystick[i]));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void S9xProcessEvents (bool8 block)
|
||||
{
|
||||
SDL_Event event;
|
||||
bool8 quit_state = FALSE;
|
||||
|
||||
while ((block) || (SDL_PollEvent (&event) != 0))
|
||||
{
|
||||
switch (event.type) {
|
||||
case SDL_KEYDOWN:
|
||||
case SDL_KEYUP:
|
||||
// domaemon: not sure it's the best idea, but reserving the SDLK_q for quit.
|
||||
if (event.key.keysym.sym == SDLK_q)
|
||||
{
|
||||
quit_state = TRUE;
|
||||
}
|
||||
else
|
||||
{
|
||||
S9xReportButton(event.key.keysym.mod << 16 | // keyboard mod
|
||||
event.key.keysym.sym, // keyboard ksym
|
||||
event.type == SDL_KEYDOWN); // press or release
|
||||
}
|
||||
break;
|
||||
|
||||
/***** Joystick starts *****/
|
||||
#if 0
|
||||
case SDL_JOYBUTTONDOWN:
|
||||
case SDL_JOYBUTTONUP:
|
||||
S9xReportButton(0x80000000 | // joystick button
|
||||
(event.jbutton.which << 24) | // joystick index
|
||||
event.jbutton.button, // joystick button code
|
||||
event.type == SDL_JOYBUTTONDOWN); // press or release
|
||||
break;
|
||||
|
||||
case SDL_JOYAXISMOTION:
|
||||
S9xReportAxis(0x80008000 | // joystick axis
|
||||
(event.jaxis.which << 24) | // joystick index
|
||||
event.jaxis.axis, // joystick axis
|
||||
event.jaxis.value); // axis value
|
||||
break;
|
||||
#endif
|
||||
/***** Joystick ends *****/
|
||||
|
||||
case SDL_QUIT:
|
||||
// domaemon: we come here when the window is getting closed.
|
||||
quit_state = TRUE;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (quit_state == TRUE)
|
||||
{
|
||||
printf ("Quit Event. Bye.\n");
|
||||
S9xExit();
|
||||
}
|
||||
}
|
||||
|
||||
bool S9xPollButton (uint32 id, bool *pressed)
|
||||
{
|
||||
return (false);
|
||||
}
|
||||
|
||||
bool S9xPollAxis (uint32 id, int16 *value)
|
||||
{
|
||||
return (false);
|
||||
}
|
||||
|
||||
bool S9xPollPointer (uint32 id, int16 *x, int16 *y)
|
||||
{
|
||||
return (false);
|
||||
}
|
||||
|
||||
// domaemon: needed by SNES9X
|
||||
void S9xHandlePortCommand (s9xcommand_t cmd, int16 data1, int16 data2)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
#if 0
|
||||
|
||||
main()
|
||||
{
|
||||
int i;
|
||||
SDL_Joystick * joysticks[4] = {NULL, NULL, NULL, NULL};
|
||||
SDL_Event event;
|
||||
SDL_Surface *screen;
|
||||
|
||||
if (SDL_Init(SDL_INIT_VIDEO | SDL_INIT_JOYSTICK) != 0)
|
||||
{
|
||||
printf("Unable to initialize SDL: %s\n", SDL_GetError());
|
||||
}
|
||||
|
||||
atexit(SDL_Quit);
|
||||
|
||||
screen = SDL_SetVideoMode(64, 64, 16, 0);
|
||||
|
||||
for (i = 0; i < SDL_NumJoysticks(); i++)
|
||||
{
|
||||
printf (" %s\n", SDL_JoystickName(i));
|
||||
joysticks[i] = SDL_JoystickOpen (i);
|
||||
}
|
||||
|
||||
SDL_JoystickEventState (SDL_ENABLE);
|
||||
|
||||
while (SDL_WaitEvent (&event) != 0)
|
||||
{
|
||||
switch (event.type) {
|
||||
case SDL_KEYDOWN:
|
||||
printf ("KEYDOWN\n");
|
||||
break;
|
||||
case SDL_JOYAXISMOTION:
|
||||
printf ("JOYAXISMOTION\n");
|
||||
break;
|
||||
case SDL_JOYBUTTONDOWN:
|
||||
printf ("JOYBUTTONDOWN\n");
|
||||
printf ("%d \n", event.jbutton.button);
|
||||
break;
|
||||
case SDL_JOYHATMOTION:
|
||||
switch (event.jhat.value) {
|
||||
case SDL_HAT_UP:
|
||||
printf ("SDL_HAT_UP\n");
|
||||
break;
|
||||
case SDL_HAT_DOWN:
|
||||
printf ("SDL_HAT_DOWN\n");
|
||||
break;
|
||||
case SDL_HAT_LEFT:
|
||||
printf ("SDL_HAT_LEFT\n");
|
||||
break;
|
||||
case SDL_HAT_RIGHT:
|
||||
printf ("SDL_HAT_RIGHT\n");
|
||||
break;
|
||||
}
|
||||
|
||||
printf ("JOYHATMOTION\n");
|
||||
break;
|
||||
case SDL_QUIT:
|
||||
// domaemon: we come here when the window is getting closed.
|
||||
SDL_Quit();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// domaemon: 2) here we send the keymapping request to the SNES9X
|
||||
bool8 S9xMapDisplayInput (const char *n, s9xcommand_t *cmd)
|
||||
{
|
||||
int i, d;
|
||||
|
||||
if (!isdigit(n[1]) || !isdigit(n[2]) || n[3] != ':')
|
||||
goto unrecog;
|
||||
|
||||
d = ((n[1] - '0') * 10 + (n[2] - '0')) << 24;
|
||||
|
||||
switch (n[0])
|
||||
{
|
||||
case 'K':
|
||||
{
|
||||
int key;
|
||||
|
||||
d |= 0x00000000;
|
||||
|
||||
for (i = 4; n[i] != '\0' && n[i] != '+'; i++) ;
|
||||
|
||||
if (n[i] == '\0' || i == 4) // domaemon: no mod keys.
|
||||
i = 4;
|
||||
|
||||
#if 0 // domaemon: mod keys not working properly.
|
||||
else // domaemon: with mod keys
|
||||
{
|
||||
for (i = 4; n[i] != '+'; i++)
|
||||
{
|
||||
switch (n[i])
|
||||
{
|
||||
case 'S': d |= KMOD_SHIFT << 16; break;
|
||||
case 'C': d |= KMOD_CTRL << 16; break;
|
||||
case 'A': d |= KMOD_ALT << 16; break;
|
||||
case 'M': d |= KMOD_META << 16; break;
|
||||
default: goto unrecog;
|
||||
}
|
||||
}
|
||||
i++;
|
||||
}
|
||||
#endif
|
||||
|
||||
string keyname (n + i); // domaemon: SDL_keysym in string format.
|
||||
key = name_sdlkeysym[keyname];
|
||||
|
||||
d |= key;
|
||||
return (S9xMapButton(d, *cmd, false));
|
||||
|
||||
}
|
||||
|
||||
case 'M':
|
||||
{
|
||||
char *c;
|
||||
int j;
|
||||
|
||||
d |= 0x40000000;
|
||||
|
||||
if (!strncmp(n + 4, "Pointer", 7))
|
||||
{
|
||||
d |= 0x8000;
|
||||
|
||||
if (n[11] == '\0')
|
||||
return (S9xMapPointer(d, *cmd, true));
|
||||
|
||||
i = 11;
|
||||
}
|
||||
else
|
||||
if (n[4] == 'B')
|
||||
i = 5;
|
||||
else
|
||||
goto unrecog;
|
||||
|
||||
d |= j = strtol(n + i, &c, 10);
|
||||
|
||||
if ((c != NULL && *c != '\0') || j > 0x7fff)
|
||||
goto unrecog;
|
||||
|
||||
if (d & 0x8000)
|
||||
return (S9xMapPointer(d, *cmd, true));
|
||||
|
||||
return (S9xMapButton(d, *cmd, false));
|
||||
}
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
unrecog:
|
||||
char *err = new char[strlen(n) + 34];
|
||||
|
||||
sprintf(err, "Unrecognized input device name '%s'", n);
|
||||
perror(err);
|
||||
delete [] err;
|
||||
|
||||
return (false);
|
||||
}
|
||||
|
||||
#endif
|
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,384 @@
|
|||
/***********************************************************************************
|
||||
Snes9x - Portable Super Nintendo Entertainment System (TM) emulator.
|
||||
|
||||
See CREDITS file to find the copyright owners of this file.
|
||||
|
||||
SDL Input/Audio/Video code (many lines of code come from snes9x & drnoksnes)
|
||||
(c) Copyright 2011 Makoto Sugano (makoto.sugano@gmail.com)
|
||||
|
||||
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 <stdlib.h>
|
||||
#include <unistd.h>
|
||||
#include <ctype.h>
|
||||
#include <errno.h>
|
||||
#include <string.h>
|
||||
#ifdef HAVE_STRINGS_H
|
||||
#include <strings.h>
|
||||
#endif
|
||||
|
||||
#include "snes9x.h"
|
||||
#include "memmap.h"
|
||||
#include "ppu.h"
|
||||
#include "controls.h"
|
||||
#include "movie.h"
|
||||
#include "logger.h"
|
||||
#include "conffile.h"
|
||||
#include "blit.h"
|
||||
#include "display.h"
|
||||
|
||||
#include "sdl_snes9x.h"
|
||||
|
||||
struct GUIData
|
||||
{
|
||||
SDL_Surface *sdl_screen;
|
||||
uint8 *snes_buffer;
|
||||
uint8 *blit_screen;
|
||||
uint32 blit_screen_pitch;
|
||||
int video_mode;
|
||||
bool8 fullscreen;
|
||||
};
|
||||
static struct GUIData GUI;
|
||||
|
||||
typedef void (* Blitter) (uint8 *, int, uint8 *, int, int, int);
|
||||
|
||||
#ifdef __linux
|
||||
// Select seems to be broken in 2.x.x kernels - if a signal interrupts a
|
||||
// select system call with a zero timeout, the select call is restarted but
|
||||
// with an infinite timeout! The call will block until data arrives on the
|
||||
// selected fd(s).
|
||||
//
|
||||
// The workaround is to stop the X library calling select in the first
|
||||
// place! Replace XPending - which polls for data from the X server using
|
||||
// select - with an ioctl call to poll for data and then only call the blocking
|
||||
// XNextEvent if data is waiting.
|
||||
#define SELECT_BROKEN_FOR_SIGNALS
|
||||
#endif
|
||||
|
||||
enum
|
||||
{
|
||||
VIDEOMODE_BLOCKY = 1,
|
||||
VIDEOMODE_TV,
|
||||
VIDEOMODE_SMOOTH,
|
||||
VIDEOMODE_SUPEREAGLE,
|
||||
VIDEOMODE_2XSAI,
|
||||
VIDEOMODE_SUPER2XSAI,
|
||||
VIDEOMODE_EPX,
|
||||
VIDEOMODE_HQ2X
|
||||
};
|
||||
|
||||
static void SetupImage (void);
|
||||
static void TakedownImage (void);
|
||||
static void Repaint (bool8);
|
||||
|
||||
void S9xExtraDisplayUsage (void)
|
||||
{
|
||||
S9xMessage(S9X_INFO, S9X_USAGE, "-fullscreen fullscreen mode (without scaling)");
|
||||
S9xMessage(S9X_INFO, S9X_USAGE, "");
|
||||
S9xMessage(S9X_INFO, S9X_USAGE, "-v1 Video mode: Blocky (default)");
|
||||
S9xMessage(S9X_INFO, S9X_USAGE, "-v2 Video mode: TV");
|
||||
S9xMessage(S9X_INFO, S9X_USAGE, "-v3 Video mode: Smooth");
|
||||
S9xMessage(S9X_INFO, S9X_USAGE, "-v4 Video mode: SuperEagle");
|
||||
S9xMessage(S9X_INFO, S9X_USAGE, "-v5 Video mode: 2xSaI");
|
||||
S9xMessage(S9X_INFO, S9X_USAGE, "-v6 Video mode: Super2xSaI");
|
||||
S9xMessage(S9X_INFO, S9X_USAGE, "-v7 Video mode: EPX");
|
||||
S9xMessage(S9X_INFO, S9X_USAGE, "-v8 Video mode: hq2x");
|
||||
S9xMessage(S9X_INFO, S9X_USAGE, "");
|
||||
}
|
||||
|
||||
void S9xParseDisplayArg (char **argv, int &i, int argc)
|
||||
{
|
||||
if (!strncasecmp(argv[i], "-fullscreen", 11))
|
||||
{
|
||||
GUI.fullscreen = TRUE;
|
||||
printf ("Entering fullscreen mode (without scaling).\n");
|
||||
}
|
||||
else
|
||||
if (!strncasecmp(argv[i], "-v", 2))
|
||||
{
|
||||
switch (argv[i][2])
|
||||
{
|
||||
case '1': GUI.video_mode = VIDEOMODE_BLOCKY; break;
|
||||
case '2': GUI.video_mode = VIDEOMODE_TV; break;
|
||||
case '3': GUI.video_mode = VIDEOMODE_SMOOTH; break;
|
||||
case '4': GUI.video_mode = VIDEOMODE_SUPEREAGLE; break;
|
||||
case '5': GUI.video_mode = VIDEOMODE_2XSAI; break;
|
||||
case '6': GUI.video_mode = VIDEOMODE_SUPER2XSAI; break;
|
||||
case '7': GUI.video_mode = VIDEOMODE_EPX; break;
|
||||
case '8': GUI.video_mode = VIDEOMODE_HQ2X; break;
|
||||
}
|
||||
}
|
||||
else
|
||||
S9xUsage();
|
||||
}
|
||||
|
||||
const char * S9xParseDisplayConfig (ConfigFile &conf, int pass)
|
||||
{
|
||||
if (pass != 1)
|
||||
return ("Unix/SDL");
|
||||
|
||||
if (conf.Exists("Unix/SDL::VideoMode"))
|
||||
{
|
||||
GUI.video_mode = conf.GetUInt("Unix/SDL::VideoMode", VIDEOMODE_BLOCKY);
|
||||
if (GUI.video_mode < 1 || GUI.video_mode > 8)
|
||||
GUI.video_mode = VIDEOMODE_BLOCKY;
|
||||
}
|
||||
else
|
||||
GUI.video_mode = VIDEOMODE_BLOCKY;
|
||||
|
||||
return ("Unix/SDL");
|
||||
}
|
||||
|
||||
static void FatalError (const char *str)
|
||||
{
|
||||
fprintf(stderr, "%s\n", str);
|
||||
S9xExit();
|
||||
}
|
||||
|
||||
void S9xInitDisplay (int argc, char **argv)
|
||||
{
|
||||
if (SDL_Init(SDL_INIT_VIDEO) != 0)
|
||||
{
|
||||
printf("Unable to initialize SDL: %s\n", SDL_GetError());
|
||||
}
|
||||
|
||||
atexit(SDL_Quit);
|
||||
|
||||
/*
|
||||
* domaemon
|
||||
*
|
||||
* we just go along with RGB565 for now, nothing else..
|
||||
*/
|
||||
|
||||
S9xSetRenderPixelFormat(RGB565);
|
||||
|
||||
S9xBlitFilterInit();
|
||||
S9xBlit2xSaIFilterInit();
|
||||
S9xBlitHQ2xFilterInit();
|
||||
|
||||
|
||||
/*
|
||||
* domaemon
|
||||
*
|
||||
* FIXME: The secreen size should be flexible
|
||||
* FIXME: Check if the SDL screen is really in RGB565 mode. screen->fmt
|
||||
*/
|
||||
if (GUI.fullscreen == TRUE)
|
||||
{
|
||||
GUI.sdl_screen = SDL_SetVideoMode(0, 0, 16, SDL_FULLSCREEN);
|
||||
} else {
|
||||
GUI.sdl_screen = SDL_SetVideoMode(SNES_WIDTH * 2, SNES_HEIGHT_EXTENDED * 2, 16, 0);
|
||||
}
|
||||
|
||||
if (GUI.sdl_screen == NULL)
|
||||
{
|
||||
printf("Unable to set video mode: %s\n", SDL_GetError());
|
||||
exit(1);
|
||||
}
|
||||
|
||||
/*
|
||||
* domaemon
|
||||
*
|
||||
* buffer allocation, quite important
|
||||
*/
|
||||
SetupImage();
|
||||
}
|
||||
|
||||
void S9xDeinitDisplay (void)
|
||||
{
|
||||
TakedownImage();
|
||||
|
||||
SDL_Quit();
|
||||
|
||||
S9xBlitFilterDeinit();
|
||||
S9xBlit2xSaIFilterDeinit();
|
||||
S9xBlitHQ2xFilterDeinit();
|
||||
}
|
||||
|
||||
static void TakedownImage (void)
|
||||
{
|
||||
if (GUI.snes_buffer)
|
||||
{
|
||||
free(GUI.snes_buffer);
|
||||
GUI.snes_buffer = NULL;
|
||||
}
|
||||
|
||||
S9xGraphicsDeinit();
|
||||
}
|
||||
|
||||
static void SetupImage (void)
|
||||
{
|
||||
TakedownImage();
|
||||
|
||||
// domaemon: The whole unix code basically assumes output=(original * 2);
|
||||
// This way the code can handle the SNES filters, which does the 2X.
|
||||
GFX.Pitch = SNES_WIDTH * 2 * 2;
|
||||
GUI.snes_buffer = (uint8 *) calloc(GFX.Pitch * ((SNES_HEIGHT_EXTENDED + 4) * 2), 1);
|
||||
if (!GUI.snes_buffer)
|
||||
FatalError("Failed to allocate GUI.snes_buffer.");
|
||||
|
||||
// domaemon: Add 2 lines before drawing.
|
||||
GFX.Screen = (uint16 *) (GUI.snes_buffer + (GFX.Pitch * 2 * 2));
|
||||
|
||||
if (GUI.fullscreen == TRUE)
|
||||
{
|
||||
int offset_height_pix;
|
||||
int offset_width_pix;
|
||||
int offset_byte;
|
||||
|
||||
|
||||
offset_height_pix = (GUI.sdl_screen->h - (SNES_HEIGHT * 2)) / 2;
|
||||
offset_width_pix = (GUI.sdl_screen->w - (SNES_WIDTH * 2)) / 2;
|
||||
|
||||
offset_byte = (GUI.sdl_screen->w * offset_height_pix + offset_width_pix) * 2;
|
||||
|
||||
GUI.blit_screen = (uint8 *) GUI.sdl_screen->pixels + offset_byte;
|
||||
GUI.blit_screen_pitch = GUI.sdl_screen->w * 2;
|
||||
}
|
||||
else
|
||||
{
|
||||
GUI.blit_screen = (uint8 *) GUI.sdl_screen->pixels;
|
||||
GUI.blit_screen_pitch = SNES_WIDTH * 2 * 2; // window size =(*2); 2 byte pir pixel =(*2)
|
||||
}
|
||||
|
||||
S9xGraphicsInit();
|
||||
}
|
||||
|
||||
void S9xPutImage (int width, int height)
|
||||
{
|
||||
static int prevWidth = 0, prevHeight = 0;
|
||||
int copyWidth, copyHeight;
|
||||
Blitter blitFn = NULL;
|
||||
|
||||
if (GUI.video_mode == VIDEOMODE_BLOCKY || GUI.video_mode == VIDEOMODE_TV || GUI.video_mode == VIDEOMODE_SMOOTH)
|
||||
if ((width <= SNES_WIDTH) && ((prevWidth != width) || (prevHeight != height)))
|
||||
S9xBlitClearDelta();
|
||||
|
||||
if (width <= SNES_WIDTH)
|
||||
{
|
||||
if (height > SNES_HEIGHT_EXTENDED)
|
||||
{
|
||||
copyWidth = width * 2;
|
||||
copyHeight = height;
|
||||
blitFn = S9xBlitPixSimple2x1;
|
||||
}
|
||||
else
|
||||
{
|
||||
copyWidth = width * 2;
|
||||
copyHeight = height * 2;
|
||||
|
||||
switch (GUI.video_mode)
|
||||
{
|
||||
case VIDEOMODE_BLOCKY: blitFn = S9xBlitPixSimple2x2; break;
|
||||
case VIDEOMODE_TV: blitFn = S9xBlitPixTV2x2; break;
|
||||
case VIDEOMODE_SMOOTH: blitFn = S9xBlitPixSmooth2x2; break;
|
||||
case VIDEOMODE_SUPEREAGLE: blitFn = S9xBlitPixSuperEagle16; break;
|
||||
case VIDEOMODE_2XSAI: blitFn = S9xBlitPix2xSaI16; break;
|
||||
case VIDEOMODE_SUPER2XSAI: blitFn = S9xBlitPixSuper2xSaI16; break;
|
||||
case VIDEOMODE_EPX: blitFn = S9xBlitPixEPX16; break;
|
||||
case VIDEOMODE_HQ2X: blitFn = S9xBlitPixHQ2x16; break;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
if (height <= SNES_HEIGHT_EXTENDED)
|
||||
{
|
||||
copyWidth = width;
|
||||
copyHeight = height * 2;
|
||||
|
||||
switch (GUI.video_mode)
|
||||
{
|
||||
default: blitFn = S9xBlitPixSimple1x2; break;
|
||||
case VIDEOMODE_TV: blitFn = S9xBlitPixTV1x2; break;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
copyWidth = width;
|
||||
copyHeight = height;
|
||||
blitFn = S9xBlitPixSimple1x1;
|
||||
}
|
||||
|
||||
|
||||
// domaemon: this is place where the rendering buffer size should be changed?
|
||||
blitFn((uint8 *) GFX.Screen, GFX.Pitch, GUI.blit_screen, GUI.blit_screen_pitch, width, height);
|
||||
|
||||
// domaemon: does the height change on the fly?
|
||||
if (height < prevHeight)
|
||||
{
|
||||
int p = GUI.blit_screen_pitch >> 2;
|
||||
for (int y = SNES_HEIGHT * 2; y < SNES_HEIGHT_EXTENDED * 2; y++)
|
||||
{
|
||||
uint32 *d = (uint32 *) (GUI.blit_screen + y * GUI.blit_screen_pitch);
|
||||
for (int x = 0; x < p; x++)
|
||||
*d++ = 0;
|
||||
}
|
||||
}
|
||||
|
||||
Repaint(TRUE);
|
||||
|
||||
prevWidth = width;
|
||||
prevHeight = height;
|
||||
}
|
||||
|
||||
static void Repaint (bool8 isFrameBoundry)
|
||||
{
|
||||
SDL_Flip(GUI.sdl_screen);
|
||||
}
|
||||
|
||||
void S9xMessage (int type, int number, const char *message)
|
||||
{
|
||||
const int max = 36 * 3;
|
||||
static char buffer[max + 1];
|
||||
|
||||
fprintf(stdout, "%s\n", message);
|
||||
strncpy(buffer, message, max + 1);
|
||||
buffer[max] = 0;
|
||||
S9xSetInfoString(buffer);
|
||||
}
|
||||
|
||||
const char * S9xStringInput (const char *message)
|
||||
{
|
||||
static char buffer[256];
|
||||
|
||||
printf("%s: ", message);
|
||||
fflush(stdout);
|
||||
|
||||
if (fgets(buffer, sizeof(buffer) - 2, stdin))
|
||||
return (buffer);
|
||||
|
||||
return (NULL);
|
||||
}
|
||||
|
||||
void S9xSetTitle (const char *string)
|
||||
{
|
||||
SDL_WM_SetCaption(string, string);
|
||||
}
|
||||
|
||||
void S9xSetPalette (void)
|
||||
{
|
||||
return;
|
||||
}
|
Loading…
Reference in New Issue