Skip to content

Commit ff91770

Browse files
committed
initial commit
0 parents  commit ff91770

File tree

14 files changed

+1115
-0
lines changed

14 files changed

+1115
-0
lines changed
Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
name: Build Geode Mod
2+
3+
on:
4+
workflow_dispatch:
5+
push:
6+
branches:
7+
- "**"
8+
9+
jobs:
10+
build:
11+
strategy:
12+
fail-fast: false
13+
matrix:
14+
config:
15+
- name: Windows
16+
os: windows-latest
17+
18+
- name: macOS
19+
os: macos-latest
20+
21+
- name: Android32
22+
os: ubuntu-latest
23+
target: Android32
24+
25+
- name: Android64
26+
os: ubuntu-latest
27+
target: Android64
28+
29+
name: ${{ matrix.config.name }}
30+
runs-on: ${{ matrix.config.os }}
31+
32+
steps:
33+
- uses: actions/checkout@v4
34+
35+
- name: Build the mod
36+
uses: geode-sdk/build-geode-mod@main
37+
with:
38+
bindings: geode-sdk/bindings
39+
bindings-ref: main
40+
combine: true
41+
target: ${{ matrix.config.target }}
42+
43+
package:
44+
name: Package builds
45+
runs-on: ubuntu-latest
46+
needs: ['build']
47+
48+
steps:
49+
- uses: geode-sdk/build-geode-mod/combine@main
50+
id: build
51+
52+
- uses: actions/upload-artifact@v4
53+
with:
54+
name: Build Output
55+
path: ${{ steps.build.outputs.build-output }}

.gitignore

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
# Prerequisites
2+
*.d
3+
4+
# Compiled Object files
5+
*.slo
6+
*.lo
7+
*.o
8+
*.obj
9+
10+
# Precompiled Headers
11+
*.gch
12+
*.pch
13+
14+
# Compiled Dynamic libraries
15+
*.so
16+
*.dylib
17+
*.dll
18+
19+
# Fortran module files
20+
*.mod
21+
*.smod
22+
23+
# Compiled Static libraries
24+
*.lai
25+
*.la
26+
*.a
27+
*.lib
28+
29+
# Executables
30+
*.exe
31+
*.out
32+
*.app
33+
34+
# Macos be like
35+
**/.DS_Store
36+
37+
# Cache files for Sublime Text
38+
*.tmlanguage.cache
39+
*.tmPreferences.cache
40+
*.stTheme.cache
41+
42+
# Ignore build folders
43+
**/build
44+
# Ignore platform specific build folders
45+
build-*/
46+
47+
# Workspace files are user-specific
48+
*.sublime-workspace
49+
50+
# ILY vscode
51+
**/.vscode
52+
53+
# Local History for Visual Studio Code
54+
.history/
55+
56+
# clangd
57+
.cache/
58+
59+
# Visual Studio
60+
.vs/
61+
62+
# CLion
63+
.idea/
64+
/cmake-build-*/

CMakeLists.txt

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
cmake_minimum_required(VERSION 3.21)
2+
set(CMAKE_CXX_STANDARD 20)
3+
set(CMAKE_CXX_STANDARD_REQUIRED ON)
4+
set(CMAKE_OSX_ARCHITECTURES "arm64;x86_64")
5+
set(CMAKE_CXX_VISIBILITY_PRESET hidden)
6+
7+
project(DiscordRichPresence VERSION 1.0.0)
8+
9+
file(GLOB_RECURSE SOURCES
10+
src/*.cpp
11+
)
12+
13+
add_library(${PROJECT_NAME} SHARED ${SOURCES})
14+
15+
if (NOT DEFINED ENV{GEODE_SDK})
16+
message(FATAL_ERROR "Unable to find Geode SDK! Please define GEODE_SDK environment variable to point to Geode")
17+
else()
18+
message(STATUS "Found Geode: $ENV{GEODE_SDK}")
19+
endif()
20+
21+
target_include_directories(${PROJECT_NAME} PRIVATE src/)
22+
23+
add_subdirectory($ENV{GEODE_SDK} ${CMAKE_CURRENT_BINARY_DIR}/geode)
24+
25+
CPMAddPackage("gh:EclipseMenu/discord-presence#346214d")
26+
27+
target_link_libraries(${PROJECT_NAME} discord-rpc)
28+
29+
setup_geode_mod(${PROJECT_NAME} EXTERNALS ninxout.champions:1.0.0-alpha.1)

README.md

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
# DiscordRichPresence
2+
This is where she makes a mod.
3+
4+
<img src="logo.png" width="150" alt="the mod's logo" />
5+
6+
*Update logo.png to change your mod's icon (please)*
7+
8+
## Getting started
9+
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.
10+
11+
## Build instructions
12+
For more info, see [our docs](https://docs.geode-sdk.org/getting-started/create-mod#build)
13+
```sh
14+
# Assuming you have the Geode CLI set up already
15+
geode build
16+
```
17+
18+
# Resources
19+
* [Geode SDK Documentation](https://docs.geode-sdk.org/)
20+
* [Geode SDK Source Code](https://github.com/geode-sdk/geode/)
21+
* [Geode CLI](https://github.com/geode-sdk/cli)
22+
* [Bindings](https://github.com/geode-sdk/bindings/)
23+
* [Dev Tools](https://github.com/geode-sdk/DevTools)

about.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# Discord Rich Presence
2+
3+
Integrating Geometry Dash with your Discord Status
4+
5+
### Support
6+
DRPC has support for many mods, including:
7+
- Globed
8+
- EditorCollab
9+
- Champions (when it comes out)
10+
11+
### Credits
12+
- jay for the mod logo!
13+
- Eclipse/discord-presence (mostly developed by Prevter) for maintaining a sensible fork of discord-rpc

changelog.md

Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
## v4.0.0
2+
* COMPLETELY rewrite DRPC to have better code and have more compatability with mods
3+
4+
## v3.0.0 and v3.0.1
5+
* Update to Geode v4.0.0 and GD 2.2074
6+
7+
## v2.11.0
8+
* Added More Difficulties support! If you have the mod installed, the BD faces will display instead of their regular counterparts.
9+
10+
## v2.10.2
11+
* Bug fixes
12+
13+
## v2.10.1
14+
* Quick hotfixes
15+
16+
## v2.10.0
17+
* Major bugfixing
18+
19+
## v2.9.0
20+
* Create changelog.md by [@coopeeo](https://github.com/coopeeo) in [#9](https://github.com/TechStudent10/DiscordRPC/pull/9)
21+
* Add several pages to rich presence by [@NetheriteMiner](https://github.com/NetheriteMiner) in [#12](https://github.com/TechStudent10/DiscordRPC/pull/12)
22+
* Fixed weekly detection and adjusted grammar by [@NetheriteMiner](https://github.com/NetheriteMiner) in [#13](https://github.com/TechStudent10/DiscordRPC/pull/13)
23+
24+
## v2.8.0
25+
* developers can use the API to add RPC to their own mods !!! (still in development)
26+
* spinoff level support
27+
28+
## v2.7.0
29+
* fixes "RobTopGames" showing up as the author on every level
30+
* adds back some macOS functionality that I forgot to add back ([#7](https://github.com/TechStudent10/DiscordRPC/issues/7))
31+
32+
## 2.6.0 (the macOS renaissance)
33+
* re-added mac support (!!!!)
34+
* fixed [#6](https://github.com/TechStudent10/DiscordRPC/issues/6)
35+
* added show percent option
36+
37+
## v2.5.0 (the fall of macOS)
38+
* no more macOS support (sorry to the four people on mac)
39+
* auto updating percent
40+
* auto updating object count
41+
* platform indication
42+
* new logo (again) by [@FireMario211](user:6253758) ([GitHub](https://github.com/FireMario211))
43+
44+
## v2.4.0 (the macOS revolution)
45+
* mac support woo!
46+
* new logo by [@Alphalaneous](user:1139015) ([GitHub](https://github.com/Alphalaneous))
47+
48+
## v2.3.0
49+
* no longer pollutes platform console (you're welcome developers)
50+
* adds time to platformers
51+
* j
52+
53+
## v2.2.0 (the funny)
54+
* bug fixes and some new features !!! (download to find out)
55+
56+
## v2.1.0
57+
* Fixes the timestamp bug while in PlayLayer
58+
* Adds distinction between normal and platformer levels.
59+
* Daily level indication (weekly not possible yet)'
60+
61+
## v2.0.0
62+
* This version is compatible with Geometry Dash 2.204 on Windows.
63+
64+
## v1.3.0
65+
* new changes: timestamps
66+
* probably also bug fixes
67+
68+
## v1.2.0
69+
* another bug fix update
70+
* yes there are that many bugs
71+
72+
## v1.1.0
73+
* INCLUDES TONS AND TONS OF BUG FIXES
74+
75+
## v1.0.0 (First Release)
76+
* First release of this mod

logo.png

46.9 KB
Loading

mod.json

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
{
2+
"geode": "4.7.0",
3+
"gd": {
4+
"win": "2.2074",
5+
"android": "2.2074",
6+
"mac": "2.2074",
7+
"ios": "2.2074"
8+
},
9+
"id": "techstudent10.discord_rich_presence",
10+
"name": "Discord Rich Presence",
11+
"version": "v4.0.0",
12+
"developer": "TechStudent10",
13+
"description": "DiscordRPC for Geometry Dash",
14+
"settings": {
15+
"private-info": {
16+
"name": "Show sensitive info",
17+
"description": "Allows this mod to show things like level names in the creator tab for the world to see (no not your password)",
18+
"type": "bool",
19+
"default": false
20+
},
21+
"idling": {
22+
"name": "Show idle status",
23+
"description": "Will change your status to idle when GD is unfocused",
24+
"type": "bool",
25+
"default": true
26+
}
27+
},
28+
"dependencies": {
29+
"ninxout.champions": {
30+
"importance": "suggested",
31+
"version": "1.0.0-alpha.1"
32+
}
33+
}
34+
}

src/main.cpp

Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
#include <Geode/Geode.hpp>
2+
#include <managers/RPCManager.hpp>
3+
#include <managers/Observer.hpp>
4+
5+
using namespace geode::prelude;
6+
7+
std::string getSysName() {
8+
#ifdef GEODE_WINDOWS
9+
return "Windows";
10+
#else
11+
return "macOS";
12+
#endif
13+
}
14+
15+
$on_mod(Loaded) {
16+
auto& rpcManager = RPCManager::get();
17+
rpcManager.initRPC();
18+
rpcManager.defaultState = "Browsing menus";
19+
rpcManager.defaultLargeImage = "gd-large";
20+
rpcManager.defaultLargeImageText = fmt::format("Playing Geometry Dash on {}", getSysName());
21+
rpcManager.startTime = time(0);
22+
23+
// start doing things
24+
Observer::get();
25+
}
26+
27+
// this is here solely to keep backwards compatability; mods should NOT use this API
28+
$execute {
29+
using NewRPCFilter = geode::DispatchFilter<std::string>;
30+
new EventListener<NewRPCFilter>(+[](std::string const& newRPCStr) {
31+
auto newRPCRes = matjson::parse(newRPCStr);
32+
if (newRPCRes.isErr()) {
33+
log::error("err updating rpc: {}", newRPCRes.err()->message);
34+
return ListenerResult::Propagate;
35+
}
36+
auto& rpcManager = RPCManager::get();
37+
auto newRPC = newRPCRes.unwrap();
38+
rpcManager.setRPC({
39+
.state = newRPC["state"].asString().unwrapOr(""),
40+
.details = newRPC["details"].asString().unwrapOr(""),
41+
.maxPartySize = static_cast<int>(newRPC["partyMax"].asInt().unwrapOr(1)),
42+
.largeImage = newRPC["largeImageKey"].asString().unwrapOr(""),
43+
.largeImageText = newRPC["largeImageText"].asString().unwrapOr(""),
44+
.smallImage = newRPC["smallImageKey"].asString().unwrapOr(""),
45+
.smallImageText = newRPC["smallImageText"].asString().unwrapOr(""),
46+
47+
});
48+
// gdrpc::GDRPC::getSharedInstance()->updateDiscordRP(
49+
// newRPC["modID"].asString().unwrapOr(""),
50+
// ,
51+
// ,
52+
// ,
53+
// ,
54+
// newRPC["useTime"].asBool().unwrapOr(false),
55+
// newRPC["shouldResetTime"].asBool().unwrapOr(false),
56+
// ,
57+
// 0,
58+
// newRPC["joinSecret"].asString().unwrapOr(""),
59+
// ,
60+
61+
// );
62+
return ListenerResult::Propagate;
63+
}, NewRPCFilter("update_rpc"_spr));
64+
65+
using ToggleRPCFilter = geode::DispatchFilter<bool>;
66+
new EventListener(+[](bool enabled) {
67+
Observer::get().isRPCOverridden = !enabled;
68+
return ListenerResult::Propagate;
69+
}, ToggleRPCFilter("set_default_rpc_enabled"_spr));
70+
};

0 commit comments

Comments
 (0)