Overview | Project | Class | Tree | Deprecated | Index

Nestopia Core API

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

## api
Struct Nes::Api::User::File

struct Nes::Api::User::File

File IO interface.

Inner Classes, Typedefs, and Enums
`enum` | `Nes::Api::User::File::Action` Action event.
`enum` | `Nes::Api::User::File::Patch` Supported patch formats.

Method Summary
`virtual Nes::Api::User::File::Action` | `GetAction() const = 0` Returns type of action.
`virtual Result` | `GetContent( const void*& mem, ulong& size ) const` Returns a pointer to the content to be saved and its size.
`virtual Result` | `GetContent( std::ostream& stream ) const` Saves the content into an output stream.
`virtual uint` | `GetId() const` Returns the sound file ID to load.
`virtual ulong` | `GetMaxSize() const` Returns the maximum allowed size for the content to load.
`virtual const wchar_t*` | `GetName() const` Returns the name of the file to load.
`virtual Result` | `GetPatchContent( Nes::Api::User::File::Patch patch, std::ostream& stream ) const` Saves the patch content into an output stream.
`virtual Result` | `SetContent( const void* mem, ulong size )` Loads content into the core.
`virtual Result` | `SetContent( std::istream& stream )` Loads content into the core through stream.
`virtual Result` | `SetPatchContent( std::istream& stream )` Loads patch content into the core.
`virtual Result` | `SetSampleContent( const void* mem, ulong length, bool stereo, uint bits, ulong rate )` Loads audio content into the core.

Method Detail

### GetAction

    public virtual Nes::Api::User::File::Action GetAction() const throw()= 0;

  Returns type of action.

Returns:
  action

### GetContent

    public virtual Result GetContent( const void*& mem, ulong& size ) const throw();

  Returns a pointer to the content to be saved and its size. Used only with the SAVE_xx action callbacks.

Parameters:
  `mem` - pointer to content
  `size` - size of content
  `result` - code

### GetContent

    public virtual Result GetContent( std::ostream& stream ) const throw();

  Saves the content into an output stream. Used only with the SAVE_xx action callbacks.

Parameters:
  `stream` - output stream
  `result` - code

### GetId

    public virtual uint GetId() const throw();

  Returns the sound file ID to load. Used only with the LOAD_SAMPLE_xx action callbacks.

Returns:
  sample id

### GetMaxSize

    public virtual ulong GetMaxSize() const throw();

  Returns the maximum allowed size for the content to load. Used only with the LOAD_xx action callbacks.

Returns:
  max size

### GetName

    public virtual const wchar_t* GetName() const throw();

  Returns the name of the file to load. Used only with the LOAD_ROM and LOAD_SAMPLE action callbacks.

Returns:
  filename

### GetPatchContent

    public virtual Result GetPatchContent( Nes::Api::User::File::Patch patch, std::ostream& stream ) const throw();

  Saves the patch content into an output stream. Used only with the FDS_SAVE action callback.

Parameters:
  `patch` - patch format to use
  `stream` - output stream

### SetContent

    public virtual Result SetContent( const void* mem, ulong size ) throw();

  Loads content into the core. Used only with the LOAD_xx action callbacks. This method can't be used for audio or patch content. Instead, use LoadSampleContent(..) and SetPatchContent(..) for those.

Parameters:
  `mem` - content
  `size` - size of content
Returns:
  result code

### SetContent

    public virtual Result SetContent( std::istream& stream ) throw();

  Loads content into the core through stream. Used only with the LOAD_xx action callbacks. This method can't be used for audio or patch content. Instead, use LoadSampleContent(..) and SetPatchContent(..) for those.

Parameters:
  `stream` - input stream
Returns:
  result code

### SetPatchContent

    public virtual Result SetPatchContent( std::istream& stream ) throw();

  Loads patch content into the core. Used only with LOAD_FDS action callback.

Parameters:
  `stream` - input stream to patch
Returns:
  result code

### SetSampleContent

    public virtual Result SetSampleContent( const void* mem, ulong length, bool stereo, uint bits, ulong rate ) throw();

  Loads audio content into the core. Used only with the LOAD_SAMPLE and LOAD_SAMPLE_xx action callbacks.

Parameters:
  `mem` - sample content
  `length` - number of samples
  `stereo` - dual channel if true
  `bits` - bits per sample
  `rate` - sample rate
Returns:
  result code

Overview | Project | Class | Tree | Deprecated | Index

Nestopia Core API

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