-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Hearts of Iron IV support, rename repo
- Loading branch information
1 parent
028c9b3
commit 49cf18b
Showing
8 changed files
with
197 additions
and
90 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
all: build-windows build-linux | ||
|
||
build-windows: | ||
env GOOS=windows GOARCH=amd64 go build -o ./build/eu4-checksum-patcher-windows.exe *.go | ||
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/eu4-checksum-patcher-linux *.go | ||
env GOOS=linux GOARCH=amd64 go build -o ./build/universal-checksum-patcher-linux *.go |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,10 @@ | ||
module github.com/goshathebusiness/eu4-checksum-patcher | ||
|
||
go 1.19 | ||
|
||
require github.com/manifoldco/promptui v0.9.0 | ||
|
||
require ( | ||
github.com/chzyer/readline v0.0.0-20180603132655-2972be24d48e // indirect | ||
golang.org/x/sys v0.0.0-20181122145206-62eef0e2fa9b // indirect | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
github.com/chzyer/logex v1.1.10 h1:Swpa1K6QvQznwJRcfTfQJmTE72DqScAa40E+fbHEXEE= | ||
github.com/chzyer/logex v1.1.10/go.mod h1:+Ywpsq7O8HXn0nuIou7OrIPyXbp3wmkHB+jjWRnGsAI= | ||
github.com/chzyer/readline v0.0.0-20180603132655-2972be24d48e h1:fY5BOSpyZCqRo5OhCuC+XN+r/bBCmeuuJtjz+bCNIf8= | ||
github.com/chzyer/readline v0.0.0-20180603132655-2972be24d48e/go.mod h1:nSuG5e5PlCu98SY8svDHJxuZscDgtXS6KTTbou5AhLI= | ||
github.com/chzyer/test v0.0.0-20180213035817-a1ea475d72b1 h1:q763qf9huN11kDQavWsoZXJNW3xEE4JJyHa5Q25/sd8= | ||
github.com/chzyer/test v0.0.0-20180213035817-a1ea475d72b1/go.mod h1:Q3SI9o4m/ZMnBNeIyt5eFwwo7qiLfzFZmjNmxjkiQlU= | ||
github.com/manifoldco/promptui v0.9.0 h1:3V4HzJk1TtXW1MTZMP7mdlwbBpIinw3HztaIlYthEiA= | ||
github.com/manifoldco/promptui v0.9.0/go.mod h1:ka04sppxSGFAtxX0qhlYQjISsg9mR4GWtQEhdbn6Pgg= | ||
golang.org/x/sys v0.0.0-20181122145206-62eef0e2fa9b h1:MQE+LT/ABUuuvEZ+YQAMSXindAdUh7slEmAkup74op4= | ||
golang.org/x/sys v0.0.0-20181122145206-62eef0e2fa9b/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,40 @@ | ||
package main | ||
|
||
import "runtime" | ||
import ( | ||
"fmt" | ||
"runtime" | ||
|
||
"github.com/manifoldco/promptui" | ||
) | ||
|
||
func main() { | ||
|
||
originalFileName := "eu4" | ||
finalFileName := "eu4" | ||
prompt := promptui.Select{ | ||
Label: "Select game to patch", | ||
Items: []string{"Europa Universalis IV", "Hearts of Iron IV"}, | ||
} | ||
|
||
_, result, err := prompt.Run() | ||
|
||
if err != nil { | ||
fmt.Printf("Prompt failed %v\n", err) | ||
return | ||
} | ||
|
||
switch result { | ||
case "Europa Universalis IV": | ||
err = applyPatch(false, "eu4", runtime.GOOS) | ||
case "Hearts of Iron IV": | ||
err = applyPatch(false, "hoi4", runtime.GOOS) | ||
} | ||
|
||
applyPatch(false, originalFileName, finalFileName, runtime.GOOS) | ||
if err != nil { | ||
fmt.Println("ERROR:", err) | ||
fmt.Println("Patch not installed, no file has been changed") | ||
} else { | ||
fmt.Println("Patch successfully installed, your original executable has been backuped in [original name]_backup") | ||
} | ||
fmt.Println("Press enter to exit") | ||
fmt.Scanln() | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
package main | ||
|
||
import ( | ||
"os" | ||
"testing" | ||
) | ||
|
||
func TestApplyPatchEU4Windows(t *testing.T) { | ||
err := backupFile("./test_files/eu4/eu4_original.exe", "./test_files/eu4/eu4_test.exe") | ||
|
||
if err != nil { | ||
t.Error(err) | ||
} | ||
err = applyPatch(true, "./test_files/eu4/eu4_test", "windows") | ||
|
||
if err != nil { | ||
t.Error(err) | ||
} | ||
|
||
if !compareExes("./test_files/eu4/eu4_patched.exe", "./test_files/eu4/eu4_test.exe") { | ||
if err != nil { | ||
t.Error("Executables doesnt match") | ||
} | ||
} | ||
os.Remove("./test_files/eu4/eu4_test.exe") | ||
os.Remove("./test_files/eu4/eu4_test_backup.exe") | ||
os.Remove("./test_files/eu4/eu4.exe") | ||
} | ||
|
||
func TestApplyPatchEU4Linux(t *testing.T) { | ||
err := backupFile("./test_files/eu4/eu4_original", "./test_files/eu4/eu4_test") | ||
|
||
if err != nil { | ||
t.Error(err) | ||
} | ||
err = applyPatch(true, "./test_files/eu4/eu4_test", "linux") | ||
if err != nil { | ||
t.Error(err) | ||
} | ||
|
||
if !compareExes("./test_files/eu4/eu4_patched", "./test_files/eu4/eu4_test") { | ||
if err != nil { | ||
t.Error("Executables doesnt match") | ||
} | ||
} | ||
os.Remove("./test_files/eu4/eu4_test") | ||
os.Remove("./test_files/eu4/eu4_test_backup") | ||
os.Remove("./test_files/eu4/eu4") | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
package main | ||
|
||
import ( | ||
"os" | ||
"testing" | ||
) | ||
|
||
func TestApplyPatchHOI4Windows(t *testing.T) { | ||
err := backupFile("./test_files/hoi4/hoi4_original.exe", "./test_files/hoi4/hoi4_test.exe") | ||
|
||
if err != nil { | ||
t.Error(err) | ||
} | ||
err = applyPatch(true, "./test_files/hoi4/hoi4_test", "windows") | ||
|
||
if err != nil { | ||
t.Error(err) | ||
} | ||
|
||
if !compareExes("./test_files/hoi4/hoi4_patched.exe", "./test_files/hoi4/hoi4_test.exe") { | ||
if err != nil { | ||
t.Error("Executables doesnt match") | ||
} | ||
} | ||
os.Remove("./test_files/hoi4/hoi4_test.exe") | ||
os.Remove("./test_files/hoi4/hoi4_test_backup.exe") | ||
os.Remove("./test_files/hoi4/hoi4.exe") | ||
} | ||
|
||
// func TestApplyPatchHOILinux(t *testing.T) { | ||
// err := backupFile("./test_files/hoi4/hoi4_original", "./test_files/hoi4/hoi4_test") | ||
|
||
// if err != nil { | ||
// t.Error(err) | ||
// } | ||
// err = applyPatch(true, "./test_files/hoi4/hoi4_test", "linux") | ||
// if err != nil { | ||
// t.Error(err) | ||
// } | ||
|
||
// if !compareExes("./test_files/hoi4/hoi4_patched", "./test_files/hoi4/hoi4_test") { | ||
// if err != nil { | ||
// t.Error("Executables doesnt match") | ||
// } | ||
// } | ||
// os.Remove("./test_files/hoi4/hoi4_test") | ||
// os.Remove("./test_files/hoi4/hoi4_test_backup") | ||
// os.Remove("./test_files/hoi4/hoi4") | ||
|
||
// } |