Skip to content

Commit

Permalink
1.27 Release
Browse files Browse the repository at this point in the history
  • Loading branch information
kodenamekrak committed Jan 11, 2023
1 parent 29d3c7b commit 8d5c1a7
Show file tree
Hide file tree
Showing 7 changed files with 17 additions and 52 deletions.
2 changes: 1 addition & 1 deletion createqmod.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ if ($help -eq $true) {

$mod = "./mod.json"

& $PSScriptRoot/validate-modjson.ps1
# & $PSScriptRoot/validate-modjson.ps1
if ($LASTEXITCODE -ne 0) {
exit $LASTEXITCODE
}
Expand Down
2 changes: 1 addition & 1 deletion mod.template.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"author": "KodenameKRAK, Henri",
"version": "0.1.0",
"packageId": "com.beatgames.beatsaber",
"packageVersion": "1.25.1",
"packageVersion": "1.27.0_3631150051",
"coverImage": "cover.jpg",
"description": "Menu saber colors reflect in game saber colors.",
"dependencies": [],
Expand Down
22 changes: 12 additions & 10 deletions qpm.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,32 +6,34 @@
"id": "qonsistentsabercolors",
"version": "0.1.0",
"url": null,
"additionalData": {}
"additionalData": {
"overrideSoName": "libqonsistentsabercolors.so"
}
},
"dependencies": [
{
"id": "codegen",
"versionRange": "^0.28.0",
"id": "beatsaber-hook",
"versionRange": "^3.14.0",
"additionalData": {}
},
{
"id": "questui",
"versionRange": "^0.17.5",
"id": "config-utils",
"versionRange": "^1.0.1",
"additionalData": {}
},
{
"id": "beatsaber-hook",
"versionRange": "^3.14.0",
"id": "questui",
"versionRange": "^0.17.10",
"additionalData": {}
},
{
"id": "config-utils",
"versionRange": "^1.0.1",
"id": "codegen",
"versionRange": "^0.32.0",
"additionalData": {}
},
{
"id": "custom-types",
"versionRange": "^0.15.21",
"versionRange": "^0.15.22",
"additionalData": {}
}
],
Expand Down
17 changes: 2 additions & 15 deletions src/ColorManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ namespace QonsistentSaberColors
{
void UpdateColors()
{
getLogger().info("Updating colors");
getLogger().info("Updating colorScheme");
if(colorSchemesSettings->overrideDefaultColors && getModConfig().Enabled.GetValue())
{
auto scheme = colorSchemesSettings->GetSelectedColorScheme();
Expand All @@ -54,7 +54,7 @@ namespace QonsistentSaberColors

void UpdatePointers()
{
getLogger().info("Updating neccessary pointers");
getLogger().info("Updating pointers");
auto controllers = UnityEngine::Resources::FindObjectsOfTypeAll<GlobalNamespace::VRController*>();
leftController = controllers[1];
rightController = controllers[0];
Expand All @@ -65,7 +65,6 @@ namespace QonsistentSaberColors

void SetControllerColors(UnityEngine::Color leftColor, UnityEngine::Color rightColor)
{
getLogger().info("SetControllerColors()");
if(!leftController->m_CachedPtr.m_value || !leftController || !rightController->m_CachedPtr.m_value || !rightController)
{
getLogger().info("One of the controllers was null, updating pointers");
Expand Down Expand Up @@ -112,7 +111,6 @@ namespace QonsistentSaberColors

void SetLaserColor(VRUIControls::VRLaserPointer* pointer)
{
getLogger().info("SetLaserColor()");
if(!laserPointer || !laserPointer->m_CachedPtr.m_value)
{
getLogger().info("laserPointer was null, not setting color");
Expand All @@ -138,28 +136,17 @@ namespace QonsistentSaberColors

void SetLaser(VRUIControls::VRLaserPointer* laser)
{
getLogger().info("SetLaser()");
laserPointer = laser;
}

void UpdateControllerColors()
{
getLogger().info("UpdateControllerColors()");
UpdateColors();
SetControllerColors(leftSaberColor, rightSaberColor);
}

void UpdateLaserColor()
{
getLogger().info("UpdateLaserColor");
if(laserPointer)
getLogger().info("laserPointer is valid");
else
{
getLogger().info("laserPointer is null");
return;
}

UpdateColors();
SetLaserColor(laserPointer);
}
Expand Down
2 changes: 0 additions & 2 deletions src/SettingsViewController.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,13 @@ void QonsistentSaberColors::SettingsViewController::DidActivate(bool firstActiva

QuestUI::BeatSaberUI::CreateToggle(transform, "Enabled", getModConfig().Enabled.GetValue(), [](bool value)
{
getLogger().info("Enabled toggle");
getModConfig().Enabled.SetValue(value);
QonsistentSaberColors::UpdateControllerColors();
QonsistentSaberColors::UpdateLaserColor();
});

QuestUI::BeatSaberUI::CreateToggle(transform, "Colored lasers", getModConfig().ColoredLasers.GetValue(), [](bool value)
{
getLogger().info("Lasers toggle");
getModConfig().ColoredLasers.SetValue(value);
QonsistentSaberColors::UpdateLaserColor();
});
Expand Down
22 changes: 0 additions & 22 deletions src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,38 +13,20 @@
#include "VRUIControls/VRPointer.hpp"
#include "VRUIControls/VRLaserPointer.hpp"


#include "UnityEngine/Resources.hpp"
#include "UnityEngine/GameObject.hpp"
#include "UnityEngine/Transform.hpp"
#include "UnityEngine/Material.hpp"
#include "UnityEngine/MeshRenderer.hpp"

static ModInfo modInfo;

using namespace QonsistentSaberColors;

MAKE_HOOK_MATCH(VRPointer_CreateLaserPointerAndLaserHit, &VRUIControls::VRPointer::CreateLaserPointerAndLaserHit, void, VRUIControls::VRPointer* self)
{
getLogger().info("VRPointer_CreateLaserPointerAndLaserHit");
VRPointer_CreateLaserPointerAndLaserHit(self);

auto mr = self->laserPointer->GetComponentInChildren<UnityEngine::MeshRenderer*>();
auto arr = mr->GetMaterialArray();
for(int i = 0; i < arr.Length(); i++)
{
auto col = arr[i]->get_color();
getLogger().info("Color for index %i is R:%f, G:%f, B:%f, A:%f", i, col.r, col.g, col.b, col.a);
}

SetLaser(self->laserPointer);
if(getModConfig().ColoredLasers.GetValue() && getModConfig().Enabled.GetValue())
UpdateLaserColor();
}

MAKE_HOOK_MATCH(MainMenuViewController_DidActivate, &GlobalNamespace::MainMenuViewController::DidActivate, void, GlobalNamespace::MainMenuViewController* self, bool a, bool b, bool c)
{
getLogger().info("MainMenuViewController_DidActivate");
MainMenuViewController_DidActivate(self, a, b, c);
if(getModConfig().Enabled.GetValue())
{
Expand All @@ -56,7 +38,6 @@ MAKE_HOOK_MATCH(MainMenuViewController_DidActivate, &GlobalNamespace::MainMenuVi

MAKE_HOOK_MATCH(ColorsOverrideSettingsPanelController_HandleOverrideColorsToggleValueChanged, &GlobalNamespace::ColorsOverrideSettingsPanelController::HandleOverrideColorsToggleValueChanged, void, GlobalNamespace::ColorsOverrideSettingsPanelController* self, bool isOn)
{
getLogger().info("ColorsOverrideSettingsPanelController_HandleOverrideColorsToggleValueChanged");
ColorsOverrideSettingsPanelController_HandleOverrideColorsToggleValueChanged(self, isOn);
if(getModConfig().Enabled.GetValue())
{
Expand All @@ -68,7 +49,6 @@ MAKE_HOOK_MATCH(ColorsOverrideSettingsPanelController_HandleOverrideColorsToggle

MAKE_HOOK_MATCH(ColorsOverrideSettingsPanelController_HandleEditColorSchemeControllerDidChangeColorScheme, &GlobalNamespace::ColorsOverrideSettingsPanelController::HandleEditColorSchemeControllerDidChangeColorScheme, void, GlobalNamespace::ColorsOverrideSettingsPanelController* self, GlobalNamespace::ColorScheme* colorScheme)
{
getLogger().info("ColorsOverrideSettingsPanelController_HandleEditColorSchemeControllerDidChangeColorScheme");
ColorsOverrideSettingsPanelController_HandleEditColorSchemeControllerDidChangeColorScheme(self, colorScheme);
if(getModConfig().Enabled.GetValue())
{
Expand All @@ -80,7 +60,6 @@ MAKE_HOOK_MATCH(ColorsOverrideSettingsPanelController_HandleEditColorSchemeContr

MAKE_HOOK_MATCH(ColorsOverrideSettingsPanelController_HandleDropDownDidSelectCellWithIdx, &GlobalNamespace::ColorsOverrideSettingsPanelController::HandleDropDownDidSelectCellWithIdx, void, GlobalNamespace::ColorsOverrideSettingsPanelController* self, HMUI::DropdownWithTableView* dropDownWithTableView, int idx)
{
getLogger().info("ColorsOverrideSettingsPanelController_HandleDropDownDidSelectCellWithIdx");
ColorsOverrideSettingsPanelController_HandleDropDownDidSelectCellWithIdx(self, dropDownWithTableView, idx);
if(getModConfig().Enabled.GetValue())
{
Expand All @@ -92,7 +71,6 @@ MAKE_HOOK_MATCH(ColorsOverrideSettingsPanelController_HandleDropDownDidSelectCel

MAKE_HOOK_MATCH(SceneManager_SetActiveScene, &UnityEngine::SceneManagement::SceneManager::SetActiveScene, bool, UnityEngine::SceneManagement::Scene scene)
{
getLogger().info("SceneManager_SetActiveScene");
bool val = SceneManager_SetActiveScene(scene);
UpdatePointers();
if(getModConfig().Enabled.GetValue() && scene.get_name() == "HealthWarning")
Expand Down
2 changes: 1 addition & 1 deletion validate-modjson.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ $mod = "./mod.json"

if (-not (Test-Path -Path $mod)) {
if (Test-Path -Path ".\mod.template.json") {
& qpm-rust qmod build
& qpm qmod build
if ($LASTEXITCODE -ne 0) {
exit $LASTEXITCODE
}
Expand Down

0 comments on commit 8d5c1a7

Please sign in to comment.