Skip to content

Commit 101a0f8

Browse files
SeventhHeavenUI: Enable native Steam edition support
Launching the Steam edition of the game will no more require a conversion. Additionally, launching 1998 edition will now require the official disk. Every other way is not officially supported starting now.
1 parent 2a4b93e commit 101a0f8

37 files changed

+548
-1032
lines changed

.github/workflows/main-3.5.1.yml .github/workflows/main-3.9.9.yml

+7-5
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
name: 7th-Heaven
22

3-
run-name: 3.5.1.${{ github.run_number }}
3+
run-name: 3.9.9.${{ github.run_number }}
44

55
on:
66
workflow_dispatch:
@@ -20,7 +20,7 @@ env:
2020
_RELEASE_VERSION: v0
2121
_RELEASE_CONFIGURATION: Release
2222
_BUILD_BRANCH: "${{ github.ref }}"
23-
_BUILD_VERSION: "3.5.1.${{ github.run_number }}"
23+
_BUILD_VERSION: "3.9.9.${{ github.run_number }}"
2424
_CHANGELOG_VERSION: "0"
2525
# VCPKG: Enable Binary Caching
2626
VCPKG_BINARY_SOURCES: clear;nuget,github,readwrite
@@ -40,7 +40,9 @@ jobs:
4040
git config --global core.filemode false
4141
git config --global core.longpaths true
4242
- name: Checkout
43-
uses: actions/checkout@v4.1.0
43+
uses: actions/checkout@v4
44+
with:
45+
fetch-depth: 0
4446
- name: Prepare Environment
4547
run: ".github/workflows/prepare.ps1"
4648
shell: pwsh
@@ -55,7 +57,7 @@ jobs:
5557
- name: Restore NuGet Packages
5658
run: nuget restore ${{ github.workspace }}\${{ env._RELEASE_NAME }}.sln
5759
- name: Add MSBuild to PATH
58-
uses: microsoft/setup-msbuild@v1.3.2
60+
uses: microsoft/setup-msbuild@v1
5961
- name: Run MSBuild
6062
run: msbuild ${{ github.workspace }}\${{ env._RELEASE_NAME }}.sln /p:WindowsTargetPlatformVersion=10.0.19041.0 /m -p:Configuration=${{ env._RELEASE_CONFIGURATION }} -p:Platform="Any CPU"
6163
- name: Prepare Installer
@@ -90,7 +92,7 @@ jobs:
9092
return ret;
9193
- name: Publish PR artifacts
9294
if: env._IS_GITHUB_RELEASE == 'false' && success()
93-
uses: actions/upload-artifact@v4.0.0
95+
uses: actions/upload-artifact@v4
9496
with:
9597
name: "${{ env._RELEASE_NAME }}-${{ env._RELEASE_VERSION }}"
9698
path: ".dist/*"

7thHeaven.Code/LaunchSettings.cs

-13
Original file line numberDiff line numberDiff line change
@@ -2,21 +2,11 @@
22

33
namespace _7thHeaven.Code
44
{
5-
public enum MountDiscOption
6-
{
7-
Unknown = -1,
8-
MountWithPowerShell = 0,
9-
MountWithWinCDEmu = 1,
10-
DoNotMount =2,
11-
}
125

136
[Serializable]
147
public class LaunchSettings
158
{
16-
public bool AutoMountGameDisc { get; set; }
17-
public bool AutoUnmountGameDisc { get; set; }
189
public bool AutoUpdateDiscPath { get; set; }
19-
public MountDiscOption MountingOption { get; set; }
2010

2111
public bool DisableReunionOnLaunch { get; set; }
2212

@@ -49,8 +39,6 @@ public static LaunchSettings DefaultSettings()
4939
{
5040
return new LaunchSettings()
5141
{
52-
AutoMountGameDisc = true,
53-
AutoUnmountGameDisc = true,
5442
AutoUpdateDiscPath = true,
5543
DisableReunionOnLaunch = true,
5644
SelectedSoundDevice = Guid.Empty,
@@ -62,7 +50,6 @@ public static LaunchSettings DefaultSettings()
6250
HasDisplayedOggMusicWarning = false,
6351
HasDisplayedMovieWarning = false,
6452
EnablePs4ControllerService = false,
65-
MountingOption = MountDiscOption.MountWithPowerShell,
6653
EnableGamepadPolling = false,
6754
};
6855
}

7thHeaven.Code/RegistryHelper.cs

+6-2
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,13 @@ public static class RegistryHelper
2424

2525
private static List<string> transaction = new();
2626

27-
public const string SteamKeyPath64Bit = @"HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall\Steam App 39140";
27+
public const string SteamKeyPath64Bit = @"HKEY_CURRENT_USER\Software\Wow6432Node\Valve\Steam";
2828

29-
public const string SteamKeyPath32Bit = @"HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\Steam App 39140";
29+
public const string SteamKeyPath32Bit = @"HKEY_CURRENT_USER\Software\Valve\Steam";
30+
31+
public const string FF7SteamKeyPath64Bit = @"HKEY_CURRENT_USER\Software\Wow6432Node\Valve\Steam\Apps\39140";
32+
33+
public const string FF7SteamKeyPath32Bit = @"HKEY_CURRENT_USER\Software\Valve\Steam\Apps\39140";
3034

3135
public const string RereleaseKeyPath64Bit = @"HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall\{141B8BA9-BFFD-4635-AF64-078E31010EC3}_is1";
3236

7thHeaven.Code/Settings.cs

+9-1
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,13 @@ The original developer is Iros <irosff@outlook.com>
1515

1616
namespace Iros._7th.Workshop {
1717

18+
public enum FF7Version
19+
{
20+
Unknown = -1,
21+
Steam,
22+
ReRelease,
23+
Original98
24+
}
1825

1926
public enum GeneralOptions {
2027
None = 0,
@@ -105,6 +112,7 @@ public List<string> SubscribedUrls
105112
public string FF7Exe { get; set; }
106113
[System.Xml.Serialization.XmlElement("AlsoLaunch")]
107114
public List<ProgramLaunchInfo> ProgramsToLaunchPrior { get; set; }
115+
public FF7Version FF7InstalledVersion { get; set; }
108116
public FFNxUpdateChannelOptions FFNxUpdateChannel { get; set; }
109117
public AppUpdateChannelOptions AppUpdateChannel { get; set; }
110118
public DateTime LastUpdateCheck { get; set; }
@@ -202,7 +210,7 @@ public static Settings UseDefaultSettings()
202210
/// <param name="pathToFf7Install"></param>
203211
public void SetPathsFromInstallationPath(string pathToFf7Install)
204212
{
205-
FF7Exe = Path.Combine(pathToFf7Install, "FF7.exe");
213+
FF7Exe = Sys.Settings.FF7InstalledVersion == FF7Version.Original98 ? Path.Combine(pathToFf7Install, "FF7.exe") : Path.Combine(pathToFf7Install, "ff7_en.exe");
206214
LibraryLocation = Path.Combine(pathToFf7Install, "mods", @"7th Heaven");
207215

208216
LogAndCreateFolderIfNotExists(LibraryLocation);

7thHeaven.Code/StringKey.cs

+1
Original file line numberDiff line numberDiff line change
@@ -280,6 +280,7 @@ public enum StringKey
280280
DeletingTemporaryFiles,
281281
BeginningToPollForGamePadInput,
282282
FoundLanguageInstalledCreatingEnglishGameFiles,
283+
ErrorOnlyEnglishLanguageSupported,
283284
Ff7IsCurrentlyInstalledInASystemFolder,
284285
CanNotContinueDueToFf7nstalledInProtectedFolder,
285286
CannotContinue,

7thHeaven.Code/Sys.cs

-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@ The original developer is Iros <irosff@outlook.com>
1717

1818
namespace Iros._7th.Workshop
1919
{
20-
2120
public class ModStatusEventArgs : EventArgs
2221
{
2322
public ModStatus OldStatus { get; set; }

7thHeaven.sln

+14
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "7thWrapperLoader", "7thWrap
1717
EndProject
1818
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "7thWrapperProxy", "7thWrapperProxy\7thWrapperProxy.csproj", "{F955F161-A47E-4399-9FD2-DB0D83E6461A}"
1919
EndProject
20+
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "FF7_Launcher", "FF7_Launcher\FF7_Launcher.vcxproj", "{E9DF030F-3113-46CD-81EB-DDEC52A7C926}"
21+
EndProject
2022
Global
2123
GlobalSection(SolutionConfigurationPlatforms) = preSolution
2224
Debug|Any CPU = Debug|Any CPU
@@ -109,6 +111,18 @@ Global
109111
{F955F161-A47E-4399-9FD2-DB0D83E6461A}.Release|x64.Build.0 = Release|Any CPU
110112
{F955F161-A47E-4399-9FD2-DB0D83E6461A}.Release|x86.ActiveCfg = Release|Any CPU
111113
{F955F161-A47E-4399-9FD2-DB0D83E6461A}.Release|x86.Build.0 = Release|Any CPU
114+
{E9DF030F-3113-46CD-81EB-DDEC52A7C926}.Debug|Any CPU.ActiveCfg = Debug|win32
115+
{E9DF030F-3113-46CD-81EB-DDEC52A7C926}.Debug|Any CPU.Build.0 = Debug|win32
116+
{E9DF030F-3113-46CD-81EB-DDEC52A7C926}.Debug|x64.ActiveCfg = Debug|win32
117+
{E9DF030F-3113-46CD-81EB-DDEC52A7C926}.Debug|x64.Build.0 = Debug|win32
118+
{E9DF030F-3113-46CD-81EB-DDEC52A7C926}.Debug|x86.ActiveCfg = Debug|win32
119+
{E9DF030F-3113-46CD-81EB-DDEC52A7C926}.Debug|x86.Build.0 = Debug|win32
120+
{E9DF030F-3113-46CD-81EB-DDEC52A7C926}.Release|Any CPU.ActiveCfg = Release|win32
121+
{E9DF030F-3113-46CD-81EB-DDEC52A7C926}.Release|Any CPU.Build.0 = Release|win32
122+
{E9DF030F-3113-46CD-81EB-DDEC52A7C926}.Release|x64.ActiveCfg = Release|win32
123+
{E9DF030F-3113-46CD-81EB-DDEC52A7C926}.Release|x64.Build.0 = Release|win32
124+
{E9DF030F-3113-46CD-81EB-DDEC52A7C926}.Release|x86.ActiveCfg = Release|win32
125+
{E9DF030F-3113-46CD-81EB-DDEC52A7C926}.Release|x86.Build.0 = Release|win32
112126
EndGlobalSection
113127
GlobalSection(SolutionProperties) = preSolution
114128
HideSolutionNode = FALSE

7thWrapperLib/Profile.cs

+2-2
Original file line numberDiff line numberDiff line change
@@ -311,7 +311,7 @@ public IEnumerable<ProgramInfo> GetLoadPrograms()
311311
public static bool DirExists(string dir)
312312
{
313313
bool exist = System.IO.Directory.Exists(dir);
314-
DebugLogger.DetailedWriteLine($"MOD: Check if directory exists {dir}: {exist}");
314+
//DebugLogger.DetailedWriteLine($"MOD: Check if directory exists {dir}: {exist}");
315315
return exist;
316316
}
317317

@@ -350,7 +350,7 @@ private bool FileExists(string file)
350350
exist = System.IO.File.Exists(file);
351351
if (exist) _activated.Add(file);
352352
}
353-
DebugLogger.DetailedWriteLine($"MOD: Check if file exists {file}: {exist}");
353+
//DebugLogger.DetailedWriteLine($"MOD: Check if file exists {file}: {exist}");
354354
return exist;
355355
}
356356

7thWrapperLib/Wrap.cs

+35-17
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ private static void MonitorThread(object rpo)
3232

3333
do
3434
{
35-
DebugLogger.WriteLine("MONITOR:");
35+
DebugLogger.WriteLine(">> MONITOR:");
3636
for (int i = 0; i < accessors.Count; i++)
3737
{
3838
int value;
@@ -85,16 +85,29 @@ public static void Run(Process currentProcess, string profileFile = ".7thWrapper
8585
}
8686
}
8787

88-
DebugLogger.WriteLine($"Wrap run... PName: {_process.ProcessName} PID: {_process.Id} Path: {_profile.ModPath} Capture: {String.Join(", ", _profile.MonitorPaths)}");
88+
DebugLogger.WriteLine($"Starting wrapper now:");
89+
90+
DebugLogger.WriteLine($">> PName: {_process.ProcessName}");
91+
DebugLogger.WriteLine($">> PID: {_process.Id}");
92+
DebugLogger.WriteLine($">> FF7Path: {_profile.FF7Path}");
93+
DebugLogger.WriteLine($">> ModPath: {_profile.ModPath}");
94+
DebugLogger.WriteLine($">> MonitorPaths:");
95+
foreach(string monPath in _profile.MonitorPaths)
96+
DebugLogger.WriteLine($" - {monPath}");
8997
for (int i = _profile.MonitorPaths.Count - 1; i >= 0; i--) {
9098
if (!_profile.MonitorPaths[i].EndsWith(System.IO.Path.DirectorySeparatorChar.ToString()))
9199
_profile.MonitorPaths[i] += System.IO.Path.DirectorySeparatorChar;
92100
if (String.IsNullOrWhiteSpace(_profile.MonitorPaths[i])) _profile.MonitorPaths.RemoveAt(i);
93101
}
94102

103+
DebugLogger.WriteLine($"\nLoading mods:");
104+
95105
foreach (var item in _profile.Mods) {
96-
DebugLogger.WriteLine($" Mod: {item.BaseFolder} has {item.Conditionals.Count} conditionals");
97-
DebugLogger.WriteLine(" Additional paths: " + String.Join(", ", item.ExtraFolders));
106+
DebugLogger.WriteLine($">> Mod: {item.BaseFolder}");
107+
DebugLogger.WriteLine($" - Conditionals: {item.Conditionals.Count}");
108+
DebugLogger.WriteLine($" - Extra Folders:");
109+
foreach (string extraFolder in item.ExtraFolders)
110+
DebugLogger.WriteLine($" - {extraFolder}");
98111
item.Startup();
99112
}
100113

@@ -119,6 +132,8 @@ public static void Run(Process currentProcess, string profileFile = ".7thWrapper
119132
}
120133
}
121134

135+
DebugLogger.WriteLine($"\nLoading hext patches:");
136+
122137
foreach (var mod in _profile.Mods.AsEnumerable().Reverse()) {
123138
foreach (string file in mod.GetPathOverrideNames("hext")) {
124139
foreach (var of in mod.GetOverrides("hext\\" + file)) {
@@ -128,11 +143,11 @@ public static void Run(Process currentProcess, string profileFile = ".7thWrapper
128143
} else {
129144
s = of.Archive.GetData(of.File);
130145
}
131-
DebugLogger.WriteLine($"Applying hext patch {file} from mod {mod.BaseFolder}");
146+
DebugLogger.WriteLine($">> Applying hext patch {file} from mod {mod.BaseFolder}");
132147
try {
133148
HexPatch.Apply(s);
134149
} catch (Exception ex) {
135-
DebugLogger.WriteLine("Error applying patch: " + ex.Message);
150+
DebugLogger.WriteLine(" - Error applying patch: " + ex.Message);
136151
}
137152
}
138153
}
@@ -167,6 +182,9 @@ public static void Run(Process currentProcess, string profileFile = ".7thWrapper
167182
AddIROFilesToMappedFiles("", null, archive);
168183
}
169184
}
185+
186+
DebugLogger.WriteLine($"\nWrapper startup complete.");
187+
DebugLogger.WriteLine($"\nListening for game actions...");
170188
} catch (Exception e) {
171189
DebugLogger.WriteLine(e.ToString());
172190
return;
@@ -262,7 +280,7 @@ public static int HCloseHandle(IntPtr hObject)
262280
if (_varchives.ContainsKey(hObject))
263281
{
264282
_varchives.Remove(hObject);
265-
DebugLogger.WriteLine($"Closing dummy handle {hObject}");
283+
DebugLogger.WriteLine($">> Closing dummy handle {hObject}");
266284
}
267285

268286
return ret;
@@ -272,7 +290,7 @@ public static uint HGetFileType(IntPtr hFile)
272290
{
273291
uint ret = 0;
274292

275-
DebugLogger.DetailedWriteLine($"GetFileType on {hFile}");
293+
DebugLogger.DetailedWriteLine($">> GetFileType on {hFile}");
276294
if (_varchives.ContainsKey(hFile))
277295
{
278296
//DebugLogger.WriteLine(" ---faking dummy file");
@@ -319,7 +337,7 @@ public static int HReadFile(IntPtr handle, IntPtr bytes, uint numBytesToRead, In
319337
public static IntPtr CreateVA(OverrideFile of) {
320338
VArchiveData va = new VArchiveData(of.Archive.GetBytes(of.File));
321339
IntPtr dummy = of.Archive.GetDummyHandle(_process);
322-
DebugLogger.WriteLine($"Creating dummy file handle {dummy} to access {of.Archive}{of.File}");
340+
DebugLogger.WriteLine($">> Creating dummy file handle {dummy} to access {of.Archive}{of.File}");
323341
_varchives[dummy] = va;
324342

325343
return dummy;
@@ -348,7 +366,7 @@ public static IntPtr HCreateFileW(
348366
if (isFF7GameFile)
349367
{
350368
lpFileName = lpFileName.Replace("\\/", "\\").Replace("/", "\\").Replace("\\\\", "\\");
351-
DebugLogger.DetailedWriteLine($"CreateFileW for {lpFileName}...");
369+
DebugLogger.DetailedWriteLine($">> CreateFileW for {lpFileName}...");
352370
if (lpFileName.IndexOf('\\') < 0)
353371
{
354372
//DebugLogger.WriteLine("No path: curdir is {0}", System.IO.Directory.GetCurrentDirectory(), 0);
@@ -375,7 +393,7 @@ public static IntPtr HCreateFileW(
375393

376394
if (mapped != null)
377395
{
378-
DebugLogger.WriteLine($"Remapping {lpFileName} to {mapped.File} [ Matched: '{match}' ]");
396+
DebugLogger.WriteLine($" - Remapping {lpFileName} to {mapped.File} [ Matched: '{match}' ]");
379397

380398
if (mapped.Archive == null)
381399
{
@@ -391,7 +409,7 @@ public static IntPtr HCreateFileW(
391409
}
392410
}
393411
else
394-
DebugLogger.DetailedWriteLine($"Skipped file {lpFileName}");
412+
DebugLogger.DetailedWriteLine($">> Skipped file {lpFileName}");
395413

396414
if (ret == IntPtr.Zero)
397415
ret = Win32.CreateFileW(lpFileName, dwDesiredAccess, dwShareMode, lpSecurityAttributes, dwCreationDisposition, dwFlagsAndAttributes, hTemplateFile);
@@ -403,7 +421,7 @@ public static IntPtr HCreateFileW(
403421

404422
public static IntPtr HFindFirstFileW(string lpFileName, IntPtr lpFindFileData)
405423
{
406-
DebugLogger.WriteLine("FindFirstFile for " + lpFileName);
424+
DebugLogger.WriteLine(">> FindFirstFile for " + lpFileName);
407425

408426
return IntPtr.Zero;
409427
}
@@ -419,7 +437,7 @@ public static int HGetFileInformationByHandle(IntPtr hFile, IntPtr lpFileInforma
419437

420438
if (result && _varchives.ContainsKey(hFile))
421439
{
422-
DebugLogger.DetailedWriteLine($"Overriding GetFileInformationByHandle for dummy file {hFile}");
440+
DebugLogger.DetailedWriteLine($">> Overriding GetFileInformationByHandle for dummy file {hFile}");
423441
_lpFileInformation.FileSizeHigh = (uint)(_varchives[hFile].Size >> 32);
424442
_lpFileInformation.FileSizeLow = (uint)(_varchives[hFile].Size & 0xffffffff);
425443

@@ -438,7 +456,7 @@ public static int HDuplicateHandle(IntPtr hSourceProcessHandle, IntPtr hSourceHa
438456
if (_varchives.ContainsKey(hSourceHandle))
439457
{
440458
_varchives[lpTargetHandle] = _varchives[hSourceHandle];
441-
DebugLogger.DetailedWriteLine($"Duplicating dummy handle {hSourceHandle} to {lpTargetHandle}");
459+
DebugLogger.DetailedWriteLine($">> Duplicating dummy handle {hSourceHandle} to {lpTargetHandle}");
442460
}
443461

444462
return 1;
@@ -450,7 +468,7 @@ public static uint HGetFileSize(IntPtr hFile, IntPtr lpFileSizeHigh)
450468

451469
if (_varchives.ContainsKey(hFile))
452470
{
453-
DebugLogger.WriteLine($"GetFileSize on dummy handle {hFile}");
471+
DebugLogger.WriteLine($">> GetFileSize on dummy handle {hFile}");
454472
ret = _varchives[hFile].GetFileSize(lpFileSizeHigh);
455473
}
456474

@@ -463,7 +481,7 @@ public static int HGetFileSizeEx(IntPtr hFile, IntPtr lpFileSize)
463481

464482
if (_varchives.ContainsKey(hFile))
465483
{
466-
DebugLogger.WriteLine($"GetFileSizeEx on dummy handle {hFile}");
484+
DebugLogger.WriteLine($">> GetFileSizeEx on dummy handle {hFile}");
467485
byte[] tmp = BitConverter.GetBytes(_varchives[hFile].Size);
468486
Util.CopyToIntPtr(tmp, lpFileSize, tmp.Length);
469487

FF7_Launcher/FF7_Launcher.cpp

+27
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
// FF7_Launcher.cpp : Defines the entry point for the application.
2+
//
3+
4+
#include <windows.h>
5+
#include "Resource.h"
6+
7+
int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow)
8+
{
9+
// Initialize the process start information
10+
STARTUPINFO si;
11+
PROCESS_INFORMATION pi;
12+
ZeroMemory(&si, sizeof(si));
13+
si.cb = sizeof(si);
14+
ZeroMemory(&pi, sizeof(pi));
15+
16+
// Start the process
17+
if (!CreateProcess(L"ff7_en.exe", NULL, NULL, NULL, FALSE, 0, NULL, NULL, &si, &pi)) return 1;
18+
19+
// Wait for the process to finish
20+
WaitForSingleObject(pi.hProcess, INFINITE);
21+
22+
// Close process and thread handles
23+
CloseHandle(pi.hProcess);
24+
CloseHandle(pi.hThread);
25+
26+
return 0;
27+
}

FF7_Launcher/FF7_Launcher.h

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
#pragma once
2+
3+
#include "resource.h"

FF7_Launcher/FF7_Launcher.ico

45.1 KB
Binary file not shown.

FF7_Launcher/FF7_Launcher.rc

3.25 KB
Binary file not shown.

0 commit comments

Comments
 (0)