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,7 +259,9 @@ int state_init(struct NDS_state *state)
void state_deinit(struct NDS_state *state) void state_deinit(struct NDS_state *state)
{ {
if (state->MMU)
MMU_unsetRom(state); MMU_unsetRom(state);
if (state->nds && state->MMU && state->NDS_ARM7 && state->NDS_ARM9 && state->MainScreen && state->SubScreen)
NDS_DeInit(state); NDS_DeInit(state);
if (state->nds) free(state->nds); if (state->nds) free(state->nds);
state->nds = NULL; state->nds = NULL;

View File

@ -1003,12 +1003,17 @@ static int twosf_info(void * context, const char * name, const char * value)
return NO; 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; emulatorCore = ( uint8_t * ) core;
emulatorExtra = state.rom; emulatorExtra = state.rom;
if ( state_init(core) )
return NO;
if ( state.rom ) if ( state.rom )
state_setrom(core, state.rom, (u32) state.rom_size ); state_setrom(core, state.rom, (u32) state.rom_size );