mirror of
https://github.com/geode-sdk/geode.git
synced 2024-11-15 03:25:01 -05:00
mod sprite names now use directories instead of prefixes. note that this
commit will not work without manually removing the prefixes from loader resources (and adding the directory prefixes to spritesheet keys) until the CLI rewrite is finished
This commit is contained in:
parent
34a64ae56b
commit
78415153b5
5 changed files with 13 additions and 25 deletions
|
@ -201,6 +201,7 @@ class cocos2d::CCFadeTo {
|
|||
|
||||
class cocos2d::CCFileUtils : cocos2d::TypeInfo {
|
||||
static cocos2d::CCFileUtils* sharedFileUtils() = mac 0x377030, ios 0x159450;
|
||||
virtual std::string fullPathForFilename(const char* filename, bool unk);
|
||||
}
|
||||
|
||||
class cocos2d::CCHide {
|
||||
|
|
|
@ -176,7 +176,6 @@ namespace geode {
|
|||
* Mod::m_addResourcesToSearchPath to true
|
||||
* first
|
||||
*/
|
||||
void addModResourcesPath(Mod* mod);
|
||||
void updateResourcePaths();
|
||||
void updateModResources(Mod* mod);
|
||||
void updateResources();
|
||||
|
|
|
@ -12,9 +12,9 @@ static ModInfo getInternalModInfo() {
|
|||
info.m_version = LOADER_VERSION;
|
||||
info.m_supportsDisabling = false;
|
||||
info.m_spritesheets = {
|
||||
"geode.loader_LogoSheet",
|
||||
"geode.loader_APISheet",
|
||||
"geode.loader_BlankSheet"
|
||||
"geode.loader/LogoSheet",
|
||||
"geode.loader/APISheet",
|
||||
"geode.loader/BlankSheet"
|
||||
};
|
||||
|
||||
return info;
|
||||
|
|
|
@ -50,26 +50,15 @@ void Loader::createDirectories() {
|
|||
m_logStream = std::ofstream(logDir / generateLogName());
|
||||
}
|
||||
|
||||
void Loader::addModResourcesPath(Mod* mod) {
|
||||
if (mod->m_addResourcesToSearchPath) {
|
||||
CCFileUtils::sharedFileUtils()->addSearchPath(
|
||||
mod->m_tempDirName.string().c_str()
|
||||
);
|
||||
CCFileUtils::sharedFileUtils()->addSearchPath(
|
||||
(mod->m_tempDirName / "resources").string().c_str()
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
void Loader::updateResourcePaths() {
|
||||
// add own resources directory
|
||||
auto resDir = this->getGeodeDirectory() / GEODE_RESOURCE_DIRECTORY;
|
||||
CCFileUtils::sharedFileUtils()->addSearchPath(resDir.string().c_str());
|
||||
|
||||
// add mods' resources directories
|
||||
for (auto const& [_, mod] : m_mods) {
|
||||
this->addModResourcesPath(mod);
|
||||
}
|
||||
CCFileUtils::sharedFileUtils()->addSearchPath(
|
||||
(this->getGeodeDirectory() / GEODE_RESOURCE_DIRECTORY).string().c_str()
|
||||
);
|
||||
// add mods directory
|
||||
CCFileUtils::sharedFileUtils()->addSearchPath(
|
||||
(this->getGeodeDirectory() / GEODE_MOD_DIRECTORY).string().c_str()
|
||||
);
|
||||
}
|
||||
|
||||
void Loader::updateModResources(Mod* mod) {
|
||||
|
|
|
@ -131,7 +131,6 @@ Result<> Mod::createTempDir() {
|
|||
}
|
||||
|
||||
this->m_addResourcesToSearchPath = true;
|
||||
Loader::get()->addModResourcesPath(this);
|
||||
|
||||
return Ok<>(tempPath);
|
||||
}
|
||||
|
@ -484,7 +483,7 @@ const char* Mod::expandSpriteName(const char* name) {
|
|||
return expanded[name];
|
||||
}
|
||||
auto exp = new char[strlen(name) + 2 + this->m_info.m_id.size()];
|
||||
auto exps = this->m_info.m_id + "_" + name;
|
||||
auto exps = this->m_info.m_id + "/" + name;
|
||||
memcpy(exp, exps.c_str(), exps.size() + 1);
|
||||
expanded[name] = exp;
|
||||
return exp;
|
||||
|
@ -560,7 +559,7 @@ Result<ModInfo> ModInfo::createFromSchemaV010(
|
|||
.has("spritesheets")
|
||||
.as<nlohmann::json::object_t>()
|
||||
.each([&info](auto key, auto) -> void {
|
||||
info.m_spritesheets.push_back(info.m_id + "_" + key);
|
||||
info.m_spritesheets.push_back(info.m_id + "/" + key);
|
||||
});
|
||||
|
||||
json_assign_optional(knownKeys, json, "toggleable", info.m_supportsDisabling);
|
||||
|
|
Loading…
Reference in a new issue