From 1a4e9d28d76726dd194353bce15aea777fa3d3be Mon Sep 17 00:00:00 2001 From: Mike Date: Thu, 14 Dec 2023 18:35:57 -0500 Subject: [PATCH] Fix setting screen crash --- CMakeLists.txt | 1 + NKHook5/Classes/CTextObject.h | 8 ++++---- NKHook5/Patches/CSettingsScreen/InitLayout.cpp | 4 ++-- 3 files changed, 7 insertions(+), 6 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 3317cfe..8568991 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -32,6 +32,7 @@ if(MSVC) $<$:/MT> #---------| $<$:/MTd> #---|-- Statically link the runtime libraries $<$:/MT> #--| + $<$:/MT> #--| ) endif() diff --git a/NKHook5/Classes/CTextObject.h b/NKHook5/Classes/CTextObject.h index 6f4710b..ca8dbf9 100644 --- a/NKHook5/Classes/CTextObject.h +++ b/NKHook5/Classes/CTextObject.h @@ -30,11 +30,11 @@ namespace NKHook5::Classes CTextObject() { ThisConstruct(this); } - CTextObject(Vec2F position, boost::shared_ptr& font, std::string text) { - ThisConstruct(this, position, font, std::move(text)); + CTextObject(const Vec2F& position, const boost::shared_ptr& font, const nfw::string& text) { + ThisConstruct(this, &position, &font, &text); } - CTextObject(boost::shared_ptr& font, std::string text) { - ThisConstruct(this, font, std::move(text)); + CTextObject(const boost::shared_ptr& font, const nfw::string& text) { + ThisConstruct(this, &font, &text); } ~CTextObject() override = default; diff --git a/NKHook5/Patches/CSettingsScreen/InitLayout.cpp b/NKHook5/Patches/CSettingsScreen/InitLayout.cpp index 6e529a0..688d315 100644 --- a/NKHook5/Patches/CSettingsScreen/InitLayout.cpp +++ b/NKHook5/Patches/CSettingsScreen/InitLayout.cpp @@ -28,8 +28,8 @@ namespace NKHook5::Patches::CSettingsScreen PLH::FnCast(o_func, &cb_hook)(self, pad, param_1); //Add the NKHook version information text - std::string verInfoString("NKHook5 v" STRING(NKHOOK_BUILD_TAG) " (" STRING(NKHOOK_BUILD_VERSION) ")"); - auto* verInfoText = new Classes::CTextObject({ 160, -100 }, self->mScreenFont, verInfoString); + nfw::string verInfoString("NKHook5 v" STRING(NKHOOK_BUILD_TAG) " (" STRING(NKHOOK_BUILD_VERSION) ")"); + auto* verInfoText = new Classes::CTextObject({160, -100}, self->mScreenFont, verInfoString); Classes::Vec2F textScale(0.5, 0.5); verInfoText->Scale(textScale); verInfoText->SetRotation(40);