mirror of
https://github.com/RPCSX/rpcsx.git
synced 2026-04-05 22:47:03 +00:00
Implement at32() util
Works like .at() but uses source location for "exception".
This commit is contained in:
parent
2655255d4d
commit
6ff6a4989a
62 changed files with 472 additions and 452 deletions
|
|
@ -85,7 +85,7 @@ void ppu_module_manager::register_module(ppu_static_module* _module)
|
|||
|
||||
ppu_static_function& ppu_module_manager::access_static_function(const char* _module, u32 fnid)
|
||||
{
|
||||
auto& res = ppu_module_manager::s_module_map.at(_module)->functions[fnid];
|
||||
auto& res = ::at32(ppu_module_manager::s_module_map, _module)->functions[fnid];
|
||||
|
||||
if (res.name)
|
||||
{
|
||||
|
|
@ -97,7 +97,7 @@ ppu_static_function& ppu_module_manager::access_static_function(const char* _mod
|
|||
|
||||
ppu_static_variable& ppu_module_manager::access_static_variable(const char* _module, u32 vnid)
|
||||
{
|
||||
auto& res = ppu_module_manager::s_module_map.at(_module)->variables[vnid];
|
||||
auto& res = ::at32(ppu_module_manager::s_module_map, _module)->variables[vnid];
|
||||
|
||||
if (res.name)
|
||||
{
|
||||
|
|
@ -347,13 +347,13 @@ static void ppu_initialize_modules(ppu_linkage_info* link, utils::serial* ar = n
|
|||
break;
|
||||
}
|
||||
|
||||
const auto _module = manager.at(name);
|
||||
const auto _module = ::at32(manager, name);
|
||||
|
||||
auto& variable = _module->variables;
|
||||
|
||||
for (u32 i = 0, end = ar.operator usz(); i < end; i++)
|
||||
{
|
||||
auto* ptr = &variable.at(ar.operator u32());
|
||||
auto* ptr = &::at32(variable, ar.operator u32());
|
||||
ptr->addr = ar.operator u32();
|
||||
ensure(!!ptr->var);
|
||||
}
|
||||
|
|
@ -699,7 +699,7 @@ static auto ppu_load_exports(ppu_linkage_info* link, u32 exports_start, u32 expo
|
|||
//else
|
||||
{
|
||||
// Static function
|
||||
const auto _sf = _sm && _sm->functions.count(fnid) ? &_sm->functions.at(fnid) : nullptr;
|
||||
const auto _sf = _sm && _sm->functions.count(fnid) ? &::at32(_sm->functions, fnid) : nullptr;
|
||||
|
||||
if (_sf && (_sf->flags & MFF_FORCED_HLE))
|
||||
{
|
||||
|
|
@ -1217,12 +1217,12 @@ std::shared_ptr<lv2_prx> ppu_load_prx(const ppu_prx_object& elf, const std::stri
|
|||
{
|
||||
const auto& rel = reinterpret_cast<const ppu_prx_relocation_info&>(prog.bin[i]);
|
||||
|
||||
if (rel.offset >= prx->segs.at(rel.index_addr).size)
|
||||
if (rel.offset >= ::at32(prx->segs, rel.index_addr).size)
|
||||
{
|
||||
fmt::throw_exception("Relocation offset out of segment memory! (offset=0x%x, index_addr=%u)", rel.offset, rel.index_addr);
|
||||
}
|
||||
|
||||
const u32 data_base = rel.index_value == 0xFF ? 0 : prx->segs.at(rel.index_value).addr;
|
||||
const u32 data_base = rel.index_value == 0xFF ? 0 : ::at32(prx->segs, rel.index_value).addr;
|
||||
|
||||
if (rel.index_value != 0xFF && !data_base)
|
||||
{
|
||||
|
|
@ -1230,7 +1230,7 @@ std::shared_ptr<lv2_prx> ppu_load_prx(const ppu_prx_object& elf, const std::stri
|
|||
}
|
||||
|
||||
ppu_reloc _rel;
|
||||
const u32 raddr = _rel.addr = vm::cast(prx->segs.at(rel.index_addr).addr + rel.offset);
|
||||
const u32 raddr = _rel.addr = vm::cast(::at32(prx->segs, rel.index_addr).addr + rel.offset);
|
||||
const u32 rtype = _rel.type = rel.type;
|
||||
const u64 rdata = _rel.data = data_base + rel.ptr.addr();
|
||||
prx->relocs.emplace_back(_rel);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue