diff --git a/stella/src/cheat/CheatManager.hxx b/stella/src/cheat/CheatManager.hxx index 09ffd4624..c7ea4910e 100644 --- a/stella/src/cheat/CheatManager.hxx +++ b/stella/src/cheat/CheatManager.hxx @@ -13,7 +13,7 @@ // See the file "license" for information on usage and redistribution of // this file, and for a DISCLAIMER OF ALL WARRANTIES. // -// $Id: CheatManager.hxx,v 1.4 2005-11-27 22:37:24 stephena Exp $ +// $Id: CheatManager.hxx,v 1.5 2005-12-09 01:16:13 stephena Exp $ //============================================================================ #ifndef CHEAT_MANAGER_HXX @@ -27,7 +27,7 @@ #include "Cheat.hxx" -typedef GUI::Array CheatList; +typedef Common::Array CheatList; typedef map CheatCodeMap; /** @@ -36,7 +36,7 @@ typedef map CheatCodeMap; the list of all cheats currently in use. @author Stephen Anthony - @version $Id: CheatManager.hxx,v 1.4 2005-11-27 22:37:24 stephena Exp $ + @version $Id: CheatManager.hxx,v 1.5 2005-12-09 01:16:13 stephena Exp $ */ class CheatManager { diff --git a/stella/src/gui/Array.hxx b/stella/src/common/Array.hxx similarity index 95% rename from stella/src/gui/Array.hxx rename to stella/src/common/Array.hxx index 576d22690..529d1d2a2 100644 --- a/stella/src/gui/Array.hxx +++ b/stella/src/common/Array.hxx @@ -13,7 +13,7 @@ // See the file "license" for information on usage and redistribution of // this file, and for a DISCLAIMER OF ALL WARRANTIES. // -// $Id: Array.hxx,v 1.7 2005-07-14 18:28:36 stephena Exp $ +// $Id: Array.hxx,v 1.1 2005-12-09 01:16:13 stephena Exp $ // // Based on code from ScummVM - Scumm Interpreter // Copyright (C) 2002-2004 The ScummVM project @@ -26,7 +26,7 @@ #include "bspf.hxx" -namespace GUI { +namespace Common { template class Array @@ -192,8 +192,8 @@ class Array } // Namespace GUI -typedef GUI::Array IntArray; -typedef GUI::Array BoolArray; -typedef GUI::Array ByteArray; +typedef Common::Array IntArray; +typedef Common::Array BoolArray; +typedef Common::Array ByteArray; #endif diff --git a/stella/src/debugger/EquateList.hxx b/stella/src/debugger/EquateList.hxx index 71b262dac..2980eb0fc 100644 --- a/stella/src/debugger/EquateList.hxx +++ b/stella/src/debugger/EquateList.hxx @@ -13,7 +13,7 @@ // See the file "license" for information on usage and redistribution of // this file, and for a DISCLAIMER OF ALL WARRANTIES. // -// $Id: EquateList.hxx,v 1.11 2005-07-12 02:27:06 urchlay Exp $ +// $Id: EquateList.hxx,v 1.12 2005-12-09 01:16:13 stephena Exp $ //============================================================================ #ifndef EQUATELIST_HXX @@ -30,7 +30,7 @@ using namespace std; typedef map addrToLabel; typedef map labelToAddr; -typedef GUI::Array Equates; +typedef Common::Array Equates; class EquateList { public: diff --git a/stella/src/emucore/Event.cxx b/stella/src/emucore/Event.cxx index c909182fa..178c45574 100644 --- a/stella/src/emucore/Event.cxx +++ b/stella/src/emucore/Event.cxx @@ -13,14 +13,15 @@ // See the file "license" for information on usage and redistribution of // this file, and for a DISCLAIMER OF ALL WARRANTIES. // -// $Id: Event.cxx,v 1.3 2005-06-16 01:11:27 stephena Exp $ +// $Id: Event.cxx,v 1.4 2005-12-09 01:16:13 stephena Exp $ //============================================================================ #include "Event.hxx" // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Event::Event() - : myNumberOfTypes(Event::LastType) + : myNumberOfTypes(Event::LastType), + myEventRecordFlag(true) { // Set all of the events to 0 / false to start with clear(); @@ -29,6 +30,28 @@ Event::Event() // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Event::~Event() { + int events = 0, waits = 0, totalwaits = 0; + cerr << "Event history contains " << myEventHistory.size()/2 << " events\n"; + for(unsigned int i = 0; i < myEventHistory.size(); ++i) + { + int tmp = myEventHistory[i]; + if(tmp < 0) + { + ++waits; + totalwaits += -tmp; + } + else + ++events; + + cerr << tmp << " "; + } + cerr << endl + << "events pairs = " << events/2 + << ", frame waits = " << waits + << ", total frame waits = " << totalwaits + << endl; + + myEventHistory.clear(); } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -41,6 +64,13 @@ Int32 Event::get(Type type) const void Event::set(Type type, Int32 value) { myValues[type] = value; + + // Add to history if we're in recording mode + if(myEventRecordFlag) + { + myEventHistory.push_back(type); + myEventHistory.push_back(value); + } } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -51,3 +81,28 @@ void Event::clear() myValues[i] = 0; } } + +// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +void Event::record(bool enable) +{ + if(myEventRecordFlag == enable) + return; + else + myEventRecordFlag = enable; + + if(myEventRecordFlag) + myEventHistory.clear(); +} + +// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +void Event::nextFrame() +{ + if(myEventRecordFlag) + { + int idx = myEventHistory.size() - 1; + if(idx >= 0 && myEventHistory[idx] < 0) + --myEventHistory[idx]; + else + myEventHistory.push_back(-1); + } +} diff --git a/stella/src/emucore/Event.hxx b/stella/src/emucore/Event.hxx index 2a0e9ccd2..8f06b4704 100644 --- a/stella/src/emucore/Event.hxx +++ b/stella/src/emucore/Event.hxx @@ -13,7 +13,7 @@ // See the file "license" for information on usage and redistribution of // this file, and for a DISCLAIMER OF ALL WARRANTIES. // -// $Id: Event.hxx,v 1.13 2005-08-29 18:36:41 stephena Exp $ +// $Id: Event.hxx,v 1.14 2005-12-09 01:16:13 stephena Exp $ //============================================================================ #ifndef EVENT_HXX @@ -21,11 +21,12 @@ class Event; +#include "Array.hxx" #include "bspf.hxx" /** @author Bradford W. Mott - @version $Id: Event.hxx,v 1.13 2005-08-29 18:36:41 stephena Exp $ + @version $Id: Event.hxx,v 1.14 2005-12-09 01:16:13 stephena Exp $ */ class Event { @@ -104,12 +105,35 @@ class Event */ virtual void clear(); + /** + Returns the history for this event + */ + virtual const IntArray& history() { return myEventHistory; } + + /** + Start/stop recording events to the event history + + @param enable Start or stop recording + */ + virtual void record(bool enable); + + /** + Indicate that a new frame has been processed + */ + virtual void nextFrame(); + protected: // Number of event types there are const Int32 myNumberOfTypes; // Array of values associated with each event type Int32 myValues[LastType]; + + // Indicates if we're in recording mode + bool myEventRecordFlag; + + // Stores the history/record of all events that have been set + IntArray myEventHistory; }; #endif diff --git a/stella/src/emucore/EventHandler.cxx b/stella/src/emucore/EventHandler.cxx index 7f7d2ff33..c42ada6fc 100644 --- a/stella/src/emucore/EventHandler.cxx +++ b/stella/src/emucore/EventHandler.cxx @@ -13,7 +13,7 @@ // See the file "license" for information on usage and redistribution of // this file, and for a DISCLAIMER OF ALL WARRANTIES. // -// $Id: EventHandler.cxx,v 1.123 2005-12-08 22:30:53 stephena Exp $ +// $Id: EventHandler.cxx,v 1.124 2005-12-09 01:16:13 stephena Exp $ //============================================================================ #include @@ -737,6 +737,10 @@ void EventHandler::poll(uInt32 time) for(unsigned int i = 0; i < cheats.size(); i++) cheats[i]->evaluate(); #endif + + // Tell the event object that another frame has finished + // This is used for event recording + myEvent->nextFrame(); } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/stella/src/emucore/FSNode.hxx b/stella/src/emucore/FSNode.hxx index 9ece909d3..7bf4b2cce 100644 --- a/stella/src/emucore/FSNode.hxx +++ b/stella/src/emucore/FSNode.hxx @@ -13,7 +13,7 @@ // See the file "license" for information on usage and redistribution of // this file, and for a DISCLAIMER OF ALL WARRANTIES. // -// $Id: FSNode.hxx,v 1.7 2005-06-16 00:55:58 stephena Exp $ +// $Id: FSNode.hxx,v 1.8 2005-12-09 01:16:13 stephena Exp $ // // Based on code from ScummVM - Scumm Interpreter // Copyright (C) 2002-2004 The ScummVM project @@ -61,7 +61,7 @@ class FilesystemNode; /** * List of multiple file system nodes. E.g. the contents of a given directory. */ -class FSList : public GUI::Array +class FSList : public Common::Array { public: void sort(); diff --git a/stella/src/emucore/m6502/src/M6502.hxx b/stella/src/emucore/m6502/src/M6502.hxx index 95ef2ee18..570932049 100644 --- a/stella/src/emucore/m6502/src/M6502.hxx +++ b/stella/src/emucore/m6502/src/M6502.hxx @@ -13,7 +13,7 @@ // See the file "license" for information on usage and redistribution of // this file, and for a DISCLAIMER OF ALL WARRANTIES. // -// $Id: M6502.hxx,v 1.15 2005-10-11 19:38:10 stephena Exp $ +// $Id: M6502.hxx,v 1.16 2005-12-09 01:16:13 stephena Exp $ //============================================================================ #ifndef M6502_HXX @@ -33,7 +33,7 @@ class PackedBitArray; #include "Array.hxx" #include "StringList.hxx" -typedef GUI::Array ExpressionList; +typedef Common::Array ExpressionList; /** This is an abstract base class for classes that emulate the @@ -41,7 +41,7 @@ typedef GUI::Array ExpressionList; has a 64K addressing space. @author Bradford W. Mott - @version $Id: M6502.hxx,v 1.15 2005-10-11 19:38:10 stephena Exp $ + @version $Id: M6502.hxx,v 1.16 2005-12-09 01:16:13 stephena Exp $ */ class M6502 { diff --git a/stella/src/gui/CheckListWidget.hxx b/stella/src/gui/CheckListWidget.hxx index edc955721..524978821 100644 --- a/stella/src/gui/CheckListWidget.hxx +++ b/stella/src/gui/CheckListWidget.hxx @@ -13,7 +13,7 @@ // See the file "license" for information on usage and redistribution of // this file, and for a DISCLAIMER OF ALL WARRANTIES. // -// $Id: CheckListWidget.hxx,v 1.7 2005-11-27 22:37:25 stephena Exp $ +// $Id: CheckListWidget.hxx,v 1.8 2005-12-09 01:16:13 stephena Exp $ // // Based on code from ScummVM - Scumm Interpreter // Copyright (C) 2002-2004 The ScummVM project @@ -36,7 +36,7 @@ enum CheckStyle { kSolidFill }; -typedef GUI::Array CheckboxArray; +typedef Common::Array CheckboxArray; /** CheckListWidget */ diff --git a/stella/src/gui/Dialog.hxx b/stella/src/gui/Dialog.hxx index 7009e6b68..b493f5149 100644 --- a/stella/src/gui/Dialog.hxx +++ b/stella/src/gui/Dialog.hxx @@ -13,7 +13,7 @@ // See the file "license" for information on usage and redistribution of // this file, and for a DISCLAIMER OF ALL WARRANTIES. // -// $Id: Dialog.hxx,v 1.21 2005-12-07 20:46:49 stephena Exp $ +// $Id: Dialog.hxx,v 1.22 2005-12-09 01:16:13 stephena Exp $ // // Based on code from ScummVM - Scumm Interpreter // Copyright (C) 2002-2004 The ScummVM project @@ -36,7 +36,7 @@ class TabWidget; This is the base class for all dialog boxes. @author Stephen Anthony - @version $Id: Dialog.hxx,v 1.21 2005-12-07 20:46:49 stephena Exp $ + @version $Id: Dialog.hxx,v 1.22 2005-12-09 01:16:13 stephena Exp $ */ class Dialog : public GuiObject { @@ -46,7 +46,7 @@ class Dialog : public GuiObject Widget* focusedWidget; WidgetArray focusList; }; - typedef GUI::Array FocusList; + typedef Common::Array FocusList; public: Dialog(OSystem* instance, DialogContainer* parent, diff --git a/stella/src/gui/GameList.hxx b/stella/src/gui/GameList.hxx index 5b9eb8724..3fbfe10a3 100644 --- a/stella/src/gui/GameList.hxx +++ b/stella/src/gui/GameList.hxx @@ -13,7 +13,7 @@ // See the file "license" for information on usage and redistribution of // this file, and for a DISCLAIMER OF ALL WARRANTIES. // -// $Id: GameList.hxx,v 1.6 2005-10-19 00:59:51 stephena Exp $ +// $Id: GameList.hxx,v 1.7 2005-12-09 01:16:13 stephena Exp $ // // Based on code from KStella - Stella frontend // Copyright (C) 2003-2005 Stephen Anthony @@ -37,7 +37,7 @@ class GameList string _note; }; - typedef GUI::Array EntryList; + typedef Common::Array EntryList; EntryList myArray; public: diff --git a/stella/src/gui/GuiObject.hxx b/stella/src/gui/GuiObject.hxx index e848833a3..eccd20985 100644 --- a/stella/src/gui/GuiObject.hxx +++ b/stella/src/gui/GuiObject.hxx @@ -13,7 +13,7 @@ // See the file "license" for information on usage and redistribution of // this file, and for a DISCLAIMER OF ALL WARRANTIES. // -// $Id: GuiObject.hxx,v 1.15 2005-08-31 19:15:10 stephena Exp $ +// $Id: GuiObject.hxx,v 1.16 2005-12-09 01:16:13 stephena Exp $ // // Based on code from ScummVM - Scumm Interpreter // Copyright (C) 2002-2004 The ScummVM project @@ -30,13 +30,13 @@ class Widget; #include "Array.hxx" #include "Font.hxx" -typedef GUI::Array WidgetArray; +typedef Common::Array WidgetArray; /** This is the base class for all GUI objects/widgets. @author Stephen Anthony - @version $Id: GuiObject.hxx,v 1.15 2005-08-31 19:15:10 stephena Exp $ + @version $Id: GuiObject.hxx,v 1.16 2005-12-09 01:16:13 stephena Exp $ */ class GuiObject : public CommandReceiver { diff --git a/stella/src/gui/InputTextDialog.hxx b/stella/src/gui/InputTextDialog.hxx index 71eabcd07..9dd8561a5 100644 --- a/stella/src/gui/InputTextDialog.hxx +++ b/stella/src/gui/InputTextDialog.hxx @@ -13,7 +13,7 @@ // See the file "license" for information on usage and redistribution of // this file, and for a DISCLAIMER OF ALL WARRANTIES. // -// $Id: InputTextDialog.hxx,v 1.4 2005-11-27 22:37:25 stephena Exp $ +// $Id: InputTextDialog.hxx,v 1.5 2005-12-09 01:16:14 stephena Exp $ // // Based on code from ScummVM - Scumm Interpreter // Copyright (C) 2002-2004 The ScummVM project @@ -29,7 +29,7 @@ class EditTextWidget; #include "Dialog.hxx" #include "Command.hxx" -typedef GUI::Array InputWidget; +typedef Common::Array InputWidget; class InputTextDialog : public Dialog, public CommandSender { diff --git a/stella/src/gui/PopUpWidget.hxx b/stella/src/gui/PopUpWidget.hxx index cc2d32304..7097dc32b 100644 --- a/stella/src/gui/PopUpWidget.hxx +++ b/stella/src/gui/PopUpWidget.hxx @@ -13,7 +13,7 @@ // See the file "license" for information on usage and redistribution of // this file, and for a DISCLAIMER OF ALL WARRANTIES. // -// $Id: PopUpWidget.hxx,v 1.10 2005-10-02 22:09:12 stephena Exp $ +// $Id: PopUpWidget.hxx,v 1.11 2005-12-09 01:16:14 stephena Exp $ // // Based on code from ScummVM - Scumm Interpreter // Copyright (C) 2002-2004 The ScummVM project @@ -50,7 +50,7 @@ class PopUpWidget : public Widget, public CommandSender int tag; }; - typedef GUI::Array EntryList; + typedef Common::Array EntryList; protected: EntryList _entries; diff --git a/stella/src/gui/StringList.hxx b/stella/src/gui/StringList.hxx index cad17a367..44d218b2a 100644 --- a/stella/src/gui/StringList.hxx +++ b/stella/src/gui/StringList.hxx @@ -13,7 +13,7 @@ // See the file "license" for information on usage and redistribution of // this file, and for a DISCLAIMER OF ALL WARRANTIES. // -// $Id: StringList.hxx,v 1.3 2005-06-16 00:56:00 stephena Exp $ +// $Id: StringList.hxx,v 1.4 2005-12-09 01:16:14 stephena Exp $ // // Based on code from ScummVM - Scumm Interpreter // Copyright (C) 2002-2004 The ScummVM project @@ -26,7 +26,7 @@ #include "bspf.hxx" -class StringList : public GUI::Array +class StringList : public Common::Array { public: void push_back(const char *str) diff --git a/stella/src/gui/TabWidget.hxx b/stella/src/gui/TabWidget.hxx index 2328e130a..2cfeb616a 100644 --- a/stella/src/gui/TabWidget.hxx +++ b/stella/src/gui/TabWidget.hxx @@ -13,7 +13,7 @@ // See the file "license" for information on usage and redistribution of // this file, and for a DISCLAIMER OF ALL WARRANTIES. // -// $Id: TabWidget.hxx,v 1.9 2005-08-10 12:23:42 stephena Exp $ +// $Id: TabWidget.hxx,v 1.10 2005-12-09 01:16:14 stephena Exp $ // // Based on code from ScummVM - Scumm Interpreter // Copyright (C) 2002-2004 The ScummVM project @@ -39,7 +39,7 @@ class TabWidget : public Widget, public CommandSender Widget* firstWidget; Widget* parentWidget; }; - typedef GUI::Array TabList; + typedef Common::Array TabList; public: TabWidget(GuiObject* boss, int x, int y, int w, int h);