Execute module entry-point function if it has one.

This commit is contained in:
Dr. Chat 2015-05-08 20:48:21 -05:00
parent 94c62b91d0
commit 8deb622abb
1 changed files with 9 additions and 0 deletions

View File

@ -15,6 +15,8 @@
#include "xenia/kernel/xboxkrnl_private.h" #include "xenia/kernel/xboxkrnl_private.h"
#include "xenia/xbox.h" #include "xenia/xbox.h"
#include "xenia/cpu/processor.h"
namespace xe { namespace xe {
namespace kernel { namespace kernel {
@ -226,6 +228,13 @@ SHIM_CALL XexLoadImage_shim(PPCContext* ppc_state, KernelState* state) {
} else { } else {
XUserModule* usermod = state->LoadUserModule(module_name); XUserModule* usermod = state->LoadUserModule(module_name);
if (usermod) { if (usermod) {
// If the module has an entry point function, we have to call it.
const xe_xex2_header_t* header = usermod->xex_header();
if (header->exe_entry_point) {
state->processor()->Execute(ppc_state->thread_state,
header->exe_entry_point);
}
result = X_STATUS_SUCCESS; result = X_STATUS_SUCCESS;
usermod->RetainHandle(); usermod->RetainHandle();