mirror of
https://github.com/AxioDL/metaforce.git
synced 2025-12-09 09:07:43 +00:00
string_view refactor
This commit is contained in:
@@ -5,6 +5,8 @@ namespace DataSpec
|
||||
namespace DNAMP1
|
||||
{
|
||||
|
||||
using namespace std::literals;
|
||||
|
||||
bool AGSC::Extract(PAKEntryReadStream& rs, const hecl::ProjectPath& outPath)
|
||||
{
|
||||
Header head;
|
||||
@@ -48,12 +50,12 @@ bool AGSC::Cook(const hecl::ProjectPath& inPath, const hecl::ProjectPath& outPat
|
||||
return false;
|
||||
|
||||
hecl::ProjectPath woExt = inPath.getWithExtension(nullptr, true);
|
||||
std::string lastComp = woExt.getLastComponentUTF8();
|
||||
std::string lastComp = std::string(woExt.getLastComponentUTF8());
|
||||
if (hecl::StringUtils::EndsWith(lastComp, "_AGSC"))
|
||||
lastComp.assign(lastComp.cbegin(), lastComp.cend() - 5);
|
||||
|
||||
Header head;
|
||||
head.audioDir = "Audio/";
|
||||
head.audioDir = "Audio/"sv;
|
||||
head.groupName = lastComp;
|
||||
head.write(w);
|
||||
|
||||
|
||||
@@ -1054,9 +1054,9 @@ bool ANCS::Extract(const SpecBase& dataSpec,
|
||||
{
|
||||
if (res.second.evntId)
|
||||
{
|
||||
hecl::SystemStringView sysStr(res.second.name);
|
||||
hecl::SystemStringConv sysStr(res.second.name);
|
||||
hecl::ProjectPath evntYamlPath = outPath.getWithExtension((hecl::SystemString(_S(".")) +
|
||||
sysStr.sys_str() +
|
||||
sysStr.c_str() +
|
||||
_S(".evnt.yaml")).c_str(), true);
|
||||
hecl::ProjectPath::Type evntYamlType = evntYamlPath.getPathType();
|
||||
|
||||
@@ -1083,24 +1083,24 @@ bool ANCS::Cook(const hecl::ProjectPath& outPath,
|
||||
hecl::ProjectPath yamlPath = inPath.getWithExtension(_S(".yaml"), true);
|
||||
if (!yamlPath.isFile())
|
||||
Log.report(logvisor::Fatal, _S("'%s' not found as file"),
|
||||
yamlPath.getRelativePath().c_str());
|
||||
yamlPath.getRelativePath().data());
|
||||
|
||||
athena::io::FileReader reader(yamlPath.getAbsolutePath());
|
||||
if (!reader.isOpen())
|
||||
Log.report(logvisor::Fatal, _S("can't open '%s' for reading"),
|
||||
yamlPath.getRelativePath().c_str());
|
||||
yamlPath.getRelativePath().data());
|
||||
|
||||
if (!BigYAML::ValidateFromYAMLStream<ANCS>(reader))
|
||||
{
|
||||
Log.report(logvisor::Fatal, _S("'%s' is not urde::DNAMP1::ANCS type"),
|
||||
yamlPath.getRelativePath().c_str());
|
||||
yamlPath.getRelativePath().data());
|
||||
}
|
||||
|
||||
athena::io::YAMLDocReader yamlReader;
|
||||
if (!yamlReader.parse(&reader))
|
||||
{
|
||||
Log.report(logvisor::Fatal, _S("unable to parse '%s'"),
|
||||
yamlPath.getRelativePath().c_str());
|
||||
yamlPath.getRelativePath().data());
|
||||
}
|
||||
ANCS ancs;
|
||||
ancs.read(yamlReader);
|
||||
@@ -1114,8 +1114,8 @@ bool ANCS::Cook(const hecl::ProjectPath& outPath,
|
||||
ch.cmdlOverlay = UniqueID32{};
|
||||
ch.cskrOverlay = UniqueID32{};
|
||||
|
||||
hecl::SystemStringView chSysName(ch.name);
|
||||
ch.cskr = inPath.ensureAuxInfo(chSysName.sys_str() + _S(".CSKR"));
|
||||
hecl::SystemStringConv chSysName(ch.name);
|
||||
ch.cskr = inPath.ensureAuxInfo(hecl::SystemString(chSysName.sys_str()) + _S(".CSKR"));
|
||||
|
||||
for (const DNAANCS::Actor::Subtype& sub : actor.subtypes)
|
||||
{
|
||||
@@ -1124,15 +1124,15 @@ bool ANCS::Cook(const hecl::ProjectPath& outPath,
|
||||
if (sub.armature >= 0)
|
||||
{
|
||||
const DNAANCS::Actor::Armature& arm = actor.armatures[sub.armature];
|
||||
hecl::SystemStringView armSysName(arm.name);
|
||||
ch.cinf = inPath.ensureAuxInfo(armSysName.sys_str() + _S(".CINF"));
|
||||
hecl::SystemStringConv armSysName(arm.name);
|
||||
ch.cinf = inPath.ensureAuxInfo(hecl::SystemString(armSysName.sys_str()) + _S(".CINF"));
|
||||
ch.cmdl = sub.mesh;
|
||||
if (sub.overlayMeshes.size())
|
||||
{
|
||||
hecl::SystemStringView overlaySys(sub.overlayMeshes[0].first);
|
||||
hecl::SystemStringConv overlaySys(sub.overlayMeshes[0].first);
|
||||
ch.cmdlOverlay = sub.overlayMeshes[0].second;
|
||||
ch.cskrOverlay = inPath.ensureAuxInfo(chSysName.sys_str() + _S('.') +
|
||||
overlaySys.sys_str() + _S(".CSKR"));
|
||||
ch.cskrOverlay = inPath.ensureAuxInfo(hecl::SystemString(chSysName.sys_str()) + _S('.') +
|
||||
overlaySys.c_str() + _S(".CSKR"));
|
||||
}
|
||||
|
||||
break;
|
||||
@@ -1144,8 +1144,8 @@ bool ANCS::Cook(const hecl::ProjectPath& outPath,
|
||||
/* Set Animation Resource IDs */
|
||||
ancs.enumeratePrimitives([&](AnimationSet::MetaAnimPrimitive& prim) -> bool
|
||||
{
|
||||
hecl::SystemStringView sysStr(prim.animName);
|
||||
hecl::ProjectPath pathOut = inPath.ensureAuxInfo(sysStr.sys_str() + _S(".ANIM"));
|
||||
hecl::SystemStringConv sysStr(prim.animName);
|
||||
hecl::ProjectPath pathOut = inPath.ensureAuxInfo(hecl::SystemString(sysStr.sys_str()) + _S(".ANIM"));
|
||||
prim.animId = pathOut;
|
||||
return true;
|
||||
});
|
||||
@@ -1154,15 +1154,15 @@ bool ANCS::Cook(const hecl::ProjectPath& outPath,
|
||||
ancs.animationSet.animResources.reserve(actor.actions.size());
|
||||
for (const DNAANCS::Actor::Action& act : actor.actions)
|
||||
{
|
||||
hecl::SystemStringView sysStr(act.name);
|
||||
hecl::ProjectPath pathOut = inPath.ensureAuxInfo(sysStr.sys_str() + _S(".ANIM"));
|
||||
hecl::SystemStringConv sysStr(act.name);
|
||||
hecl::ProjectPath pathOut = inPath.ensureAuxInfo(hecl::SystemString(sysStr.sys_str()) + _S(".ANIM"));
|
||||
|
||||
ancs.animationSet.animResources.emplace_back();
|
||||
ancs.animationSet.animResources.back().animId = pathOut;
|
||||
|
||||
/* Check for associated EVNT YAML */
|
||||
hecl::ProjectPath evntYamlPath = inPath.getWithExtension((hecl::SystemString(_S(".")) +
|
||||
sysStr.sys_str() +
|
||||
sysStr.c_str() +
|
||||
_S(".evnt.yaml")).c_str(), true);
|
||||
evntYamlPath = evntYamlPath.ensureAuxInfo(_S(""));
|
||||
if (evntYamlPath.isFile())
|
||||
@@ -1185,7 +1185,7 @@ bool ANCS::CookCINF(const hecl::ProjectPath& outPath,
|
||||
|
||||
for (const DNAANCS::Actor::Armature& arm : actor.armatures)
|
||||
{
|
||||
hecl::SystemStringView sysStr(arm.name);
|
||||
hecl::SystemStringConv sysStr(arm.name);
|
||||
if (sysStr.sys_str() == armName)
|
||||
{
|
||||
std::unordered_map<std::string, atInt32> boneIdMap;
|
||||
@@ -1215,8 +1215,8 @@ bool ANCS::CookCSKR(const hecl::ProjectPath& outPath,
|
||||
overName = hecl::SystemString(subName.begin() + dotPos + 1, subName.end());
|
||||
subName = hecl::SystemString(subName.begin(), subName.begin() + dotPos);
|
||||
}
|
||||
hecl::SystemUTF8View subNameView(subName);
|
||||
hecl::SystemUTF8View overNameView(overName);
|
||||
hecl::SystemUTF8Conv subNameView(subName);
|
||||
hecl::SystemUTF8Conv overNameView(overName);
|
||||
|
||||
/* Build bone ID map */
|
||||
std::unordered_map<std::string, atInt32> boneIdMap;
|
||||
@@ -1255,16 +1255,16 @@ bool ANCS::CookCSKR(const hecl::ProjectPath& outPath,
|
||||
Log.report(logvisor::Fatal, _S("unable to resolve model path of %s:%s"), subName.c_str(), overName.c_str());
|
||||
|
||||
if (!modelPath->isFile())
|
||||
Log.report(logvisor::Fatal, _S("unable to resolve '%s'"), modelPath->getRelativePath().c_str());
|
||||
Log.report(logvisor::Fatal, _S("unable to resolve '%s'"), modelPath->getRelativePath().data());
|
||||
|
||||
hecl::ProjectPath skinIntPath = modelPath->getCookedPath(SpecEntMP1PC).getWithExtension(_S(".skinint"));
|
||||
if (!skinIntPath.isFileOrGlob() || skinIntPath.getModtime() < modelPath->getModtime())
|
||||
if (!modelCookFunc(*modelPath))
|
||||
Log.report(logvisor::Fatal, _S("unable to cook '%s'"), modelPath->getRelativePath().c_str());
|
||||
Log.report(logvisor::Fatal, _S("unable to cook '%s'"), modelPath->getRelativePath().data());
|
||||
|
||||
athena::io::FileReader skinIO(skinIntPath.getAbsolutePath(), 1024*32, false);
|
||||
if (skinIO.hasError())
|
||||
Log.report(logvisor::Fatal, _S("unable to open '%s'"), skinIntPath.getRelativePath().c_str());
|
||||
Log.report(logvisor::Fatal, _S("unable to open '%s'"), skinIntPath.getRelativePath().data());
|
||||
|
||||
std::vector<std::vector<uint32_t>> skinBanks;
|
||||
uint32_t bankCount = skinIO.readUint32Big();
|
||||
@@ -1304,7 +1304,7 @@ bool ANCS::CookCSKR(const hecl::ProjectPath& outPath,
|
||||
auto search = boneIdMap.find(name);
|
||||
if (search == boneIdMap.cend())
|
||||
Log.report(logvisor::Fatal, "unable to find bone '%s' in %s",
|
||||
name.c_str(), inPath.getRelativePathUTF8().c_str());
|
||||
name.c_str(), inPath.getRelativePathUTF8().data());
|
||||
virtualBone.emplace_back(search->second, weight);
|
||||
}
|
||||
}
|
||||
@@ -1326,7 +1326,7 @@ bool ANCS::CookCSKR(const hecl::ProjectPath& outPath,
|
||||
auto search = boneIdMap.find(name);
|
||||
if (search == boneIdMap.cend())
|
||||
Log.report(logvisor::Fatal, "unable to find bone '%s' in %s",
|
||||
name.c_str(), inPath.getRelativePathUTF8().c_str());
|
||||
name.c_str(), inPath.getRelativePathUTF8().data());
|
||||
skinOut.writeUint32Big(search->second);
|
||||
}
|
||||
}
|
||||
@@ -1355,12 +1355,12 @@ bool ANCS::CookANIM(const hecl::ProjectPath& outPath,
|
||||
{
|
||||
hecl::SystemString actName(inPath.getAuxInfo().begin(),
|
||||
inPath.getAuxInfo().end() - 5);
|
||||
hecl::SystemUTF8View actNameView(actName);
|
||||
hecl::SystemUTF8Conv actNameView(actName);
|
||||
DNAANCS::Actor::Action action = ds.compileActionChannelsOnly(actNameView.str());
|
||||
|
||||
if (!actor.armatures.size())
|
||||
Log.report(logvisor::Fatal, _S("0 armatures in %s"),
|
||||
inPath.getRelativePath().c_str());
|
||||
inPath.getRelativePath().data());
|
||||
|
||||
/* Build bone ID map */
|
||||
std::unordered_map<std::string, atInt32> boneIdMap;
|
||||
|
||||
@@ -168,7 +168,7 @@ struct DCLN : BigDNA
|
||||
|
||||
Vector<Collision, DNA_COUNT(colCount)> collision;
|
||||
|
||||
void sendToBlender(hecl::BlenderConnection& conn, const std::string& entryName)
|
||||
void sendToBlender(hecl::BlenderConnection& conn, std::string_view entryName)
|
||||
{
|
||||
/* Open Py Stream and read sections */
|
||||
hecl::BlenderConnection::PyOutStream os = conn.beginPythonOut(true);
|
||||
@@ -182,7 +182,7 @@ struct DCLN : BigDNA
|
||||
" if ob.type != 'CAMERA':\n"
|
||||
" bpy.context.scene.objects.unlink(ob)\n"
|
||||
" bpy.data.objects.remove(ob)\n",
|
||||
entryName.c_str());
|
||||
entryName.data());
|
||||
|
||||
DeafBabe::BlenderInit(os);
|
||||
atInt32 idx = 0;
|
||||
|
||||
@@ -52,9 +52,9 @@ namespace DNAMP1
|
||||
{
|
||||
logvisor::Module Log("urde::DNAMP1");
|
||||
|
||||
static bool GetNoShare(const std::string& name)
|
||||
static bool GetNoShare(std::string_view name)
|
||||
{
|
||||
std::string lowerName = name;
|
||||
std::string lowerName(name);
|
||||
std::transform(lowerName.begin(), lowerName.end(), lowerName.begin(), tolower);
|
||||
if (!lowerName.compare(0, 7, "metroid"))
|
||||
return false;
|
||||
@@ -93,9 +93,9 @@ PAKBridge::PAKBridge(hecl::Database::Project& project,
|
||||
}
|
||||
}
|
||||
|
||||
static hecl::SystemString LayerName(const std::string& name)
|
||||
static hecl::SystemString LayerName(std::string_view name)
|
||||
{
|
||||
hecl::SystemString ret = hecl::SystemStringView(name).sys_str();
|
||||
hecl::SystemString ret(hecl::SystemStringConv(name).sys_str());
|
||||
for (auto& ch : ret)
|
||||
if (ch == _S('/') || ch == _S('\\'))
|
||||
ch = _S('-');
|
||||
@@ -119,7 +119,7 @@ void PAKBridge::build()
|
||||
}
|
||||
bool named;
|
||||
std::string bestName = m_pak.bestEntryName(entry, named);
|
||||
level.name = hecl::SystemStringView(bestName).sys_str();
|
||||
level.name = hecl::SystemStringConv(bestName).sys_str();
|
||||
level.areas.reserve(mlvl.areaCount);
|
||||
unsigned layerIdx = 0;
|
||||
|
||||
@@ -165,13 +165,13 @@ void PAKBridge::build()
|
||||
if (areaDeps.name.empty())
|
||||
{
|
||||
std::string idStr = area.areaMREAId.toString();
|
||||
areaDeps.name = _S("MREA_") + hecl::SystemStringView(idStr).sys_str();
|
||||
areaDeps.name = hecl::SystemString(_S("MREA_")) + hecl::SystemStringConv(idStr).c_str();
|
||||
}
|
||||
hecl::SystemChar num[16];
|
||||
hecl::SNPrintf(num, 16, _S("%02u "), ai);
|
||||
areaDeps.name = num + areaDeps.name;
|
||||
|
||||
std::string lowerName = hecl::SystemUTF8View(areaDeps.name).str();
|
||||
std::string lowerName(hecl::SystemUTF8Conv(areaDeps.name).str());
|
||||
for (char& ch : lowerName)
|
||||
{
|
||||
ch = tolower(ch);
|
||||
|
||||
@@ -29,8 +29,8 @@ public:
|
||||
bool doExtract=true);
|
||||
void build();
|
||||
static ResExtractor<PAKBridge> LookupExtractor(const PAK& pak, const PAK::Entry& entry);
|
||||
const std::string& getName() const {return m_node.getName();}
|
||||
const hecl::SystemString& getLevelString() const {return m_levelString;}
|
||||
std::string_view getName() const {return m_node.getName();}
|
||||
hecl::SystemStringView getLevelString() const {return m_levelString;}
|
||||
using PAKType = PAK;
|
||||
const PAKType& getPAK() const {return m_pak;}
|
||||
const nod::Node& getNode() const {return m_node;}
|
||||
|
||||
@@ -470,14 +470,14 @@ bool FRME::Extract(const SpecBase &dataSpec,
|
||||
|
||||
if (resPath.size())
|
||||
{
|
||||
hecl::SystemUTF8View resPathView(resPath);
|
||||
hecl::SystemUTF8Conv resPathView(resPath);
|
||||
os.format("if '%s' in bpy.data.images:\n"
|
||||
" image = bpy.data.images['%s']\n"
|
||||
"else:\n"
|
||||
" image = bpy.data.images.load('''//%s''')\n"
|
||||
" image.name = '%s'\n",
|
||||
texName.c_str(), texName.c_str(),
|
||||
resPathView.str().c_str(), texName.c_str());
|
||||
resPathView.c_str(), texName.c_str());
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -535,7 +535,7 @@ bool FRME::Extract(const SpecBase &dataSpec,
|
||||
os.format("frme_obj = bpy.data.objects.new(name='%s', object_data=binding)\n"
|
||||
"frme_obj.pass_index = %d\n"
|
||||
"parentName = '%s'\n"
|
||||
"frme_obj.retro_widget_type = 'RETRO_%s'\n"
|
||||
"frme_obj.retro_widget_type = 'RETRO_%.4s'\n"
|
||||
"frme_obj.retro_widget_use_anim_controller = %s\n"
|
||||
"frme_obj.retro_widget_default_visible = %s\n"
|
||||
"frme_obj.retro_widget_default_active = %s\n"
|
||||
@@ -549,7 +549,7 @@ bool FRME::Extract(const SpecBase &dataSpec,
|
||||
"else:\n"
|
||||
" frme_obj.parent = bpy.data.objects[parentName]\n",
|
||||
w.header.name.c_str(), pIdx++, w.header.parent.c_str(),
|
||||
w.type.toString().c_str(),
|
||||
w.type.getChars(),
|
||||
w.header.useAnimController ? "True" : "False",
|
||||
w.header.defaultVisible ? "True" : "False",
|
||||
w.header.defaultActive ? "True" : "False",
|
||||
@@ -566,7 +566,7 @@ bool FRME::Extract(const SpecBase &dataSpec,
|
||||
hecl::ProjectPath modelPath = pakRouter.getWorking(info->model);
|
||||
const PAKRouter<PAKBridge>::EntryType* cmdlE = pakRouter.lookupEntry(info->model, nullptr, true, true);
|
||||
|
||||
os.linkBlend(modelPath.getAbsolutePathUTF8().c_str(),
|
||||
os.linkBlend(modelPath.getAbsolutePathUTF8().data(),
|
||||
pakRouter.getBestEntryName(*cmdlE).c_str(), true);
|
||||
|
||||
os.format("frme_obj.retro_model_light_mask = %d\n", info->lightMask);
|
||||
@@ -622,7 +622,7 @@ bool FRME::Extract(const SpecBase &dataSpec,
|
||||
info->scaleCenter.vec[0],
|
||||
info->scaleCenter.vec[1],
|
||||
info->scaleCenter.vec[2],
|
||||
fontPath.getRelativePathUTF8().c_str(),
|
||||
fontPath.getRelativePathUTF8().data(),
|
||||
info->wordWrap ? "True" : "False",
|
||||
info->horizontal ? "True" : "False",
|
||||
info->fillColor.vec[0],
|
||||
@@ -635,7 +635,7 @@ bool FRME::Extract(const SpecBase &dataSpec,
|
||||
info->outlineColor.vec[3],
|
||||
info->blockExtent.vec[0],
|
||||
info->blockExtent.vec[1],
|
||||
jpFontPath.getRelativePathUTF8().c_str(),
|
||||
jpFontPath.getRelativePathUTF8().data(),
|
||||
info->jpnPointScale[0],
|
||||
info->jpnPointScale[1],
|
||||
int(info->justification),
|
||||
@@ -683,7 +683,7 @@ bool FRME::Extract(const SpecBase &dataSpec,
|
||||
hecl::ProjectPath txtrPath = pakRouter.getWorking(info->texture);
|
||||
if (txtrPath)
|
||||
os.format("frme_obj.retro_energybar_texture_path = '%s'\n",
|
||||
txtrPath.getRelativePathUTF8().c_str());
|
||||
txtrPath.getRelativePathUTF8().data());
|
||||
}
|
||||
}
|
||||
else if (w.type == SBIG('METR'))
|
||||
|
||||
@@ -90,7 +90,7 @@ bool MLVL::Cook(const hecl::ProjectPath& outPath, const hecl::ProjectPath& inPat
|
||||
if (!areaPath.isFile())
|
||||
continue;
|
||||
|
||||
Log.report(logvisor::Info, _S("Visiting %s"), area.path.getRelativePath().c_str());
|
||||
Log.report(logvisor::Info, _S("Visiting %s"), area.path.getRelativePath().data());
|
||||
|
||||
hecl::ProjectPath memRelayPath(area.path, _S("/!memoryrelays.yaml"));
|
||||
|
||||
@@ -277,8 +277,8 @@ bool MLVL::Cook(const hecl::ProjectPath& outPath, const hecl::ProjectPath& inPat
|
||||
}
|
||||
}
|
||||
|
||||
hecl::SystemUTF8View layerU8(layerName);
|
||||
mlvl.layerNames.push_back(layerU8.str());
|
||||
hecl::SystemUTF8Conv layerU8(layerName);
|
||||
mlvl.layerNames.emplace_back(layerU8.str());
|
||||
nameOffset += layerName.size() + 1;
|
||||
|
||||
MLVL::LayerFlags& thisLayFlags = mlvl.layerFlags.back();
|
||||
|
||||
@@ -566,8 +566,8 @@ bool MREA::PCCook(const hecl::ProjectPath& outPath,
|
||||
hecl::SNPrintf(parPid, 32, _S("%lluX"), (unsigned long long)getpid());
|
||||
#endif
|
||||
const hecl::SystemChar* args[] = {VisiGenPath.c_str(),
|
||||
visiIntOut.getAbsolutePath().c_str(),
|
||||
preVisiPath.getAbsolutePath().c_str(),
|
||||
visiIntOut.getAbsolutePath().data(),
|
||||
preVisiPath.getAbsolutePath().data(),
|
||||
thrIdx, parPid, nullptr};
|
||||
if (0 == hecl::RunProcess(VisiGenPath.c_str(), args))
|
||||
{
|
||||
|
||||
@@ -152,9 +152,9 @@ const PAK::Entry* PAK::lookupEntry(const UniqueID32& id) const
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
const PAK::Entry* PAK::lookupEntry(const std::string& name) const
|
||||
const PAK::Entry* PAK::lookupEntry(std::string_view name) const
|
||||
{
|
||||
auto result = m_nameMap.find(name);
|
||||
auto result = m_nameMap.find(name.data());
|
||||
if (result != m_nameMap.end())
|
||||
{
|
||||
auto result1 = m_entries.find(result->second);
|
||||
|
||||
@@ -53,7 +53,7 @@ struct PAK : BigDNA
|
||||
std::unordered_map<std::string, UniqueID32> m_nameMap;
|
||||
|
||||
const Entry* lookupEntry(const UniqueID32& id) const;
|
||||
const Entry* lookupEntry(const std::string& name) const;
|
||||
const Entry* lookupEntry(std::string_view name) const;
|
||||
std::string bestEntryName(const Entry& entry, bool& named) const;
|
||||
|
||||
using IDType = UniqueID32;
|
||||
|
||||
@@ -48,7 +48,7 @@ void SCLY::exportToLayerDirectories(const PAK::Entry& entry, PAKRouter<PAKBridge
|
||||
if (active)
|
||||
{
|
||||
hecl::ProjectPath activePath(layerPath, "!defaultactive");
|
||||
fclose(hecl::Fopen(activePath.getAbsolutePath().c_str(), _S("wb")));
|
||||
fclose(hecl::Fopen(activePath.getAbsolutePath().data(), _S("wb")));
|
||||
}
|
||||
|
||||
hecl::ProjectPath yamlFile(layerPath, _S("!objects.yaml"));
|
||||
|
||||
@@ -29,8 +29,8 @@ static uint32_t ParseTag(const char16_t* str)
|
||||
return strtoul(parseStr, nullptr, 16);
|
||||
}
|
||||
|
||||
static std::u16string::const_iterator SkipCommas(std::u16string& ret, const std::u16string& str,
|
||||
std::u16string::const_iterator it, size_t count)
|
||||
static std::u16string_view::const_iterator SkipCommas(std::u16string& ret, std::u16string_view str,
|
||||
std::u16string_view::const_iterator it, size_t count)
|
||||
{
|
||||
for (size_t i = 0; i < count; ++i)
|
||||
{
|
||||
@@ -44,8 +44,8 @@ static std::u16string::const_iterator SkipCommas(std::u16string& ret, const std:
|
||||
return it;
|
||||
}
|
||||
|
||||
static std::u16string::const_iterator UncookTextureList(std::u16string& ret, const std::u16string& str,
|
||||
std::u16string::const_iterator it)
|
||||
static std::u16string_view::const_iterator UncookTextureList(std::u16string& ret, std::u16string_view str,
|
||||
std::u16string_view::const_iterator it)
|
||||
{
|
||||
while (true)
|
||||
{
|
||||
@@ -76,8 +76,8 @@ static std::u16string::const_iterator UncookTextureList(std::u16string& ret, con
|
||||
return str.begin() + scpos + 1;
|
||||
}
|
||||
|
||||
static std::u16string::const_iterator CookTextureList(std::u16string& ret, const std::u16string& str,
|
||||
std::u16string::const_iterator it)
|
||||
static std::u16string_view::const_iterator CookTextureList(std::u16string& ret, std::u16string_view str,
|
||||
std::u16string_view::const_iterator it)
|
||||
{
|
||||
while (true)
|
||||
{
|
||||
@@ -112,8 +112,8 @@ static std::u16string::const_iterator CookTextureList(std::u16string& ret, const
|
||||
return str.begin() + scpos + 1;
|
||||
}
|
||||
|
||||
static std::u16string::const_iterator GatherTextureList(std::vector<hecl::ProjectPath>& pathsOut,
|
||||
const std::u16string& str, std::u16string::const_iterator it)
|
||||
static std::u16string_view::const_iterator GatherTextureList(std::vector<hecl::ProjectPath>& pathsOut,
|
||||
std::u16string_view str, std::u16string_view::const_iterator it)
|
||||
{
|
||||
while (true)
|
||||
{
|
||||
@@ -148,7 +148,7 @@ static std::u16string::const_iterator GatherTextureList(std::vector<hecl::Projec
|
||||
return str.begin() + scpos + 1;
|
||||
}
|
||||
|
||||
static std::u16string UncookString(const std::u16string& str)
|
||||
static std::u16string UncookString(std::u16string_view str)
|
||||
{
|
||||
std::u16string ret;
|
||||
ret.reserve(str.size());
|
||||
@@ -220,7 +220,7 @@ static std::u16string UncookString(const std::u16string& str)
|
||||
return ret;
|
||||
}
|
||||
|
||||
static std::u16string CookString(const std::u16string& str)
|
||||
static std::u16string CookString(std::u16string_view str)
|
||||
{
|
||||
std::u16string ret;
|
||||
ret.reserve(str.size());
|
||||
@@ -297,52 +297,53 @@ void STRG::gatherDependencies(std::vector<hecl::ProjectPath>& pathsOut) const
|
||||
{
|
||||
for (const std::u16string& str : lang.second)
|
||||
{
|
||||
for (auto it = str.begin(); it != str.end();)
|
||||
std::u16string_view strView(str);
|
||||
for (auto it = strView.begin(); it != strView.end();)
|
||||
{
|
||||
if (*it == u'&')
|
||||
{
|
||||
++it;
|
||||
if (!str.compare(it - str.begin(), 5, u"image"))
|
||||
if (!str.compare(it - strView.begin(), 5, u"image"))
|
||||
{
|
||||
it += 6;
|
||||
if (!str.compare(it - str.begin(), 1, u"A"))
|
||||
if (!str.compare(it - strView.begin(), 1, u"A"))
|
||||
{
|
||||
it = SkipCommas(skip, str, it, 2);
|
||||
it = GatherTextureList(pathsOut, str, it);
|
||||
continue;
|
||||
}
|
||||
else if (!str.compare(it - str.begin(), 2, u"SA"))
|
||||
else if (!str.compare(it - strView.begin(), 2, u"SA"))
|
||||
{
|
||||
it = SkipCommas(skip, str, it, 4);
|
||||
it = GatherTextureList(pathsOut, str, it);
|
||||
continue;
|
||||
}
|
||||
else if (!str.compare(it - str.begin(), 2, u"SI"))
|
||||
else if (!str.compare(it - strView.begin(), 2, u"SI"))
|
||||
{
|
||||
it = SkipCommas(skip, str, it, 3);
|
||||
it = GatherTextureList(pathsOut, str, it);
|
||||
continue;
|
||||
}
|
||||
}
|
||||
else if (!str.compare(it - str.begin(), 4, u"font"))
|
||||
else if (!str.compare(it - strView.begin(), 4, u"font"))
|
||||
{
|
||||
it += 5;
|
||||
auto scpos = str.find(u';', it - str.begin());
|
||||
auto scpos = str.find(u';', it - strView.begin());
|
||||
if (scpos == std::u16string::npos)
|
||||
Log.report(logvisor::Fatal, "Missing semicolon token while pasing font tag");
|
||||
hecl::ProjectPath path = UniqueIDBridge::MakePathFromString<UniqueID32>(
|
||||
hecl::Char16ToUTF8(std::u16string(it, str.begin() + scpos)));
|
||||
hecl::Char16ToUTF8(std::u16string(it, strView.begin() + scpos)));
|
||||
if (path)
|
||||
pathsOut.push_back(path);
|
||||
it = str.begin() + scpos + 1;
|
||||
it = strView.begin() + scpos + 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
auto scpos = str.find(u';', it - str.begin());
|
||||
auto scpos = str.find(u';', it - strView.begin());
|
||||
if (scpos == std::u16string::npos)
|
||||
it = str.end();
|
||||
it = strView.end();
|
||||
else
|
||||
it = str.begin() + scpos + 1;
|
||||
it = strView.begin() + scpos + 1;
|
||||
}
|
||||
}
|
||||
else
|
||||
|
||||
@@ -19,7 +19,7 @@ struct STRG : ISTRG
|
||||
std::vector<std::pair<FourCC, std::vector<std::u16string>>> langs;
|
||||
std::unordered_map<FourCC, std::vector<std::u16string>*> langMap;
|
||||
|
||||
int32_t lookupIdx(const std::string& name) const {return -1;}
|
||||
int32_t lookupIdx(std::string_view name) const {return -1;}
|
||||
|
||||
size_t count() const
|
||||
{
|
||||
|
||||
@@ -34,7 +34,7 @@ struct CTweakGame final : ITweakGame
|
||||
Value<float> x60_hardmodeDamageMult;
|
||||
Value<float> x64_hardmodeWeaponMult;
|
||||
|
||||
const std::string& GetWorldPrefix() const { return x4_worldPrefix; }
|
||||
std::string_view GetWorldPrefix() const { return x4_worldPrefix; }
|
||||
bool GetSplashScreensDisabled() const { return x2b_splashScreensDisabled; }
|
||||
float GetFirstPersonFOV() const { return x24_fov; }
|
||||
float GetPressStartDelay() const { return x30_pressStartDelay; }
|
||||
|
||||
@@ -72,30 +72,30 @@ struct CTweakPlayerRes final : ITweakPlayerRes
|
||||
|
||||
Value<float> m_cinematicMoveOutofIntoPlayerDistance;
|
||||
|
||||
const std::string& _GetSaveStationIcon() const { return m_saveStationIcon; }
|
||||
const std::string& _GetMissileStationIcon() const { return m_missileStationIcon; }
|
||||
const std::string& _GetElevatorIcon() const { return m_elevatorIcon; }
|
||||
std::string_view _GetSaveStationIcon() const { return m_saveStationIcon; }
|
||||
std::string_view _GetMissileStationIcon() const { return m_missileStationIcon; }
|
||||
std::string_view _GetElevatorIcon() const { return m_elevatorIcon; }
|
||||
|
||||
const std::string& _GetMinesBreakFirstTopIcon() const { return m_minesBreakFirstTopIcon; }
|
||||
const std::string& _GetMinesBreakFirstBottomIcon() const { return m_minesBreakFirstBottomIcon; }
|
||||
const std::string& _GetMinesBreakSecondTopIcon() const { return m_minesBreakSecondTopIcon; }
|
||||
const std::string& _GetMinesBreakSecondBottomIcon() const { return m_minesBreakSecondBottomIcon; }
|
||||
std::string_view _GetMinesBreakFirstTopIcon() const { return m_minesBreakFirstTopIcon; }
|
||||
std::string_view _GetMinesBreakFirstBottomIcon() const { return m_minesBreakFirstBottomIcon; }
|
||||
std::string_view _GetMinesBreakSecondTopIcon() const { return m_minesBreakSecondTopIcon; }
|
||||
std::string_view _GetMinesBreakSecondBottomIcon() const { return m_minesBreakSecondBottomIcon; }
|
||||
|
||||
const std::string& _GetLStick(size_t idx) const { return (&m_lStickN)[idx]; }
|
||||
const std::string& _GetCStick(size_t idx) const { return (&m_cStickN)[idx]; }
|
||||
std::string_view _GetLStick(size_t idx) const { return (&m_lStickN)[idx]; }
|
||||
std::string_view _GetCStick(size_t idx) const { return (&m_cStickN)[idx]; }
|
||||
|
||||
const std::string& _GetLTrigger(size_t idx) const { return (&m_lTriggerOut)[idx]; }
|
||||
const std::string& _GetRTrigger(size_t idx) const { return (&m_rTriggerOut)[idx]; }
|
||||
const std::string& _GetStartButton(size_t idx) const { return (&m_startButtonOut)[idx]; }
|
||||
const std::string& _GetAButton(size_t idx) const { return (&m_aButtonOut)[idx]; }
|
||||
const std::string& _GetBButton(size_t idx) const { return (&m_bButtonOut)[idx]; }
|
||||
const std::string& _GetXButton(size_t idx) const { return (&m_xButtonOut)[idx]; }
|
||||
const std::string& _GetYButton(size_t idx) const { return (&m_yButtonOut)[idx]; }
|
||||
std::string_view _GetLTrigger(size_t idx) const { return (&m_lTriggerOut)[idx]; }
|
||||
std::string_view _GetRTrigger(size_t idx) const { return (&m_rTriggerOut)[idx]; }
|
||||
std::string_view _GetStartButton(size_t idx) const { return (&m_startButtonOut)[idx]; }
|
||||
std::string_view _GetAButton(size_t idx) const { return (&m_aButtonOut)[idx]; }
|
||||
std::string_view _GetBButton(size_t idx) const { return (&m_bButtonOut)[idx]; }
|
||||
std::string_view _GetXButton(size_t idx) const { return (&m_xButtonOut)[idx]; }
|
||||
std::string_view _GetYButton(size_t idx) const { return (&m_yButtonOut)[idx]; }
|
||||
|
||||
const std::string& _GetBallTransitionsANCS() const { return m_ballTransitionsANCS; }
|
||||
std::string_view _GetBallTransitionsANCS() const { return m_ballTransitionsANCS; }
|
||||
|
||||
const std::string& _GetBallTransitionBeamRes(size_t idx) const { return (&m_ballTransitionsPower)[idx]; }
|
||||
const std::string& _GetBeamCineModel(size_t idx) const { return (&m_cinePower)[idx]; }
|
||||
std::string_view _GetBallTransitionBeamRes(size_t idx) const { return (&m_ballTransitionsPower)[idx]; }
|
||||
std::string_view _GetBeamCineModel(size_t idx) const { return (&m_cinePower)[idx]; }
|
||||
|
||||
float _GetCinematicMoveOutofIntoPlayerDistance() const { return m_cinematicMoveOutofIntoPlayerDistance; }
|
||||
|
||||
|
||||
@@ -33,7 +33,7 @@ struct CTweakSlideShow final : ITweakSlideShow
|
||||
CTweakSlideShow() = default;
|
||||
CTweakSlideShow(athena::io::IStreamReader& in) { read(in); }
|
||||
|
||||
const std::string& GetFont() const { return x14_fontAssetName; }
|
||||
std::string_view GetFont() const { return x14_fontAssetName; }
|
||||
const zeus::CColor& GetFontColor() const { return x24_fontColor; }
|
||||
const zeus::CColor& GetOutlineColor() const { return x28_outlineColor; }
|
||||
float GetScanPercentInterval() const { return x2c_scanPercentInterval; }
|
||||
|
||||
Reference in New Issue
Block a user