blargg_err_t Nes_Rom::resize_chr( long size ) { if ( size != chr_size_ ) { void* p = realloc( chr_, round_to_bank_size( size ) ); BLARGG_CHECK_ALLOC( p || !size ); chr_ = (byte*) p; chr_size_ = size; } return blargg_success; }
blargg_err_t Nes_Cart::resize_chr( long size ) { if ( size != chr_size_ ) { void* p = realloc( chr_, round_to_bank_size( size ) ); CHECK_ALLOC( p || !size ); chr_ = (byte*) p; chr_size_ = size; } return 0; }
blargg_err_t Nes_Rom::resize_prg( long size ) { if ( size != prg_size_ ) { // extra byte allows CPU to always read operand of instruction, which // might go past end of ROM void* p = realloc( prg_, round_to_bank_size( size ) + 1 ); BLARGG_CHECK_ALLOC( p || !size ); prg_ = (byte*) p; prg_size_ = size; } return blargg_success; }
blargg_err_t Nes_Cart::resize_prg( long size ) { if ( size != prg_size_ ) { // padding allows CPU to always read operands of instruction, which // might go past end of data void* p = realloc( prg_, round_to_bank_size( size ) + 2 ); CHECK_ALLOC( p || !size ); prg_ = (byte*) p; prg_size_ = size; } return 0; }