MCPcopy Create free account
hub / github.com/GDRETools/gdsdecomp / is_macho_binary

Method is_macho_binary

utility/common.cpp:1487–1510  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1485}
1486
1487bool gdre::is_macho_binary(const String &p_path) {
1488 Ref<FileAccess> fa = FileAccess::open(p_path, FileAccess::READ);
1489 if (fa.is_null()) {
1490 return false;
1491 }
1492 uint8_t header[4];
1493 fa->get_buffer(header, 4);
1494 fa->close();
1495 if ((header[0] == 0xcf || header[0] == 0xce) && header[1] == 0xfa && header[2] == 0xed && header[3] == 0xfe) {
1496 return true;
1497 }
1498
1499 // handle fat binaries
1500 // always stored in big-endian format
1501 if (header[0] == 0xca && header[1] == 0xfe && header[2] == 0xba && header[3] == 0xbe) {
1502 return true;
1503 }
1504 // handle big-endian mach-o binaries
1505 if (header[0] == 0xfe && header[1] == 0xed && header[2] == 0xfa && (header[3] == 0xce || header[3] == 0xcf)) {
1506 return true;
1507 }
1508
1509 return false;
1510}
1511
1512bool gdre::is_fs_path(const String &p_path) {
1513 if (!p_path.is_absolute_path()) {

Callers

nothing calls this directly

Calls 2

get_bufferMethod · 0.45
closeMethod · 0.45

Tested by

no test coverage detected