Skip to content

Commit

Permalink
MP1-5214: Add PixelShader support: Add menu to Video Fullscreen
Browse files Browse the repository at this point in the history
  • Loading branch information
epbk committed Mar 31, 2024
1 parent 0e79990 commit db9728d
Showing 1 changed file with 88 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1329,7 +1329,10 @@ private void ShowContextMenu()
if (g_Player.IsVideo)
{
dlg.AddLocalizedString(1064); // Bookmarks
}
}

if (GUIGraphicsContext.VideoRenderer != GUIGraphicsContext.VideoRendererType.madVR)
dlg.AddLocalizedString(200096); // Pixel Shaders

_IsDialogVisible = true;
dlg.DoModal(GetID);
Expand All @@ -1338,7 +1341,7 @@ private void ShowContextMenu()
if (dlg.SelectedId == -1)
{
return;
}
}
switch (dlg.SelectedId)
{
// Add audio stream selection to be able to switch audio streams in .ts recordings
Expand Down Expand Up @@ -1395,9 +1398,92 @@ private void ShowContextMenu()

case 200091:
ShowChapterStreamsMenu();
break;

case 200096:
ShowPixelShaderMenu();
break;
}
}

private void ShowPixelShaderMenu()
{
if (dlg == null)
{
dlg = (GUIDialogMenu)GUIWindowManager.GetWindow((int)Window.WINDOW_DIALOG_MENU);
}
if (dlg == null)
{
return;
}
dlg.Reset();
dlg.SetHeading(GUILocalizeStrings.Get(200096) + " [" + GUIGraphicsContext.VideoPixelShaders.Profile + ']'); // Pixel Shaders [{profile}]

dlg.AddLocalizedString(300063); // Add

GUIGraphicsContext.VideoPixelShaders.ForEach(ps => dlg.Add(GUILocalizeStrings.Get(300064) + ": " + ps.Key)); // Remove:

// show dialog and wait for result
_IsDialogVisible = true;
dlg.DoModal(GetID);
_IsDialogVisible = false;

if (dlg.SelectedId == -1)
return;

if (dlg.SelectedLabel == 0)
{
string strName = this.ShowPixelShaderFileMenu();
if (strName != null)
GUIGraphicsContext.VideoPixelShaders.Add(strName);
else
return;
}
else
GUIGraphicsContext.VideoPixelShaders.RemoveAt(dlg.SelectedLabel - 1);

using (Profile.Settings xmlWritter = new Profile.MPSettings())
{
xmlWritter.SetValue("general", "VideoPixelShader" + GUIGraphicsContext.VideoPixelShaders.Profile, GUIGraphicsContext.VideoPixelShaders.GetNames());
}
}

private string ShowPixelShaderFileMenu()
{
if (dlg == null)
{
dlg = (GUIDialogMenu)GUIWindowManager.GetWindow((int)Window.WINDOW_DIALOG_MENU);
}
if (dlg == null)
{
return null;
}
dlg.Reset();
dlg.SetHeading(200097); // Select Pixel Shader

if (Directory.Exists(PixelShaderCollection.SHADER_FOLDER_NAME))
{
DirectoryInfo di = new DirectoryInfo(PixelShaderCollection.SHADER_FOLDER_NAME);
FileInfo[] files = di.GetFiles("*" + PixelShaderCollection.SHADER_EXTENSION);

for (int i = 0; i < files.Length; i++)
{
string strName = files[i].Name.Substring(0, files[i].Name.Length - PixelShaderCollection.SHADER_EXTENSION.Length);

dlg.Add(strName);
}
}

// show dialog and wait for result
_IsDialogVisible = true;
dlg.DoModal(GetID);
_IsDialogVisible = false;

if (dlg.SelectedId == -1)
return null;

return dlg.SelectedLabelText;
}

private void ShowChapterStreamsMenu()
{
Expand Down

0 comments on commit db9728d

Please sign in to comment.