diff options
| author | spv <aquaticvegetable@gmail.com> | 2022-04-20 15:22:48 -0400 |
|---|---|---|
| committer | spv <aquaticvegetable@gmail.com> | 2022-04-20 15:22:48 -0400 |
| commit | 6cc37a8aba5368bfe5e56725382268e517d96b03 (patch) | |
| tree | cd60effe0a4a9585c4f98622fbede0d81a53322e /js/call.js | |
| parent | 67d942f77c7c9a0967bacb0a69197641ce672d02 (diff) | |
function all the things
Diffstat (limited to 'js/call.js')
| -rw-r--r-- | js/call.js | 94 |
1 files changed, 47 insertions, 47 deletions
@@ -1,47 +1,47 @@ -var reserve_addr = 0x1a0000;
-var gettimeofday_addy = 0x34d63d3c;
-var slide = 0x0;
-var base = 0x0;
-
-function get_dyld_shc_slide() {
- return read_u32((slide << 12) + reserve_addr + 20);
-}
-
-function call(addy) {
- var dyld_shc_slide = get_dyld_shc_slide();
- var tmp = read_u32(gettimeofday_addy + dyld_shc_slide);
- write_u32(gettimeofday_addy + dyld_shc_slide, addy);
- var d = new Date();
- write_u32(gettimeofday_addy + dyld_shc_slide, tmp);
-}
-
-function call4arg(addy, r0, r1, r2, r3) {
- var arg1 = new Int64("0x" + pad_left(r1.toString(16), '0', 8) + pad_left(r0.toString(16), '0', 8));
- var arg2 = new Int64("0x" + pad_left(r3.toString(16), '0', 8) + pad_left(r2.toString(16), '0', 8));
- /*
- var arg2 = new Int64(r3);
- arg1 = shiftInt64Left(arg1, 32);
- arg1 = Add(arg1, r0);
- arg2 = shiftInt64Left(arg2, 32);
- arg2 = Add(arg2, r2);
- */
-
- arg1d = arg1.asDouble();
- arg2d = arg2.asDouble();
-
- delete arg1;
- delete arg2;
-
- var dyld_shc_slide = get_dyld_shc_slide();
-
- tmp = read_u32(0x346afc84 + dyld_shc_slide);
- write_u32(0x346afc84 + dyld_shc_slide, addy);
- ret = Math.atan2(arg1d, arg2d);
- write_u32(0x346afc84 + dyld_shc_slide, tmp);
-
- delete tmp;
- delete arg1d;
- delete arg2d;
-
- return (parseInt(Int64.fromDouble(ret)) & 0xffffffff) >>> 0;
-}
+var reserve_addr = 0x1a0000; +var gettimeofday_addy = 0x34d63d3c; +var slide = 0x0; +var base = 0x0; + +function get_dyld_shc_slide() { + return read_u32((slide << 12) + reserve_addr + 20); +} + +function call(addy) { + var dyld_shc_slide = get_dyld_shc_slide(); + var tmp = read_u32(gettimeofday_addy + dyld_shc_slide); + write_u32(gettimeofday_addy + dyld_shc_slide, addy); + var d = new Date(); + write_u32(gettimeofday_addy + dyld_shc_slide, tmp); +} + +function call4arg(addy, r0, r1, r2, r3) { + var arg1 = new Int64("0x" + pad_left(r1.toString(16), '0', 8) + pad_left(r0.toString(16), '0', 8)); + var arg2 = new Int64("0x" + pad_left(r3.toString(16), '0', 8) + pad_left(r2.toString(16), '0', 8)); + /* + var arg2 = new Int64(r3); + arg1 = shiftInt64Left(arg1, 32); + arg1 = Add(arg1, r0); + arg2 = shiftInt64Left(arg2, 32); + arg2 = Add(arg2, r2); + */ + + arg1d = arg1.asDouble(); + arg2d = arg2.asDouble(); + + delete arg1; + delete arg2; + + var dyld_shc_slide = get_dyld_shc_slide(); + + tmp = read_u32(0x346afc84 + dyld_shc_slide); + write_u32(0x346afc84 + dyld_shc_slide, addy); + ret = Math.atan2(arg1d, arg2d); + write_u32(0x346afc84 + dyld_shc_slide, tmp); + + delete tmp; + delete arg1d; + delete arg2d; + + return (parseInt(Int64.fromDouble(ret)) & 0xffffffff) >>> 0; +} |
