From 64b44d758c7e806179675b6b4c333304409e9977 Mon Sep 17 00:00:00 2001 From: Illia Yalovoi Date: Sat, 15 Jul 2023 08:35:16 +0300 Subject: [PATCH] Testing MacOS support for EU4 --- Makefile | 10 ++++++++-- README.md | 2 +- patch.go | 11 +++++++++++ 3 files changed, 20 insertions(+), 3 deletions(-) diff --git a/Makefile b/Makefile index 3313372..6b56d9b 100644 --- a/Makefile +++ b/Makefile @@ -1,7 +1,13 @@ -all: build-windows build-linux +all: build-windows build-linux build-macos-amd64 build-macos-arm64 build-windows: env GOOS=windows GOARCH=amd64 go build -o ./build/universal-checksum-patcher-windows.exe *.go build-linux: - env GOOS=linux GOARCH=amd64 go build -o ./build/universal-checksum-patcher-linux *.go \ No newline at end of file + env GOOS=linux GOARCH=amd64 go build -o ./build/universal-checksum-patcher-linux *.go + +build-macos-amd64: + env GOOS=darwin GOARCH=amd64 go build -o ./build/universal-checksum-patcher-macos-amd64 *.go + +build-macos-arm64: + env GOOS=darwin GOARCH=arm64 go build -o ./build/universal-checksum-patcher-macos-arm64 *.go \ No newline at end of file diff --git a/README.md b/README.md index ac0021f..3ab73f3 100644 --- a/README.md +++ b/README.md @@ -15,7 +15,7 @@ Conrats, you done! In case you see unsupported version error most likely Paradox # Supported games and platforms | | Windows | Linux | MacOS | | ---| --- | ---| --- | -| Europa Universalis IV | Yes :heavy_check_mark: | Yes :heavy_check_mark: | No :x: | +| Europa Universalis IV | Yes :heavy_check_mark: | Yes :heavy_check_mark: | Maybe | | Hearts of Iron IV | Yes :heavy_check_mark: | No :x: | No :x: | MacOS will be supported, if someone provide me executable files for analysis. \ No newline at end of file diff --git a/patch.go b/patch.go index 8cb5b51..1d97ecc 100644 --- a/patch.go +++ b/patch.go @@ -61,11 +61,15 @@ func applyPatch(test bool, originalFileName, OS string) error { var hexWantedWindows []string var hexExistsLinux []string var hexWantedLinux []string + var hexExistsDarwin []string + var hexWantedDarwin []string // EU4 hexExistsEU4Windows := []string{"48", "8D", "0D", "??", "??", "??", "01", "E8", "??", "??", "??", "01", "85", "C0", "0F", "94", "C3", "E8"} hexWantedEU4Windows := []string{"48", "8D", "0D", "??", "??", "??", "01", "E8", "??", "??", "??", "01", "31", "C0", "0F", "94", "C3", "E8"} hexExistsEU4Linux := []string{"E8", "65", "95", "E5", "FF", "89", "C3", "E8", "38", "08", "EC", "FF", "31", "F6", "85", "DB", "40", "0F", "94", "C6", "48", "89", "C7"} hexWantedEU4Linux := []string{"E8", "65", "95", "E5", "FF", "89", "C3", "E8", "38", "08", "EC", "FF", "31", "F6", "31", "DB", "40", "0F", "94", "C6", "48", "89", "C7"} + hexExistsEU4Darwin := []string{"E8", "7A", "C5", "76", "01", "89", "01", "89", "C3", "E8", "93", "A6", "EC", "FF", "31", "F6", "85", "DB", "40", "0F", "94", "C6", "48", "89", "C7"} + hexWantedEU4Darwin := []string{"E8", "7A", "C5", "76", "01", "89", "01", "89", "C3", "E8", "93", "A6", "EC", "FF", "31", "F6", "31", "DB", "40", "0F", "94", "C6", "48", "89", "C7"} // HOI4 hexExistsHOI4Windows := []string{"48", "8D", "0D", "77", "B6", "C9", "01", "E8", "CA", "86", "B3", "01", "85", "C0", "0F", "94", "C3", "E8", "90"} hexWantedHOI4Windows := []string{"48", "8D", "0D", "77", "B6", "C9", "01", "E8", "CA", "86", "B3", "01", "31", "C0", "0F", "94", "C3", "E8", "90"} @@ -78,6 +82,9 @@ func applyPatch(test bool, originalFileName, OS string) error { hexExistsLinux = hexExistsEU4Linux hexWantedLinux = hexWantedEU4Linux + + hexExistsDarwin = hexExistsEU4Darwin + hexWantedDarwin = hexWantedEU4Darwin } else if strings.Contains(originalFileName, "hoi4") { if OS == "linux" { @@ -103,6 +110,10 @@ func applyPatch(test bool, originalFileName, OS string) error { fileExtension = "" hexExists = hexExistsLinux hexWanted = hexWantedLinux + case "darwin": + fileExtension = "" + hexExists = hexExistsDarwin + hexWanted = hexWantedDarwin default: fileExtension = "" return fmt.Errorf("this OS (%s) is not supported", OS)