Skip to content

Commit

Permalink
Possible 2.2 release
Browse files Browse the repository at this point in the history
- Updated FFNx
- Changed how FFNx.cfg is copied and edited in UI (now stored in GameDriver.cfg)
- Updated translations
- Fixed MIDI Data null bug
- Play with variable dump wasn't launching
- Added Play With Minimal Validation option
  • Loading branch information
unab0mb committed Aug 26, 2020
1 parent aee7f54 commit 14a064c
Show file tree
Hide file tree
Showing 38 changed files with 201 additions and 171 deletions.
12 changes: 10 additions & 2 deletions 7thWrapperLib/IrosArc.cs
Original file line number Diff line number Diff line change
Expand Up @@ -403,13 +403,21 @@ public IEnumerable<string> AllFolderNames() {

public bool HasFolder(string name) {
bool result = _folderNames.Contains(name);
DebugLogger.DetailedWriteLine($"ARCHIVE: Check if {_source} contains folder {name}: {result}");
if (result)
{
DebugLogger.DetailedWriteLine($"ARCHIVE: {_source} contains folder {name}");
}

return result;
}

public bool HasFile(string name) {
bool result = _lookup.ContainsKey(name);
DebugLogger.DetailedWriteLine($"ARCHIVE: Check if {_source} contains file {name}: {result}");
if (result)
{
DebugLogger.DetailedWriteLine($"ARCHIVE: {_source} contains file {name}");
}

return result;
}

Expand Down
13 changes: 0 additions & 13 deletions SeventhHeavenUI/Classes/ControllerInterceptor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -177,18 +177,5 @@ internal Task PollForGamepadInput()
});

}

internal static void SendVibrationToConnectedController(int lengthInMilliseconds = 750)
{
//PlayerIndex? connectedController = GetConnectedController();

//if (connectedController.HasValue)
//{
// GamePad.SetVibration(connectedController.Value, 0.75f, 0.75f);
// Thread.Sleep(lengthInMilliseconds);
// GamePad.SetVibration(connectedController.Value, 0f, 0f);
//}
}

}
}
70 changes: 43 additions & 27 deletions SeventhHeavenUI/Classes/GameConverter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -748,33 +748,53 @@ public void CopyMusicFiles()
/// <summary>
/// Checks FFNx.dll is up to date and matches file in Resources/Game Driver/ folder.
/// If files are different then game driver files are copied to ff7 install path
/// Also copies/overwrites the game driver cfg file in ff7 folder
/// </summary>
/// <returns>returns false if error occurred</returns>
internal bool InstallLatestGameDriver(string backupFolderPath)
{
string pathToLatestFile = Path.Combine(Sys.PathToGameDriverFolder, "FFNx.dll");
string pathToLatestCfg = Path.Combine(Sys.PathToGameDriverFolder, "FFNx.cfg");
string pathToLatestCfg = Path.Combine(Sys.PathToGameDriverFolder, "GameDriver.cfg");
string pathToCurrentFile = Path.Combine(InstallPath, "FFNx.dll");
string pathToCurrentCfg = Path.Combine(InstallPath, "FFNx.cfg");

string pathToOldCustomDriver = Path.Combine(InstallPath, "7H_GameDriver.dll");
string pathToOldCustomCfg = Path.Combine(InstallPath, "7H_GameDriver.cfg");


if (!File.Exists(pathToLatestFile))
{
SendMessage($"{ResourceHelper.Get(StringKey.CannotCheckIfLatestDriverIsInstalledDueToMissingFile)}: {pathToLatestFile}", NLog.LogLevel.Warn);
return true; // return true so it does not halt process
}

try
{
// copy latest config to ff7 game folder
if (File.Exists(pathToLatestCfg))
{
SendMessage($"\t{ResourceHelper.Get(StringKey.Copying)} {pathToLatestCfg} -> {pathToCurrentCfg} ...");
File.Copy(pathToLatestCfg, pathToCurrentCfg, true);
}
else
{
SendMessage($"\t{ResourceHelper.Get(StringKey.CannotCreateDefaultCfgDueToMissingFile)}: {pathToLatestCfg} ...", NLog.LogLevel.Error);
return false;
}
}
catch (Exception ex)
{
Logger.Error(ex);
return false;
}

FileVersionInfo currentFileVersion = null;
if (File.Exists(pathToCurrentFile))
{
currentFileVersion = FileVersionInfo.GetVersionInfo(pathToCurrentFile);

// If no version detected, trigger copy of driver because it is old
// Also if version is 1.7.2.152 (included in 7h 2.2 beta) it is old because
// TrueOdin reset version and current 1.7.2.64 is newer than 1.7.2.152
// TrueOdin reset version and current 1.7.2.124 is newer than 1.7.2.152
// 1.7.2.152 logic can be removed once bundled ffnx ver is above 1.7.2.152 again
if (String.IsNullOrWhiteSpace(currentFileVersion.FileVersion) || currentFileVersion.FileVersion.Equals("1.7.2.152"))
{
Expand All @@ -787,7 +807,7 @@ internal bool InstallLatestGameDriver(string backupFolderPath)
if (currentFileVersion != null && latestFileVersion != null && new Version(currentFileVersion.FileVersion).CompareTo(new Version(latestFileVersion.FileVersion)) >= 0)
{
SendMessage($"\t{ResourceHelper.Get(StringKey.GameDriverDllFileIsUpToDate)}");
return true; // file exist and matches what is in /Game Driver folder
return true; // file exists and matches what is in /Game Driver folder
}

try
Expand All @@ -813,28 +833,6 @@ internal bool InstallLatestGameDriver(string backupFolderPath)
File.Copy(pathToCurrentFile, Path.Combine(backupFolderPath, "FFNx.dll"), true);
}

if (File.Exists(pathToCurrentCfg))
{
// backup existing driver cfg if it exists
Directory.CreateDirectory(backupFolderPath);
SendMessage($"\t{ResourceHelper.Get(StringKey.BackingUpExistingGameDriverCfgTo)} {backupFolderPath} ...");
File.Copy(pathToCurrentCfg, Path.Combine(backupFolderPath, "FFNx.cfg"), true);
}
else
{
// copy default .cfg if it is missing
if (File.Exists(pathToLatestCfg))
{
SendMessage($"\t{ResourceHelper.Get(StringKey.GameDriverCfgFileMissingCopyingDefaultFrom)} {Sys.PathToGameDriverFolder} ...", NLog.LogLevel.Warn);
File.Copy(pathToLatestCfg, pathToCurrentCfg, true);
}
else
{
SendMessage($"\t{ResourceHelper.Get(StringKey.CannotCreateDefaultCfgDueToMissingFile)}: {pathToLatestCfg} ...", NLog.LogLevel.Error);
return false;
}
}

// backup old shaders and delete
string pathToShaders = Path.Combine(InstallPath, "shaders");
if (Directory.Exists(pathToShaders) && Directory.GetFiles(pathToShaders).Length > 0)
Expand Down Expand Up @@ -871,8 +869,26 @@ internal bool InstallLatestGameDriver(string backupFolderPath)
}

// copy entire contents of GameDriver folder to ff7 folder
// Lists are CaSe SeNsItIvE!
List<string> gameDriverFilesToIgnore = new List<string>() { "COPYING.TXT",
"FFNx._GLOBALS.txt",
"FFNx.BATTLE.fullscreen.txt",
"FFNx.BATTLE.restore_modals.txt",
"FFNx.BATTLE.transparent_modals.txt",
"FFNx.FIELD.transparent_modals.txt",
"FFNx.MENU.cursor_vertical_center.txt",
"FFNx.MENU.save_everywhere.txt",
"FFNx.reg",
"FFNx.cfg",
"GameDriver.cfg" };

List<string> gameDriverFoldersToIgnore = new List<string>() { "ff8",
"de",
"es",
"fr" };

SendMessage($"\t{ResourceHelper.Get(StringKey.CopyingContentsOf)} {Sys.PathToGameDriverFolder} -> {InstallPath} ...");
FileUtils.CopyDirectoryRecursively(Sys.PathToGameDriverFolder, InstallPath);
FileUtils.CopyDirectoryRecursively(Sys.PathToGameDriverFolder, InstallPath, gameDriverFilesToIgnore, gameDriverFoldersToIgnore, false);
}
catch (Exception ex)
{
Expand Down
58 changes: 32 additions & 26 deletions SeventhHeavenUI/Classes/GameLauncher.cs
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ public static GameLauncher Instance
[DllImport("user32.dll", EntryPoint = "FindWindow")]
private extern static IntPtr FindWindow(string lpClassName, string lpWindowName);

public static bool LaunchGame(bool varDump, bool debug, bool launchWithNoMods = false)
public static bool LaunchGame(bool varDump, bool debug, bool launchWithNoMods = false, bool LaunchWithNoValidation = false)
{
Instance.RaiseProgressChanged(ResourceHelper.Get(StringKey.CheckingFf7IsNotRunning));
if (IsFF7Running())
Expand Down Expand Up @@ -160,6 +160,12 @@ public static bool LaunchGame(bool varDump, bool debug, bool launchWithNoMods =
converter.InstallPath = newInstallationPath;
}

// if launching with no (minimal) validation checks, skip ahead
if (LaunchWithNoValidation)
{
goto VanillaCheck;
}

Instance.RaiseProgressChanged(ResourceHelper.Get(StringKey.VerifyingEnglishGameFilesExist));
if (!converter.IsEnglishGameInstalled())
{
Expand Down Expand Up @@ -426,7 +432,13 @@ public static bool LaunchGame(bool varDump, bool debug, bool launchWithNoMods =
//
Instance.SetRegistryValues();

//
// Copy input.cfg to FF7
//
Instance.RaiseProgressChanged(ResourceHelper.Get(StringKey.CopyingFf7InputCfgToFf7Path));
bool didCopyCfg = CopyKeyboardInputCfg();

VanillaCheck:
//
// Determine if game will be ran as 'vanilla' with mods so don't have to inject with EasyHook
//
Expand All @@ -444,8 +456,6 @@ public static bool LaunchGame(bool varDump, bool debug, bool launchWithNoMods =
runAsVanilla = true;
}



RuntimeProfile runtimeProfile = null;

if (!runAsVanilla)
Expand All @@ -462,14 +472,6 @@ public static bool LaunchGame(bool varDump, bool debug, bool launchWithNoMods =
return false;
}

//
// Start Turbolog for Variable Dump
//
if (varDump)
{
Instance.RaiseProgressChanged(ResourceHelper.Get(StringKey.VariableDumpSetToTrueStartingTurboLog));
StartTurboLogForVariableDump(runtimeProfile);
}

//
// Copy EasyHook.dll to FF7
Expand All @@ -478,14 +480,6 @@ public static bool LaunchGame(bool varDump, bool debug, bool launchWithNoMods =
CopyEasyHookDlls();
}


//
// Copy input.cfg to FF7
//
Instance.RaiseProgressChanged(ResourceHelper.Get(StringKey.CopyingFf7InputCfgToFf7Path));
bool didCopyCfg = CopyKeyboardInputCfg();


//
// Setup log file if debugging
//
Expand All @@ -500,17 +494,25 @@ public static bool LaunchGame(bool varDump, bool debug, bool launchWithNoMods =
//
// Check/Disable Reunion Mod
//
bool didDisableReunion = false;

// if launching with no (minimal) validation checks, skip ahead
if (LaunchWithNoValidation)
{
goto HookandStartGame;
}

Instance.RaiseProgressChanged(ResourceHelper.Get(StringKey.CheckingIfReunionModIsInstalled));
Instance.RaiseProgressChanged($"\t{ResourceHelper.Get(StringKey.Found)}: {IsReunionModInstalled()}");

bool didDisableReunion = false;
if (IsReunionModInstalled() && Sys.Settings.GameLaunchSettings.DisableReunionOnLaunch)
{
Instance.RaiseProgressChanged(ResourceHelper.Get(StringKey.DisablingReunionMod));
EnableOrDisableReunionMod(doEnable: false);
didDisableReunion = true;
}

HookandStartGame:
//
// Initialize the controller input interceptor
//
Expand Down Expand Up @@ -670,6 +672,7 @@ public static bool LaunchGame(bool varDump, bool debug, bool launchWithNoMods =
}

ff7Proc.EnableRaisingEvents = true;

if (debug)
{
Instance.RaiseProgressChanged(ResourceHelper.Get(StringKey.DebugLoggingSetToTrueWiringUpLogFile));
Expand All @@ -694,6 +697,15 @@ public static bool LaunchGame(bool varDump, bool debug, bool launchWithNoMods =
};
}

//
// Start Turbolog for Variable Dump
//
if (varDump)
{
Instance.RaiseProgressChanged(ResourceHelper.Get(StringKey.VariableDumpSetToTrueStartingTurboLog));
StartTurboLogForVariableDump(runtimeProfile);
}

/// sideload programs for mods before starting FF7 because FF7 losing focus while initializing can cause the intro movies to stop playing
/// ... Thus we load programs first so they don't steal window focus
Instance.RaiseProgressChanged(ResourceHelper.Get(StringKey.StartingProgramsForMods));
Expand Down Expand Up @@ -761,7 +773,6 @@ public static bool LaunchGame(bool varDump, bool debug, bool launchWithNoMods =
};


int secondsToWait = 120;
Instance.RaiseProgressChanged(string.Format(ResourceHelper.Get(StringKey.WaitingForFF7WindowToBeVisible), secondsToWait));
DateTime start = DateTime.Now;
Expand Down Expand Up @@ -798,8 +809,6 @@ public static bool LaunchGame(bool varDump, bool debug, bool launchWithNoMods =
ff7Proc.Refresh();
}

ControllerInterceptor.SendVibrationToConnectedController();

SetForegroundWindow(ff7Proc.MainWindowHandle); // activate window again
}

Expand Down Expand Up @@ -1033,8 +1042,6 @@ internal static bool LaunchFF7Exe()
}
};

ControllerInterceptor.SendVibrationToConnectedController();

return true;
}
catch (Exception ex)
Expand Down Expand Up @@ -1432,7 +1439,6 @@ public void SetRegistryValues()
SetValueIfChanged(graphicsKeyPath, "DD_GUID", emptyGuidBytes, RegistryValueKind.Binary);
SetValueIfChanged(graphicsVirtualKeyPath, "DD_GUID", emptyGuidBytes, RegistryValueKind.Binary);


// Add registry key values for MIDI
string midiKeyPath = $"{ff7KeyPath}\\1.00\\MIDI";
string midiVirtualKeyPath = $"{virtualStorePath}\\1.00\\MIDI";
Expand Down
4 changes: 2 additions & 2 deletions SeventhHeavenUI/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -51,5 +51,5 @@
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("2.2.3.521")]
[assembly: AssemblyFileVersion("2.2.3.521")]
[assembly: AssemblyVersion("2.2.3.522")]
[assembly: AssemblyFileVersion("2.2.3.522")]
Binary file modified SeventhHeavenUI/Resources/Game Driver/FFNx.dll
Binary file not shown.
Binary file removed SeventhHeavenUI/Resources/Game Driver/FFNx.reg
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -25,16 +25,11 @@
# - 1: OpenGL ( works fine on Intel/Nvidia, MAY break on AMD )
# - 2: Direct3D9 ( Tech Preview: Not Recommended )
# - 3: Direct3D11 ( works fine under any GPU on Windows )
# - 4: Direct3D12 ( Tech Preview: Not Recommended )
# - 5: Vulkan ( Tech Preview: Not Recommended )
# - 4: Direct3D12
# - 5: Vulkan
#~~~~~~~~~~~~~~~~~~~~~~~~~~~
renderer_backend = 0

# EXPERIMENTAL!
# This flag will allow the renderer to cache the pipelines. This MAY speedup the rendering on Direct3D 12 or Vulkan, as well as MAY create artifacts.
# Enable this AT YOUR OWN RISK!
#renderer_cache = no

#[FULLSCREEN]
# If off, it will run in window mode.
#~~~~~~~~~~~~~~~~~~~~~~~~~~~
Expand Down
Binary file modified SeventhHeavenUI/Resources/Game Driver/shaders/FFNx.flat.gl.frag
Binary file not shown.
Binary file modified SeventhHeavenUI/Resources/Game Driver/shaders/FFNx.flat.gl.vert
Binary file not shown.
Binary file modified SeventhHeavenUI/Resources/Game Driver/shaders/FFNx.flat.vk.frag
Binary file not shown.
Binary file modified SeventhHeavenUI/Resources/Game Driver/shaders/FFNx.flat.vk.vert
Binary file not shown.
Binary file modified SeventhHeavenUI/Resources/Game Driver/shaders/FFNx.post.vk.frag
Binary file not shown.
Binary file modified SeventhHeavenUI/Resources/Game Driver/shaders/FFNx.post.vk.vert
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
2 changes: 2 additions & 0 deletions SeventhHeavenUI/Resources/Help/userhelp.html
Original file line number Diff line number Diff line change
Expand Up @@ -572,6 +572,8 @@
<br /><br />
<b>Play With Debug Log: </b>Launches the game with essentially a 'verbose' log. It is the most detailed, and slowest option. It could use a lot of disk space to save the log.
<br /><br />
<b>Play With Minimal Validation: </b>Launches the game with minimal validation checks, file copies, or registry changes. Useful if you want to essentially just 'run the game' with mods but don't want 7th Heaven to make sure everything is working correctly first or apply your chosen settings to the registry. May be prone to crashing on game launch if there is something wrong with your configuration.
<br /><br />
<b>Play With Variable Dump: </b>Launches the game with 'TurBoLog' and generate a simplified but still very detailed log, along with the values of variables it encounters. This option too, will significantly slow down your game and could use a lot of disk space to save the log.
</p>

Expand Down
Loading

0 comments on commit 14a064c

Please sign in to comment.