Skip to content
6 changes: 5 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
cmake_minimum_required(VERSION 3.21)
set(CMAKE_CXX_STANDARD 20)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_OSX_ARCHITECTURES "arm64;x86_64")
if ("${GEODE_TARGET_PLATFORM}" STREQUAL "iOS" OR IOS)
set(CMAKE_OSX_ARCHITECTURES "arm64")
else()
set(CMAKE_OSX_ARCHITECTURES "arm64;x86_64")
endif()

project(DevTools VERSION 1.0.0)

Expand Down
5 changes: 3 additions & 2 deletions mod.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
{
"geode": "3.0.0-beta.5",
"geode": "3.4.0",
"version": "v1.7.0",
"gd": {
"win": "*",
"android": "*",
"mac": "2.206"
"mac": "2.206",
"ios": "2.206"
},
"id": "geode.devtools",
"name": "DevTools",
Expand Down
8 changes: 8 additions & 0 deletions src/backend.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -226,6 +226,8 @@ void DevTools::renderDrawData(ImDrawData* draw_data) {

static float SCROLL_SENSITIVITY = 10;

#ifndef GEODE_IS_IOS

class $modify(CCMouseDispatcher) {
bool dispatchScrollMSG(float y, float x) {
if(!DevTools::get()->isSetup()) return true;
Expand All @@ -241,6 +243,8 @@ class $modify(CCMouseDispatcher) {
}
};

#endif

class $modify(CCTouchDispatcher) {
void touches(CCSet* touches, CCEvent* event, unsigned int type) {
auto& io = ImGui::GetIO();
Expand Down Expand Up @@ -300,6 +304,8 @@ class $modify(CCTouchDispatcher) {
}
};

#ifndef GEODE_IS_IOS

class $modify(CCIMEDispatcher) {
void dispatchInsertText(const char* text, int len, enumKeyCodes key) {
auto& io = ImGui::GetIO();
Expand All @@ -320,3 +326,5 @@ class $modify(CCIMEDispatcher) {
io.AddKeyEvent(ImGuiKey_Backspace, false);
}
};

#endif
15 changes: 15 additions & 0 deletions src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,9 @@
#include <Geode/modify/CCKeyboardDispatcher.hpp>
#include <Geode/modify/AchievementNotifier.hpp>
#include <Geode/modify/CCDirector.hpp>
#ifndef GEODE_IS_IOS
#include <Geode/modify/CCEGLView.hpp>
#endif
#include <Geode/modify/CCNode.hpp>
#include "DevTools.hpp"
#include <imgui.h>
Expand All @@ -19,6 +21,8 @@ class $modify(CCNode) {
}
};

#ifndef GEODE_IS_IOS

// todo: use shortcuts api once Geode has those
class $modify(CCKeyboardDispatcher) {
bool dispatchKeyboardMSG(enumKeyCodes key, bool down, bool arr) {
Expand All @@ -30,6 +34,8 @@ class $modify(CCKeyboardDispatcher) {
}
};

#endif

#ifdef GEODE_IS_MOBILE
// lol
#include <Geode/modify/MenuLayer.hpp>
Expand Down Expand Up @@ -76,7 +82,12 @@ class $modify(CCDirector) {
shouldUpdateGDRenderBuffer() = false;
}

#ifdef GEODE_IS_IOS
auto winSize = this->getOpenGLView()->m_obViewPortRect * geode::utils::getDisplayFactor();
#else
auto winSize = this->getOpenGLView()->getViewPortRect() * geode::utils::getDisplayFactor();
#endif

if (!gdTexture) {
gdTexture = new GLRenderCtx({ winSize.size.width, winSize.size.height });
}
Expand All @@ -102,6 +113,8 @@ class $modify(CCDirector) {
}
};

#ifndef GEODE_IS_IOS

class $modify(CCEGLView) {
// this is needed for popout mode because we need to render after gd has rendered,
// but before the buffers have been swapped, which is not possible with just a
Expand All @@ -114,3 +127,5 @@ class $modify(CCEGLView) {
CCEGLView::swapBuffers();
}
};

#endif
4 changes: 2 additions & 2 deletions src/platform/Mac.mm
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#include <Geode/platform/platform.hpp>

#ifdef GEODE_IS_MACOS
#ifdef __APPLE__

#include "utils.hpp"

Expand Down Expand Up @@ -86,4 +86,4 @@
else return fmt::format("{:#x}", addr - base);
}

#endif
#endif
6 changes: 4 additions & 2 deletions src/platform/platform.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -76,8 +76,10 @@ bool GLRenderCtx::begin() {
0,GL_RGB, GL_UNSIGNED_BYTE, 0
);

glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
}

if (!m_depthStencil) {
Expand Down
7 changes: 7 additions & 0 deletions src/platform/platform.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,16 @@
#include <imgui.h>
#include <imgui_internal.h>
#ifdef __APPLE__

#include <TargetConditionals.h>
#if TARGET_OS_IPHONE
#include <OpenGLES/ES2/gl.h>
#else
#include <OpenGL/gl.h>
#endif

#endif

ImRect& getGDWindowRect();
bool& shouldPassEventsToGDButTransformed();
bool& shouldUpdateGDRenderBuffer();
Expand Down