[XEX] - Add support for dash 1746
- Add support for dash 1746
This commit is contained in:
committed by
Radosław Gliński
parent
5cf409d6e5
commit
cdd60494d7
@@ -888,6 +888,21 @@ int XexModule::ReadPEHeaders() {
|
||||
|
||||
void XexModule::ReadSecurityInfo() {
|
||||
switch (xex_format_) {
|
||||
case kFormatXex25: {
|
||||
const xex25_security_info* xex25_sec_info =
|
||||
reinterpret_cast<const xex25_security_info*>(
|
||||
GetSecurityInfo(xex_header()));
|
||||
|
||||
security_info_.rsa_signature = xex25_sec_info->rsa_signature;
|
||||
security_info_.aes_key = xex25_sec_info->aes_key;
|
||||
security_info_.image_size = xex25_sec_info->image_size;
|
||||
security_info_.image_flags = xex25_sec_info->image_flags;
|
||||
security_info_.export_table = xex25_sec_info->export_table;
|
||||
security_info_.load_address = xex25_sec_info->load_address;
|
||||
security_info_.page_descriptor_count =
|
||||
xex25_sec_info->page_descriptor_count;
|
||||
security_info_.page_descriptors = xex25_sec_info->page_descriptors;
|
||||
} break;
|
||||
case kFormatXex1: {
|
||||
const xex1_security_info* xex1_sec_info =
|
||||
reinterpret_cast<const xex1_security_info*>(
|
||||
@@ -938,9 +953,9 @@ bool XexModule::Load(const std::string_view name, const std::string_view path,
|
||||
XELOGE("XEX- format not supported");
|
||||
return false;
|
||||
break;
|
||||
case kXEXPSignature:
|
||||
XELOGE("XEX% format not supported");
|
||||
return false;
|
||||
case kXEX25Signature:
|
||||
xex_format_ = kFormatXex25;
|
||||
XELOGE("Loading XEX%");
|
||||
break;
|
||||
case kXEX1Signature:
|
||||
xex_format_ = kFormatXex1;
|
||||
|
||||
@@ -28,7 +28,7 @@ namespace cpu {
|
||||
constexpr fourcc_t kXEX0Signature = make_fourcc("XEX0");
|
||||
constexpr fourcc_t kXEXQSignature = make_fourcc("XEX?");
|
||||
constexpr fourcc_t kXEXHSignature = make_fourcc("XEX-");
|
||||
constexpr fourcc_t kXEXPSignature = make_fourcc("XEX%");
|
||||
constexpr fourcc_t kXEX25Signature = make_fourcc("XEX%");
|
||||
constexpr fourcc_t kXEX1Signature = make_fourcc("XEX1");
|
||||
constexpr fourcc_t kXEX2Signature = make_fourcc("XEX2");
|
||||
constexpr fourcc_t kElfSignature = make_fourcc(0x7F, 'E', 'L', 'F');
|
||||
@@ -121,9 +121,9 @@ class XexModule : public xe::cpu::Module {
|
||||
enum XexFormat {
|
||||
kFormatUnknown,
|
||||
kFormatXex0,
|
||||
kFormatXexQ, // ?
|
||||
kFormatXexH, // -
|
||||
kFormatXexP, // %
|
||||
kFormatXexQ, // ?
|
||||
kFormatXexH, // -
|
||||
kFormatXex25, // %
|
||||
kFormatXex1,
|
||||
kFormatXex2,
|
||||
};
|
||||
|
||||
@@ -373,7 +373,7 @@ const std::unique_ptr<vfs::Device> Emulator::CreateVfsDevice(
|
||||
case FileSignatureType::XEX0:
|
||||
case FileSignatureType::XEXQ:
|
||||
case FileSignatureType::XEXH:
|
||||
case FileSignatureType::XEXP:
|
||||
case FileSignatureType::XEX25:
|
||||
case FileSignatureType::XEX1:
|
||||
case FileSignatureType::XEX2:
|
||||
case FileSignatureType::ELF: {
|
||||
@@ -499,8 +499,8 @@ Emulator::FileSignatureType Emulator::GetFileSignature(
|
||||
return FileSignatureType::XEXQ;
|
||||
case xe::cpu::kXEXHSignature:
|
||||
return FileSignatureType::XEXH;
|
||||
case xe::cpu::kXEXPSignature:
|
||||
return FileSignatureType::XEXP;
|
||||
case xe::cpu::kXEX25Signature:
|
||||
return FileSignatureType::XEX25;
|
||||
case xe::cpu::kXEX1Signature:
|
||||
return FileSignatureType::XEX1;
|
||||
case xe::cpu::kXEX2Signature:
|
||||
@@ -560,7 +560,7 @@ X_STATUS Emulator::LaunchPath(const std::filesystem::path& path) {
|
||||
case FileSignatureType::XEX0:
|
||||
case FileSignatureType::XEXQ:
|
||||
case FileSignatureType::XEXH:
|
||||
case FileSignatureType::XEXP:
|
||||
case FileSignatureType::XEX25:
|
||||
case FileSignatureType::XEX1:
|
||||
case FileSignatureType::XEX2:
|
||||
case FileSignatureType::ELF: {
|
||||
|
||||
@@ -204,7 +204,7 @@ class Emulator {
|
||||
XEX0,
|
||||
XEXQ,
|
||||
XEXH,
|
||||
XEXP,
|
||||
XEX25,
|
||||
XEX1,
|
||||
XEX2,
|
||||
ELF,
|
||||
|
||||
@@ -134,7 +134,7 @@ X_STATUS UserModule::LoadFromMemory(const void* addr, const size_t length) {
|
||||
magic.value = xe::load<fourcc_t>(addr);
|
||||
if (magic == xe::cpu::kXEX2Signature || magic == xe::cpu::kXEX1Signature ||
|
||||
magic == xe::cpu::kXEXQSignature || magic == xe::cpu::kXEXHSignature ||
|
||||
magic == xe::cpu::kXEXPSignature || magic == xe::cpu::kXEX0Signature) {
|
||||
magic == xe::cpu::kXEX25Signature || magic == xe::cpu::kXEX0Signature) {
|
||||
module_format_ = kModuleFormatXex;
|
||||
} else if (magic == xe::cpu::kElfSignature) {
|
||||
module_format_ = kModuleFormatElf;
|
||||
|
||||
@@ -829,6 +829,21 @@ struct xex1_security_info {
|
||||
xex2_page_descriptor page_descriptors[1];
|
||||
};
|
||||
|
||||
struct xex25_security_info {
|
||||
xe::be<uint32_t> header_size;
|
||||
xe::be<uint32_t> image_size;
|
||||
char rsa_signature[0x100];
|
||||
char image_digest[0x14];
|
||||
char import_table_digest[0x14];
|
||||
xe::be<uint32_t> load_address;
|
||||
char aes_key[0x10];
|
||||
xe::be<uint32_t> image_flags;
|
||||
xe::be<uint32_t> export_table;
|
||||
xe::be<uint32_t> allowed_media_types;
|
||||
xe::be<uint32_t> page_descriptor_count;
|
||||
xex2_page_descriptor page_descriptors[1];
|
||||
};
|
||||
|
||||
struct xex2_export_table {
|
||||
xe::be<uint32_t> magic[3]; // 0x0
|
||||
xe::be<uint32_t> modulenumber[2]; // 0xC
|
||||
|
||||
Reference in New Issue
Block a user