mirror of
https://github.com/hedge-dev/XenonRecomp.git
synced 2025-07-22 21:17:14 +00:00
Fix import thunk resolving.
This commit is contained in:
@@ -11,7 +11,7 @@ void Image::Map(const std::string_view& name, size_t base, uint32_t size, uint8_
|
||||
|
||||
const void* Image::Find(size_t address) const
|
||||
{
|
||||
const auto section = sections.find(address);
|
||||
const auto section = sections.lower_bound(address);
|
||||
if (section == sections.end())
|
||||
{
|
||||
return nullptr;
|
||||
|
@@ -39,7 +39,7 @@ struct SectionComparer
|
||||
|
||||
bool operator()(const Section& lhs, size_t rhs) const
|
||||
{
|
||||
return rhs > lhs.base + lhs.size;
|
||||
return lhs.base < rhs;
|
||||
}
|
||||
|
||||
bool operator()(size_t lhs, const Section& rhs) const
|
||||
@@ -49,6 +49,6 @@ struct SectionComparer
|
||||
|
||||
bool operator()(const Section& lhs, const Section& rhs) const
|
||||
{
|
||||
return (lhs.base + lhs.size) < rhs.base;
|
||||
return lhs.base < rhs.base;
|
||||
}
|
||||
};
|
||||
|
@@ -101,12 +101,13 @@ Image Xex2LoadImage(const uint8_t* data)
|
||||
auto originalThunk = (XEX_THUNK_DATA*)image.Find(descriptors[im].FirstThunk);
|
||||
auto thunkType = originalThunk->Function >> 24;
|
||||
|
||||
if (thunkType == 1)
|
||||
if (thunkType != 0)
|
||||
{
|
||||
uint32_t thunk[4] = { 0x00000060, 0x00000060, 0x00000060, 0x2000804E };
|
||||
memcpy(originalThunk, thunk, sizeof(thunk));
|
||||
}
|
||||
}
|
||||
library = (XEX_IMPORT_LIBRARY*)((char*)(library + 1) + library->NumberOfImports * sizeof(XEX_IMPORT_DESCRIPTOR));
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user