diff --git a/.github/workflows/multi-platform.yml b/.github/workflows/multi-platform.yml new file mode 100644 index 0000000..1be0abf --- /dev/null +++ b/.github/workflows/multi-platform.yml @@ -0,0 +1,56 @@ +name: Build Geode Mod + +on: + workflow_dispatch: + push: + branches: + - "**" + +jobs: + build: + strategy: + fail-fast: false + matrix: + config: + - name: Windows + os: windows-latest + + - name: macOS + os: macos-latest + + - name: Android32 + os: ubuntu-latest + target: Android32 + + - name: Android64 + os: ubuntu-latest + target: Android64 + + name: ${{ matrix.config.name }} + runs-on: ${{ matrix.config.os }} + + steps: + - uses: actions/checkout@v4 + + - name: Build the mod + uses: geode-sdk/build-geode-mod@main + with: + cli: "v3.0.0-beta.1" + bindings: elnexreal/geode-bindings + bindings-ref: main + combine: true + target: ${{ matrix.config.target }} + + package: + name: Package builds + runs-on: ubuntu-latest + needs: ["build"] + + steps: + - uses: geode-sdk/build-geode-mod/combine@main + id: build + + - uses: actions/upload-artifact@v4 + with: + name: Build Output + path: ${{ steps.build.outputs.build-output }} diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..beb171c --- /dev/null +++ b/.gitignore @@ -0,0 +1,58 @@ +# Prerequisites +*.d + +# Compiled Object files +*.slo +*.lo +*.o +*.obj + +# Precompiled Headers +*.gch +*.pch + +# Compiled Dynamic libraries +*.so +*.dylib +*.dll + +# Fortran module files +*.mod +*.smod + +# Compiled Static libraries +*.lai +*.la +*.a +*.lib + +# Executables +*.exe +*.out +*.app + +# Macos be like +**/.DS_Store + +# Cache files for Sublime Text +*.tmlanguage.cache +*.tmPreferences.cache +*.stTheme.cache + +# Ignore build folders +**/build +# Ignore platform specific build folders +build-*/ + +# Workspace files are user-specific +*.sublime-workspace + +# ILY vscode +**/.vscode +.idea/ + +# clangd +.cache/ + +# Visual Studio +.vs/ diff --git a/CMakeLists.txt b/CMakeLists.txt new file mode 100644 index 0000000..e4c3c70 --- /dev/null +++ b/CMakeLists.txt @@ -0,0 +1,24 @@ +cmake_minimum_required(VERSION 3.21) +set(CMAKE_CXX_STANDARD 20) +set(CMAKE_CXX_STANDARD_REQUIRED ON) +set(CMAKE_OSX_ARCHITECTURES "x86_64") +set(CMAKE_CXX_VISIBILITY_PRESET hidden) + +project(MenuLoopRandomizer VERSION 1.0.0) + +add_library(${PROJECT_NAME} SHARED + src/main.cpp + # Add any extra C++ source files here +) + +set(GEODE_BINDINGS_REPO_PATH "D:\\Projects\\geode\\bindings") + +if (NOT DEFINED ENV{GEODE_SDK}) + message(FATAL_ERROR "Unable to find Geode SDK! Please define GEODE_SDK environment variable to point to Geode") +else() + message(STATUS "Found Geode: $ENV{GEODE_SDK}") +endif() + +add_subdirectory($ENV{GEODE_SDK} ${CMAKE_CURRENT_BINARY_DIR}/geode) + +setup_geode_mod(${PROJECT_NAME}) diff --git a/README.md b/README.md new file mode 100644 index 0000000..4803aa3 --- /dev/null +++ b/README.md @@ -0,0 +1,22 @@ +# MenuLoopRandomizer +This is where she makes a mod. + +the mod's logo + +*Update logo.png to change your mod's icon (please)* + +## Getting started +We recommend heading over to [the getting started section on our docs](https://docs.geode-sdk.org/getting-started/) for useful info on what to do next. + +## Build instructions +For more info, see [our docs](https://docs.geode-sdk.org/getting-started/create-mod#build) +```sh +# Assuming you have the CLI set up already +geode build +``` + +# Resources +* [Geode SDK Documentation](https://docs.geode-sdk.org/) +* [Geode SDK Source Code](https://github.com/geode-sdk/geode/) +* [Bindings](https://github.com/geode-sdk/bindings/) +* [Dev Tools](https://github.com/geode-sdk/DevTools) diff --git a/about.md b/about.md new file mode 100644 index 0000000..2cc2d4a --- /dev/null +++ b/about.md @@ -0,0 +1,14 @@ +# Menu Loop Randomizer + +Are you bored of hearing the same menu song over & over? Well... **No more of that!** + +This mod allows you to change the menu song every time you open the game, picking from the songs you downloaded through Newgrounds. + +# Notes + +- The song changes every time you restart the game, so you will not get another song every time you go back to the menu. +- In the future i'll add a setting to toggle between using NG songs or your own songs. + +# Thanks to! + +- [hiimjustin000](https://github.com/hiimjustin000) for helping me with the bindings problem (i was using an outdated version of geode LMAO) diff --git a/changelog.md b/changelog.md new file mode 100644 index 0000000..ade8b43 --- /dev/null +++ b/changelog.md @@ -0,0 +1,3 @@ +# v1.0.0 + +- Initial release diff --git a/logo.png b/logo.png new file mode 100644 index 0000000..af4fcf8 Binary files /dev/null and b/logo.png differ diff --git a/mod.json b/mod.json new file mode 100644 index 0000000..3ec605a --- /dev/null +++ b/mod.json @@ -0,0 +1,17 @@ +{ + "geode": "3.0.0-alpha.2", + "gd": { + "android": "2.206", + "win": "2.206" + }, + "version": "v1.0.0", + "id": "elnexreal.menu_loop_randomizer", + "name": "Menu Loop Randomizer", + "developer": "elnexreal", + "description": "Randomize your menu loop when opening the game.", + "links": { + "community": "https://discord.gg/vfFazvmKKb", + "source": "https://github.com/elnexreal/menu_loop_randomizer", + "homepage": "https://github.com/elnexreal" + } +} \ No newline at end of file diff --git a/src/main.cpp b/src/main.cpp new file mode 100644 index 0000000..4a86384 --- /dev/null +++ b/src/main.cpp @@ -0,0 +1,37 @@ +#include +#include +#include +#include + +using namespace geode::prelude; + +std::string selectedSong; + +$execute { + std::vector songs; + + // get the path for the songs + std::filesystem::path ngSongsPath = CCFileUtils::get()->getWritablePath(); + + // add all the mp3 files to the vector + for (auto &song : std::filesystem::directory_iterator(ngSongsPath)) { + if (song.path().string().ends_with(".mp3")) + songs.push_back(song.path().string()); + } + + // select a random item from the vector and return the path + std::random_device rd; + std::mt19937 gen(rd()); + std::uniform_int_distribution<> dist(0, songs.size() - 1); + int randomIndex = dist(gen); + + selectedSong = songs[randomIndex]; +} + +struct GameManagerHook : Modify { + gd::string getMenuMusicFile() { + // return GameManager::getMenuMusicFile(); + + return selectedSong; + } +}; \ No newline at end of file