forked from 0xDC00/scripts
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathNS_010014D01216E000_Rune_Factory_5.js
42 lines (34 loc) · 1.2 KB
/
NS_010014D01216E000_Rune_Factory_5.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
// ==UserScript==
// @name [010014D01216E000] Rune Factory 5
// @version 1.1.1
// @author [Kalleo]
// @description Yuzu
// * Marvelous, XSEED Games
// *
// ==/UserScript==
const gameVer = '1.1.1';
const { setHook } = require('./libYuzu.js');
const mainHandler = trans.send(handler, 200);
setHook({
'1.1.1': {
"H8293950d558a3cac": mainHandler.bind_(null, 1, "Main Text"),
"H9afedfb2d5101c93": mainHandler.bind_(null, 1, "Secondary Text"),
}
}, globalThis.gameVer = globalThis.gameVer ?? gameVer);
let previous = "";
function handler(regs, index, hookname) {
const address = regs[index].value;
// console.log('onEnter: ' + hookname);
/* processString */
//console.log(hexdump(address, { header: false, ansi: false, length: 0x50 }));
const len = address.add(0x10).readU32() * 2;
let s = address.add(0x14).readUtf16String(len);
s = s
.replace(/<[^>]*>/g, '') // Remove HTML tags
.replace(/^(?:そうび|はずす|もどる|もつ|おく|なげる|石|土|雑草|たべる)$(\r?\n|\r)?/gm, '') // Removing commands
if (s === previous) {
return;
}
previous = s;
return s;
}