Skip to content

Commit dea8954

Browse files
authored
Merge branch 'praydog:master' into master
2 parents d93423a + dcc84ba commit dea8954

4 files changed

Lines changed: 50 additions & 1 deletion

File tree

README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,9 @@ Supports both DirectX 11 and DirectX 12.
5555
* Street Fighter 6
5656
* Monster Hunter Rise
5757
* Dragon's Dogma 2
58+
* Ghosts 'n Goblins Resurrection (Using RE8 build)
59+
* Apollo Justice: Ace Attorney Trilogy (Using DD2 build)
60+
* Kunitsu-Gami: Path of the Goddess (Using DD2 build)
5861

5962
## Thanks
6063
[SkacikPL](https://github.com/SkacikPL) for originally creating the Manual Flashlight mod.

shared/sdk/REContext.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -208,7 +208,9 @@ namespace sdk {
208208
if (s_global_context != nullptr && *s_global_context != nullptr) {
209209
auto static_tbl = (REStaticTbl**)((uintptr_t)*s_global_context + s_static_tbl_offset);
210210
bool found_static_tbl_offset = false;
211-
if (IsBadReadPtr(*static_tbl, sizeof(void*)) || ((uintptr_t)*static_tbl & (sizeof(void*) - 1)) != 0) {
211+
const auto before_static_tbl_size = *(uint32_t*)((uintptr_t)static_tbl + sizeof(void*));
212+
spdlog::info("[VM::update_pointers] Static table size (before): {}", *(uint32_t*)((uintptr_t)static_tbl + sizeof(void*)));
213+
if (IsBadReadPtr(*static_tbl, sizeof(void*)) || ((uintptr_t)*static_tbl & (sizeof(void*) - 1)) != 0 || before_static_tbl_size > 9999999 || before_static_tbl_size < 2000) {
212214
spdlog::info("[VM::update_pointers] Static table offset is bad, correcting...");
213215

214216
// We are looking for the two arrays, the static field table, and the static field "initialized table"

src/mods/Graphics.cpp

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,10 @@ void Graphics::on_draw_ui() {
9898
}
9999

100100
if (m_ultrawide_fix->value()) {
101+
m_ultrawide_constrain_ui->draw("Ultrawide: Constrain UI to 16:9");
102+
if (m_ultrawide_constrain_ui->value()) {
103+
m_ultrawide_constrain_child_ui->draw("Ultrawide: Constrain Child UI to 16:9");
104+
}
101105
m_ultrawide_vertical_fov->draw("Ultrawide: Enable Vertical FOV");
102106
m_ultrawide_custom_fov->draw("Ultrawide: Override FOV");
103107
m_ultrawide_fov_multiplier->draw("Ultrawide: FOV Multiplier");
@@ -309,6 +313,12 @@ void Graphics::fix_ui_element(REComponent* gui_element) {
309313
return;
310314
}
311315

316+
const auto go_name = utility::re_string::get_view(game_object->name);
317+
318+
if (go_name == L"BlackFade") {
319+
return; // Don't do anything with the black fade, it should be taking over the whole screen
320+
}
321+
312322
const auto gui_component = utility::re_component::find<REComponent*>(game_object->transform, "via.gui.GUI");
313323

314324
if (gui_component == nullptr) {
@@ -350,6 +360,18 @@ void Graphics::fix_ui_element(REComponent* gui_element) {
350360
set_res_adjust_scale->call<void>(sdk::get_thread_context(), view, (int32_t)via::gui::ResolutionAdjustScale::FitSmallRatioAxis);
351361
set_res_adjust_anchor->call<void>(sdk::get_thread_context(), view, (int32_t)via::gui::ResolutionAdjustAnchor::CenterCenter);
352362
set_resolution_adjust->call<void>(sdk::get_thread_context(), view, true); // Causes the options to be applied/used
363+
364+
static const auto get_child = view_t->get_method("get_Child");
365+
366+
if (get_child != nullptr && m_ultrawide_constrain_child_ui->value()) {
367+
const auto child = get_child->call<::REManagedObject*>(sdk::get_thread_context(), view);
368+
369+
if (child != nullptr) {
370+
set_res_adjust_scale->call<void>(sdk::get_thread_context(), child, (int32_t)via::gui::ResolutionAdjustScale::FitSmallRatioAxis);
371+
set_res_adjust_anchor->call<void>(sdk::get_thread_context(), child, (int32_t)via::gui::ResolutionAdjustAnchor::CenterCenter);
372+
set_resolution_adjust->call<void>(sdk::get_thread_context(), child, true); // Causes the options to be applied/used
373+
}
374+
}
353375
}
354376
}
355377

@@ -365,9 +387,15 @@ bool Graphics::on_pre_gui_draw_element(REComponent* gui_element, void* primitive
365387
// TODO: Check how this interacts with the other games, could be useful for them too.
366388
#if defined(SF6)
367389
fix_ui_element(gui_element);
390+
#else
391+
if (m_ultrawide_constrain_ui->value()) {
392+
fix_ui_element(gui_element);
393+
}
368394
#endif
369395

370396
auto game_object = utility::re_component::get_game_object(gui_element);
397+
static auto letter_box_behavior_t = sdk::find_type_definition("app.LetterBoxBehavior");
398+
static auto letter_box_behavior_retype = letter_box_behavior_t != nullptr ? letter_box_behavior_t->get_type() : nullptr;
371399

372400
if (game_object != nullptr && game_object->transform != nullptr) {
373401
const auto name = utility::re_string::get_string(game_object->name);
@@ -379,6 +407,18 @@ bool Graphics::on_pre_gui_draw_element(REComponent* gui_element, void* primitive
379407
case "GUIEventPillar"_fnv:
380408
game_object->shouldDraw = false;
381409
return false;
410+
411+
case "Gui_ui0211"_fnv: // Kunitsu-Gami
412+
if (letter_box_behavior_t != nullptr) {
413+
auto letter_box_behavior = utility::re_component::find<REComponent*>(game_object->transform, letter_box_behavior_retype);
414+
415+
if (letter_box_behavior != nullptr) {
416+
game_object->shouldDraw = false;
417+
return false;
418+
}
419+
}
420+
421+
break;
382422

383423
#if defined(DD2)
384424
case "ui012203"_fnv:

src/mods/Graphics.hpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -166,6 +166,8 @@ class Graphics : public Mod {
166166
const ModToggle::Ptr m_ultrawide_fix{ ModToggle::create(generate_name("UltrawideFix"), false) };
167167
const ModToggle::Ptr m_ultrawide_vertical_fov{ ModToggle::create(generate_name("UltrawideFixVerticalFOV_V2"), false) };
168168
const ModToggle::Ptr m_ultrawide_custom_fov{ModToggle::create(generate_name("UltrawideCustomFOV"), false)};
169+
const ModToggle::Ptr m_ultrawide_constrain_ui{ModToggle::create(generate_name("UltrawideConstrainUI"), false)};
170+
const ModToggle::Ptr m_ultrawide_constrain_child_ui{ModToggle::create(generate_name("UltrawideConstrainChildUI"), false)};
169171
const ModSlider::Ptr m_ultrawide_fov_multiplier{ ModSlider::create(generate_name("UltrawideFOVMultiplier_V2"), 0.01f, 3.0f, 1.0f) };
170172
const ModToggle::Ptr m_disable_gui{ ModToggle::create(generate_name("DisableGUI"), false) };
171173
const ModToggle::Ptr m_force_render_res_to_window{ ModToggle::create(generate_name("ForceRenderResToWindow"), false) };
@@ -234,6 +236,8 @@ class Graphics : public Mod {
234236
*m_ultrawide_fix,
235237
*m_ultrawide_vertical_fov,
236238
*m_ultrawide_custom_fov,
239+
*m_ultrawide_constrain_ui,
240+
*m_ultrawide_constrain_child_ui,
237241
*m_ultrawide_fov_multiplier,
238242
*m_disable_gui,
239243
*m_force_render_res_to_window,

0 commit comments

Comments
 (0)