Skip to content

Commit 39fa4c3

Browse files
committed
Merge branch 'main' of https://github.com/geode-sdk/DevTools into main
2 parents 96f232a + 9d15112 commit 39fa4c3

17 files changed

Lines changed: 511 additions & 172 deletions

.github/workflows/build.yml

Lines changed: 27 additions & 97 deletions
Original file line numberDiff line numberDiff line change
@@ -6,119 +6,49 @@ on:
66
branches:
77
- '**'
88

9-
env:
10-
GEODE_SDK: ${{ github.workspace }}/sdk
11-
GEODE_VERSION: nightly
12-
CLI_VERSION: v2.2.2
13-
MOD_NAME: DevTools
14-
MOD_ID: geode.devtools
15-
169
jobs:
1710
build:
1811
strategy:
1912
fail-fast: false
2013
matrix:
2114
config:
22-
- name: "Windows"
23-
bin_folder: "windows"
24-
os: windows-2019
25-
extra_flags: '-T host=x64 -A win32'
26-
out_paths: './build/Release/*.dll'
27-
platform_suffix: 'win'
28-
29-
- name: "macOS"
30-
bin_folder: "macos"
31-
os: macos-latest
32-
extra_flags: ""
33-
out_paths: './build/*.dylib'
34-
platform_suffix: 'mac'
15+
- name: Windows
16+
os: windows-latest
3517

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+
3629
name: ${{ matrix.config.name }}
3730
runs-on: ${{ matrix.config.os }}
3831

3932
steps:
40-
- uses: actions/checkout@v3
41-
with:
42-
submodules: recursive
33+
- uses: actions/checkout@v3
4334

44-
- uses: actions/checkout@v3
45-
with:
46-
submodules: recursive
47-
repository: geode-sdk/geode
48-
# ref: v0.4.8
49-
path: ${{ env.GEODE_SDK }}
50-
51-
- uses: ilammy/msvc-dev-cmd@v1
52-
with:
53-
arch: x86
35+
- name: Build the mod
36+
uses: geode-sdk/build-geode-mod@main
37+
with:
38+
sdk: nightly
39+
combine: true
40+
target: ${{ matrix.config.target }}
5441

55-
- name: Download Geode SDK binaries
56-
run: |
57-
cd ${{ github.workspace }}/sdk
58-
mkdir bin
59-
mkdir bin/nightly
60-
cd bin/nightly
61-
curl -L https://github.com/geode-sdk/geode/releases/download/${{ env.GEODE_VERSION }}/geode-${{ env.GEODE_VERSION }}-${{ matrix.config.platform_suffix }}.zip -o geode-sdk.zip
62-
tar -xf geode-sdk.zip
63-
64-
- name: Configure CMake
65-
run: |
66-
cd ${{ github.workspace }}
67-
cmake -B build ${{ matrix.config.extra_flags }} -DGEODE_DISABLE_CLI_CALLS=1
68-
69-
- name: Build
70-
run: |
71-
cd ${{ github.workspace }}/build
72-
cmake --build . --config Release
73-
74-
- uses: actions/upload-artifact@v3
75-
with:
76-
name: "build-${{ matrix.config.bin_folder }}"
77-
path: "${{ matrix.config.out_paths }}"
78-
79-
8042
package:
81-
name: "Package both builds"
82-
# would use linux but theres no cli build for it
83-
runs-on: windows-2019
43+
name: Package builds
44+
runs-on: ubuntu-latest
8445
needs: ['build']
85-
86-
steps:
87-
- uses: actions/checkout@v3
88-
with:
89-
submodules: recursive
90-
91-
- name: Download and Unzip CLI
92-
run: |
93-
curl -L https://github.com/geode-sdk/cli/releases/download/${{ env.CLI_VERSION }}/geode-cli-${{ env.CLI_VERSION }}-win.zip -o geode-cli.zip
94-
tar -xf geode-cli.zip
9546

96-
- uses: actions/download-artifact@v3
97-
with:
98-
name: build-windows
99-
100-
- uses: actions/download-artifact@v3
101-
with:
102-
name: build-macos
103-
104-
- name: Merge
105-
shell: bash
106-
run: |
107-
mv $MOD_NAME.dll $MOD_ID.dll
108-
mv lib$MOD_NAME.dylib $MOD_ID.dylib
109-
./geode.exe package new . --binary $MOD_ID.dll --binary $MOD_ID.dylib --output $MOD_ID.geode
110-
47+
steps:
48+
- uses: geode-sdk/build-geode-mod@combine
49+
id: build
50+
11151
- uses: actions/upload-artifact@v3
11252
with:
11353
name: Build Output
114-
path: "${{ env.MOD_ID }}.geode"
115-
116-
- uses: geekyeggo/delete-artifact@v2
117-
with:
118-
name: build-windows
119-
failOnError: false
120-
121-
- uses: geekyeggo/delete-artifact@v2
122-
with:
123-
name: build-macos
124-
failOnError: false
54+
path: ${{ steps.build.outputs.build-output }}

.gitignore

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,11 @@ Source/Geode/pkg/uber-apk-signer.jar
1010

1111
# ILY vscode
1212
**/.vscode
13+
**/.idea
14+
15+
**/.idea
1316

1417
imgui/**
1518
imgui
19+
20+
.cache/

CMakeLists.txt

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,7 @@ else()
1818
message(STATUS "Found Geode: $ENV{GEODE_SDK}")
1919
endif()
2020

21-
set(GEODE_LINK_NIGHTLY ON)
22-
add_subdirectory($ENV{GEODE_SDK} $ENV{GEODE_SDK}/build)
23-
24-
include(cmake/CPM.cmake)
21+
add_subdirectory($ENV{GEODE_SDK} ${CMAKE_CURRENT_BINARY_DIR}/geode)
2522

2623
CPMAddPackage("gh:ocornut/imgui#c191faf")
2724

@@ -44,6 +41,8 @@ elseif(ANDROID)
4441
target_link_libraries(${PROJECT_NAME} GLESv2)
4542
endif()
4643

44+
# i still dont like this (alk)
45+
target_compile_definitions(geode-sdk INTERFACE GEODE_EXPOSE_SECRET_INTERNALS_IN_HEADERS_DO_NOT_DEFINE_PLEASE)
4746

48-
target_link_libraries(${PROJECT_NAME} geode-sdk)
49-
create_geode_file(${PROJECT_NAME})
47+
# Set up dependencies, resources, link Geode
48+
setup_geode_mod(${PROJECT_NAME})

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
Browser-like developer tools for Geode.
44

5-
Press `F11` to open up the dev tools.
5+
Press `F11` (`F10` for MacOS) to open up the dev tools.
66

77
## Features
88

mod.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
2-
"geode": "v1.0.0",
3-
"version": "v1.1.1",
2+
"geode": "v2.0.0",
3+
"version": "v1.3.0",
44
"id": "geode.devtools",
55
"name": "DevTools",
66
"developer": "Geode Team",

src/DevTools.cpp

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,14 @@ bool DevTools::pausedGame() const {
2424
return m_pauseGame;
2525
}
2626

27+
bool DevTools::isSetup() const {
28+
return m_setup;
29+
}
30+
31+
bool DevTools::shouldOrderChildren() const {
32+
return m_orderChildren;
33+
}
34+
2735
CCNode* DevTools::getSelectedNode() const {
2836
return m_selectedNode;
2937
}
@@ -61,9 +69,12 @@ void DevTools::drawPages() {
6169

6270
ImGui::DockBuilderDockWindow("###devtools/tree", topLeftDock);
6371
ImGui::DockBuilderDockWindow("###devtools/settings", topLeftDock);
72+
ImGui::DockBuilderDockWindow("###devtools/advanced/settings", topLeftDock);
6473
ImGui::DockBuilderDockWindow("###devtools/attributes", bottomLeftTopHalfDock);
6574
ImGui::DockBuilderDockWindow("###devtools/preview", leftDock);
6675
ImGui::DockBuilderDockWindow("###devtools/geometry-dash", id);
76+
ImGui::DockBuilderDockWindow("###devtools/advanced/mod-graph", topLeftDock);
77+
ImGui::DockBuilderDockWindow("###devtools/advanced/mod-index", topLeftDock);
6778

6879
ImGui::DockBuilderFinish(id);
6980
}
@@ -78,6 +89,13 @@ void DevTools::drawPages() {
7889
&DevTools::drawSettings
7990
);
8091

92+
if (m_advancedSettings) {
93+
this->drawPage(
94+
U8STR(FEATHER_SETTINGS " Advanced Settings###devtools/advanced/settings"),
95+
&DevTools::drawAdvancedSettings
96+
);
97+
}
98+
8199
this->drawPage(
82100
U8STR(FEATHER_TOOL " Attributes###devtools/attributes"),
83101
&DevTools::drawAttributes
@@ -87,6 +105,20 @@ void DevTools::drawPages() {
87105
U8STR(FEATHER_DATABASE " Preview###devtools/preview"),
88106
&DevTools::drawPreview
89107
);
108+
109+
if (m_showModGraph) {
110+
this->drawPage(
111+
U8STR(FEATHER_SHARE_2 " Mod Graph###devtools/advanced/mod-graph"),
112+
&DevTools::drawModGraph
113+
);
114+
}
115+
116+
if (m_showModIndex) {
117+
this->drawPage(
118+
U8STR(FEATHER_LIST " Mod Index###devtools/advanced/mod-index"),
119+
&DevTools::drawModIndex
120+
);
121+
}
90122
}
91123

92124
void DevTools::draw(GLRenderCtx* ctx) {
@@ -154,6 +186,11 @@ void DevTools::setup() {
154186

155187
this->setupFonts();
156188
this->setupPlatform();
189+
190+
#ifdef GEODE_IS_MOBILE
191+
ImGui::GetIO().FontGlobalScale = 3.f;
192+
ImGui::GetStyle().ScrollbarSize = 60.f;
193+
#endif
157194
}
158195

159196
void DevTools::show(bool visible) {

src/DevTools.hpp

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
#include <cocos2d.h>
77
#include <Geode/utils/cocos.hpp>
88
#include <unordered_map>
9+
#include <Geode/loader/Index.hpp>
910

1011
using namespace geode::prelude;
1112

@@ -25,7 +26,12 @@ class DevTools {
2526
bool m_alwaysHighlight = true;
2627
bool m_shouldRelayout = false;
2728
bool m_highlightLayouts = false;
29+
bool m_arrowExpand = false;
30+
bool m_advancedSettings = false;
31+
bool m_showModGraph = false;
32+
bool m_showModIndex = false;
2833
bool m_pauseGame = false;
34+
bool m_orderChildren = true;
2935
std::string m_theme = DARK_THEME;
3036
ImGuiID m_dockspaceID;
3137
ImFont* m_defaultFont = nullptr;
@@ -41,13 +47,19 @@ class DevTools {
4147
void drawTree();
4248
void drawTreeBranch(CCNode* node, size_t index);
4349
void drawSettings();
50+
void drawAdvancedSettings();
4451
void drawNodeAttributes(CCNode* node);
4552
void drawAttributes();
4653
void drawPreview();
4754
void drawNodePreview(CCNode* node);
4855
void drawHighlight(CCNode* node, HighlightMode mode);
4956
void drawLayoutHighlights(CCNode* node);
5057
void drawGD(GLRenderCtx* ctx);
58+
void drawModGraph();
59+
void drawModGraphNode(Mod* node);
60+
ModMetadata inputMetadata(void* treePtr, ModMetadata metadata);
61+
void drawModIndex();
62+
void drawIndexItem(IndexItemHandle const& node);
5163
void drawPage(const char* name, void(DevTools::* fun)());
5264
void drawPages();
5365
void draw(GLRenderCtx* ctx);
@@ -60,6 +72,8 @@ class DevTools {
6072

6173
bool shouldPopGame() const;
6274
bool pausedGame() const;
75+
bool isSetup() const;
76+
bool shouldOrderChildren() const;
6377

6478
CCNode* getSelectedNode() const;
6579
void selectNode(CCNode* node);

src/backend.cpp

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,8 +49,10 @@ void DevTools::newFrame() {
4949
);
5050
io.DeltaTime = director->getDeltaTime();
5151

52+
#ifdef GEODE_IS_DESKTOP
5253
const auto mousePos = toVec2(geode::cocos::getMousePos());
5354
io.AddMousePosEvent(mousePos.x, mousePos.y);
55+
#endif
5456

5557
// TODO: text input
5658

@@ -141,6 +143,8 @@ static float SCROLL_SENSITIVITY = 10;
141143

142144
class $modify(CCMouseDispatcher) {
143145
bool dispatchScrollMSG(float y, float x) {
146+
if(!DevTools::get()->isSetup()) return true;
147+
144148
auto& io = ImGui::GetIO();
145149
io.AddMouseWheelEvent(x / SCROLL_SENSITIVITY, -y / SCROLL_SENSITIVITY);
146150

@@ -156,6 +160,14 @@ class $modify(CCTouchDispatcher) {
156160
void touches(CCSet* touches, CCEvent* event, unsigned int type) {
157161
auto& io = ImGui::GetIO();
158162
auto* touch = static_cast<CCTouch*>(touches->anyObject());
163+
164+
// for some reason mac can filter out out of touches i think?
165+
if (touch == nullptr) {
166+
// i am very lazy to find ccset count
167+
// i don't even know if the std set in gnustl and libc++ are the same struct
168+
return;
169+
}
170+
159171
const auto pos = toVec2(touch->getLocation());
160172
io.AddMousePosEvent(pos.x, pos.y);
161173
if (io.WantCaptureMouse) {
@@ -204,10 +216,10 @@ class $modify(CCTouchDispatcher) {
204216
};
205217

206218
class $modify(CCIMEDispatcher) {
207-
void dispatchInsertText(const char* text, int len) {
219+
void dispatchInsertText(const char* text, int len, enumKeyCodes key) {
208220
auto& io = ImGui::GetIO();
209221
if (!io.WantCaptureKeyboard) {
210-
CCIMEDispatcher::dispatchInsertText(text, len);
222+
CCIMEDispatcher::dispatchInsertText(text, len, key);
211223
}
212224
std::string str(text, len);
213225
io.AddInputCharactersUTF8(str.c_str());

0 commit comments

Comments
 (0)