-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsetup-windows.ps1
More file actions
355 lines (284 loc) · 10.7 KB
/
setup-windows.ps1
File metadata and controls
355 lines (284 loc) · 10.7 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
#Requires -Version 5.0
<#
.SYNOPSIS
FF7 Remake Mods & Performance Configuration Installer for Windows
.DESCRIPTION
Automates installation of FFVIIHook, Luma upscaling mod, and Engine.ini configuration
for Final Fantasy VII Remake on Windows with Steam.
.PARAMETER GamePath
Path to FF7 Remake installation (e.g., "C:\Program Files (x86)\Steam\steamapps\common\FINAL FANTASY VII REMAKE")
Auto-detects if not provided.
.PARAMETER EngineLni
Path to Engine.ini file to deploy (default: ./Engine.ini in script directory)
.PARAMETER LumaOnly
Install only Luma mod, skip FFVIIHook and Engine.ini deployment
.PARAMETER SkipPackages
Skip all installations (used for testing/dry-run)
.PARAMETER SkipHook
Skip FFVIIHook (xinput1_3.dll) installation
.PARAMETER SkipLuma
Skip Luma mod installation
.PARAMETER SkipConfig
Skip Engine.ini deployment
.PARAMETER DryRun
Preview what would be done without making changes
.PARAMETER Help
Display this help information
.EXAMPLE
.\setup-windows.ps1
Uses auto-detected game path and ./Engine.ini
.EXAMPLE
.\setup-windows.ps1 -GamePath "C:\Games\FF7R" -EngineLni ".\Engine-full-res.ini"
Custom game path and ultra-graphics config
.EXAMPLE
.\setup-windows.ps1 -DryRun
Preview all planned installations
#>
param(
[string]$GamePath,
[string]$EngineLni,
[switch]$LumaOnly,
[switch]$SkipPackages,
[switch]$SkipHook,
[switch]$SkipLuma,
[switch]$SkipConfig,
[switch]$DryRun,
[switch]$Help
)
$ErrorActionPreference = "Stop"
$ScriptDir = Split-Path -Parent $MyInvocation.MyCommandPath
# ============================================================================
# Logging Functions
# ============================================================================
function Write-Log {
param([string]$Message, [string]$Type = "INFO")
$timestamp = Get-Date -Format "HH:mm:ss"
$prefix = "[$timestamp] [$Type]"
switch ($Type) {
"INFO" { Write-Host "$prefix $Message" -ForegroundColor Cyan }
"SUCCESS" { Write-Host "$prefix $Message" -ForegroundColor Green }
"ERROR" { Write-Host "$prefix $Message" -ForegroundColor Red }
"WARNING" { Write-Host "$prefix $Message" -ForegroundColor Yellow }
"DRY-RUN" { Write-Host "$prefix $Message" -ForegroundColor Magenta }
}
}
function Fail {
param([string]$Message)
Write-Log $Message "ERROR"
exit 1
}
# ============================================================================
# Help Display
# ============================================================================
function Show-Help {
Get-Help $PSCommandPath -Full
exit 0
}
if ($Help) { Show-Help }
# ============================================================================
# Auto-Detection Functions
# ============================================================================
function Find-GamePath {
Write-Log "Auto-detecting FF7 Remake installation..."
# Common Steam installation paths
$steamPaths = @(
"C:\Program Files (x86)\Steam\steamapps\common\FINAL FANTASY VII REMAKE",
"C:\Program Files\Steam\steamapps\common\FINAL FANTASY VII REMAKE"
)
# Check environment variable for custom Steam library
$steamRoot = $env:STEAMROOT
if ($steamRoot) {
$steamPaths += "$steamRoot\steamapps\common\FINAL FANTASY VII REMAKE"
}
# Check registry for Steam installation path
try {
$steamKey = Get-ItemProperty "HKCU:\Software\Valve\Steam" -ErrorAction SilentlyContinue
if ($steamKey.SteamPath) {
$baseSteam = $steamKey.SteamPath -replace '/', '\'
$steamPaths += "$baseSteam\steamapps\common\FINAL FANTASY VII REMAKE"
}
} catch {}
foreach ($path in $steamPaths) {
if (Test-Path "$path\End\Binaries\Win64") {
Write-Log "Found game at: $path" "SUCCESS"
return $path
}
}
Fail "Could not auto-detect game path. Please provide --GamePath parameter."
}
# ============================================================================
# File Validation
# ============================================================================
function Validate-Files {
Write-Log "Validating source files..."
# Validate Engine.ini only if we're deploying it
if (!$SkipConfig) {
if (!(Test-Path $EngineLni)) {
Fail "Engine.ini not found at: $EngineLni"
}
}
# Validate FFVIIHook DLL
if (!(Test-Path "$ScriptDir\FFVIIHook\xinput1_3.dll") -and !$SkipHook -and !$LumaOnly) {
Fail "FFVIIHook DLL not found at: $ScriptDir\FFVIIHook\xinput1_3.dll"
}
# Validate Luma zip
if (!(Test-Path "$ScriptDir\Luma-Final_Fantasy_VII_Remake-1974-2-6-1770058756.zip") -and !$SkipLuma -and !$SkipPackages) {
Fail "Luma mod zip not found at: $ScriptDir\Luma-Final_Fantasy_VII_Remake-1974-2-6-1770058756.zip"
}
Write-Log "All source files validated" "SUCCESS"
}
# ============================================================================
# Installation Functions
# ============================================================================
function Install-Hook {
param([string]$TargetPath)
if ($SkipHook -or $SkipPackages) {
Write-Log "Skipping FFVIIHook installation" "WARNING"
return
}
$dllSource = "$ScriptDir\FFVIIHook\xinput1_3.dll"
$dllDest = "$TargetPath\End\Binaries\Win64\xinput1_3.dll"
if ($DryRun) {
Write-Log "Would copy DLL: $dllSource -> $dllDest" "DRY-RUN"
return
}
Write-Log "Installing FFVIIHook (xinput1_3.dll)..."
Copy-Item -Path $dllSource -Destination $dllDest -Force
Write-Log "FFVIIHook installed successfully" "SUCCESS"
}
function Install-Luma {
param([string]$TargetPath)
if ($SkipLuma -or $SkipPackages) {
Write-Log "Skipping Luma installation" "WARNING"
return
}
$lumaZip = "$ScriptDir\Luma-Final_Fantasy_VII_Remake-1974-2-6-1770058756.zip"
$win64Path = "$TargetPath\End\Binaries\Win64"
$tempExtract = "$env:TEMP\Luma-Extract-$(Get-Random)"
if ($DryRun) {
Write-Log "Would extract Luma: $lumaZip -> $win64Path" "DRY-RUN"
return
}
try {
Write-Log "Extracting Luma mod..."
# Create temp directory for extraction
New-Item -ItemType Directory -Path $tempExtract -Force | Out-Null
# Extract zip
Expand-Archive -Path $lumaZip -DestinationPath $tempExtract -Force
# Copy all files from extracted archive to Win64 folder
$extractedFiles = Get-ChildItem -Path $tempExtract -Recurse -File
foreach ($file in $extractedFiles) {
$relativePath = $file.FullName.Substring($tempExtract.Length + 1)
$destFile = Join-Path $win64Path $relativePath
$destDir = Split-Path -Parent $destFile
if (!(Test-Path $destDir)) {
New-Item -ItemType Directory -Path $destDir -Force | Out-Null
}
Copy-Item -Path $file.FullName -Destination $destFile -Force
}
Write-Log "Luma installed successfully" "SUCCESS"
} finally {
if (Test-Path $tempExtract) {
Remove-Item -Path $tempExtract -Recurse -Force
}
}
}
function Deploy-EngineConfig {
param([string]$TargetPath)
if ($SkipConfig -or $SkipPackages) {
Write-Log "Skipping Engine.ini deployment" "WARNING"
return
}
# Windows config path
$configDir = "$env:USERPROFILE\Documents\My Games\FINAL FANTASY VII REMAKE\Saved\Config\WindowsNoEditor"
$configDest = "$configDir\Engine.ini"
if ($DryRun) {
Write-Log "Would copy Engine.ini: $EngineLni -> $configDest" "DRY-RUN"
return
}
Write-Log "Deploying Engine.ini configuration..."
# Create config directory if it doesn't exist
if (!(Test-Path $configDir)) {
New-Item -ItemType Directory -Path $configDir -Force | Out-Null
}
Copy-Item -Path $EngineLni -Destination $configDest -Force
Write-Log "Engine.ini deployed to: $configDest" "SUCCESS"
}
function Show-SteamLaunchOptions {
Write-Log ""
Write-Log "========================================" "INFO"
Write-Log "IMPORTANT: Steam Launch Options" "WARNING"
Write-Log "========================================" "INFO"
Write-Log ""
Write-Log "Luma requires this minimum launch option in Steam:"
Write-Log ""
Write-Log " -dx11" "SUCCESS"
Write-Log ""
Write-Log "1. Open Steam and right-click FINAL FANTASY VII REMAKE"
Write-Log "2. Click 'Properties' > 'General' > 'Launch Options'"
Write-Log "3. Paste the launch option above"
Write-Log ""
Write-Log "Optional: For better performance with NVIDIA GPU + overlays,"
Write-Log "use this instead:"
Write-Log ""
Write-Log " __NV_PRIME_RENDER_OFFLOAD=1 __GLX_VENDOR_LIBRARY_NAME=nvidia -dx11" "SUCCESS"
Write-Log ""
Write-Log "4. Once in-game, press Home or Insert to open Luma"
Write-Log " overlay and select your preferred upscaler."
Write-Log ""
}
# ============================================================================
# Main Execution
# ============================================================================
# Set defaults
if (!$EngineLni) {
$EngineLni = "$ScriptDir\Engine.ini"
}
# Handle LumaOnly flag
if ($LumaOnly) {
$SkipHook = $true
$SkipConfig = $true
}
# Resolve game path
if (!$GamePath) {
$GamePath = Find-GamePath
}
if (!(Test-Path $GamePath)) {
Fail "Game path does not exist: $GamePath"
}
if (!(Test-Path "$GamePath\End\Binaries\Win64")) {
Fail "Invalid game installation: Win64 directory not found at $GamePath\End\Binaries\Win64"
}
# Validate source files
Validate-Files
# Display dry-run header
if ($DryRun) {
Write-Log ""
Write-Log "========================================" "DRY-RUN"
Write-Log "DRY-RUN MODE (no changes will be made)" "DRY-RUN"
Write-Log "========================================" "DRY-RUN"
Write-Log ""
}
# Display configuration
Write-Log ""
Write-Log "Configuration:"
Write-Log " Game Path: $GamePath"
if (!$SkipConfig) {
Write-Log " Engine.ini: $EngineLni"
}
Write-Log " Install Hook: $(if ($SkipHook) { 'No' } else { 'Yes' })"
Write-Log " Install Luma: $(if ($SkipLuma) { 'No' } else { 'Yes' })"
Write-Log " Deploy Config: $(if ($SkipConfig) { 'No' } else { 'Yes' })"
Write-Log ""
# Execute installations
Install-Hook $GamePath
Install-Luma $GamePath
Deploy-EngineConfig $GamePath
# Show Steam launch options instructions
if (!$DryRun) {
Show-SteamLaunchOptions
Write-Log "Installation complete!" "SUCCESS"
} else {
Write-Log ""
Write-Log "Dry-run preview complete. No changes were made." "DRY-RUN"
}