Implementing RtlImageXexHeaderField better.

This commit is contained in:
Ben Vanik 2013-05-25 00:08:01 -07:00
parent eac03765db
commit f3552ff9a5
1 changed files with 12 additions and 20 deletions

View File

@ -12,6 +12,7 @@
#include <xenia/kernel/shim_utils.h> #include <xenia/kernel/shim_utils.h>
#include <xenia/kernel/xbox.h> #include <xenia/kernel/xbox.h>
#include <xenia/kernel/xex2.h> #include <xenia/kernel/xex2.h>
#include <xenia/kernel/modules/xboxkrnl/objects/xmodule.h>
#include <xenia/kernel/modules/xboxkrnl/objects/xthread.h> #include <xenia/kernel/modules/xboxkrnl/objects/xthread.h>
@ -276,29 +277,20 @@ SHIM_CALL RtlImageXexHeaderField_shim(
return; return;
} }
// TODO(benvanik): pull from xex header XModule* module = NULL;
// module = GetExecutableModule() || (user defined one)
// header = module->xex_header() // TODO(benvanik): use xex_header_base to dereference this.
// for (n = 0; n < header->header_count; n++) { // Right now we are only concerned with games making this call on their main
// if (header->headers[n].key == ImageField) { // module, so this hack is fine.
// return value? or offset? module = state->GetExecutableModule();
// }
// }
uint32_t return_value = 0; uint32_t return_value = 0;
switch (image_field) { const xe_xex2_header_t* xex_header = module->xex_header();
case XEX_HEADER_DEFAULT_HEAP_SIZE: for (size_t n = 0; n < xex_header->header_count; n++) {
// TODO(benvanik): pull from running module if (xex_header->headers[n].key == image_field) {
// This is header->exe_heap_size. return_value = xex_header->headers[n].value;
//SHIM_SET_MEM_32(0x80101104, [some value]);
//return_value = 0x80101104;
return_value = 0;
break; break;
default: }
XELOGE("RtlImageXexHeaderField header field %.8X NOT IMPLEMENTED",
image_field);
SHIM_SET_RETURN(0);
return;
} }
SHIM_SET_RETURN(return_value); SHIM_SET_RETURN(return_value);