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

Function check_magic_at

g2all/900/module/memtools.js:85–111  ·  view source on GitHub ↗
(p, is_text)

Source from the content-addressed store, hash-verified

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