Skip to content

Commit

Permalink
dddd
Browse files Browse the repository at this point in the history
  • Loading branch information
TheSillyDoggo committed Aug 10, 2024
1 parent 8173fdf commit 3465d3c
Show file tree
Hide file tree
Showing 6 changed files with 130 additions and 26 deletions.
4 changes: 4 additions & 0 deletions changelog.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
# 1.5.5

- Fixed GD Crashing almost all the time on macOS / iOS

# 1.5.4

- Fixed Dropdown's not being clickable
Expand Down
2 changes: 1 addition & 1 deletion mod.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"geode": "3.4.0",
"version": "v1.5.4",
"version": "v1.5.5",
"gd": {
"win": "2.206",
"android": "2.206",
Expand Down
41 changes: 18 additions & 23 deletions resources/pp-frag.glsl
Original file line number Diff line number Diff line change
Expand Up @@ -16,38 +16,33 @@

uniform sampler2D screen;
uniform vec2 screenSize;
uniform float radius;
uniform bool fast;
uniform bool first;
uniform float radius;

void main() {
// Compute scaled radius
float scaledRadius = clamp(radius * screenSize.y * 0.5, 1.0, 32.0);
float scaledRadius = radius * screenSize.y * 0.5;
vec2 texOffset = 1.0 / screenSize;

// Initialize result with the center pixel
vec3 result = texture2D(screen, TexCoords).rgb;
float weightSum = 1.0;
scaledRadius *= radius * 10.0 / ((radius * 10.0 + 1.0) * (radius * 10.0 + 1.0) - 1.0);
float weight = 1.0;

// Precompute inverse radius for weight reduction
float inverseRadius = 1.0 / scaledRadius;

for (float i = 1.0; i < scaledRadius; i++) {
weight -= inverseRadius;
weightSum += weight * 2.0;

if (first) {
vec2 offset = vec2(texOffset.x * i, 0.0);
result += texture2D(screen, TexCoords + offset).rgb * weight;
result += texture2D(screen, TexCoords - offset).rgb * weight;
} else {
vec2 offset = vec2(0.0, texOffset.y * i);
result += texture2D(screen, TexCoords + offset).rgb * weight;
result += texture2D(screen, TexCoords - offset).rgb * weight;
float weightSum = weight;
if (first) {
for (int i = 1; float(i) < scaledRadius; i++) {
weight -= 1.0 / scaledRadius;
weightSum += weight * 2.0;
result += texture2D(screen, TexCoords + vec2(texOffset.x * float(i), 0.0)).rgb * weight;
result += texture2D(screen, TexCoords - vec2(texOffset.x * float(i), 0.0)).rgb * weight;
}
} else {
for (int i = 1; float(i) < scaledRadius; i++) {
weight -= 1.0 / scaledRadius;
weightSum += weight * 2.0;
result += texture2D(screen, TexCoords + vec2(0.0, texOffset.y * float(i))).rgb * weight;
result += texture2D(screen, TexCoords - vec2(0.0, texOffset.y * float(i))).rgb * weight;
}
}

// Normalize the result by the total weight
result /= weightSum;

#if __VERSION__ == 300
Expand Down
26 changes: 26 additions & 0 deletions src/Hacks/Patches/EditorExtension.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
/*#include <Geode/Geode.hpp>
#include <Geode/modify/PauseLayer.hpp>
#include "../../Client/Client.h"
using namespace geode::prelude;
$execute
{
std::vector<geode::Patch*> patches = {};
#ifdef GEODE_IS_WINDOWS
patches.push_back(createPatchSafe(reinterpret_cast<void*>(geode::base::get() + 0x5ed33c), { 0x1, 0x0, 0x0, 0x0 }));
#endif
Loader::get()->queueInMainThread([patches]{
for (auto patch : patches)
{
Client::GetModule("editor-extension")->addPatch(patch);
}
});
};*/
//win:
//0x5ed33c
//0x
78 changes: 78 additions & 0 deletions src/Hacks/Thicker Hitboxes.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ ColourModule* interact = nullptr;
ColourModule* player = nullptr;
ColourModule* playerRot = nullptr;

#ifdef __APPLE__

class $modify (CCDrawNode)
{
bool drawPolygon(CCPoint *verts, unsigned int count, const ccColor4F &fillColor, float borderWidth, const ccColor4F &borderColor)
Expand Down Expand Up @@ -83,6 +85,82 @@ class $modify (CCDrawNode)
}
};

#else

bool myDrawPoly(CCDrawNode* ins, CCPoint *verts, unsigned int count, const ccColor4F &fillColor, float borderWidth, ccColor4F &borderColor) {
if (!thicker)
thicker = Client::GetModule("show-hitboxes")->options[7];

if (!fill)
fill = Client::GetModule("show-hitboxes")->options[8];

if (!fillOpacity)
fillOpacity = as<SliderModule*>(Client::GetModule("show-hitboxes")->options[9]);

if (!solid)
solid = as<ColourModule*>(Client::GetModule("show-hitboxes")->options[0]);

if (!hazard)
hazard = as<ColourModule*>(Client::GetModule("show-hitboxes")->options[1]);

if (!passable)
passable = as<ColourModule*>(Client::GetModule("show-hitboxes")->options[2]);

if (!interact)
interact = as<ColourModule*>(Client::GetModule("show-hitboxes")->options[3]);

if (!player)
player = as<ColourModule*>(Client::GetModule("show-hitboxes")->options[4]);

if (!playerRot)
playerRot = as<ColourModule*>(Client::GetModule("show-hitboxes")->options[5]);

if (ins->getTag() == -9999)
{
if (borderColor.r == 0 && borderColor.g == 0.25f && borderColor.b == 1)
borderColor = ccc4FFromccc3B(solid->colour);

else if (borderColor.r == 1 && borderColor.g == 0 && borderColor.b == 0)
borderColor = ccc4FFromccc3B(hazard->colour);

else if (borderColor.r == 0 && borderColor.g == 1 && borderColor.b == 0)
borderColor = ccc4FFromccc3B(interact->colour);

else if (borderColor.r == 0 && borderColor.g == 1 && borderColor.b == 1)
borderColor = ccc4FFromccc3B(passable->colour);

else if (borderColor.r == 1 && borderColor.g == 1 && borderColor.b == 0)
borderColor = ccc4FFromccc3B(playerRot->colour);

else if (borderColor.r == -1 && borderColor.g == -1 && borderColor.b == -1)
borderColor = ccc4FFromccc3B(player->colour);

auto c = borderColor;

c.a = fillOpacity->value;

if (borderWidth == 0)
borderWidth = 1;

return ins->drawPolygon(verts, count, fill->enabled ? c : fillColor, borderWidth * (thicker->enabled ? 2.2f : 1), borderColor);
}
else
return ins->drawPolygon(verts, count, fillColor, borderWidth, borderColor);
}

$execute {
Mod::get()->hook(
reinterpret_cast<void*>(
geode::addresser::getNonVirtual(&CCDrawNode::drawPolygon)
),
&myDrawPoly,
"cocos2d::CCDrawNode::drawPolygon",
tulip::hook::TulipConvention::Thiscall
);
}

#endif

class $modify (GJBaseGameLayer)
{
void drawForPlayer(PlayerObject* po)
Expand Down
5 changes: 3 additions & 2 deletions src/Utils/CCBlurLayer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,8 @@ void CCBlurLayer::draw()
glBindFramebuffer(0x8D40, ppRt0.fbo);
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT);



CCLayerColor::draw();

if (getParent())
Expand All @@ -121,6 +123,7 @@ void CCBlurLayer::draw()
parent->transform();
parent->visit();


#ifdef GEODE_IS_IOS
reinterpret_cast<void(__cdecl*)()>(geode::base::get() + 0x174250)();
#else
Expand All @@ -133,8 +136,6 @@ void CCBlurLayer::draw()
if (getParent())
getParent()->setVisible(true);

auto start2 = std::chrono::high_resolution_clock::now();

glBindVertexArray(ppVao);
#ifdef GEODE_IS_IOS
reinterpret_cast<void(__cdecl*)(GLuint)>(geode::base::get() + 0x19a4f8)(ppShader.program);
Expand Down

0 comments on commit 3465d3c

Please sign in to comment.