| 84 | |
| 85 | // these values came from analyzing dumps from CelesteBlue |
| 86 | function check_magic_at(p, is_text) { |
| 87 | // byte sequence that is very likely to appear at offset 0 of a .text |
| 88 | // segment |
| 89 | const text_magic = [new Int(0xe5894855, 0x56415741), new Int(0x54415541, 0x8d485053)]; |
| 90 | |
| 91 | // the .data "magic" is just a portion of the PT_SCE_MODULE_PARAM segment |
| 92 | |
| 93 | // .data magic from 3.00, 6.00, and 6.20 |
| 94 | //const data_magic = [ |
| 95 | // new Int(0x18), |
| 96 | // new Int(0x3c13f4bf, 0x1), |
| 97 | //]; |
| 98 | |
| 99 | // .data magic from 8.00 and 8.03 |
| 100 | const data_magic = [new Int(0x20), new Int(0x3c13f4bf, 0x2)]; |
| 101 | |
| 102 | const magic = is_text ? text_magic : data_magic; |
| 103 | const value = [p.read64(0), p.read64(8)]; |
| 104 | |
| 105 | return value[0].eq(magic[0]) && value[1].eq(magic[1]); |
| 106 | } |
| 107 | |
| 108 | // Finds the base address of a segment: .text or .data |
| 109 | // Used on the ps4 to locate module base addresses |