diff --git a/.github/workflows/main-3.5.1.yml b/.github/workflows/main-3.9.9.yml similarity index 94% rename from .github/workflows/main-3.5.1.yml rename to .github/workflows/main-3.9.9.yml index b2178209..e1dd5807 100644 --- a/.github/workflows/main-3.5.1.yml +++ b/.github/workflows/main-3.9.9.yml @@ -1,6 +1,6 @@ name: 7th-Heaven -run-name: 3.5.1.${{ github.run_number }} +run-name: 3.9.9.${{ github.run_number }} on: workflow_dispatch: @@ -20,7 +20,7 @@ env: _RELEASE_VERSION: v0 _RELEASE_CONFIGURATION: Release _BUILD_BRANCH: "${{ github.ref }}" - _BUILD_VERSION: "3.5.1.${{ github.run_number }}" + _BUILD_VERSION: "3.9.9.${{ github.run_number }}" _CHANGELOG_VERSION: "0" # VCPKG: Enable Binary Caching VCPKG_BINARY_SOURCES: clear;nuget,github,readwrite @@ -40,7 +40,9 @@ jobs: git config --global core.filemode false git config --global core.longpaths true - name: Checkout - uses: actions/checkout@v4.1.0 + uses: actions/checkout@v4 + with: + fetch-depth: 0 - name: Prepare Environment run: ".github/workflows/prepare.ps1" shell: pwsh @@ -55,7 +57,7 @@ jobs: - name: Restore NuGet Packages run: nuget restore ${{ github.workspace }}\${{ env._RELEASE_NAME }}.sln - name: Add MSBuild to PATH - uses: microsoft/setup-msbuild@v1.3.2 + uses: microsoft/setup-msbuild@v1 - name: Run MSBuild run: msbuild ${{ github.workspace }}\${{ env._RELEASE_NAME }}.sln /p:WindowsTargetPlatformVersion=10.0.19041.0 /m -p:Configuration=${{ env._RELEASE_CONFIGURATION }} -p:Platform="Any CPU" - name: Prepare Installer @@ -90,7 +92,7 @@ jobs: return ret; - name: Publish PR artifacts if: env._IS_GITHUB_RELEASE == 'false' && success() - uses: actions/upload-artifact@v4.0.0 + uses: actions/upload-artifact@v4 with: name: "${{ env._RELEASE_NAME }}-${{ env._RELEASE_VERSION }}" path: ".dist/*" diff --git a/7thHeaven.Code/LaunchSettings.cs b/7thHeaven.Code/LaunchSettings.cs index cfb3564e..3136c242 100644 --- a/7thHeaven.Code/LaunchSettings.cs +++ b/7thHeaven.Code/LaunchSettings.cs @@ -2,21 +2,11 @@ namespace _7thHeaven.Code { - public enum MountDiscOption - { - Unknown = -1, - MountWithPowerShell = 0, - MountWithWinCDEmu = 1, - DoNotMount =2, - } [Serializable] public class LaunchSettings { - public bool AutoMountGameDisc { get; set; } - public bool AutoUnmountGameDisc { get; set; } public bool AutoUpdateDiscPath { get; set; } - public MountDiscOption MountingOption { get; set; } public bool DisableReunionOnLaunch { get; set; } @@ -49,8 +39,6 @@ public static LaunchSettings DefaultSettings() { return new LaunchSettings() { - AutoMountGameDisc = true, - AutoUnmountGameDisc = true, AutoUpdateDiscPath = true, DisableReunionOnLaunch = true, SelectedSoundDevice = Guid.Empty, @@ -62,7 +50,6 @@ public static LaunchSettings DefaultSettings() HasDisplayedOggMusicWarning = false, HasDisplayedMovieWarning = false, EnablePs4ControllerService = false, - MountingOption = MountDiscOption.MountWithPowerShell, EnableGamepadPolling = false, }; } diff --git a/7thHeaven.Code/RegistryHelper.cs b/7thHeaven.Code/RegistryHelper.cs index 08be5c98..27501ea2 100644 --- a/7thHeaven.Code/RegistryHelper.cs +++ b/7thHeaven.Code/RegistryHelper.cs @@ -24,9 +24,13 @@ public static class RegistryHelper private static List transaction = new(); - public const string SteamKeyPath64Bit = @"HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall\Steam App 39140"; + public const string SteamKeyPath64Bit = @"HKEY_CURRENT_USER\Software\Wow6432Node\Valve\Steam"; - public const string SteamKeyPath32Bit = @"HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\Steam App 39140"; + public const string SteamKeyPath32Bit = @"HKEY_CURRENT_USER\Software\Valve\Steam"; + + public const string FF7SteamKeyPath64Bit = @"HKEY_CURRENT_USER\Software\Wow6432Node\Valve\Steam\Apps\39140"; + + public const string FF7SteamKeyPath32Bit = @"HKEY_CURRENT_USER\Software\Valve\Steam\Apps\39140"; public const string RereleaseKeyPath64Bit = @"HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall\{141B8BA9-BFFD-4635-AF64-078E31010EC3}_is1"; diff --git a/7thHeaven.Code/Settings.cs b/7thHeaven.Code/Settings.cs index dd69363c..e52ef49a 100644 --- a/7thHeaven.Code/Settings.cs +++ b/7thHeaven.Code/Settings.cs @@ -15,6 +15,13 @@ The original developer is Iros namespace Iros._7th.Workshop { + public enum FF7Version + { + Unknown = -1, + Steam, + ReRelease, + Original98 + } public enum GeneralOptions { None = 0, @@ -105,6 +112,7 @@ public List SubscribedUrls public string FF7Exe { get; set; } [System.Xml.Serialization.XmlElement("AlsoLaunch")] public List ProgramsToLaunchPrior { get; set; } + public FF7Version FF7InstalledVersion { get; set; } public FFNxUpdateChannelOptions FFNxUpdateChannel { get; set; } public AppUpdateChannelOptions AppUpdateChannel { get; set; } public DateTime LastUpdateCheck { get; set; } @@ -202,7 +210,7 @@ public static Settings UseDefaultSettings() /// public void SetPathsFromInstallationPath(string pathToFf7Install) { - FF7Exe = Path.Combine(pathToFf7Install, "FF7.exe"); + FF7Exe = Sys.Settings.FF7InstalledVersion == FF7Version.Original98 ? Path.Combine(pathToFf7Install, "FF7.exe") : Path.Combine(pathToFf7Install, "ff7_en.exe"); LibraryLocation = Path.Combine(pathToFf7Install, "mods", @"7th Heaven"); LogAndCreateFolderIfNotExists(LibraryLocation); diff --git a/7thHeaven.Code/StringKey.cs b/7thHeaven.Code/StringKey.cs index 2c6789b6..da3e3e52 100644 --- a/7thHeaven.Code/StringKey.cs +++ b/7thHeaven.Code/StringKey.cs @@ -280,6 +280,7 @@ public enum StringKey DeletingTemporaryFiles, BeginningToPollForGamePadInput, FoundLanguageInstalledCreatingEnglishGameFiles, + ErrorOnlyEnglishLanguageSupported, Ff7IsCurrentlyInstalledInASystemFolder, CanNotContinueDueToFf7nstalledInProtectedFolder, CannotContinue, diff --git a/7thHeaven.Code/Sys.cs b/7thHeaven.Code/Sys.cs index 8cb45668..9ea05ad3 100644 --- a/7thHeaven.Code/Sys.cs +++ b/7thHeaven.Code/Sys.cs @@ -17,7 +17,6 @@ The original developer is Iros namespace Iros._7th.Workshop { - public class ModStatusEventArgs : EventArgs { public ModStatus OldStatus { get; set; } diff --git a/7thHeaven.sln b/7thHeaven.sln index aeb1b0f8..51e27845 100644 --- a/7thHeaven.sln +++ b/7thHeaven.sln @@ -17,6 +17,8 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "7thWrapperLoader", "7thWrap EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "7thWrapperProxy", "7thWrapperProxy\7thWrapperProxy.csproj", "{F955F161-A47E-4399-9FD2-DB0D83E6461A}" EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "FF7_Launcher", "FF7_Launcher\FF7_Launcher.vcxproj", "{E9DF030F-3113-46CD-81EB-DDEC52A7C926}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -109,6 +111,18 @@ Global {F955F161-A47E-4399-9FD2-DB0D83E6461A}.Release|x64.Build.0 = Release|Any CPU {F955F161-A47E-4399-9FD2-DB0D83E6461A}.Release|x86.ActiveCfg = Release|Any CPU {F955F161-A47E-4399-9FD2-DB0D83E6461A}.Release|x86.Build.0 = Release|Any CPU + {E9DF030F-3113-46CD-81EB-DDEC52A7C926}.Debug|Any CPU.ActiveCfg = Debug|win32 + {E9DF030F-3113-46CD-81EB-DDEC52A7C926}.Debug|Any CPU.Build.0 = Debug|win32 + {E9DF030F-3113-46CD-81EB-DDEC52A7C926}.Debug|x64.ActiveCfg = Debug|win32 + {E9DF030F-3113-46CD-81EB-DDEC52A7C926}.Debug|x64.Build.0 = Debug|win32 + {E9DF030F-3113-46CD-81EB-DDEC52A7C926}.Debug|x86.ActiveCfg = Debug|win32 + {E9DF030F-3113-46CD-81EB-DDEC52A7C926}.Debug|x86.Build.0 = Debug|win32 + {E9DF030F-3113-46CD-81EB-DDEC52A7C926}.Release|Any CPU.ActiveCfg = Release|win32 + {E9DF030F-3113-46CD-81EB-DDEC52A7C926}.Release|Any CPU.Build.0 = Release|win32 + {E9DF030F-3113-46CD-81EB-DDEC52A7C926}.Release|x64.ActiveCfg = Release|win32 + {E9DF030F-3113-46CD-81EB-DDEC52A7C926}.Release|x64.Build.0 = Release|win32 + {E9DF030F-3113-46CD-81EB-DDEC52A7C926}.Release|x86.ActiveCfg = Release|win32 + {E9DF030F-3113-46CD-81EB-DDEC52A7C926}.Release|x86.Build.0 = Release|win32 EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/7thWrapperLib/Profile.cs b/7thWrapperLib/Profile.cs index cd9d82d7..15aeae14 100644 --- a/7thWrapperLib/Profile.cs +++ b/7thWrapperLib/Profile.cs @@ -311,7 +311,7 @@ public IEnumerable GetLoadPrograms() public static bool DirExists(string dir) { bool exist = System.IO.Directory.Exists(dir); - DebugLogger.DetailedWriteLine($"MOD: Check if directory exists {dir}: {exist}"); + //DebugLogger.DetailedWriteLine($"MOD: Check if directory exists {dir}: {exist}"); return exist; } @@ -350,7 +350,7 @@ private bool FileExists(string file) exist = System.IO.File.Exists(file); if (exist) _activated.Add(file); } - DebugLogger.DetailedWriteLine($"MOD: Check if file exists {file}: {exist}"); + //DebugLogger.DetailedWriteLine($"MOD: Check if file exists {file}: {exist}"); return exist; } diff --git a/7thWrapperLib/Wrap.cs b/7thWrapperLib/Wrap.cs index 901fa8e3..2e74fdb8 100644 --- a/7thWrapperLib/Wrap.cs +++ b/7thWrapperLib/Wrap.cs @@ -32,7 +32,7 @@ private static void MonitorThread(object rpo) do { - DebugLogger.WriteLine("MONITOR:"); + DebugLogger.WriteLine(">> MONITOR:"); for (int i = 0; i < accessors.Count; i++) { int value; @@ -85,16 +85,29 @@ public static void Run(Process currentProcess, string profileFile = ".7thWrapper } } - DebugLogger.WriteLine($"Wrap run... PName: {_process.ProcessName} PID: {_process.Id} Path: {_profile.ModPath} Capture: {String.Join(", ", _profile.MonitorPaths)}"); + DebugLogger.WriteLine($"Starting wrapper now:"); + + DebugLogger.WriteLine($">> PName: {_process.ProcessName}"); + DebugLogger.WriteLine($">> PID: {_process.Id}"); + DebugLogger.WriteLine($">> FF7Path: {_profile.FF7Path}"); + DebugLogger.WriteLine($">> ModPath: {_profile.ModPath}"); + DebugLogger.WriteLine($">> MonitorPaths:"); + foreach(string monPath in _profile.MonitorPaths) + DebugLogger.WriteLine($" - {monPath}"); for (int i = _profile.MonitorPaths.Count - 1; i >= 0; i--) { if (!_profile.MonitorPaths[i].EndsWith(System.IO.Path.DirectorySeparatorChar.ToString())) _profile.MonitorPaths[i] += System.IO.Path.DirectorySeparatorChar; if (String.IsNullOrWhiteSpace(_profile.MonitorPaths[i])) _profile.MonitorPaths.RemoveAt(i); } + DebugLogger.WriteLine($"\nLoading mods:"); + foreach (var item in _profile.Mods) { - DebugLogger.WriteLine($" Mod: {item.BaseFolder} has {item.Conditionals.Count} conditionals"); - DebugLogger.WriteLine(" Additional paths: " + String.Join(", ", item.ExtraFolders)); + DebugLogger.WriteLine($">> Mod: {item.BaseFolder}"); + DebugLogger.WriteLine($" - Conditionals: {item.Conditionals.Count}"); + DebugLogger.WriteLine($" - Extra Folders:"); + foreach (string extraFolder in item.ExtraFolders) + DebugLogger.WriteLine($" - {extraFolder}"); item.Startup(); } @@ -119,6 +132,8 @@ public static void Run(Process currentProcess, string profileFile = ".7thWrapper } } + DebugLogger.WriteLine($"\nLoading hext patches:"); + foreach (var mod in _profile.Mods.AsEnumerable().Reverse()) { foreach (string file in mod.GetPathOverrideNames("hext")) { foreach (var of in mod.GetOverrides("hext\\" + file)) { @@ -128,11 +143,11 @@ public static void Run(Process currentProcess, string profileFile = ".7thWrapper } else { s = of.Archive.GetData(of.File); } - DebugLogger.WriteLine($"Applying hext patch {file} from mod {mod.BaseFolder}"); + DebugLogger.WriteLine($">> Applying hext patch {file} from mod {mod.BaseFolder}"); try { HexPatch.Apply(s); } catch (Exception ex) { - DebugLogger.WriteLine("Error applying patch: " + ex.Message); + DebugLogger.WriteLine(" - Error applying patch: " + ex.Message); } } } @@ -167,6 +182,9 @@ public static void Run(Process currentProcess, string profileFile = ".7thWrapper AddIROFilesToMappedFiles("", null, archive); } } + + DebugLogger.WriteLine($"\nWrapper startup complete."); + DebugLogger.WriteLine($"\nListening for game actions..."); } catch (Exception e) { DebugLogger.WriteLine(e.ToString()); return; @@ -262,7 +280,7 @@ public static int HCloseHandle(IntPtr hObject) if (_varchives.ContainsKey(hObject)) { _varchives.Remove(hObject); - DebugLogger.WriteLine($"Closing dummy handle {hObject}"); + DebugLogger.WriteLine($">> Closing dummy handle {hObject}"); } return ret; @@ -272,7 +290,7 @@ public static uint HGetFileType(IntPtr hFile) { uint ret = 0; - DebugLogger.DetailedWriteLine($"GetFileType on {hFile}"); + DebugLogger.DetailedWriteLine($">> GetFileType on {hFile}"); if (_varchives.ContainsKey(hFile)) { //DebugLogger.WriteLine(" ---faking dummy file"); @@ -319,7 +337,7 @@ public static int HReadFile(IntPtr handle, IntPtr bytes, uint numBytesToRead, In public static IntPtr CreateVA(OverrideFile of) { VArchiveData va = new VArchiveData(of.Archive.GetBytes(of.File)); IntPtr dummy = of.Archive.GetDummyHandle(_process); - DebugLogger.WriteLine($"Creating dummy file handle {dummy} to access {of.Archive}{of.File}"); + DebugLogger.WriteLine($">> Creating dummy file handle {dummy} to access {of.Archive}{of.File}"); _varchives[dummy] = va; return dummy; @@ -348,7 +366,7 @@ public static IntPtr HCreateFileW( if (isFF7GameFile) { lpFileName = lpFileName.Replace("\\/", "\\").Replace("/", "\\").Replace("\\\\", "\\"); - DebugLogger.DetailedWriteLine($"CreateFileW for {lpFileName}..."); + DebugLogger.DetailedWriteLine($">> CreateFileW for {lpFileName}..."); if (lpFileName.IndexOf('\\') < 0) { //DebugLogger.WriteLine("No path: curdir is {0}", System.IO.Directory.GetCurrentDirectory(), 0); @@ -375,7 +393,7 @@ public static IntPtr HCreateFileW( if (mapped != null) { - DebugLogger.WriteLine($"Remapping {lpFileName} to {mapped.File} [ Matched: '{match}' ]"); + DebugLogger.WriteLine($" - Remapping {lpFileName} to {mapped.File} [ Matched: '{match}' ]"); if (mapped.Archive == null) { @@ -391,7 +409,7 @@ public static IntPtr HCreateFileW( } } else - DebugLogger.DetailedWriteLine($"Skipped file {lpFileName}"); + DebugLogger.DetailedWriteLine($">> Skipped file {lpFileName}"); if (ret == IntPtr.Zero) ret = Win32.CreateFileW(lpFileName, dwDesiredAccess, dwShareMode, lpSecurityAttributes, dwCreationDisposition, dwFlagsAndAttributes, hTemplateFile); @@ -403,7 +421,7 @@ public static IntPtr HCreateFileW( public static IntPtr HFindFirstFileW(string lpFileName, IntPtr lpFindFileData) { - DebugLogger.WriteLine("FindFirstFile for " + lpFileName); + DebugLogger.WriteLine(">> FindFirstFile for " + lpFileName); return IntPtr.Zero; } @@ -419,7 +437,7 @@ public static int HGetFileInformationByHandle(IntPtr hFile, IntPtr lpFileInforma if (result && _varchives.ContainsKey(hFile)) { - DebugLogger.DetailedWriteLine($"Overriding GetFileInformationByHandle for dummy file {hFile}"); + DebugLogger.DetailedWriteLine($">> Overriding GetFileInformationByHandle for dummy file {hFile}"); _lpFileInformation.FileSizeHigh = (uint)(_varchives[hFile].Size >> 32); _lpFileInformation.FileSizeLow = (uint)(_varchives[hFile].Size & 0xffffffff); @@ -438,7 +456,7 @@ public static int HDuplicateHandle(IntPtr hSourceProcessHandle, IntPtr hSourceHa if (_varchives.ContainsKey(hSourceHandle)) { _varchives[lpTargetHandle] = _varchives[hSourceHandle]; - DebugLogger.DetailedWriteLine($"Duplicating dummy handle {hSourceHandle} to {lpTargetHandle}"); + DebugLogger.DetailedWriteLine($">> Duplicating dummy handle {hSourceHandle} to {lpTargetHandle}"); } return 1; @@ -450,7 +468,7 @@ public static uint HGetFileSize(IntPtr hFile, IntPtr lpFileSizeHigh) if (_varchives.ContainsKey(hFile)) { - DebugLogger.WriteLine($"GetFileSize on dummy handle {hFile}"); + DebugLogger.WriteLine($">> GetFileSize on dummy handle {hFile}"); ret = _varchives[hFile].GetFileSize(lpFileSizeHigh); } @@ -463,7 +481,7 @@ public static int HGetFileSizeEx(IntPtr hFile, IntPtr lpFileSize) if (_varchives.ContainsKey(hFile)) { - DebugLogger.WriteLine($"GetFileSizeEx on dummy handle {hFile}"); + DebugLogger.WriteLine($">> GetFileSizeEx on dummy handle {hFile}"); byte[] tmp = BitConverter.GetBytes(_varchives[hFile].Size); Util.CopyToIntPtr(tmp, lpFileSize, tmp.Length); diff --git a/FF7_Launcher/FF7_Launcher.cpp b/FF7_Launcher/FF7_Launcher.cpp new file mode 100644 index 00000000..a30de374 --- /dev/null +++ b/FF7_Launcher/FF7_Launcher.cpp @@ -0,0 +1,27 @@ +// FF7_Launcher.cpp : Defines the entry point for the application. +// + +#include +#include "Resource.h" + +int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow) +{ + // Initialize the process start information + STARTUPINFO si; + PROCESS_INFORMATION pi; + ZeroMemory(&si, sizeof(si)); + si.cb = sizeof(si); + ZeroMemory(&pi, sizeof(pi)); + + // Start the process + if (!CreateProcess(L"ff7_en.exe", NULL, NULL, NULL, FALSE, 0, NULL, NULL, &si, &pi)) return 1; + + // Wait for the process to finish + WaitForSingleObject(pi.hProcess, INFINITE); + + // Close process and thread handles + CloseHandle(pi.hProcess); + CloseHandle(pi.hThread); + + return 0; +} diff --git a/FF7_Launcher/FF7_Launcher.h b/FF7_Launcher/FF7_Launcher.h new file mode 100644 index 00000000..e60f2eb7 --- /dev/null +++ b/FF7_Launcher/FF7_Launcher.h @@ -0,0 +1,3 @@ +#pragma once + +#include "resource.h" diff --git a/FF7_Launcher/FF7_Launcher.ico b/FF7_Launcher/FF7_Launcher.ico new file mode 100644 index 00000000..b3ec03bd Binary files /dev/null and b/FF7_Launcher/FF7_Launcher.ico differ diff --git a/FF7_Launcher/FF7_Launcher.rc b/FF7_Launcher/FF7_Launcher.rc new file mode 100644 index 00000000..e0153c77 Binary files /dev/null and b/FF7_Launcher/FF7_Launcher.rc differ diff --git a/FF7_Launcher/FF7_Launcher.vcxproj b/FF7_Launcher/FF7_Launcher.vcxproj new file mode 100644 index 00000000..6f963e0d --- /dev/null +++ b/FF7_Launcher/FF7_Launcher.vcxproj @@ -0,0 +1,95 @@ + + + + + Debug + win32 + + + Release + win32 + + + + 17.0 + Win32Proj + {e9df030f-3113-46cd-81eb-ddec52a7c926} + FF7Launcher + 10.0 + + + + Application + true + v143 + Unicode + + + Application + false + v143 + true + Unicode + + + + + + + + + + + + + + + $(SolutionDir)\SeventhHeavenUI\bin\Release\net8.0-windows7.0\ + + + $(SolutionDir)\SeventhHeavenUI\bin\Debug\net8.0-windows7.0\ + + + + Level3 + true + WIN32;_DEBUG;_WINDOWS;%(PreprocessorDefinitions) + true + + + Windows + true + + + + + Level3 + true + true + true + WIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions) + true + + + Windows + true + true + true + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/FF7_Launcher/Resource.h b/FF7_Launcher/Resource.h new file mode 100644 index 00000000..daf20a19 --- /dev/null +++ b/FF7_Launcher/Resource.h @@ -0,0 +1,3 @@ +#pragma once + +#define IDI_ICON1 101 diff --git a/README.md b/README.md index e1c3d23b..a3c92801 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -![License](https://img.shields.io/github/license/tsunamods-codes/7th-Heaven) ![Overall Downloads](https://img.shields.io/github/downloads/tsunamods-codes/7th-Heaven/total?label=Overall%20Downloads) ![Latest Stable Downloads](https://img.shields.io/github/downloads/tsunamods-codes/7th-Heaven/latest/total?label=Latest%20Stable%20Downloads&sort=semver) ![Latest Canary Downloads](https://img.shields.io/github/downloads/tsunamods-codes/7th-Heaven/canary/total?label=Latest%20Canary%20Downloads) ![GitHub Actions Workflow Status](https://github.com/tsunamods-codes/7th-Heaven/actions/workflows/main-3.5.1.yml/badge.svg?branch=master) +![License](https://img.shields.io/github/license/tsunamods-codes/7th-Heaven) ![Overall Downloads](https://img.shields.io/github/downloads/tsunamods-codes/7th-Heaven/total?label=Overall%20Downloads) ![Latest Stable Downloads](https://img.shields.io/github/downloads/tsunamods-codes/7th-Heaven/latest/total?label=Latest%20Stable%20Downloads&sort=semver) ![Latest Canary Downloads](https://img.shields.io/github/downloads/tsunamods-codes/7th-Heaven/canary/total?label=Latest%20Canary%20Downloads) ![GitHub Actions Workflow Status](https://github.com/tsunamods-codes/7th-Heaven/actions/workflows/main-3.9.9.yml/badge.svg?branch=master)
diff --git a/SeventhHeavenUI/Classes/FFNxDriverUpdater.cs b/SeventhHeavenUI/Classes/FFNxDriverUpdater.cs index ab5ad940..182c23f9 100644 --- a/SeventhHeavenUI/Classes/FFNxDriverUpdater.cs +++ b/SeventhHeavenUI/Classes/FFNxDriverUpdater.cs @@ -26,11 +26,19 @@ private string GetUpdateInfoPath() public string GetCurrentDriverVersion() { + _currentDriverVersion = null; + try { - _currentDriverVersion = FileVersionInfo.GetVersionInfo( - Path.Combine(Sys.InstallPath, "FFNx.dll") - ); + if (IsAlreadyInstalled()) + { + _currentDriverVersion = FileVersionInfo.GetVersionInfo( + Path.Combine( + Sys.InstallPath, + Sys.Settings.FF7InstalledVersion == FF7Version.Steam ? "AF3DN.P" : "FFNx.dll" + ) + ); + } } catch (FileNotFoundException) { @@ -60,11 +68,12 @@ private string GetUpdateVersion(string name) private string GetUpdateReleaseUrl(dynamic assets) { - for (int i = 0; i < assets.Count - 1; i++) + for (int i = 0; i < assets.Count; i++) { string url = assets[i].browser_download_url.Value; + string prefix = Sys.Settings.FF7InstalledVersion == FF7Version.Steam ? "FFNx-Steam" : "FFNx-FF7_1998"; - if (url.Contains("FFNx-FF7_1998")) + if (url.Contains(prefix)) return url; } @@ -307,5 +316,21 @@ public static void CleanupUnnecessaryFiles() } } } + + public static bool IsAlreadyInstalled() + { + var fi = new FileInfo( + Path.Combine(Sys.InstallPath, Sys.Settings.FF7InstalledVersion == FF7Version.Steam ? "AF3DN.P" : "FFNx.dll") + ); + bool ret = fi.Exists; + + if (Sys.Settings.FF7InstalledVersion == FF7Version.Steam && fi.Exists) + { + // Steam driver is not FFNx, force installation + if (fi.Length <= (192 * 1024)) ret = false; + } + + return ret; + } } } diff --git a/SeventhHeavenUI/Classes/GameConverter.cs b/SeventhHeavenUI/Classes/GameConverter.cs index 7dd94114..dacfb559 100644 --- a/SeventhHeavenUI/Classes/GameConverter.cs +++ b/SeventhHeavenUI/Classes/GameConverter.cs @@ -10,6 +10,7 @@ using System.Text; using System.Text.RegularExpressions; using System.Threading.Tasks; +using ValveKeyValue; namespace SeventhHeaven.Classes { @@ -34,31 +35,32 @@ public GameConverter(string installPath) public static string GetInstallLocation(FF7Version installedVersion) { - string installPath = null; + string installPath = ""; switch (installedVersion) { - case FF7Version.Unknown: - return ""; - case FF7Version.Steam: - if (Environment.Is64BitOperatingSystem) - { - // on 64-bit OS, Steam release registry key could be at 64bit path or 32bit path so check both - installPath = RegistryHelper.GetValue(RegistryHelper.SteamKeyPath32Bit, "InstallLocation", "") as string; + // Detect if Steam is installed + string steamPath = GetSteamPath(); - if (string.IsNullOrEmpty(installPath)) - { - installPath = RegistryHelper.GetValue(RegistryHelper.SteamKeyPath64Bit, "InstallLocation", "") as string; - } - } - else - { - installPath = RegistryHelper.GetValue(RegistryHelper.SteamKeyPath32Bit, "InstallLocation", "") as string; + if (steamPath != null) + { + var stream = File.OpenRead(steamPath + "\\steamapps\\libraryfolders.vdf"); + var kv = KVSerializer.Create(KVSerializationFormat.KeyValues1Text); + KVObject data = kv.Deserialize(stream); + + foreach (var section in data) + { + if (section["apps"]["39140"] != null) + { + if (section["apps"]["39140"].ToString() != "0") + installPath = section["path"] + "\\steamapps\\common\\FINAL FANTASY VII"; + } + } } - return installPath; + break; case FF7Version.ReRelease: // check 32-bit then 64-bit registry if not exists @@ -69,14 +71,39 @@ public static string GetInstallLocation(FF7Version installedVersion) installPath = RegistryHelper.GetValue(RegistryHelper.RereleaseKeyPath64Bit, "InstallLocation", "") as string; } - return installPath; + break; case FF7Version.Original98: - return RegistryHelper.GetValue(FF7RegKey.FF7AppKeyPath, "Path", "") as string; - - default: - return ""; + installPath = RegistryHelper.GetValue(FF7RegKey.FF7AppKeyPath, "Path", "") as string; + break; } + + return installPath; + } + + public static string GetSteamPath() + { + string ret = RegistryHelper.GetValue(RegistryHelper.SteamKeyPath32Bit, "SteamPath", "") as string; + + if (ret == null) ret = RegistryHelper.GetValue(RegistryHelper.SteamKeyPath64Bit, "SteamPath", "") as string; + + return ret; + } + + public static string GetSteamExePath() + { + string ret = RegistryHelper.GetValue(RegistryHelper.SteamKeyPath32Bit, "SteamExe", "") as string; + + if (ret == null) ret = RegistryHelper.GetValue(RegistryHelper.SteamKeyPath64Bit, "SteamExe", "") as string; + + return ret; + } + + public static string GetSteamFF7UserPath() + { + string ret = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments) + "\\Square Enix\\FINAL FANTASY VII Steam"; + + return ret; } public bool IsGamePirated() @@ -728,49 +755,12 @@ public void CopyMusicFiles() } /// - /// Checks FFNx.dll is present in the current game directory. - /// If not present it will automatically download and install the latest stable version. - /// - /// returns false if error occurred - internal bool InstallLatestGameDriver(string backupFolderPath) - { - string pathToCurrentDriver = Path.Combine(InstallPath, "FFNx.dll"); - bool currentDriverExists = File.Exists(pathToCurrentDriver); - - if (!currentDriverExists) - { - try - { - FFNxDriverUpdater updater = new FFNxDriverUpdater(); - - SendMessage($"Download and extracting the latest FFNx {Sys.Settings.FFNxUpdateChannel} version to {Sys.InstallPath}..."); - updater.DownloadAndExtractLatestVersion(Sys.Settings.FFNxUpdateChannel); - } - catch (Exception ex) - { - Logger.Error(ex); - return false; - } - } - else - { - SendMessage($"FFNx seems to be present."); - } - - return true; - } - - /// - /// Creates 'mods/Textures', 'direct' and subfolders, 'music', 'music/vgmstream', 'data/kernel' 'data/battle' folders if missing + /// Creates 'direct' and subfolders, 'mods/Textures' folders if missing /// public void CreateMissingDirectories() { string[] requiredFolders = new string[] { - Path.Combine(InstallPath, "data"), - Path.Combine(InstallPath, "data", "movies"), - Path.Combine(InstallPath, "data", "kernel"), - Path.Combine(InstallPath, "data", "battle"), Path.Combine(InstallPath, "direct"), Path.Combine(InstallPath, "direct", "battle"), Path.Combine(InstallPath, "direct", "char"), @@ -788,13 +778,7 @@ public void CreateMissingDirectories() Path.Combine(InstallPath, "direct", "snowboard"), Path.Combine(InstallPath, "direct", "sub"), Path.Combine(InstallPath, "direct", "world"), - Path.Combine(InstallPath, "music"), - Path.Combine(InstallPath, "music", "vgmstream"), - Path.Combine(InstallPath, "sfx"), - Path.Combine(InstallPath, "shaders"), - Path.Combine(InstallPath, "voice"), - Path.Combine(InstallPath, "ambient"), - Path.Combine(InstallPath, "widescreen"), + Path.Combine(InstallPath, "mods", "Textures"), }; foreach (string dir in requiredFolders) diff --git a/SeventhHeavenUI/Classes/GameDiscMounter.cs b/SeventhHeavenUI/Classes/GameDiscMounter.cs deleted file mode 100644 index fd225859..00000000 --- a/SeventhHeavenUI/Classes/GameDiscMounter.cs +++ /dev/null @@ -1,282 +0,0 @@ -using Iros._7th.Workshop; -using System; -using System.Diagnostics; -using System.IO; -using System.Linq; -using System.Threading; - -namespace _7thHeaven.Code -{ - public class GameDiscMounter - { - private static readonly NLog.Logger Logger = NLog.LogManager.GetCurrentClassLogger(); - - MountDiscOption MountOption { get; set; } - - public GameDiscMounter(MountDiscOption mountingOption) - { - MountOption = mountingOption; - } - - /// - /// Mounts FF7DISC1.ISO in 'Resources' folder to virtual drive - /// - /// - /// This will force use WinCDEmu if OS does not support powershell mounting - /// - public bool MountVirtualGameDisc() - { - if(MountOption == MountDiscOption.DoNotMount) - { - return true; - } - - bool usePowerShell = MountOption == MountDiscOption.MountWithPowerShell; - - if (!OSHasBuiltInMountSupport()) - { - Logger.Info($"OS does not support PowerShell Mount-DiskImage... forcing option to mount with WinCDEmu ..."); - usePowerShell = false; - } - - try - { - string isoPath = Path.Combine(Sys._7HFolder, "Resources", "FF7DISC1.ISO"); - Logger.Info($"\tattempting to mount iso at {isoPath}"); - - if (!File.Exists(isoPath)) - { - return false; - } - - if (usePowerShell) - { - return MountWithPowershell(isoPath); - } - else - { - return MountWithWinCDEmu(isoPath); - } - } - catch (Exception e) - { - Logger.Error(e); - return false; - } - } - - /// - /// Unmounts FF7DISC1 - /// - /// - /// This assumes the iso image at Path.Combine(Sys._7HFolder, "Resources", "FF7DISC1.ISO") is the mounted iso. - /// ... this code does not handle unmounting other iso files. - /// - /// - public bool UnmountVirtualGameDisc() - { - if (MountOption == MountDiscOption.DoNotMount) - { - return true; - } - - bool usePowerShell = MountOption == MountDiscOption.MountWithPowerShell; - - if (!OSHasBuiltInMountSupport()) - { - usePowerShell = false; - } - - try - { - string isoPath = Path.Combine(Sys._7HFolder, "Resources", "FF7DISC1.ISO"); - - if (!File.Exists(isoPath)) - { - return false; - } - - if (usePowerShell) - { - UnmountWithPowershell(isoPath); - } - else - { - UnmountWithWinCDEmu(isoPath); - } - - return true; - } - catch (Exception e) - { - Logger.Error(e); - return false; - } - } - - /// - /// Invokes PowerShell command 'Mount-DiskImage' with given - /// - private bool MountWithPowershell(string isoPath) - { - try - { - if (!File.Exists(isoPath)) - { - return false; - } - - ProcessStartInfo startInfo = new ProcessStartInfo("PowerShell.exe") - { - CreateNoWindow = false, - UseShellExecute = true, - WindowStyle = ProcessWindowStyle.Hidden, - Arguments = $"Mount-DiskImage -ImagePath '{isoPath}'" - - }; - Process.Start(startInfo); - - return true; - } - catch (Exception e) - { - Logger.Error(e); - return false; - } - } - - /// - /// Invokes PowerShell command 'Dismount-DiskImage' for given - /// - private bool UnmountWithPowershell(string isoPath) - { - try - { - if (!File.Exists(isoPath)) - { - return false; - } - - ProcessStartInfo startInfo = new ProcessStartInfo("PowerShell.exe") - { - CreateNoWindow = false, - UseShellExecute = true, - WindowStyle = ProcessWindowStyle.Hidden, - Arguments = $"Dismount-DiskImage -ImagePath '{isoPath}'", - }; - Process.Start(startInfo); - - return true; - } - catch (Exception e) - { - Logger.Error(e); - return false; - } - } - - /// - /// Invokes PortableWinCDEmu.exe process with as argument to mount image - /// - /// true if succeeded; false otherwise - private bool MountWithWinCDEmu(string isoPath) - { - try - { - if (!File.Exists(isoPath)) - { - return false; - } - - InstallWinCDEmuDriver(); - RunWinCDEmuWithArguments($"\"{isoPath}\""); - - return true; - } - catch (Exception e) - { - Logger.Error(e); - return false; - } - } - - /// - /// Invokes PortableWinCDEmu.exe process with arguments '/unmount ' - /// - /// true if succeeded; false otherwise - private bool UnmountWithWinCDEmu(string isoPath) - { - try - { - if (!File.Exists(isoPath)) - { - return false; - } - - InstallWinCDEmuDriver(); - RunWinCDEmuWithArguments($"/unmount \"{isoPath}\""); - - return true; - } - catch (Exception e) - { - Logger.Error(e); - return false; - } - } - - /// - /// Invokes PortableWinCDEmu.exe process with argument '/install' to ensure the driver is installed - /// - /// - /// It is safe to run this command multiple times because the process will check if the driver is already installed - the output is 'The driver is already installed' - /// If the driver installs successfully then the output of the command is 'The operation completed successfully.' - /// - private void InstallWinCDEmuDriver() - { - RunWinCDEmuWithArguments("/install"); - } - - /// - /// Launches PortableWinCDEmu.exe with the given and waits for the process to exit (with timeout of ) - /// - private void RunWinCDEmuWithArguments(string arguments, int timeoutInSeconds = 10) - { - ProcessStartInfo startInfo = new ProcessStartInfo(Sys.PathToWinCDEmuExe, arguments) - { - WorkingDirectory = Path.GetDirectoryName(Sys.PathToWinCDEmuExe), - UseShellExecute = true, - CreateNoWindow = true, - WindowStyle = ProcessWindowStyle.Normal - }; - - using (Process winCd = Process.Start(startInfo)) - { - winCd.WaitForExit(timeoutInSeconds * 1000); - } - } - - - /// - /// Returns true if OS is Win 8+ which has built in ISO mounting - /// - internal static bool OSHasBuiltInMountSupport() - { - Version osVersion = Environment.OSVersion.Version; - if (osVersion.Major < 6) - { - return false; - } - else if (osVersion.Major == 6) - { - if (osVersion.Minor < 2) - { - return false; // on an OS below Win 8 - } - } - - return true; - } - - } -} diff --git a/SeventhHeavenUI/Classes/GameLauncher.cs b/SeventhHeavenUI/Classes/GameLauncher.cs index 08d4c237..9cd1f902 100644 --- a/SeventhHeavenUI/Classes/GameLauncher.cs +++ b/SeventhHeavenUI/Classes/GameLauncher.cs @@ -23,14 +23,6 @@ namespace SeventhHeaven.Classes { - public enum FF7Version - { - Unknown = -1, - Steam, - ReRelease, - Original98 - } - internal enum GraphicsRenderer { SoftwareRenderer = 0, @@ -65,7 +57,6 @@ public static GameLauncher Instance private Dictionary<_7thWrapperLib.ProgramInfo, Process> _sideLoadProcesses = new Dictionary<_7thWrapperLib.ProgramInfo, Process>(); private ControllerInterceptor _controllerInterceptor; - private GameDiscMounter DiscMounter; public delegate void OnProgressChanged(string message); public event OnProgressChanged ProgressChanged; @@ -91,7 +82,7 @@ public static GameLauncher Instance private static Process ff7Proc; - public static bool LaunchGame(bool varDump, bool debug, bool launchWithNoMods = false, bool LaunchWithNoValidation = false) + public static async Task LaunchGame(bool varDump, bool debug, bool launchWithNoMods = false, bool LaunchWithNoValidation = false) { MainWindowViewModel.SaveActiveProfile(); Sys.Save(); @@ -131,7 +122,7 @@ public static bool LaunchGame(bool varDump, bool debug, bool launchWithNoMods = Instance.RaiseProgressChanged(ResourceHelper.Get(StringKey.SystemDEPDisabledPleaseReboot), NLog.LogLevel.Info); } - catch (Exception e) + catch (Exception) { Instance.RaiseProgressChanged(ResourceHelper.Get(StringKey.SomethingWentWrongWhileDisablingDEP), NLog.LogLevel.Error); } @@ -187,36 +178,6 @@ public static bool LaunchGame(bool varDump, bool debug, bool launchWithNoMods = Instance.RaiseProgressChanged(ResourceHelper.Get(StringKey.ErrorCodeYarr), NLog.LogLevel.Error); Logger.Info(FileUtils.ListAllFiles(converter.InstallPath)); return false; - } - - Instance.RaiseProgressChanged(ResourceHelper.Get(StringKey.VerifyingGameIsNotInstalledInProtectedFolder)); - if (converter.IsGameLocatedInSystemFolders()) - { - string message = ResourceHelper.Get(StringKey.Ff7IsCurrentlyInstalledInASystemFolder); - var result = MessageDialogWindow.Show(message, ResourceHelper.Get(StringKey.CannotContinue), MessageBoxButton.YesNo, MessageBoxImage.Warning); - - if (result.Result == MessageBoxResult.No) - { - Instance.RaiseProgressChanged($"\t{ResourceHelper.Get(StringKey.CanNotContinueDueToFf7nstalledInProtectedFolder)}", NLog.LogLevel.Error); - return false; - } - - - // copy installation and update settings with new path - string newInstallationPath = @"C:\Games\Final Fantasy VII"; - Instance.RaiseProgressChanged($"\t{ResourceHelper.Get(StringKey.CopyingGameFilesTo)} {newInstallationPath}"); - bool didCopy = converter.CopyGame(newInstallationPath); - - if (!didCopy) - { - Instance.RaiseProgressChanged($"\t{ResourceHelper.Get(StringKey.FailedToCopyFf7To)} {newInstallationPath}. {ResourceHelper.Get(StringKey.Aborting)}", NLog.LogLevel.Error); - return false; - } - - // update settings with new path - Logger.Info($"\t{ResourceHelper.Get(StringKey.UpdatingPathsInSysSettings)}"); - Sys.Settings.SetPathsFromInstallationPath(newInstallationPath); - converter.InstallPath = newInstallationPath; } Instance.RaiseProgressChanged(ResourceHelper.Get(StringKey.CreatingMissingRequiredDirectories)); @@ -231,142 +192,71 @@ public static bool LaunchGame(bool varDump, bool debug, bool launchWithNoMods = Instance.RaiseProgressChanged(ResourceHelper.Get(StringKey.VerifyingEnglishGameFilesExist)); if (!converter.IsEnglishGameInstalled()) { - Instance.RaiseProgressChanged($"\t{string.Format(ResourceHelper.Get(StringKey.FoundLanguageInstalledCreatingEnglishGameFiles), converter.GetInstalledLanguage())}"); - converter.ConvertToEnglishInstall(); - } - - Instance.RaiseProgressChanged(ResourceHelper.Get(StringKey.VerifyingGameIsMaxInstall)); - if (!converter.VerifyFullInstallation()) - { - Instance.RaiseProgressChanged(ResourceHelper.Get(StringKey.YourFf7InstallationFolderIsMissingCriticalFiles), NLog.LogLevel.Error); + Instance.RaiseProgressChanged(ResourceHelper.Get(StringKey.ErrorOnlyEnglishLanguageSupported), NLog.LogLevel.Error); return false; } - Instance.RaiseProgressChanged(ResourceHelper.Get(StringKey.VerifyingAdditionalFilesForBattleAndKernelFoldersExist)); - if (!converter.VerifyAdditionalFilesExist()) + if (Sys.Settings.FF7InstalledVersion == FF7Version.Original98) { - Instance.RaiseProgressChanged(ResourceHelper.Get(StringKey.FailedToVerifyCopyMissingAdditionalFiles), NLog.LogLevel.Error); - return false; - } - - converter.CopyMovieFilesToFolder(Sys.PathToFF7Movies); - - Instance.RaiseProgressChanged(ResourceHelper.Get(StringKey.VerifyingAllMovieFilesExist)); - if (!GameConverter.AllMovieFilesExist(Sys.PathToFF7Movies)) - { - Instance.RaiseProgressChanged($"\t{ResourceHelper.Get(StringKey.CouldNotFindAllMovieFilesAt)} {Sys.PathToFF7Movies}", NLog.LogLevel.Warn); - - Instance.RaiseProgressChanged($"\t{ResourceHelper.Get(StringKey.AttemptingToCopyMovieFiles)}"); - - if (!converter.CopyMovieFilesToFolder(Sys.PathToFF7Movies)) + Instance.RaiseProgressChanged(ResourceHelper.Get(StringKey.VerifyingGameIsMaxInstall)); + if (!converter.VerifyFullInstallation()) { - // skip warning if an active mod contains movie files - bool activeModsHasMovies = Sys.ActiveProfile.ActiveItems.Any(a => Sys.Library.GetItem(a.ModID).CachedDetails.ContainsMovies); - - string title = ResourceHelper.Get(StringKey.MovieFilesAreMissing); - string message = ResourceHelper.Get(StringKey.InOrderToSeeInGameMoviesYouWillNeedMessage); - if (!Sys.Settings.GameLaunchSettings.HasDisplayedMovieWarning && !activeModsHasMovies) - { - Sys.Settings.GameLaunchSettings.HasDisplayedMovieWarning = true; - MessageDialogWindow.Show(message, title, MessageBoxButton.OK, MessageBoxImage.Warning); - } - - if (!activeModsHasMovies) - { - Instance.RaiseProgressChanged(title, NLog.LogLevel.Warn); - Instance.RaiseProgressChanged(message, NLog.LogLevel.Warn); - } - + Instance.RaiseProgressChanged(ResourceHelper.Get(StringKey.YourFf7InstallationFolderIsMissingCriticalFiles), NLog.LogLevel.Error); + return false; } } Instance.RaiseProgressChanged(ResourceHelper.Get(StringKey.VerifyingMusicFilesExist)); - if (!converter.AllMusicFilesExist()) - { - Instance.RaiseProgressChanged($"\t{ResourceHelper.Get(StringKey.CouldNotFindAllMusicFilesAt)} {Path.Combine(converter.InstallPath, "music", "vgmstream")}", NLog.LogLevel.Warn); + converter.AllMusicFilesExist(); - Instance.RaiseProgressChanged($"\t{ResourceHelper.Get(StringKey.AttemptingToCopyMusicFiles)}"); - converter.CopyMusicFiles(); + string backupFolderPath = Path.Combine(converter.InstallPath, GameConverter.BackupFolderName, DateTime.Now.ToString("yyyyMMddHHmmss")); - if (!converter.AllMusicFilesExist()) + if (Sys.Settings.FF7InstalledVersion == FF7Version.Original98) + { + Instance.RaiseProgressChanged(ResourceHelper.Get(StringKey.VerifyingFf7Exe)); + if (new FileInfo(Sys.Settings.FF7Exe).Name.Equals("ff7.exe", StringComparison.InvariantCultureIgnoreCase)) { - // skip warning if an active mod contains music files - bool activeModsHasMusic = Sys.ActiveProfile.ActiveItems.Any(a => Sys.Library.GetItem(a.ModID).CachedDetails.ContainsMusic); - - string title = ResourceHelper.Get(StringKey.OggMusicFilesAreMissing); - string message = ResourceHelper.Get(StringKey.InOrderToHearHighQualityMusicYouWillNeedMessage); - if (!Sys.Settings.GameLaunchSettings.HasDisplayedOggMusicWarning && !activeModsHasMusic) + // only compare exes are different if ff7.exe set in Settings (and not something like ff7_bc.exe) + if (converter.IsExeDifferent()) { - Sys.Settings.GameLaunchSettings.HasDisplayedOggMusicWarning = true; - MessageDialogWindow.Show(message, title, MessageBoxButton.OK, MessageBoxImage.Warning); - } - - if (!activeModsHasMusic) - { - Instance.RaiseProgressChanged(title, NLog.LogLevel.Warn); - Instance.RaiseProgressChanged(message, NLog.LogLevel.Warn); + Instance.RaiseProgressChanged($"\t{ResourceHelper.Get(StringKey.Ff7ExeDetectedToBeDifferent)}"); + if (converter.BackupExe(backupFolderPath)) + { + bool didCopy = converter.CopyFF7ExeToGame(); + if (!didCopy) + { + Instance.RaiseProgressChanged($"\t{ResourceHelper.Get(StringKey.FailedToCopyFf7Exe)}", NLog.LogLevel.Error); + return false; + } + } + else + { + Instance.RaiseProgressChanged($"\t{ResourceHelper.Get(StringKey.FailedToCreateBackupOfFf7Exe)}", NLog.LogLevel.Error); + return false; + } } - } - } - string backupFolderPath = Path.Combine(converter.InstallPath, GameConverter.BackupFolderName, DateTime.Now.ToString("yyyyMMddHHmmss")); - - - converter.CheckAndCopyOldGameConverterFiles(backupFolderPath); - - - Instance.RaiseProgressChanged(ResourceHelper.Get(StringKey.VerifyingLatestGameDriverIsInstalled)); - if (!converter.InstallLatestGameDriver(backupFolderPath)) - { - Instance.RaiseProgressChanged(ResourceHelper.Get(StringKey.SomethingWentWrongTryingToDetectGameDriver), NLog.LogLevel.Error); - return false; - } - Instance.RaiseProgressChanged(ResourceHelper.Get(StringKey.VerifyingGameDriverShadersFoldersExist)); - - Instance.RaiseProgressChanged(ResourceHelper.Get(StringKey.VerifyingFf7Exe)); - if (new FileInfo(Sys.Settings.FF7Exe).Name.Equals("ff7.exe", StringComparison.InvariantCultureIgnoreCase)) - { - // only compare exes are different if ff7.exe set in Settings (and not something like ff7_bc.exe) - if (converter.IsExeDifferent()) + if (converter.IsConfigExeDifferent()) { - Instance.RaiseProgressChanged($"\t{ResourceHelper.Get(StringKey.Ff7ExeDetectedToBeDifferent)}"); - if (converter.BackupExe(backupFolderPath)) + Instance.RaiseProgressChanged($"\t{ResourceHelper.Get(StringKey.Ff7ConfigExeDetectedToBeMissingOrDifferent)}"); + if (converter.BackupFF7ConfigExe(backupFolderPath)) { - bool didCopy = converter.CopyFF7ExeToGame(); + bool didCopy = converter.CopyFF7ConfigExeToGame(); if (!didCopy) { - Instance.RaiseProgressChanged($"\t{ResourceHelper.Get(StringKey.FailedToCopyFf7Exe)}", NLog.LogLevel.Error); + Instance.RaiseProgressChanged($"\t{ResourceHelper.Get(StringKey.FailedToCopyFf7ConfigExe)}", NLog.LogLevel.Error); return false; } } else { - Instance.RaiseProgressChanged($"\t{ResourceHelper.Get(StringKey.FailedToCreateBackupOfFf7Exe)}", NLog.LogLevel.Error); + Instance.RaiseProgressChanged($"\t{ResourceHelper.Get(StringKey.FailedToCreateBackupOfFf7ConfigExe)}", NLog.LogLevel.Error); return false; } } } - if (converter.IsConfigExeDifferent()) - { - Instance.RaiseProgressChanged($"\t{ResourceHelper.Get(StringKey.Ff7ConfigExeDetectedToBeMissingOrDifferent)}"); - if (converter.BackupFF7ConfigExe(backupFolderPath)) - { - bool didCopy = converter.CopyFF7ConfigExeToGame(); - if (!didCopy) - { - Instance.RaiseProgressChanged($"\t{ResourceHelper.Get(StringKey.FailedToCopyFf7ConfigExe)}", NLog.LogLevel.Error); - return false; - } - } - else - { - Instance.RaiseProgressChanged($"\t{ResourceHelper.Get(StringKey.FailedToCreateBackupOfFf7ConfigExe)}", NLog.LogLevel.Error); - return false; - } - } - // // GAME SHOULD BE FULLY 'CONVERTED' AND READY TO LAUNCH FOR MODS AT THIS POINT // @@ -399,74 +289,6 @@ public static bool LaunchGame(bool varDump, bool debug, bool launchWithNoMods = return false; } - - // - // Get Drive Letter and auto mount if needed - // - Instance.DidMountVirtualDisc = false; - - Instance.RaiseProgressChanged(ResourceHelper.Get(StringKey.LookingForGameDisc)); - Instance.DriveLetter = GetDriveLetter(); - - if (!string.IsNullOrEmpty(Instance.DriveLetter)) - { - Instance.RaiseProgressChanged($"{ResourceHelper.Get(StringKey.FoundGameDiscAt)} {Instance.DriveLetter} ..."); - } - else - { - Instance.RaiseProgressChanged(ResourceHelper.Get(StringKey.FailedToFindGameDisc), NLog.LogLevel.Warn); - - if (!Sys.Settings.GameLaunchSettings.AutoMountGameDisc) - { - return false; // game disc not found and user is not trying to auto mount the disc so exit as failure - } - - Instance.RaiseProgressChanged(ResourceHelper.Get(StringKey.AutoMountingVirtualGameDisc)); - - - Instance.DiscMounter = new GameDiscMounter(Sys.Settings.GameLaunchSettings.MountingOption); - bool didMount = Instance.DiscMounter.MountVirtualGameDisc(); - - if (!didMount) - { - Instance.RaiseProgressChanged($"{ResourceHelper.Get(StringKey.FailedToAutoMountVirtualDiscAt)} {Path.Combine(Sys._7HFolder, "Resources")} ...", NLog.LogLevel.Error); - return false; - } - - Instance.DidMountVirtualDisc = true; - Instance.RaiseProgressChanged(ResourceHelper.Get(StringKey.LookingForGameDiscAfterMounting)); - - // when mounting with WinCDEmu it can take a few seconds (anywhere from 1 to 3 seconds from my experience) so add a fallback here to try mounting multiple times instead of once - int maxMountAttempts = 15; - int currentAttempt = 0; - - do - { - Instance.DriveLetter = GetDriveLetter(); - currentAttempt++; - - if (string.IsNullOrEmpty(Instance.DriveLetter)) - { - System.Threading.Thread.Sleep(1000); // sleep for a second before looking for the drive letter again - } - - } while (string.IsNullOrEmpty(Instance.DriveLetter) && currentAttempt < maxMountAttempts); - - - if (string.IsNullOrEmpty(Instance.DriveLetter)) - { - Instance.RaiseProgressChanged(ResourceHelper.Get(StringKey.FailedToFindGameDiscAfterAutoMounting), NLog.LogLevel.Error); - return false; - } - - Instance.RaiseProgressChanged($"{ResourceHelper.Get(StringKey.FoundGameDiscAt)} {Instance.DriveLetter} ..."); - } - - // - // Update Registry with new launch settings - // - Instance.SetRegistryValues(); - // // Copy input.cfg to FF7 // @@ -507,7 +329,6 @@ public static bool LaunchGame(bool varDump, bool debug, bool launchWithNoMods = return false; } - // // Copy 7thWrapper* dlls to FF7 // @@ -606,7 +427,7 @@ public static bool LaunchGame(bool varDump, bool debug, bool launchWithNoMods = Instance._controllerInterceptor = new ControllerInterceptor(); } - Instance._controllerInterceptor.PollForGamepadInput().ContinueWith((result) => + await Instance._controllerInterceptor.PollForGamepadInput().ContinueWith((result) => { if (result.IsFaulted) { @@ -624,11 +445,11 @@ public static bool LaunchGame(bool varDump, bool debug, bool launchWithNoMods = if (runAsVanilla) { Instance.RaiseProgressChanged(vanillaMsg); - LaunchFF7Exe(); + await LaunchFF7Exe(); if (didDisableReunion) { - Task.Factory.StartNew(() => + await Task.Factory.StartNew(() => { System.Threading.Thread.Sleep(5000); // wait 5 seconds before renaming the dll so the game and gl driver can fully initialize Instance.RaiseProgressChanged(ResourceHelper.Get(StringKey.ReenablingReunionMod)); @@ -667,7 +488,7 @@ public static bool LaunchGame(bool varDump, bool debug, bool launchWithNoMods = { try { - LaunchFF7Exe(); + await LaunchFF7Exe(); didInject = true; } catch (Exception e) @@ -780,16 +601,6 @@ public static bool LaunchGame(bool varDump, bool debug, bool launchWithNoMods = Instance.RaiseProgressChanged(ResourceHelper.Get(StringKey.StoppingOtherProgramsForMods)); Instance.StopAllSideProcessesForMods(); - if (Sys.Settings.GameLaunchSettings.AutoUnmountGameDisc && Instance.DidMountVirtualDisc) - { - Instance.RaiseProgressChanged(ResourceHelper.Get(StringKey.AutoUnmountingGameDisc)); - if (Instance.DiscMounter != null) - { - Instance.DiscMounter.UnmountVirtualGameDisc(); - } - Instance.DiscMounter = null; - } - // ensure Reunion is re-enabled when ff7 process exits in case it failed above for any reason if (File.Exists(Path.Combine(Path.GetDirectoryName(Sys.Settings.FF7Exe), "Reunion.dll.bak"))) { @@ -945,9 +756,15 @@ private static void Copy7thWrapperDlls() File.Copy(Path.Combine(src, "7thWrapperLib.dll"), Path.Combine(dest, "7thWrapperLib.dll"), true); File.Copy(Path.Combine(src, "7thWrapperLoader.dll"), Path.Combine(dest, "dinput.dll"), true); File.Copy(Path.Combine(src, "7thWrapperLoader.pdb"), Path.Combine(dest, "7thWrapperLoader.pdb"), true); + + if (Sys.Settings.FF7InstalledVersion == FF7Version.Steam) + { + File.Move(Path.Combine(dest, "FF7_Launcher.exe"), Path.Combine(dest, "_FF7_Launcher.exe")); + File.Copy(Path.Combine(src, "FF7_Launcher.exe"), Path.Combine(dest, "FF7_Launcher.exe")); + } } - private static void Delete7thWrapperDlls() + private static async void Delete7thWrapperDlls() { string dest = Path.GetDirectoryName(Sys.Settings.FF7Exe); @@ -960,6 +777,13 @@ private static void Delete7thWrapperDlls() File.Delete(Path.Combine(dest, "7thWrapperLib.dll")); File.Delete(Path.Combine(dest, "dinput.dll")); File.Delete(Path.Combine(dest, "7thWrapperLoader.pdb")); + + if (Sys.Settings.FF7InstalledVersion == FF7Version.Steam) + { + await waitForProcessExit("FF7_Launcher"); + File.Delete(Path.Combine(dest, "FF7_Launcher.exe")); + File.Move(Path.Combine(dest, "_FF7_Launcher.exe"), Path.Combine(dest, "FF7_Launcher.exe")); + } } private static void StartTurboLogForVariableDump(RuntimeProfile runtimeProfiles) @@ -990,20 +814,74 @@ private static void StartTurboLogForVariableDump(RuntimeProfile runtimeProfiles) aproc.Exited += (o, e) => Instance._alsoLaunchProcesses.Remove(turboLogProcName); } + internal static async Task waitForProcess(string name) + { + Process ret = null; + + do + { + if (Process.GetProcessesByName(name) is [{ HasExited: false } process, ..]) + ret = process; + else + await Task.Delay(5000); + } while (ret == null); + + return ret; + } + + internal static async Task waitForProcessExit(string name) + { + Process ret; + do + { + if (Process.GetProcessesByName(name) is [{ HasExited: true } process, ..]) + { + ret = process; + await Task.Delay(5000); + } + else + ret = null; + } while (ret != null); + + return true; + } /// /// Launches FF7.exe without loading any mods. /// - internal static bool LaunchFF7Exe() + internal static async Task LaunchFF7Exe() { try { - ProcessStartInfo startInfo = new ProcessStartInfo(Sys.Settings.FF7Exe) + if (Sys.Settings.FF7InstalledVersion == FF7Version.Steam) + { + // Start game via Steam + ProcessStartInfo startInfo = new ProcessStartInfo(GameConverter.GetSteamExePath()) + { + WorkingDirectory = GameConverter.GetSteamPath(), + UseShellExecute = true, + Arguments = "-applaunch 39140" + }; + Process.Start(startInfo); + + // Wait for game process + Process game = await waitForProcess(Path.GetFileNameWithoutExtension(Sys.Settings.FF7Exe)); + if (game != null) + { + ff7Proc = game; + } + } + else { - WorkingDirectory = Path.GetDirectoryName(Sys.Settings.FF7Exe), - UseShellExecute = true, - }; - ff7Proc = Process.Start(startInfo); + // Start game directly + ProcessStartInfo startInfo = new ProcessStartInfo(Sys.Settings.FF7Exe) + { + WorkingDirectory = Path.GetDirectoryName(Sys.Settings.FF7Exe), + UseShellExecute = true, + }; + ff7Proc = Process.Start(startInfo); + } + ff7Proc.EnableRaisingEvents = true; ff7Proc.Exited += (o, e) => { @@ -1015,13 +893,6 @@ internal static bool LaunchFF7Exe() Instance._controllerInterceptor.PollingInput = false; } - if (Sys.Settings.GameLaunchSettings.AutoUnmountGameDisc && Instance.DidMountVirtualDisc) - { - Instance.RaiseProgressChanged(ResourceHelper.Get(StringKey.AutoUnmountingGameDisc)); - Instance.DiscMounter.UnmountVirtualGameDisc(); - Instance.DiscMounter = null; - } - // ensure Reunion is re-enabled when ff7 process exits in case it failed above for any reason if (File.Exists(Path.Combine(Path.GetDirectoryName(Sys.Settings.FF7Exe), "Reunion.dll.bak"))) { @@ -1591,7 +1462,10 @@ public static bool CopyKeyboardInputCfg() try { - string targetPath = Path.Combine(Path.GetDirectoryName(Sys.Settings.FF7Exe), "ff7input.cfg"); + string targetPath = Path.Combine( + Sys.Settings.FF7InstalledVersion == FF7Version.Steam ? GameConverter.GetSteamFF7UserPath() : Path.GetDirectoryName(Sys.Settings.FF7Exe), + "ff7input.cfg" + ); Instance.RaiseProgressChanged($"\t{ResourceHelper.Get(StringKey.Copying)} {pathToCfg} -> {targetPath} ..."); File.Copy(pathToCfg, targetPath, true); @@ -1679,13 +1553,24 @@ private void CollectCrashReport() using (var archive = ZipArchive.Create()) { // === FF7 files === - var savePath = Path.Combine(Sys.InstallPath, "save"); - if (Directory.Exists(savePath)) + if (Sys.Settings.FF7InstalledVersion == FF7Version.Steam) { - var saveFiles = Directory.GetFiles(savePath); - foreach (var file in saveFiles) + var di = new DirectoryInfo(GameConverter.GetSteamFF7UserPath()); + foreach (FileInfo fi in di.GetFiles("*.ff7", SearchOption.AllDirectories)) { - archive.AddEntry(Path.Combine("save", Path.GetFileName(file)), file); + archive.AddEntry(Path.Combine("save", Path.GetFileName(fi.FullName)), fi.FullName); + } + } + else + { + var savePath = Path.Combine(Sys.InstallPath, "save"); + if (Directory.Exists(savePath)) + { + var saveFiles = Directory.GetFiles(savePath); + foreach (var file in saveFiles) + { + archive.AddEntry(Path.Combine("save", Path.GetFileName(file)), file); + } } } @@ -1697,7 +1582,10 @@ private void CollectCrashReport() archive.AddEntry("7thWrapperLoader.log", Path.Combine(Sys.InstallPath, "7thWrapperLoader.log")); archive.AddEntry("applog.txt", File.Open(Sys.PathToApplog, FileMode.Open, FileAccess.Read, FileShare.ReadWrite)); archive.AddEntry("settings.xml", Sys.PathToSettings); - archive.AddEntry("registry_transaction.bat", Path.Combine(Sys.PathToTempFolder, "registry_transaction.bat")); + + string rt = Path.Combine(Sys.PathToTempFolder, "registry_transaction.bat"); + if (File.Exists(rt)) archive.AddEntry(Path.GetFileName(rt), rt); + // Convert profile.xml to profile.txt Profile currentProfile = Util.Deserialize(Sys.PathToCurrentProfileFile); IEnumerable profileDetails = currentProfile.GetDetails(); diff --git a/SeventhHeavenUI/Resources/FF7DISC1.ISO b/SeventhHeavenUI/Resources/FF7DISC1.ISO deleted file mode 100644 index 7b3b2a17..00000000 Binary files a/SeventhHeavenUI/Resources/FF7DISC1.ISO and /dev/null differ diff --git a/SeventhHeavenUI/Resources/Languages/StringResources.br.xaml b/SeventhHeavenUI/Resources/Languages/StringResources.br.xaml index 4d5ed39b..004ae3c7 100644 --- a/SeventhHeavenUI/Resources/Languages/StringResources.br.xaml +++ b/SeventhHeavenUI/Resources/Languages/StringResources.br.xaml @@ -1229,6 +1229,7 @@ Você quer aplicar essa configuração e tentar de novo? Verificando se arquivos de jogo em Inglês existem ... Linguagem instalada encontrada: {0} Criando arquivos de jogo em Inglês... + ERROR: Only English language is supported. Consider installing FF7 in English (US) on Steam. Extraindo arquivos .lgp ... Renomeando arquivos específos á linguagem ... Não foi possível encontrar arquivo para renomear: {0} ... diff --git a/SeventhHeavenUI/Resources/Languages/StringResources.de.xaml b/SeventhHeavenUI/Resources/Languages/StringResources.de.xaml index 30871e91..c23771f8 100644 --- a/SeventhHeavenUI/Resources/Languages/StringResources.de.xaml +++ b/SeventhHeavenUI/Resources/Languages/StringResources.de.xaml @@ -1237,6 +1237,7 @@ Möchten Sie die Einstellung übernehmen und es erneut versuchen? Prüfe, ob die englischen Spieldateien vorhanden sind... Installierte Sprachdateien gefunden in: {0}. Erstelle englische Spieldateien... + ERROR: Only English language is supported. Consider installing FF7 in English (US) on Steam. Entpacke .lgp-Dateien... Bennene sprachbezogene Dateien um... Datei zum Umbenennen konnte nicht gefunden werden: {0}... diff --git a/SeventhHeavenUI/Resources/Languages/StringResources.es.xaml b/SeventhHeavenUI/Resources/Languages/StringResources.es.xaml index 659f9d4a..6d5f99a3 100644 --- a/SeventhHeavenUI/Resources/Languages/StringResources.es.xaml +++ b/SeventhHeavenUI/Resources/Languages/StringResources.es.xaml @@ -1238,6 +1238,7 @@ Por último, si quieres usar archivos .OGG de alta calidad, cambia la opción de Verificando que existen los archivos del juego Inglés ... Encontrado idioma instalado: {0} Generando los archivos del juego Inglés... + ERROR: Only English language is supported. Consider installing FF7 in English (US) on Steam. Extrayendo los archivos .lgp ... Renombrando los archivos específicos del idioma ... No se ha encontrado el archivo para renombrar: {0} ... diff --git a/SeventhHeavenUI/Resources/Languages/StringResources.fr.xaml b/SeventhHeavenUI/Resources/Languages/StringResources.fr.xaml index 20734982..737b226d 100644 --- a/SeventhHeavenUI/Resources/Languages/StringResources.fr.xaml +++ b/SeventhHeavenUI/Resources/Languages/StringResources.fr.xaml @@ -1224,6 +1224,7 @@ Voulez-vous appliquer ce réglage et essayer à nouveau ? Vérification que les fichiers de la version anglaise du jeu existent... Fichiers d'une autre langue trouvés: {0} Création des fichiers anglais... + ERROR: Only English language is supported. Consider installing FF7 in English (US) on Steam. Extraction des fichiers .lgp... Renommage des fichiers spécifiques à la langue... Impossible de trouver le fichier a renommer: {0} ... diff --git a/SeventhHeavenUI/Resources/Languages/StringResources.gr.xaml b/SeventhHeavenUI/Resources/Languages/StringResources.gr.xaml index 0643e8c1..b99963ba 100644 --- a/SeventhHeavenUI/Resources/Languages/StringResources.gr.xaml +++ b/SeventhHeavenUI/Resources/Languages/StringResources.gr.xaml @@ -1232,6 +1232,7 @@ Υπάρχει επαλήθευση αρχείων αγγλικών παιχνιδιών ... Εγκατεστημένη γλώσσα που βρέθηκε: {0} Δημιουργία αγγλικών αρχείων παιχνιδιών ... + ERROR: Only English language is supported. Consider installing FF7 in English (US) on Steam. Εξαγωγή αρχείων .lgp ... Μετονομασία αρχείων ειδικά για τη γλώσσα ... Δεν ήταν δυνατή η εύρεση αρχείου για μετονομασία: {0} ... diff --git a/SeventhHeavenUI/Resources/Languages/StringResources.it.xaml b/SeventhHeavenUI/Resources/Languages/StringResources.it.xaml index cd104472..3f0881e1 100644 --- a/SeventhHeavenUI/Resources/Languages/StringResources.it.xaml +++ b/SeventhHeavenUI/Resources/Languages/StringResources.it.xaml @@ -1228,6 +1228,7 @@ Vuoi applicare questa modifica e riprovare? Verifico l'esistenza dei file di gioco in Inglese... Trovata versione in lingua: {0} Creo i file di gioco in Inglese... + ERROR: Only English language is supported. Consider installing FF7 in English (US) on Steam. Estraggo i file .lgp ... Rinomino i file specifici della lingua ... Impossibile trovare il file da rinominare: {0} ... diff --git a/SeventhHeavenUI/Resources/StringResources.xaml b/SeventhHeavenUI/Resources/StringResources.xaml index c4ac1594..0cc2a40d 100644 --- a/SeventhHeavenUI/Resources/StringResources.xaml +++ b/SeventhHeavenUI/Resources/StringResources.xaml @@ -1237,6 +1237,7 @@ Do you want to apply the setting and try again? Verifying English game files exist ... Found language installed: {0} Creating English game files... + ERROR: Only English language is supported. Consider installing FF7 in English (US) on Steam. Extracting .lgp files ... Renaming language specific files ... Could not find file to rename: {0} ... diff --git a/SeventhHeavenUI/Resources/WinCDEmu/LICENSE.txt b/SeventhHeavenUI/Resources/WinCDEmu/LICENSE.txt deleted file mode 100644 index 0a041280..00000000 --- a/SeventhHeavenUI/Resources/WinCDEmu/LICENSE.txt +++ /dev/null @@ -1,165 +0,0 @@ - GNU LESSER GENERAL PUBLIC LICENSE - Version 3, 29 June 2007 - - Copyright (C) 2007 Free Software Foundation, Inc. - Everyone is permitted to copy and distribute verbatim copies - of this license document, but changing it is not allowed. - - - This version of the GNU Lesser General Public License incorporates -the terms and conditions of version 3 of the GNU General Public -License, supplemented by the additional permissions listed below. - - 0. Additional Definitions. - - As used herein, "this License" refers to version 3 of the GNU Lesser -General Public License, and the "GNU GPL" refers to version 3 of the GNU -General Public License. - - "The Library" refers to a covered work governed by this License, -other than an Application or a Combined Work as defined below. - - An "Application" is any work that makes use of an interface provided -by the Library, but which is not otherwise based on the Library. -Defining a subclass of a class defined by the Library is deemed a mode -of using an interface provided by the Library. - - A "Combined Work" is a work produced by combining or linking an -Application with the Library. The particular version of the Library -with which the Combined Work was made is also called the "Linked -Version". - - The "Minimal Corresponding Source" for a Combined Work means the -Corresponding Source for the Combined Work, excluding any source code -for portions of the Combined Work that, considered in isolation, are -based on the Application, and not on the Linked Version. - - The "Corresponding Application Code" for a Combined Work means the -object code and/or source code for the Application, including any data -and utility programs needed for reproducing the Combined Work from the -Application, but excluding the System Libraries of the Combined Work. - - 1. Exception to Section 3 of the GNU GPL. - - You may convey a covered work under sections 3 and 4 of this License -without being bound by section 3 of the GNU GPL. - - 2. Conveying Modified Versions. - - If you modify a copy of the Library, and, in your modifications, a -facility refers to a function or data to be supplied by an Application -that uses the facility (other than as an argument passed when the -facility is invoked), then you may convey a copy of the modified -version: - - a) under this License, provided that you make a good faith effort to - ensure that, in the event an Application does not supply the - function or data, the facility still operates, and performs - whatever part of its purpose remains meaningful, or - - b) under the GNU GPL, with none of the additional permissions of - this License applicable to that copy. - - 3. Object Code Incorporating Material from Library Header Files. - - The object code form of an Application may incorporate material from -a header file that is part of the Library. You may convey such object -code under terms of your choice, provided that, if the incorporated -material is not limited to numerical parameters, data structure -layouts and accessors, or small macros, inline functions and templates -(ten or fewer lines in length), you do both of the following: - - a) Give prominent notice with each copy of the object code that the - Library is used in it and that the Library and its use are - covered by this License. - - b) Accompany the object code with a copy of the GNU GPL and this license - document. - - 4. Combined Works. - - You may convey a Combined Work under terms of your choice that, -taken together, effectively do not restrict modification of the -portions of the Library contained in the Combined Work and reverse -engineering for debugging such modifications, if you also do each of -the following: - - a) Give prominent notice with each copy of the Combined Work that - the Library is used in it and that the Library and its use are - covered by this License. - - b) Accompany the Combined Work with a copy of the GNU GPL and this license - document. - - c) For a Combined Work that displays copyright notices during - execution, include the copyright notice for the Library among - these notices, as well as a reference directing the user to the - copies of the GNU GPL and this license document. - - d) Do one of the following: - - 0) Convey the Minimal Corresponding Source under the terms of this - License, and the Corresponding Application Code in a form - suitable for, and under terms that permit, the user to - recombine or relink the Application with a modified version of - the Linked Version to produce a modified Combined Work, in the - manner specified by section 6 of the GNU GPL for conveying - Corresponding Source. - - 1) Use a suitable shared library mechanism for linking with the - Library. A suitable mechanism is one that (a) uses at run time - a copy of the Library already present on the user's computer - system, and (b) will operate properly with a modified version - of the Library that is interface-compatible with the Linked - Version. - - e) Provide Installation Information, but only if you would otherwise - be required to provide such information under section 6 of the - GNU GPL, and only to the extent that such information is - necessary to install and execute a modified version of the - Combined Work produced by recombining or relinking the - Application with a modified version of the Linked Version. (If - you use option 4d0, the Installation Information must accompany - the Minimal Corresponding Source and Corresponding Application - Code. If you use option 4d1, you must provide the Installation - Information in the manner specified by section 6 of the GNU GPL - for conveying Corresponding Source.) - - 5. Combined Libraries. - - You may place library facilities that are a work based on the -Library side by side in a single library together with other library -facilities that are not Applications and are not covered by this -License, and convey such a combined library under terms of your -choice, if you do both of the following: - - a) Accompany the combined library with a copy of the same work based - on the Library, uncombined with any other library facilities, - conveyed under the terms of this License. - - b) Give prominent notice with the combined library that part of it - is a work based on the Library, and explaining where to find the - accompanying uncombined form of the same work. - - 6. Revised Versions of the GNU Lesser General Public License. - - The Free Software Foundation may publish revised and/or new versions -of the GNU Lesser General Public License from time to time. Such new -versions will be similar in spirit to the present version, but may -differ in detail to address new problems or concerns. - - Each version is given a distinguishing version number. If the -Library as you received it specifies that a certain numbered version -of the GNU Lesser General Public License "or any later version" -applies to it, you have the option of following the terms and -conditions either of that published version or of any later version -published by the Free Software Foundation. If the Library as you -received it does not specify a version number of the GNU Lesser -General Public License, you may choose any version of the GNU Lesser -General Public License ever published by the Free Software Foundation. - - If the Library as you received it specifies that a proxy can decide -whether future versions of the GNU Lesser General Public License shall -apply, that proxy's public statement of acceptance of any version is -permanent authorization for you to choose that version for the -Library. diff --git a/SeventhHeavenUI/Resources/WinCDEmu/PortableWinCDEmu.exe b/SeventhHeavenUI/Resources/WinCDEmu/PortableWinCDEmu.exe deleted file mode 100644 index 850dd7c0..00000000 Binary files a/SeventhHeavenUI/Resources/WinCDEmu/PortableWinCDEmu.exe and /dev/null differ diff --git a/SeventhHeavenUI/SeventhHeavenUI.csproj b/SeventhHeavenUI/SeventhHeavenUI.csproj index 20ad07e6..25635ec3 100644 --- a/SeventhHeavenUI/SeventhHeavenUI.csproj +++ b/SeventhHeavenUI/SeventhHeavenUI.csproj @@ -159,9 +159,6 @@ PreserveNewest - - PreserveNewest - Always @@ -574,12 +571,6 @@ PreserveNewest - - PreserveNewest - - - PreserveNewest - @@ -628,6 +619,7 @@ 4.2.0 + 2.2.3 diff --git a/SeventhHeavenUI/ViewModels/ControlMappingViewModel.cs b/SeventhHeavenUI/ViewModels/ControlMappingViewModel.cs index 88d3ecf7..255ea986 100644 --- a/SeventhHeavenUI/ViewModels/ControlMappingViewModel.cs +++ b/SeventhHeavenUI/ViewModels/ControlMappingViewModel.cs @@ -1253,7 +1253,10 @@ internal void DeleteSelectedCustomControl() public bool CopyInputCfgToCustomCfg(bool forceCopy, string customFileName) { string pathToCustomCfg = Path.Combine(Sys.PathToControlsFolder, customFileName); - string pathToInputCfg = Path.Combine(Path.GetDirectoryName(Sys.Settings.FF7Exe), "ff7input.cfg"); + string pathToInputCfg = Path.Combine( + Sys.Settings.FF7InstalledVersion == FF7Version.Steam ? GameConverter.GetSteamFF7UserPath() : Path.GetDirectoryName(Sys.Settings.FF7Exe), + "ff7input.cfg" + ); Directory.CreateDirectory(Sys.PathToControlsFolder); diff --git a/SeventhHeavenUI/ViewModels/GameLaunchSettingsViewModel.cs b/SeventhHeavenUI/ViewModels/GameLaunchSettingsViewModel.cs index 08ac7a2e..05652a1b 100644 --- a/SeventhHeavenUI/ViewModels/GameLaunchSettingsViewModel.cs +++ b/SeventhHeavenUI/ViewModels/GameLaunchSettingsViewModel.cs @@ -17,6 +17,7 @@ using System.Text; using System.Threading.Tasks; using System.Windows; +using System.Runtime.InteropServices; namespace SeventhHeaven.ViewModels { @@ -41,10 +42,7 @@ class GameLaunchSettingsViewModel : ViewModelBase #region Data Members private static readonly NLog.Logger Logger = NLog.LogManager.GetCurrentClassLogger(); - private bool _autoMountChecked; - private bool _autoUnmountChecked; private bool _autoUpdatePathChecked; - private bool _isAutoMountSupported; private bool _isReverseSpeakersChecked; private bool _isLogVolumeChecked; private string _selectedSoundDevice; @@ -62,7 +60,6 @@ class GameLaunchSettingsViewModel : ViewModelBase private bool _isShowLauncherChecked; private VolumeSlider _lastVolumeSliderChanged; private bool _isSoundDevicesLoaded; - private string _selectedMountOption; private int _voiceVolumeValue; private int _ambientVolumeValue; @@ -102,45 +99,6 @@ public bool IsSoundDevicesLoaded } } - public bool IsAutoMountSupported - { - get - { - return _isAutoMountSupported; - } - set - { - _isAutoMountSupported = value; - NotifyPropertyChanged(); - } - } - - public bool AutoMountChecked - { - get - { - return _autoMountChecked; - } - set - { - _autoMountChecked = value; - NotifyPropertyChanged(); - } - } - - public bool AutoUnmountChecked - { - get - { - return _autoUnmountChecked; - } - set - { - _autoUnmountChecked = value; - NotifyPropertyChanged(); - } - } - public bool AutoUpdatePathChecked { get @@ -469,56 +427,6 @@ public VolumeSlider LastVolumeSliderChanged } } - /// - /// List of ways to mount disc (matches the order of enum ) - /// - public List MountOptions - { - get - { - // this list matches the order of the mountoption enum - List ret = new List(); - if (IsAutoMountSupported) - { - - ret.Add(ResourceHelper.Get(StringKey.MountDiscWithPowershell)); - } - - ret.Add(ResourceHelper.Get(StringKey.MountDiscWithWinCDEmu)); - ret.Add(ResourceHelper.Get(StringKey.DoNotMount)); - return ret; - } - } - - public string SelectedMountOption - { - get - { - return _selectedMountOption; - } - set - { - if (_selectedMountOption != value) - { - _selectedMountOption = value; - NotifyPropertyChanged(); - } - } - } - - public MountDiscOption SelectedMountOptionAsEnum - { - get - { - if (string.IsNullOrEmpty(SelectedMountOption)) - { - return MountDiscOption.Unknown; - } - - return (MountDiscOption) MountOptions.IndexOf(SelectedMountOption); - } - } - #endregion @@ -537,6 +445,8 @@ public GameLaunchSettingsViewModel() SelectedSoundDevice = ResourceHelper.Get(StringKey.LoadingDevices); InitSoundDevicesAsync(); + if (Sys.Settings.FF7InstalledVersion == FF7Version.Steam) Sys.FFNxConfig.Reload(); + InitMidiDevices(); LoadSettings(Sys.Settings.GameLaunchSettings); } @@ -567,21 +477,6 @@ private void LoadSettings(LaunchSettings launchSettings) AutoUpdatePathChecked = launchSettings.AutoUpdateDiscPath; IsShowLauncherChecked = launchSettings.ShowLauncherWindow; - - IsAutoMountSupported = GameDiscMounter.OSHasBuiltInMountSupport(); - AutoMountChecked = launchSettings.AutoMountGameDisc; - AutoUnmountChecked = launchSettings.AutoUnmountGameDisc; - - // options to select mount method is disabled if user OS does not support and forced to use wincdemu (i.e. does not support PowerShell Mount-DiskImage) - if (IsAutoMountSupported) - { - SelectedMountOption = MountOptions[(int)launchSettings.MountingOption]; - } - else - { - SelectedMountOption = MountOptions[(int)MountDiscOption.MountWithWinCDEmu]; - } - SetSelectedSoundDeviceFromSettings(launchSettings); SelectedMidiData = MidiDataFormats.Where(s => s.Value == launchSettings.SelectedMidiData) @@ -625,12 +520,32 @@ private void GetVolumesFromRegistry() string soundKeyPath = $"{ff7KeyPath}\\1.00\\Sound"; string ffnxKeyPath = $"{ff7KeyPath}\\1.00\\FFNx"; - SfxVolumeValue = (int) RegistryHelper.GetValue(soundKeyPath, "SFXVolume", 100); - MusicVolumeValue = (int)RegistryHelper.GetValue(midiKeyPath, "MusicVolume", 100); - - VoiceVolumeValue = (int)RegistryHelper.GetValue(ffnxKeyPath, "VoiceVolume", 100); - AmbientVolumeValue = (int)RegistryHelper.GetValue(ffnxKeyPath, "AmbientVolume", 100); - MovieVolumeValue = (int)RegistryHelper.GetValue(ffnxKeyPath, "MovieVolume", 100); + if (Sys.Settings.FF7InstalledVersion == FF7Version.Steam) + { + SfxVolumeValue = int.Parse(Sys.FFNxConfig.Get("external_sfx_volume")); + if (SfxVolumeValue < 0) SfxVolumeValue = 100; + + MusicVolumeValue = int.Parse(Sys.FFNxConfig.Get("external_music_volume")); + if (MusicVolumeValue < 0) MusicVolumeValue = 100; + + VoiceVolumeValue = int.Parse(Sys.FFNxConfig.Get("external_voice_volume")); + if (VoiceVolumeValue < 0) VoiceVolumeValue = 100; + + AmbientVolumeValue = int.Parse(Sys.FFNxConfig.Get("external_ambient_volume")); + if (AmbientVolumeValue < 0) AmbientVolumeValue = 100; + + MovieVolumeValue = int.Parse(Sys.FFNxConfig.Get("ffmpeg_video_volume")); + if (MovieVolumeValue < 0) MovieVolumeValue = 100; + } + else + { + SfxVolumeValue = (int)RegistryHelper.GetValue(soundKeyPath, "SFXVolume", 100); + MusicVolumeValue = (int)RegistryHelper.GetValue(midiKeyPath, "MusicVolume", 100); + VoiceVolumeValue = (int)RegistryHelper.GetValue(ffnxKeyPath, "VoiceVolume", 100); + AmbientVolumeValue = (int)RegistryHelper.GetValue(ffnxKeyPath, "AmbientVolume", 100); + MovieVolumeValue = (int)RegistryHelper.GetValue(ffnxKeyPath, "MovieVolume", 100); + } + } private void SetVolumesInRegistry() @@ -645,20 +560,31 @@ private void SetVolumesInRegistry() string soundVirtualKeyPath = $"{virtualStorePath}\\1.00\\Sound"; string ffnxVirtualKeyPath = $"{virtualStorePath}\\1.00\\FFNx"; - RegistryHelper.SetValueIfChanged(soundKeyPath, "SFXVolume", SfxVolumeValue, RegistryValueKind.DWord); - RegistryHelper.SetValueIfChanged(soundVirtualKeyPath, "SFXVolume", SfxVolumeValue, RegistryValueKind.DWord); + if (Sys.Settings.FF7InstalledVersion == FF7Version.Steam) + { + Sys.FFNxConfig.Set("external_sfx_volume", SfxVolumeValue.ToString()); + Sys.FFNxConfig.Set("external_music_volume", MusicVolumeValue.ToString()); + Sys.FFNxConfig.Set("external_voice_volume", VoiceVolumeValue.ToString()); + Sys.FFNxConfig.Set("external_ambient_volume", AmbientVolumeValue.ToString()); + Sys.FFNxConfig.Set("ffmpeg_video_volume", MovieVolumeValue.ToString()); + } + else + { + RegistryHelper.SetValueIfChanged(soundKeyPath, "SFXVolume", SfxVolumeValue, RegistryValueKind.DWord); + RegistryHelper.SetValueIfChanged(soundVirtualKeyPath, "SFXVolume", SfxVolumeValue, RegistryValueKind.DWord); - RegistryHelper.SetValueIfChanged(midiKeyPath, "MusicVolume", MusicVolumeValue, RegistryValueKind.DWord); - RegistryHelper.SetValueIfChanged(midiVirtualKeyPath, "MusicVolume", MusicVolumeValue, RegistryValueKind.DWord); + RegistryHelper.SetValueIfChanged(midiKeyPath, "MusicVolume", MusicVolumeValue, RegistryValueKind.DWord); + RegistryHelper.SetValueIfChanged(midiVirtualKeyPath, "MusicVolume", MusicVolumeValue, RegistryValueKind.DWord); - RegistryHelper.SetValueIfChanged(ffnxKeyPath, "VoiceVolume", VoiceVolumeValue, RegistryValueKind.DWord); - RegistryHelper.SetValueIfChanged(ffnxVirtualKeyPath, "VoiceVolume", VoiceVolumeValue, RegistryValueKind.DWord); + RegistryHelper.SetValueIfChanged(ffnxKeyPath, "VoiceVolume", VoiceVolumeValue, RegistryValueKind.DWord); + RegistryHelper.SetValueIfChanged(ffnxVirtualKeyPath, "VoiceVolume", VoiceVolumeValue, RegistryValueKind.DWord); - RegistryHelper.SetValueIfChanged(ffnxKeyPath, "AmbientVolume", AmbientVolumeValue, RegistryValueKind.DWord); - RegistryHelper.SetValueIfChanged(ffnxVirtualKeyPath, "AmbientVolume", AmbientVolumeValue, RegistryValueKind.DWord); + RegistryHelper.SetValueIfChanged(ffnxKeyPath, "AmbientVolume", AmbientVolumeValue, RegistryValueKind.DWord); + RegistryHelper.SetValueIfChanged(ffnxVirtualKeyPath, "AmbientVolume", AmbientVolumeValue, RegistryValueKind.DWord); - RegistryHelper.SetValueIfChanged(ffnxKeyPath, "MovieVolume", MovieVolumeValue, RegistryValueKind.DWord); - RegistryHelper.SetValueIfChanged(ffnxVirtualKeyPath, "MovieVolume", MovieVolumeValue, RegistryValueKind.DWord); + RegistryHelper.SetValueIfChanged(ffnxKeyPath, "MovieVolume", MovieVolumeValue, RegistryValueKind.DWord); + RegistryHelper.SetValueIfChanged(ffnxVirtualKeyPath, "MovieVolume", MovieVolumeValue, RegistryValueKind.DWord); + } } private void SetSelectedSoundDeviceFromSettings(LaunchSettings launchSettings) @@ -702,10 +628,7 @@ internal bool SaveSettings() { Sys.Settings.ProgramsToLaunchPrior = GetUpdatedProgramsToRun(); - Sys.Settings.GameLaunchSettings.AutoMountGameDisc = AutoMountChecked; - Sys.Settings.GameLaunchSettings.AutoUnmountGameDisc = AutoUnmountChecked; Sys.Settings.GameLaunchSettings.AutoUpdateDiscPath = AutoUpdatePathChecked; - Sys.Settings.GameLaunchSettings.MountingOption = SelectedMountOptionAsEnum; Sys.Settings.GameLaunchSettings.ShowLauncherWindow = IsShowLauncherChecked; Sys.Settings.GameLaunchSettings.DisableReunionOnLaunch = true; // always have this set to true @@ -720,6 +643,8 @@ internal bool SaveSettings() SetMidiDeviceInRegistry(); RegistryHelper.CommitTransaction(); + if (Sys.Settings.FF7InstalledVersion == FF7Version.Steam) Sys.FFNxConfig.Save(); + Sys.SaveSettings(); Sys.Message(new WMessage(ResourceHelper.Get(StringKey.GameLauncherSettingsUpdated))); diff --git a/SeventhHeavenUI/ViewModels/GameLaunchViewModel.cs b/SeventhHeavenUI/ViewModels/GameLaunchViewModel.cs index 1f402257..8da1b624 100644 --- a/SeventhHeavenUI/ViewModels/GameLaunchViewModel.cs +++ b/SeventhHeavenUI/ViewModels/GameLaunchViewModel.cs @@ -49,7 +49,7 @@ internal Task BeginLaunchProcessAsync() { GameLauncher.Instance.ProgressChanged += LaunchGame_ProgressChanged; - didLaunch = GameLauncher.LaunchGame(variableDump, debugLogging, IsLaunchingWithNoMods, IsLaunchingWithNoValidation); + didLaunch = GameLauncher.LaunchGame(variableDump, debugLogging, IsLaunchingWithNoMods, IsLaunchingWithNoValidation).Result; } finally { diff --git a/SeventhHeavenUI/ViewModels/GeneralSettingsViewModel.cs b/SeventhHeavenUI/ViewModels/GeneralSettingsViewModel.cs index 95450a29..4bbb9e87 100644 --- a/SeventhHeavenUI/ViewModels/GeneralSettingsViewModel.cs +++ b/SeventhHeavenUI/ViewModels/GeneralSettingsViewModel.cs @@ -422,41 +422,42 @@ public static void AutoDetectSystemPaths(Settings settings) { Logger.Info("FF7 Exe path is empty or ff7.exe is missing. Auto detecting paths ..."); - string registry_path = $"{RegistryHelper.GetKeyPath(FF7RegKey.SquareSoftKeyPath)}\\Final Fantasy VII"; string ff7 = null; - FF7Version foundVersion = FF7Version.Unknown; + Sys.Settings.FF7InstalledVersion = FF7Version.Unknown; try { - // first try to detect 1998 game or a "converted" game from the old 7H game converter - ff7 = (string)Registry.GetValue(registry_path, "AppPath", null); - foundVersion = !string.IsNullOrWhiteSpace(ff7) ? FF7Version.Original98 : FF7Version.Unknown; + // First try to autodetect the Steam installation if any + ff7 = GameConverter.GetInstallLocation(FF7Version.Steam); + Sys.Settings.FF7InstalledVersion = !string.IsNullOrWhiteSpace(ff7) ? FF7Version.Steam : FF7Version.Unknown; - if (!Directory.Exists(ff7)) + // If no Steam version detected, attempt to detect the Eidos release + if (Sys.Settings.FF7InstalledVersion == FF7Version.Unknown) { - Logger.Warn($"Deleting invalid 'AppPath' registry key since path does not exist: {ff7}"); - RegistryHelper.DeleteValueFromKey(registry_path, "AppPath"); // delete old paths set - RegistryHelper.DeleteValueFromKey(registry_path, "DataPath"); // delete old paths set - RegistryHelper.DeleteValueFromKey(registry_path, "MoviePath"); // delete old paths set - foundVersion = FF7Version.Unknown; // set back to Unknown to check other registry keys + ff7 = GameConverter.GetInstallLocation(FF7Version.ReRelease); + // Return the Steam version as both use the same logic to run from the 7th perspective + Sys.Settings.FF7InstalledVersion = !string.IsNullOrWhiteSpace(ff7) ? FF7Version.Steam : FF7Version.Unknown; } + // Finally as a last attempt try to autodetect the 1998 release + if (Sys.Settings.FF7InstalledVersion == FF7Version.Unknown) + { + // Try to detect 1998 game or a "converted" game from the old 7H game converter + string registry_path = $"{RegistryHelper.GetKeyPath(FF7RegKey.SquareSoftKeyPath)}\\Final Fantasy VII"; + ff7 = (string)Registry.GetValue(registry_path, "AppPath", null); + Sys.Settings.FF7InstalledVersion = !string.IsNullOrWhiteSpace(ff7) ? FF7Version.Original98 : FF7Version.Unknown; - if (foundVersion == FF7Version.Unknown) - { - // next check Steam registry keys and then Re-Release registry keys for installation path - ff7 = GameConverter.GetInstallLocation(FF7Version.Steam); - foundVersion = !string.IsNullOrWhiteSpace(ff7) ? FF7Version.Steam : FF7Version.Unknown; - - - if (foundVersion == FF7Version.Unknown) + if (!Directory.Exists(ff7)) { - ff7 = GameConverter.GetInstallLocation(FF7Version.ReRelease); - foundVersion = !string.IsNullOrWhiteSpace(ff7) ? FF7Version.ReRelease : FF7Version.Unknown; + Logger.Warn($"Deleting invalid 'AppPath' registry key since path does not exist: {ff7}"); + RegistryHelper.DeleteValueFromKey(registry_path, "AppPath"); // delete old paths set + RegistryHelper.DeleteValueFromKey(registry_path, "DataPath"); // delete old paths set + RegistryHelper.DeleteValueFromKey(registry_path, "MoviePath"); // delete old paths set + Sys.Settings.FF7InstalledVersion = FF7Version.Unknown; // set back to Unknown to check other registry keys } } - string versionStr = foundVersion == FF7Version.Original98 ? $"{foundVersion.ToString()} (or Game Converted)" : foundVersion.ToString(); + string versionStr = Sys.Settings.FF7InstalledVersion == FF7Version.Original98 ? $"{Sys.Settings.FF7InstalledVersion.ToString()} (or Game Converted)" : Sys.Settings.FF7InstalledVersion.ToString(); Logger.Info($"FF7Version Detected: {versionStr} with installation path: {ff7}"); @@ -472,7 +473,7 @@ public static void AutoDetectSystemPaths(Settings settings) // could fail if game not installed } - if (foundVersion != FF7Version.Unknown) + if (Sys.Settings.FF7InstalledVersion != FF7Version.Unknown) { settings.SetPathsFromInstallationPath(ff7); @@ -496,8 +497,21 @@ public static void AutoDetectSystemPaths(Settings settings) { Logger.Warn("Auto detect paths failed - could not get ff7.exe path from Windows Registry."); } - - + } + // User has given a ff7 exe path, try to guess which version it is + else + { + if (settings.FF7Exe.EndsWith("ff7_en.exe")) + { + string ff7Launcher = Path.Combine(Path.GetDirectoryName(settings.FF7Exe), "FF7_Launcher.exe"); + + // Since both Steam and ReRelease share the same way to launch, prefer the Steam codepath + if (File.Exists(ff7Launcher)) Sys.Settings.FF7InstalledVersion = FF7Version.Steam; + } + else if(settings.FF7Exe.EndsWith("ff7.exe")) + { + Sys.Settings.FF7InstalledVersion = FF7Version.Original98; + } } } @@ -547,7 +561,6 @@ internal bool SaveSettings() Sys.Settings.FFNxUpdateChannel = FFNxUpdateChannel; Sys.Settings.AppUpdateChannel = AppUpdateChannel; - Sys.Settings.Options = GetUpdatedOptions(); ApplyOptions(); @@ -556,6 +569,23 @@ internal bool SaveSettings() Sys.Message(new WMessage(ResourceHelper.Get(StringKey.GeneralSettingsHaveBeenUpdated))); + if (!FFNxDriverUpdater.IsAlreadyInstalled()) + { + try + { + FFNxDriverUpdater updater = new FFNxDriverUpdater(); + + Sys.Message(new WMessage($"Downloading and extracting the latest FFNx {Sys.Settings.FFNxUpdateChannel} version to {Sys.InstallPath}...")); + updater.DownloadAndExtractLatestVersion(Sys.Settings.FFNxUpdateChannel); + } + catch (Exception ex) + { + Sys.Message(new WMessage($"Something went wrong while attempting to install FFNx. See logs.")); + Logger.Error(ex); + return false; + } + } + return true; } diff --git a/SeventhHeavenUI/Windows/GameLaunchSettingsWindow.xaml b/SeventhHeavenUI/Windows/GameLaunchSettingsWindow.xaml index 589272d8..38823814 100644 --- a/SeventhHeavenUI/Windows/GameLaunchSettingsWindow.xaml +++ b/SeventhHeavenUI/Windows/GameLaunchSettingsWindow.xaml @@ -15,7 +15,7 @@ ResizeMode="NoResize" Title="{DynamicResource GameLauncherSettings}" Width="470" - Height="750"> + Height="633"> @@ -379,34 +379,13 @@ VerticalAlignment="Top"> - - - - + - - - diff --git a/SeventhHeavenUI/Windows/GeneralSettingsWindow.xaml.cs b/SeventhHeavenUI/Windows/GeneralSettingsWindow.xaml.cs index 63c21ed4..55d74858 100644 --- a/SeventhHeavenUI/Windows/GeneralSettingsWindow.xaml.cs +++ b/SeventhHeavenUI/Windows/GeneralSettingsWindow.xaml.cs @@ -70,37 +70,6 @@ private void btnFf7Exe_Click(object sender, RoutedEventArgs e) if (!string.IsNullOrEmpty(exePath)) { FileInfo fileSelected = new FileInfo(exePath); - if (fileSelected.Name.Equals("ff7_en.exe", System.StringComparison.InvariantCultureIgnoreCase) || fileSelected.Name.Equals("FF7_Launcher.exe", System.StringComparison.InvariantCultureIgnoreCase)) - { - // User selected the exe's for Steam release so we try to auto copy the 1.02 patched exe and select it for them - string targetPathToFf7Exe = Path.Combine(fileSelected.DirectoryName, "ff7.exe"); - string copyOrSelectMessage = ResourceHelper.Get(StringKey.Selected); - - if (!File.Exists(targetPathToFf7Exe)) - { - // use game converter to copy files over - var gc = new GameConverter(fileSelected.DirectoryName); - if (!gc.CopyFF7ExeToGame()) - { - MessageDialogWindow.Show(ResourceHelper.Get(StringKey.ThisExeIsUsedForSteamReleaseFailedToCopyExe), - ResourceHelper.Get(StringKey.ErrorIncorrectExe), - MessageBoxButton.OK, - MessageBoxImage.Error); - return; - } - - copyOrSelectMessage = ResourceHelper.Get(StringKey.CopiedAndSelected); - } - - ViewModel.FF7ExePathInput = targetPathToFf7Exe; - - MessageDialogWindow.Show(string.Format(ResourceHelper.Get(StringKey.ThisExeIsUsedForSteamReleaseCopiedSelectedForYou), copyOrSelectMessage), - ResourceHelper.Get(StringKey.ErrorIncorrectExe), - MessageBoxButton.OK, - MessageBoxImage.Warning); - - return; - } if (fileSelected.Name.Equals("FF7Config.exe", System.StringComparison.InvariantCultureIgnoreCase)) {