Cleaned up some inlines that weren't needed.

Updated documentation with info about 2600-daptor, including
usage and its creator.  Also included more in-depth explanation
for the various controller types.

Errors from the Thumb ARM emulation code are now caught as exceptions,
and thrown to the parent class instead of calling exit() and simply
crashing Stella.  For now, the messages are simply printed and
emulation continues.  This will be expanded to show a detailed crash
log in the debugger, and offer the option to exit the ROM.

Removed most of the menus from the OSX port.  They weren't being
maintained anyway, and most of them didn't work.  I've modelled this
on the way other cross-platform OSX programs work (notably, ScummVM).
Basically, there are menus for exit and help, but otherwise you
should use the menuing system in the application itself.


git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@2231 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
This commit is contained in:
stephena 2011-05-10 15:04:19 +00:00
parent 2da201c4a2
commit 4e6d4cb1c6
36 changed files with 334 additions and 2148 deletions

View File

@ -26,9 +26,9 @@
be set separately with the 'dsense' and 'msense' commandline
arguments, and from within the Input Settings UI.
* Added support for the 2600-daptor device, which is similar to a
Stelladaptor but improves handling of paddles. Thanks go to XXX
for a complimentary test sample of this device.
* Added support for the 2600-daptor device (2600-daptor.com), which is
similar to a Stelladaptor but improves handling of paddles. Thanks
go to Tom Hafner for a complimentary test sample of this device.
* Added new controller types 'Paddles_IAxis', 'Paddles_IDir', and
'Paddles_IAxDr', which invert the paddle axis, direction, and

View File

@ -10,7 +10,7 @@
<br><br>
<center><h2><b>A multi-platform Atari 2600 VCS emulator</b></h2></center>
<center><h4><b>Release 3.3</b></h4></center>
<center><h4><b>Release 3.4</b></h4></center>
<br><br>
<center><h2><b>User's Guide</b></h2></center>
@ -37,7 +37,7 @@
<li><a href="#Remapping">Event Remapping / Input Devices</a></li>
<li><a href="#ROMInfo">ROM Launcher</a></li>
<li><a href="#ROMAudit">ROM Audit Mode</a></li>
<li><a href="#Adaptor">Stelladaptor Support</a></li>
<li><a href="#Adaptor">Stelladaptor/2600-daptor Support</a></li>
<li><a href="#AtariVox">AtariVox/SaveKey Support</a></li>
<li><a href="#Debugger">Developer Options/Integrated Debugger</a></li>
<li><a href="#Settings">Settings File</a></li>
@ -52,7 +52,7 @@
<br><br><br>
<center><b>February 1999 - November 2010</b></center>
<center><b>February 1999 - May 2011</b></center>
<center><b>The Stella Team</b></center>
<center><b><a href="http://stella.sourceforge.net">Stella Homepage</a></b></center>
@ -258,11 +258,13 @@
<li>Emulates CX-22 / CX-80 style trackballs and Amiga Mouse using your
computer's mouse</li>
<li>Support for real Atari 2600 controllers using the
<a href="http://www.stelladaptor.com">Stelladaptor</a></li>
<a href="http://www.stelladaptor.com">Stelladaptor</a> and
<a href="http://2600-daptor.com">2600-adaptor</a></li>
<li>Support for the speech portion of a real
<a href="http://www.richard.hutchinson.dsl.pipex.com/new_page_5.htm">
AtariVox</a> device connected to your PC using a USB adaptor</li>
<li>Supports EEPROM emulation for AtariVox and SaveKey controllers</li>
<li>Supports EEPROM emulation for <a href="http://www.richard.hutchinson.dsl.pipex.com/new_page_5.htm">
AtariVox</a> and <a href="http://www.vectrex.biz/MemCard.htm">SaveKey</a> controllers</li>
<li>Supports all known bankswitching schemes (let us know if there's one we missed)</li>
<li>Supports cartridge autodetection for almost all bankswitching schemes</li>
<li>Supports Supercharger single-load and multi-load games</li>
@ -301,7 +303,8 @@
<li>SDL version 1.2.10 or greater, latest version highly recommended</li>
<li>CRT emulation effects require OpenGL 2.0 with GLSL (GL shading language) support</li>
<li>Joysticks or gamepads are highly recommended</li>
<li>Mouse or Stelladaptor with real paddles required for paddle emulation</li>
<li>Mouse or <a href="http://www.stelladaptor.com">Stelladaptor</a> /
<a href="http://2600-daptor.com">2600-adaptor</a> with real paddles required for paddle emulation</li>
<li>Some ROM images (See <a href="http://www.atariage.com">AtariAge</a> for more information)</li>
</ul>
@ -316,9 +319,6 @@
but aren't as well tested as i386/x86_64</li>
<li>GNU C++ compiler version 4.x and the make utility are required for compiling
the Stella source code</li>
<li><b>NOTE:</b> There are potential issues with SDL 1.2.14 in windowed
OpenGL mode for Linux/UNIX. If you have this configuration, you are
advised to use SDL 1.2.13 instead.
</ul>
<p>
@ -339,7 +339,7 @@
<p>
<h3><b><u>Windows</u></b></h3>
<p>The Windows version of Stella is designed to work on Windows 2000/XP/Vista/7
<p>The Windows version of Stella is designed to work on Windows 98/2000/XP/Vista/7
with the following:</p>
<ul>
@ -347,7 +347,9 @@
recommended</li>
<li>64-bit port has been tested on Windows Vista/7 only; it may work on
WinXP64 as well, but isn't a priority</li>
<li>Visual C++ 2008 is required to compile the Stella source code</li>
<li>Visual C++ 2005 is required to compile the Stella source code for Windows 98 and 2000</li>
<li>Visual C++ 2010 is required to compile the Stella source code for Windows XP and above</li>
<li>It may be possible to compile using MinGW, but this hasn't been extensively tested since Stella version 3.0</li>
</ul>
<p>
@ -444,7 +446,7 @@
<li>For installation:
<ul>
<li>Run the script <b>Create_build.sh</b>, located in the src/macosx directory.
This will create a DMG file on your desktop.</li>
This will create a DMG installation archive on your desktop.</li>
&nbsp;&nbsp;&nbsp;<b>OR</b>
<li>Copy the <b>Stella.app</b> package to your 'Applications' folder.</li>
</ul>
@ -476,8 +478,10 @@
<li>Extract files from the distribution using <b>Winzip</b>,
<b>Total Commander</b>, or some other archiving program that supports
gzipped tar files</li>
<li>Open the <b>stella-<i>release</i>/src/win32/Stella.sln</b>
file using Visual C++ 2008</li>
<li>For Windows XP and above: open the <b>stella-<i>release</i>/src/win32/Stella.sln</b>
file using Visual C++ 2010</li>
<li>For Windows 98/2000: open the <b>stella-<i>release</i>/src/win32/Stella_vs2005.sln</b>
file using Visual C++ 2005</li>
<li>Build the 'Stella' solution, making sure to correctly select either 'Win32'
or 'x64' mode (depending on the version of Windows you have installed)</li>
<li>For installation:
@ -516,9 +520,9 @@
<p><ul>
<li>Search around the internet and find ROM images to download (websites such
as <a href="http://atariage.com">Atariage</a> and
as <a href="http://atariage.com">AtariAge</a> and
<a href="http://www.atarimania.com/rom_collection_archive_atari_2600_roms.html">
AtariMania</a> may be useful)</li>
AtariMania/RomHunter</a> may be useful)</li>
<li>You can purchase the Atari 2600 Action Packs by Activision and use
their ROM images</li>
@ -1439,12 +1443,6 @@
<td>Cmd + ]</td>
</tr>
<tr>
<td>Grab mouse (keep mouse in game window)</td>
<td>Control + g</td>
<td>Control + g</td>
</tr>
<tr>
<td>Toggle display palette (<i>NTSC/PAL/SECAM</i>)</td>
<td>Control + f</td>
@ -1458,25 +1456,25 @@
</tr>
<tr>
<td>Set mouse to emulate paddle 0</td>
<td>Set mouse to emulate controller 0</td>
<td>Control + 0</td>
<td>Control + 0</td>
</tr>
<tr>
<td>Set mouse to emulate paddle 1</td>
<td>Set mouse to emulate controller 1</td>
<td>Control + 1</td>
<td>Control + 1</td>
</tr>
<tr>
<td>Set mouse to emulate paddle 2</td>
<td>Set mouse to emulate controller 2</td>
<td>Control + 2</td>
<td>Control + 2</td>
</tr>
<tr>
<td>Set mouse to emulate paddle 3</td>
<td>Set mouse to emulate controller 3</td>
<td>Control + 3</td>
<td>Control + 3</td>
</tr>
@ -1811,12 +1809,12 @@
<tr>
<td><pre>-sa1 &lt;left|right&gt;</pre></td>
<td>Stelladaptor 1 emulates specified joystick port.</td>
<td>Stelladaptor/2600-daptor 1 emulates specified joystick port.</td>
</tr>
<tr>
<td><pre>-sa2 &lt;left|right&gt;</pre></td>
<td>Stelladaptor 2 emulates specified joystick port.</td>
<td>Stelladaptor/2600-daptor 2 emulates specified joystick port.</td>
</tr>
<tr>
@ -2369,7 +2367,7 @@
<td valign="top">
<table border="1" cellpadding="4">
<tr><th>Item</th><th>Brief description</th><th>For more information,<br>see <a href="#CommandLine">CommandLine</a></th></tr>
<tr><td>Stelladaptor X is</td><td>Specifies which virtual port each Stelladaptor uses (See <b>Advanced Configuration - <a href="#Adaptor">Stelladaptor Support</a></b>)</td><td>-sa1 &amp; -sa2</td></tr>
<tr><td>Stelladaptor X is</td><td>Specifies which virtual port each Stelladaptor/2600-daptor uses (See <b>Advanced Configuration - <a href="#Adaptor">Stelladaptor/2600-daptor Support</a></b>)</td><td>-sa1 &amp; -sa2</td></tr>
<tr><td>AVox serial port</td><td>Described in further detail in <b>Advanced Configuration - <a href="#AtariVox">AtariVox/SaveKey Support</a></b> </td><td>-avoxport</td></tr>
<tr><td>Joy deadzone size</td><td>Deadzone area for axes on joysticks/gamepads</td><td>-joydeadzone</td></tr>
<tr><td>Digital paddle sensitivity</td><td>Sensitvity used when emulating a paddle using a digital device</td><td>-dsense</td></tr>
@ -2521,13 +2519,14 @@
</ul>
</blockquote>
<h2><b><a name="Adaptor">6. Stelladaptor Support</a></b></h2>
<h2><b><a name="Adaptor">6. Stelladaptor/2600-daptor Support</a></b></h2>
<blockquote>
<p>Stella supports real Atari 2600 joysticks, paddles and driving controllers
using the <a href="http://www.stelladaptor.com">Stelladaptor</a> device.</p>
using the <a href="http://www.stelladaptor.com">Stelladaptor</a> and
<a href="http://2600-daptor.com">2600-adaptor</a> devices.</p>
<p>Stella can use up to <b>two</b> Stelladaptors; any extra ones are ignored.
<p>Stella can use up to <b>two</b> adaptors; any extra ones are ignored.
Stelladaptor devices will be automatically detected and configured. Devices
can be plugged/unplugged while the emulator is running, although you will need
to restart the game currently being emulated.</p>
@ -2535,17 +2534,17 @@
<p>The detection and configuration is as follows:
<ul>
<li>The first Stelladaptor found will act as the <b>left game port</b>
<li>The first device found will act as the <b>left game port</b>
on a real Atari. Depending on the device, Stella will detect it as
either the left joystick, paddles 0 & 1, or the left driving controller.</li>
<li>The second Stelladaptor found will act as the <b>right game port</b>
<li>The second device found will act as the <b>right game port</b>
on a real Atari. Depending on the device, Stella will detect it as
either the right joystick, paddles 2 & 3, or the right driving controller.</li>
<li>Any other Stelladaptors will be ignored.</li>
<li>Any other devices will be ignored.</li>
<li>The assignment ordering of Stelladaptor to port can be redefined with
<li>The assignment ordering of Stelladaptor/2600-daptor to port can be redefined with
'sa1' and 'sa2' (see description in 'Starting a Game').</li>
</ul>
</blockquote>
@ -2955,7 +2954,6 @@ Ms Pac-Man (Stella extended codes):
</table></td>
</tr>
<tr>
<td VALIGN="TOP"><i>Console.LeftDifficulty:</i></td>
<td>Indicates the default difficulty setting for the left
@ -2983,20 +2981,27 @@ Ms Pac-Man (Stella extended codes):
</tr>
<tr>
<td VALIGN="TOP"><i>Controller.Left:</i></td>
<td>Indicates what type of controller the left player
uses. The value must be <b>BoosterGrip</b>, <b>Driving</b>,
<b>Keyboard</b>, <b>Paddles</b>, <b>Paddles_IAxis</b>, <b>Paddles_IDir</b>, <b>Paddles_IAxDr</b>, <b>Trackball22</b>,
<b>Trackball80</b>, <b>AmigaMouse</b>, <b>Genesis</b> or <b>Joystick</b>.</td>
</tr>
<tr>
<td VALIGN="TOP"><i>Controller.Right:</i></td>
<td>Indicates what type of controller the right player
uses. The value must be <b>BoosterGrip</b>, <b>Driving</b>,
<b>Keyboard</b>, <b>Paddles</b>,<b>Paddles_IAxis</b>, <b>Paddles_IDir</b>, <b>Paddles_IAxDr</b>, <b>Trackball22</b>,
<b>Trackball80</b>, <b>AmigaMouse</b>, <b>AtariVox</b>,
<b>SaveKey</b>, <b>Genesis</b> or <b>Joystick</b>.</td>
<td VALIGN="TOP"><i>Controller.Left:</i><br><i>Controller.Right:</i></td>
<td>Indicates what type of controller the left and right player
uses. The value must be one of the following types:
<table cellpadding="2" border="1">
<tr><th>&nbsp;Type&nbsp;</th><th>Description</th></tr>
<tr><td>Joystick </td><td>Atari's famous black joystick that was originally included with the system.</td></tr>
<tr><td>BoosterGrip </td><td>A controller add-in that plugs directly into the joystick port and provides a pass-through for the joystick. In doing so, it provides the two independent buttons.</td></tr>
<tr><td>Paddles </td><td>Standard paddle controllers for use with games such as Breakout and Warlords. One pair of controller per connector (allows for 4-player Warlords).</td></tr>
<tr><td>Paddles_IAxis </td><td>Same as Paddles, except the axes are inverted.</td></tr>
<tr><td>Paddles_IDir </td><td>Same as Paddles, except the direction of movement is inverted.</td></tr>
<tr><td>Paddles_IAxDr </td><td>Same as Paddles, except both the axes and direction of movement is inverted.</td></tr>
<tr><td>Driving </td><td>Looks like a paddle, but allows 360' movement. Only one unit per connector, unlike paddles which were sold in pairs.</td></tr>
<tr><td>Keyboard </td><td>Also known as the Star Raiders controller, functionally identical to the Kid's Controller and Keyboard Controller. Game included an overlay with commands, for use with Star Raiders.</td></tr>
<tr><td>Trackball22 </td><td>Standard Atari 2600 CX-22 trackball controller.</td></tr>
<tr><td>Trackball80 </td><td>Atari ST CX-80 trackball controller.</td></tr>
<tr><td>AmigaMouse</td><td>Commodore Amiga computer mouse.</td></tr>
<tr><td><a href="http://www.richard.hutchinson.dsl.pipex.com/new_page_5.htm">
AtariVox</a></td><td>A SpeakJet based unlimited-vocabulary speech / sound synthesizer with 32K EEPROM.</td></tr>
<tr><td><a href="http://www.vectrex.biz/MemCard.htm">SaveKey</a></td><td>A 32K EEPROM for saving high scores, etc (the EEPROM portion of an AtariVox).</td></tr>
<tr><td>Genesis </td><td>Sega Genesis controller, which can be used similar to a BoosterGrip, giving two extra buttons.</td></tr>
</table></td>
</tr>
<tr>
@ -3172,7 +3177,7 @@ Ms Pac-Man (Stella extended codes):
versions. Added INI file support, faster startup, snapshot support,
and pause functionality to core. Converted Stella 1.1 manual to HTML.
Ported codebase to SDL for Windows/MacOSX. Added OpenGL support and
Stelladaptor support. Current maintainer for the Linux, MacOSX and Windows
Stelladaptor/2600-daptor support. Current maintainer for the Linux, MacOSX and Windows
versions.</td>
</tr>
@ -3238,17 +3243,14 @@ Ms Pac-Man (Stella extended codes):
<td VALIGN="TOP">Mark&nbsp;Grebe<br>
(<a href="http://www.atarimac.com">http://www.atarimac.com</a>)</td>
<td>Author of the Macintosh OSX version of Stella from releases
1.4 to 2.4. Helped with Stelladaptor support.</td>
1.4 to 2.4; helped with Stelladaptor support</td>
</tr>
<tr>
<td VALIGN="TOP">Alex&nbsp;Herbert</td>
<td>Provided much information on AtariVox and SaveKey functionality</td>
</tr>
<tr>
<td VALIGN="TOP">Richard&nbsp;Hutchinson</td>
<td>Provided an AtariVox USB adaptor to help with AVox development</td>
<td VALIGN="TOP">Tom&nbsp;Hafner<br>
(<a href="http://2600-daptor.com">http://2600-daptor.com</a>)</td>
<td>Generously donated a 2600-daptor device and sample code to help with
development</td>
</tr>
<tr>
@ -3257,11 +3259,21 @@ Ms Pac-Man (Stella extended codes):
provided help with the TIA HMOVE blank bug</td>
</tr>
<tr>
<td VALIGN="TOP">Alex&nbsp;Herbert</td>
<td>Provided much information on AtariVox and SaveKey functionality</td>
</tr>
<tr>
<td VALIGN="TOP">Kevin&nbsp;Horton</td>
<td>Author of the definitive Atari 2600 bank-switching document</td>
</tr>
<tr>
<td VALIGN="TOP">Richard&nbsp;Hutchinson</td>
<td>Provided an AtariVox USB adaptor to help with AVox development</td>
</tr>
<tr>
<td VALIGN="TOP">Thomas&nbsp;Jentzsch</td>
<td>Provided updated NTSC palette and many ideas</td>
@ -3469,7 +3481,8 @@ Ms Pac-Man (Stella extended codes):
</tr>
<tr>
<td VALIGN="TOP">Albert&nbsp;Yarusso (aka Al from AtariAge)</td>
<td VALIGN="TOP">Albert&nbsp;Yarusso<br>
<a href="http://atariage.com">http://atariage.com</a></td>
<td>Provided helpful feedback for the MacOSX port, and generously
donated an AtariVox device to help with development</td>
</tr>

View File

@ -334,8 +334,8 @@ class FBSurfaceGL : public FBSurface
*/
void renderThreeTexture(GLuint program, bool firstRender);
inline void* pixels() const { return myTexture->pixels; }
inline uInt32 pitch() const { return myPitch; }
void* pixels() const { return myTexture->pixels; }
uInt32 pitch() const { return myPitch; }
static uInt32 power_of_two(uInt32 input)
{

View File

@ -208,7 +208,7 @@ class FBSurfaceSoft : public FBSurface
void reload();
private:
inline void* getBasePtr(uInt32 x, uInt32 y) {
void* getBasePtr(uInt32 x, uInt32 y) {
return static_cast<void *>(static_cast<uInt8*>(mySurface->pixels) +
(myYOffset + y) * mySurface->pitch + (myXOffset + x) *
mySurface->format->BytesPerPixel);

View File

@ -626,7 +626,7 @@ string CartDebug::loadSymbolFile(string file)
{
ifstream in(node.getPath().c_str());
if(!in.is_open())
return DebuggerParser::red("symbol file '" + node.getPath() + "' not found");
return DebuggerParser::red("symbol file '" + node.getRelativePath() + "' not found");
myUserAddresses.clear();
myUserLabels.clear();
@ -645,9 +645,9 @@ string CartDebug::loadSymbolFile(string file)
addLabel(label, value);
}
in.close();
return "loaded " + file + " OK";
return "loaded " + node.getRelativePath() + " OK";
}
return DebuggerParser::red("symbol file '" + node.getPath() + "' not found");
return DebuggerParser::red("symbol file '" + node.getRelativePath() + "' not found");
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

View File

@ -101,9 +101,9 @@ class CartDebug : public DebuggerSystem
// The following assume that the given addresses are using the
// correct read/write port ranges; no checking will be done to
// confirm this.
inline uInt8 peek(uInt16 addr) { return mySystem.peek(addr); }
inline uInt16 dpeek(uInt16 addr) { return mySystem.peek(addr) | (mySystem.peek(addr+1) << 8); }
inline void poke(uInt16 addr, uInt8 value) { mySystem.poke(addr, value); }
uInt8 peek(uInt16 addr) { return mySystem.peek(addr); }
uInt16 dpeek(uInt16 addr) { return mySystem.peek(addr) | (mySystem.peek(addr+1) << 8); }
void poke(uInt16 addr, uInt8 value) { mySystem.poke(addr, value); }
// Indicate that a read from write port has occurred at the specified
// address.

View File

@ -226,18 +226,32 @@ void Debugger::setConsole(Console* console)
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
bool Debugger::start(const string& message, int address)
{
bool result = myOSystem->eventHandler().enterDebugMode();
if(myOSystem->eventHandler().enterDebugMode())
{
// This must be done *after* we enter debug mode,
// so the message isn't erased
ostringstream buf;
buf << message;
if(address > -1)
buf << valueToString(address);
// This must be done *after* we enter debug mode,
// so the message isn't erased
ostringstream buf;
buf << message;
if(address > -1)
buf << valueToString(address);
myMessage->setEditString(buf.str());
return true;
}
return false;
}
myMessage->setEditString(buf.str());
return result;
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
bool Debugger::startWithFatalError(const string& message)
{
if(myOSystem->eventHandler().enterDebugMode())
{
// This must be done *after* we enter debug mode,
// so the message isn't erased
myMessage->setEditString(message);
return true;
}
return false;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

View File

@ -116,6 +116,7 @@ class Debugger : public DialogContainer
@param data An address associated with the message
*/
bool start(const string& message = "", int address = -1);
bool startWithFatalError(const string& message = "");
/**
Wrapper method for EventHandler::leaveDebugMode() for those classes
@ -268,7 +269,7 @@ class Debugger : public DialogContainer
everywhere, but I feel it's better to place it here then in
YaccParser (which technically isn't related to it at all).
*/
inline static Debugger& debugger() { return *myStaticDebugger; }
static Debugger& debugger() { return *myStaticDebugger; }
/**
Get the dimensions of the various debugger dialog areas
@ -283,10 +284,10 @@ class Debugger : public DialogContainer
/* These are now exposed so Expressions can use them. */
int peek(int addr) { return mySystem->peek(addr); }
int dpeek(int addr) { return mySystem->peek(addr) | (mySystem->peek(addr+1) << 8); }
inline int getAccessFlags(uInt16 addr)
{ return mySystem->getAccessFlags(addr); }
inline void setAccessFlags(uInt16 addr, uInt8 flags)
{ mySystem->setAccessFlags(addr, flags); }
int getAccessFlags(uInt16 addr)
{ return mySystem->getAccessFlags(addr); }
void setAccessFlags(uInt16 addr, uInt8 flags)
{ mySystem->setAccessFlags(addr, flags); }
void setBreakPoint(int bp, bool set);

View File

@ -51,7 +51,7 @@ class PromptWidget : public Widget, public CommandSender
void clearScreen();
protected:
inline int &buffer(int idx) { return _buffer[idx % kBufferSize]; }
int& buffer(int idx) { return _buffer[idx % kBufferSize]; }
void drawWidget(bool hilite);
void drawCaret();

View File

@ -96,9 +96,9 @@ class Cartridge : public Device
the banks before querying the cart state, otherwise reading values
could inadvertantly cause a bankswitch to occur.
*/
inline void lockBank() { myBankLocked = true; }
inline void unlockBank() { myBankLocked = false; }
inline bool bankLocked() { return myBankLocked; }
void lockBank() { myBankLocked = true; }
void unlockBank() { myBankLocked = false; }
bool bankLocked() { return myBankLocked; }
/**
Get the default startup bank for a cart. This is the bank where

View File

@ -20,6 +20,9 @@
#include <cassert>
#include <cstring>
#ifdef DEBUGGER_SUPPORT
#include "Debugger.hxx"
#endif
#include "System.hxx"
#include "Thumbulator.hxx"
#include "CartDPCPlus.hxx"
@ -202,7 +205,15 @@ inline void CartridgeDPCPlus::callFunction(uInt8 value)
case 254:
case 255:
// Call user written ARM code (most likely be C compiled for ARM)
myThumbEmulator->run();
try {
myThumbEmulator->run();
}
catch(const char* msg) {
cerr << msg << endl;
#ifdef DEBUGGER_SUPPORT
Debugger::debugger().startWithFatalError(msg);
#endif
}
break;
#endif
// reserved

View File

@ -152,23 +152,23 @@ class CartridgeDPCPlus : public Cartridge
/**
Clocks the random number generator to move it to its next state
*/
inline void clockRandomNumberGenerator();
void clockRandomNumberGenerator();
/**
Clocks the random number generator to move it to its prior state
*/
inline void priorClockRandomNumberGenerator();
void priorClockRandomNumberGenerator();
/**
Updates any data fetchers in music mode based on the number of
CPU cycles which have passed since the last update.
*/
inline void updateMusicModeDataFetchers();
void updateMusicModeDataFetchers();
/**
Call Special Functions
*/
inline void callFunction(uInt8 value);
void callFunction(uInt8 value);
private:
// The ROM image and size

View File

@ -86,7 +86,7 @@ class Console : public Serializable
@return The specified controller
*/
inline Controller& controller(Controller::Jack jack) const
Controller& controller(Controller::Jack jack) const
{
return (jack == Controller::Left) ? *myControllers[0] : *myControllers[1];
}
@ -166,7 +166,7 @@ class Console : public Serializable
/**
Query detailed information about this console.
*/
inline const ConsoleInfo& about() const { return myConsoleInfo; }
const ConsoleInfo& about() const { return myConsoleInfo; }
public:
/**

View File

@ -92,12 +92,12 @@ class Event
/**
Get the value associated with the event of the specified type
*/
inline Int32 get(Type type) const { return myValues[type]; }
Int32 get(Type type) const { return myValues[type]; }
/**
Set the value associated with the event of the specified type
*/
inline void set(Type type, Int32 value) { myValues[type] = value; }
void set(Type type, Int32 value) { myValues[type] = value; }
/**
Clears the event array (resets to initial state)

View File

@ -2124,7 +2124,7 @@ void EventHandler::leaveMenuMode()
bool EventHandler::enterDebugMode()
{
#ifdef DEBUGGER_SUPPORT
if(myState == S_DEBUGGER)
if(myState == S_DEBUGGER || !(&myOSystem->console()))
return false;
// Make sure debugger starts in a consistent state

View File

@ -170,7 +170,7 @@ class EventHandler
@return The State type
*/
inline State state() const { return myState; }
State state() const { return myState; }
/**
Resets the state machine of the EventHandler to the defaults
@ -201,7 +201,7 @@ class EventHandler
*/
void setContinuousSnapshots(uInt32 interval);
inline bool kbdAlt(int mod) const
bool kbdAlt(int mod) const
{
#ifndef MAC_OSX
return (mod & KMOD_ALT);
@ -210,12 +210,12 @@ class EventHandler
#endif
}
inline bool kbdControl(int mod) const
bool kbdControl(int mod) const
{
return (mod & KMOD_CTRL) > 0;
}
inline bool kbdShift(int mod) const
bool kbdShift(int mod) const
{
return (mod & KMOD_SHIFT);
}
@ -235,9 +235,9 @@ class EventHandler
*/
void handleEvent(Event::Type type, Int32 value);
inline bool frying() const { return myFryingFlag; }
bool frying() const { return myFryingFlag; }
inline SDL_Joystick* getJoystick(int i) const { return ourJoysticks[i].stick; }
SDL_Joystick* getJoystick(int i) const { return ourJoysticks[i].stick; }
StringList getActionList(EventMode mode) const;
StringMap getComboList(EventMode mode) const;
@ -246,13 +246,13 @@ class EventHandler
StringList getComboListForEvent(Event::Type event) const;
void setComboListForEvent(Event::Type event, const StringList& events);
inline Event::Type eventForKey(int key, EventMode mode) const
Event::Type eventForKey(int key, EventMode mode) const
{ return myKeyTable[key][mode]; }
inline Event::Type eventForJoyButton(int stick, int button, EventMode mode) const
Event::Type eventForJoyButton(int stick, int button, EventMode mode) const
{ return myJoyTable[stick][button][mode]; }
inline Event::Type eventForJoyAxis(int stick, int axis, int value, EventMode mode) const
Event::Type eventForJoyAxis(int stick, int axis, int value, EventMode mode) const
{ return myJoyAxisTable[stick][axis][(value > 0)][mode]; }
inline Event::Type eventForJoyHat(int stick, int hat, int value, EventMode mode) const
Event::Type eventForJoyHat(int stick, int hat, int value, EventMode mode) const
{ return myJoyHatTable[stick][hat][value][mode]; }
Event::Type eventAtIndex(int idx, EventMode mode) const;
@ -341,7 +341,7 @@ class EventHandler
@param type The event
@return True if the state changed, else false
*/
inline bool eventStateChange(Event::Type type);
bool eventStateChange(Event::Type type);
/**
The following methods take care of assigning action mappings.
@ -379,7 +379,7 @@ class EventHandler
@param event The event to test for analog processing
@return True if analog, else false
*/
inline bool eventIsAnalog(Event::Type event) const;
bool eventIsAnalog(Event::Type event) const;
void setEventState(State state);

View File

@ -189,14 +189,14 @@ class FrameBuffer
Note that this will take into account the current scaling (if any)
as well as image 'centering'.
*/
inline const GUI::Rect& imageRect() const { return myImageRect; }
const GUI::Rect& imageRect() const { return myImageRect; }
/**
Returns the current dimensions of the framebuffer window.
This is the entire area containing the framebuffer image as well as any
'unusable' area.
*/
inline const GUI::Rect& screenRect() const { return myScreenRect; }
const GUI::Rect& screenRect() const { return myScreenRect; }
/**
Refresh display according to the current state, taking single vs.

View File

@ -237,7 +237,7 @@ class M6502 : public Serializable
@return The byte at the specified address
*/
inline uInt8 peek(uInt16 address, uInt8 flags);
uInt8 peek(uInt16 address, uInt8 flags);
/**
Change the byte at the specified address to the given value and
@ -246,7 +246,7 @@ class M6502 : public Serializable
@param address The address where the value should be stored
@param value The value to be stored at the address
*/
inline void poke(uInt16 address, uInt8 value);
void poke(uInt16 address, uInt8 value);
/**
Get the 8-bit value of the Processor Status register.

View File

@ -130,7 +130,7 @@ class M6532 : public Device
bool poke(uInt16 address, uInt8 value);
private:
inline Int32 timerClocks()
Int32 timerClocks()
{ return myTimer - (mySystem->cycles() - myCyclesWhenTimerSet); }
void setTimerRegister(uInt8 data, uInt8 interval);

View File

@ -92,77 +92,77 @@ class OSystem
@return The event handler
*/
inline EventHandler& eventHandler() const { return *myEventHandler; }
EventHandler& eventHandler() const { return *myEventHandler; }
/**
Get the frame buffer of the system
@return The frame buffer
*/
inline FrameBuffer& frameBuffer() const { return *myFrameBuffer; }
FrameBuffer& frameBuffer() const { return *myFrameBuffer; }
/**
Get the sound object of the system
@return The sound object
*/
inline Sound& sound() const { return *mySound; }
Sound& sound() const { return *mySound; }
/**
Get the settings object of the system
@return The settings object
*/
inline Settings& settings() const { return *mySettings; }
Settings& settings() const { return *mySettings; }
/**
Get the set of game properties for the system
@return The properties set object
*/
inline PropertiesSet& propSet() const { return *myPropSet; }
PropertiesSet& propSet() const { return *myPropSet; }
/**
Get the console of the system.
@return The console object
*/
inline Console& console() const { return *myConsole; }
Console& console() const { return *myConsole; }
/**
Get the serial port of the system.
@return The serial port object
*/
inline SerialPort& serialPort() const { return *mySerialPort; }
SerialPort& serialPort() const { return *mySerialPort; }
/**
Get the settings menu of the system.
@return The settings menu object
*/
inline Menu& menu() const { return *myMenu; }
Menu& menu() const { return *myMenu; }
/**
Get the command menu of the system.
@return The command menu object
*/
inline CommandMenu& commandMenu() const { return *myCommandMenu; }
CommandMenu& commandMenu() const { return *myCommandMenu; }
/**
Get the ROM launcher of the system.
@return The launcher object
*/
inline Launcher& launcher() const { return *myLauncher; }
Launcher& launcher() const { return *myLauncher; }
/**
Get the state manager of the system.
@return The statemanager object
*/
inline StateManager& state() const { return *myStateManager; }
StateManager& state() const { return *myStateManager; }
#ifdef DEBUGGER_SUPPORT
/**
@ -170,7 +170,7 @@ class OSystem
@return The debugger object
*/
inline Debugger& debugger() const { return *myDebugger; }
Debugger& debugger() const { return *myDebugger; }
#endif
#ifdef CHEATCODE_SUPPORT
@ -179,7 +179,7 @@ class OSystem
@return The cheatmanager object
*/
inline CheatManager& cheat() const { return *myCheatManager; }
CheatManager& cheat() const { return *myCheatManager; }
#endif
/**
@ -187,35 +187,35 @@ class OSystem
@return The font reference
*/
inline const GUI::Font& font() const { return *myFont; }
const GUI::Font& font() const { return *myFont; }
/**
Get the info font object of the system
@return The font reference
*/
inline const GUI::Font& infoFont() const { return *myInfoFont; }
const GUI::Font& infoFont() const { return *myInfoFont; }
/**
Get the small font object of the system
@return The font reference
*/
inline const GUI::Font& smallFont() const { return *mySmallFont; }
const GUI::Font& smallFont() const { return *mySmallFont; }
/**
Get the launcher font object of the system
@return The font reference
*/
inline const GUI::Font& launcherFont() const { return *myLauncherFont; }
const GUI::Font& launcherFont() const { return *myLauncherFont; }
/**
Get the console font object of the system
@return The console font reference
*/
inline const GUI::Font& consoleFont() const { return *myConsoleFont; }
const GUI::Font& consoleFont() const { return *myConsoleFont; }
/**
Set the framerate for the video system. It's placed in this class since
@ -240,13 +240,13 @@ class OSystem
@return The video framerate currently in use
*/
inline float frameRate() const { return myDisplayFrameRate; }
float frameRate() const { return myDisplayFrameRate; }
/**
Get the maximum dimensions of a window for the video hardware.
*/
inline uInt32 desktopWidth() const { return myDesktopWidth; }
inline uInt32 desktopHeight() const { return myDesktopHeight; }
uInt32 desktopWidth() const { return myDesktopWidth; }
uInt32 desktopHeight() const { return myDesktopHeight; }
/**
Get the supported fullscreen resolutions for the video hardware.

View File

@ -161,30 +161,21 @@ class System : public Serializable
@return The total number of pages available
*/
inline uInt16 numberOfPages() const
{
return myNumberOfPages;
}
uInt16 numberOfPages() const { return myNumberOfPages; }
/**
Get the amount to right shift an address by to obtain its page.
@return The amount to right shift an address by to get its page
*/
inline uInt16 pageShift() const
{
return myPageShift;
}
uInt16 pageShift() const { return myPageShift; }
/**
Get the mask to apply to an address to obtain its page offset.
@return The mask to apply to an address to obtain its page offset
*/
inline uInt16 pageMask() const
{
return myPageMask;
}
uInt16 pageMask() const { return myPageMask; }
public:
/**
@ -193,10 +184,7 @@ class System : public Serializable
@return The number of system cycles which have passed
*/
inline uInt32 cycles() const
{
return myCycles;
}
uInt32 cycles() const { return myCycles; }
/**
Increment the system cycles by the specified number of cycles.
@ -223,10 +211,7 @@ class System : public Serializable
@return The data bus state
*/
inline uInt8 getDataBusState() const
{
return myDataBusState;
}
uInt8 getDataBusState() const { return myDataBusState; }
/**
Get the current state of the data bus in the system, taking into
@ -243,7 +228,7 @@ class System : public Serializable
@param hmask The bits which should always be driven high
@return The data bus state
*/
inline uInt8 getDataBusState(uInt8 zmask, uInt8 hmask = 0x00)
uInt8 getDataBusState(uInt8 zmask, uInt8 hmask = 0x00)
{
// For the pins that are floating, randomly decide which are high or low
// Otherwise, they're specifically driven high

View File

@ -187,9 +187,9 @@ class TIA : public Device
/**
Answers the width and height of the frame buffer
*/
inline uInt32 width() const { return myFrameWidth; }
inline uInt32 height() const { return myFrameHeight; }
inline uInt32 ystart() const { return myFrameYStart; }
uInt32 width() const { return myFrameWidth; }
uInt32 height() const { return myFrameHeight; }
uInt32 ystart() const { return myFrameYStart; }
/**
Changes the current Height/YStart properties.
@ -220,7 +220,7 @@ class TIA : public Device
@return The current color clock
*/
inline uInt32 clocksThisLine() const
uInt32 clocksThisLine() const
{ return ((mySystem->cycles() * 3) - myClockWhenFrameStarted) % 228; }
/**
@ -230,7 +230,7 @@ class TIA : public Device
@return The total number of scanlines generated
*/
inline uInt32 scanlines() const
uInt32 scanlines() const
{ return ((mySystem->cycles() * 3) - myClockWhenFrameStarted) / 228; }
/**
@ -239,14 +239,14 @@ class TIA : public Device
@return If we're in partial frame mode
*/
inline bool partialFrame() const { return myPartialFrameFlag; }
bool partialFrame() const { return myPartialFrameFlag; }
/**
Answers the first scanline at which drawing occured in the last frame.
@return The starting scanline
*/
inline uInt32 startScanline() const { return myStartScanline; }
uInt32 startScanline() const { return myStartScanline; }
/**
Answers the current position of the virtual 'electron beam' used to
@ -359,10 +359,10 @@ class TIA : public Device
void pokeHMBL(uInt8 value, Int32 clock);
// Apply motion to registers when HMOVE is currently active
inline void applyActiveHMOVEMotion(int hpos, Int16& pos, Int32 motionClock);
void applyActiveHMOVEMotion(int hpos, Int16& pos, Int32 motionClock);
// Apply motion to registers when HMOVE was previously active
inline void applyPreviousHMOVEMotion(int hpos, Int16& pos, uInt8 motion);
void applyPreviousHMOVEMotion(int hpos, Int16& pos, uInt8 motion);
private:
// Console the TIA is associated with

View File

@ -63,8 +63,7 @@ int Thumbulator::run( void )
{
DISS=0;
DBUG=0;
// TODO - deal with this condition more elegantly
exit(1); // exit Stella
throw "instructions > 501000";
}
}
//dump_counters();
@ -98,8 +97,8 @@ uInt32 Thumbulator::fetch16 ( uInt32 addr )
addr &= ROMADDMASK;
if(addr<0x50)
{
fprintf(stderr,"fetch16(0x%08X), abort\n",addr);
exit(1);
sprintf(errorMsg,"fetch16(0x%08X), abort\n",addr);
throw errorMsg;
}
addr>>=1;
@ -124,8 +123,8 @@ uInt32 Thumbulator::fetch16 ( uInt32 addr )
fprintf(stderr,"0x%04X\n",data);
return(data);
}
fprintf(stderr,"fetch16(0x%08X), abort\n",addr);
exit(1);
sprintf(errorMsg,"fetch16(0x%08X), abort\n",addr);
throw errorMsg;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
@ -146,8 +145,8 @@ uInt32 Thumbulator::fetch32 ( uInt32 addr )
fprintf(stderr,"0x%08X\n",data);
if(addr==0x00000000) return(data);
if(addr==0x00000004) return(data);
fprintf(stderr,"fetch32(0x%08X), abort\n",addr);
exit(1);
sprintf(errorMsg,"fetch32(0x%08X), abort\n",addr);
throw errorMsg;
}
case 0x40000000: //RAM
@ -158,8 +157,8 @@ uInt32 Thumbulator::fetch32 ( uInt32 addr )
fprintf(stderr,"0x%08X\n",data);
return(data);
}
fprintf(stderr,"fetch32(0x%08X), abort\n",addr);
exit(1);
sprintf(errorMsg,"fetch32(0x%08X), abort\n",addr);
throw errorMsg;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
@ -182,8 +181,8 @@ void Thumbulator::write16 ( uInt32 addr, uInt32 data )
#endif
return;
}
fprintf(stderr,"write16(0x%08X,0x%08X), abort\n",addr,data);
exit(1);
sprintf(errorMsg,"write16(0x%08X,0x%08X), abort\n",addr,data);
throw errorMsg;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
@ -196,7 +195,7 @@ void Thumbulator::write32 ( uInt32 addr, uInt32 data )
{
case 0xF0000000: //halt
dump_counters();
exit(0);
throw "HALT";// exit(0);
case 0xE0000000: //periph
switch(addr)
@ -219,8 +218,8 @@ void Thumbulator::write32 ( uInt32 addr, uInt32 data )
write16(addr+2,(data>>16)&0xFFFF);
return;
}
fprintf(stderr,"write32(0x%08X,0x%08X), abort\n",addr,data);
exit(1);
sprintf(errorMsg,"write32(0x%08X,0x%08X), abort\n",addr,data);
throw errorMsg;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
@ -259,8 +258,8 @@ uInt32 Thumbulator::read16 ( uInt32 addr )
fprintf(stderr,"0x%04X\n",data);
return(data);
}
fprintf(stderr,"read16(0x%08X), abort\n",addr);
exit(1);
sprintf(errorMsg,"read16(0x%08X), abort\n",addr);
throw errorMsg;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
@ -282,8 +281,8 @@ uInt32 Thumbulator::read32 ( uInt32 addr )
fprintf(stderr,"0x%08X\n",data);
return(data);
}
fprintf(stderr,"read32(0x%08X), abort\n",addr);
exit(1);
sprintf(errorMsg,"read32(0x%08X), abort\n",addr);
throw errorMsg;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
@ -307,8 +306,8 @@ uInt32 Thumbulator::read_register ( uInt32 reg )
fprintf(stderr,"0x%08X\n",data);
return(data);
}
fprintf(stderr,"invalid cpsr mode 0x%08X\n",cpsr);
exit(1);
sprintf(errorMsg,"invalid cpsr mode 0x%08X\n",cpsr);
throw errorMsg;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
@ -329,8 +328,8 @@ uInt32 Thumbulator::write_register ( uInt32 reg, uInt32 data )
}
return(data);
}
fprintf(stderr,"invalid cpsr mode 0x%08X\n",cpsr);
exit(1);
sprintf(errorMsg,"invalid cpsr mode 0x%08X\n",cpsr);
throw errorMsg;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

View File

@ -111,6 +111,7 @@ class Thumbulator
Int32 DBUG; // dump detailed execution trace
Int32 DISS; // dump Thumb instruction trace
char errorMsg[100];
};
#endif

View File

@ -76,7 +76,7 @@ class Dialog : public GuiObject
void addCancelWidget(Widget* w) { _cancelWidget = w; }
void setFocus(Widget* w);
inline FBSurface& surface() { return *_surface; }
FBSurface& surface() { return *_surface; }
protected:
virtual void draw();
@ -106,7 +106,7 @@ class Dialog : public GuiObject
private:
void buildFocusWidgetList(int id);
inline bool handleNavEvent(Event::Type e);
bool handleNavEvent(Event::Type e);
protected:
Widget* _mouseWidget;

View File

@ -35,20 +35,20 @@ class GameList
GameList();
~GameList();
inline const string& name(int i) const
{ return i < (int)myArray.size() ? myArray[i]._name : EmptyString; }
inline const string& path(int i) const
{ return i < (int)myArray.size() ? myArray[i]._path : EmptyString; }
inline const string& md5(int i) const
{ return i < (int)myArray.size() ? myArray[i]._md5 : EmptyString; }
inline const bool isDir(int i) const
{ return i < (int)myArray.size() ? myArray[i]._isdir: false; }
const string& name(int i) const
{ return i < (int)myArray.size() ? myArray[i]._name : EmptyString; }
const string& path(int i) const
{ return i < (int)myArray.size() ? myArray[i]._path : EmptyString; }
const string& md5(int i) const
{ return i < (int)myArray.size() ? myArray[i]._md5 : EmptyString; }
const bool isDir(int i) const
{ return i < (int)myArray.size() ? myArray[i]._isdir: false; }
inline void setMd5(int i, const string& md5)
{ myArray[i]._md5 = md5; }
void setMd5(int i, const string& md5)
{ myArray[i]._md5 = md5; }
inline int size() const { return myArray.size(); }
inline void clear() { myArray.clear(); }
int size() const { return myArray.size(); }
void clear() { myArray.clear(); }
void appendGame(const string& name, const string& path, const string& md5,
bool isDir = false);

View File

@ -29,9 +29,8 @@
namespace GUI {
/*! @brief simple class for handling both 2D position and size
This small class is an helper for position and size values.
/*
This small class is an helper for position and size values.
*/
struct Point
{
@ -46,23 +45,22 @@ struct Point
bool operator!=(const Point & p) const { return x != p.x || y != p.y; };
};
/*! @brief simple class for handling a rectangular zone.
/*
This small class is an helper for rectangles.
Note: This implementation is built around the assumption that (top,left) is
part of the rectangle, but (bottom,right) is not! This is reflected in
various methods, including contains(), intersects() and others.
This small class is an helper for rectangles.
Note: This implementation is built around the assumption that (top,left) is
part of the rectangle, but (bottom,right) is not! This is reflected in
various methods, including contains(), intersects() and others.
Another very wide spread approach to rectangle classes treats (bottom,right)
also as a part of the rectangle.
Coneptually, both are sound, but the approach we use saves many intermediate
computations (like computing the height in our case is done by doing this:
height = bottom - top;
while in the alternate system, it would be
height = bottom - top + 1;
When writing code using our Rect class, always keep this principle in mind!
Another very wide spread approach to rectangle classes treats (bottom,right)
also as a part of the rectangle.
Coneptually, both are sound, but the approach we use saves many intermediate
computations (like computing the height in our case is done by doing this:
height = bottom - top;
while in the alternate system, it would be
height = bottom - top + 1;
When writing code using our Rect class, always keep this principle in mind!
*/
struct Rect
{
@ -75,109 +73,99 @@ struct Rect
{
assert(isValidRect());
}
inline int x() const { return left; }
inline int y() const { return top; }
inline int width() const { return right - left; }
inline int height() const { return bottom - top; }
void setWidth(int aWidth) {
right = left + aWidth;
}
int x() const { return left; }
int y() const { return top; }
int width() const { return right - left; }
int height() const { return bottom - top; }
void setHeight(int aHeight) {
bottom = top + aHeight;
}
void setWidth(int aWidth) { right = left + aWidth; }
void setHeight(int aHeight) { bottom = top + aHeight; }
/*! @brief check if given position is inside this rectangle
/*
@param x the horizontal position to check
@param y the vertical position to check
@param x the horizontal position to check
@param y the vertical position to check
@return true if the given position is inside this rectangle, false otherwise
*/
bool contains(int x, int y) const {
return (left <= x) && (x < right) && (top <= y) && (y < bottom);
}
@return true if the given position is inside this rectangle, false otherwise
*/
bool contains(int x, int y) const {
return (left <= x) && (x < right) && (top <= y) && (y < bottom);
}
/*! @brief check if given point is inside this rectangle
@param p the point to check
@return true if the given point is inside this rectangle, false otherwise
*/
bool contains(const Point & p) const {
return contains(p.x, p.y);
}
/*
@param p the point to check
/*! @brief check if given rectangle intersects with this rectangle
@param r the rectangle to check
@return true if the given rectangle is inside the rectangle, false otherwise
*/
bool intersects(const Rect & r) const {
return (left < r.right) && (r.left < right) && (top < r.bottom) && (r.top < bottom);
}
@return true if the given point is inside this rectangle, false otherwise
*/
bool contains(const Point & p) const { return contains(p.x, p.y); }
/*! @brief extend this rectangle so that it contains r
@param r the rectangle to extend by
*/
void extend(const Rect & r) {
left = BSPF_min(left, r.left);
right = BSPF_max(right, r.right);
top = BSPF_min(top, r.top);
bottom = BSPF_max(bottom, r.bottom);
}
/*! @brief extend this rectangle in all four directions by the given number of pixels
@param offset the size to grow by
*/
void grow(int offset) {
top -= offset;
left -= offset;
bottom += offset;
right += offset;
}
void clip(const Rect & r) {
assert(isValidRect());
assert(r.isValidRect());
/*
@param r the rectangle to check
if (top < r.top) top = r.top;
else if (top > r.bottom) top = r.bottom;
@return true if the given rectangle is inside the rectangle, false otherwise
*/
bool intersects(const Rect & r) const {
return (left < r.right) && (r.left < right) && (top < r.bottom) && (r.top < bottom);
}
if (left < r.left) left = r.left;
else if (left > r.right) left = r.right;
/*
@param r the rectangle to extend by
*/
void extend(const Rect & r) {
left = BSPF_min(left, r.left);
right = BSPF_max(right, r.right);
top = BSPF_min(top, r.top);
bottom = BSPF_max(bottom, r.bottom);
}
if (bottom > r.bottom) bottom = r.bottom;
else if (bottom < r.top) bottom = r.top;
/*
Extend this rectangle in all four directions by the given number of pixels
if (right > r.right) right = r.right;
else if (right < r.left) right = r.left;
}
void clip(int maxw, int maxh) {
clip(Rect(0, 0, maxw, maxh));
}
bool isValidRect() const {
return (left <= right && top <= bottom);
}
void moveTo(int x, int y) {
bottom += y - top;
right += x - left;
top = y;
left = x;
}
void moveTo(const Point & p) {
moveTo(p.x, p.y);
}
@param offset the size to grow by
*/
void grow(int offset) {
top -= offset;
left -= offset;
bottom += offset;
right += offset;
}
void clip(const Rect & r) {
assert(isValidRect());
assert(r.isValidRect());
if (top < r.top) top = r.top;
else if (top > r.bottom) top = r.bottom;
if (left < r.left) left = r.left;
else if (left > r.right) left = r.right;
if (bottom > r.bottom) bottom = r.bottom;
else if (bottom < r.top) bottom = r.top;
if (right > r.right) right = r.right;
else if (right < r.left) right = r.left;
}
void clip(int maxw, int maxh) {
clip(Rect(0, 0, maxw, maxh));
}
bool isValidRect() const {
return (left <= right && top <= bottom);
}
void moveTo(int x, int y) {
bottom += y - top;
right += x - left;
top = y;
left = x;
}
void moveTo(const Point & p) {
moveTo(p.x, p.y);
}
};
} // End of namespace Common
} // End of namespace Common
#endif

View File

@ -1,55 +0,0 @@
//============================================================================
//
// SSSS tt lll lll
// SS SS tt ll ll
// SS tttttt eeee ll ll aaaa
// SSSS tt ee ee ll ll aa
// SS tt eeeeee ll ll aaaaa -- "An Atari 2600 VCS Emulator"
// SS SS tt ee ll ll aa aa
// SSSS ttt eeeee llll llll aaaaa
//
// Copyright (c) 1995-2011 by Bradford W. Mott, Stephen Anthony
// and the Stella Team
//
// See the file "License.txt" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
//
// $Id$
//============================================================================
#import <Cocoa/Cocoa.h>
/**
Menus window class and support functions for the Macintosh OS X
SDL port of Stella.
@author Mark Grebe <atarimac@cox.net>
*/
@interface Menus : NSObject
{
IBOutlet id preferencesMenuItem;
IBOutlet id openMenuItem;
IBOutlet id restartMenuItem;
IBOutlet id screenBiggerMenuItem;
IBOutlet id screenSmallerMenuItem;
IBOutlet id fullScreenMenuItem;
IBOutlet id increaseVolumeMenuItem;
IBOutlet id decreaseVolumeMenuItem;
}
+ (Menus *)sharedInstance;
- (void)pushKeyEvent:(int)key:(bool)shift:(bool)cmd:(bool)control;
- (IBAction)biggerScreen:(id)sender;
- (IBAction)smallerScreen:(id)sender;
- (IBAction)fullScreen:(id)sender;
- (IBAction)restartGame:(id)sender;
- (IBAction)doPrefs:(id)sender;
- (IBAction)volumePlus:(id)sender;
- (IBAction)volumeMinus:(id)sender;
- (void)setEmulationMenus;
- (void)setLauncherMenus;
- (void)setOptionsMenus;
- (void)setCommandMenus;
- (void)setDebuggerMenus;
@end

View File

@ -1,213 +0,0 @@
//============================================================================
//
// SSSS tt lll lll
// SS SS tt ll ll
// SS tttttt eeee ll ll aaaa
// SSSS tt ee ee ll ll aa
// SS tt eeeeee ll ll aaaaa -- "An Atari 2600 VCS Emulator"
// SS SS tt ee ll ll aa aa
// SSSS ttt eeeee llll llll aaaaa
//
// Copyright (c) 1995-2011 by Bradford W. Mott, Stephen Anthony
// and the Stella Team
//
// See the file "License.txt" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
//
// $Id$
//============================================================================
#import <Cocoa/Cocoa.h>
#import "SDL.h"
#import "Menus.h"
#import "MenusEvents.h"
#define QZ_m 0x2E
#define QZ_o 0x1F
#define QZ_h 0x04
#define QZ_SLASH 0x2C
extern void macOSXSendMenuEvent(int event);
/*------------------------------------------------------------------------------
* releaseCmdKeys - This method fixes an issue when modal windows are used with
* the Mac OSX version of the SDL library.
* As the SDL normally captures all keystrokes, but we need to type in some
* Mac windows, all of the control menu windows run in modal mode. However,
* when this happens, the release of the command key and the shortcut key
* are not sent to SDL. We have to manually cause these events to happen
* to keep the SDL library in a sane state, otherwise only everyother shortcut
* keypress will work.
*-----------------------------------------------------------------------------*/
void releaseCmdKeys(NSString *character, int keyCode)
{
NSEvent *event1, *event2;
NSPoint point;
event1 = [NSEvent keyEventWithType:NSKeyUp location:point modifierFlags:0
timestamp:0.0 windowNumber:0 context:nil characters:character
charactersIgnoringModifiers:character isARepeat:NO keyCode:keyCode];
[NSApp postEvent:event1 atStart:NO];
event2 = [NSEvent keyEventWithType:NSFlagsChanged location:point modifierFlags:0
timestamp:0.0 windowNumber:0 context:nil characters:nil
charactersIgnoringModifiers:nil isARepeat:NO keyCode:0];
[NSApp postEvent:event2 atStart:NO];
}
void setEmulationMenus(void)
{
[[Menus sharedInstance] setEmulationMenus];
}
void setLauncherMenus(void)
{
[[Menus sharedInstance] setLauncherMenus];
}
void setOptionsMenus(void)
{
[[Menus sharedInstance] setOptionsMenus];
}
void setCommandMenus(void)
{
[[Menus sharedInstance] setCommandMenus];
}
void setDebuggerMenus(void)
{
[[Menus sharedInstance] setDebuggerMenus];
}
@implementation Menus
static Menus *sharedInstance = nil;
+ (Menus *)sharedInstance
{
return sharedInstance ? sharedInstance : [[self alloc] init];
}
- (id)init
{
sharedInstance = self;
return(self);
}
-(void)pushKeyEvent:(int)key:(bool)shift:(bool)cmd:(bool)control
{
SDL_Event theEvent;
theEvent.key.type = SDL_KEYDOWN;
theEvent.key.state = SDL_PRESSED;
theEvent.key.keysym.scancode = 0;
theEvent.key.keysym.sym = key;
theEvent.key.keysym.mod = 0;
if (cmd)
theEvent.key.keysym.mod = KMOD_META;
else if (control)
theEvent.key.keysym.mod = KMOD_CTRL;
if (shift)
theEvent.key.keysym.mod |= KMOD_SHIFT;
theEvent.key.keysym.unicode = 0;
SDL_PushEvent(&theEvent);
}
- (IBAction)biggerScreen:(id)sender
{
[self pushKeyEvent:SDLK_EQUALS:NO:YES:NO];
}
- (IBAction)smallerScreen:(id)sender
{
[self pushKeyEvent:SDLK_MINUS:NO:YES:NO];
}
- (IBAction)fullScreen:(id)sender
{
[self pushKeyEvent:SDLK_RETURN:NO:YES:NO];
}
- (IBAction)restartGame:(id)sender
{
[self pushKeyEvent:SDLK_r:NO:NO:YES];
}
- (IBAction)doPrefs:(id)sender
{
[self pushKeyEvent:SDLK_TAB:NO:NO:NO];
}
- (IBAction)volumePlus:(id)sender
{
macOSXSendMenuEvent(MENU_VOLUME_INCREASE);
}
- (IBAction)volumeMinus:(id)sender
{
macOSXSendMenuEvent(MENU_VOLUME_DECREASE);
}
- (void)setEmulationMenus
{
[preferencesMenuItem setTarget:self];
[openMenuItem setTarget:self];
[restartMenuItem setTarget:self];
[screenBiggerMenuItem setTarget:self];
[screenSmallerMenuItem setTarget:self];
[fullScreenMenuItem setTarget:self];
[increaseVolumeMenuItem setTarget:self];
[decreaseVolumeMenuItem setTarget:self];
}
- (void)setLauncherMenus
{
[preferencesMenuItem setTarget:nil];
[openMenuItem setTarget:nil];
[restartMenuItem setTarget:nil];
[screenBiggerMenuItem setTarget:nil];
[screenSmallerMenuItem setTarget:nil];
[fullScreenMenuItem setTarget:self];
[increaseVolumeMenuItem setTarget:nil];
[decreaseVolumeMenuItem setTarget:nil];
}
- (void)setOptionsMenus
{
[preferencesMenuItem setTarget:nil];
[openMenuItem setTarget:nil];
[restartMenuItem setTarget:nil];
[screenBiggerMenuItem setTarget:self];
[screenSmallerMenuItem setTarget:self];
[fullScreenMenuItem setTarget:self];
[increaseVolumeMenuItem setTarget:nil];
[decreaseVolumeMenuItem setTarget:nil];
}
- (void)setCommandMenus
{
[preferencesMenuItem setTarget:nil];
[openMenuItem setTarget:nil];
[restartMenuItem setTarget:nil];
[screenBiggerMenuItem setTarget:self];
[screenSmallerMenuItem setTarget:self];
[fullScreenMenuItem setTarget:self];
[increaseVolumeMenuItem setTarget:nil];
[decreaseVolumeMenuItem setTarget:nil];
}
- (void)setDebuggerMenus
{
[preferencesMenuItem setTarget:nil];
[openMenuItem setTarget:nil];
[restartMenuItem setTarget:nil];
[screenBiggerMenuItem setTarget:self];
[screenSmallerMenuItem setTarget:self];
[fullScreenMenuItem setTarget:self];
[increaseVolumeMenuItem setTarget:nil];
[decreaseVolumeMenuItem setTarget:nil];
}
@end

View File

@ -17,60 +17,7 @@
// $Id$
//============================================================================
#include <cstdlib>
#include <sstream>
#include <fstream>
#include <string>
#include <unistd.h>
#include <sys/stat.h>
#include <sys/types.h>
#include <sys/param.h> /* for MAXPATHLEN */
#include "bspf.hxx"
#include "OSystem.hxx"
#include "OSystemMACOSX.hxx"
#include "MenusEvents.h"
extern "C" {
void macOpenConsole(char *romname);
void setEmulationMenus(void);
void setLauncherMenus(void);
void setOptionsMenus(void);
void setCommandMenus(void);
void setDebuggerMenus(void);
void macOSXSendMenuEvent(int event);
}
// Pointer to the main parent osystem object or the null pointer
extern OSystem* theOSystem;
extern char parentdir[MAXPATHLEN];
// Allow the SDL main object to pass request to open cartridges from
// the OS into the application.
void macOpenConsole(char *romname)
{
theOSystem->deleteConsole();
theOSystem->createConsole(romname);
}
// Allow the Menus Objective-C object to pass event sends into the
// application.
void macOSXSendMenuEvent(int event)
{
switch(event)
{
case MENU_OPEN:
theOSystem->eventHandler().handleEvent(Event::LauncherMode, 1);
break;
case MENU_VOLUME_INCREASE:
theOSystem->eventHandler().handleEvent(Event::VolumeIncrease, 1);
break;
case MENU_VOLUME_DECREASE:
theOSystem->eventHandler().handleEvent(Event::VolumeDecrease, 1);
break;
}
}
/**
Each derived class is responsible for calling the following methods
@ -96,33 +43,3 @@ OSystemMACOSX::OSystemMACOSX()
OSystemMACOSX::~OSystemMACOSX()
{
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void OSystemMACOSX::stateChanged(EventHandler::State state)
{
switch(state)
{
case EventHandler::S_EMULATE:
setEmulationMenus();
break;
case EventHandler::S_LAUNCHER:
setLauncherMenus();
break;
case EventHandler::S_MENU:
setOptionsMenus();
break;
case EventHandler::S_CMDMENU:
setCommandMenus();
break;
case EventHandler::S_DEBUGGER:
setDebuggerMenus();
break;
default:
break;
}
}

View File

@ -20,10 +20,8 @@
#ifndef OSYSTEM_MACOSX_HXX
#define OSYSTEM_MACOSX_HXX
#include "bspf.hxx"
#include "OSystem.hxx"
/**
This class defines UNIX-like OS's (MacOS X) system specific settings.
@ -42,12 +40,6 @@ class OSystemMACOSX : public OSystem
Destructor
*/
virtual ~OSystemMACOSX();
public:
/**
Informs the OSystem of a change in EventHandler state.
*/
void stateChanged(EventHandler::State state);
};
#endif

View File

@ -12,6 +12,7 @@
</object>
<object class="NSMutableArray" key="IBDocument.EditedObjectIDs">
<bool key="EncodedWithXMLCoder">YES</bool>
<integer value="29"/>
</object>
<object class="NSArray" key="IBDocument.PluginDependencies">
<bool key="EncodedWithXMLCoder">YES</bool>
@ -65,14 +66,6 @@
<reference key="NSOnImage" ref="643725106"/>
<reference key="NSMixedImage" ref="871915098"/>
</object>
<object class="NSMenuItem" id="1066215367">
<reference key="NSMenu" ref="436681932"/>
<string key="NSTitle">Preferences...</string>
<string type="base64-UTF8" key="NSKeyEquiv">CQ</string>
<int key="NSMnemonicLoc">2147483647</int>
<reference key="NSOnImage" ref="643725106"/>
<reference key="NSMixedImage" ref="871915098"/>
</object>
<object class="NSMenuItem" id="1018074706">
<reference key="NSMenu" ref="436681932"/>
<bool key="NSIsDisabled">YES</bool>
@ -97,129 +90,6 @@
<string key="NSName">_NSAppleMenu</string>
</object>
</object>
<object class="NSMenuItem" id="921862423">
<reference key="NSMenu" ref="458184759"/>
<string key="NSTitle">File</string>
<string key="NSKeyEquiv"/>
<int key="NSKeyEquivModMask">1048576</int>
<int key="NSMnemonicLoc">2147483647</int>
<reference key="NSOnImage" ref="643725106"/>
<reference key="NSMixedImage" ref="871915098"/>
<string key="NSAction">submenuAction:</string>
<object class="NSMenu" key="NSSubmenu" id="563078089">
<object class="NSMutableString" key="NSTitle">
<characters key="NS.bytes">File</characters>
</object>
<object class="NSMutableArray" key="NSMenuItems">
<bool key="EncodedWithXMLCoder">YES</bool>
<object class="NSMenuItem" id="685277797">
<reference key="NSMenu" ref="563078089"/>
<string key="NSTitle">Open New Cartridge…</string>
<string type="base64-UTF8" key="NSKeyEquiv">Gw</string>
<int key="NSMnemonicLoc">2147483647</int>
<reference key="NSOnImage" ref="643725106"/>
<reference key="NSMixedImage" ref="871915098"/>
</object>
<object class="NSMenuItem" id="355632901">
<reference key="NSMenu" ref="563078089"/>
<string key="NSTitle">Restart Current Game</string>
<string key="NSKeyEquiv">r</string>
<int key="NSKeyEquivModMask">1048576</int>
<int key="NSMnemonicLoc">2147483647</int>
<reference key="NSOnImage" ref="643725106"/>
<reference key="NSMixedImage" ref="871915098"/>
</object>
</object>
</object>
</object>
<object class="NSMenuItem" id="1066835396">
<reference key="NSMenu" ref="458184759"/>
<string key="NSTitle">Video</string>
<string key="NSKeyEquiv"/>
<int key="NSKeyEquivModMask">1048576</int>
<int key="NSMnemonicLoc">2147483647</int>
<reference key="NSOnImage" ref="643725106"/>
<reference key="NSMixedImage" ref="871915098"/>
<string key="NSAction">submenuAction:</string>
<object class="NSMenu" key="NSSubmenu" id="600826152">
<string key="NSTitle">Video</string>
<object class="NSMutableArray" key="NSMenuItems">
<bool key="EncodedWithXMLCoder">YES</bool>
<object class="NSMenuItem" id="444796077">
<reference key="NSMenu" ref="600826152"/>
<string key="NSTitle">Screen Bigger</string>
<string key="NSKeyEquiv">+</string>
<int key="NSKeyEquivModMask">1048576</int>
<int key="NSMnemonicLoc">2147483647</int>
<reference key="NSOnImage" ref="643725106"/>
<reference key="NSMixedImage" ref="871915098"/>
</object>
<object class="NSMenuItem" id="419817989">
<reference key="NSMenu" ref="600826152"/>
<string key="NSTitle">Screen Smaller</string>
<string key="NSKeyEquiv">_</string>
<int key="NSKeyEquivModMask">1048576</int>
<int key="NSMnemonicLoc">2147483647</int>
<reference key="NSOnImage" ref="643725106"/>
<reference key="NSMixedImage" ref="871915098"/>
</object>
<object class="NSMenuItem" id="455501136">
<reference key="NSMenu" ref="600826152"/>
<bool key="NSIsDisabled">YES</bool>
<bool key="NSIsSeparator">YES</bool>
<string key="NSTitle"/>
<string key="NSKeyEquiv"/>
<int key="NSKeyEquivModMask">1048576</int>
<int key="NSMnemonicLoc">2147483647</int>
<reference key="NSOnImage" ref="643725106"/>
<reference key="NSMixedImage" ref="871915098"/>
</object>
<object class="NSMenuItem" id="608769272">
<reference key="NSMenu" ref="600826152"/>
<string key="NSTitle">Fullscreen</string>
<string type="base64-UTF8" key="NSKeyEquiv">DQ</string>
<int key="NSKeyEquivModMask">1048576</int>
<int key="NSMnemonicLoc">2147483647</int>
<reference key="NSOnImage" ref="643725106"/>
<reference key="NSMixedImage" ref="871915098"/>
</object>
</object>
</object>
</object>
<object class="NSMenuItem" id="1063813785">
<reference key="NSMenu" ref="458184759"/>
<string key="NSTitle">Sound</string>
<string key="NSKeyEquiv"/>
<int key="NSKeyEquivModMask">1048576</int>
<int key="NSMnemonicLoc">2147483647</int>
<reference key="NSOnImage" ref="643725106"/>
<reference key="NSMixedImage" ref="871915098"/>
<string key="NSAction">submenuAction:</string>
<object class="NSMenu" key="NSSubmenu" id="507184922">
<string key="NSTitle">Sound</string>
<object class="NSMutableArray" key="NSMenuItems">
<bool key="EncodedWithXMLCoder">YES</bool>
<object class="NSMenuItem" id="742583516">
<reference key="NSMenu" ref="507184922"/>
<string key="NSTitle">Increase Volume</string>
<string key="NSKeyEquiv">}</string>
<int key="NSKeyEquivModMask">1048576</int>
<int key="NSMnemonicLoc">2147483647</int>
<reference key="NSOnImage" ref="643725106"/>
<reference key="NSMixedImage" ref="871915098"/>
</object>
<object class="NSMenuItem" id="456965787">
<reference key="NSMenu" ref="507184922"/>
<string key="NSTitle">Decrease Volume</string>
<string key="NSKeyEquiv">{</string>
<int key="NSKeyEquivModMask">1048576</int>
<int key="NSMnemonicLoc">2147483647</int>
<reference key="NSOnImage" ref="643725106"/>
<reference key="NSMixedImage" ref="871915098"/>
</object>
</object>
</object>
</object>
<object class="NSMenuItem" id="728343460">
<reference key="NSMenu" ref="458184759"/>
<string key="NSTitle">Help</string>
@ -256,9 +126,6 @@
<object class="NSCustomObject" id="770704366">
<string key="NSClassName">NSFontManager</string>
</object>
<object class="NSCustomObject" id="465429176">
<string key="NSClassName">Menus</string>
</object>
<object class="NSCustomObject" id="957538386">
<string key="NSClassName">AboutBox</string>
</object>
@ -290,70 +157,6 @@
</object>
<int key="connectionID">469</int>
</object>
<object class="IBConnectionRecord">
<object class="IBActionConnection" key="connection">
<string key="label">openCart:</string>
<reference key="source" ref="465429176"/>
<reference key="destination" ref="685277797"/>
</object>
<int key="connectionID">607</int>
</object>
<object class="IBConnectionRecord">
<object class="IBActionConnection" key="connection">
<string key="label">biggerScreen:</string>
<reference key="source" ref="465429176"/>
<reference key="destination" ref="444796077"/>
</object>
<int key="connectionID">608</int>
</object>
<object class="IBConnectionRecord">
<object class="IBActionConnection" key="connection">
<string key="label">smallerScreen:</string>
<reference key="source" ref="465429176"/>
<reference key="destination" ref="419817989"/>
</object>
<int key="connectionID">609</int>
</object>
<object class="IBConnectionRecord">
<object class="IBActionConnection" key="connection">
<string key="label">fullScreen:</string>
<reference key="source" ref="465429176"/>
<reference key="destination" ref="608769272"/>
</object>
<int key="connectionID">610</int>
</object>
<object class="IBConnectionRecord">
<object class="IBActionConnection" key="connection">
<string key="label">restartGame:</string>
<reference key="source" ref="465429176"/>
<reference key="destination" ref="355632901"/>
</object>
<int key="connectionID">685</int>
</object>
<object class="IBConnectionRecord">
<object class="IBActionConnection" key="connection">
<string key="label">doPrefs:</string>
<reference key="source" ref="465429176"/>
<reference key="destination" ref="1066215367"/>
</object>
<int key="connectionID">690</int>
</object>
<object class="IBConnectionRecord">
<object class="IBActionConnection" key="connection">
<string key="label">volumePlus:</string>
<reference key="source" ref="465429176"/>
<reference key="destination" ref="742583516"/>
</object>
<int key="connectionID">691</int>
</object>
<object class="IBConnectionRecord">
<object class="IBActionConnection" key="connection">
<string key="label">volumeMinus:</string>
<reference key="source" ref="465429176"/>
<reference key="destination" ref="456965787"/>
</object>
<int key="connectionID">692</int>
</object>
<object class="IBConnectionRecord">
<object class="IBActionConnection" key="connection">
<string key="label">showPanel:</string>
@ -362,70 +165,6 @@
</object>
<int key="connectionID">720</int>
</object>
<object class="IBConnectionRecord">
<object class="IBOutletConnection" key="connection">
<string key="label">screenBiggerMenuItem</string>
<reference key="source" ref="465429176"/>
<reference key="destination" ref="444796077"/>
</object>
<int key="connectionID">721</int>
</object>
<object class="IBConnectionRecord">
<object class="IBOutletConnection" key="connection">
<string key="label">screenSmallerMenuItem</string>
<reference key="source" ref="465429176"/>
<reference key="destination" ref="419817989"/>
</object>
<int key="connectionID">722</int>
</object>
<object class="IBConnectionRecord">
<object class="IBOutletConnection" key="connection">
<string key="label">fullScreenMenuItem</string>
<reference key="source" ref="465429176"/>
<reference key="destination" ref="608769272"/>
</object>
<int key="connectionID">723</int>
</object>
<object class="IBConnectionRecord">
<object class="IBOutletConnection" key="connection">
<string key="label">increaseVolumeMenuItem</string>
<reference key="source" ref="465429176"/>
<reference key="destination" ref="742583516"/>
</object>
<int key="connectionID">739</int>
</object>
<object class="IBConnectionRecord">
<object class="IBOutletConnection" key="connection">
<string key="label">decreaseVolumeMenuItem</string>
<reference key="source" ref="465429176"/>
<reference key="destination" ref="456965787"/>
</object>
<int key="connectionID">740</int>
</object>
<object class="IBConnectionRecord">
<object class="IBOutletConnection" key="connection">
<string key="label">openMenuItem</string>
<reference key="source" ref="465429176"/>
<reference key="destination" ref="685277797"/>
</object>
<int key="connectionID">742</int>
</object>
<object class="IBConnectionRecord">
<object class="IBOutletConnection" key="connection">
<string key="label">restartMenuItem</string>
<reference key="source" ref="465429176"/>
<reference key="destination" ref="355632901"/>
</object>
<int key="connectionID">743</int>
</object>
<object class="IBConnectionRecord">
<object class="IBOutletConnection" key="connection">
<string key="label">preferencesMenuItem</string>
<reference key="source" ref="465429176"/>
<reference key="destination" ref="1066215367"/>
</object>
<int key="connectionID">746</int>
</object>
</object>
<object class="IBMutableOrderedSet" key="objectRecords">
<object class="NSArray" key="orderedObjects">
@ -457,9 +196,6 @@
<bool key="EncodedWithXMLCoder">YES</bool>
<reference ref="847870142"/>
<reference ref="728343460"/>
<reference ref="1066835396"/>
<reference ref="921862423"/>
<reference ref="1063813785"/>
</object>
<reference key="parent" ref="0"/>
<string key="objectName">MainMenu</string>
@ -480,7 +216,6 @@
<bool key="EncodedWithXMLCoder">YES</bool>
<reference ref="1070722212"/>
<reference ref="1018074706"/>
<reference ref="1066215367"/>
<reference ref="101237657"/>
</object>
<reference key="parent" ref="847870142"/>
@ -495,11 +230,6 @@
<reference key="object" ref="1018074706"/>
<reference key="parent" ref="436681932"/>
</object>
<object class="IBObjectRecord">
<int key="objectID">293</int>
<reference key="object" ref="1066215367"/>
<reference key="parent" ref="436681932"/>
</object>
<object class="IBObjectRecord">
<int key="objectID">717</int>
<reference key="object" ref="101237657"/>
@ -528,105 +258,6 @@
<reference key="object" ref="175274894"/>
<reference key="parent" ref="718015693"/>
</object>
<object class="IBObjectRecord">
<int key="objectID">332</int>
<reference key="object" ref="1066835396"/>
<object class="NSMutableArray" key="children">
<bool key="EncodedWithXMLCoder">YES</bool>
<reference ref="600826152"/>
</object>
<reference key="parent" ref="458184759"/>
</object>
<object class="IBObjectRecord">
<int key="objectID">328</int>
<reference key="object" ref="600826152"/>
<object class="NSMutableArray" key="children">
<bool key="EncodedWithXMLCoder">YES</bool>
<reference ref="608769272"/>
<reference ref="444796077"/>
<reference ref="419817989"/>
<reference ref="455501136"/>
</object>
<reference key="parent" ref="1066835396"/>
</object>
<object class="IBObjectRecord">
<int key="objectID">333</int>
<reference key="object" ref="608769272"/>
<reference key="parent" ref="600826152"/>
</object>
<object class="IBObjectRecord">
<int key="objectID">343</int>
<reference key="object" ref="444796077"/>
<reference key="parent" ref="600826152"/>
</object>
<object class="IBObjectRecord">
<int key="objectID">344</int>
<reference key="object" ref="419817989"/>
<reference key="parent" ref="600826152"/>
</object>
<object class="IBObjectRecord">
<int key="objectID">347</int>
<reference key="object" ref="455501136"/>
<reference key="parent" ref="600826152"/>
</object>
<object class="IBObjectRecord">
<int key="objectID">357</int>
<reference key="object" ref="921862423"/>
<object class="NSMutableArray" key="children">
<bool key="EncodedWithXMLCoder">YES</bool>
<reference ref="563078089"/>
</object>
<reference key="parent" ref="458184759"/>
</object>
<object class="IBObjectRecord">
<int key="objectID">358</int>
<reference key="object" ref="563078089"/>
<object class="NSMutableArray" key="children">
<bool key="EncodedWithXMLCoder">YES</bool>
<reference ref="685277797"/>
<reference ref="355632901"/>
</object>
<reference key="parent" ref="921862423"/>
</object>
<object class="IBObjectRecord">
<int key="objectID">368</int>
<reference key="object" ref="685277797"/>
<reference key="parent" ref="563078089"/>
</object>
<object class="IBObjectRecord">
<int key="objectID">684</int>
<reference key="object" ref="355632901"/>
<reference key="parent" ref="563078089"/>
</object>
<object class="IBObjectRecord">
<int key="objectID">686</int>
<reference key="object" ref="1063813785"/>
<object class="NSMutableArray" key="children">
<bool key="EncodedWithXMLCoder">YES</bool>
<reference ref="507184922"/>
</object>
<reference key="parent" ref="458184759"/>
</object>
<object class="IBObjectRecord">
<int key="objectID">687</int>
<reference key="object" ref="507184922"/>
<object class="NSMutableArray" key="children">
<bool key="EncodedWithXMLCoder">YES</bool>
<reference ref="742583516"/>
<reference ref="456965787"/>
</object>
<reference key="parent" ref="1063813785"/>
</object>
<object class="IBObjectRecord">
<int key="objectID">688</int>
<reference key="object" ref="742583516"/>
<reference key="parent" ref="507184922"/>
</object>
<object class="IBObjectRecord">
<int key="objectID">689</int>
<reference key="object" ref="456965787"/>
<reference key="parent" ref="507184922"/>
</object>
<object class="IBObjectRecord">
<int key="objectID">194</int>
<reference key="object" ref="73995279"/>
@ -639,12 +270,6 @@
<reference key="parent" ref="0"/>
<string key="objectName">Font Manager</string>
</object>
<object class="IBObjectRecord">
<int key="objectID">596</int>
<reference key="object" ref="465429176"/>
<reference key="parent" ref="0"/>
<string key="objectName">Menus</string>
</object>
<object class="IBObjectRecord">
<int key="objectID">719</int>
<reference key="object" ref="957538386"/>
@ -679,45 +304,11 @@
<string>29.IBEditorWindowLastContentRect</string>
<string>29.IBPluginDependency</string>
<string>29.ImportedFromIB2</string>
<string>293.IBPluginDependency</string>
<string>293.ImportedFromIB2</string>
<string>328.IBEditorWindowLastContentRect</string>
<string>328.IBPluginDependency</string>
<string>328.ImportedFromIB2</string>
<string>332.IBPluginDependency</string>
<string>332.ImportedFromIB2</string>
<string>333.IBPluginDependency</string>
<string>333.ImportedFromIB2</string>
<string>343.IBPluginDependency</string>
<string>343.ImportedFromIB2</string>
<string>344.IBPluginDependency</string>
<string>344.ImportedFromIB2</string>
<string>347.IBPluginDependency</string>
<string>347.ImportedFromIB2</string>
<string>357.IBPluginDependency</string>
<string>357.ImportedFromIB2</string>
<string>358.IBEditorWindowLastContentRect</string>
<string>358.IBPluginDependency</string>
<string>358.ImportedFromIB2</string>
<string>368.IBPluginDependency</string>
<string>368.ImportedFromIB2</string>
<string>56.IBPluginDependency</string>
<string>56.ImportedFromIB2</string>
<string>57.IBEditorWindowLastContentRect</string>
<string>57.IBPluginDependency</string>
<string>57.ImportedFromIB2</string>
<string>596.ImportedFromIB2</string>
<string>684.IBPluginDependency</string>
<string>684.ImportedFromIB2</string>
<string>686.IBPluginDependency</string>
<string>686.ImportedFromIB2</string>
<string>687.IBEditorWindowLastContentRect</string>
<string>687.IBPluginDependency</string>
<string>687.ImportedFromIB2</string>
<string>688.IBPluginDependency</string>
<string>688.ImportedFromIB2</string>
<string>689.IBPluginDependency</string>
<string>689.ImportedFromIB2</string>
<string>717.IBPluginDependency</string>
<string>717.ImportedFromIB2</string>
<string>719.ImportedFromIB2</string>
@ -726,7 +317,7 @@
<bool key="EncodedWithXMLCoder">YES</bool>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<boolean value="YES"/>
<string>{{580, 691}, {143, 23}}</string>
<string>{{420, 691}, {143, 23}}</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<boolean value="YES"/>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
@ -737,46 +328,12 @@
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<boolean value="YES"/>
<boolean value="YES"/>
<string>{{329, 714}, {312, 20}}</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<boolean value="YES"/>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<boolean value="YES"/>
<string>{{462, 641}, {179, 73}}</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<boolean value="YES"/>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<boolean value="YES"/>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<boolean value="YES"/>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<boolean value="YES"/>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<boolean value="YES"/>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<boolean value="YES"/>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<boolean value="YES"/>
<string>{{420, 671}, {232, 43}}</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<boolean value="YES"/>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<boolean value="YES"/>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<boolean value="YES"/>
<string>{{341, 641}, {183, 73}}</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<boolean value="YES"/>
<boolean value="YES"/>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<boolean value="YES"/>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<boolean value="YES"/>
<string>{{519, 671}, {188, 43}}</string>
<string>{{329, 714}, {152, 20}}</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<boolean value="YES"/>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<boolean value="YES"/>
<string>{{341, 661}, {179, 53}}</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<boolean value="YES"/>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
@ -900,437 +457,6 @@
<string key="minorKey"/>
</object>
</object>
<object class="IBPartialClassDescription">
<string key="className">Menus</string>
<string key="superclassName">NSObject</string>
<object class="NSMutableDictionary" key="actions">
<bool key="EncodedWithXMLCoder">YES</bool>
<object class="NSArray" key="dict.sortedKeys">
<bool key="EncodedWithXMLCoder">YES</bool>
<string>biggerScreen:</string>
<string>doPrefs:</string>
<string>fullScreen:</string>
<string>openCart:</string>
<string>paddleChange:</string>
<string>restartGame:</string>
<string>smallerScreen:</string>
<string>volumeMinus:</string>
<string>volumePlus:</string>
</object>
<object class="NSMutableArray" key="dict.values">
<bool key="EncodedWithXMLCoder">YES</bool>
<string>id</string>
<string>id</string>
<string>id</string>
<string>id</string>
<string>id</string>
<string>id</string>
<string>id</string>
<string>id</string>
<string>id</string>
</object>
</object>
<object class="NSMutableDictionary" key="actionInfosByName">
<bool key="EncodedWithXMLCoder">YES</bool>
<object class="NSArray" key="dict.sortedKeys">
<bool key="EncodedWithXMLCoder">YES</bool>
<string>biggerScreen:</string>
<string>doPrefs:</string>
<string>fullScreen:</string>
<string>openCart:</string>
<string>paddleChange:</string>
<string>restartGame:</string>
<string>smallerScreen:</string>
<string>volumeMinus:</string>
<string>volumePlus:</string>
</object>
<object class="NSMutableArray" key="dict.values">
<bool key="EncodedWithXMLCoder">YES</bool>
<object class="IBActionInfo">
<string key="name">biggerScreen:</string>
<string key="candidateClassName">id</string>
</object>
<object class="IBActionInfo">
<string key="name">doPrefs:</string>
<string key="candidateClassName">id</string>
</object>
<object class="IBActionInfo">
<string key="name">fullScreen:</string>
<string key="candidateClassName">id</string>
</object>
<object class="IBActionInfo">
<string key="name">openCart:</string>
<string key="candidateClassName">id</string>
</object>
<object class="IBActionInfo">
<string key="name">paddleChange:</string>
<string key="candidateClassName">id</string>
</object>
<object class="IBActionInfo">
<string key="name">restartGame:</string>
<string key="candidateClassName">id</string>
</object>
<object class="IBActionInfo">
<string key="name">smallerScreen:</string>
<string key="candidateClassName">id</string>
</object>
<object class="IBActionInfo">
<string key="name">volumeMinus:</string>
<string key="candidateClassName">id</string>
</object>
<object class="IBActionInfo">
<string key="name">volumePlus:</string>
<string key="candidateClassName">id</string>
</object>
</object>
</object>
<object class="NSMutableDictionary" key="outlets">
<bool key="EncodedWithXMLCoder">YES</bool>
<object class="NSArray" key="dict.sortedKeys">
<bool key="EncodedWithXMLCoder">YES</bool>
<string>decreaseVolumeMenuItem</string>
<string>fullScreenMenuItem</string>
<string>increaseVolumeMenuItem</string>
<string>mousePaddle0MenuItem</string>
<string>mousePaddle1MenuItem</string>
<string>mousePaddle2MenuItem</string>
<string>mousePaddle3MenuItem</string>
<string>openMenuItem</string>
<string>preferencesMenuItem</string>
<string>restartMenuItem</string>
<string>screenBiggerMenuItem</string>
<string>screenSmallerMenuItem</string>
</object>
<object class="NSMutableArray" key="dict.values">
<bool key="EncodedWithXMLCoder">YES</bool>
<string>id</string>
<string>id</string>
<string>id</string>
<string>id</string>
<string>id</string>
<string>id</string>
<string>id</string>
<string>id</string>
<string>id</string>
<string>id</string>
<string>id</string>
<string>id</string>
</object>
</object>
<object class="NSMutableDictionary" key="toOneOutletInfosByName">
<bool key="EncodedWithXMLCoder">YES</bool>
<object class="NSArray" key="dict.sortedKeys">
<bool key="EncodedWithXMLCoder">YES</bool>
<string>decreaseVolumeMenuItem</string>
<string>fullScreenMenuItem</string>
<string>increaseVolumeMenuItem</string>
<string>mousePaddle0MenuItem</string>
<string>mousePaddle1MenuItem</string>
<string>mousePaddle2MenuItem</string>
<string>mousePaddle3MenuItem</string>
<string>openMenuItem</string>
<string>preferencesMenuItem</string>
<string>restartMenuItem</string>
<string>screenBiggerMenuItem</string>
<string>screenSmallerMenuItem</string>
</object>
<object class="NSMutableArray" key="dict.values">
<bool key="EncodedWithXMLCoder">YES</bool>
<object class="IBToOneOutletInfo">
<string key="name">decreaseVolumeMenuItem</string>
<string key="candidateClassName">id</string>
</object>
<object class="IBToOneOutletInfo">
<string key="name">fullScreenMenuItem</string>
<string key="candidateClassName">id</string>
</object>
<object class="IBToOneOutletInfo">
<string key="name">increaseVolumeMenuItem</string>
<string key="candidateClassName">id</string>
</object>
<object class="IBToOneOutletInfo">
<string key="name">mousePaddle0MenuItem</string>
<string key="candidateClassName">id</string>
</object>
<object class="IBToOneOutletInfo">
<string key="name">mousePaddle1MenuItem</string>
<string key="candidateClassName">id</string>
</object>
<object class="IBToOneOutletInfo">
<string key="name">mousePaddle2MenuItem</string>
<string key="candidateClassName">id</string>
</object>
<object class="IBToOneOutletInfo">
<string key="name">mousePaddle3MenuItem</string>
<string key="candidateClassName">id</string>
</object>
<object class="IBToOneOutletInfo">
<string key="name">openMenuItem</string>
<string key="candidateClassName">id</string>
</object>
<object class="IBToOneOutletInfo">
<string key="name">preferencesMenuItem</string>
<string key="candidateClassName">id</string>
</object>
<object class="IBToOneOutletInfo">
<string key="name">restartMenuItem</string>
<string key="candidateClassName">id</string>
</object>
<object class="IBToOneOutletInfo">
<string key="name">screenBiggerMenuItem</string>
<string key="candidateClassName">id</string>
</object>
<object class="IBToOneOutletInfo">
<string key="name">screenSmallerMenuItem</string>
<string key="candidateClassName">id</string>
</object>
</object>
</object>
<object class="IBClassDescriptionSource" key="sourceIdentifier">
<string key="majorKey">IBProjectSource</string>
<string key="minorKey">Menus.h</string>
</object>
</object>
<object class="IBPartialClassDescription">
<string key="className">Menus</string>
<string key="superclassName">NSObject</string>
<object class="NSMutableDictionary" key="actions">
<bool key="EncodedWithXMLCoder">YES</bool>
<object class="NSArray" key="dict.sortedKeys">
<bool key="EncodedWithXMLCoder">YES</bool>
<string>grabMouse:</string>
<string>heightMinus:</string>
<string>heightPlus:</string>
<string>mergeProps:</string>
<string>ntscPalMode:</string>
<string>pauseGame:</string>
<string>saveProps:</string>
<string>togglePallette:</string>
<string>widthMinus:</string>
<string>widthPlus:</string>
<string>xStartMinus:</string>
<string>xStartPlus:</string>
<string>yStartMinus:</string>
<string>yStartPlus:</string>
</object>
<object class="NSMutableArray" key="dict.values">
<bool key="EncodedWithXMLCoder">YES</bool>
<string>id</string>
<string>id</string>
<string>id</string>
<string>id</string>
<string>id</string>
<string>id</string>
<string>id</string>
<string>id</string>
<string>id</string>
<string>id</string>
<string>id</string>
<string>id</string>
<string>id</string>
<string>id</string>
</object>
</object>
<object class="NSMutableDictionary" key="actionInfosByName">
<bool key="EncodedWithXMLCoder">YES</bool>
<object class="NSArray" key="dict.sortedKeys">
<bool key="EncodedWithXMLCoder">YES</bool>
<string>grabMouse:</string>
<string>heightMinus:</string>
<string>heightPlus:</string>
<string>mergeProps:</string>
<string>ntscPalMode:</string>
<string>pauseGame:</string>
<string>saveProps:</string>
<string>togglePallette:</string>
<string>widthMinus:</string>
<string>widthPlus:</string>
<string>xStartMinus:</string>
<string>xStartPlus:</string>
<string>yStartMinus:</string>
<string>yStartPlus:</string>
</object>
<object class="NSMutableArray" key="dict.values">
<bool key="EncodedWithXMLCoder">YES</bool>
<object class="IBActionInfo">
<string key="name">grabMouse:</string>
<string key="candidateClassName">id</string>
</object>
<object class="IBActionInfo">
<string key="name">heightMinus:</string>
<string key="candidateClassName">id</string>
</object>
<object class="IBActionInfo">
<string key="name">heightPlus:</string>
<string key="candidateClassName">id</string>
</object>
<object class="IBActionInfo">
<string key="name">mergeProps:</string>
<string key="candidateClassName">id</string>
</object>
<object class="IBActionInfo">
<string key="name">ntscPalMode:</string>
<string key="candidateClassName">id</string>
</object>
<object class="IBActionInfo">
<string key="name">pauseGame:</string>
<string key="candidateClassName">id</string>
</object>
<object class="IBActionInfo">
<string key="name">saveProps:</string>
<string key="candidateClassName">id</string>
</object>
<object class="IBActionInfo">
<string key="name">togglePallette:</string>
<string key="candidateClassName">id</string>
</object>
<object class="IBActionInfo">
<string key="name">widthMinus:</string>
<string key="candidateClassName">id</string>
</object>
<object class="IBActionInfo">
<string key="name">widthPlus:</string>
<string key="candidateClassName">id</string>
</object>
<object class="IBActionInfo">
<string key="name">xStartMinus:</string>
<string key="candidateClassName">id</string>
</object>
<object class="IBActionInfo">
<string key="name">xStartPlus:</string>
<string key="candidateClassName">id</string>
</object>
<object class="IBActionInfo">
<string key="name">yStartMinus:</string>
<string key="candidateClassName">id</string>
</object>
<object class="IBActionInfo">
<string key="name">yStartPlus:</string>
<string key="candidateClassName">id</string>
</object>
</object>
</object>
<object class="NSMutableDictionary" key="outlets">
<bool key="EncodedWithXMLCoder">YES</bool>
<object class="NSArray" key="dict.sortedKeys">
<bool key="EncodedWithXMLCoder">YES</bool>
<string>decreaseHeightMenuItem</string>
<string>decreaseWidthMenuItem</string>
<string>decreaseXStartMenuItem</string>
<string>decreaseYStartMenuItem</string>
<string>grabMouseMenuItem</string>
<string>increaseHeightMenuItem</string>
<string>increaseWidthMenuItem</string>
<string>increaseXStartMenuItem</string>
<string>increaseYStartMenuItem</string>
<string>mergePropsMenuItem</string>
<string>ntscPalMenuItem</string>
<string>pauseMenuItem</string>
<string>savePropsMenuItem</string>
<string>togglePalletteMenuItem</string>
</object>
<object class="NSMutableArray" key="dict.values">
<bool key="EncodedWithXMLCoder">YES</bool>
<string>id</string>
<string>id</string>
<string>id</string>
<string>id</string>
<string>id</string>
<string>id</string>
<string>id</string>
<string>id</string>
<string>id</string>
<string>id</string>
<string>id</string>
<string>id</string>
<string>id</string>
<string>id</string>
</object>
</object>
<object class="NSMutableDictionary" key="toOneOutletInfosByName">
<bool key="EncodedWithXMLCoder">YES</bool>
<object class="NSArray" key="dict.sortedKeys">
<bool key="EncodedWithXMLCoder">YES</bool>
<string>decreaseHeightMenuItem</string>
<string>decreaseWidthMenuItem</string>
<string>decreaseXStartMenuItem</string>
<string>decreaseYStartMenuItem</string>
<string>grabMouseMenuItem</string>
<string>increaseHeightMenuItem</string>
<string>increaseWidthMenuItem</string>
<string>increaseXStartMenuItem</string>
<string>increaseYStartMenuItem</string>
<string>mergePropsMenuItem</string>
<string>ntscPalMenuItem</string>
<string>pauseMenuItem</string>
<string>savePropsMenuItem</string>
<string>togglePalletteMenuItem</string>
</object>
<object class="NSMutableArray" key="dict.values">
<bool key="EncodedWithXMLCoder">YES</bool>
<object class="IBToOneOutletInfo">
<string key="name">decreaseHeightMenuItem</string>
<string key="candidateClassName">id</string>
</object>
<object class="IBToOneOutletInfo">
<string key="name">decreaseWidthMenuItem</string>
<string key="candidateClassName">id</string>
</object>
<object class="IBToOneOutletInfo">
<string key="name">decreaseXStartMenuItem</string>
<string key="candidateClassName">id</string>
</object>
<object class="IBToOneOutletInfo">
<string key="name">decreaseYStartMenuItem</string>
<string key="candidateClassName">id</string>
</object>
<object class="IBToOneOutletInfo">
<string key="name">grabMouseMenuItem</string>
<string key="candidateClassName">id</string>
</object>
<object class="IBToOneOutletInfo">
<string key="name">increaseHeightMenuItem</string>
<string key="candidateClassName">id</string>
</object>
<object class="IBToOneOutletInfo">
<string key="name">increaseWidthMenuItem</string>
<string key="candidateClassName">id</string>
</object>
<object class="IBToOneOutletInfo">
<string key="name">increaseXStartMenuItem</string>
<string key="candidateClassName">id</string>
</object>
<object class="IBToOneOutletInfo">
<string key="name">increaseYStartMenuItem</string>
<string key="candidateClassName">id</string>
</object>
<object class="IBToOneOutletInfo">
<string key="name">mergePropsMenuItem</string>
<string key="candidateClassName">id</string>
</object>
<object class="IBToOneOutletInfo">
<string key="name">ntscPalMenuItem</string>
<string key="candidateClassName">id</string>
</object>
<object class="IBToOneOutletInfo">
<string key="name">pauseMenuItem</string>
<string key="candidateClassName">id</string>
</object>
<object class="IBToOneOutletInfo">
<string key="name">savePropsMenuItem</string>
<string key="candidateClassName">id</string>
</object>
<object class="IBToOneOutletInfo">
<string key="name">togglePalletteMenuItem</string>
<string key="candidateClassName">id</string>
</object>
</object>
</object>
<object class="IBClassDescriptionSource" key="sourceIdentifier">
<string key="majorKey">IBUserSource</string>
<string key="minorKey"/>
</object>
</object>
<object class="IBPartialClassDescription">
<string key="className">SDLMain</string>
<string key="superclassName">NSObject</string>

Binary file not shown.

View File

@ -78,7 +78,6 @@
2D91741B09BA90380026E9FF /* OSystem.hxx in Headers */ = {isa = PBXBuildFile; fileRef = 2DDBEB7508457B7D00812C11 /* OSystem.hxx */; };
2D91741C09BA90380026E9FF /* unzip.h in Headers */ = {isa = PBXBuildFile; fileRef = 2DDBEB7708457B7D00812C11 /* unzip.h */; };
2D91741D09BA90380026E9FF /* Preferences.h in Headers */ = {isa = PBXBuildFile; fileRef = 2DDBEBE3084582C400812C11 /* Preferences.h */; };
2D91741E09BA90380026E9FF /* Menus.h in Headers */ = {isa = PBXBuildFile; fileRef = 2D62C40E085011050063A4A3 /* Menus.h */; };
2D91741F09BA90380026E9FF /* AboutBox.h in Headers */ = {isa = PBXBuildFile; fileRef = 2D1A6CD4085135F9007CDBA8 /* AboutBox.h */; };
2D91742009BA90380026E9FF /* ConsoleFont.hxx in Headers */ = {isa = PBXBuildFile; fileRef = 2D9217FA0857CC88001D664B /* ConsoleFont.hxx */; };
2D91742109BA90380026E9FF /* Font.hxx in Headers */ = {isa = PBXBuildFile; fileRef = 2D9217FC0857CC88001D664B /* Font.hxx */; };
@ -192,7 +191,6 @@
2D9174C009BA90380026E9FF /* OSystem.cxx in Sources */ = {isa = PBXBuildFile; fileRef = 2DDBEB7408457B7D00812C11 /* OSystem.cxx */; };
2D9174C109BA90380026E9FF /* unzip.c in Sources */ = {isa = PBXBuildFile; fileRef = 2DDBEB7608457B7D00812C11 /* unzip.c */; };
2D9174C209BA90380026E9FF /* Preferences.m in Sources */ = {isa = PBXBuildFile; fileRef = 2DDBEBE4084582C400812C11 /* Preferences.m */; };
2D9174C309BA90380026E9FF /* Menus.m in Sources */ = {isa = PBXBuildFile; fileRef = 2D47A45208491D4500ABFB6A /* Menus.m */; };
2D9174C409BA90380026E9FF /* AboutBox.m in Sources */ = {isa = PBXBuildFile; fileRef = 2D1A6CD5085135F9007CDBA8 /* AboutBox.m */; };
2D9174C509BA90380026E9FF /* Font.cxx in Sources */ = {isa = PBXBuildFile; fileRef = 2D9217FB0857CC88001D664B /* Font.cxx */; };
2D9174C609BA90380026E9FF /* Debugger.cxx in Sources */ = {isa = PBXBuildFile; fileRef = 2D659E2D085D3DD6005D96C8 /* Debugger.cxx */; };
@ -478,8 +476,6 @@
2D403BCE08611A69001E31A1 /* PackedBitArray.cxx */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; name = PackedBitArray.cxx; path = ../debugger/PackedBitArray.cxx; sourceTree = SOURCE_ROOT; };
2D403BCF08611A69001E31A1 /* PackedBitArray.hxx */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.h; name = PackedBitArray.hxx; path = ../debugger/PackedBitArray.hxx; sourceTree = SOURCE_ROOT; };
2D4764C806683C5F00F63D87 /* SDL.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; path = SDL.framework; sourceTree = SOURCE_ROOT; };
2D47A45208491D4500ABFB6A /* Menus.m */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.objc; path = Menus.m; sourceTree = SOURCE_ROOT; };
2D62C40E085011050063A4A3 /* Menus.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = Menus.h; sourceTree = SOURCE_ROOT; };
2D659E2D085D3DD6005D96C8 /* Debugger.cxx */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; name = Debugger.cxx; path = ../debugger/Debugger.cxx; sourceTree = SOURCE_ROOT; };
2D659E2E085D3DD6005D96C8 /* Debugger.hxx */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.h; name = Debugger.hxx; path = ../debugger/Debugger.hxx; sourceTree = SOURCE_ROOT; };
2D659E31085D3DD6005D96C8 /* DebuggerParser.cxx */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; name = DebuggerParser.cxx; path = ../debugger/DebuggerParser.cxx; sourceTree = SOURCE_ROOT; };
@ -798,8 +794,6 @@
children = (
2D1A6CD4085135F9007CDBA8 /* AboutBox.h */,
2D1A6CD5085135F9007CDBA8 /* AboutBox.m */,
2D62C40E085011050063A4A3 /* Menus.h */,
2D47A45208491D4500ABFB6A /* Menus.m */,
2DDBEBE3084582C400812C11 /* Preferences.h */,
2DDBEBE4084582C400812C11 /* Preferences.m */,
F5A47A9D01A0482F01D3D55B /* SDLMain.h */,
@ -1373,7 +1367,6 @@
2D91741B09BA90380026E9FF /* OSystem.hxx in Headers */,
2D91741C09BA90380026E9FF /* unzip.h in Headers */,
2D91741D09BA90380026E9FF /* Preferences.h in Headers */,
2D91741E09BA90380026E9FF /* Menus.h in Headers */,
2D91741F09BA90380026E9FF /* AboutBox.h in Headers */,
2D91742009BA90380026E9FF /* ConsoleFont.hxx in Headers */,
2D91742109BA90380026E9FF /* Font.hxx in Headers */,
@ -1642,7 +1635,6 @@
2D9174C009BA90380026E9FF /* OSystem.cxx in Sources */,
2D9174C109BA90380026E9FF /* unzip.c in Sources */,
2D9174C209BA90380026E9FF /* Preferences.m in Sources */,
2D9174C309BA90380026E9FF /* Menus.m in Sources */,
2D9174C409BA90380026E9FF /* AboutBox.m in Sources */,
2D9174C509BA90380026E9FF /* Font.cxx in Sources */,
2D9174C609BA90380026E9FF /* Debugger.cxx in Sources */,

View File

@ -78,7 +78,6 @@
2D91741B09BA90380026E9FF /* OSystem.hxx in Headers */ = {isa = PBXBuildFile; fileRef = 2DDBEB7508457B7D00812C11 /* OSystem.hxx */; };
2D91741C09BA90380026E9FF /* unzip.h in Headers */ = {isa = PBXBuildFile; fileRef = 2DDBEB7708457B7D00812C11 /* unzip.h */; };
2D91741D09BA90380026E9FF /* Preferences.h in Headers */ = {isa = PBXBuildFile; fileRef = 2DDBEBE3084582C400812C11 /* Preferences.h */; };
2D91741E09BA90380026E9FF /* Menus.h in Headers */ = {isa = PBXBuildFile; fileRef = 2D62C40E085011050063A4A3 /* Menus.h */; };
2D91741F09BA90380026E9FF /* AboutBox.h in Headers */ = {isa = PBXBuildFile; fileRef = 2D1A6CD4085135F9007CDBA8 /* AboutBox.h */; };
2D91742009BA90380026E9FF /* ConsoleFont.hxx in Headers */ = {isa = PBXBuildFile; fileRef = 2D9217FA0857CC88001D664B /* ConsoleFont.hxx */; };
2D91742109BA90380026E9FF /* Font.hxx in Headers */ = {isa = PBXBuildFile; fileRef = 2D9217FC0857CC88001D664B /* Font.hxx */; };
@ -191,7 +190,6 @@
2D9174C009BA90380026E9FF /* OSystem.cxx in Sources */ = {isa = PBXBuildFile; fileRef = 2DDBEB7408457B7D00812C11 /* OSystem.cxx */; };
2D9174C109BA90380026E9FF /* unzip.c in Sources */ = {isa = PBXBuildFile; fileRef = 2DDBEB7608457B7D00812C11 /* unzip.c */; };
2D9174C209BA90380026E9FF /* Preferences.m in Sources */ = {isa = PBXBuildFile; fileRef = 2DDBEBE4084582C400812C11 /* Preferences.m */; };
2D9174C309BA90380026E9FF /* Menus.m in Sources */ = {isa = PBXBuildFile; fileRef = 2D47A45208491D4500ABFB6A /* Menus.m */; };
2D9174C409BA90380026E9FF /* AboutBox.m in Sources */ = {isa = PBXBuildFile; fileRef = 2D1A6CD5085135F9007CDBA8 /* AboutBox.m */; };
2D9174C509BA90380026E9FF /* Font.cxx in Sources */ = {isa = PBXBuildFile; fileRef = 2D9217FB0857CC88001D664B /* Font.cxx */; };
2D9174C609BA90380026E9FF /* Debugger.cxx in Sources */ = {isa = PBXBuildFile; fileRef = 2D659E2D085D3DD6005D96C8 /* Debugger.cxx */; };
@ -476,8 +474,6 @@
2D403BCE08611A69001E31A1 /* PackedBitArray.cxx */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; name = PackedBitArray.cxx; path = ../debugger/PackedBitArray.cxx; sourceTree = SOURCE_ROOT; };
2D403BCF08611A69001E31A1 /* PackedBitArray.hxx */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.h; name = PackedBitArray.hxx; path = ../debugger/PackedBitArray.hxx; sourceTree = SOURCE_ROOT; };
2D4764C806683C5F00F63D87 /* SDL.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; path = SDL.framework; sourceTree = SOURCE_ROOT; };
2D47A45208491D4500ABFB6A /* Menus.m */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.objc; path = Menus.m; sourceTree = SOURCE_ROOT; };
2D62C40E085011050063A4A3 /* Menus.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = Menus.h; sourceTree = SOURCE_ROOT; };
2D659E2D085D3DD6005D96C8 /* Debugger.cxx */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; name = Debugger.cxx; path = ../debugger/Debugger.cxx; sourceTree = SOURCE_ROOT; };
2D659E2E085D3DD6005D96C8 /* Debugger.hxx */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.h; name = Debugger.hxx; path = ../debugger/Debugger.hxx; sourceTree = SOURCE_ROOT; };
2D659E31085D3DD6005D96C8 /* DebuggerParser.cxx */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; name = DebuggerParser.cxx; path = ../debugger/DebuggerParser.cxx; sourceTree = SOURCE_ROOT; };
@ -796,8 +792,6 @@
children = (
2D1A6CD4085135F9007CDBA8 /* AboutBox.h */,
2D1A6CD5085135F9007CDBA8 /* AboutBox.m */,
2D62C40E085011050063A4A3 /* Menus.h */,
2D47A45208491D4500ABFB6A /* Menus.m */,
2DDBEBE3084582C400812C11 /* Preferences.h */,
2DDBEBE4084582C400812C11 /* Preferences.m */,
F5A47A9D01A0482F01D3D55B /* SDLMain.h */,
@ -1370,7 +1364,6 @@
2D91741B09BA90380026E9FF /* OSystem.hxx in Headers */,
2D91741C09BA90380026E9FF /* unzip.h in Headers */,
2D91741D09BA90380026E9FF /* Preferences.h in Headers */,
2D91741E09BA90380026E9FF /* Menus.h in Headers */,
2D91741F09BA90380026E9FF /* AboutBox.h in Headers */,
2D91742009BA90380026E9FF /* ConsoleFont.hxx in Headers */,
2D91742109BA90380026E9FF /* Font.hxx in Headers */,
@ -1641,7 +1634,6 @@
2D9174C009BA90380026E9FF /* OSystem.cxx in Sources */,
2D9174C109BA90380026E9FF /* unzip.c in Sources */,
2D9174C209BA90380026E9FF /* Preferences.m in Sources */,
2D9174C309BA90380026E9FF /* Menus.m in Sources */,
2D9174C409BA90380026E9FF /* AboutBox.m in Sources */,
2D9174C509BA90380026E9FF /* Font.cxx in Sources */,
2D9174C609BA90380026E9FF /* Debugger.cxx in Sources */,

View File

@ -1,577 +0,0 @@
/* example.c -- usage example of the zlib compression library
* Copyright (C) 1995-2006 Jean-loup Gailly.
* For conditions of distribution and use, see copyright notice in zlib.h
*/
/* @(#) $Id$ */
#include "zlib.h"
#include <stdio.h>
#ifdef STDC
# include <string.h>
# include <stdlib.h>
#endif
#if defined(VMS) || defined(RISCOS)
# define TESTFILE "foo-gz"
#else
# define TESTFILE "foo.gz"
#endif
#define CHECK_ERR(err, msg) { \
if (err != Z_OK) { \
fprintf(stderr, "%s error: %d\n", msg, err); \
exit(1); \
} \
}
const char hello[] = "hello, hello!";
/* "hello world" would be more standard, but the repeated "hello"
* stresses the compression code better, sorry...
*/
const char dictionary[] = "hello";
uLong dictId; /* Adler32 value of the dictionary */
void test_compress OF((Byte *compr, uLong comprLen,
Byte *uncompr, uLong uncomprLen));
void test_gzio OF((const char *fname,
Byte *uncompr, uLong uncomprLen));
void test_deflate OF((Byte *compr, uLong comprLen));
void test_inflate OF((Byte *compr, uLong comprLen,
Byte *uncompr, uLong uncomprLen));
void test_large_deflate OF((Byte *compr, uLong comprLen,
Byte *uncompr, uLong uncomprLen));
void test_large_inflate OF((Byte *compr, uLong comprLen,
Byte *uncompr, uLong uncomprLen));
void test_flush OF((Byte *compr, uLong *comprLen));
void test_sync OF((Byte *compr, uLong comprLen,
Byte *uncompr, uLong uncomprLen));
void test_dict_deflate OF((Byte *compr, uLong comprLen));
void test_dict_inflate OF((Byte *compr, uLong comprLen,
Byte *uncompr, uLong uncomprLen));
int main OF((int argc, char *argv[]));
/* ===========================================================================
* Test compress() and uncompress()
*/
void test_compress(
Byte *compr,
uLong comprLen,
Byte *uncompr,
uLong uncomprLen)
{
int err;
uLong len = (uLong)strlen(hello)+1;
err = compress(compr, &comprLen, (const Bytef*)hello, len);
CHECK_ERR(err, "compress");
strcpy((char*)uncompr, "garbage");
err = uncompress(uncompr, &uncomprLen, compr, comprLen);
CHECK_ERR(err, "uncompress");
if (strcmp((char*)uncompr, hello)) {
fprintf(stderr, "bad uncompress\n");
exit(1);
} else {
printf("uncompress(): %s\n", (char *)uncompr);
}
}
/* ===========================================================================
* Test read/write of .gz files
*/
void test_gzio(
const char *fname,
Byte *uncompr,
uLong uncomprLen)
{
#ifdef NO_GZCOMPRESS
fprintf(stderr, "NO_GZCOMPRESS -- gz* functions cannot compress\n");
#else
int err;
int len = (int)strlen(hello)+1;
gzFile file;
z_off_t pos;
file = gzopen(fname, "wb");
if (file == NULL) {
fprintf(stderr, "gzopen error\n");
exit(1);
}
gzputc(file, 'h');
if (gzputs(file, "ello") != 4) {
fprintf(stderr, "gzputs err: %s\n", gzerror(file, &err));
exit(1);
}
if (gzprintf(file, ", %s!", "hello") != 8) {
fprintf(stderr, "gzprintf err: %s\n", gzerror(file, &err));
exit(1);
}
gzseek(file, 1L, SEEK_CUR); /* add one zero byte */
gzclose(file);
file = gzopen(fname, "rb");
if (file == NULL) {
fprintf(stderr, "gzopen error\n");
exit(1);
}
strcpy((char*)uncompr, "garbage");
if (gzread(file, uncompr, (unsigned)uncomprLen) != len) {
fprintf(stderr, "gzread err: %s\n", gzerror(file, &err));
exit(1);
}
if (strcmp((char*)uncompr, hello)) {
fprintf(stderr, "bad gzread: %s\n", (char*)uncompr);
exit(1);
} else {
printf("gzread(): %s\n", (char*)uncompr);
}
pos = gzseek(file, -8L, SEEK_CUR);
if (pos != 6 || gztell(file) != pos) {
fprintf(stderr, "gzseek error, pos=%ld, gztell=%ld\n",
(long)pos, (long)gztell(file));
exit(1);
}
if (gzgetc(file) != ' ') {
fprintf(stderr, "gzgetc error\n");
exit(1);
}
if (gzungetc(' ', file) != ' ') {
fprintf(stderr, "gzungetc error\n");
exit(1);
}
gzgets(file, (char*)uncompr, (int)uncomprLen);
if (strlen((char*)uncompr) != 7) { /* " hello!" */
fprintf(stderr, "gzgets err after gzseek: %s\n", gzerror(file, &err));
exit(1);
}
if (strcmp((char*)uncompr, hello + 6)) {
fprintf(stderr, "bad gzgets after gzseek\n");
exit(1);
} else {
printf("gzgets() after gzseek: %s\n", (char*)uncompr);
}
gzclose(file);
#endif
}
/* ===========================================================================
* Test deflate() with small buffers
*/
void test_deflate(
Byte *compr,
uLong comprLen)
{
z_stream c_stream; /* compression stream */
int err;
uLong len = (uLong)strlen(hello)+1;
c_stream.zalloc = (alloc_func)0;
c_stream.zfree = (free_func)0;
c_stream.opaque = (voidpf)0;
err = deflateInit(&c_stream, Z_DEFAULT_COMPRESSION);
CHECK_ERR(err, "deflateInit");
c_stream.next_in = (Bytef*)hello;
c_stream.next_out = compr;
while (c_stream.total_in != len && c_stream.total_out < comprLen) {
c_stream.avail_in = c_stream.avail_out = 1; /* force small buffers */
err = deflate(&c_stream, Z_NO_FLUSH);
CHECK_ERR(err, "deflate");
}
/* Finish the stream, still forcing small buffers: */
for (;;) {
c_stream.avail_out = 1;
err = deflate(&c_stream, Z_FINISH);
if (err == Z_STREAM_END) break;
CHECK_ERR(err, "deflate");
}
err = deflateEnd(&c_stream);
CHECK_ERR(err, "deflateEnd");
}
/* ===========================================================================
* Test inflate() with small buffers
*/
void test_inflate(
Byte *compr,
uLong comprLen,
Byte *uncompr,
uLong uncomprLen)
{
int err;
z_stream d_stream; /* decompression stream */
strcpy((char*)uncompr, "garbage");
d_stream.zalloc = (alloc_func)0;
d_stream.zfree = (free_func)0;
d_stream.opaque = (voidpf)0;
d_stream.next_in = compr;
d_stream.avail_in = 0;
d_stream.next_out = uncompr;
err = inflateInit(&d_stream);
CHECK_ERR(err, "inflateInit");
while (d_stream.total_out < uncomprLen && d_stream.total_in < comprLen) {
d_stream.avail_in = d_stream.avail_out = 1; /* force small buffers */
err = inflate(&d_stream, Z_NO_FLUSH);
if (err == Z_STREAM_END) break;
CHECK_ERR(err, "inflate");
}
err = inflateEnd(&d_stream);
CHECK_ERR(err, "inflateEnd");
if (strcmp((char*)uncompr, hello)) {
fprintf(stderr, "bad inflate\n");
exit(1);
} else {
printf("inflate(): %s\n", (char *)uncompr);
}
}
/* ===========================================================================
* Test deflate() with large buffers and dynamic change of compression level
*/
void test_large_deflate(
Byte *compr,
uLong comprLen,
Byte *uncompr,
uLong uncomprLen)
{
z_stream c_stream; /* compression stream */
int err;
c_stream.zalloc = (alloc_func)0;
c_stream.zfree = (free_func)0;
c_stream.opaque = (voidpf)0;
err = deflateInit(&c_stream, Z_BEST_SPEED);
CHECK_ERR(err, "deflateInit");
c_stream.next_out = compr;
c_stream.avail_out = (uInt)comprLen;
/* At this point, uncompr is still mostly zeroes, so it should compress
* very well:
*/
c_stream.next_in = uncompr;
c_stream.avail_in = (uInt)uncomprLen;
err = deflate(&c_stream, Z_NO_FLUSH);
CHECK_ERR(err, "deflate");
if (c_stream.avail_in != 0) {
fprintf(stderr, "deflate not greedy\n");
exit(1);
}
/* Feed in already compressed data and switch to no compression: */
deflateParams(&c_stream, Z_NO_COMPRESSION, Z_DEFAULT_STRATEGY);
c_stream.next_in = compr;
c_stream.avail_in = (uInt)comprLen/2;
err = deflate(&c_stream, Z_NO_FLUSH);
CHECK_ERR(err, "deflate");
/* Switch back to compressing mode: */
deflateParams(&c_stream, Z_BEST_COMPRESSION, Z_FILTERED);
c_stream.next_in = uncompr;
c_stream.avail_in = (uInt)uncomprLen;
err = deflate(&c_stream, Z_NO_FLUSH);
CHECK_ERR(err, "deflate");
err = deflate(&c_stream, Z_FINISH);
if (err != Z_STREAM_END) {
fprintf(stderr, "deflate should report Z_STREAM_END\n");
exit(1);
}
err = deflateEnd(&c_stream);
CHECK_ERR(err, "deflateEnd");
}
/* ===========================================================================
* Test inflate() with large buffers
*/
void test_large_inflate(
Byte *compr,
uLong comprLen,
Byte *uncompr,
uLong uncomprLen)
{
int err;
z_stream d_stream; /* decompression stream */
strcpy((char*)uncompr, "garbage");
d_stream.zalloc = (alloc_func)0;
d_stream.zfree = (free_func)0;
d_stream.opaque = (voidpf)0;
d_stream.next_in = compr;
d_stream.avail_in = (uInt)comprLen;
err = inflateInit(&d_stream);
CHECK_ERR(err, "inflateInit");
for (;;) {
d_stream.next_out = uncompr; /* discard the output */
d_stream.avail_out = (uInt)uncomprLen;
err = inflate(&d_stream, Z_NO_FLUSH);
if (err == Z_STREAM_END) break;
CHECK_ERR(err, "large inflate");
}
err = inflateEnd(&d_stream);
CHECK_ERR(err, "inflateEnd");
if (d_stream.total_out != 2*uncomprLen + comprLen/2) {
fprintf(stderr, "bad large inflate: %ld\n", d_stream.total_out);
exit(1);
} else {
printf("large_inflate(): OK\n");
}
}
/* ===========================================================================
* Test deflate() with full flush
*/
void test_flush(
Byte *compr,
uLong *comprLen)
{
z_stream c_stream; /* compression stream */
int err;
uInt len = (uInt)strlen(hello)+1;
c_stream.zalloc = (alloc_func)0;
c_stream.zfree = (free_func)0;
c_stream.opaque = (voidpf)0;
err = deflateInit(&c_stream, Z_DEFAULT_COMPRESSION);
CHECK_ERR(err, "deflateInit");
c_stream.next_in = (Bytef*)hello;
c_stream.next_out = compr;
c_stream.avail_in = 3;
c_stream.avail_out = (uInt)*comprLen;
err = deflate(&c_stream, Z_FULL_FLUSH);
CHECK_ERR(err, "deflate");
compr[3]++; /* force an error in first compressed block */
c_stream.avail_in = len - 3;
err = deflate(&c_stream, Z_FINISH);
if (err != Z_STREAM_END) {
CHECK_ERR(err, "deflate");
}
err = deflateEnd(&c_stream);
CHECK_ERR(err, "deflateEnd");
*comprLen = c_stream.total_out;
}
/* ===========================================================================
* Test inflateSync()
*/
void test_sync(
Byte *compr,
uLong comprLen,
Byte *uncompr,
uLong uncomprLen)
{
int err;
z_stream d_stream; /* decompression stream */
strcpy((char*)uncompr, "garbage");
d_stream.zalloc = (alloc_func)0;
d_stream.zfree = (free_func)0;
d_stream.opaque = (voidpf)0;
d_stream.next_in = compr;
d_stream.avail_in = 2; /* just read the zlib header */
err = inflateInit(&d_stream);
CHECK_ERR(err, "inflateInit");
d_stream.next_out = uncompr;
d_stream.avail_out = (uInt)uncomprLen;
inflate(&d_stream, Z_NO_FLUSH);
CHECK_ERR(err, "inflate");
d_stream.avail_in = (uInt)comprLen-2; /* read all compressed data */
err = inflateSync(&d_stream); /* but skip the damaged part */
CHECK_ERR(err, "inflateSync");
err = inflate(&d_stream, Z_FINISH);
if (err != Z_DATA_ERROR) {
fprintf(stderr, "inflate should report DATA_ERROR\n");
/* Because of incorrect adler32 */
exit(1);
}
err = inflateEnd(&d_stream);
CHECK_ERR(err, "inflateEnd");
printf("after inflateSync(): hel%s\n", (char *)uncompr);
}
/* ===========================================================================
* Test deflate() with preset dictionary
*/
void test_dict_deflate(
Byte *compr,
uLong comprLen)
{
z_stream c_stream; /* compression stream */
int err;
c_stream.zalloc = (alloc_func)0;
c_stream.zfree = (free_func)0;
c_stream.opaque = (voidpf)0;
err = deflateInit(&c_stream, Z_BEST_COMPRESSION);
CHECK_ERR(err, "deflateInit");
err = deflateSetDictionary(&c_stream,
(const Bytef*)dictionary, sizeof(dictionary));
CHECK_ERR(err, "deflateSetDictionary");
dictId = c_stream.adler;
c_stream.next_out = compr;
c_stream.avail_out = (uInt)comprLen;
c_stream.next_in = (Bytef*)hello;
c_stream.avail_in = (uInt)strlen(hello)+1;
err = deflate(&c_stream, Z_FINISH);
if (err != Z_STREAM_END) {
fprintf(stderr, "deflate should report Z_STREAM_END\n");
exit(1);
}
err = deflateEnd(&c_stream);
CHECK_ERR(err, "deflateEnd");
}
/* ===========================================================================
* Test inflate() with a preset dictionary
*/
void test_dict_inflate(
Byte *compr,
uLong comprLen,
Byte *uncompr,
uLong uncomprLen)
{
int err;
z_stream d_stream; /* decompression stream */
strcpy((char*)uncompr, "garbage");
d_stream.zalloc = (alloc_func)0;
d_stream.zfree = (free_func)0;
d_stream.opaque = (voidpf)0;
d_stream.next_in = compr;
d_stream.avail_in = (uInt)comprLen;
err = inflateInit(&d_stream);
CHECK_ERR(err, "inflateInit");
d_stream.next_out = uncompr;
d_stream.avail_out = (uInt)uncomprLen;
for (;;) {
err = inflate(&d_stream, Z_NO_FLUSH);
if (err == Z_STREAM_END) break;
if (err == Z_NEED_DICT) {
if (d_stream.adler != dictId) {
fprintf(stderr, "unexpected dictionary");
exit(1);
}
err = inflateSetDictionary(&d_stream, (const Bytef*)dictionary,
sizeof(dictionary));
}
CHECK_ERR(err, "inflate with dict");
}
err = inflateEnd(&d_stream);
CHECK_ERR(err, "inflateEnd");
if (strcmp((char*)uncompr, hello)) {
fprintf(stderr, "bad inflate with dict\n");
exit(1);
} else {
printf("inflate with dictionary: %s\n", (char *)uncompr);
}
}
/* ===========================================================================
* Usage: example [output.gz [input.gz]]
*/
int main(
int argc,
char *argv[])
{
Byte *compr, *uncompr;
uLong comprLen = 10000*sizeof(int); /* don't overflow on MSDOS */
uLong uncomprLen = comprLen;
static const char* myVersion = ZLIB_VERSION;
if (zlibVersion()[0] != myVersion[0]) {
fprintf(stderr, "incompatible zlib version\n");
exit(1);
} else if (strcmp(zlibVersion(), ZLIB_VERSION) != 0) {
fprintf(stderr, "warning: different zlib version\n");
}
printf("zlib version %s = 0x%04x, compile flags = 0x%lx\n",
ZLIB_VERSION, ZLIB_VERNUM, zlibCompileFlags());
compr = (Byte*)calloc((uInt)comprLen, 1);
uncompr = (Byte*)calloc((uInt)uncomprLen, 1);
/* compr and uncompr are cleared to avoid reading uninitialized
* data and to ensure that uncompr compresses well.
*/
if (compr == Z_NULL || uncompr == Z_NULL) {
printf("out of memory\n");
exit(1);
}
test_compress(compr, comprLen, uncompr, uncomprLen);
test_gzio((argc > 1 ? argv[1] : TESTFILE),
uncompr, uncomprLen);
test_deflate(compr, comprLen);
test_inflate(compr, comprLen, uncompr, uncomprLen);
test_large_deflate(compr, comprLen, uncompr, uncomprLen);
test_large_inflate(compr, comprLen, uncompr, uncomprLen);
test_flush(compr, &comprLen);
test_sync(compr, comprLen, uncompr, uncomprLen);
comprLen = uncomprLen;
test_dict_deflate(compr, comprLen);
test_dict_inflate(compr, comprLen, uncompr, uncomprLen);
free(compr);
free(uncompr);
return 0;
}