From 9d498cf69edb02a76acc041cfa6ffcb7e6f5da29 Mon Sep 17 00:00:00 2001 From: ZeqMacaw Date: Sat, 5 Oct 2019 19:00:55 -0400 Subject: [PATCH 1/2] Test different fb option. --- Crowbar/Core/SteamAppInfos/GarrysModSteamAppInfo.vb | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Crowbar/Core/SteamAppInfos/GarrysModSteamAppInfo.vb b/Crowbar/Core/SteamAppInfos/GarrysModSteamAppInfo.vb index b24c9ee..5079d55 100644 --- a/Crowbar/Core/SteamAppInfos/GarrysModSteamAppInfo.vb +++ b/Crowbar/Core/SteamAppInfos/GarrysModSteamAppInfo.vb @@ -127,8 +127,9 @@ Public Class GarrysModSteamAppInfo ' the length of the arguments added to the length of the full path to the process must be less than 2080. ' On Windows 7 and later versions, the length must be less than 32699. lzmaExeProcess.StartInfo.FileName = TheApp.LzmaExePathFileName - lzmaExeProcess.StartInfo.Arguments = "e """ + gmaPathFileName + """ """ + processedPathFileName + """ -d25 -fb256" + 'lzmaExeProcess.StartInfo.Arguments = "e """ + gmaPathFileName + """ """ + processedPathFileName + """ -d25 -fb256" 'lzmaExeProcess.StartInfo.Arguments = "e """ + givenPathFileName + """ """ + processedPathFileName + """ -d25" + lzmaExeProcess.StartInfo.Arguments = "e """ + gmaPathFileName + """ """ + processedPathFileName + """ -d25 -fb32" #If DEBUG Then lzmaExeProcess.StartInfo.CreateNoWindow = False #Else From 2f3f36f6bbb493dc2e716711e20722ce381d92fb Mon Sep 17 00:00:00 2001 From: ZeqMacaw Date: Thu, 10 Oct 2019 10:30:07 -0400 Subject: [PATCH 2/2] Add 8 extra bytes to end of compressed GMA file. Without this fix, addon does not work on Garry's Mod dedicated server. Instead, it shows "Error! Item is not an addon!" in the log. --- .../SteamAppInfos/GarrysModSteamAppInfo.vb | 32 +++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/Crowbar/Core/SteamAppInfos/GarrysModSteamAppInfo.vb b/Crowbar/Core/SteamAppInfos/GarrysModSteamAppInfo.vb index 5079d55..0564012 100644 --- a/Crowbar/Core/SteamAppInfos/GarrysModSteamAppInfo.vb +++ b/Crowbar/Core/SteamAppInfos/GarrysModSteamAppInfo.vb @@ -102,6 +102,9 @@ Public Class GarrysModSteamAppInfo gmaPathFileName = item.ContentPathFolderOrFileName End If + Dim gmaFileInfo As New FileInfo(gmaPathFileName) + Dim uncompressedFileSize As UInt32 = CUInt(gmaFileInfo.Length) + 'NOTE: Compress GMA file for Garry's Mod before uploading it. ' Calling lzma.exe (outside of Crowbar) works (i.e. subscribed item can be used within Garry's Mod), but does not compress to same bytes as Garry's Mod gmpublish.exe. ' In tests, files were smaller, possibly because lzma.exe has newer compression code than what Garry's Mod gmpublish.exe has. @@ -144,6 +147,35 @@ Public Class GarrysModSteamAppInfo lzmaExeProcess.Close() End Try + ' Write 8 extra bytes after the lzma compressed data: 4 bytes for uncompressed file size and 4 magic bytes (BEEFCACE), both values in little-endian order. + Dim outputFileStream As FileStream = Nothing + Try + If File.Exists(processedPathFileName) Then + outputFileStream = New FileStream(processedPathFileName, FileMode.Open) + If outputFileStream IsNot Nothing Then + Dim inputFileWriter As BinaryWriter = Nothing + Try + inputFileWriter = New BinaryWriter(outputFileStream) + + inputFileWriter.Seek(0, SeekOrigin.End) + inputFileWriter.Write(uncompressedFileSize) + '-1091581234 BEEFCACE in little endian order: CE CA EF BE + inputFileWriter.Write(-1091581234) + Catch + Finally + If inputFileWriter IsNot Nothing Then + inputFileWriter.Close() + End If + End Try + End If + End If + Catch + Finally + If outputFileStream IsNot Nothing Then + outputFileStream.Close() + End If + End Try + Return processedPathFileName End Function