Skip to content

Commit

Permalink
Merge branch 'master' into pd-upscaler
Browse files Browse the repository at this point in the history
  • Loading branch information
praydog committed Apr 30, 2024
2 parents 183d4da + 3ff3531 commit 49fc0a5
Show file tree
Hide file tree
Showing 8 changed files with 491 additions and 18 deletions.
17 changes: 15 additions & 2 deletions reversing/rsz/emulation-dumper.py
Original file line number Diff line number Diff line change
Expand Up @@ -301,7 +301,7 @@ def hook_code(emu, address, size, frame):
list_size = cur_hist[lex] - 1

# Loop count matches the integer we filled the whole buffer with
if list_size == FILL_BYTE:
if list_size == FILL_BYTE and len(frame["layout"]) > FILL_BYTE:
try:
element_layout = frame["layout"][-1]
except IndexError as e:
Expand All @@ -320,7 +320,20 @@ def hook_code(emu, address, size, frame):
frame["layout"] = frame["layout"][0:len(frame["layout"]) - FILL_BYTE]
frame["was_string"] = False

list_layout = frame["layout"][-1]
try:
list_layout = frame["layout"][-1]
except IndexError as e:
cs.detail = True
dis_g = cs.disasm(emu.mem_read(lex, 0x100), address, 1)
dis = next(dis_g)

print("LEX: 0x%x" % lex)
print("0x%x: %s %s" % (address, dis.mnemonic, dis.op_str))

print("Instruction at %X didn't read bytes from stream? (2)" % address)
os.system("pause")
return

list_layout["list"] = True
list_layout["element"] = element_layout
list_layout["element_size"] = int((element_layout["offset"] - list_layout["offset"]) / FILL_BYTE)
Expand Down
11 changes: 11 additions & 0 deletions shared/sdk/REComponent.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,17 @@ namespace utility::re_component {
return nullptr;
}

template<typename T = ::REComponent>
static T** find_replaceable(::REComponent* comp, REType* t) {
for (auto* child = &comp->childComponent; *child != nullptr && *child != comp; child = &(*child)->childComponent) {
if (utility::re_managed_object::is_a(*child, t)) {
return (T**)child;
}
}

return nullptr;
}

// Find a component using the getComponent method
/*template <typename T = ::REComponent>
static T *find_using_method(::REComponent *comp, std::string_view name) {
Expand Down
4 changes: 2 additions & 2 deletions src/Mods.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,9 @@ Mods::Mods() {
#endif
#endif

// All games!!!!
// All games!!!
m_mods.emplace_back(Camera::get());
m_mods.emplace_back(std::make_unique<Graphics>());
m_mods.emplace_back(Graphics::get());

#if defined(RE2) || defined(RE3) || defined(RE8)
m_mods.emplace_back(std::make_unique<ManualFlashlight>());
Expand Down
Loading

0 comments on commit 49fc0a5

Please sign in to comment.