Skip to content

Commit fe94253

Browse files
committed
v2: Fix GameObjectsDisplay silently disabled on D3D11 games
on_frame() gated on !m_d3d12.initialized even though the mod has a working D3D11/legacy-mode ImGui fallback path (line 380-381: world_to_screen + draw_list->AddText). initialize_d3d_resources() only populates m_d3d12.initialized for the D3D12 branch; the D3D11 branch has just '// TODO'. So for any game running on D3D11 (DMC5 and others), the gate returned early before reaching the ImGui fallback \u2014 the mod was effectively disabled. Same behavior on upstream master; DMC5 was never getting object labels even with the mod enabled. Split the gate: m_d3d12.initialized is only required when actually taking the D3D12 3D-text path. For legacy mode or D3D11, proceed to the ImGui fallback. Verified: DMC5 (D3D11) now draws game object labels when the mod is enabled.
1 parent a306f8c commit fe94253

1 file changed

Lines changed: 9 additions & 1 deletion

File tree

src/mods/tools/GameObjectsDisplay.cpp

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,15 @@ void GameObjectsDisplay::on_present() {
162162
}
163163

164164
void GameObjectsDisplay::on_frame() {
165-
if (!m_enabled->value() || m_needs_d3d_init || !m_d3d12.initialized) {
165+
if (!m_enabled->value() || m_needs_d3d_init) {
166+
return;
167+
}
168+
169+
// The D3D12 3D-text rendering path needs m_d3d12.initialized. The ImGui
170+
// world-to-screen fallback (legacy mode or D3D11) does not — it draws via
171+
// ImGui::GetBackgroundDrawList() and only needs world_to_screen to work.
172+
const bool is_d3d12_frame = g_framework->is_dx12();
173+
if (is_d3d12_frame && !m_legacy_mode && !m_d3d12.initialized) {
166174
return;
167175
}
168176

0 commit comments

Comments
 (0)