-
Notifications
You must be signed in to change notification settings - Fork 41
/
NS_010032300C562000_LoverPretend.js
49 lines (40 loc) · 1.47 KB
/
NS_010032300C562000_LoverPretend.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
// ==UserScript==
// @name [010032300C562000] LoverPretend / Lover Pretend
// @version 1.0.0
// @author Mansive
// @description Yuzu, Ryujinx
// * Design Factory Co., Ltd. & Otomate
// * Idea Factory Co., Ltd.
// ==/UserScript==
const gameVer = "1.0.0";
const { setHook } = require("./libYuzu.js");
const mainHandler = trans.send(handler, "200++");
const mainHandler2 = trans.send(handler, "200+");
const dictHandler = trans.send(handler, 300);
setHook(
{
"1.0.0": {
[0x80034ad0 - 0x80004000]: mainHandler.bind_(null, 0, "text"),
[0x8004e950 - 0x80004000]: mainHandler2.bind_(null, 1, "choices"),
[0x8002e6c4 - 0x80004000]: mainHandler.bind_(null, 0, "phone"),
// [0x8005f6c8 - 0x80004000]: dictHandler.bind_(null, 0, "word"),
[0x8005f6ec - 0x80004000]: dictHandler.bind_(null, 0, "meaning"),
},
}[(globalThis.gameVer = globalThis.gameVer ?? gameVer)]
);
let previous = "";
function handler(regs, index, hookname) {
// console.log("onEnter: ", hookname);
const address = regs[index].value;
// console.log(hexdump(address, { header: false, ansi: false, length: 0x50 }));
let s = address
.readUtf8String()
.replace(/(#Ruby\[)([^,]+),(#\w+\[.\])?(.+?])/g, "$2") // '#Ruby[光葉,#Type[2]こうよう]' to '光葉'
.replace(/#\w+(\[.+?\])?/g, "") // remove controls
.replace(/\u3000/gu, ""); // remove fullwidth whitespace
if (s === "" || s === previous) {
return null;
}
previous = s;
return s;
}