Skip to content

Commit ab396db

Browse files
committed
icky hack to make h1 core save stuff not attempt construction on winstore (cores are steam only)
1 parent 9ff1cf9 commit ab396db

File tree

3 files changed

+19
-6
lines changed

3 files changed

+19
-6
lines changed

HCMInternal/App.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ class App {
111111
auto optionalCheats = std::make_shared<OptionalCheatManager>(guireq, cheatfail, settings, ptr, ver, mccStateHook, sharedMem, mes, exp, dirPath, modal, control); PLOGV << "optionalCheats init"; // constructs and stores required optional cheats. Needs a lot of dependencies, cheats will only keep what they need.
112112

113113
auto guistore = std::make_shared<GUIElementStore>(); PLOGV << "guistore init"; // collection starts empty, populated later by GUIElementConstructor
114-
auto GUICon = std::make_shared<GUIElementConstructor>(guireq, cheatfail, guistore, guifail, settings); PLOGV << "GUIMan init"; // constructs gui elements, pushing them into guistore
114+
auto GUICon = std::make_shared<GUIElementConstructor>(guireq, cheatfail, guistore, guifail, settings, ver->getMCCProcessType()); PLOGV << "GUIMan init"; // constructs gui elements, pushing them into guistore
115115
//guifail->printAllFailures();
116116
// set up main gui
117117
auto HCMGUI = std::make_shared<HCMInternalGUI>(mccStateHook, guistore, hkr, imm->MidgroundRenderEvent, mccStateHook->getMCCStateChangedEvent(), control, settings); PLOGV << "HCMGUI init";// main gui. Mostly just a canvas for rendering a collection of IGUIElements that will get constructed a bit below.

HCMInternal/GUIElementConstructor.cpp

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,18 @@ class GUIElementConstructor::GUIElementConstructorImpl {
4949
return std::nullopt;
5050
}
5151

52+
53+
// stupid override to make core save/dump stuff only construct for steam since I can't be bothered reworking the macro system to do this properly
54+
if ((magic_enum::enum_name<GUIElementEnum>(guielementenum).contains("core") || magic_enum::enum_name<GUIElementEnum>(guielementenum).contains("Core")) // is the gui elemenet a core save thing? this is the most icky part of this, doing a stringcheck of the enum name.. what if I want to add another cheat that uses the name "core" to mean something else? eh prolly won't come up
55+
&& game.operator GameState::Value() == GameState::Value::Halo1 // and is halo 1
56+
&& mProcType == MCCProcessType::WinStore // and current process is winstore
57+
)
58+
{
59+
PLOG_DEBUG << "GUIElementEnum::" << magic_enum::enum_name(guielementenum) << " for game " << game.toString() << " does not support WinStore version of MCC (steam only), skipping construction";
60+
return std::nullopt; // don't construct
61+
}
62+
63+
5264
PLOG_DEBUG << "attempting to construct guielement: " << magic_enum::enum_name(guielementenum) << " for game: " << game.toString();
5365
try
5466
{
@@ -539,11 +551,11 @@ class GUIElementConstructor::GUIElementConstructorImpl {
539551

540552
std::shared_ptr<GUIElementStore> mStore;
541553

542-
554+
MCCProcessType mProcType;
543555

544556
public:
545-
GUIElementConstructorImpl(std::shared_ptr<IGUIRequiredServices> guireq, std::shared_ptr<OptionalCheatInfo> fail, std::shared_ptr<GUIElementStore> store, std::shared_ptr<GUIServiceInfo> info, std::shared_ptr<SettingsStateAndEvents> settings)
546-
: mStore(store)
557+
GUIElementConstructorImpl(std::shared_ptr<IGUIRequiredServices> guireq, std::shared_ptr<OptionalCheatInfo> fail, std::shared_ptr<GUIElementStore> store, std::shared_ptr<GUIServiceInfo> info, std::shared_ptr<SettingsStateAndEvents> settings, MCCProcessType procType)
558+
: mStore(store), mProcType(procType)
547559
{
548560
// Create all top level GUI elements. Each one will recursively create it's nested elements, if it has any.
549561
for (auto& [element, game] : guireq->getToplevelGUIElements())
@@ -564,5 +576,5 @@ class GUIElementConstructor::GUIElementConstructorImpl {
564576

565577

566578

567-
GUIElementConstructor::GUIElementConstructor(std::shared_ptr<IGUIRequiredServices> guireq, std::shared_ptr<OptionalCheatInfo> fail, std::shared_ptr<GUIElementStore> store, std::shared_ptr<GUIServiceInfo> info, std::shared_ptr<SettingsStateAndEvents> settings) : pimpl(std::make_unique<GUIElementConstructorImpl>(guireq, fail, store, info, settings)) {}
579+
GUIElementConstructor::GUIElementConstructor(std::shared_ptr<IGUIRequiredServices> guireq, std::shared_ptr<OptionalCheatInfo> fail, std::shared_ptr<GUIElementStore> store, std::shared_ptr<GUIServiceInfo> info, std::shared_ptr<SettingsStateAndEvents> settings, MCCProcessType procType) : pimpl(std::make_unique<GUIElementConstructorImpl>(guireq, fail, store, info, settings, procType)) {}
568580
GUIElementConstructor::~GUIElementConstructor() = default;

HCMInternal/GUIElementConstructor.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,15 @@
44
#include "GUIElementStore.h"
55
#include "GUIServiceInfo.h"
66
#include "SettingsStateAndEvents.h"
7+
#include "IGetMCCVersion.h"
78
class GUIElementConstructor
89
{
910
private:
1011
class GUIElementConstructorImpl;
1112
std::unique_ptr< GUIElementConstructorImpl> pimpl;
1213

1314
public:
14-
GUIElementConstructor(std::shared_ptr<IGUIRequiredServices>, std::shared_ptr<OptionalCheatInfo>, std::shared_ptr<GUIElementStore>, std::shared_ptr<GUIServiceInfo>, std::shared_ptr<SettingsStateAndEvents>);
15+
GUIElementConstructor(std::shared_ptr<IGUIRequiredServices>, std::shared_ptr<OptionalCheatInfo>, std::shared_ptr<GUIElementStore>, std::shared_ptr<GUIServiceInfo>, std::shared_ptr<SettingsStateAndEvents>, MCCProcessType);
1516
~GUIElementConstructor();
1617
};
1718

0 commit comments

Comments
 (0)