mirror of
https://github.com/xenia-project/xenia.git
synced 2025-12-06 07:12:03 +01:00
Handling imports when modules aren't found.
This commit is contained in:
parent
dceb9550c9
commit
1c96941236
|
|
@ -123,8 +123,10 @@ bool XexModule::SetupLibraryImports(const xe_xex2_import_library_t* library) {
|
||||||
export_resolver->GetExportByOrdinal(library->name, info->ordinal);
|
export_resolver->GetExportByOrdinal(library->name, info->ordinal);
|
||||||
} else {
|
} else {
|
||||||
XModule* module = kernel_state_->GetModule(library->name);
|
XModule* module = kernel_state_->GetModule(library->name);
|
||||||
|
if (module) {
|
||||||
user_export_addr = module->GetProcAddressByOrdinal(info->ordinal);
|
user_export_addr = module->GetProcAddressByOrdinal(info->ordinal);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (kernel_export) {
|
if (kernel_export) {
|
||||||
if (info->thunk_address) {
|
if (info->thunk_address) {
|
||||||
|
|
@ -146,8 +148,8 @@ bool XexModule::SetupLibraryImports(const xe_xex2_import_library_t* library) {
|
||||||
var_info->set_status(SymbolInfo::STATUS_DEFINED);
|
var_info->set_status(SymbolInfo::STATUS_DEFINED);
|
||||||
|
|
||||||
// Grab, if available.
|
// Grab, if available.
|
||||||
if (kernel_export) {
|
|
||||||
auto slot = memory_->TranslateVirtual<uint32_t*>(info->value_address);
|
auto slot = memory_->TranslateVirtual<uint32_t*>(info->value_address);
|
||||||
|
if (kernel_export) {
|
||||||
if (kernel_export->type == KernelExport::Function) {
|
if (kernel_export->type == KernelExport::Function) {
|
||||||
// Not exactly sure what this should be...
|
// Not exactly sure what this should be...
|
||||||
if (info->thunk_address) {
|
if (info->thunk_address) {
|
||||||
|
|
@ -170,19 +172,19 @@ bool XexModule::SetupLibraryImports(const xe_xex2_import_library_t* library) {
|
||||||
kernel_export->name);
|
kernel_export->name);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else if (user_export_addr) {
|
||||||
auto slot = memory_->TranslateVirtual<uint32_t*>(info->value_address);
|
|
||||||
|
|
||||||
// Assuming this is correct...
|
|
||||||
xe::store_and_swap<uint32_t>(slot, user_export_addr);
|
xe::store_and_swap<uint32_t>(slot, user_export_addr);
|
||||||
|
} else {
|
||||||
|
// Nothing.
|
||||||
|
XELOGE("kernel import not found: %.8X", info->value_address);
|
||||||
|
*slot = xe::byte_swap(0xF00DF00D);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (info->thunk_address) {
|
if (info->thunk_address) {
|
||||||
if (kernel_export) {
|
if (kernel_export) {
|
||||||
snprintf(name, xe::countof(name), "%s", kernel_export->name);
|
snprintf(name, xe::countof(name), "%s", kernel_export->name);
|
||||||
} else if (user_export_addr) {
|
} else if (user_export_addr) {
|
||||||
snprintf(name, xe::countof(name), "__%s_%.3X", libname,
|
snprintf(name, xe::countof(name), "__%s_%.3X", libname, info->ordinal);
|
||||||
info->ordinal);
|
|
||||||
} else {
|
} else {
|
||||||
snprintf(name, xe::countof(name), "__kernel_%s_%.3X", libname,
|
snprintf(name, xe::countof(name), "__kernel_%s_%.3X", libname,
|
||||||
info->ordinal);
|
info->ordinal);
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue