add update_dependency script

This commit is contained in:
2025-12-07 15:33:15 +11:00
parent b134834170
commit 62dc974fa7
4 changed files with 608 additions and 1 deletions

View File

@@ -54,7 +54,7 @@ Everything about spoofing ehre (steam name, server name, level...) will persist
* Infinite mirrors (Manor update) * Infinite mirrors (Manor update)
* Switch between realms (Manor update) * Switch between realms (Manor update)
* Farm Items x5 (host only) * Farm Items x5 (host only)
* recall function (Inspired by League of Legends, now you can use button B to teleport to the hidden place) * Radial Menu (Z)
* Customize Lobby (Public or Private, 1-64 room size, but when the number of players exceeds four, the game will have bugs) * Customize Lobby (Public or Private, 1-64 room size, but when the number of players exceeds four, the game will have bugs)
* 11 languages supported (English, 简体中文, Français, Deutsch, Español, 日本語, 한국어, Русский, Português, Italiano, Tiếng Việt) with in-game language switcher in Misc tab. Check it in misc table! * 11 languages supported (English, 简体中文, Français, Deutsch, Español, 日本語, 한국어, Русский, Português, Italiano, Tiếng Việt) with in-game language switcher in Misc tab. Check it in misc table!
* Due to the game update, I deleted "Steam name spoofer" and "Server name spoofer" these two functions.For "steam name spoofer", even changed your name by this function, your teamates can still see your name by steam profile, escape button, and your message in game.(by manafeng) * Due to the game update, I deleted "Steam name spoofer" and "Server name spoofer" these two functions.For "steam name spoofer", even changed your name by this function, your teamates can still see your name by steam profile, escape button, and your message in game.(by manafeng)
@@ -148,8 +148,11 @@ If you want to modify and develop the code, please follow the [Building from sou
* `C:\Program Files (x86)\Steam\steamapps\common\Devour\MelonLoader\Il2CppAssemblies\UnityEngine.PhysicsModule.dll` * `C:\Program Files (x86)\Steam\steamapps\common\Devour\MelonLoader\Il2CppAssemblies\UnityEngine.PhysicsModule.dll`
* `C:\Program Files (x86)\Steam\steamapps\common\Devour\MelonLoader\Il2CppAssemblies\Il2Cppcom.rlabrecque.steamworks.net.dll` * `C:\Program Files (x86)\Steam\steamapps\common\Devour\MelonLoader\Il2CppAssemblies\Il2Cppcom.rlabrecque.steamworks.net.dll`
* `C:\Program Files (x86)\Steam\steamapps\common\Devour\MelonLoader\Il2CppAssemblies\unity.TextMeshPro.dll` * `C:\Program Files (x86)\Steam\steamapps\common\Devour\MelonLoader\Il2CppAssemblies\unity.TextMeshPro.dll`
* `C:\Program Files (x86)\Steam\steamapps\common\Devour\MelonLoader\Il2CppAssemblies\UnityEngine.TextRenderingModule.dll`
8. Build the solutions in Release | Any CPU 8. Build the solutions in Release | Any CPU
**Note**: Now you can add these dependencies automatically by 'update_dependency' script.
## Contact ## Contact
You can add me on discord at _.patate or on the [discord server](https://discord.gg/2amMFvqjYd) You can add me on discord at _.patate or on the [discord server](https://discord.gg/2amMFvqjYd)

28
update_dependency.bat Normal file
View File

@@ -0,0 +1,28 @@
@echo off
chcp 65001 >nul
echo ========================================
echo DevourClient Dependency Path Update Script
echo ========================================
echo.
REM Check if PowerShell is available
powershell -Command "exit 0" >nul 2>&1
if errorlevel 1 (
echo Error: PowerShell not found, cannot run script
pause
exit /b 1
)
REM Run PowerShell script
powershell -ExecutionPolicy Bypass -File "%~dp0update_dependency.ps1"
if errorlevel 1 (
echo.
echo Script execution failed!
pause
exit /b 1
) else (
echo.
pause
)

296
update_dependency.ps1 Normal file
View File

@@ -0,0 +1,296 @@
# PowerShell script: Automatically update dependency paths in DevourClient.csproj (Windows)
# Function: Automatically find Devour installation path in Steam libraries and replace hardcoded paths in csproj file
param(
[string]$CsprojPath = "DevourClient\DevourClient.csproj"
)
Write-Host "========================================" -ForegroundColor Cyan
Write-Host "DevourClient Dependency Path Update Script" -ForegroundColor Cyan
Write-Host "========================================" -ForegroundColor Cyan
Write-Host ""
$DevourAppId = "1274570"
function Find-SteamLibraries {
$steamLibraries = @()
$defaultSteamPath = "${env:ProgramFiles(x86)}\Steam"
if (Test-Path $defaultSteamPath) {
$steamLibraries += $defaultSteamPath
} else {
$alternativePaths = @(
"${env:ProgramFiles}\Steam",
"$env:LOCALAPPDATA\Steam",
"C:\Steam",
"D:\Steam"
)
foreach ($altPath in $alternativePaths) {
if (Test-Path $altPath) {
$steamLibraries += $altPath
$defaultSteamPath = $altPath
break
}
}
}
$libraryFoldersPath = Join-Path $defaultSteamPath "steamapps\libraryfolders.vdf"
if (Test-Path $libraryFoldersPath) {
try {
$content = Get-Content $libraryFoldersPath -Raw -ErrorAction Stop
$pathPattern = '"path"\s+"([^"]+)"'
$pathMatches = [regex]::Matches($content, $pathPattern)
foreach ($match in $pathMatches) {
$libraryPath = $match.Groups[1].Value -replace '\\\\', '\'
if (Test-Path $libraryPath) {
$steamLibraries += $libraryPath
}
}
} catch {
Write-Host "Error reading libraryfolders.vdf: $($_.Exception.Message)" -ForegroundColor Red
}
} else {
$driveLetters = @("C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z")
foreach ($drive in $driveLetters) {
$pathsToCheck = @(
"${drive}:\SteamLibrary",
"${drive}:\Steam",
"${drive}:\steam",
"${drive}:\Steam\SteamLibrary",
"${drive}:\Games\Steam"
)
foreach ($checkPath in $pathsToCheck) {
if (Test-Path $checkPath) {
$steamappsPath = Join-Path $checkPath "steamapps"
if (Test-Path $steamappsPath) {
$steamLibraries += $checkPath
}
}
}
}
}
return $steamLibraries | Select-Object -Unique
}
function Find-DevourPathFromManifest {
param([string]$SteamLibraryPath)
$appManifestPath = Join-Path $SteamLibraryPath "steamapps\appmanifest_$DevourAppId.acf"
if (Test-Path $appManifestPath) {
$content = Get-Content $appManifestPath -Raw
$installDirPattern = '"installdir"\s+"([^"]+)"'
$installDirMatch = [regex]::Match($content, $installDirPattern)
if ($installDirMatch.Success) {
$installDir = $installDirMatch.Groups[1].Value
$devourPath = Join-Path $SteamLibraryPath "steamapps\common\$installDir"
if (Test-Path $devourPath) {
return $devourPath
}
}
}
return $null
}
$RequiredDependencies = @(
@{ Name = "0Harmony"; RelativePath = "steamapps\common\Devour\MelonLoader\net6\0Harmony.dll" },
@{ Name = "Assembly-CSharp"; RelativePath = "steamapps\common\Devour\MelonLoader\Il2CppAssemblies\Assembly-CSharp.dll" },
@{ Name = "Il2CppAstarPathfindingProject"; RelativePath = "steamapps\common\Devour\MelonLoader\Il2CppAssemblies\Il2CppAstarPathfindingProject.dll" },
@{ Name = "Il2CppBehaviorDesigner.Runtime"; RelativePath = "steamapps\common\Devour\MelonLoader\Il2CppAssemblies\Il2CppBehaviorDesigner.Runtime.dll" },
@{ Name = "Il2Cppbolt"; RelativePath = "steamapps\common\Devour\MelonLoader\Il2CppAssemblies\Il2Cppbolt.dll" },
@{ Name = "Il2Cppbolt.user"; RelativePath = "steamapps\common\Devour\MelonLoader\Il2CppAssemblies\Il2Cppbolt.user.dll" },
@{ Name = "Il2Cppcom.rlabrecque.steamworks.net"; RelativePath = "steamapps\common\Devour\MelonLoader\Il2CppAssemblies\Il2Cppcom.rlabrecque.steamworks.net.dll" },
@{ Name = "Il2CppInterop.Runtime"; RelativePath = "steamapps\common\Devour\MelonLoader\net6\Il2CppInterop.Runtime.dll" },
@{ Name = "Il2Cppmscorlib"; RelativePath = "steamapps\common\Devour\MelonLoader\Il2CppAssemblies\Il2Cppmscorlib.dll" },
@{ Name = "Il2CppOpsive.UltimateCharacterController"; RelativePath = "steamapps\common\Devour\MelonLoader\Il2CppAssemblies\Il2CppOpsive.UltimateCharacterController.dll" },
@{ Name = "Il2Cppudpkit"; RelativePath = "steamapps\common\Devour\MelonLoader\Il2CppAssemblies\Il2Cppudpkit.dll" },
@{ Name = "Il2Cppudpkit.common"; RelativePath = "steamapps\common\Devour\MelonLoader\Il2CppAssemblies\Il2Cppudpkit.common.dll" },
@{ Name = "Il2Cppudpkit.platform.photon"; RelativePath = "steamapps\common\Devour\MelonLoader\Il2CppAssemblies\Il2Cppudpkit.platform.photon.dll" },
@{ Name = "MelonLoader"; RelativePath = "steamapps\common\Devour\MelonLoader\net6\MelonLoader.dll" },
@{ Name = "Unity.TextMeshPro"; RelativePath = "steamapps\common\Devour\MelonLoader\Il2CppAssemblies\Unity.TextMeshPro.dll" },
@{ Name = "UnityEngine"; RelativePath = "steamapps\common\Devour\MelonLoader\Il2CppAssemblies\UnityEngine.dll" },
@{ Name = "UnityEngine.AnimationModule"; RelativePath = "steamapps\common\Devour\MelonLoader\Il2CppAssemblies\UnityEngine.AnimationModule.dll" },
@{ Name = "UnityEngine.CoreModule"; RelativePath = "steamapps\common\Devour\MelonLoader\Il2CppAssemblies\UnityEngine.CoreModule.dll" },
@{ Name = "UnityEngine.HotReloadModule"; RelativePath = "steamapps\common\Devour\MelonLoader\Il2CppAssemblies\UnityEngine.HotReloadModule.dll" },
@{ Name = "UnityEngine.IMGUIModule"; RelativePath = "steamapps\common\Devour\MelonLoader\Il2CppAssemblies\UnityEngine.IMGUIModule.dll" },
@{ Name = "UnityEngine.InputLegacyModule"; RelativePath = "steamapps\common\Devour\MelonLoader\Il2CppAssemblies\UnityEngine.InputLegacyModule.dll" },
@{ Name = "UnityEngine.PhysicsModule"; RelativePath = "steamapps\common\Devour\MelonLoader\Il2CppAssemblies\UnityEngine.PhysicsModule.dll" },
@{ Name = "UnityEngine.TextRenderingModule"; RelativePath = "steamapps\common\Devour\MelonLoader\Il2CppAssemblies\UnityEngine.TextRenderingModule.dll" },
@{ Name = "UnityEngine.UI"; RelativePath = "steamapps\common\Devour\MelonLoader\Il2CppAssemblies\UnityEngine.UI.dll" },
@{ Name = "UnityEngine.UIModule"; RelativePath = "steamapps\common\Devour\MelonLoader\Il2CppAssemblies\UnityEngine.UIModule.dll" }
)
function Find-DevourPath {
Write-Host "Searching for Devour installation path..." -ForegroundColor Yellow
$steamLibraries = Find-SteamLibraries
if ($steamLibraries.Count -eq 0) {
Write-Host "No Steam libraries found!" -ForegroundColor Red
Write-Host "Please check if Steam is installed." -ForegroundColor Yellow
return $null
}
$devourPath = $null
foreach ($library in $steamLibraries) {
$foundPath = Find-DevourPathFromManifest -SteamLibraryPath $library
if ($foundPath) {
$melonLoaderPath = Join-Path $foundPath "MelonLoader"
if (Test-Path $melonLoaderPath) {
$devourPath = $foundPath
Write-Host "Found Devour: $devourPath" -ForegroundColor Green
return $devourPath
}
}
}
foreach ($library in $steamLibraries) {
$possiblePath = Join-Path $library "steamapps\common\Devour"
if (Test-Path $possiblePath) {
$melonLoaderPath = Join-Path $possiblePath "MelonLoader"
if (Test-Path $melonLoaderPath) {
$devourPath = $possiblePath
Write-Host "Found Devour: $devourPath" -ForegroundColor Green
break
}
}
}
if (-not $devourPath) {
Write-Host "Devour installation path not found!" -ForegroundColor Red
Write-Host "Please ensure:" -ForegroundColor Yellow
Write-Host " 1. Devour is installed via Steam" -ForegroundColor Yellow
Write-Host " 2. MelonLoader is installed in the game" -ForegroundColor Yellow
Write-Host ""
return $null
}
return $devourPath
}
function Update-CsprojDependencies {
param(
[string]$CsprojContent,
[string]$DevourPath
)
[xml]$xmlDoc = $CsprojContent
$itemGroup = $xmlDoc.Project.ItemGroup | Where-Object { $null -ne $_.Reference } | Select-Object -First 1
if (-not $itemGroup) {
$itemGroup = $xmlDoc.CreateElement("ItemGroup")
$xmlDoc.Project.AppendChild($itemGroup) | Out-Null
}
$addedCount = 0
$updatedCount = 0
foreach ($dep in $RequiredDependencies) {
$relativePart = $dep.RelativePath -replace '^steamapps\\common\\Devour\\', ''
$fullPath = Join-Path $DevourPath $relativePart
$existingRef = $itemGroup.Reference | Where-Object { $_.Include -eq $dep.Name } | Select-Object -First 1
if ($existingRef) {
$hintPathNode = $existingRef.SelectSingleNode("HintPath")
if (-not $hintPathNode) {
$hintPathNode = $xmlDoc.CreateElement("HintPath")
$existingRef.AppendChild($hintPathNode) | Out-Null
}
$hintPathNode.InnerText = $fullPath
$updatedCount++
} else {
$newRef = $xmlDoc.CreateElement("Reference")
$newRef.SetAttribute("Include", $dep.Name)
$hintPathNode = $xmlDoc.CreateElement("HintPath")
$hintPathNode.InnerText = $fullPath
$newRef.AppendChild($hintPathNode) | Out-Null
$itemGroup.AppendChild($newRef) | Out-Null
$addedCount++
}
}
$stringWriter = New-Object System.IO.StringWriter
$xmlWriter = New-Object System.Xml.XmlTextWriter($stringWriter)
$xmlWriter.Formatting = [System.Xml.Formatting]::Indented
$xmlWriter.Indentation = 2
$xmlDoc.WriteContentTo($xmlWriter)
$xmlWriter.Flush()
$updatedContent = $stringWriter.ToString()
return @{
Content = $updatedContent
Added = $addedCount
Updated = $updatedCount
}
}
try {
if (-not (Test-Path $CsprojPath)) {
Write-Host "Error: csproj file not found: $CsprojPath" -ForegroundColor Red
exit 1
}
$devourPath = Find-DevourPath
if (-not $devourPath) {
exit 1
}
Write-Host ""
Write-Host "Updating csproj file..." -ForegroundColor Yellow
$csprojContent = Get-Content $CsprojPath -Raw -Encoding UTF8
$originalContent = $csprojContent
$oldPathPattern = '[A-Z]:\\SteamLibrary\\steamapps\\common\\Devour'
$escapedNewPath = $devourPath -replace '\\', '\\'
$csprojContent = $csprojContent -replace $oldPathPattern, $escapedNewPath
$result = Update-CsprojDependencies -CsprojContent $csprojContent -DevourPath $devourPath
$updatedContent = $result.Content
if ($originalContent -eq $updatedContent -and $result.Added -eq 0 -and $result.Updated -eq 0) {
Write-Host "Note: No changes needed (all dependencies are up to date)" -ForegroundColor Yellow
} else {
$backupPath = "$CsprojPath.backup"
Copy-Item $CsprojPath $backupPath -Force
Write-Host "Backup created: $backupPath" -ForegroundColor Gray
$fullPath = (Resolve-Path $CsprojPath).Path
[System.IO.File]::WriteAllText($fullPath, $updatedContent, [System.Text.Encoding]::UTF8)
Write-Host "Successfully updated csproj file!" -ForegroundColor Green
if ($result.Added -gt 0) {
Write-Host "Added $($result.Added) new dependency reference(s)" -ForegroundColor Cyan
}
if ($result.Updated -gt 0) {
Write-Host "Updated $($result.Updated) existing dependency reference(s)" -ForegroundColor Cyan
}
}
Write-Host ""
Write-Host "========================================" -ForegroundColor Cyan
Write-Host "Update completed!" -ForegroundColor Green
Write-Host "Devour path: $devourPath" -ForegroundColor Cyan
Write-Host "========================================" -ForegroundColor Cyan
} catch {
Write-Host ""
Write-Host "Error: $($_.Exception.Message)" -ForegroundColor Red
Write-Host $_.ScriptStackTrace -ForegroundColor Red
exit 1
}

280
update_dependency.sh Normal file
View File

@@ -0,0 +1,280 @@
#!/bin/bash
# Bash script: Automatically update dependency paths in DevourClient.csproj (macOS)
# Function: Automatically find Devour installation path in Steam libraries and replace hardcoded paths in csproj file
CSPROJ_PATH="${1:-DevourClient/DevourClient.csproj}"
echo "========================================"
echo "DevourClient Dependency Path Update Script"
echo "========================================"
echo ""
DEVOUR_APP_ID="1274570"
find_steam_libraries() {
local steam_libraries=()
local default_steam_path="$HOME/Library/Application Support/Steam"
if [ -d "$default_steam_path" ]; then
steam_libraries+=("$default_steam_path")
fi
local library_folders_path="$default_steam_path/steamapps/libraryfolders.vdf"
if [ -f "$library_folders_path" ]; then
while IFS= read -r line; do
if [[ $line =~ \"path\"[[:space:]]+\"([^\"]+)\" ]]; then
local library_path="${BASH_REMATCH[1]}"
library_path="${library_path//\\\\/\/}"
if [ -d "$library_path" ]; then
steam_libraries+=("$library_path")
fi
fi
done < "$library_folders_path"
fi
printf '%s\n' "${steam_libraries[@]}" | sort -u
}
find_devour_path_from_manifest() {
local steam_library_path="$1"
local app_manifest_path="$steam_library_path/steamapps/appmanifest_${DEVOUR_APP_ID}.acf"
if [ -f "$app_manifest_path" ]; then
local install_dir=$(grep -o '"installdir"[[:space:]]*"[^"]*"' "$app_manifest_path" | sed 's/.*"\([^"]*\)".*/\1/')
if [ -n "$install_dir" ]; then
local devour_path="$steam_library_path/steamapps/common/$install_dir"
if [ -d "$devour_path" ]; then
echo "$devour_path"
return 0
fi
fi
fi
return 1
}
declare -A REQUIRED_DEPENDENCIES=(
["0Harmony"]="steamapps/common/Devour/MelonLoader/net6/0Harmony.dll"
["Assembly-CSharp"]="steamapps/common/Devour/MelonLoader/Il2CppAssemblies/Assembly-CSharp.dll"
["Il2CppAstarPathfindingProject"]="steamapps/common/Devour/MelonLoader/Il2CppAssemblies/Il2CppAstarPathfindingProject.dll"
["Il2CppBehaviorDesigner.Runtime"]="steamapps/common/Devour/MelonLoader/Il2CppAssemblies/Il2CppBehaviorDesigner.Runtime.dll"
["Il2Cppbolt"]="steamapps/common/Devour/MelonLoader/Il2CppAssemblies/Il2Cppbolt.dll"
["Il2Cppbolt.user"]="steamapps/common/Devour/MelonLoader/Il2CppAssemblies/Il2Cppbolt.user.dll"
["Il2Cppcom.rlabrecque.steamworks.net"]="steamapps/common/Devour/MelonLoader/Il2CppAssemblies/Il2Cppcom.rlabrecque.steamworks.net.dll"
["Il2CppInterop.Runtime"]="steamapps/common/Devour/MelonLoader/net6/Il2CppInterop.Runtime.dll"
["Il2Cppmscorlib"]="steamapps/common/Devour/MelonLoader/Il2CppAssemblies/Il2Cppmscorlib.dll"
["Il2CppOpsive.UltimateCharacterController"]="steamapps/common/Devour/MelonLoader/Il2CppAssemblies/Il2CppOpsive.UltimateCharacterController.dll"
["Il2Cppudpkit"]="steamapps/common/Devour/MelonLoader/Il2CppAssemblies/Il2Cppudpkit.dll"
["Il2Cppudpkit.common"]="steamapps/common/Devour/MelonLoader/Il2CppAssemblies/Il2Cppudpkit.common.dll"
["Il2Cppudpkit.platform.photon"]="steamapps/common/Devour/MelonLoader/Il2CppAssemblies/Il2Cppudpkit.platform.photon.dll"
["MelonLoader"]="steamapps/common/Devour/MelonLoader/net6/MelonLoader.dll"
["Unity.TextMeshPro"]="steamapps/common/Devour/MelonLoader/Il2CppAssemblies/Unity.TextMeshPro.dll"
["UnityEngine"]="steamapps/common/Devour/MelonLoader/Il2CppAssemblies/UnityEngine.dll"
["UnityEngine.AnimationModule"]="steamapps/common/Devour/MelonLoader/Il2CppAssemblies/UnityEngine.AnimationModule.dll"
["UnityEngine.CoreModule"]="steamapps/common/Devour/MelonLoader/Il2CppAssemblies/UnityEngine.CoreModule.dll"
["UnityEngine.HotReloadModule"]="steamapps/common/Devour/MelonLoader/Il2CppAssemblies/UnityEngine.HotReloadModule.dll"
["UnityEngine.IMGUIModule"]="steamapps/common/Devour/MelonLoader/Il2CppAssemblies/UnityEngine.IMGUIModule.dll"
["UnityEngine.InputLegacyModule"]="steamapps/common/Devour/MelonLoader/Il2CppAssemblies/UnityEngine.InputLegacyModule.dll"
["UnityEngine.PhysicsModule"]="steamapps/common/Devour/MelonLoader/Il2CppAssemblies/UnityEngine.PhysicsModule.dll"
["UnityEngine.TextRenderingModule"]="steamapps/common/Devour/MelonLoader/Il2CppAssemblies/UnityEngine.TextRenderingModule.dll"
["UnityEngine.UI"]="steamapps/common/Devour/MelonLoader/Il2CppAssemblies/UnityEngine.UI.dll"
["UnityEngine.UIModule"]="steamapps/common/Devour/MelonLoader/Il2CppAssemblies/UnityEngine.UIModule.dll"
)
find_devour_path() {
echo "Searching for Devour installation path..." >&2
local steam_libraries
steam_libraries=$(find_steam_libraries)
if [ -z "$steam_libraries" ]; then
echo "No Steam libraries found!" >&2
echo "Please check if Steam is installed." >&2
return 1
fi
local devour_path=""
while IFS= read -r library; do
[ -z "$library" ] && continue
local found_path=$(find_devour_path_from_manifest "$library")
if [ -n "$found_path" ]; then
local melon_loader_path="$found_path/MelonLoader"
if [ -d "$melon_loader_path" ]; then
devour_path="$found_path"
echo "Found Devour: $devour_path" >&2
echo "$devour_path"
return 0
fi
fi
done <<< "$steam_libraries"
while IFS= read -r library; do
[ -z "$library" ] && continue
local possible_path="$library/steamapps/common/Devour"
if [ -d "$possible_path" ]; then
local melon_loader_path="$possible_path/MelonLoader"
if [ -d "$melon_loader_path" ]; then
devour_path="$possible_path"
echo "Found Devour: $devour_path" >&2
echo "$devour_path"
return 0
fi
fi
done <<< "$steam_libraries"
echo "Devour installation path not found!" >&2
echo "Please ensure:" >&2
echo " 1. Devour is installed via Steam" >&2
echo " 2. MelonLoader is installed in the game" >&2
echo "" >&2
return 1
}
update_csproj_dependencies() {
local csproj_file="$1"
local devour_path="$2"
python3 << EOF
import xml.etree.ElementTree as ET
import sys
import os
required_deps = {
"0Harmony": "steamapps/common/Devour/MelonLoader/net6/0Harmony.dll",
"Assembly-CSharp": "steamapps/common/Devour/MelonLoader/Il2CppAssemblies/Assembly-CSharp.dll",
"Il2CppAstarPathfindingProject": "steamapps/common/Devour/MelonLoader/Il2CppAssemblies/Il2CppAstarPathfindingProject.dll",
"Il2CppBehaviorDesigner.Runtime": "steamapps/common/Devour/MelonLoader/Il2CppAssemblies/Il2CppBehaviorDesigner.Runtime.dll",
"Il2Cppbolt": "steamapps/common/Devour/MelonLoader/Il2CppAssemblies/Il2Cppbolt.dll",
"Il2Cppbolt.user": "steamapps/common/Devour/MelonLoader/Il2CppAssemblies/Il2Cppbolt.user.dll",
"Il2Cppcom.rlabrecque.steamworks.net": "steamapps/common/Devour/MelonLoader/Il2CppAssemblies/Il2Cppcom.rlabrecque.steamworks.net.dll",
"Il2CppInterop.Runtime": "steamapps/common/Devour/MelonLoader/net6/Il2CppInterop.Runtime.dll",
"Il2Cppmscorlib": "steamapps/common/Devour/MelonLoader/Il2CppAssemblies/Il2Cppmscorlib.dll",
"Il2CppOpsive.UltimateCharacterController": "steamapps/common/Devour/MelonLoader/Il2CppAssemblies/Il2CppOpsive.UltimateCharacterController.dll",
"Il2Cppudpkit": "steamapps/common/Devour/MelonLoader/Il2CppAssemblies/Il2Cppudpkit.dll",
"Il2Cppudpkit.common": "steamapps/common/Devour/MelonLoader/Il2CppAssemblies/Il2Cppudpkit.common.dll",
"Il2Cppudpkit.platform.photon": "steamapps/common/Devour/MelonLoader/Il2CppAssemblies/Il2Cppudpkit.platform.photon.dll",
"MelonLoader": "steamapps/common/Devour/MelonLoader/net6/MelonLoader.dll",
"Unity.TextMeshPro": "steamapps/common/Devour/MelonLoader/Il2CppAssemblies/Unity.TextMeshPro.dll",
"UnityEngine": "steamapps/common/Devour/MelonLoader/Il2CppAssemblies/UnityEngine.dll",
"UnityEngine.AnimationModule": "steamapps/common/Devour/MelonLoader/Il2CppAssemblies/UnityEngine.AnimationModule.dll",
"UnityEngine.CoreModule": "steamapps/common/Devour/MelonLoader/Il2CppAssemblies/UnityEngine.CoreModule.dll",
"UnityEngine.HotReloadModule": "steamapps/common/Devour/MelonLoader/Il2CppAssemblies/UnityEngine.HotReloadModule.dll",
"UnityEngine.IMGUIModule": "steamapps/common/Devour/MelonLoader/Il2CppAssemblies/UnityEngine.IMGUIModule.dll",
"UnityEngine.InputLegacyModule": "steamapps/common/Devour/MelonLoader/Il2CppAssemblies/UnityEngine.InputLegacyModule.dll",
"UnityEngine.PhysicsModule": "steamapps/common/Devour/MelonLoader/Il2CppAssemblies/UnityEngine.PhysicsModule.dll",
"UnityEngine.TextRenderingModule": "steamapps/common/Devour/MelonLoader/Il2CppAssemblies/UnityEngine.TextRenderingModule.dll",
"UnityEngine.UI": "steamapps/common/Devour/MelonLoader/Il2CppAssemblies/UnityEngine.UI.dll",
"UnityEngine.UIModule": "steamapps/common/Devour/MelonLoader/Il2CppAssemblies/UnityEngine.UIModule.dll"
}
try:
tree = ET.parse("$csproj_file")
root = tree.getroot()
item_group = None
for ig in root.findall(".//ItemGroup"):
if ig.find("Reference") is not None:
item_group = ig
break
if item_group is None:
item_group = ET.SubElement(root, "ItemGroup")
added_count = 0
updated_count = 0
for dep_name, rel_path in required_deps.items():
relative_part = rel_path.replace("steamapps/common/Devour/", "")
full_path = os.path.join("$devour_path", relative_part)
existing_ref = None
for ref in item_group.findall("Reference"):
if ref.get("Include") == dep_name:
existing_ref = ref
break
if existing_ref is not None:
hint_path = existing_ref.find("HintPath")
if hint_path is None:
hint_path = ET.SubElement(existing_ref, "HintPath")
hint_path.text = full_path
updated_count += 1
else:
new_ref = ET.SubElement(item_group, "Reference")
new_ref.set("Include", dep_name)
hint_path = ET.SubElement(new_ref, "HintPath")
hint_path.text = full_path
added_count += 1
try:
ET.indent(tree, space=" ")
except AttributeError:
pass
tree.write("$csproj_file", encoding="utf-8", xml_declaration=True)
print(f"ADDED:{added_count}")
print(f"UPDATED:{updated_count}")
except Exception as e:
print(f"ERROR:{str(e)}", file=sys.stderr)
sys.exit(1)
EOF
}
if [ ! -f "$CSPROJ_PATH" ]; then
echo "Error: csproj file not found: $CSPROJ_PATH" >&2
exit 1
fi
DEVOUR_PATH=$(find_devour_path)
if [ $? -ne 0 ] || [ -z "$DEVOUR_PATH" ]; then
exit 1
fi
echo ""
echo "Updating csproj file..."
BACKUP_PATH="${CSPROJ_PATH}.backup"
cp "$CSPROJ_PATH" "$BACKUP_PATH"
echo "Backup created: $BACKUP_PATH"
sed -i '' "s|[A-Z]:\\\\SteamLibrary\\\\steamapps\\\\common\\\\Devour|$DEVOUR_PATH|g" "$CSPROJ_PATH" 2>/dev/null || \
sed -i "s|[A-Z]:\\\\SteamLibrary\\\\steamapps\\\\common\\\\Devour|$DEVOUR_PATH|g" "$CSPROJ_PATH"
RESULT=$(update_csproj_dependencies "$CSPROJ_PATH" "$DEVOUR_PATH")
if [ $? -ne 0 ]; then
echo "Error updating dependencies!" >&2
exit 1
fi
ADDED=$(echo "$RESULT" | grep "ADDED:" | cut -d: -f2)
UPDATED=$(echo "$RESULT" | grep "UPDATED:" | cut -d: -f2)
if [ -z "$ADDED" ]; then
ADDED=0
fi
if [ -z "$UPDATED" ]; then
UPDATED=0
fi
if [ "$ADDED" -eq 0 ] && [ "$UPDATED" -eq 0 ]; then
echo "Note: No changes needed (all dependencies are up to date)"
else
echo "Successfully updated csproj file!"
if [ "$ADDED" -gt 0 ]; then
echo "Added $ADDED new dependency reference(s)"
fi
if [ "$UPDATED" -gt 0 ]; then
echo "Updated $UPDATED existing dependency reference(s)"
fi
fi
echo ""
echo "========================================"
echo "Update completed!"
echo "Devour path: $DEVOUR_PATH"
echo "========================================"