-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathscript.ts
More file actions
60 lines (51 loc) · 1.71 KB
/
script.ts
File metadata and controls
60 lines (51 loc) · 1.71 KB
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
let xeniabase = Module.getBaseAddress("xenia.exe");
let getinputstatePtr = xeniabase.add(0x2C7DDC); //find me pls
var callcount = -1;
var inputdata = {};
send("ready");
let rec_recv = recv("record",function(msg){
inputdata = msg.data;
});
rec_recv.wait();
console.log("Done Waiting");
var inp_index = 0;
// @ts-ignore
console.log(JSON.stringify(inputdata));
// @ts-ignore
let keys = Object.keys(inputdata);
var current_frame = 0;
// @ts-ignore
let current_inputs = inputdata[current_frame].inputs;
// @ts-ignore
let current_fc : number = inputdata[current_frame].frame;
Interceptor.attach(getinputstatePtr, {onEnter: function(args) {
// @ts-ignore
if (this.context.rdx.toInt32() == 0) {
// @ts-ignore
let stateptr = this.context.r15.add(4);
// @ts-ignore
if (callcount > current_fc) {
// @ts-ignore
inp_index += 1
if (inp_index >= Object.keys(inputdata).length) {
console.log("Done")
Interceptor.detachAll();
return;
} else {
// @ts-ignore
current_inputs = inputdata[keys[inp_index]].inputs;
// @ts-ignore
current_fc = inputdata[keys[inp_index]].frame;
console.log("Current next frame " + current_fc);
}
}
// @ts-ignore
stateptr.writeU16(current_inputs.buttons);
// @ts-ignore
stateptr.add(4).writeU16(current_inputs.LX);
// @ts-ignore
stateptr.add(6).writeU16(current_inputs.LY);
callcount++;
}
}
})