remove completely unused internal nodes

This commit is contained in:
mat 2024-01-04 09:57:56 -03:00
parent d5761857a1
commit 53e01fd94e
8 changed files with 0 additions and 283 deletions

View file

@ -53,8 +53,6 @@ file(GLOB SOURCES CONFIGURE_DEPENDS
src/ui/*.cpp
src/ui/nodes/*.cpp
src/ui/internal/*.cpp
src/ui/internal/credits/*.cpp
src/ui/internal/dev/*.cpp
src/ui/internal/info/*.cpp
src/ui/internal/list/*.cpp
src/ui/internal/settings/*.cpp

View file

@ -1,27 +0,0 @@
#include "HookListLayer.hpp"
#include <Geode/binding/GJListLayer.hpp>
bool HookListLayer::init(Mod* mod) {
if (!GJDropDownLayer::init("Hooks", 220.f)) return false;
auto winSize = CCDirector::sharedDirector()->getWinSize();
auto hooks = CCArray::create();
for (auto const& hook : mod->getHooks()) {
hooks->addObject(new HookItem(hook));
}
m_listLayer->m_listView = HookListView::create(hooks, mod, 356.f, 220.f);
m_listLayer->addChild(m_listLayer->m_listView);
return true;
}
HookListLayer* HookListLayer::create(Mod* mod) {
auto ret = new HookListLayer;
if (ret && ret->init(mod)) {
ret->autorelease();
return ret;
}
CC_SAFE_DELETE(ret);
return nullptr;
}

View file

@ -1,13 +0,0 @@
#pragma once
#include "HookListView.hpp"
#include <Geode/binding/GJDropDownLayer.hpp>
class HookListLayer : public GJDropDownLayer {
protected:
bool init(Mod* mod);
public:
static HookListLayer* create(Mod* mod);
};

View file

@ -1,135 +0,0 @@
#include "HookListView.hpp"
#include <Geode/binding/StatsCell.hpp>
#include <Geode/binding/TableView.hpp>
#include <Geode/binding/FLAlertLayer.hpp>
#include <Geode/binding/CCMenuItemToggler.hpp>
#include <Geode/utils/casts.hpp>
#include <Geode/loader/Mod.hpp>
HookCell::HookCell(char const* name, CCSize size) : TableViewCell(name, size.width, size.height) {}
void HookCell::draw() {
reinterpret_cast<StatsCell*>(this)->StatsCell::draw();
}
void HookCell::updateBGColor(int index) {
if (index & 1) m_backgroundLayer->setColor(ccc3(0xc2, 0x72, 0x3e));
else m_backgroundLayer->setColor(ccc3(0xa1, 0x58, 0x2c));
m_backgroundLayer->setOpacity(0xff);
}
void HookCell::onEnable(CCObject* pSender) {
auto toggle = as<CCMenuItemToggler*>(pSender);
if (!toggle->isToggled()) {
auto res = m_mod->enableHook(m_hook);
if (!res) {
FLAlertLayer::create(
nullptr, "Error Enabling Hook", std::string(res.unwrapErr()), "OK", nullptr, 280.f
)
->show();
}
}
else {
auto res = m_mod->disableHook(m_hook);
if (!res) {
FLAlertLayer::create(
nullptr, "Error Disabling Hook", std::string(res.unwrapErr()), "OK", nullptr, 280.f
)
->show();
}
}
toggle->toggle(!m_hook->isEnabled());
}
void HookCell::loadFromHook(Hook* hook, Mod* Mod) {
m_hook = hook;
m_mod = Mod;
m_mainLayer->setVisible(true);
m_backgroundLayer->setOpacity(255);
auto menu = CCMenu::create();
menu->setPosition(m_width - m_height, m_height / 2);
m_mainLayer->addChild(menu);
auto enableBtn =
CCMenuItemToggler::createWithStandardSprites(this, menu_selector(HookCell::onEnable), .6f);
enableBtn->setPosition(0, 0);
enableBtn->toggle(hook->isEnabled());
menu->addChild(enableBtn);
std::stringstream moduleName;
// #ifdef GEODE_IS_WINDOWS // add other platforms?
// HMODULE module;
// if (GetModuleHandleExA(
// GET_MODULE_HANDLE_EX_FLAG_FROM_ADDRESS |
// GET_MODULE_HANDLE_EX_FLAG_UNCHANGED_REFCOUNT,
// as<LPCSTR>(hook->getAddress()),
// &module
// )) {
// addr -= as<uintptr_t>(module);
// char name[MAX_PATH];
// if (GetModuleFileNameA(
// module, name, sizeof name
// )) {
// auto fileName = std::filesystem::path(name).stem();
// moduleName << fileName.string() << " + ";
// }
// }
// #endif
if (hook->getDisplayName() != "") moduleName << hook->getDisplayName();
else moduleName << "0x" << std::hex << hook->getAddress();
auto label = CCLabelBMFont::create(moduleName.str().c_str(), "chatFont.fnt");
label->setPosition(m_height / 2, m_height / 2);
label->setScale(.7f);
label->setAnchorPoint({ .0f, .5f });
m_mainLayer->addChild(label);
}
HookCell* HookCell::create(char const* key, CCSize size) {
auto pRet = new HookCell(key, size);
if (pRet) {
return pRet;
}
CC_SAFE_DELETE(pRet);
return nullptr;
}
void HookListView::setupList(float) {
m_itemSeparation = 30.0f;
if (!m_entries->count()) return;
m_tableView->reloadData();
if (m_entries->count() == 1)
m_tableView->moveToTopWithOffset(m_itemSeparation);
m_tableView->moveToTop();
}
TableViewCell* HookListView::getListCell(char const* key) {
return HookCell::create(key, CCSize { m_width, m_itemSeparation });
}
void HookListView::loadCell(TableViewCell* cell, int index) {
as<HookCell*>(cell)->loadFromHook(
as<HookItem*>(m_entries->objectAtIndex(index))->m_hook, m_mod
);
as<HookCell*>(cell)->updateBGColor(index);
}
HookListView* HookListView::create(CCArray* hooks, Mod* Mod, float width, float height) {
auto pRet = new HookListView;
if (pRet) {
pRet->m_mod = Mod;
if (pRet->init(hooks, kBoomListType_Hooks, width, height)) {
pRet->autorelease();
return pRet;
}
}
CC_SAFE_DELETE(pRet);
return nullptr;
}

View file

@ -1,46 +0,0 @@
#pragma once
#include <Geode/binding/CustomListView.hpp>
#include <Geode/binding/TableViewCell.hpp>
using namespace geode::prelude;
static constexpr const BoomListType kBoomListType_Hooks = static_cast<BoomListType>(0x358);
struct HookItem : public CCObject {
Hook* m_hook;
HookItem(Hook* h) : m_hook(h) {
this->autorelease();
}
};
class HookCell : public TableViewCell {
protected:
Mod* m_mod;
Hook* m_hook;
HookCell(char const* name, CCSize size);
void draw() override;
void onEnable(CCObject*);
public:
void updateBGColor(int index);
void loadFromHook(Hook*, Mod*);
static HookCell* create(char const* key, CCSize size);
};
class HookListView : public CustomListView {
protected:
Mod* m_mod;
void setupList(float) override;
TableViewCell* getListCell(char const* key) override;
void loadCell(TableViewCell* cell, int index) override;
public:
static HookListView* create(CCArray* hooks, Mod* Mod, float width, float height);
};

View file

@ -1,45 +0,0 @@
#include "HotReloadLayer.hpp"
bool HotReloadLayer::init(std::string const& name) {
if (!CCLayer::init()) return false;
auto winSize = CCDirector::sharedDirector()->getWinSize();
auto bg = CCSprite::create("GJ_gradientBG.png");
auto bgSize = bg->getTextureRect().size;
bg->setAnchorPoint({ 0.0f, 0.0f });
bg->setScaleX((winSize.width + 10.0f) / bgSize.width);
bg->setScaleY((winSize.height + 10.0f) / bgSize.height);
bg->setPosition({ -5.0f, -5.0f });
bg->setColor({ 0, 102, 255 });
this->addChild(bg);
std::string text = "Reloading " + name + "...";
auto label = CCLabelBMFont::create(text.c_str(), "bigFont.fnt");
label->setPosition(this->getContentSize() / 2);
label->setZOrder(1);
label->setScale(.5f);
this->addChild(label);
return true;
}
HotReloadLayer* HotReloadLayer::create(std::string const& name) {
auto ret = new HotReloadLayer;
if (ret && ret->init(name)) {
ret->autorelease();
return ret;
}
CC_SAFE_DELETE(ret);
return nullptr;
}
HotReloadLayer* HotReloadLayer::scene(std::string const& name) {
auto scene = CCScene::create();
auto layer = HotReloadLayer::create(name);
scene->addChild(layer);
CCDirector::sharedDirector()->replaceScene(scene);
return layer;
}

View file

@ -1,14 +0,0 @@
#pragma once
#include <cocos2d.h>
using namespace geode::prelude;
class HotReloadLayer : public CCLayer {
protected:
bool init(std::string const& name);
public:
static HotReloadLayer* create(std::string const& name);
static HotReloadLayer* scene(std::string const& name);
};

View file

@ -1,6 +1,5 @@
#include "ModInfoPopup.hpp"
#include "../dev/HookListLayer.hpp"
#include "../list/ModListLayer.hpp"
#include "../settings/ModSettingsPopup.hpp"
#include <Geode/loader/Dirs.hpp>