Skip to content

Commit

Permalink
Update to 1.37
Browse files Browse the repository at this point in the history
  • Loading branch information
Tatenshi committed Jul 11, 2024
1 parent e1866ff commit 85311c5
Show file tree
Hide file tree
Showing 11 changed files with 76 additions and 65 deletions.
5 changes: 4 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,11 @@ set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
set(SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/src)
set(INCLUDE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/include)

# stop symbol leaking
add_link_options(-Wl,--exclude-libs,ALL)

# compile options used
add_compile_options(-frtti -fexceptions)
add_compile_options(-frtti -fexceptions -fvisibility=hidden)
add_compile_options(-O3)
# compile definitions used
add_compile_definitions(VERSION=\"${MOD_VERSION}\")
Expand Down
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
# BSNightcoreQuest
![GitHub Downloads (all assets, specific tag)](https://img.shields.io/github/downloads/tatenshi/bsnightcorequest/v0.1.0/total)



Removes pitch compensation to make songs go nightcore

Expand Down
2 changes: 1 addition & 1 deletion buildQMOD.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ if ((-not ($cover -eq "./")) -and (Test-Path $cover))
$filelist += ,$cover
}

foreach ($mod in $modJson.modFiles)
foreach ($mod in $modJson.lateModFiles)
{
$path = "./build/" + $mod
if (-not (Test-Path $path))
Expand Down
8 changes: 4 additions & 4 deletions copy.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -52,13 +52,13 @@ if ($LASTEXITCODE -ne 0) {
}
$modJson = Get-Content "./mod.json" -Raw | ConvertFrom-Json

$modFiles = $modJson.modFiles
$lateModFiles = $modJson.lateModFiles

foreach ($fileName in $modFiles) {
foreach ($fileName in $lateModFiles) {
if ($useDebug -eq $true) {
& adb push build/debug/$fileName /sdcard/Android/data/com.beatgames.beatsaber/files/mods/$fileName
& adb push build/debug/$fileName /sdcard/ModData/com.beatgames.beatsaber/Modloader/mods/$fileName
} else {
& adb push build/$fileName /sdcard/Android/data/com.beatgames.beatsaber/files/mods/$fileName
& adb push build/$fileName /sdcard/ModData/com.beatgames.beatsaber/Modloader/mods/$fileName
}
}

Expand Down
8 changes: 3 additions & 5 deletions include/logger.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,10 @@
#include "beatsaber-hook/shared/utils/logging.hpp"
#include "beatsaber-hook/shared/config/config-utils.hpp"

// Include the modloader header, which allows us to tell the modloader which mod this is, and the version etc.
#include "modloader/shared/modloader.hpp"
#include "paper/shared/logger.hpp"

// Static Variables
extern ModInfo modInfo; // Stores the ID and version of our mod, and is sent to the modloader upon startup
inline modloader::ModInfo modInfo = {MOD_ID, VERSION, 0}; // Stores the ID and version of our mod, and is sent to the modloader upon startup

// Define these functions here so that we can easily read configuration and log information from other files
Configuration& getConfig();
Logger& getLogger();
Paper::ConstLoggerContext<17UL> getLogger();
5 changes: 2 additions & 3 deletions include/main.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,11 @@
#include "GlobalNamespace/GameplayModifiers.hpp"
#include "GlobalNamespace/PracticeSettings.hpp"
#include "HMUI/ViewController.hpp"
#include "questui/shared/BeatSaberUI.hpp"
#include "questui/shared/QuestUI.hpp"
#include "bsml/shared/BSML.hpp"
#include "HMUI/Touchable.hpp"

// Include the modloader header, which allows us to tell the modloader which mod this is, and the version etc.
#include "modloader/shared/modloader.hpp"
#include "scotland2/shared/loader.hpp"

#include "include/logger.hpp"
#include "include/config.hpp"
Expand Down
25 changes: 14 additions & 11 deletions mod.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,34 +2,37 @@
"_QPVersion": "0.1.1",
"name": "BSNightcoreQuest",
"id": "BSNightcoreQuest",
"modloader": "Scotland2",
"author": "Tatenshi",
"version": "0.1.0",
"packageId": "com.beatgames.beatsaber",
"packageVersion": "1.28.0_4124311467",
"packageVersion": "1.37.0_9064817954",
"description": "Removes pitch compensation to make songs go nightcore on different speed",
"coverImage": "",
"dependencies": [
{
"version": "^0.15.23",
"version": "^0.17.10",
"id": "custom-types",
"downloadIfMissing": "https://github.com/sc2ad/Il2CppQuestTypePatching/releases/download/v0.15.23/CustomTypes.qmod"
"downloadIfMissing": "https://github.com/QuestPackageManager/Il2CppQuestTypePatching/releases/download/v0.17.10/CustomTypes.qmod"
},
{
"version": "=0.33.0",
"id": "codegen",
"downloadIfMissing": "https://github.com/sc2ad/BeatSaber-Quest-Codegen/releases/download/v0.33.0/Codegen.qmod"
"version": "^0.4.43",
"id": "bsml",
"downloadIfMissing": "https://github.com/RedBrumbler/Quest-BSML/releases/download/v0.4.43/BSML.qmod"
},
{
"version": "^0.17.11",
"id": "questui",
"downloadIfMissing": "https://github.com/darknight1050/QuestUI/releases/download/v0.17.12/QuestUI.qmod"
"version": "^3.6.4",
"id": "paper",
"downloadIfMissing": "https://github.com/Fernthedev/paperlog/releases/download/v3.6.4/paperlog.qmod"
}
],
"modFiles": [
"modFiles": [],
"lateModFiles": [
"libBSNightcoreQuest.so"
],
"libraryFiles": [
"libbeatsaber-hook_3_14_0.so"
"libbeatsaber-hook_5_1_9.so",
"libsl2.so"
],
"fileCopies": [],
"copyExtensions": []
Expand Down
5 changes: 4 additions & 1 deletion mod.template.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,14 @@
"author": "Tatenshi",
"version": "0.1.0",
"packageId": "com.beatgames.beatsaber",
"packageVersion": "1.28.0_4124311467",
"packageVersion": "1.37.0_9064817954",
"coverImage": "",
"description": "Removes pitch compensation to make songs go nightcore on different speed",
"dependencies": [],
"modFiles": [],
"lateModFiles": [
"${binary}"
],
"libraryFiles": [],
"fileCopies": []
}
35 changes: 23 additions & 12 deletions qpm.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{
"version": "0.1.0",
"sharedDir": "shared",
"dependenciesDir": "extern",
"info": {
Expand All @@ -10,41 +11,51 @@
"overrideSoName": "libBSNightcoreQuest.so"
}
},
"workspace": {
"scripts": {},
"qmodIncludeDirs": [],
"qmodIncludeFiles": [],
"qmodOutput": null
},
"dependencies": [
{
"id": "beatsaber-hook",
"versionRange": "^3.14.0",
"versionRange": "^5.1.9",
"additionalData": {
"extraFiles": [
"src/inline-hook"
]
}
},
{
"id": "modloader",
"versionRange": "^1.2.3",
"id": "scotland2",
"versionRange": "^0.1.4",
"additionalData": {}
},
{
"id": "codegen",
"versionRange": "=0.33.0",
"id": "bs-cordl",
"versionRange": "^3700.0.0",
"additionalData": {}
},
{
"id": "config-utils",
"versionRange": "^1.0.2",
"versionRange": "^1.4.2",
"additionalData": {}
},
{
"id": "questui",
"versionRange": "^0.17.11",
"id": "custom-types",
"versionRange": "^0.17.10",
"additionalData": {}
},
{
"id": "custom-types",
"versionRange": "^0.15.23",
"id": "bsml",
"versionRange": "^0.4.43",
"additionalData": {}
},
{
"id": "paper",
"versionRange": "^3.6.4",
"additionalData": {}
}
],
"additionalData": {}
]
}
16 changes: 3 additions & 13 deletions src/logger.cpp
Original file line number Diff line number Diff line change
@@ -1,18 +1,8 @@
#include "logger.hpp"

ModInfo modInfo;

// Loads the config from disk using our modInfo, then returns it for use
Configuration &getConfig()
{
static Configuration config(modInfo);
config.Load();
return config;
}

// Returns a logger, useful for printing debug messages
Logger &getLogger()
Paper::ConstLoggerContext<17UL> getLogger()
{
static Logger *logger = new Logger(modInfo);
return *logger;
static auto fastContext = Paper::Logger::WithContext<"BSNightcoreQuest">();
return fastContext;
}
29 changes: 15 additions & 14 deletions src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,14 @@ MAKE_HOOK_MATCH(GameplayCoreInstallerInstallBindingsHook, &GlobalNamespace::Game
// Base Call
GameplayCoreInstallerInstallBindingsHook(self);

bool positiveSongMultiplier = (self->sceneSetupData->practiceSettings == NULL ? self->sceneSetupData->gameplayModifiers->get_songSpeedMul() : self->sceneSetupData->practiceSettings->get_songSpeedMul()) > 1;
bool positiveSongMultiplier = (self->_sceneSetupData->practiceSettings == NULL ? self->_sceneSetupData->gameplayModifiers->get_songSpeedMul() : self->_sceneSetupData->practiceSettings->get_songSpeedMul()) > 1;

// First check if we have a positive multiplier or if it was allowed to run in slower mode
// If this allows us, then we check if we are in practice mode and if yes if the change is allowed to run in practice mode
if((positiveSongMultiplier || getModConfig().EnableInSlowerMode.GetValue())
&& (self->sceneSetupData->practiceSettings == NULL || getModConfig().EnableInPractice.GetValue()))
&& (self->_sceneSetupData->practiceSettings == NULL || getModConfig().EnableInPractice.GetValue()))
{
self->audioManager->set_musicPitch(1);
self->_audioManager->set_musicPitch(1);
}
}

Expand All @@ -23,7 +23,7 @@ void DidActivate(HMUI::ViewController* self, bool firstActivation, bool addedToH
self->get_gameObject()->AddComponent<HMUI::Touchable*>();

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

// Add Options
AddConfigValueToggle(container->get_transform(), getModConfig().EnableInPractice);
Expand All @@ -32,29 +32,30 @@ void DidActivate(HMUI::ViewController* self, bool firstActivation, bool addedToH
}

// Called at the early stages of game loading
extern "C" void setup(ModInfo &info)
extern "C" __attribute__((visibility("default"))) void setup(CModInfo* info)
{
info.id = MOD_ID;
info.version = VERSION;
modInfo = info;
info->version = VERSION;
info->id = MOD_ID;
info->version_long = 0;
modInfo.assign(*info);

getConfig().Load(); // Load the config file
getModConfig().Init(modInfo);
getLogger().info("Completed setup!");
}

// Called later on in the game loading - a good time to install function hooks
extern "C" void load()
extern "C" __attribute__((visibility("default"))) void late_load()
{
// Init things
getModConfig().Init(modInfo);
il2cpp_functions::Init();
QuestUI::Init();
BSML::Init();

// Register our Settings
QuestUI::Register::RegisterModSettingsViewController(modInfo, DidActivate);
BSML::Register::RegisterSettingsMenu("BSNightcoreQuest", DidActivate, true);

// Install Hooks
auto logger = Paper::ConstLoggerContext("BSNightcoreQuest");
getLogger().info("Installing hooks...");
INSTALL_HOOK(getLogger(), GameplayCoreInstallerInstallBindingsHook);
INSTALL_HOOK(logger, GameplayCoreInstallerInstallBindingsHook);
getLogger().info("Installed all hooks!");
}

0 comments on commit 85311c5

Please sign in to comment.