MCPcopy Create free account
hub / github.com/GamerHack/GamerHack.github.io / check_magic_at

Function check_magic_at

g2all/700/module/memtools.js:86–106  ·  view source on GitHub ↗
(p, is_text)

Source from the content-addressed store, hash-verified

84
85// these values came from analyzing dumps from CelesteBlue
86function 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

Callers 1

find_baseFunction · 0.70

Calls 2

read64Method · 0.45
eqMethod · 0.45

Tested by

no test coverage detected