mirror of
https://github.com/par274/sharpemu.git
synced 2026-07-28 05:30:57 +08:00
Compare commits
1 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 2a270cea4e |
@@ -92,6 +92,11 @@ public partial class MainWindow : Window
|
|||||||
// plain window color remains the fallback when the asset fails to load.
|
// plain window color remains the fallback when the asset fails to load.
|
||||||
private Bitmap? _defaultBackdrop;
|
private Bitmap? _defaultBackdrop;
|
||||||
|
|
||||||
|
// Whether the native loading/closing popup should be showing; it is a
|
||||||
|
// desktop-topmost popup, so it closes while the launcher is in the
|
||||||
|
// background or minimized and reopens from this flag on activation.
|
||||||
|
private bool _sessionLoadingActive;
|
||||||
|
|
||||||
// Controller navigation state.
|
// Controller navigation state.
|
||||||
private readonly DispatcherTimer _gamepadTimer;
|
private readonly DispatcherTimer _gamepadTimer;
|
||||||
private HostGamepadButtons _previousPadButtons;
|
private HostGamepadButtons _previousPadButtons;
|
||||||
@@ -150,8 +155,18 @@ public partial class MainWindow : Window
|
|||||||
};
|
};
|
||||||
_libraryBlurTimer.Tick += (_, _) => AdvanceLibraryBlur();
|
_libraryBlurTimer.Tick += (_, _) => AdvanceLibraryBlur();
|
||||||
|
|
||||||
Activated += (_, _) => UpdateSessionBarVisibility();
|
// Native popups float above every window on the desktop; they must
|
||||||
Deactivated += (_, _) => SessionBarPopup.IsOpen = false;
|
// follow the launcher into the background or a minimized state.
|
||||||
|
Activated += (_, _) =>
|
||||||
|
{
|
||||||
|
UpdateSessionBarVisibility();
|
||||||
|
SessionLoadingPopup.IsOpen = _sessionLoadingActive;
|
||||||
|
};
|
||||||
|
Deactivated += (_, _) =>
|
||||||
|
{
|
||||||
|
SessionBarPopup.IsOpen = false;
|
||||||
|
SessionLoadingPopup.IsOpen = false;
|
||||||
|
};
|
||||||
|
|
||||||
TitleBar.PointerPressed += OnTitleBarPointerPressed;
|
TitleBar.PointerPressed += OnTitleBarPointerPressed;
|
||||||
GameList.SelectionChanged += (_, _) => UpdateSelectedGame();
|
GameList.SelectionChanged += (_, _) => UpdateSelectedGame();
|
||||||
@@ -414,6 +429,15 @@ public partial class MainWindow : Window
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (_isRunning || _isStopping)
|
||||||
|
{
|
||||||
|
// The game renders inside the launcher window, so the launcher
|
||||||
|
// stays active while playing. The controller belongs to the game
|
||||||
|
// then: no navigation, and Circle/B must never stop the session.
|
||||||
|
_previousPadButtons = pad.Buttons;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
var shoulderPressed = pad.Buttons & ~_previousPadButtons;
|
var shoulderPressed = pad.Buttons & ~_previousPadButtons;
|
||||||
if ((shoulderPressed & HostGamepadButtons.L1) != 0)
|
if ((shoulderPressed & HostGamepadButtons.L1) != 0)
|
||||||
{
|
{
|
||||||
@@ -463,11 +487,6 @@ public partial class MainWindow : Window
|
|||||||
LaunchSelected();
|
LaunchSelected();
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((pressed & HostGamepadButtons.Circle) != 0)
|
|
||||||
{
|
|
||||||
StopEmulator();
|
|
||||||
}
|
|
||||||
|
|
||||||
_previousPadButtons = pad.Buttons;
|
_previousPadButtons = pad.Buttons;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1626,13 +1645,23 @@ public partial class MainWindow : Window
|
|||||||
base.OnPropertyChanged(change);
|
base.OnPropertyChanged(change);
|
||||||
if (change.Property == WindowStateProperty)
|
if (change.Property == WindowStateProperty)
|
||||||
{
|
{
|
||||||
|
// The XAML WindowState="Maximized" assignment raises this change
|
||||||
|
// during InitializeComponent, before named controls are wired up.
|
||||||
if (WindowState == WindowState.Minimized)
|
if (WindowState == WindowState.Minimized)
|
||||||
{
|
{
|
||||||
_sndPreview.Pause();
|
_sndPreview.Pause();
|
||||||
|
if (SessionLoadingPopup is { } popup)
|
||||||
|
{
|
||||||
|
popup.IsOpen = false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
_sndPreview.Resume();
|
_sndPreview.Resume();
|
||||||
|
if (SessionLoadingPopup is { } popup)
|
||||||
|
{
|
||||||
|
popup.IsOpen = _sessionLoadingActive;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -2009,7 +2038,7 @@ public partial class MainWindow : Window
|
|||||||
ContentToolbar.IsVisible = false;
|
ContentToolbar.IsVisible = false;
|
||||||
ConsolePanel.IsVisible = false;
|
ConsolePanel.IsVisible = false;
|
||||||
LaunchBar.IsVisible = false;
|
LaunchBar.IsVisible = false;
|
||||||
SessionLoadingPopup.IsOpen = false;
|
HideSessionLoading();
|
||||||
UpdateSessionBarVisibility();
|
UpdateSessionBarVisibility();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@@ -2109,7 +2138,7 @@ public partial class MainWindow : Window
|
|||||||
GameView.IsVisible = false;
|
GameView.IsVisible = false;
|
||||||
GameView.IsHitTestVisible = true;
|
GameView.IsHitTestVisible = true;
|
||||||
SessionBarPopup.IsOpen = false;
|
SessionBarPopup.IsOpen = false;
|
||||||
SessionLoadingPopup.IsOpen = false;
|
HideSessionLoading();
|
||||||
AnimateLibraryBlur(0, clearWhenComplete: true);
|
AnimateLibraryBlur(0, clearWhenComplete: true);
|
||||||
MainContent.Margin = new Thickness(32, 24, 32, 20);
|
MainContent.Margin = new Thickness(32, 24, 32, 20);
|
||||||
ContentToolbar.IsVisible = true;
|
ContentToolbar.IsVisible = true;
|
||||||
@@ -2193,7 +2222,14 @@ public partial class MainWindow : Window
|
|||||||
{
|
{
|
||||||
SessionLoadingTitle.Text = title;
|
SessionLoadingTitle.Text = title;
|
||||||
SessionLoadingDetail.Text = detail;
|
SessionLoadingDetail.Text = detail;
|
||||||
SessionLoadingPopup.IsOpen = true;
|
_sessionLoadingActive = true;
|
||||||
|
SessionLoadingPopup.IsOpen = IsActive && WindowState != WindowState.Minimized;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void HideSessionLoading()
|
||||||
|
{
|
||||||
|
_sessionLoadingActive = false;
|
||||||
|
SessionLoadingPopup.IsOpen = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void ReturnToLibraryWhileStopping()
|
private void ReturnToLibraryWhileStopping()
|
||||||
|
|||||||
Reference in New Issue
Block a user