From 5da0da19813dc9c09b5bc3cba5b7def2d0ff958b Mon Sep 17 00:00:00 2001 From: CakeLancelot Date: Thu, 9 Feb 2023 04:39:21 -0600 Subject: [PATCH] Consolidate afterPack scripts into one file --- build/4gb-patch.js | 19 ------------------- build/afterpack.js | 28 ++++++++++++++++++++++++++++ build/delete-default-app.js | 10 ---------- package.json | 5 +---- 4 files changed, 29 insertions(+), 33 deletions(-) delete mode 100644 build/4gb-patch.js create mode 100644 build/afterpack.js delete mode 100644 build/delete-default-app.js diff --git a/build/4gb-patch.js b/build/4gb-patch.js deleted file mode 100644 index 203ddaf..0000000 --- a/build/4gb-patch.js +++ /dev/null @@ -1,19 +0,0 @@ -const fs = require('fs'); -const file = './dist/win-ia32-unpacked/OpenFusionClient.exe' - -exports.default = async function() { - fs.open(file, "r+", (err, fd) => { - if(!err) { - fs.write( - fd, new Uint8Array([0x22]), 0, 1, 0x166, - (err) => { - if(err) { - throw err; - } - } - ); - } else { - throw err; - } - }); -} diff --git a/build/afterpack.js b/build/afterpack.js new file mode 100644 index 0000000..4ce113e --- /dev/null +++ b/build/afterpack.js @@ -0,0 +1,28 @@ +const fs = require('fs'); +const dir = './dist/win-ia32-unpacked/resources/default_app' +const exefile = './dist/win-ia32-unpacked/OpenFusionClient.exe' + +exports.default = function() { + // remove leftover files from default electron app + fs.rm(dir, { recursive: true }, (err) => { + if (err) { + throw err; + } + }); + // patch executable for large address awareness + fs.open(exefile, "r+", (err, fd) => { + if(!err) { + fs.write( + fd, new Uint8Array([0x22]), 0, 1, 0x166, + (err) => { + if(err) { + throw err; + } + fs.closeSync(fd); + } + ); + } else { + throw err; + } + }); +} diff --git a/build/delete-default-app.js b/build/delete-default-app.js deleted file mode 100644 index 4594616..0000000 --- a/build/delete-default-app.js +++ /dev/null @@ -1,10 +0,0 @@ -const fs = require('fs'); -const dir = './dist/win-ia32-unpacked/resources/default_app' - -exports.default = async function() { - fs.rm(dir, { recursive: true }, (err) => { - if (err) { - throw err; - } - }); -} diff --git a/package.json b/package.json index bc976c7..8c4aeec 100644 --- a/package.json +++ b/package.json @@ -67,10 +67,7 @@ "to": "utils" } ], - "afterPack": [ - "./build/4gb-patch.js", - "./build/delete-default-app.js" - ] + "afterPack": "./build/afterpack.js" }, "dependencies": { "fs-extra": "^0.30.0"