const char * Nes_State_Reader::begin( Auto_File_Reader dr, Nes_State* out ) { state_ = out; if ( !out ) CHECK_ALLOC( state_ = owned = BLARGG_NEW Nes_State ); RETURN_ERR( Nes_File_Reader::begin( dr ) ); if ( block_tag() != state_file_tag ) return "Not a state snapshot file"; return 0; }
blargg_err_t Nes_Snapshot_Reader::begin( Data_Reader* dr, Nes_Snapshot* out ) { snapshot_ = out; if ( !out ) { BLARGG_RETURN_ERR( snapshots.resize( 1 ) ); snapshot_ = &snapshots [0]; } BLARGG_RETURN_ERR( Nes_File_Reader::begin( dr ) ); if ( block_tag() != snapshot_file_tag ) return "Not a snapshot file"; return blargg_success; }