-
Notifications
You must be signed in to change notification settings - Fork 41
/
NS_010037500DF38000_Gensou_Manege.js
58 lines (48 loc) · 1.49 KB
/
NS_010037500DF38000_Gensou_Manege.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
50
51
52
53
54
55
56
57
58
// ==UserScript==
// @name [010037500DF38000] Gensou Manège
// @version 1.0.4
// @author Mansive
// @description Yuzu, Ryujinx
// * LOVE&ART & MAGES. Inc.
// ==/UserScript==
const gameVer = "1.0.4";
const { setHook } = require("./libYuzu.js");
const mainHandler = trans.send(handler, "200++");
const choiceHandler = trans.send(handler, "200+");
setHook(
{
"1.0.4": {
[0x8124f690 - 0x80004000]: mainHandler.bind_(null, 0, "dialogue"),
[0x811f63f0 - 0x80004000]: mainHandler.bind_(null, 0, "prompt"),
[0x811917f4 - 0x80004000]: mainHandler.bind_(null, 0, "backlog"), // backlog accessed
[0x81595f90 - 0x80004000]: choiceHandler.bind_(null, 1, "choices"),
},
}[(globalThis.gameVer = globalThis.gameVer ?? gameVer)]
);
let open = true;
let timer = null;
let previous = "";
function handler(regs, index, hookname) {
// prevent backlog spam when rewinding to previous dialogue
if (open === false && hookname === "dialogue") {
clearTimeout(timer);
timer = setTimeout(() => {
open = true;
mainHandler(regs, index, hookname); // output most recent text
}, 200);
return null;
}
// culprits of backlog spam
if (hookname === "prompt" || hookname === "backlog") {
open = false;
return null;
}
const address = regs[index].value;
// console.log("onEnter: " + hookname);
let s = address.add(0x14).readUtf16String().replace(/\n/g, ""); // single line
if (s === previous) {
return null;
}
previous = s;
return s;
}