Overview | Project | Class | Tree | Deprecated | Index

Nestopia Core API

FRAMES NO FRAMES
SUMMARY: INNER | FIELD | CONSTR | METHOD

## api
Class Nes::Api::Machine

    Base
       |
       +--Nes::Api::Machine

class Nes::Api::Machine
extends Base

Machine interface.

Inner Classes, Typedefs, and Enums
`enum` | `Nes::Api::Machine::AskProfile` Image profile questioning state.
`enum` | `Nes::Api::Machine::Compression` Internal compression on states.
`enum` | `Nes::Api::Machine::Event` Machine events.
`typedef` | `Nes::Api::Machine::EventCallback` Machine event callback prototype.
`enum` | `Nes::Api::Machine::FavoredSystem` Favored System.
`enum` | `Nes::Api::Machine::Mode` NTSC/PAL mode.
`struct` | `Nes::Api::Machine::Patch` Soft-patching context object.

Field Summary
`static Nes::Api::Machine::EventCaller` | `eventCallback` Machine event callback manager.

Constructor Summary
`Machine( T& instance )` Interface constructor.

Method Summary
`Nes::Api::Machine::Mode` | `GetDesiredMode() const` Returns the mode most appropriate for the current image.
`Nes::Api::Machine::Mode` | `GetMode() const` Returns the current mode.
`bool` | `Is( uint flags1, uint flags2 ) const` Returns a machine state.
`uint` | `Is( uint flags ) const` Returns a machine state.
`bool` | `IsLocked() const` Tells if the machine is in a locked state.
`Result` | `Load( std::istream& stream, Nes::Api::Machine::FavoredSystem system, Nes::Api::Machine::Patch& patch, Nes::Api::Machine::AskProfile askProfile = DONT_ASK_PROFILE )` Loads any image.
`Result` | `Load( std::istream& stream, Nes::Api::Machine::FavoredSystem system, Nes::Api::Machine::AskProfile askProfile = DONT_ASK_PROFILE )` Loads any image.
`Result` | `LoadCartridge( std::istream& stream, Nes::Api::Machine::FavoredSystem system, Nes::Api::Machine::Patch& patch, Nes::Api::Machine::AskProfile askProfile = DONT_ASK_PROFILE )` Loads a cartridge image.
`Result` | `LoadCartridge( std::istream& stream, Nes::Api::Machine::FavoredSystem system, Nes::Api::Machine::AskProfile askProfile = DONT_ASK_PROFILE )` Loads a cartridge image.
`Result` | `LoadDisk( std::istream& stream, Nes::Api::Machine::FavoredSystem system )` Loads a Famicom Disk System image.
`Result` | `LoadSound( std::istream& stream, Nes::Api::Machine::FavoredSystem system )` Loads a sound image.
`Result` | `LoadState( std::istream& stream )` Loads a state.
`Result` | `Power( bool state )` Powers ON or OFF the machine.
`Result` | `Reset( bool state )` Resets the machine.
`Result` | `SaveState( std::ostream& stream, Nes::Api::Machine::Compression compression = USE_COMPRESSION ) const` Saves a state.
`Result` | `SetMode( Nes::Api::Machine::Mode mode )` Sets the mode.
`Result` | `Unload()` Unloads the current image.

Field Detail

### eventCallback

    public static Nes::Api::Machine::EventCaller eventCallback;

  Machine event callback manager. Static object used for adding the user defined callback.

Constructor Detail

### Machine

    public Machine( T& instance );

  Interface constructor.

Parameters:
  `instance` - emulator instance

Method Detail

### GetDesiredMode

    public Nes::Api::Machine::Mode GetDesiredMode() const throw();

  Returns the mode most appropriate for the current image.

Returns:
  mode

### GetMode

    public Nes::Api::Machine::Mode GetMode() const throw();

  Returns the current mode.

Returns:
  mode

### Is

    public bool Is( uint flags1, uint flags2 ) const throw();

  Returns a machine state.

Parameters:
  `flags1` - OR:ed flags to check
  `flags2` - OR:ed flags to check
Returns:
  true if both parameters has at least one flag evaluated to true

### Is

    public uint Is( uint flags ) const throw();

  Returns a machine state.

Parameters:
  `flags` - OR:ed flags to check
Returns:
  OR:ed flags evaluated to true

### IsLocked

    public bool IsLocked() const;

  Tells if the machine is in a locked state. A locked state means that the machine can't respond to certain operations because it's doing something special, like playing a movie or rewinding.

Returns:
  true if machine is in a locked state.

### Load

    public Result Load( std::istream& stream, Nes::Api::Machine::FavoredSystem system, Nes::Api::Machine::Patch& patch, Nes::Api::Machine::AskProfile askProfile = DONT_ASK_PROFILE ) throw();

  Loads any image. Input stream can be in XML, iNES, UNIF, FDS or NSF format.

Parameters:
  `stream` - input stream containing the image to load
  `system` - console to emulate if the core can't do automatic detection
  `patch` - object for performing soft-patching on the image
  `askProfile` - to allow callback triggering if the image has multiple media profiles, default is false
Returns:
  result code

### Load

    public Result Load( std::istream& stream, Nes::Api::Machine::FavoredSystem system, Nes::Api::Machine::AskProfile askProfile = DONT_ASK_PROFILE ) throw();

  Loads any image. Input stream can be in XML, iNES, UNIF, FDS or NSF format.

Parameters:
  `stream` - input stream containing the image to load
  `system` - console to emulate if the core can't do automatic detection
  `askProfile` - to allow callback triggering if the image has multiple media profiles, default is false
Returns:
  result code

### LoadCartridge

    public Result LoadCartridge( std::istream& stream, Nes::Api::Machine::FavoredSystem system, Nes::Api::Machine::Patch& patch, Nes::Api::Machine::AskProfile askProfile = DONT_ASK_PROFILE ) throw();

  Loads a cartridge image. Input stream can be in XML, iNES or UNIF format.

Parameters:
  `stream` - input stream containing the image to load
  `system` - console to emulate if the core can't do automatic detection
  `patch` - object for performing soft-patching on the image
  `askProfile` - to allow callback triggering if the image has multiple media profiles, default is false
Returns:
  result code

### LoadCartridge

    public Result LoadCartridge( std::istream& stream, Nes::Api::Machine::FavoredSystem system, Nes::Api::Machine::AskProfile askProfile = DONT_ASK_PROFILE ) throw();

  Loads a cartridge image. Input stream can be in XML, iNES or UNIF format.

Parameters:
  `stream` - input stream containing the image to load
  `system` - console to emulate if the core can't do automatic detection
  `askProfile` - to allow callback triggering if the image has multiple media profiles, default is false
Returns:
  result code

### LoadDisk

    public Result LoadDisk( std::istream& stream, Nes::Api::Machine::FavoredSystem system ) throw();

  Loads a Famicom Disk System image. Input stream can be in FDS format.

Parameters:
  `stream` - input stream containing the image to load
  `system` - console to emulate if the core can't do automatic detection
Returns:
  result code

### LoadSound

    public Result LoadSound( std::istream& stream, Nes::Api::Machine::FavoredSystem system ) throw();

  Loads a sound image. Input stream can be in NSF format.

Parameters:
  `stream` - input stream containing the image to load
  `system` - console to emulate if the core can't do automatic detection
Returns:
  result code

### LoadState

    public Result LoadState( std::istream& stream ) throw();

  Loads a state.

Parameters:
  `stream` - input stream containing the state
Returns:
  result code

### Power

    public Result Power( bool state ) throw();

  Powers ON or OFF the machine.

Parameters:
  `state` - ON if true
Returns:
  result code

### Reset

    public Result Reset( bool state ) throw();

  Resets the machine.

Parameters:
  `state` - hard-reset if true, soft-reset otherwise
Returns:
  result code

### SaveState

    public Result SaveState( std::ostream& stream, Nes::Api::Machine::Compression compression = USE_COMPRESSION ) const throw();

  Saves a state.

Parameters:
  `stream` - output stream which the state will be written to
  `compression` - to allow internal compression in the state, default is USE_COMPRESSION
Returns:
  result code

### SetMode

    public Result SetMode( Nes::Api::Machine::Mode mode ) throw();

  Sets the mode.

Parameters:
  `mode` - new mode
Returns:
  result code

### Unload

    public Result Unload() throw();

  Unloads the current image.

Returns:
  result code

Overview | Project | Class | Tree | Deprecated | Index

Nestopia Core API

FRAMES NO FRAMES
SUMMARY: INNER | FIELD | CONSTR | METHOD