forked from 0xDC00/scripts
-
Notifications
You must be signed in to change notification settings - Fork 0
/
NS_01001CC017BB2000_Aiyoku_no_Eustia.js
116 lines (108 loc) · 3.89 KB
/
NS_01001CC017BB2000_Aiyoku_no_Eustia.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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
// ==UserScript==
// @name [01001CC017BB2000] Aiyoku no Eustia
// @version 1.0.0
// @author Koukdw
// @description Yuzu
// * AUGUST
// * NxNeXAS
// *
// ==/UserScript==
const gameVer = '1.0.0';
const { setHook } = require('./libYuzu.js');
const mainHandler = trans.send(handler, '200+'); // join 200ms
setHook({
'1.0.0': {
[0x804BEFD0 - 0x80004000]: mainHandler, // x0 - name
[0x804BEFE8 - 0x80004000]: mainHandler, // x0 - dialogue
[0x804d043c - 0x80004000]: mainHandler, // x0 - choice
//[0x8051d290 - 0x80004000]: mainHandler, // x1 - dialogue + name at bottom
}
}[globalThis.gameVer = globalThis.gameVer ?? gameVer]);
function handler(regs) {
console.log('onEnter: ');
const address = regs[0].value; // x0
// let s = address.readUtf8String();
// // print rubi
// const rubis = s.matchAll(/(@r)([^@]+).([^\@]+)./g);
// for (const rubi of rubis) {
// console.log('rubi', rubi[3]);
// console.log('rube', rubi[2]);
// }
// // remove rubi
// s = s.replace(/(@r)([^@]+).([^\@]+)./g, '$2')
// .replace(/(^\x0C|^@v[A-Za-z\d_]+|@k|@p|@h[A-Za-z\d_]+|@t\d+|@s\d+|@m\d|@a|@b|@d)+/g, '')
// .replace(/(@n)+/g, ' ');
//console.log(hexdump(address, { header: false, ansi: false, length: 0x50 }));
let s = readString(address);
return s;
}
function readString(address) {
let s = address.readUtf8String();
const parts = s.split(/(?=@.)/g);
s = '';
let counter = 0;
while (counter < parts.length) {
const part = parts[counter];
if (part.startsWith('@') === false) {
s += part;
counter++;
continue;
}
const tag = part.substring(0, 2);
const content = part.substring(2);
switch (tag) {
// @v20372@s5050「くらえっ! セクシーービーーーーム!!」
// @v10446「や、や……やっ! @t0321@hHUBUKI_U101EG2やったあああああああ!!!」@k
case '@s':
case '@t':
s += content.substring(4);
counter++
continue;
// @v01856@m00@a「あと……大切な人と過ごした、忘れられない日々」
case '@m':
s += content.substring(2);
counter++
continue;
case '@n':
s += '\n' + content;
counter++
continue;
// あくあさんの肩の力が抜け、柔らかい笑みを向けてくる。@p@nそれを見た瞬間、僕の心臓が大きく跳ねた。@k
case '@b':
case '@a':
case '@p':
case '@k':
s += content;
counter++
continue;
// @v00095「うん、その………@t0242@hAQUA_A102TRあ、ありがとう」
// @vRYU_01100010「よう、作家先生のお出ましじゃないか」
case '@v':
case '@h':
s += content.replace(/[\w_-]+/g, '');
counter++
continue;
// 差し出された酒を遠慮なく@r呷@あお@る。
case '@r':
s += content + parts[counter + 2].substring(1);
counter += 3;
continue;
// @I771418──穢れた生き物を@I@
// @I771418──@r屠@ほふ@れ@I@
case '@I':
if (content == '@' || parts[counter + 1].substring(0, 2) == '@r') {
counter++
continue;
}
s += content.replace(/[\d+─]/g, '');
counter += 3;
continue;
default:
console.log('Unrecognized dialogue tag: ' + tag);
s += content;
counter++
continue;
}
}
return s;
}