From a5395c4c62e566e388b0192bb6728c317b7974e6 Mon Sep 17 00:00:00 2001
From: Erymanthus | RayDeeUx <51521765+RayDeeUx@users.noreply.github.com>
Date: Wed, 13 Nov 2024 19:40:38 -0500
Subject: [PATCH] v4?
---
about.md | 6 ++--
changelog.md | 3 ++
mod.json | 19 +++++-----
src/OptionsLayer.cpp | 36 -------------------
src/Settings.cpp | 7 ++--
src/Settings.hpp | 84 ++++++++++++++++++++++++--------------------
src/main.cpp | 2 +-
7 files changed, 65 insertions(+), 92 deletions(-)
delete mode 100644 src/OptionsLayer.cpp
diff --git a/about.md b/about.md
index 1421ab4..3f75ad5 100644
--- a/about.md
+++ b/about.md
@@ -4,16 +4,14 @@ Are you bored of hearing the same menu song over & over? Well... **No m
This mod allows you to randomize the menu song every time you open the game, picking from a random downloaded song from Newgrounds, RobTop's Music Library, or your own songs. `.mp3`, `.ogg`/`.oga`, `.wav`, and `.flac` files are supported.
# Adding custom songs
-If you want to add your own songs to the mod you should go to the settings tab, then click the pink folder button. Just like with grabbing songs you've downloaded from Newgrounds or RobTop's Music Library, `.mp3` and `.ogg` files are supported.
+If you want to add your own songs to the mod you should go to the mod's settings menu, then "Click me to open the Config Directory!". Just like the songs you've downloaded from Newgrounds or RobTop's Music Library, `.mp3` and `.ogg` files are supported.
![Screenshot on how to use it. Install the mod to view this screenshot!](elnexreal.menuloop_randomizer/screenshot.png)
`.oga`, `.flac` and `.wav` files are also supported, for the few audiophiles who want the highest of audio quality out there.
-*Note:* ***There is an alternative config directory shortcut button within the mod's settings, in case you have QOLMod installed.***
-
## Android
-*If you click the folder and you get sent to the geode folder itself, you should go to `game/geode/config/elnexreal.menuloop_randomizer` and put the songs there*
+*If you click the config directory shortcut and you get sent to the geode folder itself, you should go to `game/geode/config/elnexreal.menuloop_randomizer` and put the songs there*
# Blacklisting songs
Ever felt like a song was an absolute dud? Click the (crudely drawn) blacklist button and you won't ever hear that song as a menu loop again.
diff --git a/changelog.md b/changelog.md
index ceccb26..a1a6490 100644
--- a/changelog.md
+++ b/changelog.md
@@ -1,3 +1,6 @@
+# v1.6.2
+- Port to 2.2074.
+- Remove the pink button config directory shortcut.
# v1.6.1
- Redo the button for blacklisting songs. Base icon shape provided by [FREAKINGDAN](https://github.com/freakingdan).
- Reduce confusion when copying song names/IDs while playing songs replaced by Jukebox/Auto Nong. {Reported by CyBlanc}
diff --git a/mod.json b/mod.json
index 843d28f..467a200 100644
--- a/mod.json
+++ b/mod.json
@@ -1,11 +1,11 @@
{
- "geode": "3.4.0",
+ "geode": "4.0.0-alpha.1",
"gd": {
- "win": "2.206",
- "android": "2.206",
- "mac": "2.206"
+ "win": "2.2074",
+ "android": "2.2074",
+ "mac": "2.2074"
},
- "version": "v1.6.1",
+ "version": "v1.6.2",
"id": "elnexreal.menuloop_randomizer",
"name": "Menu Loop Randomizer",
"developers": ["RayDeeUx", "elnexreal"],
@@ -16,7 +16,8 @@
"configdir": {
"name": "Click me to open the Config Directory!",
"desc": "(Hopefully.)\nThis setting does literally nothing new except being a button that acts as a shortcut to open the config directory for this mod (which is kind of important for using this mod properly, because this is where you will store menu loops), because the legendary developers in the Geode Team themselves forgot to add a shortcut button that would have done this exact same thing, and I have gotten far too many folks (rightfully) asking me to find the config directory when using some of my other mods, and I hate repeating the same things over and over again, and I don't know if the next major update for Geode will also repeat this mistake where HJfod forgets to include a config directory shortcut button, so this setting and this button are here for extra insurance, so please enjoy this extra button, I guess. Anyway, by the time you're finished reading this, your device should be finished with opening the config directory; press \"Aight\" to close this window.",
- "type": "custom"
+ "description": "(Hopefully.)\nThis setting does literally nothing new except being a button that acts as a shortcut to open the config directory for this mod (which is kind of important for using this mod properly, because this is where you will store menu loops), because the legendary developers in the Geode Team themselves forgot to add a shortcut button that would have done this exact same thing, and I have gotten far too many folks (rightfully) asking me to find the config directory when using some of my other mods, and I hate repeating the same things over and over again, and I don't know if the next major update for Geode will also repeat this mistake where HJfod forgets to include a config directory shortcut button, so this setting and this button are here for extra insurance, so please enjoy this extra button, I guess. Anyway, by the time you're finished reading this, your device should be finished with opening the config directory; press \"Aight\" to close this window.",
+ "type": "custom:configdir"
},
"useCustomSongs": {
"name": "Use Custom Songs Instead",
@@ -155,13 +156,9 @@
{
"id": "geode.node-ids",
"importance": "required",
- "version": ">=1.13.1"
+ "version": ">=1.16.0"
}
],
- "issues": {
- "url": "https://discord.com/channels/911701438269386882/1205523212444639292",
- "info": "To disable hyphen prefixes and suffixes in custom messages, edit saved.json. For other issues, ping me (@erymanthus) in the Geode SDK Discord server's #help channel if you need help. DMs are NOT accepted."
- },
"links": {
"community": "https://discord.gg/WqZBYdBWZW",
"homepage": "https://discord.com/channels/822510988409831486/1206371881222144020"
diff --git a/src/OptionsLayer.cpp b/src/OptionsLayer.cpp
deleted file mode 100644
index 9988952..0000000
--- a/src/OptionsLayer.cpp
+++ /dev/null
@@ -1,36 +0,0 @@
-#include
-
-using namespace geode::prelude;
-
-class $modify(MenuLoopOLHook, OptionsLayer) {
- void customSetup() {
- OptionsLayer::customSetup();
-
- if (Loader::get()->getLoadedMod("thesillydoggo.qolmod")) return;
-
- // add the folder btn to the settings layer
- auto menu = CCMenu::create();
-
- auto btn = CCMenuItemSpriteExtra::create(
- CircleButtonSprite::create(
- CCSprite::createWithSpriteFrameName("gj_folderBtn_001.png"),
- CircleBaseColor::Pink
- ),
- this,
- menu_selector(MenuLoopOLHook::onSongsBtn)
- );
-
- btn->setPosition({-144.0f, -60.0f});
- btn->m_scaleMultiplier = 1.1f;
- btn->setID("songs-button"_spr);
-
- menu->addChild(btn);
- menu->setID("songs-button-menu"_spr);
-
- m_mainLayer->addChild(menu);
- }
-
- void onSongsBtn(CCObject *sender) {
- file::openFolder(Mod::get()->getConfigDir());
- }
-};
\ No newline at end of file
diff --git a/src/Settings.cpp b/src/Settings.cpp
index cfc9a75..057cf81 100644
--- a/src/Settings.cpp
+++ b/src/Settings.cpp
@@ -1,7 +1,10 @@
#include "Settings.hpp"
-SettingNode* MySettingValue::createNode(float width) {
- return MySettingNode::create(this, width);
+SettingNodeV3* MyButtonSettingV3::createNode(float width) {
+ return MyButtonSettingNodeV3::create(
+ std::static_pointer_cast(shared_from_this()),
+ width
+ );
}
// i had to include this cpp file because C++ is a legendary language!
\ No newline at end of file
diff --git a/src/Settings.hpp b/src/Settings.hpp
index f96e2e9..51274b5 100644
--- a/src/Settings.hpp
+++ b/src/Settings.hpp
@@ -1,28 +1,45 @@
#pragma once
-#include
+#include
using namespace geode::prelude;
-class MySettingValue : public
-
-SettingValue
-
-{
-protected:
- std::string m_placeholder;
+class MyButtonSettingV3 : public SettingV3 {
public:
- MySettingValue(std::string const& key, std::string const& modID, std::string const& placeholder)
- : SettingValue(key, modID), m_placeholder(placeholder) {}
- bool load(matjson::Value const& json) override { return true; }
- bool save(matjson::Value& json) const override { return true; }
- SettingNode* createNode(float width) override;
+ static Result> parse(std::string const& key, std::string const& modID, matjson::Value const& json) {
+ auto res = std::make_shared();
+ auto root = checkJson(json, "MyButtonSettingV3");
+ res->init(key, modID, root);
+ res->parseNameAndDescription(root);
+ res->parseEnableIf(root);
+ return root.ok(std::static_pointer_cast(res));
+ }
+ bool load(matjson::Value const& json) override {
+ return true;
+ }
+ bool save(matjson::Value& json) const override {
+ return true;
+ }
+ bool isDefaultValue() const override {
+ return true;
+ }
+ void reset() override {}
+ // SettingNodeV3* createNode(float width) override; // this line is [absolutely] certified cringe
+ SettingNodeV3 *createNode(float width) override; // this line is NOT certified cringe
};
-class MySettingNode : public SettingNode {
+class MyButtonSettingNodeV3 : public SettingNodeV3 {
private:
std::string m_desc = "";
-protected:
+public:
+ void onCommit() {}
+ void onResetToDefault() {}
+ bool hasUncommittedChanges() const {
+ return false;
+ }
+ bool hasNonDefaultValue() const {
+ return false;
+ }
void onConfigDirButton(CCObject*) {
file::openFolder(Mod::get()->getConfigDir());
#ifndef GEODE_IS_MOBILE
@@ -34,47 +51,38 @@ class MySettingNode : public SettingNode {
)->show();
#endif
}
- bool init(MySettingValue* value, float width) {
- if (!SettingNode::init(value))
- return false;
+ bool init(std::shared_ptr setting, float width) {
+ if (!SettingNodeV3::init(setting, width)) return false;
this->setContentSize({ width, 40.f });
- std::string name = Mod::get()->getSettingDefinition(value->getKey())->get()->json->get("name");
- m_desc = Mod::get()->getSettingDefinition(value->getKey())->get()->json->get("desc");
-
+ std::string name = setting->getName().value();
+ m_desc = setting->getDescription().value();
auto theMenu = CCMenu::create();
auto theLabel = CCLabelBMFont::create(name.c_str(), "bigFont.fnt");
- // copied a bit from viper
+ // copied a bit from louis ck jr
theLabel->setScale(.35f);
theLabel->limitLabelWidth(300.f, .35f, .25f); // added by Ery. max width is 346.f
- auto theLabelAsAButton = CCMenuItemSpriteExtra::create(theLabel, this, menu_selector(MySettingNode::onConfigDirButton));
+ auto theLabelAsAButton = CCMenuItemSpriteExtra::create(theLabel, this, menu_selector(MyButtonSettingNodeV3::onConfigDirButton));
theLabelAsAButton->setPositionX(0);
+ theLabelAsAButton->setID("config-dir-shortcut-button"_spr);
theMenu->addChild(theLabelAsAButton);
theMenu->setPosition(width / 2, 20.f);
+ theMenu->setID("config-dir-shortcut-menu"_spr);
this->addChild(theMenu);
- return true;
- }
+ for (const auto &node : CCArrayExt(this->getChildren())) {
+ node->setVisible(!node->getID().empty());
+ }
-public:
- void commit() override {
- this->dispatchCommitted();
- }
- bool hasUncommittedChanges() override {
- return false;
- }
- bool hasNonDefaultValue() override {
return true;
}
- void resetToDefault() override {}
-
- static MySettingNode* create(MySettingValue* value, float width) {
- auto ret = new MySettingNode();
- if (ret && ret->init(value, width)) {
+ static MyButtonSettingNodeV3* create(std::shared_ptr setting, float width) {
+ auto ret = new MyButtonSettingNodeV3();
+ if (ret && ret->init(setting, width)) {
ret->autorelease();
return ret;
}
diff --git a/src/main.cpp b/src/main.cpp
index 8a87f96..1045254 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -1,7 +1,7 @@
#include "SongManager.hpp"
#include "Utils.hpp"
#include "Settings.hpp"
-#include
+#include
using namespace geode::prelude;