Skip to content

Commit

Permalink
Migration: Swap to D3D9 if dll is in game folder
Browse files Browse the repository at this point in the history
  • Loading branch information
Sora-yx committed Feb 4, 2025
1 parent ea42126 commit e0a427e
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 12 deletions.
6 changes: 1 addition & 5 deletions SA-Mod-Manager/App.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ protected override async void OnStartup(StartupEventArgs e)

}

public static void UpdateDependenciesLocation(string oldD3D8Path)
public static void UpdateDependenciesLocation()
{
if (Directory.Exists(App.extLibPath) == false && Directory.Exists(App.oldExtLibPath))
{
Expand All @@ -154,10 +154,6 @@ public static void UpdateDependenciesLocation(string oldD3D8Path)
{
File.Copy(newPath, newPath.Replace(App.oldExtLibPath, App.extLibPath), true);
}


if (App.CurrentGame.id == GameEntry.GameType.SADX && File.Exists(oldD3D8Path))
File.Delete(oldD3D8Path);
}
catch { }
}
Expand Down
17 changes: 14 additions & 3 deletions SA-Mod-Manager/Controls/SADX/GameConfig.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ public partial class GameConfig : UserControl
#region Variables
public GameSettings GameProfile;

bool suppressEvent = false;
bool suppressEvent = false;
public static string OldD3d8to9GamePath = Path.Combine(App.CurrentGame.gameDirectory, "d3d8.dll");
private static string d3d8to9Path = Path.Combine(App.extLibPath, "d3d8m.dll");
private readonly double LowOpacityBtn = 0.7;
Expand All @@ -49,6 +49,7 @@ public GameConfig(ref object gameSettings, ref bool suppressEvent_)

SetPatches();
}

Loaded += GameConfig_Loaded;
}

Expand All @@ -57,10 +58,15 @@ private void GameConfig_Loaded(object sender, RoutedEventArgs e)
{
SetupBindings();
SetPatches();
//CheckOldD3D9Dll();
SetTextureFilterList();
InitMouseList();

if (App.CurrentGame.id == GameEntry.GameType.SADX && File.Exists(OldD3d8to9GamePath))
{
File.Delete(OldD3d8to9GamePath);
SetD3D9();
}

mouseAction.SelectionChanged += mouseAction_SelectionChanged;
mouseBtnAssign.SelectionChanged += mouseBtnAssign_SelectionChanged;
}
Expand Down Expand Up @@ -191,7 +197,12 @@ public static void UpdateD3D8Paths()
{
OldD3d8to9GamePath = Path.Combine(App.CurrentGame.gameDirectory, "d3d8.dll");
d3d8to9Path = Path.Combine(App.extLibPath, "d3d8m.dll");
}
}

public void SetD3D9()
{
comboRenderBackend.SelectedIndex = 1;
}


private void comboTextureFilter_SelectionChanged(object sender, SelectionChangedEventArgs e)
Expand Down
7 changes: 3 additions & 4 deletions SA-Mod-Manager/UI/MainWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1469,10 +1469,9 @@ private void UpdateManagerInfo()

App.extLibPath = Path.Combine(App.CurrentGame.modDirectory, ".modloader", "extlib");

if (App.CurrentGame?.id == GameEntry.GameType.SADX)
Controls.SADX.GameConfig.UpdateD3D8Paths();

App.UpdateDependenciesLocation(Controls.SADX.GameConfig.OldD3d8to9GamePath);
Controls.SADX.GameConfig.UpdateD3D8Paths();

App.UpdateDependenciesLocation();

}
else
Expand Down

0 comments on commit e0a427e

Please sign in to comment.