Skip to content

Commit

Permalink
RT: Fix some bugs in other games
Browse files Browse the repository at this point in the history
  • Loading branch information
praydog committed Apr 29, 2024
1 parent e1f53fd commit 30ec831
Showing 1 changed file with 9 additions and 8 deletions.
17 changes: 9 additions & 8 deletions src/mods/Graphics.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -669,6 +669,11 @@ void Graphics::setup_path_trace_hook() {

const auto offset = ctx.instrux.Operands[0].Info.Memory.Disp;

// ones that are comparing to 6 (ASVGF) are the right one.
if (ctx.instrux.Operands[0].Info.Memory.DispSize != 4 || (ctx.instrux.Operands[1].Info.Immediate.Imm & 0xFFFFFFFF) != 6) {
return utility::ExhaustionResult::CONTINUE;
}

if (offset_reference_counts.contains(offset)) {
offset_reference_counts[offset]++;
} else {
Expand Down Expand Up @@ -712,13 +717,6 @@ void Graphics::setup_rt_component() {
if (rt_t == nullptr) {
return;
}

// Means our reference is still valid
if (m_rt_component != nullptr && m_rt_component->referenceCount > 1) {
return;
}

m_rt_component.reset();

const auto camera = sdk::get_primary_camera();

Expand All @@ -740,10 +738,13 @@ void Graphics::setup_rt_component() {
}

if (rt_component == nullptr) {
m_rt_component.reset();
return;
}

m_rt_component = (sdk::ManagedObject*)rt_component;
if (m_rt_component.get() != (sdk::ManagedObject*)rt_component) {
m_rt_component = (sdk::ManagedObject*)rt_component;
}
}

void Graphics::apply_ray_tracing_tweaks() {
Expand Down

0 comments on commit 30ec831

Please sign in to comment.