Skip to content

Commit

Permalink
Adding BSML Features
Browse files Browse the repository at this point in the history
  • Loading branch information
vcmikuu committed Aug 13, 2024
1 parent 11242cc commit 70b1544
Show file tree
Hide file tree
Showing 5 changed files with 37 additions and 18 deletions.
4 changes: 1 addition & 3 deletions include/config.hpp
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
#pragma once

#include "config-utils/shared/config-utils.hpp"
#include <vector>
#include <string>

DECLARE_CONFIG(ModConfig,
CONFIG_VALUE(TestingWK, int, "More featuers to 1.37.1", 1371);
CONFIG_VALUE(Active, bool, "Active", true);
)
4 changes: 2 additions & 2 deletions mod.template.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@
"id": "${mod_id}",
"coverImage:": "cover.jpg",
"author": "laynia",
"version": "0.1.0",
"version": "0.1.1",
"packageId": "com.beatgames.beatsaber",
"packageVersion": "1.37.1_9895289101",
"packageVersion": "1.37.0_9064817954",
"description": "Expands the song artwork to cover the right side of the level select.",
"dependencies": [],
"modFiles": ["${binary}"],
Expand Down
4 changes: 2 additions & 2 deletions qpm.json
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
{
"version": "0.1.0",
"version": "0.1.1",
"sharedDir": "shared",
"dependenciesDir": "extern",
"info": {
"name": "ImageCoverExpander",
"id": "imagecoverexpander",
"version": "0.1.0",
"version": "0.1.1",
"url": null,
"additionalData": {
"overrideSoName": "libimagecoverexpander.so",
Expand Down
4 changes: 2 additions & 2 deletions qpm.shared.json
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
{
"config": {
"version": "0.1.0",
"version": "0.1.1",
"sharedDir": "shared",
"dependenciesDir": "extern",
"info": {
"name": "ImageCoverExpander",
"id": "imagecoverexpander",
"version": "0.1.0",
"version": "0.1.1",
"url": null,
"additionalData": {
"overrideSoName": "libimagecoverexpander.so",
Expand Down
39 changes: 30 additions & 9 deletions src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,18 +33,36 @@ MAKE_HOOK_MATCH(m_DidActivate,
m_DidActivate(self, firstActivation, addedToHeirarchy, screenSystemEnabling);


auto* imageCoverTransform = self->get_transform()->Find("LevelDetail/LevelBarBig/SongArtwork")->GetComponent<RectTransform*>();
if(getModConfig().Active.GetValue()){
return;
} else{
auto* imageCoverTransform = self->get_transform()->Find("LevelDetail/LevelBarBig/SongArtwork")->GetComponent<RectTransform*>();

imageCoverTransform->set_sizeDelta(Vector2(70.5, 58.0));
imageCoverTransform->set_localPosition(Vector3(-34.4, -56, 0));
imageCoverTransform->SetAsFirstSibling();
imageCoverTransform->set_sizeDelta(Vector2(70.5, 58.0));
imageCoverTransform->set_localPosition(Vector3(-34.4, -56, 0));
imageCoverTransform->SetAsFirstSibling();

auto* imageView = imageCoverTransform->GetComponent<ImageView*>();
auto* imageView = imageCoverTransform->GetComponent<ImageView*>();

imageView->set_color(Color(0.5, 0.5, 0.5, 1));
imageView->set_preserveAspect(false);
imageView->_skew = 0.0f;
imageView->__Refresh();
imageView->set_color(Color(0.5, 0.5, 0.5, 1));
imageView->set_preserveAspect(false);
imageView->_skew = 0.0f;
imageView->__Refresh();
}

}

void DidActivate(HMUI::ViewController* self, bool firstActivation, bool addedToHierarchy, bool screenSystemEnabling){
if(firstActivation){
// Make Touchable
self->get_gameObject()->AddComponent<HMUI::Touchable*>();

// Create Container
auto* container = BSML::Lite::CreateScrollableSettingsContainer(self->get_transform());

// Add Options
AddConfigValueToggle(container->get_transform(), getModConfig().Active);
}
}

#pragma region Mod setup
Expand All @@ -62,7 +80,10 @@ MOD_EXPORT_FUNC void setup(CModInfo& info) {
/// @return
MOD_EXPORT_FUNC void late_load() {
il2cpp_functions::Init();
getModConfig().Init(modInfo);
BSML::Init();

BSML::Register::RegisterMainMenu("ImageCoverExpander", "ImageCoverExpander", "Hide/Show Bigger Image Cover Art", DidActivate);
Logger.info("Installing hooks...");

INSTALL_HOOK(Logger, m_DidActivate);
Expand Down

0 comments on commit 70b1544

Please sign in to comment.