Skip to content

Instantly share code, notes, and snippets.

Created December 22, 2017 22:34
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save anonymous/c5afa5b2c6d74b540317d9e74efbd2ee to your computer and use it in GitHub Desktop.
Save anonymous/c5afa5b2c6d74b540317d9e74efbd2ee to your computer and use it in GitHub Desktop.
disables shadows in acs.exe render pipeline for 1.14, 1.14.1, 1.14.2, 1.14.3, 1.14.4, 1.15, 1.15.1, 1.15.2, 1.16, 1.16.1
package main
import (
"crypto/sha256"
"fmt"
"io/ioutil"
"time"
)
const VERSION = "v0.7"
type BinaryInfo struct {
Version string
FunctionOffset int
Orig string
OrigOpcode byte
Patched string
PatchedOpcode byte
}
func checksum(buf []byte) string {
return fmt.Sprintf("%x", sha256.Sum256(buf))
}
func main() {
versions := []BinaryInfo{
BinaryInfo{
Version: "1.14",
FunctionOffset: 0x273e40,
Orig: "b1a22daf22ce49623a2d779b0f224c6381c59c3166b000385127b5bf6522b8e8",
OrigOpcode: 0x48,
Patched: "abb5feccd36f6f1af527a0f135271d88ffc72e1a0cad23aae1d59e35ce4d3f75",
PatchedOpcode: 0xc3,
},
BinaryInfo{
Version: "1.14.1",
FunctionOffset: 0x274290,
Orig: "fb3fe0bb72ddeb98a873b0a3e46efb7c366a4fbe59c3a18baae072eed48388e8",
OrigOpcode: 0x48,
Patched: "5eab91fcdaa0d5d3e55f49010154b98f7b828743df1efa3e7cd6dc137e733482",
PatchedOpcode: 0xc3,
},
BinaryInfo{
Version: "1.14.2",
FunctionOffset: 0x273f90,
Orig: "27b73890099945b9bf597ed28afb322f87f03349d2bd619dab87bbce09e72178",
OrigOpcode: 0x48,
Patched: "164db25ddc7c650e76403b3835eac0304849e7bc6350486df341f8693f991338",
PatchedOpcode: 0xc3,
},
BinaryInfo{
Version: "1.14.3",
FunctionOffset: 0x274530,
Orig: "d7faa332adf9c4b123d0666d9ce0f56e3be06463d84193ba4a03f3216261d85d",
OrigOpcode: 0x48,
Patched: "4e3267c1fb95c896006b8dc357b77438ad70b72cf12490f4b8653d2083640522",
PatchedOpcode: 0xc3,
},
BinaryInfo{
Version: "1.14.4",
FunctionOffset: 0x273ee0,
Orig: "c258a4b22b33fed749e530224b95f2aa8adfdeae2a0c8b894062f2be14010153",
OrigOpcode: 0x48,
Patched: "245e935a356cdc2bb99c6ee007ea76b82bfb78709c8db4da8155db2b80d3d9ca",
PatchedOpcode: 0xc3,
},
BinaryInfo{
Version: "1.15",
FunctionOffset: 0x20bb60,
Orig: "7de3155a014618d6372cd6e309d1cab110cb02b84812f0a7b3adda10f28fa527",
OrigOpcode: 0x48,
Patched: "aa7517e608e84a9575a21c47add8e7fe330a1afad4b800a256a15a56ad0716ea",
PatchedOpcode: 0xc3,
},
BinaryInfo{
Version: "1.15.1",
FunctionOffset: 0x20bb60,
Orig: "0494054b0a4e4010aa4a73ea6a99f1555af888fd81a45f4a272388d9588719b8",
OrigOpcode: 0x48,
Patched: "74b99fa7127baeb7af04bcecf4deeb63dab609dcd26d7d4143be14039603aa1f",
PatchedOpcode: 0xc3,
},
BinaryInfo{
Version: "1.15.2",
FunctionOffset: 0x20bd40,
Orig: "37cea2d7fb63ae85c4452873c0298b6f2dcb11fefbc0c41a7944f31fd825bf6b",
OrigOpcode: 0x48,
Patched: "0a1a4a147e4e50afba5f361040b37f015a2a3752084180e0dad6b8d4e61f497d",
PatchedOpcode: 0xc3,
},
BinaryInfo{
Version: "1.16",
FunctionOffset: 0x20ca20,
Orig: "ddc498ff9b9f8a85b1ab7b803714c5e6483969bf00cb240c0b89f377b985aaa0",
OrigOpcode: 0x48,
Patched: "b2501b16229eb2cbc137a4389b925337e2a62e1143faddad031219ae98815017",
PatchedOpcode: 0xc3,
},
BinaryInfo{
Version: "1.16.1",
FunctionOffset: 0x20ca20,
Orig: "12ff76a2fc02e377cbe2f5e574be8a0abd9b2142f38306dc44c7c431ca9a74b1",
OrigOpcode: 0x48,
Patched: "9fdbf07e9c751069533ff22067d01366acc7c53109454b9f366fb2b4be39b478",
PatchedOpcode: 0xc3,
},
}
filename := "acs.exe"
buf, err := ioutil.ReadFile(filename)
if err != nil {
fmt.Println(err)
return
}
fmt.Println("== Assetto Corsa Disable Shadows Patcher", VERSION)
current := checksum(buf)
var info BinaryInfo
for _, i := range versions {
if i.Orig == current || i.Patched == current {
info = i
break
}
}
if info.Version == "" {
fmt.Printf("acs.exe version not supported (only ")
for _, i := range versions {
fmt.Printf("[%s] ", i.Version)
}
fmt.Printf("supported)\n")
} else {
switch current {
case info.Orig:
fmt.Printf(" * found original acs.exe (version %s)\n * patching now..\n", info.Version)
buf[info.FunctionOffset] = info.PatchedOpcode
err = ioutil.WriteFile(filename, buf, 0755)
if err != nil {
fmt.Println(err)
return
}
fmt.Println("= successfully patched")
fmt.Println("\nrestart Assetto Corsa and enjoy VR without flickering shadows")
case info.Patched:
fmt.Printf(" * found patched acs.exe (version %s) \n * reverting back to original..\n", info.Version)
buf[info.FunctionOffset] = info.OrigOpcode
err = ioutil.WriteFile(filename, buf, 0755)
if err != nil {
fmt.Println(err)
return
}
fmt.Println("= successfully reverted back to original acs.exe")
fmt.Println("\nrestart Assetto Corsa and Shadows are rendered again")
}
}
time.Sleep(1 * time.Minute)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment