Repository navigation
Expand file tree
/
Copy pathinstall.ps1
More file actions
49 lines (45 loc) · 2.48 KB
/
Copy pathinstall.ps1
File metadata and controls
49 lines (45 loc) · 2.48 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
# How to Fish Mod Menu installer.
# One-liner: irm https://raw.githubusercontent.com/JHVIW/HowToFish-ModMenu/main/install.ps1 | iex
# From clone: .\install.ps1 [-GameDir "D:\Games\How to Fish"]
# Adds BepInEx 5.4.23.5 (x64) and HTFMenu.dll. Nothing in the original game is modified; see uninstall.ps1.
param(
[string]$GameDir
)
$ErrorActionPreference = "Stop"
$Repo = "JHVIW/HowToFish-ModMenu"
function Find-GameDir {
$candidates = @("C:\Program Files (x86)\Steam\steamapps\common\How to Fish\How to Fish")
$vdf = "C:\Program Files (x86)\Steam\steamapps\libraryfolders.vdf"
if (Test-Path $vdf) {
foreach ($m in [regex]::Matches((Get-Content $vdf -Raw), '"path"\s+"([^"]+)"')) {
$candidates += (Join-Path ($m.Groups[1].Value -replace '\\\\', '\') "steamapps\common\How to Fish\How to Fish")
}
}
foreach ($c in $candidates) { if (Test-Path (Join-Path $c "How to Fish.exe")) { return $c } }
return $null
}
if (-not $GameDir) { $GameDir = Find-GameDir }
if (-not $GameDir -or -not (Test-Path (Join-Path $GameDir "How to Fish.exe"))) {
throw "Could not find 'How to Fish.exe'. Re-run with -GameDir '<folder containing How to Fish.exe>'."
}
if (Get-Process "How to Fish" -ErrorAction SilentlyContinue) { throw "Close the game first." }
Write-Host "Game folder: $GameDir"
if (-not (Test-Path (Join-Path $GameDir "BepInEx\core\BepInEx.dll"))) {
$zip = Join-Path $env:TEMP "BepInEx_win_x64_5.4.23.5.zip"
Write-Host "Downloading BepInEx 5.4.23.5..."
Invoke-WebRequest "https://github.com/BepInEx/BepInEx/releases/download/v5.4.23.5/BepInEx_win_x64_5.4.23.5.zip" -OutFile $zip -UseBasicParsing
Expand-Archive $zip -DestinationPath $GameDir -Force
}
$plugins = Join-Path $GameDir "BepInEx\plugins\HTFMenu"
New-Item -ItemType Directory -Force $plugins | Out-Null
$local = if ($PSScriptRoot) { Join-Path $PSScriptRoot "dist\HTFMenu.dll" } else { $null }
if ($local -and (Test-Path $local)) {
Copy-Item $local $plugins -Force
} else {
Write-Host "Downloading latest HTFMenu.dll..."
$rel = Invoke-RestMethod "https://api.github.com/repos/$Repo/releases/latest" -UseBasicParsing
$asset = $rel.assets | Where-Object { $_.name -eq "HTFMenu.dll" } | Select-Object -First 1
if (-not $asset) { throw "No HTFMenu.dll in the latest release." }
Invoke-WebRequest $asset.browser_download_url -OutFile (Join-Path $plugins "HTFMenu.dll") -UseBasicParsing
}
Write-Host "Done. Start How to Fish and press Right Shift to open the menu." -ForegroundColor Green