[Kernel/CPU] Fix XEX version numbers not being output correctly
Couldn't find a way to get bitfields & byte-swapping to play well together, so this was the best I could come up with... at least the proper version numbers will show in the log file now :)
This commit is contained in:
parent
06f7617c57
commit
70c616fe27
|
@ -447,19 +447,15 @@ int XexModule::ApplyPatch(XexModule* module) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// byteswap versions because of bitfields...
|
auto& source_ver = patch_header->source_version;
|
||||||
xex2_version source_ver, target_ver;
|
auto& target_ver = patch_header->target_version;
|
||||||
source_ver.value =
|
|
||||||
xe::byte_swap<uint32_t>(patch_header->source_version.value);
|
|
||||||
|
|
||||||
target_ver.value =
|
|
||||||
xe::byte_swap<uint32_t>(patch_header->target_version.value);
|
|
||||||
|
|
||||||
XELOGI(
|
XELOGI(
|
||||||
"XEX patch applied successfully: base version: %d.%d.%d.%d, new "
|
"XEX patch applied successfully: base version: %d.%d.%d.%d, new "
|
||||||
"version: %d.%d.%d.%d",
|
"version: %d.%d.%d.%d",
|
||||||
source_ver.major, source_ver.minor, source_ver.build, source_ver.qfe,
|
source_ver.major(), source_ver.minor(), source_ver.build(),
|
||||||
target_ver.major, target_ver.minor, target_ver.build, target_ver.qfe);
|
source_ver.qfe(), target_ver.major(), target_ver.minor(),
|
||||||
|
target_ver.build(), target_ver.qfe());
|
||||||
} else {
|
} else {
|
||||||
XELOGE("XEX patch application failed, error code %d", result_code);
|
XELOGE("XEX patch application failed, error code %d", result_code);
|
||||||
}
|
}
|
||||||
|
|
|
@ -39,8 +39,8 @@ class XexModule : public xe::cpu::Module {
|
||||||
public:
|
public:
|
||||||
std::string name;
|
std::string name;
|
||||||
uint32_t id;
|
uint32_t id;
|
||||||
xe_xex2_version_t version;
|
xex2_version version;
|
||||||
xe_xex2_version_t min_version;
|
xex2_version min_version;
|
||||||
std::vector<ImportLibraryFn> imports;
|
std::vector<ImportLibraryFn> imports;
|
||||||
};
|
};
|
||||||
struct SecurityInfoContext {
|
struct SecurityInfoContext {
|
||||||
|
|
|
@ -551,16 +551,14 @@ void UserModule::Dump() {
|
||||||
sb.AppendFormat(" %s - %d imports\n", name,
|
sb.AppendFormat(" %s - %d imports\n", name,
|
||||||
(uint16_t)library->count);
|
(uint16_t)library->count);
|
||||||
|
|
||||||
// Manually byteswap these because of the bitfields.
|
auto& version = library->version;
|
||||||
xex2_version version, version_min;
|
auto& version_min = library->version_min;
|
||||||
version.value = xe::byte_swap<uint32_t>(library->version.value);
|
|
||||||
version_min.value =
|
sb.AppendFormat(" Version: %d.%d.%d.%d\n", version.major(),
|
||||||
xe::byte_swap<uint32_t>(library->version_min.value);
|
version.minor(), version.build(), version.qfe());
|
||||||
sb.AppendFormat(" Version: %d.%d.%d.%d\n", version.major,
|
sb.AppendFormat(" Min Version: %d.%d.%d.%d\n",
|
||||||
version.minor, version.build, version.qfe);
|
version_min.major(), version_min.minor(),
|
||||||
sb.AppendFormat(" Min Version: %d.%d.%d.%d\n", version_min.major,
|
version_min.build(), version_min.qfe());
|
||||||
version_min.minor, version_min.build,
|
|
||||||
version_min.qfe);
|
|
||||||
|
|
||||||
library_offset += library->size;
|
library_offset += library->size;
|
||||||
}
|
}
|
||||||
|
@ -742,12 +740,13 @@ void UserModule::Dump() {
|
||||||
if (library->imports.size() > 0) {
|
if (library->imports.size() > 0) {
|
||||||
sb.AppendFormat(" %s - %lld imports\n", library->name.c_str(),
|
sb.AppendFormat(" %s - %lld imports\n", library->name.c_str(),
|
||||||
library->imports.size());
|
library->imports.size());
|
||||||
sb.AppendFormat(" Version: %d.%d.%d.%d\n", library->version.major,
|
sb.AppendFormat(" Version: %d.%d.%d.%d\n", library->version.major(),
|
||||||
library->version.minor, library->version.build,
|
library->version.minor(), library->version.build(),
|
||||||
library->version.qfe);
|
library->version.qfe());
|
||||||
sb.AppendFormat(" Min Version: %d.%d.%d.%d\n",
|
sb.AppendFormat(" Min Version: %d.%d.%d.%d\n",
|
||||||
library->min_version.major, library->min_version.minor,
|
library->min_version.major(),
|
||||||
library->min_version.build, library->min_version.qfe);
|
library->min_version.minor(),
|
||||||
|
library->min_version.build(), library->min_version.qfe());
|
||||||
sb.AppendFormat("\n");
|
sb.AppendFormat("\n");
|
||||||
|
|
||||||
// Counts.
|
// Counts.
|
||||||
|
|
|
@ -14,16 +14,6 @@
|
||||||
|
|
||||||
#include "xenia/base/byte_order.h"
|
#include "xenia/base/byte_order.h"
|
||||||
|
|
||||||
union xe_xex2_version_t {
|
|
||||||
uint32_t value;
|
|
||||||
struct {
|
|
||||||
uint32_t major : 4;
|
|
||||||
uint32_t minor : 4;
|
|
||||||
uint32_t build : 16;
|
|
||||||
uint32_t qfe : 8;
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
enum xe_pe_section_flags_e : uint32_t {
|
enum xe_pe_section_flags_e : uint32_t {
|
||||||
kXEPESectionContainsCode = 0x00000020,
|
kXEPESectionContainsCode = 0x00000020,
|
||||||
kXEPESectionContainsDataInit = 0x00000040,
|
kXEPESectionContainsDataInit = 0x00000040,
|
||||||
|
@ -371,14 +361,13 @@ struct xex2_opt_file_format_info {
|
||||||
} compression_info;
|
} compression_info;
|
||||||
};
|
};
|
||||||
|
|
||||||
union xex2_version {
|
struct xex2_version {
|
||||||
xe::be<uint32_t> value;
|
xe::be<uint32_t> value;
|
||||||
struct {
|
|
||||||
uint32_t major : 4;
|
uint32_t qfe() const { return value & 0xFF; }
|
||||||
uint32_t minor : 4;
|
uint32_t build() const { return (value >> 8) & 0xFFFF; }
|
||||||
uint32_t build : 16;
|
uint32_t minor() const { return (value >> 24) & 0xF; }
|
||||||
uint32_t qfe : 8;
|
uint32_t major() const { return (value >> 28) & 0xF; }
|
||||||
};
|
|
||||||
};
|
};
|
||||||
|
|
||||||
struct xex2_opt_lan_key {
|
struct xex2_opt_lan_key {
|
||||||
|
@ -462,8 +451,8 @@ struct xex2_opt_delta_patch_descriptor {
|
||||||
|
|
||||||
struct xex2_opt_execution_info {
|
struct xex2_opt_execution_info {
|
||||||
xe::be<uint32_t> media_id; // 0x0
|
xe::be<uint32_t> media_id; // 0x0
|
||||||
xe::be<xex2_version> version; // 0x4
|
xex2_version version; // 0x4
|
||||||
xe::be<xex2_version> base_version; // 0x8
|
xex2_version base_version; // 0x8
|
||||||
xe::be<uint32_t> title_id; // 0xC
|
xe::be<uint32_t> title_id; // 0xC
|
||||||
uint8_t platform; // 0x10
|
uint8_t platform; // 0x10
|
||||||
uint8_t executable_table; // 0x11
|
uint8_t executable_table; // 0x11
|
||||||
|
|
Loading…
Reference in New Issue