Skip to content

Commit

Permalink
Fix some issues
Browse files Browse the repository at this point in the history
  • Loading branch information
Alphalaneous committed Jul 22, 2024
1 parent 5a78244 commit a88e77e
Show file tree
Hide file tree
Showing 8 changed files with 66 additions and 42 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@ jobs:
- name: Build the mod
uses: geode-sdk/build-geode-mod@main
with:
sdk: 'v3.1.1'
cli: 'v3.0.0'
sdk: 'v3.2.0'
cli: 'v3.2.0'
bindings: geode-sdk/bindings
bindings-ref: main
combine: true
Expand Down
4 changes: 2 additions & 2 deletions mod.json
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
{
"geode": "3.1.1",
"geode": "3.2.0",
"gd": {
"win": "2.206",
"android": "2.206",
"mac": "2.206"
},
"version": "v1.3.19",
"version": "v1.3.20",
"id": "alphalaneous.happy_textures",
"name": "Happy Textures :3",
"developer": "Alphalaneous",
Expand Down
36 changes: 1 addition & 35 deletions src/UIModding.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1491,7 +1491,7 @@ void UIModding::startFileListeners(){
fw->stop();
}
listeners.clear();
std::vector<std::string> packs = getActivePacks();
std::vector<std::string> packs = Utils::getActivePacks();
for(std::string path : packs){

std::string uiPath = fmt::format("{}{}", path, "ui\\");
Expand Down Expand Up @@ -1519,41 +1519,7 @@ void UIModding::startFileListeners(){
}
}

std::vector<std::string> UIModding::getActivePacks(){

gd::vector<gd::string> paths = CCFileUtils::sharedFileUtils()->getSearchPaths();
std::vector<std::string> packPaths;
Mod* textureLoader = Loader::get()->getLoadedMod("geode.texture-loader");
if(textureLoader){
std::filesystem::path textureLoaderPacks = textureLoader->getConfigDir();
std::string packDirStr = fmt::format("{}{}", textureLoaderPacks, "\\packs");
std::filesystem::path packDir = std::filesystem::path(packDirStr);

for(std::string path : paths){

std::filesystem::path fpath = std::filesystem::path(path);
std::filesystem::path pathParent = std::filesystem::path(path);

while(pathParent.has_parent_path()){

if(pathParent == packDir){
if(std::find(packPaths.begin(), packPaths.end(), fpath.string()) == packPaths.end()) {
packPaths.push_back(fpath.string());
break;
}
}
if(pathParent == std::filesystem::current_path().root_path()){
break;
}
pathParent = pathParent.parent_path();
}
}
}
std::string resourcesDir = fmt::format("{}{}", CCFileUtils::sharedFileUtils()->getWritablePath2(), "Resources\\");
packPaths.push_back(resourcesDir);

return packPaths;
}

AxisAlignment UIModding::getAxisAlignment(std::string name){
AxisAlignment axisAlignment = AxisAlignment::Start;
Expand Down
36 changes: 36 additions & 0 deletions src/Utils.h
Original file line number Diff line number Diff line change
Expand Up @@ -70,5 +70,41 @@ namespace Utils {
}
return spr;
}

static std::vector<std::string> getActivePacks(){

gd::vector<gd::string> paths = CCFileUtils::sharedFileUtils()->getSearchPaths();
std::vector<std::string> packPaths;
Mod* textureLoader = Loader::get()->getLoadedMod("geode.texture-loader");
if(textureLoader){
std::filesystem::path textureLoaderPacks = textureLoader->getConfigDir();
std::string packDirStr = fmt::format("{}{}", textureLoaderPacks, "\\packs");
std::filesystem::path packDir = std::filesystem::path(packDirStr);

for(std::string path : paths){

std::filesystem::path fpath = std::filesystem::path(path);
std::filesystem::path pathParent = std::filesystem::path(path);

while(pathParent.has_parent_path()){

if(pathParent == packDir){
if(std::find(packPaths.begin(), packPaths.end(), fpath.string()) == packPaths.end()) {
packPaths.push_back(fpath.string());
break;
}
}
if(pathParent == std::filesystem::current_path().root_path()){
break;
}
pathParent = pathParent.parent_path();
}
}
}
std::string resourcesDir = fmt::format("{}{}", CCFileUtils::sharedFileUtils()->getWritablePath2(), "Resources\\");
packPaths.push_back(resourcesDir);

return packPaths;
}
}
#endif
15 changes: 15 additions & 0 deletions src/icons/IconHandler.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#include <Geode/Geode.hpp>
#include "../Utils.h"


using namespace geode::prelude;

/*$execute {
std::vector<std::string> packs = Utils::getActivePacks();
for(std::string path : packs){
log::info("{}", path);
}
}*/
1 change: 1 addition & 0 deletions src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
#include "nodes/LoadingLayer.h"
#include "nodes/MenuGameLayer.h"
#include "nodes/MenuLayer.h"
#include "icons/IconHandler.h"
#include "CCDirector.h"

using namespace geode::prelude;
10 changes: 8 additions & 2 deletions src/nodes/CCLabelBMFont.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,12 @@ class $modify(MyCCLabelBMFont, CCLabelBMFont){

#ifndef GEODE_IS_MACOS

myRet->m_fields->m_schedule = schedule_selector(MyCCLabelBMFont::checkParent);
ret->schedule(myRet->m_fields->m_schedule);
bool doFix = Mod::get()->getSettingValue<bool>("pusab-fix");

if(doFix){
myRet->m_fields->m_schedule = schedule_selector(MyCCLabelBMFont::checkParent);
ret->schedule(myRet->m_fields->m_schedule);
}

#endif

Expand All @@ -51,7 +55,9 @@ class $modify(MyCCLabelBMFont, CCLabelBMFont){
if(auto parent = this->getParent()){
if(typeinfo_cast<LabelGameObject*>(parent)){
if(strcmp(this->getFntFile(), "bigFont.fnt") == 0){
ccBlendFunc blendFunc = this->getBlendFunc();
this->setFntFile("bigFont.fnt"_spr);
this->setBlendFunc(blendFunc);
}
}
this->unschedule(m_fields->m_schedule);
Expand Down
2 changes: 1 addition & 1 deletion src/nodes/CCMenuItemSpriteExtra.h
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ class $modify(EventCCMenuItemSpriteExtra, CCMenuItemSpriteExtra) {

void checkTouch(bool hasLayerOnTop){

if(this && (m_fields->hasHover || m_fields->hasExit) && nodeIsVisible(this)){
if((m_fields->hasHover || m_fields->hasExit) && nodeIsVisible(this)){

CCPoint point = getMousePos();

Expand Down

0 comments on commit a88e77e

Please sign in to comment.