Skip to content

Commit

Permalink
initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
pundang committed Jun 12, 2024
0 parents commit cac95ad
Show file tree
Hide file tree
Showing 9 changed files with 231 additions and 0 deletions.
56 changes: 56 additions & 0 deletions .github/workflows/multi-platform.yml
Original file line number Diff line number Diff line change
@@ -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 }}
58 changes: 58 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -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/
24 changes: 24 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -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})
22 changes: 22 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# MenuLoopRandomizer
This is where she makes a mod.

<img src="logo.png" width="150" alt="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)
14 changes: 14 additions & 0 deletions about.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# Menu Loop Randomizer

Are you bored of hearing the same menu song <cr>over & over</cr>? 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) <cj>for helping me with the bindings problem (i was using an outdated version of geode LMAO)</cj>
3 changes: 3 additions & 0 deletions changelog.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# v1.0.0

- Initial release
Binary file added logo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
17 changes: 17 additions & 0 deletions mod.json
Original file line number Diff line number Diff line change
@@ -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"
}
}
37 changes: 37 additions & 0 deletions src/main.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
#include <Geode/Geode.hpp>
#include <Geode/modify/GameManager.hpp>
#include <random>
#include <vector>

using namespace geode::prelude;

std::string selectedSong;

$execute {
std::vector<std::string> 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<GameManagerHook, GameManager> {
gd::string getMenuMusicFile() {
// return GameManager::getMenuMusicFile();

return selectedSong;
}
};

0 comments on commit cac95ad

Please sign in to comment.