[CPU] Load alt-title-ids XEX header into XexModule::opt_alternate_title_ids_
This commit is contained in:
parent
fbf9c4630f
commit
c889a8af3f
|
@ -966,6 +966,16 @@ bool XexModule::LoadContinue() {
|
|||
return false;
|
||||
}
|
||||
|
||||
// Parse any "unsafe" headers into safer variants
|
||||
xex2_opt_generic_u32* alternate_titleids;
|
||||
if (GetOptHeader(xex2_header_keys::XEX_HEADER_ALTERNATE_TITLE_IDS,
|
||||
&alternate_titleids)) {
|
||||
auto count = alternate_titleids->count();
|
||||
for (uint32_t i = 0; i < count; i++) {
|
||||
opt_alternate_title_ids_.push_back(alternate_titleids->values[i]);
|
||||
}
|
||||
}
|
||||
|
||||
// Scan and find the low/high addresses.
|
||||
// All code sections are continuous, so this should be easy.
|
||||
auto heap = memory()->LookupHeap(base_address_);
|
||||
|
|
|
@ -107,6 +107,10 @@ class XexModule : public xe::cpu::Module {
|
|||
return retval;
|
||||
}
|
||||
|
||||
std::vector<uint32_t> opt_alternate_title_ids() const {
|
||||
return opt_alternate_title_ids_;
|
||||
}
|
||||
|
||||
const uint32_t base_address() const { return base_address_; }
|
||||
const bool is_dev_kit() const { return is_dev_kit_; }
|
||||
|
||||
|
@ -198,6 +202,9 @@ class XexModule : public xe::cpu::Module {
|
|||
import_libs_; // pre-loaded import libraries for ease of use
|
||||
std::vector<PESection> pe_sections_;
|
||||
|
||||
// XEX_HEADER_ALTERNATE_TITLE_IDS loaded into a safe std::vector
|
||||
std::vector<uint32_t> opt_alternate_title_ids_;
|
||||
|
||||
uint8_t session_key_[0x10];
|
||||
bool is_dev_kit_ = false;
|
||||
|
||||
|
|
|
@ -529,6 +529,13 @@ struct xex2_import_library {
|
|||
}
|
||||
};
|
||||
|
||||
struct xex2_opt_generic_u32 {
|
||||
xe::be<uint32_t> size;
|
||||
xe::be<uint32_t> values[1];
|
||||
|
||||
uint32_t count() const { return (size - 4) / 4; }
|
||||
};
|
||||
|
||||
struct xex2_opt_header {
|
||||
xe::be<uint32_t> key; // 0x0
|
||||
|
||||
|
|
Loading…
Reference in New Issue