@@ -90,7 +90,7 @@ private void OnPreviewDragDrop(object? sender, DragEventArgs e)
9090
9191 private void OnPreviewDragDrop ( string fileName )
9292 {
93- if ( Model . CurrentMachine is not { } machine )
93+ if ( Model . CurrentMachine is not { } machine )
9494 return ;
9595 var machineDir = machine . GetFolder ( ) ! ;
9696 const string previewName = "preview.png" ;
@@ -134,6 +134,7 @@ private void Machines_OnSelectionChanged(object? sender, SelectionChangedEventAr
134134 if ( added == null )
135135 return ;
136136 Model . CurrentMachine = ( MetaMachine ? ) added ;
137+ RestoreLastEmu ( ) ;
137138 }
138139
139140 private MainWindowViewModel Model => ( MainWindowViewModel ) DataContext ! ;
@@ -298,6 +299,7 @@ private void StartThis_OnClick(object? sender, RoutedEventArgs e)
298299 var proc = plat . GetProcs ( ) ;
299300 var core = proc . Build ( arg ) ;
300301 mach. Tag = id ;
302+ RememberLastEmu ( current ) ;
301303 core . RunThis ( id , StartThis_OnEvent ) ;
302304 }
303305 }
@@ -494,5 +496,26 @@ private void HardStop_OnClick(object? sender, RoutedEventArgs e)
494496 IVmCommand vCmd = new ForceOffVCmd ( ) ;
495497 proc . Send ( mach . Tag ! , vCmd ) ;
496498 }
499+
500+ private void RememberLastEmu ( ( MetaMachine mach , FoundExe exe , FoundRom rom ) current )
501+ {
502+ var exeVer = current . exe . Version . ReleaseId ! ;
503+ var romVer = current . rom . ReleaseId ;
504+ current . mach . LastEmuUsed = ( emuId : exeVer, romId: romVer);
505+ }
506+
507+ private void RestoreLastEmu()
508+ {
509+ if ( GetEmuAndRom ( ) is not { } current )
510+ return;
511+ if ( current . mach . E is not { IdEmu : { } emuId , IdRom : { } romId } )
512+ return;
513+ var foundExe = Model. AllEmus . FirstOrDefault ( m => m . Version . ReleaseId == emuId ) ;
514+ var foundRom = Model. AllRoms . FirstOrDefault ( m => m . ReleaseId == romId ) ;
515+ if ( foundExe == null || foundRom == null )
516+ return;
517+ EmuCombo. SelectedItem = foundExe ;
518+ RomCombo. SelectedItem = foundRom;
519+ }
497520 }
498521}
0 commit comments