Skip to content

Commit

Permalink
some a
Browse files Browse the repository at this point in the history
  • Loading branch information
user95401 committed Jul 8, 2024
1 parent efb580b commit b3f6c44
Show file tree
Hide file tree
Showing 6 changed files with 60 additions and 49 deletions.
26 changes: 8 additions & 18 deletions README.md
Original file line number Diff line number Diff line change
@@ -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 <cr>"Load Failed!"</c> <cl>bypass</c> here

<cg>summary u can add ur own level in level select layer</c>

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

<cr>
- ui
- editor
- basic work this mod should do ya

#### android releases is unstable i think
and <cr>"Load Failed!"</c> <cl>bypass</c> here

</c>
<cg>summary u can add ur own level in level select layer</c>

## 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)
Just open .geode file (its zip btw) and pack the config files up to `./config/` folder.
Binary file removed Screenshot_121.png
Binary file not shown.
Binary file removed Screenshot_122.png
Binary file not shown.
21 changes: 7 additions & 14 deletions about.md
Original file line number Diff line number Diff line change
@@ -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 <cr>"Load Failed!"</c> <cl>bypass</c> here

<cg>summary u can add ur own level in level select layer</c>
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

<cr>

#### android releases is unstable i think
and <cr>"Load Failed!"</c> <cl>bypass</c> here

</c>
<cg>summary u can add ur own level in level select layer</c>

## packed config feature
u can distribute mod with your config...
Expand Down
15 changes: 8 additions & 7 deletions mod.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand All @@ -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",
Expand All @@ -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
}
}
}
47 changes: 37 additions & 10 deletions src/level_data.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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 <Geode/modify/LoadingLayer.hpp>
class $modify(LoadingLayer) {
void loadAssets() {
if (m_loadStep == 0) Loaded();
LoadingLayer::loadAssets();
}
};

//huh
#include <Geode/modify/PlayLayer.hpp>
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 <Geode/modify/GameLevelManager.hpp>
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
Expand Down Expand Up @@ -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;
}
};
Expand Down

0 comments on commit b3f6c44

Please sign in to comment.