~ubuntu-branches/debian/squeeze/stella/squeeze

« back to all changes in this revision

Viewing changes to src/emucore/Console.hxx

  • Committer: Bazaar Package Importer
  • Author(s): Stephen Kitt
  • Date: 2010-07-12 23:49:36 UTC
  • mfrom: (1.1.4 upstream)
  • Revision ID: james.westby@ubuntu.com-20100712234936-juawrr3etzhr2qpv
Tags: 3.1.2-1
* New maintainer (closes: #532039).
* New upstream version (closes: #461121):
  - includes launcher (closes: #396058).
* Fix the reference to the X Window System in the description (closes:
  #411815).
* Move to main, DFSG-free ROMs are available (see README.Debian).
* Enhance the package description.
* Drop the libslang2-dev dependency (closes: #560274).
* Remove the Encoding entry from stella.desktop.
* Avoid ignoring errors when cleaning.
* Add ${misc:Depends} to the package dependencies.
* Provide a doc-base file to install the documentation using doc-base.
* Switch to debhelper 7 with a simplified rules file.
* Use autotools-dev to provide updated configuration files.
* Update to Standards-Version 3.9.0:
  - Move to menu section Applications/Emulators.
  - Move the homepage declaration.
* Re-write the manpage.

Show diffs side-by-side

added added

removed removed

Lines of Context:
8
8
//  SS  SS   tt   ee      ll   ll  aa  aa
9
9
//   SSSS     ttt  eeeee llll llll  aaaaa
10
10
//
11
 
// Copyright (c) 1995-2008 by Bradford W. Mott and the Stella team
 
11
// Copyright (c) 1995-2010 by Bradford W. Mott, Stephen Anthony
 
12
// and the Stella Team
12
13
//
13
 
// See the file "license" for information on usage and redistribution of
 
14
// See the file "License.txt" for information on usage and redistribution of
14
15
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
15
16
//
16
 
// $Id: Console.hxx,v 1.68 2008/05/21 14:01:29 stephena Exp $
 
17
// $Id: Console.hxx 2001 2010-04-10 21:37:23Z stephena $
17
18
//============================================================================
18
19
 
19
20
#ifndef CONSOLE_HXX
20
21
#define CONSOLE_HXX
21
22
 
22
 
class Console;
23
23
class Controller;
24
24
class Event;
25
 
class MediaSource;
26
25
class Switches;
27
26
class System;
 
27
class TIA;
28
28
 
29
29
#include "bspf.hxx"
30
30
#include "Control.hxx"
36
36
#include "Serializable.hxx"
37
37
 
38
38
/**
 
39
  Contains detailed info about a console.
 
40
*/
 
41
struct ConsoleInfo
 
42
{
 
43
  string BankSwitch;
 
44
  string CartName;
 
45
  string CartMD5;
 
46
  string Control0;
 
47
  string Control1;
 
48
  string DisplayFormat;
 
49
  string InitialFrameRate;
 
50
};
 
51
 
 
52
/**
39
53
  This class represents the entire game console.
40
54
 
41
55
  @author  Bradford W. Mott
42
 
  @version $Id: Console.hxx,v 1.68 2008/05/21 14:01:29 stephena Exp $
 
56
  @version $Id: Console.hxx 2001 2010-04-10 21:37:23Z stephena $
43
57
*/
44
58
class Console : public Serializable
45
59
{
78
92
    }
79
93
 
80
94
    /**
81
 
      Get the MediaSource for this console
 
95
      Get the TIA for this console
82
96
 
83
 
      @return The mediasource
 
97
      @return The TIA
84
98
    */
85
 
    MediaSource& mediaSource() const { return *myMediaSource; }
 
99
    TIA& tia() const { return *myTIA; }
86
100
 
87
101
    /**
88
102
      Get the properties being used by the game
128
142
    bool save(Serializer& out) const;
129
143
 
130
144
    /**
131
 
      Loads the current state of this console class from the given Deserializer.
 
145
      Loads the current state of this console class from the given Serializer.
132
146
 
133
 
      @param in The deserializer device to load from.
 
147
      @param in The Serializer device to load from.
134
148
      @return The result of the load.  True on success, false on failure.
135
149
    */
136
 
    bool load(Deserializer& in);
 
150
    bool load(Serializer& in);
137
151
 
138
152
    /**
139
153
      Get a descriptor for this console class (used in error checking).
150
164
    void setProperties(const Properties& props);
151
165
 
152
166
    /**
153
 
      Query some information about this console.
 
167
      Query detailed information about this console.
154
168
    */
155
 
    const string& about() const { return myAboutString; }
 
169
    inline const ConsoleInfo& about() const { return myConsoleInfo; }
156
170
 
157
171
  public:
158
172
    /**
197
211
 
198
212
      @param full  Whether we want a full initialization,
199
213
                   or only reset certain attributes.
 
214
 
 
215
      @return  False on any errors, else true
200
216
    */
201
 
    void initializeVideo(bool full = true);
 
217
    bool initializeVideo(bool full = true);
202
218
 
203
219
    /**
204
220
      Initialize the audio subsystem wrt this class.
240
256
    /**
241
257
      Toggles the TIA bit specified in the method name.
242
258
    */
243
 
    void toggleP0Bit() const { toggleTIABit(TIA::P0, "P0"); }
244
 
    void toggleP1Bit() const { toggleTIABit(TIA::P1, "P1"); }
245
 
    void toggleM0Bit() const { toggleTIABit(TIA::M0, "M0"); }
246
 
    void toggleM1Bit() const { toggleTIABit(TIA::M1, "M1"); }
247
 
    void toggleBLBit() const { toggleTIABit(TIA::BL, "BL"); }
248
 
    void togglePFBit() const { toggleTIABit(TIA::PF, "PF"); }
 
259
    void toggleP0Bit() const { toggleTIABit(P0Bit, "P0"); }
 
260
    void toggleP1Bit() const { toggleTIABit(P1Bit, "P1"); }
 
261
    void toggleM0Bit() const { toggleTIABit(M0Bit, "M0"); }
 
262
    void toggleM1Bit() const { toggleTIABit(M1Bit, "M1"); }
 
263
    void toggleBLBit() const { toggleTIABit(BLBit, "BL"); }
 
264
    void togglePFBit() const { toggleTIABit(PFBit, "PF"); }
 
265
    void toggleHMOVE() const;
249
266
    void enableBits(bool enable) const;
250
267
 
251
 
    // TODO - make the core code work without needing to access this
252
 
    AtariVox* atariVox() { return myAVox; }
 
268
    /**
 
269
      Toggles the TIA collisions specified in the method name.
 
270
    */
 
271
    void toggleP0Collision() const { toggleTIACollision(P0Bit, "P0"); }
 
272
    void toggleP1Collision() const { toggleTIACollision(P1Bit, "P1"); }
 
273
    void toggleM0Collision() const { toggleTIACollision(M0Bit, "M0"); }
 
274
    void toggleM1Collision() const { toggleTIACollision(M1Bit, "M1"); }
 
275
    void toggleBLCollision() const { toggleTIACollision(BLBit, "BL"); }
 
276
    void togglePFCollision() const { toggleTIACollision(PFBit, "PF"); }
 
277
    void enableCollisions(bool enable) const;
 
278
 
 
279
    /**
 
280
      Toggles the TIA 'fixed debug colors' mode.
 
281
    */
 
282
    void toggleFixedColors() const;
253
283
 
254
284
  private:
255
285
    /**
256
286
      Adds the left and right controllers to the console
257
287
    */
258
 
    void setControllers();
259
 
 
260
 
    void toggleTIABit(TIA::TIABit bit, const string& bitname, bool show = true) const;
 
288
    void setControllers(const string& rommd5);
261
289
 
262
290
    /**
263
291
      Loads a user-defined palette file (from OSystem::paletteFile), filling the
266
294
    void loadUserPalette();
267
295
 
268
296
    /**
269
 
      Loads all defined palettes with PAL color-loss data depending
270
 
      on 'state'.
 
297
      Loads all defined palettes with PAL color-loss data, even those that
 
298
      normally can't have it enabled (NTSC), since it's also used for
 
299
      'greying out' the frame in the debugger.
271
300
    */
272
 
    void setColorLossPalette(bool state);
 
301
    void setColorLossPalette();
273
302
 
274
303
    /**
275
304
      Returns a pointer to the palette data for the palette currently defined
277
306
    */
278
307
    const uInt32* getPalette(int direction) const;
279
308
 
 
309
    void toggleTIABit(TIABit bit, const string& bitname, bool show = true) const;
 
310
    void toggleTIACollision(TIABit bit, const string& bitname, bool show = true) const;
 
311
 
280
312
  private:
281
313
    // Pointer to the osystem object
282
314
    OSystem* myOSystem;
287
319
    // Pointer to the event object to use
288
320
    Event* myEvent;
289
321
 
290
 
    // Pointer to the media source object 
291
 
    MediaSource* myMediaSource;
 
322
    // Pointer to the TIA object 
 
323
    TIA* myTIA;
292
324
 
293
325
    // Properties for the game
294
326
    Properties myProperties;
306
338
    // A RIOT of my own! (...with apologies to The Clash...)
307
339
    M6532 *myRiot;
308
340
 
309
 
    AtariVox* myAVox;
310
 
 
311
341
    // The currently defined display format (NTSC/PAL/SECAM)
312
342
    string myDisplayFormat;
313
343
 
318
348
    // successfully loaded
319
349
    bool myUserPaletteDefined;
320
350
 
321
 
    // Contains info about this console in string format
322
 
    string myAboutString;
 
351
    // Contains detailed info about this console
 
352
    ConsoleInfo myConsoleInfo;
323
353
 
324
354
    // Table of RGB values for NTSC, PAL and SECAM
325
355
    static uInt32 ourNTSCPalette[256];