Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion mod.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"geode": "5.11.2",
"geode": "6.0.0-alpha.1",
"version": "v1.14.0",
"gd": {
"win": "2.2091",
Expand Down
1 change: 1 addition & 0 deletions src/DevTools.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,7 @@ class DevTools {
void drawLabelAttributes(CCNode* node);
void drawAxisGapAttribute(CCNode* node);
void drawTextureAttributes(CCNode* node);
void drawBlendingAttributes(CCNode* node);
void drawMenuItemAttributes(CCNode* node);
void drawLayoutOptionsAttributes(CCNode* node);
void drawLayoutAttributes(CCNode* node);
Expand Down
64 changes: 64 additions & 0 deletions src/pages/Attributes.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ void DevTools::drawNodeAttributes(CCNode* node) {
ImGui::NewLine();

drawTextureAttributes(node);
drawBlendingAttributes(node);
drawMenuItemAttributes(node);

setUsedAPI(false);
Expand Down Expand Up @@ -406,6 +407,69 @@ void DevTools::drawTextureAttributes(CCNode* node) {
}
}

void DevTools::drawBlendingAttributes(CCNode* node) {
if (auto nineSlice = typeinfo_cast<geode::NineSlice*>(node)) {
node = nineSlice->getBatchNode();
}
if (auto blendProtocol = typeinfo_cast<CCBlendProtocol*>(node)) {
static const std::unordered_map<GLenum, const char*> blend_map = {
{ GL_ZERO, "GL_ZERO" },
{ GL_ONE, "GL_ONE" },
{ GL_SRC_COLOR, "GL_SRC_COLOR" },
{ GL_ONE_MINUS_SRC_COLOR, "GL_ONE_MINUS_SRC_COLOR" },
{ GL_DST_COLOR, "GL_DST_COLOR" },
{ GL_ONE_MINUS_DST_COLOR, "GL_ONE_MINUS_DST_COLOR" },
{ GL_SRC_ALPHA, "GL_SRC_ALPHA" },
{ GL_ONE_MINUS_SRC_ALPHA, "GL_ONE_MINUS_SRC_ALPHA" },
{ GL_DST_ALPHA, "GL_DST_ALPHA" },
{ GL_ONE_MINUS_DST_ALPHA, "GL_ONE_MINUS_DST_ALPHA" },
{ GL_CONSTANT_COLOR, "GL_CONSTANT_COLOR" },
{ GL_ONE_MINUS_CONSTANT_COLOR, "GL_ONE_MINUS_CONSTANT_COLOR" },
{ GL_CONSTANT_ALPHA, "GL_CONSTANT_ALPHA" },
{ GL_ONE_MINUS_CONSTANT_ALPHA, "GL_ONE_MINUS_CONSTANT_ALPHA" },
{ GL_SRC_ALPHA_SATURATE, "GL_SRC_ALPHA_SATURATE" },
};

auto func = blendProtocol->getBlendFunc();
bool changed = false;

if (ImGui::BeginCombo("Src", blend_map.at(func.src))) {
for (auto& item : blend_map) {
if (ImGui::Selectable(item.second, item.first == func.src)) {
func.src = item.first;
changed = true;
}

if (item.first == func.src)
ImGui::SetItemDefaultFocus();
}

ImGui::EndCombo();
}

if (ImGui::BeginCombo("Dst", blend_map.at(func.dst))) {
for (auto& item : blend_map) {
if (ImGui::Selectable(item.second, item.first == func.dst)) {
func.dst = item.first;
changed = true;
}

if (item.first == func.dst)
ImGui::SetItemDefaultFocus();
}

ImGui::EndCombo();
}

if (changed)
blendProtocol->setBlendFunc(func);

ImGui::NewLine();
ImGui::Separator();
ImGui::NewLine();
}
}

void DevTools::drawMenuItemAttributes(CCNode* node) {
if (auto menuItemNode = typeinfo_cast<CCMenuItem*>(node)) {
const auto selector = menuItemNode->m_pfnSelector;
Expand Down
2 changes: 1 addition & 1 deletion src/pages/Memory.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -257,7 +257,7 @@ std::optional<std::string_view> findStdString(SafePtr ptr) {
data = reinterpret_cast<char*>(ptr.read_ptr().as_ptr());
}
#elif defined(GEODE_IS_ANDROID)
static gd::string emptyStdString;
static std::string emptyStdString;
auto internalData = ptr.read_ptr();
if (!internalData.addr) return {};
auto size = (internalData - (3 * sizeof(void*))).read<size_t>();
Expand Down
Loading