sdl: added sdl2 branch for sdl2 port development

This commit is contained in:
punkrockguy318 2014-02-12 14:58:27 +00:00
parent d0a7716ba4
commit 0015bd043c
981 changed files with 273094 additions and 0 deletions

72
branches/sdl2/Authors Normal file
View File

@ -0,0 +1,72 @@
Authors
=======
A list of people who have contributed code to FCE Ultra, or have had their code
placed in FCE Ultra by others.
Pre-2.0 FCE / FCE Ultra Contributors
------------------------------------
_These authors contributed exclusively to pre-2.0 versions,
but much of their code remains in 2.0 builds_
* BERO - bero at geocities.co.jp - Base FCE code.
* Xodnizel - Most of the base FCE Ultra code
* Aaron Oneal - http://www.morphgear.com - Many changes to compile with MSVC and first frame skipping code
* Joe Nahmias - Man pages
* Paul Kuliniewicz - kuliniew at purdue.edu - Various code for the original SDL port.
* Quietust - quietust at ircN dot org - VRC7 "translation" code.
* Ben Parnell - Windows debugging tools
* Parasyte & bbitmaster - Enhanced Windows debugging tools
* blip & nitsuja - Rerecording support
FCEUX >= 2.0 Contributors
-------------------------
* SP - document thyself (sf:rheiny) - Enhanced Windows debugging tools
* zeromus - mgambrell at gmail dot com (sf:zeromus) - Core architecture refactoring and merging - Windows driver maintenance
* adelikat - document thyself (sf:adelikat) - UI cleanup, project management, Win32 features & maintenance, TAS tools, documentation
* CaH4e3 - CaH4e3 at mail dot ru (sf: cah4e3) - Mappers
* Luke Gustafson - (sf:???) - Windows TAS and movie recording enhancements
* qfox - (sf:qfox) - lua scripting fucntions, luabot, basicbot (no longer implemented), various lua scripts
* _mz - document thyself (mauzus) - Windows driver maintenance and cleanup
* UncombedCoconut - UncombedCoconut at gmail dot com (sf:jeblanchard) - Build system and cross-compilation support - Driver maintenance and refactoring
* DWEdit - Debugger additions
* AnS - ansstuff at yandex dot ru (sf:ansstuff) - Win32 features & maintenance, TAS Editor, debugging tools, documentation
FCEUX (>=2.0) Linux/SDL Developers
----------------------------------
_These guys concentrated on keeping fceux the premiere linux/portable nes emu._
* Lukas Sabota - ltsmooth42 at gmail dot com (sf:punkrockguy318) - Head FceuX-SDL developer - GTK GUI, complete overhaul of SDL port, build scripts; maintainence; docs
* Shinydoofy - sf:shinydoofy - SDL maintenence
* Soules - gimmedonutnow at gmail dot com (sf:gimmedonutnow) - Linux SDL driver maintenance
* radsaq - radsaq at gmail dot com (sf:radsaq) - Build system, testing, and random cleanups
* Bryan Cain - sf:plombo - Patch to embed SDL in the GTK+ GUI, miscellaneous other SDL and GTK+ contributions
Included components:
--------------------
* Mitsutaka Okazaki - YM2413 emulator.
* Andrea Mazzoleni - Scale2x/Scale3x scalers
* Gilles Vollant - unzip.c PKZIP fileio

339
branches/sdl2/COPYING Normal file
View File

@ -0,0 +1,339 @@
GNU GENERAL PUBLIC LICENSE
Version 2, June 1991
Copyright (C) 1989, 1991 Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
Preamble
The licenses for most software are designed to take away your
freedom to share and change it. By contrast, the GNU General Public
License is intended to guarantee your freedom to share and change free
software--to make sure the software is free for all its users. This
General Public License applies to most of the Free Software
Foundation's software and to any other program whose authors commit to
using it. (Some other Free Software Foundation software is covered by
the GNU Lesser General Public License instead.) You can apply it to
your programs, too.
When we speak of free software, we are referring to freedom, not
price. Our General Public Licenses are designed to make sure that you
have the freedom to distribute copies of free software (and charge for
this service if you wish), that you receive source code or can get it
if you want it, that you can change the software or use pieces of it
in new free programs; and that you know you can do these things.
To protect your rights, we need to make restrictions that forbid
anyone to deny you these rights or to ask you to surrender the rights.
These restrictions translate to certain responsibilities for you if you
distribute copies of the software, or if you modify it.
For example, if you distribute copies of such a program, whether
gratis or for a fee, you must give the recipients all the rights that
you have. You must make sure that they, too, receive or can get the
source code. And you must show them these terms so they know their
rights.
We protect your rights with two steps: (1) copyright the software, and
(2) offer you this license which gives you legal permission to copy,
distribute and/or modify the software.
Also, for each author's protection and ours, we want to make certain
that everyone understands that there is no warranty for this free
software. If the software is modified by someone else and passed on, we
want its recipients to know that what they have is not the original, so
that any problems introduced by others will not reflect on the original
authors' reputations.
Finally, any free program is threatened constantly by software
patents. We wish to avoid the danger that redistributors of a free
program will individually obtain patent licenses, in effect making the
program proprietary. To prevent this, we have made it clear that any
patent must be licensed for everyone's free use or not licensed at all.
The precise terms and conditions for copying, distribution and
modification follow.
GNU GENERAL PUBLIC LICENSE
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
0. This License applies to any program or other work which contains
a notice placed by the copyright holder saying it may be distributed
under the terms of this General Public License. The "Program", below,
refers to any such program or work, and a "work based on the Program"
means either the Program or any derivative work under copyright law:
that is to say, a work containing the Program or a portion of it,
either verbatim or with modifications and/or translated into another
language. (Hereinafter, translation is included without limitation in
the term "modification".) Each licensee is addressed as "you".
Activities other than copying, distribution and modification are not
covered by this License; they are outside its scope. The act of
running the Program is not restricted, and the output from the Program
is covered only if its contents constitute a work based on the
Program (independent of having been made by running the Program).
Whether that is true depends on what the Program does.
1. You may copy and distribute verbatim copies of the Program's
source code as you receive it, in any medium, provided that you
conspicuously and appropriately publish on each copy an appropriate
copyright notice and disclaimer of warranty; keep intact all the
notices that refer to this License and to the absence of any warranty;
and give any other recipients of the Program a copy of this License
along with the Program.
You may charge a fee for the physical act of transferring a copy, and
you may at your option offer warranty protection in exchange for a fee.
2. You may modify your copy or copies of the Program or any portion
of it, thus forming a work based on the Program, and copy and
distribute such modifications or work under the terms of Section 1
above, provided that you also meet all of these conditions:
a) You must cause the modified files to carry prominent notices
stating that you changed the files and the date of any change.
b) You must cause any work that you distribute or publish, that in
whole or in part contains or is derived from the Program or any
part thereof, to be licensed as a whole at no charge to all third
parties under the terms of this License.
c) If the modified program normally reads commands interactively
when run, you must cause it, when started running for such
interactive use in the most ordinary way, to print or display an
announcement including an appropriate copyright notice and a
notice that there is no warranty (or else, saying that you provide
a warranty) and that users may redistribute the program under
these conditions, and telling the user how to view a copy of this
License. (Exception: if the Program itself is interactive but
does not normally print such an announcement, your work based on
the Program is not required to print an announcement.)
These requirements apply to the modified work as a whole. If
identifiable sections of that work are not derived from the Program,
and can be reasonably considered independent and separate works in
themselves, then this License, and its terms, do not apply to those
sections when you distribute them as separate works. But when you
distribute the same sections as part of a whole which is a work based
on the Program, the distribution of the whole must be on the terms of
this License, whose permissions for other licensees extend to the
entire whole, and thus to each and every part regardless of who wrote it.
Thus, it is not the intent of this section to claim rights or contest
your rights to work written entirely by you; rather, the intent is to
exercise the right to control the distribution of derivative or
collective works based on the Program.
In addition, mere aggregation of another work not based on the Program
with the Program (or with a work based on the Program) on a volume of
a storage or distribution medium does not bring the other work under
the scope of this License.
3. You may copy and distribute the Program (or a work based on it,
under Section 2) in object code or executable form under the terms of
Sections 1 and 2 above provided that you also do one of the following:
a) Accompany it with the complete corresponding machine-readable
source code, which must be distributed under the terms of Sections
1 and 2 above on a medium customarily used for software interchange; or,
b) Accompany it with a written offer, valid for at least three
years, to give any third party, for a charge no more than your
cost of physically performing source distribution, a complete
machine-readable copy of the corresponding source code, to be
distributed under the terms of Sections 1 and 2 above on a medium
customarily used for software interchange; or,
c) Accompany it with the information you received as to the offer
to distribute corresponding source code. (This alternative is
allowed only for noncommercial distribution and only if you
received the program in object code or executable form with such
an offer, in accord with Subsection b above.)
The source code for a work means the preferred form of the work for
making modifications to it. For an executable work, complete source
code means all the source code for all modules it contains, plus any
associated interface definition files, plus the scripts used to
control compilation and installation of the executable. However, as a
special exception, the source code distributed need not include
anything that is normally distributed (in either source or binary
form) with the major components (compiler, kernel, and so on) of the
operating system on which the executable runs, unless that component
itself accompanies the executable.
If distribution of executable or object code is made by offering
access to copy from a designated place, then offering equivalent
access to copy the source code from the same place counts as
distribution of the source code, even though third parties are not
compelled to copy the source along with the object code.
4. You may not copy, modify, sublicense, or distribute the Program
except as expressly provided under this License. Any attempt
otherwise to copy, modify, sublicense or distribute the Program is
void, and will automatically terminate your rights under this License.
However, parties who have received copies, or rights, from you under
this License will not have their licenses terminated so long as such
parties remain in full compliance.
5. You are not required to accept this License, since you have not
signed it. However, nothing else grants you permission to modify or
distribute the Program or its derivative works. These actions are
prohibited by law if you do not accept this License. Therefore, by
modifying or distributing the Program (or any work based on the
Program), you indicate your acceptance of this License to do so, and
all its terms and conditions for copying, distributing or modifying
the Program or works based on it.
6. Each time you redistribute the Program (or any work based on the
Program), the recipient automatically receives a license from the
original licensor to copy, distribute or modify the Program subject to
these terms and conditions. You may not impose any further
restrictions on the recipients' exercise of the rights granted herein.
You are not responsible for enforcing compliance by third parties to
this License.
7. If, as a consequence of a court judgment or allegation of patent
infringement or for any other reason (not limited to patent issues),
conditions are imposed on you (whether by court order, agreement or
otherwise) that contradict the conditions of this License, they do not
excuse you from the conditions of this License. If you cannot
distribute so as to satisfy simultaneously your obligations under this
License and any other pertinent obligations, then as a consequence you
may not distribute the Program at all. For example, if a patent
license would not permit royalty-free redistribution of the Program by
all those who receive copies directly or indirectly through you, then
the only way you could satisfy both it and this License would be to
refrain entirely from distribution of the Program.
If any portion of this section is held invalid or unenforceable under
any particular circumstance, the balance of the section is intended to
apply and the section as a whole is intended to apply in other
circumstances.
It is not the purpose of this section to induce you to infringe any
patents or other property right claims or to contest validity of any
such claims; this section has the sole purpose of protecting the
integrity of the free software distribution system, which is
implemented by public license practices. Many people have made
generous contributions to the wide range of software distributed
through that system in reliance on consistent application of that
system; it is up to the author/donor to decide if he or she is willing
to distribute software through any other system and a licensee cannot
impose that choice.
This section is intended to make thoroughly clear what is believed to
be a consequence of the rest of this License.
8. If the distribution and/or use of the Program is restricted in
certain countries either by patents or by copyrighted interfaces, the
original copyright holder who places the Program under this License
may add an explicit geographical distribution limitation excluding
those countries, so that distribution is permitted only in or among
countries not thus excluded. In such case, this License incorporates
the limitation as if written in the body of this License.
9. The Free Software Foundation may publish revised and/or new versions
of the General Public License from time to time. Such new versions will
be similar in spirit to the present version, but may differ in detail to
address new problems or concerns.
Each version is given a distinguishing version number. If the Program
specifies a version number of this License which applies to it and "any
later version", you have the option of following the terms and conditions
either of that version or of any later version published by the Free
Software Foundation. If the Program does not specify a version number of
this License, you may choose any version ever published by the Free Software
Foundation.
10. If you wish to incorporate parts of the Program into other free
programs whose distribution conditions are different, write to the author
to ask for permission. For software which is copyrighted by the Free
Software Foundation, write to the Free Software Foundation; we sometimes
make exceptions for this. Our decision will be guided by the two goals
of preserving the free status of all derivatives of our free software and
of promoting the sharing and reuse of software generally.
NO WARRANTY
11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
REPAIR OR CORRECTION.
12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
POSSIBILITY OF SUCH DAMAGES.
END OF TERMS AND CONDITIONS
How to Apply These Terms to Your New Programs
If you develop a new program, and you want it to be of the greatest
possible use to the public, the best way to achieve this is to make it
free software which everyone can redistribute and change under these terms.
To do so, attach the following notices to the program. It is safest
to attach them to the start of each source file to most effectively
convey the exclusion of warranty; and each file should have at least
the "copyright" line and a pointer to where the full notice is found.
<one line to give the program's name and a brief idea of what it does.>
Copyright (C) <year> <name of author>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
Also add information on how to contact you by electronic and paper mail.
If the program is interactive, make it output a short notice like this
when it starts in an interactive mode:
Gnomovision version 69, Copyright (C) year name of author
Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
This is free software, and you are welcome to redistribute it
under certain conditions; type `show c' for details.
The hypothetical commands `show w' and `show c' should show the appropriate
parts of the General Public License. Of course, the commands you use may
be called something other than `show w' and `show c'; they could even be
mouse-clicks or menu items--whatever suits your program.
You should also get your employer (if you work as a programmer) or your
school, if any, to sign a "copyright disclaimer" for the program, if
necessary. Here is a sample; alter the names:
Yoyodyne, Inc., hereby disclaims all copyright interest in the program
`Gnomovision' (which makes passes at compilers) written by James Hacker.
<signature of Ty Coon>, 1 April 1989
Ty Coon, President of Vice
This General Public License does not permit incorporating your program into
proprietary programs. If your program is a subroutine library, you may
consider it more useful to permit linking proprietary applications with the
library. If this is what you want to do, use the GNU Lesser General
Public License instead of this License.

7
branches/sdl2/INSTALL Normal file
View File

@ -0,0 +1,7 @@
To compile and install FCEUX for SDL, follow the instructions in the README-SDL.md file.
Users of Microsoft Visual Studio can use the solution files within the vc directory.
These solution files will compile FCEUX and some included libraries for full functionality.
CMake has been depreciated in favor of scons. However, if you wish to use it you can find the old cmake build files in the attic.

View File

@ -0,0 +1,69 @@
NewPPU tests
Bad
Nightshade (U) - flickering
Good
3-D Battles of World Runner, The (U)
8 Eyes
10 Yard fight
Advanced Dungeons and Dragons - Pool of Radiance
Adventures of Bayou Billy
Adventures of Lolo 1
Adventures of Lolo 2
Advenutres of Lolo 3
Akira
Akumajou secial - Boku Dracula-kun
Archon
Astyanax
Barbie
Bart vs the Space Mutants
Baseball
Batman - Return of the Joker
Battletoads
Battletoads & Double Dragon
Bee 52
Bible Adventures
Castlevania
Castlevania II: Simon's Quest
Castlevania III: Dracula's Curse
Championship Pool
Chessmaster
Circus Charlie
Contra (U)
Contra (J)
Dragon Warrior
Dragon Warrior III
Dragon Warrior IV
Double Dragon
Double Dragon 2
Double Dragon 3
Donky Kong Classics
Doki Doki panic
Dragon's Lair - [FIXED] Black screen for level 1 (music plays)
Duck Tales
Duck Tales
Earthworm Jim 2
Excitebike
Eggerland
Final Fantasy
Friday the 13th
Gauntlet
Gauntlet II
Legend of Zelda
Metroid
Mike Tyson's Punch-out!!/Punch-out!!
Power Blade
RBI Baseball
Rygar
Super C
Super Mario Bros 2 JPN
Super Mario Bros 2 USA
Super Mario Bros 3
Tecmobowl
Tecmo NBA Basketball (U)
Tecmo Super Bowl (U) [!] - [FIXED] Intro screen messed up, menus out of whack, Team selection screen bad, pre game screen, field is messed up.
TMNT
Transformers
Zanac
Zelda II: The Adventure of Link

116
branches/sdl2/README-SDL Normal file
View File

@ -0,0 +1,116 @@
FCEUX SDL 2.2.1 SDL README
==========================
By Lukas Sabota (sf: punkrockguy318)
http://www.fceux.com
Last Modified: March 10, 2013
Table of Contents
-----------------
1. Requirements
2. Installation
3. Compile-time options
4. GUI
5. LUA Scripting
5. FAQ
6. Contact
1 - Requirements
----------------
* libsdl1.2 - It is strongly recommended that you upgrade to the latest
version of sdl (1.2.15 at the time of writing).
* scons - Required to build fceux.
* libgtk2.0 (optional) - version >= 2.24 recommended
* libgtk3.0 (optional) - this compiles as of fceux 2.2.0
* liblua5.1 (optional)
* minizip (optional) - you may chose to use the version of minizip on your system by enabling SYSTEM_MINIZIP in the SConstruct
* c++ compiler -- you may use g++ from gcc or clang++ from llvm.
2 - Installation
----------------
Fceux can be compiled and built using the scons build system. To compile, run:
scons
After a sucessful compilation, the fceux binary will be generated to
./src/fceux . You can install fceux to your system with the following command:
scons install
You can optionally define a prefix:
scons --prefix=/usr/local install
You can choose to install the lua scripts (located in output/luaScripts) to a directory of your choosing:
cp -R output/luaScripts /usr/local/some/directory/that/i/will/find/later
If you would like to clean the temporary scons files to perform a 'make clean' like function, you can do the following:
scons -c && rm -rf .scon*
3 - Compile-time options
------------------------
You can enable and disable certain features of fceux at build time.
To edit these options, edit the "BoolOptions" following the "opts.AddVariables" method
at the head of the "SConstruct" file in this source directory. The
default options will be fine for most users, but power users may want to
tweak some of these options.
4 - GUI
-------
You can enable the GTK GUI by setting GTK to 1 in the SConstruct build file.
GfceuX is deprecatiated in favor of the new GTK GUI. You can disable the GTK GUI at
run-time by passing the --nogui option, or disable it at build-time by setting
GTK to 0 in the SConstruct file. If you prefer GTK3 to GTK2, you can set the
GTK3 BoolVariable to 1 in the SConstruct.
5 - LUA Scripting
-----------------
FCEUX provides a LUA 5.1 engine that allows for in-game scripting capabilities. LUA can be enabled or disabled at build time by adjusting the "LUA" BoolVariable in the SConstruct file.
A collection of LUA scripts are provided with the source distribuition in the output directory:
$source_directory/output/luaScripts
You should be able to run most of the scripts in this directory out of the box. However, some of the the lua scripts require functionality from the "auxlib.lua" library. This file can be copied from "./bin/auxlib.lua" or "./src/auxlib.lua". You will need to place this file in the LUA library search path if a script bombs out looking for auxlib.lua. If the script bombs out, the console output will let you know what the search path are (/usr/local/lib/lua/5.1/ on my particular system). You can simply copy the auxlib to a preferred location to utilize the functions in the auxiliary lua library.
In addition, some of the lua scripts require functionality from the "iup" GUI library. You can obtain binaries and source for "iup" upstream (http://www.tecgraf.puc-rio.br/iup/), but I would recommend obtaining packages from your Linux distribution if you are able, as it can be difficult to compile or get the binaries working correctly on a given system.
You will need to add the location that the libiup*.so files to the LUA_CPATH. This can be done with the following command (please note that the location where iup is installed with vary based on how you installed iup):
export LUA_CPATH="/path/to/iup/lib/lib?51.so;"
For example, if libiuplua51.so is located in '/usr/lib', you can run the following command before executing fceux to place the library in the search path:
export LUA_CPATH="/usr/lib/lib?51.so;"
Finally, if any scripts complaints about "attempt to index global 'iup' (a nil value)", this means that "iup" needs to be explicitly loaded into the script. You can add the following line to the head of script to manually load "iup":
require("iuplua")
The latest version of iup (3.5 at the time of writing) is recomended.
6 - FAQ
-------
* Q. Im having issues with my sound!
* A. First of all, for the best sound quality be sure you are using SDL 1.2.14 or later. Versions 1.2.13 and earlier are known to have problems with fceux! Next, try different SDL audio drivers to see if this makes any difference. You can do this by using this command before running fceux:
export SDL_AUDIODRIVER=driver
where driver is either: 'pulse' for pulseaudio;' alsa' for ALSA; 'dsp' for OSS; 'esd' for ESD; see SDL documentation for details (http://www.libsdl.org/docs/html/sdlenvvars.html)
There are sound options that you can tweak at runtime through command line switches:
* -soundq x internal sound quality hack value (0 off)
* -soundrate x sound rate (sane values: 28000 48000
* -soundbuffersize x (in ms) sane values (30, 50, 100, 120)
Running fceux through esddsp is known to fix some audio issues with pulseaudio on some older Ubuntu versions.
7 - Contact
-----------
If you have an issue with fceux, report it in the sourceforge bug tracker (see fceux.com). If you would like to contact the author of this readme personally, e-mail LTsmooth42 <at> gmail <dot> com. You can also check us out at #fceu on irc.freenode.net.

241
branches/sdl2/SConstruct Normal file
View File

@ -0,0 +1,241 @@
#
# SConstruct - build script for the SDL port of fceux
#
# You can adjust the BoolVariables below to include/exclude features
# at compile-time. You may also use arguments to specify the parameters.
# ie: scons RELEASE=1 GTK3=1
#
# Use "scons" to compile and "scons install" to install.
#
import os
import sys
import platform
opts = Variables(None, ARGUMENTS)
opts.AddVariables(
BoolVariable('DEBUG', 'Build with debugging symbols', 1),
BoolVariable('RELEASE', 'Set to 1 to build for release', 0),
BoolVariable('FRAMESKIP', 'Enable frameskipping', 1),
BoolVariable('OPENGL', 'Enable OpenGL support', 1),
BoolVariable('LUA', 'Enable Lua support', 1),
BoolVariable('GTK', 'Enable GTK2 GUI (SDL only)', 1),
BoolVariable('GTK3', 'Enable GTK3 GUI (SDL only)', 0),
BoolVariable('NEWPPU', 'Enable new PPU core', 1),
BoolVariable('CREATE_AVI', 'Enable avi creation support (SDL only)', 1),
BoolVariable('LOGO', 'Enable a logoscreen when creating avis (SDL only)', 1),
BoolVariable('SYSTEM_LUA','Use system lua instead of static lua provided with fceux', 1),
BoolVariable('SYSTEM_MINIZIP', 'Use system minizip instead of static minizip provided with fceux', 0),
BoolVariable('LSB_FIRST', 'Least signficant byte first (non-PPC)', 1),
BoolVariable('CLANG', 'Compile with llvm-clang instead of gcc', 0),
BoolVariable('SDL2', 'Compile using SDL2 instead of SDL 1.2 (experimental/non-functional)', 0)
)
AddOption('--prefix', dest='prefix', type='string', nargs=1, action='store', metavar='DIR', help='installation prefix')
prefix = GetOption('prefix')
env = Environment(options = opts)
if env['RELEASE']:
env.Append(CPPDEFINES=["PUBLIC_RELEASE"])
env['DEBUG'] = 0
# LSB_FIRST must be off for PPC to compile
if platform.system == "ppc":
env['LSB_FIRST'] = 0
# Default compiler flags:
env.Append(CCFLAGS = ['-Wall', '-Wno-write-strings', '-Wno-sign-compare'])
if os.environ.has_key('PLATFORM'):
env.Replace(PLATFORM = os.environ['PLATFORM'])
if os.environ.has_key('CC'):
env.Replace(CC = os.environ['CC'])
if os.environ.has_key('CXX'):
env.Replace(CXX = os.environ['CXX'])
if os.environ.has_key('WINDRES'):
env.Replace(WINDRES = os.environ['WINDRES'])
if os.environ.has_key('CFLAGS'):
env.Append(CCFLAGS = os.environ['CFLAGS'].split())
if os.environ.has_key('CXXFLAGS'):
env.Append(CXXFLAGS = os.environ['CXXFLAGS'].split())
if os.environ.has_key('CPPFLAGS'):
env.Append(CPPFLAGS = os.environ['CPPFLAGS'].split())
if os.environ.has_key('LDFLAGS'):
env.Append(LINKFLAGS = os.environ['LDFLAGS'].split())
if os.environ.has_key('PKG_CONFIG_PATH'):
env['ENV']['PKG_CONFIG_PATH'] = os.environ['PKG_CONFIG_PATH']
if os.environ.has_key('PKG_CONFIG_LIBDIR'):
env['ENV']['PKG_CONFIG_LIBDIR'] = os.environ['PKG_CONFIG_LIBDIR']
print "platform: ", env['PLATFORM']
# compile with clang
if env['CLANG']:
env.Replace(CC='clang')
env.Replace(CXX='clang++')
# special flags for cygwin
# we have to do this here so that the function and lib checks will go through mingw
if env['PLATFORM'] == 'cygwin':
env.Append(CCFLAGS = " -mno-cygwin")
env.Append(LINKFLAGS = " -mno-cygwin")
env['LIBS'] = ['wsock32'];
if env['PLATFORM'] == 'win32':
env.Append(CPPPATH = [".", "drivers/win/", "drivers/common/", "drivers/", "drivers/win/zlib", "drivers/win/directx", "drivers/win/lua/include"])
env.Append(CPPDEFINES = ["PSS_STYLE=2", "WIN32", "_USE_SHARED_MEMORY_", "NETWORK", "FCEUDEF_DEBUGGER", "NOMINMAX", "NEED_MINGW_HACKS", "_WIN32_IE=0x0600"])
env.Append(LIBS = ["rpcrt4", "comctl32", "vfw32", "winmm", "ws2_32", "comdlg32", "ole32", "gdi32", "htmlhelp"])
else:
conf = Configure(env)
# If libdw is available, compile in backward-cpp support
if conf.CheckLib('dw'):
conf.env.Append(CCFLAGS = "-DBACKWARD_HAS_DW=1")
conf.env.Append(LINKFLAGS = "-ldw")
if conf.CheckFunc('asprintf'):
conf.env.Append(CCFLAGS = "-DHAVE_ASPRINTF")
if env['SYSTEM_MINIZIP']:
assert conf.CheckLibWithHeader('minizip', 'minizip/unzip.h', 'C', 'unzOpen;', 1), "please install: libminizip"
assert conf.CheckLibWithHeader('z', 'zlib.h', 'c', 'inflate;', 1), "please install: zlib"
env.Append(CPPDEFINES=["_SYSTEM_MINIZIP"])
else:
assert conf.CheckLibWithHeader('z', 'zlib.h', 'c', 'inflate;', 1), "please install: zlib"
if env['SDL2']:
if not conf.CheckLib('SDL2'):
print 'Did not find libSDL2 or SDL2.lib, exiting!'
Exit(1)
env.Append(CPPDEFINES=["_SDL2"])
env.ParseConfig('pkg-config sdl2 --cflags --libs')
else:
if not conf.CheckLib('SDL'):
print 'Did not find libSDL or SDL.lib, exiting!'
Exit(1)
env.ParseConfig('sdl-config --cflags --libs')
if env['GTK']:
if not conf.CheckLib('gtk-x11-2.0'):
print 'Could not find libgtk-2.0, exiting!'
Exit(1)
# Add compiler and linker flags from pkg-config
config_string = 'pkg-config --cflags --libs gtk+-2.0'
env.ParseConfig(config_string)
env.Append(CPPDEFINES=["_GTK2"])
env.Append(CCFLAGS = ["-D_GTK"])
if env['GTK3']:
# Add compiler and linker flags from pkg-config
config_string = 'pkg-config --cflags --libs gtk+-3.0'
env.ParseConfig(config_string)
env.Append(CPPDEFINES=["_GTK3"])
env.Append(CCFLAGS = ["-D_GTK"])
### Lua platform defines
### Applies to all files even though only lua needs it, but should be ok
if env['LUA']:
env.Append(CPPDEFINES=["_S9XLUA_H"])
if env['PLATFORM'] == 'darwin':
# Define LUA_USE_MACOSX otherwise we can't bind external libs from lua
env.Append(CCFLAGS = ["-DLUA_USE_MACOSX"])
if env['PLATFORM'] == 'posix':
# If we're POSIX, we use LUA_USE_LINUX since that combines usual lua posix defines with dlfcn calls for dynamic library loading.
# Should work on any *nix
env.Append(CCFLAGS = ["-DLUA_USE_LINUX"])
lua_available = False
if conf.CheckLib('lua5.1'):
env.Append(LINKFLAGS = ["-ldl", "-llua5.1"])
env.Append(CCFLAGS = ["-I/usr/include/lua5.1"])
lua_available = True
elif conf.CheckLib('lua'):
env.Append(LINKFLAGS = ["-ldl", "-llua"])
env.Append(CCFLAGS = ["-I/usr/include/lua"])
lua_available = True
if lua_available == False:
print 'Could not find liblua, exiting!'
Exit(1)
# "--as-needed" no longer available on OSX (probably BSD as well? TODO: test)
if env['PLATFORM'] != 'darwin':
env.Append(LINKFLAGS=['-Wl,--as-needed'])
### Search for gd if we're not in Windows
if env['PLATFORM'] != 'win32' and env['PLATFORM'] != 'cygwin' and env['CREATE_AVI'] and env['LOGO']:
gd = conf.CheckLib('gd', autoadd=1)
if gd == 0:
env['LOGO'] = 0
print 'Did not find libgd, you won\'t be able to create a logo screen for your avis.'
if env['OPENGL'] and conf.CheckLibWithHeader('GL', 'GL/gl.h', 'c', autoadd=1):
conf.env.Append(CCFLAGS = "-DOPENGL")
conf.env.Append(CPPDEFINES = ['PSS_STYLE=1'])
env = conf.Finish()
if sys.byteorder == 'little' or env['PLATFORM'] == 'win32':
env.Append(CPPDEFINES = ['LSB_FIRST'])
if env['FRAMESKIP']:
env.Append(CPPDEFINES = ['FRAMESKIP'])
print "base CPPDEFINES:",env['CPPDEFINES']
print "base CCFLAGS:",env['CCFLAGS']
if env['DEBUG']:
env.Append(CPPDEFINES=["_DEBUG"], CCFLAGS = ['-g', '-O0'])
else:
env.Append(CCFLAGS = ['-O2'])
if env['PLATFORM'] != 'win32' and env['PLATFORM'] != 'cygwin' and env['CREATE_AVI']:
env.Append(CPPDEFINES=["CREATE_AVI"])
else:
env['CREATE_AVI']=0;
Export('env')
fceux = SConscript('src/SConscript')
env.Program(target="fceux-net-server", source=["fceux-server/server.cpp", "fceux-server/md5.cpp", "fceux-server/throttle.cpp"])
# Installation rules
if prefix == None:
prefix = "/usr/local"
exe_suffix = ''
if env['PLATFORM'] == 'win32':
exe_suffix = '.exe'
fceux_src = 'src/fceux' + exe_suffix
fceux_dst = 'bin/fceux' + exe_suffix
fceux_net_server_src = 'fceux-net-server' + exe_suffix
fceux_net_server_dst = 'bin/fceux-net-server' + exe_suffix
auxlib_src = 'src/auxlib.lua'
auxlib_dst = 'bin/auxlib.lua'
auxlib_inst_dst = prefix + '/share/fceux/auxlib.lua'
fceux_h_src = 'output/fceux.chm'
fceux_h_dst = 'bin/fceux.chm'
env.Command(fceux_h_dst, fceux_h_src, [Copy(fceux_h_dst, fceux_h_src)])
env.Command(fceux_dst, fceux_src, [Copy(fceux_dst, fceux_src)])
env.Command(fceux_net_server_dst, fceux_net_server_src, [Copy(fceux_net_server_dst, fceux_net_server_src)])
env.Command(auxlib_dst, auxlib_src, [Copy(auxlib_dst, auxlib_src)])
man_src = 'documentation/fceux.6'
man_net_src = 'documentation/fceux-net-server.6'
man_dst = prefix + '/share/man/man6/fceux.6'
man_net_dst = prefix + '/share/man/man6/fceux-net-server.6'
share_src = 'output/'
share_dst = prefix + '/share/fceux/'
image_src = 'fceux.png'
image_dst = prefix + '/share/pixmaps'
desktop_src = 'fceux.desktop'
desktop_dst = prefix + '/share/applications/'
env.Install(prefix + "/bin/", fceux)
env.Install(prefix + "/bin/", "fceux-net-server")
# TODO: Where to put auxlib on "scons install?"
env.Alias('install', env.Command(auxlib_inst_dst, auxlib_src, [Copy(auxlib_inst_dst, auxlib_src)]))
env.Alias('install', env.Command(share_dst, share_src, [Copy(share_dst, share_src)]))
env.Alias('install', env.Command(man_dst, man_src, [Copy(man_dst, man_src)]))
env.Alias('install', env.Command(man_net_dst, man_net_src, [Copy(man_net_dst, man_net_src)]))
env.Alias('install', env.Command(image_dst, image_src, [Copy(image_dst, image_src)]))
env.Alias('install', env.Command(desktop_dst, desktop_src, [Copy(desktop_dst, desktop_src)]))
env.Alias('install', (prefix + "/bin/"))

View File

@ -0,0 +1,14 @@
FceuX-SDL Style Guidelines
=========================
Background
----------
While having style guidelines specific to a directory in a sourcetree is slightly riddiculous, fceuX has a unique elaborate history of the code. I (prg318) have ressurected the majority of the SDL port code and tried to keep some aspects of the style consistant (although not many aspects were that consistent to begin with due to the amount of different people who have contributed to this codebase). Much of the SDL code is compliant to these guidelines so please use this guidelines when going forth and making contributions in src/drivers/sdl.
Tabs
----
Hard tabs only! Please! src/drivers/sdl/* entirely consists of hard tabbed code. Please continue to use this convention. Consult the documentation of your text editor documentation for instructions on how to this with your editor.
Return Statements
-----------------
Please use the "return 0;" style return statements instead of the "return(0);" style return statements.

47
branches/sdl2/TODO-SDL Normal file
View File

@ -0,0 +1,47 @@
Priorities
==========
* SDL 2.0 RC is released - SDL2.0 compatibility is a goal
* Backwards-cpp still has an issue with clang++; look into this
* Users are reporting crashing issues with hotkey dialog (probably because its a mess!). A huge chunk of the hotkey code should be rewritten (GUI and hotkey structs - or lack there-of)
* GTK File menu quit element has "CTRL-Q" accelerator. This causes confusion with there being another SDL Hotkey for quit. This should be addressed.
* Quit was mapped to '0' to prevent users from accidently quitting. Perhaps a default quit combo could be used.
Features
========
* SDL.Vsync
* lets wait on this -- theres no simple way to use the OS default in SDL unless we just dont touch it, which might be the best thing to do here.
GTK
===
* Better on-the-fly video resizing with window resize / video config
* Smarter video config (disable widgets that are not used when openGL is enabled)
* Options to investigate:
* bpp
* scanlines
* GUI Cheat editor
SDL 2.0
=======
* segfaults when opening a second game
* segfaults on fullscreen entry
* has not been tested in a while
BUGS
====
* F1 from terminal-less gui fceux process hangs fceux (since input is required from console in cheat editor)
OS X
====
* Single window mode does not work (the XWINDOWID hack does not work in Apples X11 server, so this may never get fixed).
* It is possible to use GTK to build native OS X menus: http://developer.gnome.org/gtk3/3.4/GtkApplication.html . It would be awesome to do this and hide the main GTK window if the top bar is available
* Zapper input is taken from GTK window instead of X11 window (a workaround could be implemented to resolve with with some #ifdef APPLE etc)
* Not an "official" target, but testing should be done before release on OS X
* DMG Static binary download for Intel OS X
* Include needful libaries
* Adjust scons to produce static binary/libraries with an option
* http://www.scons.org/wiki/StaticallyLink
DOCS
====
* Be sure to include details about new scons features for package maintainers so that the manpage, luascripts, and auxlib will be included in future packages
* Docs REALLY need a cleanup/rewrite

17
branches/sdl2/attic/.gitignore vendored Normal file
View File

@ -0,0 +1,17 @@
# A simulation of Subversion default ignores, generated by reposurgeon.
*.o
*.lo
*.la
*.al
*.libs
*.so
*.so.[0-9]*
*.a
*.pyc
*.pyo
*.rej
*~
*.#*
.*.swp
.DS_store
# Simulated Subversion default ignores end here

12
branches/sdl2/attic/BUGS Normal file
View File

@ -0,0 +1,12 @@
BUILD SYSTEM BUGS:
Date - Person - Details
CLOSED * July 30, 2006 - Luke - I'm getting build errors about:
sh: illegal option -l
Started happening when the build system was edited to be more robust.
I'll check it out when i get the chance, or soules if you could take a look at it, that would be grand.
- July 31, 2006 - Luke - checked out to latest revision, all is well.

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1 @@
SUBDIRS = src

View File

@ -0,0 +1,147 @@
# Use this SConstruct if you are using scons < 1.x
# Just replace the SConstruct file with this one
# cp SConstruct.pre1.0 SConstruct
#
# or just updated scons already
import os
import sys
import platform
opts = Options()
opts.AddOptions(
BoolOption('FRAMESKIP', 'Enable frameskipping', 1),
BoolOption('OPENGL', 'Enable OpenGL support', 1),
BoolOption('LSB_FIRST', 'Least signficant byte first (non-PPC)', 1),
BoolOption('DEBUG', 'Build with debugging symbols', 1),
BoolOption('LUA', 'Enable Lua support', 1),
BoolOption('NEWPPU', 'Enable new PPU core', 1),
BoolOption('CREATE_AVI', 'Enable avi creation support (SDL only)', 0),
BoolOption('LOGO', 'Enable a logoscreen when creating avis (SDL only)', '1'),
BoolOption('GTK', 'Enable GTK2 GUI (SDL only)', 1),
BoolOption('GTK_LITE', 'Enable GTK2 for dialogs only', 0)
)
env = Environment(options = opts)
# LSB_FIRST must be off for PPC to compile
if platform.system == "ppc":
env['LSB_FIRST'] = 0
# Default compiler flags:
env.Append(CCFLAGS = ['-Wall', '-Wno-write-strings', '-Wno-sign-compare', '-O2', '-Isrc/lua/src'])
if os.environ.has_key('PLATFORM'):
env.Replace(PLATFORM = os.environ['PLATFORM'])
if os.environ.has_key('CC'):
env.Replace(CC = os.environ['CC'])
if os.environ.has_key('CXX'):
env.Replace(CXX = os.environ['CXX'])
if os.environ.has_key('WINDRES'):
env.Replace(WINDRES = os.environ['WINDRES'])
if os.environ.has_key('CFLAGS'):
env.Append(CCFLAGS = os.environ['CFLAGS'].split())
if os.environ.has_key('LDFLAGS'):
env.Append(LINKFLAGS = os.environ['LDFLAGS'].split())
print "platform: ", env['PLATFORM']
# special flags for cygwin
# we have to do this here so that the function and lib checks will go through mingw
if env['PLATFORM'] == 'cygwin':
env.Append(CCFLAGS = " -mno-cygwin")
env.Append(LINKFLAGS = " -mno-cygwin")
env['LIBS'] = ['wsock32'];
if env['PLATFORM'] == 'win32':
env.Append(CPPPATH = [".", "drivers/win/", "drivers/common/", "drivers/", "drivers/win/zlib", "drivers/win/directx", "drivers/win/lua/include"])
env.Append(CPPDEFINES = ["PSS_STYLE=2", "WIN32", "_USE_SHARED_MEMORY_", "NETWORK", "FCEUDEF_DEBUGGER", "NOMINMAX", "NEED_MINGW_HACKS", "_WIN32_IE=0x0600"])
env.Append(LIBS = ["rpcrt4", "comctl32", "vfw32", "winmm", "ws2_32", "comdlg32", "ole32", "gdi32", "htmlhelp"])
else:
conf = Configure(env)
if not conf.CheckLib('SDL'):
print 'Did not find libSDL or SDL.lib, exiting!'
Exit(1)
if not conf.CheckLib('z', autoadd=1):
print 'Did not find libz or z.lib, exiting!'
Exit(1)
if env['GTK'] or env['GTK_LITE']:
# Add compiler and linker flags from pkg-config
env.ParseConfig('pkg-config --cflags --libs gtk+-2.0')
env.Append(CPPDEFINES=["_GTK2"])
if env['GTK']:
env.Append(CCFLAGS = ["-D_GTK"])
env.Append(CCFLAGS =["-D_GTK_LITE"])
if env['GTK_LITE']:
env.Append(CCFLAGS =["-D_GTK_LITE"])
### Lua platform defines
### Applies to all files even though only lua needs it, but should be ok
if env['LUA']:
if env['PLATFORM'] == 'darwin':
# Define LUA_USE_MACOSX otherwise we can't bind external libs from lua
env.Append(CCFLAGS = ["-DLUA_USE_MACOSX"])
if env['PLATFORM'] == 'posix':
# If we're POSIX, we use LUA_USE_LINUX since that combines usual lua posix defines with dlfcn calls for dynamic library loading.
# Should work on any *nix
env.Append(CCFLAGS = ["-DLUA_USE_LINUX"])
### Search for gd if we're not in Windows
if env['PLATFORM'] != 'win32' and env['PLATFORM'] != 'cygwin' and env['CREATE_AVI'] and env['LOGO']:
gd = conf.CheckLib('gd', autoadd=1)
if gd == 0:
env['LOGO'] = 0
print 'Did not find libgd, you won\'t be able to create a logo screen for your avis.'
if conf.CheckFunc('asprintf'):
conf.env.Append(CCFLAGS = " -DHAVE_ASPRINTF")
if env['OPENGL'] and conf.CheckLibWithHeader('GL', 'GL/gl.h', 'c++', autoadd=1):
conf.env.Append(CCFLAGS = " -DOPENGL")
conf.env.Append(CPPDEFINES = ['PSS_STYLE=1'])
# parse SDL cflags/libs
env.ParseConfig('sdl-config --cflags --libs')
env.Append(CPPDEFINES=["_S9XLUA_H"])
env = conf.Finish()
if sys.byteorder == 'little' or env['PLATFORM'] == 'win32':
env.Append(CPPDEFINES = ['LSB_FIRST'])
if env['FRAMESKIP']:
env.Append(CPPDEFINES = ['FRAMESKIP'])
print "base CPPDEFINES:",env['CPPDEFINES']
print "base CCFLAGS:",env['CCFLAGS']
if env['DEBUG']:
env.Append(CPPDEFINES=["_DEBUG"], CCFLAGS = ['-g'])
if env['PLATFORM'] != 'win32' and env['PLATFORM'] != 'cygwin' and env['CREATE_AVI']:
env.Append(CPPDEFINES=["CREATE_AVI"])
else:
env['CREATE_AVI']=0;
Export('env')
SConscript('src/SConscript')
# Install rules
exe_suffix = ''
if env['PLATFORM'] == 'win32':
exe_suffix = '.exe'
fceux_src = 'src/fceux' + exe_suffix
fceux_dst = 'bin/fceux' + exe_suffix
auxlib_src = 'src/auxlib.lua'
auxlib_dst = 'bin/auxlib.lua'
fceux_h_src = 'src/drivers/win/help/fceux.chm'
fceux_h_dst = 'bin/fceux.chm'
env.Command(fceux_h_dst, fceux_h_src, [Copy(fceux_h_dst, fceux_h_src)])
env.Command(fceux_dst, fceux_src, [Copy(fceux_dst, fceux_src)])
env.Command(auxlib_dst, auxlib_src, [Copy(auxlib_dst, auxlib_src)])
# TODO: Fix this build script to gracefully install auxlib and the man page
#env.Alias(target="install", source=env.Install(dir="/usr/local/bin/", source=("bin/fceux", "bin/auxlib.lua")))
env.Alias(target="install", source=env.Install(dir="/usr/local/bin/", source="bin/fceux"))

View File

@ -0,0 +1,118 @@
BUGS
====
Save/Load State Console Print Bug
---------------------------------
* ie:
-select state-
State -777722344 saved
* If the root of the bug cannot be determined by release time, just #ifdef the print statement for win32
Clip sides bug in BOTH WINDOWED AND FULLSCREEN mode
---------------------------------------------------
* Go to game genie with clip sides enabled or save a state to see
* Ensure no clip sides is only being enabled during fullscreen
DONE! Gamepad dialog and others segfault on Ubuntu 10.04 (and older GTK versions)
---------------------------------------------------------------------------------
* Not planning on using legacy code here (especially with Ubuntu 12.04 on its way) but perhaps
a messagebox can be displayed recommending the user to upgrade their GTK version to prevent
the frustrating segfault. Segfaults need to be avoided like the plague.
* This is fixed in r2447. FceuX will print a warning to the console that the GTK version is old, and
provide instructions on how to configure the gamepad.
* Maybe we should also provide a GTK MessageBox with this info?
FEATURES
========
XDG Standardization of Config
-----------------------------
* fceux currently stores stuff to ~/.fceux by default
* FD.O/XDG recommends default to be ~/.config/fceux (and to check $XDG_whatever)
* If the XDG folder exists, use it. If NO folder exists, use the XDG folder.
* If .fceux exists, display a warning message but use .fceux
* Don't move around people's config files without asking (or at all in this case)
input.cpp
=========
* This code is a fscking mess! However, now is not the time to clean it. Perhaps set a goal to clean this file up for
2.1.7, but cleaning this for 2.1.6 is not realistic (and would break too many things and require more testing time)
DISTRO TESTING
==============
Summary
-------
* Out of box working distros:
* Arch Linux
* Ubuntu 10.04
* Ubuntu 12.04
* Works, but needs patching:
* Fedora Core 16
* Couldn't get working
* openSUSE
* Untested:
* Linux Mint
* Debian
Arch Linux 64 bit
-----------------
* Flawless installation from fceux-svn in [aur]. No issues other than the ones already noted.
* Dpendencies: sdl, gtk2, scons libz
Ubuntu 10.04
------------
* Compiles/builds without issue.
* Build deps: libsdl1.2-dev, scons, libgtk2.0-dev, zlib-dev, build-essentials
* No issues found in gameplay.
* DONE Some dialogs with segfault FCEUX due to an older version of GTK. Perhaps we can detect the old version of GTK and just prevent the dialog from being opened so the segfault doesnt occur? (bug added).
* DONE Wrote CheckGTKVersion(), which will be used like CheckGTKVersion(2, 24) to check the GTK version before segfaulting on dialogs
* DONE Implement a check for the dialogs that would bomb -- (a hook in init; makes all items under Options inacessible besides fullscreen if under 2.24)
Ubuntu 12.04 Beta
-----------------
* Compiles/builds without issue.
* GTK3 preferred for Unity
* Build deps: libsdl1.2-dev, scons, libgtk-3-dev, zlib-dev, build-essentials
* No issues AFAICS
Fedora Core 16
--------------
* Dependencies: subversion, scons, SDL-devel, gtk2-devel/gtk3-devel, gcc, [glib-devel?]
* You also need to install the "Development Tools" group:
yum groupinstall "Development Tools"
* scons bombs out (another missing dependency?
/usr/bin/ld: src/lua/src/loadlib.o: undefined reference to symbol 'dlclose@@GLIBC_2.2.5'
/usr/bin/ld: note: 'dlclose@@GLIBC_2.2.5' is defined in DSO /lib64/libdl.so.2 so try adding it to the linker command line
/lib64/libdl.so.2: could not read symbols: Invalid operation
collect2: ld returned 1 exit status
scons: *** [src/fceux] Error 1
scons: building terminated because of errors.
* This was fixed by forcing "-ldl" to the linker command line. This can be done by adding the following
to line 92 of the SConstruct:
env.Append(LINKFLAGS = ["-ldl"])
* TODO Answer some questions:
1. Is -ldl necessary everywhere?
2. Should we always use it? If not what can we test for for when to use it?
* Check the code circa line 92 in SConstruct for a Fedora resolution.
* Tested with GTK2, runs smoothly in VirtualBox.
openSUSE 12.1
-------------
* scons bombs out because can't find libgtk; I can't find gtk headers package
PROJECT STUFF
=============
* Contact debian package management about inclusion
* Create a sane release procedure script that generates a release ready tarball
* DONE - Create markdown file of README
* Locate important features/changes new to 2.1.6 and summarize them.

View File

@ -0,0 +1,357 @@
# Configure paths for SDL
# Sam Lantinga 9/21/99
# stolen from Manish Singh
# stolen back from Frank Belew
# stolen from Manish Singh
# Shamelessly stolen from Owen Taylor
dnl AM_PATH_SDL([MINIMUM-VERSION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]]])
dnl Test for SDL, and define SDL_CFLAGS and SDL_LIBS
dnl
AC_DEFUN(AM_PATH_SDL,
[dnl
dnl Get the cflags and libraries from the sdl-config script
dnl
AC_ARG_WITH(sdl-prefix,[ --with-sdl-prefix=PFX Prefix where SDL is installed (optional)],
sdl_prefix="$withval", sdl_prefix="")
AC_ARG_WITH(sdl-exec-prefix,[ --with-sdl-exec-prefix=PFX Exec prefix where SDL is installed (optional)],
sdl_exec_prefix="$withval", sdl_exec_prefix="")
AC_ARG_ENABLE(sdltest, [ --disable-sdltest Do not try to compile and run a test SDL program],
, enable_sdltest=yes)
if test x$sdl_exec_prefix != x ; then
sdl_args="$sdl_args --exec-prefix=$sdl_exec_prefix"
if test x${SDL_CONFIG+set} != xset ; then
SDL_CONFIG=$sdl_exec_prefix/bin/sdl-config
fi
fi
if test x$sdl_prefix != x ; then
sdl_args="$sdl_args --prefix=$sdl_prefix"
if test x${SDL_CONFIG+set} != xset ; then
SDL_CONFIG=$sdl_prefix/bin/sdl-config
fi
fi
AC_PATH_PROG(SDL_CONFIG, sdl-config, no)
min_sdl_version=ifelse([$1], ,0.11.0,$1)
AC_MSG_CHECKING(for SDL - version >= $min_sdl_version)
no_sdl=""
if test "$SDL_CONFIG" = "no" ; then
no_sdl=yes
else
SDL_CFLAGS=`$SDL_CONFIG $sdlconf_args --cflags`
SDL_LIBS=`$SDL_CONFIG $sdlconf_args --libs`
sdl_major_version=`$SDL_CONFIG $sdl_args --version | \
sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'`
sdl_minor_version=`$SDL_CONFIG $sdl_args --version | \
sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'`
sdl_micro_version=`$SDL_CONFIG $sdl_config_args --version | \
sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'`
if test "x$enable_sdltest" = "xyes" ; then
ac_save_CFLAGS="$CFLAGS"
ac_save_LIBS="$LIBS"
CFLAGS="$CFLAGS $SDL_CFLAGS"
LIBS="$LIBS $SDL_LIBS"
dnl
dnl Now check if the installed SDL is sufficiently new. (Also sanity
dnl checks the results of sdl-config to some extent
dnl
rm -f conf.sdltest
AC_TRY_RUN([
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <SDL.h>
char*
my_strdup (char *str)
{
char *new_str;
if (str)
{
new_str = (char *)malloc ((strlen (str) + 1) * sizeof(char));
strcpy (new_str, str);
}
else
new_str = NULL;
return new_str;
}
int main (int argc, char *argv[])
{
int major, minor, micro;
char *tmp_version;
/* This hangs on some systems (?)
system ("touch conf.sdltest");
*/
{ FILE *fp = fopen("conf.sdltest", "a"); if ( fp ) fclose(fp); }
/* HP/UX 9 (%@#!) writes to sscanf strings */
tmp_version = my_strdup("$min_sdl_version");
if (sscanf(tmp_version, "%d.%d.%d", &major, &minor, &micro) != 3) {
printf("%s, bad version string\n", "$min_sdl_version");
exit(1);
}
if (($sdl_major_version > major) ||
(($sdl_major_version == major) && ($sdl_minor_version > minor)) ||
(($sdl_major_version == major) && ($sdl_minor_version == minor) && ($sdl_micro_version >= micro)))
{
return 0;
}
else
{
printf("\n*** 'sdl-config --version' returned %d.%d.%d, but the minimum version\n", $sdl_major_version, $sdl_minor_version, $sdl_micro_version);
printf("*** of SDL required is %d.%d.%d. If sdl-config is correct, then it is\n", major, minor, micro);
printf("*** best to upgrade to the required version.\n");
printf("*** If sdl-config was wrong, set the environment variable SDL_CONFIG\n");
printf("*** to point to the correct copy of sdl-config, and remove the file\n");
printf("*** config.cache before re-running configure\n");
return 1;
}
}
],, no_sdl=yes,[echo $ac_n "cross compiling; assumed OK... $ac_c"])
CFLAGS="$ac_save_CFLAGS"
LIBS="$ac_save_LIBS"
fi
fi
if test "x$no_sdl" = x ; then
AC_MSG_RESULT(yes)
ifelse([$2], , :, [$2])
else
AC_MSG_RESULT(no)
if test "$SDL_CONFIG" = "no" ; then
echo "*** The sdl-config script installed by SDL could not be found"
echo "*** If SDL was installed in PREFIX, make sure PREFIX/bin is in"
echo "*** your path, or set the SDL_CONFIG environment variable to the"
echo "*** full path to sdl-config."
else
if test -f conf.sdltest ; then
:
else
echo "*** Could not run SDL test program, checking why..."
CFLAGS="$CFLAGS $SDL_CFLAGS"
LIBS="$LIBS $SDL_LIBS"
AC_TRY_LINK([
#include <stdio.h>
#include <SDL.h>
], [ return 0; ],
[ echo "*** The test program compiled, but did not run. This usually means"
echo "*** that the run-time linker is not finding SDL or finding the wrong"
echo "*** version of SDL. If it is not finding SDL, you'll need to set your"
echo "*** LD_LIBRARY_PATH environment variable, or edit /etc/ld.so.conf to point"
echo "*** to the installed location Also, make sure you have run ldconfig if that"
echo "*** is required on your system"
echo "***"
echo "*** If you have an old version installed, it is best to remove it, although"
echo "*** you may also be able to get things to work by modifying LD_LIBRARY_PATH"],
[ echo "*** The test program failed to compile or link. See the file config.log for the"
echo "*** exact error that occured. This usually means SDL was incorrectly installed"
echo "*** or that you have moved SDL since it was installed. In the latter case, you"
echo "*** may want to edit the sdl-config script: $SDL_CONFIG" ])
CFLAGS="$ac_save_CFLAGS"
LIBS="$ac_save_LIBS"
fi
fi
SDL_CFLAGS=""
SDL_LIBS=""
ifelse([$3], , :, [$3])
fi
AC_SUBST(SDL_CFLAGS)
AC_SUBST(SDL_LIBS)
rm -f conf.sdltest
])
/* Steven G. Johnson <stevenj@alum.mit.edu> and Alejandro Forero Cuervo <bachue@bachue.com> */
AC_DEFUN([ACX_PTHREAD], [
AC_REQUIRE([AC_CANONICAL_HOST])
AC_LANG_SAVE
AC_LANG_C
acx_pthread_ok=no
# We used to check for pthread.h first, but this fails if pthread.h
# requires special compiler flags (e.g. on True64 or Sequent).
# It gets checked for in the link test anyway.
# First of all, check if the user has set any of the PTHREAD_LIBS,
# etcetera environment variables, and if threads linking works using
# them:
if test x"$PTHREAD_LIBS$PTHREAD_CFLAGS" != x; then
save_CFLAGS="$CFLAGS"
CFLAGS="$CFLAGS $PTHREAD_CFLAGS"
save_LIBS="$LIBS"
LIBS="$PTHREAD_LIBS $LIBS"
AC_MSG_CHECKING([for pthread_join in LIBS=$PTHREAD_LIBS with CFLAGS=$PTHREAD_CFLAGS])
AC_TRY_LINK_FUNC(pthread_join, acx_pthread_ok=yes)
AC_MSG_RESULT($acx_pthread_ok)
if test x"$acx_pthread_ok" = xno; then
PTHREAD_LIBS=""
PTHREAD_CFLAGS=""
fi
LIBS="$save_LIBS"
CFLAGS="$save_CFLAGS"
fi
# We must check for the threads library under a number of different
# names; the ordering is very important because some systems
# (e.g. DEC) have both -lpthread and -lpthreads, where one of the
# libraries is broken (non-POSIX).
# Create a list of thread flags to try. Items starting with a "-" are
# C compiler flags, and other items are library names, except for "none"
# which indicates that we try without any flags at all.
acx_pthread_flags="pthreads none -Kthread -kthread lthread -pthread -pthreads -mthreads pthread --thread-safe -mt"
# The ordering *is* (sometimes) important. Some notes on the
# individual items follow:
# pthreads: AIX (must check this before -lpthread)
# none: in case threads are in libc; should be tried before -Kthread and
# other compiler flags to prevent continual compiler warnings
# -Kthread: Sequent (threads in libc, but -Kthread needed for pthread.h)
# -kthread: FreeBSD kernel threads (preferred to -pthread since SMP-able)
# lthread: LinuxThreads port on FreeBSD (also preferred to -pthread)
# -pthread: Linux/gcc (kernel threads), BSD/gcc (userland threads)
# -pthreads: Solaris/gcc
# -mthreads: Mingw32/gcc, Lynx/gcc
# -mt: Sun Workshop C (may only link SunOS threads [-lthread], but it
# doesn't hurt to check since this sometimes defines pthreads too;
# also defines -D_REENTRANT)
# pthread: Linux, etcetera
# --thread-safe: KAI C++
case "${host_cpu}-${host_os}" in
*solaris*)
# On Solaris (at least, for some versions), libc contains stubbed
# (non-functional) versions of the pthreads routines, so link-based
# tests will erroneously succeed. (We need to link with -pthread or
# -lpthread.) (The stubs are missing pthread_cleanup_push, or rather
# a function called by this macro, so we could check for that, but
# who knows whether they'll stub that too in a future libc.) So,
# we'll just look for -pthreads and -lpthread first:
acx_pthread_flags="-pthread -pthreads pthread -mt $acx_pthread_flags"
;;
esac
if test x"$acx_pthread_ok" = xno; then
for flag in $acx_pthread_flags; do
case $flag in
none)
AC_MSG_CHECKING([whether pthreads work without any flags])
;;
-*)
AC_MSG_CHECKING([whether pthreads work with $flag])
PTHREAD_CFLAGS="$flag"
;;
*)
AC_MSG_CHECKING([for the pthreads library -l$flag])
PTHREAD_LIBS="-l$flag"
;;
esac
save_LIBS="$LIBS"
save_CFLAGS="$CFLAGS"
LIBS="$PTHREAD_LIBS $LIBS"
CFLAGS="$CFLAGS $PTHREAD_CFLAGS"
# Check for various functions. We must include pthread.h,
# since some functions may be macros. (On the Sequent, we
# need a special flag -Kthread to make this header compile.)
# We check for pthread_join because it is in -lpthread on IRIX
# while pthread_create is in libc. We check for pthread_attr_init
# due to DEC craziness with -lpthreads. We check for
# pthread_cleanup_push because it is one of the few pthread
# functions on Solaris that doesn't have a non-functional libc stub.
# We try pthread_create on general principles.
AC_TRY_LINK([#include <pthread.h>],
[pthread_t th; pthread_join(th, 0);
pthread_attr_init(0); pthread_cleanup_push(0, 0);
pthread_create(0,0,0,0); pthread_cleanup_pop(0); ],
[acx_pthread_ok=yes])
LIBS="$save_LIBS"
CFLAGS="$save_CFLAGS"
AC_MSG_RESULT($acx_pthread_ok)
if test "x$acx_pthread_ok" = xyes; then
break;
fi
PTHREAD_LIBS=""
PTHREAD_CFLAGS=""
done
fi
# Various other checks:
if test "x$acx_pthread_ok" = xyes; then
save_LIBS="$LIBS"
LIBS="$PTHREAD_LIBS $LIBS"
save_CFLAGS="$CFLAGS"
CFLAGS="$CFLAGS $PTHREAD_CFLAGS"
# Detect AIX lossage: threads are created detached by default
# and the JOINABLE attribute has a nonstandard name (UNDETACHED).
AC_MSG_CHECKING([for joinable pthread attribute])
AC_TRY_LINK([#include <pthread.h>],
[int attr=PTHREAD_CREATE_JOINABLE;],
ok=PTHREAD_CREATE_JOINABLE, ok=unknown)
if test x"$ok" = xunknown; then
AC_TRY_LINK([#include <pthread.h>],
[int attr=PTHREAD_CREATE_UNDETACHED;],
ok=PTHREAD_CREATE_UNDETACHED, ok=unknown)
fi
if test x"$ok" != xPTHREAD_CREATE_JOINABLE; then
AC_DEFINE(PTHREAD_CREATE_JOINABLE, $ok,
[Define to the necessary symbol if this constant
uses a non-standard name on your system.])
fi
AC_MSG_RESULT(${ok})
if test x"$ok" = xunknown; then
AC_MSG_WARN([we do not know how to create joinable pthreads])
fi
AC_MSG_CHECKING([if more special flags are required for pthreads])
flag=no
case "${host_cpu}-${host_os}" in
*-aix* | *-freebsd*) flag="-D_THREAD_SAFE";;
*solaris* | *-osf* | *-hpux*) flag="-D_REENTRANT";;
esac
AC_MSG_RESULT(${flag})
if test "x$flag" != xno; then
PTHREAD_CFLAGS="$flag $PTHREAD_CFLAGS"
fi
LIBS="$save_LIBS"
CFLAGS="$save_CFLAGS"
# More AIX lossage: must compile with cc_r
AC_CHECK_PROG(PTHREAD_CC, cc_r, cc_r, ${CC})
else
PTHREAD_CC="$CC"
fi
AC_SUBST(PTHREAD_LIBS)
AC_SUBST(PTHREAD_CFLAGS)
AC_SUBST(PTHREAD_CC)
# Finally, execute ACTION-IF-FOUND/ACTION-IF-NOT-FOUND:
if test x"$acx_pthread_ok" = xyes; then
ifelse([$1],,AC_DEFINE(HAVE_PTHREAD,1,[Define if you have POSIX threads libraries and header files.]),[$1])
:
else
acx_pthread_ok=no
$2
fi
AC_LANG_RESTORE
])dnl ACX_PTHREAD

879
branches/sdl2/attic/aclocal.m4 vendored Normal file
View File

@ -0,0 +1,879 @@
# generated automatically by aclocal 1.9.5 -*- Autoconf -*-
# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
# 2005 Free Software Foundation, Inc.
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
# PARTICULAR PURPOSE.
# Copyright (C) 2002, 2003, 2005 Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
# AM_AUTOMAKE_VERSION(VERSION)
# ----------------------------
# Automake X.Y traces this macro to ensure aclocal.m4 has been
# generated from the m4 files accompanying Automake X.Y.
AC_DEFUN([AM_AUTOMAKE_VERSION], [am__api_version="1.9"])
# AM_SET_CURRENT_AUTOMAKE_VERSION
# -------------------------------
# Call AM_AUTOMAKE_VERSION so it can be traced.
# This function is AC_REQUIREd by AC_INIT_AUTOMAKE.
AC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION],
[AM_AUTOMAKE_VERSION([1.9.5])])
# AM_AUX_DIR_EXPAND -*- Autoconf -*-
# Copyright (C) 2001, 2003, 2005 Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
# For projects using AC_CONFIG_AUX_DIR([foo]), Autoconf sets
# $ac_aux_dir to `$srcdir/foo'. In other projects, it is set to
# `$srcdir', `$srcdir/..', or `$srcdir/../..'.
#
# Of course, Automake must honor this variable whenever it calls a
# tool from the auxiliary directory. The problem is that $srcdir (and
# therefore $ac_aux_dir as well) can be either absolute or relative,
# depending on how configure is run. This is pretty annoying, since
# it makes $ac_aux_dir quite unusable in subdirectories: in the top
# source directory, any form will work fine, but in subdirectories a
# relative path needs to be adjusted first.
#
# $ac_aux_dir/missing
# fails when called from a subdirectory if $ac_aux_dir is relative
# $top_srcdir/$ac_aux_dir/missing
# fails if $ac_aux_dir is absolute,
# fails when called from a subdirectory in a VPATH build with
# a relative $ac_aux_dir
#
# The reason of the latter failure is that $top_srcdir and $ac_aux_dir
# are both prefixed by $srcdir. In an in-source build this is usually
# harmless because $srcdir is `.', but things will broke when you
# start a VPATH build or use an absolute $srcdir.
#
# So we could use something similar to $top_srcdir/$ac_aux_dir/missing,
# iff we strip the leading $srcdir from $ac_aux_dir. That would be:
# am_aux_dir='\$(top_srcdir)/'`expr "$ac_aux_dir" : "$srcdir//*\(.*\)"`
# and then we would define $MISSING as
# MISSING="\${SHELL} $am_aux_dir/missing"
# This will work as long as MISSING is not called from configure, because
# unfortunately $(top_srcdir) has no meaning in configure.
# However there are other variables, like CC, which are often used in
# configure, and could therefore not use this "fixed" $ac_aux_dir.
#
# Another solution, used here, is to always expand $ac_aux_dir to an
# absolute PATH. The drawback is that using absolute paths prevent a
# configured tree to be moved without reconfiguration.
AC_DEFUN([AM_AUX_DIR_EXPAND],
[dnl Rely on autoconf to set up CDPATH properly.
AC_PREREQ([2.50])dnl
# expand $ac_aux_dir to an absolute path
am_aux_dir=`cd $ac_aux_dir && pwd`
])
# AM_CONDITIONAL -*- Autoconf -*-
# Copyright (C) 1997, 2000, 2001, 2003, 2004, 2005
# Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
# serial 7
# AM_CONDITIONAL(NAME, SHELL-CONDITION)
# -------------------------------------
# Define a conditional.
AC_DEFUN([AM_CONDITIONAL],
[AC_PREREQ(2.52)dnl
ifelse([$1], [TRUE], [AC_FATAL([$0: invalid condition: $1])],
[$1], [FALSE], [AC_FATAL([$0: invalid condition: $1])])dnl
AC_SUBST([$1_TRUE])
AC_SUBST([$1_FALSE])
if $2; then
$1_TRUE=
$1_FALSE='#'
else
$1_TRUE='#'
$1_FALSE=
fi
AC_CONFIG_COMMANDS_PRE(
[if test -z "${$1_TRUE}" && test -z "${$1_FALSE}"; then
AC_MSG_ERROR([[conditional "$1" was never defined.
Usually this means the macro was only invoked conditionally.]])
fi])])
# Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005
# Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
# serial 8
# There are a few dirty hacks below to avoid letting `AC_PROG_CC' be
# written in clear, in which case automake, when reading aclocal.m4,
# will think it sees a *use*, and therefore will trigger all it's
# C support machinery. Also note that it means that autoscan, seeing
# CC etc. in the Makefile, will ask for an AC_PROG_CC use...
# _AM_DEPENDENCIES(NAME)
# ----------------------
# See how the compiler implements dependency checking.
# NAME is "CC", "CXX", "GCJ", or "OBJC".
# We try a few techniques and use that to set a single cache variable.
#
# We don't AC_REQUIRE the corresponding AC_PROG_CC since the latter was
# modified to invoke _AM_DEPENDENCIES(CC); we would have a circular
# dependency, and given that the user is not expected to run this macro,
# just rely on AC_PROG_CC.
AC_DEFUN([_AM_DEPENDENCIES],
[AC_REQUIRE([AM_SET_DEPDIR])dnl
AC_REQUIRE([AM_OUTPUT_DEPENDENCY_COMMANDS])dnl
AC_REQUIRE([AM_MAKE_INCLUDE])dnl
AC_REQUIRE([AM_DEP_TRACK])dnl
ifelse([$1], CC, [depcc="$CC" am_compiler_list=],
[$1], CXX, [depcc="$CXX" am_compiler_list=],
[$1], OBJC, [depcc="$OBJC" am_compiler_list='gcc3 gcc'],
[$1], GCJ, [depcc="$GCJ" am_compiler_list='gcc3 gcc'],
[depcc="$$1" am_compiler_list=])
AC_CACHE_CHECK([dependency style of $depcc],
[am_cv_$1_dependencies_compiler_type],
[if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then
# We make a subdir and do the tests there. Otherwise we can end up
# making bogus files that we don't know about and never remove. For
# instance it was reported that on HP-UX the gcc test will end up
# making a dummy file named `D' -- because `-MD' means `put the output
# in D'.
mkdir conftest.dir
# Copy depcomp to subdir because otherwise we won't find it if we're
# using a relative directory.
cp "$am_depcomp" conftest.dir
cd conftest.dir
# We will build objects and dependencies in a subdirectory because
# it helps to detect inapplicable dependency modes. For instance
# both Tru64's cc and ICC support -MD to output dependencies as a
# side effect of compilation, but ICC will put the dependencies in
# the current directory while Tru64 will put them in the object
# directory.
mkdir sub
am_cv_$1_dependencies_compiler_type=none
if test "$am_compiler_list" = ""; then
am_compiler_list=`sed -n ['s/^#*\([a-zA-Z0-9]*\))$/\1/p'] < ./depcomp`
fi
for depmode in $am_compiler_list; do
# Setup a source with many dependencies, because some compilers
# like to wrap large dependency lists on column 80 (with \), and
# we should not choose a depcomp mode which is confused by this.
#
# We need to recreate these files for each test, as the compiler may
# overwrite some of them when testing with obscure command lines.
# This happens at least with the AIX C compiler.
: > sub/conftest.c
for i in 1 2 3 4 5 6; do
echo '#include "conftst'$i'.h"' >> sub/conftest.c
# Using `: > sub/conftst$i.h' creates only sub/conftst1.h with
# Solaris 8's {/usr,}/bin/sh.
touch sub/conftst$i.h
done
echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf
case $depmode in
nosideeffect)
# after this tag, mechanisms are not by side-effect, so they'll
# only be used when explicitly requested
if test "x$enable_dependency_tracking" = xyes; then
continue
else
break
fi
;;
none) break ;;
esac
# We check with `-c' and `-o' for the sake of the "dashmstdout"
# mode. It turns out that the SunPro C++ compiler does not properly
# handle `-M -o', and we need to detect this.
if depmode=$depmode \
source=sub/conftest.c object=sub/conftest.${OBJEXT-o} \
depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \
$SHELL ./depcomp $depcc -c -o sub/conftest.${OBJEXT-o} sub/conftest.c \
>/dev/null 2>conftest.err &&
grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 &&
grep sub/conftest.${OBJEXT-o} sub/conftest.Po > /dev/null 2>&1 &&
${MAKE-make} -s -f confmf > /dev/null 2>&1; then
# icc doesn't choke on unknown options, it will just issue warnings
# or remarks (even with -Werror). So we grep stderr for any message
# that says an option was ignored or not supported.
# When given -MP, icc 7.0 and 7.1 complain thusly:
# icc: Command line warning: ignoring option '-M'; no argument required
# The diagnosis changed in icc 8.0:
# icc: Command line remark: option '-MP' not supported
if (grep 'ignoring option' conftest.err ||
grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else
am_cv_$1_dependencies_compiler_type=$depmode
break
fi
fi
done
cd ..
rm -rf conftest.dir
else
am_cv_$1_dependencies_compiler_type=none
fi
])
AC_SUBST([$1DEPMODE], [depmode=$am_cv_$1_dependencies_compiler_type])
AM_CONDITIONAL([am__fastdep$1], [
test "x$enable_dependency_tracking" != xno \
&& test "$am_cv_$1_dependencies_compiler_type" = gcc3])
])
# AM_SET_DEPDIR
# -------------
# Choose a directory name for dependency files.
# This macro is AC_REQUIREd in _AM_DEPENDENCIES
AC_DEFUN([AM_SET_DEPDIR],
[AC_REQUIRE([AM_SET_LEADING_DOT])dnl
AC_SUBST([DEPDIR], ["${am__leading_dot}deps"])dnl
])
# AM_DEP_TRACK
# ------------
AC_DEFUN([AM_DEP_TRACK],
[AC_ARG_ENABLE(dependency-tracking,
[ --disable-dependency-tracking speeds up one-time build
--enable-dependency-tracking do not reject slow dependency extractors])
if test "x$enable_dependency_tracking" != xno; then
am_depcomp="$ac_aux_dir/depcomp"
AMDEPBACKSLASH='\'
fi
AM_CONDITIONAL([AMDEP], [test "x$enable_dependency_tracking" != xno])
AC_SUBST([AMDEPBACKSLASH])
])
# Generate code to set up dependency tracking. -*- Autoconf -*-
# Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005
# Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
#serial 3
# _AM_OUTPUT_DEPENDENCY_COMMANDS
# ------------------------------
AC_DEFUN([_AM_OUTPUT_DEPENDENCY_COMMANDS],
[for mf in $CONFIG_FILES; do
# Strip MF so we end up with the name of the file.
mf=`echo "$mf" | sed -e 's/:.*$//'`
# Check whether this is an Automake generated Makefile or not.
# We used to match only the files named `Makefile.in', but
# some people rename them; so instead we look at the file content.
# Grep'ing the first line is not enough: some people post-process
# each Makefile.in and add a new line on top of each file to say so.
# So let's grep whole file.
if grep '^#.*generated by automake' $mf > /dev/null 2>&1; then
dirpart=`AS_DIRNAME("$mf")`
else
continue
fi
# Extract the definition of DEPDIR, am__include, and am__quote
# from the Makefile without running `make'.
DEPDIR=`sed -n 's/^DEPDIR = //p' < "$mf"`
test -z "$DEPDIR" && continue
am__include=`sed -n 's/^am__include = //p' < "$mf"`
test -z "am__include" && continue
am__quote=`sed -n 's/^am__quote = //p' < "$mf"`
# When using ansi2knr, U may be empty or an underscore; expand it
U=`sed -n 's/^U = //p' < "$mf"`
# Find all dependency output files, they are included files with
# $(DEPDIR) in their names. We invoke sed twice because it is the
# simplest approach to changing $(DEPDIR) to its actual value in the
# expansion.
for file in `sed -n "
s/^$am__include $am__quote\(.*(DEPDIR).*\)$am__quote"'$/\1/p' <"$mf" | \
sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g' -e 's/\$U/'"$U"'/g'`; do
# Make sure the directory exists.
test -f "$dirpart/$file" && continue
fdir=`AS_DIRNAME(["$file"])`
AS_MKDIR_P([$dirpart/$fdir])
# echo "creating $dirpart/$file"
echo '# dummy' > "$dirpart/$file"
done
done
])# _AM_OUTPUT_DEPENDENCY_COMMANDS
# AM_OUTPUT_DEPENDENCY_COMMANDS
# -----------------------------
# This macro should only be invoked once -- use via AC_REQUIRE.
#
# This code is only required when automatic dependency tracking
# is enabled. FIXME. This creates each `.P' file that we will
# need in order to bootstrap the dependency handling code.
AC_DEFUN([AM_OUTPUT_DEPENDENCY_COMMANDS],
[AC_CONFIG_COMMANDS([depfiles],
[test x"$AMDEP_TRUE" != x"" || _AM_OUTPUT_DEPENDENCY_COMMANDS],
[AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir"])
])
# Do all the work for Automake. -*- Autoconf -*-
# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005
# Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
# serial 12
# This macro actually does too much. Some checks are only needed if
# your package does certain things. But this isn't really a big deal.
# AM_INIT_AUTOMAKE(PACKAGE, VERSION, [NO-DEFINE])
# AM_INIT_AUTOMAKE([OPTIONS])
# -----------------------------------------------
# The call with PACKAGE and VERSION arguments is the old style
# call (pre autoconf-2.50), which is being phased out. PACKAGE
# and VERSION should now be passed to AC_INIT and removed from
# the call to AM_INIT_AUTOMAKE.
# We support both call styles for the transition. After
# the next Automake release, Autoconf can make the AC_INIT
# arguments mandatory, and then we can depend on a new Autoconf
# release and drop the old call support.
AC_DEFUN([AM_INIT_AUTOMAKE],
[AC_PREREQ([2.58])dnl
dnl Autoconf wants to disallow AM_ names. We explicitly allow
dnl the ones we care about.
m4_pattern_allow([^AM_[A-Z]+FLAGS$])dnl
AC_REQUIRE([AM_SET_CURRENT_AUTOMAKE_VERSION])dnl
AC_REQUIRE([AC_PROG_INSTALL])dnl
# test to see if srcdir already configured
if test "`cd $srcdir && pwd`" != "`pwd`" &&
test -f $srcdir/config.status; then
AC_MSG_ERROR([source directory already configured; run "make distclean" there first])
fi
# test whether we have cygpath
if test -z "$CYGPATH_W"; then
if (cygpath --version) >/dev/null 2>/dev/null; then
CYGPATH_W='cygpath -w'
else
CYGPATH_W=echo
fi
fi
AC_SUBST([CYGPATH_W])
# Define the identity of the package.
dnl Distinguish between old-style and new-style calls.
m4_ifval([$2],
[m4_ifval([$3], [_AM_SET_OPTION([no-define])])dnl
AC_SUBST([PACKAGE], [$1])dnl
AC_SUBST([VERSION], [$2])],
[_AM_SET_OPTIONS([$1])dnl
AC_SUBST([PACKAGE], ['AC_PACKAGE_TARNAME'])dnl
AC_SUBST([VERSION], ['AC_PACKAGE_VERSION'])])dnl
_AM_IF_OPTION([no-define],,
[AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE", [Name of package])
AC_DEFINE_UNQUOTED(VERSION, "$VERSION", [Version number of package])])dnl
# Some tools Automake needs.
AC_REQUIRE([AM_SANITY_CHECK])dnl
AC_REQUIRE([AC_ARG_PROGRAM])dnl
AM_MISSING_PROG(ACLOCAL, aclocal-${am__api_version})
AM_MISSING_PROG(AUTOCONF, autoconf)
AM_MISSING_PROG(AUTOMAKE, automake-${am__api_version})
AM_MISSING_PROG(AUTOHEADER, autoheader)
AM_MISSING_PROG(MAKEINFO, makeinfo)
AM_PROG_INSTALL_SH
AM_PROG_INSTALL_STRIP
AC_REQUIRE([AM_PROG_MKDIR_P])dnl
# We need awk for the "check" target. The system "awk" is bad on
# some platforms.
AC_REQUIRE([AC_PROG_AWK])dnl
AC_REQUIRE([AC_PROG_MAKE_SET])dnl
AC_REQUIRE([AM_SET_LEADING_DOT])dnl
_AM_IF_OPTION([tar-ustar], [_AM_PROG_TAR([ustar])],
[_AM_IF_OPTION([tar-pax], [_AM_PROG_TAR([pax])],
[_AM_PROG_TAR([v7])])])
_AM_IF_OPTION([no-dependencies],,
[AC_PROVIDE_IFELSE([AC_PROG_CC],
[_AM_DEPENDENCIES(CC)],
[define([AC_PROG_CC],
defn([AC_PROG_CC])[_AM_DEPENDENCIES(CC)])])dnl
AC_PROVIDE_IFELSE([AC_PROG_CXX],
[_AM_DEPENDENCIES(CXX)],
[define([AC_PROG_CXX],
defn([AC_PROG_CXX])[_AM_DEPENDENCIES(CXX)])])dnl
])
])
# When config.status generates a header, we must update the stamp-h file.
# This file resides in the same directory as the config header
# that is generated. The stamp files are numbered to have different names.
# Autoconf calls _AC_AM_CONFIG_HEADER_HOOK (when defined) in the
# loop where config.status creates the headers, so we can generate
# our stamp files there.
AC_DEFUN([_AC_AM_CONFIG_HEADER_HOOK],
[# Compute $1's index in $config_headers.
_am_stamp_count=1
for _am_header in $config_headers :; do
case $_am_header in
$1 | $1:* )
break ;;
* )
_am_stamp_count=`expr $_am_stamp_count + 1` ;;
esac
done
echo "timestamp for $1" >`AS_DIRNAME([$1])`/stamp-h[]$_am_stamp_count])
# Copyright (C) 2001, 2003, 2005 Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
# AM_PROG_INSTALL_SH
# ------------------
# Define $install_sh.
AC_DEFUN([AM_PROG_INSTALL_SH],
[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
install_sh=${install_sh-"$am_aux_dir/install-sh"}
AC_SUBST(install_sh)])
# Copyright (C) 2003, 2005 Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
# serial 2
# Check whether the underlying file-system supports filenames
# with a leading dot. For instance MS-DOS doesn't.
AC_DEFUN([AM_SET_LEADING_DOT],
[rm -rf .tst 2>/dev/null
mkdir .tst 2>/dev/null
if test -d .tst; then
am__leading_dot=.
else
am__leading_dot=_
fi
rmdir .tst 2>/dev/null
AC_SUBST([am__leading_dot])])
# Check to see how 'make' treats includes. -*- Autoconf -*-
# Copyright (C) 2001, 2002, 2003, 2005 Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
# serial 3
# AM_MAKE_INCLUDE()
# -----------------
# Check to see how make treats includes.
AC_DEFUN([AM_MAKE_INCLUDE],
[am_make=${MAKE-make}
cat > confinc << 'END'
am__doit:
@echo done
.PHONY: am__doit
END
# If we don't find an include directive, just comment out the code.
AC_MSG_CHECKING([for style of include used by $am_make])
am__include="#"
am__quote=
_am_result=none
# First try GNU make style include.
echo "include confinc" > confmf
# We grep out `Entering directory' and `Leaving directory'
# messages which can occur if `w' ends up in MAKEFLAGS.
# In particular we don't look at `^make:' because GNU make might
# be invoked under some other name (usually "gmake"), in which
# case it prints its new name instead of `make'.
if test "`$am_make -s -f confmf 2> /dev/null | grep -v 'ing directory'`" = "done"; then
am__include=include
am__quote=
_am_result=GNU
fi
# Now try BSD make style include.
if test "$am__include" = "#"; then
echo '.include "confinc"' > confmf
if test "`$am_make -s -f confmf 2> /dev/null`" = "done"; then
am__include=.include
am__quote="\""
_am_result=BSD
fi
fi
AC_SUBST([am__include])
AC_SUBST([am__quote])
AC_MSG_RESULT([$_am_result])
rm -f confinc confmf
])
# Copyright (C) 1999, 2000, 2001, 2003, 2005 Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
# serial 3
# AM_PROG_CC_C_O
# --------------
# Like AC_PROG_CC_C_O, but changed for automake.
AC_DEFUN([AM_PROG_CC_C_O],
[AC_REQUIRE([AC_PROG_CC_C_O])dnl
AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
# FIXME: we rely on the cache variable name because
# there is no other way.
set dummy $CC
ac_cc=`echo $[2] | sed ['s/[^a-zA-Z0-9_]/_/g;s/^[0-9]/_/']`
if eval "test \"`echo '$ac_cv_prog_cc_'${ac_cc}_c_o`\" != yes"; then
# Losing compiler, so override with the script.
# FIXME: It is wrong to rewrite CC.
# But if we don't then we get into trouble of one sort or another.
# A longer-term fix would be to have automake use am__CC in this case,
# and then we could set am__CC="\$(top_srcdir)/compile \$(CC)"
CC="$am_aux_dir/compile $CC"
fi
])
# Fake the existence of programs that GNU maintainers use. -*- Autoconf -*-
# Copyright (C) 1997, 1999, 2000, 2001, 2003, 2005
# Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
# serial 4
# AM_MISSING_PROG(NAME, PROGRAM)
# ------------------------------
AC_DEFUN([AM_MISSING_PROG],
[AC_REQUIRE([AM_MISSING_HAS_RUN])
$1=${$1-"${am_missing_run}$2"}
AC_SUBST($1)])
# AM_MISSING_HAS_RUN
# ------------------
# Define MISSING if not defined so far and test if it supports --run.
# If it does, set am_missing_run to use it, otherwise, to nothing.
AC_DEFUN([AM_MISSING_HAS_RUN],
[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
test x"${MISSING+set}" = xset || MISSING="\${SHELL} $am_aux_dir/missing"
# Use eval to expand $SHELL
if eval "$MISSING --run true"; then
am_missing_run="$MISSING --run "
else
am_missing_run=
AC_MSG_WARN([`missing' script is too old or missing])
fi
])
# Copyright (C) 2003, 2004, 2005 Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
# AM_PROG_MKDIR_P
# ---------------
# Check whether `mkdir -p' is supported, fallback to mkinstalldirs otherwise.
#
# Automake 1.8 used `mkdir -m 0755 -p --' to ensure that directories
# created by `make install' are always world readable, even if the
# installer happens to have an overly restrictive umask (e.g. 077).
# This was a mistake. There are at least two reasons why we must not
# use `-m 0755':
# - it causes special bits like SGID to be ignored,
# - it may be too restrictive (some setups expect 775 directories).
#
# Do not use -m 0755 and let people choose whatever they expect by
# setting umask.
#
# We cannot accept any implementation of `mkdir' that recognizes `-p'.
# Some implementations (such as Solaris 8's) are not thread-safe: if a
# parallel make tries to run `mkdir -p a/b' and `mkdir -p a/c'
# concurrently, both version can detect that a/ is missing, but only
# one can create it and the other will error out. Consequently we
# restrict ourselves to GNU make (using the --version option ensures
# this.)
AC_DEFUN([AM_PROG_MKDIR_P],
[if mkdir -p --version . >/dev/null 2>&1 && test ! -d ./--version; then
# We used to keeping the `.' as first argument, in order to
# allow $(mkdir_p) to be used without argument. As in
# $(mkdir_p) $(somedir)
# where $(somedir) is conditionally defined. However this is wrong
# for two reasons:
# 1. if the package is installed by a user who cannot write `.'
# make install will fail,
# 2. the above comment should most certainly read
# $(mkdir_p) $(DESTDIR)$(somedir)
# so it does not work when $(somedir) is undefined and
# $(DESTDIR) is not.
# To support the latter case, we have to write
# test -z "$(somedir)" || $(mkdir_p) $(DESTDIR)$(somedir),
# so the `.' trick is pointless.
mkdir_p='mkdir -p --'
else
# On NextStep and OpenStep, the `mkdir' command does not
# recognize any option. It will interpret all options as
# directories to create, and then abort because `.' already
# exists.
for d in ./-p ./--version;
do
test -d $d && rmdir $d
done
# $(mkinstalldirs) is defined by Automake if mkinstalldirs exists.
if test -f "$ac_aux_dir/mkinstalldirs"; then
mkdir_p='$(mkinstalldirs)'
else
mkdir_p='$(install_sh) -d'
fi
fi
AC_SUBST([mkdir_p])])
# Helper functions for option handling. -*- Autoconf -*-
# Copyright (C) 2001, 2002, 2003, 2005 Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
# serial 3
# _AM_MANGLE_OPTION(NAME)
# -----------------------
AC_DEFUN([_AM_MANGLE_OPTION],
[[_AM_OPTION_]m4_bpatsubst($1, [[^a-zA-Z0-9_]], [_])])
# _AM_SET_OPTION(NAME)
# ------------------------------
# Set option NAME. Presently that only means defining a flag for this option.
AC_DEFUN([_AM_SET_OPTION],
[m4_define(_AM_MANGLE_OPTION([$1]), 1)])
# _AM_SET_OPTIONS(OPTIONS)
# ----------------------------------
# OPTIONS is a space-separated list of Automake options.
AC_DEFUN([_AM_SET_OPTIONS],
[AC_FOREACH([_AM_Option], [$1], [_AM_SET_OPTION(_AM_Option)])])
# _AM_IF_OPTION(OPTION, IF-SET, [IF-NOT-SET])
# -------------------------------------------
# Execute IF-SET if OPTION is set, IF-NOT-SET otherwise.
AC_DEFUN([_AM_IF_OPTION],
[m4_ifset(_AM_MANGLE_OPTION([$1]), [$2], [$3])])
# Check to make sure that the build environment is sane. -*- Autoconf -*-
# Copyright (C) 1996, 1997, 2000, 2001, 2003, 2005
# Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
# serial 4
# AM_SANITY_CHECK
# ---------------
AC_DEFUN([AM_SANITY_CHECK],
[AC_MSG_CHECKING([whether build environment is sane])
# Just in case
sleep 1
echo timestamp > conftest.file
# Do `set' in a subshell so we don't clobber the current shell's
# arguments. Must try -L first in case configure is actually a
# symlink; some systems play weird games with the mod time of symlinks
# (eg FreeBSD returns the mod time of the symlink's containing
# directory).
if (
set X `ls -Lt $srcdir/configure conftest.file 2> /dev/null`
if test "$[*]" = "X"; then
# -L didn't work.
set X `ls -t $srcdir/configure conftest.file`
fi
rm -f conftest.file
if test "$[*]" != "X $srcdir/configure conftest.file" \
&& test "$[*]" != "X conftest.file $srcdir/configure"; then
# If neither matched, then we have a broken ls. This can happen
# if, for instance, CONFIG_SHELL is bash and it inherits a
# broken ls alias from the environment. This has actually
# happened. Such a system could not be considered "sane".
AC_MSG_ERROR([ls -t appears to fail. Make sure there is not a broken
alias in your environment])
fi
test "$[2]" = conftest.file
)
then
# Ok.
:
else
AC_MSG_ERROR([newly created file is older than distributed files!
Check your system clock])
fi
AC_MSG_RESULT(yes)])
# Copyright (C) 2001, 2003, 2005 Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
# AM_PROG_INSTALL_STRIP
# ---------------------
# One issue with vendor `install' (even GNU) is that you can't
# specify the program used to strip binaries. This is especially
# annoying in cross-compiling environments, where the build's strip
# is unlikely to handle the host's binaries.
# Fortunately install-sh will honor a STRIPPROG variable, so we
# always use install-sh in `make install-strip', and initialize
# STRIPPROG with the value of the STRIP variable (set by the user).
AC_DEFUN([AM_PROG_INSTALL_STRIP],
[AC_REQUIRE([AM_PROG_INSTALL_SH])dnl
# Installed binaries are usually stripped using `strip' when the user
# run `make install-strip'. However `strip' might not be the right
# tool to use in cross-compilation environments, therefore Automake
# will honor the `STRIP' environment variable to overrule this program.
dnl Don't test for $cross_compiling = yes, because it might be `maybe'.
if test "$cross_compiling" != no; then
AC_CHECK_TOOL([STRIP], [strip], :)
fi
INSTALL_STRIP_PROGRAM="\${SHELL} \$(install_sh) -c -s"
AC_SUBST([INSTALL_STRIP_PROGRAM])])
# Check how to create a tarball. -*- Autoconf -*-
# Copyright (C) 2004, 2005 Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
# serial 2
# _AM_PROG_TAR(FORMAT)
# --------------------
# Check how to create a tarball in format FORMAT.
# FORMAT should be one of `v7', `ustar', or `pax'.
#
# Substitute a variable $(am__tar) that is a command
# writing to stdout a FORMAT-tarball containing the directory
# $tardir.
# tardir=directory && $(am__tar) > result.tar
#
# Substitute a variable $(am__untar) that extract such
# a tarball read from stdin.
# $(am__untar) < result.tar
AC_DEFUN([_AM_PROG_TAR],
[# Always define AMTAR for backward compatibility.
AM_MISSING_PROG([AMTAR], [tar])
m4_if([$1], [v7],
[am__tar='${AMTAR} chof - "$$tardir"'; am__untar='${AMTAR} xf -'],
[m4_case([$1], [ustar],, [pax],,
[m4_fatal([Unknown tar format])])
AC_MSG_CHECKING([how to create a $1 tar archive])
# Loop over all known methods to create a tar archive until one works.
_am_tools='gnutar m4_if([$1], [ustar], [plaintar]) pax cpio none'
_am_tools=${am_cv_prog_tar_$1-$_am_tools}
# Do not fold the above two line into one, because Tru64 sh and
# Solaris sh will not grok spaces in the rhs of `-'.
for _am_tool in $_am_tools
do
case $_am_tool in
gnutar)
for _am_tar in tar gnutar gtar;
do
AM_RUN_LOG([$_am_tar --version]) && break
done
am__tar="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$$tardir"'
am__tar_="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$tardir"'
am__untar="$_am_tar -xf -"
;;
plaintar)
# Must skip GNU tar: if it does not support --format= it doesn't create
# ustar tarball either.
(tar --version) >/dev/null 2>&1 && continue
am__tar='tar chf - "$$tardir"'
am__tar_='tar chf - "$tardir"'
am__untar='tar xf -'
;;
pax)
am__tar='pax -L -x $1 -w "$$tardir"'
am__tar_='pax -L -x $1 -w "$tardir"'
am__untar='pax -r'
;;
cpio)
am__tar='find "$$tardir" -print | cpio -o -H $1 -L'
am__tar_='find "$tardir" -print | cpio -o -H $1 -L'
am__untar='cpio -i -H $1 -d'
;;
none)
am__tar=false
am__tar_=false
am__untar=false
;;
esac
# If the value was cached, stop now. We just wanted to have am__tar
# and am__untar set.
test -n "${am_cv_prog_tar_$1}" && break
# tar/untar a dummy directory, and stop if the command works
rm -rf conftest.dir
mkdir conftest.dir
echo GrepMe > conftest.dir/file
AM_RUN_LOG([tardir=conftest.dir && eval $am__tar_ >conftest.tar])
rm -rf conftest.dir
if test -s conftest.tar; then
AM_RUN_LOG([$am__untar <conftest.tar])
grep GrepMe conftest.dir/file >/dev/null 2>&1 && break
fi
done
rm -rf conftest.dir
AC_CACHE_VAL([am_cv_prog_tar_$1], [am_cv_prog_tar_$1=$_am_tool])
AC_MSG_RESULT([$am_cv_prog_tar_$1])])
AC_SUBST([am__tar])
AC_SUBST([am__untar])
]) # _AM_PROG_TAR
m4_include([acinclude.m4])

View File

@ -0,0 +1,30 @@
A list of people who have contributed code to FCE Ultra follows.
Please note that the "Code Contributions" field may not be all inclusive;
the coder may have done more than what is listed.
Name/Alias Code Contributions Contact Information
------------------------------------------------------------------------------
Aaron Oneal Many changes to compile http://www.morphgear.com
with MSVC and first frame
skipping code.
BERO Base FCE code. bero@geocities.co.jp
CaH4e3 Some mapper code. CaH4e3 at mail dot ru
\Firebug\ VGA register setting code. ??
Joe Nahmias man pages.
LULU SDL network play code. ??
Paul Various code for the official kuliniew@purdue.edu
Kuliniewicz SDL port.
Quietust VRC7 "translation" code. quietust@ircN.org
Tatsuyuki OPL2 emulator. ??
Satoh
Xodnizel Most of the FCE Ultra code. http://xodnizel.net/

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,19 @@
cmake_minimum_required(VERSION 2.6)
project(fceux)
set(EXECUTABLE_OUTPUT_PATH ${CMAKE_SOURCE_DIR}/bin)
add_subdirectory(cmake/native)
if(UNIX)
add_subdirectory(cmake/cross-mingw32)
endif(UNIX)
add_custom_command(
OUTPUT ${EXECUTABLE_OUTPUT_PATH}/fceux.chm
COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_SOURCE_DIR}/src/drivers/win/help/fceux.chm ${EXECUTABLE_OUTPUT_PATH}/fceux.chm
DEPENDS ${CMAKE_SOURCE_DIR}/src/drivers/win/help/fceux.chm
VERBATIM
)
add_custom_target(
InstallHelpFile
ALL
DEPENDS ${EXECUTABLE_OUTPUT_PATH}/fceux.chm
)

View File

@ -0,0 +1,2 @@
add_subdirectory(release)
add_subdirectory(debug)

View File

@ -0,0 +1,4 @@
project("fceux: cross-mingw32 debug")
set(CMAKE_BUILD_TYPE debug)
set(FCEUX_EXE_NAME fceuxDBG.exe)
include(${CMAKE_SOURCE_DIR}/cmake/cross-mingw32/fceux_cross-mingw32.cmake)

View File

@ -0,0 +1,50 @@
include(CheckIncludeFile)
# Find mingw by looking for windows.h; set HOST accordingly.
find_path(PATH_TO_WINDOWS_H windows.h
/usr/i386-mingw32msvc/mingw/include
/usr/i586-mingw32msvc/mingw/include
/usr/i686-mingw32msvc/mingw/include
/usr/i386-mingw32/mingw/include
/usr/i586-mingw32/mingw/include
/usr/i686-mingw32/mingw/include
)
string(REGEX MATCH "i.86-[^/]*" HOST ${PATH_TO_WINDOWS_H})
set(CMAKE_CROSSCOMPILING TRUE)
set(MINGW TRUE)
set(WIN32 TRUE)
set(APPLE FALSE)
set(UNIX FALSE)
set(CMAKE_SYSTEM_NAME Windows)
set(CMAKE_C_COMPILER "${HOST}-gcc")
set(CMAKE_CXX_COMPILER "${HOST}-g++")
set(CMAKE_RC_COMPILER "${HOST}-windres")
set(CMAKE_FIND_ROOT_PATH "/usr/${HOST}")
set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
include(${CMAKE_SOURCE_DIR}/cmake/fceux.cmake)
# I cannot fucking believe that I need to do this:
#don't: ENABLE_LANGUAGE(RC) # above
#do: (for cmake-2.6.0 at least)
set(OUTPUT_RES_RC_O CMakeFiles/${FCEUX_EXE_NAME}.dir/__/__/__/src/drivers/win/res.rc.o)
add_custom_command(
OUTPUT ${OUTPUT_RES_RC_O}
COMMAND ${HOST}-windres -Isrc/drivers/win -DLVS_OWNERDATA=0x1000 -o ${OUTPUT_RES_RC_O} ${CMAKE_SOURCE_DIR}/src/drivers/win/res.rc
DEPENDS ${CMAKE_SOURCE_DIR}/src/drivers/win/res.rc
VERBATIM
)
add_custom_target(
BuildResourceFileFor${FCEUX_EXE_NAME}
DEPENDS ${OUTPUT_RES_RC_O}
)
set(DEFINED_BUILD_RESOURCE_FILE TRUE CACHE GLOBAL "This is a hack to get CMake to build the .rc file")
add_dependencies( ${FCEUX_EXE_NAME} BuildResourceFileFor${FCEUX_EXE_NAME} )
set_property(
TARGET ${FCEUX_EXE_NAME}
PROPERTY LINK_FLAGS ${OUTPUT_RES_RC_O}
)

View File

@ -0,0 +1,4 @@
project("fceux: cross-mingw32 release")
set(CMAKE_BUILD_TYPE release)
set(FCEUX_EXE_NAME fceuxREL.exe)
include(${CMAKE_SOURCE_DIR}/cmake/cross-mingw32/fceux_cross-mingw32.cmake)

View File

@ -0,0 +1,476 @@
#TODO: install generated exe's, appropriately named, in bin/
include(CheckFunctionExists)
include(TestBigEndian)
option(FCEUX_FORCE_LE "Build for a little-endian target" OFF)
option(FCEUX_FORCE_BE "Build for a big-endian target" OFF)
option(FCEUX_FRAMESKIP "Build legacy frameskip code" OFF)
if(WIN32)
OPTION (NOWIN32 "Replace Win32 support with SDL" OFF)
if (NOWIN32)
set(WIN32 OFF)
endif(NOWIN32)
endif(WIN32)
if (NOT WIN32)
option(FCEUX_SDL_OPENGL "Build with OpenGL support" ON)
find_package(SDL REQUIRED)
find_package(ZLIB REQUIRED)
if(FCEUX_SDL_OPENGL)
find_package(OpenGL REQUIRED)
endif(FCEUX_SDL_OPENGL)
endif(NOT WIN32)
set(SRC_CORE
${CMAKE_SOURCE_DIR}/src/asm.cpp
${CMAKE_SOURCE_DIR}/src/cart.cpp
${CMAKE_SOURCE_DIR}/src/cheat.cpp
${CMAKE_SOURCE_DIR}/src/conddebug.cpp
${CMAKE_SOURCE_DIR}/src/config.cpp
${CMAKE_SOURCE_DIR}/src/debug.cpp
${CMAKE_SOURCE_DIR}/src/drawing.cpp
${CMAKE_SOURCE_DIR}/src/fceu.cpp
${CMAKE_SOURCE_DIR}/src/fds.cpp
${CMAKE_SOURCE_DIR}/src/file.cpp
${CMAKE_SOURCE_DIR}/src/emufile.cpp
${CMAKE_SOURCE_DIR}/src/filter.cpp
${CMAKE_SOURCE_DIR}/src/ines.cpp
${CMAKE_SOURCE_DIR}/src/input.cpp
${CMAKE_SOURCE_DIR}/src/movie.cpp
${CMAKE_SOURCE_DIR}/src/netplay.cpp
${CMAKE_SOURCE_DIR}/src/nsf.cpp
${CMAKE_SOURCE_DIR}/src/oldmovie.cpp
${CMAKE_SOURCE_DIR}/src/palette.cpp
${CMAKE_SOURCE_DIR}/src/ppu.cpp
${CMAKE_SOURCE_DIR}/src/sound.cpp
${CMAKE_SOURCE_DIR}/src/state.cpp
${CMAKE_SOURCE_DIR}/src/unif.cpp
${CMAKE_SOURCE_DIR}/src/video.cpp
${CMAKE_SOURCE_DIR}/src/vsuni.cpp
${CMAKE_SOURCE_DIR}/src/wave.cpp
${CMAKE_SOURCE_DIR}/src/x6502.cpp
${CMAKE_SOURCE_DIR}/src/boards/01-222.cpp
${CMAKE_SOURCE_DIR}/src/boards/103.cpp
${CMAKE_SOURCE_DIR}/src/boards/106.cpp
${CMAKE_SOURCE_DIR}/src/boards/108.cpp
${CMAKE_SOURCE_DIR}/src/boards/112.cpp
${CMAKE_SOURCE_DIR}/src/boards/117.cpp
${CMAKE_SOURCE_DIR}/src/boards/120.cpp
${CMAKE_SOURCE_DIR}/src/boards/121.cpp
${CMAKE_SOURCE_DIR}/src/boards/15.cpp
${CMAKE_SOURCE_DIR}/src/boards/164.cpp
${CMAKE_SOURCE_DIR}/src/boards/175.cpp
${CMAKE_SOURCE_DIR}/src/boards/176.cpp
${CMAKE_SOURCE_DIR}/src/boards/177.cpp
${CMAKE_SOURCE_DIR}/src/boards/178.cpp
${CMAKE_SOURCE_DIR}/src/boards/179.cpp
${CMAKE_SOURCE_DIR}/src/boards/183.cpp
${CMAKE_SOURCE_DIR}/src/boards/185.cpp
${CMAKE_SOURCE_DIR}/src/boards/186.cpp
${CMAKE_SOURCE_DIR}/src/boards/187.cpp
${CMAKE_SOURCE_DIR}/src/boards/189.cpp
${CMAKE_SOURCE_DIR}/src/boards/199.cpp
${CMAKE_SOURCE_DIR}/src/boards/208.cpp
${CMAKE_SOURCE_DIR}/src/boards/222.cpp
${CMAKE_SOURCE_DIR}/src/boards/23.cpp
${CMAKE_SOURCE_DIR}/src/boards/235.cpp
${CMAKE_SOURCE_DIR}/src/boards/253.cpp
${CMAKE_SOURCE_DIR}/src/boards/3d-block.cpp
${CMAKE_SOURCE_DIR}/src/boards/411120-c.cpp
${CMAKE_SOURCE_DIR}/src/boards/43.cpp
${CMAKE_SOURCE_DIR}/src/boards/57.cpp
${CMAKE_SOURCE_DIR}/src/boards/603-5052.cpp
${CMAKE_SOURCE_DIR}/src/boards/68.cpp
${CMAKE_SOURCE_DIR}/src/boards/8157.cpp
${CMAKE_SOURCE_DIR}/src/boards/8237.cpp
${CMAKE_SOURCE_DIR}/src/boards/830118C.cpp
${CMAKE_SOURCE_DIR}/src/boards/88.cpp
${CMAKE_SOURCE_DIR}/src/boards/90.cpp
${CMAKE_SOURCE_DIR}/src/boards/95.cpp
${CMAKE_SOURCE_DIR}/src/boards/__dummy_mapper.cpp
${CMAKE_SOURCE_DIR}/src/boards/a9711.cpp
${CMAKE_SOURCE_DIR}/src/boards/a9746.cpp
${CMAKE_SOURCE_DIR}/src/boards/addrlatch.cpp
${CMAKE_SOURCE_DIR}/src/boards/ax5705.cpp
${CMAKE_SOURCE_DIR}/src/boards/bandai.cpp
${CMAKE_SOURCE_DIR}/src/boards/bmc13in1jy110.cpp
${CMAKE_SOURCE_DIR}/src/boards/bmc42in1r.cpp
${CMAKE_SOURCE_DIR}/src/boards/bmc64in1nr.cpp
${CMAKE_SOURCE_DIR}/src/boards/bmc70in1.cpp
${CMAKE_SOURCE_DIR}/src/boards/bonza.cpp
${CMAKE_SOURCE_DIR}/src/boards/bs-5.cpp
${CMAKE_SOURCE_DIR}/src/boards/onebus.cpp
${CMAKE_SOURCE_DIR}/src/boards/datalatch.cpp
${CMAKE_SOURCE_DIR}/src/boards/deirom.cpp
${CMAKE_SOURCE_DIR}/src/boards/dream.cpp
${CMAKE_SOURCE_DIR}/src/boards/edu2000.cpp
${CMAKE_SOURCE_DIR}/src/boards/fk23c.cpp
${CMAKE_SOURCE_DIR}/src/boards/ghostbusters63in1.cpp
${CMAKE_SOURCE_DIR}/src/boards/gs-2004.cpp
${CMAKE_SOURCE_DIR}/src/boards/gs-2013.cpp
${CMAKE_SOURCE_DIR}/src/boards/h2288.cpp
${CMAKE_SOURCE_DIR}/src/boards/karaoke.cpp
${CMAKE_SOURCE_DIR}/src/boards/kof97.cpp
${CMAKE_SOURCE_DIR}/src/boards/vrc5.cpp
${CMAKE_SOURCE_DIR}/src/boards/ks7032.cpp
${CMAKE_SOURCE_DIR}/src/boards/malee.cpp
${CMAKE_SOURCE_DIR}/src/boards/mmc1.cpp
${CMAKE_SOURCE_DIR}/src/boards/mmc3.cpp
${CMAKE_SOURCE_DIR}/src/boards/mmc5.cpp
${CMAKE_SOURCE_DIR}/src/boards/n-c22m.cpp
${CMAKE_SOURCE_DIR}/src/boards/n106.cpp
${CMAKE_SOURCE_DIR}/src/boards/n625092.cpp
${CMAKE_SOURCE_DIR}/src/boards/novel.cpp
${CMAKE_SOURCE_DIR}/src/boards/sachen.cpp
${CMAKE_SOURCE_DIR}/src/boards/sc-127.cpp
${CMAKE_SOURCE_DIR}/src/boards/sheroes.cpp
${CMAKE_SOURCE_DIR}/src/boards/sl1632.cpp
${CMAKE_SOURCE_DIR}/src/boards/smb2j.cpp
${CMAKE_SOURCE_DIR}/src/boards/subor.cpp
${CMAKE_SOURCE_DIR}/src/boards/super24.cpp
${CMAKE_SOURCE_DIR}/src/boards/supervision.cpp
${CMAKE_SOURCE_DIR}/src/boards/t-227-1.cpp
${CMAKE_SOURCE_DIR}/src/boards/t-262.cpp
${CMAKE_SOURCE_DIR}/src/boards/tengen.cpp
${CMAKE_SOURCE_DIR}/src/boards/tf-1201.cpp
${CMAKE_SOURCE_DIR}/src/input/arkanoid.cpp
${CMAKE_SOURCE_DIR}/src/input/bworld.cpp
${CMAKE_SOURCE_DIR}/src/input/cursor.cpp
${CMAKE_SOURCE_DIR}/src/input/fkb.cpp
${CMAKE_SOURCE_DIR}/src/input/ftrainer.cpp
${CMAKE_SOURCE_DIR}/src/input/hypershot.cpp
${CMAKE_SOURCE_DIR}/src/input/mahjong.cpp
${CMAKE_SOURCE_DIR}/src/input/mouse.cpp
${CMAKE_SOURCE_DIR}/src/input/oekakids.cpp
${CMAKE_SOURCE_DIR}/src/input/powerpad.cpp
${CMAKE_SOURCE_DIR}/src/input/quiz.cpp
${CMAKE_SOURCE_DIR}/src/input/shadow.cpp
${CMAKE_SOURCE_DIR}/src/input/suborkb.cpp
${CMAKE_SOURCE_DIR}/src/input/toprider.cpp
${CMAKE_SOURCE_DIR}/src/input/zapper.cpp
${CMAKE_SOURCE_DIR}/src/mappers/151.cpp
${CMAKE_SOURCE_DIR}/src/mappers/16.cpp
${CMAKE_SOURCE_DIR}/src/mappers/17.cpp
${CMAKE_SOURCE_DIR}/src/mappers/18.cpp
${CMAKE_SOURCE_DIR}/src/mappers/193.cpp
${CMAKE_SOURCE_DIR}/src/mappers/201.cpp
${CMAKE_SOURCE_DIR}/src/mappers/202.cpp
${CMAKE_SOURCE_DIR}/src/mappers/203.cpp
${CMAKE_SOURCE_DIR}/src/mappers/204.cpp
${CMAKE_SOURCE_DIR}/src/mappers/21.cpp
${CMAKE_SOURCE_DIR}/src/mappers/212.cpp
${CMAKE_SOURCE_DIR}/src/mappers/213.cpp
${CMAKE_SOURCE_DIR}/src/mappers/214.cpp
${CMAKE_SOURCE_DIR}/src/mappers/215.cpp
${CMAKE_SOURCE_DIR}/src/mappers/217.cpp
${CMAKE_SOURCE_DIR}/src/mappers/22.cpp
${CMAKE_SOURCE_DIR}/src/mappers/225.cpp
${CMAKE_SOURCE_DIR}/src/mappers/227.cpp
${CMAKE_SOURCE_DIR}/src/mappers/228.cpp
${CMAKE_SOURCE_DIR}/src/mappers/229.cpp
${CMAKE_SOURCE_DIR}/src/mappers/230.cpp
${CMAKE_SOURCE_DIR}/src/mappers/231.cpp
${CMAKE_SOURCE_DIR}/src/mappers/232.cpp
${CMAKE_SOURCE_DIR}/src/mappers/234.cpp
${CMAKE_SOURCE_DIR}/src/mappers/241.cpp
${CMAKE_SOURCE_DIR}/src/mappers/242.cpp
${CMAKE_SOURCE_DIR}/src/mappers/244.cpp
${CMAKE_SOURCE_DIR}/src/mappers/246.cpp
${CMAKE_SOURCE_DIR}/src/mappers/24and26.cpp
${CMAKE_SOURCE_DIR}/src/mappers/25.cpp
${CMAKE_SOURCE_DIR}/src/mappers/255.cpp
${CMAKE_SOURCE_DIR}/src/mappers/27.cpp
${CMAKE_SOURCE_DIR}/src/mappers/32.cpp
${CMAKE_SOURCE_DIR}/src/mappers/33.cpp
${CMAKE_SOURCE_DIR}/src/mappers/40.cpp
${CMAKE_SOURCE_DIR}/src/mappers/41.cpp
${CMAKE_SOURCE_DIR}/src/mappers/42.cpp
${CMAKE_SOURCE_DIR}/src/mappers/46.cpp
${CMAKE_SOURCE_DIR}/src/mappers/50.cpp
${CMAKE_SOURCE_DIR}/src/mappers/51.cpp
${CMAKE_SOURCE_DIR}/src/mappers/59.cpp
${CMAKE_SOURCE_DIR}/src/mappers/6.cpp
${CMAKE_SOURCE_DIR}/src/mappers/60.cpp
${CMAKE_SOURCE_DIR}/src/mappers/61.cpp
${CMAKE_SOURCE_DIR}/src/mappers/62.cpp
${CMAKE_SOURCE_DIR}/src/mappers/65.cpp
${CMAKE_SOURCE_DIR}/src/mappers/67.cpp
${CMAKE_SOURCE_DIR}/src/mappers/69.cpp
${CMAKE_SOURCE_DIR}/src/mappers/71.cpp
${CMAKE_SOURCE_DIR}/src/mappers/72.cpp
${CMAKE_SOURCE_DIR}/src/mappers/73.cpp
${CMAKE_SOURCE_DIR}/src/mappers/75.cpp
${CMAKE_SOURCE_DIR}/src/mappers/76.cpp
${CMAKE_SOURCE_DIR}/src/mappers/77.cpp
${CMAKE_SOURCE_DIR}/src/mappers/79.cpp
${CMAKE_SOURCE_DIR}/src/mappers/8.cpp
${CMAKE_SOURCE_DIR}/src/mappers/80.cpp
${CMAKE_SOURCE_DIR}/src/mappers/82.cpp
${CMAKE_SOURCE_DIR}/src/mappers/83.cpp
${CMAKE_SOURCE_DIR}/src/mappers/85.cpp
${CMAKE_SOURCE_DIR}/src/mappers/86.cpp
${CMAKE_SOURCE_DIR}/src/mappers/89.cpp
${CMAKE_SOURCE_DIR}/src/mappers/91.cpp
${CMAKE_SOURCE_DIR}/src/mappers/92.cpp
${CMAKE_SOURCE_DIR}/src/mappers/97.cpp
${CMAKE_SOURCE_DIR}/src/mappers/99.cpp
${CMAKE_SOURCE_DIR}/src/mappers/emu2413.c
${CMAKE_SOURCE_DIR}/src/mappers/mmc2and4.cpp
${CMAKE_SOURCE_DIR}/src/mappers/simple.cpp
${CMAKE_SOURCE_DIR}/src/utils/ConvertUTF.c
${CMAKE_SOURCE_DIR}/src/utils/crc32.cpp
${CMAKE_SOURCE_DIR}/src/utils/endian.cpp
${CMAKE_SOURCE_DIR}/src/utils/general.cpp
${CMAKE_SOURCE_DIR}/src/utils/guid.cpp
${CMAKE_SOURCE_DIR}/src/utils/md5.cpp
${CMAKE_SOURCE_DIR}/src/utils/memory.cpp
${CMAKE_SOURCE_DIR}/src/utils/unzip.cpp
${CMAKE_SOURCE_DIR}/src/utils/xstring.cpp
)
set(SRC_DRIVERS_COMMON
${CMAKE_SOURCE_DIR}/src/drivers/common/args.cpp
${CMAKE_SOURCE_DIR}/src/drivers/common/cheat.cpp
${CMAKE_SOURCE_DIR}/src/drivers/common/config.cpp
${CMAKE_SOURCE_DIR}/src/drivers/common/configSys.cpp
${CMAKE_SOURCE_DIR}/src/drivers/common/hq2x.cpp
${CMAKE_SOURCE_DIR}/src/drivers/common/hq3x.cpp
${CMAKE_SOURCE_DIR}/src/drivers/common/scale2x.cpp
${CMAKE_SOURCE_DIR}/src/drivers/common/scale3x.cpp
${CMAKE_SOURCE_DIR}/src/drivers/common/scalebit.cpp
${CMAKE_SOURCE_DIR}/src/drivers/common/vidblit.cpp
${CMAKE_SOURCE_DIR}/src/drivers/common/nes_ntsc.c
)
set(SRC_DRIVERS_SDL
${CMAKE_SOURCE_DIR}/src/drivers/sdl/config.cpp
${CMAKE_SOURCE_DIR}/src/drivers/sdl/input.cpp
${CMAKE_SOURCE_DIR}/src/drivers/sdl/sdl.cpp
${CMAKE_SOURCE_DIR}/src/drivers/sdl/sdl-joystick.cpp
${CMAKE_SOURCE_DIR}/src/drivers/sdl/sdl-sound.cpp
${CMAKE_SOURCE_DIR}/src/drivers/sdl/sdl-throttle.cpp
${CMAKE_SOURCE_DIR}/src/drivers/sdl/sdl-video.cpp
${CMAKE_SOURCE_DIR}/src/drivers/sdl/unix-netplay.cpp
)
if(FCEUX_SDL_OPENGL)
set(SRC_DRIVERS_SDL ${SRC_DRIVERS_SDL} ${CMAKE_SOURCE_DIR}/src/drivers/sdl/sdl-opengl.cpp)
endif(FCEUX_SDL_OPENGL)
set(SRC_DRIVERS_WIN
${CMAKE_SOURCE_DIR}/src/lua-engine.cpp
${CMAKE_SOURCE_DIR}/src/lua/src/lapi.c
${CMAKE_SOURCE_DIR}/src/lua/src/lauxlib.c
${CMAKE_SOURCE_DIR}/src/lua/src/lbaselib.c
${CMAKE_SOURCE_DIR}/src/lua/src/lcode.c
${CMAKE_SOURCE_DIR}/src/lua/src/ldblib.c
${CMAKE_SOURCE_DIR}/src/lua/src/ldebug.c
${CMAKE_SOURCE_DIR}/src/lua/src/ldo.c
${CMAKE_SOURCE_DIR}/src/lua/src/ldump.c
${CMAKE_SOURCE_DIR}/src/lua/src/lfunc.c
${CMAKE_SOURCE_DIR}/src/lua/src/lgc.c
${CMAKE_SOURCE_DIR}/src/lua/src/linit.c
${CMAKE_SOURCE_DIR}/src/lua/src/liolib.c
${CMAKE_SOURCE_DIR}/src/lua/src/llex.c
${CMAKE_SOURCE_DIR}/src/lua/src/lmathlib.c
${CMAKE_SOURCE_DIR}/src/lua/src/lmem.c
${CMAKE_SOURCE_DIR}/src/lua/src/loadlib.c
${CMAKE_SOURCE_DIR}/src/lua/src/lobject.c
${CMAKE_SOURCE_DIR}/src/lua/src/lopcodes.c
${CMAKE_SOURCE_DIR}/src/lua/src/loslib.c
${CMAKE_SOURCE_DIR}/src/lua/src/lparser.c
${CMAKE_SOURCE_DIR}/src/lua/src/lstate.c
${CMAKE_SOURCE_DIR}/src/lua/src/lstring.c
${CMAKE_SOURCE_DIR}/src/lua/src/lstrlib.c
${CMAKE_SOURCE_DIR}/src/lua/src/ltable.c
${CMAKE_SOURCE_DIR}/src/lua/src/ltablib.c
${CMAKE_SOURCE_DIR}/src/lua/src/ltm.c
${CMAKE_SOURCE_DIR}/src/lua/src/lundump.c
${CMAKE_SOURCE_DIR}/src/lua/src/lvm.c
${CMAKE_SOURCE_DIR}/src/lua/src/lzio.c
${CMAKE_SOURCE_DIR}/src/lua/src/print.c
${CMAKE_SOURCE_DIR}/src/drivers/win/archive.cpp
${CMAKE_SOURCE_DIR}/src/drivers/win/args.cpp
${CMAKE_SOURCE_DIR}/src/drivers/win/aviout.cpp
${CMAKE_SOURCE_DIR}/src/drivers/win/cdlogger.cpp
${CMAKE_SOURCE_DIR}/src/drivers/win/cheat.cpp
${CMAKE_SOURCE_DIR}/src/drivers/win/common.cpp
${CMAKE_SOURCE_DIR}/src/drivers/win/config.cpp
${CMAKE_SOURCE_DIR}/src/drivers/win/debugger.cpp
${CMAKE_SOURCE_DIR}/src/drivers/win/debuggersp.cpp
${CMAKE_SOURCE_DIR}/src/drivers/win/directories.cpp
${CMAKE_SOURCE_DIR}/src/drivers/win/gui.cpp
${CMAKE_SOURCE_DIR}/src/drivers/win/guiconfig.cpp
${CMAKE_SOURCE_DIR}/src/drivers/win/help.cpp
${CMAKE_SOURCE_DIR}/src/drivers/win/input.cpp
${CMAKE_SOURCE_DIR}/src/drivers/win/joystick.cpp
${CMAKE_SOURCE_DIR}/src/drivers/win/keyboard.cpp
${CMAKE_SOURCE_DIR}/src/drivers/win/log.cpp
${CMAKE_SOURCE_DIR}/src/drivers/win/luaconsole.cpp
${CMAKE_SOURCE_DIR}/src/drivers/win/main.cpp
${CMAKE_SOURCE_DIR}/src/drivers/win/mapinput.cpp
${CMAKE_SOURCE_DIR}/src/drivers/win/memview.cpp
${CMAKE_SOURCE_DIR}/src/drivers/win/memviewsp.cpp
${CMAKE_SOURCE_DIR}/src/drivers/win/memwatch.cpp
${CMAKE_SOURCE_DIR}/src/drivers/win/movieoptions.cpp
${CMAKE_SOURCE_DIR}/src/drivers/win/monitor.cpp
${CMAKE_SOURCE_DIR}/src/drivers/win/netplay.cpp
${CMAKE_SOURCE_DIR}/src/drivers/win/ntview.cpp
${CMAKE_SOURCE_DIR}/src/drivers/win/OutputDS.cpp
${CMAKE_SOURCE_DIR}/src/drivers/win/palette.cpp
${CMAKE_SOURCE_DIR}/src/drivers/win/ppuview.cpp
${CMAKE_SOURCE_DIR}/src/drivers/win/pref.cpp
${CMAKE_SOURCE_DIR}/src/drivers/win/ram_search.cpp
${CMAKE_SOURCE_DIR}/src/drivers/win/ramwatch.cpp
${CMAKE_SOURCE_DIR}/src/drivers/win/replay.cpp
${CMAKE_SOURCE_DIR}/src/drivers/win/res.rc
${CMAKE_SOURCE_DIR}/src/drivers/win/sound.cpp
${CMAKE_SOURCE_DIR}/src/drivers/win/state.cpp
${CMAKE_SOURCE_DIR}/src/drivers/win/tasedit.cpp
${CMAKE_SOURCE_DIR}/src/drivers/win/taseditlib/taseditproj.cpp
${CMAKE_SOURCE_DIR}/src/drivers/win/taseditlib/greenzone.cpp
${CMAKE_SOURCE_DIR}/src/drivers/win/taseditlib/bookmark.cpp
${CMAKE_SOURCE_DIR}/src/drivers/win/taseditlib/bookmarks.cpp
${CMAKE_SOURCE_DIR}/src/drivers/win/taseditlib/inputhistory.cpp
${CMAKE_SOURCE_DIR}/src/drivers/win/taseditlib/inputsnapshot.cpp
${CMAKE_SOURCE_DIR}/src/drivers/win/taseditlib/playback.cpp
${CMAKE_SOURCE_DIR}/src/drivers/win/taseditlib/markers.cpp
${CMAKE_SOURCE_DIR}/src/drivers/win/texthook.cpp
${CMAKE_SOURCE_DIR}/src/drivers/win/throttle.cpp
${CMAKE_SOURCE_DIR}/src/drivers/win/timing.cpp
${CMAKE_SOURCE_DIR}/src/drivers/win/tracer.cpp
${CMAKE_SOURCE_DIR}/src/drivers/win/video.cpp
${CMAKE_SOURCE_DIR}/src/drivers/win/wave.cpp
${CMAKE_SOURCE_DIR}/src/drivers/win/window.cpp
${CMAKE_SOURCE_DIR}/src/drivers/win/Win32InputBox.cpp
${CMAKE_SOURCE_DIR}/src/drivers/win/zlib/adler32.c
${CMAKE_SOURCE_DIR}/src/drivers/win/zlib/compress.c
${CMAKE_SOURCE_DIR}/src/drivers/win/zlib/crc32.c
${CMAKE_SOURCE_DIR}/src/drivers/win/zlib/deflate.c
${CMAKE_SOURCE_DIR}/src/drivers/win/zlib/gzio.c
${CMAKE_SOURCE_DIR}/src/drivers/win/zlib/infblock.c
${CMAKE_SOURCE_DIR}/src/drivers/win/zlib/infcodes.c
${CMAKE_SOURCE_DIR}/src/drivers/win/zlib/inffast.c
${CMAKE_SOURCE_DIR}/src/drivers/win/zlib/inflate.c
${CMAKE_SOURCE_DIR}/src/drivers/win/zlib/inftrees.c
${CMAKE_SOURCE_DIR}/src/drivers/win/zlib/infutil.c
${CMAKE_SOURCE_DIR}/src/drivers/win/zlib/trees.c
${CMAKE_SOURCE_DIR}/src/drivers/win/zlib/uncompr.c
${CMAKE_SOURCE_DIR}/src/drivers/win/zlib/zutil.c
# ${CMAKE_SOURCE_DIR}/src/drivers/res.rc
)
set(CMAKE_INCLUDE_CURRENT_DIR ON)
include_directories( ${CMAKE_SOURCE_DIR}/src )
add_definitions( -DNETWORK )
if(WIN32)
set(SOURCES ${SRC_CORE} ${SRC_DRIVERS_COMMON} ${SRC_DRIVERS_WIN})
include_directories( ${CMAKE_SOURCE_DIR}/src/drivers/win/directx ${CMAKE_SOURCE_DIR}/src/drivers/win/zlib )
add_definitions(
-DWIN32
-DFCEUDEF_DEBUGGER
-D_USE_SHARED_MEMORY_
-DPSS_STYLE=2
-DNOMINMAX
-D_S9XLUA_H
)
link_directories( ${CMAKE_SOURCE_DIR}/src/drivers/win/directx )
else(WIN32)
set(SOURCES ${SRC_CORE} ${SRC_DRIVERS_COMMON} ${SRC_DRIVERS_SDL})
include_directories( ${SDL_INCLUDE_DIR} ${ZLIB_INCLUDE_DIR} )
add_definitions( ${SDL_DEFINITIONS} ${ZLIB_DEFINITIONS} )
if(FCEUX_SDL_OPENGL)
add_definitions( -DOPENGL )
include_directories( ${OPENGL_INCLUDE_DIR} )
endif(FCEUX_SDL_OPENGL)
endif(WIN32)
if(APPLE)
add_definitions( -DPSS_STYLE=4 )
else(APPLE)
if(UNIX)
add_definitions( -DPSS_STYLE=1 )
endif(UNIX)
endif(APPLE)
if(MINGW)
add_definitions( -DNEED_MINGW_HACKS -D_WIN32_IE=0x0600 )
endif(MINGW)
if(CMAKE_BUILD_TYPE STREQUAL "debug")
add_definitions( -D_DEBUG )
endif(CMAKE_BUILD_TYPE STREQUAL "debug")
if(CMAKE_COMPILER_IS_GNUCXX)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -O2 -Wall -Wno-write-strings -Wno-sign-compare")
endif(CMAKE_COMPILER_IS_GNUCXX)
if(FCEUX_FRAMESKIP)
add_definitions( -DFRAMESKIP )
endif(FCEUX_FRAMESKIP)
if(NOT FCEUX_FORCE_BE)
if(FCEUX_FORCE_LE)
add_definitions( -DLSB_FIRST )
else(FCEUX_FORCE_LE)
test_big_endian(SYS_IS_BE)
if(NOT SYS_IS_BE)
add_definitions( -DLSB_FIRST )
endif(NOT SYS_IS_BE)
endif(FCEUX_FORCE_LE)
endif(NOT FCEUX_FORCE_BE)
check_function_exists(asprintf HAVE_ASPRINTF)
# HACK: cmake seems to cache HAVE_ASPRINTF and I don't know how to ask it
# to forget--even if your compiler changes. So tell it mingw=>no.
if(HAVE_ASPRINTF AND NOT MINGW)
add_definitions( -DHAVE_ASPRINTF )
endif(HAVE_ASPRINTF AND NOT MINGW)
add_executable( ${FCEUX_EXE_NAME} ${SOURCES} )
if(WIN32)
add_dependencies( ${FCEUX_EXE_NAME} InstallHelpFile )
#add_dependencies( ${FCEUX_EXE_NAME} res.o)
#add_custom_command(
# OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/res.o
# COMMAND windres
# ARGS ${CMAKE_SOURCE_DIR}/src/drivers/win/res.rc ${CMAKE_CURRENT_BINARY_DIR}/res.o --use-temp-file -D_WIN_IE=0x300
# MAIN_DEPENDENCY ${CMAKE_SOURCE_DIR}/src/drivers/win/res.rc
#)
set(OUTPUT_RES_RC_O CMakeFiles/${FCEUX_EXE_NAME}.dir/__/__/__/src/drivers/win/res.rc.o)
add_custom_command(
OUTPUT ${OUTPUT_RES_RC_O}
COMMAND windres -o ${OUTPUT_RES_RC_O} ${CMAKE_SOURCE_DIR}/src/drivers/win/res.rc
DEPENDS ${CMAKE_SOURCE_DIR}/src/drivers/win/res.rc
VERBATIM
)
add_custom_target(
BuildResourceFileFor${FCEUX_EXE_NAME}
DEPENDS ${OUTPUT_RES_RC_O}
)
set(DEFINED_BUILD_RESOURCE_FILE TRUE CACHE GLOBAL "This is a hack to get CMake to build the .rc file")
add_dependencies( ${FCEUX_EXE_NAME} BuildResourceFileFor${FCEUX_EXE_NAME} )
set_property(
TARGET ${FCEUX_EXE_NAME}
PROPERTY LINK_FLAGS "${OUTPUT_RES_RC_O} -mwindows"
)
target_link_libraries( ${FCEUX_EXE_NAME} rpcrt4 comctl32 vfw32 winmm ws2_32
comdlg32 ole32 gdi32
dsound dxguid ddraw dinput
)
if(MINGW)
include_directories(${CMAKE_SOURCE_DIR}/src/drivers/win/lua/include/)
else(MINGW)
target_link_libraries( ${FCEUX_EXE_NAME} htmlhelp)
endif(MINGW)
else(WIN32)
target_link_libraries( ${FCEUX_EXE_NAME} ${SDL_LIBRARY} ${ZLIB_LIBRARIES} )
if(FCEUX_SDL_OPENGL)
target_link_libraries( ${FCEUX_EXE_NAME} ${OPENGL_gl_LIBRARY} )
endif(FCEUX_SDL_OPENGL)
endif(WIN32)

View File

@ -0,0 +1,2 @@
add_subdirectory(release)
add_subdirectory(debug)

View File

@ -0,0 +1,4 @@
project("fceux: native debug")
set(CMAKE_BUILD_TYPE debug)
set(FCEUX_EXE_NAME fceuxDBG)
include(${CMAKE_SOURCE_DIR}/cmake/native/fceux_native.cmake)

View File

@ -0,0 +1 @@
include(${CMAKE_SOURCE_DIR}/cmake/fceux.cmake)

View File

@ -0,0 +1,4 @@
project("fceux: native release")
set(CMAKE_BUILD_TYPE release)
set(FCEUX_EXE_NAME fceuxREL)
include(${CMAKE_SOURCE_DIR}/cmake/native/fceux_native.cmake)

99
branches/sdl2/attic/compile Executable file
View File

@ -0,0 +1,99 @@
#! /bin/sh
# Wrapper for compilers which do not understand `-c -o'.
# Copyright 1999, 2000 Free Software Foundation, Inc.
# Written by Tom Tromey <tromey@cygnus.com>.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2, or (at your option)
# any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
# As a special exception to the GNU General Public License, if you
# distribute this file as part of a program that contains a
# configuration script generated by Autoconf, you may include it under
# the same distribution terms that you use for the rest of that program.
# Usage:
# compile PROGRAM [ARGS]...
# `-o FOO.o' is removed from the args passed to the actual compile.
prog=$1
shift
ofile=
cfile=
args=
while test $# -gt 0; do
case "$1" in
-o)
# configure might choose to run compile as `compile cc -o foo foo.c'.
# So we do something ugly here.
ofile=$2
shift
case "$ofile" in
*.o | *.obj)
;;
*)
args="$args -o $ofile"
ofile=
;;
esac
;;
*.c)
cfile=$1
args="$args $1"
;;
*)
args="$args $1"
;;
esac
shift
done
if test -z "$ofile" || test -z "$cfile"; then
# If no `-o' option was seen then we might have been invoked from a
# pattern rule where we don't need one. That is ok -- this is a
# normal compilation that the losing compiler can handle. If no
# `.c' file was seen then we are probably linking. That is also
# ok.
exec "$prog" $args
fi
# Name of file we expect compiler to create.
cofile=`echo $cfile | sed -e 's|^.*/||' -e 's/\.c$/.o/'`
# Create the lock directory.
# Note: use `[/.-]' here to ensure that we don't use the same name
# that we are using for the .o file. Also, base the name on the expected
# object file name, since that is what matters with a parallel build.
lockdir=`echo $cofile | sed -e 's|[/.-]|_|g'`.d
while true; do
if mkdir $lockdir > /dev/null 2>&1; then
break
fi
sleep 1
done
# FIXME: race condition here if user kills between mkdir and trap.
trap "rmdir $lockdir; exit 1" 1 2 15
# Run the compile.
"$prog" $args
status=$?
if test -f "$cofile"; then
mv "$cofile" "$ofile"
fi
rmdir $lockdir
exit $status

1317
branches/sdl2/attic/config.guess vendored Executable file

File diff suppressed because it is too large Load Diff

1411
branches/sdl2/attic/config.sub vendored Executable file

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1 @@
CFLAGS="-mno-cygwin" CXXFLAGS="-mno-cygwin" LDFLAGS="-mno-cygwin" ./configure --host=mingw32

View File

@ -0,0 +1,101 @@
AC_INIT([src/fceu.cpp])
AC_CANONICAL_HOST
AC_CANONICAL_TARGET
AM_INIT_AUTOMAKE([fceu], $FCEU_VERSION)
AC_PROG_CC
AC_PROG_CPP
AM_PROG_CC_C_O
AC_PROG_CXX
AC_PROG_CXXCPP
AC_PROG_INSTALL
AC_DEFINE(_GNU_SOURCE)
AC_CHECK_FUNC(asprintf, AC_DEFINE([HAVE_ASPRINTF]), [])
AC_CHECK_FUNC(alloca, AC_DEFINE([HAVE_ALLOCA]), [])
dnl Check for zlib
AC_CHECK_LIB([z], [zlibVersion],[], AC_MSG_ERROR([*** zlib not found!]))
LIBS="$LIBS -lz"
AM_CONDITIONAL(WIN32, false)
AM_CONDITIONAL(UNIX, false)
AM_CONDITIONAL(USE_SEXYAL, false)
AM_CONDITIONAL(OPENGL, false)
AM_CONDITIONAL(HAVE_GTK, false)
AC_DEFINE([NETWORK],[1])
if expr x"$target" : 'x.*beos' > /dev/null; then
CFLAGS="-no-fpic $CFLAGS"
CPPFLAGS="-no-fpic $CPPFLAGS"
AC_DEFINE([PSS_STYLE],[1])
elif expr x"$target" : 'x.*mingw' > /dev/null; then
AC_DEFINE([PSS_STYLE],[2])
AC_DEFINE([WIN32])
AM_CONDITIONAL(WIN32, true)
else
AM_CONDITIONAL(UNIX, true)
AC_DEFINE([UNIX])
AC_DEFINE([PSS_STYLE],[1])
AC_DEFINE([NETWORK],[1])
dnl AC_CHECK_HEADER([sys/soundcard.h],
dnl AM_CONDITIONAL(USE_SEXYAL, true)
dnl AC_DEFINE([USE_SEXYAL]),[])
fi
dnl if expr x"$target" : 'x.*darwin' > /dev/null; then
dnl AC_DEFINE([MACOSX])
dnl fi
if test x$use_nativewin32 = xno; then
dnl Check for SDL
SDL_VERSION=1.2.0
AM_PATH_SDL($SDL_VERSION, [:],
AC_MSG_ERROR([*** SDL version $SDL_VERSION not found!]))
AC_LANG_CPLUSPLUS
LIBS="$LIBS $SDL_LIBS"
CFLAGS="-Wall -fomit-frame-pointer $CFLAGS $SDL_CFLAGS"
CPPFLAGS="-Wall -fomit-frame-pointer $CPPFLAGS $SDL_CFLAGS"
dnl Check for SDL_net for net play
HAS_SDL_NET=no
dnl AC_CHECK_LIB([SDL_net], [SDLNet_Init],[HAS_SDL_NET=yes])
dnl if test x$HAS_SDL_NET = xyes; then
dnl AC_DEFINE([NETWORK])
dnl LIBS="$LIBS -lSDL_net"
dnl fi
AC_ARG_WITH(opengl,
[AC_HELP_STRING([--with-opengl],
[use OpenGL])],
use_opengl=$withval,
use_opengl="no")
if [[ "$use_opengl" = "yes" ]] ; then
dnl Check for OpenGL
AC_CHECK_HEADER([GL/gl.h],[AC_DEFINE([OPENGL]) AM_CONDITIONAL(OPENGL, true)],
[
AC_CHECK_HEADER([OpenGL/gl.h],[AC_DEFINE([OPENGL]) AM_CONDITIONAL(OPENGL, true)],[])
AC_DEFINE([APPLEOPENGL])
])
fi
AC_DEFINE([SDL],[1])
fi
if expr match "$target_cpu" 'i.86' > /dev/null; then
AC_DEFINE([C80x86])
fi
AC_C_BIGENDIAN([], [AC_DEFINE([LSB_FIRST])])
AC_DEFINE(FRAMESKIP)
dnl Output Makefiles
AC_OUTPUT([Makefile src/Makefile])

423
branches/sdl2/attic/depcomp Executable file
View File

@ -0,0 +1,423 @@
#! /bin/sh
# depcomp - compile a program generating dependencies as side-effects
# Copyright 1999, 2000 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2, or (at your option)
# any later version.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
# 02111-1307, USA.
# As a special exception to the GNU General Public License, if you
# distribute this file as part of a program that contains a
# configuration script generated by Autoconf, you may include it under
# the same distribution terms that you use for the rest of that program.
# Originally written by Alexandre Oliva <oliva@dcc.unicamp.br>.
if test -z "$depmode" || test -z "$source" || test -z "$object"; then
echo "depcomp: Variables source, object and depmode must be set" 1>&2
exit 1
fi
# `libtool' can also be set to `yes' or `no'.
if test -z "$depfile"; then
base=`echo "$object" | sed -e 's,^.*/,,' -e 's,\.\([^.]*\)$,.P\1,'`
dir=`echo "$object" | sed 's,/.*$,/,'`
if test "$dir" = "$object"; then
dir=
fi
# FIXME: should be _deps on DOS.
depfile="$dir.deps/$base"
fi
tmpdepfile=${tmpdepfile-`echo "$depfile" | sed 's/\.\([^.]*\)$/.T\1/'`}
rm -f "$tmpdepfile"
# Some modes work just like other modes, but use different flags. We
# parameterize here, but still list the modes in the big case below,
# to make depend.m4 easier to write. Note that we *cannot* use a case
# here, because this file can only contain one case statement.
if test "$depmode" = hp; then
# HP compiler uses -M and no extra arg.
gccflag=-M
depmode=gcc
fi
if test "$depmode" = dashXmstdout; then
# This is just like dashmstdout with a different argument.
dashmflag=-xM
depmode=dashmstdout
fi
case "$depmode" in
gcc3)
## gcc 3 implements dependency tracking that does exactly what
## we want. Yay! Note: for some reason libtool 1.4 doesn't like
## it if -MD -MP comes after the -MF stuff. Hmm.
"$@" -MT "$object" -MD -MP -MF "$tmpdepfile"
stat=$?
if test $stat -eq 0; then :
else
rm -f "$tmpdepfile"
exit $stat
fi
mv "$tmpdepfile" "$depfile"
;;
gcc)
## There are various ways to get dependency output from gcc. Here's
## why we pick this rather obscure method:
## - Don't want to use -MD because we'd like the dependencies to end
## up in a subdir. Having to rename by hand is ugly.
## (We might end up doing this anyway to support other compilers.)
## - The DEPENDENCIES_OUTPUT environment variable makes gcc act like
## -MM, not -M (despite what the docs say).
## - Using -M directly means running the compiler twice (even worse
## than renaming).
if test -z "$gccflag"; then
gccflag=-MD,
fi
"$@" -Wp,"$gccflag$tmpdepfile"
stat=$?
if test $stat -eq 0; then :
else
rm -f "$tmpdepfile"
exit $stat
fi
rm -f "$depfile"
echo "$object : \\" > "$depfile"
alpha=ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz
## The second -e expression handles DOS-style file names with drive letters.
sed -e 's/^[^:]*: / /' \
-e 's/^['$alpha']:\/[^:]*: / /' < "$tmpdepfile" >> "$depfile"
## This next piece of magic avoids the `deleted header file' problem.
## The problem is that when a header file which appears in a .P file
## is deleted, the dependency causes make to die (because there is
## typically no way to rebuild the header). We avoid this by adding
## dummy dependencies for each header file. Too bad gcc doesn't do
## this for us directly.
tr ' ' '
' < "$tmpdepfile" |
## Some versions of gcc put a space before the `:'. On the theory
## that the space means something, we add a space to the output as
## well.
## Some versions of the HPUX 10.20 sed can't process this invocation
## correctly. Breaking it into two sed invocations is a workaround.
sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile"
rm -f "$tmpdepfile"
;;
hp)
# This case exists only to let depend.m4 do its work. It works by
# looking at the text of this script. This case will never be run,
# since it is checked for above.
exit 1
;;
sgi)
if test "$libtool" = yes; then
"$@" "-Wp,-MDupdate,$tmpdepfile"
else
"$@" -MDupdate "$tmpdepfile"
fi
stat=$?
if test $stat -eq 0; then :
else
rm -f "$tmpdepfile"
exit $stat
fi
rm -f "$depfile"
if test -f "$tmpdepfile"; then # yes, the sourcefile depend on other files
echo "$object : \\" > "$depfile"
# Clip off the initial element (the dependent). Don't try to be
# clever and replace this with sed code, as IRIX sed won't handle
# lines with more than a fixed number of characters (4096 in
# IRIX 6.2 sed, 8192 in IRIX 6.5). We also remove comment lines;
# the IRIX cc adds comments like `#:fec' to the end of the
# dependency line.
tr ' ' '
' < "$tmpdepfile" \
| sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' | \
tr '
' ' ' >> $depfile
echo >> $depfile
# The second pass generates a dummy entry for each header file.
tr ' ' '
' < "$tmpdepfile" \
| sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' -e 's/$/:/' \
>> $depfile
else
# The sourcefile does not contain any dependencies, so just
# store a dummy comment line, to avoid errors with the Makefile
# "include basename.Plo" scheme.
echo "#dummy" > "$depfile"
fi
rm -f "$tmpdepfile"
;;
aix)
# The C for AIX Compiler uses -M and outputs the dependencies
# in a .u file. This file always lives in the current directory.
# Also, the AIX compiler puts `$object:' at the start of each line;
# $object doesn't have directory information.
stripped=`echo "$object" | sed -e 's,^.*/,,' -e 's/\(.*\)\..*$/\1/'`
tmpdepfile="$stripped.u"
outname="$stripped.o"
if test "$libtool" = yes; then
"$@" -Wc,-M
else
"$@" -M
fi
stat=$?
if test $stat -eq 0; then :
else
rm -f "$tmpdepfile"
exit $stat
fi
if test -f "$tmpdepfile"; then
# Each line is of the form `foo.o: dependent.h'.
# Do two passes, one to just change these to
# `$object: dependent.h' and one to simply `dependent.h:'.
sed -e "s,^$outname:,$object :," < "$tmpdepfile" > "$depfile"
sed -e "s,^$outname: \(.*\)$,\1:," < "$tmpdepfile" >> "$depfile"
else
# The sourcefile does not contain any dependencies, so just
# store a dummy comment line, to avoid errors with the Makefile
# "include basename.Plo" scheme.
echo "#dummy" > "$depfile"
fi
rm -f "$tmpdepfile"
;;
tru64)
# The Tru64 compiler uses -MD to generate dependencies as a side
# effect. `cc -MD -o foo.o ...' puts the dependencies into `foo.o.d'.
# At least on Alpha/Redhat 6.1, Compaq CCC V6.2-504 seems to put
# dependencies in `foo.d' instead, so we check for that too.
# Subdirectories are respected.
dir=`echo "$object" | sed -e 's|/[^/]*$|/|'`
test "x$dir" = "x$object" && dir=
base=`echo "$object" | sed -e 's|^.*/||' -e 's/\.o$//' -e 's/\.lo$//'`
if test "$libtool" = yes; then
tmpdepfile1="$dir.libs/$base.lo.d"
tmpdepfile2="$dir.libs/$base.d"
"$@" -Wc,-MD
else
tmpdepfile1="$dir$base.o.d"
tmpdepfile2="$dir$base.d"
"$@" -MD
fi
stat=$?
if test $stat -eq 0; then :
else
rm -f "$tmpdepfile1" "$tmpdepfile2"
exit $stat
fi
if test -f "$tmpdepfile1"; then
tmpdepfile="$tmpdepfile1"
else
tmpdepfile="$tmpdepfile2"
fi
if test -f "$tmpdepfile"; then
sed -e "s,^.*\.[a-z]*:,$object:," < "$tmpdepfile" > "$depfile"
# That's a space and a tab in the [].
sed -e 's,^.*\.[a-z]*:[ ]*,,' -e 's,$,:,' < "$tmpdepfile" >> "$depfile"
else
echo "#dummy" > "$depfile"
fi
rm -f "$tmpdepfile"
;;
#nosideeffect)
# This comment above is used by automake to tell side-effect
# dependency tracking mechanisms from slower ones.
dashmstdout)
# Important note: in order to support this mode, a compiler *must*
# always write the proprocessed file to stdout, regardless of -o.
"$@" || exit $?
# Remove the call to Libtool.
if test "$libtool" = yes; then
while test $1 != '--mode=compile'; do
shift
done
shift
fi
# Remove `-o $object'. We will use -o /dev/null later,
# however we can't do the remplacement now because
# `-o $object' might simply not be used
IFS=" "
for arg
do
case $arg in
-o)
shift
;;
$object)
shift
;;
*)
set fnord "$@" "$arg"
shift # fnord
shift # $arg
;;
esac
done
test -z "$dashmflag" && dashmflag=-M
"$@" -o /dev/null $dashmflag | sed 's:^[^:]*\:[ ]*:'"$object"'\: :' > "$tmpdepfile"
rm -f "$depfile"
cat < "$tmpdepfile" > "$depfile"
tr ' ' '
' < "$tmpdepfile" | \
## Some versions of the HPUX 10.20 sed can't process this invocation
## correctly. Breaking it into two sed invocations is a workaround.
sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile"
rm -f "$tmpdepfile"
;;
dashXmstdout)
# This case only exists to satisfy depend.m4. It is never actually
# run, as this mode is specially recognized in the preamble.
exit 1
;;
makedepend)
"$@" || exit $?
# X makedepend
shift
cleared=no
for arg in "$@"; do
case $cleared in
no)
set ""; shift
cleared=yes ;;
esac
case "$arg" in
-D*|-I*)
set fnord "$@" "$arg"; shift ;;
-*)
;;
*)
set fnord "$@" "$arg"; shift ;;
esac
done
obj_suffix="`echo $object | sed 's/^.*\././'`"
touch "$tmpdepfile"
${MAKEDEPEND-makedepend} -o"$obj_suffix" -f"$tmpdepfile" "$@"
rm -f "$depfile"
cat < "$tmpdepfile" > "$depfile"
sed '1,2d' "$tmpdepfile" | tr ' ' '
' | \
## Some versions of the HPUX 10.20 sed can't process this invocation
## correctly. Breaking it into two sed invocations is a workaround.
sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile"
rm -f "$tmpdepfile" "$tmpdepfile".bak
;;
cpp)
# Important note: in order to support this mode, a compiler *must*
# always write the proprocessed file to stdout.
"$@" || exit $?
# Remove the call to Libtool.
if test "$libtool" = yes; then
while test $1 != '--mode=compile'; do
shift
done
shift
fi
# Remove `-o $object'.
IFS=" "
for arg
do
case $arg in
-o)
shift
;;
$object)
shift
;;
*)
set fnord "$@" "$arg"
shift # fnord
shift # $arg
;;
esac
done
"$@" -E |
sed -n '/^# [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' |
sed '$ s: \\$::' > "$tmpdepfile"
rm -f "$depfile"
echo "$object : \\" > "$depfile"
cat < "$tmpdepfile" >> "$depfile"
sed < "$tmpdepfile" '/^$/d;s/^ //;s/ \\$//;s/$/ :/' >> "$depfile"
rm -f "$tmpdepfile"
;;
msvisualcpp)
# Important note: in order to support this mode, a compiler *must*
# always write the proprocessed file to stdout, regardless of -o,
# because we must use -o when running libtool.
"$@" || exit $?
IFS=" "
for arg
do
case "$arg" in
"-Gm"|"/Gm"|"-Gi"|"/Gi"|"-ZI"|"/ZI")
set fnord "$@"
shift
shift
;;
*)
set fnord "$@" "$arg"
shift
shift
;;
esac
done
"$@" -E |
sed -n '/^#line [0-9][0-9]* "\([^"]*\)"/ s::echo "`cygpath -u \\"\1\\"`":p' | sort | uniq > "$tmpdepfile"
rm -f "$depfile"
echo "$object : \\" > "$depfile"
. "$tmpdepfile" | sed 's% %\\ %g' | sed -n '/^\(.*\)$/ s:: \1 \\:p' >> "$depfile"
echo " " >> "$depfile"
. "$tmpdepfile" | sed 's% %\\ %g' | sed -n '/^\(.*\)$/ s::\1\::p' >> "$depfile"
rm -f "$tmpdepfile"
;;
none)
exec "$@"
;;
*)
echo "Unknown depmode $depmode" 1>&2
exit 1
;;
esac
exit 0

View File

@ -0,0 +1,135 @@
.\" t Hey, EMACS: -*- nroff -*-
.\" First parameter, NAME, should be all caps
.\" Second parameter, SECTION, should be 1-8, maybe w/ subsection
.\" other parameters are allowed: see man(7), man(1)
.TH FCEU-SVGA 6 "March 27, 2003"
.\" Please adjust this date whenever revising the manpage.
.\"
.\" Some roff macros, for reference:
.\" .nh disable hyphenation
.\" .hy enable hyphenation
.\" .ad l left justify
.\" .ad b justify to both left and right margins
.\" .nf disable filling
.\" .fi enable filling
.\" .br insert line break
.\" .sp <n> insert n+1 empty lines
.\" for manpage-specific macros, see man(7)
.SH NAME
fceu-svga \- An emulator for the original (8-bit) Nintendo game console.
.SH SYNOPSIS
.B fceu-svga
.RI [ options ]
"filename"
.SH DESCRIPTION
.B FCE Ultra
is an emulator for the original (8-bit) Nintendo Entertainment System (NES).
It has a robust color palette rendering engine that is fully customizable,
along with excellent sound and joystick support, and even includes TCP/IP based
network playing for head-to-head gaming with your friends!
.PP
The emulator is available in two versions for Linux (there are also versions
for DOS and Windows): an SDL-based version, and one based on SVGALIB. The two
versions are essentially the same \-\- use the SVGALIB version for the Linux
console, and the SDL version for playing in X.
.SH OPTIONS
These are some of the more frequently used options in FCE Ultra SVGALIB. Run
fceu-svga without any options for a larger list, or see the README for the full
list.
.TP
.BI \-gg
Enable Game Genie emulation support.
.TP
.BI "\-cpalette " <file>
Use the custom palette in <file>.
.TP
.BI "\-soundvol " <percentage>
Sets the sound volume to the given percentage.
.TP
.BI "\-sound " <rate>
Set the sound playback sample rate (0 == off).
.TP
.BI "\-connect " <server>
Connect as a client (player 2) to <server> for TCP/IP network play.
.TP
.BI \-server
Be a host server (player 1) for a TCP/IP network game.
.TP
.BI "\-netport " <portnum>
Use <portnum> for TCP/IP network play.
.SH KEYBOARD COMMANDS
.B FCE Ultra
has a number of commands available within the emulator.
It also includes default keyboard bindings when emulating game pads or power pads.
.SS Gamepad Keyboard Bindings
.TS
center box;
cb | cb, c | ci.
NES Gamepad Keyboard
=
Arrows Cursor Arrows
A Left ALT
B Left CTRL
Select TAB
Start ENTER
.TE
.SS Other Commands
.PP
.TP 15
.BI <F2>
Activate cheat interface.
.TP 15
.BI <F3>
Lock virtual console.
.TP 15
.BI <F4>
Unlock virtual console.
.TP 15
.BI <F5>
Save game state into current slot (set using number keys).
.TP 15
.BI <F7>
Restore game state from current slot (set using number keys).
.TP 15
.BI <F9>
Save screen snapshot.
.TP 15
.BI <F10>
Reset NES.
.TP 15
.BI <F11>
Toggle power to NES.
.TP 15
.BR <F12> ", " <ESC>
Quit
.B FCE Ultra.
.SH NOTES
This program needs permisison to the video hardware, this normally requires
root access. One way to accomplish this is by making
.BI "fceu-svga " suid-root.
An easy way to do this is using the
.BR dpkg-statoverride
command. For example, as root on a
.I Debian
system run:
.PP
.B dpkg-statoverride --update --add root games 04755 /usr/games/fceu-svga
.PP
This will ensure that the setuid bit is preserved across package upgrades.
.SH SEE ALSO
.BR dpkg-statoverride "(8), " fceu-sdl (6)
.TP
.I /usr/share/doc/fceu-doc/readme-linux.txt.gz
The
.B FCE Ultra README
for linux, available from the
.I fceu-doc
Debian package.
.TP
.I http://fceultra.sourceforge.net/
The
.B FCE Ultra
project homepage.
.SH AUTHOR
This manual page was written by Joe Nahmias <joe@nahmias.net>,
for the Debian GNU/Linux system (but may be used by others).

251
branches/sdl2/attic/install-sh Executable file
View File

@ -0,0 +1,251 @@
#!/bin/sh
#
# install - install a program, script, or datafile
# This comes from X11R5 (mit/util/scripts/install.sh).
#
# Copyright 1991 by the Massachusetts Institute of Technology
#
# Permission to use, copy, modify, distribute, and sell this software and its
# documentation for any purpose is hereby granted without fee, provided that
# the above copyright notice appear in all copies and that both that
# copyright notice and this permission notice appear in supporting
# documentation, and that the name of M.I.T. not be used in advertising or
# publicity pertaining to distribution of the software without specific,
# written prior permission. M.I.T. makes no representations about the
# suitability of this software for any purpose. It is provided "as is"
# without express or implied warranty.
#
# 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}"
transformbasename=""
transform_arg=""
instcmd="$mvprog"
chmodcmd="$chmodprog 0755"
chowncmd=""
chgrpcmd=""
stripcmd=""
rmcmd="$rmprog -f"
mvcmd="$mvprog"
src=""
dst=""
dir_arg=""
while [ x"$1" != x ]; do
case $1 in
-c) instcmd="$cpprog"
shift
continue;;
-d) dir_arg=true
shift
continue;;
-m) chmodcmd="$chmodprog $2"
shift
shift
continue;;
-o) chowncmd="$chownprog $2"
shift
shift
continue;;
-g) chgrpcmd="$chgrpprog $2"
shift
shift
continue;;
-s) stripcmd="$stripprog"
shift
continue;;
-t=*) transformarg=`echo $1 | sed 's/-t=//'`
shift
continue;;
-b=*) transformbasename=`echo $1 | sed 's/-b=//'`
shift
continue;;
*) if [ x"$src" = x ]
then
src=$1
else
# this colon is to work around a 386BSD /bin/sh bug
:
dst=$1
fi
shift
continue;;
esac
done
if [ x"$src" = x ]
then
echo "install: no input file specified"
exit 1
else
:
fi
if [ x"$dir_arg" != x ]; then
dst=$src
src=""
if [ -d $dst ]; then
instcmd=:
chmodcmd=""
else
instcmd=$mkdirprog
fi
else
# Waiting for this to be detected by the "$instcmd $src $dsttmp" command
# might cause directories to be created, which would be especially bad
# if $src (and thus $dsttmp) contains '*'.
if [ -f "$src" ] || [ -d "$src" ]
then
:
else
echo "install: $src does not exist"
exit 1
fi
if [ x"$dst" = x ]
then
echo "install: no destination specified"
exit 1
else
:
fi
# If destination is a directory, append the input filename; if your system
# does not like double slashes in filenames, you may need to add some logic
if [ -d $dst ]
then
dst="$dst"/`basename $src`
else
:
fi
fi
## this sed command emulates the dirname command
dstdir=`echo $dst | sed -e 's,[^/]*$,,;s,/$,,;s,^$,.,'`
# Make sure that the destination directory exists.
# this part is taken from Noah Friedman's mkinstalldirs script
# Skip lots of stat calls in the usual case.
if [ ! -d "$dstdir" ]; then
defaultIFS='
'
IFS="${IFS-${defaultIFS}}"
oIFS="${IFS}"
# Some sh's can't handle IFS=/ for some reason.
IFS='%'
set - `echo ${dstdir} | sed -e 's@/@%@g' -e 's@^%@/@'`
IFS="${oIFS}"
pathcomp=''
while [ $# -ne 0 ] ; do
pathcomp="${pathcomp}${1}"
shift
if [ ! -d "${pathcomp}" ] ;
then
$mkdirprog "${pathcomp}"
else
:
fi
pathcomp="${pathcomp}/"
done
fi
if [ x"$dir_arg" != x ]
then
$doit $instcmd $dst &&
if [ x"$chowncmd" != x ]; then $doit $chowncmd $dst; else : ; fi &&
if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dst; else : ; fi &&
if [ x"$stripcmd" != x ]; then $doit $stripcmd $dst; else : ; fi &&
if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dst; else : ; fi
else
# If we're going to rename the final executable, determine the name now.
if [ x"$transformarg" = x ]
then
dstfile=`basename $dst`
else
dstfile=`basename $dst $transformbasename |
sed $transformarg`$transformbasename
fi
# don't allow the sed command to completely eliminate the filename
if [ x"$dstfile" = x ]
then
dstfile=`basename $dst`
else
:
fi
# Make a temp file name in the proper directory.
dsttmp=$dstdir/#inst.$$#
# Move or copy the file name to the temp name
$doit $instcmd $src $dsttmp &&
trap "rm -f ${dsttmp}" 0 &&
# 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 $instcmd $src $dsttmp" command.
if [ x"$chowncmd" != x ]; then $doit $chowncmd $dsttmp; else :;fi &&
if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dsttmp; else :;fi &&
if [ x"$stripcmd" != x ]; then $doit $stripcmd $dsttmp; else :;fi &&
if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dsttmp; else :;fi &&
# Now rename the file to the real destination.
$doit $rmcmd -f $dstdir/$dstfile &&
$doit $mvcmd $dsttmp $dstdir/$dstfile
fi &&
exit 0

336
branches/sdl2/attic/missing Executable file
View File

@ -0,0 +1,336 @@
#! /bin/sh
# Common stub for a few missing GNU programs while installing.
# Copyright (C) 1996, 1997, 1999, 2000, 2002 Free Software Foundation, Inc.
# Originally by Fran,cois Pinard <pinard@iro.umontreal.ca>, 1996.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2, or (at your option)
# any later version.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
# 02111-1307, USA.
# As a special exception to the GNU General Public License, if you
# distribute this file as part of a program that contains a
# configuration script generated by Autoconf, you may include it under
# the same distribution terms that you use for the rest of that program.
if test $# -eq 0; then
echo 1>&2 "Try \`$0 --help' for more information"
exit 1
fi
run=:
# In the cases where this matters, `missing' is being run in the
# srcdir already.
if test -f configure.ac; then
configure_ac=configure.ac
else
configure_ac=configure.in
fi
case "$1" in
--run)
# Try to run requested program, and just exit if it succeeds.
run=
shift
"$@" && exit 0
;;
esac
# If it does not exist, or fails to run (possibly an outdated version),
# try to emulate it.
case "$1" in
-h|--h|--he|--hel|--help)
echo "\
$0 [OPTION]... PROGRAM [ARGUMENT]...
Handle \`PROGRAM [ARGUMENT]...' for when PROGRAM is missing, or return an
error status if there is no known handling for PROGRAM.
Options:
-h, --help display this help and exit
-v, --version output version information and exit
--run try to run the given command, and emulate it if it fails
Supported PROGRAM values:
aclocal touch file \`aclocal.m4'
autoconf touch file \`configure'
autoheader touch file \`config.h.in'
automake touch all \`Makefile.in' files
bison create \`y.tab.[ch]', if possible, from existing .[ch]
flex create \`lex.yy.c', if possible, from existing .c
help2man touch the output file
lex create \`lex.yy.c', if possible, from existing .c
makeinfo touch the output file
tar try tar, gnutar, gtar, then tar without non-portable flags
yacc create \`y.tab.[ch]', if possible, from existing .[ch]"
;;
-v|--v|--ve|--ver|--vers|--versi|--versio|--version)
echo "missing 0.4 - GNU automake"
;;
-*)
echo 1>&2 "$0: Unknown \`$1' option"
echo 1>&2 "Try \`$0 --help' for more information"
exit 1
;;
aclocal*)
if test -z "$run" && ($1 --version) > /dev/null 2>&1; then
# We have it, but it failed.
exit 1
fi
echo 1>&2 "\
WARNING: \`$1' is missing on your system. You should only need it if
you modified \`acinclude.m4' or \`${configure_ac}'. You might want
to install the \`Automake' and \`Perl' packages. Grab them from
any GNU archive site."
touch aclocal.m4
;;
autoconf)
if test -z "$run" && ($1 --version) > /dev/null 2>&1; then
# We have it, but it failed.
exit 1
fi
echo 1>&2 "\
WARNING: \`$1' is missing on your system. You should only need it if
you modified \`${configure_ac}'. You might want to install the
\`Autoconf' and \`GNU m4' packages. Grab them from any GNU
archive site."
touch configure
;;
autoheader)
if test -z "$run" && ($1 --version) > /dev/null 2>&1; then
# We have it, but it failed.
exit 1
fi
echo 1>&2 "\
WARNING: \`$1' is missing on your system. You should only need it if
you modified \`acconfig.h' or \`${configure_ac}'. You might want
to install the \`Autoconf' and \`GNU m4' packages. Grab them
from any GNU archive site."
files=`sed -n 's/^[ ]*A[CM]_CONFIG_HEADER(\([^)]*\)).*/\1/p' ${configure_ac}`
test -z "$files" && files="config.h"
touch_files=
for f in $files; do
case "$f" in
*:*) touch_files="$touch_files "`echo "$f" |
sed -e 's/^[^:]*://' -e 's/:.*//'`;;
*) touch_files="$touch_files $f.in";;
esac
done
touch $touch_files
;;
automake*)
if test -z "$run" && ($1 --version) > /dev/null 2>&1; then
# We have it, but it failed.
exit 1
fi
echo 1>&2 "\
WARNING: \`$1' is missing on your system. You should only need it if
you modified \`Makefile.am', \`acinclude.m4' or \`${configure_ac}'.
You might want to install the \`Automake' and \`Perl' packages.
Grab them from any GNU archive site."
find . -type f -name Makefile.am -print |
sed 's/\.am$/.in/' |
while read f; do touch "$f"; done
;;
autom4te)
if test -z "$run" && ($1 --version) > /dev/null 2>&1; then
# We have it, but it failed.
exit 1
fi
echo 1>&2 "\
WARNING: \`$1' is needed, and you do not seem to have it handy on your
system. You might have modified some files without having the
proper tools for further handling them.
You can get \`$1Help2man' as part of \`Autoconf' from any GNU
archive site."
file=`echo "$*" | sed -n 's/.*--output[ =]*\([^ ]*\).*/\1/p'`
test -z "$file" && file=`echo "$*" | sed -n 's/.*-o[ ]*\([^ ]*\).*/\1/p'`
if test -f "$file"; then
touch $file
else
test -z "$file" || exec >$file
echo "#! /bin/sh"
echo "# Created by GNU Automake missing as a replacement of"
echo "# $ $@"
echo "exit 0"
chmod +x $file
exit 1
fi
;;
bison|yacc)
echo 1>&2 "\
WARNING: \`$1' is missing on your system. You should only need it if
you modified a \`.y' file. You may need the \`Bison' package
in order for those modifications to take effect. You can get
\`Bison' from any GNU archive site."
rm -f y.tab.c y.tab.h
if [ $# -ne 1 ]; then
eval LASTARG="\${$#}"
case "$LASTARG" in
*.y)
SRCFILE=`echo "$LASTARG" | sed 's/y$/c/'`
if [ -f "$SRCFILE" ]; then
cp "$SRCFILE" y.tab.c
fi
SRCFILE=`echo "$LASTARG" | sed 's/y$/h/'`
if [ -f "$SRCFILE" ]; then
cp "$SRCFILE" y.tab.h
fi
;;
esac
fi
if [ ! -f y.tab.h ]; then
echo >y.tab.h
fi
if [ ! -f y.tab.c ]; then
echo 'main() { return 0; }' >y.tab.c
fi
;;
lex|flex)
echo 1>&2 "\
WARNING: \`$1' is missing on your system. You should only need it if
you modified a \`.l' file. You may need the \`Flex' package
in order for those modifications to take effect. You can get
\`Flex' from any GNU archive site."
rm -f lex.yy.c
if [ $# -ne 1 ]; then
eval LASTARG="\${$#}"
case "$LASTARG" in
*.l)
SRCFILE=`echo "$LASTARG" | sed 's/l$/c/'`
if [ -f "$SRCFILE" ]; then
cp "$SRCFILE" lex.yy.c
fi
;;
esac
fi
if [ ! -f lex.yy.c ]; then
echo 'main() { return 0; }' >lex.yy.c
fi
;;
help2man)
if test -z "$run" && ($1 --version) > /dev/null 2>&1; then
# We have it, but it failed.
exit 1
fi
echo 1>&2 "\
WARNING: \`$1' is missing on your system. You should only need it if
you modified a dependency of a manual page. You may need the
\`Help2man' package in order for those modifications to take
effect. You can get \`Help2man' from any GNU archive site."
file=`echo "$*" | sed -n 's/.*-o \([^ ]*\).*/\1/p'`
if test -z "$file"; then
file=`echo "$*" | sed -n 's/.*--output=\([^ ]*\).*/\1/p'`
fi
if [ -f "$file" ]; then
touch $file
else
test -z "$file" || exec >$file
echo ".ab help2man is required to generate this page"
exit 1
fi
;;
makeinfo)
if test -z "$run" && (makeinfo --version) > /dev/null 2>&1; then
# We have makeinfo, but it failed.
exit 1
fi
echo 1>&2 "\
WARNING: \`$1' is missing on your system. You should only need it if
you modified a \`.texi' or \`.texinfo' file, or any other file
indirectly affecting the aspect of the manual. The spurious
call might also be the consequence of using a buggy \`make' (AIX,
DU, IRIX). You might want to install the \`Texinfo' package or
the \`GNU make' package. Grab either from any GNU archive site."
file=`echo "$*" | sed -n 's/.*-o \([^ ]*\).*/\1/p'`
if test -z "$file"; then
file=`echo "$*" | sed 's/.* \([^ ]*\) *$/\1/'`
file=`sed -n '/^@setfilename/ { s/.* \([^ ]*\) *$/\1/; p; q; }' $file`
fi
touch $file
;;
tar)
shift
if test -n "$run"; then
echo 1>&2 "ERROR: \`tar' requires --run"
exit 1
fi
# We have already tried tar in the generic part.
# Look for gnutar/gtar before invocation to avoid ugly error
# messages.
if (gnutar --version > /dev/null 2>&1); then
gnutar "$@" && exit 0
fi
if (gtar --version > /dev/null 2>&1); then
gtar "$@" && exit 0
fi
firstarg="$1"
if shift; then
case "$firstarg" in
*o*)
firstarg=`echo "$firstarg" | sed s/o//`
tar "$firstarg" "$@" && exit 0
;;
esac
case "$firstarg" in
*h*)
firstarg=`echo "$firstarg" | sed s/h//`
tar "$firstarg" "$@" && exit 0
;;
esac
fi
echo 1>&2 "\
WARNING: I can't seem to be able to run \`tar' with the given arguments.
You may want to install GNU tar or Free paxutils, or check the
command line arguments."
exit 1
;;
*)
echo 1>&2 "\
WARNING: \`$1' is needed, and you do not seem to have it handy on your
system. You might have modified some files without having the
proper tools for further handling them. Check the \`README' file,
it often tells you about the needed prerequirements for installing
this package. You may also peek at any GNU archive site, in case
some other package would contain this missing \`$1' program."
exit 1
;;
esac
exit 0

View File

@ -0,0 +1,99 @@
#! /bin/sh
# mkinstalldirs --- make directory hierarchy
# Author: Noah Friedman <friedman@prep.ai.mit.edu>
# Created: 1993-05-16
# Public domain
errstatus=0
dirmode=""
usage="\
Usage: mkinstalldirs [-h] [--help] [-m mode] dir ..."
# process command line arguments
while test $# -gt 0 ; do
case "${1}" in
-h | --help | --h* ) # -h for help
echo "${usage}" 1>&2; exit 0 ;;
-m ) # -m PERM arg
shift
test $# -eq 0 && { echo "${usage}" 1>&2; exit 1; }
dirmode="${1}"
shift ;;
-- ) shift; break ;; # stop option processing
-* ) echo "${usage}" 1>&2; exit 1 ;; # unknown option
* ) break ;; # first non-opt arg
esac
done
for file
do
if test -d "$file"; then
shift
else
break
fi
done
case $# in
0) exit 0 ;;
esac
case $dirmode in
'')
if mkdir -p -- . 2>/dev/null; then
echo "mkdir -p -- $*"
exec mkdir -p -- "$@"
fi ;;
*)
if mkdir -m "$dirmode" -p -- . 2>/dev/null; then
echo "mkdir -m $dirmode -p -- $*"
exec mkdir -m "$dirmode" -p -- "$@"
fi ;;
esac
for file
do
set fnord `echo ":$file" | sed -ne 's/^:\//#/;s/^://;s/\// /g;s/^#/\//;p'`
shift
pathcomp=
for d
do
pathcomp="$pathcomp$d"
case "$pathcomp" in
-* ) pathcomp=./$pathcomp ;;
esac
if test ! -d "$pathcomp"; then
echo "mkdir $pathcomp"
mkdir "$pathcomp" || lasterr=$?
if test ! -d "$pathcomp"; then
errstatus=$lasterr
else
if test ! -z "$dirmode"; then
echo "chmod $dirmode $pathcomp"
lasterr=""
chmod "$dirmode" "$pathcomp" || lasterr=$?
if test ! -z "$lasterr"; then
errstatus=$lasterr
fi
fi
fi
fi
pathcomp="$pathcomp/"
done
done
exit $errstatus
# Local Variables:
# mode: shell-script
# sh-indentation: 3
# End:
# mkinstalldirs ends here

View File

@ -0,0 +1,32 @@
FCE Ultra was developed with gcc and GNU make in mind. MSVC will probably
compile the Windows source code with a few modifications, but you'll still
need to make a project file.
Several pre-made makefiles are provided:
Makefile.beos - BeOS(with SDL and SDL_net)
Makefile.unixsdl - UN*X(FreeBSD/Linux/etc, with SDL)
Makefile.linuxvga - Linux(with svgalib)
Makefile.dos - (MS/PC/DR) DOS
Makefile.win - MS Windows 9x/Me/Xp/2000/etc.(with DirectX).
Makefile.macosx - Mac OS X(with SDL)
If you want to use Makefile.beos or Makefile.unixsdl for a cpu type other
than 80x86, you will need to remove "-DC80x86" from the defines line
and also remove "-DLSB_FIRST" if your target cpu uses MSB first ordering.
You'll also need to remove/change "-mcpu=xxx".
For the Windows port, I use MINGW32. http://www.mingw.org
To compile the DOS port, you'll need to download the DJGPP package.
Any version of gcc >=2.95.3 should compile the code without changes, BUT
the DJGPP versions of gcc have some problems:
gcc 2.95.3 sometimes breaks when compiling the code. gcc 3.0.2 seems to
produce bad code for sound.c. So, I recommend using gcc 3.0.4 for
compiling the DOS version.
Modifying the "-mcpu=i686" string in the makefiles, to optimize more effectively
for your cpu type, is a good idea.
Always do a "make -f Makefile.<platform> clean" before compiling for a
different platform or if you update via cvs and if you have stale object
files lying around.

820
branches/sdl2/changelog.txt Normal file
View File

@ -0,0 +1,820 @@
---r3017 - FCEUX 2.2.1 Released---
---September 23 2013---
23-Sep-2013 - AnS - Tracer: do not clear window log when stopping the logging
22-Sep-2013 - AnS - Tracer: the dialog window can be resized
21-Sep-2013 - AnS - Debugger: newly created Bookmarks inherit existing symbolic name by default
20-Sep-2013 - AnS - Debugger, Tracer: clicking on Symbolic names works as well as clicking on addresses
17-Sep-2013 - zeromus - fixed "Single Instance Mode"
16-Sep-2013 - AnS - PPU Viewer: added "Mask unused graphics" and "Invert the mask" checkboxes; fixed window layout when using big fonts
15-Sep-2013 - feos - Lua: added tobitstring(), memory.readword(int address1 [, int address2]), memory.readwordsigned(int address1 [, int address2]) functions
15-Sep-2013 - CaH4e3 - mapper 002 - workaround for "Top Gun" issue #621, needs testing if this broke something else; mapper 012 - added hardware dip for language select; UNIF PEC-586 - fixed render finally, added 512K cartridges suppport, TODO: PEC keyboard
13-Sep-2013 - AnS - debuggerFontSize and hexeditorFontSize can be specified in fceux.cfg
13-Sep-2013 - AnS - Debugger: "Symbolic Debug" state is now saved in global fceux.cfg instead of different .deb files
12-Sep-2013 - AnS - Tracer: added mouse wheel support
12-Sep-2013 - AnS - Tracer: clicking any address select the address; double-clicking any address brings Debugger at the address
12-Sep-2013 - AnS - Tracer: added Symbolic Debug naming by right-clicking any address
10-Sep-2013 - feos - Hexeditor: Symbolic Debug naming by right-clicking address
10-Sep-2013 - AnS - Debugger: added Symbolic Debug naming by right-clicking any address
05-Sep-2013 - AnS - Debugger: fixed Cycles counter reset when loading an earlier savestate
15-Aug-2013 - CaH4e3 - fixed bandai mapper emulation
04-Aug-2013 - AnS - Hexeditor: added "Highlighting" submenu and "Highlight Activity" feature
04-Aug-2013 - AnS - Taseditor: an experiment with somewhat different colors for HotChanges
04-Aug-2013 - AnS - Auto-disable "Game Genie ROM" feature when no "gg.rom" file is found
16-Jul-2013 - AnS - Debugger: highlight PC pointer line when a breakpoint is hit
05-Jul-2013 - AnS - RAM Search: added "Hex Editor" button and right-click
04-Jul-2013 - AnS - Debugger: added CDL data column in place of left panel. It helps to distinguish executed branches of code from not logged code
04-Jul-2013 - AnS - Debugger: clever autoscrolling when stepping/seeking to PC. It maintains relative position of the ">" pointer inside the Disassembly window
03-Jul-2013 - AnS - RAM Watch: fixed epic bug when contents of old .wch file mixed with the newly saved data because of "r+b" mode (changed it to "w+b")
03-Jul-2013 - AnS - Taseditor: Greenzone: always keep Greenzone.lagLog in touch with history.currentSnapshot.laglog (fixes workflow with "Auto-adjust" disabled)
03-Jul-2013 - AnS - Tracer: only output "from $XXXX" when the subroutine was called by JSR (fixes possible errors in those cases when the subroutine was called using stack magic)
03-Jul-2013 - AnS - Debugger: do not reload ram.nl every time automatically
21-Jun-2013 - CaH4e3 - PPU Viewer: when CDLogger is on, display unused graphics in a dim palette
15-Jun-2013 - AnS - Movie recording: fixed bug when emulator allowed recording commands outside the range of FM2 specs
15-Jun-2013 - AnS - Movie recording: added ability to record "Insert coin" command (for VS games)
15-Jun-2013 - AnS - Movie recording: remember last Author name when creating a new movie
08-Jun-2013 - AnS - A couple of fixes which deal with "multiple ROMs in a single archive" case. The loading procedure now takes into account actual ROM name when loading ROM from an archive containing multiple files. This affects PAL/NTSC detection (in case there were ROMs of different regions inside a single zip). Also, "auto-resume play" now loads actual ROM on startup (instead of prompting a list of archived files to choose). Also, NL files (symbolic debug) are named correctly when debugging a ROM from such an archive, etc.
08-Jun-2013 - AnS - Hexeditor: fixed bugs when saving files while working with ROMs in archives
27-May-2013 - AnS - Hexeditor: specify Data bank condition when adding a Breakpoint by context menu
26-May-2013 - AnS - Debugger: added 'T' condition (checks the bank of the data accessed)
26-May-2013 - AnS - Win32: fixed storing and loading .deb files when working with archived ROMs
26-May-2013 - AnS - new Lua functions: debugger.hitbreakpoint(), debugger.getcyclescount(), debugger.getinstructionscount(), debugger.resetcyclescount(), debugger.resetinstructionscount()
26-May-2013 - AnS - Win32: when no script is currently running, Shift+L loads the most recent Lua script
26-May-2013 - CaH4e3 - fixed mapper 183
14-May-2013 - CaH4e3 - fixed mapper 253
13-May-2013 - CaH4e3 - mapper 43
09-May-2013 - AnS - Video config: changed "Disable hardware acceleration" option to a drop-down list with 3 options: a) No hardware acceleration; b) Create surface in RAM; c) Hardware acceleration. Because it appears that some video cards still blur textures even when stored in RAM.
29-Apr-2013 - AnS - added checking if archive file has any files in it, because new 7z.dll confuses FDS files with archives (it recognizes the first "F" as a signature of an archive)
19-Apr-2013 - AnS - Video config: added "Square pixels" option
19-Apr-2013 - AnS - Video config: added aspect ratio fields for customizing "TV Aspect" ratio, by default it's 4:3
17-Apr-2013 - AnS - "Auto-resume old play session" now also works with NSFs
17-Apr-2013 - zeromus - properly savestate NSF
17-Apr-2013 - zeromus - add missing mmc5 savestate variables
16-Apr-2013 - AnS - Tracer: added "Log Cycles count" and "Log Instructions count" options
13-Apr-2013 - AnS - Debugger: scrolling up/down by whole instructions
12-Apr-2013 - gocha - Lua: fix wrong frequency calculation in sound.get()
07-Apr-2013 - AnS - Taseditor: comply with Lua movie.rerecordcounting() setting
01-Apr-2013 - CaH4e3 - mapper 154 - fixed
26-Mar-2013 - CaH4e3 - mapper 53 - supported ines format of SUPERVISION UNIF board; UNIF 8157 - fix according to hw; UNIF T-262 - fix according to hw
24-Mar-2013 - CaH4e3 - UNIF DANCE2000 - now emulated properly
20-Mar-2013 - gocha - link to lua51.dll instead of static linking
19-Mar-2013 - zeromus - bring some improvements to newppu from bizhawk, and fix vtoggle5/6 back to vtoggle
19-Mar-2013 - zeromus - fix mapper 28
17-Mar-2013 - AnS - Replay: removed redundant window update when using "Browse" (fixes #585)
17-Mar-2013 - CaH4e3 - UNIF DSOUNDV1 - removed due to duplicate of 178 mapper; mapper 178 - added more features of 8/16M carts with 32K SRAM; UNIF 09-034A - added support for a new SMB2j Lite version
14-Mar-2013 - AnS - Debugger: ported "smart scrolling" from an obscure version of FCEUXD 1.1
14-Mar-2013 - CaH4e3 - palette ram reading fix for old ppu
---r2869 - FCEUX 2.2.1 Released---
---March 10 2013---
10-Mar-2013 - prg - SDL: added option to use system minizip
10-Mar-2013 - prg - updated to use minizip v1.2.7
10-Mar-2013 - CaH4e3 - CDLogger: improved CHR logging, now it also logs the data when using Old PPU
02-Mar-2013 - AnS - Hexeditor: fixed ROM coloring when using CDLogger data
28-Feb-2013 - AnS - PPU/PAL/Input type changing is now disabled when a movie is playing
28-Feb-2013 - AnS - Cheats: update the window when ROM is changed
28-Feb-2013 - AnS - show the number of active cheats when a ROM is loaded
27-Feb-2013 - CaH4e3 - CDLogger: added "Auto-load .CDL when opening the window" option
27-Feb-2013 - CaH4e3 - MMC5 refixed
24-Feb-2013 - AnS - CDLogger: added "Auto-save .CDL when closing ROMs" and "Auto-resume logging when loading ROMs" options
23-Feb-2013 - AnS - Hexeditor: show symbolic names in the window caption
18-Feb-2013 - CaH4e3 - various mapper improvements; UNIF MALISB - Mali Splash Bomb dump; mapper 19 - Dream Master mirror fix
18-Feb-2013 - CaH4e3 - fixed mapper 69 low quality sound issue
11-Feb-2013 - AnS - fixed possible crash when saving the ROM in Hex Editor
11-Feb-2013 - AnS - Moved "Config->Game Genie" to "Config->Enable->Game Genie ROM"
03-Feb-2013 - AnS - win32: speed up screen blitting
02-Feb-2013 - AnS - Added "TV Aspect (4:3)" to Video Config
21-Jan-2013 - AnS - Taseditor: fixed Bookmarks List height on Windows 7
21-Jan-2013 - AnS - Taseditor: fixed bug with adding new item to History Log
20-Jan-2013 - AnS - Taseditor: changed the logic by which the Piano Roll follows Playback cursor, now it doesn't follow it while seeking
15-Jan-2013 - AnS - Lua: removed "shadow pixels" from gui.text(), made gui.parsecolor() function available for users
10-Jan-2013 - AnS - Taseditor: Config->Project file saving options
01-Jan-2013 - zeromus - NameTableViewer: do something reasonable if a 4-screen, table2, table3 mirror mode is chosen when the corresponding nametable ram is not available on the cart (instead of crashing)
31-Dec-2012 - CaH4e3 - fixed mappers 24, 26, 115
29-Dec-2012 - AnS - Taseditor: Changed "Compact save" dialog, added 4 options of Greenzone saving
29-Dec-2012 - AnS - Cheats: added "Add from CHT file..." button
29-Dec-2012 - AnS - win32: force the entire client area to be invalidated at the beginning of WM_PAINT; this fixes the rare bug with DIRECTDRAWCLIPPER sometimes calculating wrong region (was noticed on some video cards)
27-Dec-2012 - AnS - Play movie dialog shows New PPU in red if the required setting does not match
27-Dec-2012 - thezlomus - RAM Search: added "Search ROM" checkbox
19-Dec-2012 - AnS - win32: remodel "Video config" dialog
19-Dec-2012 - AnS - win32: fixed restoring maximized window after switching from fullscreen
18-Dec-2012 - CaH4e3 - fixed mapper 018 and 198
15-Dec-2012 - AnS - win32: added Config->Enable->Auto-resume old play session
13-Dec-2012 - AnS - win32: added Emulation Speed->Set custom speed for FrameAdvance
13-Dec-2012 - AnS - win32: added NES->Emulation Speed->Set FrameAdvance Delay
13-Dec-2012 - AnS - win32: added NES->Emulation Speed->Set Custom Speed
12-Dec-2012 - CaH4e3 - finish with mapper to boards conversion
07-Dec-2012 - CaH4e3 - Tracer: fixed RAM-located code logging when CDLogger options are enabled
05-Dec-2012 - AnS - fixed zapper and mouse positioning in fullscreen
04-Dec-2012 - AnS - speed up HUD text drawing
04-Dec-2012 - AnS - Taseditor: speed up consecutive Recordings (when combining)
03-Dec-2012 - AnS - Taseditor: fixed accelerators when editing Notes
03-Dec-2012 - AnS - fixed "X" button in the "Enter New Input" dialog (Hotkey Mapping); changed "Cancel" button to "OK"
03-Dec-2012 - CaH4e3 - fixed mapper 99
29-Nov-2012 - zeromus - fix "you ling xing dong" by assigning to mapper 192
---r2768 - FCEUX 2.2.0 Released---
---November 27 2012---
24-Nov-2012 - AnS - when the New PPU is on, it displays "(NewPPU)" in the window caption
20-Nov-2012 - AnS - Taseditor: added "Ungreenzone" item to context menu; added "Config->Enable Greenzoning"
13-Nov-2012 - AnS - Taseditor: changed fm3 format to version 3
10-Nov-2012 - AnS - win32 hotkeys mapping: added the condition that both commands must have the same EMUCMDFLAG_TASEDITOR, or else they are not considered conflicting
10-Nov-2012 - AnS - win32 hotkeys: disallow unwanted hits of e.g. F1 after pressing Shift+F1 and quickly releasing Shift
05-Nov-2012 - zeromus - support mapper 028
05-Nov-2012 - AnS - Taseditor: fixed lag adjustments when dealing with previously unknown lag state
30-Oct-2012 - zeromus - default stack pointer to $FD instead of $FF
29-Oct-2012 - CaH4e3 - mapper 252 added
29-Oct-2012 - AnS - Taseditor: update RAM Search and RAM Watch when jumping causes game state to change
21-Oct-2012 - CaH4e3 - sync mappers with fceu-mm
30-Sep-2012 - AnS - added "(Europe)" and "(PAL)" strings to region detection
28-Sep-2012 - AnS - Hexeditor: Ctrl+F opens Find dialog
28-Sep-2012 - AnS - Hexeditor: display 0x5000-0x5FFF contents
28-Sep-2012 - AnS - Tracer: fixed crash when logging undefined opcodes
26-Sep-2012 - AnS - Debugger: "Name" button in Bookmarks, total revamp of Bookmarks
26-Sep-2012 - AnS - Debugger: single click on any address copies this address to the "Seek To" field and "Bookmark Add" field
26-Sep-2012 - AnS - Fixed replay engine bug that doubles the last input of the movie
26-Sep-2012 - AnS - Tracer: "RTS" instructions now output the subroutine address/name
23-Sep-2012 - AnS - Lua: clear previous frame drawings at the beginning of every frame
23-Sep-2012 - AnS - Debugger: fixed mouseover when using Symbolic debug; mouseover works for the disassembly window too
23-Sep-2012 - CaH4e3 - CDLogger: Now can log VROM access (CHR banks of the ROM) when NewPPU is enabled
22-Sep-2012 - AnS - Tracer: added "Symbolic trace", "Log current Frame number", "Log emulator messages", "Log breakpoint hits" options
11-Sep-2012 - AnS - new Lua function: emu.setlagflag()
11-Sep-2012 - AnS - Debugger: deleting a breakpoint leaves selection in the Breakpoints list
06-Sep-2012 - AnS - added "Use Custom Palette" checkbox to Palette config
06-Sep-2012 - AnS - Debugger: special strings (NMI/IRQ/etc) can be also used in "Seek To" field and Bookmarks
01-Sep-2012 - AnS - fixed movie savestates logic, loading post-movie savestates is not allowed in read-only
31-Aug-2012 - zeromus - update mapper 156 from fceu-mm sources
30-Aug-2012 - AnS - fixed savestates filenaming bug when working with a movie
29-Aug-2012 - AnS - added "Force Grayscale" checkbox to Palette config
26-Aug-2012 - AnS - Taseditor: History Log highlights items related to current item
25-Aug-2012 - AnS - Taseditor: fixed AdjustLag feature and changed fm3 version to v2
22-Aug-2012 - AnS - added "Clear" button to Message Log
20-Aug-2012 - AnS - "Switch fullscreen by double-click" option in GUI config
20-Aug-2012 - AnS - "Hide mouse cursor" and "Use console BG color for empty areas" options
20-Aug-2012 - AnS - total revamp of Video config stuff, Best Fit also works for fullscreen mode
19-Aug-2012 - AnS - win32: "Maintain aspect ratio (best fit)" option in Video config
12-Aug-2012 - AnS - Debugger: "Display ROM offsets" option
12-Aug-2012 - AnS - Debugger: double-click breakpoint also adds current bank number to breakpoint condition
12-Aug-2012 - AnS - Added FPS display to Win32 port (Config->Display->FPS)
10-Aug-2012 - prg - gtk: reset video on video dialog close
10-Aug-2012 - prg - gtk: add gui option for showfps
10-Aug-2012 - prg - sdl: add runtime option for controling drawing fps (SDL.ShowFPS)
10-Aug-2012 - prg - core: move showfps from build option to runtime option
10-Aug-2012 - prg - sdl: fix and enable SHOWFPS build option (TODO: make runtime option)
10-Aug-2012 - AnS - Debugger: "Address Bookmark Add" field follows disassembly window scrolling position
08-Aug-2012 - AnS - Taseditor: frame counter display is auto-on when Taseditor launches
08-Aug-2012 - AnS - Debugger: improved stack display
08-Aug-2012 - AnS - Debugger: doubleclick on the disassembly prompts "Add Execute breakpoint" dialog
08-Aug-2012 - AnS - Debugger: fixed RAM peek by a rightclick on left pane
08-Aug-2012 - AnS - Debugger: ">" points at current line in disassembly
08-Aug-2012 - AnS - Debugger: show the number of breakpoints (enabled and total) above the breakpoints list
06-Aug-2012 - CaH4e3 - fixed bug when loading UNF games (#525 )
06-Aug-2012 - AnS - Tracer also updates its window when user pauses the game, not just when Debugger snaps
06-Aug-2012 - AnS - Tracer: added "Use Stack Pointer for code tabbing" option and added "To the left from disassembly text" option
05-Aug-2012 - AnS - Debugger: .DEB file now also stores the state of "Break on Bad Opcode" and "Break when exceed" checkboxes/editfields
05-Aug-2012 - AnS - Debugger: added "CPU cycles" and "Instructions" counters (request #527) and added "Break when exceed" breakpoints
05-Aug-2012 - AnS - Debugger: window layout cleanup
06-Aug-2012 - prg - gtk: added hotkey gui config
04-Aug-2012 - prg - all: updated FSF address
04-Aug-2012 - prg - sdl: added SDL.Input.EnableOppositeDirectional option. allows/disallows simultaneous right+left / up+down.
03-Aug-2012 - AnS - Debugger: highlighting breakpoint item in BPs list when it's triggered
03-Aug-2012 - AnS - Debugger: allow Frame Advancing when Debugger is in breakpoint state
03-Aug-2012 - AnS - Debugger: don't update Debugger window at the beginning of Step command (it will update at at the end of Step) - fixes #528
25-Jul-2012 - AnS - Taseditor: auto-starting Note editing when creating Marker by double-click
19-Jul-2012 - AnS - Taseditor: Lua registermanual allows changing the "Run function" button caption; Markers are always restored when deploying Bookmarks
01-Jul-2012 - AnS - new hotkey "Run Manual Lua function"
24-Jun-2012 - AnS - Taseditor: drawing selected_slot border in Branches Tree
24-Jun-2012 - zeromus - add ability for CNROM games to choose whether they have bus conflicts (fixes Colorful Dragon (Unl) (Sachen), since it flakes out if bus conflicts are emulated)
23-Jun-2012 - zeromus - add m116 from fceu-mm; fix mapper 178 big PRG support
20-Jun-2012 - zeromus - fix savestate engine to throw errors when a buggy SFORMAT is passed to AddExState, and fix those errors in m015 and m253
19-Jun-2012 - AnS - added TASEDITOR type of hotkeys
19-Jun-2012 - AnS - Taseditor: 2 new hotkeys: "Switch Auto-restoring" (Ctrl+Spacebar), "Switch current Multitracking mode" (W)
16-Jun-2012 - AnS - Taseditor: drawing patterns with Alt held; no more row_last_clicked
15-Jun-2012 - AnS - Taseditor: added "rewatch from Selection to Playback" feature for Ctrl+middle click action
14-Jun-2012 - AnS - Taseditor: combining consecutive AdjustLag operations
13-Jun-2012 - AnS - Taseditor: truncated Greenzone is drawn by pale colors, not just white
12-Jun-2012 - AnS - Taseditor: "Auto-adjust Input due to lag" checkbox
11-Jun-2012 - AnS - Taseditor: green arrow doesn't disappear when Playback cursor goes through it
11-Jun-2012 - AnS - Taseditor: changed icons column in Piano Roll, now can show both Bookmark and arrow
09-Jun-2012 - zeromus - win32-support funny languages for opening roms, through drag&drop, at least
06-Jun-2012 - AnS - Taseditor: small fix for Branches Tree - among bookmarks with equal jump_frame the cursor must be pointing at current branch
06-Jun-2012 - zeromus - support mapper 176. mapper 176 no longer maps to BMCFK23C. BMCFK23C is still accessible through crc or unif? test case would be welcome. it is unclear to me why mapper 176 control was removed from 176.cpp and given to BMCFK23C
06-Jun-2012 - AnS - Taseditor: autosave works only when project has a filename
26-May-2012 - AnS - Taseditor: Ctrl+Space accelerator = toggle "Auto-restore last position" checkbox; remapped "Restore Playback" hotkey to Spacebar; "Restore Playback" also pauses seeking; mid-click = "Restore Playback" when possible
08-May-2012 - AnS - Taseditor: changed "lost_position" logic
01-May-2012 - AnS - Lua functions emu.pause() and emu.unpause() don't yield and don't reset emulator speed anymore
30-Apr-2012 - AnS - Taseditor: Ctrl + mid click = run to Selection cursor; Shift + mid click = run to nearest Marker
26-Apr-2012 - AnS - Taseditor: fixed filename logic when user creates project from an fm2 or a corrupted fm3
23-Apr-2012 - AnS - Taseditor: menus overhaul
19-Apr-2012 - AnS - RAM Watch: fixed loading Data Size and Data Type from a .wch, now corrupted .wch won't crash
17-Apr-2012 - zeromus - fix bug in mapper 164 savestates which caused wram to be lost, also make mapper 164 sram work
17-Apr-2012 - AnS - Taseditor: gradual History Log autocompression when idle
14-Apr-2012 - zeromus - add hash database entry for Rasaaru Ishii no Childs Quest (J), whose extant roms specify both the wrong mapper and the wrong mirroring
14-Apr-2012 - zeromus - change mapper 12 (mmc3 variant) to specify MMC3A chip version
14-Apr-2012 - AnS - Taseditor: rightclicks in Branches Tree
14-Apr-2012 - AnS - "Play Movie" dialog doesn't search in fceux root folder anymore
10-Apr-2012 - AnS - bold items in some context menus
10-Apr-2012 - zeromus - fix mapper 115 (actually to fix mapper 248 for Bao Qing Tian)
09-Apr-2012 - zeromus - remove vram protection from mapper 227
09-Apr-2012 - AnS - Taseditor: all GUI buttons fire off at mousedown; disabled Spacebar and enabled Middle mouse button on GUI buttons
09-Apr-2012 - AnS - Taseditor: clicks in Branches Tree
07-Apr-2012 - AnS - Taseditor: version data in fm3
07-Apr-2012 - AnS - Taseditor: much better way of calculating Branches Tree; hinting full timelines; miniarrow showing current Playback cursor position in Branches Tree; "Bookmark#" modtype, undo/redo works for Bookmarks
07-Apr-2012 - AnS - Taseditor: applying PAL and PPU flags when loading projects
05-Apr-2012 - zeromus - fix mapper 242 (dragon quest 8 UNL)
26-Mar-2012 - AnS - Taseditor: Alt+Wheel = jump across gaps in Input/Markers
25-Mar-2012 - AnS - returned default mapping of Frame Advance hotkey to Backslash
25-Mar-2012 - AnS - Taseditor: BookmarksList clicks apply on buttonup only
22-Mar-2012 - AnS - Config->Combine consecutive Recordings/Draws
18-Mar-2012 - AnS - new hotkey "Cancel Seeking (TAS Editor)" (Esc)
18-Mar-2012 - AnS - Taseditor: Config->Autopause at the end of Movie
17-Mar-2012 - CaH4e3 - varous bugfixes, xstring trimming functions logic bugs, etc
17-Mar-2012 - AnS - Taseditor: showing row_last_clicked when Shift or Alt is held
17-Mar-2012 - AnS - Taseditor: no more "allow keys in Piano Roll"; new accelerators: Ctrl + arrows, Shift + arrows, Home/End/Page Up/Page Down, Ctrl + Home/End, Shift + Home/End
17-Mar-2012 - AnS - Taseditor: selection by dragging from Frame#
17-Mar-2012 - AnS - Taseditor: set/pick Markers by doubleclick, throw Markers away
14-Mar-2012 - AnS - Taseditor: drawing input; holding Shift when drawing
14-Mar-2012 - AnS - Taseditor: fixed known WinXP bug with scrollbar arrows
14-Mar-2012 - AnS - Taseditor: moving Markers by drag'n'drop, "Marker Drag" and "Marker Swap" operations
14-Mar-2012 - AnS - Taseditor: dragging blue arrow (moving Playback cursor)
14-Mar-2012 - AnS - Taseditor: observing Piano Roll by dragging cursor outside
11-Mar-2012 - AnS - Taseditor: double-tapping Shift/Ctrl scrolls Piano Roll to respective cursor
09-Mar-2012 - AnS - Taseditor: Config->Deselect on doubleclick
09-Mar-2012 - AnS - Taseditor: checking ROM checksum when saving/loading projects
09-Mar-2012 - AnS - Taseditor: TAS Editor can have mouse wheel input even when keyboard focus is on FCEUX window
09-Mar-2012 - AnS - disabled FCEUX context menu when TAS Editor is engaged
06-mar-2012 - prg - fceux no longer segfaults when opening gamepadconfig with GTK < 2.24 - a message is printed to the console
06-mar-2012 - prg - supports loading of configuration files in $FCEUXDIR/cfg.d/*
01-Mar-2012 - AnS - Taseditor: changing history size doesn't reset history
28-feb-2012 - AnS - Taseditor: "Deselect" option in menus
26-feb-2012 - AnS - Small save/load state speedup, noticeable only in TAS Editor or lua bots
21-feb-2012 - AnS - Taseditor: header lights on mouseover
21-feb-2012 - AnS - Taseditor: registering click at buttondown; Alt+click on input = set pattern
20-feb-2012 - AnS - Taseditor: Right button + wheel = Playback rewind/forward; Shift/Ctrl + wheel = jump via Markers with Playback/Selection cursor
20-feb-2012 - AnS - Taseditor: middle button pauses/unpauses emulation
18-feb-2012 - AnS - PATTERNS menu, loading data from "tools\taseditor_patterns.txt"
18-feb-2012 - AnS - "Use pattern" checkbox in Recorder; Config->ColumnSet Pattern skips Lag
18-feb-2012 - AnS - Taseditor: "Frame#" lights when Alt key is being held, not entering menu by Alt
18-feb-2012 - AnS - Changed some checkboxes to radiobuttons in FCEUX menu
13-feb-2012 - AnS - Taseditor: when clicking text fields, Piano Roll scrolls to corresponding Marker, not to cursor
13-feb-2012 - AnS - Replay dialog speedup, now movie is not loaded into memory when checking md5
06-feb-2012 - AnS - new Lua scripts: SoundDisplay.lua, TrackNoise.lua
06-feb-2012 - AnS - refined Recording, now can safely record commands (Power, Reset, Insert, Switch)
02-feb-2012 - AnS - uploaded HelpNDoc3 project file
02-feb-2012 - AnS - added Lua scripts demonstrating some TAS Editor library functions
02-feb-2012 - AnS - new Lua function in TAS Editor library: getsuperimpose()
02-feb-2012 - AnS - new Lua function in Joypad library: getimmediate()
30-jan-2012 - AnS - Taseditor: 9 new Lua functions in TAS Editor library
30-jan-2012 - AnS - Taseditor: Added "Restore Playback (TAS Editor)" hotkey (Enter by default)
30-jan-2012 - AnS - Taseditor: Help->Show Tooltips
30-jan-2012 - AnS - Taseditor: quicksave/quickload hotkeys save/load current branch
23-jan-2012 - prg - sdl: pause will now show/ungrab cursor in fullscreen. this can be disabled with the SDL.NoFullscreenCursor option
12-jan-2012 - AnS - Tasedit: File->New Project, INPUT_TYPE_1P
12-jan-2012 - AnS - Tasedit: resizing TAS Editor window
08-jan-2012 - prg - sdl: switched advance one frame key from "\" to "`"
08-jan-2012 - AnS - changed default mapping of Frame Advance to Tilde
08-jan-2012 - AnS - fixed recording bug where "length" tag appeared in fm2s
08-jan-2012 - AnS - Tasedit: Lua panel; 5 new Lua functions
08-jan-2012 - AnS - Tasedit: refactoring; Config->Silent autosave
04-jan-2012 - AnS - Tasedit: colored marker captions; pale yellow and bright yellow when "Bind Markers" is off/on
27-dec-2011 - AnS - Tasedit: "About" window
27-dec-2011 - AnS - Tasedit: searching Markers with similar Notes ("Similar" and "More" buttons)
26-dec-2011 - AnS - Tasedit: Find Note dialog (Ctrl-F)
26-dec-2011 - AnS - new Lua functions (TAS Editor library)
19-dec-2011 - AnS - Tasedit: listview header lights
19-dec-2011 - AnS - Tasedit: Recording checkbox instead of radiobutton; Config->Use Input keys for ColumnSet
19-dec-2011 - AnS - Tasedit: Export dialog: "Convert Marker Notes to Movie Subtitles"
16-dec-2011 - AnS - Tasedit: new accelerators: Ctrl-PgUp/Ctrl-PgDn/Shift-PgUp/Shift-PgDn; Config->Allow keyboard controls in Listview
16-dec-2011 - AnS - Tasedit: View->Display Branch Tooltips
16-dec-2011 - AnS - Tasedit: Markers notes; View->Follow Marker Note context
16-dec-2011 - AnS - changed ".tas" extension to ".fm3"
10-dec-2011 - AnS - loading TAS Editor projects by drag-n-drop
10-dec-2011 - AnS - Tasedit: File->Save Compact dialog
09-dec-2011 - AnS - Replaying TAS Editor project files in FCEUX (win32 and SDL)
07-dec-2011 - AnS - disabled changing PPU/PAL/input_type when Taseditor is engaged
07-dec-2011 - AnS - Tasedit: File->Recent projects
07-dec-2011 - AnS - enhanced Reload hotkey (Ctrl-F1), now it loads last ROM or last TAS Editor project
05-dec-2011 - AnS - Tasedit: Import input, Export to FM2
04-dec-2011 - AnS - Tasedit: branches autofind best parent, "Set Marker"/"Remove marker" in context menu, checking clipboard at selection.init() and retrieving info
29-nov-2011 - AnS - Tasedit: MsgBox about not working with movies starting from savestate
26-nov-2011 - aquanull - win32: fixed graphic-tearing WITH vertical sync enabled in windowed mode. It used to wait for V-Blank too early so that the V-Blank would end too soon before the blitting could be finished.
26-nov-2011 - AnS - Fixed crash when using machine with no sound card
26-nov-2011 - zeromus - Fixed wrong default palette entry
25-nov-2011 - zeromus - add nestopia palette files
25-nov-2011 - AnS - Tasedit: selection << and >>, Turbo Seek checkbox, PasteInsert, Config->Superimpose affects copy/paste, Editing info texts
23-nov-2011 - zeromus - fix [3441099] printf bug in SwapSaveState()
21-nov-2011 - AnS - Tasedit: multitrack recording, "Superimpose" checkbox, Config->Use 1P keys for all single recordings, Config->Combine consecutive Recordings
19-nov-2011 - AnS - Tasedit: selection strobe, soft reset and power switch messages, messages when saving/loading Branches
17-nov-2011 - AnS - Tasedit: selection history, undo/redo, Reselect Clipboard, saving/loading selection history to .tas
17-nov-2011 - AnS - Tasedit: input hotchanges
14-nov-2011 - zeromus - straighten out bandai m159/m016 handling and add valid null-EEPROM emulation to get those games booting.
12-nov-2011 - adelikat - win32 - cheat search - slight GUI tweak
12-nov-2011 - AnS - Tasedit: project autosaving
10-nov-2011 - AnS - Tasedit: Branches show saved screenshot on mouseover (alpha-fade popup window)
7-nov-2011 - AnS - Tasedit: Drawing Branches Tree (using GDI), animations, transitions, mouseover
04-nov-2011 - prg318 - gtk: added option for frameskipping and made label case consistent in gui
1-nov-2011 - zeromus - debugger - fix mysterious out of bounds condition while editing breakpoints
31-oct-2011 - zeromus - add winapi lua library
31-oct-2011 - zeromus - fix newppu bug; chr ram was not getting initialized to anything
28-oct-2011 - AnS - Switching Tasedit Bg input on/off when Tasedit gets/loses focus
27-oct-2011 - AnS - "Toggle Rerecord Display" hotkey (M), "Play Movie From Beginning" hotkey also works in Tasedit
27-oct-2011 - AnS - Tasedit: Bookmarks/Branches
23-oct-2011 - prg318 - sdl: fix a bug where alt key would get "stuck" when alt tabbing to window
21-oct-2011 - AnS - Tasedit: gradual greenzone cleaning
19-oct-2011 - prg318 - scons: "scons install" now installs auxlib and manpage
19-oct-2011 - prg318 - scons: added --prefix option to build system and improved "install" target
18-oct-2011 - prg318 - sdl: new hotkeys added - statestatenext savestateprev - useful for scrolling through savestates on a gamepad. mapped to pgup and pgdown by default
18-oct-2011 - prg318 - gtk: new video option for double buffering and ClipSides
18-oct-2011 - prg318 - sdl: GTK3 support is now functional. Set GTK3 to 1 in the SConstruct to try it out.
18-oct-2011 - prg318 - no longer use depreciated gtk2 functions
18-oct-2011 - prg318 - getSDLKey tool added to assist in remapping hotkeys
17-oct-2011 - prg318 - some segfaults fixed, also fixed some build errors
17-oct-2011 - prg318 - sdl netplay fixed
15-oct-2011 - zeromus - don't lose cheat compare value when toggle cheat enables through UI
14-oct-2011 - AnS - added rewind hotkey (~), works only in Taseditor
14-oct-2011 - AnS - Tasedit: execute lua functions when jumping inside greenzone
13-oct-2011 - AnS - Tasedit: major refactoring
9-oct-2011 - AnS - Tasedit: input history, undo, redo; greenzone reduces only from the point where actual differences were found
07-oct-2011 - prg318 - sdl: fixed some issues with --nogui . "--nogui" no longer requires an argument and can be used like this "$ fceux --nogui rom.nes"
07-oct-2011 - prg318 - gtk: support mouseclicks (ie zapper)
03-oct-2011 - AnS - Tasedit: Clone Frame(s)
02-oct-2011 - AnS - Tasedit: Markers
30-sept-2011 - AnS - logging all display messages to Message Log
30-sept-2011 - AnS - Tasedit: special method of inserting frames; progressbar updating when loading/saving large projects; moved "Follow cursor" checkbox from View menu to main TASEdit window
30-sept-2011 - AnS - Tasedit: View->Show dot in empty cells; ClearFrames (Del), Cut operation clears frames instead of deleting; checking unsaved project on Exit and Open project
28-sept-2011 - CaH4e3 - resetexstate crash fix
27-sept-2011 - AnS - Fixed old bug with "Play Movie From Beginning"
26-sept-2011 - AnS - added support for "Enable HUD recording" option to SDL version
25-sept-2011 - AnS - Tasedit: progressbar; holding "<" and ">" buttons
25-sept-2011 - zeromus - newppu-fix bug in scroll reg logic causing mis-scrolls in p'radikus conflict
24-sept-2011 - CaH4e3 - latest mapper changes; code/data logger now can log data access from the RAM code; the new button to save unused data to the code/data logger
24-sept-2011 - AnS - Tasedit: changed control scheme to single click instead of double click
23-sept-2011 - AnS - File->AVI/Wav->Enable HUD recording
23-sept-2011 - AnS - moved "Display movie status icon" from Config->Movie options to Config->Display
23-sept-2011 - AnS - Config->Display->Rerecord counter; no more TweakCount
23-sept-2011 - AnS - Config->Movie options->Always suggest Read-Only replay (for Replay dialog)
22-sept-2011 - AnS - deleted "Lag Counter Reset" hotkey; added "Open TAS Edit" hotkey
22-sept-2011 - AnS - fixed long "savestate" messages containing path
22-sept-2011 - AnS - Tasedit: auto clear "Disable speed throttling" and "Run in background", auto set "Set high-priority thread" when entering TASEdit; FCEUX runs in bg when TASEdit has focus; Config->"Mute Turbo" check
19-sept-2011 - AnS - Tasedit: accelerator table; Config->"Set greenzone capacity"; pauseframe is shown by flashing color
18-sept-2011 - zeromus - datalatch mapper-fix bug where wramless games would be able to do something mysterious to unmapped host emulator memory
17-sept-2011 - AnS - Tasedit: forced read-only behaviour when seeking or holding turbo
17-sept-2011 - AnS - Tasedit: "Auto-restore last position" checkbox in playback controls
17-sept-2011 - AnS - Tasedit: fixed item drawing method, no more flicker and slowdowns
12-sept-2011 - prg318 - sdl: rename InputType to CurInputType due to variable of same name in src/movie.h
12-sept-2011 - AnS - Tasedit: rewrote project save/load functions, various bugfixes
6-sept-2011 - AnS - Tasedit: red lines for lag frames
6-sept-2011 - AnS - fixed bug when trying to open Replay dialog without having ROM loaded
3-sept-2011 - AnS - Tasedit: tweaks and bugfixes
3-sept-2011 - CaH4e3 - fixed bus conflict emulation, no kage no densetsu bug anymore
31-Aug-2011 - AnS - Tasedit: Added 4 pads support; also now current frame is shown by blue line; minor cleanups
30-Aug-2011 - mart0258 - Ram Search updates list when emulator is paused (on Power, or when resetting search)
25-Aug-2011 - zeromus - win32: fix context menus to use rightclicks in context menus correctly
19-Aug-2011 - CaH4e3 - PAL/NTSC noise fixed
18-Jul-2011 - zeromus - slightly improve hud text rendering wrapping
16-Jul-2011 - adelikat - Add Button Count lua script written by Brandon Evans
15-Jul-2011 - prg318 - sdl: patch to resolve 'XKeysymToString' complication errors on debian sid and osx (thanks antonio ospite!)
6-Jul-2011 - plombo - sdl: fixed --nogui option and removed SDL.NoGUI from fceux.cfg
5-Jul-2011 - FatRatKnight - Lua console now gets the proper file path when selecting a file from the recent menu.
---r2206 - FCEUX 2.1.5 Released---
---June 21 2011---
16-Jun-2011 - zeromus - win32: poll hotkeys while no rom is loaded
1-jun-2011 - prg318 - sdl - print usage when --help is passed even if SDL fails
plombo - added stock icons to menu items
plombo - added new gamepad configuration dialog
19-mar-2011 - prg318 - gtk - added hard reset option (renamed reset->soft reset)
18-mar-2011 - prg318 - sdl - removed GTK_LITE; --nogui made it obsolete
12-feb-2010 - mart0258 - Fix input selection for Famicom Expansion port
25-jan-2010 - prg318 - gtk - filechooser now remembers last file opened
25-jan-2010 - prg318 - gtk - fixed xscale/yscale spinbuttons not changing config
24-jan-2010 - prg318 - gtk - game window integrated into sdl window (thanks bryan!)
11-nov-2010 - mart0258 - TasEdit - Invalidate greenzone when re-recording earlier portions of a movie.
09-oct-2010 - zeromus - fix bug in new ppu that made some intensify bits not get applied to output (fixes flashing siren screen in werefolf
09-oct-2010 - gocha - win32 - Ram Watch - fix the multiple selection of watches
09-oct-2010 - gocha - Win32 - Ram Search - multiple selection of addresses, fix restoration of the selection range
09-oct-2010 - gocha - Win32 - Ram Search - fix restoration of the selection range
01-oct-2010 - qeed - Fix many segfaults related to file handling
22-sept-2010 - adelikat - win32 - Hex Editor - ask before removing all bookmarks
04-sept-2010 - adelikat - Win32 - Ramwatch - fix displaying of 2 byte values
26-aug-2010 - mart0258 - Win32 - fix crash when re-opening debugging window
20-aug-2010 - adelikat - Win32 - Display movie name at the top of the main window
09-july-2010 - mart0258 - TasEdit - cleanup; prevent crash when truncating while turbo
13-june-2010 - adelikat - Win32 - avi capture commandline argument and related parameters
12-june-2010 - adelikat - Save Turbo frame skip amount to config so that it can be customized by user
12-june-2010 - adelikat - Lua - fix speed.mode() so that normal turns off turbo
12-june-2010 - CaH4e3 - Fix Young Indiana Jones Chronicals
10-june-2010 - Deign - Fix Ram Search to only display valid RAM addresses (0000-07FF and 6000-7FFF)
10-june-2010 - zeromus - add luasocket to built in lua library
09-june-2010 - adelikat - Movies - Fixed read-only loadstate error logic & messages
07-june-2010 - mart0258 - Movie loading now faster - TAS savestates moved from class MovieRecord to class MovieData
07-june-2010 - adelikat - Lua - new function: gui.screenshotas()
07-june-2010 - Deign/adelikat - Win32 - Added a SavestateAs Menu item
06-june-2010 - FatRatKnight - Added a return value to gui.text: The X position where the function would paint the next character.
02-june-2010 - adelikat - Win32 - Movie Options Dialog - Fix so Full Savestate Load checkbox is updated on load
---r1984 - FCEUX 2.1.4a Released---
---June 1 2010---
01-june-2010 - zeromus - fix crash bug in fcm convert
01-june-2010 - adelikat - fix logic error in read-only loadstate of movies, should not improperly report savestate after movie errors
---r1977 - FCEUX 2.1.4 Released---
---May 31 2010---
29-may-2010 - Cah4e3 - Added zapper autodetection for Gotcha!
28-may-2010 - adelikat - Added lua function movie.getfilename() which returns the current movie filename without the path included
27-may-2010 - ugetab - Win32 - Debugger - Made debugger able to break on and distinguish Stack reads/writes
24-may-2010 - adelikat - Win32 - Memwatch - ignore spaces at the beginnign of an address in the address boxes
24-may-2010 - mart0258 - Disable auto-savestates during turbo
24-may-2010 - mart0258 - Prevent .zip files containing no recognized files from causing crash
23-may-2010 - adelikat - Win32 - Replay dialog - fix bug that was causing it to always report savestate movies as soft-reset
23-may-2010 - adelikat - Fix PlayMovieFromBeginning when using a movie that starts from savestate
23-may-2010 - cah4e3 - mapper 19 savestate fix mirroring for "Dream Master (J)" corrected to "four-screen" by CRC check
23-may-2010 - ugetab - Win32 - Fixed bug involving pausing emulation outside of the debugger, then trying to use the debugger commands, and having teh CPU registers become corrupted.
22-may-2010 - ugetab - Win32 - Made cheat menu's Pause When Active effect immediate.
22-may-2010 - ugetab - Win32 - Enabled multi-select for Cheat menu to allow multiple toggles and deletes.
20-may-2010 - ugetab - Added NTSC 2x scalar option with some CFG config options of it's own
20-may-2010 - Cah4e3 - Win32 - CDLogger - fixed bug preventing correct interrupt vectors from logging
19-may-2010 - ugetab/adelikat - Win32 - Added single-instance mode, which makes starting a second copy of FCEUX load the file into the first, then exit.Mode off by default, togglable under Config -> GUI
18-may-2010 - adelikat - Movie + loadstate errors are handled more gracefully now, more informative error messages and the movie doesn't have to stop
18-may-2010 - adelikat - Implemented a "full savestate-movie load" mode similar to the implementation in VBA-rr & SNES9x-rr. In this mode loading a savestate in read+write doesn't truncate the movie to its frame count immediately. Instead it waits until input is recording into the movie (next frame). For win32 this feature is togglable in movie options and the context menu. For SDL this is off by default and a toggle will need to be added.
17-may-2010 - adelikat - Made gamepad 2 off by default.
17-may-2010 - adelikat - Movies - fully implemented "bulletproof" read-only
17-may-2010 - zeromus - Movie loading (& movie-savestate saving/loading) should now be faster due to the use of a emufile class instead of std::ostream for dumping
16-may-2010 - ugetab - Added player 3 and 4 to autohold notification window. Made FCEU_DispMessage able to display to different screen locations to do it. Made sure to update SDL with the change. Hope SDL still compiles ok.
15-may-2010 - ugetab - Win32 - Added option for palette selection as color for LUA colors. Included an LUA script to display all choices with the value used to pick displayed color.
14-may-2010 - adelikat - Win32 - Replay dialog, when selecting a movie in a relative path (.\movies for example), the recent movies list stores an absolute path instead.
14-may-2010 - adelikat - Win32 - When recording a movie, add it to recent movies
14-may-2010 - adelikat - Win32 - Replay dialog shows PAL flag & New PPU flag
14-may-2010 - adelikat - New PPU flag in movie headers (doesn't change an emulators PPU state when loading a movie)
13-may-2010 - adelikat - input display overhaul - a more desmume style system which shows both keys held the previous frame and immiately held keys that will be put in on the next frame
12-may-2010 - ugetab - Win32 - Added rudamentry Between-Frames input display code for adelikat to customize.
12-may-2010 - adelikat - Input Display - displays a silver color when input is from a movie rather than the user
12-may-2010 - ugetab - Win32 - With special scaler in window mode, it's possible to resize to anything above the minimum.
12-may-2010 - adelikat - Movies now have a "finished" option. If a playback stops the movie isn't cleared from memory, and can be replayed or a state loaded. Similar functionality as DeSmuME and GENS rerecording
11-may-2010 - adelikat - Loadstate updates input display
11-may-2010 - ugetab - Win32 - Added Ram Search hotkeys for the first 6 search types in the list.
10-may-2010 - ugetab - Added gui.getpixel() which gets any gui.pixel() set pixel colors, and possibly other functions. Added emu.getscreenpixel() which gets the RGB and Palette of any pixel on the screen.
08-may-2010 - ugetab - Added savestate.object() which is savestate.create() with intuitive numbering under windows
08-may-2010 - ugetab - Added emu.addgamegenie() and emu.delgamegenie() LUA functions.
07-may-2010 - ugetab - Win32 - Added context menu to Cheat Dialog Cheat Listbox, populated list with Toggle Cheat, Poke Cheat Value, and Goto In Hex Editor
07-may-2010 - ugetab - Win32 - Made enabling/disabling cheats no longer deselect the selected cheat.
06-may-2010 - ugetab - win32 - Add Cheat buttons for Ram Search and Ram Watch
06-may-2010 - ugetab - win32 - Hex editor - Made the Hex Editor display the Frozen, Bookmarked, etc. status of the selected address, and made the Frozen color override the Bookmarked color.
04-may-2010 - ugetab - Win32 - Added "Goto" command for hex editor.
28-april-2010 - ugetab - Added microphone support option. When enabled, Port 2 Start activates the Microphone. Movies also support this.
25-april-2010 - FatRatKnight - Fixed a potential desync that plays out an extra frame without an update to the frame count involving heavy lua use, joypad.get, and a loadstate.
23-april-2010 - ugetab - Win32 - Added Tools>GUI option to partially disable visual themes, so the emulator can be made to look like it did in 2.1.1 and earlier releases.
20-april-2010 - adelikat - New lua functions movie.ispoweron() and movie.isfromsavestate()
20-april-2010 - adelikat - Win32 - Drag & Drop - if dropping a .fcm with no ROM loaded, prompt for one (same functionality that was added to .fm2 files)
08-april-2010 - ugetab - Win32 - Added conditional debugging option 'K', for bank PC is on
07-april-2010 - adelikat - fix bug that caused zapper.read() to crash when movie playback ends
---r1767 - FCEUX 2.1.3 Released---
---April 7 2010---
07-april-2010 - sgrunt - Lua - gui.text now has out of bounds checking
07-april-2010 - adelikat - Win32 - Lua console - filename updates when lua scripts are dragged to emulator or recent filenames invoked
07-april-2010 - adelikat - Lua no longer unpauses the emulator when a script is loaded
30-march-2010 - ugetab - Win32 - Closing minimized windows no longer moves them the next time they get opened
28-march-2010 - adelikat - lua - fixed zapper.read() to read movie data if a movie is playing. Also changed the struct values to x,y,fire. This breaks lua scripts that used it previous, sorry.
04-march-2010 - prockguy - added menu buttons for loading nsf files
03-march-2010 - adelikat - Win32 - If .fm2 drag & dropped with no ROM load, the open ROM dialog will appear
03-march-2010 - prockguy - fceux - now prints the name of the mapper on rom load
03-march-2010 - prockguy - SDL - VS unisystem keys now configable
03-march-2010 - prcokguy - SDL - changed default hotkeys and keys to match w32
03-march-2010 - prockguy - SDL - fixed dpad/joyhat support
01-march-2010 - adelikat - Movie file format header now has a FDS flag
01-march-2010 - adelikat - win32 - cheats dialog - toggling a cheat in the cheats list now updates the active cheats count
01-march-2010 - adelikat - win32 - a disable movie messages menu item
25-feb-2010 - prockguy - unix netplay is now functional; gtk network gui created
24-feb-2010 - prockguy - GTK - added basic movie controls
24-feb-2010 - prockguy - GTK - added file filters; added Load FDS function
24-feb-2010 - prockguy - GTK - added palette config dialog
23-feb-2010 - prockguy - GTK - added UI elemnts for x/y scale; added lowpass UI option
23-feb-2010 - prockguy - GTK - added GUI for color/tint/hue
23-feb-2010 - prockguy - GTK - implemented sound mixer dialog (for square1, 2, triangle, etc)
22-feb-2010 - prockguy - SDL - ported to SDL 1.3; compatibility maintained with 1.2
18-feb-2010 - prockguy - GTK - a lot of options added to GTK gui; relatively stable; added GUI for gamepad config and sound config.
02-feb-2010 - ugetab - Win32 - Added window positions bounds checks. Accounts for -32000 positions & less out-of-range too
08-jan-2010 - rheiny - Win32 - Trace Logger - Trace logger now logs the values of the stack pointer register
31-dec-2009 - prg318 - added gtk gui
08-dec-2009 - Zeromus - Fix Name Table Viewer - Fix for use with New PPU
08-dec-2009 - - mart0258 - FDS - show name of missing bios file in error message
07-dec-2009 - qeed - NewPPU - fixed sprite hit before 255 and for non transparent hits only, thanks to dwedit for providing the fix
06-dec-2009 - Zeromus - SDL - disallow --inputcfg gamepad0 and gamepad5
??-???-2009 - CaH4e3 - fixed mappers 82, 25, 21, and 18. Games such as SD Kiji Blader, Ganbare Goemon Gaiden, and Ganbare Goemon Gaiden 2, Jajamaru Gekimadden are now playable
17-nov-2009 - adelikat - Win32 - Cheats - Pause while active checkbox installed
17-nov-2009 - adelikat - Win32 - Fix debug window so it doesn't crash if unminimized with no game loaded.
13-nov-2009 - mart0258 - Win32 - TASEdit - Added interface functionality (save/load, running TASEdit mid-movie, etc.)
13-nov-2009 - adelikat - made savestate compression togglable
13-nov-2009 - adelikat - made savestate backups togglable
08-nov-2009 - gocha - Win32 - Lua console - added a menu
08-nov-2009 - gocha - change gui.line, gui.box, joypad.get to function like GENS rerecording
08-nov-2009 - gocha - New lua functions: gui.parsecolor, joypad.getup, joypad.getdown, emu.emulating.
08-nov-2009 - CaH4e3 - Fixes for mappers 253 & 226 - fixes games such as Fire Emblem (J) and Fire Emblem Gaiden (J)
08-nov-2009 - CaH4e3 - Fix crashing on game loading for any battery backed roms with mappers from MapInitTab (fixes Esper Dream 2 - Aratanaru Tatakai (J)
04-nov-2009 - adelikat - win32 - debugger - added an auto-load feature
---r1527 - FCEUX 2.1.2 Released---
---November 3, 2009---
02-nov-2009 - qeed - fixed mapper 226, 76-in-1 seems to work now, also super 42 also seems to work with this fix, but people with save states with this game should make a new one. Since the the save state format for this game was changed a little.
31-oct-2009 - adelikat - win32 - Memwatch - Save Changes prompt - Selecting yes will do quicksave first, save as 2nd (instead of always defaulting to save as)
19-oct-2009 - qeed - Mapper 253 mostly implemented, known game [ES-1064] Qi Long Zhu (C) is mostly playable (some minor graphic glitches). Thanks to VirtualNESEX for reverse engineering this, gil for giving me the mapper src for implementation reference, and Dead_Body for figuring out this game had to use chr-ram
10-oct-2009 - qeed - fixed dragon's lair the mapper 4 europe version in new PPU
10-oct-2009 - zeromus - fixed Tecmo Super Bowl in new PPU
08-oct-2009 - ugetab - win32 - fixed a debugger crash error, Unif/FDS filename issue, and enabled debugger bank display
01-oct-2009 - gocha - win32 - movie play dialog displays movie time based on ~60.1 (~50.1 PAL) instead of 60 & 50
26-sept-2009 - qeed - fixed action 52 game that was broken in fceux >2.0.3
16-sept-2009 - ugetab - win32 - Restored DPCM Logging when Code/Data Logger is active
sept-2009 - FatRatKnight - Finally got in that "invert" value for joypad.set. This value simply inverts the player input. Actually, any string will invert it, since we have not used strings for anything else in joypad.set.
15-sept-2009 - FatRatKnight - Reworked how input is taken from lua, and generally everything related to joypad.set and what it affects. Now setting stuff to false will: Prevent user control for exactly one frame, and allow more than one false button as a time. Yeah, bug fixes. Hopefully runs a little faster now.
22-aug-2009 - adelikat - Win32 - Map Hotkeys Dialog - Fixed but where "X" and Alt+F4 would not close dialog
22-aug-2009 - adelikat - Win32 - Added a Save Config File menu item
12-aug-2009 - adelikat - Win32 - Added a menu item to toggle to New PPU
10-aug-2009 - adelikat - fixed bug that caused new movies be created in /movie instead of /movies
08-aug-2009 - qeed - mappers - fixed mapper irq count, dragon ball z 3
should be playable again.
07-aug-2009 - ugetab - win32 - imported NSF features from FCEU-XDSP-NSF
05-aug-2009 - adelikat - win32 - fixed an erroneous assumption made in 2.1.1 that caused the recent roms menu to be grayed out even when there were recent roms (however, it uncovered an underlying bug in the recent menu saving that needs to be fixed at some point).
---r1375 - FCEUX 2.1.1---
---July 29, 2009---
01-july-2009 - adelikat - win32 - texthooker - drag & drop for table files
01-july-2009 - adelikat - win32 - drag & drop for cheat (.cht) files
25-jun-2009 - qeed - sound/ppu - fixed the noise value, it seems that the noise logic was shifting the values to the left by 1 when reloading, but this doesnt work for PAL since one of the PAL reload value is odd, so fix the logic and used the old tables. Revert a stupid CPU ignore logic in PPU. Sorry about that.
25-jun-2009 - adelikat - Win32 - CD Logger - Drag and Drop for .cdl files
24-jun-2009 - qeed - sound/ppu - reverted to old noise table value since this seems to get correct sound for double
dragon 2. Also added experimental $2004 reading support to play micro machines with (little) shakes, and fixed some
timing in the new PPU.
24-jun-2009 - adelikat - win32 - memory watch - option to bind to main window, if checked it gives GENS dialog style control, where there is no extra task bar item, and it minimizes when FCEUX is minimized
24-jun-2009 - adelikat - win32 - palette commandline options
24-jun-2009 - adelikat - win32 - Sound Dialog - cleanup, when sound is off, all controls are grayed out
24-jun-2009 - adelikat - win32 - Hex Editor - Drag & Drop for .tbl files
24-jun-2009 - adelikat - win32 - Drag & Drop for .fcm, it converts and then loads the converted movie automatically
24-jun-2009 - adelikat - win32 - Drag & Drop support for palette files
23-jun-2009 - adelikat - win32 - Drag & Drop support for savestates
22-jun-2009 - qeed - Revert IRQ inhibit fix, since this seems to break Dragon
Warrior 4, added palette reading cases for the new PPU.
21-jun-2009 - adelikat - win32 - memwatch - save menu item is grayed if file hasn't changed
20-jun-2009 - adelikat - win32 - memwatch - fixed a regression I made in 2.0.1 that broke the Save As menu item
17-jun-2009 - qeed - Sound core fix, updated with the correct values for the noise and DMC table,
and also fixed the IRQ inhibit behavior for register $4017. Also fixed the CPU
unofficial opcode ATX, ORing with correct constant $FF instead of $EE, as tested
by blargg's. These fixes passes the IRQ flags test from blargg, and also one more
opcode test from blargg's cpu.nes test.
16-jun-2009 - adelikat - sound core fix - square 1 & square 2 volume controls no longer backwards
11-jun-2009 - zeromus - sound core fix, length counters for APU now correct variables
11-jun-2009 - adelikat - Win32 - Hex Editor - changed ROM values again dsiplay as red, saved in the config as RomFreezeColor
06-jun-2009 - rheiny - Fixed reported issue 2746924 (md5_asciistr() doesn't produce correct string)
23-may-2009 - adelikat - win32 - hex editor - freeze/unfreeze ram addresses now causes the colors to update immediately, but only with groups of addresses highlighted at once (single ones still don't yet update)
23-may-2009 - adelikat - win32 - context menu - Save Movie As... menu item (for when a movie is loaded in read+write mode)
23-may-2009 - adelikat - win32 - added opton to remove a recent item to the roms, lua, and movie recent menus
23-may-2009 - adelikat - win32 - Added a remove recent item function and hooked it up to memwatch recent menu, now if a bad recent item is clicked, the user has a choice to remove it from the list
23-may-2009 - adelikat - win32 - Load Last Movie context menu item added
23-may-2009 - adelikat - win32 - Recent Movie Menu added
22-may-2009 - adelikat - win32 - "Disable screen saver" gui option now also diables the monitor powersave
22-may-2009 - adelikat - win32 - Debugger - Step type functions now update other dialogs such as ppu, nametable, code/data, trace logger, etc.
22-may-2009 - adelikat - win32 - Hex Editor - Save Rom As... menu option enabled and implemented
22-may-2009 - adelikat - win32 - Window caption shows the name of the ROM loaded
22-may-2009 - adelikat - win32 - Hex Editor - allowed the user to customize the color scheme by use of RGB values stored in the .cfg file
21-may-2009 - adelikat - win32 - reverted fixedFontHeight to 13 instead of 14. Gave the option of adjusting the height by modifying RowHeightBorder in the .cfg file
21-may-2009 - adelikat - win32 - made fullscreen toggle (Alt+Enter) remappable
15-may-2009 - shinydoofy - sdl - added --subtitles
10-may-2009 - shinydoofy - sdl - fixed Four Score movie playback
02-may-2009 - adelikat - win32 - stop movie at frame x feature - fixed off by 1 error
23-apr-2009 - shinydoofy - sdl - added --ripsubs for converting fm2 movie subtitles to an srt file
15-apr-2009 - shinydoofy - sdl - Lua is optional again, fixed the real issue
14-apr-2009 - punkrockguy - sdl - LUA is NO longer optional, so the SConscripts have been updated to reflect that change. This fixes the mysterious non-working input issue.
12-apr-2009 - shinydoofy - sdl - implemented saving/loading a savestate from a specific file on Alt+S/L
11-apr-2009 - shinydoofy - sdl - implemented starting an FM2 movie on Alt+R
11-apr-2009 - adelikat - made default save slot 0 instead of 1, Win32 - remember last slot used
11-apr-2009 - shinydoofy - sdl - added --pauseframe to pause movie playback on frame x
11-apr-2009 - shinydoofy - sdl - dropped UTFConverter.c from SDL build and added hotkey Q for toggling read-only/read+write movie playback
--version 2.1.0a released----
04-apr-2009 - shinydoofy - fixed fcm->fm2 code once again (this time for good, hopefully). Thanks to Bisqwit!
04-apr-2009 - shinydoofy - Reverted UTF8<->UTF32 code changes to fix up the win32 build for now
---version 2.1.0 released---
29-mar-2009 - adelikat - Win32 - reverted acmlm's /dll folder change
28-mar-2009 - shinydoofy - sdl - added hotkey Del to toggle mute avi capturing
28-mar-2009 - shinydoofy - sdl - fix fm2 playback and fcm->fm2 conversion crash at the cost of ugly 0x00 bytes behind the author's comment line
28-mar-2009 - adelikat - Lua - added FCEU.poweron() and FCEU.softreset()
27-mar-2009 - shinydoofy - sdl - added --no-config
23-mar-2009 - adelikat - Win32 - blocked "hotkey explosion" by rshift on some laptops
22-mar-2009 - shinydoofy - sdl - added hotkey I and --inputdisplay {0|1|2|4} for toggling input display.
22-mar-2009 - shinydoofy - sdl - added commandline options for sound channels' volumes
22-mar-2009 - shinydoofy - sdl - updated window title
19-mar-2009 - adelikat - Win32 - make Video - windowed mode - disable hardware accel the default setting. Made high quality sound the default setting.
16-mar-2009 - adelikat - Win32 - GUI Dialog - added an option to disable the context menu
15-mar-2009 - adelikat - Lua - added movie.rerecordcount(), movie.length(), movie.getname(), movie.playbeginning(), FCEU.getreadonly(), FCEU.setreadonly()
14-mar-2009 - adelikat - Lua - added movie.active() - returns a bool value based on whether a movie is currently loaded
14-mar-2009 - adelikat - Fixed Joypad.set, it uses 3 values instead of 2 now. True will take control of a button and make it on, False will take control and make it off, and Nil will not take control (allowing the user to press the button)
14-mar-2009 - adelikat - Fix major crash issue where NROM game savestates were writing erroneous information if a non NROM game was loaded prior
13-mar-2009 - adelikat - Closing game / Opening new game resets the frame counter
13-mar-2009 - adelikat - Win32 - Debugger - Scanlines and PPU Pixels are displayed even in vblank (lines 240-261)
12-mar-2009 - shinydoofy - sdl - fixed compilation error and reactivated the mouse pointer in the SDL window
12-mar-2009 - adelikat - Win32 - Trace Logger - fixed bug where user can't scroll the log window while it is auto-updating
11-mar-2009 - adelikat - Win32 - Trace Logger - changed message about F2 pause (left over from FCEUXDSP) to display the current hotkey mapping
11-mar-2009 - adelikat - Added frame counter to savestates
08-mar-2009 - adelikat - Lua - added input.get() function
08-mar-2009 - adelikat - Lua - memory.readbyte will recognize frozen addresses
08-mar-2009 - adelikat - Lua - added FCEU.lagged() function
08-mar-2009 - adelikat - Lua - added zapper.read() function
07-mar-2009 - adelikat - Lua - added FCEU.lagcount() function
04-mar-2009 - adelikat - win32 - Fix bug so that Escape can now be assigned as a hotkey
03-mar-2009 - adelikat - win32 - Fix Directory Overrides so to allow users to have no override. Also fixes directory override reset bug
02-mar-2009 - adelikat - win32 - Drag & Drop for Memwatch dialog (.txt files)
01-mar-2009 - adelikat - win32 - Drag & Drop Lua files
25-feb-2009 - adelikat - win32 - Memwatch - added cancel to save changes? message box
22-feb-2009 - adelikat - win32 - Lua - made speedmode("turbo") turn on turbo (which employs frameskipping) rather than max speed
22-feb-2009 - adelikat - Increased lua gui.text height (and DrawTextTransWH() height)
21-feb-2009 - adelikat - win32 - Lua - Added -lua commandline argment, loads a lua script on startup
21-feb-2009 - adelikat - win32 - Debugger - Added pixel display after scanline display - Thanks to DWEdit for this patch
21-feb-2009 - adelikat - win32 - Debugger - Added Run Line, Run 128 Lines buttons - Thanks to DWEdit for this patch
21-feb-2009 - adelikat - win32 - Message Log - remembers X,Y position
19-feb-2009 - adelikat - win32 - Memory Watch - fixed recent file menu - no longer crashes when attempting to load a non existent recent file
07-feb-2009 - adelikat - win32 - Fix bug in screenshot numbering that caused numbering to not reset when changing ROMs
06-feb-2009 - adelikat - win32 - Hex editor - remembers window size
06-feb-2009 - adelikat - Win32 - sound config dialog - added sliders for individual sound channel volume control
06-feb-2009 - zeromus - Force processor affinity, fixes throttling problem on AMD dualcore machines
06-feb-2009 - adelikat - Sound channels now have individual volume control
01-jan-2009 - adelikat - Win32 - Timing - "disable throttling when sound is off" now only affects FCEUX when sound is off
26-dec-2008 - adelikat - Metadata - remember window position
24-dec-2008 - adelikat - auto-save fixes, prevent loading an auto-save from previous session. Win32 - added flags for enabling auto-save menu item.
24-dec-2008 - adelikat - added undo/redo savestate hotkey. Win32 - made undo/redo default key mapping Ctrl+Z
24-dec-2008 - adelikat - win32 - added Last ROM used context menu item when no game loaded
24-dec-2008 - shinydoofy - sdl - added option to mute FCEUX for avi capturing, check the docs for more detail
23-dec-2008 - adelikat - Win32 - Undo/redo loadstate and Undo/redo savestate context menu items added
23-dec-2008 - adelikat - undo/redo loadstate and undo/redo savestate implemented
22-dec-2008 - adelikat - backupSavestate system added.
22-dec-2008 - shinydoofy - sdl - added Shift+M for toggling automatic movie backups for SDL
22-dec-2008 - adelikat - Movie auto-backup feature implemented
22-dec-2008 - adelikat - win32 - moved movie related menu items to a movie options dialog box
22-dec-2008 - adelikat - Win32 - context menu item "create backup" for backing up movie files
21-dec-2008 - adelikat - Win32 - Name Table Viewer - Refresh value default to 15, Refresh value stored in config file
21-dec-2008 - adelikat - Win32 - PPU Viewer - Refresh value default to 15, Refresh value stored in config file
19-dec-2008 - adelikat - Loadbackup function added, Win32 - Undo Loadstate context menu item
19-dec-2008 - adelikat - Backup savestate is made before loading a state
18-dec-2008 - adelikat - win32 - turbo bypasses sound better if muteturbo is checked
18-dec-2008 - shinydoofy - sdl - fixed compiling errors for SDL due to r1037
18-dec-2008 - adelikat - win32 - fullscreen mode fixed (both enters and returns to fullscreen just fine)
16-dec-2008 - adelikat - win32 - debugger - added "Restore original window size" button
16-dec-2008 - adelikat - win32 - debugger - fixed SF2073113 - Debugger now has a minimum valid size
15-dec-2008 - adelikat - win32 - cheats - number of active cheats listed, freezing ram addresses in hex editor automatically updates cheats dialog
15-dec-2008 - adelikat - win32 - hexeditor - added minimize & maximize buttons
14-dec-2008 - adelikat - win32 - memwatch - frozen addresses will display as blue
14-dec-2008 - adelikat - win32 - hexeditor - prevent the user from freezing more than 256 addresses at once
14-dec-2008 - adelikat - win32 - memwatch - collapsable to 1 column
08-dec-2008 - adelikat - win32 - stop lua menu item gray if no lua script is running
08-dec-2008 - adelikat - win32 - fix bug where no sound + mute turbo caused chirps when toggling
08-dec-2008 - adelikat - win32 - sound dialog - disabling sound disabled sound options
08-dec-2008 - adelikat - win32 - opening a rom runs closerom first, fixes bug where new sav file was not getting loaded
07-dec-2008 - adelikat - win32 - turbo now employs frame skip
30-nov-2008 - punkrockguy - commit 1000
30-nov-2008 - punkrockguy - fixed gcc compile error
30-nov-2008 - punkrockguy - moved around some hotkeys to be consistent with docs
30-nov-2008 - punkrockguy - major update to sdl documentation
24-nov-2008 - qfox - win32 - fixed two position checks for memwatch and debugger that could cause these windows to "disappear" (moved far out of reach).
24-nov-2008 - adelikat - win32 - right click context menus installed
24-nov-2008 - adelikat - win32 - added lots of mappable hotkey items as Menu items
23-nov-2008 - adelikat - Win32 - fixed some errors in my AVI directory override code
23-nov-2008 - shinydoofy - movie subs now have a toggle button in the SDL build (F10 by default)
23-nov-2008 - adelikat - movie subtitle system installed
22-nov-2008 - adelikat - Win32 - added help menu item to TASEdit and Hex Editor, Minor TASEdit clean up
22-nov-2008 - adelikat - Win32 - fixed so that turbo works with VBlank sync settings
21-nov-2008 - qfox - Lua - added joypad.write and joypad.get for naming consistency. Added plane display toggle for lua: FCEU.fceu_setrenderplanes(sprites, background) which accepts two boolean args and toggles the drawing of those planes from Lua. Changed movie.framecount() to always return a number, even when no movie is playing. Should return the same number as in view; the number of frames since last reset, if no movie is playing.
17-nov-2008 - adelikat - added Open Cheats hotkey (currently a windows only function)
16-nov-2008 - adelikat - Win32 - menu items that are hotkey mappable show the current hotkey mapping
15-nov-2008 - adelikat - Win32 - memwatch - implemented RamChange() - monitors the behavior of ram addresses
15-nov-2008 - adelikat - Win32 - re-enabled sound buffer time
15-nov-2008 - adelikat - Clip Left and Right sides taken into account when drawing on screen (record/play/pause, lag & frame counters, messages, etc)
15-nov-2008 - adelikat - win32 - Implemented Drap & Drop for movie files
14-nov-2008 - adelikat - win32 Hex Editor - Dump Rom & Dump PPU to file Dialog - uses ROM to build default filename
14-nov-2008 - adelikat - Win32 Memwatch - Save as dialog - uses ROM name to build default memwatch filename if there is no last used memwatch filename
14-nov-2008 - adelikat - Win32 Text Hooker fixes - Init error checking reinstated, save .tht file no longer crashes, Dialog updates as ROM plays, Remembers window position, fix bug where canceling save as produces an error message, Save As produces default filename based on loaded ROM
14-nov-2008 - adelikat - fixed but when aspect correction and special scaling 3x are set, video was getting resized incorrectly
14-nov-2008 - adelikat - fixed a bug introduced in previous commit, frame display toggle now works when no movie is present
12-nov-2008 - adelikat - allowed frame counter to display even with no movie present
11-nov-2008 - punkrockguy - sdl - savestate slots now mappable [2175167]
10-nov-2008 - adelikat - win32 - removed accel keys from main window
10-nov-2008 - adelikat - Win32 - added Open & Close ROM mappable hotkeys, removed accel functions
10-nov-2008 - punkrockguy - improved the sdl sound code; drasticaly improves quality of sound.
09-nov-2008 - adelikat - minor memory watch menu clean up, removed Ctrl+W hotkey for close (and placed Alt+F4 on the menu name)
08-nov-2008 - zeromus - big endian wasnt compiling. fix issues.
02-nov-2008 - shinydoofy - added --fcmconvert for SDL
02-nov-2008 - zeromus - emulua - add rom.readbyte and rom.readbytesigned
---version 2.0.3 released---
02-nov-2008 - zeromus - fix fcm conversion, recording, and playback of reset and power commands
25-oct-2008 - shinydoofy - added support for AVI creation for SDL, see documentation/Videolog.txt for more
19-oct-2008 - shinydoofy - toggle lag frame counter for SDL, default hotkey F8
19-oct-2008 - shinydoofy - toggle skipping of lag frames for SDL, default hotkey F6
19-oct-2008 - shinydoofy - [ 2179829 ] user ability to toggle "bind savestates to movie" added for SDL, default hotkey F2
19-oct-2008 - adelikat - win32 - added a toggle for binding savestates to movies
18-oct-2008 - adelikat - win32 - added -cfg (config file) command line argument
08-oct-2008 - zeromus - SF [ 2073113 ] Child windows inside debugging window get invalid sizes
08-oct-2008 - zeromus - SF [ 2153843 ] Lua ignores second joypad.set()
24-sep-2008 - punkrockguy318 - made the input config window more usable
24-sep-2008 - punkrockguy318 - --inputcfg can now be used without a filename
24-sep-2008 - punkrockguy318 - [ 2085437 ] should fix issues with missing author field crashing fceux
24-sep-2008 - punkrockguy318 - [ 2047057 ] added uninstall script for gfceux
24-sep-2008 - punkrockguy318 - [ 2062823 ] fixed ppc build errors and added LSB_FIRST option to build scripts
24-sep-2008 - punkrockguy318 - [ 2057006 ] --newppu option added to sdl, disabled by default
24-sep-2008 - punkrockguy318 - [ 2057008 ] lua is now optional, thanks shinydoofy for a patch. also fixed some build issues.
22-sep-2008 - punkrockguy318 - [ 2008437 ] fixed an issue where flawed movie would crash fceux on every startup
21-aug-2008 - punkrockguy318 - sdl - fixed issue where windowed mode would always be set to 32 bpp
18-aug-2008 - zeromus - windows - SF [ 2058942 ] Load state as... does not use the savestate override dir (fixed; now, it does)
18-aug-2008 - zeromus - windows - permit user optionally to proceed through the movie savestate mismatch error condition, in case he knows what he is doing.
18-aug-2008 - zeromus - fix a bug in the savestate recovery code which prevent aborted savestate loads from recovering emulator state correctly.
18-aug-2008 - zeromus - windows - bind a menu option for display framecounter
17-aug-2008 - zeromus - windows - fix problem where replay dialog couldnt work when the process current directory had changed to something other than emulator base directory
17-aug-2008 - zeromus - windows - autoload the only useful rom or movie from an archive, in cases where there is only one
17-aug-2008 - zeromus - gracefully handle non-convertible broken utf-8 text without crashing
17-aug-2008 - zeromus - windows - don't read every archive file when scanning for replay dialog. scan them, and only look for *.fm2
17-aug-2008 - zeromus - debugger - fix issue where keyboard keys get stuck when switching between debugger window and main window
15-aug-2008 - adelikat - fixed an oversight on my part. Sound config dialog will now look to see if Mute Turbo should be checked
---version 2.0.2 released---
14-aug-2008 - punkrockguy318 - SDL: prevent frame advance from crashing emulator
14-aug-2008 - punkrockguy318 - SDL build scripts now look for lua5.1 and lua (distributions package lua differently)
14-aug-2008 - zeromus - restore savestate error recovery functionality. This should have the side effect of guaranteeing that ( SF [ 2040761 ] Wrong savestate bug - crashes FCEUX) is resolved.
14-aug-2008 - zeromus - SF [ 2047001 ] Low speeds crash FCEUX
14-aug-2008 - zeromus - SF [ 2050371 ] FCM>FM2 converter should release file handle
13-aug-2008 - zeromus - restore ungzipping (and unzipping in sdl) capability which was lost when archive support was added
13-aug-2008 - zeromus - add FORBID breakpoints - regions which block breakpoints from happening if they contain the PC
13-aug-2008 - punkrockguy318 - SDL: fixed --input(1-4) options. input1 and 2 are regular inputs, input3 and 4 are famicom expansion inputs
12-aug-2008 - zeromus - fix SDL configfile woes. configfile now goes to ~/.fceux/fceux.cfg
12-aug-2008 - zeromus - SF [ 2047986 ] palflag 1 in .fm2 files crashes fceux
12-aug-2008 - adelikat - movie replay dialog displays fractions of a second
12-aug-2008 - punkrockguy318 - SDL: fixed segfault when opening .fcm files
12-aug-2008 - punkrockguy318 - SDL: Saner sound defaults for less choppy sound
12-aug-2008 - punkrockguy318 - SF [ 2047050 ] SDL: "--special" option fixed for special video scaling filters
12-aug-2008 - zeromus - SF [ 2046984 ] Player 3 inputs when not used
12-aug-2008 - zeromus - print a special message when trying to open an FCM reminding user to convert. (finishes SF [ 2011832 ] Opening non movie file crashes FCEUX)
12-aug-2008 - zeromus - SF [ 2046985 ] SRAM not wiped on power cycle (during movies)
11-aug-2008 - zeromus - restore IPS patching capability which was lost when archive support was added
11-aug-2008 - zeromus - SF [ 2011550 ] Buffer overflow (change vsprintf to vsnprintf)
11-aug-2008 - zeromus - SF [ 2047004 ] Moviefilenames without extension don't automatically get fm2
10-aug-2008 - zeromus - upgrade to cah4e3's latest mapper 163&164 code to fix a crash in a game
10-aug-2008 - zeromus - remove cnrom chr rom size limit for homebrew roms
10-aug-2008 - punkrockguy318 - SDL: cleaned up the SConsruct
10-aug-2008 - punkrockguy318 - SDL: fixed issue where fceu would lock up when file dialogs were opened during fullscreen
10-aug-2008 - punkrockguy318 - SDL: fixed bug where fceux would close when file dialogs were closed
10-aug-2008 - punkrockguy318 - SDL: File open dialog is now used to movie playback
10-aug-2008 - punkrockguy318 - SDL: File open wrapper now takes a titlebar argument
10-aug-2008 - punkrockguy318 - SDL: Cleanup of usage
10-aug-2008 - punkrockguy318 - SDL: rename options --no8lim -> --nospritelim and --color -> --ntsccolor
10-aug-2008 - punkrockguy318 - SDL: Screenshots now always prepend the game name.
10-aug-2008 - punkrockguy318 - SDL: Changed default A/B from numpad 2 and 3 to j and k.
10-aug-2008 - punkrockguy318 - SDL: Enable frameskip by default
10-aug-2008 - punkrockguy318 - SDL: Fixed a bug that would crash fceux if the emulation speed was overincreased
10-aug-2008 - punkrockguy318 - SDL: New default hotkeys to more closely match win32 defaults
10-aug-2008 - punkrockguy318 - SDL: Added lua script loading hotkey (f3). Non win32 SDL requires zenity for this to function.
10-aug-2008 - punkrockguy318 - SDL: Build script cleanup; also added option for DEBUG builds.
10-aug-2008 - zeromus - SF [ 2030405 ] Avi recording: no sound b0rks format
10-aug-2008 - zeromus - SF [ 2037878 ] Convert .fcm doesn't do special characters
09-aug-2008 - zeromus - SF [ 2040463 ] Add an "author" text field in the record movie dialog
09-aug-2008 - zeromus - re-enable support for old-format savestates.
09-aug-2008 - zeromus - SF [ 2041944 ] Savestates remember Lua painting
09-aug-2008 - zeromus - support loading movies from archives
08-aug-2008 - adelikat - added input display to the FCEUX main menu
08-aug-2008 - adelikat - fixed the (null) in the default lua directory listing
08-aug-2008 - adelikat - added shift+L as default hotkey for reload lua script
08-aug-2008 - adelikat - removed accel ctrl+x (prevented cut from working in accel dialogs)
08-aug-2008 - zeromus - fiddle with nametable viewer to display correct NT,CHR,ATTR data in more cases (specifically, including some exotic mmc5 cases).
08-aug-2008 - zeromus - fix a new bug in windows build which caused fourscore emulation to fail in some cases
07-aug-2008 - zeromus - add an option to pick a constant color to draw in place of BG when BG rendering is disabled (look for gNoBGFillColor in config; 255 means to use palette[0])
07-aug-2008 - adelikat - added a mute turbo option in sound config
07-aug-2008 - adelikat - new toggle - frame adv. - lag skip (menu item + hotkey mapping + saved in config)
07-aug-2008 - adelikat - put in -32000 protection on all dialogs that remember x,y
06-aug-2008 - adelikat - change config filename from fceu98.cfg to fceux.cfg
06-aug-2008 - zeromus - add lagcounter and lagflag to savestate
06-aug-2008 - zeromus - SF [ 2040448 ] View Slots bug - does not include new savestate naming
06-aug-2008 - zeromus - restore the debugger snap functionality
06-aug-2008 - zeromus - add memory.readbyterange to emulua
06-aug-2008 - zeromus - auto-fill .fcs extension in save state as dialog
06-aug-2008 - zeromus - mmc5 - 64KB WRAM games now work correctly
06-aug-2008 - zeromus - mmc5 - use of chr A regs for BG in sprite 8x8 mode is fixed
06-aug-2008 - zeromus - debugger - debugger window is now resizeable
---version 2.0.1 released---
04-aug-2008 - reorganize display toggle options in the menu
04-aug-2008 - adelikat - autofire fix
04-aug-2008 - zeromus - homebrew mmc5 games now have 64KB of exwram instead of only 8KB
04-aug-2008 - zeromus - fix crash related to player2 in lua scripts
03-aug-2008 - qfox - fixed player2 in lua scripts
---version 2.0.0 released---

View File

@ -0,0 +1,5 @@
#!/bin/sh
if [ -f /usr/bin/i586-mingw32msvc-windres ]; then HOST=i586-mingw32msvc
else HOST=i586-mingw32
fi
PLATFORM=win32 CC=${HOST}-gcc CXX=${HOST}-g++ WRC=${HOST}-windres WINDRES=${HOST}-windres scons $@

17
branches/sdl2/documentation/.gitignore vendored Normal file
View File

@ -0,0 +1,17 @@
# A simulation of Subversion default ignores, generated by reposurgeon.
*.o
*.lo
*.la
*.al
*.libs
*.so
*.so.[0-9]*
*.a
*.pyc
*.pyo
*.rej
*~
*.#*
.*.swp
.DS_store
# Simulated Subversion default ignores end here

View File

@ -0,0 +1,61 @@
Items to be completed before 2.0 release
FASTAPASS / FP_FASTAPASS / Are these archaic? They suck - ??
Separate frameskip/pause from EmulationPaused - zeromus
Make ALL Debugging code conditional - zeromus
Doxygen integration - DONE
* website integration
Linux build - soules
* clean-up of input device code
Windows build - zeromus
* verify rerecording
* verify debugging
* verify avi writing
Commandline parsing - lukas
* verify in windows - zeromus
Configfile parsing - lukas
* verify in windows - zeromus
Do we really need vc7 project? Cah4e3? - zeromus
Source code docs cleaning - zeromus
Homepage docs - zeromus
What is the proper gnu way to do CREDITS from the homepage? e.g. Marat Fayzullin - General NES information
Freenode registration - lukas
* homepage update
Default hotkey philosophy (there are different philosophies from XD and TAS) - ALL
Netplay - FUTURE STUFF
Move server code into tree - DONE
Ensure netplay compiles
verify netplay
----done-----
Investigate OSX build [ http://www.lamer0.com/ ] - zeromus [posted on blog...]
Move to scons - DONE
Merge garnet and sf repos - DONE
* Ensure gnome frontend is in repo - DONE
* Move to sourceforge SVN - DONE
--strategic--
Politics:
* aboutbox credits
* AUTHORS
Release:
* Press Release - ??
* Homepage updates
- eliminate old news, add new links

View File

@ -0,0 +1,48 @@
Since SVN revision 931, FCEUX features a new option to create avi files from a recorded movie and it is relatively easy to use if you know the bare basics of mencoder.
Call "scons CREATE_AVI=1" to activate it. You will, however, most likely need mencoder to use it.
You get the raw video data via stdin and the audio data from a fifo file. Let's say you want the video to be in the best quality available, no matter how long it takes or how big the avi file might get. In order to get the NES's original video resolution and a good sound quality, you might need to set some settings beforehand or just pass them along while calling mencoder.
Here's an example:
./fceux \
--xscale 1 --yscale 1 --special 0 \
--pal 0 \
--sound 1 --soundq 1 --soundrate 48000 --mute 1 \
--nospritelim 1 \
--no-config 1 \
--videolog "mencoder - -o myfirstencodedrun.avi \
-ovc x264 -x264encopts qp=0 \
-oac pcm \
-noskip -nocache -mc 0 -aspect 4/3
NESVSETTINGS" \
--playmov mymovie.fm2 myROM.nes
Now let's see what is done and why we did it:
First of all, we started fceux with "./fceux" and gave it some options:
"--xscale" and "--yscale" determine how much bigger the video in comparison to its regular size. It's no point to use anything other than 1 here because you can always see your video on fullscreen or at least scale it, can't you? As a nice addon, it saves time to create the avi file and also saves valuable space on your hard disk.
"--special" would usually do something fancy to your picture when you're playing a ROM, but again, it's mostly pointless to use for an avi.
"--pal 0" lets the game run at ~60Hz. Set this so 1 if you are using a PAL ROM.
"--sound 1" activates sound.
"--soundq 1" activates high quality sound.
"--soundrate 48000" sets the sound rate to 48kHz.
"--mute 1" mutes FCEUX while still passing the sound to mencoder. This way you can capture a movie and still listen to your music without having the NES sounds in the background.
"--nospritelim" deactivates the NES's 8 sprites per scanlines limit.
"--no-config 1" is used not to destroy your settings when creating an avi movie.
"--videolog" calls mencoder:
"-" states that we're getting the video stream from stdin.
"-o" determines the name of the produced avi file.
"-ovc x264" sets the video codec to be x264 and is highly recommended for quality reasons. However, if you using a version of x264 from Sep 28th 2008 or newer, mplayer will not be able to decode this again properly. Until this is fixed this mplayer, you might want to replace "-ovc x264 -x264encopts qp=0" with "-ovc lavc -lavcopts vcodec=ffv1:format=bgr32:coder=1:vstrict=-1". Watch out, though, as this needs *way* more space than x264 does.
"-x264encopts qp=0" tells the x264 codec to use a quantizer of 0, which results in lossless video quality.
"-oac pcm" saves the audio data uncompressed (this might turn out really big).
"-noskip" makes sure that no frame is dropped during capturing.
"-nocache" is responsible for immediate encoding and not using any cache.
"-mc 0" makes sure that the sound does not go out of sync.
"-aspect 4/3" sets the avi's aspect ratio so you can see it in fullscreen and have no borders to the left and right.
"NESVSETTINGS" takes care of proper recognition of the audio and video data from FCEUX.
"&> mencoder.log" lets mencoders log its output into a file called "mencoder.log" in your current working directory.
"--playmov" reads which movie file we want to load (here it's mymovie.fm2).
Lastly, we load our desired ROM (in this case it's "myROM.nes").
To go for faster encoding and thus less quality, change "-ovc x264 -x264encopts qp=0" to "-ovc xvid -xvidencopts bitrate=200" and "-oac pcm" to "-oac mp3lame -lameopts mode=3:preset=60" to create a 200 kbps xvid video with 60 kbps of mono mp3 audio.
Good luck! :)

View File

@ -0,0 +1,313 @@
<html>
<head>
<title>FCE Ultra Cheat Guide</title>
</head>
<body>
<center><h1>FCE Ultra Cheat Guide</h1></center>
<center><i>Last updated November 12, 2003<br />Valid as of FCE Ultra 0.97.4</i></center>
<p>
<b>Table of Contents:</b>
<ul>
<li><a href="#intro">Introduction</a>
<ul>
<li><a href="#cheatfiles">Cheat Files</a>
</ul>
<li><a href="#windows">The Windows Interface</a>
<ul>
<li><a href="#windows-search">Cheat Search Interface</a>
</ul>
<li><ba href="#text">The Text Interface(TODO)</ba>
<li><a href="#examples">Examples</a>
<ul>
<li><a href="#examples-mm3">"Mega Man 3" Windows Example</a>
<li><a href="#examples-oh">"Over Horizon" Text Interface Example</a>
</ul>
<li><a href="#tips">Tips</a>
</ul>
<hr width="100%">
<a name="tips"><h2>Introduction</h2></a>
<p>
FCE Ultra allows cheating by the periodic "patching" of arbitrary addresses
in the 6502's memory space with arbitrary values, as well as read substitution.
"Read substitution" is the method that would be used on a real NES/Famicom,
such as done by the Game Genie and Pro Action Replay. It is required
to support GG and PAR codes, but since it is relatively slow when done
in emulation, it is not the preferred method when a RAM patch will
suffice. Also, in FCE Ultra, read substitution will not work properly with
zero-page addressing modes(instructions that operate on RAM at $0000 through
$00FF).
</p>
<p>
The RAM patches are all applied a short time before the emulated
vertical blanking period. This detail shouldn't concern most people, though.
However, this does mean that cheating with games that use
bank-switched RAM may be problematic. Fortunately, such games are not very
common(in relation to the total number of NES and Famicom games).
</p>
<a name="cheatfiles"><h3>Cheat Files</h3></a>
<p>
Cheats are stored in the "cheats" subdirectory under the base FCE Ultra
directory. The files are in a simple plain-text format. Each line represents
a one-byte memory patch. The format is as follows(text in brackets []
represents optional parameters):
</p>
<p>
<blockquote>
[S][C][:]Address(hex):Value(hex):[Compare value:]Description
</blockquote>
Example:
<blockquote> 040e:05:Infinite super power.</blockquote>
</p>
<p>
A colon(:) near the beginning of the line is used to disable the cheat.
"S" denotes a cheat that is a read-substitute-style cheat(such as with Game
Genie cheats), and a "C" denotes that the cheat has a compare value.
</p>
<hr width="100%">
<a name="windows"><h2>The Windows Interface</h2></a>
<p>
All addresses listed in the cheats window are in unsigned
16-bit hexadecimal format and all values in these windows are in an
unsigned 8-bit decimal format(the range for values is 0 through 255).
</p>
<p>
The cheats window contains the list of cheats for the currently loaded game
on the right side. Existing cheats can be selected, edited, and updated
using the "Update" button.
</p>
<a name="windows-search"><h3>Cheat Search Interface</h2></a>
<p>
The cheat search interface consists of several components: a list of
addresses and associated data for a search, several command buttons,
and the search parameters.
</p>
<p>
Each entry in the list is in the format of:
<blockquote>Address:Original Value:Current Value</blockquote>
</p>
<p>
The address is the location in the 6502's address space, the original
value is the value that was stored at this address when the search was
reset, and the current value is the value that is currently stored at
that address. Selecting an item in this list will automatically cause
the "Address" field in the cheat information box on the right side of the
window to be updated with the selected address.
</p>
<p>
The "Reset Search" button resets the search process; all valid addresses
are displayed in the cheat list and the data values at those addresses noted.
</p>
<p>
The "Do Search" buttons performs a search based on the search parameters
and removes any non-matching addresses from the address list.
</p>
<p>
The "Set Original to Current" button sets the remembered original values
to the current values. It is like the "Reset Search" button, but it does
not affect which addresses are shown in the address list. This command is
especially useful when used in conjunction with the "O!=C" search filter.
</p>
<p>
The "Unhide Excluded" button shows all addresses that are excluded as a
result of any previous searches. It is like the "Reset Search" button
except that it does not affect the remembered original values.
</p>
<p>
The numbers assigned the names "V1" and "V2" have different meanings based
on which filter is selected. A list of the names of the filters and detailed
information on what they do follows("original value" corresponds to the value
remembered for a given addres and "current value" is the value currently
at that address. Also, if a value is not explicitly said to be shown
under a certain condition, then it is obviously excluded.):
<p>
"O==V1 && C==V2":
<blockquote>
Show the address if the original value is equal to "V1" AND
the current value is equal to "V2".
</blockquote>
</p>
<p>
"O==V1 && |O-C|==V2":
<blockquote>
Show the address if the original value is equal to "V1" AND
the difference between the current value and the original
value is equal to "V2".
</blockquote>
</p>
<p>
"|O-C|==V2":
<blockquote>
Show the address if the difference between the current value
and the original value is equal to "V2".
</blockquote>
</p>
<p>
"O!=C":
<blockquote>
Show the address if the original value does not equal the
current value.
</blockquote>
</p>
<p>
The following cheat methods/filters automatically perform the function
of the "Set Original to Current" button after "Do Search" is pressed.
</p>
<p>
"Value decreased."
<blockquote>
Show the address if the value has decreased.
</blockquote>
</p>
<p>
"Value increased."
<blockquote>
Show the address if the value has increased.
</blockquote>
</p>
<hr width="100%">
<a name="examples"><h2>Examples</h2></a>
<a name="examples-mm3"><h3>"Mega Man 3" Windows Example</h3></a>
<p>
This example will give Mega Man unlimited energy.
Immediately after entering the Top Man stage, make your way to the
"Add Cheat" window. Push "Reset Search".
Go back to playing and move right until the first enemy appears. Allow
yourself to be hit twice. Each hit does "2" damage, so you've lost 4 energy
bars. Go to the "Add Cheat" window again and select the third filter
("|O-C|==V2") and enter the value 4 next to "V2". Then push "Do Search".
</p>
<p>
Several addresses will appear in the address list. You can try to find
the address you want through trial and error, or you can narrow the results
down further. We will do the latter.
</p>
<p>
Go back to playing MM3 and get hit one more time and make your way back
to the "Add Cheat" window. Your damage is now "6". You can probably
see which address that contains your life(it is 00A2). If not, change
V2 to 6 and push "Do Search" again. This should leave only 00A2.
</p>
<p>
Select that entry in the address list. Shift your attention to the "Add
Cheat" box to the right. Type in a meaningful name and the desired value(156;
it was the value when you had no damage, so it's safe to assume it's the
maximum value you can use). Push the "Add" button and a new entry will
appear in the cheats list. The cheat has been added.
</p>
<a name="examples-oh"><h3>"Over Horizon" Text Interface Example</h3></a>
<p>
This example will give you infinite lives in the NTSC(Japanese) version
of "Over Horizon".
</p>
<p>
Start a new game. Notice that when you press "Start" during gameplay,
the number of lives you have left is indicated. With no cheating, you
start with 3 lives(2 lives left).
</p>
<p>
Activate the cheat interface immediately after starting a new game.
Select the "New Cheats" menu and "Reset Search".
</p>
<p>
I'll assume that the number of lives left shown in the game is the same number
that's stored in RAM. Now, "Do Search". You're going to use the first search
filter. For V1, enter the value 2. For V2, enter the same value. This,
coupled with the fact that you just reset the search, will allow you to search
for a value "absolutely"(as opposed to changes in the value).
</p>
<p>
Now, "Show Results". When I did it, I received 11 results:
</p>
<pre>
1) $0000:002:002
2) $001c:002:002
3) $001e:002:002
4) $009d:002:002
5) $00b9:002:002
6) $00e3:002:002
7) $0405:002:002
8) $0406:002:002
9) $0695:002:002
10) $07d5:002:002
11) $07f8:002:002
</pre>
<p>
You really can't do much yet(unless you want to spend time doing trial
and error cheat additions). Return to the game.
</p>
<p>
After losing a life, go back to the cheat interface, to the "New Cheats"
menu, and "Show Results". Here are my results:
</p>
<pre>
1) $0000:002:002
2) $001c:002:002
3) $001e:002:002
4) $009d:002:002
5) $00b9:002:041
6) $00e3:002:002
7) $0405:002:001
8) $0406:002:002
9) $0695:002:002
10) $07d5:002:001
11) $07f8:002:002
</pre>
<p>
Notice that two addresses seem to hold the number of lives($0405 and
$07d5). You can lose another life and go "Show Results" again, and you
should see that $07d5 is the address that holds the number of lives.
</p>
<p>
Now that you know the address that holds the number of lives, you can
add a cheat. You can either type in the number from the cheat results list
corresponding to the address you want to add a cheat for, or you can
remember the address and select "Add Cheat" from the "New Cheats" menu.
Do the former.
</p>
<p>
Now you will need to enter a name for the cheat. I suggest something short,
but descriptive. "Infinite lives" will work fine. Next, a prompt for
the address will show up. Since you selected an item from the list, you
can press enter to use the associated address($07d5). Next, you will
need to enter a value. It doesn't need to be large(in fact, it probably
shouldn't be; abnormally high numbers can cause some games to misbehave).
I suggest a value of 2. After this, you should get a prompt that looks like
this:
</p>
<pre>
Add cheat "Infinite lives" for address $07d5 with value 002?(Y/N)[N]:
</pre>
<p>
Answer "Y". You now have infinite lives.
</p>
<hr width="100%">
<a name="tips"><h2>Tips</h2></a>
<p>
Games store player information in many different ways. For example,
if you have "3" lives in Super Wacky Dodgeball 1989, the game might store
it in memory as 2, 3, or 4, or perhaps a different number all together.
Also, say that you have 69 life points out of 200 in Mole Mashers. The
game might store how many life points you have, or how much damage you have
taken. Relative value searches are very valuable because you probably
don't know the way that the game stores its player data.
</p>
<p>
Some games, especially RPGs, deal with individual numbers greater than
8-bits in size. Most that I've seen seem to store the multiple-byte data
least significant byte(lower byte of number) first in memory, though
conceivably, it could be stored most significant byte first, or the component
bytes of the number could be non-contiguous, though the latter is very unlikely.
For example, say I have 5304 experience points in Boring Quest for the
Overused Plot Device. To split the number into two eight bit decimal numbers,
take 5304 %(modulus) 256. This will give a number that is the lower 8 bits.
Next, take 5304 / 256. The integral component of your answer will be the
upper 8 bits(or the next 8 bits, if the number is or can be larger than 16
bits) of 5304. Now you will need to search for these numbers. Fortunately,
most(all?) RPGs seem to store large numbers exactly as they are shown in the
game.
</p>
</body>
</html>

View File

@ -0,0 +1,67 @@
FCE Ultra General User's FAQ
preliminary version
Last updated on: Friday 13th, 2003
------------------
Q: Why do some games make a popping sound(Rad Racer 2, Final Fantasy 3)?
A: These games do a very crude drum imitation by causing a large jump in
the output level for a short period of time via the register at $4011.
The analog filters on a real NES and Famicom make it sound rather decent.
I have not completely emulated these filters. Enabling high-quality
sound emulation will also make these pseudo-drums sound better. See
the next question for more information.
Q: Why do some games' digitized sounds sound too loud?
Why do the drums in Crystalis and other games sound fuzzy?
A: The NES' digital to analog converter is faulty, in that it does not output
sound linearly. This effect is most noteable when a games messes with
register $4011, which is added with the triangle wave channel and the noise
channel outputs. When $4011 is set to a large value, the volume
of the triangle wave channel and the noise channel drop significantly. More
Importantly, when digitized sounds are being played and the digitized sample
stream is at a high value, less changes will be noticeable. In other words,
the byte sequence "00 01 00" would be much more audible than the sequence
"7e 7f 7e". This non-linearity is only emulated when high-quality sound
emulation is enabled.
Q: Why doesn't the NSF <insert name here> work(correctly) on FCE Ultra?
A: Some NSF rips are bad. Some read from addresses that are not specified
in the NSF specifications, expecting certain values to be returned.
Others execute undocumented instructions that have no affect on
less-accurate software NSF players, but will cause problems on NSF players
that emulate these instructions. Also, the playback rate specified
in the NSF header is currently ignored, though I haven't encountered
any problems in doing this.
Q: Why doesn't the game <insert name here> work(correctly) on FCE Ultra?
A: Many factors can make a game not work on FCE Ultra:
- If the ROM image is in the iNES format(typically files that have
the extension "nes"), its header may be incorrect. This
incorrectness may also be because of garbage in the
header. Certain utilities used to put text in the reserved
bytes of the iNES header, then those reserved bytes were
later assigned functions. FCE Ultra recognizes and
automatically removes(from the ROM image in RAM, not on the
storage medium) SOME header junk.
If the game has graphical errors while scrolling, chances are
the mirroring is set incorrectly in the header.
You can try to edit the header with a utility(in the NES
utilities section at http://zophar.net ) or a hex editor.
- The on-cart hardware the game uses may not be emulated
correctly.
- Limitations of the ROM image format may prevent a game from
being emulated correctly without special code to recognize that
game. This occurs quite often with many Koei MMC5(iNES mapper 5)
and MMC1(iNES mapper 1) games in the iNES format. FCE Ultra identifies
and emulates some of these games based on the ROM CRC32 value.
- The ROM image may be encrypted. The author of SMYNES seems to
have done this intentionally to block other emulators from
playing "SMYNES only" games.

View File

@ -0,0 +1,74 @@
.\" Hey, EMACS: -*- nroff -*-
.\" (C) Copyright 2012 Joe Nahmias <jello@debian.org>
.\"
.\" First parameter, NAME, should be all caps
.\" Second parameter, SECTION, should be 1-8, maybe w/ subsection
.\" other parameters are allowed: see man(7), man(1)
.TH FCEUX-NET-SERVER 6 "October 12, 2012"
.\" Please adjust this date whenever revising the manpage.
.\"
.\" Some roff macros, for reference:
.\" .nh disable hyphenation
.\" .hy enable hyphenation
.\" .ad l left justify
.\" .ad b justify to both left and right margins
.\" .nf disable filling
.\" .fi enable filling
.\" .br insert line break
.\" .sp <n> insert n+1 empty lines
.\" for manpage-specific macros, see man(7)
.SH NAME
fceux-net-server \- FCE Ultra game server
.SH SYNOPSIS
.B fceux-net-server
.RI [ options ]
.SH DESCRIPTION
This manual page documents briefly the
.B fceux-net-server
command.
.PP
\fBfceux-net-server\fP is the game server for multiplayer use of the FCE Ultra
family of NES emulators. This server will first look in
\fI/etc/fceux-server.conf\fP for options. If that file does not exist, it will
use the defaults given here. Any argument given directly will override any
default values.
.SH OPTIONS
These programs follow the usual GNU command line syntax, with long
options starting with two dashes (`-').
A summary of options is included below.
.TP
.B \-h, \-\-help
Displays a help message.
.TP
.B \-v, \-\-version
Displays the version number and quits.
.TP
.B \-p, \-\-port
Starts server on given port (default = \fI4046\fP).
.TP
.B \-w, \-\-password
Specifies a password for entry.
.TP
.B \-m, \-\-maxclients
Specifies the maximum number of clients allowed to access the
server (default = \fI100\fP).
.TP
.B \-t, \-\-timeout
Specifies the number of seconds before the server times out (default = \fI5\fP).
.TP
.B \-f, \-\-framedivisor
Specifies frame divisor, which controls the number of updates sent to client;
calculated as: 60 / framedivisor = updates per second (default = \fI1\fP).
.TP
.B \-c, \-\-configfile
Loads the given configuration file (default = \fI/etc/fceux\-server.conf\fP).
.SH SEE ALSO
.BR fceux (6),
The
.B FCEUX
project homepage
.RI < http://fceux.com/ >.
.SH AUTHOR
This manual page was written by Joe Nahmias <jello@debian.org>
for the Debian GNU/Linux system (but may be used by others).

View File

@ -0,0 +1,353 @@
.\" t Hey, EMACS: -*- nroff -*-
.\" First parameter, NAME, should be all caps
.\" Second parameter, SECTION, should be 1-8, maybe w/ subsection
.\" other parameters are allowed: see man(7), man(1)
.TH FCEUX 6 "June 24, 2012"
.\" Please adjust this date whenever revising the manpage.
.\"
.\" Some roff macros, for reference:
.\" .nh disable hyphenation
.\" .hy enable hyphenation
.\" .ad l left justify
.\" .ad b justify to both left and right margins
.\" .nf disable filling
.\" .fi enable filling
.\" .br insert line break
.\" .sp <n> insert n+1 empty lines
.\" for manpage-specific macros, see man(7)
.SH NAME
fceux \- An emulator for the original (8-bit) Nintendo / Famicom game console.
.SH SYNOPSIS
.B fceux
.RI [ options ]
"filename"
.SH DESCRIPTION
.B FCEUX
is an emulator for the original (8-bit) Nintendo Entertainment System (NES).
It has a robust color palette rendering engine that is fully customizable,
along with excellent sound and joystick support, and even supports movie
recording and playback.
.SH OPTIONS
.SS Misc. Options
.TP
.B \--no-config {0|1}
Use default config file and do not save to it, when enabled.
.TP
.B \-g {0|1}, \--gamegenie {0|1}
Enable or disable emulated Game Genie.
.TP
.B \--nogui {0|1}
Enable or disable the GTK GUI.
.TP
.B \--loadlua FILE
Loads lua script from filename FILE.
.SS Emulation Options
.TP
.B \--pal {0|1}
Enable or disable PAL mode.
.SS Input Options
.TP
.B \-i DEV, \--inputcfg DEV
Configures input device DEV on startup.
Devices: gamepad powerpad hypershot quizking
.TP
.B \--input{1|2} DEV
Set which input device to emulate for input 1 or 2.
Devices: gamepad zapper powerpad.0 powerpad.1 arkanoid
.TP
.B \--input{3|4} DEV
Set the famicom expansion device to emulate for input 3 or 4.
Devices: quizking hypershot mahjong toprider ftrainer familykeyboard
oekakids arkanoid shadow bworld 4player
.TP
.B \--inputdisplay {0|1}
Enable or disable input display.
.TP
.B \--fourscore {0|1}
Enable or disable fourscore emulation.
.SS Graphics Options
.TP
.B \--newppu {0|1}
Enable or disable the new PPU core. (WARNING: May break savestates)
.TP
.B \--frameskip NUM
Set NUM of frames to skip per emulated frame.
.TP
.B \--clipsides {0|1}
Enable or disable clipping of the leftmost and rightmost 8 columns of
the video output.
.TP
.B \--slstart SCANLINE
Set the first scanline to be rendered.
.TP
.B \--slend SCANLINE
Set the last scanline to be rendered.
.TP
.B \--nospritelim {0|1}
When set to 0, this disables the normal 8 sprites per scanline limitation.
When set to 1, this enables the normal 8 sprites per scanline limitation.
NOTE: Yes, this option is 'backwards'.
.TP
.B \-x XRES, \--xres XRES
Set horizontal resolution for full screen mode.
.TP
.B \-y YRES, \--yres YRES
Set vertical resolution for full screen mode.
.TP
.B \--doublebuf {0|1}
Enable or disable double buffering.
.TP
.B \--autoscale {0|1}
Enable or disable autoscaling in fullscreen.
.TP
.B \--keepratio {0|1}
Keep native NES aspect ratio when autoscaling.
.TP
.B \--{x|y}scale VAL
Multiply width/height by VAL.
(Real numbers > 0 with OpenGL, otherwise integers > 0).
.TP
.B \--{x|y}stretch {0|1}
Stretch to fill surface on x/y axis (OpenGL only).
.TP
.B \-b {8|16|24|32}, \--bpp {8|16|24|32}
Set bits per pixel.
.TP
.B \--opengl {0|1}
Enable or disable OpenGL support.
.TP
.B \--openglip {0|1}
Enable or disable OpenGL linear interpolation.
.TP
.B \-f {0|1}, \--fullscreen {0|1}
Enable or disable full-screen mode.
.TP
.B \--noframe {0|1}
Hide title bar and window decorations.
.TP
.B \--special {1-4}
Use special video scaling filters.
(1 = hq2x 2 = Scale2x 3 = NTSC 2x 4 = hq3x 5 = Scale3x)
.TP
.B \-p FILE, \--palette FILE
Use the custom palette in FILE.
.TP
.B \--ntsccolor {0|1}
Enable or disable NTSC NES colors.
.TP
.B \--tint VAL
Set the NTSC tint.
.TP
.B \--hue VAL
Set the NTSC hue.
.SS Sound Options
.TP
.B \-s {0|1}, \--sound {0|1}
Enable or disable sound.
.TP
.B \--soundrate RATE
Set the sound playback sample rate (0 == off?).
.TP
.B \--soundq {0|1|2}
Set sound quality. (0 = Low 1 = High 2 = Very High)
.TP
.B \--soundbufsize MS
Set sound buffer size to MS milliseconds.
.TP
.B \--volume {0-256}
Sets the sound volume to the given value, where 256 is max volume.
.TP
.B \--trianglevol {0-256}
Sets the sound volume of the triangle wave to the given value, where 256 is max volume.
.TP
.B \--square1vol {0-256}
Sets the sound volume of square wave 1 to the given value, where 256 is max volume.
.TP
.B \--square2vol {0-256}
Sets the sound volume of square wave 2 to the given value, where 256 is max volume.
.TP
.B \--noisevol {0-256}
Sets the sound volume of the noise generator to the given value, where 256 is max volume.
.TP
.B \--lowpass {0|1}
Enables or disables lowpass filtering of the sound.
.TP
.B \--soundrecord FILE
Record sound to file FILE.
.SS Movie Options
.TP
.B \--playmov FILE
Play back a recorded FCM/FM2 movie from filename FILE.
.TP
.B \--pauseframe FRAME
Pause movie playback at frame FRAME.
.TP
.B \--moviemsg {0|1}
Enable or disable movie messages.
.TP
.B \--fcmconvert FILE
Convert fcm movie file FILE to fm2.
.TP
.B \--ripsubs FILE
Convert movie's subtitles to srt.
.TP
.B \--subtitles {0|1}
Enable or disable subtitle display.
.SS Networking Options
.TP
.B \-n SRV, \--net SRV
Connect to server SRV for TCP/IP network play.
.TP
.B \--port PORT
Use TCP/IP port PORT for network play.
.TP
.B \-u NICK, \--user NICK
Set the nickname to use in network play.
.TP
.B \-w PASS, \--pass PASS
Set password to use for connecting to the server.
.TP
.B \-k NETKEY, \--netkey NETKEY
Use string NETKEY to create a unique session for the game loaded.
.TP
.B \--players NUM
Set the number of local players.
.TP
.B \--rp2mic {0|1}
If enabled, replace Port 2 Start with microphone (Famicom).
.TP
.B \--videolog c
Calls mencoder to grab the video and audio streams to encode them. Check the documentation for more on this.?
.TP
.B \--mute {0|1}
Mutes FCEUX while still passing the audio stream to mencoder.
.TP
.SH KEYBOARD COMMANDS
.B FCEUX
has a number of commands available within the emulator.
It also includes default keyboard bindings when emulating game pads or power pads.
.SS Gamepad Keyboard Bindings
.TS
center box;
cb | cb, c | ci.
NES Gamepad Keyboard
=
Up Keypad Up
Down Keypad Down
Left Keypad Left
Right Keypad Right
A F
B D
Select S
Start Enter
.TE
.SS Other Commands
.PP
.TP 15
.BI <Alt+Enter>
Toggle full-screen mode.
.TP 15
.BI <F1>
Cheat menu (command-line only).
.TP 15
.BI <F2>
Toggle savestate binding to movies.
.TP 15
.BI <F3>
Load LUA script.
.TP 15
.BI <F4>
Toggles background rendering.
.TP 15
.BI <F5>
Save game state into current slot (set using number keys).
.TP 15
.BI <F7>
Restore game state from current slot (set using number keys).
.TP 15
.BI <F10>
Toggle movie subtitles.
.TP 15
.BI <F11>
Reset NES.
.TP 15
.BI <F12>
Save screen snapshot.
.TP 15
.BI Shift + <F5>
Beging recording video.
.TP 15
.BI Shift + <F7>
Load recorded video.
.TP 15
.BI 0-9
Select save state slot.
.TP 15
.BI Page Up/Page Down
Select next/previous state.
.TP 15
.BI \-
Decrease emulation speed.
.TP 15
.BI =
Increase emulation speed.
.TP 15
.BI Tab
Hold for turbo emulation speed.
.TP 15
.BI Pause
Pause emulation.
.TP 15
.BI \e
Advance a single frame.
.TP 15
.BI .
Toggle movie frame counter.
.TP 15
.BI ,
Toggle input display.
.TP 15
.BI q
Toggle movie read-only.
.TP 15
.BI '
Advance a single frame.
.TP 15
.BI /
Lag counter display.
.TP 15
.BI Delete
Frame advance lag skip display.
.TP 15
.BR <ESC>
Quit
.B FCEUX.
.SS VS Unisystem Commands
.PP
.TP 15
.BI <F8>
Insert coin.
.TP 15
.BI <F6>
Show/Hide dip switches.
.TP 15
.BI 1-8
Toggle dip switches (when dip switches are shown).
.SS Famicom Disk System Commands
.PP
.TP 15
.BI <F6>
Select disk and disk side.
.TP 15
.BI <F8>
Eject or insert disk.
.TP
.I http://fceux.com/
The
.B FCEUX
project homepage.
.SH AUTHOR
This manual page was written by Joe Nahmias <joe _at_ nahmias.net>,
Lukas Sabota <ltsmooth42 _at_ gmail.com> and Alexander Toresson
<alexander.toresson _at_ gmail.com> for the Debian GNU/Linux system
(but may be used by others).

View File

@ -0,0 +1,153 @@
FCE Ultra Save State Format
Updated: Mar 9, 2003
---------------------------------------
FCE Ultra's save state format is now designed to be as forward and backwards
compatible as possible. This is achieved through the (over)use of chunks.
All multiple-byte variables are stored LSB(least significant byte)-first.
Data types:
(u)int8 - (un)signed 8 bit variable(also referred to as "byte")
(u)int16 - (un)signed 16 bit variable
(u)int32 - (un)signed 32 bit variable
-- Main File Header:
The main file header is 16-bytes in length. The first three bytes contain
the string "FCS". The next byte contains the version of FCE Ultra that saved
this save state. This document only applies to version "53"(.53) and higher.
After the version byte, the size of the entire file in bytes(minus the 16 byte
main file header) is stored. The rest of the header is currently unused
and should be nulled out. Example of relevant parts:
FCS <uint8 version> <uint32 totalsize>
-- Section Chunks:
Sections chunk headers are 5-bytes in length. The first byte defines what
section it is, the next four bytes define the total size of the section
(including the section chunk header).
<uint8 section> <uint32 size>
Section definitions:
1 - "CPU"
2 - "CPUC"
3 - "PPU"
4 - "CTLR"
5 - "SND"
16 - "EXTRA"
-- Subsection Chunks
Subsection chunks are stored within section chunks. They contain the actual
state data. Each subsection chunk is composed of an 8-byte header and the data.
The header contains a description(a name) and the size of the data contained
in the chunk:
<uint8 description[4]> <uint32 size>
The name is a four-byte string. It does not need to be null-terminated.
If the string is less than four bytes in length, the remaining unused bytes
must be null.
-- Subsection Chunk Description Definitions
Note that not all subsection chunk description definitions listed below
are guaranteed to be in the section chunk. It's just a list of what CAN
be in a section chunk. This especially applies to the "EXTRA" subsection.
---- Section "CPU"
Name: Type: Description:
PC uint16 Program Counter
A uint8 Accumulator
P uint8 Processor status register
X uint8 X register
Y uint8 Y register
S uint8 Stack pointer
RAM uint8[0x800] 2KB work RAM
---- Section "CPUC" (emulator specific)
Name: Type: Description:
JAMM uint8 Non-zero value if CPU in a "jammed" state
IRQL uint8 Non-zero value if IRQs are to be generated constantly
ICoa int32 Temporary cycle counter
ICou int32 Cycle counter
---- Section "PPU"
Name: Type: Description:
NTAR uint8[0x800] 2 KB of name/attribute table RAM
PRAM uint8[32] 32 bytes of palette index RAM
SPRA uint8[0x100] 256 bytes of sprite RAM
PPU uint8[4] Last values written to $2000 and $2001, the PPU
status register, and the last value written to
$2003.
XOFF uint8 Tile X-offset.
VTOG uint8 Toggle used by $2005 and $2006.
RADD uint16 PPU Address Register(address written to/read from
when $2007 is accessed).
TADD uint16 PPU Address Register
VBUF uint8 VRAM Read Buffer
PGEN uint8 PPU "general" latch. See Ki's document.
---- Section "CTLR" (somewhat emulator specific)
Name: Type: Description:
J1RB uint8 Bit to be returned when first joystick is read.
J2RB uint8 Bit to be returned when second joystick is read.
---- Section "SND" (somewhat emulator specific)
NREG uint16 Noise LFSR.
P17 uint8 Last byte written to $4017.
PBIN uint8 DMC bit index.
PAIN uint32 DMC address index(from $8000).
PSIN uint32 DMC length counter(how many bytes left
to fetch).
<to be finished>
---- Section "EXTRA" (varying emulator specificness)
For iNES-format games(incomplete, and doesn't apply to every game):
Name: Type: Description:
WRAM uint8[0x2000] 8KB of WRAM at $6000-$7fff
MEXR uint8[0x8000] (very emulator specific)
CHRR uint8[0x2000] 8KB of CHR RAM at $0000-$1fff(in PPU address space).
EXNR uint8[0x800] Extra 2KB of name/attribute table RAM.
MPBY uint8[32] (very emulator specific)
MIRR uint8 Current mirroring:
0 = "Horizontal"
1 = "Vertical"
$10 = Mirror from $2000
$11 = Mirror from $2400
IRQC uint32 Generic IRQ counter
IQL1 uint32 Generic IRQ latch
IQL2 uint32 Generic IRQ latch
IRQA uint8 Generic IRQ on/off register.
PBL uint8[4] List of 4 8KB ROM banks paged in at $8000-$FFFF
CBL uint8[8] List of 8 1KB VROM banks page in at $0000-$1FFF(PPU).
For FDS games(incomplete):
Name: Type: Description:
DDT<x> uint8[65500] Disk data for side x(0-3).
FDSR uint8[0x8000] 32 KB of work RAM
CHRR uint8[0x2000] 8 KB of CHR RAM
IRQC uint32 IRQ counter
IQL1 uint32 IRQ latch
IRQA uint8 IRQ on/off.
WAVE uint8[64] Carrier waveform data.
MWAV uint8[32] Modulator waveform data.
AMPL uint8[2] Amplitude data.

View File

@ -0,0 +1,79 @@
FM2 is ascii plain text.
It consists of several key-value pairs followed by an inputlog section.
The inputlog section can be identified by its starting with a | (pipe).
The inputlog section terminates at eof.
Newlines may be \r\n or \n
Key-value pairs consist of a key identifier, followed by a space separator, followed by the value text.
Value text is always terminated by a newline, which the value text will not include.
The value text is parsed differently depending on the type of the key.
The key-value pairs may be in any order, except that the first key must be version.
Integer keys (also used for booleans, with a 1 or 0) will have a value that is a simple integer not to exceed 32bits
- version (required) - the version of the movie file format; for now it is always 3
- emuVersion (required) - the version of the emulator used to produce the movie
- rerecordCount (optional) - the rerecord count
- palFlag (bool) (optional) - true if the movie uses pal timing
- fourscore (bool) (*note C) - true if a fourscore was used
- port0, port1 (*note C) - indicates the types of input devices. Supported values are:
SI_GAMEPAD = 1,
SI_ZAPPER = 2
- port2 (required) - indicates the type of the FCExp port device which was attached. Supported values are:
SIFC_NONE = 0
String keys have values that consist of the remainder of the key-value pair line. As a consequence, string values cannot contain newlines.
- romFilename (required) - the name of the file used to record the movie
- comment (optional) - simply a memo.
by convention, the first token in the comment value is the subject of the comment.
by convention, subsequent comments with the same subject will have their ordering preserved and may be used to approximate multiline comments.
by convention, the author of the movie should be stored in comment(s) with a subject of: author
Hex string keys (used for binary blobs) will have a value that is like 0x0123456789ABCDEF...
- romChecksum (required) - the MD5 hash of the rom which was used to record the movie
- savestate (optional) - a fcs savestate blob, in case a movie was recorded from savestate
GUID keys have a value which is in the standard guid format: 452DE2C3-EF43-2FA9-77AC-0677FC51543B
- guid (required) a unique identifier for a movie, generated when the movie is created, which is used when loading a savestate to make sure it belongs to the current movie.
The inputlog section consists of lines beginning and ending with a | (pipe).
The fields are as follows, except as noted in note C.
|c|port0|port1|port2|
field c is a variable length decimal integer which is a bitfield corresponding to miscellaneous input states which are valid at the start of the frame.
Current values for this are
MOVIECMD_RESET = 1
the format of port0, port1, port2 depends on which types of devices were attached.
SI_GAMEPAD:
the field consists of eight characters which constitute a bitfield.
any character other than ' ' or '.' means that the button was pressed.
by convention, the following mnemonics will be used in a column to remind us of which button corresponds to which column:
RLDUTSBA (Right,Left,Down,Up,sTart,Select,B,A)
This seemingly arbitrary ordering is actually the reverse of the originally-desired order, which was screwed up in the first release of FCEUX. So we have preserved it for compatibility's sake.
SI_ZAPPER:
XXX YYY B Q Z
XXX: %03d, the x position of the mouse
YYY: %03d, the y position of the mouse
B: %1d, 1 if the mouse button is pressed; 0 if not
Q: %1d, an internal value used by the emulator's zapper code (this is most unfortunate..)
Z: %d, a variable-length decimal integer; an internal value used by the emulator's zapper code (this is even more unfortunate..)
SIFC_NONE:
this field must always be empty.
* Notes *
A. There is no key-value pair that indicates the length of the movie. This must be read by scanning the inputlog and counting the number of lines.
B. All movies start from power-on, unless a savestate key-value is present.
C.
If a fourscore is used, then port0 and port1 are irrelevant and ignored.
The input types must all be gamepads, and the inputlog will be in the following format:
{player1 player2 player3 player4}
|c|RLDUTSBA|RLDUTSBA|RLDUTSBA|RLDUTSBA|port2|
If a fourscore is not used, then port0 and port1 are required.
D. The emulator uses these framerate constants
- NTSC: 1008307711 /256/65536 = 60.099822938442230224609375
- PAL : 838977920 /256/65536 = 50.00698089599609375
E. The author of this format is curious about what people think of it. Please let him know!

View File

@ -0,0 +1,289 @@
FCE Ultra Porting Guide
Updated: October 4, 2003
*Incomplete*
***Driver-supplied functions:
These functions will only be called after the driver code calls
FCEUI_LoadGame() or FCEUI_Emulate().
void FCEUD_Update(uint8 *XBuf, int32 *Buffer, int Count);
Called by FCE Ultra on every emulated frame. This function should
perform the following three things(in any order):
1.
Update the data pointed to by the pointers passed to
FCEUI_SetInput() and FCEUI_SetInputFC().
2.
Copy contents of XBuf over to video memory(or whatever needs to be
done to make the contents of XBuf visible on screen).
Each line is 256 pixels(and bytes) in width, and there can be 240
lines. The pitch for each line is 272 bytes.
XBuf will be 0 if the symbol FRAMESKIP is defined and this frame
was skipped.
3.
Write the contents of "Buffer" to the sound device. "Count" is the
number of samples to write. Only the lower 16-bits of each
sample are used, so each 32-bit sample in "Buffer" can be converted to
signed 16-bit by dropping the upper 16 bits.
When sound was disabled for the frame, "Count" will be 0.
void FCEUD_SetPalette(uint8 index, uint8 r, uint8 g, uint8 b);
Set palette entry "index" to specified RGB values(value: min=0, max=255).
void FCEUD_GetPalette(uint8 index, uint8 *r, uint8 *g, uint8 *b);
Get palette entry "index" data.
void FCEUD_PrintError(char *s);
Print/Display an error message string pointed to by "s".
void FCEUD_Message(char *s);
Display a status message string.
int FCEUD_NetworkConnect(void);
Initialize a network connection. Return 0 if an error occurs.
int FCEUD_GetDataFromClients(uint8 *data);
/* Sends 5 bytes of data to all clients. */
int FCEUD_SendDataToClients(uint8 *data);
/* Sends 1 byte of data to server, and maybe a command. */
int FCEUD_SendDataToServer(uint8 v, uint8 cmd);
/* Gets 5 bytes of data from the server. This function must block. */
int FCEUD_GetDataFromServer(uint8 *data);
void FCEUD_NetworkClose(void);
Close the network connection.
***FCE Ultra functions(called by the driver code):
The FCEUI_* functions may only be called before FCEUI_Emulate() is
called or after it returns and before it is called again, or after the
following functions are called and before they return:
FCEUD_Update();
Calling the FCEUI_* functions at any other time may result in
undefined behavior.
void FCEUI_SetInput(int port, int type, void *ptr, int attrib);
"port" can be either 0 or 1, and corresponds to the physical
ports on the front of a NES.
"type" may be:
SI_NONE - No input on this port.
SI_GAMEPAD - Standard NES gamepad
SI_ZAPPER - "Zapper" light gun.
SI_POWERPAD - Power-pad mat.
SI_ARKANOID - Arkanoid controller.
void FCEUI_SetInputFC(int type, void *ptr, int attrib);
Special Famicom devices.
"type" may be:
SIFC_NONE - No input here.
SIFC_ARKANOID - Arkanoid controller.
SIFC_SHADOW - "Space Shadow" gun.
SIFC_4PLAYER - Famicom 4-player adapter
SIFC_FKB - Family Keyboard
void FCEUI_DisableFourScore(int s);
Disables four-score emulation if s is nonzero.
void FCEUI_SetSnapName(int a);
0 to order screen snapshots numerically(0.png), 1 to order them file
base-numerically(smb3-0.png).
void FCEUI_DisableSpriteLimitation(int a);
Disables the 8-sprite-per-scanline limitation of the NES if "a"
is nonzero. The default behavior is the limitation is enabled.
void FCEUI_SaveExtraDataUnderBase(int a);
If "a" is nonzero, save extra non-volatile game data(battery-backed
RAM) under FCE Ultra's base directory. Otherwise, the behavior is
to save it under the same directory the game is located in(this is
the default behavior).
FCEUGI *FCEUI_LoadGame(char *name);
Loads a new file. "name" is the full path of the file to load.
Returns 0 on failure, or a pointer to data type "FCEUGI":
See file "git.h" for more details on this structure.
int FCEUI_Initialize(void);
Allocates and initializes memory. Should only be called once, before
any calls to other FCEU functions.
void FCEUI_SetBaseDirectory(void);
Specifies the base FCE Ultra directory. This should be called
immediately after FCEUI_Initialize() and any time afterwards.
void FCEUI_SetDirOverride(int which, char *n);
FCEUIOD_CHEATS - Cheats
FCEUIOD_MISC - Miscellaneous stuff(custom game palettes)
FCEUIOD_NV - Non-volatile game data(battery backed RAM)
FCEUIOD_SNAPS - Screen snapshots
FCEUIOD_STATE - Save states
void FCEUI_Emulate(void);
Enters the emulation loop. This loop will be exited when FCEUI_CloseGame()
is called. This function obviously shouldn't be called if FCEUI_LoadGame()
wasn't called or FCEUI_CloseGame() was called after FCEUI_LoadGame().
void FCEUI_CloseGame(void);
Closes the loaded game and frees all memory used to load it.
Also causes FCEUI_Emulate() to return.
void FCEUI_ResetNES(void);
void FCEUI_PowerNES(void);
void FCEUI_SetRenderedLines(int ntscf, int ntscl, int palf, int pall);
Sets the first(minimum is 0) and last(NOT the last scanline plus one;
maximum is 239) scanlines of background data to draw, for both NTSC
emulation mode and PAL emulation mode.
Defaults are as if this function were called with the variables set
up as follows:
ntscf=8, ntscl=231, palf=0, pall=239
void FCEUI_SetNetworkPlay(int type);
Sets status of network play according to "type". If type is 0,
then network play is disabled. If type is 1, then we are server.
If type is 2, then we are a client.
void FCEUI_SelectState(int w);
Selects the state "slot" to save to and load from.
void FCEUI_SaveState(void);
Saves the current virtual NES state from the "slot" selected by
FCEUI_SelectState().
void FCEUI_LoadState(void);
Loads the current virtual NES state from the "slot" selected by
FCEUI_SelectState().
void FCEUI_SaveSnapshot(void);
Saves a screen snapshot.
void FCEUI_DispMessage(char *msg);
Displays a short, one-line message using FCE Ultra's built-in
functions and ASCII font data.
int32 FCEUI_GetDesiredFPS(void);
Returns the desired FPS based on whether NTSC or PAL emulation is
enabled, shifted left by 24 bits(this is necessary because the real
FPS value is not a whole integer). This function should only be
necessary if sound emulation is disabled.
int FCEUI_GetCurrentVidSystem(int *slstart, int *slend);
Convenience function(not strictly necessary, but reduces excessive code
duplication); returns currently emulated video system
(0=NTSC, 1=PAL). It will also set the variables pointed to by slstart
and slend to the first and last scanlines to be rendered, respectively,
if slstart and slend are not 0.
void FCEUI_GetNTSCTH(int *tint, int *hue);
void FCEUI_SetNTSCTH(int n, int tint, int hue);
int FCEUI_AddCheat(char *name, uint16 addr, uint8 val);
Adds a RAM cheat with the specified name to patch the address "addr"
with the value "val".
int FCEUI_DelCheat(uint32 which);
Deletes the specified(by number) cheat.
void FCEUI_ListCheats(void (*callb)(char *name, uint16 a, uint8 v));
Causes FCE Ultra to go through the list of all cheats loaded for
the current game and call callb() for each cheat with the cheat
information.
int FCEUI_GetCheat(uint32 which, char **name, int32 *a, int32 *v, int *s);
Gets information on the cheat referenced by "which".
int FCEUI_SetCheat(uint32 which, char *name, int32 a, int32 v, int s);
Sets information for the cheat referenced by "which".
void FCEUI_CheatSearchBegin(void);
Begins the cheat search process. Current RAM values are copied
to a buffer to later be processed by the other cheat search functions.
void FCEUI_CheatSearchEnd(int type, int v1, int v2);
Searches the buffer using the search method specified by "type"
and the parameters "v1" and "v2".
int32 FCEUI_CheatSearchGetCount(void);
Returns the number of matches from the cheat search.
void FCEUI_CheatSearchGet(void (*callb)(uint16 a, int last, int current));
void FCEUI_CheatSearchGetRange(int first, int last, void (*callb)(uint16 a, int last, int current));
Like FCEUI_CheatSearchGet(), but you can specify the first and last
matches to get.
void FCEUI_CheatSearchShowExcluded(void);
Undos any exclusions of valid addresses done by FCEUI_CheatSearchEnd().
void FCEUI_CheatSearchSetCurrentAsOriginal(void);
Copies the current values in RAM into the cheat search buffer.
void FCEUI_MemDump(uint16 a, int32 len, void (*callb)(uint16 a, uint8 v));
Callback to dump memory.
void FCEUI_DumpMem(char *fname, uint32 start, uint32 end);
Dump memory to filename fname.
void FCEUI_MemPoke(uint16 a, uint8 v, int hl);
Write a byte to specified address. Set hl to 1 to attempt to store
it to ROM("high-level" write).
void FCEUI_NMI(void);
Triggers(queues) an NMI.
void FCEUI_IRQ(void);
Triggers(queues) an IRQ.
void FCEUI_Disassemble(uint16 a, int (*callb)(uint16 a, char *s));
Text disassembly.
void FCEUI_GetIVectors(uint16 *reset, uint16 *irq, uint16 *nmi);
Get current interrupt vectors.
***Recognized defined symbols:
The following defined symbols affect the way FCE Ultra is compiled:
C80x86
- Include 80x86 inline assembly in AT&T syntax, if available. Also
use special 80x86-specific C constructs if the compiler is compatible.
FRAMESKIP
- Include frame skipping code.
NETWORK
- Include network play code.
FPS
- Compile code that prints out a number when FCE Ultra exits
that represents the average fps.
ZLIB
- Compile support for compressed PKZIP-style files AND gzip compressed
files. "unzip.c" will need to be compiled and linked in by you if
this is defined(it's in the zlib subdirectory).
LSB_FIRST
- Compile code to expect that variables that are greater than 8 bits
in size are stored Least Significant Byte First in memory.
PSS_STYLE x
- Sets the path separator style to the integer 'x'. Valid styles are:
1: Only "/" - For UNIX platforms.
2: Both "/" and "\" - For Windows and MSDOS platforms.
3: Only "\" - For ???.
4: Only ":" - For Apple IIs ^_^.

View File

@ -0,0 +1,90 @@
FCE Ultra 0.91+ network play protocol.
Description v 0.0.1
--------------------------------------
In FCE Ultra, all data is sent to the server, and then the server
distributes, every emulated frame(60hz on NTSC), the collated data to the
clients.
The server should not block when it is receiving UDP data from the clients.
If no UDP data is available, then just go on.
The clients MUST block until the input data packet comes on every emulated
frame.
Packets from the server to the client are sent out over both TCP and UDP.
Duplicate packets should be discarded. Out-of-order packets can either
be cached, or discarded(what I recommend, as caching code gets a little
complex and wouldn't yield any benefit from what I've observed).
In the case of client->server UDP communications, the server should just use
the data from the UDP packet that has the highest packet number count, and
the server should then set its internal incoming packet counter to that
number(to prevent out-of-order packets from totally screwing up user input).
The "magic number"(used with UDP packets) is meant to reduce the chance of a hostile remote host
from disrupting the network play, without resorting to using extreme amounts
of network bandwidth. The server generates the magic number, and it is best
if the magic number is as random as possible.
UDP packets received with an incorrect magic number should be discarded, of
course.
Initialization, server->client:
uint32 Local UDP port(what the server is listening on).
uint32 Player number(0-3) for client.
uint32 Magic number(for UDP).
Initialization, client->server
uint32 Local UDP port(that the client is listening on).
Structure of UDP packet data:
uint32 CRC32 - Includes magic number, packet counter, and
data. For reference, CRC32 is calculated
with the zlib function crc32().
uint32 Magic number
uint32 Packet counter(linear, starts at 0).
uint8[variable] Data.
Structure of tcp packet data:
uint32 Packet counter(" ").
uint8[variable] Data.
Data format of server->client communications:
uint8[4] Controller data
uint8 Command byte. 0 if no command. Otherwise(in decimal):
1 Select FDS disk side.
2 Insert/eject FDS disk.
10 Toggle VS Unisystem dip switch editing.
11 ... 18 Toggle VS Unisystem dip switches.
19 Insert VS Unisystem coin.
30 Reset NES.
31 Power toggle NES.
40 Save state(not implemented correctly).
41 Load state(not implemented correctly).
42 ... 50 Select save state slot(minus 42).
Special message communications occurs if the "Packet counter" is
0xFFFFFFFF(only with TCP):
uint32 Length of text data, minus the null character(the null
character is sent, though).
uint8[variable] Text data. Convert all characters <32 to space, and
then display the text message(it's one line) as is.
Structure of client->server communication:
uint8 Controller data(for this client).
Over tcp channel, a text message can be sent. It is one line,
null terminated(remember the data and parse it and display it and
distribute it to the clients once the null byte is received).
Maximum size of message(including the null byte) should be 256 bytes.

View File

@ -0,0 +1,417 @@
<html><head>
<meta http-equiv="content-type" content="text/html; charset=ISO-8859-1"><title>Snes9x Lua Library</title></head><body>
This is the API from DeHackEd's version of Lua in ZSnes. At the time of writing, FCUE's Lua was based on this API.<br /><br />
<h1>Basics</h1>
Your code will be run alongside the emulator's main loop. You code should
probably look roughly like this:
<hr>
<pre>-- initialization goes here
while condition do
-- Code executed once per frame
snes9x.frameadvance()
end
-- Cleanup goes here
</pre><hr>
When Lua execution starts, the emulator will be automatically unpaused if it
is currently paused. If so, it will automatically be paused when the script
exits, voluntarily or otherwise. This allows you to have a script execute
some work on your behalf and then when it exits the emulator will be paused,
ready for the player to continue use.
<br>
<h1>Base library</h1>
Handy little things that are not put into a class. Mostly binary operations right now.
<hr>
<a name="AND">
</a><pre><a name="AND">int AND(int arg1, int arg2, ..., int argn)</a></pre>
<a name="AND">Since Lua lacks binary operators and since binary will come up with memory manipulation,
I offer this function. Output is the binary AND of all its parameters together.
Minimum 1 argument, all integers.
</a><p>
<a name="AND">At a binary level, the AND of two binary bits is 1 if both inputs are 1, and the output
is 0 in any other case. Commonly used to test if a bit is set by ANDing with a number
with only the desired position set to 1.
</a></p><hr>
<a name="OR">
</a><pre><a name="OR">int OR(int arg1, int arg2, ..., int argn)</a></pre>
<a name="OR">The OR of two bits is 1 if either of the inputs is 1, and 0 if both inputs are 0.
Typically used to force a single bit to 1, regardless of its current state.
</a><hr>
<a name="XOR">
</a><pre><a name="XOR">int XOR(int arg1, int arg2, ..., int argn)</a></pre>
<a name="XOR">XOR flips bits. An even number of 1s yields a zero and an odd number of 1s yields a 1.
Commonly used to toggle a bit by XORing.
</a><hr>
<a name="BIT">
</a><pre><a name="BIT">int BIT(int which)</a></pre>
<a name="BIT">Returns a number with only the given bit set. <tt>which</tt> is in the range from 0 to 15 since the
SNES is a 16 bit system. <tt>BIT(15) == 32768</tt>
</a><p>
<a name="BIT">... Actually this system will accept a range of 0 to 30, but none of the memory access functions will
accept it, so you're on your own for those. 31 is not allowed for now due to signedness risking wreaking havoc.
</a></p><h1><a name="BIT">snes9x</a></h1>
<a name="BIT">Basic master emulator control.
</a><hr>
<a name="snes9x.speedmode">
</a><pre><a name="snes9x.speedmode">snes9x.speedmode(string mode)</a></pre>
<a name="snes9x.speedmode">Selects the speed mode snes9x should run at while Lua is in control of frame advance. It must be set to one of the following:
</a><ul>
<li><a name="snes9x.speedmode"><b><tt>normal</tt></b> sets to normal operation. The game runs at its normal speed. Speed control (eg: 50%) apply.</a></li>
<li><a name="snes9x.speedmode"><b><tt>nothrottle</tt></b> makes snes9x run at maximum CPU speed while still showing each frame on screen.
</a></li><li><a name="snes9x.speedmode"><b><tt>turbo</tt></b> drops some frames. It looks like high speed fast-forwarding.</a></li>
<li><a name="snes9x.speedmode"><b><tt>maximum</tt></b> disables screen rendering</a></li>
</ul>
<a name="snes9x.speedmode">In modes other than normal, pause will have no effect.
</a><hr>
<a name="snes9x.frameadvance">
</a><pre><a name="snes9x.frameadvance">snes9x.frameadvance()</a></pre>
<a name="snes9x.frameadvance">Snes9x executes one frame. This function pauses until the execution finishes. General system slowdown
when running at normal speed (ie. sleeping for 1/60 seconds) also occurs here when not in high speed mode.
</a><p>
<a name="snes9x.frameadvance">Warning: Due to the way the code is written, the times this function may be called is restricted. Norably,
it must not be called within a coroutine or under a [x]pcall(). You can use coroutines for
your own purposes, but they must not call this function themselves. Furthermore, this function cannot be called from any
"registered" callback function. An error will occur if you do.
</a></p><p>
</p><hr>
<a name="snes9x.message">
</a><pre><a name="snes9x.message">snes9x.message(string msg)</a></pre>
<a name="snes9x.message">Displays the indicated string on the user's screen. snes9x.speedmode("normal") is probably the only way this is of any use,
lest the message not be displayed at all
</a><hr>
<a name="snes9x.pause">
</a><pre><a name="snes9x.pause">snes9x.pause()</a></pre>
<a name="snes9x.pause"><font color="#800000">v0.05+ only</font><br>
Pauses the emulator. This function blocks until the user unpauses.
</a><p>
<a name="snes9x.pause">This function is allowed to be called from outside a frame boundary (ie. when it is not allowed to call
snes9x.frameadvance). In this case, the function does not wait for the pause because you can't pause
midway through a frame. Your code will continue to execute and the emulator will be paused at the end
of the current frame. If you are at a frame boundary, this function acts a lot like snes9x.frameadvance()
plus the whole pause thing.
</a></p><p>
<a name="snes9x.pause">It might be smart to reset the speed mode to "normal" if it is not already so.
</a></p><hr>
<a name="snes9x.wait">
</a><pre><a name="snes9x.wait">snes9x.wait()</a></pre>
<a name="snes9x.wait"><font color="#800000">v0.06+ only</font><br>
Skips emulation of the next frame. If your script needs to wait for something to happen before proceeding (eg.
input from another application) then you should call this. Otherwise the GUI might jam up and your
application will not appear to be responding and need termination. It is expected that this function
will pause the script for 1/60 of a second without actually running the emulator itself, though it tends to be
OS-dependent right now.
</a><p>
<a name="snes9x.wait">If you're not sufficiently confused yet, think of this as pausing for one frame.
</a></p><p>
<a name="snes9x.wait">If you need to do a large amount of calculations -- so much that you risk setting off the rampant script
warning, just call this function every once in a while.
</a></p><p>
<a name="snes9x.wait">Might want to avoid using this if you don't need to. If the emulator is running at normal speed, paused
and the user presses frame-advance, they might be confused when nothing happens.
</a></p><p>
</p><h1><a name="snes9x.wait">memory</a></h1>
<a name="snes9x.wait">Memory access and manipulation.
</a><pre><a name="snes9x.wait">int memory.readbyte(int address)
int memory.readword(int address)</a></pre>
<a name="snes9x.wait">Reads a number of bits (8 or 16) and returns the memory contents. The address must be a fully qualified
memory address. The RAM range is 0x7e0000 through 0x7fffff, but you may use any memory address, including
the ROM data itself.
</a><hr>
<pre><a name="snes9x.wait">int memory.readbytesigned(int address)
int memory.readwordsigned(int address)</a></pre><a name="snes9x.wait"><font color="#800000">v0.04+ only</font><br>
Same as its counterparts, except numbers will be treated as signed. Numbers larger than 127 for bytes and
32767 for words will be translated into the correct negative numbers. For reference, an alternate formula
is to subtract 256 for bytes and 65536 for words from any number equal to or larger than half that number.
For example, a byte at 250 becomes <tt>250-256 = -6</tt>.
</a><hr>
<pre><a name="snes9x.wait">memory.writebyte(int address, int value)
memory.writebyte(int address, int value)</a></pre>
<a name="snes9x.wait">Writes a number of bits (8 or 16) to the indicated memory address. The address MUST be in the range of
0x7e0000 through 0x7fffff.
</a><hr>
<pre><a name="snes9x.wait">memory.register(int address, function func)</a></pre>
<a name="snes9x.wait">When the given memory address is written to (range must be 0x7e0000 to 0x7fffff), the given function will be
called. The execution of the CPU will be paused mid-frame to call the given function.
</a><p>
<a name="snes9x.wait">Only one function can be registered with a memory address. 16 bit writes will only trigger the lower address
listener. There is no distinction between 8 and 16 bit writes. <tt>func</tt> may be nil in order to
delete a function from listening.
</a></p><p>
<a name="snes9x.wait">Code called may not call snes9x.frameadvance() or any savestate save/load functions, and any button
manipulation results are undefined. Those actions are only meaningful at frame boundaries.
</a></p><p>
</p><h1><a name="snes9x.wait">joypad</a></h1>
<a name="snes9x.wait">Access to the gamepads. Note that Lua makes some joysticks do strange things.
Setting joypad inputs causes the user input for that frame to be ignored, but
only for that one frame.
</a><p>
<a name="snes9x.wait">Joypads are numbered 1 to 5.
</a></p><p>
<a name="snes9x.wait">Joypad buttons are selected by use of a table with special keys. The table
has keys start, select, up, down, left, right, A, B, X, Y, L, R. Note the
case is sensetive. Buttons that are pressed are set to a non-nil value
(use of the integer 1 is just a convention). Note that "false" is valid,
but discouraged as testing for logical true will fail.
</a></p><p>
<a name="snes9x.wait">Currently reading input from a movie file is not possible, but
a movie will record button presses from Lua.
</a></p><pre><a name="snes9x.wait">table joypad.read(int which)</a></pre>
<a name="snes9x.wait">Returns a table indicating which buttons are pressed <i>by the user</i>.
This is probably the only way to get input to the script by the user.
This is always user input, even if the joypads have been set by joypad.set.
</a><hr>
<pre><a name="snes9x.wait">joypad.set(int which, table buttons)</a></pre>
<a name="snes9x.wait">Sets the buttons to be pressed. These choices will be made in place of
what the user is pressing during the next frame advance; they are then
discarded, so this must be called once every frame, even if you just want to
keep the same buttons pressed for several frames.
</a><p>
</p><h1><a name="snes9x.wait">savestate</a></h1>
<a name="snes9x.wait">Control over the savestate process. Savestate objects are opaque structures
that represent non-player accessible states (except for the functions that
return "official" savesates). Such an object is garbage collectable, in which
case the savestate is no longer usable. Recycling of existing savestate objects
is highly recommended for disk space concerns lest the garbage collector
grow lazy.</a><p>
<a name="snes9x.wait">Each object is basically a savestate file. Anonymous savestates are saved to
your temp directory.
</a></p><hr>
<pre><a name="snes9x.wait">object savestate.create(int userslot=nil)</a></pre>
<a name="snes9x.wait">Creates a savestate object for use. If the userslot argument
is given, the state will be accessible via the associated
F-key (F1 through F12 are 1 through 12). If not specified or
nil, an anonymous savestate is created that only Lua can access.
</a><p>
<a name="snes9x.wait">Each call to <tt>savestate.create()</tt> (without parameters) returns
a unique savestate. As such, if you discard the contents of a variable
containing an important savestate, you've just shot yourself in the foot.
</a></p><p>
<a name="snes9x.wait">An object may be used freely once created, saved over and loaded whenever.
</a></p><p>
<a name="snes9x.wait">It is an error to load an anonymous (non-player accessbile) state that
has not been saved yet, since it's empty.
</a></p><p>
<a name="snes9x.wait">Each savestate uses about 120 KB of disk space and the random filename generator
has its limits with regards to how many filenames it can generate. Don't go too
overboard. If you need more than 1000 savestates, maybe you should rethink
your tehcnique. <small>(The actual windows limit is about 32768, Linux is higher).</small>
</a></p><hr><pre><a name="snes9x.wait">savestate.save(object state)</a></pre>
<a name="snes9x.wait">Saves the current state to the given object. Causes an error if something goes horribly
wrong, or if called within any "registered" callback function.
</a><hr><pre><a name="snes9x.wait">savestate.load(object state)</a></pre>
<a name="snes9x.wait">Loads the given state. Throws an error for all the same bad things that might happen.
</a><hr>
<pre><a name="snes9x.wait">function savestate.registersave(function save)</a></pre>
<a name="snes9x.wait"><font color="#800000">v0.06+ only</font><br>
Registers a function to be called on a savestate event. This includes both calls to
<tt>savestate.save()</tt> and users pressing buttons. The function will be called without
parameters.
</a><p>
<a name="snes9x.wait">The function called is permitted to return any number of string and number values.
Lua lets you do this by simply writing <tt>return 1, 2, 3, "four and five", 6.2, integerVar</tt>
</a></p><p>
<a name="snes9x.wait">These variables must be numeric or string. They will be saved into the savestate itself
and returned back to the application via savestate.registerload() should the state ever be loaded
again later.
</a></p><p>
<a name="snes9x.wait">Only one function can be registered. Registering a second function will cause the first function
to be returned back by savestate.registersave() before being discarded.
</a></p><p>
<a name="snes9x.wait">Savestates created with this mechanism are likely to break some savestate features in other emulators.
Don't be surprised if savestates from this version don't work on others if you enable all those
fancy features. Compatible savestates are created if there is no registered save function, or if
the save function returns no parameters at all.
</a></p><hr>
<pre><a name="snes9x.wait">function savestate.registerload(function load)</a></pre>
<a name="snes9x.wait"><font color="#800000">v0.06+ only</font><br>
The companion to savestate.registersave, this function registers a function to be called during
a load. The function will be passed parameters -- exactly those returned by the function
registered for a save. If the savestate contains no saved data for your script, the function
will be called without parameters.
</a><p>
<a name="snes9x.wait">Concept code:
<font color="#000080">
<pre>function saveState() .... end
function loadState(arg1, arg2, ...) ... end
savestate.registersave(saveState)
savestate.registerload(loadState)
-- Behind the scenes
local saved_variables
-- User presses savestate
saved_variables = { saveState() } -- All return values saved
-- Time passes
-- ...
-- User presses loadstate
loadState(unpack(saved_variables))
</pre></font>
</a></p><h2><a name="snes9x.wait">Recommendations for registered savestates</a></h2>
<ul><li><a name="snes9x.wait">You may want to reserve the first parameter as a sort of key to make sure that the right
script or the correct revision of a script is receiving its data.</a></li>
<li><a name="snes9x.wait">The order of declarations in your script should be local variables, then functions (inclduing these),
then any registration calls, and then your main loop. Code is executed top-to-bottom, and that includes
variables being prepared as locals, functions created, etc.</a></li>
<li><a name="snes9x.wait">You can build a string using string.char() from bytes and disassemble one from string.byte().
If you need to store a table's worth of data, you'll have to do this.</a></li>
</ul>
<p>
</p><h1><a name="snes9x.wait">movie</a></h1>
<a name="snes9x.wait">Access to movie information.
<br>
</a><hr>
<pre><a name="snes9x.wait">int movie.framecount()</a></pre>
<a name="snes9x.wait">Returns the current frame count, or nil if no movie is running.
</a><hr>
<pre><a name="snes9x.wait">string movie.mode()</a></pre>
<a name="snes9x.wait">Returns "record", "playback", or nil, depending on the current movie.
</a><hr>
<pre><a name="snes9x.wait">movie.rerecordcounting(boolean counting)</a></pre>
<a name="snes9x.wait">Select whether rerecording should be counted. If set to false, you can do
all the brute force work you want without inflating the rerecord count.
</a><p>
<a name="snes9x.wait">This will automatically be set to true after a script finishes running, so
don't worry about messing up the rerecord count for the player.
</a></p><hr>
<pre><a name="snes9x.wait">movie.stop()</a></pre>
<a name="snes9x.wait">Stops movie recording/playback. I'm not sure why you'd want to do that, but you can.
</a><hr>
<!--
<pre>movie.record(string filename, boolean resetFirst = true, int players = 1)</pre>
Starts recording a movie with the indicated filename. Will throw an error if the file
already exists
<hr>
<pre>movie.playback(string filename, boolean readonly = true)</pre>
Starts playback of the given movie file. It is an error if the file does not already exist, is invalid, etc.
Specify readonly=true if savestates should be used for seeking during playback. If readonly=false,
loading a savestate will switch into recording mode.
<p>
The selection of readonly mode might affect the ability to open a file. readonly=true would successfully
play a file on a read-only medium (such as a CD) but readonly=false would fail.
-->
<h1><a name="snes9x.wait">gui</a></h1>
<a name="snes9x.wait"><font color="#800000">0.03+ only</font><br>
The ability to draw on the surface of the screen is a long sought feature. The surface is 256x239 pixels
(256x224 most of the time though) with (0,0) being in the top-left corner of the screen.
</a><p>
<a name="snes9x.wait">The SNES uses a 16 bit colour system. Red and blue both use 5 bits (0 through 31) while green uses
6 bits (0 through 63), in place of the usual 0 to 255 range. If you want to construct your own exact colours,
multiply your red value by 2048, your green value by 32 and leave your blue value untouched. Add these all
together to get a valid colour. Bright red would be <tt>31*2048 = 63488</tt>, for example.
</a></p><p>
<a name="snes9x.wait">Some strings are accepted. HTML style encoding such as "#00ff00" for green is accepted. Some simple strings such
as "red", "green", "blue", "white" and "black" are also accepted.
</a></p><p>
<a name="snes9x.wait">The transparent colour is 1 (a VERY dark blue, which is probably not worth using in place of black) or the string
"clear". Remove drawn elements using this colour.
</a></p><p>
<a name="snes9x.wait">Output is delayed by a frame. The graphics are drawn on a separate buffer and then overlayed on the image
during the next refresh, which means allowing for a frame to execute. Also, the buffer is cleared after drawing,
so if you want to keep something on screen, you must keep drawing it on each frame.
</a></p><p>
<a name="snes9x.wait">It is an error to draw outside the drawing area. gdoverlay is the only exception to this rule - images will
be clipped to the visible area.
</a></p><hr>
<pre><a name="snes9x.wait">r,g,b = gui.getpixel(int x, int y)</a></pre>
<a name="snes9x.wait">Returns the pixel on the indicated coordinate. (0,0) is the top-left corner and (255, 223) is the typical bottom-right corner,
though (255,238) is allowed. The return value range is (0,0,0) to (31,63,31). You get the actual screen surface before
any damage is done by your drawing. Well, unless you call snes9x.wait() in which case your damage is applied and the SNES
hardware doesn't get a chance to draw a new frame. :)
</a><hr>
<pre><a name="snes9x.wait">gui.drawpixel(int x, int y, type colour)</a></pre>
<a name="snes9x.wait">Draw a single pixel on the screen.
</a><hr>
<pre><a name="snes9x.wait">gui.drawline(int x1, int y1, int x2, int y2, type colour)</a></pre>
<a name="snes9x.wait">Draw a line between the two indicated positions.
</a><hr>
<pre><a name="snes9x.wait">gui.drawbox(int x1, int y1, int x2, int y2, type colour)</a></pre>
<a name="snes9x.wait">Draw a box going through the indicated opposite corners.
</a><hr>
<pre><a name="snes9x.wait">gui.text(int x, int y, string message)</a></pre>
<a name="snes9x.wait">Write text on the screen at the indicated position.
</a><p>
<a name="snes9x.wait">The coordinates determine the top-left corner of the box that the text fits in.
The font is the same one as the snes9x messages, and you can't control colours or anything. <tt>:(</tt>
</a></p><p>
<a name="snes9x.wait">The minimum y value is 9 for the font's height and each letter will take around 8 pixels of width.
Text that exceeds the viewing area will be cut short, so ensuring your text will fit would be wise.
</a></p><hr>
<pre><a name="snes9x.wait">string gui.gdscreenshot()</a></pre>
<a name="snes9x.wait"><font color="#800000">0.04+ only</font><br>
Takes a screen shot of the image and returns it in the form of a string which can be imported by
the </a><a href="http://lua-gd.luaforge.net/">gd library</a> using the gd.createFromGdStr() function.
<p>
This function is provided so as to allow snes9x to not carry a copy of the gd library itself. If you
want raw RGB32 access, skip the first 11 bytes (header) and then read pixels as Alpha (always 0), Red,
Green, Blue, left to right then top to bottom, range is 0-255 for all colours.
</p><p>
Warning: Storing screen shots in memory is not recommended. Memory usage will blow up pretty quick.
One screen shot string eats around 230 KB of RAM.
</p><hr>
<pre>gui.gdoverlay(int x=0, int y=0, string gdimage)</pre>
<font color="#800000">0.04+ only</font><br>
Overlays the given image on top of the screen with the top-left corner in the given screen location.
Transparency is not fully supported -- a pixel must be 100% transparent to actually leave
a hole in the overlayed image or else it will be treated as opaque.<p>
Naturally, the format for input is the gd file format, version 1. The image MUST be truecolour.
</p><p>
The image will be clipped to fit into the screen area.
</p><hr>
<pre>gui.transparency(int strength)</pre>
<font color="#800000">0.04+ only</font><br>
Transparency mode. A value of 0 means opaque; a value of 4 means invisible (useful option that one).
As for 1 through 3, I'll let you figure those out.<p>
All image drawing (including gui.gdoverlay) will have the given transparency level applied from that point
on. Note that drawing on the same point over and over will NOT build up to a higher opacity level.
</p><hr>
<pre>function gui.register(function func)</pre>
<font color="#800000">0.04+ only</font><br>
Register a function to be called between a frame being prepared for displaying on your screen and
it actually happening. Used when that 1 frame delay for rendering is a pain in the butt.
<p>This function is not necessarily complicated to use, but it's not recommended to users
new to the whole scripting thing.
</p><p>
You may pass nil as the parameter to kill off a registered function. The old function (if any) will be
returned.
</p><hr>
<pre>string function gui.popup(string message, [string type = "ok"])</pre>
<font color="#800000">v0.05+ only</font><br>
Pops up a dialog to the user with a message, and returns after the user acknowledges the dialog.
<tt>type</tt> may be any of "ok", "yesno", "yesnocancel". The return value will be "yes", "no" or "cancel"
as the case may be. "ok" is a waste of effort.
<p>
Linux users might want to install xmessage to perform the work. Otherwise the dialog will
appear on the shell and that's less noticable.
</p></body></html>

View File

@ -0,0 +1,97 @@
This is an email posted to nesdev by Ki a while back. I have removed one
line at the end regarding the B flag of the cpu(the information was
incorrect, which Ki noted in a later email).
--------------------------------------------------------------------------------
By reading Brad's NESSOUND document, we know that there is a
"frame counter" in the NES/FC APU. I would like to post
some more on this.
The frame counter is reset upon any write to $4017. It is
reset at system power-on as well, but is NOT reset upon
system reset.
Thanks to Samus Aran, we now know the exact period of the
PPU's single frame. In another words, we are now sure that
the NMI occurs on every 29780 2/3 CPU cycles.
However, the APU's single frame is NOT 29780 2/3 CPU cycles.
What I mean by "APU's single frame" here is that it is the
number of CPU cycles taken between the frame IRQs.
The APU's single frame seems to be:
1789772.727... / 60 = 29829 6/11 [CPU CYCLE]
Below is a simple diagram which shows the difference
in periods of the PPU's single frame and the APU's.
RESET 29780 2/3 CPU CYCLES NMI
PPU |------------------------------------------|
| 29829 6/11 CPU CYCLES IRQ
APU |----------|----------|----------|----------|
Note that if you write $00 to $4017 on every NMI, the frame
IRQ would NEVER go off even if it is enabled. This is because
the the period of NMI is slightly shorter than the period of
the frame IRQ. This causes the frame counter to be reset
before the frame IRQ goes off.
When you write zero to bit 7 of $4017, the frame counter will
be reset, and the first sound update will be done after 7457 CPU
cycles (i.e. 29829/4). 2nd update will be done 7457 after that,
same goes for 3rd update and 4th update, but the frame IRQ occurs
on 4th update, resetting the frame counter as well.
When you write 1 to bit 7 of $4017, the frame counter will be
reset, but the first sound update will occur at the same time.
2nd, 3rd, and 4th update will be done after 7457, 14914, 22371
CPU cycles after the first update respectively, but the 5th
update will be 14914 cycles after the 4th update. This causes
sound output to last 1.25 times longer than that of bit 7 = 0.
$4017W:
o when the MSB of $4017 is 0:
bit7=0
|---------|---------|---------|---------|---------|---------|----
1st 2nd 3rd 4th 5th(1st) 6th(2nd)
o when the MSB of $4017 is 1:
bit7=1
|---------|---------|---------|-------------------|---------|----
1st 2nd 3rd 4th 5th(1st) 6th(2nd)
On 1st, 3rd, 5th, ... updates, the envelope decay and the
linear counter are updated.
On 2nd, 4th, 6th, ... updates, the envelope decay, the
linear counter, the length counter, and the frequency sweep
are updated.
----
The original info was provided by goroh, and verified by me.
However, it could still be wrong. Please tell me if you
find anything wrong.
----
(Correction from my last posting)
I have checked once again and it turned out that the frame IRQ
was NOT disabled upon system reset. What actually prevented the
frame IRQ to occur after system reset was, in fact, the I flag.
I checked this flag shortly after system reset (right after stack
pointer was initialized), and the flag was 1, although I never
executed "sei" after reset. Therefore the I flag of the PR2A03G
is 1 on system reset.
Thanks Matthew Conte and Samus Aran for pointing out the
inaccuracy.

View File

@ -0,0 +1,235 @@
Delta modulation channel tutorial 1.0
Written by Brad Taylor
Last updated: August 20th, 2000.
All results were obtained by studying prior information available (from
nestech 1.00, and postings on NESDev from miscellanious people), and through
a series of experiments conducted by me. Results aquired by individuals
prior to my reverse-engineering have been double checked, and final results
have been confirmed. Credit is due to those individual(s) who contributed
any information in regards to the DMC.
Description
-----------
The delta modulation channel (DMC) is a complex digital network of counters
and registers used to produce analog sound. It's primary function is to play
"samples" from memory, and have an internal counter connected to a digital
to analog converter (DAC) updated accordingly. The channel is able to be
assigned a pointer to a chunk of memory to be played. At timed intervals,
the DMC will halt the 2A03 (NES's CPU) for 1 clock cycle to retrieve the
sample to pe played. This method of playback will be refered to here on as
direct memory access (DMA). Another method of playback known as pulse code
modulation (PCM) is available by the channel, which requires the constant
updating of one of the DMC's memory-mapped registers.
Registers
---------
The DMC has 5 registers assigned to it. They are as follows:
$4010: play mode and DMA frequency
$4011: delta counter
$4012: play code's starting address
$4013: length of play code
$4015: DMC/IRQ status
Note that $4015 is the only R/W register. All others are write only (attempt
to read them will most likely result in a returned 040H, due to heavy
capacitance on the NES's data bus).
$4010 - Play mode and DMA frequency
-----------------------------------
This register is used to control the frequency of the DMA fetches, and to
control the playback mode.
Bits
----
6-7 this is the playback mode.
00 - play DMC sample until length counter reaches 0 (see $4013)
x1 - loop the DMC sample (x = immaterial)
10 - play DMC sample until length counter reaches 0, then generate a CPU
IRQ
Looping (playback mode "x1") will have the chunk of memory played over and
over, until the channel is disabled (via $4015). In this case, after the
length counter reaches 0, it will be reloaded with the calculated length
value of $4013.
If playback mode "10" is chosen, an interrupt will be dispached when the
length counter reaches 0 (after the sample is done playing). There are 2
ways to acknowledge the DMC's interrupt request upon recieving it. The first
is a write to this register ($4010), with the MSB (bit 7) cleared (0). The
second is any write to $4015 (see the $4015 register description for more
details).
If playback mode "00" is chosen, the sample plays until the length counter
reaches 0. No interrupt is generated.
5-4 appear to be unused
3-0 this is the DMC frequency control. Valid values are from 0 - F. The
value of this register determines how many CPU clocks to wait before the DMA
will fetch another byte from memory. The # of clocks to wait -1 is initially
loaded into an internal 12-bit down counter. The down counter is then
decremented at the frequency of the CPU (1.79MHz). The channel fetches the
next DMC sample byte when the count reaches 0, and then reloads the count.
This process repeats until the channel is disabled by $4015, or when the
length counter has reached 0 (if not in the looping playback mode). The
exact number of CPU clock cycles is as follows:
value CPU
written clocks octave scale
------- ------ ------ -----
F 1B0 8 C
E 240 7 G
D 2A0 7 E
C 350 7 C
B 400 6 A
A 470 6 G
9 500 6 F
8 5F0 6 D
7 6B0 6 C
6 710 5 B
5 7F0 5 A
4 8F0 5 G
3 A00 5 F
2 AA0 5 E
1 BE0 5 D
0 D60 5 C
The octave and scale values shown represent the DMC DMA clock cycle rate
equivelant. These values are merely shown for the music enthusiast
programmer, who is more familiar with notes than clock cycles.
Every fetched byte is loaded into a internal 8-bit shift register. The shift
register is then clocked at 8x the DMA frequency (which means that the CPU
clock count would be 1/8th that of the DMA clock count), or shifted at +3
the octave of the DMA (same scale). The data shifted out of the register is
in serial form, and the least significant bit (LSB, or bit 0) of the fetched
byte is the first one to be shifted out (then bit 1, bit 2, etc.).
The bits shifted out are then fed to the UP/DOWN control pin of the internal
delta counter, which will effectively have the counter increment it's
retained value by one on "1" bit samples, and decrement it's value by one on
"0" bit samples. This counter is clocked at the same frequency of the shift
register's.
The counter is only 6 bits in size, and has it's 6 outputs tied to the 6 MSB
inputs of a 7 bit DAC. The analog output of the DAC is then what you hear
being played by the DMC.
Wrap around counting is not allowed on this counter. Instead, a "clipping"
behaviour is exhibited. If the internal value of the counter has reached 0,
and the next bit sample is a 0 (instructing a decrement), the counter will
take no action. Likewise, if the counter's value is currently at -1
(111111B, or 03FH), and the bit sample to be played is a 1, the counter will
not increment.
$4011 - Delta counter load register
-----------------------------------
bits
----
7 appears to be unused
1-6 the load inputs of the internal delta counter
0 LSB of the DAC
A write to this register effectively loads the internal delta counter with a
6 bit value, but can be used for 7 bit PCM playback. Bit 0 is connected
directly to the LSB (bit 0) of the DAC, and has no effect on the internal
delta counter. Bit 7 appears to be unused.
This register can be used to output direct 7-bit digital PCM data to the
DMC's audio output. To use this register for PCM playback, the programmer
would be responsible for making sure that this register is updated at a
constant rate. The rate is completely user-definable. For the regular CD
quality 44100 Hz playback sample rate, this register would have to be
written to approximately every 40 CPU cycles (assuming the 2A03 is running @
1.79 MHz).
$4012 - DMA address load register
----------------------------
This register contains the initial address where the DMC is to fetch samples
from memory for playback. The effective address value is $4012 shl 6 or
0C000H. This register is connected to the load pins of the internal DMA
address pointer register (counter). The counter is incremented after every
DMA byte fetch. The counter is 15 bits in size, and has addresses wrap
around from $FFFF to $8000 (not $C000, as you might have guessed). The DMA
address pointer register is reloaded with the initial calculated address,
when the DMC is activated from an inactive state, or when the length counter
has arrived at terminal count (count=0), if in the looping playback mode.
$4013 - DMA length register
---------------------------
This register contains the length of the chunk of memory to be played by the
DMC, and it's size is measured in bytes. The value of $4013 shl 4 is loaded
into a 12 bit internal down counter, dubbed the length counter. The length
counter is decremented after every DMA fetch, and when it arrives at 0, the
DMC will take action(s) based on the 2 MSB of $4010. This counter will be
loaded with the current calculated address value of $4013 when the DMC is
activated from an inactive state. Because the value that is loaded by the
length counter is $4013 shl 4, this effectively produces a calculated byte
sample length of $4013 shl 4 + 1 (i.e. if $4013=0, sample length is 1 byte
long; if $4013=FF, sample length is $FF1 bytes long).
$4015 - DMC status
------------------
This contains the current status of the DMC channel. There are 2 read bits,
and 1 write bit.
bits
----
7(R) DMC's IRQ status (1=CPU IRQ being caused by DMC)
4(R) DMC is currently enabled (playing a stream of samples)
4(W) enable/disable DMC (1=start/continue playing a sample;0=stop playing)
When an IRQ goes off inside the 2A03, Bit 7 of $4015 can tell the interrupt
handler if it was caused by the DMC hardware or not. This bit will be set
(1) if the DMC is responsible for the IRQ. Of course, if your program has no
other IRQ-generating hardware going while it's using the DMC, then reading
this register is not neccessary upon IRQ generation. Note that reading this
register will NOT clear bit 7 (meaning that the DMC's IRQ will still NOT be
acknowledged). Also note that if the 2 MSB of $4010 were set to 10, no IRQ
will be generated, and bit 7 will always be 0.
Upon generation of a IRQ, to let the DMC know that the software has
acknowledged the /IRQ (and to reset the DMC's internal IRQ flag), any write
out to $4015 will reset the flag, or a write out to $4010 with the MSB set
to 0 will do. These practices should be performed inside the IRQ handler
routine. To replay the same sample that just finished, all you need to do is
just write a 1 out to bit 4 of $4015.
Bit 4 of $4015 reports the real-time status of the DMC. A returned value of
1 denotes that the channel is currently playing a stream of samples. A
returned value of 0 indicates that the channel is inactive. If the
programmer needed to know when a stream of samples was finished playing, but
didn't want to use the IRQ generation feature of the DMC, then polling this
bit would be a valid option.
Writing a value to $4015's 4th bit has the effect of enabling the channel
(start, or continue playing a stream of samples), or disabling the channel
(stop all DMC activity). Note that writing a 1 to this bit while the channel
is currently enabled, will have no effect on counters or registers internal
to the DMC.
The conditions that control the time the DMC will stay enabled are
determined by the 2 MSB of $4010, and register $4013 (if applicable).
System Reset
------------
On system reset, all 7 used bits of $4011 are reset to 0, the IRQ flag is
cleared (disabled), and the channel is disabled. All other registers will
remain unmodified.

View File

@ -0,0 +1,551 @@
*******************************************
*2A03 sound channel hardware documentation*
*******************************************
Brad Taylor (big_time_software@hotmail.com)
4th release: February 19th, 2K3
All results were obtained by studying prior information available (from nestech 1.00, and postings on NESDev from miscellanious people), and through a series of experiments conducted by me. Results acquired by individuals prior to my reverse-engineering have been double checked, and final results have been confirmed. Credit is due to those individual(s) who contributed miscellanious information in regards to NES sound channel hardware. Such individuals are:
Goroh
Memblers
FluBBa
Izumi
Chibi-Tech
Quietust
SnowBro
Kentaro Ishihara (Ki) is responsible for posting (on the NESdev mailing list) differrences in the 2 square wave channels, including the operation of 2A03 hardware publically undocumented (until now) such as the frame IRQ counter, and it's ties with sound hardware. Goroh had originally discovered some of this information, and Ki confirmed it.
A special thanks goes out to Matthew Conte, for his expertise on pseudo-random number generation (amoung other things), which allowed for the full reverse engineering of the NES's noise channel to take place. Without his help, I would still be trying to find a needle in a haystack, as far as the noise's method of pseudo-random number generation goes. Additionally, his previous findings / reverse engineering work on the NES's sound hardware really got the ball of NES sound emulation rolling. If it weren't for Matt's original work, this document wouldn't exist.
****************
* Introduction *
****************
The 2A03 (NES's integrated CPU) has 4 internal channels to it that have the ability to generate semi-analog sound, for musical playback purposes. These channels are 2 square wave channels, one triangle wave channel, and a noise generation channel. This document will go into full detail on every aspect of the operation and timing of the mentioned sound channels.
*******************
* Channel details *
*******************
Each channel has different characteristics to it that make up it's operation.
The square channel(s) have the ability to generate a square wave frequency in the range of 54.6 Hz to 12.4 KHz. It's key features are frequency sweep abilities, and output duty cycle adjustment.
The triangle wave channel has the ability to generate an output triangle wave with a resolution of 4-bits (16 steps), in the range of 27.3 Hz to 55.9 KHz. The key features this channel has is it's analog triangle wave output, and it's linear counter, which can be set to automatically disable the channel's sound after a certain period of time has gone by.
The noise channel is used for producing random frequencys, which results in a "noisey" sounding output. Output frequencys can range anywhere from 29.3 Hz to 447 KHz. It's key feature is it's pseudo- random number generator, which generates the random output frequencys heard by the channel.
*****************
* Frame counter *
*****************
The 2A03 has an internal frame counter. The purpose of it is to generate the various low frequency signals (60, 120, 240 Hz, and 48, 96, 192 Hz) required to clock several of the sound hardware's counters. It also has the ability to generate IRQ's.
The smallest unit of timing the frame counter operates around is 240Hz; all other frequencies are generated by multiples of this base frequency. A clock divider of 14915 (clocked at twice the CPU speed) is used to get 240Hz (this was the actual measured ratio).
+---------------+
|$4017 operation|
+---------------+
Writes to register $4017 control operation of both the clock divider, and the frame counter.
- Any write to $4017 resets both the frame counter, and the clock divider. Sometimes, games will write to this register in order to synchronize the sound hardware's internal timing, to the sound routine's timing (usually tied into the NMI code). The frame IRQ is slightly longer than the PPU's, so you can see why games would desire this syncronization.
- bit 7 of $4017 controls the frame counter's divide rate. Every time the counter cycles (reaches terminal count (0)), a frame IRQ will be generated, if enabled by clearing bit 6 of $4017. $4015.6 holds the status of the frame counter IRQ; it will be set if the frame counter is responsible for the interrupt.
$4017.7 divider frame IRQ freq.
------- ------- ---------------
0 4 60
1 5 48
On 2A03 reset, both bits of $4017 (6 & 7) will be cleared, enabling frame IRQ's off the hop. The reason why the existence of frame IRQ's are generally unknown is because the 6502's maskable interrupt is disabled on reset, and this blocks out the frame IRQ's. Most games don't use any IRQ-generating hardware in general, therefore they don't bother enabling maskable interrupts.
Note that the IRQ line will be held down by the frame counter until it is acknowledged (by reading $4015). Before this, the 6502 will generate an IRQ *every* time interrupts are enabled (either by CLI or RTI), since the IRQ design on the 6502 is level-triggered, and not edge. If you've written a program that does not read $4015 in the IRQ handler, and you execute CLI, the processor will immediately go into a infinite IRQ call-return loop.
+-----------------------+
|Frame counter operation|
+-----------------------+
Depending on the status of $4017.7, the frame counter will follow 2 different count sequences. These sequences determine when sound hardware counters will be clocked. The sequences are initialized immediately following any write to $4017.
$4017.7 sequence
------- --------
0 4, 0,1,2,3, 0,1,2,3,..., etc.
1 0,1,2,3,4, 0,1,2,3,4,..., etc.
During count sequences 0..3, the linear (triangle) and envelope decay (square & noise) counters recieve a clock for each count. This means that both these counters are clocked once immediately after $4017.7 is written with a value of 1.
Count sequences 1 & 3 clock (update) the frequency sweep (square), and length (all channels) counters. Even though the length counter's smallest unit of time counting is a frame, it seems that it is actually being clocked twice per frame. That said, you can consider the length counters to contain an extra stage to divide this clock signal by 2.
No aforementioned sound hardware counters are clocked on count sequence #4. You should now see how this causes the 96, and 192 Hz signals to be generated when $4017.7=1.
The rest of the document will describe the operation of the sound channels using the $4017.7=0 frequencies (60, 120, and 240 Hz). For $4017.7=1 operation, replace those frequencies with 48, 96, and 192 Hz (respectively).
************************
* Sound hardware delay *
************************
After resetting the 2A03, the first time any sound channel(s) length counter contains a non-zero value (channel is enabled), there will be a 2048 CPU clock cycle delay before any of the sound hardware is clocked. After the 2K clock cycles go by, the NES sound hardware will be clocked normally. This phenomenon only occurs prior to a system reset, and only occurs during the first 2048 CPU clocks after the activation of any of the 4 basic sound channels.
The information in regards to this delay is only provided to keep this document accurate with all information that is currently known about the 2A03's sound hardware. I haven't done much tests on the behaviour of this delay (mainly because I don't care, as I view it as a inconvenience anyway), so this information should be taken with a grain of salt.
************************
* Register Assignments *
************************
The sound hardware internal to the 2A03 has been designated these special memory addresses in the CPU's memory map.
$4000-$4003 Square wave 1
$4004-$4007 Square wave 2 (identical to the first, except for upward frequency sweeps (see "sweep unit" section))
$4008-$400B Triangle
$400C-$400F Noise
$4015 Channel enable / length/frame counter status
$4017 frame counter control
Note that $4015 (and $4017, but is unrelated to sound hardware) are the only R/W registers. All others are write only (attempt to read them will most likely return the last byte on the bus (usually 040H), due to heavy capacitance on the NES's data bus). Reading a "write only" register, will have no effect on the specific register, or channel.
Every sound channel has 4 registers affiliated with it. The description of the register sets are as follows:
+----------------+
| Register set 1 |
+----------------+
$4000(sq1)/$4004(sq2)/$400C(noise) bits
---------------------------------------
0-3 volume / envelope decay rate
4 envelope decay disable
5 length counter clock disable / envelope decay looping enable
6-7 duty cycle type (unused on noise channel)
$4008(tri) bits
---------------
0-6 linear counter load register
7 length counter clock disable / linear counter start
+----------------+
| Register set 2 |
+----------------+
$4001(sq1)/$4005(sq2) bits
--------------------------
0-2 right shift amount
3 decrease / increase (1/0) wavelength
4-6 sweep update rate
7 sweep enable
$4009(tri)/$400D(noise) bits
----------------------------
0-7 unused
+----------------+
| Register set 3 |
+----------------+
$4002(sq1)/$4006(sq2)/$400A(Tri) bits
-------------------------------------
0-7 8 LSB of wavelength
$400E(noise) bits
-----------------
0-3 playback sample rate
4-6 unused
7 random number type generation
+----------------+
| Register set 4 |
+----------------+
$4003(sq1)/$4007(sq2)/$400B(tri)/$400F(noise) bits
--------------------------------------------------
0-2 3 MS bits of wavelength (unused on noise channel)
3-7 length counter load register
+--------------------------------+
| length counter status register |
+--------------------------------+
$4015(read)
-----------
0 square wave channel 1
1 square wave channel 2
2 triangle wave channel
3 noise channel
4 DMC (see "DMC.TXT" for details)
5-6 unused
7 IRQ status of DMC (see "DMC.TXT" for details)
+-------------------------+
| channel enable register |
+-------------------------+
$4015(write)
------------
0 square wave channel 1
1 square wave channel 2
2 triangle wave channel
3 noise channel
4 DMC channel (see "DMC.TXT" for details)
5-7 unused
************************
* Channel architecture *
************************
This section will describe the internal components making up each individual channel. Each component will then be described in full detail.
Device Triangle Noise Square
------ -------- ------ ------
triangle step generator X
linear counter X
programmable timer X X X
length counter X X X
4-bit DAC X X X
volume/envelope decay unit X X
sweep unit X
duty cycle generator X
wavelength converter X
random number generator X
+-------------------------+
| Triangle step generator |
+-------------------------+
This is a 5-bit, single direction counter, and it is only used in the triangle channel. Each of the 4 LSB outputs of the counter lead to one input on a corresponding mutually exclusive XNOR gate. The 4 XNOR gates have been strobed together, which results in the inverted representation of the 4 LSB of the counter appearing on the outputs of the gates when the strobe is 0, and a non-inverting action taking place when the strobe is 1. The strobe is naturally connected to the MSB of the counter, which effectively produces on the output of the XNOR gates a count sequence which reflects the scenario of a near- ideal triangle step generator (D,E,F,F,E,D,...,2,1,0,0,1,2,...). At this point, the outputs of the XNOR gates will be fed into the input of a 4-bit DAC.
This 5-bit counter will be halted whenever the Triangle channel's length or linear counter contains a count of 0. This results in a "latching" behaviour; the counter will NOT be reset to any definite state.
On system reset, this counter is loaded with 0.
The counter's clock input is connected directly to the terminal count output pin of the 11-bit programmable timer in the triangle channel. As a result of the 5-bit triangle step generator, the output triangle wave frequency will be 32 times less than the frequency of the triangle channel's programmable timer is set to generate.
+----------------+
| Linear counter |
+----------------+
The linear counter is only found in the triangle channel. It is a 7-bit presettable down counter, with a decoded output condition of 0 available (not exactly the same as terminal count). Here's the bit assignments:
$4008 bits
----------
0-6 bits 0-6 of the linear counter load register (NOT the linear counter itself)
7 linear counter start
The counter is clocked at 240 Hz (1/4 framerate), and the calculated length in frames is 0.25*N, where N is the 7-bit loaded value. The counter is always being clocked, except when 0 appears on the output of the counter. At this point, the linear counter & triangle step counter clocks signals are disabled, which results in both counters latching their current state (the linear counter will stay at 0, and the triangle step counter will stop, and the channel will be silenced due to this).
The linear counter has 2 modes: load, and count. When the linear counter is in load mode, it essentially becomes transparent (i.e. whatever value is currently in, or being written to $4008, will appear on the output of the counter). Because of this, no count action can occur in load mode. When the mode changes from load to count, the counter will now latch the value currently in it, and start counting down from there. In the count mode, the current value of $4008 is ignored by the counter (but still retained in $4008). Described below is how the mode of the linear counter is set:
Writes to $400B
---------------
cur mode
--- ----
1 load
0 load (on next linear counter clock), count
Cur is the current state of the MSB of $4008.
Writes to $4008
---------------
old new mode
--- --- ----
0 X count
1 0 no change (during the CPU write cycle), count
1 1 no change
Old and new represent the state(s) of the MSB of $4008. Old is the value being replaced in the MSB of $4008 on the write, and new is the value replacing the old one.
"no change" indicates that the mode of the linear counter will not change from the last.
Note that writes to $400B when $4008.7=0 only loads the linear counter with the value in $4008 on the next *linear* counter clock (and NOT at the end of the CPU write cycle). This is a correction from older versions of this doc.
+--------------------+
| Programmable timer |
+--------------------+
The programmable timer is a 11-bit presettable down counter, and is found in the square, triangle, and noise channel(s). The bit assignments are as follows:
$4002(sq1)/$4006(sq2)/$400A(Tri) bits
-------------------------------------
0-7 represent bits 0-7 of the 11-bit wavelength
$4003(sq1)/$4007(sq2)/$400B(Tri) bits
-------------------------------------
0-2 represent bits 8-A of the 11-bit wavelength
Note that on the noise channel, the 11 bits are not available directly. See the wavelength converter section, for more details.
The counter has automatic syncronous reloading upon terminal count (count=0), therefore the counter will count for N+1 (N is the 11-bit loaded value) clock cycles before arriving at terminal count, and reloading. This counter will typically be clocked at the 2A03's internal 6502 speed (1.79 MHz), and produces an output frequency of 1.79 MHz/(N+1). The terminal count's output spike length is typically no longer than half a CPU clock. The TC signal will then be fed to the appropriate device for the particular sound channel (for square, this terminal count spike will lead to the duty cycle generator. For the triangle, the spike will be fed to the triangle step generator. For noise, this signal will go to the random number generator unit).
+----------------+
| Length counter |
+----------------+
The length counter is found in all sound channels. It is essentially a 7-bit down counter, and is conditionally clocked at a frequency of 60 Hz.
When the length counter arrives at a count of 0, the counter will be stopped (stay on 0), and the appropriate channel will be silenced.
The length counter clock disable bit, found in all the channels, can also be used to halt the count sequence of the length counter for the appropriate channel, by writing a 1 out to it. A 0 condition will permit counting (unless of course, the counter's current count = 0). Location(s) of the length counter clock disable bit:
$4000(sq1)/$4004(sq2)/$400C(noise) bits
---------------------------------------
5 length counter clock disable
$4008(tri) bits
---------------
7 length counter clock disable
To load the length counter with a specified count, a write must be made out to the length register. Location(s) of the length register:
$4003(sq1)/$4007(sq2)/$400B(tri)/$400F(noise) bits
--------------------------------------------------
3-7 length
The 5-bit length value written, determines what 7-bit value the length counter will start counting from. A conversion table here will show how the values are translated.
+-----------------------+
| bit3=0 |
+-------+---------------+
| |frames |
|bits +-------+-------+
|4-6 |bit7=0 |bit7=1 |
+-------+-------+-------+
|0 |05 |06 |
|1 |0A |0C |
|2 |14 |18 |
|3 |28 |30 |
|4 |50 |60 |
|5 |1E |24 |
|6 |07 |08 |
|7 |0D |10 |
+-------+-------+-------+
+---------------+
| bit3=1 |
+-------+-------+
|bits | |
|4-7 |frames |
+-------+-------+
|0 |7F |
|1 |01 |
|2 |02 |
|3 |03 |
|4 |04 |
|5 |05 |
|6 |06 |
|7 |07 |
|8 |08 |
|9 |09 |
|A |0A |
|B |0B |
|C |0C |
|D |0D |
|E |0E |
|F |0F |
+-------+-------+
The length counter's real-time status for each channel can be attained. A 0 is returned for a zero count status in the length counter (channel's sound is disabled), and 1 for a non-zero status. Here's the bit description of the length counter status register:
$4015(read)
-----------
0 length counter status of square wave channel 1
1 length counter status of square wave channel 2
2 length counter status of triangle wave channel
3 length counter status of noise channel
4 length counter status of DMC (see "DMC.TXT" for details)
5 unknown
6 frame IRQ status
7 IRQ status of DMC (see "DMC.TXT" for details)
Writing a 0 to the channel enable register will force the length counters to always contain a count equal to 0, which renders that specific channel disabled (as if it doesn't exist). Writing a 1 to the channel enable register disables the forced length counter value of 0, but will not change the count itself (it will still be whatever it was prior to the writing of 1).
Bit description of the channel enable register:
$4015(write)
------------
0 enable square wave channel 1
1 enable square wave channel 2
2 enable triangle wave channel
3 enable noise channel
4 enable DMC channel (see "DMC.TXT" for details)
5-7 unknown
Note that all 5 used bits in this register will be set to 0 upon system reset.
+-----------+
| 4-bit DAC |
+-----------+
This is just a standard 4-bit DAC with 16 steps of output voltage resolution, and is used by all 4 sound channels. On the 2A03, square wave 1 & 2 are mixed together, and are available via pin 1. Triangle & noise are available on pin 2.
These analog outputs require a negative current source, to attain linear symmetry on the various output voltage levels generated by the channel(s) (moreover, to get the sound to be audible). Instead of current sources, the NES uses external 100 ohm pull-down resistors. This results in the output waveforms having some linear asymmetry (i.e., as the desired output voltage increases on a linear scale, the actual outputted voltage increases less and less each step).
The side effect of this is that the DMC's 7-bit DAC port ($4011) is able to indirectly control the volume (somewhat) of both triangle & noise channels. While I have not measured the voltage asymmetery, others on the NESdev messageboards have posted their findings. The conclusion is that when $4011 is 0, triangle & noise volume outputs are at maximum. When $4011 = 7F, the triangle & noise channel outputs operate at only 57% total volume.
The odd thing is that a few games actually take advantage of this "volume" feature, and write values to $4011 in order to regulate the amplitude of the triangle wave channel's output.
+------------------------------+
| Volume / envelope decay unit |
+------------------------------+
The volume / envelope decay hardware is found only in the square wave and noise channels.
$4000(sq1)/$4004(sq2)/$400C(noise)
----------------------------------
0-3 volume / envelope decay rate
4 envelope decay disable
5 envelope decay looping enable
When the envelope decay disable bit (bit 4) is set (1), the current volume value (bits 0-3) is sent directly to the channel's DAC. However, depending on certain conditions, this 4-bit volume value will be ignored, and a value of 0 will be sent to the DAC instead. This means that while the channel is enabled (producing sound), the output of the channel (what you'll hear from the DAC) will either be the 4-bit volume value, or 0. This also means that a 4-bit volume value of 0 will result in no audible sound. These conditions are as follows:
- When hardware in the channel wants to disable it's sound output (like the length counter, or sweep unit (square channels only)).
- On the negative portion of the output frequency signal coming from the duty cycle / random number generator hardware (square wave channel / noise channel).
When the envelope decay disable bit is cleared, bits 0-3 now control the envelope decay rate, and an internal 4-bit down counter (hereon the envelope decay counter) now controls the channel's volume level. "Envelope decay" is used to describe the action of the channel's audio output volume starting from a certain value, and decreasing by 1 at a fixed (linear) rate (which produces a "fade-out" sounding effect). This fixed decrement rate is controlled by the envelope decay rate (bits 0-3). The calculated decrement rate is 240Hz/(N+1), where N is any value between $0-$F.
When the channel's envelope decay counter reaches a value of 0, depending on the status of the envelope decay looping enable bit (bit 5, which is shared with the length counter's clock disable bit), 2 different things will happen:
bit 5 action
----- ------
0 The envelope decay count will stay at 0 (channel silenced).
1 The envelope decay count will wrap-around to $F (upon the next clock cycle). The envelope decay counter will then continue to count down normally.
Only a write out to $4003/$4007/$400F will reset the current envelope decay counter to a known state (to $F, the maximum volume level) for the appropriate channel's envelope decay hardware. Otherwise, the envelope decay counter is always counting down (by 1) at the frequency currently contained in the volume / envelope decay rate bits (even when envelope decays are disabled (setting bit 4)), except when the envelope decay counter contains a value of 0, and envelope decay looping (bit 5) is disabled (0).
+------------+
| Sweep unit |
+------------+
The sweep unit is only found in the square wave channels. The controls for the sweep unit have been mapped in at $4001 for square 1, and $4005 for square 2.
The controls
------------
Bit 7 when this bit is set (1), sweeping is active. This results in real-time increasing or decreasing of the the current wavelength value (the audible frequency will decrease or increase, respectively). The wavelength value in $4002/3 ($4006/7) is constantly read & updated by the sweep. Modifying the contents of $4002/3 will be immediately audible, and will result in the sweep now starting from this new wavelength value.
Bits 6-4 These 3 bits represent the sweep refresh rate, or the frequency at which $4002/3 is updated with the new calculated wavelength. The refresh rate frequency is 120Hz/(N+1), where N is the value written, between 0 and 7.
Bit 3 This bit controls the sweep mode. When this bit is set (1), sweeps will decrease the current wavelength value, as a 0 will increase the current wavelength.
Bits 2-0 These bits control the right shift amount of the new calculated sweep update wavelength. Code that shows how the sweep unit calculates a new sweep wavelength is as follows:
bit 3
-----
0 New = Wavelength + (Wavelength >> N)
1 New = Wavelength - (Wavelength >> N) (minus an additional 1, if using square wave channel 1)
where N is the the shift right value, between 0-7.
Note that in decrease mode, for subtracting the 2 values:
1's compliment (NOT) is being used for square wave channel 1
2's compliment (NEG) is being used for square wave channel 2
This information is currently the only known difference between the 2 square wave channels.
On each sweep refresh clock, the Wavelength register will be updated with the New value, but only if all 3 of these conditions are met:
- bit 7 is set (sweeping enabled)
- the shift value (which is N in the formula) does not equal to 0
- the channel's length counter contains a non-zero value
Notes
-----
There are certain conditions that will cause the sweep unit to silence the channel, and halt the sweep refresh clock (which effectively stops sweep action, if any). Note that these conditions pertain regardless of any sweep refresh rate values, or if sweeping is enabled/disabled (via bit 7).
- an 11-bit wavelength value less than $008 will cause this condition
- if the sweep unit is currently set to increase mode, the New calculated wavelength value will always be tested to see if a carry (bit $B) was generated or not (if sweeping is enabled, this carry will be examined before the Wavelength register is updated) from the shift addition calculation. If carry equals 1, the channel is silenced, and sweep action is halted.
+----------------------+
| Duty cycle generator |
+----------------------+
The duty cycle generator takes the fequency produced from the 11-bit programmable timer, and uses a 4 bit counter to produce 4 types of duty cycles. The output frequency is then 1/16 that of the programmable timer. The duty cycle hardware is only found in the square wave channels. The bit assignments are as follows:
$4000(sq1)/$4004(sq2)
---------------------
6-7 Duty cycle type
duty (positive/negative)
val in clock cycles
--- ---------------
00 2/14
01 4/12
10 8/ 8
11 12/ 4
Where val represents bits 6-7 of $4000/$4004.
This counter is reset when the length counter of the same channel is written to (via $4003/$4007).
The output frequency at this point will now be fed to the volume/envelope decay hardware.
+----------------------+
| Wavelength converter |
+----------------------+
The wavelength converter is only used in the noise channel. It is used to convert a given 4-bit value to an 11-bit wavelength, which then is sent to the noise's own programmable timer. Here is the bit descriptions:
$400E bits
----------
0-3 The 4-bit value to be converted
Below is a conversion chart that shows what 4-bit value will represent the 11-bit wavelength to be fed to the channel's programmable timer:
value octave scale CPU clock cycles (11-bit wavelength+1)
----- ------ ----- --------------------------------------
0 15 A 002
1 14 A 004
2 13 A 008
3 12 A 010
4 11 A 020
5 11 D 030
6 10 A 040
7 10 F 050
8 10 C 065
9 9 A 07F
A 9 D 0BE
B 8 A 0FE
C 8 D 17D
D 7 A 1FC
E 6 A 3F9
F 5 A 7F2
Octave and scale information is provided for the music enthusiast programmer who is more familiar with notes than clock cycles.
+-------------------------+
| Random number generator |
+-------------------------+
The noise channel has a 1-bit pseudo-random number generator. It's based on a 15-bit shift register, and an exclusive or gate. The generator can produce two types of random number sequences: long, and short. The long sequence generates 32,767-bit long number patterns. The short sequence generates 93-bit long number patterns. The 93-bit mode will generally produce higher sounding playback frequencys on the channel. Here is the bit that controls the mode:
$400E bits
----------
7 mode
If mode=0, then 32,767-bit long number sequences will be produced (32K mode), otherwise 93-bit long number sequences will be produced (93-bit mode).
The following diagram shows where the XOR taps are taken off the shift register to produce the 1-bit pseudo-random number sequences for each mode.
mode <-----
---- EDCBA9876543210
32K **
93-bit * *
The current result of the XOR will be transferred into bit position 0 of the SR, upon the next shift cycle. The 1-bit random number output is taken from pin E, is inverted, then is sent to the volume/envelope decay hardware for the noise channel. The shift register is shifted upon recieving 2 clock pulses from the programmable timer (the shift frequency will be half that of the frequency from the programmable timer (one octave lower)).
On system reset, this shift register is loaded with a value of 1.
RP2A03E quirk
-------------
I have been informed that revisions of the 2A03 before "F" actually lacked support for the 93-bit looped noise playback mode. While the Famicom's 2A03 went through 4 revisions (E..H), I think that only one was ever used for the front loading NES: "G". Other differences between 2A03 revisions are unknown.
EOF

View File

@ -0,0 +1,697 @@
The NES sound channel guide 1.8
Written by Brad Taylor.
btmine@hotmail.com
Last updated: July 27th, 2000.
All results were obtained by studying prior information available (from
nestech 1.00, and postings on NESDev from miscellanious people), and through
a series of experiments conducted by me. Results acquired by individuals
prior to my reverse-engineering have been double checked, and final results
have been confirmed. Credit is due to those individual(s) who contributed
any information in regards to the the miscellanious sound channels wihtin
the NES.
A special thanks goes out to Matthew Conte, for his expertise on
pseudo-random number generation (amoung other things), which allowed for the
full reverse engineering of the NES's noise channel to take place. Without
his help, I would still be trying to find a needle in a haystack, as far as
the noise's method of pseudo-random number generation goes. Additionally,
his previous findings / reverse engineering work on the NES's sound hardware
really got the ball of NES sound emulation rolling. If it weren't for Matt's
original work, this document wouldn't exist.
Thanks to Kentaro Ishihara, for his excellent work on finding the difference
in upward frequency sweep between the 2 square wave channels.
****************
* Introduction *
****************
The 2A03 (NES's integrated CPU) has 4 internal channels to it that have the
ability to generate semi-analog sound, for musical playback purposes. These
channels are 2 square wave channels, one triangle wave channel, and a noise
generation channel. This document will go into full detail on every aspect
of the operation and timing of the mentioned sound channels.
*******************
* Channel details *
*******************
Each channel has different characteristics to it that make up it's
operation.
The square channel(s) have the ability to generate a square wave frequency
in the range of 54.6 Hz to 12.4 KHz. It's key features are frequency sweep
abilities, and output duty cycle adjustment.
The triangle wave channel has the ability to generate an output triangle
wave with a resolution of 4-bits (16 steps), in the range of 27.3 Hz to 55.9
KHz. The key features this channel has is it's analog triangle wave output,
and it's linear counter, which can be set to automatically disable the
channel's sound after a certain period of time has gone by.
The noise channel is used for producing random frequencys, which results in
a "noisey" sounding output. Output frequencys can range anywhere from 29.3
Hz to 447 KHz. It's key feature is it's pseudo- random number generator,
which generates the random output frequencys heard by the channel.
*****************
* Frame counter *
*****************
The 2A03 has an internal frame counter. It has the ability to generate 60 Hz
(1/1 framerate), 120 Hz (1/2 framerate), and 240 Hz (1/4 framerate) signals,
used by some of the sound hardware. The 1/4 framerate is calculated by
taking twice the CPU clock speed (3579545.454545 Hz), and dividing it by
14915 (i.e., the divide-by-14915 counter is decremented on the rising AND
falling edge of the CPU's clock signal).
************************
* Sound hardware delay *
************************
After resetting the 2A03, the first time any sound channel(s) length counter
contains a non-zero value (channel is enabled), there will be a 2048 CPU
clock cycle delay before any of the sound hardware is clocked. After the 2K
clock cycles go by, the NES sound hardware will be clocked normally. This
phenomenon only occurs prior to a system reset, and only occurs during the
first 2048 CPU clocks for any sound channel prior to a sound channel being
enabled.
The information in regards to this delay is only provided to keep this
entire document persistently accurate on the 2A03's sound hardware, but may
not be 100% accurate in itself. I haven't done much tests on the behaviour
of this delay (mainly because I don't care, as I view it as a inconvenience
anyway), so that's why I believe there could be some inaccuracies.
************************
* Register Assignments *
************************
The sound hardware internal to the 2A03 has been designated these special
memory addresses in the CPU's memory map.
$4000-$4003 Square wave 1
$4004-$4007 Square wave 2 (identical to the first, except for upward
frequency sweeps (see "sweep unit" section))
$4008-$400B Triangle
$400C-$400F Noise
$4015 Channel enable / length counter status
Note that $4015 is the only R/W register. All others are write only (attempt
to read them will most likely result in a returned 040H, due to heavy
capacitance on the NES's data bus). Reading a "write only" register, will
have no effect on the specific register, or channel.
Every sound channel has 4 registers affiliated with it. The description of
the register sets are as follows:
+----------------+
| Register set 1 |
+----------------+
$4000(sq1)/$4004(sq2)/$400C(noise) bits
---------------------------------------
0-3 volume / envelope decay rate
4 envelope decay disable
5 length counter clock disable / envelope decay looping enable
6-7 duty cycle type (unused on noise channel)
$4008(tri) bits
---------------
0-6 linear counter load register
7 length counter clock disable / linear counter start
+----------------+
| Register set 2 |
+----------------+
$4001(sq1)/$4005(sq2) bits
--------------------------
0-2 right shift amount
3 decrease / increase (1/0) wavelength
4-6 sweep update rate
7 sweep enable
$4009(tri)/$400D(noise) bits
----------------------------
0-7 unused
+----------------+
| Register set 3 |
+----------------+
$4002(sq1)/$4006(sq2)/$400A(Tri) bits
-------------------------------------
0-7 8 LSB of wavelength
$400E(noise) bits
-----------------
0-3 playback sample rate
4-6 unused
7 random number type generation
+----------------+
| Register set 4 |
+----------------+
$4003(sq1)/$4007(sq2)/$400B(tri)/$400F(noise) bits
--------------------------------------------------
0-2 3 MS bits of wavelength (unused on noise channel)
3-7 length counter load register
+--------------------------------+
| length counter status register |
+--------------------------------+
$4015(read)
-----------
0 square wave channel 1
1 square wave channel 2
2 triangle wave channel
3 noise channel
4 DMC (see "DMC.TXT" for details)
5-6 unused
7 IRQ status of DMC (see "DMC.TXT" for details)
+-------------------------+
| channel enable register |
+-------------------------+
$4015(write)
------------
0 square wave channel 1
1 square wave channel 2
2 triangle wave channel
3 noise channel
4 DMC channel (see "DMC.TXT" for details)
5-7 unused
************************
* Channel architecture *
************************
This section will describe the internal components making up each individual
channel. Each component will then be described in full detail.
Device Triangle Noise Square
------ -------- ------ ------
triangle step generator X
linear counter X
programmable timer X X X
length counter X X X
4-bit DAC X X X
volume/envelope decay unit X X
sweep unit X
duty cycle generator X
wavelength converter X
random number generator X
+-------------------------+
| Triangle step generator |
+-------------------------+
This is a 5-bit, single direction counter, and it is only used in the
triangle channel. Each of the 4 LSB outputs of the counter lead to one input
on a corresponding mutually exclusive XNOR gate. The 4 XNOR gates have been
strobed together, which results in the inverted representation of the 4 LSB
of the counter appearing on the outputs of the gates when the strobe is 0,
and a non-inverting action taking place when the strobe is 1. The strobe is
naturally connected to the MSB of the counter, which effectively produces on
the output of the XNOR gates a count sequence which reflects the scenario of
a near- ideal triangle step generator (D,E,F,F,E,D,...,2,1,0,0,1,2,...). At
this point, the outputs of the XNOR gates will be fed into the input of a
4-bit DAC.
This 5-bit counter will be halted whenever the Triangle channel's length or
linear counter contains a count of 0. This results in a "latching"
behaviour; the counter will NOT be reset to any definite state.
On system reset, this counter is loaded with 0.
The counter's clock input is connected directly to the terminal count output
pin of the 11-bit programmable timer in the triangle channel. As a result of
the 5-bit triangle step generator, the output triangle wave frequency will
be 32 times less than the frequency of the triangle channel's programmable
timer is set to generate.
+----------------+
| Linear counter |
+----------------+
The linear counter is only found in the triangle channel. It is a 7-bit
presettable down counter, with a decoded output condition of 0 available
(not exactly the same as terminal count). Here's the bit assignments:
$4008 bits
----------
0-6 bits 0-6 of the linear counter load register (NOT the linear counter
itself)
7 linear counter start
The counter is clocked at 240 Hz (1/4 framerate), and the calculated length
in frames is 0.25*N, where N is the 7-bit loaded value. The counter is
always being clocked, except when 0 appears on the output of the counter. At
this point, the linear counter & triangle step counter clocks signals are
disabled, which results in both counters latching their current state (the
linear counter will stay at 0, and the triangle step counter will stop, and
the channel will be silenced due to this).
The linear counter has 2 modes: load, and count. When the linear counter is
in load mode, it essentially becomes transparent (i.e. whatever value is
currently in, or being written to $4008, will appear on the output of the
counter). Because of this, no count action can occur in load mode. When the
mode changes from load to count, the counter will now latch the value
currently in it, and start counting down from there. In the count mode, the
current value of $4008 is ignored by the counter (but still retained in
$4008). Described below is how the mode of the linear counter is set:
Writes to $400B
---------------
cur mode
--- ----
1 load
0 load (during the write cycle), count
Cur is the current state of the MSB of $4008.
Writes to $4008
---------------
old new mode
--- --- ----
0 X count
1 0 no change (during the write cycle), count
1 1 no change
Old and new represent the state(s) of the MSB of $4008. Old is the value
being replaced in the MSB of $4008 on the write, and new is the value
replacing the old one.
"no change" indicates that the mode of the linear counter will not change
from the last.
+--------------------+
| Programmable timer |
+--------------------+
The programmable timer is a 11-bit presettable down counter, and is found in
the square, triangle, and noise channel(s). The bit assignments are as
follows:
$4002(sq1)/$4006(sq2)/$400A(Tri) bits
-------------------------------------
0-7 represent bits 0-7 of the 11-bit wavelength
$4003(sq1)/$4007(sq2)/$400B(Tri) bits
-------------------------------------
0-2 represent bits 8-A of the 11-bit wavelength
Note that on the noise channel, the 11 bits are not available directly. See
the wavelength converter section, for more details.
The counter has automatic syncronous reloading upon terminal count
(count=0), therefore the counter will count for N+1 (N is the 11-bit loaded
value) clock cycles before arriving at terminal count, and reloading. This
counter will typically be clocked at the 2A03's internal 6502 speed (1.79
MHz), and produces an output frequency of 1.79 MHz/(N+1). The terminal
count's output spike length is typically no longer than half a CPU clock.
The TC signal will then be fed to the appropriate device for the particular
sound channel (for square, this terminal count spike will lead to the duty
cycle generator. For the triangle, the spike will be fed to the triangle
step generator. For noise, this signal will go to the random number
generator unit).
+----------------+
| Length counter |
+----------------+
The length counter is found in all sound channels. It is essentially a 7-bit
down counter, and is conditionally clocked at a frequency of 60 Hz.
When the length counter arrives at a count of 0, the counter will be stopped
(stay on 0), and the appropriate channel will be silenced.
The length counter clock disable bit, found in all the channels, can also be
used to halt the count sequence of the length counter for the appropriate
channel, by writing a 1 out to it. A 0 condition will permit counting
(unless of course, the counter's current count = 0). Location(s) of the
length counter clock disable bit:
$4000(sq1)/$4004(sq2)/$400C(noise) bits
---------------------------------------
5 length counter clock disable
$4008(tri) bits
---------------
7 length counter clock disable
To load the length counter with a specified count, a write must be made out
to the length register. Location(s) of the length register:
$4003(sq1)/$4007(sq2)/$400B(tri)/$400F(noise) bits
--------------------------------------------------
3-7 length
The 5-bit length value written, determines what 7-bit value the length
counter will start counting from. A conversion table here will show how the
values are translated.
+-----------------------+
| bit3=0 |
+-------+---------------+
| |frames |
|bits +-------+-------+
|4-6 |bit7=0 |bit7=1 |
+-------+-------+-------+
|0 |05 |06 |
|1 |0A |0C |
|2 |14 |18 |
|3 |28 |30 |
|4 |50 |60 |
|5 |1E |24 |
|6 |07 |08 |
|7 |0E |10 |
+-------+-------+-------+
+---------------+
| bit3=1 |
+-------+-------+
|bits | |
|4-7 |frames |
+-------+-------+
|0 |7F |
|1 |01 |
|2 |02 |
|3 |03 |
|4 |04 |
|5 |05 |
|6 |06 |
|7 |07 |
|8 |08 |
|9 |09 |
|A |0A |
|B |0B |
|C |0C |
|D |0D |
|E |0E |
|F |0F |
+-------+-------+
The length counter's real-time status for each channel can be attained. A 0
is returned for a zero count status in the length counter (channel's sound
is disabled), and 1 for a non-zero status. Here's the bit description of the
length counter status register:
$4015(read)
-----------
0 length counter status of square wave channel 1
1 length counter status of square wave channel 2
2 length counter status of triangle wave channel
3 length counter status of noise channel
4 length counter status of DMC (see "DMC.TXT" for details)
5-6 unused
7 IRQ status of DMC (see "DMC.TXT" for details)
Writing a 0 to the channel enable register will force the length counters to
always contain a count equal to 0, which renders that specific channel
disabled (as if it doesn't exist). Writing a 1 to the channel enable
register disables the forced length counter value of 0, but will not change
the count itself (it will still be whatever it was prior to the writing of
1).
Bit description of the channel enable register:
$4015(write)
------------
0 enable square wave channel 1
1 enable square wave channel 2
2 enable triangle wave channel
3 enable noise channel
4 enable DMC channel (see "DMC.TXT" for details)
5-7 unused
Note that all 5 used bits in this register will be set to 0 upon system
reset.
+-----------+
| 4-bit DAC |
+-----------+
This is just a standard 4-bit DAC with 16 steps of output voltage
resolution, and is used by all 4 sound channels.
On the 2A03, square wave 1 & 2 are mixed together, and are available via pin
1. Triangle & noise are available on pin 2. These analog outputs require a
negative current source, to attain linear symmetry on the various output
voltage levels generated by the channel(s) (moreover, to get the sound to be
audible). Since the NES just uses external 100 ohm pull-down resistors, this
results in the output waveforms being of very small amplitude, but with
minimal linearity asymmetry.
+------------------------------+
| Volume / envelope decay unit |
+------------------------------+
The volume / envelope decay hardware is found only in the square wave and
noise channels.
$4000(sq1)/$4004(sq2)/$400C(noise)
----------------------------------
0-3 volume / envelope decay rate
4 envelope decay disable
5 envelope decay looping enable
When the envelope decay disable bit (bit 4) is set (1), the current volume
value (bits 0-3) is sent directly to the channel's DAC. However, depending
on certain conditions, this 4-bit volume value will be ignored, and a value
of 0 will be sent to the DAC instead. This means that while the channel is
enabled (producing sound), the output of the channel (what you'll hear from
the DAC) will either be the 4-bit volume value, or 0. This also means that a
4-bit volume value of 0 will result in no audible sound. These conditions
are as follows:
- When hardware in the channel wants to disable it's sound output (like the
length counter, or sweep unit (square channels only)).
- On the negative portion of the output frequency signal coming from the
duty cycle / random number generator hardware (square wave channel / noise
channel).
When the envelope decay disable bit is cleared, bits 0-3 now control the
envelope decay rate, and an internal 4-bit down counter (hereon the envelope
decay counter) now controls the channel's volume level. "Envelope decay" is
used to describe the action of the channel's audio output volume starting
from a certain value, and decreasing by 1 at a fixed (linear) rate (which
produces a "fade-out" sounding effect). This fixed decrement rate is
controlled by the envelope decay rate (bits 0-3). The calculated decrement
rate is 240Hz/(N+1), where N is any value between $0-$F.
When the channel's envelope decay counter reaches a value of 0, depending on
the status of the envelope decay looping enable bit (bit 5, which is shared
with the length counter's clock disable bit), 2 different things will
happen:
bit 5 action
----- ------
0 The envelope decay count will stay at 0 (channel silenced).
1 The envelope decay count will wrap-around to $F (upon the next clock
cycle). The envelope decay counter will then continue to count down
normally.
Only a write out to $4003/$4007/$400F will reset the current envelope decay
counter to a known state (to $F, the maximum volume level) for the
appropriate channel's envelope decay hardware. Otherwise, the envelope decay
counter is always counting down (by 1) at the frequency currently contained
in the volume / envelope decay rate bits (even when envelope decays are
disabled (setting bit 4)), except when the envelope decay counter contains a
value of 0, and envelope decay looping (bit 5) is disabled (0).
+------------+
| Sweep unit |
+------------+
The sweep unit is only found in the square wave channels. The controls for
the sweep unit have been mapped in at $4001 for square 1, and $4005 for
square 2.
The controls
------------
Bit 7 when this bit is set (1), sweeping is active. This results in
real-time increasing or decreasing of the the current wavelength value (the
audible frequency will decrease or increase, respectively). The wavelength
value in $4002/3 ($4006/7) is constantly read & updated by the sweep.
Modifying the contents of $4002/3 will be immediately audible, and will
result in the sweep now starting from this new wavelength value.
Bits 6-4 These 3 bits represent the sweep refresh rate, or the frequency at
which $4002/3 is updated with the new calculated wavelength. The refresh
rate frequency is 120Hz/(N+1), where N is the value written, between 0 and
7.
Bit 3 This bit controls the sweep mode. When this bit is set (1), sweeps
will decrease the current wavelength value, as a 0 will increase the current
wavelength.
Bits 2-0 These bits control the right shift amount of the new calculated
sweep update wavelength. Code that shows how the sweep unit calculates a new
sweep wavelength is as follows:
bit 3
-----
0 New = Wavelength + (Wavelength >> N)
1 New = Wavelength - (Wavelength >> N) (minus an additional 1, if using
square wave channel 1)
where N is the the shift right value, between 0-7.
Note that in decrease mode, for subtracting the 2 values:
1's compliment (NOT) is being used for square wave channel 1
2's compliment (NEG) is being used for square wave channel 2
This information is currently the only known difference between the 2 square
wave channels.
On each sweep refresh clock, the Wavelength register will be updated with
the New value, but only if all 3 of these conditions are met:
- bit 7 is set (sweeping enabled)
- the shift value (which is N in the formula) does not equal to 0
- the channel's length counter contains a non-zero value
Notes
-----
There are certain conditions that will cause the sweep unit to silence the
channel, and halt the sweep refresh clock (which effectively stops sweep
action, if any). Note that these conditions pertain regardless of any sweep
refresh rate values, or if sweeping is enabled/disabled (via bit 7).
- an 11-bit wavelength value less than $008 will cause this condition
- if the sweep unit is currently set to increase mode, the New calculated
wavelength value will always be tested to see if a carry (bit $B) was
generated or not (if sweeping is enabled, this carry will be examined before
the Wavelength register is updated) from the shift addition calculation. If
carry equals 1, the channel is silenced, and sweep action is halted.
+----------------------+
| Duty cycle generator |
+----------------------+
The duty cycle generator takes the fequency produced from the 11-bit
programmable timer, and uses a 4 bit counter to produce 4 types of duty
cycles. The output frequency is then 1/16 that of the programmable timer.
The duty cycle hardware is only found in the square wave channels. The bit
assignments are as follows:
$4000(sq1)/$4004(sq2)
---------------------
6-7 Duty cycle type
duty (positive/negative)
val in clock cycles
--- ---------------
00 2/14
01 4/12
10 8/ 8
11 12/ 4
Where val represents bits 6-7 of $4000/$4004.
The output frequency at this point will now be fed to the volume/envelope
decay hardware.
+----------------------+
| Wavelength converter |
+----------------------+
The wavelength converter is only used in the noise channel. It is used to
convert a given 4-bit value to an 11-bit wavelength, which then is sent to
the noise's own programmable timer. Here is the bit descriptions:
$400E bits
----------
0-3 The 4-bit value to be converted
Below is a conversion chart that shows what 4-bit value will represent the
11-bit wavelength to be fed to the channel's programmable timer:
value octave scale CPU clock cycles (11-bit wavelength+1)
----- ------ ----- --------------------------------------
0 15 A 002
1 14 A 004
2 13 A 008
3 12 A 010
4 11 A 020
5 11 D 030
6 10 A 040
7 10 F 050
8 10 C 065
9 9 A 07F
A 9 D 0BE
B 8 A 0FE
C 8 D 17D
D 7 A 1FC
E 6 A 3F9
F 5 A 7F2
Octave and scale information is provided for the music enthusiast programmer
who is more familiar with notes than clock cycles.
+-------------------------+
| Random number generator |
+-------------------------+
The noise channel has a 1-bit pseudo-random number generator. It's based on
a 15-bit shift register, and an exclusive or gate. The generator can produce
two types of random number sequences: long, and short. The long sequence
generates 32,767-bit long number patterns. The short sequence generates
93-bit long number patterns. The 93-bit mode will generally produce higher
sounding playback frequencys on the channel. Here is the bit that controls
the mode:
$400E bits
----------
7 mode
If mode=0, then 32,767-bit long number sequences will be produced (32K
mode), otherwise 93-bit long number sequences will be produced (93-bit
mode).
The following diagram shows where the XOR taps are taken off the shift
register to produce the 1-bit pseudo-random number sequences for each mode.
mode <-----
---- EDCBA9876543210
32K **
93-bit * *
The current result of the XOR will be transferred into bit position 0 of the
SR, upon the next shift cycle. The 1-bit random number output is taken from
pin E, is inverted, then is sent to the volume/envelope decay hardware for
the noise channel. The shift register is shifted upon recieving 2 clock
pulses from the programmable timer (the shift frequency will be half that of
the frequency from the programmable timer (one octave lower)).
On system reset, this shift register is loaded with a value of 1.

View File

@ -0,0 +1,250 @@
========= mmc5 infomation ==========
date 1998/05/31
by goroh
translated May 31, 1998 by Sgt. Bowhack
mail goroh_kun@geocities.co.jp
5000,5004 ch1,ch2 Pulse Control
bit CCwevvvv
CC Duty Cycle (Positive vs. Negative)
#0:87.5% #1:75.0% #2:50.0% #3:25.0%
w Waveform Hold (e.g. Looping)
0: Off 1: On
e Envelope Select
0: Varied 1: Fixed
< e=0 >
vvvv Playback Rate
#0<-fast<--->-slow--> #15
< e=1 >
vvvv Output Volume
5002,5006 ch1,ch2 frequency L
bit ffffffff
5003,5007 ch1,ch2 frequency H
bit tttttfff
ttttt sound occurence time
Objective is to remove the continuous changing of frequency for
square wave setup and do the same to the main part of the square wave
of studying the main part of the famicom. (?- Sgt. Bowhack)
5010 ch3 synthetic voice business channel
bit -------O
O wave output 0:Off 1:On
5011 ch4 synthetic voice business channel 2
bit vvvvvvvv
vvvvvvvv wave size
5015 sound output channel
bit ------BA
A: ch1 output 1:enable 0:disable
B: ch2 output 1:enable 0:disable
5100 PRG-page size Setting
bit ------SS
SS PRG-page size
0: 32k 1:16k 2,3:8k
* Reset is misled the first times for about 8k (?- SB)
5101 CHR-page size Setting
bit ------SS
SS CHR-page size
0:8k 1:4k 2:2k 3:1k
5102 W BBR-RAM Write Protect 1
bit ------AA
5103 W BBR-RAM Write Protect 2
bit ------BB
(AA,BB) = (2,1) permitted to write to BBR-RAM only when crowded
*Reset write around becomes prohibited when crowded
5104 Grafix Mode Setting
$5c00-$5fff decides how it should be used
bit ------MM
#00:Enable only Split Mode
#01:Enable Split Mode & ExGrafix Mode
#02:ExRAM Mode
#03:ExRAM Mode & Write Protect
Consideration
MMC5 has 2 graphic mode extensions that allow more than 256 characters
on one standard game screen. It uses Split Mode so it can display the
specified CHR-page and scroll position seperate from ExGrafix Mode to
be able to choose a palette, and the other divides it vertically.
5105 W NameTable Setting
bit ddccbbaa
aa: Select VRAM at 0x2000-0x23ff
bb: Select VRAM at 0x2400-0x27ff
cc: Select VRAM at 0x2800-0x2bff
dd: Select VRAM at 0x2c00-0x2fff
#0:use VRAM 0x000-0x3ff
#1:use VRAM 0x400-0x7ff
#2:use ExVRAM 0x000-0x3ff
#3:use ExNameTable(Fill Mode)
Consideration
The name table can designate 4 kinds of this resister and be a useful
special quality for this because painting and smashing it with a
character that there is 1 sheet for the remaining sheets can generally
be used. (?-SB)
5106 W Fill Mode Setting 1
bit vvvvvvvv
Fill chr-table
For whether it paints or smashes it at any non-designated character
5107 W Fill Mode Setting 2
bit ------pp
Whether or not it uses any non-designated palettes
5113 RAM-page for $6000-$7FFF
bit -----p--
5114-5117 Program Bank switch
< page_size=32k >
$5117 [8]-[F] bit pppppp--
< page_size=16k >
$5115 [8]-[B] bit ppppppp-
$5117 [C]-[F] bit ppppppp-
< page_size=8k >
$5114 [8][9] bit pppppppp
$5115 [A][B] bit pppppppp
$5116 [C][D] bit pppppppp
$5117* [E][F] bit pppppppp
*Reset is around early, Last Page misled
5120-512b Charactor Bank switch
< page_size=8k >
$5120-$5127 switch to mode A
$5128-$512b switch to mode B
$5127 [0]-[7] modeA
$512b [0]-[7] modeB
< page_size=4k >
$5120-$5127 switch to mode A
$5128-$512b switch to mode B
$5123 [0]-[3] modeA
$5127 [4]-[7] modeA
$512b [0]-[3],[4]-[7] modeB
< page_size=2k >
$5120-$5127 switch to mode A
$5128-$512b switch to mode B
$5121 [0]-[1] modeA
$5123 [2]-[3] modeA
$5125 [4]-[5] modeA
$5127 [6]-[7] modeA
$5129 [0]-[1],[4]-[5] modeB
$512b [2]-[3],[6]-[7] modeB
< page_size=1k >
$5120-$5127 switch to mode A
$5128-$512b switch to mode B
$5120 [0] modeA
$5121 [1] modeA
$5122 [2] modeA
$5123 [3] modeA
$5124 [4] modeA
$5125 [5] modeA
$5126 [6] modeA
$5127 [7] modeA
$5128 [0],[4] modeB
$5129 [1],[5] modeB
$512a [2],[6] modeB
$512b [3],[7] modeB
Consideration
MMC5 has mode A ,mode B and 2 kinds of CHR-page memory resistors.
They can be used for refreshing it. (?-SB)
5130 ???
analyzing it...
5200 W Split Mode Control 1
bit Ec-vvvvv
For the E function 0:don't use 1:use
c boundary's side is for using Split Mode extension of graphics
0: left side 1: right side
vvvvv left boundary is designated with the char. # to count places
Sample.
5200 <- #00
(not?) used yet
5200 <- #82
Used for SplitMode GFX extension from left 1-2 character
5200 <- #c2
Used for SplitMode GFX extension from the right side 3 chars.
5200 <- #c0
Used for SplitMode GFX extension on the whole screen
5200 <- #d0
Used for SplitMode GFX extension on the right side of the screen
5200 <- #90
Used for SplitMode GFX extension on the left side of the screen
5201 W SplitMode setup for SplitMode Ext. GFX use 1
$2005 determines the vertical movement; it can also delay ext. gfx's
vert. movement if necessary. It's written 2 times in bulk in the same
way as it would slip off a grade in $2005 (??-SB)
5202 W SplitMode setup for SplitMode Ext. GFX use 2
bit --pppppp
uses vertical division of ext. gfx CHR-page designation
index_size=4k(0x1000byte)
In case it uses a character 0x4000-0x4fff for the ext. gfx in question
$5202 <- 4
5203 W scanline break point
For scanline # that it splits and wants to make it designate it in bulk
5204 WR IRQ enable/disable
W bit I-------
I 1:IRQ Enable 0:IRQ Disable
R bit I-------
I 1:Scanline Hit 0:Scanline not Hit
$5203 is designated as scanline when arrived.
5205 WR mult input/output
5206 WR mult input/output
($5205in)*($5206in) = $5205,$5206out
5c00-5fbf ext. gfx business VRAM
shows an attribute of every position character
<ExGrafix Mode>
bit PPpppppp
PP: use character palette number
pppppp: use background CHR-PAGE number index=4k
#0-#3F are designations, $0000-$3FFF is CHR-data's range
Use for extension gfx
<Split Mode>
SplitMode uses a Name Table for extension gfx use.
bit pppppppp
pppppppp: use for background char. number designation
<ExRAM Mode>
Used for Extension RAM
5fc0-5fff
<ExGrafix Mode>
(not?) used yet
<Split Mode>
SplitMode uses gfx's Attribute Table extension.
PPU uses $23c0-$23ff in the same way as the Attribute Table
<ExRAM Mode>
Used for Extension RAM
Consideration
5c00-5fff has 3 uses.
Split Mode and ExGrafix Mode's VBlank is written so as to become
crowded, it writes a 0 and becomes crowded.
Every mode tries to go around ExRAM mode including reading but it
writes it, is effective in bulk and #5c-#5f is the output at times
where it is effective.

View File

@ -0,0 +1,112 @@
SMB2j Revision "A". Mapper #50 Info
-----------------------------------
12.09.2000
V2.00
Mapper info by The Mad Dumper
---
This mapper has been assigned the number 50. (that's 50 decimal)
Wow, another SMB2j cart! This one is alot different than the last one I
worked on. It has a single 128K PRG ROM and VRAM. The other SMB2j had
64K PRG and 8K CHR. Not much more to say other than this has one very
fucked up mapper circuit on it!
---
The hardware:
It consists of 6 TTL chips (74163, 74157, 74139, 7400, 7474, and a 4020),
1 8K RAM chip for the VRAM, and 1 128K 28 pin ROM. There is some
"M^2L" logic on the board (Mickey-Mouse Logic). It is a 3 input OR gate
made out of 3 diodes and a resistor.
Also, they swapped D3 and D6, as well as A1 and A3. Why this was done, I
have no idea. It sure mussed up my REing efforts! I desoldered and read
the ROM out through the EPROM programmer as a check and was not happy to
find the data seemingly corrupt!
After converting the ROM image over via some QBasic, it matched up great.
You do not have to swap the addresses or data bytes; I have done this
already in the released .NES ROM.
---
There are two registers on this cartridge. They are located in the 4000h-
5FFFh block.
Funny addresses are decoded for the register selection; presumably so they
did not interfere with the FDS or NES registers.
A15 ... A0
-------------------
010x xxxQ x01x xxxx
x = Don't Care
0 = must be 0
1 = must be 1
Q = register selection bit. 0 = ROM Page; 1 = IRQ Timer Enable
-
ROM Page Register:
------------------
Accessed when the address lines are in the above state. An example address
would be 4020h. 4021h, 4022h, ... 403Fh, 40A0h, 40A1h, ... are all mirrors
of this register. Writing here stores the desired bank #.
7 bit 0
---------
xxxx DCBA
These 4 bits are shown below in the ROM memory map. Note that they are
somewhat "scrambled". The value of this register is unknown at powerup.
-
IRQ Timer.
7 bit 0
---------
xxxx xxxI
The IRQ Timer register controls the state of the IRQ timer. Writing here
will turn it on or off. Turning the IRQ timer off resets it to 0. Writing
a 1 here will turn the timer on, while writing a 0 will turn it off.
The timer is composed of a binary ripple counter. After 4096 M2 cycles,
/IRQ is pulled low. This is about 36 scanlines. The idea behind the timer
is to split the screen for the score bar at the top. You start it at the
beginning of the VBI routine, and then after 36 scanlines, it sends the IRQ
which clears the timer, and resets the scroll registers. The value of this
register is unknown at powerup.
---
ROM Memory Map:
Address Range | Bank bits: 3210
-------------------------------
6000h-7FFFh 1111
8000h-9FFFh 1000
A000h-BFFFh 1001
C000h-DFFFh DACB -- Selectable page
E000h-FFFFh 1011
The ROM is composed of 16 8K banks. The 4 bank bits are shown above. Bit 3
is the MSB while bit 0 is the LSB. 6000h-7FFFh is set to 1111b, or bank 0fh.
All banks are FIXED except the bank at C000h-DFFFh. Only it can be changed.

View File

@ -0,0 +1,18 @@
Unknown:
Alien Syndrome 128KiB/128KiB
Super Sprint
MIMIC 1:
Fantasy Zone 64KiB/64KiB
Toobin' 128KiB/64KiB
Vindicators 64KiB/32KiB
RAMBO 1(board looks like it can take 256KiB PRG/256KiB CHR max):
Klax 64KiB PRG/64KiB CHR
Road Runner 64KiB PRG/128KiB CHR
Rolling Thunder 128KiB PRG/128KiB CHR
Skull and Crossbones 128KiB PRG/64KiB CHR

View File

@ -0,0 +1,388 @@
VRCVI CHIP INFO
----- ---- ----
By:
Kevin Horton
khorton@iquest.net
The RENES Project:
Reverse-engineering
the world.
V1.01 08/31/99 teeny fix
V1.00 08/31/99 Complete Version
VRCVI (VRC6) (48 pin standard 600mil wide DIP)
------------
This chip is used in such games as Konami's CV3j and Madara. It's unique
because it has some extra sound channels on it that get piped through the
Famicom (note this is a fami-only chip and you will not find one in any
NES game). "VI" of "VRCVI" is "6" for the roman numeral challenged.
This chip generates its audio via a 6 bit R2R ladder. This is contained
inside a 9 pin resistor network like so:
3K 3K 3K 3K 3K 2K
/------*-\/\/-*-\/\/-*-\/\/-*-\/\/-*-\/\/-*------*-\/\/-\
| | | | | | | | |
\ \ \ \ \ \ \ | |
/ / / / / / / | |
\ 6K \ 6K \ 6K \ 6K \ 6K \ 6K \ 6K | |
/ / / / / / / | |
| | | | | | | | |
O O O O O O O O O
GND D0 D1 D2 D3 D4 D5 Aud In Aud Out
Legend:
-------
(s) means this pin connects to the System
(r) this only connects to the ROM
(w) this is a SRAM/WRAM connection only
AUD : these pass to the resistor network
CHR : these connect to the CHR ROM and/or fami's CHR pins
PRG : these connect to the PRG ROM and/or fami's PRG pins
WRAM : this hooks to the WRAM
CIRAM : the RAM chip which is on the fami board
.----\/----.
GND - |01 48| - +5V
AUD D1 - |02 47| - AUD D0
AUD D3 - |03 46| - AUD D2
AUD D5 - |04 45| - AUD D4
(s) PRG A12 - |05 44| - PRG A16 (r)
(s) PRG A14 - |06 43| - PRG A13 (s)
(s) M2 - |07 42| - PRG A17 (r)
(r) PRG A14 - |08 41| - PRG A15 (r)
*1 (s) PRG A1 - |09 40| - PRG A13 (r)
*1 (s) PRG A0 - |10 39| - PRG D7 (s)
(s) PRG D0 - |11 38| - PRG D6 (s)
(s) PRG D1 - |12 37| - PRG D5 (s)
(s) PRG D2 - |13 36| - PRG D4 (s)
(r) PRG /CE - |14 35| - PRG D3 (s)
(s) R/W - |15 34| - PRG /CE (s)
*2 (w) WRAM /CE - |16 33| - /IRQ (s)
(r) CHR /CE - |17 32| - CIRAM /CE (s)
(s) CHR /RD - |18 31| - CHR A10 (s)
(s) CHR /A13 - |19 30| - CHR A11 (s)
(r) CHR A16 - |20 29| - CHR A12 (s)
(r) CHR A15 - |21 28| - CHR A17 (r)
(r) CHR A12 - |22 27| - CHR A14 (r)
(r) CHR A11 - |23 26| - CHR A13 (r)
GND - |24 25| - CHR A10 (r)
| |
`----------'
VRCVI
*1: On some VRCVI carts, these are reversed. This affects some registers.
*2: This passes through a small pulse shaping network consisting of a
resistor, diode, and cap.
Registers: (sound related only)
----------
regs 9000-9002 are for pulse channel #1
regs a000-a002 are for pulse channel #2
regs b000-b002 are for the phase accumulator channel (sawtooth)
(bits listed 7 through 0)
9000h: GDDDVVVV
D - Duty Cycle bits:
000 - 1/16th ( 6.25%)
001 - 2/16ths (12.50%)
010 - 3/16ths (18.75%)
011 - 4/16ths (25.00%)
100 - 5/16ths (31.25%)
101 - 6/16ths (37.50%)
110 - 7/16ths (43.75%)
111 - 8/16ths (50.00%)
V - Volume bits. 0000b is silence, 1111b is loudest. Volume is
linear. When in "normal" mode (see G bit), this acts as a general
volume control register. When in "digitized" mode, these act as a
4 bit sample input.
G - Gate bit. 0=normal operation, 1=digitized. In digi operation,
registers 9001h and 9002h are totally disabled. Only bits 0-3 of
9000h are used. Whatever binary word is present here is passed on
as a 4 bit digitized output.
9002h: FFFFFFFF
F - Lower 8 bits of frequency data
9003h: X---FFFF
X - Channel disable. 0=channel disabled, 1=channel enabled.
F - Upper 4 bits of frequency data
A000h-A002h are identical in operation to 9000h-9002h. One note: this chip
will mix both digitized outputs (if the G bits are both set) into one
added output. (see in-depth chip operation below)
B000h: --PPPPPP
P - Phase accumulator input bits
B001h: FFFFFFFF
F - Lower 8 bits of frequency data
B002h: X---FFFF
X - Channel disable. 0=channel disabled, 1=channel enabled.
F - Upper 4 bits of frequency data
How the sounds are formed:
--------------------------
This chip is pretty cool. It outputs a 6 bit binary word for the sound
which is passed through a DAC and finally to the NES/Fami. Because of this,
the sound can be emulated *very* close to the original.
I used my scope to figure all this out as well as my meter and logic probe
so it should be 100% accurate.
Block diagrams of the VRCVI: (as reverse engineered by me)
----------------------------
| F bits | | D bits| | V bits |
| (12) | | (3) | | (4) |
\___________/ \_______/ \________/
+-----+ +----------------+ +-----------+ +------------+
| | | | | | | |--\
| OSC |-->|Divider (12 bit)|-->| Duty Cycle|-->| AND array |(4)> chan out
|(M2) | | | | Generator | | |--/
+-----+ +----------------+ +-----------+ +------------+
^ ^
| |
| |
G X
One Pulse channel (both are identical)
--------------------------------------
How it works: The oscillator (in the NES, the clock arrives on the M2 line
and is about 1.78Mhz) generates our starting frequency. This is passed
first into a divide by 1 to 4096 divider to generate a base frequency.
This is then passed to the duty cycle generator. The duty cycle generator
generates the desired duty cycle for the output waveform. The "D" input
controls the duty cycle generator's duty cycle. If the "G" bit is
a "1", it forces the output of the duty cycle generator to a "1" also. If
the "X" bit is "0", it forces the output of the duty cycle generator to "0",
which effectively disables the channel. Note that this input has precidence
over the "G" bit.
The AND array is just that- an array of 4 AND gates. If the output of
the duty cycle generator is a "0", then the "chan out" outputs will all be
forced to "0". If the output of the duty cycle generator is a "1", then
the chan out outputs will follow the V bit inputs.
Note that the output of this generator is a 4 bit binary word.
---
| F bits | | P bits|
| (12) | | (6) |
\___________/ \_______/
+-----+ +----------------+ +-----------+
| | | | | |--\
| OSC |-->|Divider (12 bit)|-->| Phase |(5)> chan out
|(M2) | | | |Accumulator|--/
+-----+ +----------------+ +-----------+
^
|
|
X
The Sawtooth (ramp) channel
---------------------------
This one is pretty similar to the above when it comes to frequency selection.
The output frequency will be the same relative to the square wave channels.
OK, the tough part will be explaining the phase accumulator. :-) What it is
is just an adder tied to a latch. Every clock it adds a constant to the
latch. In the case of the VRCVI, what you do is this:
The ramp is generated over the course of 7 evenly spaced cycles, generated
from the divider. Every clock from the divider causes the phase accumulator
to add once. So... let's say we have 03h in the P bits. Every 7 cycles
the phase accumulator (which is 8 bits) is reset to 00h.
cycle: accumulator: chan out: notes:
-----------------------------------------
0 00h 00h On the first cycle, the acc. is reset to 0
1 03h 00h We add 3 to 0 to get 3
2 06h 00h We add 3 to 3 to get 6
3 09h 01h
4 0ch 01h
5 0fh 01h
6 12h 02h
7 00h 00h Reset the acc. back to 0 and do it again
This will look like so: (as viewed on an oscilloscope)
- - - 2
--- --- --- 1
--- --- --- 0
|
012345601234560123456-+
Note: if you enter a value that is too large (i.e. 30h) the accumulator
*WILL WRAP*. Yes, this doesn't sound very good at all and you no longer
have a sawtooth. ;-)
The upper 5 bits of said accumulator are run to the "chan out" outputs.
The lower 3 bits are not run anywhere.
"X" disables the phase accumulator and forces all outputs to "0".
Note that the output of this generator is a 5 bit word.
---
Now that the actual sound generation is out of the way, here's how the
channels are combined into the final 6 bit binary output:
+---------+
| Pulse |
|Generator|
| #1 | Final 6 Bit
+---------+ Output
| (4) | / \
\ / | (6) |
+---------+ +---------+ +---------+
| 4 Bit |--\ | 5 Bit | /--|Sawtooth |
| Binary |(5)>| Binary |<(5)|Generator|
| Adder |--/ | Adder | \--| |
+---------+ +---------+ +---------+
/ \
| (4) |
+---------+
| Pulse |
|Generator|
| #2 |
+---------+
Channel Combining
-----------------
The three channels are finally added together through a series of adders
to produce the final output word. The two pulse chans are most likely added
first since they are 4 bit words, and that 5 bit result is most likely
added to the sawtooth's output. (The actual adding order is not known,
but I can make a *very* good guess. The above illustrated way uses the least
amount of transistors). In the end it does not matter the order in which
the words are added; the final word will always be the same.
The final 6 bit output word is run through an "R2R" resistor ladder which
turns the digital bits into a 64 level analog representation. The ladder
is binarally weighted and works like the DAC on your soundcard. :-)
(so take heart emulator authours: just run the finished 6 bit word to
your soundcard and it will sound right ;-).
Frequency Generation:
---------------------
The chip generates all its output frequencies based on M2, which is
colourburst divided by two (1789772.7272Hz). This signal is passed
directly into the programmable dividers (the 12 bit frequency regs).
Squares:
--------
These take the output of the programmable divider and then run it through
the duty cycle generator, which in the process of generating the duty cycle,
divides the frequency by 16.
To calculate output frequency:
1789772.7272
Fout = ----------------
(freq_in+1) * 16
This will tell you the exact frequency in Hz. (note that the * 16 is to
compensate for the divide by 16 duty cycle generator.)
Saw:
----
This is similar to the above, however the duty cycle generator is replaced
with a phase accumulator which divides the output frequency by 14.
To calculate output frequency:
1789772.7272
Fout = ----------------
(freq_in+1) * 14
This will tell you the exact frequency in Hz. (note that the * 14 is to
compensate for the phase accumulator.)
So how accurate is this info, anyways?
--------------------------------------
I believe the info to be 100% accurate. I have extensively tested the
output of the actual VRCVI chip to this spec and everything fits perfectly.
I did this by using a register dump and a QBASIC program I wrote which
takes the register dump and produces a WAV file. All frequency and
duty cycle measurements were taken with a Fluke 83 multimeter, and all
waveform data was culled from my oscilloscope measuring the real chip.
---EOF---

View File

@ -0,0 +1,321 @@
VRCVII CHIP INFO
------ ---- ----
By:
Kevin Horton
khorton@iquest.net
The RENES Project:
Reverse-engineering
the world.
V0.10 11/05/99 Document started, pinned out chip and audio thingy
V0.20 11/10/99 Added very, very, very preliminary register findings
v1.00 11/14/99 First release version of this doc
VRCVII (VRC7) (48 pin standard 600mil wide DIP)
-------------
This chip is used in only one Konami game that I know of- Lagrange Point.
I heard rumours it was used in another game, so if someone could provide
info and/or a ROM image, that would help immensely. It handles ROM
bankswitching as well as sound generation. The sound generation is done
using FM synthesis, so the music sounds like "Adlib" OPL2 music. Due to
extra sound, this is a Famicom-only chip like its cousin the
VRCVI. (See the VRCVI doc for more info)
"VII" of "VRCVII" is "7" for the roman numeral challenged.
This chip appears to generate all of its audio internally, which is then
fed to a small hybrid (aka "black blob") that does the audio interfacing
to the Famicom proper. It is physically a small ceramic substrate with
an 8 pin SMD chip on it (probably an op-amp), and what appears to be three
0805 sized SMD chip parts (capacitors most likely, since resistors can be
formed on the substrate). The whole works is then coated with a black
dipped epoxy coating, and the smooth side (opposite the parts) is then
marked with an identifying part number and the pin 1 dot.
Here's the pinout for it:
Front Side (parts facing away)
+-----------------+ 1- Audio in from Famicom
| 054002 | 2- Audio out to Famicom
|@ | 3,7 - Ground
+-----------------+ 4-6 - NC
| | | | | | | | | 8- Audio from VRCVII
1 2 3 4 5 6 7 8 9 9- +5V
Legend:
-------
(s) means this pin connects to the System
(r) this only connects to the ROM
(w) this is a SRAM/WRAM connection only
PRG : these connect to the PRG ROM and/or fami's PRG pins
WRAM : this hooks to the WRAM
Note: There is a 3.58Mhz ceramic resonator connected to the "X1" and "X2"
pins. it is the three-pin style with internal caps tied to the third pin
which is grounded.
Chip is physically marked: "VRV VII 053982"
.----\/----.
*1 (RAM&s) CHR /OE - |01 48| - NC
*1 (RAM&s) CHR /CE - |02 47| - M2 (s)
GND - |03 46| - /CE WRAM (w)
(s) R/W - |04 45| - PRG /A15 (s) (aka /CE)
(s) /IRQ - |05 44| - PRG ROM /CE (r)
(s) CIRAM A11 - |06 43| - Audio Out
(s) PD0 - |07 42| - +5V
(s) PD1 - |08 41| - NC
(s) PD2 - |09 40| - NC
(s) PD3 - |10 39| - NC
(s) PD4 - |11 38| - NC
(s) PD5 - |12 37| - NC
(s) PD6 - |13 36| - CHR RAM A12
(s) PD7 - |14 35| - CHR RAM A11
+5V - |15 34| - CHR RAM A10
(s) PRG A5 - |16 33| - CHR A12 (s)
Crystal X2 - |17 32| - CHR A11 (s)
Crystal X1 - |18 31| - CHR A10 (s)
(s) PRG A4 - |19 30| - +5V
(r) PRG ROM A13 - |20 29| - PRG A14 (s)
(r) PRG ROM A14 - |21 28| - PRG A13 (s)
(r) PRG ROM A15 - |22 27| - PRG A12 (s)
(r) PRG ROM A16 - |23 26| - PRG ROM A18 (r)
GND - |24 25| - PRG ROM A17 (r)
| |
`----------'
VRCVII
*1: these connect to both the CHR RAM's pins and the card edge.
Note: the NC pins 37-41 most likely for CHR ROM bankswitching. Since this
cart uses CHR RAM these obviously weren't used ;-)
Registers: (sound related only)
----------
All sound registers are accessed through only two physical registers.
9010:
-----
This is the index register. You write the desired register number here.
9030:
-----
This is the data register. Data written here is stored in the register
pointed to by the above index register.
There are 6 channels, each containing three registers, and 8 custom
instrument control registers.
Sound Registers:
----------------
00h - 07h : Custom instrument registers. See below for info.
---
10h - 15h : ffffffff
f: Lower 8 bits of frequency
---
20h - 25h : ???tooof
f: Upper bit of frequency
o: Octave Select
t: Channel trigger.
?: Dunno what these do yet (No audible effect)
---
30h - 35h : iiiivvvv
i: Instrument number
v: Volume
Instrument numbers 01h-0fh are fixed and cannot be changed.
Instrument number 00h is the "programmable" one.
To program the custom instrument, you load registers 00h-07h with the
desired parameters for it. All channels set to instrument 00h will
then use this instrument. Note that you can only program one custom
instrument at a time.
How do the frequency registers work?
------------------------------------
To generate a tone, you must select an octave and a frequency value. The
frequency values stay the same for say, the note "C", while the octave
bits determine which octave "C" lies in. This makes your note lookup table
quite small.
o = 000 is octave 0
o = 001 is octave 1
.
.
.
o = 111 is octave 7
49722*freqval
F = -------------
2^(19-octave)
Where:
F = output frequency in Hz
freqval = frequency register value
octave = desired octave (starting at 0)
Custom Instrument Registers (00-07)
-----------------------------------
Note: I will not provide too extensive documentation of the instrument
registers since their functions are identical to those of the OPL2 chip,
commonly found on Adlib/Soundblaster/compatible cards, and there is alot
of information out on how to program these. I will use terminology
similar to that found in said documents. My VRC7 "emulator" test program
I wrote simply re-arranged and tweaked the register writes to correspond
with the OPL2 registers.
Here's a link to a good document about this chip:
http://www.ccms.net/~aomit/oplx/
The tremolo depth is set to 4.3db and the vibrato depth is set to 14 cent
(in reguards to OPL2 settings; to achieve this you would write 0C0h to
OPL register 0BDh). All operator connections are fixed in FM mode. (Where
Modulator modulates the Carrier).
---
00 (Modulator) - tvskmmmm
01 (Carrier)
t: Tremolo Enable
v: Vibrato Enable
s: Sustain Enable
k: KSR
m: Multiplier
---
02 - kkoooooo
k: Key Scale Level
o: Output Level
---
03 - ---qweee
-: Not used: Write 0's
q: Carrier Waveform
w: Modulator Waveform
Note: There are only two waveforms available. Sine and rectified sine (only
the positive cycle of the sine; negative cycle "chopped off".)
e: Feedback Control
---
04 (Modulator) - aaaadddd
05 (Carrier)
a: Attack
d: Decay
---
06 (Modulator) - ssssrrrr
07 (Carrier)
s: Sustain
r: Release
Register Settings for the 15 fixed instruments.
-----------------------------------------------
*CAUTION*CAUTION*CAUTION*CAUTION*CAUTION*CAUTION*CAUTION*CAUTION*CAUTION*
C C
A These instruments are not 100% correct! There is no way to extract A
U the register settings from the chip short of an electron microscope. U
T I have "tuned" these instruments best I could, though I know a couple T
I are not exactly right. Use them at your own perl! If someone wants I
O to waste all day tuning a new set, please let me know what you get. O
N N
*CAUTION*CAUTION*CAUTION*CAUTION*CAUTION*CAUTION*CAUTION*CAUTION*CAUTION*
Register
--------
00 01 02 03 04 05 06 07
-----------------------
0 | -- -- -- -- -- -- -- --
1 | 05 03 10 06 74 A1 13 F4
2 | 05 01 16 00 F9 A2 15 F5
3 | 01 41 11 00 A0 A0 83 95
4 | 01 41 17 00 60 F0 83 95
5 | 24 41 1F 00 50 B0 94 94
6 | 05 01 0B 04 65 A0 54 95
7 | 11 41 0E 04 70 C7 13 10
Instrument 8 | 02 44 16 06 E0 E0 31 35
---------- 9 | 48 22 22 07 50 A1 A5 F4
A | 05 A1 18 00 A2 A2 F5 F5
B | 07 81 2B 05 A5 A5 03 03
C | 01 41 08 08 A0 A0 83 95
D | 21 61 12 00 93 92 74 75
E | 21 62 21 00 84 85 34 15
F | 21 62 0E 00 A1 A0 34 15
So how accurate is this info, anyways?
--------------------------------------
I believe the info to be 100% accurate. The pinout was generated with the
help of a multimeter and my Super-8 with both an NES cart and the Fami cart
plugged in. (this allows me to measure between my known "control" board
with the unknown "experimental" board to generate the connections).
Register info was gleaned via writing test code and listening and capturing
the resultant audio stream for analysis.
---EOF---

View File

@ -0,0 +1,336 @@
NES Music Format Spec
---------------------
By: Kevin Horton khorton@iquest.net
NOTE:
-----
Remember that I am very willing to add stuff and update this spec. If
you find a new sound chip or other change let me know and I will get back
with you. E-mail to the above address.
V1.61 - 06/27/2000 Updated spec a bit
V1.60 - 06/01/2000 Updated Sunsoft, MMC5, and Namco chip information
V1.50 - 05/28/2000 Updated FDS, added Sunsoft and Namco chips
V1.32 - 11/27/1999 Added MMC5 register locations
V1.30 - 11/14/1999 Added MMC5 audio bit, added some register info
V1.20 - 09/12/1999 VRC and FDS prelim sound info added
V1.00 - 05/11/1999 First official NSF specification file
This file encompasses a way to transfer NES music data in a small, easy to
use format.
The basic idea is one rips the music/sound code from an NES game and prepends
a small header to the data.
A program of some form (6502/sound emulator) then takes the data and loads
it into the proper place into the 6502's address space, then inits and plays
the tune.
Here's an overview of the header:
offset # of bytes Function
----------------------------
0000 5 STRING "NESM",01Ah ; denotes an NES sound format file
0005 1 BYTE Version number (currently 01h)
0006 1 BYTE Total songs (1=1 song, 2=2 songs, etc)
0007 1 BYTE Starting song (1= 1st song, 2=2nd song, etc)
0008 2 WORD (lo/hi) load address of data (8000-FFFF)
000a 2 WORD (lo/hi) init address of data (8000-FFFF)
000c 2 WORD (lo/hi) play address of data (8000-FFFF)
000e 32 STRING The name of the song, null terminated
002e 32 STRING The artist, if known, null terminated
004e 32 STRING The Copyright holder, null terminated
006e 2 WORD (lo/hi) speed, in 1/1000000th sec ticks, NTSC (see text)
0070 8 BYTE Bankswitch Init Values (see text, and FDS section)
0078 2 WORD (lo/hi) speed, in 1/1000000th sec ticks, PAL (see text)
007a 1 BYTE PAL/NTSC bits:
bit 0: if clear, this is an NTSC tune
bit 0: if set, this is a PAL tune
bit 1: if set, this is a dual PAL/NTSC tune
bits 2-7: not used. they *must* be 0
007b 1 BYTE Extra Sound Chip Support
bit 0: if set, this song uses VRCVI
bit 1: if set, this song uses VRCVII
bit 2: if set, this song uses FDS Sound
bit 3: if set, this song uses MMC5 audio
bit 4: if set, this song uses Namco 106
bit 5: if set, this song uses Sunsoft FME-07
bits 6,7: future expansion: they *must* be 0
007c 4 ---- 4 extra bytes for expansion (must be 00h)
0080 nnn ---- The music program/data follows
This may look somewhat familiar; if so that's because this is somewhat
sorta of based on the PSID file format for C64 music/sound.
Loading a tune into RAM
-----------------------
If offsets 0070h to 0077h have 00h in them, then bankswitching is *not*
used. If one or more bytes are something other than 00h then bankswitching
is used. If bankswitching is used then the load address is still used,
but you now use (ADDRESS AND 0FFFh) to determine where on the first bank
to load the data.
Each bank is 4K in size, and that means there are 8 of them for the
entire 08000h-0ffffh range in the 6502's address space. You determine where
in memory the data goes by setting bytes 070h thru 077h in the file.
These determine the inital bank values that will be used, and hence where
the data will be loaded into the address space.
Here's an example:
METROID.NSF will be used for the following explaination.
The file is set up like so: (starting at 070h in the file)
0070: 05 05 05 05 05 05 05 05 - 00 00 00 00 00 00 00 00
0080: ... music data goes here...
Since 0070h-0077h are something other than 00h, then we know that this
tune uses bankswitching. The load address for the data is specified as
08000h. We take this AND 0fffh and get 0000h, so we will load data in
at byte 0 of bank 0, since data is loaded into the banks sequentially
starting from bank 0 up until the music data is fully loaded.
Metroid has 6 4K banks in it, numbered 0 through 5. The 6502's address
space has 8 4K bankswitchable blocks on it, starting at 08000h-08fffh,
09000h-09fffh, 0a000h-0afffh ... 0f000h-0ffffh. Each one of these is 4K in
size, and the current bank is controlled by writes to 05ff8h thru 05fffh,
one byte per bank. So, 05ff8h controls the 08000h-08fffh range, 05ff9h
controls the 09000h-09fffh range, etc. up to 05fffh which controls the
0f000h-0ffffh range. When the song is loaded into RAM, it is loaded into
the banks and not the 6502's address space. Once this is done, then the
bank control registers are written to set up the inital bank values.
To do this, the value at 0070h in the file is written to 05ff8h, 0071h
is written to 05ff9h, etc. all the way to 0077h is written to 05fffh.
This is should be done before every call to the init routine.
If the tune was not bankswitched, then it is simply loaded in at the
specified load address, until EOF
Initalizing a tune
------------------
This is pretty simple. Load the desired song # into the accumulator,
minus 1 and set the X register to specify PAL (X=1) or NTSC (X=0).
If this is a single standard tune (i.e. PAL *or* NTSC but not both)
then the X register contents should not matter. Once the song # and
optional PAL/NTSC standard are loaded, simply call the INIT address.
Once init is done, it should perform an RTS.
Playing a tune
--------------
Once the tune has been initalized, it can now be played. To do this,
simply call the play address several times a second. How many times
per second is determined by offsets 006eh and 006fh in the file.
These bytes denote the speed of playback in 1/1000000ths of a second.
For the "usual" 60Hz playback rate, set this to 411ah.
To generate a differing playback rate, use this formula:
1000000
PBRATE= ---------
speed
Where PBRATE is the value you stick into 006e/006fh in the file, and
speed is the desired speed in hertz.
"Proper" way to load the tune
-----------------------------
1) If the tune is bankswitched, go to #3.
2) Load the data into the 6502's address space starting at the specified
load address. Go to #4.
3) Load the data into a RAM area, starting at (start_address AND 0fffh).
4) Tune load is done.
"Proper" way to init a tune
---------------------------
1) Clear all RAM at 0000h-07ffh.
2) Clear all RAM at 6000h-7fffh.
3) Init the sound registers by writing 00h to 04000-0400Fh, 10h to 4010h,
and 00h to 4011h-4013h.
4) Set volume register 04015h to 00fh.
5) If this is a banked tune, load the bank values from the header into
5ff8-5fffh.
6) Set the accumulator and X registers for the desired song.
7) Call the music init routine.
"Proper" way to play a tune
---------------------------
1) Call the play address of the music at periodic intervals determined
by the speed words. Which word to use is determined by which mode
you are in- PAL or NTSC.
Sound Chip Support
------------------
Byte 007bh of the file stores the sound chip flags. If a particular flag
is set, those sound registers should be enabled. If the flag is clear,
then those registers should be disabled.
* VRCVI Uses registers 9000-9002, A000-A002, and B000-B002, write only.
Caveats: 1) The above registers are *write only* and must not disrupt music
code that happens to be stored there.
2) Major caveat: The A0 and A1 lines are flipped on a few games!!
If you rip the music and it sounds all funny, flip around
the xxx1 and xxx2 register pairs. (i.e. 9001 and 9002) 9000
and 9003 can be left untouched. I decided to do this since it
would make things easier all around, and this means you only
will have to change the music code in a very few places (6).
Esper2 and Madara will need this change, while Castlevania 3j
will not for instance.
3) See my VRCVI.TXT doc for a complete register description.
* VRCVII Uses registers 9010 and 9030, write only.
Caveats: 1) Same caveat as #1, above.
2) See my VRCVII.TXT doc for a complete register description.
* FDS Sound uses registers from 4040 through 4092.
Caveats: 1) 6000-DFFF is assumed to be RAM, since 6000-DFFF is RAM on the
FDS. E000-FFFF is usually not included in FDS games because
it is the BIOS ROM. However, it can be used on FDS rips to help
the ripper (for modified play/init addresses).
2) Bankswitching operates slightly different on FDS tunes.
5FF6 and 5FF7 control the banks 6000-6FFF and 7000-7FFF
respectively. NSF header offsets 76h and 77h correspond to
*both* 6000-7FFF *AND* E000-FFFF. Keep this in mind!
* MMC5 Sound Uses registers 5000-5015, write only as well as 5205 and 5206,
and 5C00-5FF5
Caveats: 1) Generating a proper doc file. Be patient.
2) 5205 and 5206 are a hardware 8*8 multiplier. The idea being
you write your two bytes to be multiplied into 5205 and 5206
and after doing so, you read the result back out. Still working
on what exactly triggers it (I think a write to either 5205
or 5206 triggers the multiply).
3) 5C00-5FF5 should be RAM to emulate EXRAM while in MMC5 mode.
Note: Thanks to Mamiya for the EXRAM info.
* Namco 106 Sound Uses registers 4800 and F800.
This works similar to VRC7. 4800 is the "data" port which is
readable and writable, while F800 is the "address" port and is
writable only.
The address is 7 bits plus a "mode" bit. Bit 7 controls
address auto-incrementing. If bit 7 is set, the address will
auto-increment after a byte of data is read or written from/to
4800.
$40 ffffffff f:frequency L
$42 ffffffff f:frequency M
$44 ---sssff f:frequency H s:tone length (8-s)*4 in 4bit-samples
$46 tttttttt t:tone address(4bit-address,$41 means high-4bits of $20)
$47 -cccvvvv v:linear volume 1+c:number of channels in use($7F only)
$40-47:ch1 $48-4F:ch2 ... $78-7F:ch8
ch2-ch8 same to ch1
$00-3F(8ch)...77(1ch) hhhhllll tone data
h:odd address data(signed 4bit)
l:even address data(signed 4bit)
real frequency = (f * NES_BASECYCLES) / (40000h * (c+1) * (8-s)*4 * 45)
NES_BASECYCLES 21477270(Hz)
Note: Very Special thanks to Mamiya for this information!
* Sunsoft FME-07 Sound uses registers C000 and E000
This is similar to the common AY 3-8910 sound chip that is
used on tons of arcade machines, and in the Intellivision.
C000 is the address port
E000 is the data port
Both are write-only, and behave like the AY 3-8910.
Note: Special thanks to Mamiya for this information as well
Caveats
-------
1) The starting song number and maximum song numbers start counting at
1, while the init address of the tune starts counting at 0. To
"fix", simply pass the desired song number minus 1 to the init
routine.
2) The NTSC speed word is used *only* for NTSC tunes, or dual PAL/NTSC tunes.
The PAL speed word is used *only* for PAL tunes, or dual PAL/NTSC tunes.
3) The length of the text in the name, artist, and copyright fields must
be 31 characters or less! There has to be at least a single NULL byte
(00h) after the text, between fields.
4) If a field is not known (name, artist, copyright) then the field must
contain the string "<?>" (without quotes).
5) There should be 8K of RAM present at 6000-7FFFh. MMC5 tunes need RAM at
5C00-5FF7 to emulate its EXRAM. 8000-FFFF Should be read-only (not
writable) after a tune has loaded. The only time this area should be
writable is if an FDS tune is being played.
6) Do not assume the state of *anything* on entry to the init routine
except A and X. Y can be anything, as can the flags.
7) Do not assume the state of *anything* on entry to the play routine either.
Flags, X, A, and Y could be at any state. I've fixed about 10 tunes
because of this problem and the problem, above.
8) The stack sits at 1FFh and grows down. Make sure the tune does not
attempt to use 1F0h-1FFh for variables. (Armed Dragon Villigust did and
I had to relocate its RAM usage to 2xx)
9) Variables should sit in the 0000h-07FFh area *only*. If the tune writes
outside this range, say 1400h this is bad and should be relocated.
(Terminator 3 did this and I relocated it to 04xx).
That's it!

View File

@ -0,0 +1,296 @@
*******************************
*NTSC 2C02 technical operation*
*******************************
Brad Taylor (big_time_software@hotmail.com)
1st release: Sept 25th, Y2K
2nd release: Jan 27th, 2K3
3rd release: Feb 4th, 2K3
4th release: Feb 19th, 2K3
This document describes the low-level operation and technical details of the 2C02, the NES's PPU. In general, it contains important information in regards to PPU timing, which no NES coder/emulator author should be without. This document assumes that you already understand the basics of how the PPU works, like how the playfield/object images are generated, and the behaviour of scroll/address counters during playfield rendering.
Alot of the concepts behind how the PPU works described here have been extracted from Nintendo's patent documentation (U.S.#4,824,106). With block diagrams of the PPU's architecture (and even some schematics), these papers will definetely aid in the comprehension of this complex device.
Since the first release, this document has been given a major overhaul. Most sections of the document have been reworked, and new information has been added just about everywhere. If you've read the old version of this document before, I recommend that you read this new one in it's entirity; there's new information even in sections which may look like they haven't changed much.
Topics discussed hereon are as follows.
- Video signal generation
- PPU base timing
- Miscellanious PPU info
- PPU memory access cycles
- Frame rendering details
- Scanline rendering details
- In-range object evaluation
- Details of playfield render pipeline
- Details of object pattern fetch & render
- Extra cycle frames
- The MMC3's scanline counter
- PPU pixel priority quirk
- Graphical enhancements
+-------+
|History|
+-------+
On the weekend of Sept. 25th, Y2K, I setup an experiment with my NTSC NES MB & my PC so's I could RE the PPU's timing. What I did was (using a PC interface) analyse the changes that occur on the PPU's address and data pins on every rising & falling edge of the PPU's clock. I was not planning on removing the PPU from the motherboard (yet), so basically I just kept everything intact (minus the stuff I added onto the MB so I could monitor the PPU's signals), and popped in a game, so that it would initialize the PPU for me (I used DK classics, since it was only taking somthing like 4 frames before it was turning on the background/sprites).
The only change I made was taking out the 21 MHz clock generator circuitry. To replace the clock signal, I connected a port controlled latch to the NES's main clock line instead. Now, by writing a 0 or a 1 out to an PC ISA port of my choice (I was using $104), I was able to control the 21 MHz clockline of the NES. After I would create a rise or a fall on the NES's clock line, I would then read in the data that appeared on the PPU's address and data pins, which included monitoring what PPU registers the game read/wrote to (& the data that was read/written).
+-----------------------+
|Video signal generation|
+-----------------------+
A 21.48 MHz clock signal is fed into the PPU. This is the NES's main clock line, which is shared by the CPU.
Inside the PPU, the 21.48 MHz signal is used to clock a three-stage Johnson counter. The complimentery outputs of both master and slave portions of each stage are used to form 12 mutually exclusive output phases- all 3.58 MHz each (the NTSC colorburst). These 12 different phases form the basis of all color generation for the PPU's composite video output.
Naturally, when the user programs the lower 4-bits of a palette register, they are essentially selecting any 1 of 12 phases to be routed to the PPU's video out pin (this corresponds to chrominance (tint/hue) video information) when the appropriate pixel indexes it. Other chrominance combinations (0 & 13) are simply hardwired to a 1 or 0 to generate grayscale pixels.
Bits 4 & 5 of a palette entry selects 1 of 4 linear DC voltage offsets to apply to the selected chrominance signal (this corresponds to luminance (brightness) video information) for a pixel.
Chrominance values 14 & 15 yield a black pixel color, regardless of any luminance value setting.
Luminance value 0, mixed with chrominance value 13 yield a "blacker than black" pixel color. This super black pixel has an output voltage level close to the vertical/horizontal syncronization pulses. Because of this, some video monitors will display warped/distorted screens for games which use this color for black (Game Genie is the best example of this). Essentially what is happening is the video monitor's horizontal timing is compromised by what it thinks are extra syncronization pulses in the scanline. This is not damaging to the monitors which are effected by it, but use of the super black color should be avoided, due to the graphical distortion it causes.
The amplitude of the selected chrominance signal (via the 4 lower bits of a palette register) remain constant regardless of bits 4 or 5. Thus it is not possible to adjust the saturation level of a particular color.
+---------------+
|PPU base timing|
+---------------+
Other than the 3-stage Johnson counter, the 21.48 MHz signal is not used directly by any other PPU hardware. Instead, the signal is divided by 4 to get 5.37 MHz, and is used as the smallest unit of timing in the PPU. All following references to PPU clock cycle (abbr. "cc") timing in this document will be in respect to this timing base, unless otherwise indicated.
- Pixels are rendered at the same rate as the base PPU clock. In other words, 1 clock cycle= 1 pixel.
- 341 PPU cc's make up the time of a typical scanline (or 341/3 CPU cc's).
- One frame consists of 262 scanlines. This equals 341*262 PPU cc's per frame (divide by 3 for # of CPU cc's).
+------------------------+
|PPU memory access cycles|
+------------------------+
All PPU memory access cycles are 2 clocks long, and can be made back-to-back (typically done during rendering). Here's how the access breaks down:
At the beginning of the access cycle, PPU address lines 8..13 are updated with the target address. This data remains here until the next time an access cycle occurs.
The lower 8-bits of the PPU address lines are multiplexed with the data bus, to reduce the PPU's pin count. On the first clock cycle of the access, A0..A7 are put on the PPU's data bus, and the ALE (address latch enable) line is activated for the first half of the cycle. This loads the lower 8-bit address into an external 8-bit transparent latch strobed by ALE (74LS373 is used).
On the second clock cycle, the /RD (or /WR) line is activated, and stays active for the entire cycle. Appropriate data is driven onto the bus during this time.
+----------------------+
|Miscellanious PPU info|
+----------------------+
- Sprite DMA is 1536 clock cycles long (512 CPU cc's). 256 individual transfers are made from CPU memory to a temp register inside the CPU, then from the CPU's temp reg, to $2004.
- The PPU makes NO external access to the PPU bus, unless the playfield or objects are enabled during a scanline outside vblank. This means that the PPU's address and data busses are dead while in this state.
- palette RAM is accessed internally during playfield rendering (i.e., the palette address/data is never put on the PPU bus during this time). Additionally, when the programmer accesses palette RAM via $2006/7, the palette address accessed actually does show up on the PPU address bus, but the PPU's /RD & /WR flags are not activated. This is required; to prevent writing over name table data falling under the approprite mirrored area (since the name table RAM's address decoder simply consists of an inverter connected to the A13 line- effectively decoding all addresses in $2000-$3FFF).
- the VINT impulse (NMI) and bit $2002.7 are set simultaniously. Reading $2002 will reset bit 7, but it seems that the VINT flag goes down on it's own. Because of this, when the PPU generates a VINT, it doesn't require any acknowledgement whatsoever; it will continue firing off VINTs, regardless of inservice to $2002. The only way to stop VINTs is to clear $2000.7.
- Because the PPU cannot make a read from PPU memory immediately upon request (via $2007), there is an internal buffer, which acts as a 1-stage data pipeline. As a read is requested, the contents of the read buffer are returned to the NES's CPU. After this, at the PPU's earliest convience (according to PPU read cycle timings), the PPU will fetch the requested data from the PPU memory, and throw it in the read buffer. Writes to PPU mem via $2007 are pipelined as well, but it is unknown to me if the PPU uses this same buffer (this could be easily tested by writing somthing to $2007, and seeing if the same value is returned immediately after reading).
+-----------------------+
|Frame rendering details|
+-----------------------+
The following describes the PPU's status during all 262 scanlines of a frame. Any scanlines where work is done (like image rendering), consists of the steps which will be described in the next section.
0..19: Starting at the instant the VINT flag is pulled down (when a NMI is generated), 20 scanlines make up the period of time on the PPU which I like to call the VINT period. During this time, the PPU makes no access to it's external memory (i.e. name / pattern tables, etc.).
20: After 20 scanlines worth of time go by (since the VINT flag was set), the PPU starts to render scanlines. This first scanline is a dummy one; although it will access it's external memory in the same sequence it would for drawing a valid scanline, no on-screen pixels are rendered during this time, making the fetched background data immaterial. Both horizontal *and* vertical scroll counters are updated (presumably) at cc offset 256 in this scanline. Other than that, the operation of this scanline is identical to any other. The primary reason this scanline exists is to start the object render pipeline, since it takes 256 cc's worth of time to determine which objects are in range or not for any particular scanline.
21..260: after rendering 1 dummy scanline, the PPU starts to render the actual data to be displayed on the screen. This is done for 240 scanlines, of course.
261: after the very last rendered scanline finishes, the PPU does nothing for 1 scanline (i.e. the programmer gets screwed out of perfectly good VINT time). When this scanline finishes, the VINT flag is set, and the process of drawing lines starts all over again.
+--------------------------+
|Scanline rendering details|
+--------------------------+
Naturally, the PPU will fetch data from name, attribute, and pattern tables during a scanline to produce an image on the screen. This section details the PPU's doings during this time.
As explained before, external PPU memory can be accessed every 2 cc's. With 341 cc's per scanline, this gives the PPU enough time to make 170 memory accesses per scanline (and it uses all of them!). After the 170th fetch, the PPU does nothing for 1 clock cycle. Remember that a single pixel is rendered every clock cycle.
Memory fetch phase 1 thru 128
-----------------------------
1. Name table byte
2. Attribute table byte
3. Pattern table bitmap #0
4. Pattern table bitmap #1
This process is repeated 32 times (32 tiles in a scanline).
This is when the PPU retrieves the appropriate data from PPU memory for rendering the playfield. The first playfield tile fetched here is actually the 3rd to be drawn on the screen (the playfield data for the first 2 tiles to be rendered on this scanline are fetched at the end of the scanline prior to this one).
All valid on-screen pixel data arrives at the PPU's video out pin during this time (256 clocks). For determining the precise delay between when a tile's bitmap fetch phase starts (the whole 4 memory fetches), and when the first pixel of that tile's bitmap data hits the video out pin, the formula is (16-n) clock cycles, where n is the fine horizontal scroll offset (0..7 pixels). This information is relivant for understanding the exact timing operation of the "object 0 collision" flag.
Note that the PPU fetches an attribute table byte for every 8 sequential horizontal pixels it draws. This essentially limits the PPU's color area (the area of pixels which are forced to use the same 3-color palette) to only 8 horizontally sequential pixels.
It is also during this time that the PPU evaluates the "Y coordinate" entries of all 64 objects in object attribute RAM (OAM), to see if the objects are within range (to be drawn on the screen) for the *next* scanline (this is why Y-coordinate entries in the OAM must be programmed to a value 1 less than the scanline the object is to appear on). Each evaluation (presumably) takes 4 clock cycles, for a total of 256 (which is why it's done during on-screen pixel rendering).
In-range object evaluation
--------------------------
An 8-bit comparator is used to calculate the 9-bit difference between the current scanline (minus 21), and each Y-coordinate (plus 1) of every object entry in the OAM. Objects are considered in range if the comparator produces a difference in the range of 0..7 (if $2000.5 currently = 0), or 0..15 (if $2000.5 currently = 1).
(Note that a 9-bit comparison result is generated. This means that setting object scanline coordinates for ranges -1..-15 are actually interpreted as ranges 241..255. For this reason, objects with these ranges will never be considered to be part of any on-screen scanline range, and will not allow smooth object scrolling off the top of the screen.)
Tile index (8 bits), X-coordinate (8 bits), & attribute information (4 bits; vertical inversion is excluded) from the in-range OAM element, plus the associated 4-bit result of the range comparison accumulate in a part of the PPU called the "sprite temporary memory". Logical inversion is applied to the loaded 4-bit range comparison result, if the object's vertical inversion attribute bit is set.
Since object range evaluations occur sequentially through the OAM (starting from entry 0 to 63), the sprite temporary memory always fills in order from the highest priority in-range object, to lower ones. A 4-bit "in-range" counter is used to determine the number of found objects on the scanline (from 0 up to 8), and serves as an index pointer for placement of found object data into the 8-element sprite temporary memory. The counter is reset at the beginning of the object evaluation phase, and is post-incremented everytime an object is found in-range. This occurs until the counter equals 8, when found object data after this is discarded, and a flag (bit 5 of $2002) is raised, indicating that it is going to be dropping objects for the next scanline.
An additional memory bit associated with the sprite temporary memory is used to indicate that the primary object (#0) was found to be in range. This will be used later on to detect primary object-to-playfield pixel collisions.
Playfield render pipeline details
---------------------------------
As pattern table & palette select data is fetched, it is loaded into internal latches (the palette select data is selected from the fetched byte via a 2-bit 1-of-4 selector).
At the start of a new tile fetch phase (every 8 cc's), both latched pattern table bitmaps are loaded into the upper 8-bits of 2- 16-bit shift registers (which both shift right every clock cycle). The palette select data is also transfered into another latch during this time (which feeds the serial inputs of 2 8-bit right shift registers shifted every clock). The pixel data is fed into these extra shift registers in order to implement fine horizontal scrolling, since the periods when the PPU fetch tile data is fixed.
A single bit from each shift register is selected, to form the valid 4-bit playfield pixel for the current clock cycle. The bit selection offset is based on the fine horizontal scroll value (this selects bit positions 0..7 for all 4 shift registers). The selected 4-bit pixel data will then be fed into the multiplexer (described later) to be mixed with object data.
Memory fetch phase 129 thru 160
-------------------------------
1. Garbage name table byte
2. Garbage name table byte
3. Pattern table bitmap #0 for applicable object (for next scanline)
4. Pattern table bitmap #1 for applicable object (for next scanline)
This process is repeated 8 times.
This is the period of time when the PPU retrieves the appropriate pattern table data for the objects to be drawn on the *next* scanline. When less than 8 objects exist on the next scanline (as the in-range object evaluation counter indicates), dummy pattern table fetches take place for the remaining fetches. Internally, the fetched dummy-data is discarded, and replaced with completely transparent bitmap patterns).
Although the fetched name table data is thrown away, and the name table address is somewhat unpredictable, the address does seem to relate to the first name table tile to be fetched for the next scanline. This would seem to imply that PPU cc #256 is when the PPU's scroll/address counters have their horizontal scroll values automatically updated.
It should also be noted that because this fetch is required for objects on the next scanline, it is neccessary for a garbage scanline to exist prior to the very first scanline to be actually rendered, so that object attribute RAM entries can be evaluated, and the appropriate bitmap data retrieved.
As far as the wasted fetch phases here, well, what can I say. Either Nintendo's engineers were VERY lazy, and didn't want to add the small amount of extra circuitry to the PPU so that 16 object fetches could take place per scanline, or Nintendo couldn't spot the extra memory required to implement 16 object scanlines. Thing is though- between the object attribute mem, sprite temporary & buffer mem, and palette mem, that's already 2406 bits of RAM; I don't think it would've killed them to just add the 408 bits it would've took for an extra 8 objects, which would've made games with horrible OAM cycling (Double Dragon 2 w/ 2 players) look half-decent (hell, with 16 object scanlines, games would hardly even need OAM cycling).
Details of object pattern fetch & render
----------------------------------------
Where the PPU fetches pattern table data for an individual object is conditioned on the contents of the sprite temporary memory element, and $2000.5. If $2000.5 = 0, the tile index data is used as usual, and $2000.3 selects the pattern table to use. If $2000.5 = 1, the MSB of the range result value become the LSB of the indexed tile, and the LSB of the tile index value determines pattern table selection. The lower 3 bits of the range result value are always used as the fine vertical offset into the selected pattern.
Horizontal inversion (bit order reversing) is applied to fetched bitmaps, if indicated in the sprite temporary memory element.
The fetched pattern table data (which is 2 bytes), plus the associated 3 attribute bits (palette select & priority), and the x coordinate byte in sprite temporary memory are then loaded into a part of the PPU called the "sprite buffer memory" (the primary object present bit is also copied). This memory area again, is large enough to hold the contents for 8 sprites.
The composition of one sprite buffer element here is: 2 8-bit shift registers (the fetched pattern table data is loaded in here, where it will be serialized at the appropriate time), a 3-bit latch (which holds the color & priority data for an object), and an 8-bit down counter (this is where the x coordinate is loaded).
The counter is decremented every time the PPU renders a pixel (the first 256 cc's of a scanline; see "Memory fetch phase 1 thru 128" above). When the counter equals 0, the pattern table data in the shift registers will start to serialize (1 shift per clock). Before this time, or 8 clocks after, consider the outputs of the serializers for each stage to be 0 (transparency).
The streams of all 8 object serializers are prioritized, and ultimately only one stream (with palette select & priority information) is selected for output to the multiplexer (where object & playfield pixels are prioritized).
The data for the first sprite buffer entry (including the primary object present flag) has the first chance to enter the multiplexer, if it's output pixel is non-transparent (non-zero). Otherwise, priority is passed to the next serializer in the sprite buffer memory, and the test for non-transparency is made again (the primary object present status will always be passed to the multiplexer as false in this case). This is done until the last (8th) stage is reached, when the object data is passed through unconditionally. Keep in mind that this whole process occurs every clock cycle (hardware is used to determine priority instantly).
The multiplexer does 2 things: determines primary object collisions, and decides which pixel data to pass through to index the palette RAM- either the playfield's or the object's.
Primary object collisions occur when a non-transparent playfield pixel coincides with a non-transparent object pixel, while the primary object present status entering the multiplexer for the current clock cycle is true. This causes a flip-flop ($2002.6) to be set, and remains set (presumably) some time after the VINT occurence (prehaps up until scanline 20?).
The decision for selecting the data to pass through to the palette index is made rather easilly. The condition to use object (opposed to playfield) data is:
(OBJpri=foreground OR PFpixel=xparent) AND OBJpixel<>xparent
Since the PPU has 2 palettes; one for objects, and one for playfield, the appropriate palette will be selected depending on which pixel data is passed through.
After the palette look-up, the operation of events follows the aforementioned steps in the "video signal generation" section.
Memory fetch phase 161 thru 168
-------------------------------
1. Name table byte
2. Attribute table byte
3. Pattern table bitmap #0 (for next scanline)
4. Pattern table bitmap #1 (for next scanline)
This process is repeated 2 times.
It is during this time that the PPU fetches the appliciable playfield data for the first and second tiles to be rendered on the screen for the *next* scanline. These fetches initialize the internal playfield pixel pipelines (2- 16-bit shift registers) with valid bitmap data. The rest of tiles (3..32) are fetched at the beginning of the following scanline.
Memory fetch phase 169 thru 170
-------------------------------
1. Name table byte
2. Name table byte
I'm unclear of the reason why this particular access to memory is made. The name table address that is accessed 2 times in a row here, is also the same nametable address that points to the 3rd tile to be rendered on the screen (or basically, the first name table address that will be accessed when the PPU is fetching playfield data on the next scanline).
After memory access 170
-----------------------
The PPU simply rests for 1 cycle here (or the equivelant of half a memory access cycle) before repeating the whole pixel/scanline rendering process.
+------------------+
|Extra cycle frames|
+------------------+
Scanline 20 is the only scanline that has variable length. On every odd frame, this scanline is only 340 cycles (the dead cycle at the end is removed). This is done to cause a shift in the NTSC colorburst phase.
You see, a 3.58 MHz signal, the NTSC colorburst, is required to be modulated into a luminance carrying signal in order for color to be generated on an NTSC monitor. Since the PPU's video out consists of basically square waves (as opposed to sine waves, which would be preferred), it takes an entire colorburst cycle (1/3.58 MHz) for an NTSC monitor to identify the color of a PPU pixel accurately.
But now you remember that the PPU renders pixels at 5.37 MHz- 1.5x the rate of the colorburst. This means that if a single pixel resides on a scanline with a color different to those surrounding it, the pixel will probably be misrepresented on the screen, sometimes appearing faintly.
Well, to somewhat fix this problem, they added this extra pixel into every odd frame (shifting the colorburst phase over a bit), and changing the way the monitor interprets isolated colored pixels each frame. This is why when you play games with detailed background graphics, the background seems to flicker a bit. Once you start scrolling the screen however, it seems as if some pixels become invisible; this is how stationary PPU images would look without this cycle removed from odd frames.
Certain scroll rates expose this NTSC PPU color caveat regardless of the toggling phase shift. Some of Zelda 2's dungeon backgrounds are a good place to see this effect.
+---------------------------+
|The MMC3's scanline counter|
+---------------------------+
As most people know, the MMC3 bases it's scanline counter on PPU address line A13 (which is why IRQ's can be fired off manually by toggling A13 a bunch of times via $2006). What's not common knowledge is the number of times A13 is expected to toggle in a scanline (although if you've been paying close attention to the doc here, you should already know ;)
A13 was probably used for the IRQ counter (as opposed to using the PPU's /READ line) because this address line already needed to be connected to the MMC for bankswitching purposes (so in other words, to reduce the MMC3's pin count by 1). They also probably used this method of counting (as opposed to a CPU cycle counter) since A13 cycles (0 -> 1) exactly 42 times per scanline, whereas the CPU count of cycles per scanline is not an exact integer (113.67). Having said that, I guess Nintendo wanted to provide an "easy-to-use" method of generating special image effects, without making programmers have to figure out how many clock cycles to program an IRQ counter with (a pretty lame excuse for not providing an IRQ counter with CPU clock cycle precision (which would have been more useful and versatile)).
Regardless of any values PPU registers are programmed with, A13 will operate in a predictable fashion during image rendering (and if you understand how PPU addressing works, you should understand that A13 is the *only* address line with fixed behaviour during image rendering).
+------------------------+
|PPU pixel priority quirk|
+------------------------+
Object data is prioritized between itself, then prioritized between the playfield. There are some odd side effects to this scheme of rendering, however. For instance, imagine a low priority object pixel with foreground priority, a high priority object pixel with background priority, and a playfield pixel all coinciding (all non-transparent).
Ideally, the playfield is considered to be the middle layer between background and foreground priority objects. This means that the playfield pixel should hide the background priority object pixel (regardless of object priority), and the foreground priority object should appear atop the PF pixel.
However, because of the way the PPU renders (as just described), OBJ priority is evaluated first, and therefore the background object pixel wins, which means that you'll only be seeing the PF pixel after this mess.
A good game to demonstrate this behaviour is Megaman 2. Go into airman's stage. First, jump into the energy bar, just to confirm that megaman's sprite is of a higher priority than the energy bar's. Now, get to the second half of the stage, where the clouds cover the energy bar. The energy bar will be ontop of the clouds, but megaman will be behind them. Now, look what happens when you jump into the energy bar here... you see the clouds where megaman underlaps the energy bar.
+----------------------+
|Graphical enhancements|
+----------------------+
Since an NES cartridge has access to the PPU bus, any number of on-cart hardware schemes can be used to enhance the graphic capabilities of the NES. After all, the PPU's playfield pipeline is very simple: it fetches 272 playfield pixels per scanline (as 34*2 byte fetches, in real-time), and outputs 256 of them to the screen (with the 0..7 pixel offset determined by the fine X scroll register), along with object data combined with it.
Essentially, you can bypass the PPU's simple scrolling system, implement a custom one on your cart (fetching bitmap data in your own fashion), and feed the PPU bitmap data in your own order.
The possibilities of this are endless (like sporting multiple playfields, or even playfield rotation/scaling), but of course what it comes down to is the amount of cartridge hardware required.
Generally, playfield rotation/scaling can be done quite easily- it only requires a few sets of 16-bit registers and adders (the 16 bits are broken up into 8.8 fixed point values). But this kind of implementation is more suited for an integrated circuit, since this would require dozens of discrete logic chips.
Multiple playfields are another thing which could be easily done. The caveat here is that pixel pipelines (i.e., shift registers) and a multiplexer would have to be implemented on the cart (not to mention exclusive name table RAM) in order to process the playfield bitmaps from multiple sources. The access to the CHR-ROM/RAM would also have to increased- but as it stands, the CHR-ROM/RAM bandwidth is 1.34 MHz, a rather low frequency. With a memory device capable of a 10.74 MHz bandwith, you could have 8 playfields to work with. Generally, this would be very useful for displaying multiple huge objects on the screen- without ever having to worry about annoying flicker.
The only restriction to doing any of this is that:
- every 8 sequential horizontal pixels sent to the PPU must share the same palette select value. Because of this, hardware would have to be implemented to decide which palette select value to feed the PPU between 8 horizontally sequential pixels, if they do not all share the same palette select value. The on-screen results of this may not be too flattering sometimes, but this is a small price to pay to do some neat graphical tricks on the NES.
-only the playfield palette can be used. As usual, this pretty much limits your randomly accessable colors to about 12+1.
It's a damn shame that Nintendo never created a MMC which would enhance graphics on the NES in useful ways as mentioned above. The MMC5 was the only device that came close, and it's only selling features were the single-tile color area, and the vertical split screen mode (which I don't think any game ever used). Considering the amount of pins (100) the MMC5 had, and number of gates they put in it just for the EXRAM (which was 1K bytes), they could've put some really useful graphics hardware inside there instead.
Prehaps the infamous Color Dreams "Hellraiser" cart was the closest the NES ever came to seeing such sophisticated graphics. The cart was never released, but from what I've read, it was going to use some sort of frame buffer, and a Z80 CPU to do the graphical rendering. It had been rumored that the game had 3D graphics (or at least 2.5D) in it. If so (and the game was actually good), prehaps it would have raised a few eyebrows in the industry, and inspired Nintendo to develop a new MMC chip with similar capabilities, in order to keep the NES in it's profit margin for another few years (and allow it to compete somewhat with the more advanced systems of the time).
EOF

View File

@ -0,0 +1,63 @@
Subject: [nesdev] the skinny on nes scrolling
Date: Tue, 13 Apr 1999 16:42:00 -0600
From: loopy <zxcvzxcv@netzero.net>
Reply-To: nesdev@onelist.com
To: nesdev@onelist.com
From: loopy <zxcvzxcv@netzero.net>
---------
the current information on background scrolling is sufficient for most games;
however, there are a few that require a more complete understanding.
here are the related registers:
(v) vram address, a.k.a. 2006 which we all know and love. (16 bits)
(t) another temp vram address (16 bits)
(you can really call them 15 bits, the last isn't used)
(x) tile X offset (3 bits)
the ppu uses the vram address for both reading/writing to vram thru 2007,
and for fetching nametable data to draw the background. as it's drawing the
background, it updates the address to point to the nametable data currently
being drawn. bits 0-11 hold the nametable address (-$2000). bits 12-14 are
the tile Y offset.
---------
stuff that affects register contents:
(sorry for the shorthand logic but i think it's easier to see this way)
2000 write:
t:0000110000000000=d:00000011
2005 first write:
t:0000000000011111=d:11111000
x=d:00000111
2005 second write:
t:0000001111100000=d:11111000
t:0111000000000000=d:00000111
2006 first write:
t:0011111100000000=d:00111111
t:1100000000000000=0
2006 second write:
t:0000000011111111=d:11111111
v=t
scanline start (if background and sprites are enabled):
v:0000010000011111=t:0000010000011111
frame start (line 0) (if background and sprites are enabled):
v=t
note! 2005 and 2006 share the toggle that selects between first/second
writes. reading 2002 will clear it.
note! all of this info agrees with the tests i've run on a real nes. BUT
if there's something you don't agree with, please let me know so i can verify
it.
________________________________________________________
NetZero - We believe in a FREE Internet. Shouldn't you?
Get your FREE Internet Access and Email at
http://www.netzero.net/download.html
------------------------------------------------------------------------
New hobbies? New curiosities? New enthusiasms?
http://www.ONElist.com
Sign up for a new e-mail list today!

View File

@ -0,0 +1,33 @@
Subject: [nesdev] Re: the skinny on nes scrolling
Date: Tue, 13 Apr 1999 17:48:54 -0600
From: loopy <zxcvzxcv@netzero.net>
Reply-To: nesdev@onelist.com
To: nesdev@onelist.com
From: loopy <zxcvzxcv@netzero.net>
(more notes on ppu logic)
you can think of bits 0,1,2,3,4 of the vram address as the "x scroll"(*8)
that the ppu increments as it draws. as it wraps from 31 to 0, bit 10 is
switched. you should see how this causes horizontal wrapping between name
tables (0,1) and (2,3).
you can think of bits 5,6,7,8,9 as the "y scroll"(*8). this functions
slightly different from the X. it wraps to 0 and bit 11 is switched when
it's incremented from _29_ instead of 31. there are some odd side effects
from this.. if you manually set the value above 29 (from either 2005 or
2006), the wrapping from 29 obviously won't happen, and attrib data will be
used as name table data. the "y scroll" still wraps to 0 from 31, but
without switching bit 11. this explains why writing 240+ to 'Y' in 2005
appeared as a negative scroll value.
________________________________________________________
NetZero - We believe in a FREE Internet. Shouldn't you?
Get your FREE Internet Access and Email at
http://www.netzero.net/download.html
------------------------------------------------------------------------
Looking for a new hobby? Want to make a new friend?
http://www.ONElist.com
Come join one of the 115,000 e-mail communities at ONElist!

View File

@ -0,0 +1,6 @@
Many(possibly all) of these documents contain flaws or are incomplete, so
don't pull out your hair if there are inconsistencies between the documents,
what's in FCE Ultra, and what you observe. That's not to say that FCE Ultra
doesn't have its share of (emulation) flaws, though...
For many more NES-related documents, try http://nesdev.parodius.com

View File

@ -0,0 +1,2 @@
Sound information is in the "cpu" subdirectory, due to the intimate
relationship between the sound circuitry and the cpu.

View File

@ -0,0 +1,70 @@
The following games are broken to some extent:
Crystalis: Mostly working, but the screen jumps around during
dialogue. It apparently resets the MMC3 IRQ counter
mid-scanline. It'll require low-level PPU and MMC3
IRQ counter emulation to function properly.
Kyoro Chan Land: Expects a sprite hit to happen, but it has sprite 0 over
transparent background.
*** First, things that are not on the TODO list(Don't bug me about these
things if you're an idiot. I don't like listening to idiots.
If you are not an idiot, and you can make decent arguments for why
these should be on the TODO list, then you can bug me.).
*** General Features:
Remappable command keys(to multiple keys on the keyboard and a joystick).
Fix possible UNIF crashes(if no PRGx or CHRx chunks exist, it may crash,
due to changes made in 0.92).
Windows Port:
Support for command-line options(so that one crazy guy will quit bugging
me).
SDL Port:
Hotkey remap GUI
Figure out a good way to add "turbo" button support and then do it.
Make default svgalib video mode a non-tweaked VGA mode.
Finish the software video blitting "library", add support for 2xsai, eagle,
interpolation, etc. effects.
*** Emulation:
***IMPORTANT***
If anyone ever cares to implement movie recording/playback, we must figure
out what to do with some unsaved variables, like timestamp and timestampbase.
These variables are abused in the sound emulation code, and modifying them
in certain ways elsewhere can cause crashes.
***IMPORTANT***
Implement cart-based expansion devices, and interfaces for them(dip switches
and that Datach barcode reader, and maybe others).
Fix DPCM playback and IRQ at end of playback.
Fix some 6502 emulation bugs(undocumented opcodes might not be implemented
correctly and I'm not sure if the IRQ flag latency is implemented correctly).
Implement more dummy CPU reads when in debug mode.
Fix MMC3 IRQ emulation.
Figure out correct timing for when the PPU refresh address register is
updated by the PPU(for the next scanline).
Sound frame count stuff on PAL games(is it correct?).
Fix FDS sound emulation.
Fix NMI timing and D7 of 2002 setting timing. Fixing this might require
a small hack. Also be aware that this might break Battletoads, particularly
during the second level.
Fix Zapper emulation(Chiller still doesn't always work correctly).

1237
branches/sdl2/doxygen Normal file

File diff suppressed because it is too large Load Diff

17
branches/sdl2/fceux-server/.gitignore vendored Normal file
View File

@ -0,0 +1,17 @@
# A simulation of Subversion default ignores, generated by reposurgeon.
*.o
*.lo
*.la
*.al
*.libs
*.so
*.so.[0-9]*
*.a
*.pyc
*.pyo
*.rej
*~
*.#*
.*.swp
.DS_store
# Simulated Subversion default ignores end here

View File

@ -0,0 +1,2 @@
Major developer: Xodnizel
Interface changes and all releases past 0.0.3: Lukas Sabota <punkrockguy318 _at_ comcast _dot_ net>

View File

@ -0,0 +1,339 @@
GNU GENERAL PUBLIC LICENSE
Version 2, June 1991
Copyright (C) 1989, 1991 Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
Preamble
The licenses for most software are designed to take away your
freedom to share and change it. By contrast, the GNU General Public
License is intended to guarantee your freedom to share and change free
software--to make sure the software is free for all its users. This
General Public License applies to most of the Free Software
Foundation's software and to any other program whose authors commit to
using it. (Some other Free Software Foundation software is covered by
the GNU Lesser General Public License instead.) You can apply it to
your programs, too.
When we speak of free software, we are referring to freedom, not
price. Our General Public Licenses are designed to make sure that you
have the freedom to distribute copies of free software (and charge for
this service if you wish), that you receive source code or can get it
if you want it, that you can change the software or use pieces of it
in new free programs; and that you know you can do these things.
To protect your rights, we need to make restrictions that forbid
anyone to deny you these rights or to ask you to surrender the rights.
These restrictions translate to certain responsibilities for you if you
distribute copies of the software, or if you modify it.
For example, if you distribute copies of such a program, whether
gratis or for a fee, you must give the recipients all the rights that
you have. You must make sure that they, too, receive or can get the
source code. And you must show them these terms so they know their
rights.
We protect your rights with two steps: (1) copyright the software, and
(2) offer you this license which gives you legal permission to copy,
distribute and/or modify the software.
Also, for each author's protection and ours, we want to make certain
that everyone understands that there is no warranty for this free
software. If the software is modified by someone else and passed on, we
want its recipients to know that what they have is not the original, so
that any problems introduced by others will not reflect on the original
authors' reputations.
Finally, any free program is threatened constantly by software
patents. We wish to avoid the danger that redistributors of a free
program will individually obtain patent licenses, in effect making the
program proprietary. To prevent this, we have made it clear that any
patent must be licensed for everyone's free use or not licensed at all.
The precise terms and conditions for copying, distribution and
modification follow.
GNU GENERAL PUBLIC LICENSE
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
0. This License applies to any program or other work which contains
a notice placed by the copyright holder saying it may be distributed
under the terms of this General Public License. The "Program", below,
refers to any such program or work, and a "work based on the Program"
means either the Program or any derivative work under copyright law:
that is to say, a work containing the Program or a portion of it,
either verbatim or with modifications and/or translated into another
language. (Hereinafter, translation is included without limitation in
the term "modification".) Each licensee is addressed as "you".
Activities other than copying, distribution and modification are not
covered by this License; they are outside its scope. The act of
running the Program is not restricted, and the output from the Program
is covered only if its contents constitute a work based on the
Program (independent of having been made by running the Program).
Whether that is true depends on what the Program does.
1. You may copy and distribute verbatim copies of the Program's
source code as you receive it, in any medium, provided that you
conspicuously and appropriately publish on each copy an appropriate
copyright notice and disclaimer of warranty; keep intact all the
notices that refer to this License and to the absence of any warranty;
and give any other recipients of the Program a copy of this License
along with the Program.
You may charge a fee for the physical act of transferring a copy, and
you may at your option offer warranty protection in exchange for a fee.
2. You may modify your copy or copies of the Program or any portion
of it, thus forming a work based on the Program, and copy and
distribute such modifications or work under the terms of Section 1
above, provided that you also meet all of these conditions:
a) You must cause the modified files to carry prominent notices
stating that you changed the files and the date of any change.
b) You must cause any work that you distribute or publish, that in
whole or in part contains or is derived from the Program or any
part thereof, to be licensed as a whole at no charge to all third
parties under the terms of this License.
c) If the modified program normally reads commands interactively
when run, you must cause it, when started running for such
interactive use in the most ordinary way, to print or display an
announcement including an appropriate copyright notice and a
notice that there is no warranty (or else, saying that you provide
a warranty) and that users may redistribute the program under
these conditions, and telling the user how to view a copy of this
License. (Exception: if the Program itself is interactive but
does not normally print such an announcement, your work based on
the Program is not required to print an announcement.)
These requirements apply to the modified work as a whole. If
identifiable sections of that work are not derived from the Program,
and can be reasonably considered independent and separate works in
themselves, then this License, and its terms, do not apply to those
sections when you distribute them as separate works. But when you
distribute the same sections as part of a whole which is a work based
on the Program, the distribution of the whole must be on the terms of
this License, whose permissions for other licensees extend to the
entire whole, and thus to each and every part regardless of who wrote it.
Thus, it is not the intent of this section to claim rights or contest
your rights to work written entirely by you; rather, the intent is to
exercise the right to control the distribution of derivative or
collective works based on the Program.
In addition, mere aggregation of another work not based on the Program
with the Program (or with a work based on the Program) on a volume of
a storage or distribution medium does not bring the other work under
the scope of this License.
3. You may copy and distribute the Program (or a work based on it,
under Section 2) in object code or executable form under the terms of
Sections 1 and 2 above provided that you also do one of the following:
a) Accompany it with the complete corresponding machine-readable
source code, which must be distributed under the terms of Sections
1 and 2 above on a medium customarily used for software interchange; or,
b) Accompany it with a written offer, valid for at least three
years, to give any third party, for a charge no more than your
cost of physically performing source distribution, a complete
machine-readable copy of the corresponding source code, to be
distributed under the terms of Sections 1 and 2 above on a medium
customarily used for software interchange; or,
c) Accompany it with the information you received as to the offer
to distribute corresponding source code. (This alternative is
allowed only for noncommercial distribution and only if you
received the program in object code or executable form with such
an offer, in accord with Subsection b above.)
The source code for a work means the preferred form of the work for
making modifications to it. For an executable work, complete source
code means all the source code for all modules it contains, plus any
associated interface definition files, plus the scripts used to
control compilation and installation of the executable. However, as a
special exception, the source code distributed need not include
anything that is normally distributed (in either source or binary
form) with the major components (compiler, kernel, and so on) of the
operating system on which the executable runs, unless that component
itself accompanies the executable.
If distribution of executable or object code is made by offering
access to copy from a designated place, then offering equivalent
access to copy the source code from the same place counts as
distribution of the source code, even though third parties are not
compelled to copy the source along with the object code.
4. You may not copy, modify, sublicense, or distribute the Program
except as expressly provided under this License. Any attempt
otherwise to copy, modify, sublicense or distribute the Program is
void, and will automatically terminate your rights under this License.
However, parties who have received copies, or rights, from you under
this License will not have their licenses terminated so long as such
parties remain in full compliance.
5. You are not required to accept this License, since you have not
signed it. However, nothing else grants you permission to modify or
distribute the Program or its derivative works. These actions are
prohibited by law if you do not accept this License. Therefore, by
modifying or distributing the Program (or any work based on the
Program), you indicate your acceptance of this License to do so, and
all its terms and conditions for copying, distributing or modifying
the Program or works based on it.
6. Each time you redistribute the Program (or any work based on the
Program), the recipient automatically receives a license from the
original licensor to copy, distribute or modify the Program subject to
these terms and conditions. You may not impose any further
restrictions on the recipients' exercise of the rights granted herein.
You are not responsible for enforcing compliance by third parties to
this License.
7. If, as a consequence of a court judgment or allegation of patent
infringement or for any other reason (not limited to patent issues),
conditions are imposed on you (whether by court order, agreement or
otherwise) that contradict the conditions of this License, they do not
excuse you from the conditions of this License. If you cannot
distribute so as to satisfy simultaneously your obligations under this
License and any other pertinent obligations, then as a consequence you
may not distribute the Program at all. For example, if a patent
license would not permit royalty-free redistribution of the Program by
all those who receive copies directly or indirectly through you, then
the only way you could satisfy both it and this License would be to
refrain entirely from distribution of the Program.
If any portion of this section is held invalid or unenforceable under
any particular circumstance, the balance of the section is intended to
apply and the section as a whole is intended to apply in other
circumstances.
It is not the purpose of this section to induce you to infringe any
patents or other property right claims or to contest validity of any
such claims; this section has the sole purpose of protecting the
integrity of the free software distribution system, which is
implemented by public license practices. Many people have made
generous contributions to the wide range of software distributed
through that system in reliance on consistent application of that
system; it is up to the author/donor to decide if he or she is willing
to distribute software through any other system and a licensee cannot
impose that choice.
This section is intended to make thoroughly clear what is believed to
be a consequence of the rest of this License.
8. If the distribution and/or use of the Program is restricted in
certain countries either by patents or by copyrighted interfaces, the
original copyright holder who places the Program under this License
may add an explicit geographical distribution limitation excluding
those countries, so that distribution is permitted only in or among
countries not thus excluded. In such case, this License incorporates
the limitation as if written in the body of this License.
9. The Free Software Foundation may publish revised and/or new versions
of the General Public License from time to time. Such new versions will
be similar in spirit to the present version, but may differ in detail to
address new problems or concerns.
Each version is given a distinguishing version number. If the Program
specifies a version number of this License which applies to it and "any
later version", you have the option of following the terms and conditions
either of that version or of any later version published by the Free
Software Foundation. If the Program does not specify a version number of
this License, you may choose any version ever published by the Free Software
Foundation.
10. If you wish to incorporate parts of the Program into other free
programs whose distribution conditions are different, write to the author
to ask for permission. For software which is copyrighted by the Free
Software Foundation, write to the Free Software Foundation; we sometimes
make exceptions for this. Our decision will be guided by the two goals
of preserving the free status of all derivatives of our free software and
of promoting the sharing and reuse of software generally.
NO WARRANTY
11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
REPAIR OR CORRECTION.
12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
POSSIBILITY OF SUCH DAMAGES.
END OF TERMS AND CONDITIONS
How to Apply These Terms to Your New Programs
If you develop a new program, and you want it to be of the greatest
possible use to the public, the best way to achieve this is to make it
free software which everyone can redistribute and change under these terms.
To do so, attach the following notices to the program. It is safest
to attach them to the start of each source file to most effectively
convey the exclusion of warranty; and each file should have at least
the "copyright" line and a pointer to where the full notice is found.
<one line to give the program's name and a brief idea of what it does.>
Copyright (C) <year> <name of author>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
Also add information on how to contact you by electronic and paper mail.
If the program is interactive, make it output a short notice like this
when it starts in an interactive mode:
Gnomovision version 69, Copyright (C) year name of author
Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
This is free software, and you are welcome to redistribute it
under certain conditions; type `show c' for details.
The hypothetical commands `show w' and `show c' should show the appropriate
parts of the General Public License. Of course, the commands you use may
be called something other than `show w' and `show c'; they could even be
mouse-clicks or menu items--whatever suits your program.
You should also get your employer (if you work as a programmer) or your
school, if any, to sign a "copyright disclaimer" for the program, if
necessary. Here is a sample; alter the names:
Yoyodyne, Inc., hereby disclaims all copyright interest in the program
`Gnomovision' (which makes passes at compilers) written by James Hacker.
<signature of Ty Coon>, 1 April 1989
Ty Coon, President of Vice
This General Public License does not permit incorporating your program into
proprietary programs. If your program is a subroutine library, you may
consider it more useful to permit linking proprietary applications with the
library. If this is what you want to do, use the GNU Lesser General
Public License instead of this License.

View File

@ -0,0 +1,30 @@
0.0.5:
Interface received massive overhaul. Now takes command line
options. This will allow the server to communicate with
other front-ends. Integration can now occur in gfceu.
0.0.4:
Renamed from "server" to "fceu-server".
Renamed standard.conf -> fceu-standard.conf
If no configuration file is specified, look in /etc and ./
Added a --help option.
Added GPL headers
0.0.3:
Error messages during server startup are more verbose(slightly).
Fixed initialization of the sockaddr_in structure, sin_family
member. It's now initialized to AF_INET before calling bind().
While not initializing that member seemed to work ok on
Linux 2.4, it won't work on Linux 2.2 and under Cygwin,
and possibly other environments.
0.0.2:
Switched to using fcntl() to set the socket to nonblocking,
so I don't need to use MSG_NOWAIT in send() anymore, which is
undefined under Cygwin.
Added a "clean" Makefile target.
0.0.1:
First Release

View File

@ -0,0 +1,20 @@
PREFIX = /usr
OUTFILE = fceux-net-server
CC = g++
OBJS = server.o md5.o throttle.o
all: ${OBJS}
${CC} -o ${OUTFILE} ${OBJS}
clean:
rm -f ${OUTFILE} ${OBJS}
install:
install -m 755 -D fceux-net-server ${PREFIX}/bin/fceux-server
install -m 644 -D fceux-server.conf /etc/fceux-server.conf
server.o: server.cpp
md5.o: md5.cpp
throttle.o: throttle.cpp

View File

@ -0,0 +1,53 @@
FCE Ultra Network Play Server v0.0.5
------------------------------------
To compile, type this in the shell:
$ make
To install, type this in this shell:
$ sudo make install
To run, type this in shell:
$ ./fceu-server
To compile under MS Windows, you should use Cygwin. I'm not
going to change this server to use Win-old-dirty-smelly-sock natively.
There are known issues with running fceux-server in mac OSX. As a (somewhat extensive) workaround, you can run the server inside a Linux VM in bridged network mode.
If it doesn't compile, sell your <eternally lasting essence of self> to the
<evil entity of your religion>.
Most beings can run it like "./fceu-server >logfile &".
Windows users can run it some other way. A batch file with absolute paths, perhaps?
snuggums.bat:
C:\somethingdirectory\server.exe c:\somethingdirectory\standard.conf
With the default settings, each client should use about 65-70Kbps, excluding any
data transferred during chat, state loads, etc(which should be negligible, but limits
will be placed on these types of transfers in the future).
Clients connecting with high-latency or slow links may use more bandwidth, or they
may use less bandwidth. I'm really not quite sure. If it concerns you, test it.
Any client connecting over VERY high latency links, such as bidirectional satellite connections,
may find that attempting network play will lock up his/her connection for
several minutes. Right, Disch. ;)
The server probably won't scale well to a huge number of clients connected at the same time.
Bumping up the server's priority and running it on a low-latency kernel(preferably with
1 ms or smaller timeslices) should help make network play more usable if you're running the
network play server on an otherwise non-idle physical server.
TODO:
Implement a more flexible timing system, so that PAL games will be playable.
Change the protocol to allow the client to specify the size of input update information,
so devices like the powerpad or zapper can work over network play.
Send emulation info, such as NTSC/PAL, input devices, and Game Genie emulation at connect
time, to make it easier on end users.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -0,0 +1,5 @@
maxclients 100 ; Maximum number of clients
connecttimeout 5 ; Connection(login) timeout
framedivisor 1 ; Frame divisor(eg: 60 / framedivisor updates per second)
port 4046 ; Port to listen on
;password sexybeef

View File

@ -0,0 +1,266 @@
/* FCE Ultra Network Play Server
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
* */
/*
* RFC 1321 compliant MD5 implementation,
* by Christophe Devine <devine@cr0.net>;
* this program is licensed under the GPL.
*/
/* Modified October 3, 2003, to remove testing code, and add
include of "types.h".
Added simple MD5 to ASCII string conversion function.
-Xodnizel
*/
#include <string.h>
#include "types.h"
#include "md5.h"
#define GET_UINT32(n,b,i) \
{ \
(n) = ( (uint32) (b)[(i) + 3] << 24 ) \
| ( (uint32) (b)[(i) + 2] << 16 ) \
| ( (uint32) (b)[(i) + 1] << 8 ) \
| ( (uint32) (b)[(i) ] ); \
}
#define PUT_UINT32(n,b,i) \
{ \
(b)[(i) ] = (uint8) ( (n) ); \
(b)[(i) + 1] = (uint8) ( (n) >> 8 ); \
(b)[(i) + 2] = (uint8) ( (n) >> 16 ); \
(b)[(i) + 3] = (uint8) ( (n) >> 24 ); \
}
void md5_starts( struct md5_context *ctx )
{
ctx->total[0] = 0;
ctx->total[1] = 0;
ctx->state[0] = 0x67452301;
ctx->state[1] = 0xEFCDAB89;
ctx->state[2] = 0x98BADCFE;
ctx->state[3] = 0x10325476;
}
void md5_process( struct md5_context *ctx, uint8 data[64] )
{
uint32 A, B, C, D, X[16];
GET_UINT32( X[0], data, 0 );
GET_UINT32( X[1], data, 4 );
GET_UINT32( X[2], data, 8 );
GET_UINT32( X[3], data, 12 );
GET_UINT32( X[4], data, 16 );
GET_UINT32( X[5], data, 20 );
GET_UINT32( X[6], data, 24 );
GET_UINT32( X[7], data, 28 );
GET_UINT32( X[8], data, 32 );
GET_UINT32( X[9], data, 36 );
GET_UINT32( X[10], data, 40 );
GET_UINT32( X[11], data, 44 );
GET_UINT32( X[12], data, 48 );
GET_UINT32( X[13], data, 52 );
GET_UINT32( X[14], data, 56 );
GET_UINT32( X[15], data, 60 );
#define S(x,n) ((x << n) | ((x & 0xFFFFFFFF) >> (32 - n)))
#define P(a,b,c,d,k,s,t) \
{ \
a += F(b,c,d) + X[k] + t; a = S(a,s) + b; \
}
A = ctx->state[0];
B = ctx->state[1];
C = ctx->state[2];
D = ctx->state[3];
#define F(x,y,z) (z ^ (x & (y ^ z)))
P( A, B, C, D, 0, 7, 0xD76AA478 );
P( D, A, B, C, 1, 12, 0xE8C7B756 );
P( C, D, A, B, 2, 17, 0x242070DB );
P( B, C, D, A, 3, 22, 0xC1BDCEEE );
P( A, B, C, D, 4, 7, 0xF57C0FAF );
P( D, A, B, C, 5, 12, 0x4787C62A );
P( C, D, A, B, 6, 17, 0xA8304613 );
P( B, C, D, A, 7, 22, 0xFD469501 );
P( A, B, C, D, 8, 7, 0x698098D8 );
P( D, A, B, C, 9, 12, 0x8B44F7AF );
P( C, D, A, B, 10, 17, 0xFFFF5BB1 );
P( B, C, D, A, 11, 22, 0x895CD7BE );
P( A, B, C, D, 12, 7, 0x6B901122 );
P( D, A, B, C, 13, 12, 0xFD987193 );
P( C, D, A, B, 14, 17, 0xA679438E );
P( B, C, D, A, 15, 22, 0x49B40821 );
#undef F
#define F(x,y,z) (y ^ (z & (x ^ y)))
P( A, B, C, D, 1, 5, 0xF61E2562 );
P( D, A, B, C, 6, 9, 0xC040B340 );
P( C, D, A, B, 11, 14, 0x265E5A51 );
P( B, C, D, A, 0, 20, 0xE9B6C7AA );
P( A, B, C, D, 5, 5, 0xD62F105D );
P( D, A, B, C, 10, 9, 0x02441453 );
P( C, D, A, B, 15, 14, 0xD8A1E681 );
P( B, C, D, A, 4, 20, 0xE7D3FBC8 );
P( A, B, C, D, 9, 5, 0x21E1CDE6 );
P( D, A, B, C, 14, 9, 0xC33707D6 );
P( C, D, A, B, 3, 14, 0xF4D50D87 );
P( B, C, D, A, 8, 20, 0x455A14ED );
P( A, B, C, D, 13, 5, 0xA9E3E905 );
P( D, A, B, C, 2, 9, 0xFCEFA3F8 );
P( C, D, A, B, 7, 14, 0x676F02D9 );
P( B, C, D, A, 12, 20, 0x8D2A4C8A );
#undef F
#define F(x,y,z) (x ^ y ^ z)
P( A, B, C, D, 5, 4, 0xFFFA3942 );
P( D, A, B, C, 8, 11, 0x8771F681 );
P( C, D, A, B, 11, 16, 0x6D9D6122 );
P( B, C, D, A, 14, 23, 0xFDE5380C );
P( A, B, C, D, 1, 4, 0xA4BEEA44 );
P( D, A, B, C, 4, 11, 0x4BDECFA9 );
P( C, D, A, B, 7, 16, 0xF6BB4B60 );
P( B, C, D, A, 10, 23, 0xBEBFBC70 );
P( A, B, C, D, 13, 4, 0x289B7EC6 );
P( D, A, B, C, 0, 11, 0xEAA127FA );
P( C, D, A, B, 3, 16, 0xD4EF3085 );
P( B, C, D, A, 6, 23, 0x04881D05 );
P( A, B, C, D, 9, 4, 0xD9D4D039 );
P( D, A, B, C, 12, 11, 0xE6DB99E5 );
P( C, D, A, B, 15, 16, 0x1FA27CF8 );
P( B, C, D, A, 2, 23, 0xC4AC5665 );
#undef F
#define F(x,y,z) (y ^ (x | ~z))
P( A, B, C, D, 0, 6, 0xF4292244 );
P( D, A, B, C, 7, 10, 0x432AFF97 );
P( C, D, A, B, 14, 15, 0xAB9423A7 );
P( B, C, D, A, 5, 21, 0xFC93A039 );
P( A, B, C, D, 12, 6, 0x655B59C3 );
P( D, A, B, C, 3, 10, 0x8F0CCC92 );
P( C, D, A, B, 10, 15, 0xFFEFF47D );
P( B, C, D, A, 1, 21, 0x85845DD1 );
P( A, B, C, D, 8, 6, 0x6FA87E4F );
P( D, A, B, C, 15, 10, 0xFE2CE6E0 );
P( C, D, A, B, 6, 15, 0xA3014314 );
P( B, C, D, A, 13, 21, 0x4E0811A1 );
P( A, B, C, D, 4, 6, 0xF7537E82 );
P( D, A, B, C, 11, 10, 0xBD3AF235 );
P( C, D, A, B, 2, 15, 0x2AD7D2BB );
P( B, C, D, A, 9, 21, 0xEB86D391 );
#undef F
ctx->state[0] += A;
ctx->state[1] += B;
ctx->state[2] += C;
ctx->state[3] += D;
}
void md5_update( struct md5_context *ctx, uint8 *input, uint32 length )
{
uint32 left, fill;
if( ! length ) return;
left = ( ctx->total[0] >> 3 ) & 0x3F;
fill = 64 - left;
ctx->total[0] += length << 3;
ctx->total[1] += length >> 29;
ctx->total[0] &= 0xFFFFFFFF;
ctx->total[1] += ctx->total[0] < ( length << 3 );
if( left && length >= fill )
{
memcpy( (void *) (ctx->buffer + left), (void *) input, fill );
md5_process( ctx, ctx->buffer );
length -= fill;
input += fill;
left = 0;
}
while( length >= 64 )
{
md5_process( ctx, input );
length -= 64;
input += 64;
}
if( length )
{
memcpy( (void *) (ctx->buffer + left), (void *) input, length );
}
}
static uint8 md5_padding[64] =
{
0x80, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
};
void md5_finish( struct md5_context *ctx, uint8 digest[16] )
{
uint32 last, padn;
uint8 msglen[8];
PUT_UINT32( ctx->total[0], msglen, 0 );
PUT_UINT32( ctx->total[1], msglen, 4 );
last = ( ctx->total[0] >> 3 ) & 0x3F;
padn = ( last < 56 ) ? ( 56 - last ) : ( 120 - last );
md5_update( ctx, md5_padding, padn );
md5_update( ctx, msglen, 8 );
PUT_UINT32( ctx->state[0], digest, 0 );
PUT_UINT32( ctx->state[1], digest, 4 );
PUT_UINT32( ctx->state[2], digest, 8 );
PUT_UINT32( ctx->state[3], digest, 12 );
}
/* Uses a static buffer, so beware of how it's used. */
char *md5_asciistr(uint8 digest[16])
{
static char str[33];
static char trans[16]={'0','1','2','3','4','5','6','7','8','9','a','b','c','d','e','f'};
int x;
for(x=0;x<16;x++)
{
str[x*2]=trans[digest[x]&0x0F];
str[x*2+1]=trans[digest[x]>>4];
}
return(str);
}

View File

@ -0,0 +1,37 @@
/* FCE Ultra Network Play Server
*
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef _MD5_H
#define _MD5_H
struct md5_context
{
uint32 total[2];
uint32 state[4];
uint8 buffer[64];
};
void md5_starts( struct md5_context *ctx );
void md5_update( struct md5_context *ctx, uint8 *input, uint32 length );
void md5_finish( struct md5_context *ctx, uint8 digest[16] );
/* Uses a static buffer, so beware of how it's used. */
char *md5_asciistr(uint8 digest[16]);
#endif /* md5.h */

View File

@ -0,0 +1,915 @@
/* FCE Ultra Network Play Server
*
* Copyright notice for this file:
* Copyright (C) 2004 Xodnizel
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#include <time.h>
#include <stdlib.h>
#include <string.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <sys/ioctl.h>
#include <sys/time.h>
#include <sys/param.h>
#include <netinet/in.h>
#include <netinet/tcp.h>
#include <arpa/inet.h>
#include <stdio.h>
#include <unistd.h>
#include <netdb.h>
#include <errno.h>
#include <fcntl.h>
#include <stdarg.h>
#include <exception>
#include "types.h"
#include "md5.h"
#include "throttle.h"
#define VERSION "0.0.5"
#define DEFAULT_PORT 4046
#define DEFAULT_MAX 100
#define DEFAULT_TIMEOUT 5
#define DEFAULT_FRAMEDIVISOR 1
#define DEFAULT_CONFIG "/etc/fceux-server.conf"
// MSG_NOSIGNAL and SOL_TCP have been depreciated on osx
#if defined (__APPLE__) || defined(BSD)
#define MSG_NOSIGNAL SO_NOSIGPIPE
#define SOL_TCP IPPROTO_TCP
#endif
typedef struct {
uint32 id; /* mainly for faster referencing when pointed to from the Games
entries.
*/
char *nickname;
int TCPSocket;
void *game; /* Pointer to the game this player is in. */
int localplayers; /* The number of local players, 1-4 */
time_t timeconnect; /* Time the client made the connection. */
/* Variables to handle non-blocking TCP reads. */
uint8 *nbtcp;
uint32 nbtcphas, nbtcplen;
uint32 nbtcptype;
} ClientEntry;
typedef struct
{
uint8 id[16]; /* Unique 128-bit identifier for this game session. */
uint8 joybuf[5]; /* 4 player data + 1 command byte */
int MaxPlayers; /* Maximum players for this game */
ClientEntry *Players[4]; /* Pointers to player data. */
int IsUnique[4]; /* Set to 1 if player is unique client, 0
if it's a duplicated entry to handle multiple players
per client.
*/
uint8 ExtraInfo[64]; /* Expansion information to be used in future versions
of FCE Ultra.
*/
} GameEntry;
typedef struct
{
unsigned int MaxClients; /* The maximum number of clients to allow. */
/* You should expect each client to use
65-70Kbps(not including save state loads) while
connected(and logged in), when using the default
FrameDivisor value of 1.
*/
unsigned int ConnectTimeout; /* How long to wait(in seconds) for the client to provide
login data before disconnecting the client.
*/
unsigned int FrameDivisor; /* The number of updates per second are divided
by this number. 1 = 60 updates/sec(approx),
2 = 30 updates/sec, etc. */
unsigned int Port; /* The port to listen on. */
uint8 *Password; /* The server password. */
} CONFIG;
CONFIG ServerConfig;
int LoadConfigFile(char *fn)
{
FILE *fp;
ServerConfig.Port = ServerConfig.MaxClients = ServerConfig.ConnectTimeout = ServerConfig.FrameDivisor = ~0;
if(fp=fopen(fn,"rb"))
{
char buf[256];
while(fgets(buf, 256, fp) > 0)
{
if(!strncasecmp(buf,"maxclients",strlen("maxclients")))
sscanf(buf,"%*s %d",&ServerConfig.MaxClients);
else if(!strncasecmp(buf,"connecttimeout",strlen("connecttimeout")))
sscanf(buf,"%*s %d",&ServerConfig.ConnectTimeout);
else if(!strncasecmp(buf,"framedivisor",strlen("framedivisor")))
sscanf(buf,"%*s %d",&ServerConfig.FrameDivisor);
else if(!strncasecmp(buf,"port",strlen("port")))
sscanf(buf,"%*s %d",&ServerConfig.Port);
else if(!strncasecmp(buf,"password",strlen("password")))
{
char *pass = 0;
sscanf(buf,"%*s %as",&pass);
if(pass)
{
struct md5_context md5;
ServerConfig.Password = (uint8 *)malloc(16);
md5_starts(&md5);
md5_update(&md5,(uint8*)pass,strlen(pass));
md5_finish(&md5,ServerConfig.Password);
puts("Password required to log in.");
}
}
}
}
else
{
printf("Cannot load configuration file %s.\n", fn);
return(0);
}
if(~0 == (ServerConfig.Port & ServerConfig.MaxClients & ServerConfig.ConnectTimeout & ServerConfig.FrameDivisor))
{
puts("Incomplete configuration file");
return(0);
}
//printf("%d,%d,%d\n",ServerConfig.MaxClients,ServerConfig.ConnectTimeout,ServerConfig.FrameDivisor);
printf("Using configuration file located at %s\n", fn);
return(1);
}
static ClientEntry *Clients;
static GameEntry *Games;
static void en32(uint8 *buf, uint32 morp)
{
buf[0]=morp;
buf[1]=morp>>8;
buf[2]=morp>>16;
buf[3]=morp>>24;
}
static uint32 de32(uint8 *morp)
{
return(morp[0]|(morp[1]<<8)|(morp[2]<<16)|(morp[3]<<24));
}
static char *CleanNick(char *nick);
static int NickUnique(ClientEntry *client);
static void AddClientToGame(ClientEntry *client, uint8 id[16], uint8 extra[64]) throw(int);
static void SendToAll(GameEntry *game, int cmd, uint8 *data, uint32 len) throw(int);
static void BroadcastText(GameEntry *game, const char *fmt, ...) throw(int);
static void TextToClient(ClientEntry *client, const char *fmt, ...) throw(int);
static void KillClient(ClientEntry *client);
#define NBTCP_LOGINLEN 0x100
#define NBTCP_LOGIN 0x200
#define NBTCP_COMMANDLEN 0x300
#define NBTCP_COMMAND 0x400
#define NBTCP_UPDATEDATA 0x800
static void StartNBTCPReceive(ClientEntry *client, uint32 type, uint32 len)
{
client->nbtcp = (uint8 *)malloc(len);
client->nbtcplen = len;
client->nbtcphas = 0;
client->nbtcptype = type;
}
static void RedoNBTCPReceive(ClientEntry *client)
{
client->nbtcphas = 0;
}
static void EndNBTCPReceive(ClientEntry *client)
{
free(client->nbtcp);
client->nbtcplen = client->localplayers;
client->nbtcphas = 0;
client->nbtcptype = 0;
client->nbtcp = 0;
}
static uint8 *MakeMPS(ClientEntry *client)
{
static uint8 buf[64];
uint8 *bp = buf;
int x;
GameEntry *game = (GameEntry *)client->game;
for(x=0;x<4;x++)
{
if(game->Players[x] == client)
{
*bp = '0' + x + 1;
bp++;
*bp = ',';
bp++;
}
}
if(*(bp-1) == ',') bp--;
*bp = 0;
return(buf);
}
/* Returns 1 if we are back to normal game mode, 0 if more data is yet to arrive. */
static int CheckNBTCPReceive(ClientEntry *client) throw(int)
{
if(!client->nbtcplen)
throw(1); /* Should not happen. */
int l;
while(l = recv(client->TCPSocket, client->nbtcp + client->nbtcphas, client->nbtcplen - client->nbtcphas, MSG_NOSIGNAL))
{
if(l == -1)
{
if(errno == EAGAIN || errno == EWOULDBLOCK)
break;
throw(1); /* Die now. NOW. */
}
client->nbtcphas += l;
//printf("Read: %d, %04x, %d, %d\n",l,client->nbtcptype,client->nbtcphas, client->nbtcplen);
/* We're all full. Yippie. */
if(client->nbtcphas == client->nbtcplen)
{
uint32 len;
switch(client->nbtcptype & 0xF00)
{
case NBTCP_UPDATEDATA:
{
GameEntry *game = (GameEntry *)client->game;
int x, wx;
if(client->nbtcp[0] == 0xFF)
{
EndNBTCPReceive(client);
StartNBTCPReceive(client, NBTCP_COMMANDLEN, 5);
return(1);
}
for(x=0,wx=0; x < 4; x++)
{
if(game->Players[x] == client)
{
game->joybuf[x] = client->nbtcp[wx];
wx++;
}
}
RedoNBTCPReceive(client);
}
return(1);
case NBTCP_COMMANDLEN:
{
uint8 cmd = client->nbtcp[4];
len = de32(client->nbtcp);
if(len > 200000) /* Sanity check. */
throw(1);
//printf("%02x, %d\n",cmd,len);
if(!len && !(cmd&0x80))
{
SendToAll((GameEntry*)client->game, client->nbtcp[4], 0, 0);
EndNBTCPReceive(client);
StartNBTCPReceive(client,NBTCP_UPDATEDATA,client->localplayers);
}
else if(client->nbtcp[4]&0x80)
{
EndNBTCPReceive(client);
if(len)
StartNBTCPReceive(client,NBTCP_COMMAND | cmd,len);
else /* Woops. Client probably tried to send a text message of 0 length. Or maybe a 0-length cheat file? Better be safe! */
StartNBTCPReceive(client,NBTCP_UPDATEDATA,client->localplayers);
}
else throw(1);
return(1);
}
case NBTCP_COMMAND:
{
len = client->nbtcplen;
uint32 tocmd = client->nbtcptype & 0xFF;
if(tocmd == 0x90) /* Text */
{
char *ma, *ma2;
ma = (char *) malloc(len + 1);
memcpy(ma, client->nbtcp, len);
ma[len] = 0;
asprintf(&ma2, "<%s> %s",client->nickname,ma);
free(ma);
ma = ma2;
len=strlen(ma);
SendToAll((GameEntry*)client->game, tocmd, (uint8 *)ma, len);
free(ma);
}
else
SendToAll((GameEntry*)client->game, tocmd, client->nbtcp, len);
EndNBTCPReceive(client);
StartNBTCPReceive(client,NBTCP_UPDATEDATA,client->localplayers);
return(1);
}
case NBTCP_LOGINLEN:len = de32(client->nbtcp);
if(len > 1024 || len < (16 + 16 + 64 + 1))
throw(1);
EndNBTCPReceive(client);
StartNBTCPReceive(client,NBTCP_LOGIN,len);
return(1);
case NBTCP_LOGIN:
{
uint32 len;
uint8 gameid[16];
uint8 *sexybuf;
uint8 extra[64];
len = client->nbtcplen;
sexybuf = client->nbtcp;
/* Game ID(MD5'd game MD5 and password on client side). */
memcpy(gameid, sexybuf, 16);
sexybuf += 16;
len -= 16;
if(ServerConfig.Password)
if(memcmp(ServerConfig.Password,sexybuf,16))
{
TextToClient(client,"Invalid server password.");
throw(1);
}
sexybuf += 16;
len -= 16;
memcpy(extra, sexybuf, 64);
sexybuf += 64;
len -= 64;
client->localplayers = *sexybuf;
if(client->localplayers < 1 || client->localplayers > 4)
{
TextToClient(client,"Invalid number(%d) of local players!",client->localplayers);
throw(1);
}
sexybuf++;
len -= 1;
AddClientToGame(client, gameid, extra);
/* Get the nickname */
if(len)
{
client->nickname = (char *)malloc(len + 1);
memcpy(client->nickname, sexybuf, len);
client->nickname[len] = 0;
if((client->nickname = CleanNick(client->nickname)))
if(!NickUnique(client)) /* Nickname already exists */
{
free(client->nickname);
client->nickname = 0;
}
}
uint8 *mps = MakeMPS(client);
if(!client->nickname)
asprintf(&client->nickname,"*Player %s",mps);
printf("Client %d assigned to game %d as player %s <%s>\n",client->id,(GameEntry*)client->game - Games,mps, client->nickname);
int x;
GameEntry *tg=(GameEntry *)client->game;
for(x=0; x<tg->MaxPlayers; x++)
if(tg->Players[x] && tg->IsUnique[x])
{
if(tg->Players[x] != client)
{
try
{
TextToClient(tg->Players[x], "* Player %s has just connected as: %s",MakeMPS(client),client->nickname);
} catch(int i)
{
KillClient(tg->Players[x]);
}
TextToClient(client, "* Player %s is already connected as: %s",MakeMPS(tg->Players[x]),tg->Players[x]->nickname);
}
else
TextToClient(client, "* You(Player %s) have just connected as: %s",MakeMPS(client),client->nickname);
}
}
EndNBTCPReceive(client);
StartNBTCPReceive(client,NBTCP_UPDATEDATA,client->localplayers);
return(1);
}
}
}
return(0);
}
int ListenSocket;
static char *CleanNick(char *nick)
{
int x;
for(x=0; x<strlen(nick); x++)
if(nick[x] == '<' || nick[x] == '>' || nick[x] == '*' || (nick[x] < 0x20))
nick[x] = 0;
if(!strlen(nick))
{
free(nick);
nick = 0;
}
return(nick);
}
static int NickUnique(ClientEntry *client)
{
int x;
GameEntry *game = (GameEntry *)client-> game;
for(x=0; x<game->MaxPlayers; x++)
if(game->Players[x] && client != game->Players[x])
if(!strcasecmp(client->nickname, game->Players[x]->nickname))
return(0);
return(1);
}
static int MakeSendTCP(ClientEntry *client, uint8 *data, uint32 len) throw(int)
{
if(send(client->TCPSocket, data, len, MSG_NOSIGNAL) != len)
throw(1);
return(1);
}
static void SendToAll(GameEntry *game, int cmd, uint8 *data, uint32 len) throw(int)
{
uint8 poo[5];
int x;
poo[4] = cmd;
for(x=0;x<game->MaxPlayers;x++)
{
if(!game->Players[x] || !game->IsUnique[x]) continue;
try
{
if(cmd & 0x80)
en32(poo, len);
MakeSendTCP(game->Players[x],poo,5);
if(cmd & 0x80)
{
MakeSendTCP(game->Players[x], data, len);
}
}
catch(int i)
{
KillClient(game->Players[x]);
}
}
}
static void TextToClient(ClientEntry *client, const char *fmt, ...) throw(int)
{
char *moo;
va_list ap;
va_start(ap,fmt);
vasprintf(&moo, fmt, ap);
va_end(ap);
uint8 poo[5];
uint32 len;
poo[4] = 0x90;
len = strlen(moo);
en32(poo, len);
MakeSendTCP(client, poo, 5);
MakeSendTCP(client, (uint8*)moo, len);
free(moo);
}
static void BroadcastText(GameEntry *game, const char *fmt, ...) throw(int)
{
char *moo;
va_list ap;
va_start(ap,fmt);
vasprintf(&moo, fmt, ap);
va_end(ap);
SendToAll(game, 0x90,(uint8 *)moo,strlen(moo));
free(moo);
}
static void KillClient(ClientEntry *client)
{
GameEntry *game;
uint8 *mps;
char *bmsg;
game = (GameEntry *)client->game;
if(game)
{
int w;
int tc = 0;
for(w=0;w<game->MaxPlayers;w++)
if(game->Players[w]) tc++;
for(w=0;w<game->MaxPlayers;w++)
if(game->Players[w])
if(game->Players[w] == client)
game->Players[w] = NULL;
time_t curtime = time(0);
printf("Player <%s> disconnected from game %d on %s",client->nickname,game-Games,ctime(&curtime));
asprintf(&bmsg, "* Player %s <%s> left.",MakeMPS(client),client->nickname);
if(tc == client->localplayers) /* If total players for this game = total local
players for this client, destroy the game.
*/
{
printf("Game %d destroyed.\n",game-Games);
memset(game, 0, sizeof(GameEntry));
game = 0;
}
}
else
{
time_t curtime = time(0);
printf("Unassigned client %d disconnected on %s",client->id, ctime(&curtime));
}
if(client->nbtcp)
free(client->nbtcp);
if(client->nickname)
free(client->nickname);
if(client->TCPSocket != -1)
close(client->TCPSocket);
memset(client, 0, sizeof(ClientEntry));
client->TCPSocket = -1;
if(game)
BroadcastText(game,"%s",bmsg);
}
static void AddClientToGame(ClientEntry *client, uint8 id[16], uint8 extra[64]) throw(int)
{
int wg;
GameEntry *game,*fegame;
retry:
game = NULL;
fegame = NULL;
/* First, find an available game. */
for(wg=0; wg<ServerConfig.MaxClients; wg++)
if(!Games[wg].MaxPlayers && !fegame)
{
if(!fegame)
fegame=&Games[wg];
}
else if(!memcmp(Games[wg].id,id,16)) /* A match was found! */
{
game = &Games[wg];
break;
}
if(!game) /* Hmm, no game found. Guess we'll have to create one. */
{
game=fegame;
printf("Game %d added\n",game-Games);
memset(game, 0, sizeof(GameEntry));
game->MaxPlayers = 4;
memcpy(game->id, id, 16);
memcpy(game->ExtraInfo, extra, 64);
}
int n;
for(n = 0; n < game->MaxPlayers; n++)
if(game->Players[n])
{
try
{
uint8 b[5];
b[4] = 0x81;
MakeSendTCP(game->Players[n], b, 5);
break;
}
catch(int i)
{
KillClient(game->Players[n]);
/* All right, now the client we sent the request to is killed. I HOPE YOU'RE HAPPY! */
/* Since killing a client can destroy a game, we'll need to see if the game was trashed.
If it was, then "goto retry", and try again. Ugly, yes. I LIKE UGLY.
*/
if(!game->MaxPlayers)
goto retry;
}
}
int instancecount = client->localplayers;
for(n=0; n<game->MaxPlayers; n++)
if(!game->Players[n])
{
game->Players[n] = client;
if(instancecount == client->localplayers)
game->IsUnique[n] = 1;
else
game->IsUnique[n] = 0;
instancecount --;
if(!instancecount)
break;
}
/* Game is full. */
if(n == game->MaxPlayers)
{
for(n=0; n<game->MaxPlayers; n++)
if(game->Players[n] == client)
game->Players[n] = 0;
TextToClient(client, "Sorry, game is full. %d instance(s) tried, %d available.",client->localplayers,client->localplayers - instancecount);
throw(1);
}
client->game = (void *)game;
}
int main(int argc, char *argv[])
{
struct sockaddr_in sockin;
socklen_t sockin_len;
int i;
char* pass = 0;
/* If we can't load the default config file, use some defined values */
if(!LoadConfigFile(DEFAULT_CONFIG)) {
ServerConfig.Port = DEFAULT_PORT;
ServerConfig.MaxClients = DEFAULT_MAX;
ServerConfig.ConnectTimeout = DEFAULT_TIMEOUT;
ServerConfig.FrameDivisor = DEFAULT_FRAMEDIVISOR;
}
char* configfile = 0;
for(i=1; i<argc ;i++)
{
if(!strcmp(argv[i], "--help") || !strcmp(argv[i], "-h")) {
printf("Usage: %s [OPTION]...\n" ,argv[0]);
printf("Begins the FCE Ultra game server with given options.\n");
printf("This server will first look in %s for options. If that \nfile does not exist, it will use the defaults given here. Any argument given \ndirectly will override any default values.\n\n", DEFAULT_CONFIG);
printf("-h\t--help\t\tDisplays this help message.\n");
printf("-v\t--version\t\tDisplays the version number and quits.\n");
printf("-p\t--port\t\tStarts server on given port. (default=%d)\n", DEFAULT_PORT);
printf("-w\t--password\tSpecifies a password for entry.\n");
printf("-m\t--maxclients\tSpecifies the maximum amount of clients allowed \n\t\t\tto access the server. (default=%d)\n", DEFAULT_MAX);
printf("-t\t--timeout\tSpecifies the amount of seconds before the server \n\t\t\ttimes out. (default=%d)\n", DEFAULT_TIMEOUT);
printf("-f\t--framedivisor\tSpecifies frame divisor.\n\t\t\t(eg: 60 / framedivisor = updates per second)(default=%d)\n", DEFAULT_FRAMEDIVISOR);
printf("-c\t--configfile\tLoads the given configuration file.\n");
return -1;
}
if(!strcmp(argv[i], "--port") || !strcmp(argv[i], "-p")) {
i++;
if(argc == i)
{
printf("Please specify a port to use.\n");
return -1;
}
ServerConfig.Port = atoi(argv[i]);
continue;
}
if(!strcmp(argv[i], "--password") || !strcmp(argv[i], "-w")) {
i++;
if(argc == i) {
printf("Please specify a password.\n");
return -1;
}
pass = argv[i];
struct md5_context md5;
ServerConfig.Password = (uint8 *)malloc(16);
md5_starts(&md5);
md5_update(&md5,(uint8*)pass,strlen(pass));
md5_finish(&md5,ServerConfig.Password);
puts("Password required to log in.");
continue;
}
if(!strcmp(argv[i], "--maxclients") || !strcmp(argv[i], "-m")) {
i++;
if(argc == i) {
printf("Please specify the maximium ammount of clients.\n");
return -1;
}
ServerConfig.MaxClients = atoi(argv[i]);
continue;
}
if(!strcmp(argv[i], "--timeout") || !strcmp(argv[i], "-t")) {
i++;
if(argc == i) {
printf("Please specify the conenction timeout time in seconds.\n");
return -1;
}
ServerConfig.ConnectTimeout = atoi(argv[i]);
continue;
}
if(!strcmp(argv[i], "--framedivisor") || !strcmp(argv[i], "-f")) {
i++;
if(argc == i) {
printf("Please specify a framedivisor.\n");
return -1;
}
ServerConfig.FrameDivisor = atoi(argv[i]);
continue;
}
if(!strcmp(argv[i], "--configfile") || !strcmp(argv[i], "-c")) {
i++;
if(argc == i) {
printf("Please specify a configfile to load.\n");
return -1;
}
if(!LoadConfigFile(argv[i])) {
puts("Error loading configuration file.");
exit(-1);
}
continue;
}
if(!strcmp(argv[i], "--version") || !strcmp(argv[i], "-v")) {
printf("FCE Ultra network server version %s\n", VERSION);
return 0;
}
/* If we've gotten here, we don't know what the argument is */
printf("Invalid parameter: %s\n", argv[i]);
return -1;
}
Games = (GameEntry *)malloc(sizeof(GameEntry) * ServerConfig.MaxClients);
Clients = (ClientEntry *)malloc(sizeof(ClientEntry) * ServerConfig.MaxClients);
memset(Games,0,sizeof(GameEntry) * ServerConfig.MaxClients);
memset(Clients,0,sizeof(ClientEntry) * ServerConfig.MaxClients);
{
int x;
for(x=0; x<ServerConfig.MaxClients; x++)
Clients[x].TCPSocket = -1;
}
RefreshThrottleFPS(ServerConfig.FrameDivisor);
/* First, we need to create a socket to listen on. */
ListenSocket = socket(AF_INET, SOCK_STREAM, 0);
/* Set send buffer size to 262,144 bytes. */
int sndbufsize = 262144;
if(setsockopt(ListenSocket, SOL_SOCKET, SO_SNDBUF, &sndbufsize, sizeof(int)))
printf("Send buffer size set failed: %s",strerror(errno));
int tcpopt = 1;
if(setsockopt(ListenSocket, SOL_TCP, TCP_NODELAY, &tcpopt, sizeof(int)))
{
printf("Nodelay fail: %s",strerror(errno));
exit(-1);
}
memset(&sockin, 0, sizeof(sockin));
sockin.sin_family = AF_INET;
sockin.sin_addr.s_addr = INADDR_ANY;
sockin_len = sizeof(sockin);
sockin.sin_port = htons(ServerConfig.Port);
printf("Binding to port %d... ",ServerConfig.Port);
if(bind(ListenSocket, (struct sockaddr *)&sockin, sockin_len))
{
printf("Error: %s\n",strerror(errno));
exit(-1);
}
puts("Ok");
printf("Listening on socket... ");
if(listen(ListenSocket, 8))
{
printf("Error: %s",strerror(errno));
exit(-1);
}
puts("Ok");
/* We don't want to block on accept() */
fcntl(ListenSocket, F_SETFL, fcntl(ListenSocket, F_GETFL) | O_NONBLOCK);
/* Now for the BIG LOOP. */
while(1)
{
int n;
for(n=0; n<ServerConfig.MaxClients; n++)
{
if(Clients[n].TCPSocket != -1) continue;
if((Clients[n].TCPSocket = accept(ListenSocket, (struct sockaddr *)&sockin, &sockin_len)) != -1)
{
struct sockaddr_in usockin;
/* We have a new client. Yippie. */
fcntl(Clients[n].TCPSocket, F_SETFL, fcntl(Clients[n].TCPSocket, F_GETFL) | O_NONBLOCK);
Clients[n].timeconnect = time(0);
Clients[n].id = n;
printf("Client %d connecting from %s on %s",n,inet_ntoa(sockin.sin_addr),ctime(&Clients[n].timeconnect));
{
uint8 buf[1];
buf[0] = ServerConfig.FrameDivisor;
send(Clients[n].TCPSocket,buf,1,MSG_NOSIGNAL);
}
StartNBTCPReceive(&Clients[n], NBTCP_LOGINLEN, 4);
}
}
/* Check for users still in the login process(not yet assigned a game). BOING */
time_t curtime = time(0);
for(n = 0; n < ServerConfig.MaxClients; n++)
try
{
if(Clients[n].TCPSocket != -1 && !Clients[n].game)
{
if((Clients[n].timeconnect + ServerConfig.ConnectTimeout) < curtime)
{
KillClient(&Clients[n]);
}
else
while(CheckNBTCPReceive(&Clients[n])) {};
}
}
catch(int i)
{
KillClient(&Clients[n]);
}
int whichgame;
for(whichgame = 0; whichgame < ServerConfig.MaxClients; whichgame ++)
{
/* Now, the loop to get data from each client. Meep. */
for(n = 0; n < Games[whichgame].MaxPlayers; n++)
{
try
{
ClientEntry *client = Games[whichgame].Players[n];
if(!client || !Games[whichgame].IsUnique[n]) continue;
int localplayers = client->localplayers;
while(CheckNBTCPReceive(client)) {};
} // catch
catch(int i)
{
KillClient(Games[whichgame].Players[n]);
}
} // A games clients
/* Now we send the data to all the clients. */
for(n = 0; n < Games[whichgame].MaxPlayers; n++)
{
if(!Games[whichgame].Players[n] || !Games[whichgame].IsUnique[n]) continue;
try
{
MakeSendTCP(Games[whichgame].Players[n], Games[whichgame].joybuf, 5);
}
catch(int i)
{
KillClient(Games[whichgame].Players[n]);
}
} // A game's clients
} // Games
SpeedThrottle();
} // while(1)
}

View File

@ -0,0 +1,102 @@
/* FCE Ultra Network Play Server
*
* Copyright notice for this file:
* Copyright (C) 2004 Xodnizel
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#include <sys/time.h>
#include <unistd.h>
#include "types.h"
#include "throttle.h"
#ifdef TODO
THROTTLE *MakeThrottle(uint32 fps)
{
}
/* Returns 1 if it's time to run, 0 if it's not time yet. */
int TestThrottle(THROTTLE *throt)
{
}
/* Pass it a pointer to an array of THROTTLE structs */
/* It will check */
void DoAllThrottles(THROTTLE *throt)
{
}
void KillThrottle(THROTTLE *throt)
{
}
#endif
static uint64 tfreq;
static uint64 desiredfps;
int32 FCEUI_GetDesiredFPS(void)
{
//if(PAL)
// return(838977920); // ~50.007
//else
return(1008307711); // ~60.1
}
void RefreshThrottleFPS(int divooder)
{
desiredfps=(FCEUI_GetDesiredFPS() / divooder)>>8;
tfreq=1000000;
tfreq<<=16; /* Adjustment for fps returned from FCEUI_GetDesiredFPS(). */
}
static uint64 GetCurTime(void)
{
uint64 ret;
struct timeval tv;
gettimeofday(&tv,0);
ret=(uint64)tv.tv_sec*1000000;
ret+=tv.tv_usec;
return(ret);
}
void SpeedThrottle(void)
{
static uint64 ttime,ltime;
waiter:
ttime=GetCurTime();
if( (ttime-ltime) < (tfreq/desiredfps) )
{
usleep(1000);
goto waiter;
}
if( (ttime-ltime) >= (tfreq*4/desiredfps))
ltime=ttime;
else
ltime+=tfreq/desiredfps;
}

View File

@ -0,0 +1,23 @@
/* FCE Ultra Network Play Server
*
* Copyright notice for this file:
* Copyright (C) 2004 Xodnizel
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
* */
void RefreshThrottleFPS(int divooder);
void SpeedThrottle(void);

View File

@ -0,0 +1,38 @@
/* FCE Ultra Network Play Server
*
* Copyright notice for this file:
* Copyright (C) 2004 Xodnizel
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef __FCEU_TYPES
#define __FCEU_TYPES
#include <inttypes.h>
typedef int8_t int8;
typedef int16_t int16;
typedef int32_t int32;
typedef uint8_t uint8;
typedef uint16_t uint16;
typedef uint32_t uint32;
typedef unsigned long long uint64;
typedef long long int64;
#define INLINE inline
#define GINLINE inline
#endif

View File

@ -0,0 +1,22 @@
[Desktop Entry]
Type=Application
Version=1.0
Name=Fceux
GenericName=NES/Famicom emulator
NoDisplay=false
Comment=Emulate NES ROMs
Exec=/usr/bin/fceux
Icon=/usr/share/pixmaps/fceux.png
Terminal=false
MimeType=application/x-nes-rom
Categories=Game;Emulator;
Encoding=UTF-8
Actions=Fullscreen;DefaultConfig;
[Desktop Action Fullscreen]
Name=Open in Fullscreen
Exec=fceux -f 1
OnlyShowIn=Unity
[Desktop Action DefaultConfig]
Name=Start With the Default Configuration
Exec=fceux --no-config 1
OnlyShowIn=Unity

BIN
branches/sdl2/fceux.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 583 B

View File

@ -0,0 +1,339 @@
GNU GENERAL PUBLIC LICENSE
Version 2, June 1991
Copyright (C) 1989, 1991 Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
Preamble
The licenses for most software are designed to take away your
freedom to share and change it. By contrast, the GNU General Public
License is intended to guarantee your freedom to share and change free
software--to make sure the software is free for all its users. This
General Public License applies to most of the Free Software
Foundation's software and to any other program whose authors commit to
using it. (Some other Free Software Foundation software is covered by
the GNU Lesser General Public License instead.) You can apply it to
your programs, too.
When we speak of free software, we are referring to freedom, not
price. Our General Public Licenses are designed to make sure that you
have the freedom to distribute copies of free software (and charge for
this service if you wish), that you receive source code or can get it
if you want it, that you can change the software or use pieces of it
in new free programs; and that you know you can do these things.
To protect your rights, we need to make restrictions that forbid
anyone to deny you these rights or to ask you to surrender the rights.
These restrictions translate to certain responsibilities for you if you
distribute copies of the software, or if you modify it.
For example, if you distribute copies of such a program, whether
gratis or for a fee, you must give the recipients all the rights that
you have. You must make sure that they, too, receive or can get the
source code. And you must show them these terms so they know their
rights.
We protect your rights with two steps: (1) copyright the software, and
(2) offer you this license which gives you legal permission to copy,
distribute and/or modify the software.
Also, for each author's protection and ours, we want to make certain
that everyone understands that there is no warranty for this free
software. If the software is modified by someone else and passed on, we
want its recipients to know that what they have is not the original, so
that any problems introduced by others will not reflect on the original
authors' reputations.
Finally, any free program is threatened constantly by software
patents. We wish to avoid the danger that redistributors of a free
program will individually obtain patent licenses, in effect making the
program proprietary. To prevent this, we have made it clear that any
patent must be licensed for everyone's free use or not licensed at all.
The precise terms and conditions for copying, distribution and
modification follow.
GNU GENERAL PUBLIC LICENSE
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
0. This License applies to any program or other work which contains
a notice placed by the copyright holder saying it may be distributed
under the terms of this General Public License. The "Program", below,
refers to any such program or work, and a "work based on the Program"
means either the Program or any derivative work under copyright law:
that is to say, a work containing the Program or a portion of it,
either verbatim or with modifications and/or translated into another
language. (Hereinafter, translation is included without limitation in
the term "modification".) Each licensee is addressed as "you".
Activities other than copying, distribution and modification are not
covered by this License; they are outside its scope. The act of
running the Program is not restricted, and the output from the Program
is covered only if its contents constitute a work based on the
Program (independent of having been made by running the Program).
Whether that is true depends on what the Program does.
1. You may copy and distribute verbatim copies of the Program's
source code as you receive it, in any medium, provided that you
conspicuously and appropriately publish on each copy an appropriate
copyright notice and disclaimer of warranty; keep intact all the
notices that refer to this License and to the absence of any warranty;
and give any other recipients of the Program a copy of this License
along with the Program.
You may charge a fee for the physical act of transferring a copy, and
you may at your option offer warranty protection in exchange for a fee.
2. You may modify your copy or copies of the Program or any portion
of it, thus forming a work based on the Program, and copy and
distribute such modifications or work under the terms of Section 1
above, provided that you also meet all of these conditions:
a) You must cause the modified files to carry prominent notices
stating that you changed the files and the date of any change.
b) You must cause any work that you distribute or publish, that in
whole or in part contains or is derived from the Program or any
part thereof, to be licensed as a whole at no charge to all third
parties under the terms of this License.
c) If the modified program normally reads commands interactively
when run, you must cause it, when started running for such
interactive use in the most ordinary way, to print or display an
announcement including an appropriate copyright notice and a
notice that there is no warranty (or else, saying that you provide
a warranty) and that users may redistribute the program under
these conditions, and telling the user how to view a copy of this
License. (Exception: if the Program itself is interactive but
does not normally print such an announcement, your work based on
the Program is not required to print an announcement.)
These requirements apply to the modified work as a whole. If
identifiable sections of that work are not derived from the Program,
and can be reasonably considered independent and separate works in
themselves, then this License, and its terms, do not apply to those
sections when you distribute them as separate works. But when you
distribute the same sections as part of a whole which is a work based
on the Program, the distribution of the whole must be on the terms of
this License, whose permissions for other licensees extend to the
entire whole, and thus to each and every part regardless of who wrote it.
Thus, it is not the intent of this section to claim rights or contest
your rights to work written entirely by you; rather, the intent is to
exercise the right to control the distribution of derivative or
collective works based on the Program.
In addition, mere aggregation of another work not based on the Program
with the Program (or with a work based on the Program) on a volume of
a storage or distribution medium does not bring the other work under
the scope of this License.
3. You may copy and distribute the Program (or a work based on it,
under Section 2) in object code or executable form under the terms of
Sections 1 and 2 above provided that you also do one of the following:
a) Accompany it with the complete corresponding machine-readable
source code, which must be distributed under the terms of Sections
1 and 2 above on a medium customarily used for software interchange; or,
b) Accompany it with a written offer, valid for at least three
years, to give any third party, for a charge no more than your
cost of physically performing source distribution, a complete
machine-readable copy of the corresponding source code, to be
distributed under the terms of Sections 1 and 2 above on a medium
customarily used for software interchange; or,
c) Accompany it with the information you received as to the offer
to distribute corresponding source code. (This alternative is
allowed only for noncommercial distribution and only if you
received the program in object code or executable form with such
an offer, in accord with Subsection b above.)
The source code for a work means the preferred form of the work for
making modifications to it. For an executable work, complete source
code means all the source code for all modules it contains, plus any
associated interface definition files, plus the scripts used to
control compilation and installation of the executable. However, as a
special exception, the source code distributed need not include
anything that is normally distributed (in either source or binary
form) with the major components (compiler, kernel, and so on) of the
operating system on which the executable runs, unless that component
itself accompanies the executable.
If distribution of executable or object code is made by offering
access to copy from a designated place, then offering equivalent
access to copy the source code from the same place counts as
distribution of the source code, even though third parties are not
compelled to copy the source along with the object code.
4. You may not copy, modify, sublicense, or distribute the Program
except as expressly provided under this License. Any attempt
otherwise to copy, modify, sublicense or distribute the Program is
void, and will automatically terminate your rights under this License.
However, parties who have received copies, or rights, from you under
this License will not have their licenses terminated so long as such
parties remain in full compliance.
5. You are not required to accept this License, since you have not
signed it. However, nothing else grants you permission to modify or
distribute the Program or its derivative works. These actions are
prohibited by law if you do not accept this License. Therefore, by
modifying or distributing the Program (or any work based on the
Program), you indicate your acceptance of this License to do so, and
all its terms and conditions for copying, distributing or modifying
the Program or works based on it.
6. Each time you redistribute the Program (or any work based on the
Program), the recipient automatically receives a license from the
original licensor to copy, distribute or modify the Program subject to
these terms and conditions. You may not impose any further
restrictions on the recipients' exercise of the rights granted herein.
You are not responsible for enforcing compliance by third parties to
this License.
7. If, as a consequence of a court judgment or allegation of patent
infringement or for any other reason (not limited to patent issues),
conditions are imposed on you (whether by court order, agreement or
otherwise) that contradict the conditions of this License, they do not
excuse you from the conditions of this License. If you cannot
distribute so as to satisfy simultaneously your obligations under this
License and any other pertinent obligations, then as a consequence you
may not distribute the Program at all. For example, if a patent
license would not permit royalty-free redistribution of the Program by
all those who receive copies directly or indirectly through you, then
the only way you could satisfy both it and this License would be to
refrain entirely from distribution of the Program.
If any portion of this section is held invalid or unenforceable under
any particular circumstance, the balance of the section is intended to
apply and the section as a whole is intended to apply in other
circumstances.
It is not the purpose of this section to induce you to infringe any
patents or other property right claims or to contest validity of any
such claims; this section has the sole purpose of protecting the
integrity of the free software distribution system, which is
implemented by public license practices. Many people have made
generous contributions to the wide range of software distributed
through that system in reliance on consistent application of that
system; it is up to the author/donor to decide if he or she is willing
to distribute software through any other system and a licensee cannot
impose that choice.
This section is intended to make thoroughly clear what is believed to
be a consequence of the rest of this License.
8. If the distribution and/or use of the Program is restricted in
certain countries either by patents or by copyrighted interfaces, the
original copyright holder who places the Program under this License
may add an explicit geographical distribution limitation excluding
those countries, so that distribution is permitted only in or among
countries not thus excluded. In such case, this License incorporates
the limitation as if written in the body of this License.
9. The Free Software Foundation may publish revised and/or new versions
of the General Public License from time to time. Such new versions will
be similar in spirit to the present version, but may differ in detail to
address new problems or concerns.
Each version is given a distinguishing version number. If the Program
specifies a version number of this License which applies to it and "any
later version", you have the option of following the terms and conditions
either of that version or of any later version published by the Free
Software Foundation. If the Program does not specify a version number of
this License, you may choose any version ever published by the Free Software
Foundation.
10. If you wish to incorporate parts of the Program into other free
programs whose distribution conditions are different, write to the author
to ask for permission. For software which is copyrighted by the Free
Software Foundation, write to the Free Software Foundation; we sometimes
make exceptions for this. Our decision will be guided by the two goals
of preserving the free status of all derivatives of our free software and
of promoting the sharing and reuse of software generally.
NO WARRANTY
11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
REPAIR OR CORRECTION.
12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
POSSIBILITY OF SUCH DAMAGES.
END OF TERMS AND CONDITIONS
How to Apply These Terms to Your New Programs
If you develop a new program, and you want it to be of the greatest
possible use to the public, the best way to achieve this is to make it
free software which everyone can redistribute and change under these terms.
To do so, attach the following notices to the program. It is safest
to attach them to the start of each source file to most effectively
convey the exclusion of warranty; and each file should have at least
the "copyright" line and a pointer to where the full notice is found.
<one line to give the program's name and a brief idea of what it does.>
Copyright (C) <year> <name of author>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
Also add information on how to contact you by electronic and paper mail.
If the program is interactive, make it output a short notice like this
when it starts in an interactive mode:
Gnomovision version 69, Copyright (C) year name of author
Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
This is free software, and you are welcome to redistribute it
under certain conditions; type `show c' for details.
The hypothetical commands `show w' and `show c' should show the appropriate
parts of the General Public License. Of course, the commands you use may
be called something other than `show w' and `show c'; they could even be
mouse-clicks or menu items--whatever suits your program.
You should also get your employer (if you work as a programmer) or your
school, if any, to sign a "copyright disclaimer" for the program, if
necessary. Here is a sample; alter the names:
Yoyodyne, Inc., hereby disclaims all copyright interest in the program
`Gnomovision' (which makes passes at compilers) written by James Hacker.
<signature of Ty Coon>, 1 April 1989
Ty Coon, President of Vice
This General Public License does not permit incorporating your program into
proprietary programs. If your program is a subroutine library, you may
consider it more useful to permit linking proprietary applications with the
library. If this is what you want to do, use the GNU Lesser General
Public License instead of this License.

View File

@ -0,0 +1,17 @@
PREFIX = /usr
OUTFILE = getSDLKey
CC = g++
OBJS = getSDLKey.o
LIBS = $(shell sdl-config --cflags --libs)
all: ${OBJS}
${CC} -o ${OUTFILE} ${OBJS} ${LIBS}
clean:
rm -f ${OUTFILE} ${OBJS}
install:
install -m 755 -D getSDLKey ${PREFIX}/bin/getSDLKey
getSDLKey.o = getSDLKey.cpp

View File

@ -0,0 +1,27 @@
#############################################
# getSDLKey - Lukas Sabota - October, 2011 #
#############################################
1. Dependencies:
gcc
make
libsdl
2. Installing
Run "make" to compile to "getSDLKey". Run "make install" as root if you would like to install "getSDLKey" into a user-specified PREFIX.
3. Running
Type "./getSDLKey" while in this directory to run.
4. About this tool.
This is a tool to determine what the SDL keysym for a particular key on your keyboard is. This is especially useful when mapping hotkeys to FCEUX. Take a look at an excerpt of ~/.fceux/fceux.cfg:
SDL.Hotkeys.SaveState = 286
Apparently, F5 on my system is SDL keysym 286. If you wanted to remap this to a different key, run ./getSDLKey and press the desired key to see what keysym you should modify your configuration with.
5. Bugs
You can report any issues with this tool in the FCEUX SourceForge bugtracker. Alternatively, you can contact me directly at LTsmooth42 _at_ gmail _dot_ com.
6. Future
I plan to implement a GUI for remapping these keys so you dont have to do this in the future, but were all very busy people, arent we?

View File

@ -0,0 +1,90 @@
/////////////////////////////////////////////////////////////////
// getSDLKey.cpp
// Lukas Sabota - October, 2011
//
// Prints the corresponding SDL keysym for a key pressed
// into a SDL window. Useful for remapping hotkeys in they
// ~/.fceux/fceux.cfg config file, but may be useful for other
// applications as well.
//
/////////////////////////////////////////////////////////////////
#include<SDL/SDL.h>
void DisplayState(SDL_KeyboardEvent *key)
{
if (key->type == SDL_KEYUP)
printf("RELEASED: ");
else
printf("PRESSED: ");
}
void DisplayModifiers(SDL_KeyboardEvent *key)
{
SDLMod modifier = key->keysym.mod;
if( modifier & KMOD_NUM ) printf( "NUMLOCK " );
if( modifier & KMOD_CAPS ) printf( "CAPSLOCK " );
if( modifier & KMOD_MODE ) printf( "MODE " );
if( modifier & KMOD_LCTRL ) printf( "LCTRL " );
if( modifier & KMOD_RCTRL ) printf( "RCTRL " );
if( modifier & KMOD_LSHIFT ) printf( "LSHIFT " );
if( modifier & KMOD_RSHIFT ) printf( "RSHIFT " );
if( modifier & KMOD_LALT ) printf( "LALT " );
if( modifier & KMOD_RALT ) printf( "RALT " );
if( modifier & KMOD_LMETA ) printf( "LMETA " );
if( modifier & KMOD_RMETA ) printf( "RMETA " );
}
void DisplayKey(SDL_KeyboardEvent *key)
{
printf( "%s\n", SDL_GetKeyName(key->keysym.sym));
}
void DisplayKeysym(SDL_KeyboardEvent *key)
{
printf ("%d\n", key->keysym.sym);
}
int main(int argc, char** argv)
{
SDL_Surface *screen;
if (SDL_Init(SDL_INIT_VIDEO) != 0)
{
printf("Unable to initialize SDL: %s\n", SDL_GetError());
return 1;
}
atexit(SDL_Quit);
screen = SDL_SetVideoMode(320, 240, 0, SDL_ANYFORMAT);
SDL_WM_SetCaption("Get SDL Keysyms! Now 50\% off!", NULL);
if (screen == NULL)
{
printf("Unable to set video mode: %s\n", SDL_GetError());
return 1;
}
SDL_Event event;
int running = 1;
while(running) {
while(SDL_PollEvent(&event)) {
switch(event.type){
case SDL_KEYDOWN:
case SDL_KEYUP:
DisplayState(&event.key);
DisplayModifiers(&event.key);
DisplayKey(&event.key);
DisplayKeysym(&event.key);
break;
case SDL_QUIT:
running = 0;
break;
}
}
}
return 0;
}

15
branches/sdl2/output/.gitignore vendored Normal file
View File

@ -0,0 +1,15 @@
/7z.dll
/auxlib.lua
/cheats
/disksys.rom
/fceux.cfg
/fceux.chm
/fceux.chw
/fceux.exe
/fceux.exp
/fceux.lib
/fceux.pdb
/fcs
/movies
/sav
/snaps

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -0,0 +1,121 @@
-- Script by amaurea, andymac and feos for FCEUX 2.2.0 and earlier versions.
-- Allows customizable recording of Frame, Lag, Timer and Input display to AVI dump.
-- Drag and drop HUD items with mouse, use Numpad 1-6 to switch them on/off.
print("Drag and drop HUD items with mouse, use Numpad 1-6 to switch them on/off.")
screen = {w=256,h=231}
move = {object=nil,offx=0,offy=0}
pads = {
{num=1,on=true, color="red", x=9, y=220,w=34,h=10,toggle="numpad1"},
{num=2,on=true, color="yellow",x=54, y=220,w=34,h=10,toggle="numpad2"},
{num=3,on=false,color="green", x=99, y=220,w=34,h=10,toggle="numpad3"},
{num=4,on=false,color="orange",x=144,y=220,w=34,h=10,toggle="numpad4"}
}
buttons = {
A = {x=30,y=5,w=3,h=3},
B = {x=24,y=5,w=3,h=3},
select = {x=18,y=7,w=3,h=1},
start = {x=12,y=7,w=3,h=1},
up = {x=4, y=1,w=2,h=2},
down = {x=4, y=7,w=2,h=2},
left = {x=1, y=4,w=2,h=2},
right = {x=7, y=4,w=2,h=2}
}
text = {on=true,x=1, y=9,w=30,h=16,toggle="numpad5"}
timer = {on=true,x=197,y=9,w=58,h= 7,toggle="numpad6"}
function drawpad(pad)
gui.drawbox( pad.x, pad.y, pad.x+pad.w, pad.y+pad.h, "#3070ffb0" )
gui.drawbox( pad.x+4, pad.y+4, pad.x+6, pad.y+6, "black" )
controller = joypad.read(pad.num)
for name, b in pairs(buttons) do
gui.drawbox( pad.x + b.x, pad.y + b.y, pad.x + b.x + b.w, pad.y + b.y + b.h,
controller[name] and pad.color or "black" )
end
end
function mouseover(pad, margin)
return keys.xmouse >= pad.x-margin and keys.xmouse <= pad.x+pad.w+margin and
keys.ymouse >= pad.y-margin and keys.ymouse <= pad.y+pad.h+margin
end
function inrange(upper, lower, testval)
if testval >= upper then return upper
elseif testval <= lower then return lower
else return testval
end
end
function concat(tables)
local res = {}
for _, tab in ipairs(tables) do
for _, val in ipairs(tab) do
table.insert(res, val)
end
end
return res
end
prev_keys = input.get()
objects = concat({pads, {text, timer}})
function everything()
keys = input.get()
-- Are we moving anything around?
if move.object then
if keys["leftclick"] then
-- Do not go outside screen
local safex = inrange(screen.w - move.object.w, 0, keys.xmouse - move.offx)
local safey = inrange(screen.h - move.object.h, 8, keys.ymouse - move.offy)
move.object.x = safex
move.object.y = safey
else move.object = nil end
-- Try to pick something up
elseif keys["leftclick"] then
for _,object in ipairs(objects) do
if mouseover(object,0) then
move.object = object
move.offx = keys.xmouse - object.x
move.offy = keys.ymouse - object.y
end
end
end
-- Toggle displays
for _, object in ipairs(objects) do
if keys[object.toggle] and not prev_keys[object.toggle] then
object.on = not object.on
end
end
-- Actually draw the stuff
if timer.on then
mins = math.floor(movie.framecount()/3600)
secs = movie.framecount()/60-mins*60
gui.text( timer.x, timer.y, string.format("%s:%05.2f",os.date("!%H:%M",mins*60),secs), "white" )
end
if text.on then
local done = movie.mode() == "finished" or movie.mode() == nil
gui.text( text.x, text.y, movie.framecount(), done and "red" or "white" )
gui.text( text.x, text.y + 9, FCEU.lagcount(), FCEU.lagged() and "red" or "green" )
end
for _, pad in ipairs(pads) do
if pad.on then drawpad(pad) end
end
prev_keys = keys
end
gui.register(everything)
while (true) do
FCEU.frameadvance()
end

View File

@ -0,0 +1,589 @@
---------------------------------------------------------------------------
-- Boulder Dash - Displaying Amoeba Pointer Movements
-- by AnS, 2012
-- requested by CtrlAltDestroy
---------------------------------------------------------------------------
-- Showcases following functions:
-- * memory.registerexec()
---------------------------------------------------------------------------
-- Usage:
-- Start playing any level of the BoulderDash that has the Amoeba enemy,
-- for example Level 2-3, Level 4-1 or Level 6-3.
-- Come close to the Amoeba enemy and see if you can find any regularities
-- in its movement. When you are convinced that its behavior is completely
-- erratic, run the script and unpause emulation. Now the script will draw
-- various arrows that show you the actual rules of the enemy AI.
--
-- You can control the "playback slider" in the bottom of the screen (click
-- or drag it with mouse). Also you can pause and unpause this mini-playback
-- while the emulator is still paused. This is necessary because the Amoeba
-- makes a new set of moves every 8 frames, and this time span is not enough
-- for you to replay all the logged events.
---------------------------------------------------------------------------
-- Explanations:
-- The Amoeba AI is defined by UpdateAmoeba() function (see the disassembly
-- code at the end of this script).
-- The UpdateAmoeba() makes many steps with the Amoeba Pointer (so the arrow
-- may move from tile to tile 100-200 times within the span of one frame!
-- This complexity makes it look unpredictable for player, even though the
-- rules of movement are very simple (move clockwise, rotate anticlockwise).
--
-- This script allows you to see all steps of this Pointer, so you can grasp
-- the logic of Amoeba movement/multiplication. The script registers hooks
-- to all essential points of the UpdateAmoeba() code, and logs the whole
-- process of the function execution. Then it pauses emulation and replays
-- the log of events by drawing arrows over the game sprites.
-- The log auto-resets at the beginning of every new call of UpdateAmoeba().
--
-- Similar approach can be used for displaying complex AI in other games.
---------------------------------------------------------------------------
-- constants
CELL_SIZE = 16;
CELL_HALFSIZE = CELL_SIZE / 2;
UPPER_BORDER_SIZE = 64;
LEFT_BORDER_SIZE = 32;
INTRO_DELAY = 1;
OUTRO_DELAY = 1;
MAX_ARROW_SIZE = 9;
PAUSE_BUTTON_X = 2;
PAUSE_BUTTON_Y = 172;
PAUSE_BUTTON_WIDTH = 16;
PAUSE_BUTTON_HEIGHT = 16;
TIMELINE_X = 20;
TIMELINE_LENGTH = 232;
TIMELINE_HEIGHT = 8;
TIMELINE_Y = 180;
ColorStatuses = { "#00A000FF", "#00FF00FF", "#A0A0A0FF", "#00FFFFFF", "#FFFFFFFF", "#C0C000FF" };
STATUS_NORMAL = 1; -- Green: Normal movements
STATUS_ROTATED = 2; -- Light-green: just rotated 90 degrees (anticlockwise) relative to current movement direction
STATUS_BUMPED = 3; -- Grey: bumped into obstacle
STATUS_SET = 4; -- Blue: Set amoeba
STATUS_REFUSED = 5; -- White: Refused to set amoeba
STATUS_END = 6; -- Yellow: RTS from UpdateAmoeba
-- variables
animation_timer = 0;
current_step = 0;
animation_speed = 0.5;
animation_paused = false;
mouse_held = false;
dragging_timeline = false;
log_size = 0;
creation_frame = -1;
-- arrays for storing the log data
Amoeba_X = {};
Amoeba_Y = {};
AmoebaDirection = {};
AmoebaPhase = {};
AmoebaTimer = {};
ColorStatus = {};
------------------------------------------------------------------------
function reset_log()
log_size = 0;
animation_timer = 0;
creation_frame = movie.framecount();
emu.pause();
end
function append_log_normal()
log_size = log_size + 1;
Amoeba_X[log_size] = memory.readbyte(0x0050); -- Temp_X
Amoeba_Y[log_size] = memory.readbyte(0x004F); -- Temp_Y
AmoebaDirection[log_size] = memory.readbyte(0x004E); -- Temp_AmoebaDirection
AmoebaPhase[log_size] = memory.readbyte(0x00B7);
AmoebaTimer[log_size] = memory.readbyte(0x00BD);
ColorStatus[log_size] = STATUS_NORMAL; -- Green: Normal movements
end
function append_log_rotated()
log_size = log_size + 1;
Amoeba_X[log_size] = memory.readbyte(0x0050); -- Temp_X
Amoeba_Y[log_size] = memory.readbyte(0x004F); -- Temp_Y
AmoebaDirection[log_size] = memory.readbyte(0x004E); -- Temp_AmoebaDirection
AmoebaPhase[log_size] = memory.readbyte(0x00B7);
AmoebaTimer[log_size] = memory.readbyte(0x00BD);
ColorStatus[log_size] = STATUS_ROTATED; -- Light-green: just rotated 90 degrees (anticlockwise) relative to current movement direction
end
function append_log_bumped()
log_size = log_size + 1;
Amoeba_X[log_size] = memory.readbyte(0x0050); -- Temp_X
Amoeba_Y[log_size] = memory.readbyte(0x004F); -- Temp_Y
AmoebaDirection[log_size] = memory.readbyte(0x004E); -- Temp_AmoebaDirection
AmoebaPhase[log_size] = memory.readbyte(0x00B7);
AmoebaTimer[log_size] = memory.readbyte(0x00BD);
ColorStatus[log_size] = STATUS_BUMPED; -- Grey: bumped into obstacle
end
function append_log_set()
log_size = log_size + 1;
Amoeba_X[log_size] = memory.readbyte(0x0050); -- Temp_X
Amoeba_Y[log_size] = memory.readbyte(0x004F); -- Temp_Y
AmoebaDirection[log_size] = memory.readbyte(0x004E); -- Temp_AmoebaDirection
AmoebaPhase[log_size] = memory.readbyte(0x00B7);
AmoebaTimer[log_size] = memory.readbyte(0x00BD);
ColorStatus[log_size] = STATUS_SET; -- Blue: Set amoeba
end
function append_log_refused()
log_size = log_size + 1;
Amoeba_X[log_size] = memory.readbyte(0x0050); -- Temp_X
Amoeba_Y[log_size] = memory.readbyte(0x004F); -- Temp_Y
AmoebaDirection[log_size] = memory.readbyte(0x004E); -- Temp_AmoebaDirection
AmoebaPhase[log_size] = memory.readbyte(0x00B7);
AmoebaTimer[log_size] = memory.readbyte(0x00BD);
ColorStatus[log_size] = STATUS_REFUSED; -- White: Refused to set amoeba
end
function append_log_rts()
log_size = log_size + 1;
Amoeba_X[log_size] = memory.readbyte(0x00BC);
AmoebaDirectionAnd_Y = memory.readbyte(0x00BB);
Amoeba_Y[log_size] = AND(AmoebaDirectionAnd_Y, 0x3F);
AmoebaDirection[log_size] = AND(AmoebaDirectionAnd_Y, 0xC0);
AmoebaPhase[log_size] = memory.readbyte(0x00B7);
AmoebaTimer[log_size] = memory.readbyte(0x00BD);
ColorStatus[log_size] = STATUS_END; -- Yellow: RTS from UpdateAmoeba
end
------------------------------------------------------------------------
function DrawArrow(x, y, direction, size, color)
x = x + CELL_HALFSIZE;
y = y + CELL_HALFSIZE;
if (direction == 00) then
-- Left
gui.line(x, y - size, x - size, y, color);
gui.line(x - size, y, x, y + size, color);
gui.line(x, y + size, x, y - size, color);
end
if (direction == 0x40) then
-- up
gui.line(x - size, y, x, y - size, color);
gui.line(x, y - size, x + size, y, color);
gui.line(x + size, y, x - size, y, color);
end
if (direction == 0x80) then
-- Right
gui.line(x, y - size, x + size, y, color);
gui.line(x + size, y, x, y + size, color);
gui.line(x, y + size, x, y - size, color);
end
if (direction == 0xC0) then
-- Down
gui.line(x - size, y, x, y + size, color);
gui.line(x, y + size, x + size, y, color);
gui.line(x + size, y, x - size, y, color);
end
end
------------------------------------------------------------------------
-- This function is called every frame when the emulator is unpaused,
-- and 20 times per second when the emulator is paused.
function update()
AmoebaOrigin_X = memory.readbyte(0x00B9);
AmoebaOriginDirectionAnd_Y = memory.readbyte(0x00B8);
AmoebaOrigin_Y = AND(AmoebaOriginDirectionAnd_Y, 0x3F);
AmoebaOriginDirection = AND(AmoebaOriginDirectionAnd_Y, 0xC0);
Camera_X_Lo = memory.readbyte(0x00BE);
Camera_X_Hi = memory.readbyte(0x00BF);
Camera_Y_Lo = memory.readbyte(0x00C0);
Camera_Y_Hi = memory.readbyte(0x00C1);
Camera_X = (256 * Camera_X_Hi + Camera_X_Lo) - UPPER_BORDER_SIZE;
Camera_Y = (256 * Camera_Y_Hi + Camera_Y_Lo) - LEFT_BORDER_SIZE;
if (log_size > 0) then
inp = input.get()
if (inp.leftclick) then
xm = inp.xmouse
ym = inp.ymouse
-- check click on the Pause/Resume button
if (not mouse_held) then
if (xm >= PAUSE_BUTTON_X and ym >= PAUSE_BUTTON_Y and xm < PAUSE_BUTTON_X + PAUSE_BUTTON_WIDTH and ym < PAUSE_BUTTON_Y + PAUSE_BUTTON_HEIGHT) then
animation_paused = not animation_paused;
end
end
-- check click on the timeline
if (dragging_timeline or (xm >= TIMELINE_X and ym >= TIMELINE_Y - TIMELINE_HEIGHT and xm < TIMELINE_X + TIMELINE_LENGTH and ym < TIMELINE_Y + TIMELINE_HEIGHT)) then
shift = xm - TIMELINE_X;
if (shift < 0) then
shift = 0;
else
if (shift > TIMELINE_LENGTH) then shift = TIMELINE_LENGTH; end
end
animation_timer = (INTRO_DELAY + log_size + OUTRO_DELAY) * shift / TIMELINE_LENGTH;
dragging_timeline = true;
end
mouse_held = true;
else
mouse_held = false;
dragging_timeline = false;
end
if (not animation_paused and not mouse_held) then
-- animate
animation_timer = animation_timer + animation_speed;
if (animation_timer > INTRO_DELAY + log_size + OUTRO_DELAY) then
animation_timer = 0;
end
end
current_step = math.floor(animation_timer - INTRO_DELAY);
if (current_step > log_size) then
current_step = log_size;
else
if (current_step < 1) then current_step = 1; end
end
-- show info
if (ColorStatus[current_step] == STATUS_END) then
-- emphasize the phase change by yellow
gui.text(3, 11, "AmoebaPhase = " .. AND(AmoebaPhase[current_step], 3), "yellow");
else
gui.text(3, 11, "AmoebaPhase = " .. AND(AmoebaPhase[current_step], 3));
end
if ((ColorStatus[current_step] == STATUS_SET) or (ColorStatus[current_step] == STATUS_REFUSED)) then
-- emphasize the decrement by red
gui.text(3, 20, "AmoebaTimer = " .. AmoebaTimer[current_step], "red");
else
gui.text(3, 20, "AmoebaTimer = " .. AmoebaTimer[current_step]);
end
-- draw origin
DrawArrow(AmoebaOrigin_X * CELL_SIZE - Camera_X, AmoebaOrigin_Y * CELL_SIZE - Camera_Y, AmoebaOriginDirection, 5, "#00FFFFFF");
-- draw tail of pointers
for i = (MAX_ARROW_SIZE - 1), 0, -1 do
step = current_step - i;
if (step > 0) then
for s = 1, (MAX_ARROW_SIZE - i) do
-- draw previous position of pointer
DrawArrow(Amoeba_X[step] * CELL_SIZE - Camera_X, Amoeba_Y[step] * CELL_SIZE - Camera_Y, AmoebaDirection[step], s, ColorStatuses[ColorStatus[step]]);
end
end
end
-- draw black border around the last (current) pointer
DrawArrow(Amoeba_X[current_step] * CELL_SIZE - Camera_X, Amoeba_Y[current_step] * CELL_SIZE - Camera_Y, AmoebaDirection[current_step], MAX_ARROW_SIZE + 1, "black");
-- draw GUI
-- Pause/Resume button
gui.box(PAUSE_BUTTON_X, PAUSE_BUTTON_Y, PAUSE_BUTTON_X + PAUSE_BUTTON_WIDTH, PAUSE_BUTTON_Y + PAUSE_BUTTON_HEIGHT, "grey", "black");
if (animation_paused) then
for s = 1, 6 do
DrawArrow(PAUSE_BUTTON_X - 2, PAUSE_BUTTON_Y, 0x80, s, "black");
end
else
gui.box(PAUSE_BUTTON_X + (PAUSE_BUTTON_WIDTH / 2) - 3, PAUSE_BUTTON_Y + 3, PAUSE_BUTTON_X + (PAUSE_BUTTON_WIDTH / 2) - 1, PAUSE_BUTTON_Y + PAUSE_BUTTON_HEIGHT - 3, "black", "black");
gui.box(PAUSE_BUTTON_X + (PAUSE_BUTTON_WIDTH / 2) + 3, PAUSE_BUTTON_Y + 3, PAUSE_BUTTON_X + (PAUSE_BUTTON_WIDTH / 2) + 1, PAUSE_BUTTON_Y + PAUSE_BUTTON_HEIGHT - 3, "black", "black");
end
-- line
gui.box(TIMELINE_X, TIMELINE_Y - TIMELINE_HEIGHT, TIMELINE_X + TIMELINE_LENGTH, TIMELINE_Y + TIMELINE_HEIGHT, "#00000040", "black");
gui.box(TIMELINE_X, TIMELINE_Y - 1, TIMELINE_X + TIMELINE_LENGTH, TIMELINE_Y + 1, "white", "black");
-- slider
shift = TIMELINE_LENGTH * animation_timer / (INTRO_DELAY + log_size + OUTRO_DELAY);
gui.box(TIMELINE_X + shift - 1, TIMELINE_Y - TIMELINE_HEIGHT, TIMELINE_X + shift + 1, TIMELINE_Y + TIMELINE_HEIGHT, "grey", "black");
-- info
gui.text(TIMELINE_X + 80 + creation_frame % 3, TIMELINE_Y + TIMELINE_HEIGHT + 2, "Displaying " .. current_step .. " / " .. log_size);
gui.text(TIMELINE_X + 80 + creation_frame % 3, TIMELINE_Y + TIMELINE_HEIGHT + 11, "Created at frame " .. creation_frame);
end
end
------------------------------------------------------------------------
gui.register(update);
memory.registerexec(0xCE60, reset_log); -- ReallyUpdateAmoeba
--memory.registerexec(0xCE66, reset_log); -- RestartFromOrigin
memory.registerexec(0xCE95, append_log_normal); -- TryMultiplying_Left
memory.registerexec(0xCEAE, append_log_normal); -- TryMultiplying_Up
memory.registerexec(0xCEC7, append_log_normal); -- TryMultiplying_Right
memory.registerexec(0xCEE0, append_log_normal); -- TryMultiplying_Down
memory.registerexec(0xCEF9, append_log_normal); -- TryMultiplying_Left2
memory.registerexec(0xCF12, append_log_normal); -- TryMultiplying_Up2
memory.registerexec(0xCF2B, append_log_normal); -- TryMultiplying_Right2
memory.registerexec(0xCEA3, append_log_rotated); -- Rotated from left to down
memory.registerexec(0xCEBC, append_log_rotated); -- Rotated from up to left
memory.registerexec(0xCED5, append_log_rotated); -- Rotated from right to up
memory.registerexec(0xCEEE, append_log_rotated); -- Rotated from down to right
memory.registerexec(0xCF07, append_log_rotated); -- Rotated from left to down
memory.registerexec(0xCF20, append_log_rotated); -- Rotated from up to left
memory.registerexec(0xCF39, append_log_rotated); -- Rotated from right to up
memory.registerexec(0xCE9C, append_log_bumped); -- Bumped into obstacle
memory.registerexec(0xCEB5, append_log_bumped); -- Bumped into obstacle
memory.registerexec(0xCECE, append_log_bumped); -- Bumped into obstacle
memory.registerexec(0xCEE7, append_log_bumped); -- Bumped into obstacle
memory.registerexec(0xCF00, append_log_bumped); -- Bumped into obstacle
memory.registerexec(0xCF19, append_log_bumped); -- Bumped into obstacle
memory.registerexec(0xCF32, append_log_bumped); -- Bumped into obstacle
memory.registerexec(0xCF97, append_log_normal); -- Jumped to another amoeba
memory.registerexec(0xCFA5, append_log_set); -- Set amoeba
memory.registerexec(0xCFA3, append_log_refused); -- Refused to set amoeba
memory.registerexec(0xCF5D, append_log_rts); -- RTS from UpdateAmoeba
------------------------------------------------------------------------
-- Disassembly of the BoulderDash code in question:
--
-- UpdateAmoeba:
-- ; Called every frame, but works only once per 8 frames
-- >01:CE51:A5 B7 LDA AmoebaPhase = #$82
-- 01:CE53:F0 0A BEQ ExitWithoutUpdate
-- 01:CE55:C9 FF CMP #$FF
-- 01:CE57:F0 06 BEQ ExitWithoutUpdate
-- 01:CE59:A5 FE LDA FrameCounter = #$6A
-- 01:CE5B:29 07 AND #$07
-- 01:CE5D:F0 01 BEQ ReallyUpdateAmoeba
-- ExitWithoutUpdate:
-- 01:CE5F:60 RTS -----------------------------------------------------------
-- ReallyUpdateAmoeba:
-- 01:CE60:A5 B7 LDA AmoebaPhase = #$82
-- 01:CE62:29 03 AND #$03
-- 01:CE64:D0 0C BNE PrepareForLoop25
-- RestartFromOrigin:
-- ; Every time the amoeba multiplies or fails to multiply within 32 frames, it restarts to the original point
-- 01:CE66:A9 00 LDA #$00
-- 01:CE68:85 B7 STA AmoebaPhase = #$82
-- 01:CE6A:A5 B8 LDA AmoebaOriginDirectionAnd_Y = #$41
-- 01:CE6C:85 BB STA AmoebaDirectionAnd_Y = #$41
-- 01:CE6E:A5 B9 LDA AmoebaOrigin_X = #$14
-- 01:CE70:85 BC STA Amoeba_X = #$18
-- PrepareForLoop25:
-- 01:CE72:A9 19 LDA #$19
-- 01:CE74:85 4D STA 25Tries = #$0A
-- ; Temp_X = Amoeba_X; Temp_Y = AmoebaDirectionAnd_Y & 00111111b; Temp_AmoebaDirection = AmoebaDirectionAnd_Y & 11000000b
-- 01:CE76:A5 BB LDA AmoebaDirectionAnd_Y = #$41
-- 01:CE78:29 3F AND #$3F
-- 01:CE7A:A8 TAY
-- 01:CE7B:A5 BB LDA AmoebaDirectionAnd_Y = #$41
-- 01:CE7D:29 C0 AND #$C0
-- 01:CE7F:85 4E STA Temp_AmoebaDirection = #$00
-- 01:CE81:A6 BC LDX Amoeba_X = #$18
-- 01:CE83:84 4F STY Temp_Y = #$38
-- 01:CE85:86 50 STX Temp_X = #$0A
-- Loop25Tries:
-- 01:CE87:A5 4E LDA Temp_AmoebaDirection = #$00
-- 01:CE89:C9 40 CMP #$40
-- 01:CE8B:F0 21 BEQ TryMultiplying_Up
-- 01:CE8D:C9 80 CMP #$80
-- 01:CE8F:F0 36 BEQ TryMultiplying_Right
-- 01:CE91:C9 C0 CMP #$C0
-- 01:CE93:F0 4B BEQ TryMultiplying_Down
-- TryMultiplying_Left:
-- 01:CE95:20 5E CF JSR CheckMultiplying_Left
-- 01:CE98:B0 05 BCS NextTimeTryDown
-- 01:CE9A:F0 0A BEQ OkSetAmoeba
-- 01:CE9C:4C AC CE JMP Restore_X
-- NextTimeTryDown:
-- ; Since we just moved the pointer to another amoeba, rotate direction anticlockwise
-- 01:CE9F:A9 C0 LDA #$C0
-- 01:CEA1:85 4E STA Temp_AmoebaDirection = #$00
-- 01:CEA3:4C 44 CF JMP DoUntilAll25TriesExpired
-- OkSetAmoeba:
-- 01:CEA6:20 99 CF JSR IntendToSetAmoebaToMap
-- 01:CEA9:90 01 BCC Restore_X
-- 01:CEAB:60 RTS -----------------------------------------------------------
-- Restore_X:
-- 01:CEAC:E6 50 INC Temp_X = #$0A
-- TryMultiplying_Up:
-- 01:CEAE:20 6A CF JSR CheckMultiplying_Up
-- 01:CEB1:B0 05 BCS NextTimeTryLeft
-- 01:CEB3:F0 0A BEQ OkSetAmoeba
-- 01:CEB5:4C C5 CE JMP Restore_Y
-- NextTimeTryLeft:
-- ; Since we just moved the pointer to another amoeba, rotate direction anticlockwise
-- 01:CEB8:A9 00 LDA #$00
-- 01:CEBA:85 4E STA Temp_AmoebaDirection = #$00
-- 01:CEBC:4C 44 CF JMP DoUntilAll25TriesExpired
-- OkSetAmoeba:
-- 01:CEBF:20 99 CF JSR IntendToSetAmoebaToMap
-- 01:CEC2:90 01 BCC Restore_Y
-- 01:CEC4:60 RTS -----------------------------------------------------------
-- Restore_Y:
-- 01:CEC5:E6 4F INC Temp_Y = #$38
-- TryMultiplying_Right:
-- 01:CEC7:20 76 CF JSR CheckMultiplying_Right
-- 01:CECA:B0 05 BCS NextTimeTryUp
-- 01:CECC:F0 0A BEQ OkSetAmoeba
-- 01:CECE:4C DE CE JMP Restore_X
-- NextTimeTryUp:
-- ; Since we just moved the pointer to another amoeba, rotate direction anticlockwise
-- 01:CED1:A9 40 LDA #$40
-- 01:CED3:85 4E STA Temp_AmoebaDirection = #$00
-- 01:CED5:4C 44 CF JMP DoUntilAll25TriesExpired
-- OkSetAmoeba:
-- 01:CED8:20 99 CF JSR IntendToSetAmoebaToMap
-- 01:CEDB:90 01 BCC Restore_X
-- 01:CEDD:60 RTS -----------------------------------------------------------
-- Restore_X:
-- 01:CEDE:C6 50 DEC Temp_X = #$0A
-- TryMultiplying_Down:
-- 01:CEE3:B0 05 BCS NextTimeTryRight
-- 01:CEE5:F0 0A BEQ OkSetAmoeba
-- 01:CEE7:4C F7 CE JMP Restore_X
-- NextTimeTryRight:
-- ; Since we just moved the pointer to another amoeba, rotate direction anticlockwise
-- 01:CEEA:A9 80 LDA #$80
-- 01:CEEC:85 4E STA Temp_AmoebaDirection = #$00
-- 01:CEEE:4C 44 CF JMP DoUntilAll25TriesExpired
-- OkSetAmoeba:
-- 01:CEF1:20 99 CF JSR IntendToSetAmoebaToMap
-- 01:CEF4:90 01 BCC Restore_X
-- 01:CEF6:60 RTS -----------------------------------------------------------
-- Restore_X:
-- 01:CEF7:C6 4F DEC Temp_Y = #$38
-- TryMultiplying_Left2:
-- 01:CEF9:20 5E CF JSR CheckMultiplying_Left
-- 01:CEFC:B0 05 BCS NextTimeTryDown2
-- 01:CEFE:F0 0A BEQ OkSetAmoeba
-- 01:CF00:4C 10 CF JMP Restore_X
-- NextTimeTryDown2:
-- ; Since we just moved the pointer to another amoeba, rotate direction anticlockwise
-- 01:CF03:A9 C0 LDA #$C0
-- 01:CF05:85 4E STA Temp_AmoebaDirection = #$00
-- 01:CF07:4C 44 CF JMP DoUntilAll25TriesExpired
-- OkSetAmoeba:
-- 01:CF0A:20 99 CF JSR IntendToSetAmoebaToMap
-- 01:CF0D:90 01 BCC Restore_X
-- 01:CF0F:60 RTS -----------------------------------------------------------
-- Restore_X:
-- 01:CF10:E6 50 INC Temp_X = #$0A
-- TryMultiplying_Up2:
-- 01:CF12:20 6A CF JSR CheckMultiplying_Up
-- 01:CF15:B0 05 BCS NextTimeTryLeft2
-- 01:CF17:F0 0A BEQ OkSetAmoeba
-- 01:CF19:4C 29 CF JMP Restore_Y
-- NextTimeTryLeft2:
-- ; Since we just moved the pointer to another amoeba, rotate direction anticlockwise
-- 01:CF1C:A9 00 LDA #$00
-- 01:CF1E:85 4E STA Temp_AmoebaDirection = #$00
-- 01:CF20:4C 44 CF JMP DoUntilAll25TriesExpired
-- OkSetAmoeba:
-- 01:CF23:20 99 CF JSR IntendToSetAmoebaToMap
-- 01:CF26:90 01 BCC Restore_Y
-- 01:CF28:60 RTS -----------------------------------------------------------
-- Restore_Y:
-- 01:CF29:E6 4F INC Temp_Y = #$38
-- TryMultiplying_Right2:
-- 01:CF2B:20 76 CF JSR CheckMultiplying_Right
-- 01:CF2E:B0 05 BCS NextTimeTryUp2
-- 01:CF30:F0 0A BEQ OkSetAmoeba
-- 01:CF32:4C 42 CF JMP Restore_X
-- NextTimeTryUp2:
-- ; Since we just moved the pointer to another amoeba, rotate direction anticlockwise
-- 01:CF35:A9 40 LDA #$40
-- 01:CF37:85 4E STA Temp_AmoebaDirection = #$00
-- 01:CF39:4C 44 CF JMP DoUntilAll25TriesExpired
-- OkSetAmoeba:
-- 01:CF3C:20 99 CF JSR IntendToSetAmoebaToMap
-- 01:CF3F:90 01 BCC Restore_X
-- 01:CF41:60 RTS -----------------------------------------------------------
-- Restore_X:
-- 01:CF42:C6 50 DEC Temp_X = #$0A
-- DoUntilAll25TriesExpired:
-- 01:CF44:C6 4D DEC 25Tries = #$0A
-- 01:CF46:F0 03 BEQ All25TriesExpired
-- 01:CF48:4C 87 CE JMP Loop25Tries
-- All25TriesExpired:
-- ; Exits from UpdateAmoeba
-- 01:CF4B:A5 4F LDA Temp_Y = #$38
-- 01:CF4D:05 4E ORA Temp_AmoebaDirection = #$00
-- 01:CF4F:85 BB STA AmoebaDirectionAnd_Y = #$41
-- 01:CF51:A5 50 LDA Temp_X = #$0A
-- 01:CF53:85 BC STA Amoeba_X = #$18
-- 01:CF55:E6 B7 INC AmoebaPhase = #$82
-- 01:CF57:A5 B7 LDA AmoebaPhase = #$82
-- 01:CF59:29 83 AND #$83
-- 01:CF5B:85 B7 STA AmoebaPhase = #$82
-- 01:CF5D:60 RTS -----------------------------------------------------------
--
-- CheckMultiplying_Left:
-- ; Returns C=1 when the pointer is on another amoeba, Z=1 when can multiply
-- 01:CF5E:A4 4F LDY Temp_Y = #$38
-- 01:CF60:C6 50 DEC Temp_X = #$0A
-- 01:CF62:A6 50 LDX Temp_X = #$0A
-- 01:CF64:20 7D CC JSR GetObjectFromMap
-- 01:CF67:4C 8B CF JMP CheckMultiplying
-- CheckMultiplying_Up:
-- ; Returns C=1 when the pointer is on another amoeba, Z=1 when can multiply
-- 01:CF6A:C6 4F DEC Temp_Y = #$38
-- 01:CF6C:A4 4F LDY Temp_Y = #$38
-- 01:CF6E:A6 50 LDX Temp_X = #$0A
-- 01:CF70:20 7D CC JSR GetObjectFromMap
-- 01:CF73:4C 8B CF JMP CheckMultiplying
-- CheckMultiplying_Right:
-- ; Returns C=1 when the pointer is on another amoeba, Z=1 when can multiply
-- 01:CF76:E6 50 INC Temp_X = #$0A
-- 01:CF78:A4 4F LDY Temp_Y = #$38
-- 01:CF7A:A6 50 LDX Temp_X = #$0A
-- 01:CF7C:20 7D CC JSR GetObjectFromMap
-- 01:CF7F:4C 8B CF JMP CheckMultiplying
-- CheckMultiplying_Down:
-- ; Returns C=1 when the pointer is on another amoeba, Z=1 when can multiply
-- 01:CF82:E6 4F INC Temp_Y = #$38
-- 01:CF84:A4 4F LDY Temp_Y = #$38
-- 01:CF86:A6 50 LDX Temp_X = #$0A
-- 01:CF88:20 7D CC JSR GetObjectFromMap
-- CheckMultiplying:
-- ; Returns C=1 when the pointer is on another amoeba, Z=1 when can multiply
-- 01:CF8B:C9 D0 CMP #$D0
-- 01:CF8D:F0 08 BEQ OccupiedByAmoeba
-- 01:CF8F:C9 00 CMP #$00
-- 01:CF91:F0 02 BEQ $CF95
-- 01:CF93:C9 20 CMP #$20
-- ; Return result in Z flag: Z=1 when can multiply
-- 01:CF95:18 CLC
-- 01:CF96:60 RTS -----------------------------------------------------------
-- OccupiedByAmoeba:
-- ; The place is occupied by another amoeba, so we can't multiply there
-- ; but instead we will move the pointer there!
-- 01:CF97:38 SEC
-- 01:CF98:60 RTS -----------------------------------------------------------
--
-- IntendToSetAmoebaToMap:
-- ; Uses Temp_X/Temp_Y, returns C=1 on success, and C=0 when --Countdown_BD != 0
-- 01:CF99:A5 B7 LDA AmoebaPhase = #$82
-- 01:CF9B:09 80 ORA #$80
-- 01:CF9D:85 B7 STA AmoebaPhase = #$82
-- 01:CF9F:C6 BD DEC Amoeba_Timer = #$1D
-- 01:CFA1:F0 02 BEQ ReallySetAmoebaToMap
-- DontWantToMultiply:
-- ; The IntendToSetAmoebaToMap() must be called many times, only then the multiplication will be made
-- 01:CFA3:18 CLC
-- 01:CFA4:60 RTS -----------------------------------------------------------
-- ReallySetAmoebaToMap:
-- ; Uses Temp_X/Temp_Y, returns C=1 on success
-- 01:CFA5:A4 4F LDY Temp_Y = #$38
-- 01:CFA7:A6 50 LDX Temp_X = #$0A
-- 01:CFA9:A9 D0 LDA #$D0
-- 01:CFAB:20 77 D0 JSR SetObjectToMap
-- 01:CFAE:A4 4F LDY Temp_Y = #$38
-- 01:CFB0:A6 50 LDX Temp_X = #$0A
-- 01:CFB2:A9 D0 LDA #$D0
-- 01:CFB4:20 B7 D0 JSR AddObjectToBuffer
-- SheduleNextTimer:
-- ; Every time the waiting period decreases by 4
-- 01:CFB7:A5 BA LDA AmoebaTimerResetValue = #$3F
-- 01:CFB9:38 SEC
-- 01:CFBA:E9 04 SBC #$04
-- 01:CFBC:85 BA STA AmoebaTimerResetValue = #$3F
-- 01:CFBE:85 BD STA Amoeba_Timer = #$1D
-- ; Next update should reset the pointer to the origin
-- 01:CFC0:A9 80 LDA #$80
-- 01:CFC2:85 B7 STA AmoebaPhase = #$82
-- 01:CFC4:38 SEC
-- 01:CFC5:60 RTS -----------------------------------------------------------
------------------------------------------------------------------------

Some files were not shown because too many files have changed in this diff Show More