Back to Game is an extension fro Playnite game manager and launcher to switch back to game if it was minimized, for example by pressing XBox button to activate Playnite. Main goal is to help to gamers who are using Fullsreen theme and controllers on theirs sofa.
Warning: it is required Theme side support to show button on game status screen.
I do everything in my spare time for free, if you feel something aided you and you want to support me, you can always buy me a "koffie" as we say in dutch, no obligations whatsoever...
If you may not use Ko-Fi in you country, it should not stop you! On boosty you may support me and other creators.
To use this extension it is require to have theme support.
One of simpliest approach is to modify customice theme Views/GameStatus.xaml file.
You should make modification under PART_PanelActionButtons
section and add new button element like:
<StackPanel Name="PART_PanelActionButtons" Orientation="Horizontal"
HorizontalAlignment="Center" Margin="0,540,0,20" >
<ButtonEx
Visibility="{PluginSettings Plugin=BackToGame, Path=IsRunning, Converter={StaticResource BooleanToVisibilityConverter}}"
Style="{StaticResource ButtonGameStatusAction}"
Content="{DynamicResource LOCBackToGame}"
Command="{PluginSettings Plugin=BackToGame, Path=ActivateGame}"
/>
</StackPanel>
Path=IsRunning
return true if extension is active and game is running. So use it to manage Visibility- Style - Up to theme, I recomend to use same as for 'Cancel' button.
LOCBackToGame
- is translatable resource to show 'Back to game' textPath=ActivateGame
- handler to call game activation.
Banner/Badge 'Back to game' on came list cards may be implemented in this way:
<TextBlock x:Name="GameIsRunningBadge"
Visibility="{Binding ElementName=BackToGame_Control, Path=Content.IsRunning, Converter={StaticResource BooleanToVisibilityConverter}}"
Background="{DynamicResource GlyphTransparentBrush}"
Text="{DynamicResource LOCGameRunning}"
VerticalAlignment="Bottom"
TextAlignment="Center"
Margin="0,0,0,15"
Padding="0,0,0,5"
FontSize="{DynamicResource ThemeFontSmallSize}"
Style="{DynamicResource ButtonTextBlockBoldStyle}" />
...
<DataTrigger Binding="{Binding ElementName=BackToGame_Control, Path=Content.IsRunning}" Value="True" >
<Setter Property="Text" Value="{DynamicResource LOCBackToGame}" TargetName="GameIsRunningBadge" />
</DataTrigger>
As soon as ActivateGame
command is invoked - extension will try to detect game window basing on process Id remembered on game launch.
After window is found it will issue Minimize and then Restore command to reactivate game window.
There are many ways how exacly game is executed and managed. So the processId of started event may not belong to exact game window. For examle:
- Pid is game.
- Pid is Launcher, that exacute Game. In this case game Pid is one of children.
- Pid is some process, but game is one of binary from game directory
The Only windows searching by pid modes (exact and tree) are supported.
The Next problem that pid (or list of pids from processes tree) may contain multiple windows. So detection of which is exact game - the point to improve.