(sz, type = 4)
| 496 | } |
| 497 | |
| 498 | function malloc(sz, type = 4) { |
| 499 | let backing; |
| 500 | if (type == 1) { |
| 501 | backing = new Uint8Array(0x10000 + sz); |
| 502 | } else if (type == 2) { |
| 503 | backing = new Uint16Array(0x10000 + sz); |
| 504 | } else if (type == 4) { |
| 505 | backing = new Uint32Array(0x10000 + sz); |
| 506 | } |
| 507 | nogc.push(backing); |
| 508 | let ptr = p.read8(p.leakval(backing).add32(0x10)); |
| 509 | ptr.backing = backing; |
| 510 | return ptr; |
| 511 | } |
| 512 | |
| 513 | function array_from_address(addr, size) { |
| 514 | let og_array = new Uint32Array(0x1000); |