Skip to content

Commit

Permalink
Merge pull request #111 from BUTR/dev
Browse files Browse the repository at this point in the history
v1.5.7
  • Loading branch information
Aragas authored May 2, 2024
2 parents e74dcbc + 221e0ea commit cb145bb
Show file tree
Hide file tree
Showing 9 changed files with 55 additions and 370 deletions.
71 changes: 13 additions & 58 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ jobs:
gpu-hint:
name: Add GPU Hints
needs: [build]
runs-on: windows-latest
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

Expand All @@ -95,68 +95,13 @@ jobs:

- name: Add Dedicated GPU Hint
run: |
echo "Downloading ILAsm";
Invoke-WebRequest https://globalcdn.nuget.org/packages/runtime.win-x64.microsoft.netcore.ilasm.8.0.0.nupkg -OutFile ilasm.nupkg;
Invoke-WebRequest https://globalcdn.nuget.org/packages/runtime.win-x64.microsoft.netcore.ildasm.8.0.0.nupkg -OutFile ildasm.nupkg;
echo "Extracting ILAsm";
Expand-Archive ilasm.nupkg -d tools/ilasm;
Expand-Archive ildasm.nupkg -d tools/ildasm;
#echo "chmod ILAsm";
#chmod +x tools/ilasm/runtimes/linux-x64/native/ilasm;
#chmod +x tools/ildasm/runtimes/linux-x64/native/ildasm;
# So what is happening here?
# We're not able to export global variables from C#
# But ILAsm is able to do it
# So we compile our .exe files from C#
# Then we decompile them with ILDasm
# Then we compile them back to .exe with ILAsm and with the .il file for exporting the global variable
# Then we set the icon back because ILAsm doesn't support setting the icon
$workingDir = "$PWD";
mkdir tmp;
cd build/set-icon;
yarn install;
cd $workingDir;
dotnet tool install -g dotnet-script;
$fileNames = Get-ChildItem -Path "bannerlord/" -Recurse -Include *.exe;
foreach ($f in $fileNames) {
cd $workingDir/tmp;
echo $f.FullName;
$runtime = "";
If ($f.FullName.Contains("Win64_Shipping_Client")) {
$runtime = "Win64_Shipping_Client";
}
If ($f.FullName.Contains("Gaming.Desktop.x64_Shipping_Client")) {
$runtime = "Gaming.Desktop.x64_Shipping_Client";
}
$fileDirname = $f.DirectoryName;
$dirname = [System.IO.Path]::GetFileNameWithoutExtension($f.FullName);
New-Item -ItemType Directory -Path $dirname/$runtime -Force
cd $dirname/$runtime;
# Decompile to IL Code
& "$workingDir/tools/ildasm/runtimes/win-x64/native/ildasm.exe" "$f" /OUT=Code.il
#& "$workingDir/tools/ildasm/runtimes/linux-x64/native/ildasm" "$f" -OUT="Code.il"
Copy-Item -Path $workingDir/build/ForceDedicatedGraphicCard.il -Destination ForceDedicatedGraphicCard.il;
# Recompile to .exe
& "$workingDir/tools/ilasm/runtimes/win-x64/native/ilasm.exe" -QUIET -NOLOGO -OPTIMIZE -EXE /X64 -OUTPUT="$dirname.exe" Code.il ForceDedicatedGraphicCard.il
#& "$workingDir/tools/ilasm/runtimes/linux-x64/native/ilasm" -QUIET -NOLOGO -OPTIMIZE -EXE -X64 -OUTPUT="$dirname.exe" Code.il ForceDedicatedGraphicCard.il
# Set Icon
cd $workingDir/build/set-icon;
node index.js "$workingDir/tmp/$dirname/$runtime/$dirname.exe" "$workingDir/resources/BLSE_SMALL.ico";
Copy-Item -Path "$workingDir/tmp/$dirname/$runtime/$dirname.exe" -Destination "$fileDirname/$dirname.exe" -force
dotnet script build/gpu.csx -- "$f";
}
cd $workingDir;
rmdir tmp -Recurse -Force;
shell: pwsh

- name: Upload Bannerlord folder
Expand Down Expand Up @@ -221,3 +166,13 @@ jobs:
rootPath: build
depot1Path: ./artifact
releaseBranch: prerelease

cleanup-build-output:
name: Cleanup Build Output
needs: [publish-on-nexusmods, publish-on-github, publish-on-steam]
runs-on: ubuntu-latest
if: always()
steps:
- uses: joutvhu/delete-artifact@v2
with:
pattern: bannerlord-tmp-*
2 changes: 0 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -349,5 +349,3 @@ MigrationBackup/
# Ionide (cross platform F# VS Code tools) working folder
.ionide/
/src/.idea/*
/tmp/*
/tools/*
15 changes: 0 additions & 15 deletions build/ForceDedicatedGraphicCard.il

This file was deleted.

2 changes: 1 addition & 1 deletion build/common.props
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

<!--Development Variables-->
<PropertyGroup>
<Version>1.5.6</Version>
<Version>1.5.7</Version>
<HarmonyVersion>2.2.2</HarmonyVersion>
<BUTRSharedVersion>3.0.0.139</BUTRSharedVersion>
<BUTRModuleManagerVersion>5.0.222</BUTRModuleManagerVersion>
Expand Down
Loading

0 comments on commit cb145bb

Please sign in to comment.