Skip to content

Commit

Permalink
Fix blackscreen on picture background / video background switching
Browse files Browse the repository at this point in the history
  • Loading branch information
aRandomKiwi committed Jul 7, 2021
1 parent 848d3a0 commit 47d4c61
Show file tree
Hide file tree
Showing 11 changed files with 16 additions and 12 deletions.
7 changes: 4 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
Source/1.3/.vs/RimTheme/v15/.suo
Source/1.3/.vs/RimTheme/v15/Server/sqlite3/storage.ide-wal
Source/1.3/.vs/RimTheme/v15/Server/sqlite3/storage.ide-shm
Source/1.3/.vs/RimTheme/v15/.suo
Source/1.3/.vs/RimTheme/v15/Server/sqlite3/storage.ide-shm
Source/1.3/.vs/RimTheme/v15/Server/sqlite3/storage.ide-wal
Source/1.1-1.2/.vs/RimTheme/v15/.suo
Source/1.1-1.2/.vs/RimTheme/v15/Server/sqlite3/storage.ide-wal
Source/1.1-1.2/.vs/RimTheme/v15/Server/sqlite3/storage.ide-shm

Binary file modified 1.3/Assemblies/RimThemes.dll
Binary file not shown.
Binary file modified Source/1.3/.vs/RimTheme/v15/.suo
Binary file not shown.
Binary file modified Source/1.3/.vs/RimTheme/v15/Server/sqlite3/storage.ide
Binary file not shown.
Binary file modified Source/1.3/.vs/RimTheme/v15/Server/sqlite3/storage.ide-shm
Binary file not shown.
Binary file modified Source/1.3/.vs/RimTheme/v15/Server/sqlite3/storage.ide-wal
Binary file not shown.
2 changes: 2 additions & 0 deletions Source/1.3/Harmony/SaveLoad_Patchs.cs
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,8 @@ public class GameFinalizeInitPatch
{
public static void Prefix()
{
Utils.CurrentMainAnimatedBgPlaying = false;
Utils.CurrentMainAnimatedBgSourceSet = false;
LoaderGM.curStep = LoaderSteps.FinalizeLoad;
}
}
Expand Down
18 changes: 10 additions & 8 deletions Source/1.3/Harmony/UI_BackgroundMain_Patch.cs
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,9 @@ static bool Prefix()
return true;

//If the animated background is available and loaded, we start reading it!
if (Current.ProgramState == ProgramState.Entry && Themes.DBAnimatedBackground.ContainsKey(curTheme) && !Settings.disableVideoBg)
bool animatedBgOK = Current.ProgramState == ProgramState.Entry && Themes.DBAnimatedBackground.ContainsKey(curTheme) && !Settings.disableVideoBg;
bool animatedBgOKException = false;
if (animatedBgOK)
{
Rect pos;
if ((double)Screen.width <= (double)Screen.height * ((double)MainBackgroundSize.x / (double)MainBackgroundSize.y))
Expand All @@ -74,6 +76,7 @@ static bool Prefix()
Utils.CurrentMainAnimatedBg.enabled = true;
}


if (!Utils.CurrentMainAnimatedBgSourceSet)
{
Utils.CurrentMainAnimatedBg.renderMode = VideoRenderMode.RenderTexture;
Expand All @@ -89,7 +92,7 @@ static bool Prefix()
Utils.CurrentMainAnimatedBgSourceSet = true;
Utils.CurrentMainAnimatedBg.errorReceived += delegate (VideoPlayer source, string message)
{
Themes.LogMsg("VideoPlayer_Error : " + message+ " ");
Themes.LogMsg("VideoPlayer_Error : " + message + " ");
};
Utils.CurrentMainAnimatedBg.time = 0;
Utils.CurrentMainAnimatedBg.Prepare();
Expand All @@ -101,18 +104,17 @@ static bool Prefix()
Utils.CurrentMainAnimatedBg.Play();
Utils.CurrentMainAnimatedBgPlaying = true;
}
else
{
//To wait RimWorld original background display
return true;
}

//To wait show the picture background
animatedBgOKException = true;
}
else
{
GUI.DrawTexture(pos, Utils.CurrentMainAnimatedBg.texture, ScaleMode.ScaleToFit);
}
}
else

if(!animatedBgOK || animatedBgOKException)
{
bool flag = true;

Expand Down
1 change: 0 additions & 1 deletion Source/1.3/obj/Debug/RimThemes.csproj.FileListAbsolute.txt
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,3 @@ C:\Program Files (x86)\Steam\steamapps\common\RimWorld\Mods\RimThemes\1.3\Assemb
C:\Program Files (x86)\Steam\steamapps\common\RimWorld\Mods\RimThemes\Source\1.3\obj\Debug\RimThemes.csproj.CoreCompileInputs.cache
C:\Program Files (x86)\Steam\steamapps\common\RimWorld\Mods\RimThemes\Source\1.3\obj\Debug\RimThemes.csproj.CopyComplete
C:\Program Files (x86)\Steam\steamapps\common\RimWorld\Mods\RimThemes\Source\1.3\obj\Debug\RimThemes.dll
C:\Program Files (x86)\Steam\steamapps\common\RimWorld\mods\RimThemes\Source\1.3\obj\Debug\RimThemes.csprojAssemblyReference.cache
Binary file not shown.
Binary file modified Source/1.3/obj/Debug/RimThemes.dll
Binary file not shown.

0 comments on commit 47d4c61

Please sign in to comment.