diff --git a/README.md b/README.md
index f6cb6b8..91bddf1 100644
--- a/README.md
+++ b/README.md
@@ -4,7 +4,7 @@
---
-
WeMod patcher allows you to get some WeMod features absolutely free. This script patches WeMod, thereby removing the daily usage limit (2h), etc.
+WeMod patcher allows you to get some WeMod Pro features absolutely free. This script patches WeMod, thereby removing the daily usage limit (2h), etc.
## 👾 No malware? Is it safe for me?
@@ -40,7 +40,7 @@ With this patch you will be able to use the latest version together with Pro.
2. **Run the script**
``` bash
bun install/npm install/yarn install/whatever you use
- npm ./unlocker.js
+ node ./unlocker.js
```
3. **Follow the instructions**
diff --git a/unlocker.js b/unlocker.js
index db11518..ef5b53e 100644
--- a/unlocker.js
+++ b/unlocker.js
@@ -6,7 +6,7 @@ const patchBySignature = require("./memoryScanner");
const regex = /getUserAccount\(\)\{.*?return\s+this\.#\w+\.fetch\(\{.*?\}\).*?\}/g;
-const asarPatch = "getUserAccount(){return this.#v.fetch({endpoint:\"/v3/account\",method:\"GET\",name:\"/v3/account\",collectMetrics:0}).then(response=>{response.subscription={period:\"yearly\",state:\"active\"};response.flags=78;return response;})}"
+const asarPatch = "getUserAccount(){return this.#.fetch({endpoint:\"/v3/account\",method:\"GET\",name:\"/v3/account\",collectMetrics:0}).then(response=>{response.subscription={period:\"yearly\",state:\"active\"};response.flags=78;return response;})}"
const signature = "E8 ?? ?? ?? ?? 85 C0 75 ?? F6 C3 01 74 ?? 48 89 F9 E8 ?? ?? ?? ??"
const patchBytes = [0x31]
const patchOffset = 0x5
@@ -40,6 +40,11 @@ const checkWeModPaths = (dir) => {
return fs.existsSync(dir) && fs.existsSync(path.join(dir, 'WeMod.exe')) && fs.existsSync(path.join(dir, 'resources'))
}
+function getFetchFieldName(code) {
+ const match = code.match(/this\.#([a-zA-Z_$][0-9a-zA-Z_$]*)\.fetch/);
+ return match ? match[1] : null;
+}
+
const patchAsar = unpackedPath => {
let items = fs.readdirSync(unpackedPath,{ withFileTypes: true })
items = items.filter(item => !item.isDirectory() && /^app-\w+/.test(item.name));
@@ -60,9 +65,18 @@ const patchAsar = unpackedPath => {
console.error(" - Multiple target functions found. Looks like the version is not supported")
throw new Error("Multiple target functions found");
}
+
+ const fetchFieldName = getFetchFieldName(matches[0]);
+ if(!fetchFieldName) {
+ console.error(" - Fetch field name not found")
+ throw new Error("Fetch field name not found");
+ }
+
+ const patch = asarPatch.replace(//g, fetchFieldName)
+
console.log(" - Found target function in: ", item.name)
console.log(" - Patching asar...")
- fs.writeFileSync(path.join(unpackedPath, item.name), data.replace(regex, asarPatch), {encoding: 'utf8'})
+ fs.writeFileSync(path.join(unpackedPath, item.name), data.replace(regex, patch), {encoding: 'utf8'})
console.log(" - Patch applied")
asarPatchApplied = true;
break;
@@ -153,7 +167,6 @@ if(fs.existsSync(defaultDir)) {
}
}
-
(async () => {
await prepare();
})();