Shuffled around init/deinit of vio2sf state a bit

CQTexperiment
Chris Moeller 2013-10-13 13:21:56 -07:00
parent 11fb240606
commit 7e34ccd15a
2 changed files with 12 additions and 5 deletions

View File

@ -259,8 +259,10 @@ int state_init(struct NDS_state *state)
void state_deinit(struct NDS_state *state)
{
MMU_unsetRom(state);
NDS_DeInit(state);
if (state->MMU)
MMU_unsetRom(state);
if (state->nds && state->MMU && state->NDS_ARM7 && state->NDS_ARM9 && state->MainScreen && state->SubScreen)
NDS_DeInit(state);
if (state->nds) free(state->nds);
state->nds = NULL;
if (state->NDS_ARM7) free(state->NDS_ARM7);

View File

@ -1003,12 +1003,17 @@ static int twosf_info(void * context, const char * name, const char * value)
return NO;
}
if ( state_init(core) )
{
state_deinit(core);
if (state.rom) free(state.rom);
if (state.state) free(state.state);
return NO;
}
emulatorCore = ( uint8_t * ) core;
emulatorExtra = state.rom;
if ( state_init(core) )
return NO;
if ( state.rom )
state_setrom(core, state.rom, (u32) state.rom_size );