Skip to content

Commit

Permalink
Update main.cpp
Browse files Browse the repository at this point in the history
  • Loading branch information
vcmikuu committed Aug 13, 2024
1 parent a0c7af0 commit 8f42be4
Showing 1 changed file with 16 additions and 6 deletions.
22 changes: 16 additions & 6 deletions src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,16 @@ using namespace UnityEngine::UI;
#include "HMUI/ImageView.hpp"
using namespace HMUI;

MAKE_HOOK_MATCH(UpdateValue, void) {
if(getModConfig().Active.GetValue()){
Logger.info("ImageCoverExpander Set Value True");
getModConfig().Active.SetValue(true);
} else{
Logger.info("ImageCoverExpander Set Value False");
getModConfig().Active.SetValue(false);
}
};


MAKE_HOOK_MATCH(m_DidActivate,
&GlobalNamespace::StandardLevelDetailViewController::DidActivate,
Expand Down Expand Up @@ -49,11 +59,12 @@ MAKE_HOOK_MATCH(m_DidActivate,
imageView->__Refresh();
} else{
Logger.info("ImageCoverExpander Found Value Set As False, skipping expanding Image");
return;
}

}



void DidActivate(HMUI::ViewController* self, bool firstActivation, bool addedToHierarchy, bool screenSystemEnabling){
if(firstActivation){
// Make Touchable
Expand All @@ -63,14 +74,12 @@ void DidActivate(HMUI::ViewController* self, bool firstActivation, bool addedToH
auto* container = BSML::Lite::CreateScrollableSettingsContainer(self->get_transform());

// Add Options
AddConfigValueToggle(container->get_transform(), getModConfig().Active,
[](bool value) {
Logger.info("ImageCoverExpander Set Value");
getModConfig().Active.SetValue(value);
});
AddConfigValueToggle(container->get_transform(), getModConfig().Active);

}
}


#pragma region Mod setup
/// @brief Called at the early stages of game loading
/// @param info
Expand All @@ -93,6 +102,7 @@ MOD_EXPORT_FUNC void late_load() {
Logger.info("Installing hooks...");

INSTALL_HOOK(Logger, m_DidActivate);
INSTALL_HOOK(Logger, UpdateValue);

Logger.info("Installed all hooks!");
}
Expand Down

0 comments on commit 8f42be4

Please sign in to comment.