From 3a6239a69f05c78d1d898dc54e3bea7c1da6dfa2 Mon Sep 17 00:00:00 2001 From: user95401 <90561697+user95401@users.noreply.github.com> Date: Wed, 22 Jan 2025 23:04:08 +0400 Subject: [PATCH] pubeditiona --- README.md | 18 ++-- about.md | 19 ++--- mod.json | 4 +- src/_updater.hpp | 215 ----------------------------------------------- src/on_load.cpp | 7 +- 5 files changed, 21 insertions(+), 242 deletions(-) delete mode 100644 src/_updater.hpp diff --git a/README.md b/README.md index 38b07fd..26ce61f 100644 --- a/README.md +++ b/README.md @@ -1,21 +1,17 @@ -#### Mod developer was banned on Geode for dumb reasons, but he still keeps his mods up-to-date.
See for working latest versions at [releases page](../../releases)! -> Yes, u can't find it in geode servers, download it and install manually. # Main Levels Editor -currently this mod getting rewrite and port to 2206 +You can edit main levels setup (stars, song, name, difficulty), add levels, edit songs and other stuff. -u can edit main levels setup (stars, song, name, difficulty) and other stuff - -- ui -- editor -- basic work this mod should do ya +Featuring: +- UI for config setup (disabled by default. see for changes in Level Pages, Song Info, Pause). +- Main Level Editor that actually saves your changes in config. +- Basic stuff that this mod should do ya and "Load Failed!" bypass here -summary u can add ur own level in level select layer +## Packed Config Feature -## packed config feature -u can distribute mod with your config... +You can distribute mod with your config... Just open .geode file (its zip btw) and pack the config files up to `./config/` folder. diff --git a/about.md b/about.md index ccca979..26ce61f 100644 --- a/about.md +++ b/about.md @@ -1,18 +1,17 @@ -# Main Levels Editor -currently this mod getting rewrite and port to 2206 +# Main Levels Editor -u can edit main levels setup (stars, song, name, difficulty) and other stuff +You can edit main levels setup (stars, song, name, difficulty), add levels, edit songs and other stuff. -- ui -- editor -- basic work this mod should do ya +Featuring: +- UI for config setup (disabled by default. see for changes in Level Pages, Song Info, Pause). +- Main Level Editor that actually saves your changes in config. +- Basic stuff that this mod should do ya and "Load Failed!" bypass here -summary u can add ur own level in level select layer +## Packed Config Feature -## packed config feature -u can distribute mod with your config... +You can distribute mod with your config... -Just open .geode file (its zip btw) and pack the config files up to `./config/` folder. \ No newline at end of file +Just open .geode file (its zip btw) and pack the config files up to `./config/` folder. diff --git a/mod.json b/mod.json index a8353c8..46c8d6b 100644 --- a/mod.json +++ b/mod.json @@ -1,10 +1,10 @@ { - "geode": "4.0.1", + "geode": "4.2.0", "gd": { "win": "2.2074", "android": "2.2074" }, - "version": "v7.0.3-beta.15", + "version": "v7.0.4-beta.15", "id": "user95401.mainlevelseditor", "name": "Main Levels Editor", "developer": "user95401", diff --git a/src/_updater.hpp b/src/_updater.hpp deleted file mode 100644 index 86683da..0000000 --- a/src/_updater.hpp +++ /dev/null @@ -1,215 +0,0 @@ -#include <_fs.hpp> -//geode -#include -using namespace geode::prelude; - -#include - -inline auto repo = Mod::get()->getMetadata().getLinks().getSourceURL().value_or(""); -inline auto raw_repo_content = string::replace(repo, "github.com", "raw.githubusercontent.com") + "/master/"; -inline auto latest_release = repo + "/releases/latest/download/"; - -inline void download(std::string url = "", fs::path path = "", std::function onDownloadingEnd = []() {}) { - auto layer = CCLayer::create(); - layer->setID("download"_spr); - SceneManager::get()->keepAcrossScenes(layer); - - auto downloadingLabel = CCLabelBMFont::create( - fmt::format("Downloading {}...", fs::path(url).filename().string()).c_str(), - "goldFont.fnt" - ); - layer->setID("downloadingLabel"_spr); - downloadingLabel->setLayoutOptions(AnchorLayoutOptions::create() - ->setAnchor(Anchor::Top) - ->setOffset({ 0.f, -12.f } - )); - downloadingLabel->setScale(0.600f); - layer->addChild(downloadingLabel); - - layer->setAnchorPoint(CCPointZero); - layer->setLayout(AnchorLayout::create()); - - auto req = web::WebRequest(); - auto listener = new EventListener; - listener->bind( - [path, onDownloadingEnd, layer, downloadingLabel](web::WebTask::Event* e) { - if (web::WebProgress* prog = e->getProgress()) { - double a100 = 100 - prog->downloadProgress().value_or(0.0); - if (downloadingLabel and (a100 > 0.0)) downloadingLabel->setOpacity((a100 / 100) * 255); - } - if (web::WebResponse* res = e->getValue()) { - std::string data = res->string().unwrapOr("no res"); - if (res->code() < 399) { - res->into(path); - if (layer) SceneManager::get()->forget(layer); - if (layer) layer->removeFromParent(); - onDownloadingEnd(); - } - else { - auto asd = geode::createQuickPopup( - "Request exception", - data, - "Nah", nullptr, 420.f, nullptr, false - ); - asd->show(); - if (layer) SceneManager::get()->forget(layer); - if (layer) layer->removeFromParent(); - }; - } - } - ); - listener->setFilter(req.send("GET", url)); - -} - -inline auto UPDATES_CHECK_DISABLED = Mod::get()->getSaveDir() / "UPDATES_CHECK_DISABLED.txt"; -inline auto UPDATES_SKIPPED = Mod::get()->getSaveDir() / "UPDATES_SKIPPED.txt"; - -inline auto doWithConfirmPop(auto lb = []() {}) { - return geode::createQuickPopup( - "Action Confirm", - "Are you sure?", - "Abort", "Yes", - [lb](auto, bool btn2) { - if (btn2) lb(); - } - ); -} - -#include -class $modify(MenuLayerExt, MenuLayer) { - struct Fields { - EventListener m_getJsonListener; - }; - $override bool init() { - - //get mod json - m_fields->m_getJsonListener.bind( - [this](web::WebTask::Event* e) { - if (web::WebResponse* res = e->getValue()) { - - auto str = res->string().unwrapOr(""); - - auto parse = matjson::parse(str); - - if (not parse.ok()) - return log::error("parse err: {}", parse.unwrapErr()); - - auto actualMetaDataResult = ModMetadata::create(parse.unwrap()); - - if (not actualMetaDataResult.ok()) - return log::error("actualMetaDataResult: {}", actualMetaDataResult.unwrapErr()); - - auto actualMetaData = actualMetaDataResult.unwrap(); - - if (actualMetaData.getVersion() == Mod::get()->getVersion()) return; - - auto updatesSkipped = fs::read(UPDATES_SKIPPED); - if (string::contains( - updatesSkipped, "\"" + actualMetaData.getVersion().toVString() + "\"" - )) return; - - auto pop = geode::createQuickPopup( - Mod::get()->getID().c_str(), - fmt::format( - "\n" "Founded new actual version!" - "\n" "{} -> {}" - "\n" "Download latest release of mod?" - "\n " - , Mod::get()->getVersion().toVString(), actualMetaData.getVersion().toVString() - ), - "", "", [](CCNode*pop, auto) { - SceneManager::get()->forget(pop); - pop->removeFromParent(); - }, false - ); - pop->show(); - SceneManager::get()->keepAcrossScenes(pop); - - pop->m_buttonMenu->removeAllChildrenWithCleanup(0); - pop->m_buttonMenu->setScale(0.6f); - pop->m_buttonMenu->setAnchorPoint(CCPoint(0.5f, 0.3f)); - pop->m_buttonMenu->setContentSize(CCSize(512.f, 65.f)); - - pop->m_buttonMenu->addChild(CCMenuItemExt::createSpriteExtra( - ButtonSprite::create("Download And Restart", "goldFont.fnt", "GJ_button_01.png", 1.f), - [pop](auto) { - pop->m_alertProtocol->FLAlert_Clicked(pop, 0); - download( - latest_release + Mod::get()->getID() + ".geode", - dirs::getModsDir() / (Mod::get()->getID() + ".geode"), - []() { - game::restart(); - } - ); - } - ), 0, 1); - pop->m_buttonMenu->getChildByTag(1)->setLayoutOptions(AxisLayoutOptions::create()->setBreakLine(1)); - - pop->m_buttonMenu->addChild(CCMenuItemExt::createSpriteExtra( - ButtonSprite::create("Just Download", "goldFont.fnt", "GJ_button_04.png", 0.6f), - [pop](auto) { - pop->m_alertProtocol->FLAlert_Clicked(pop, 0); - download( - latest_release + Mod::get()->getID() + ".geode", - dirs::getModsDir() / (Mod::get()->getID() + ".geode"), - []() { -#ifdef __APPLE__ - Notification::create( - "Latest release downloading is finished!", - CCSprite::createWithSpriteFrameName("geode.loader/install.png") - )->show(); -#else - AchievementNotifier::sharedState()->notifyAchievement( - Mod::get()->getID().c_str(), - "Latest release downloading is finished!", - "geode.loader/install.png", 1 - ); -#endif // __APPLE__ - } - ); - } - ), 0, 2); - - pop->m_buttonMenu->addChild(CCMenuItemExt::createSpriteExtra( - ButtonSprite::create("Later", "goldFont.fnt", "GJ_button_04.png", 0.6f), - [pop](auto) { - pop->m_alertProtocol->FLAlert_Clicked(pop, 0); - } - ), 0, 3); - - pop->m_buttonMenu->addChild(CCMenuItemExt::createSpriteExtra( - ButtonSprite::create("Skip", "goldFont.fnt", "GJ_button_05.png", 0.6f), - [pop, actualMetaData](auto) { doWithConfirmPop([pop, actualMetaData]() { - - std::ofstream(UPDATES_SKIPPED, std::ios_base::app) - << "\"" + actualMetaData.getVersion().toVString() + "\"" - << std::endl; - pop->m_alertProtocol->FLAlert_Clicked(pop, 0); - - });} - ), 0, 4); - - pop->m_buttonMenu->addChild(CCMenuItemExt::createSpriteExtra( - ButtonSprite::create("Disable Checks", "goldFont.fnt", "GJ_button_06.png", 0.6f), - [pop](auto) { doWithConfirmPop([pop]() { - - std::ofstream(UPDATES_CHECK_DISABLED) - << "delete it to bring back checks"; - pop->m_alertProtocol->FLAlert_Clicked(pop, 0); - - });} - ), 0, 5); - - pop->m_buttonMenu->setLayout(AxisLayout::create()->setGrowCrossAxis(1)); - } - } - ); - if (fs::exists(UPDATES_CHECK_DISABLED)) void(); - else m_fields->m_getJsonListener.setFilter( - web::WebRequest().get(raw_repo_content + "/mod.json") - ); - - return MenuLayer::init(); - } -}; \ No newline at end of file diff --git a/src/on_load.cpp b/src/on_load.cpp index 9b61119..224de85 100644 --- a/src/on_load.cpp +++ b/src/on_load.cpp @@ -1,11 +1,10 @@ #include "_main.hpp" -#include "_updater.hpp" void Loaded() { //dirs - fs::create_directories(levels_meta_path); - fs::create_directories(audios_meta_path); - fs::create_directories(artists_meta_path); + fs::create_directories(levels_meta_path, fs::last_err_code); + fs::create_directories(audios_meta_path, fs::last_err_code); + fs::create_directories(artists_meta_path, fs::last_err_code); //add info std::ofstream(levels_meta_path / "_here is {id}.json meta files about names, stars and stuff") << "asd"; std::ofstream(levels_path / "_here u put {id}.txt level data files");