diff --git a/README.md b/README.md index e8069d1..ccca979 100644 --- a/README.md +++ b/README.md @@ -1,28 +1,18 @@ # Main Levels Editor -u can edit: -- main levels setup (stars, song, name, difficulty) -- bg color for page -- songs -- pages in level select layer (here is a fake page list) +currently this mod getting rewrite and port to 2206 -and "Load Failed!" bypass here - -summary u can add ur own level in level select layer - -settings here is generating per hooked functions call -so play stereo madness to generate all config structure +u can edit main levels setup (stars, song, name, difficulty) and other stuff - +- ui +- editor +- basic work this mod should do ya -#### android releases is unstable i think +and "Load Failed!" bypass here - +summary u can add ur own level in level select layer ## packed config feature u can distribute mod with your config... -Just open .geode file (its zip btw) and pack the config files up to `./config/` folder. - -![img](Screenshot_121.png) -![img](Screenshot_122.png) \ No newline at end of file +Just open .geode file (its zip btw) and pack the config files up to `./config/` folder. \ No newline at end of file diff --git a/Screenshot_121.png b/Screenshot_121.png deleted file mode 100644 index 21fa5a4..0000000 Binary files a/Screenshot_121.png and /dev/null differ diff --git a/Screenshot_122.png b/Screenshot_122.png deleted file mode 100644 index a1e773a..0000000 Binary files a/Screenshot_122.png and /dev/null differ diff --git a/about.md b/about.md index c1fee7f..ccca979 100644 --- a/about.md +++ b/about.md @@ -1,23 +1,16 @@ # Main Levels Editor -u can edit: -- main levels setup (stars, song, name, difficulty) -- bg color for page -- songs -- pages in level select layer (here is a fake page list) +currently this mod getting rewrite and port to 2206 -and "Load Failed!" bypass here - -summary u can add ur own level in level select layer +u can edit main levels setup (stars, song, name, difficulty) and other stuff -settings here is generating per hooked functions call -so play stereo madness to generate all config structure +- ui +- editor +- basic work this mod should do ya - - -#### android releases is unstable i think +and "Load Failed!" bypass here - +summary u can add ur own level in level select layer ## packed config feature u can distribute mod with your config... diff --git a/mod.json b/mod.json index 6625aaa..d7beec4 100644 --- a/mod.json +++ b/mod.json @@ -4,13 +4,14 @@ "win": "2.206", "android": "*" }, - "version": "v7.0.0-beta.1", + "version": "v7.0.0-beta.2", "id": "user95401.mainlevelseditor", "name": "Main Levels Editor", "developer": "user95401", "description": "customizable thing to change main levels uknowya", "repository": "https://github.com/user95401/MainLevelsEditor", "tags": [ "gameplay", "music", "interface", "utility", "customization", "cheats" ], + "early-load": true, "dependencies": [ { "id": "geode.node-ids", @@ -19,6 +20,12 @@ } ], "settings": { + "ui": { + "name": "Add control UI", + "description": "add buttons an other stuff to control things in game", + "type": "bool", + "default": false + }, "start_id": { "name": "Start ID", "description": "its about populating the level list", @@ -45,12 +52,6 @@ "description": "shows Coming Soon page", "type": "bool", "default": true - }, - "ui": { - "name": "Add control UI", - "description": "add buttons an other stuff to control things in game", - "type": "bool", - "default": false } } } diff --git a/src/level_data.cpp b/src/level_data.cpp index f48b179..723e2ce 100644 --- a/src/level_data.cpp +++ b/src/level_data.cpp @@ -8,29 +8,46 @@ void Loaded() { std::ofstream(levels_path / "_here u put {id}.txt level data files"); //preset all org levels for (int i = 1; i <= 100; i++) { - auto level_in_game_path = fmt::format("levels/{}.txt", i); + auto level_in_game_path = CCFileUtils::sharedFileUtils()->fullPathForFilename(fmt::format("levels/{}.txt", i).c_str(), 0); auto level_path_to_save = (levels_path / fmt::format("{}.txt", i)); auto level_is_exists_in_gd = cocos::fileExistsInSearchPaths(level_in_game_path.c_str()); auto level_is_exists_in_mod = cocos::fileExistsInSearchPaths(level_path_to_save.string().c_str()); - log::debug("level_in_game_path: {}", level_in_game_path); - log::debug("level_path_to_save: {}", level_path_to_save); - log::debug("level_is_exists_in_gd: {}", level_is_exists_in_gd); - log::debug("level_is_exists_in_mod: {}", level_is_exists_in_mod); if (level_is_exists_in_gd and not level_is_exists_in_mod) { log::debug("ofstreamingo..."); - std::ofstream(level_path_to_save) << read_file(level_in_game_path).c_str(); + std::ofstream(level_path_to_save) + << read_file(level_in_game_path); } + //add sp ea + CCFileUtils::get()->addPriorityPath(Mod::get()->getConfigDir().string().c_str()); + } +}; +#include +class $modify(LoadingLayer) { + void loadAssets() { + if (m_loadStep == 0) Loaded(); + LoadingLayer::loadAssets(); + } +}; + +//huh +#include +class $modify(PlayLayer) { + bool init(GJGameLevel * level, bool useReplay, bool dontCreateObjects) { + if (level->m_levelType == GJLevelType::Local) + level->m_levelString = GameLevelManager::get()->getMainLevel(level->m_levelID.value(), 0)->m_levelString; + auto oldID = level->m_levelID.value(); + level->m_levelID = 999; //temp "Load Failed" bypass + auto rtn = PlayLayer::init(level, useReplay, dontCreateObjects); + level->m_levelID = oldID; + return rtn; } - //add sp ea - CCFileUtils::get()->addPriorityPath(Mod::get()->getConfigDir().string().c_str()); }; -$execute { Loaded(); }; #include class $modify(GameLevelManagerExt, GameLevelManager) { static void updateLevelByJson(GJGameLevel* level) { auto level_meta_file = levels_meta_path / fmt::format("{}.json", level->m_levelID.value()); - auto file_content = read_file(level_meta_file); + auto file_content = read_file(level_meta_file.string()); //json val auto value = matjson::parse("{}"); //file parse @@ -72,7 +89,17 @@ class $modify(GameLevelManagerExt, GameLevelManager) { } GJGameLevel* getMainLevel(int levelID, bool dontGetLevelString) { auto level = GameLevelManager::getMainLevel(levelID, dontGetLevelString); + //json meta updateLevelByJson(level); + //lvl str + auto toRead = std::string(); + auto dataFile = std::string(CCFileUtils::get()->fullPathForFilename(fmt::format("levels/{}.txt", levelID).c_str(), 1).data()); + auto dataFileAtMod = (levels_path / fmt::format("{}.txt", levelID)).string(); + if (cocos::fileExistsInSearchPaths(dataFileAtMod.c_str())) toRead = dataFileAtMod; + else toRead = dataFile; + auto fileContent = read_file(toRead); + level->m_levelString.clear(); + level->m_levelString.append(fileContent); return level; } };