Skip to content

Commit 3d63e21

Browse files
update to 1.24, remove bt audio fix
1 parent c1e0ca7 commit 3d63e21

4 files changed

Lines changed: 47 additions & 32 deletions

File tree

mod.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,15 @@
22
"_QPVersion": "0.1.1",
33
"id": "CrashMod",
44
"name": "CrashMod",
5-
"version": "0.7.1",
5+
"version": "0.8.0",
66
"author": "ComputerElite",
77
"packageId": "com.beatgames.beatsaber",
8-
"packageVersion": "1.21.0",
8+
"packageVersion": "1.24.0",
99
"modFiles": [
1010
"libCrashMod.so"
1111
],
1212
"libraryFiles": [
13-
"libbeatsaber-hook_3_7_4.so"
13+
"libbeatsaber-hook_3_10_0.so"
1414
],
1515
"dependencies": [],
1616
"fileCopies": []

qpm.json

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
"info": {
55
"name": "Crash Mod",
66
"id": "CrashMod",
7-
"version": "0.7.1",
7+
"version": "0.8.0",
88
"url": null,
99
"additionalData": {
1010
"overrideSoName": "libCrashMod.so"
@@ -13,33 +13,34 @@
1313
"dependencies": [
1414
{
1515
"id": "beatsaber-hook",
16-
"versionRange": "^3.7.4",
16+
"versionRange": "^3.10.0",
1717
"additionalData": {
1818
"extraFiles": [
1919
"src/inline-hook"
20-
]
20+
],
21+
"useRelease": true
2122
}
2223
},
24+
{
25+
"id": "codegen",
26+
"versionRange": "^0.25.0",
27+
"additionalData": {}
28+
},
2329
{
2430
"id": "modloader",
2531
"versionRange": "=1.2.3",
2632
"additionalData": {
2733

2834
}
2935
},
30-
{
31-
"id": "codegen",
32-
"versionRange": "^0.22.0",
33-
"additionalData": {}
34-
},
3536
{
3637
"id": "questui",
37-
"versionRange": "^0.13.5",
38+
"versionRange": "^0.16.2",
3839
"additionalData": {}
3940
},
4041
{
4142
"id": "custom-types",
42-
"versionRange": "^0.15.9",
43+
"versionRange": "^0.15.18",
4344
"additionalData": {}
4445
},
4546
{

src/CrashModViewController.cpp

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,14 @@ void DidActivate(ViewController* self, bool firstActivation, bool addedToHierarc
3535
self->get_gameObject()->AddComponent<Touchable*>();
3636
GameObject* container = BeatSaberUI::CreateScrollableSettingsContainer(self->get_transform());
3737

38+
// AudioFix
39+
//QuestUI::BeatSaberUI::AddHoverHint(AddConfigValueToggle(container->get_transform(), getModConfig().AudioFix)->get_gameObject(), "Enable and disable the BT audio fix");
40+
41+
//QuestUI::BeatSaberUI::AddHoverHint(AddConfigValueIncrementInt(container->get_transform(), getModConfig().AudioBuffer, 128, 0, 0xFFFFF)->get_gameObject(), "Set the buffer size for the BT audio fix");
42+
43+
// Active
44+
QuestUI::BeatSaberUI::AddHoverHint(AddConfigValueToggle(container->get_transform(), getModConfig().Active)->get_gameObject(), "Why would you want to disable it at all?");
45+
3846
// Active
3947
QuestUI::BeatSaberUI::AddHoverHint(AddConfigValueToggle(container->get_transform(), getModConfig().Active)->get_gameObject(), "Why would you want to disable it at all?");
4048

@@ -96,18 +104,10 @@ void DidActivate(ViewController* self, bool firstActivation, bool addedToHierarc
96104
QuestUI::BeatSaberUI::AddHoverHint(AddConfigValueToggle(container->get_transform(), getModConfig().CrashOnNE)->get_gameObject(), "Crash if you got Noodle Extensions installed");
97105

98106
// CrashOnPause
99-
/*
100-
auto CrashOnPauseChange = il2cpp_utils::MakeDelegate<UnityEngine::Events::UnityAction_1<bool>*>(
101-
classof(UnityEngine::Events::UnityAction_1<bool>*), this, onCrashOnPauseChange);
102-
UnityEngine::UI::Toggle* CrashOnPause = QuestUI::BeatSaberUI::CreateToggle(container->get_transform(), "Crash on Pause", getConfig().config["CrashOnPause"].GetBool(), CrashOnPauseChange);
103-
QuestUI::BeatSaberUI::AddHoverHint(CrashOnPause->get_gameObject(), "Crashes the game when you pause it");
107+
QuestUI::BeatSaberUI::AddHoverHint(AddConfigValueToggle(container->get_transform(), getModConfig().CrashOnPause)->get_gameObject(), "Crash if you pause the game");
104108

105109
// CrashOnUnpause
106-
auto CrashOnUnpauseChange = il2cpp_utils::MakeDelegate<UnityEngine::Events::UnityAction_1<bool>*>(
107-
classof(UnityEngine::Events::UnityAction_1<bool>*), this, onCrashOnUnpauseChange);
108-
UnityEngine::UI::Toggle* CrashOnUnpause = QuestUI::BeatSaberUI::CreateToggle(container->get_transform(), "Crash on Resume", getConfig().config["CrashOnUnpause"].GetBool(), CrashOnUnpauseChange);
109-
QuestUI::BeatSaberUI::AddHoverHint(CrashOnUnpause->get_gameObject(), "Crashes the game when you resume.");
110-
*/
110+
QuestUI::BeatSaberUI::AddHoverHint(AddConfigValueToggle(container->get_transform(), getModConfig().CrashOnUnpause)->get_gameObject(), "Crash if you unpause the game");
111111

112112
// OnCrashAction
113113
QuestUI::BeatSaberUI::AddHoverHint(AddConfigValueIncrementInt(container->get_transform(), getModConfig().OnCrashAction, 1, 0, 1)->get_gameObject(), "Why would you even want to do that? (0 = Crash, 1 = Quit)");

src/main.cpp

Lines changed: 23 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -95,9 +95,9 @@ MAKE_HOOK_MATCH(BombNoteController_HandleWasCutBySaber, &BombNoteController::Han
9595
MAKE_HOOK_MATCH(HandleSwingFinish, &GlobalNamespace::CutScoreBuffer::HandleSaberSwingRatingCounterDidFinish, void, GlobalNamespace::CutScoreBuffer* self, ISaberSwingRatingCounter* counter) {
9696
HandleSwingFinish(self, counter);
9797
if(!getModConfig().Active.GetValue() || !getModConfig().CrashOn115.GetValue()) return;
98-
int score = self->dyn__afterCutScore() + self->dyn__beforeCutScore() + self->dyn__centerDistanceCutScore();
99-
auto *noteScoreDefinition = self->dyn__noteScoreDefinition();
100-
int maxCutScore = noteScoreDefinition->dyn_maxAfterCutScore() + noteScoreDefinition->dyn_maxBeforeCutScore() + noteScoreDefinition->dyn_maxCenterDistanceCutScore();
98+
int score = self->afterCutScore + self->beforeCutScore + self->centerDistanceCutScore;
99+
auto *noteScoreDefinition = self->noteScoreDefinition;
100+
int maxCutScore = noteScoreDefinition->maxAfterCutScore + noteScoreDefinition->maxBeforeCutScore + noteScoreDefinition->maxCenterDistanceCutScore;
101101
if(score == maxCutScore) Crash();
102102
}
103103

@@ -106,6 +106,16 @@ MAKE_HOOK_MATCH(RelativeScoreAndImmediateRankCounter_UpdateRelativeScoreAndImmed
106106
if(getModConfig().Active.GetValue() && getModConfig().PercentageActive.GetValue() && self->get_relativeScore() < getModConfig().Percentage.GetValue() / 100) Crash();
107107
}
108108

109+
MAKE_HOOK_MATCH(PauseController_HandlePauseMenuManagerDidPressMenuButton, &PauseController::HandlePauseMenuManagerDidPressMenuButton, void, PauseController* self) {
110+
PauseController_HandlePauseMenuManagerDidPressMenuButton(self);
111+
if(getModConfig().Active.GetValue() && getModConfig().CrashOnPause.GetValue()) Crash();
112+
}
113+
114+
MAKE_HOOK_MATCH(PauseController_HandlePauseMenuManagerDidPressContinueButton, &PauseController::HandlePauseMenuManagerDidPressContinueButton, void, PauseController* self) {
115+
PauseController_HandlePauseMenuManagerDidPressContinueButton(self);
116+
if(getModConfig().Active.GetValue() && getModConfig().CrashOnUnpause.GetValue()) Crash();
117+
}
118+
109119
MAKE_HOOK_MATCH(StandardLevelScenesTransitionSetupDataSO_Init, &StandardLevelScenesTransitionSetupDataSO::Init, void, StandardLevelScenesTransitionSetupDataSO* self, StringW gameMode, IDifficultyBeatmap* dbm, IPreviewBeatmapLevel* previewBeatmapLevel, OverrideEnvironmentSettings* overrideEnvironmentSettings, ColorScheme* overrideColorScheme, GameplayModifiers* gameplayModifiers, PlayerSpecificSettings* playerSpecificSettings, PracticeSettings* practiceSettings, StringW backButtonText, bool startPaused, bool useTestNoteCutSoundEffects) {
110120
StandardLevelScenesTransitionSetupDataSO_Init(self, gameMode, dbm, previewBeatmapLevel, overrideEnvironmentSettings, overrideColorScheme, gameplayModifiers, playerSpecificSettings, practiceSettings, backButtonText, startPaused, useTestNoteCutSoundEffects);
111121
if(getModConfig().Active.GetValue()) {
@@ -136,16 +146,20 @@ MAKE_HOOK_MATCH(SceneManager_ActiveSceneChanged, &UnityEngine::SceneManagement::
136146
if(getModConfig().CrashOnOver5PerBattery.GetValue() && GlobalNamespace::OVRPlugin::OVRP_1_1_0::ovrp_GetSystemBatteryLevel() > getModConfig().BatteryThreshold.GetValue() / 100) Crash();
137147
if(getModConfig().CrashOnNE.GetValue() && Modloader::getMods().find("noodleextensions") == Modloader::getMods().end()) Crash();
138148
}
139-
UnityEngine::AudioConfiguration audioConfig = AudioSettings::GetConfiguration();
140-
audioConfig.dspBufferSize = 128;
141-
using ResetMethodDef = function_ptr_t<bool, AudioConfiguration>;
142-
static ResetMethodDef Reset = reinterpret_cast<ResetMethodDef>(il2cpp_functions::resolve_icall("UnityEngine.AudioSettings::SetConfiguration_Injected"));
143-
Reset(audioConfig);
149+
/*
150+
if(getModConfig().AudioFix.GetValue()) {
151+
UnityEngine::AudioConfiguration audioConfig = AudioSettings::GetConfiguration();
152+
audioConfig.dspBufferSize = getModConfig().AudioBuffer.GetValue();
153+
using ResetMethodDef = function_ptr_t<bool, AudioConfiguration>;
154+
static ResetMethodDef Reset = reinterpret_cast<ResetMethodDef>(il2cpp_functions::resolve_icall("UnityEngine.AudioSettings::SetConfiguration_Injected"));
155+
Reset(audioConfig);
156+
}
157+
*/
144158
}
145159

146160
MAKE_HOOK_MATCH(ResultsViewController_Init, &ResultsViewController::Init, void, ResultsViewController* self, LevelCompletionResults* result, IReadonlyBeatmapData* beatmap, IDifficultyBeatmap* bm, bool practice, bool newHighScore) {
147161
ResultsViewController_Init(self, result, beatmap, bm, practice, newHighScore);
148-
if(getModConfig().Active.GetValue() && ((getModConfig().CrashOnNotFullCombo.GetValue() && !result->dyn_fullCombo()) || (getModConfig().CrashOnNewHighscore.GetValue() && self->dyn__newHighScore()))) Crash();
162+
if(getModConfig().Active.GetValue() && ((getModConfig().CrashOnNotFullCombo.GetValue() && !result->fullCombo) || (getModConfig().CrashOnNewHighscore.GetValue() && self->newHighScore))) Crash();
149163
}
150164

151165
MAKE_HOOK_MATCH(StandardLevelDetailView_RefreshContent, &StandardLevelDetailView::RefreshContent, void, StandardLevelDetailView* self) {

0 commit comments

Comments
 (0)