diff --git a/Source/ui_ios/EmulatorViewController.mm b/Source/ui_ios/EmulatorViewController.mm index 20c536ff..a8290b29 100644 --- a/Source/ui_ios/EmulatorViewController.mm +++ b/Source/ui_ios/EmulatorViewController.mm @@ -58,6 +58,13 @@ CPS2VM* g_virtualMachine = nullptr; [self.view addSubview: self.virtualPadView]; [self setupFpsCounter]; + + UIButton* but = [UIButton buttonWithType: UIButtonTypeRoundedRect]; + [but setTitle: @"Save" forState: UIControlStateNormal]; + [but setBackgroundColor: [UIColor whiteColor]]; + [but addTarget: self action: @selector(onSaveStateButtonClick) forControlEvents: UIControlEventTouchUpInside]; + but.frame = CGRectMake(screenBounds.size.width - 50, (screenBounds.size.height - 25) / 2, 50, 25); + [self.view addSubview: but]; g_virtualMachine->Pause(); g_virtualMachine->Reset(); @@ -226,6 +233,14 @@ CPS2VM* g_virtualMachine = nullptr; [self.fpsCounterLabel sizeToFit]; } +-(void)onSaveStateButtonClick +{ + auto dataPath = Framework::PathUtils::GetPersonalDataPath(); + auto statePath = dataPath / "state.sta"; + g_virtualMachine->SaveState(statePath.c_str()); + NSLog(@"Saved state to '%s'.", statePath.string().c_str()); +} + -(BOOL)prefersStatusBarHidden { return YES;