mirror of
https://github.com/Laupetin/OpenAssetTools.git
synced 2026-01-24 08:53:04 +00:00
chore: fix annoying IW4 cross-type pointer reusage with dirty hack
The game reuses pointer across different types as long as bytes and size matches This leads to non-pointer and pointer types being reused To fix this loading code now handles block memory offsets by nulling and block offsets to non-block data with pointing to raw block data The behaviour only seems to realistically happen on nulled memory
This commit is contained in:
@@ -0,0 +1,19 @@
|
||||
#include "InvalidLookupPositionException.h"
|
||||
|
||||
#include <format>
|
||||
|
||||
InvalidLookupPositionException::InvalidLookupPositionException(block_t block, size_t offset)
|
||||
: m_block(block),
|
||||
m_offset(offset)
|
||||
{
|
||||
}
|
||||
|
||||
std::string InvalidLookupPositionException::DetailedMessage()
|
||||
{
|
||||
return std::format("Zone tried to lookup at block {}, offset {} that was not recorded", m_block, m_offset);
|
||||
}
|
||||
|
||||
char const* InvalidLookupPositionException::what() const noexcept
|
||||
{
|
||||
return "Zone tried to lookup at zone offset that is not recorded";
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
#pragma once
|
||||
|
||||
#include "LoadingException.h"
|
||||
#include "Zone/ZoneTypes.h"
|
||||
|
||||
#include <cstdlib>
|
||||
|
||||
class InvalidLookupPositionException final : public LoadingException
|
||||
{
|
||||
public:
|
||||
InvalidLookupPositionException(block_t block, size_t offset);
|
||||
|
||||
std::string DetailedMessage() override;
|
||||
char const* what() const noexcept override;
|
||||
|
||||
private:
|
||||
block_t m_block;
|
||||
size_t m_offset;
|
||||
};
|
||||
Reference in New Issue
Block a user