2
0
mirror of https://github.com/AxioDL/metaforce.git synced 2025-06-06 01:53:27 +00:00

string_view refactor

This commit is contained in:
Jack Andersen 2017-11-12 20:19:18 -10:00
parent 742ab2514f
commit f7ec7bdc0c
345 changed files with 907 additions and 921 deletions

View File

@ -3,7 +3,7 @@ cmake_minimum_required(VERSION 3.1.0 FATAL_ERROR) # because of CMAKE_CXX_STANDAR
cmake_policy(SET CMP0054 NEW) cmake_policy(SET CMP0054 NEW)
project(urde) project(urde)
set(CMAKE_CXX_STANDARD 14) set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON) set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(BUILD_SHARED_LIBS OFF CACHE BOOL "Force shared libs off" FORCE) set(BUILD_SHARED_LIBS OFF CACHE BOOL "Force shared libs off" FORCE)
set(BUILD_STATIC_LIBS ON CACHE BOOL "Force static libs on" FORCE) set(BUILD_STATIC_LIBS ON CACHE BOOL "Force static libs on" FORCE)

View File

@ -59,7 +59,7 @@ bool ReadANCSToBlender(hecl::BlenderConnection& conn,
return false; return false;
std::string bestName = pakRouter.getBestEntryName(*cmdlE); std::string bestName = pakRouter.getBestEntryName(*cmdlE);
hecl::SystemStringView bestNameView(bestName); hecl::SystemStringConv bestNameView(bestName);
fileChanged(bestNameView.c_str()); fileChanged(bestNameView.c_str());
typename ANCSDNA::CSKRType cskr; typename ANCSDNA::CSKRType cskr;
@ -79,7 +79,7 @@ bool ReadANCSToBlender(hecl::BlenderConnection& conn,
} }
std::string bestName = pakRouter.getBestEntryName(entry); std::string bestName = pakRouter.getBestEntryName(entry);
hecl::SystemStringView bestNameView(bestName); hecl::SystemStringConv bestNameView(bestName);
fileChanged(bestNameView.c_str()); fileChanged(bestNameView.c_str());
/* Establish ANCS blend */ /* Establish ANCS blend */
@ -138,8 +138,8 @@ bool ReadANCSToBlender(hecl::BlenderConnection& conn,
if (cmdlE) if (cmdlE)
{ {
hecl::ProjectPath cmdlPath = pakRouter.getWorking(cmdlE); hecl::ProjectPath cmdlPath = pakRouter.getWorking(cmdlE);
os.linkBlend(cmdlPath.getAbsolutePathUTF8().c_str(), os.linkBlend(cmdlPath.getAbsolutePathUTF8().data(),
pakRouter.getBestEntryName(*cmdlE).c_str(), true); pakRouter.getBestEntryName(*cmdlE).data(), true);
/* Attach CMDL to CINF */ /* Attach CMDL to CINF */
os << "if obj.name not in bpy.context.scene.objects:\n" os << "if obj.name not in bpy.context.scene.objects:\n"
@ -160,8 +160,8 @@ bool ReadANCSToBlender(hecl::BlenderConnection& conn,
if (cmdlE) if (cmdlE)
{ {
hecl::ProjectPath cmdlPath = pakRouter.getWorking(cmdlE); hecl::ProjectPath cmdlPath = pakRouter.getWorking(cmdlE);
os.linkBlend(cmdlPath.getAbsolutePathUTF8().c_str(), os.linkBlend(cmdlPath.getAbsolutePathUTF8().data(),
pakRouter.getBestEntryName(*cmdlE).c_str(), true); pakRouter.getBestEntryName(*cmdlE).data(), true);
/* Attach CMDL to CINF */ /* Attach CMDL to CINF */
os << "if obj.name not in bpy.context.scene.objects:\n" os << "if obj.name not in bpy.context.scene.objects:\n"

View File

@ -89,7 +89,7 @@ void ReadMaterialSetToBlender_1_2(hecl::BlenderConnection::PyOutStream& os,
TXTR::Extract(rs, txtrPath); TXTR::Extract(rs, txtrPath);
} }
hecl::SystemString resPath = pakRouter.getResourceRelativePath(entry, tex); hecl::SystemString resPath = pakRouter.getResourceRelativePath(entry, tex);
hecl::SystemUTF8View resPathView(resPath); hecl::SystemUTF8Conv resPathView(resPath);
os.format("if '%s' in bpy.data.textures:\n" os.format("if '%s' in bpy.data.textures:\n"
" image = bpy.data.images['%s']\n" " image = bpy.data.images['%s']\n"
" texture = bpy.data.textures[image.name]\n" " texture = bpy.data.textures[image.name]\n"
@ -100,7 +100,7 @@ void ReadMaterialSetToBlender_1_2(hecl::BlenderConnection::PyOutStream& os,
" texture.image = image\n" " texture.image = image\n"
"texmap_list.append(texture)\n" "texmap_list.append(texture)\n"
"\n", texName.c_str(), texName.c_str(), "\n", texName.c_str(), texName.c_str(),
resPathView.str().c_str(), texName.c_str()); resPathView.c_str(), texName.c_str());
} }
unsigned m=0; unsigned m=0;
@ -519,7 +519,7 @@ void InitGeomBlenderContext(hecl::BlenderConnection::PyOutStream& os,
os.format("# Master shader library\n" os.format("# Master shader library\n"
"with bpy.data.libraries.load('%s', link=True, relative=True) as (data_from, data_to):\n" "with bpy.data.libraries.load('%s', link=True, relative=True) as (data_from, data_to):\n"
" data_to.node_groups = data_from.node_groups\n" " data_to.node_groups = data_from.node_groups\n"
"\n", masterShaderPath.getAbsolutePathUTF8().c_str()); "\n", masterShaderPath.getAbsolutePathUTF8().data());
} }
void FinishBlenderMesh(hecl::BlenderConnection::PyOutStream& os, void FinishBlenderMesh(hecl::BlenderConnection::PyOutStream& os,
@ -1248,7 +1248,7 @@ bool WriteCMDL(const hecl::ProjectPath& outPath, const hecl::ProjectPath& inPath
atUint32 nextGroupIdx = 0; atUint32 nextGroupIdx = 0;
for (const Mesh::Material& mat : mset) for (const Mesh::Material& mat : mset)
{ {
std::string diagName = hecl::Format("%s:%s", inPath.getLastComponentUTF8(), mat.name.c_str()); std::string diagName = hecl::Format("%s:%s", inPath.getLastComponentUTF8().data(), mat.name.c_str());
hecl::Frontend::IR matIR = FE.compileSource(mat.source, diagName); hecl::Frontend::IR matIR = FE.compileSource(mat.source, diagName);
setBackends.emplace_back(); setBackends.emplace_back();
hecl::Backend::GX& matGX = setBackends.back(); hecl::Backend::GX& matGX = setBackends.back();
@ -1521,7 +1521,7 @@ bool WriteHMDLCMDL(const hecl::ProjectPath& outPath, const hecl::ProjectPath& in
size_t endOff = 0; size_t endOff = 0;
for (const Mesh::Material& mat : mset) for (const Mesh::Material& mat : mset)
{ {
std::string diagName = hecl::Format("%s:%s", inPath.getLastComponentUTF8(), mat.name.c_str()); std::string diagName = hecl::Format("%s:%s", inPath.getLastComponentUTF8().data(), mat.name.c_str());
targetMSet.materials.emplace_back(FE, diagName, mat, mat.iprops, texPaths); targetMSet.materials.emplace_back(FE, diagName, mat, mat.iprops, texPaths);
endOff = targetMSet.materials.back().binarySize(endOff); endOff = targetMSet.materials.back().binarySize(endOff);
targetMSet.head.addMaterialEndOff(endOff); targetMSet.head.addMaterialEndOff(endOff);
@ -1719,7 +1719,7 @@ bool WriteHMDLMREASecs(std::vector<std::vector<uint8_t>>& secsOut, const hecl::P
texPaths.push_back(path); texPaths.push_back(path);
} }
std::string diagName = hecl::Format("%s:%s", inPath.getLastComponentUTF8(), mat.name.c_str()); std::string diagName = hecl::Format("%s:%s", inPath.getLastComponentUTF8().data(), mat.name.c_str());
matSet.materials.emplace_back(FE, diagName, mat, mat.iprops, texPaths); matSet.materials.emplace_back(FE, diagName, mat, mat.iprops, texPaths);
endOff = matSet.materials.back().binarySize(endOff); endOff = matSet.materials.back().binarySize(endOff);
matSet.head.addMaterialEndOff(endOff); matSet.head.addMaterialEndOff(endOff);

View File

@ -56,7 +56,7 @@ template
hecl::ProjectPath UniqueIDBridge::TranslatePakIdToPath(const UniqueID64& id, bool silenceWarnings); hecl::ProjectPath UniqueIDBridge::TranslatePakIdToPath(const UniqueID64& id, bool silenceWarnings);
template <class IDType> template <class IDType>
hecl::ProjectPath UniqueIDBridge::MakePathFromString(const std::string& str) hecl::ProjectPath UniqueIDBridge::MakePathFromString(std::string_view str)
{ {
if (str.empty()) if (str.empty())
return {}; return {};
@ -69,9 +69,9 @@ hecl::ProjectPath UniqueIDBridge::MakePathFromString(const std::string& str)
return path; return path;
} }
template template
hecl::ProjectPath UniqueIDBridge::MakePathFromString<UniqueID32>(const std::string& str); hecl::ProjectPath UniqueIDBridge::MakePathFromString<UniqueID32>(std::string_view str);
template template
hecl::ProjectPath UniqueIDBridge::MakePathFromString<UniqueID64>(const std::string& str); hecl::ProjectPath UniqueIDBridge::MakePathFromString<UniqueID64>(std::string_view str);
template <class IDType> template <class IDType>
void UniqueIDBridge::TransformOldHashToNewHash(IDType& id) void UniqueIDBridge::TransformOldHashToNewHash(IDType& id)
@ -105,7 +105,7 @@ void UniqueID32::write(athena::io::YAMLDocWriter& writer) const
if (!path) if (!path)
return; return;
writer.writeString(nullptr, path.getAuxInfo().size() ? writer.writeString(nullptr, path.getAuxInfo().size() ?
(path.getRelativePathUTF8() + '|' + path.getAuxInfoUTF8()) : (std::string(path.getRelativePathUTF8()) + '|' + path.getAuxInfoUTF8().data()) :
path.getRelativePathUTF8()); path.getRelativePathUTF8());
} }
size_t UniqueID32::binarySize(size_t __isz) const size_t UniqueID32::binarySize(size_t __isz) const
@ -165,8 +165,8 @@ void AuxiliaryID32::write(athena::io::YAMLDocWriter& writer) const
return; return;
if (m_addExtension) if (m_addExtension)
path = path.getWithExtension(m_addExtension); path = path.getWithExtension(m_addExtension);
hecl::SystemUTF8View ufx8AuxStr(m_auxStr); hecl::SystemUTF8Conv ufx8AuxStr(m_auxStr);
writer.writeString(nullptr, path.getRelativePathUTF8() + '|' + ufx8AuxStr); writer.writeString(nullptr, std::string(path.getRelativePathUTF8()) + '|' + ufx8AuxStr);
} }
@ -187,7 +187,7 @@ void UniqueID64::write(athena::io::YAMLDocWriter& writer) const
if (!path) if (!path)
return; return;
writer.writeString(nullptr, path.getAuxInfo().size() ? writer.writeString(nullptr, path.getAuxInfo().size() ?
(path.getRelativePathUTF8() + '|' + path.getAuxInfoUTF8()) : (std::string(path.getRelativePathUTF8()) + '|' + path.getAuxInfoUTF8().data()) :
path.getRelativePathUTF8()); path.getRelativePathUTF8());
} }
size_t UniqueID64::binarySize(size_t __isz) const size_t UniqueID64::binarySize(size_t __isz) const
@ -223,7 +223,7 @@ void UniqueID128::write(athena::io::YAMLDocWriter& writer) const
if (!path) if (!path)
return; return;
writer.writeString(nullptr, path.getAuxInfo().size() ? writer.writeString(nullptr, path.getAuxInfo().size() ?
(path.getRelativePathUTF8() + '|' + path.getAuxInfoUTF8()) : (std::string(path.getRelativePathUTF8()) + '|' + path.getAuxInfoUTF8().data()) :
path.getRelativePathUTF8()); path.getRelativePathUTF8());
} }
size_t UniqueID128::binarySize(size_t __isz) const size_t UniqueID128::binarySize(size_t __isz) const

View File

@ -130,7 +130,7 @@ public:
template <class IDType> template <class IDType>
static hecl::ProjectPath TranslatePakIdToPath(const IDType& id, bool silenceWarnings=false); static hecl::ProjectPath TranslatePakIdToPath(const IDType& id, bool silenceWarnings=false);
template <class IDType> template <class IDType>
static hecl::ProjectPath MakePathFromString(const std::string& str); static hecl::ProjectPath MakePathFromString(std::string_view str);
template <class IDType> template <class IDType>
static void TransformOldHashToNewHash(IDType& id); static void TransformOldHashToNewHash(IDType& id);

View File

@ -376,7 +376,7 @@ bool Cook(const hecl::BlenderConnection::DataStream::MapArea& mapaIn, const hecl
if (mapaIn.verts.size() >= 256) if (mapaIn.verts.size() >= 256)
{ {
Log.report(logvisor::Error, _S("MAPA %s vertex range exceeded [%d/%d]"), Log.report(logvisor::Error, _S("MAPA %s vertex range exceeded [%d/%d]"),
out.getRelativePath().c_str(), mapaIn.verts.size(), 255); out.getRelativePath().data(), mapaIn.verts.size(), 255);
return false; return false;
} }

View File

@ -40,8 +40,8 @@ bool ReadMAPUToBlender(hecl::BlenderConnection& conn,
"\n"; "\n";
hecl::ProjectPath hexPath = pakRouter.getWorking(mapu.hexMapa); hecl::ProjectPath hexPath = pakRouter.getWorking(mapu.hexMapa);
os.linkBlend(hexPath.getAbsolutePathUTF8().c_str(), os.linkBlend(hexPath.getAbsolutePathUTF8().data(),
pakRouter.getBestEntryName(mapu.hexMapa).c_str()); pakRouter.getBestEntryName(mapu.hexMapa).data());
os << "hexMesh = bpy.data.objects['MAP'].data\n"; os << "hexMesh = bpy.data.objects['MAP'].data\n";
for (const MAPU::World& wld : mapu.worlds) for (const MAPU::World& wld : mapu.worlds)
@ -62,7 +62,7 @@ bool ReadMAPUToBlender(hecl::BlenderConnection& conn,
wldXf.xf[1].vec[0], wldXf.xf[1].vec[1], wldXf.xf[1].vec[2], wldXf.xf[1].vec[3], wldXf.xf[1].vec[0], wldXf.xf[1].vec[1], wldXf.xf[1].vec[2], wldXf.xf[1].vec[3],
wldXf.xf[2].vec[0], wldXf.xf[2].vec[1], wldXf.xf[2].vec[2], wldXf.xf[2].vec[3], wldXf.xf[2].vec[0], wldXf.xf[2].vec[1], wldXf.xf[2].vec[2], wldXf.xf[2].vec[3],
wld.hexColor.r, wld.hexColor.g, wld.hexColor.b, wld.hexColor.a, wld.hexColor.r, wld.hexColor.g, wld.hexColor.b, wld.hexColor.a,
path.getParentPath().getRelativePathUTF8().c_str()); path.getParentPath().getRelativePathUTF8().data());
int idx = 0; int idx = 0;
for (const MAPU::Transform& hexXf : wld.hexTransforms) for (const MAPU::Transform& hexXf : wld.hexTransforms)
{ {

View File

@ -42,7 +42,7 @@ bool ReadMLVLToBlender(hecl::BlenderConnection& conn,
for (const auto& area : mlvl.areas) for (const auto& area : mlvl.areas)
{ {
const typename PAKRouter::EntryType* mreaEntry = pakRouter.lookupEntry(area.areaMREAId); const typename PAKRouter::EntryType* mreaEntry = pakRouter.lookupEntry(area.areaMREAId);
hecl::SystemUTF8View areaDirName(*mreaEntry->unique.m_areaName); hecl::SystemUTF8Conv areaDirName(*mreaEntry->unique.m_areaName);
os.AABBToBMesh(area.aabb[0], area.aabb[1]); os.AABBToBMesh(area.aabb[0], area.aabb[1]);
os.format("box_mesh = bpy.data.meshes.new('''%s''')\n" os.format("box_mesh = bpy.data.meshes.new('''%s''')\n"
@ -56,7 +56,7 @@ bool ReadMLVLToBlender(hecl::BlenderConnection& conn,
"box.location = mtxd[0]\n" "box.location = mtxd[0]\n"
"box.rotation_quaternion = mtxd[1]\n" "box.rotation_quaternion = mtxd[1]\n"
"box.scale = mtxd[2]\n", "box.scale = mtxd[2]\n",
areaDirName.str().c_str(), areaDirName.str().data(),
area.transformMtx[0].vec[0], area.transformMtx[0].vec[1], area.transformMtx[0].vec[2], area.transformMtx[0].vec[3], area.transformMtx[0].vec[0], area.transformMtx[0].vec[1], area.transformMtx[0].vec[2], area.transformMtx[0].vec[3],
area.transformMtx[1].vec[0], area.transformMtx[1].vec[1], area.transformMtx[1].vec[2], area.transformMtx[1].vec[3], area.transformMtx[1].vec[0], area.transformMtx[1].vec[1], area.transformMtx[1].vec[2], area.transformMtx[1].vec[3],
area.transformMtx[2].vec[0], area.transformMtx[2].vec[1], area.transformMtx[2].vec[2], area.transformMtx[2].vec[3]); area.transformMtx[2].vec[0], area.transformMtx[2].vec[1], area.transformMtx[2].vec[2], area.transformMtx[2].vec[3]);

View File

@ -151,10 +151,10 @@ void PAKRouter<BRIDGETYPE>::build(std::vector<BRIDGETYPE>& bridges, std::functio
size_t bridgeIdx = 0; size_t bridgeIdx = 0;
for (BRIDGETYPE& bridge : bridges) for (BRIDGETYPE& bridge : bridges)
{ {
const std::string& name = bridge.getName(); const auto& name = bridge.getName();
hecl::SystemStringView sysName(name); hecl::SystemStringConv sysName(name);
hecl::SystemString::const_iterator extit = sysName.sys_str().end() - 4; hecl::SystemStringView::const_iterator extit = sysName.sys_str().end() - 4;
hecl::SystemString baseName(sysName.sys_str().begin(), extit); hecl::SystemString baseName(sysName.sys_str().begin(), extit);
m_bridgePaths.emplace_back(std::make_pair(hecl::ProjectPath(m_gameWorking, baseName), m_bridgePaths.emplace_back(std::make_pair(hecl::ProjectPath(m_gameWorking, baseName),
@ -214,12 +214,12 @@ void PAKRouter<BRIDGETYPE>::build(std::vector<BRIDGETYPE>& bridges, std::functio
{ {
if (auto v = catalogWriter.enterSubVector(nullptr)) if (auto v = catalogWriter.enterSubVector(nullptr))
{ {
catalogWriter.writeString(nullptr, working.getRelativePathUTF8().c_str()); catalogWriter.writeString(nullptr, working.getRelativePathUTF8());
catalogWriter.writeString(nullptr, working.getAuxInfoUTF8().c_str()); catalogWriter.writeString(nullptr, working.getAuxInfoUTF8());
} }
} }
else else
catalogWriter.writeString(nullptr, working.getRelativePathUTF8().c_str()); catalogWriter.writeString(nullptr, working.getRelativePathUTF8());
} }
} }
@ -227,8 +227,7 @@ void PAKRouter<BRIDGETYPE>::build(std::vector<BRIDGETYPE>& bridges, std::functio
intptr_t curBridgeIdx = reinterpret_cast<intptr_t>(m_curBridgeIdx.get()); intptr_t curBridgeIdx = reinterpret_cast<intptr_t>(m_curBridgeIdx.get());
const hecl::ProjectPath& pakPath = m_bridgePaths[curBridgeIdx].first; const hecl::ProjectPath& pakPath = m_bridgePaths[curBridgeIdx].first;
pakPath.makeDirChain(true); pakPath.makeDirChain(true);
hecl::SystemString catalogPath = hecl::ProjectPath(pakPath, "!catalog.yaml").getAbsolutePath(); athena::io::FileWriter writer(hecl::ProjectPath(pakPath, "!catalog.yaml").getAbsolutePath());
athena::io::FileWriter writer(catalogPath);
catalogWriter.finish(&writer); catalogWriter.finish(&writer);
} }
} }
@ -264,8 +263,8 @@ hecl::ProjectPath PAKRouter<BRIDGETYPE>::getCharacterWorking(const EntryType* en
hecl::ProjectPath characterPath = getWorking(characterSearch->second.first); hecl::ProjectPath characterPath = getWorking(characterSearch->second.first);
if (entry->type == FOURCC('EVNT')) if (entry->type == FOURCC('EVNT'))
{ {
hecl::SystemStringView wideStr(characterSearch->second.second); hecl::SystemStringConv wideStr(characterSearch->second.second);
return characterPath.getWithExtension((_S(".") + wideStr.sys_str()).c_str(), true); return characterPath.getWithExtension((hecl::SystemString(_S(".")) + wideStr.c_str()).c_str(), true);
} }
return characterPath.ensureAuxInfo(characterSearch->second.second); return characterPath.ensureAuxInfo(characterSearch->second.second);
} }
@ -530,7 +529,7 @@ bool PAKRouter<BRIDGETYPE>::extractResources(const BRIDGETYPE& pakBridge, bool f
continue; continue;
std::string bestName = getBestEntryName(*entryPtr, false); std::string bestName = getBestEntryName(*entryPtr, false);
hecl::SystemStringView bestNameView(bestName); hecl::SystemStringConv bestNameView(bestName);
float thisFac = ++count / fsz; float thisFac = ++count / fsz;
progress(bestNameView.c_str(), thisFac); progress(bestNameView.c_str(), thisFac);
@ -548,7 +547,7 @@ bool PAKRouter<BRIDGETYPE>::extractResources(const BRIDGETYPE& pakBridge, bool f
{ {
cooked.makeDirChain(false); cooked.makeDirChain(false);
PAKEntryReadStream s = entryPtr->beginReadStream(*node); PAKEntryReadStream s = entryPtr->beginReadStream(*node);
FILE* fout = hecl::Fopen(cooked.getAbsolutePath().c_str(), _S("wb")); FILE* fout = hecl::Fopen(cooked.getAbsolutePath().data(), _S("wb"));
fwrite(s.data(), 1, s.length(), fout); fwrite(s.data(), 1, s.length(), fout);
fclose(fout); fclose(fout);
} }

View File

@ -18,7 +18,7 @@ struct ISTRG : BigYAML
virtual std::string getUTF8(const FourCC& lang, size_t idx) const=0; virtual std::string getUTF8(const FourCC& lang, size_t idx) const=0;
virtual std::u16string getUTF16(const FourCC& lang, size_t idx) const=0; virtual std::u16string getUTF16(const FourCC& lang, size_t idx) const=0;
virtual hecl::SystemString getSystemString(const FourCC& lang, size_t idx) const=0; virtual hecl::SystemString getSystemString(const FourCC& lang, size_t idx) const=0;
virtual int32_t lookupIdx(const std::string& name) const=0; virtual int32_t lookupIdx(std::string_view name) const=0;
virtual void gatherDependencies(std::vector<hecl::ProjectPath>& pathsOut) const; virtual void gatherDependencies(std::vector<hecl::ProjectPath>& pathsOut) const;
}; };

View File

@ -544,12 +544,12 @@ bool TXTR::Extract(PAKEntryReadStream& rs, const hecl::ProjectPath& outPath)
uint16_t height = rs.readUint16Big(); uint16_t height = rs.readUint16Big();
uint32_t numMips = rs.readUint32Big(); uint32_t numMips = rs.readUint32Big();
FILE* fp = hecl::Fopen(outPath.getAbsolutePath().c_str(), _S("wb")); FILE* fp = hecl::Fopen(outPath.getAbsolutePath().data(), _S("wb"));
if (!fp) if (!fp)
{ {
Log.report(logvisor::Error, Log.report(logvisor::Error,
_S("Unable to open '%s' for writing"), _S("Unable to open '%s' for writing"),
outPath.getAbsolutePath().c_str()); outPath.getAbsolutePath().data());
return false; return false;
} }
png_structp png = png_create_write_struct(PNG_LIBPNG_VER_STRING, nullptr, PNGErr, PNGWarn); png_structp png = png_create_write_struct(PNG_LIBPNG_VER_STRING, nullptr, PNGErr, PNGWarn);
@ -761,12 +761,12 @@ bool TXTR::Cook(const hecl::ProjectPath& inPath, const hecl::ProjectPath& outPat
bool TXTR::CookPC(const hecl::ProjectPath& inPath, const hecl::ProjectPath& outPath) bool TXTR::CookPC(const hecl::ProjectPath& inPath, const hecl::ProjectPath& outPath)
{ {
FILE* inf = hecl::Fopen(inPath.getAbsolutePath().c_str(), _S("rb")); FILE* inf = hecl::Fopen(inPath.getAbsolutePath().data(), _S("rb"));
if (!inf) if (!inf)
{ {
Log.report(logvisor::Error, Log.report(logvisor::Error,
_S("Unable to open '%s' for reading"), _S("Unable to open '%s' for reading"),
inPath.getAbsolutePath().c_str()); inPath.getAbsolutePath().data());
return false; return false;
} }
@ -776,7 +776,7 @@ bool TXTR::CookPC(const hecl::ProjectPath& inPath, const hecl::ProjectPath& outP
if (png_sig_cmp((png_const_bytep)header, 0, 8)) if (png_sig_cmp((png_const_bytep)header, 0, 8))
{ {
Log.report(logvisor::Error, _S("invalid PNG signature in '%s'"), Log.report(logvisor::Error, _S("invalid PNG signature in '%s'"),
inPath.getAbsolutePath().c_str()); inPath.getAbsolutePath().data());
fclose(inf); fclose(inf);
return false; return false;
} }
@ -801,7 +801,7 @@ bool TXTR::CookPC(const hecl::ProjectPath& inPath, const hecl::ProjectPath& outP
if (setjmp(png_jmpbuf(pngRead))) if (setjmp(png_jmpbuf(pngRead)))
{ {
Log.report(logvisor::Error, _S("unable to initialize libpng I/O for '%s'"), Log.report(logvisor::Error, _S("unable to initialize libpng I/O for '%s'"),
inPath.getAbsolutePath().c_str()); inPath.getAbsolutePath().data());
fclose(inf); fclose(inf);
png_destroy_read_struct(&pngRead, &info, nullptr); png_destroy_read_struct(&pngRead, &info, nullptr);
return false; return false;
@ -837,7 +837,7 @@ bool TXTR::CookPC(const hecl::ProjectPath& inPath, const hecl::ProjectPath& outP
if (bitDepth != 8) if (bitDepth != 8)
{ {
Log.report(logvisor::Error, _S("'%s' is not 8 bits-per-channel"), Log.report(logvisor::Error, _S("'%s' is not 8 bits-per-channel"),
inPath.getAbsolutePath().c_str()); inPath.getAbsolutePath().data());
fclose(inf); fclose(inf);
png_destroy_read_struct(&pngRead, &info, nullptr); png_destroy_read_struct(&pngRead, &info, nullptr);
return false; return false;
@ -869,7 +869,7 @@ bool TXTR::CookPC(const hecl::ProjectPath& inPath, const hecl::ProjectPath& outP
break; break;
default: default:
Log.report(logvisor::Error, _S("unsupported color type in '%s'"), Log.report(logvisor::Error, _S("unsupported color type in '%s'"),
inPath.getAbsolutePath().c_str()); inPath.getAbsolutePath().data());
fclose(inf); fclose(inf);
png_destroy_read_struct(&pngRead, &info, nullptr); png_destroy_read_struct(&pngRead, &info, nullptr);
return false; return false;
@ -890,7 +890,7 @@ bool TXTR::CookPC(const hecl::ProjectPath& inPath, const hecl::ProjectPath& outP
if (setjmp(png_jmpbuf(pngRead))) if (setjmp(png_jmpbuf(pngRead)))
{ {
Log.report(logvisor::Error, _S("unable to read image in '%s'"), Log.report(logvisor::Error, _S("unable to read image in '%s'"),
inPath.getAbsolutePath().c_str()); inPath.getAbsolutePath().data());
fclose(inf); fclose(inf);
png_destroy_read_struct(&pngRead, &info, nullptr); png_destroy_read_struct(&pngRead, &info, nullptr);
return false; return false;
@ -979,7 +979,7 @@ bool TXTR::CookPC(const hecl::ProjectPath& inPath, const hecl::ProjectPath& outP
{ {
Log.report(logvisor::Error, Log.report(logvisor::Error,
_S("Unable to open '%s' for writing"), _S("Unable to open '%s' for writing"),
outPath.getAbsolutePath().c_str()); outPath.getAbsolutePath().data());
return false; return false;
} }

View File

@ -8,7 +8,7 @@ namespace DataSpec
struct ITweakGame : ITweak struct ITweakGame : ITweak
{ {
virtual const std::string& GetWorldPrefix() const = 0; virtual std::string_view GetWorldPrefix() const = 0;
virtual bool GetSplashScreensDisabled() const = 0; virtual bool GetSplashScreensDisabled() const = 0;
virtual float GetFirstPersonFOV() const = 0; virtual float GetFirstPersonFOV() const = 0;
virtual float GetPressStartDelay() const = 0; virtual float GetPressStartDelay() const = 0;

View File

@ -87,78 +87,78 @@ struct ITweakPlayerRes : ITweak
void ResolveResources(const urde::IFactory& factory) void ResolveResources(const urde::IFactory& factory)
{ {
x4_saveStationIcon = factory.GetResourceIdByName(_GetSaveStationIcon().c_str())->id; x4_saveStationIcon = factory.GetResourceIdByName(_GetSaveStationIcon().data())->id;
x8_missileStationIcon = factory.GetResourceIdByName(_GetMissileStationIcon().c_str())->id; x8_missileStationIcon = factory.GetResourceIdByName(_GetMissileStationIcon().data())->id;
xc_elevatorIcon = factory.GetResourceIdByName(_GetElevatorIcon().c_str())->id; xc_elevatorIcon = factory.GetResourceIdByName(_GetElevatorIcon().data())->id;
x10_minesBreakFirstTopIcon = factory.GetResourceIdByName(_GetMinesBreakFirstTopIcon().c_str())->id; x10_minesBreakFirstTopIcon = factory.GetResourceIdByName(_GetMinesBreakFirstTopIcon().data())->id;
x14_minesBreakFirstBottomIcon = factory.GetResourceIdByName(_GetMinesBreakFirstTopIcon().c_str())->id; x14_minesBreakFirstBottomIcon = factory.GetResourceIdByName(_GetMinesBreakFirstTopIcon().data())->id;
x18_minesBreakSecondTopIcon = factory.GetResourceIdByName(_GetMinesBreakFirstTopIcon().c_str())->id; x18_minesBreakSecondTopIcon = factory.GetResourceIdByName(_GetMinesBreakFirstTopIcon().data())->id;
x1c_minesBreakSecondBottomIcon = factory.GetResourceIdByName(_GetMinesBreakFirstTopIcon().c_str())->id; x1c_minesBreakSecondBottomIcon = factory.GetResourceIdByName(_GetMinesBreakFirstTopIcon().data())->id;
for (int i=0 ; i<9 ; ++i) for (int i=0 ; i<9 ; ++i)
x24_lStick[i] = factory.GetResourceIdByName(_GetLStick(i).c_str())->id; x24_lStick[i] = factory.GetResourceIdByName(_GetLStick(i).data())->id;
for (int i=0 ; i<9 ; ++i) for (int i=0 ; i<9 ; ++i)
x4c_cStick[i] = factory.GetResourceIdByName(_GetCStick(i).c_str())->id; x4c_cStick[i] = factory.GetResourceIdByName(_GetCStick(i).data())->id;
for (int i=0 ; i<2 ; ++i) for (int i=0 ; i<2 ; ++i)
x74_lTrigger[i] = factory.GetResourceIdByName(_GetLTrigger(i).c_str())->id; x74_lTrigger[i] = factory.GetResourceIdByName(_GetLTrigger(i).data())->id;
for (int i=0 ; i<2 ; ++i) for (int i=0 ; i<2 ; ++i)
x80_rTrigger[i] = factory.GetResourceIdByName(_GetRTrigger(i).c_str())->id; x80_rTrigger[i] = factory.GetResourceIdByName(_GetRTrigger(i).data())->id;
for (int i=0 ; i<2 ; ++i) for (int i=0 ; i<2 ; ++i)
x8c_startButton[i] = factory.GetResourceIdByName(_GetStartButton(i).c_str())->id; x8c_startButton[i] = factory.GetResourceIdByName(_GetStartButton(i).data())->id;
for (int i=0 ; i<2 ; ++i) for (int i=0 ; i<2 ; ++i)
x98_aButton[i] = factory.GetResourceIdByName(_GetAButton(i).c_str())->id; x98_aButton[i] = factory.GetResourceIdByName(_GetAButton(i).data())->id;
for (int i=0 ; i<2 ; ++i) for (int i=0 ; i<2 ; ++i)
xa4_bButton[i] = factory.GetResourceIdByName(_GetBButton(i).c_str())->id; xa4_bButton[i] = factory.GetResourceIdByName(_GetBButton(i).data())->id;
for (int i=0 ; i<2 ; ++i) for (int i=0 ; i<2 ; ++i)
xb0_xButton[i] = factory.GetResourceIdByName(_GetXButton(i).c_str())->id; xb0_xButton[i] = factory.GetResourceIdByName(_GetXButton(i).data())->id;
for (int i=0 ; i<2 ; ++i) for (int i=0 ; i<2 ; ++i)
xbc_yButton[i] = factory.GetResourceIdByName(_GetYButton(i).c_str())->id; xbc_yButton[i] = factory.GetResourceIdByName(_GetYButton(i).data())->id;
xc4_ballTransitionsANCS = factory.GetResourceIdByName(_GetBallTransitionsANCS().c_str())->id; xc4_ballTransitionsANCS = factory.GetResourceIdByName(_GetBallTransitionsANCS().data())->id;
for (int i=0 ; i<5 ; ++i) for (int i=0 ; i<5 ; ++i)
xc8_ballTransitions[i] = factory.GetResourceIdByName(_GetBallTransitionBeamRes(i).c_str())->id; xc8_ballTransitions[i] = factory.GetResourceIdByName(_GetBallTransitionBeamRes(i).data())->id;
for (int i=0 ; i<5 ; ++i) for (int i=0 ; i<5 ; ++i)
xc8_cineGun[i] = factory.GetResourceIdByName(_GetBeamCineModel(i).c_str())->id; xc8_cineGun[i] = factory.GetResourceIdByName(_GetBeamCineModel(i).data())->id;
xf0_cinematicMoveOutofIntoPlayerDistance = _GetCinematicMoveOutofIntoPlayerDistance(); xf0_cinematicMoveOutofIntoPlayerDistance = _GetCinematicMoveOutofIntoPlayerDistance();
} }
protected: protected:
virtual const std::string& _GetSaveStationIcon() const=0; virtual std::string_view _GetSaveStationIcon() const=0;
virtual const std::string& _GetMissileStationIcon() const=0; virtual std::string_view _GetMissileStationIcon() const=0;
virtual const std::string& _GetElevatorIcon() const=0; virtual std::string_view _GetElevatorIcon() const=0;
virtual const std::string& _GetMinesBreakFirstTopIcon() const=0; virtual std::string_view _GetMinesBreakFirstTopIcon() const=0;
virtual const std::string& _GetMinesBreakFirstBottomIcon() const=0; virtual std::string_view _GetMinesBreakFirstBottomIcon() const=0;
virtual const std::string& _GetMinesBreakSecondTopIcon() const=0; virtual std::string_view _GetMinesBreakSecondTopIcon() const=0;
virtual const std::string& _GetMinesBreakSecondBottomIcon() const=0; virtual std::string_view _GetMinesBreakSecondBottomIcon() const=0;
virtual const std::string& _GetLStick(size_t idx) const=0; virtual std::string_view _GetLStick(size_t idx) const=0;
virtual const std::string& _GetCStick(size_t idx) const=0; virtual std::string_view _GetCStick(size_t idx) const=0;
virtual const std::string& _GetLTrigger(size_t idx) const=0; virtual std::string_view _GetLTrigger(size_t idx) const=0;
virtual const std::string& _GetRTrigger(size_t idx) const=0; virtual std::string_view _GetRTrigger(size_t idx) const=0;
virtual const std::string& _GetStartButton(size_t idx) const=0; virtual std::string_view _GetStartButton(size_t idx) const=0;
virtual const std::string& _GetAButton(size_t idx) const=0; virtual std::string_view _GetAButton(size_t idx) const=0;
virtual const std::string& _GetBButton(size_t idx) const=0; virtual std::string_view _GetBButton(size_t idx) const=0;
virtual const std::string& _GetXButton(size_t idx) const=0; virtual std::string_view _GetXButton(size_t idx) const=0;
virtual const std::string& _GetYButton(size_t idx) const=0; virtual std::string_view _GetYButton(size_t idx) const=0;
virtual const std::string& _GetBallTransitionsANCS() const=0; virtual std::string_view _GetBallTransitionsANCS() const=0;
virtual const std::string& _GetBallTransitionBeamRes(size_t idx) const=0; virtual std::string_view _GetBallTransitionBeamRes(size_t idx) const=0;
virtual const std::string& _GetBeamCineModel(size_t idx) const=0; virtual std::string_view _GetBeamCineModel(size_t idx) const=0;
virtual float _GetCinematicMoveOutofIntoPlayerDistance() const=0; virtual float _GetCinematicMoveOutofIntoPlayerDistance() const=0;
}; };

View File

@ -8,7 +8,7 @@ namespace DataSpec
struct ITweakSlideShow : ITweak struct ITweakSlideShow : ITweak
{ {
virtual const std::string& GetFont() const=0; virtual std::string_view GetFont() const=0;
virtual const zeus::CColor& GetFontColor() const=0; virtual const zeus::CColor& GetFontColor() const=0;
virtual const zeus::CColor& GetOutlineColor() const=0; virtual const zeus::CColor& GetOutlineColor() const=0;
virtual float GetScanPercentInterval() const=0; virtual float GetScanPercentInterval() const=0;

View File

@ -5,6 +5,8 @@ namespace DataSpec
namespace DNAMP1 namespace DNAMP1
{ {
using namespace std::literals;
bool AGSC::Extract(PAKEntryReadStream& rs, const hecl::ProjectPath& outPath) bool AGSC::Extract(PAKEntryReadStream& rs, const hecl::ProjectPath& outPath)
{ {
Header head; Header head;
@ -48,12 +50,12 @@ bool AGSC::Cook(const hecl::ProjectPath& inPath, const hecl::ProjectPath& outPat
return false; return false;
hecl::ProjectPath woExt = inPath.getWithExtension(nullptr, true); 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")) if (hecl::StringUtils::EndsWith(lastComp, "_AGSC"))
lastComp.assign(lastComp.cbegin(), lastComp.cend() - 5); lastComp.assign(lastComp.cbegin(), lastComp.cend() - 5);
Header head; Header head;
head.audioDir = "Audio/"; head.audioDir = "Audio/"sv;
head.groupName = lastComp; head.groupName = lastComp;
head.write(w); head.write(w);

View File

@ -1054,9 +1054,9 @@ bool ANCS::Extract(const SpecBase& dataSpec,
{ {
if (res.second.evntId) if (res.second.evntId)
{ {
hecl::SystemStringView sysStr(res.second.name); hecl::SystemStringConv sysStr(res.second.name);
hecl::ProjectPath evntYamlPath = outPath.getWithExtension((hecl::SystemString(_S(".")) + hecl::ProjectPath evntYamlPath = outPath.getWithExtension((hecl::SystemString(_S(".")) +
sysStr.sys_str() + sysStr.c_str() +
_S(".evnt.yaml")).c_str(), true); _S(".evnt.yaml")).c_str(), true);
hecl::ProjectPath::Type evntYamlType = evntYamlPath.getPathType(); 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); hecl::ProjectPath yamlPath = inPath.getWithExtension(_S(".yaml"), true);
if (!yamlPath.isFile()) if (!yamlPath.isFile())
Log.report(logvisor::Fatal, _S("'%s' not found as file"), Log.report(logvisor::Fatal, _S("'%s' not found as file"),
yamlPath.getRelativePath().c_str()); yamlPath.getRelativePath().data());
athena::io::FileReader reader(yamlPath.getAbsolutePath()); athena::io::FileReader reader(yamlPath.getAbsolutePath());
if (!reader.isOpen()) if (!reader.isOpen())
Log.report(logvisor::Fatal, _S("can't open '%s' for reading"), Log.report(logvisor::Fatal, _S("can't open '%s' for reading"),
yamlPath.getRelativePath().c_str()); yamlPath.getRelativePath().data());
if (!BigYAML::ValidateFromYAMLStream<ANCS>(reader)) if (!BigYAML::ValidateFromYAMLStream<ANCS>(reader))
{ {
Log.report(logvisor::Fatal, _S("'%s' is not urde::DNAMP1::ANCS type"), Log.report(logvisor::Fatal, _S("'%s' is not urde::DNAMP1::ANCS type"),
yamlPath.getRelativePath().c_str()); yamlPath.getRelativePath().data());
} }
athena::io::YAMLDocReader yamlReader; athena::io::YAMLDocReader yamlReader;
if (!yamlReader.parse(&reader)) if (!yamlReader.parse(&reader))
{ {
Log.report(logvisor::Fatal, _S("unable to parse '%s'"), Log.report(logvisor::Fatal, _S("unable to parse '%s'"),
yamlPath.getRelativePath().c_str()); yamlPath.getRelativePath().data());
} }
ANCS ancs; ANCS ancs;
ancs.read(yamlReader); ancs.read(yamlReader);
@ -1114,8 +1114,8 @@ bool ANCS::Cook(const hecl::ProjectPath& outPath,
ch.cmdlOverlay = UniqueID32{}; ch.cmdlOverlay = UniqueID32{};
ch.cskrOverlay = UniqueID32{}; ch.cskrOverlay = UniqueID32{};
hecl::SystemStringView chSysName(ch.name); hecl::SystemStringConv chSysName(ch.name);
ch.cskr = inPath.ensureAuxInfo(chSysName.sys_str() + _S(".CSKR")); ch.cskr = inPath.ensureAuxInfo(hecl::SystemString(chSysName.sys_str()) + _S(".CSKR"));
for (const DNAANCS::Actor::Subtype& sub : actor.subtypes) for (const DNAANCS::Actor::Subtype& sub : actor.subtypes)
{ {
@ -1124,15 +1124,15 @@ bool ANCS::Cook(const hecl::ProjectPath& outPath,
if (sub.armature >= 0) if (sub.armature >= 0)
{ {
const DNAANCS::Actor::Armature& arm = actor.armatures[sub.armature]; const DNAANCS::Actor::Armature& arm = actor.armatures[sub.armature];
hecl::SystemStringView armSysName(arm.name); hecl::SystemStringConv armSysName(arm.name);
ch.cinf = inPath.ensureAuxInfo(armSysName.sys_str() + _S(".CINF")); ch.cinf = inPath.ensureAuxInfo(hecl::SystemString(armSysName.sys_str()) + _S(".CINF"));
ch.cmdl = sub.mesh; ch.cmdl = sub.mesh;
if (sub.overlayMeshes.size()) 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.cmdlOverlay = sub.overlayMeshes[0].second;
ch.cskrOverlay = inPath.ensureAuxInfo(chSysName.sys_str() + _S('.') + ch.cskrOverlay = inPath.ensureAuxInfo(hecl::SystemString(chSysName.sys_str()) + _S('.') +
overlaySys.sys_str() + _S(".CSKR")); overlaySys.c_str() + _S(".CSKR"));
} }
break; break;
@ -1144,8 +1144,8 @@ bool ANCS::Cook(const hecl::ProjectPath& outPath,
/* Set Animation Resource IDs */ /* Set Animation Resource IDs */
ancs.enumeratePrimitives([&](AnimationSet::MetaAnimPrimitive& prim) -> bool ancs.enumeratePrimitives([&](AnimationSet::MetaAnimPrimitive& prim) -> bool
{ {
hecl::SystemStringView sysStr(prim.animName); hecl::SystemStringConv sysStr(prim.animName);
hecl::ProjectPath pathOut = inPath.ensureAuxInfo(sysStr.sys_str() + _S(".ANIM")); hecl::ProjectPath pathOut = inPath.ensureAuxInfo(hecl::SystemString(sysStr.sys_str()) + _S(".ANIM"));
prim.animId = pathOut; prim.animId = pathOut;
return true; return true;
}); });
@ -1154,15 +1154,15 @@ bool ANCS::Cook(const hecl::ProjectPath& outPath,
ancs.animationSet.animResources.reserve(actor.actions.size()); ancs.animationSet.animResources.reserve(actor.actions.size());
for (const DNAANCS::Actor::Action& act : actor.actions) for (const DNAANCS::Actor::Action& act : actor.actions)
{ {
hecl::SystemStringView sysStr(act.name); hecl::SystemStringConv sysStr(act.name);
hecl::ProjectPath pathOut = inPath.ensureAuxInfo(sysStr.sys_str() + _S(".ANIM")); hecl::ProjectPath pathOut = inPath.ensureAuxInfo(hecl::SystemString(sysStr.sys_str()) + _S(".ANIM"));
ancs.animationSet.animResources.emplace_back(); ancs.animationSet.animResources.emplace_back();
ancs.animationSet.animResources.back().animId = pathOut; ancs.animationSet.animResources.back().animId = pathOut;
/* Check for associated EVNT YAML */ /* Check for associated EVNT YAML */
hecl::ProjectPath evntYamlPath = inPath.getWithExtension((hecl::SystemString(_S(".")) + hecl::ProjectPath evntYamlPath = inPath.getWithExtension((hecl::SystemString(_S(".")) +
sysStr.sys_str() + sysStr.c_str() +
_S(".evnt.yaml")).c_str(), true); _S(".evnt.yaml")).c_str(), true);
evntYamlPath = evntYamlPath.ensureAuxInfo(_S("")); evntYamlPath = evntYamlPath.ensureAuxInfo(_S(""));
if (evntYamlPath.isFile()) if (evntYamlPath.isFile())
@ -1185,7 +1185,7 @@ bool ANCS::CookCINF(const hecl::ProjectPath& outPath,
for (const DNAANCS::Actor::Armature& arm : actor.armatures) for (const DNAANCS::Actor::Armature& arm : actor.armatures)
{ {
hecl::SystemStringView sysStr(arm.name); hecl::SystemStringConv sysStr(arm.name);
if (sysStr.sys_str() == armName) if (sysStr.sys_str() == armName)
{ {
std::unordered_map<std::string, atInt32> boneIdMap; 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()); overName = hecl::SystemString(subName.begin() + dotPos + 1, subName.end());
subName = hecl::SystemString(subName.begin(), subName.begin() + dotPos); subName = hecl::SystemString(subName.begin(), subName.begin() + dotPos);
} }
hecl::SystemUTF8View subNameView(subName); hecl::SystemUTF8Conv subNameView(subName);
hecl::SystemUTF8View overNameView(overName); hecl::SystemUTF8Conv overNameView(overName);
/* Build bone ID map */ /* Build bone ID map */
std::unordered_map<std::string, atInt32> boneIdMap; 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()); Log.report(logvisor::Fatal, _S("unable to resolve model path of %s:%s"), subName.c_str(), overName.c_str());
if (!modelPath->isFile()) 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")); hecl::ProjectPath skinIntPath = modelPath->getCookedPath(SpecEntMP1PC).getWithExtension(_S(".skinint"));
if (!skinIntPath.isFileOrGlob() || skinIntPath.getModtime() < modelPath->getModtime()) if (!skinIntPath.isFileOrGlob() || skinIntPath.getModtime() < modelPath->getModtime())
if (!modelCookFunc(*modelPath)) 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); athena::io::FileReader skinIO(skinIntPath.getAbsolutePath(), 1024*32, false);
if (skinIO.hasError()) 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; std::vector<std::vector<uint32_t>> skinBanks;
uint32_t bankCount = skinIO.readUint32Big(); uint32_t bankCount = skinIO.readUint32Big();
@ -1304,7 +1304,7 @@ bool ANCS::CookCSKR(const hecl::ProjectPath& outPath,
auto search = boneIdMap.find(name); auto search = boneIdMap.find(name);
if (search == boneIdMap.cend()) if (search == boneIdMap.cend())
Log.report(logvisor::Fatal, "unable to find bone '%s' in %s", 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); virtualBone.emplace_back(search->second, weight);
} }
} }
@ -1326,7 +1326,7 @@ bool ANCS::CookCSKR(const hecl::ProjectPath& outPath,
auto search = boneIdMap.find(name); auto search = boneIdMap.find(name);
if (search == boneIdMap.cend()) if (search == boneIdMap.cend())
Log.report(logvisor::Fatal, "unable to find bone '%s' in %s", 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); skinOut.writeUint32Big(search->second);
} }
} }
@ -1355,12 +1355,12 @@ bool ANCS::CookANIM(const hecl::ProjectPath& outPath,
{ {
hecl::SystemString actName(inPath.getAuxInfo().begin(), hecl::SystemString actName(inPath.getAuxInfo().begin(),
inPath.getAuxInfo().end() - 5); inPath.getAuxInfo().end() - 5);
hecl::SystemUTF8View actNameView(actName); hecl::SystemUTF8Conv actNameView(actName);
DNAANCS::Actor::Action action = ds.compileActionChannelsOnly(actNameView.str()); DNAANCS::Actor::Action action = ds.compileActionChannelsOnly(actNameView.str());
if (!actor.armatures.size()) if (!actor.armatures.size())
Log.report(logvisor::Fatal, _S("0 armatures in %s"), Log.report(logvisor::Fatal, _S("0 armatures in %s"),
inPath.getRelativePath().c_str()); inPath.getRelativePath().data());
/* Build bone ID map */ /* Build bone ID map */
std::unordered_map<std::string, atInt32> boneIdMap; std::unordered_map<std::string, atInt32> boneIdMap;

View File

@ -168,7 +168,7 @@ struct DCLN : BigDNA
Vector<Collision, DNA_COUNT(colCount)> collision; 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 */ /* Open Py Stream and read sections */
hecl::BlenderConnection::PyOutStream os = conn.beginPythonOut(true); hecl::BlenderConnection::PyOutStream os = conn.beginPythonOut(true);
@ -182,7 +182,7 @@ struct DCLN : BigDNA
" if ob.type != 'CAMERA':\n" " if ob.type != 'CAMERA':\n"
" bpy.context.scene.objects.unlink(ob)\n" " bpy.context.scene.objects.unlink(ob)\n"
" bpy.data.objects.remove(ob)\n", " bpy.data.objects.remove(ob)\n",
entryName.c_str()); entryName.data());
DeafBabe::BlenderInit(os); DeafBabe::BlenderInit(os);
atInt32 idx = 0; atInt32 idx = 0;

View File

@ -52,9 +52,9 @@ namespace DNAMP1
{ {
logvisor::Module Log("urde::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); std::transform(lowerName.begin(), lowerName.end(), lowerName.begin(), tolower);
if (!lowerName.compare(0, 7, "metroid")) if (!lowerName.compare(0, 7, "metroid"))
return false; 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) for (auto& ch : ret)
if (ch == _S('/') || ch == _S('\\')) if (ch == _S('/') || ch == _S('\\'))
ch = _S('-'); ch = _S('-');
@ -119,7 +119,7 @@ void PAKBridge::build()
} }
bool named; bool named;
std::string bestName = m_pak.bestEntryName(entry, 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); level.areas.reserve(mlvl.areaCount);
unsigned layerIdx = 0; unsigned layerIdx = 0;
@ -165,13 +165,13 @@ void PAKBridge::build()
if (areaDeps.name.empty()) if (areaDeps.name.empty())
{ {
std::string idStr = area.areaMREAId.toString(); 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::SystemChar num[16];
hecl::SNPrintf(num, 16, _S("%02u "), ai); hecl::SNPrintf(num, 16, _S("%02u "), ai);
areaDeps.name = num + areaDeps.name; 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) for (char& ch : lowerName)
{ {
ch = tolower(ch); ch = tolower(ch);

View File

@ -29,8 +29,8 @@ public:
bool doExtract=true); bool doExtract=true);
void build(); void build();
static ResExtractor<PAKBridge> LookupExtractor(const PAK& pak, const PAK::Entry& entry); static ResExtractor<PAKBridge> LookupExtractor(const PAK& pak, const PAK::Entry& entry);
const std::string& getName() const {return m_node.getName();} std::string_view getName() const {return m_node.getName();}
const hecl::SystemString& getLevelString() const {return m_levelString;} hecl::SystemStringView getLevelString() const {return m_levelString;}
using PAKType = PAK; using PAKType = PAK;
const PAKType& getPAK() const {return m_pak;} const PAKType& getPAK() const {return m_pak;}
const nod::Node& getNode() const {return m_node;} const nod::Node& getNode() const {return m_node;}

View File

@ -470,14 +470,14 @@ bool FRME::Extract(const SpecBase &dataSpec,
if (resPath.size()) if (resPath.size())
{ {
hecl::SystemUTF8View resPathView(resPath); hecl::SystemUTF8Conv resPathView(resPath);
os.format("if '%s' in bpy.data.images:\n" os.format("if '%s' in bpy.data.images:\n"
" image = bpy.data.images['%s']\n" " image = bpy.data.images['%s']\n"
"else:\n" "else:\n"
" image = bpy.data.images.load('''//%s''')\n" " image = bpy.data.images.load('''//%s''')\n"
" image.name = '%s'\n", " image.name = '%s'\n",
texName.c_str(), texName.c_str(), texName.c_str(), texName.c_str(),
resPathView.str().c_str(), texName.c_str()); resPathView.c_str(), texName.c_str());
} }
else 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" os.format("frme_obj = bpy.data.objects.new(name='%s', object_data=binding)\n"
"frme_obj.pass_index = %d\n" "frme_obj.pass_index = %d\n"
"parentName = '%s'\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_use_anim_controller = %s\n"
"frme_obj.retro_widget_default_visible = %s\n" "frme_obj.retro_widget_default_visible = %s\n"
"frme_obj.retro_widget_default_active = %s\n" "frme_obj.retro_widget_default_active = %s\n"
@ -549,7 +549,7 @@ bool FRME::Extract(const SpecBase &dataSpec,
"else:\n" "else:\n"
" frme_obj.parent = bpy.data.objects[parentName]\n", " frme_obj.parent = bpy.data.objects[parentName]\n",
w.header.name.c_str(), pIdx++, w.header.parent.c_str(), 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.useAnimController ? "True" : "False",
w.header.defaultVisible ? "True" : "False", w.header.defaultVisible ? "True" : "False",
w.header.defaultActive ? "True" : "False", w.header.defaultActive ? "True" : "False",
@ -566,7 +566,7 @@ bool FRME::Extract(const SpecBase &dataSpec,
hecl::ProjectPath modelPath = pakRouter.getWorking(info->model); hecl::ProjectPath modelPath = pakRouter.getWorking(info->model);
const PAKRouter<PAKBridge>::EntryType* cmdlE = pakRouter.lookupEntry(info->model, nullptr, true, true); 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); pakRouter.getBestEntryName(*cmdlE).c_str(), true);
os.format("frme_obj.retro_model_light_mask = %d\n", info->lightMask); 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[0],
info->scaleCenter.vec[1], info->scaleCenter.vec[1],
info->scaleCenter.vec[2], info->scaleCenter.vec[2],
fontPath.getRelativePathUTF8().c_str(), fontPath.getRelativePathUTF8().data(),
info->wordWrap ? "True" : "False", info->wordWrap ? "True" : "False",
info->horizontal ? "True" : "False", info->horizontal ? "True" : "False",
info->fillColor.vec[0], info->fillColor.vec[0],
@ -635,7 +635,7 @@ bool FRME::Extract(const SpecBase &dataSpec,
info->outlineColor.vec[3], info->outlineColor.vec[3],
info->blockExtent.vec[0], info->blockExtent.vec[0],
info->blockExtent.vec[1], info->blockExtent.vec[1],
jpFontPath.getRelativePathUTF8().c_str(), jpFontPath.getRelativePathUTF8().data(),
info->jpnPointScale[0], info->jpnPointScale[0],
info->jpnPointScale[1], info->jpnPointScale[1],
int(info->justification), int(info->justification),
@ -683,7 +683,7 @@ bool FRME::Extract(const SpecBase &dataSpec,
hecl::ProjectPath txtrPath = pakRouter.getWorking(info->texture); hecl::ProjectPath txtrPath = pakRouter.getWorking(info->texture);
if (txtrPath) if (txtrPath)
os.format("frme_obj.retro_energybar_texture_path = '%s'\n", os.format("frme_obj.retro_energybar_texture_path = '%s'\n",
txtrPath.getRelativePathUTF8().c_str()); txtrPath.getRelativePathUTF8().data());
} }
} }
else if (w.type == SBIG('METR')) else if (w.type == SBIG('METR'))

View File

@ -90,7 +90,7 @@ bool MLVL::Cook(const hecl::ProjectPath& outPath, const hecl::ProjectPath& inPat
if (!areaPath.isFile()) if (!areaPath.isFile())
continue; 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")); 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); hecl::SystemUTF8Conv layerU8(layerName);
mlvl.layerNames.push_back(layerU8.str()); mlvl.layerNames.emplace_back(layerU8.str());
nameOffset += layerName.size() + 1; nameOffset += layerName.size() + 1;
MLVL::LayerFlags& thisLayFlags = mlvl.layerFlags.back(); MLVL::LayerFlags& thisLayFlags = mlvl.layerFlags.back();

View File

@ -566,8 +566,8 @@ bool MREA::PCCook(const hecl::ProjectPath& outPath,
hecl::SNPrintf(parPid, 32, _S("%lluX"), (unsigned long long)getpid()); hecl::SNPrintf(parPid, 32, _S("%lluX"), (unsigned long long)getpid());
#endif #endif
const hecl::SystemChar* args[] = {VisiGenPath.c_str(), const hecl::SystemChar* args[] = {VisiGenPath.c_str(),
visiIntOut.getAbsolutePath().c_str(), visiIntOut.getAbsolutePath().data(),
preVisiPath.getAbsolutePath().c_str(), preVisiPath.getAbsolutePath().data(),
thrIdx, parPid, nullptr}; thrIdx, parPid, nullptr};
if (0 == hecl::RunProcess(VisiGenPath.c_str(), args)) if (0 == hecl::RunProcess(VisiGenPath.c_str(), args))
{ {

View File

@ -152,9 +152,9 @@ const PAK::Entry* PAK::lookupEntry(const UniqueID32& id) const
return nullptr; 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()) if (result != m_nameMap.end())
{ {
auto result1 = m_entries.find(result->second); auto result1 = m_entries.find(result->second);

View File

@ -53,7 +53,7 @@ struct PAK : BigDNA
std::unordered_map<std::string, UniqueID32> m_nameMap; std::unordered_map<std::string, UniqueID32> m_nameMap;
const Entry* lookupEntry(const UniqueID32& id) const; 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; std::string bestEntryName(const Entry& entry, bool& named) const;
using IDType = UniqueID32; using IDType = UniqueID32;

View File

@ -48,7 +48,7 @@ void SCLY::exportToLayerDirectories(const PAK::Entry& entry, PAKRouter<PAKBridge
if (active) if (active)
{ {
hecl::ProjectPath activePath(layerPath, "!defaultactive"); 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")); hecl::ProjectPath yamlFile(layerPath, _S("!objects.yaml"));

View File

@ -29,8 +29,8 @@ static uint32_t ParseTag(const char16_t* str)
return strtoul(parseStr, nullptr, 16); return strtoul(parseStr, nullptr, 16);
} }
static std::u16string::const_iterator SkipCommas(std::u16string& ret, const std::u16string& str, static std::u16string_view::const_iterator SkipCommas(std::u16string& ret, std::u16string_view str,
std::u16string::const_iterator it, size_t count) std::u16string_view::const_iterator it, size_t count)
{ {
for (size_t i = 0; i < count; ++i) 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; return it;
} }
static std::u16string::const_iterator UncookTextureList(std::u16string& ret, const std::u16string& str, static std::u16string_view::const_iterator UncookTextureList(std::u16string& ret, std::u16string_view str,
std::u16string::const_iterator it) std::u16string_view::const_iterator it)
{ {
while (true) while (true)
{ {
@ -76,8 +76,8 @@ static std::u16string::const_iterator UncookTextureList(std::u16string& ret, con
return str.begin() + scpos + 1; return str.begin() + scpos + 1;
} }
static std::u16string::const_iterator CookTextureList(std::u16string& ret, const std::u16string& str, static std::u16string_view::const_iterator CookTextureList(std::u16string& ret, std::u16string_view str,
std::u16string::const_iterator it) std::u16string_view::const_iterator it)
{ {
while (true) while (true)
{ {
@ -112,8 +112,8 @@ static std::u16string::const_iterator CookTextureList(std::u16string& ret, const
return str.begin() + scpos + 1; return str.begin() + scpos + 1;
} }
static std::u16string::const_iterator GatherTextureList(std::vector<hecl::ProjectPath>& pathsOut, static std::u16string_view::const_iterator GatherTextureList(std::vector<hecl::ProjectPath>& pathsOut,
const std::u16string& str, std::u16string::const_iterator it) std::u16string_view str, std::u16string_view::const_iterator it)
{ {
while (true) while (true)
{ {
@ -148,7 +148,7 @@ static std::u16string::const_iterator GatherTextureList(std::vector<hecl::Projec
return str.begin() + scpos + 1; return str.begin() + scpos + 1;
} }
static std::u16string UncookString(const std::u16string& str) static std::u16string UncookString(std::u16string_view str)
{ {
std::u16string ret; std::u16string ret;
ret.reserve(str.size()); ret.reserve(str.size());
@ -220,7 +220,7 @@ static std::u16string UncookString(const std::u16string& str)
return ret; return ret;
} }
static std::u16string CookString(const std::u16string& str) static std::u16string CookString(std::u16string_view str)
{ {
std::u16string ret; std::u16string ret;
ret.reserve(str.size()); 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 (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'&') if (*it == u'&')
{ {
++it; ++it;
if (!str.compare(it - str.begin(), 5, u"image")) if (!str.compare(it - strView.begin(), 5, u"image"))
{ {
it += 6; 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 = SkipCommas(skip, str, it, 2);
it = GatherTextureList(pathsOut, str, it); it = GatherTextureList(pathsOut, str, it);
continue; 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 = SkipCommas(skip, str, it, 4);
it = GatherTextureList(pathsOut, str, it); it = GatherTextureList(pathsOut, str, it);
continue; 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 = SkipCommas(skip, str, it, 3);
it = GatherTextureList(pathsOut, str, it); it = GatherTextureList(pathsOut, str, it);
continue; continue;
} }
} }
else if (!str.compare(it - str.begin(), 4, u"font")) else if (!str.compare(it - strView.begin(), 4, u"font"))
{ {
it += 5; it += 5;
auto scpos = str.find(u';', it - str.begin()); auto scpos = str.find(u';', it - strView.begin());
if (scpos == std::u16string::npos) if (scpos == std::u16string::npos)
Log.report(logvisor::Fatal, "Missing semicolon token while pasing font tag"); Log.report(logvisor::Fatal, "Missing semicolon token while pasing font tag");
hecl::ProjectPath path = UniqueIDBridge::MakePathFromString<UniqueID32>( hecl::ProjectPath path = UniqueIDBridge::MakePathFromString<UniqueID32>(
hecl::Char16ToUTF8(std::u16string(it, str.begin() + scpos))); hecl::Char16ToUTF8(std::u16string(it, strView.begin() + scpos)));
if (path) if (path)
pathsOut.push_back(path); pathsOut.push_back(path);
it = str.begin() + scpos + 1; it = strView.begin() + scpos + 1;
} }
else else
{ {
auto scpos = str.find(u';', it - str.begin()); auto scpos = str.find(u';', it - strView.begin());
if (scpos == std::u16string::npos) if (scpos == std::u16string::npos)
it = str.end(); it = strView.end();
else else
it = str.begin() + scpos + 1; it = strView.begin() + scpos + 1;
} }
} }
else else

View File

@ -19,7 +19,7 @@ struct STRG : ISTRG
std::vector<std::pair<FourCC, std::vector<std::u16string>>> langs; std::vector<std::pair<FourCC, std::vector<std::u16string>>> langs;
std::unordered_map<FourCC, std::vector<std::u16string>*> langMap; 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 size_t count() const
{ {

View File

@ -34,7 +34,7 @@ struct CTweakGame final : ITweakGame
Value<float> x60_hardmodeDamageMult; Value<float> x60_hardmodeDamageMult;
Value<float> x64_hardmodeWeaponMult; 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; } bool GetSplashScreensDisabled() const { return x2b_splashScreensDisabled; }
float GetFirstPersonFOV() const { return x24_fov; } float GetFirstPersonFOV() const { return x24_fov; }
float GetPressStartDelay() const { return x30_pressStartDelay; } float GetPressStartDelay() const { return x30_pressStartDelay; }

View File

@ -72,30 +72,30 @@ struct CTweakPlayerRes final : ITweakPlayerRes
Value<float> m_cinematicMoveOutofIntoPlayerDistance; Value<float> m_cinematicMoveOutofIntoPlayerDistance;
const std::string& _GetSaveStationIcon() const { return m_saveStationIcon; } std::string_view _GetSaveStationIcon() const { return m_saveStationIcon; }
const std::string& _GetMissileStationIcon() const { return m_missileStationIcon; } std::string_view _GetMissileStationIcon() const { return m_missileStationIcon; }
const std::string& _GetElevatorIcon() const { return m_elevatorIcon; } std::string_view _GetElevatorIcon() const { return m_elevatorIcon; }
const std::string& _GetMinesBreakFirstTopIcon() const { return m_minesBreakFirstTopIcon; } std::string_view _GetMinesBreakFirstTopIcon() const { return m_minesBreakFirstTopIcon; }
const std::string& _GetMinesBreakFirstBottomIcon() const { return m_minesBreakFirstBottomIcon; } std::string_view _GetMinesBreakFirstBottomIcon() const { return m_minesBreakFirstBottomIcon; }
const std::string& _GetMinesBreakSecondTopIcon() const { return m_minesBreakSecondTopIcon; } std::string_view _GetMinesBreakSecondTopIcon() const { return m_minesBreakSecondTopIcon; }
const std::string& _GetMinesBreakSecondBottomIcon() const { return m_minesBreakSecondBottomIcon; } std::string_view _GetMinesBreakSecondBottomIcon() const { return m_minesBreakSecondBottomIcon; }
const std::string& _GetLStick(size_t idx) const { return (&m_lStickN)[idx]; } std::string_view _GetLStick(size_t idx) const { return (&m_lStickN)[idx]; }
const std::string& _GetCStick(size_t idx) const { return (&m_cStickN)[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]; } std::string_view _GetLTrigger(size_t idx) const { return (&m_lTriggerOut)[idx]; }
const std::string& _GetRTrigger(size_t idx) const { return (&m_rTriggerOut)[idx]; } std::string_view _GetRTrigger(size_t idx) const { return (&m_rTriggerOut)[idx]; }
const std::string& _GetStartButton(size_t idx) const { return (&m_startButtonOut)[idx]; } std::string_view _GetStartButton(size_t idx) const { return (&m_startButtonOut)[idx]; }
const std::string& _GetAButton(size_t idx) const { return (&m_aButtonOut)[idx]; } std::string_view _GetAButton(size_t idx) const { return (&m_aButtonOut)[idx]; }
const std::string& _GetBButton(size_t idx) const { return (&m_bButtonOut)[idx]; } std::string_view _GetBButton(size_t idx) const { return (&m_bButtonOut)[idx]; }
const std::string& _GetXButton(size_t idx) const { return (&m_xButtonOut)[idx]; } std::string_view _GetXButton(size_t idx) const { return (&m_xButtonOut)[idx]; }
const std::string& _GetYButton(size_t idx) const { return (&m_yButtonOut)[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]; } std::string_view _GetBallTransitionBeamRes(size_t idx) const { return (&m_ballTransitionsPower)[idx]; }
const std::string& _GetBeamCineModel(size_t idx) const { return (&m_cinePower)[idx]; } std::string_view _GetBeamCineModel(size_t idx) const { return (&m_cinePower)[idx]; }
float _GetCinematicMoveOutofIntoPlayerDistance() const { return m_cinematicMoveOutofIntoPlayerDistance; } float _GetCinematicMoveOutofIntoPlayerDistance() const { return m_cinematicMoveOutofIntoPlayerDistance; }

View File

@ -33,7 +33,7 @@ struct CTweakSlideShow final : ITweakSlideShow
CTweakSlideShow() = default; CTweakSlideShow() = default;
CTweakSlideShow(athena::io::IStreamReader& in) { read(in); } 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& GetFontColor() const { return x24_fontColor; }
const zeus::CColor& GetOutlineColor() const { return x28_outlineColor; } const zeus::CColor& GetOutlineColor() const { return x28_outlineColor; }
float GetScanPercentInterval() const { return x2c_scanPercentInterval; } float GetScanPercentInterval() const { return x2c_scanPercentInterval; }

View File

@ -44,7 +44,7 @@ bool AGSC::Cook(const hecl::ProjectPath& inPath, const hecl::ProjectPath& outPat
return false; return false;
hecl::ProjectPath woExt = inPath.getWithExtension(nullptr, true); 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")) if (hecl::StringUtils::EndsWith(lastComp, "_AGSC"))
lastComp.assign(lastComp.cbegin(), lastComp.cend() - 5); lastComp.assign(lastComp.cbegin(), lastComp.cend() - 5);

View File

@ -25,9 +25,9 @@ namespace DNAMP2
{ {
logvisor::Module Log("urde::DNAMP2"); logvisor::Module Log("urde::DNAMP2");
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); std::transform(lowerName.begin(), lowerName.end(), lowerName.begin(), tolower);
if (!lowerName.compare(0, 7, "metroid")) if (!lowerName.compare(0, 7, "metroid"))
return false; return false;
@ -65,9 +65,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) for (auto& ch : ret)
if (ch == _S('/') || ch == _S('\\')) if (ch == _S('/') || ch == _S('\\'))
ch = _S('-'); ch = _S('-');
@ -91,7 +91,7 @@ void PAKBridge::build()
} }
bool named; bool named;
std::string bestName = m_pak.bestEntryName(e, named); std::string bestName = m_pak.bestEntryName(e, named);
level.name = hecl::SystemStringView(bestName).sys_str(); level.name = hecl::SystemStringConv(bestName).sys_str();
level.areas.reserve(mlvl.areaCount); level.areas.reserve(mlvl.areaCount);
unsigned layerIdx = 0; unsigned layerIdx = 0;
@ -127,11 +127,11 @@ void PAKBridge::build()
} }
if (areaDeps.name.empty()) if (areaDeps.name.empty())
{ {
areaDeps.name = hecl::SystemStringView(area.internalAreaName).sys_str(); areaDeps.name = hecl::SystemStringConv(area.internalAreaName).sys_str();
if (areaDeps.name.empty()) if (areaDeps.name.empty())
{ {
std::string idStr = area.areaMREAId.toString(); 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::SystemChar num[16];

View File

@ -28,8 +28,8 @@ public:
bool doExtract=true); bool doExtract=true);
void build(); void build();
static ResExtractor<PAKBridge> LookupExtractor(const DNAMP1::PAK& pak, const DNAMP1::PAK::Entry& entry); static ResExtractor<PAKBridge> LookupExtractor(const DNAMP1::PAK& pak, const DNAMP1::PAK::Entry& entry);
const std::string& getName() const {return m_node.getName();} std::string_view getName() const {return m_node.getName();}
const hecl::SystemString& getLevelString() const {return m_levelString;} hecl::SystemStringView getLevelString() const {return m_levelString;}
using PAKType = DNAMP1::PAK; using PAKType = DNAMP1::PAK;
const PAKType& getPAK() const {return m_pak;} const PAKType& getPAK() const {return m_pak;}

View File

@ -19,9 +19,9 @@ struct STRG : ISTRG
std::unordered_map<FourCC, std::vector<std::u16string>*> langMap; std::unordered_map<FourCC, std::vector<std::u16string>*> langMap;
std::map<std::string, int32_t> names; std::map<std::string, int32_t> names;
int32_t lookupIdx(const std::string& name) const int32_t lookupIdx(std::string_view name) const
{ {
auto search = names.find(name); auto search = names.find(name.data());
if (search == names.end()) if (search == names.end())
return -1; return -1;
return search->second; return search->second;

View File

@ -131,7 +131,7 @@ void Material::SectionPASS::constructNode(hecl::BlenderConnection::PyOutStream&
TXTR::Extract(rs, txtrPath); TXTR::Extract(rs, txtrPath);
} }
hecl::SystemString resPath = pakRouter.getResourceRelativePath(entry, txtrId); hecl::SystemString resPath = pakRouter.getResourceRelativePath(entry, txtrId);
hecl::SystemUTF8View resPathView(resPath); hecl::SystemUTF8Conv resPathView(resPath);
out.format("if '%s' in bpy.data.textures:\n" out.format("if '%s' in bpy.data.textures:\n"
" image = bpy.data.images['%s']\n" " image = bpy.data.images['%s']\n"
" texture = bpy.data.textures[image.name]\n" " texture = bpy.data.textures[image.name]\n"
@ -142,7 +142,7 @@ void Material::SectionPASS::constructNode(hecl::BlenderConnection::PyOutStream&
" texture.image = image\n" " texture.image = image\n"
"tex_maps.append(texture)\n" "tex_maps.append(texture)\n"
"\n", texName.c_str(), texName.c_str(), "\n", texName.c_str(), texName.c_str(),
resPathView.str().c_str(), texName.c_str()); resPathView.c_str(), texName.c_str());
if (uvAnim.size()) if (uvAnim.size())
{ {
const UVAnimation& uva = uvAnim[0]; const UVAnimation& uva = uvAnim[0];

View File

@ -23,9 +23,9 @@ namespace DNAMP3
{ {
logvisor::Module Log("urde::DNAMP3"); logvisor::Module Log("urde::DNAMP3");
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); std::transform(lowerName.begin(), lowerName.end(), lowerName.begin(), tolower);
if (!lowerName.compare(0, 7, "metroid")) if (!lowerName.compare(0, 7, "metroid"))
return false; return false;
@ -70,9 +70,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) for (auto& ch : ret)
if (ch == _S('/') || ch == _S('\\')) if (ch == _S('/') || ch == _S('\\'))
ch = _S('-'); ch = _S('-');
@ -96,7 +96,7 @@ void PAKBridge::build()
} }
bool named; bool named;
std::string bestName = m_pak.bestEntryName(entry, 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); level.areas.reserve(mlvl.areaCount);
unsigned layerIdx = 0; unsigned layerIdx = 0;
@ -132,11 +132,11 @@ void PAKBridge::build()
} }
if (areaDeps.name.empty()) if (areaDeps.name.empty())
{ {
areaDeps.name = hecl::SystemStringView(area.internalAreaName).sys_str(); areaDeps.name = hecl::SystemStringConv(area.internalAreaName).sys_str();
if (areaDeps.name.empty()) if (areaDeps.name.empty())
{ {
std::string idStr = area.areaMREAId.toString(); 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::SystemChar num[16];
@ -200,7 +200,7 @@ void PAKBridge::addCMDLRigPairs(PAKRouter<PAKBridge>& pakRouter,
{ {
addTo[overlay.cmdl] = std::make_pair(overlay.cskr, ci.cinf); addTo[overlay.cmdl] = std::make_pair(overlay.cskr, ci.cinf);
cskrCinfToChar[overlay.cskr] = std::make_pair(entry.second.id, cskrCinfToChar[overlay.cskr] = std::make_pair(entry.second.id,
hecl::Format("%s.%s.CSKR", ci.name.c_str(), overlay.type.toString().c_str())); hecl::Format("%s.%.4s.CSKR", ci.name.c_str(), overlay.type.getChars()));
} }
} }
} }

View File

@ -28,12 +28,12 @@ public:
bool doExtract=true); bool doExtract=true);
void build(); void build();
static ResExtractor<PAKBridge> LookupExtractor(const PAK& pak, const PAK::Entry& entry); static ResExtractor<PAKBridge> LookupExtractor(const PAK& pak, const PAK::Entry& entry);
inline const std::string& getName() const {return m_node.getName();} std::string_view getName() const {return m_node.getName();}
inline hecl::SystemString getLevelString() const {return m_levelString;} hecl::SystemStringView getLevelString() const {return m_levelString;}
using PAKType = PAK; using PAKType = PAK;
inline const PAKType& getPAK() const {return m_pak;} const PAKType& getPAK() const {return m_pak;}
inline const nod::Node& getNode() const {return m_node;} const nod::Node& getNode() const {return m_node;}
void addCMDLRigPairs(PAKRouter<PAKBridge>& pakRouter, void addCMDLRigPairs(PAKRouter<PAKBridge>& pakRouter,
std::unordered_map<UniqueID64, std::pair<UniqueID64, UniqueID64>>& addTo, std::unordered_map<UniqueID64, std::pair<UniqueID64, UniqueID64>>& addTo,

View File

@ -212,9 +212,9 @@ const PAK::Entry* PAK::lookupEntry(const UniqueID64& id) const
return nullptr; 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()) if (result != m_nameMap.end())
{ {
auto result1 = m_entries.find(result->second); auto result1 = m_entries.find(result->second);

View File

@ -64,7 +64,7 @@ struct PAK : BigDNA
DECL_EXPLICIT_DNA DECL_EXPLICIT_DNA
const Entry* lookupEntry(const UniqueID64& id) const; const Entry* lookupEntry(const UniqueID64& 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; std::string bestEntryName(const Entry& entry, bool& named) const;
typedef UniqueID64 IDType; typedef UniqueID64 IDType;

View File

@ -19,9 +19,9 @@ struct STRG : ISTRG
std::unordered_map<DNAFourCC, std::vector<std::string>*> langMap; std::unordered_map<DNAFourCC, std::vector<std::string>*> langMap;
std::map<std::string, int32_t> names; std::map<std::string, int32_t> names;
int32_t lookupIdx(const std::string& name) const int32_t lookupIdx(std::string_view name) const
{ {
auto search = names.find(name); auto search = names.find(name.data());
if (search == names.end()) if (search == names.end())
return -1; return -1;
return search->second; return search->second;

View File

@ -61,7 +61,7 @@ void SpecBase::setThreadProject()
bool SpecBase::canExtract(const ExtractPassInfo& info, std::vector<ExtractReport>& reps) bool SpecBase::canExtract(const ExtractPassInfo& info, std::vector<ExtractReport>& reps)
{ {
m_disc = nod::OpenDiscFromImage(info.srcpath.c_str(), m_isWii); m_disc = nod::OpenDiscFromImage(info.srcpath, m_isWii);
if (!m_disc) if (!m_disc)
return false; return false;
const char* gameID = m_disc->getHeader().m_gameID; const char* gameID = m_disc->getHeader().m_gameID;
@ -141,7 +141,7 @@ static bool IsPathAudioGroup(const hecl::ProjectPath& path)
!path.getWithExtension(_S(".samp"), true).isFile()) !path.getWithExtension(_S(".samp"), true).isFile())
{ {
if (path.isFile() && if (path.isFile() &&
!hecl::StrCmp(_S("proj"), path.getLastComponentExt()) && !hecl::StrCmp(_S("proj"), path.getLastComponentExt().data()) &&
path.getWithExtension(_S(".pool"), true).isFile() && path.getWithExtension(_S(".pool"), true).isFile() &&
path.getWithExtension(_S(".sdir"), true).isFile() && path.getWithExtension(_S(".sdir"), true).isFile() &&
path.getWithExtension(_S(".samp"), true).isFile()) path.getWithExtension(_S(".samp"), true).isFile())
@ -158,7 +158,7 @@ static bool IsPathSong(const hecl::ProjectPath& path)
!path.getWithExtension(_S(".yaml"), true).isFile()) !path.getWithExtension(_S(".yaml"), true).isFile())
{ {
if (path.isFile() && if (path.isFile() &&
!hecl::StrCmp(_S("mid"), path.getLastComponentExt()) && !hecl::StrCmp(_S("mid"), path.getLastComponentExt().data()) &&
path.getWithExtension(_S(".yaml"), true).isFile()) path.getWithExtension(_S(".yaml"), true).isFile())
return true; return true;
return false; return false;
@ -229,7 +229,7 @@ const hecl::Database::DataSpecEntry* SpecBase::overrideDataSpec(const hecl::Proj
if (!conn.openBlend(asBlend)) if (!conn.openBlend(asBlend))
{ {
Log.report(logvisor::Error, _S("unable to cook '%s'"), Log.report(logvisor::Error, _S("unable to cook '%s'"),
path.getAbsolutePath().c_str()); path.getAbsolutePath().data());
return nullptr; return nullptr;
} }
hecl::BlenderConnection::BlendType type = conn.getBlendType(); hecl::BlenderConnection::BlendType type = conn.getBlendType();
@ -375,26 +375,26 @@ void SpecBase::flattenDependencies(const hecl::ProjectPath& path,
{ {
pathsOut.push_back(sub.mesh); pathsOut.push_back(sub.mesh);
hecl::SystemStringView chSysName(sub.name); hecl::SystemStringConv chSysName(sub.name);
pathsOut.push_back(asGlob.ensureAuxInfo(chSysName.sys_str() + _S(".CSKR"))); pathsOut.push_back(asGlob.ensureAuxInfo(hecl::SystemString(chSysName.sys_str()) + _S(".CSKR")));
const auto& arm = actor.armatures[sub.armature]; const auto& arm = actor.armatures[sub.armature];
hecl::SystemStringView armSysName(arm.name); hecl::SystemStringConv armSysName(arm.name);
pathsOut.push_back(asGlob.ensureAuxInfo(armSysName.sys_str() + _S(".CINF"))); pathsOut.push_back(asGlob.ensureAuxInfo(hecl::SystemString(armSysName.sys_str()) + _S(".CINF")));
for (const auto& overlay : sub.overlayMeshes) for (const auto& overlay : sub.overlayMeshes)
{ {
hecl::SystemStringView ovelaySys(overlay.first); hecl::SystemStringConv ovelaySys(overlay.first);
pathsOut.push_back(overlay.second); pathsOut.push_back(overlay.second);
pathsOut.push_back(asGlob.ensureAuxInfo(chSysName.sys_str() + _S('.') + pathsOut.push_back(asGlob.ensureAuxInfo(hecl::SystemString(chSysName.sys_str()) + _S('.') +
ovelaySys.sys_str() + _S(".CSKR"))); ovelaySys.c_str() + _S(".CSKR")));
} }
} }
} }
auto actNames = ds.getActionNames(); auto actNames = ds.getActionNames();
for (const auto& act : actNames) for (const auto& act : actNames)
{ {
hecl::SystemStringView actSysName(act); hecl::SystemStringConv actSysName(act);
pathsOut.push_back(asGlob.ensureAuxInfo(actSysName.sys_str() + _S(".ANIM"))); pathsOut.push_back(asGlob.ensureAuxInfo(hecl::SystemString(actSysName.sys_str()) + _S(".ANIM")));
hecl::ProjectPath evntPath = asGlob.getWithExtension( hecl::ProjectPath evntPath = asGlob.getWithExtension(
hecl::SysFormat(_S(".%s.evnt.yaml"), actSysName.c_str()).c_str(), true); hecl::SysFormat(_S(".%s.evnt.yaml"), actSysName.c_str()).c_str(), true);
if (evntPath.isFile()) if (evntPath.isFile())
@ -496,7 +496,7 @@ void SpecBase::copyBuildListData(std::vector<std::tuple<size_t, size_t, bool>>&
hecl::ProjectPath cooked = getCookedPath(path, true); hecl::ProjectPath cooked = getCookedPath(path, true);
athena::io::FileReader r(cooked.getAbsolutePath()); athena::io::FileReader r(cooked.getAbsolutePath());
if (r.hasError()) if (r.hasError())
Log.report(logvisor::Fatal, _S("Unable to open resource %s"), cooked.getRelativePath().c_str()); Log.report(logvisor::Fatal, _S("Unable to open resource %s"), cooked.getRelativePath().data());
atUint64 size = r.length(); atUint64 size = r.length();
auto data = r.readUBytes(size); auto data = r.readUBytes(size);
auto compData = compressPakData(tag, data.get(), size); auto compData = compressPakData(tag, data.get(), size);
@ -538,7 +538,7 @@ void SpecBase::doPackage(const hecl::ProjectPath& path, const hecl::Database::Da
hecl::ProjectPath outPath(m_project.getProjectWorkingPath(), hecl::ProjectPath outPath(m_project.getProjectWorkingPath(),
_S("out/") + components[0] + _S("/") + components[1] + _S(".upak")); _S("out/") + components[0] + _S("/") + components[1] + _S(".upak"));
outPath.makeDirChain(false); outPath.makeDirChain(false);
hecl::SystemString tmpPath = outPath.getAbsolutePath() + _S("~"); hecl::SystemString tmpPath = hecl::SystemString(outPath.getAbsolutePath()) + _S("~");
/* Output file */ /* Output file */
athena::io::FileWriter pakOut(tmpPath); athena::io::FileWriter pakOut(tmpPath);
@ -546,7 +546,7 @@ void SpecBase::doPackage(const hecl::ProjectPath& path, const hecl::Database::Da
atUint64 resTableOffset = 0; atUint64 resTableOffset = 0;
if (path.getPathType() == hecl::ProjectPath::Type::File && if (path.getPathType() == hecl::ProjectPath::Type::File &&
!hecl::StrCmp(path.getLastComponent(), _S("!world.blend"))) /* World PAK */ !hecl::StrCmp(path.getLastComponent().data(), _S("!world.blend"))) /* World PAK */
{ {
/* Force-cook MLVL and write resource list structure */ /* Force-cook MLVL and write resource list structure */
m_project.cookPath(path, progress, false, true, fast); m_project.cookPath(path, progress, false, true, fast);
@ -642,7 +642,7 @@ void SpecBase::doPackage(const hecl::ProjectPath& path, const hecl::Database::Da
/* Write resource data and build file index */ /* Write resource data and build file index */
std::vector<std::tuple<size_t, size_t, bool>> fileIndex; std::vector<std::tuple<size_t, size_t, bool>> fileIndex;
Log.report(logvisor::Info, _S("Copying data into %s"), outPath.getRelativePath().c_str()); Log.report(logvisor::Info, _S("Copying data into %s"), outPath.getRelativePath().data());
copyBuildListData(fileIndex, buildList, entry, fast, progress, pakOut); copyBuildListData(fileIndex, buildList, entry, fast, progress, pakOut);
/* Write file index */ /* Write file index */
@ -650,7 +650,7 @@ void SpecBase::doPackage(const hecl::ProjectPath& path, const hecl::Database::Da
pakOut.close(); pakOut.close();
/* Atomic rename */ /* Atomic rename */
hecl::Rename(tmpPath.c_str(), outPath.getAbsolutePath().c_str()); hecl::Rename(tmpPath.c_str(), outPath.getAbsolutePath().data());
} }
hecl::ProjectPath SpecBase::getCookedPath(const hecl::ProjectPath& working, bool pcTarget) const hecl::ProjectPath SpecBase::getCookedPath(const hecl::ProjectPath& working, bool pcTarget) const
@ -684,18 +684,18 @@ void SpecBase::extractRandomStaticEntropy(const uint8_t* buf, const hecl::Projec
hecl::ProjectPath entropyPath(noAramPath, _S("RandomStaticEntropy.png")); hecl::ProjectPath entropyPath(noAramPath, _S("RandomStaticEntropy.png"));
hecl::ProjectPath catalogPath(noAramPath, _S("!catalog.yaml")); hecl::ProjectPath catalogPath(noAramPath, _S("!catalog.yaml"));
if (FILE* fp = hecl::Fopen(catalogPath.getAbsolutePath().c_str(), _S("a"))) if (FILE* fp = hecl::Fopen(catalogPath.getAbsolutePath().data(), _S("a")))
{ {
fprintf(fp, "RandomStaticEntropy: %s\n", entropyPath.getRelativePathUTF8().c_str()); fprintf(fp, "RandomStaticEntropy: %s\n", entropyPath.getRelativePathUTF8().data());
fclose(fp); fclose(fp);
} }
FILE* fp = hecl::Fopen(entropyPath.getAbsolutePath().c_str(), _S("wb")); FILE* fp = hecl::Fopen(entropyPath.getAbsolutePath().data(), _S("wb"));
if (!fp) if (!fp)
{ {
Log.report(logvisor::Error, Log.report(logvisor::Error,
_S("Unable to open '%s' for writing"), _S("Unable to open '%s' for writing"),
entropyPath.getAbsolutePath().c_str()); entropyPath.getAbsolutePath().data());
return; return;
} }
png_structp png = png_create_write_struct(PNG_LIBPNG_VER_STRING, nullptr, PNGErr, PNGWarn); png_structp png = png_create_write_struct(PNG_LIBPNG_VER_STRING, nullptr, PNGErr, PNGWarn);
@ -783,9 +783,9 @@ bool SpecBase::waitForTagReady(const urde::SObjectTag& tag, const hecl::ProjectP
return true; return true;
} }
const urde::SObjectTag* SpecBase::getResourceIdByName(const char* name) const const urde::SObjectTag* SpecBase::getResourceIdByName(std::string_view name) const
{ {
std::string lower = name; std::string lower(name);
std::transform(lower.cbegin(), lower.cend(), lower.begin(), tolower); std::transform(lower.cbegin(), lower.cend(), lower.begin(), tolower);
std::unique_lock<std::mutex> lk(const_cast<SpecBase&>(*this).m_backgroundIndexMutex); std::unique_lock<std::mutex> lk(const_cast<SpecBase&>(*this).m_backgroundIndexMutex);
@ -854,7 +854,7 @@ void SpecBase::enumerateResources(const std::function<bool(const urde::SObjectTa
} }
void SpecBase::enumerateNamedResources( void SpecBase::enumerateNamedResources(
const std::function<bool(const std::string&, const urde::SObjectTag&)>& lambda) const const std::function<bool(std::string_view, const urde::SObjectTag&)>& lambda) const
{ {
waitForIndexComplete(); waitForIndexComplete();
for (const auto& pair : m_catalogNameToTag) for (const auto& pair : m_catalogNameToTag)
@ -873,18 +873,18 @@ static void WriteTag(athena::io::YAMLDocWriter& cacheWriter,
{ {
cacheWriter.writeString(nullptr, pathTag.type.toString().c_str()); cacheWriter.writeString(nullptr, pathTag.type.toString().c_str());
cacheWriter.writeString(nullptr, path.getAuxInfo().size() ? cacheWriter.writeString(nullptr, path.getAuxInfo().size() ?
(path.getRelativePathUTF8() + '|' + path.getAuxInfoUTF8()) : (std::string(path.getRelativePathUTF8()) + '|' + path.getAuxInfoUTF8().data()) :
path.getRelativePathUTF8()); path.getRelativePathUTF8());
} }
} }
static void WriteNameTag(athena::io::YAMLDocWriter& nameWriter, static void WriteNameTag(athena::io::YAMLDocWriter& nameWriter,
const urde::SObjectTag& pathTag, const urde::SObjectTag& pathTag,
const std::string& name) std::string_view name)
{ {
char idStr[9]; char idStr[9];
snprintf(idStr, 9, "%08X", uint32_t(pathTag.id.Value())); snprintf(idStr, 9, "%08X", uint32_t(pathTag.id.Value()));
nameWriter.writeString(name.c_str(), idStr); nameWriter.writeString(name.data(), idStr);
} }
void SpecBase::readCatalog(const hecl::ProjectPath& catalogPath, void SpecBase::readCatalog(const hecl::ProjectPath& catalogPath,
@ -980,7 +980,7 @@ static void DumpCacheAdd(const urde::SObjectTag& pathTag, const hecl::ProjectPat
{ {
fprintf(stderr, "%s %08X %s\n", fprintf(stderr, "%s %08X %s\n",
pathTag.type.toString().c_str(), uint32_t(pathTag.id.Value()), pathTag.type.toString().c_str(), uint32_t(pathTag.id.Value()),
path.getRelativePathUTF8().c_str()); path.getRelativePathUTF8().data());
} }
#endif #endif
@ -1021,8 +1021,8 @@ bool SpecBase::addFileToIndex(const hecl::ProjectPath& path,
for (const std::string& arm : armatureNames) for (const std::string& arm : armatureNames)
{ {
hecl::SystemStringView sysStr(arm); hecl::SystemStringConv sysStr(arm);
hecl::ProjectPath subPath = asGlob.ensureAuxInfo(sysStr.sys_str() + _S(".CINF")); hecl::ProjectPath subPath = asGlob.ensureAuxInfo(hecl::SystemString(sysStr.sys_str()) + _S(".CINF"));
urde::SObjectTag pathTag = buildTagFromPath(subPath, m_backgroundBlender); urde::SObjectTag pathTag = buildTagFromPath(subPath, m_backgroundBlender);
m_tagToPath[pathTag] = subPath; m_tagToPath[pathTag] = subPath;
m_pathToTag[subPath.hash()] = pathTag; m_pathToTag[subPath.hash()] = pathTag;
@ -1034,8 +1034,8 @@ bool SpecBase::addFileToIndex(const hecl::ProjectPath& path,
for (const std::string& sub : subtypeNames) for (const std::string& sub : subtypeNames)
{ {
hecl::SystemStringView sysStr(sub); hecl::SystemStringConv sysStr(sub);
hecl::ProjectPath subPath = asGlob.ensureAuxInfo(sysStr.sys_str() + _S(".CSKR")); hecl::ProjectPath subPath = asGlob.ensureAuxInfo(hecl::SystemString(sysStr.sys_str()) + _S(".CSKR"));
urde::SObjectTag pathTag = buildTagFromPath(subPath, m_backgroundBlender); urde::SObjectTag pathTag = buildTagFromPath(subPath, m_backgroundBlender);
m_tagToPath[pathTag] = subPath; m_tagToPath[pathTag] = subPath;
m_pathToTag[subPath.hash()] = pathTag; m_pathToTag[subPath.hash()] = pathTag;
@ -1047,9 +1047,9 @@ bool SpecBase::addFileToIndex(const hecl::ProjectPath& path,
std::vector<std::string> overlayNames = ds.getSubtypeOverlayNames(sub); std::vector<std::string> overlayNames = ds.getSubtypeOverlayNames(sub);
for (const auto& overlay : overlayNames) for (const auto& overlay : overlayNames)
{ {
hecl::SystemStringView overlaySys(overlay); hecl::SystemStringConv overlaySys(overlay);
hecl::ProjectPath subPath = asGlob.ensureAuxInfo(sysStr.sys_str() + _S('.') + hecl::ProjectPath subPath = asGlob.ensureAuxInfo(hecl::SystemString(sysStr.sys_str()) + _S('.') +
overlaySys.sys_str() + _S(".CSKR")); overlaySys.c_str() + _S(".CSKR"));
urde::SObjectTag pathTag = buildTagFromPath(subPath, m_backgroundBlender); urde::SObjectTag pathTag = buildTagFromPath(subPath, m_backgroundBlender);
m_tagToPath[pathTag] = subPath; m_tagToPath[pathTag] = subPath;
m_pathToTag[subPath.hash()] = pathTag; m_pathToTag[subPath.hash()] = pathTag;
@ -1062,8 +1062,8 @@ bool SpecBase::addFileToIndex(const hecl::ProjectPath& path,
for (const std::string& act : actionNames) for (const std::string& act : actionNames)
{ {
hecl::SystemStringView sysStr(act); hecl::SystemStringConv sysStr(act);
hecl::ProjectPath subPath = asGlob.ensureAuxInfo(sysStr.sys_str() + _S(".ANIM")); hecl::ProjectPath subPath = asGlob.ensureAuxInfo(hecl::SystemString(sysStr.sys_str()) + _S(".ANIM"));
urde::SObjectTag pathTag = buildTagFromPath(subPath, m_backgroundBlender); urde::SObjectTag pathTag = buildTagFromPath(subPath, m_backgroundBlender);
m_tagToPath[pathTag] = subPath; m_tagToPath[pathTag] = subPath;
m_pathToTag[subPath.hash()] = pathTag; m_pathToTag[subPath.hash()] = pathTag;

View File

@ -143,11 +143,11 @@ struct SpecBase : hecl::Database::IDataSpec
urde::SObjectTag tagFromPath(const hecl::ProjectPath& path, hecl::BlenderToken& btok) const; urde::SObjectTag tagFromPath(const hecl::ProjectPath& path, hecl::BlenderToken& btok) const;
hecl::ProjectPath pathFromTag(const urde::SObjectTag& tag) const; hecl::ProjectPath pathFromTag(const urde::SObjectTag& tag) const;
bool waitForTagReady(const urde::SObjectTag& tag, const hecl::ProjectPath*& pathOut); bool waitForTagReady(const urde::SObjectTag& tag, const hecl::ProjectPath*& pathOut);
const urde::SObjectTag* getResourceIdByName(const char* name) const; const urde::SObjectTag* getResourceIdByName(std::string_view name) const;
hecl::FourCC getResourceTypeById(urde::CAssetId id) const; hecl::FourCC getResourceTypeById(urde::CAssetId id) const;
void enumerateResources(const std::function<bool(const urde::SObjectTag&)>& lambda) const; void enumerateResources(const std::function<bool(const urde::SObjectTag&)>& lambda) const;
void enumerateNamedResources( void enumerateNamedResources(
const std::function<bool(const std::string&, const urde::SObjectTag&)>& lambda) const; const std::function<bool(std::string_view, const urde::SObjectTag&)>& lambda) const;
void cancelBackgroundIndex(); void cancelBackgroundIndex();
void beginBackgroundIndex(); void beginBackgroundIndex();
bool backgroundIndexRunning() const { return m_backgroundRunning; } bool backgroundIndexRunning() const { return m_backgroundRunning; }

View File

@ -49,6 +49,8 @@
namespace DataSpec namespace DataSpec
{ {
using namespace std::literals;
static logvisor::Module Log("urde::SpecMP1"); static logvisor::Module Log("urde::SpecMP1");
extern hecl::Database::DataSpecEntry SpecEntMP1; extern hecl::Database::DataSpecEntry SpecEntMP1;
extern hecl::Database::DataSpecEntry SpecEntMP1PC; extern hecl::Database::DataSpecEntry SpecEntMP1PC;
@ -185,8 +187,8 @@ struct SpecMP1 : SpecBase
for (const nod::Node& child : root) for (const nod::Node& child : root)
{ {
bool isPak = false; bool isPak = false;
const std::string& name = child.getName(); auto name = child.getName();
std::string lowerName = name; std::string lowerName(name);
std::transform(lowerName.begin(), lowerName.end(), lowerName.begin(), tolower); std::transform(lowerName.begin(), lowerName.end(), lowerName.begin(), tolower);
if (name.size() > 4) if (name.size() > 4)
{ {
@ -219,7 +221,7 @@ struct SpecMP1 : SpecBase
{ {
for (const hecl::SystemString& arg : args) for (const hecl::SystemString& arg : args)
{ {
std::string lowerArg = hecl::SystemUTF8View(arg).str(); std::string lowerArg(hecl::SystemUTF8Conv(arg).str());
std::transform(lowerArg.begin(), lowerArg.end(), lowerArg.begin(), tolower); std::transform(lowerArg.begin(), lowerArg.end(), lowerArg.begin(), tolower);
if (!lowerArg.compare(0, lowerBase.size(), lowerBase)) if (!lowerArg.compare(0, lowerBase.size(), lowerBase))
good = true; good = true;
@ -238,7 +240,7 @@ struct SpecMP1 : SpecBase
/* Sort PAKs alphabetically */ /* Sort PAKs alphabetically */
m_orderedPaks.clear(); m_orderedPaks.clear();
for (DNAMP1::PAKBridge& dpak : m_paks) for (DNAMP1::PAKBridge& dpak : m_paks)
m_orderedPaks[dpak.getName()] = &dpak; m_orderedPaks[std::string(dpak.getName())] = &dpak;
/* Assemble extract report */ /* Assemble extract report */
rep.childOpts.reserve(m_orderedPaks.size()); rep.childOpts.reserve(m_orderedPaks.size());
@ -248,8 +250,8 @@ struct SpecMP1 : SpecBase
continue; continue;
rep.childOpts.emplace_back(); rep.childOpts.emplace_back();
ExtractReport& childRep = rep.childOpts.back(); ExtractReport& childRep = rep.childOpts.back();
hecl::SystemStringView nameView(item.first); hecl::SystemStringConv nameView(item.first);
childRep.name = nameView; childRep.name = nameView.sys_str();
childRep.desc = item.second->getLevelString(); childRep.desc = item.second->getLevelString();
} }
} }
@ -272,7 +274,7 @@ struct SpecMP1 : SpecBase
if (buildInfo) if (buildInfo)
{ {
std::string buildStr(buildInfo); std::string buildStr(buildInfo);
hecl::SystemStringView buildView(buildStr); hecl::SystemStringConv buildView(buildStr);
rep.desc += _S(" (") + buildView + _S(")"); rep.desc += _S(" (") + buildView + _S(")");
} }
@ -334,7 +336,7 @@ struct SpecMP1 : SpecBase
if (buildInfo) if (buildInfo)
{ {
std::string buildStr(buildInfo); std::string buildStr(buildInfo);
hecl::SystemStringView buildView(buildStr); hecl::SystemStringConv buildView(buildStr);
rep.desc += _S(" (") + buildView + _S(")"); rep.desc += _S(" (") + buildView + _S(")");
} }
@ -374,8 +376,8 @@ struct SpecMP1 : SpecBase
/* Extract non-pak files */ /* Extract non-pak files */
progress(_S("MP1 Root"), _S(""), 3, 0.0); progress(_S("MP1 Root"), _S(""), 3, 0.0);
int prog = 0; int prog = 0;
ctx.progressCB = [&](const std::string& name, float) { ctx.progressCB = [&](std::string_view name, float) {
hecl::SystemStringView nameView(name); hecl::SystemStringConv nameView(name);
progress(_S("MP1 Root"), nameView.c_str(), 3, prog / (float)m_nonPaks.size()); progress(_S("MP1 Root"), nameView.c_str(), 3, prog / (float)m_nonPaks.size());
}; };
for (const nod::Node* node : m_nonPaks) for (const nod::Node* node : m_nonPaks)
@ -409,19 +411,19 @@ struct SpecMP1 : SpecBase
if (!pak.m_doExtract) if (!pak.m_doExtract)
continue; continue;
const std::string& name = pak.getName(); auto name = pak.getName();
hecl::SystemStringView sysName(name); hecl::SystemStringConv sysName(name);
{ {
std::unique_lock<std::mutex> lk(msgLock); std::unique_lock<std::mutex> lk(msgLock);
progress(sysName.c_str(), _S(""), compIdx, 0.0); progress(sysName.c_str(), _S(""), compIdx, 0.0);
} }
hecl::SystemString pakName = sysName.sys_str(); auto pakName = sysName.sys_str();
process.addLambdaTransaction([&, pakName](hecl::BlenderToken& btok) { process.addLambdaTransaction([&, pakName](hecl::BlenderToken& btok) {
m_pakRouter.extractResources(pak, force, btok, [&](const hecl::SystemChar* substr, float factor) { m_pakRouter.extractResources(pak, force, btok, [&](const hecl::SystemChar* substr, float factor) {
std::unique_lock<std::mutex> lk(msgLock); std::unique_lock<std::mutex> lk(msgLock);
progress(pakName.c_str(), substr, compIdx, factor); progress(pakName.data(), substr, compIdx, factor);
}); });
}); });
} }
@ -525,7 +527,7 @@ struct SpecMP1 : SpecBase
return {SBIG('CSKR'), path.hash().val32()}; return {SBIG('CSKR'), path.hash().val32()};
else if (hecl::StringUtils::EndsWith(path.getAuxInfo(), _S(".ANIM"))) else if (hecl::StringUtils::EndsWith(path.getAuxInfo(), _S(".ANIM")))
return {SBIG('ANIM'), path.hash().val32()}; return {SBIG('ANIM'), path.hash().val32()};
else if (const hecl::SystemChar* ext = path.getLastComponentExt()) else if (const hecl::SystemChar* ext = path.getLastComponentExt().data())
{ {
if (ext[0] == _S('*') || !hecl::StrCmp(ext, _S("proj"))) if (ext[0] == _S('*') || !hecl::StrCmp(ext, _S("proj")))
{ {
@ -611,7 +613,7 @@ struct SpecMP1 : SpecBase
} }
else if (hecl::IsPathYAML(path)) else if (hecl::IsPathYAML(path))
{ {
FILE* fp = hecl::Fopen(path.getAbsolutePath().c_str(), _S("r")); FILE* fp = hecl::Fopen(path.getAbsolutePath().data(), _S("r"));
if (!fp) if (!fp)
return {}; return {};
@ -811,7 +813,7 @@ struct SpecMP1 : SpecBase
for (const std::string& mesh : meshes) for (const std::string& mesh : meshes)
{ {
hecl::SystemStringView meshSys(mesh); hecl::SystemStringConv meshSys(mesh);
if (!mesh.compare("CMESH")) if (!mesh.compare("CMESH"))
{ {
colMesh = ds.compileColMesh(mesh); colMesh = ds.compileColMesh(mesh);
@ -824,7 +826,7 @@ struct SpecMP1 : SpecBase
} }
if (!colMesh) if (!colMesh)
Log.report(logvisor::Fatal, _S("unable to find mesh named 'CMESH' in %s"), in.getAbsolutePath().c_str()); Log.report(logvisor::Fatal, _S("unable to find mesh named 'CMESH' in %s"), in.getAbsolutePath().data());
std::vector<Light> lights = ds.compileLights(); std::vector<Light> lights = ds.compileLights();
@ -1141,7 +1143,7 @@ struct SpecMP1 : SpecBase
{ {
athena::io::FileReader r(worldPathCooked.getAbsolutePath()); athena::io::FileReader r(worldPathCooked.getAbsolutePath());
if (r.hasError()) if (r.hasError())
Log.report(logvisor::Fatal, _S("Unable to open world %s"), worldPathCooked.getRelativePath().c_str()); Log.report(logvisor::Fatal, _S("Unable to open world %s"), worldPathCooked.getRelativePath().data());
mlvl.read(r); mlvl.read(r);
} }
@ -1161,7 +1163,7 @@ struct SpecMP1 : SpecBase
hecl::ProjectPath parentDir = worldPath.getParentPath(); hecl::ProjectPath parentDir = worldPath.getParentPath();
nameEnt.type = worldTag.type; nameEnt.type = worldTag.type;
nameEnt.id = atUint32(worldTag.id.Value()); nameEnt.id = atUint32(worldTag.id.Value());
nameEnt.nameLen = atUint32(hecl::StrLen(parentDir.getLastComponent())); nameEnt.nameLen = atUint32(parentDir.getLastComponent().size());
nameEnt.name = parentDir.getLastComponentUTF8(); nameEnt.name = parentDir.getLastComponentUTF8();
nameEnt.write(w); nameEnt.write(w);
@ -1191,10 +1193,10 @@ struct SpecMP1 : SpecBase
{ {
athena::io::FileReader r(mapCookedPath.getAbsolutePath()); athena::io::FileReader r(mapCookedPath.getAbsolutePath());
if (r.hasError()) if (r.hasError())
Log.report(logvisor::Fatal, _S("Unable to open %s"), mapCookedPath.getRelativePath().c_str()); Log.report(logvisor::Fatal, _S("Unable to open %s"), mapCookedPath.getRelativePath().data());
if (r.readUint32Big() != 0xDEADF00D) if (r.readUint32Big() != 0xDEADF00D)
Log.report(logvisor::Fatal, _S("Corrupt MAPW %s"), mapCookedPath.getRelativePath().c_str()); Log.report(logvisor::Fatal, _S("Corrupt MAPW %s"), mapCookedPath.getRelativePath().data());
r.readUint32Big(); r.readUint32Big();
atUint32 mapaCount = r.readUint32Big(); atUint32 mapaCount = r.readUint32Big();
for (int i=0 ; i<mapaCount ; ++i) for (int i=0 ; i<mapaCount ; ++i)
@ -1221,7 +1223,7 @@ struct SpecMP1 : SpecBase
{ {
urde::SObjectTag texTag = tagFromPath(tex, btok); urde::SObjectTag texTag = tagFromPath(tex, btok);
if (!texTag) if (!texTag)
Log.report(logvisor::Fatal, _S("Unable to resolve %s"), tex.getRelativePath().c_str()); Log.report(logvisor::Fatal, _S("Unable to resolve %s"), tex.getRelativePath().data());
listOut.push_back(texTag); listOut.push_back(texTag);
} }
} }
@ -1368,13 +1370,13 @@ struct SpecMP1 : SpecBase
}; };
hecl::Database::DataSpecEntry SpecEntMP1 = { hecl::Database::DataSpecEntry SpecEntMP1 = {
_S("MP1"), _S("Data specification for original Metroid Prime engine"), _S("MP1"sv), _S("Data specification for original Metroid Prime engine"sv),
[](hecl::Database::Project& project, hecl::Database::DataSpecTool) -> hecl::Database::IDataSpec* { [](hecl::Database::Project& project, hecl::Database::DataSpecTool) -> hecl::Database::IDataSpec* {
return new struct SpecMP1(&SpecEntMP1, project, false); return new struct SpecMP1(&SpecEntMP1, project, false);
}}; }};
hecl::Database::DataSpecEntry SpecEntMP1PC = { hecl::Database::DataSpecEntry SpecEntMP1PC = {
_S("MP1-PC"), _S("Data specification for PC-optimized Metroid Prime engine"), _S("MP1-PC"sv), _S("Data specification for PC-optimized Metroid Prime engine"sv),
[](hecl::Database::Project& project, hecl::Database::DataSpecTool tool) -> hecl::Database::IDataSpec* { [](hecl::Database::Project& project, hecl::Database::DataSpecTool tool) -> hecl::Database::IDataSpec* {
if (tool != hecl::Database::DataSpecTool::Extract) if (tool != hecl::Database::DataSpecTool::Extract)
return new struct SpecMP1(&SpecEntMP1PC, project, true); return new struct SpecMP1(&SpecEntMP1PC, project, true);
@ -1382,5 +1384,5 @@ hecl::Database::DataSpecEntry SpecEntMP1PC = {
}}; }};
hecl::Database::DataSpecEntry SpecEntMP1ORIG = { hecl::Database::DataSpecEntry SpecEntMP1ORIG = {
_S("MP1-ORIG"), _S("Data specification for unmodified Metroid Prime resources"), {}}; _S("MP1-ORIG"sv), _S("Data specification for unmodified Metroid Prime resources"sv), {}};
} }

View File

@ -17,6 +17,8 @@
namespace DataSpec namespace DataSpec
{ {
using namespace std::literals;
static logvisor::Module Log("urde::SpecMP2"); static logvisor::Module Log("urde::SpecMP2");
extern hecl::Database::DataSpecEntry SpecEntMP2; extern hecl::Database::DataSpecEntry SpecEntMP2;
extern hecl::Database::DataSpecEntry SpecEntMP2ORIG; extern hecl::Database::DataSpecEntry SpecEntMP2ORIG;
@ -53,8 +55,8 @@ struct SpecMP2 : SpecBase
for (const nod::Node& child : root) for (const nod::Node& child : root)
{ {
bool isPak = false; bool isPak = false;
const std::string& name = child.getName(); auto name = child.getName();
std::string lowerName = name; std::string lowerName(name);
std::transform(lowerName.begin(), lowerName.end(), lowerName.begin(), tolower); std::transform(lowerName.begin(), lowerName.end(), lowerName.begin(), tolower);
if (name.size() > 4) if (name.size() > 4)
{ {
@ -87,7 +89,7 @@ struct SpecMP2 : SpecBase
{ {
for (const hecl::SystemString& arg : args) for (const hecl::SystemString& arg : args)
{ {
std::string lowerArg = hecl::SystemUTF8View(arg).str(); std::string lowerArg(hecl::SystemUTF8Conv(arg).str());
std::transform(lowerArg.begin(), lowerArg.end(), lowerArg.begin(), tolower); std::transform(lowerArg.begin(), lowerArg.end(), lowerArg.begin(), tolower);
if (!lowerArg.compare(0, lowerBase.size(), lowerBase)) if (!lowerArg.compare(0, lowerBase.size(), lowerBase))
good = true; good = true;
@ -106,7 +108,7 @@ struct SpecMP2 : SpecBase
/* Sort PAKs alphabetically */ /* Sort PAKs alphabetically */
m_orderedPaks.clear(); m_orderedPaks.clear();
for (DNAMP2::PAKBridge& dpak : m_paks) for (DNAMP2::PAKBridge& dpak : m_paks)
m_orderedPaks[dpak.getName()] = &dpak; m_orderedPaks[std::string(dpak.getName())] = &dpak;
/* Assemble extract report */ /* Assemble extract report */
for (const std::pair<std::string, DNAMP2::PAKBridge*>& item : m_orderedPaks) for (const std::pair<std::string, DNAMP2::PAKBridge*>& item : m_orderedPaks)
@ -115,8 +117,8 @@ struct SpecMP2 : SpecBase
continue; continue;
rep.childOpts.emplace_back(); rep.childOpts.emplace_back();
ExtractReport& childRep = rep.childOpts.back(); ExtractReport& childRep = rep.childOpts.back();
hecl::SystemStringView nameView(item.first); hecl::SystemStringConv nameView(item.first);
childRep.name = nameView; childRep.name = hecl::SystemString(nameView.sys_str());
childRep.desc = item.second->getLevelString(); childRep.desc = item.second->getLevelString();
} }
} }
@ -138,7 +140,7 @@ struct SpecMP2 : SpecBase
rep.name = _S("MP2"); rep.name = _S("MP2");
rep.desc = _S("Metroid Prime 2 ") + regstr; rep.desc = _S("Metroid Prime 2 ") + regstr;
std::string buildStr(buildInfo); std::string buildStr(buildInfo);
hecl::SystemStringView buildView(buildStr); hecl::SystemStringConv buildView(buildStr);
rep.desc += _S(" (") + buildView + _S(")"); rep.desc += _S(" (") + buildView + _S(")");
/* Iterate PAKs and build level options */ /* Iterate PAKs and build level options */
@ -201,7 +203,7 @@ struct SpecMP2 : SpecBase
if (buildInfo) if (buildInfo)
{ {
std::string buildStr(buildInfo); std::string buildStr(buildInfo);
hecl::SystemStringView buildView(buildStr); hecl::SystemStringConv buildView(buildStr);
rep.desc += _S(" (") + buildView + _S(")"); rep.desc += _S(" (") + buildView + _S(")");
} }
@ -237,8 +239,8 @@ struct SpecMP2 : SpecBase
mp2OutPath.makeDir(); mp2OutPath.makeDir();
progress(_S("MP2 Root"), _S(""), 3, 0.0); progress(_S("MP2 Root"), _S(""), 3, 0.0);
int prog = 0; int prog = 0;
ctx.progressCB = [&](const std::string& name, float) { ctx.progressCB = [&](std::string_view name, float) {
hecl::SystemStringView nameView(name); hecl::SystemStringConv nameView(name);
progress(_S("MP2 Root"), nameView.c_str(), 3, prog); progress(_S("MP2 Root"), nameView.c_str(), 3, prog);
}; };
for (const nod::Node* node : m_nonPaks) for (const nod::Node* node : m_nonPaks)
@ -258,14 +260,14 @@ struct SpecMP2 : SpecBase
if (!pak.m_doExtract) if (!pak.m_doExtract)
continue; continue;
const std::string& name = pak.getName(); auto name = pak.getName();
hecl::SystemStringView sysName(name); hecl::SystemStringConv sysName(name);
{ {
std::unique_lock<std::mutex> lk(msgLock); std::unique_lock<std::mutex> lk(msgLock);
progress(sysName.c_str(), _S(""), compIdx, 0.0); progress(sysName.c_str(), _S(""), compIdx, 0.0);
} }
hecl::SystemString pakName = sysName.sys_str(); hecl::SystemString pakName = hecl::SystemString(sysName.sys_str());
process.addLambdaTransaction([&, pakName](hecl::BlenderToken& btok) process.addLambdaTransaction([&, pakName](hecl::BlenderToken& btok)
{ {
m_pakRouter.extractResources(pak, force, btok, m_pakRouter.extractResources(pak, force, btok,
@ -405,16 +407,16 @@ struct SpecMP2 : SpecBase
hecl::Database::DataSpecEntry SpecEntMP2 hecl::Database::DataSpecEntry SpecEntMP2
( (
_S("MP2"), _S("MP2"sv),
_S("Data specification for original Metroid Prime 2 engine"), _S("Data specification for original Metroid Prime 2 engine"sv),
[](hecl::Database::Project& project, hecl::Database::DataSpecTool) [](hecl::Database::Project& project, hecl::Database::DataSpecTool)
-> hecl::Database::IDataSpec* {return new struct SpecMP2(&SpecEntMP2, project, false);} -> hecl::Database::IDataSpec* {return new struct SpecMP2(&SpecEntMP2, project, false);}
); );
hecl::Database::DataSpecEntry SpecEntMP2PC = hecl::Database::DataSpecEntry SpecEntMP2PC =
{ {
_S("MP2-PC"), _S("MP2-PC"sv),
_S("Data specification for PC-optimized Metroid Prime 2 engine"), _S("Data specification for PC-optimized Metroid Prime 2 engine"sv),
[](hecl::Database::Project& project, hecl::Database::DataSpecTool tool) [](hecl::Database::Project& project, hecl::Database::DataSpecTool tool)
-> hecl::Database::IDataSpec* -> hecl::Database::IDataSpec*
{ {
@ -426,8 +428,8 @@ hecl::Database::DataSpecEntry SpecEntMP2PC =
hecl::Database::DataSpecEntry SpecEntMP2ORIG = hecl::Database::DataSpecEntry SpecEntMP2ORIG =
{ {
_S("MP2-ORIG"), _S("MP2-ORIG"sv),
_S("Data specification for unmodified Metroid Prime 2 resources"), _S("Data specification for unmodified Metroid Prime 2 resources"sv),
{} {}
}; };

View File

@ -16,6 +16,8 @@
namespace DataSpec namespace DataSpec
{ {
using namespace std::literals;
static logvisor::Module Log("urde::SpecMP3"); static logvisor::Module Log("urde::SpecMP3");
extern hecl::Database::DataSpecEntry SpecEntMP3; extern hecl::Database::DataSpecEntry SpecEntMP3;
extern hecl::Database::DataSpecEntry SpecEntMP3ORIG; extern hecl::Database::DataSpecEntry SpecEntMP3ORIG;
@ -75,8 +77,8 @@ struct SpecMP3 : SpecBase
for (const nod::Node& child : root) for (const nod::Node& child : root)
{ {
bool isPak = false; bool isPak = false;
const std::string& name = child.getName(); auto name = child.getName();
std::string lowerName = name; std::string lowerName(name);
std::transform(lowerName.begin(), lowerName.end(), lowerName.begin(), tolower); std::transform(lowerName.begin(), lowerName.end(), lowerName.begin(), tolower);
if (name.size() > 4) if (name.size() > 4)
{ {
@ -109,7 +111,7 @@ struct SpecMP3 : SpecBase
{ {
for (const hecl::SystemString& arg : args) for (const hecl::SystemString& arg : args)
{ {
std::string lowerArg = hecl::SystemUTF8View(arg).str(); std::string lowerArg(hecl::SystemUTF8Conv(arg).str());
std::transform(lowerArg.begin(), lowerArg.end(), lowerArg.begin(), tolower); std::transform(lowerArg.begin(), lowerArg.end(), lowerArg.begin(), tolower);
if (!lowerArg.compare(0, lowerBase.size(), lowerBase)) if (!lowerArg.compare(0, lowerBase.size(), lowerBase))
good = true; good = true;
@ -138,13 +140,13 @@ struct SpecMP3 : SpecBase
{ {
m_feOrderedPaks.clear(); m_feOrderedPaks.clear();
for (DNAMP3::PAKBridge& dpak : m_fePaks) for (DNAMP3::PAKBridge& dpak : m_fePaks)
m_feOrderedPaks[dpak.getName()] = &dpak; m_feOrderedPaks[std::string(dpak.getName())] = &dpak;
} }
else else
{ {
m_orderedPaks.clear(); m_orderedPaks.clear();
for (DNAMP3::PAKBridge& dpak : m_paks) for (DNAMP3::PAKBridge& dpak : m_paks)
m_orderedPaks[dpak.getName()] = &dpak; m_orderedPaks[std::string(dpak.getName())] = &dpak;
} }
/* Assemble extract report */ /* Assemble extract report */
@ -154,8 +156,8 @@ struct SpecMP3 : SpecBase
continue; continue;
rep.childOpts.emplace_back(); rep.childOpts.emplace_back();
ExtractReport& childRep = rep.childOpts.back(); ExtractReport& childRep = rep.childOpts.back();
hecl::SystemStringView nameView(item.first); hecl::SystemStringConv nameView(item.first);
childRep.name = nameView; childRep.name = hecl::SystemString(nameView.sys_str());
if (!item.first.compare("Worlds.pak")) if (!item.first.compare("Worlds.pak"))
continue; continue;
else if (!item.first.compare("Metroid6.pak")) else if (!item.first.compare("Metroid6.pak"))
@ -196,7 +198,7 @@ struct SpecMP3 : SpecBase
rep.name = _S("MP3"); rep.name = _S("MP3");
rep.desc = _S("Metroid Prime 3 ") + regstr; rep.desc = _S("Metroid Prime 3 ") + regstr;
std::string buildStr(buildInfo); std::string buildStr(buildInfo);
hecl::SystemStringView buildView(buildStr); hecl::SystemStringConv buildView(buildStr);
rep.desc += _S(" (") + buildView + _S(")"); rep.desc += _S(" (") + buildView + _S(")");
/* Iterate PAKs and build level options */ /* Iterate PAKs and build level options */
@ -293,7 +295,7 @@ struct SpecMP3 : SpecBase
rep.desc = _S("Metroid Prime 3 ") + regstr; rep.desc = _S("Metroid Prime 3 ") + regstr;
std::string buildStr(buildInfo); std::string buildStr(buildInfo);
hecl::SystemStringView buildView(buildStr); hecl::SystemStringConv buildView(buildStr);
rep.desc += _S(" (") + buildView + _S(")"); rep.desc += _S(" (") + buildView + _S(")");
@ -329,7 +331,7 @@ struct SpecMP3 : SpecBase
if (buildInfo) if (buildInfo)
{ {
std::string buildStr(buildInfo); std::string buildStr(buildInfo);
hecl::SystemStringView buildView(buildStr); hecl::SystemStringConv buildView(buildStr);
rep.desc += _S(" (") + buildView + _S(")"); rep.desc += _S(" (") + buildView + _S(")");
} }
@ -354,9 +356,9 @@ struct SpecMP3 : SpecBase
size_t nodeCount = 0; size_t nodeCount = 0;
int prog = 0; int prog = 0;
nod::ExtractionContext ctx = {force, nod::ExtractionContext ctx = {force,
[&](const std::string& name, float) [&](std::string_view name, float)
{ {
hecl::SystemStringView nameView(name); hecl::SystemStringConv nameView(name);
progress(currentTarget.c_str(), nameView.c_str(), compIdx, prog / (float)nodeCount); progress(currentTarget.c_str(), nameView.c_str(), compIdx, prog / (float)nodeCount);
}}; }};
if (doMP3) if (doMP3)
@ -398,14 +400,14 @@ struct SpecMP3 : SpecBase
if (!pak.m_doExtract) if (!pak.m_doExtract)
continue; continue;
const std::string& name = pak.getName(); auto name = pak.getName();
hecl::SystemStringView sysName(name); hecl::SystemStringConv sysName(name);
{ {
std::unique_lock<std::mutex> lk(msgLock); std::unique_lock<std::mutex> lk(msgLock);
progress(sysName.c_str(), _S(""), compIdx, 0.0); progress(sysName.c_str(), _S(""), compIdx, 0.0);
} }
hecl::SystemString pakName = sysName.sys_str(); hecl::SystemString pakName = hecl::SystemString(sysName.sys_str());
process.addLambdaTransaction([&, pakName](hecl::BlenderToken& btok) process.addLambdaTransaction([&, pakName](hecl::BlenderToken& btok)
{ {
m_pakRouter.extractResources(pak, force, btok, m_pakRouter.extractResources(pak, force, btok,
@ -457,14 +459,14 @@ struct SpecMP3 : SpecBase
if (!pak.m_doExtract) if (!pak.m_doExtract)
continue; continue;
const std::string& name = pak.getName(); auto name = pak.getName();
hecl::SystemStringView sysName(name); hecl::SystemStringConv sysName(name);
{ {
std::unique_lock<std::mutex> lk(msgLock); std::unique_lock<std::mutex> lk(msgLock);
progress(sysName.c_str(), _S(""), compIdx, 0.0); progress(sysName.c_str(), _S(""), compIdx, 0.0);
} }
hecl::SystemString pakName = sysName.sys_str(); hecl::SystemString pakName(sysName.sys_str());
process.addLambdaTransaction([&, pakName](hecl::BlenderToken& btok) process.addLambdaTransaction([&, pakName](hecl::BlenderToken& btok)
{ {
m_fePakRouter.extractResources(pak, force, btok, m_fePakRouter.extractResources(pak, force, btok,
@ -591,16 +593,16 @@ struct SpecMP3 : SpecBase
hecl::Database::DataSpecEntry SpecEntMP3 hecl::Database::DataSpecEntry SpecEntMP3
( (
_S("MP3"), _S("MP3"sv),
_S("Data specification for original Metroid Prime 3 engine"), _S("Data specification for original Metroid Prime 3 engine"sv),
[](hecl::Database::Project& project, hecl::Database::DataSpecTool) [](hecl::Database::Project& project, hecl::Database::DataSpecTool)
-> hecl::Database::IDataSpec* {return new struct SpecMP3(&SpecEntMP3, project, false);} -> hecl::Database::IDataSpec* {return new struct SpecMP3(&SpecEntMP3, project, false);}
); );
hecl::Database::DataSpecEntry SpecEntMP3PC = hecl::Database::DataSpecEntry SpecEntMP3PC =
{ {
_S("MP3-PC"), _S("MP3-PC"sv),
_S("Data specification for PC-optimized Metroid Prime 3 engine"), _S("Data specification for PC-optimized Metroid Prime 3 engine"sv),
[](hecl::Database::Project& project, hecl::Database::DataSpecTool tool) [](hecl::Database::Project& project, hecl::Database::DataSpecTool tool)
-> hecl::Database::IDataSpec* -> hecl::Database::IDataSpec*
{ {
@ -612,8 +614,8 @@ hecl::Database::DataSpecEntry SpecEntMP3PC =
hecl::Database::DataSpecEntry SpecEntMP3ORIG = hecl::Database::DataSpecEntry SpecEntMP3ORIG =
{ {
_S("MP3-ORIG"), _S("MP3-ORIG"sv),
_S("Data specification for unmodified Metroid Prime 3 resources"), _S("Data specification for unmodified Metroid Prime 3 resources"sv),
{} {}
}; };

View File

@ -7,7 +7,7 @@ namespace urde
static logvisor::Module Log("URDE::ProjectManager"); static logvisor::Module Log("URDE::ProjectManager");
ProjectManager* ProjectManager::g_SharedManager = nullptr; ProjectManager* ProjectManager::g_SharedManager = nullptr;
CToken ProjectResourcePool::GetObj(const char* name) CToken ProjectResourcePool::GetObj(std::string_view name)
{ {
CToken ret = CSimplePool::GetObj(name); CToken ret = CSimplePool::GetObj(name);
if (ret) if (ret)
@ -22,7 +22,7 @@ CToken ProjectResourcePool::GetObj(const char* name)
return {}; return {};
} }
CToken ProjectResourcePool::GetObj(const char* name, const CVParamTransfer& pvxfer) CToken ProjectResourcePool::GetObj(std::string_view name, const CVParamTransfer& pvxfer)
{ {
CToken ret = CSimplePool::GetObj(name, pvxfer); CToken ret = CSimplePool::GetObj(name, pvxfer);
if (ret) if (ret)
@ -49,16 +49,16 @@ ProjectManager::ProjectManager(ViewManager &vm)
g_SharedManager = this; g_SharedManager = this;
} }
bool ProjectManager::newProject(const hecl::SystemString& path) bool ProjectManager::newProject(hecl::SystemStringView path)
{ {
hecl::ProjectRootPath projPath = hecl::SearchForProject(path); hecl::ProjectRootPath projPath = hecl::SearchForProject(path);
if (projPath) if (projPath)
{ {
Log.report(logvisor::Warning, _S("project already exists at '%s'"), path.c_str()); Log.report(logvisor::Warning, _S("project already exists at '%s'"), path.data());
return false; return false;
} }
hecl::MakeDir(path.c_str()); hecl::MakeDir(path.data());
m_proj.reset(new hecl::Database::Project(path)); m_proj.reset(new hecl::Database::Project(path));
if (!*m_proj) if (!*m_proj)
{ {
@ -79,13 +79,13 @@ bool ProjectManager::newProject(const hecl::SystemString& path)
return true; return true;
} }
bool ProjectManager::openProject(const hecl::SystemString& path) bool ProjectManager::openProject(hecl::SystemStringView path)
{ {
hecl::SystemString subPath; hecl::SystemString subPath;
hecl::ProjectRootPath projPath = hecl::SearchForProject(path, subPath); hecl::ProjectRootPath projPath = hecl::SearchForProject(path, subPath);
if (!projPath) if (!projPath)
{ {
Log.report(logvisor::Warning, _S("project doesn't exist at '%s'"), path.c_str()); Log.report(logvisor::Warning, _S("project doesn't exist at '%s'"), path.data());
return false; return false;
} }
@ -182,7 +182,7 @@ makeProj:
return true; return true;
} }
bool ProjectManager::extractGame(const hecl::SystemString& path) bool ProjectManager::extractGame(hecl::SystemStringView path)
{ {
return false; return false;
} }
@ -204,9 +204,9 @@ bool ProjectManager::saveProject()
hecl::ProjectPath newSpacesPath(*m_proj, _S(".hecl/urde_spaces.yaml")); hecl::ProjectPath newSpacesPath(*m_proj, _S(".hecl/urde_spaces.yaml"));
hecl::Unlink(newSpacesPath.getAbsolutePath().c_str()); hecl::Unlink(newSpacesPath.getAbsolutePath().data());
hecl::Rename(oldSpacesPath.getAbsolutePath().c_str(), hecl::Rename(oldSpacesPath.getAbsolutePath().data(),
newSpacesPath.getAbsolutePath().c_str()); newSpacesPath.getAbsolutePath().data());
m_vm.pushRecentProject(m_proj->getProjectRootPath().getAbsolutePath()); m_vm.pushRecentProject(m_proj->getProjectRootPath().getAbsolutePath());

View File

@ -21,8 +21,8 @@ class ProjectResourcePool : public CSimplePool
public: public:
ProjectResourcePool(IFactory& factory, ProjectManager& parent) ProjectResourcePool(IFactory& factory, ProjectManager& parent)
: CSimplePool(factory), m_parent(parent) {} : CSimplePool(factory), m_parent(parent) {}
CToken GetObj(const char*); CToken GetObj(std::string_view);
CToken GetObj(const char*, const CVParamTransfer&); CToken GetObj(std::string_view, const CVParamTransfer&);
}; };
class ProjectManager class ProjectManager
@ -45,12 +45,12 @@ public:
ProjectResourcePool& objectStore() {return m_objStore;} ProjectResourcePool& objectStore() {return m_objStore;}
ProjectResourceFactoryMP1& resourceFactoryMP1() {return m_factoryMP1;} ProjectResourceFactoryMP1& resourceFactoryMP1() {return m_factoryMP1;}
MP1::CMain* gameMain() {return m_mainMP1 ? &*m_mainMP1 : nullptr;} MP1::CMain* gameMain() {return m_mainMP1 ? &*m_mainMP1 : nullptr;}
SObjectTag TagFromPath(const hecl::SystemChar* path) const SObjectTag TagFromPath(hecl::SystemStringView path) const
{ return m_factoryMP1.ProjectResourceFactoryBase::TagFromPath(path); } { return m_factoryMP1.ProjectResourceFactoryBase::TagFromPath(path); }
bool newProject(const hecl::SystemString& path); bool newProject(hecl::SystemStringView path);
bool openProject(const hecl::SystemString& path); bool openProject(hecl::SystemStringView path);
bool extractGame(const hecl::SystemString& path); bool extractGame(hecl::SystemStringView path);
bool saveProject(); bool saveProject();
void mainUpdate(); void mainUpdate();

View File

@ -20,7 +20,7 @@ void ProjectResourceFactoryBase::BeginBackgroundIndex
bool ProjectResourceFactoryBase::SyncCook(const hecl::ProjectPath& working) bool ProjectResourceFactoryBase::SyncCook(const hecl::ProjectPath& working)
{ {
Log.report(logvisor::Warning, _S("sync-cooking %s"), working.getRelativePath().c_str()); Log.report(logvisor::Warning, _S("sync-cooking %s"), working.getRelativePath().data());
return m_clientProc.syncCook(working, m_cookSpec.get(), hecl::SharedBlenderToken); return m_clientProc.syncCook(working, m_cookSpec.get(), hecl::SharedBlenderToken);
} }
@ -42,13 +42,13 @@ CFactoryFnReturn ProjectResourceFactoryBase::BuildSync(const SObjectTag& tag,
CFactoryFnReturn ret = CFactoryFnReturn ret =
m_factoryMgr.MakeObjectFromMemory(tag, std::move(memBuf), length, false, paramXfer, selfRef); m_factoryMgr.MakeObjectFromMemory(tag, std::move(memBuf), length, false, paramXfer, selfRef);
Log.report(logvisor::Info, "sync-built %.4s %08X", Log.report(logvisor::Info, "sync-built %.4s %08X",
tag.type.toString().c_str(), u32(tag.id.Value())); tag.type.getChars(), u32(tag.id.Value()));
return ret; return ret;
} }
CFactoryFnReturn ret = m_factoryMgr.MakeObject(tag, *fr, paramXfer, selfRef); CFactoryFnReturn ret = m_factoryMgr.MakeObject(tag, *fr, paramXfer, selfRef);
Log.report(logvisor::Info, "sync-built %.4s %08X", Log.report(logvisor::Info, "sync-built %.4s %08X",
tag.type.toString().c_str(), u32(tag.id.Value())); tag.type.getChars(), u32(tag.id.Value()));
return ret; return ret;
} }
@ -63,7 +63,7 @@ void ProjectResourceFactoryBase::AsyncTask::EnsurePath(const urde::SObjectTag& t
if (!path.isFileOrGlob()) if (!path.isFileOrGlob())
{ {
Log.report(logvisor::Error, _S("unable to find resource path '%s'"), Log.report(logvisor::Error, _S("unable to find resource path '%s'"),
path.getRelativePath().c_str()); path.getRelativePath().data());
m_failed = true; m_failed = true;
return; return;
} }
@ -80,8 +80,8 @@ void ProjectResourceFactoryBase::AsyncTask::EnsurePath(const urde::SObjectTag& t
if (verifyTag.type != tag.type) if (verifyTag.type != tag.type)
{ {
Log.report(logvisor::Error, _S("%s: expected type '%.4s', found '%.4s'"), Log.report(logvisor::Error, _S("%s: expected type '%.4s', found '%.4s'"),
path.getRelativePath().c_str(), path.getRelativePath().data(),
tag.type.toString().c_str(), verifyTag.type.toString().c_str()); tag.type.getChars(), verifyTag.type.getChars());
m_failed = true; m_failed = true;
return; return;
} }
@ -110,7 +110,7 @@ void ProjectResourceFactoryBase::AsyncTask::CookComplete()
if (fr.hasError()) if (fr.hasError())
{ {
Log.report(logvisor::Error, _S("unable to open cooked resource path '%s'"), Log.report(logvisor::Error, _S("unable to open cooked resource path '%s'"),
m_cookedPath.getAbsolutePath().c_str()); m_cookedPath.getAbsolutePath().data());
m_failed = true; m_failed = true;
return; return;
} }
@ -214,7 +214,7 @@ ProjectResourceFactoryBase::PrepForReadSync(const SObjectTag& tag,
if (!path.isFileOrGlob()) if (!path.isFileOrGlob())
{ {
Log.report(logvisor::Error, _S("unable to find resource path '%s'"), Log.report(logvisor::Error, _S("unable to find resource path '%s'"),
path.getAbsolutePath().c_str()); path.getAbsolutePath().data());
return false; return false;
} }
@ -230,8 +230,8 @@ ProjectResourceFactoryBase::PrepForReadSync(const SObjectTag& tag,
if (verifyTag.type != tag.type) if (verifyTag.type != tag.type)
{ {
Log.report(logvisor::Error, _S("%s: expected type '%.4s', found '%.4s'"), Log.report(logvisor::Error, _S("%s: expected type '%.4s', found '%.4s'"),
path.getRelativePath().c_str(), path.getRelativePath().data(),
tag.type.toString().c_str(), verifyTag.type.toString().c_str()); tag.type.getChars(), verifyTag.type.getChars());
return false; return false;
} }
@ -246,7 +246,7 @@ ProjectResourceFactoryBase::PrepForReadSync(const SObjectTag& tag,
if (!SyncCook(path)) if (!SyncCook(path))
{ {
Log.report(logvisor::Error, _S("unable to cook resource path '%s'"), Log.report(logvisor::Error, _S("unable to cook resource path '%s'"),
path.getAbsolutePath().c_str()); path.getAbsolutePath().data());
return false; return false;
} }
} }
@ -257,7 +257,7 @@ ProjectResourceFactoryBase::PrepForReadSync(const SObjectTag& tag,
if (fr->hasError()) if (fr->hasError())
{ {
Log.report(logvisor::Error, _S("unable to open cooked resource path '%s'"), Log.report(logvisor::Error, _S("unable to open cooked resource path '%s'"),
cooked.getAbsolutePath().c_str()); cooked.getAbsolutePath().data());
return false; return false;
} }
@ -269,7 +269,7 @@ std::unique_ptr<urde::IObj> ProjectResourceFactoryBase::Build(const urde::SObjec
CObjectReference* selfRef) CObjectReference* selfRef)
{ {
if (!tag.id.IsValid()) if (!tag.id.IsValid())
Log.report(logvisor::Fatal, "attempted to access null id on type '%s'", tag.type.toString().c_str()); Log.report(logvisor::Fatal, "attempted to access null id on type '%.4s'", tag.type.getChars());
const hecl::ProjectPath* resPath = nullptr; const hecl::ProjectPath* resPath = nullptr;
if (!WaitForTagReady(tag, resPath)) if (!WaitForTagReady(tag, resPath))
@ -301,7 +301,7 @@ std::unique_ptr<urde::IObj> ProjectResourceFactoryBase::Build(const urde::SObjec
//*task.xc_targetObjPtr = newObj.get(); //*task.xc_targetObjPtr = newObj.get();
Log.report(logvisor::Warning, "spin-built %.4s %08X", Log.report(logvisor::Warning, "spin-built %.4s %08X",
task.x0_tag.type.toString().c_str(), u32(task.x0_tag.id.Value())); task.x0_tag.type.getChars(), u32(task.x0_tag.id.Value()));
_RemoveTask(asyncSearch); _RemoveTask(asyncSearch);
return newObj; return newObj;
@ -309,12 +309,12 @@ std::unique_ptr<urde::IObj> ProjectResourceFactoryBase::Build(const urde::SObjec
else if (task.m_complete) else if (task.m_complete)
{ {
Log.report(logvisor::Error, "unable to spin-build %.4s %08X; Resource requested as cook-only", Log.report(logvisor::Error, "unable to spin-build %.4s %08X; Resource requested as cook-only",
task.x0_tag.type.toString().c_str(), u32(task.x0_tag.id.Value())); task.x0_tag.type.getChars(), u32(task.x0_tag.id.Value()));
} }
else else
{ {
Log.report(logvisor::Error, "unable to spin-build %.4s %08X", Log.report(logvisor::Error, "unable to spin-build %.4s %08X",
task.x0_tag.type.toString().c_str(), u32(task.x0_tag.id.Value())); task.x0_tag.type.getChars(), u32(task.x0_tag.id.Value()));
} }
_RemoveTask(asyncSearch); _RemoveTask(asyncSearch);
@ -342,7 +342,7 @@ void ProjectResourceFactoryBase::BuildAsync(const urde::SObjectTag& tag,
CObjectReference* selfRef) CObjectReference* selfRef)
{ {
if (!tag.id.IsValid()) if (!tag.id.IsValid())
Log.report(logvisor::Fatal, "attempted to access null id on type '%s'", tag.type.toString().c_str()); Log.report(logvisor::Fatal, "attempted to access null id on type '%.4s'", tag.type.getChars());
BuildAsyncInternal(tag, paramXfer, objOut, selfRef); BuildAsyncInternal(tag, paramXfer, objOut, selfRef);
} }
@ -350,7 +350,7 @@ void ProjectResourceFactoryBase::BuildAsync(const urde::SObjectTag& tag,
u32 ProjectResourceFactoryBase::ResourceSize(const SObjectTag& tag) u32 ProjectResourceFactoryBase::ResourceSize(const SObjectTag& tag)
{ {
if (!tag.id.IsValid()) if (!tag.id.IsValid())
Log.report(logvisor::Fatal, "attempted to access null id on type '%s'", tag.type.toString().c_str()); Log.report(logvisor::Fatal, "attempted to access null id on type '%.4s'", tag.type.getChars());
/* Ensure resource at requested path is indexed and not cooking */ /* Ensure resource at requested path is indexed and not cooking */
const hecl::ProjectPath* resPath = nullptr; const hecl::ProjectPath* resPath = nullptr;
@ -455,7 +455,7 @@ bool ProjectResourceFactoryBase::CanBuild(const urde::SObjectTag& tag)
return false; return false;
} }
const urde::SObjectTag* ProjectResourceFactoryBase::GetResourceIdByName(const char* name) const const urde::SObjectTag* ProjectResourceFactoryBase::GetResourceIdByName(std::string_view name) const
{ {
return static_cast<DataSpec::SpecBase&>(*m_cookSpec).getResourceIdByName(name); return static_cast<DataSpec::SpecBase&>(*m_cookSpec).getResourceIdByName(name);
} }
@ -471,7 +471,7 @@ void ProjectResourceFactoryBase::EnumerateResources(const std::function<bool(con
} }
void ProjectResourceFactoryBase::EnumerateNamedResources( void ProjectResourceFactoryBase::EnumerateNamedResources(
const std::function<bool(const std::string&, const SObjectTag&)>& lambda) const const std::function<bool(std::string_view, const SObjectTag&)>& lambda) const
{ {
return static_cast<DataSpec::SpecBase&>(*m_cookSpec).enumerateNamedResources(lambda); return static_cast<DataSpec::SpecBase&>(*m_cookSpec).enumerateNamedResources(lambda);
} }
@ -486,8 +486,8 @@ bool ProjectResourceFactoryBase::AsyncPumpTask(ItType& it)
{ {
if (!static_cast<DataSpec::SpecBase&>(*m_cookSpec).backgroundIndexRunning()) if (!static_cast<DataSpec::SpecBase&>(*m_cookSpec).backgroundIndexRunning())
{ {
Log.report(logvisor::Error, _S("unable to find async load resource (%s, %08X)"), Log.report(logvisor::Error, _S("unable to find async load resource (%.4s, %08X)"),
task.x0_tag.type.toString().c_str(), task.x0_tag.id); task.x0_tag.type.getChars(), task.x0_tag.id);
it = _RemoveTask(it); it = _RemoveTask(it);
} }
return true; return true;
@ -518,7 +518,7 @@ bool ProjectResourceFactoryBase::AsyncPumpTask(ItType& it)
*task.xc_targetObjPtr = std::move(newObj); *task.xc_targetObjPtr = std::move(newObj);
Log.report(logvisor::Info, "async-built %.4s %08X", Log.report(logvisor::Info, "async-built %.4s %08X",
task.x0_tag.type.toString().c_str(), task.x0_tag.type.getChars(),
u32(task.x0_tag.id.Value())); u32(task.x0_tag.id.Value()));
} }
else if (task.xc_targetDataPtr) else if (task.xc_targetDataPtr)
@ -526,14 +526,14 @@ bool ProjectResourceFactoryBase::AsyncPumpTask(ItType& it)
/* Buffer only */ /* Buffer only */
*task.xc_targetDataPtr = std::move(task.x10_loadBuffer); *task.xc_targetDataPtr = std::move(task.x10_loadBuffer);
Log.report(logvisor::Info, "async-loaded %.4s %08X", Log.report(logvisor::Info, "async-loaded %.4s %08X",
task.x0_tag.type.toString().c_str(), task.x0_tag.type.getChars(),
u32(task.x0_tag.id.Value())); u32(task.x0_tag.id.Value()));
} }
else if (task.xc_targetDataRawPtr) else if (task.xc_targetDataRawPtr)
{ {
/* Buffer only raw */ /* Buffer only raw */
Log.report(logvisor::Info, "async-loaded %.4s %08X", Log.report(logvisor::Info, "async-loaded %.4s %08X",
task.x0_tag.type.toString().c_str(), task.x0_tag.type.getChars(),
u32(task.x0_tag.id.Value())); u32(task.x0_tag.id.Value()));
} }
} }

View File

@ -150,7 +150,7 @@ public:
void BuildAsync(const urde::SObjectTag&, const urde::CVParamTransfer&, std::unique_ptr<urde::IObj>*, CObjectReference* selfRef); void BuildAsync(const urde::SObjectTag&, const urde::CVParamTransfer&, std::unique_ptr<urde::IObj>*, CObjectReference* selfRef);
void CancelBuild(const urde::SObjectTag&); void CancelBuild(const urde::SObjectTag&);
bool CanBuild(const urde::SObjectTag&); bool CanBuild(const urde::SObjectTag&);
const urde::SObjectTag* GetResourceIdByName(const char*) const; const urde::SObjectTag* GetResourceIdByName(std::string_view) const;
FourCC GetResourceTypeById(CAssetId id) const; FourCC GetResourceTypeById(CAssetId id) const;
hecl::ProjectPath GetCookedPath(const hecl::ProjectPath& working, bool pcTarget) const hecl::ProjectPath GetCookedPath(const hecl::ProjectPath& working, bool pcTarget) const
{ {
@ -158,7 +158,7 @@ public:
} }
void EnumerateResources(const std::function<bool(const SObjectTag&)>& lambda) const; void EnumerateResources(const std::function<bool(const SObjectTag&)>& lambda) const;
void EnumerateNamedResources(const std::function<bool(const std::string&, const SObjectTag&)>& lambda) const; void EnumerateNamedResources(const std::function<bool(std::string_view, const SObjectTag&)>& lambda) const;
u32 ResourceSize(const SObjectTag& tag); u32 ResourceSize(const SObjectTag& tag);
std::shared_ptr<urde::IDvdRequest> LoadResourceAsync(const urde::SObjectTag& tag, void* target); std::shared_ptr<urde::IDvdRequest> LoadResourceAsync(const urde::SObjectTag& tag, void* target);
@ -174,7 +174,7 @@ public:
void Shutdown() { CancelBackgroundIndex(); } void Shutdown() { CancelBackgroundIndex(); }
bool IsBusy() const { return m_asyncLoadMap.size() != 0; } bool IsBusy() const { return m_asyncLoadMap.size() != 0; }
SObjectTag TagFromPath(const hecl::SystemChar* path) const SObjectTag TagFromPath(hecl::SystemStringView path) const
{ {
return TagFromPath(hecl::ProjectPath(*(hecl::Database::Project*)m_proj, path), return TagFromPath(hecl::ProjectPath(*(hecl::Database::Project*)m_proj, path),
hecl::SharedBlenderToken); hecl::SharedBlenderToken);

View File

@ -55,34 +55,34 @@ class ResourceBrowser : public Space, public specter::IPathButtonsBinding
size_t columnCount() const {return 3;} size_t columnCount() const {return 3;}
size_t rowCount() const {return m_entries.size();} size_t rowCount() const {return m_entries.size();}
const std::string* header(size_t cIdx) const std::string_view header(size_t cIdx) const
{ {
switch (cIdx) switch (cIdx)
{ {
case 0: case 0:
return &m_nameCol; return m_nameCol;
case 1: case 1:
return &m_typeCol; return m_typeCol;
case 2: case 2:
return &m_sizeCol; return m_sizeCol;
default: break; default: break;
} }
return nullptr; return {};
} }
const std::string* cell(size_t cIdx, size_t rIdx) const std::string_view cell(size_t cIdx, size_t rIdx) const
{ {
switch (cIdx) switch (cIdx)
{ {
case 0: case 0:
return &m_entries.at(rIdx).m_name; return m_entries.at(rIdx).m_name;
case 1: case 1:
return &m_entries.at(rIdx).m_type; return m_entries.at(rIdx).m_type;
case 2: case 2:
return &m_entries.at(rIdx).m_size; return m_entries.at(rIdx).m_size;
default: break; default: break;
} }
return nullptr; return {};
} }
bool columnSplitResizeAllowed() const {return true;} bool columnSplitResizeAllowed() const {return true;}
@ -107,7 +107,7 @@ class ResourceBrowser : public Space, public specter::IPathButtonsBinding
m_entries.emplace_back(); m_entries.emplace_back();
Entry& ent = m_entries.back(); Entry& ent = m_entries.back();
ent.m_path = d.m_path; ent.m_path = d.m_path;
hecl::SystemUTF8View nameUtf8(d.m_name); hecl::SystemUTF8Conv nameUtf8(d.m_name);
ent.m_name = nameUtf8.str(); ent.m_name = nameUtf8.str();
if (d.m_isDir) if (d.m_isDir)
{ {

View File

@ -111,7 +111,7 @@ public:
struct SpaceSelectBind : specter::IButtonBinding struct SpaceSelectBind : specter::IButtonBinding
{ {
Space& m_space; Space& m_space;
const char* name(const specter::Control* control) const {return SpaceMenuNode::s_text.c_str();} std::string_view name(const specter::Control* control) const {return SpaceMenuNode::s_text;}
MenuStyle menuStyle(const specter::Button* button) const {return MenuStyle::Primary;} MenuStyle menuStyle(const specter::Button* button) const {return MenuStyle::Primary;}
std::unique_ptr<specter::View> buildMenu(const specter::Button* button); std::unique_ptr<specter::View> buildMenu(const specter::Button* button);
@ -384,7 +384,7 @@ class TestSpace : public Space
specter::IButtonBinding* m_binding; specter::IButtonBinding* m_binding;
public: public:
TestSpace(ViewManager& vm, Space* parent, const std::string& content, const std::string& button, TestSpace(ViewManager& vm, Space* parent, std::string_view content, std::string_view button,
specter::IButtonBinding* binding) specter::IButtonBinding* binding)
: Space(vm, Class::TestSpace, parent), m_contentStr(content), m_buttonStr(button), m_binding(binding) : Space(vm, Class::TestSpace, parent), m_contentStr(content), m_buttonStr(button), m_binding(binding)
{} {}

View File

@ -41,9 +41,9 @@ SplashScreen::SplashScreen(ViewManager& vm, specter::ViewResources& res)
GIT_BRANCH[0] != '\0') GIT_BRANCH[0] != '\0')
{ {
m_buildInfoStr = hecl::Format("%s: %s\n%s: %s\n%s: %s", m_buildInfoStr = hecl::Format("%s: %s\n%s: %s\n%s: %s",
vm.translateOr("branch", "Branch").c_str(), GIT_BRANCH, vm.translateOr("branch", "Branch").data(), GIT_BRANCH,
vm.translateOr("commit", "Commit").c_str(), GIT_COMMIT_HASH, vm.translateOr("commit", "Commit").data(), GIT_COMMIT_HASH,
vm.translateOr("date", "Date").c_str(), GIT_COMMIT_DATE); vm.translateOr("date", "Date").data(), GIT_COMMIT_DATE);
} }
m_openProjBind.m_openRecentMenuRoot.m_text = vm.translateOr("recent_projects", "Recent Projects"); m_openProjBind.m_openRecentMenuRoot.m_text = vm.translateOr("recent_projects", "Recent Projects");

View File

@ -41,15 +41,15 @@ class SplashScreen : public specter::ModalWindow
SplashScreen& m_splash; SplashScreen& m_splash;
hecl::SystemString m_deferPath; hecl::SystemString m_deferPath;
NewProjBinding(SplashScreen& splash) : m_splash(splash) {} NewProjBinding(SplashScreen& splash) : m_splash(splash) {}
const char* name(const specter::Control* control) const {return m_splash.m_newString.c_str();} std::string_view name(const specter::Control* control) const {return m_splash.m_newString.c_str();}
const char* help(const specter::Control* control) const {return "Creates an empty project at selected path";} std::string_view help(const specter::Control* control) const {return "Creates an empty project at selected path";}
void activated(const specter::Button* button, const boo::SWindowCoord& coord) void activated(const specter::Button* button, const boo::SWindowCoord& coord)
{ {
m_splash.m_fileBrowser.m_view.reset( m_splash.m_fileBrowser.m_view.reset(
new specter::FileBrowser(m_splash.rootView().viewRes(), new specter::FileBrowser(m_splash.rootView().viewRes(),
m_splash, m_splash.m_newString, m_splash, m_splash.m_newString,
specter::FileBrowser::Type::NewHECLProject, specter::FileBrowser::Type::NewHECLProject,
[&](bool ok, const hecl::SystemString& path) [&](bool ok, hecl::SystemStringView path)
{ {
if (ok) if (ok)
m_deferPath = path; m_deferPath = path;
@ -64,15 +64,15 @@ class SplashScreen : public specter::ModalWindow
SplashScreen& m_splash; SplashScreen& m_splash;
hecl::SystemString m_deferPath; hecl::SystemString m_deferPath;
OpenProjBinding(SplashScreen& splash) : m_splash(splash), m_openRecentMenuRoot(*this) {} OpenProjBinding(SplashScreen& splash) : m_splash(splash), m_openRecentMenuRoot(*this) {}
const char* name(const specter::Control* control) const {return m_splash.m_openString.c_str();} std::string_view name(const specter::Control* control) const {return m_splash.m_openString.c_str();}
const char* help(const specter::Control* control) const {return "Opens an existing project at selected path";} std::string_view help(const specter::Control* control) const {return "Opens an existing project at selected path";}
void activated(const specter::Button* button, const boo::SWindowCoord& coord) void activated(const specter::Button* button, const boo::SWindowCoord& coord)
{ {
m_splash.m_fileBrowser.m_view.reset( m_splash.m_fileBrowser.m_view.reset(
new specter::FileBrowser(m_splash.rootView().viewRes(), new specter::FileBrowser(m_splash.rootView().viewRes(),
m_splash, m_splash.m_openString, m_splash, m_splash.m_openString,
specter::FileBrowser::Type::OpenHECLProject, specter::FileBrowser::Type::OpenHECLProject,
[&](bool ok, const hecl::SystemString& path) [&](bool ok, hecl::SystemStringView path)
{ {
if (ok) if (ok)
m_deferPath = path; m_deferPath = path;
@ -108,7 +108,7 @@ class SplashScreen : public specter::ModalWindow
{ {
std::vector<hecl::SystemString> pathComps = specter::FileBrowser::PathComponents(path); std::vector<hecl::SystemString> pathComps = specter::FileBrowser::PathComponents(path);
if (pathComps.size()) if (pathComps.size())
m_text = hecl::SystemUTF8View(pathComps.back()).str(); m_text = hecl::SystemUTF8Conv(pathComps.back()).str();
} }
}; };
std::vector<OpenRecentMenuItem> m_items; std::vector<OpenRecentMenuItem> m_items;
@ -142,15 +142,15 @@ class SplashScreen : public specter::ModalWindow
SplashScreen& m_splash; SplashScreen& m_splash;
hecl::SystemString m_deferPath; hecl::SystemString m_deferPath;
ExtractProjBinding(SplashScreen& splash) : m_splash(splash) {} ExtractProjBinding(SplashScreen& splash) : m_splash(splash) {}
const char* name(const specter::Control* control) const {return m_splash.m_extractString.c_str();} std::string_view name(const specter::Control* control) const {return m_splash.m_extractString.c_str();}
const char* help(const specter::Control* control) const {return "Extracts game image as project at selected path";} std::string_view help(const specter::Control* control) const {return "Extracts game image as project at selected path";}
void activated(const specter::Button* button, const boo::SWindowCoord& coord) void activated(const specter::Button* button, const boo::SWindowCoord& coord)
{ {
m_splash.m_fileBrowser.m_view.reset( m_splash.m_fileBrowser.m_view.reset(
new specter::FileBrowser(m_splash.rootView().viewRes(), new specter::FileBrowser(m_splash.rootView().viewRes(),
m_splash, m_splash.m_extractString, m_splash, m_splash.m_extractString,
specter::FileBrowser::Type::OpenFile, specter::FileBrowser::Type::OpenFile,
[&](bool ok, const hecl::SystemString& path) [&](bool ok, hecl::SystemStringView path)
{ {
if (ok) if (ok)
m_deferPath = path; m_deferPath = path;

View File

@ -121,8 +121,8 @@ void ViewManager::DismissSplash()
ViewManager::ViewManager(hecl::Runtime::FileStoreManager& fileMgr, hecl::CVarManager& cvarMgr) ViewManager::ViewManager(hecl::Runtime::FileStoreManager& fileMgr, hecl::CVarManager& cvarMgr)
: m_fileStoreManager(fileMgr), m_cvarManager(cvarMgr), m_projManager(*this), : m_fileStoreManager(fileMgr), m_cvarManager(cvarMgr), m_projManager(*this),
m_fontCache(fileMgr), m_translator(urde::SystemLocaleOrEnglish()), m_fontCache(fileMgr), m_translator(urde::SystemLocaleOrEnglish()),
m_recentProjectsPath(hecl::SysFormat(_S("%s/recent_projects.txt"), fileMgr.getStoreRoot().c_str())), m_recentProjectsPath(hecl::SysFormat(_S("%s/recent_projects.txt"), fileMgr.getStoreRoot().data())),
m_recentFilesPath(hecl::SysFormat(_S("%s/recent_files.txt"), fileMgr.getStoreRoot().c_str())) m_recentFilesPath(hecl::SysFormat(_S("%s/recent_files.txt"), fileMgr.getStoreRoot().data()))
{ {
Space::SpaceMenuNode::InitializeStrings(*this); Space::SpaceMenuNode::InitializeStrings(*this);
char path[2048]; char path[2048];
@ -135,9 +135,9 @@ ViewManager::ViewManager(hecl::Runtime::FileStoreManager& fileMgr, hecl::CVarMan
{ {
std::string pathStr(path); std::string pathStr(path);
pathStr.pop_back(); pathStr.pop_back();
hecl::SystemStringView pathStrView(pathStr); hecl::SystemStringConv pathStrView(pathStr);
if (!hecl::Stat(pathStrView.c_str(), &theStat) && S_ISDIR(theStat.st_mode)) if (!hecl::Stat(pathStrView.c_str(), &theStat) && S_ISDIR(theStat.st_mode))
m_recentProjects.push_back(pathStrView); m_recentProjects.emplace_back(pathStrView.sys_str());
} }
fclose(fp); fclose(fp);
} }
@ -149,9 +149,9 @@ ViewManager::ViewManager(hecl::Runtime::FileStoreManager& fileMgr, hecl::CVarMan
{ {
std::string pathStr(path); std::string pathStr(path);
pathStr.pop_back(); pathStr.pop_back();
hecl::SystemStringView pathStrView(pathStr); hecl::SystemStringConv pathStrView(pathStr);
if (!hecl::Stat(pathStrView.c_str(), &theStat) && S_ISDIR(theStat.st_mode)) if (!hecl::Stat(pathStrView.c_str(), &theStat) && S_ISDIR(theStat.st_mode))
m_recentFiles.push_back(pathStrView); m_recentFiles.emplace_back(pathStrView.sys_str());
} }
fclose(fp); fclose(fp);
} }
@ -159,36 +159,36 @@ ViewManager::ViewManager(hecl::Runtime::FileStoreManager& fileMgr, hecl::CVarMan
ViewManager::~ViewManager() {} ViewManager::~ViewManager() {}
void ViewManager::pushRecentProject(const hecl::SystemString& path) void ViewManager::pushRecentProject(hecl::SystemStringView path)
{ {
for (hecl::SystemString& testPath : m_recentProjects) for (hecl::SystemString& testPath : m_recentProjects)
{ {
if (path == testPath) if (path == testPath)
return; return;
} }
m_recentProjects.push_back(path); m_recentProjects.emplace_back(path);
FILE* fp = hecl::Fopen(m_recentProjectsPath.c_str(), _S("w"), hecl::FileLockType::Write); FILE* fp = hecl::Fopen(m_recentProjectsPath.c_str(), _S("w"), hecl::FileLockType::Write);
if (fp) if (fp)
{ {
for (hecl::SystemString& pPath : m_recentProjects) for (hecl::SystemString& pPath : m_recentProjects)
fprintf(fp, "%s\n", hecl::SystemUTF8View(pPath).c_str()); fprintf(fp, "%s\n", hecl::SystemUTF8Conv(pPath).c_str());
fclose(fp); fclose(fp);
} }
} }
void ViewManager::pushRecentFile(const hecl::SystemString& path) void ViewManager::pushRecentFile(hecl::SystemStringView path)
{ {
for (hecl::SystemString& testPath : m_recentFiles) for (hecl::SystemString& testPath : m_recentFiles)
{ {
if (path == testPath) if (path == testPath)
return; return;
} }
m_recentFiles.push_back(path); m_recentFiles.emplace_back(path);
FILE* fp = hecl::Fopen(m_recentFilesPath.c_str(), _S("w"), hecl::FileLockType::Write); FILE* fp = hecl::Fopen(m_recentFilesPath.c_str(), _S("w"), hecl::FileLockType::Write);
if (fp) if (fp)
{ {
for (hecl::SystemString& pPath : m_recentFiles) for (hecl::SystemString& pPath : m_recentFiles)
fprintf(fp, "%s\n", hecl::SystemUTF8View(pPath).c_str()); fprintf(fp, "%s\n", hecl::SystemUTF8Conv(pPath).c_str());
fclose(fp); fclose(fp);
}} }}

View File

@ -175,10 +175,10 @@ public:
} }
const std::vector<hecl::SystemString>* recentProjects() const {return &m_recentProjects;} const std::vector<hecl::SystemString>* recentProjects() const {return &m_recentProjects;}
void pushRecentProject(const hecl::SystemString& path); void pushRecentProject(hecl::SystemStringView path);
const std::vector<hecl::SystemString>* recentFiles() const {return &m_recentFiles;} const std::vector<hecl::SystemString>* recentFiles() const {return &m_recentFiles;}
void pushRecentFile(const hecl::SystemString& path); void pushRecentFile(hecl::SystemStringView path);
void init(boo::IApplication* app); void init(boo::IApplication* app);
const boo::SystemChar* platformName() { return m_mainPlatformName; } const boo::SystemChar* platformName() { return m_mainPlatformName; }

View File

@ -18,27 +18,29 @@ extern "C" size_t L_ja_JP_SZ;
namespace urde namespace urde
{ {
using namespace std::literals;
static const specter::Locale Locales[] = static const specter::Locale Locales[] =
{ {
{"en_US", "US English", L_en_US, L_en_US_SZ}, {"en_US"sv, "US English"sv, L_en_US, L_en_US_SZ},
{"en_GB", "British English", L_en_GB, L_en_GB_SZ}, {"en_GB"sv, "British English"sv, L_en_GB, L_en_GB_SZ},
{"ja_JP", "Japanese", L_ja_JP, L_ja_JP_SZ} {"ja_JP"sv, "Japanese"sv, L_ja_JP, L_ja_JP_SZ}
}; };
std::vector<std::pair<const std::string*, const std::string*>> ListLocales() std::vector<std::pair<std::string_view, std::string_view>> ListLocales()
{ {
constexpr size_t localeCount = std::extent<decltype(Locales)>::value; constexpr size_t localeCount = std::extent<decltype(Locales)>::value;
std::vector<std::pair<const std::string*, const std::string*>> ret; std::vector<std::pair<std::string_view, std::string_view>> ret;
ret.reserve(localeCount); ret.reserve(localeCount);
for (size_t i=0 ; i<localeCount ; ++i) for (size_t i=0 ; i<localeCount ; ++i)
{ {
const specter::Locale& l = Locales[i]; const specter::Locale& l = Locales[i];
ret.emplace_back(&l.name(), &l.fullName()); ret.emplace_back(l.name(), l.fullName());
} }
return ret; return ret;
} }
const specter::Locale* LookupLocale(const std::string& name) const specter::Locale* LookupLocale(std::string_view name)
{ {
constexpr size_t localeCount = std::extent<decltype(Locales)>::value; constexpr size_t localeCount = std::extent<decltype(Locales)>::value;
for (size_t i=0 ; i<localeCount ; ++i) for (size_t i=0 ; i<localeCount ; ++i)

View File

@ -6,8 +6,8 @@
namespace urde namespace urde
{ {
std::vector<std::pair<const std::string*, const std::string*>> ListLocales(); std::vector<std::pair<std::string_view, std::string_view>> ListLocales();
const specter::Locale* LookupLocale(const std::string& name); const specter::Locale* LookupLocale(std::string_view name);
const specter::Locale* SystemLocaleOrEnglish(); const specter::Locale* SystemLocaleOrEnglish();
} }

View File

@ -75,7 +75,7 @@ struct Application : boo::IApplicationCallback
{ {
if (arg.find(_S("--verbosity=")) == 0 || arg.find(_S("-v=")) == 0) if (arg.find(_S("--verbosity=")) == 0 || arg.find(_S("-v=")) == 0)
{ {
hecl::SystemUTF8View utf8Arg(arg.substr(arg.find_last_of('=') + 1)); hecl::SystemUTF8Conv utf8Arg(arg.substr(arg.find_last_of('=') + 1));
hecl::VerbosityLevel = atoi(utf8Arg.c_str()); hecl::VerbosityLevel = atoi(utf8Arg.c_str());
hecl::LogModule.report(logvisor::Info, "Set verbosity level to %i", hecl::VerbosityLevel); hecl::LogModule.report(logvisor::Info, "Set verbosity level to %i", hecl::VerbosityLevel);
} }

View File

@ -21,7 +21,7 @@ class CAudioGroupSet
public: public:
CAudioGroupSet(std::unique_ptr<u8[]>&& in); CAudioGroupSet(std::unique_ptr<u8[]>&& in);
const amuse::AudioGroupData& GetAudioGroupData() const {return m_data;} const amuse::AudioGroupData& GetAudioGroupData() const {return m_data;}
const std::string& GetName() const { return x20_name; } std::string_view GetName() const { return x20_name; }
}; };
CFactoryFnReturn FAudioGroupSetDataFactory(const urde::SObjectTag& tag, CFactoryFnReturn FAudioGroupSetDataFactory(const urde::SObjectTag& tag,

View File

@ -10,15 +10,15 @@ static std::unordered_map<std::string, TLockedToken<CAudioGroupSet>> mpGroupSetD
static std::unordered_map<CAssetId, std::string> mpGroupSetResNameDB; static std::unordered_map<CAssetId, std::string> mpGroupSetResNameDB;
static const std::string mpDefaultInvalidString = "NULL"; static const std::string mpDefaultInvalidString = "NULL";
TLockedToken<CAudioGroupSet> CAudioSys::FindGroupSet(const std::string& name) TLockedToken<CAudioGroupSet> CAudioSys::FindGroupSet(std::string_view name)
{ {
auto search = mpGroupSetDB.find(name); auto search = mpGroupSetDB.find(name.data());
if (search == mpGroupSetDB.cend()) if (search == mpGroupSetDB.cend())
return {}; return {};
return search->second; return search->second;
} }
const std::string& CAudioSys::SysGetGroupSetName(CAssetId id) std::string_view CAudioSys::SysGetGroupSetName(CAssetId id)
{ {
auto search = mpGroupSetResNameDB.find(id); auto search = mpGroupSetResNameDB.find(id);
if (search == mpGroupSetResNameDB.cend()) if (search == mpGroupSetResNameDB.cend())
@ -41,7 +41,7 @@ bool CAudioSys::SysLoadGroupSet(CSimplePool* pool, CAssetId id)
} }
} }
bool CAudioSys::SysLoadGroupSet(const TLockedToken<CAudioGroupSet>& set, const std::string& name, CAssetId id) bool CAudioSys::SysLoadGroupSet(const TLockedToken<CAudioGroupSet>& set, std::string_view name, CAssetId id)
{ {
if (!FindGroupSet(name)) if (!FindGroupSet(name))
{ {
@ -55,28 +55,28 @@ bool CAudioSys::SysLoadGroupSet(const TLockedToken<CAudioGroupSet>& set, const s
} }
} }
void CAudioSys::SysUnloadAudioGroupSet(const std::string& name) void CAudioSys::SysUnloadAudioGroupSet(std::string_view name)
{ {
auto set = FindGroupSet(name); auto set = FindGroupSet(name);
if (!set) if (!set)
return; return;
mpGroupSetDB.erase(name); mpGroupSetDB.erase(name.data());
mpGroupSetResNameDB.erase(set.GetObjectTag()->id); mpGroupSetResNameDB.erase(set.GetObjectTag()->id);
} }
bool CAudioSys::SysIsGroupSetLoaded(const std::string& name) bool CAudioSys::SysIsGroupSetLoaded(std::string_view name)
{ {
return FindGroupSet(name).operator bool(); return FindGroupSet(name).operator bool();
} }
void CAudioSys::SysAddGroupIntoAmuse(const std::string& name) void CAudioSys::SysAddGroupIntoAmuse(std::string_view name)
{ {
if (auto set = FindGroupSet(name)) if (auto set = FindGroupSet(name))
AddAudioGroup(set->GetAudioGroupData()); AddAudioGroup(set->GetAudioGroupData());
} }
void CAudioSys::SysRemoveGroupFromAmuse(const std::string& name) void CAudioSys::SysRemoveGroupFromAmuse(std::string_view name)
{ {
if (auto set = FindGroupSet(name)) if (auto set = FindGroupSet(name))
RemoveAudioGroup(set->GetAudioGroupData()); RemoveAudioGroup(set->GetAudioGroupData());

View File

@ -78,14 +78,14 @@ public:
{ {
} }
static TLockedToken<CAudioGroupSet> FindGroupSet(const std::string& name); static TLockedToken<CAudioGroupSet> FindGroupSet(std::string_view name);
static const std::string& SysGetGroupSetName(CAssetId id); static std::string_view SysGetGroupSetName(CAssetId id);
static bool SysLoadGroupSet(CSimplePool* pool, CAssetId id); static bool SysLoadGroupSet(CSimplePool* pool, CAssetId id);
static bool SysLoadGroupSet(const TLockedToken<CAudioGroupSet>& set, const std::string& name, CAssetId id); static bool SysLoadGroupSet(const TLockedToken<CAudioGroupSet>& set, std::string_view name, CAssetId id);
static void SysUnloadAudioGroupSet(const std::string& name); static void SysUnloadAudioGroupSet(std::string_view name);
static bool SysIsGroupSetLoaded(const std::string& name); static bool SysIsGroupSetLoaded(std::string_view name);
static void SysAddGroupIntoAmuse(const std::string& name); static void SysAddGroupIntoAmuse(std::string_view name);
static void SysRemoveGroupFromAmuse(const std::string& name); static void SysRemoveGroupFromAmuse(std::string_view name);
static void SysSetVolume(u8 volume); static void SysSetVolume(u8 volume);
static void SysSetSfxVolume(u8 volume, u16 time, bool music, bool fx); static void SysSetSfxVolume(u8 volume, u16 time, bool music, bool fx);

View File

@ -7,7 +7,7 @@ namespace urde
#define RSF_BUFFER_SIZE 0x20000 #define RSF_BUFFER_SIZE 0x20000
CStaticAudioPlayer::CStaticAudioPlayer(boo::IAudioVoiceEngine& engine, const std::string& path, CStaticAudioPlayer::CStaticAudioPlayer(boo::IAudioVoiceEngine& engine, std::string_view path,
int loopStart, int loopEnd) int loopStart, int loopEnd)
: x0_path(path), x1c_loopStartSamp(loopStart & 0xfffffffe), x20_loopEndSamp(loopEnd & 0xfffffffe), : x0_path(path), x1c_loopStartSamp(loopStart & 0xfffffffe), x20_loopEndSamp(loopEnd & 0xfffffffe),
m_voiceCallback(*this), m_voice(engine.allocateNewStereoVoice(32000, &m_voiceCallback)) m_voiceCallback(*this), m_voice(engine.allocateNewStereoVoice(32000, &m_voiceCallback))
@ -16,7 +16,7 @@ CStaticAudioPlayer::CStaticAudioPlayer(boo::IAudioVoiceEngine& engine, const std
//x28_dmaLeft.reset(new u8[640]); //x28_dmaLeft.reset(new u8[640]);
//x30_dmaRight.reset(new u8[640]); //x30_dmaRight.reset(new u8[640]);
CDvdFile file(path.c_str()); CDvdFile file(path);
x10_rsfRem = file.Length(); x10_rsfRem = file.Length();
x14_rsfLength = x10_rsfRem; x14_rsfLength = x10_rsfRem;

View File

@ -57,9 +57,9 @@ class CStaticAudioPlayer
std::unique_ptr<boo::IAudioVoice> m_voice; std::unique_ptr<boo::IAudioVoice> m_voice;
public: public:
CStaticAudioPlayer(boo::IAudioVoiceEngine& engine, const std::string& path, CStaticAudioPlayer(boo::IAudioVoiceEngine& engine, std::string_view path,
int loopStart, int loopEnd); int loopStart, int loopEnd);
CStaticAudioPlayer(const std::string& path, CStaticAudioPlayer(std::string_view path,
int loopStart, int loopEnd) int loopStart, int loopEnd)
: CStaticAudioPlayer(*CAudioSys::GetVoiceEngine(), path, loopStart, loopEnd) {} : CStaticAudioPlayer(*CAudioSys::GetVoiceEngine(), path, loopStart, loopEnd) {}

View File

@ -503,10 +503,10 @@ public:
x70_24_unclaimed = true; x70_24_unclaimed = true;
} }
CDSPStreamManager(const std::string& fileName, u32 handle, float volume, bool oneshot) CDSPStreamManager(std::string_view fileName, u32 handle, float volume, bool oneshot)
: x60_fileName(fileName), x73_volume(volume), x74_oneshot(oneshot), x78_handleId(handle) : x60_fileName(fileName), x73_volume(volume), x74_oneshot(oneshot), x78_handleId(handle)
{ {
if (!CDvdFile::FileExists(fileName.c_str())) if (!CDvdFile::FileExists(fileName))
x70_24_unclaimed = true; x70_24_unclaimed = true;
} }
@ -771,7 +771,7 @@ public:
m_dvdReq.reset(); m_dvdReq.reset();
} }
static u32 StartStreaming(const std::string& fileName, float volume, bool oneshot) static u32 StartStreaming(std::string_view fileName, float volume, bool oneshot)
{ {
auto pipePos = fileName.find('|'); auto pipePos = fileName.find('|');
if (pipePos == std::string::npos) if (pipePos == std::string::npos)
@ -951,7 +951,7 @@ struct SDSPPlayer
bool x28_music = true; bool x28_music = true;
SDSPPlayer() = default; SDSPPlayer() = default;
SDSPPlayer(EPlayerState playing, const std::string& fileName, float volume, SDSPPlayer(EPlayerState playing, std::string_view fileName, float volume,
float fadeIn, float fadeOut, u32 handle, bool music) float fadeIn, float fadeOut, u32 handle, bool music)
: x0_fileName(fileName), x10_playState(playing), x14_volume(volume), : x0_fileName(fileName), x10_playState(playing), x14_volume(volume),
x18_fadeIn(fadeIn), x1c_fadeOut(fadeOut), x20_internalHandle(handle), x28_music(music) {} x18_fadeIn(fadeIn), x1c_fadeOut(fadeOut), x20_internalHandle(handle), x28_music(music) {}
@ -967,7 +967,7 @@ float CStreamAudioManager::GetTargetDSPVolume(float fileVol, bool music)
return g_SfxUnmute ? (g_SfxVolume * fileVol / 127.f) : 0.f; return g_SfxUnmute ? (g_SfxVolume * fileVol / 127.f) : 0.f;
} }
void CStreamAudioManager::Start(bool oneshot, const std::string& fileName, void CStreamAudioManager::Start(bool oneshot, std::string_view fileName,
u8 volume, bool music, float fadeIn, float fadeOut) u8 volume, bool music, float fadeIn, float fadeOut)
{ {
float fvol = volume / 127.f; float fvol = volume / 127.f;
@ -1022,7 +1022,7 @@ void CStreamAudioManager::Start(bool oneshot, const std::string& fileName,
} }
} }
void CStreamAudioManager::Stop(bool oneshot, const std::string& fileName) void CStreamAudioManager::Stop(bool oneshot, std::string_view fileName)
{ {
SDSPPlayer& p = s_Players[oneshot]; SDSPPlayer& p = s_Players[oneshot];
SDSPPlayer& qp = s_QueuedPlayers[oneshot]; SDSPPlayer& qp = s_QueuedPlayers[oneshot];

View File

@ -20,9 +20,9 @@ class CStreamAudioManager
static void StopAllStreams(); static void StopAllStreams();
public: public:
static void Start(bool oneshot, const std::string& fileName, u8 volume, static void Start(bool oneshot, std::string_view fileName, u8 volume,
bool music, float fadeIn, float fadeOut); bool music, float fadeIn, float fadeOut);
static void Stop(bool oneshot, const std::string& fileName); static void Stop(bool oneshot, std::string_view fileName);
static void FadeBackIn(bool oneshot, float fadeTime); static void FadeBackIn(bool oneshot, float fadeTime);
static void TemporaryFadeOut(bool oneshot, float fadeTime); static void TemporaryFadeOut(bool oneshot, float fadeTime);
static void Update(float dt); static void Update(float dt);

View File

@ -131,31 +131,6 @@ public:
TAreaId xc_areaId; TAreaId xc_areaId;
}; };
class CAudioMenu
{
public:
enum class EMenu
{
};
struct SMenuOption
{
SMenuOption(const std::string&, s32, s32, s32);
void BuildDrawableString();
};
private:
public:
CAudioMenu()=default;
void SetIsHighlighted(bool);
void AddOption(const SMenuOption&);
void ProcessControllerInput(const CFinalInput&);
u32 GetSelectionIndex() const;
const SMenuOption& GetOption(s32) const;
SMenuOption& Option(s32);
void SetSelectionIndex(s32);
void Draw(EMenu) const;
};
private: private:
enum class EZoomState enum class EZoomState
{ {

View File

@ -83,7 +83,7 @@ public:
CMapWorldData(CInputStream& in, u32 version); CMapWorldData(CInputStream& in, u32 version);
CAssetId GetWorldAssetId() const { return x10_worldAssetId; } CAssetId GetWorldAssetId() const { return x10_worldAssetId; }
const zeus::CVector3f& GetWorldCenterPoint() const { return x64_centerPoint; } const zeus::CVector3f& GetWorldCenterPoint() const { return x64_centerPoint; }
const std::string& GetWorldLabel() const { return x0_label; } std::string_view GetWorldLabel() const { return x0_label; }
const zeus::CTransform& GetWorldTransform() const { return x14_transform; } const zeus::CTransform& GetWorldTransform() const { return x14_transform; }
const zeus::CTransform& GetMapAreaData(s32 idx) const { return x44_hexagonXfs[idx]; } const zeus::CTransform& GetMapAreaData(s32 idx) const { return x44_hexagonXfs[idx]; }
u32 GetNumMapAreaDatas() const { return x44_hexagonXfs.size(); } u32 GetNumMapAreaDatas() const { return x44_hexagonXfs.size(); }

View File

@ -46,7 +46,7 @@ public:
static void Initialize(const hecl::ProjectPath& path); static void Initialize(const hecl::ProjectPath& path);
static void Shutdown(); static void Shutdown();
CDvdFile(const char* path) CDvdFile(std::string_view path)
: x18_path(path), : x18_path(path),
m_reader(std::make_shared<athena::io::FileReader>( m_reader(std::make_shared<athena::io::FileReader>(
hecl::ProjectPath(m_DvdRoot, path).getAbsolutePath())) {} hecl::ProjectPath(m_DvdRoot, path).getAbsolutePath())) {}
@ -55,7 +55,7 @@ public:
{ {
m_reader->seek(pos, athena::SeekOrigin::Begin); m_reader->seek(pos, athena::SeekOrigin::Begin);
} }
static bool FileExists(const char* path) static bool FileExists(std::string_view path)
{ {
return hecl::ProjectPath(m_DvdRoot, path).isFile(); return hecl::ProjectPath(m_DvdRoot, path).isFile();
} }
@ -79,7 +79,7 @@ public:
return m_reader->readBytesToBuf(buf, len); return m_reader->readBytesToBuf(buf, len);
} }
u64 Length() {return m_reader->length();} u64 Length() {return m_reader->length();}
const std::string& GetPath() const { return x18_path; } std::string_view GetPath() const { return x18_path; }
}; };
} }

View File

@ -32,7 +32,7 @@ public:
float GetNormalTime() const { return x14_normalTime; } float GetNormalTime() const { return x14_normalTime; }
float GetImmediateTime() const { return x10_immediateTime; } float GetImmediateTime() const { return x10_immediateTime; }
float GetTextTime() const { return x1c_textTime; } float GetTextTime() const { return x1c_textTime; }
const std::string& GetName() const { return x0_name; } std::string_view GetName() const { return x0_name; }
CAssetId GetStringID() const { return x18_stringId; } CAssetId GetStringID() const { return x18_stringId; }
const std::vector<SHintLocation>& GetLocations() const { return x20_locations; } const std::vector<SHintLocation>& GetLocations() const { return x20_locations; }
}; };

View File

@ -24,12 +24,12 @@ public:
RemoveIOWin = 3 RemoveIOWin = 3
}; };
virtual ~CIOWin() {} virtual ~CIOWin() {}
CIOWin(const char* name) : x4_name(name) { m_nameHash = std::hash<std::string>()(x4_name); } CIOWin(std::string_view name) : x4_name(name) { m_nameHash = std::hash<std::string_view>()(name); }
virtual EMessageReturn OnMessage(const CArchitectureMessage&, CArchitectureQueue&)=0; virtual EMessageReturn OnMessage(const CArchitectureMessage&, CArchitectureQueue&)=0;
virtual bool GetIsContinueDraw() const { return true; } virtual bool GetIsContinueDraw() const { return true; }
virtual void Draw() const {} virtual void Draw() const {}
virtual void PreDraw() const {} virtual void PreDraw() const {}
const std::string& GetName() const { return x4_name; } std::string_view GetName() const { return x4_name; }
size_t GetNameHash() const { return m_nameHash; } size_t GetNameHash() const { return m_nameHash; }
}; };

View File

@ -117,9 +117,9 @@ void CIOWinManager::PumpMessages(CArchitectureQueue& queue)
} }
} }
CIOWin* CIOWinManager::FindIOWin(const std::string& name) CIOWin* CIOWinManager::FindIOWin(std::string_view name)
{ {
size_t findHash = std::hash<std::string>()(name); size_t findHash = std::hash<std::string_view>()(name);
for (IOWinPQNode* node = x4_pumpRoot ; node ; node = node->x8_next) for (IOWinPQNode* node = x4_pumpRoot ; node ; node = node->x8_next)
{ {
@ -138,9 +138,9 @@ CIOWin* CIOWinManager::FindIOWin(const std::string& name)
return nullptr; return nullptr;
} }
std::shared_ptr<CIOWin> CIOWinManager::FindAndShareIOWin(const std::string& name) std::shared_ptr<CIOWin> CIOWinManager::FindAndShareIOWin(std::string_view name)
{ {
size_t findHash = std::hash<std::string>()(name); size_t findHash = std::hash<std::string_view>()(name);
for (IOWinPQNode* node = x4_pumpRoot ; node ; node = node->x8_next) for (IOWinPQNode* node = x4_pumpRoot ; node ; node = node->x8_next)
{ {

View File

@ -31,8 +31,8 @@ public:
void Draw() const; void Draw() const;
bool DistributeOneMessage(const CArchitectureMessage& msg, CArchitectureQueue& queue); bool DistributeOneMessage(const CArchitectureMessage& msg, CArchitectureQueue& queue);
void PumpMessages(CArchitectureQueue& queue); void PumpMessages(CArchitectureQueue& queue);
CIOWin* FindIOWin(const std::string& name); CIOWin* FindIOWin(std::string_view name);
std::shared_ptr<CIOWin> FindAndShareIOWin(const std::string& name); std::shared_ptr<CIOWin> FindAndShareIOWin(std::string_view name);
void ChangeIOWinPriority(CIOWin* toChange, int pumpPrio, int drawPrio); void ChangeIOWinPriority(CIOWin* toChange, int pumpPrio, int drawPrio);
void RemoveAllIOWins(); void RemoveAllIOWins();
void RemoveIOWin(CIOWin* toRemove); void RemoveIOWin(CIOWin* toRemove);

View File

@ -17,12 +17,12 @@ public:
float x0_fadeIn, x4_fadeOut, x8_volume; float x0_fadeIn, x4_fadeOut, x8_volume;
std::string xc_fileName; std::string xc_fileName;
CAssetId x1c_res; CAssetId x1c_res;
Audio(float fadeIn, float fadeOut, float vol, const std::string& fileName, u32 handle) Audio(float fadeIn, float fadeOut, float vol, std::string_view fileName, u32 handle)
: x0_fadeIn(fadeIn), x4_fadeOut(fadeOut), x8_volume(vol), xc_fileName(fileName), x1c_res(handle) {} : x0_fadeIn(fadeIn), x4_fadeOut(fadeOut), x8_volume(vol), xc_fileName(fileName), x1c_res(handle) {}
float GetFadeIn() const { return x0_fadeIn; } float GetFadeIn() const { return x0_fadeIn; }
float GetFadeOut() const { return x4_fadeOut; } float GetFadeOut() const { return x4_fadeOut; }
float GetVolume() const { return x8_volume; } float GetVolume() const { return x8_volume; }
const std::string& GetFileName() const { return xc_fileName; } std::string_view GetFileName() const { return xc_fileName; }
CAssetId GetResId() const { return x1c_res; } CAssetId GetResId() const { return x1c_res; }
static Audio None() { return Audio{0.f, 0.f, 0.f, "", 0}; } static Audio None() { return Audio{0.f, 0.f, 0.f, "", 0}; }
}; };
@ -44,9 +44,9 @@ public:
CTweakValue()=default; CTweakValue()=default;
//CTweakValue(CTextInputStream&); //CTweakValue(CTextInputStream&);
//void PutTo(CTextOutStream&); //void PutTo(CTextOutStream&);
const std::string& GetName() const { return x4_key; } std::string_view GetName() const { return x4_key; }
const std::string& GetValueAsString() const; std::string_view GetValueAsString() const;
void SetValueFromString(const std::string&); void SetValueFromString(std::string_view);
const Audio& GetAudio() const { return x24_audio; } const Audio& GetAudio() const { return x24_audio; }
EType GetType() const { return x0_type; } EType GetType() const { return x0_type; }
}; };
@ -56,7 +56,7 @@ class CInGameTweakManagerBase
protected: protected:
std::vector<CTweakValue> x0_values; std::vector<CTweakValue> x0_values;
public: public:
bool HasTweakValue(const std::string& name) const bool HasTweakValue(std::string_view name) const
{ {
for (const CTweakValue& val : x0_values) for (const CTweakValue& val : x0_values)
if (val.GetName() == name) if (val.GetName() == name)
@ -64,7 +64,7 @@ public:
return false; return false;
} }
const CTweakValue* GetTweakValue(const std::string& name) const const CTweakValue* GetTweakValue(std::string_view name) const
{ {
for (const CTweakValue& val : x0_values) for (const CTweakValue& val : x0_values)
if (val.GetName() == name) if (val.GetName() == name)
@ -72,16 +72,16 @@ public:
return nullptr; return nullptr;
} }
bool ReadFromMemoryCard(const std::string& name) bool ReadFromMemoryCard(std::string_view name)
{ {
return true; return true;
} }
static std::string GetIdentifierForMidiEvent(CAssetId world, CAssetId area, static std::string GetIdentifierForMidiEvent(CAssetId world, CAssetId area,
const std::string& midiObj) std::string_view midiObj)
{ {
return hecl::Format("World %8.8x Area %8.8x MidiObject: %s", return hecl::Format("World %8.8x Area %8.8x MidiObject: %s",
u32(world.Value()), u32(area.Value()), midiObj.c_str()); u32(world.Value()), u32(area.Value()), midiObj.data());
} }
}; };

View File

@ -86,7 +86,7 @@ CMemoryCardSys::CMemoryCardSys()
std::vector<std::pair<CAssetId, CAssetId>> orderedMLVLs; std::vector<std::pair<CAssetId, CAssetId>> orderedMLVLs;
orderedMLVLs.reserve(16); orderedMLVLs.reserve(16);
g_ResFactory->EnumerateNamedResources([&](const std::string& name, const SObjectTag& tag) -> bool g_ResFactory->EnumerateNamedResources([&](std::string_view name, const SObjectTag& tag) -> bool
{ {
if (tag.type == FOURCC('MLVL')) if (tag.type == FOURCC('MLVL'))
{ {

View File

@ -137,7 +137,7 @@ public:
CVParamTransfer m_texParam = {new TObjOwnerParam<u32>(SBIG('OTEX'))}; CVParamTransfer m_texParam = {new TObjOwnerParam<u32>(SBIG('OTEX'))};
CCardFileInfo(kabufuda::ECardSlot port, const std::string& name) CCardFileInfo(kabufuda::ECardSlot port, std::string_view name)
: m_handle(port), x18_fileName(name) {} : m_handle(port), x18_fileName(name) {}
void LockBannerToken(CAssetId bannerTxtr, CSimplePool& sp); void LockBannerToken(CAssetId bannerTxtr, CSimplePool& sp);

View File

@ -4,18 +4,18 @@ namespace urde
{ {
static logvisor::Module Log("urde::CPakFile"); static logvisor::Module Log("urde::CPakFile");
CPakFile::CPakFile(const std::string& filename, bool buildDepList, bool worldPak) CPakFile::CPakFile(std::string_view filename, bool buildDepList, bool worldPak)
: CDvdFile(filename.c_str()) : CDvdFile(filename)
{ {
if (!CDvdFile::operator bool()) if (!CDvdFile::operator bool())
Log.report(logvisor::Fatal, "%s: Unable to open", GetPath().c_str()); Log.report(logvisor::Fatal, "%s: Unable to open", GetPath().data());
x28_24_buildDepList = buildDepList; x28_24_buildDepList = buildDepList;
x28_24_buildDepList = true; // Always do this so URDE can rapidly pre-warm shaders x28_24_buildDepList = true; // Always do this so URDE can rapidly pre-warm shaders
x28_26_worldPak = worldPak; x28_26_worldPak = worldPak;
x28_27_stashedInARAM = false; x28_27_stashedInARAM = false;
} }
const SObjectTag* CPakFile::GetResIdByName(const char* name) const const SObjectTag* CPakFile::GetResIdByName(std::string_view name) const
{ {
for (const std::pair<std::string, SObjectTag>& p : x54_nameList) for (const std::pair<std::string, SObjectTag>& p : x54_nameList)
if (!CStringExtras::CompareCaseInsensitive(p.first.c_str(), name)) if (!CStringExtras::CompareCaseInsensitive(p.first.c_str(), name))
@ -65,7 +65,7 @@ void CPakFile::InitialHeaderLoad()
if (version != 0x80030005) if (version != 0x80030005)
{ {
Log.report(logvisor::Fatal, "%s: Incompatible pak file version -- Current version is %x, you're using %x", Log.report(logvisor::Fatal, "%s: Incompatible pak file version -- Current version is %x, you're using %x",
GetPath().c_str(), 0x80030005, version); GetPath().data(), 0x80030005, version);
return; return;
} }

View File

@ -69,10 +69,10 @@ private:
void InitialHeaderLoad(); void InitialHeaderLoad();
void Warmup(); void Warmup();
public: public:
CPakFile(const std::string& filename, bool buildDepList, bool worldPak); CPakFile(std::string_view filename, bool buildDepList, bool worldPak);
const std::vector<std::pair<std::string, SObjectTag>>& GetNameList() const { return x54_nameList; } const std::vector<std::pair<std::string, SObjectTag>>& GetNameList() const { return x54_nameList; }
const std::vector<CAssetId>& GetDepList() const { return x64_depList; } const std::vector<CAssetId>& GetDepList() const { return x64_depList; }
const SObjectTag* GetResIdByName(const char* name) const; const SObjectTag* GetResIdByName(std::string_view name) const;
const SResInfo* GetResInfoForLoadPreferForward(CAssetId id) const; const SResInfo* GetResInfoForLoadPreferForward(CAssetId id) const;
const SResInfo* GetResInfoForLoadDirectionless(CAssetId id) const; const SResInfo* GetResInfoForLoadDirectionless(CAssetId id) const;
const SResInfo* GetResInfo(CAssetId id) const; const SResInfo* GetResInfo(CAssetId id) const;

View File

@ -84,7 +84,7 @@ public:
return x4_loader.LoadResourcePartAsync(tag, off, size, target); return x4_loader.LoadResourcePartAsync(tag, off, size, target);
} }
const SObjectTag* GetResourceIdByName(const char* name) const const SObjectTag* GetResourceIdByName(std::string_view name) const
{ {
return x4_loader.GetResourceIdByName(name); return x4_loader.GetResourceIdByName(name);
} }
@ -104,7 +104,7 @@ public:
return x4_loader.EnumerateResources(lambda); return x4_loader.EnumerateResources(lambda);
} }
void EnumerateNamedResources(const std::function<bool(const std::string&, const SObjectTag&)>& lambda) const void EnumerateNamedResources(const std::function<bool(std::string_view, const SObjectTag&)>& lambda) const
{ {
return x4_loader.EnumerateNamedResources(lambda); return x4_loader.EnumerateNamedResources(lambda);
} }

View File

@ -10,18 +10,18 @@ CResLoader::CResLoader()
x48_curPak = x18_pakLoadedList.end(); x48_curPak = x18_pakLoadedList.end();
} }
const std::vector<CAssetId>* CResLoader::GetTagListForFile(const std::string& name) const const std::vector<CAssetId>* CResLoader::GetTagListForFile(std::string_view name) const
{ {
std::string namePak = name + ".upak"; std::string namePak = std::string(name) + ".upak";
for (const std::unique_ptr<CPakFile>& pak : x18_pakLoadedList) for (const std::unique_ptr<CPakFile>& pak : x18_pakLoadedList)
if (!CStringExtras::CompareCaseInsensitive(namePak, pak->x18_path)) if (!CStringExtras::CompareCaseInsensitive(namePak, pak->x18_path))
return &pak->GetDepList(); return &pak->GetDepList();
return nullptr; return nullptr;
} }
void CResLoader::AddPakFileAsync(const std::string& name, bool buildDepList, bool worldPak) void CResLoader::AddPakFileAsync(std::string_view name, bool buildDepList, bool worldPak)
{ {
std::string namePak = name + ".upak"; std::string namePak = std::string(name) + ".upak";
if (CDvdFile::FileExists(namePak.c_str())) if (CDvdFile::FileExists(namePak.c_str()))
{ {
x30_pakLoadingList.emplace_back(new CPakFile(namePak, buildDepList, worldPak)); x30_pakLoadingList.emplace_back(new CPakFile(namePak, buildDepList, worldPak));
@ -29,7 +29,7 @@ void CResLoader::AddPakFileAsync(const std::string& name, bool buildDepList, boo
} }
} }
void CResLoader::AddPakFile(const std::string& name, bool samusPak, bool worldPak) void CResLoader::AddPakFile(std::string_view name, bool samusPak, bool worldPak)
{ {
AddPakFileAsync(name, samusPak, worldPak); AddPakFileAsync(name, samusPak, worldPak);
WaitForPakFileLoadingComplete(); WaitForPakFileLoadingComplete();
@ -169,7 +169,7 @@ FourCC CResLoader::GetResourceTypeById(CAssetId id) const
return {}; return {};
} }
const SObjectTag* CResLoader::GetResourceIdByName(const char* name) const const SObjectTag* CResLoader::GetResourceIdByName(std::string_view name) const
{ {
for (const std::unique_ptr<CPakFile>& file : x18_pakLoadedList) for (const std::unique_ptr<CPakFile>& file : x18_pakLoadedList)
{ {
@ -309,7 +309,7 @@ void CResLoader::EnumerateResources(const std::function<bool(const SObjectTag&)>
} }
} }
void CResLoader::EnumerateNamedResources(const std::function<bool(const std::string&, const SObjectTag&)>& lambda) const void CResLoader::EnumerateNamedResources(const std::function<bool(std::string_view, const SObjectTag&)>& lambda) const
{ {
for (auto it = x18_pakLoadedList.begin() ; it != x18_pakLoadedList.end() ; ++it) for (auto it = x18_pakLoadedList.begin() ; it != x18_pakLoadedList.end() ; ++it)
{ {

View File

@ -25,9 +25,9 @@ class CResLoader
bool x54_forwardSeek = false; bool x54_forwardSeek = false;
public: public:
CResLoader(); CResLoader();
const std::vector<CAssetId>* GetTagListForFile(const std::string& name) const; const std::vector<CAssetId>* GetTagListForFile(std::string_view name) const;
void AddPakFileAsync(const std::string& name, bool buildDepList, bool worldPak); void AddPakFileAsync(std::string_view name, bool buildDepList, bool worldPak);
void AddPakFile(const std::string& name, bool samusPak, bool worldPak); void AddPakFile(std::string_view name, bool samusPak, bool worldPak);
void WaitForPakFileLoadingComplete(); void WaitForPakFileLoadingComplete();
std::unique_ptr<CInputStream> LoadNewResourcePartSync(const SObjectTag& tag, u32 length, u32 offset, void* extBuf); std::unique_ptr<CInputStream> LoadNewResourcePartSync(const SObjectTag& tag, u32 length, u32 offset, void* extBuf);
void LoadMemResourceSync(const SObjectTag& tag, std::unique_ptr<u8[]>& bufOut, int* sizeOut); void LoadMemResourceSync(const SObjectTag& tag, std::unique_ptr<u8[]>& bufOut, int* sizeOut);
@ -42,7 +42,7 @@ public:
u32 ResourceSize(const SObjectTag& tag); u32 ResourceSize(const SObjectTag& tag);
bool ResourceExists(const SObjectTag& tag); bool ResourceExists(const SObjectTag& tag);
FourCC GetResourceTypeById(CAssetId id) const; FourCC GetResourceTypeById(CAssetId id) const;
const SObjectTag* GetResourceIdByName(const char* name) const; const SObjectTag* GetResourceIdByName(std::string_view name) const;
bool AreAllPaksLoaded() const; bool AreAllPaksLoaded() const;
void AsyncIdlePakLoading(); void AsyncIdlePakLoading();
bool FindResource(CAssetId id) const; bool FindResource(CAssetId id) const;
@ -53,7 +53,7 @@ public:
void MoveToCorrectLoadedList(std::unique_ptr<CPakFile>&& file); void MoveToCorrectLoadedList(std::unique_ptr<CPakFile>&& file);
std::vector<std::pair<std::string, SObjectTag>> GetResourceIdToNameList() const; std::vector<std::pair<std::string, SObjectTag>> GetResourceIdToNameList() const;
void EnumerateResources(const std::function<bool(const SObjectTag&)>& lambda) const; void EnumerateResources(const std::function<bool(const SObjectTag&)>& lambda) const;
void EnumerateNamedResources(const std::function<bool(const std::string&, const SObjectTag&)>& lambda) const; void EnumerateNamedResources(const std::function<bool(std::string_view, const SObjectTag&)>& lambda) const;
}; };
} }

View File

@ -28,12 +28,12 @@ CToken CSimplePool::GetObj(const SObjectTag& tag)
return GetObj(tag, x1c_paramXfer); return GetObj(tag, x1c_paramXfer);
} }
CToken CSimplePool::GetObj(const char* resourceName) CToken CSimplePool::GetObj(std::string_view resourceName)
{ {
return GetObj(resourceName, x1c_paramXfer); return GetObj(resourceName, x1c_paramXfer);
} }
CToken CSimplePool::GetObj(const char* resourceName, const CVParamTransfer& paramXfer) CToken CSimplePool::GetObj(std::string_view resourceName, const CVParamTransfer& paramXfer)
{ {
const SObjectTag* tag = x18_factory.GetResourceIdByName(resourceName); const SObjectTag* tag = x18_factory.GetResourceIdByName(resourceName);
if (!tag) if (!tag)

View File

@ -23,8 +23,8 @@ public:
CSimplePool(IFactory& factory); CSimplePool(IFactory& factory);
CToken GetObj(const SObjectTag&, const CVParamTransfer&); CToken GetObj(const SObjectTag&, const CVParamTransfer&);
CToken GetObj(const SObjectTag&); CToken GetObj(const SObjectTag&);
CToken GetObj(const char*); CToken GetObj(std::string_view);
CToken GetObj(const char*, const CVParamTransfer&); CToken GetObj(std::string_view, const CVParamTransfer&);
bool HasObject(const SObjectTag&) const; bool HasObject(const SObjectTag&) const;
bool ObjectIsLive(const SObjectTag&) const; bool ObjectIsLive(const SObjectTag&) const;
IFactory& GetFactory() const {return x18_factory;} IFactory& GetFactory() const {return x18_factory;}

View File

@ -18,14 +18,14 @@ public:
return strcasecmp(a, b); return strcasecmp(a, b);
#endif #endif
} }
static int CompareCaseInsensitive(const std::string& a, const std::string& b) static int CompareCaseInsensitive(std::string_view a, std::string_view b)
{ {
return CompareCaseInsensitive(a.c_str(), b.c_str()); return CompareCaseInsensitive(a.data(), b.data());
} }
static int IndexOfSubstring(const std::string& haystack, const std::string& needle) static int IndexOfSubstring(std::string_view haystack, std::string_view needle)
{ {
std::string str = haystack; std::string str(haystack);
std::transform(str.begin(), str.end(), str.begin(), tolower); std::transform(str.begin(), str.end(), str.begin(), tolower);
std::string::size_type s = str.find(needle); std::string::size_type s = str.find(needle);
if (s == std::string::npos) if (s == std::string::npos)

View File

@ -6,7 +6,7 @@
namespace urde namespace urde
{ {
CCinematicCamera::CCinematicCamera(TUniqueId uid, const std::string& name, const CEntityInfo& info, CCinematicCamera::CCinematicCamera(TUniqueId uid, std::string_view name, const CEntityInfo& info,
const zeus::CTransform& xf, bool active, float shotDuration, float fovy, float znear, const zeus::CTransform& xf, bool active, float shotDuration, float fovy, float znear,
float zfar, float aspect, u32 w1) float zfar, float aspect, u32 w1)
: CGameCamera(uid, active, name, info, xf, fovy, znear, zfar, aspect, kInvalidUniqueId, w1 & 0x20, 0), x21c_w1(w1) : CGameCamera(uid, active, name, info, xf, fovy, znear, zfar, aspect, kInvalidUniqueId, w1 & 0x20, 0), x21c_w1(w1)

View File

@ -10,7 +10,7 @@ class CCinematicCamera : public CGameCamera
{ {
u32 x21c_w1; u32 x21c_w1;
public: public:
CCinematicCamera(TUniqueId, const std::string& name, const CEntityInfo& info, CCinematicCamera(TUniqueId, std::string_view name, const CEntityInfo& info,
const zeus::CTransform& xf, bool, float, float, float, float, float, u32 w1); const zeus::CTransform& xf, bool, float, float, float, float, float, u32 w1);
void Accept(IVisitor& visitor); void Accept(IVisitor& visitor);

View File

@ -6,7 +6,7 @@
namespace urde namespace urde
{ {
CGameCamera::CGameCamera(TUniqueId uid, bool active, const std::string& name, const CEntityInfo& info, CGameCamera::CGameCamera(TUniqueId uid, bool active, std::string_view name, const CEntityInfo& info,
const zeus::CTransform& xf, float fovy, float znear, float zfar, float aspect, const zeus::CTransform& xf, float fovy, float znear, float zfar, float aspect,
TUniqueId watchedId, bool disableInput, u32 controllerIdx) TUniqueId watchedId, bool disableInput, u32 controllerIdx)
: CActor(uid, active, name, info, xf, CModelData::CModelDataNull(), CMaterialList(EMaterialTypes::Unknown), : CActor(uid, active, name, info, xf, CModelData::CModelDataNull(), CMaterialList(EMaterialTypes::Unknown),

View File

@ -30,7 +30,7 @@ protected:
float x180_; float x180_;
float x184_fov; float x184_fov;
public: public:
CGameCamera(TUniqueId, bool active, const std::string& name, const CEntityInfo& info, const zeus::CTransform& xf, CGameCamera(TUniqueId, bool active, std::string_view name, const CEntityInfo& info, const zeus::CTransform& xf,
float fov, float nearz, float farz, float aspect, TUniqueId watchedId, bool disableInput, float fov, float nearz, float farz, float aspect, TUniqueId watchedId, bool disableInput,
u32 controllerIdx); u32 controllerIdx);

View File

@ -4,7 +4,7 @@
namespace urde namespace urde
{ {
CPathCamera::CPathCamera(TUniqueId uid, const std::string& name, const CEntityInfo& info, CPathCamera::CPathCamera(TUniqueId uid, std::string_view name, const CEntityInfo& info,
const zeus::CTransform& xf, bool active, bool, bool, bool, bool, const zeus::CTransform& xf, bool active, bool, bool, bool, bool,
float, float, float, float, float, float, float, u32, float, float, float, float, float, float, float, u32,
EInitialSplinePosition) EInitialSplinePosition)

View File

@ -12,7 +12,7 @@ public:
enum class EInitialSplinePosition enum class EInitialSplinePosition
{ {
}; };
CPathCamera(TUniqueId, const std::string& name, const CEntityInfo& info, CPathCamera(TUniqueId, std::string_view name, const CEntityInfo& info,
const zeus::CTransform& xf, bool, bool, bool, bool, bool, const zeus::CTransform& xf, bool, bool, bool, bool, bool,
float, float, float, float, float, float, float, u32, float, float, float, float, float, float, float, u32,
EInitialSplinePosition); EInitialSplinePosition);

View File

@ -87,7 +87,7 @@ CAnimData::CAnimData(CAssetId id,
{ {
defaultAnim = 0; defaultAnim = 0;
Log.report(logvisor::Warning, "Character %s has invalid initial animation, so defaulting to first.", Log.report(logvisor::Warning, "Character %s has invalid initial animation, so defaulting to first.",
character.GetCharacterName().c_str()); character.GetCharacterName().data());
} }
std::shared_ptr<CAnimTreeNode> treeNode = std::shared_ptr<CAnimTreeNode> treeNode =
@ -534,19 +534,19 @@ zeus::CTransform CAnimData::GetLocatorTransform(CSegId id, const CCharAnimTime*
return ret; return ret;
} }
zeus::CTransform CAnimData::GetLocatorTransform(const std::string& name, const CCharAnimTime* time) const zeus::CTransform CAnimData::GetLocatorTransform(std::string_view name, const CCharAnimTime* time) const
{ {
return GetLocatorTransform(xcc_layoutData->GetSegIdFromString(name), time); return GetLocatorTransform(xcc_layoutData->GetSegIdFromString(name), time);
} }
bool CAnimData::IsAnimTimeRemaining(float rem, const std::string& name) const bool CAnimData::IsAnimTimeRemaining(float rem, std::string_view name) const
{ {
if (!x1f8_animRoot) if (!x1f8_animRoot)
return false; return false;
return x1f8_animRoot->VGetTimeRemaining().GetSeconds() >= rem; return x1f8_animRoot->VGetTimeRemaining().GetSeconds() >= rem;
} }
float CAnimData::GetAnimTimeRemaining(const std::string& name) const float CAnimData::GetAnimTimeRemaining(std::string_view name) const
{ {
float rem = x1f8_animRoot->VGetTimeRemaining().GetSeconds(); float rem = x1f8_animRoot->VGetTimeRemaining().GetSeconds();
if (x200_speedScale) if (x200_speedScale)
@ -1001,7 +1001,7 @@ void CAnimData::ResetPOILists()
x218_passedSoundCount = 0; x218_passedSoundCount = 0;
} }
CSegId CAnimData::GetLocatorSegId(const std::string& name) const CSegId CAnimData::GetLocatorSegId(std::string_view name) const
{ {
return xcc_layoutData->GetSegIdFromString(name); return xcc_layoutData->GetSegIdFromString(name);
} }
@ -1034,7 +1034,7 @@ void CAnimData::SubstituteModelData(const TCachedToken<CSkinnedModel>& model)
x108_aabb = xd8_modelData->GetModel()->GetAABB(); x108_aabb = xd8_modelData->GetModel()->GetAABB();
} }
void CAnimData::SetParticleCEXTValue(const std::string& name, int idx, float value) void CAnimData::SetParticleCEXTValue(std::string_view name, int idx, float value)
{ {
auto search = std::find_if(xc_charInfo.x98_effects.begin(), xc_charInfo.x98_effects.end(), auto search = std::find_if(xc_charInfo.x98_effects.begin(), xc_charInfo.x98_effects.end(),
[&name](const auto& v) { return v.first == name; }); [&name](const auto& v) { return v.first == name; });

View File

@ -190,9 +190,9 @@ public:
void CalcPlaybackAlignmentParms(const CAnimPlaybackParms& parms, void CalcPlaybackAlignmentParms(const CAnimPlaybackParms& parms,
const std::shared_ptr<CAnimTreeNode>& node); const std::shared_ptr<CAnimTreeNode>& node);
zeus::CTransform GetLocatorTransform(CSegId id, const CCharAnimTime* time) const; zeus::CTransform GetLocatorTransform(CSegId id, const CCharAnimTime* time) const;
zeus::CTransform GetLocatorTransform(const std::string& name, const CCharAnimTime* time) const; zeus::CTransform GetLocatorTransform(std::string_view name, const CCharAnimTime* time) const;
bool IsAnimTimeRemaining(float, const std::string& name) const; bool IsAnimTimeRemaining(float, std::string_view name) const;
float GetAnimTimeRemaining(const std::string& name) const; float GetAnimTimeRemaining(std::string_view name) const;
float GetAnimationDuration(int) const; float GetAnimationDuration(int) const;
bool GetIsLoop() const {return x220_25_loop;} bool GetIsLoop() const {return x220_25_loop;}
void EnableLooping(bool val) {x220_25_loop = val; x220_24_animating = true;} void EnableLooping(bool val) {x220_25_loop = val; x220_24_animating = true;}
@ -233,7 +233,7 @@ public:
const zeus::CVector3f&, CStateManager& stateMgr); const zeus::CVector3f&, CStateManager& stateMgr);
float GetAverageVelocity(int animIn) const; float GetAverageVelocity(int animIn) const;
void ResetPOILists(); void ResetPOILists();
CSegId GetLocatorSegId(const std::string& name) const; CSegId GetLocatorSegId(std::string_view name) const;
zeus::CAABox GetBoundingBox(const zeus::CTransform& xf) const; zeus::CAABox GetBoundingBox(const zeus::CTransform& xf) const;
zeus::CAABox GetBoundingBox() const; zeus::CAABox GetBoundingBox() const;
void SubstituteModelData(const TCachedToken<CSkinnedModel>& model); void SubstituteModelData(const TCachedToken<CSkinnedModel>& model);
@ -242,7 +242,7 @@ public:
const CHierarchyPoseBuilder& GetPoseBuilder() const { return x2fc_poseBuilder; } const CHierarchyPoseBuilder& GetPoseBuilder() const { return x2fc_poseBuilder; }
const CParticleDatabase& GetParticleDB() const { return x120_particleDB; } const CParticleDatabase& GetParticleDB() const { return x120_particleDB; }
CParticleDatabase& GetParticleDB() { return x120_particleDB; } CParticleDatabase& GetParticleDB() { return x120_particleDB; }
void SetParticleCEXTValue(const std::string& name, int idx, float value); void SetParticleCEXTValue(std::string_view name, int idx, float value);
u32 GetPassedBoolPOICount() const { return x20c_passedBoolCount; } u32 GetPassedBoolPOICount() const { return x20c_passedBoolCount; }
u32 GetPassedIntPOICount() const { return x210_passedIntCount; } u32 GetPassedIntPOICount() const { return x210_passedIntCount; }

View File

@ -46,7 +46,7 @@ CAnimSourceReaderBase::GetUniqueParticlePOIs() const
const std::vector<CParticlePOINode>& particleNodes = x4_sourceInfo->GetParticlePOIStream(); const std::vector<CParticlePOINode>& particleNodes = x4_sourceInfo->GetParticlePOIStream();
std::map<std::string, CParticleData::EParentedMode> ret; std::map<std::string, CParticleData::EParentedMode> ret;
for (const CParticlePOINode& node : particleNodes) for (const CParticlePOINode& node : particleNodes)
ret[node.GetString()] = node.GetParticleData().GetParentedMode(); ret[std::string(node.GetString())] = node.GetParticleData().GetParentedMode();
return ret; return ret;
} }
@ -56,7 +56,7 @@ CAnimSourceReaderBase::GetUniqueInt32POIs() const
const std::vector<CInt32POINode>& int32Nodes = x4_sourceInfo->GetInt32POIStream(); const std::vector<CInt32POINode>& int32Nodes = x4_sourceInfo->GetInt32POIStream();
std::map<std::string, s32> ret; std::map<std::string, s32> ret;
for (const CInt32POINode& node : int32Nodes) for (const CInt32POINode& node : int32Nodes)
ret[node.GetString()] = node.GetValue(); ret[std::string(node.GetString())] = node.GetValue();
return ret; return ret;
} }
@ -66,7 +66,7 @@ CAnimSourceReaderBase::GetUniqueBoolPOIs() const
const std::vector<CBoolPOINode>& boolNodes = x4_sourceInfo->GetBoolPOIStream(); const std::vector<CBoolPOINode>& boolNodes = x4_sourceInfo->GetBoolPOIStream();
std::map<std::string, bool> ret; std::map<std::string, bool> ret;
for (const CBoolPOINode& node : boolNodes) for (const CBoolPOINode& node : boolNodes)
ret[node.GetString()] = node.GetValue(); ret[std::string(node.GetString())] = node.GetValue();
return ret; return ret;
} }

View File

@ -3,7 +3,7 @@
namespace urde namespace urde
{ {
CAnimTreeAnimReaderContainer::CAnimTreeAnimReaderContainer(const std::string& name, CAnimTreeAnimReaderContainer::CAnimTreeAnimReaderContainer(std::string_view name,
std::shared_ptr<IAnimReader> reader, std::shared_ptr<IAnimReader> reader,
u32 dbIdx) u32 dbIdx)
: CAnimTreeNode(name), x14_reader(reader), x1c_animDbIdx(dbIdx) : CAnimTreeNode(name), x14_reader(reader), x1c_animDbIdx(dbIdx)

View File

@ -11,7 +11,7 @@ class CAnimTreeAnimReaderContainer : public CAnimTreeNode
std::shared_ptr<IAnimReader> x14_reader; std::shared_ptr<IAnimReader> x14_reader;
u32 x1c_animDbIdx; u32 x1c_animDbIdx;
public: public:
CAnimTreeAnimReaderContainer(const std::string& name, CAnimTreeAnimReaderContainer(std::string_view name,
std::shared_ptr<IAnimReader> reader, std::shared_ptr<IAnimReader> reader,
u32 animDbIdx); u32 animDbIdx);

View File

@ -13,7 +13,7 @@ std::string CAnimTreeBlend::CreatePrimitiveName(const std::shared_ptr<CAnimTreeN
CAnimTreeBlend::CAnimTreeBlend(bool b1, CAnimTreeBlend::CAnimTreeBlend(bool b1,
const std::shared_ptr<CAnimTreeNode>& a, const std::shared_ptr<CAnimTreeNode>& a,
const std::shared_ptr<CAnimTreeNode>& b, const std::shared_ptr<CAnimTreeNode>& b,
float blendWeight, const std::string& name) float blendWeight, std::string_view name)
: CAnimTreeTweenBase(b1, a, b, 1 | 2, name), x24_blendWeight(blendWeight) : CAnimTreeTweenBase(b1, a, b, 1 | 2, name), x24_blendWeight(blendWeight)
{ {

View File

@ -17,7 +17,7 @@ public:
CAnimTreeBlend(bool, CAnimTreeBlend(bool,
const std::shared_ptr<CAnimTreeNode>& a, const std::shared_ptr<CAnimTreeNode>& a,
const std::shared_ptr<CAnimTreeNode>& b, const std::shared_ptr<CAnimTreeNode>& b,
float blendWeight, const std::string& name); float blendWeight, std::string_view name);
SAdvancementResults VAdvanceView(const CCharAnimTime& a); SAdvancementResults VAdvanceView(const CCharAnimTime& a);
CCharAnimTime VGetTimeRemaining() const; CCharAnimTime VGetTimeRemaining() const;

View File

@ -5,7 +5,7 @@ namespace urde
CAnimTreeDoubleChild::CAnimTreeDoubleChild(const std::weak_ptr<CAnimTreeNode>& a, CAnimTreeDoubleChild::CAnimTreeDoubleChild(const std::weak_ptr<CAnimTreeNode>& a,
const std::weak_ptr<CAnimTreeNode>& b, const std::weak_ptr<CAnimTreeNode>& b,
const std::string& name) std::string_view name)
: CAnimTreeNode(name), x14_a(a.lock()), x18_b(b.lock()) : CAnimTreeNode(name), x14_a(a.lock()), x18_b(b.lock())
{ {
} }

View File

@ -26,7 +26,7 @@ protected:
public: public:
CAnimTreeDoubleChild(const std::weak_ptr<CAnimTreeNode>& a, const std::weak_ptr<CAnimTreeNode>& b, CAnimTreeDoubleChild(const std::weak_ptr<CAnimTreeNode>& a, const std::weak_ptr<CAnimTreeNode>& b,
const std::string& name); std::string_view name);
SAdvancementResults VAdvanceView(const CCharAnimTime& a); SAdvancementResults VAdvanceView(const CCharAnimTime& a);
u32 VGetBoolPOIList(const CCharAnimTime& time, CBoolPOINode* listOut, u32 capacity, u32 iterator, u32) const; u32 VGetBoolPOIList(const CCharAnimTime& time, CBoolPOINode* listOut, u32 capacity, u32 iterator, u32) const;
u32 VGetInt32POIList(const CCharAnimTime& time, CInt32POINode* listOut, u32 capacity, u32 iterator, u32) const; u32 VGetInt32POIList(const CCharAnimTime& time, CInt32POINode* listOut, u32 capacity, u32 iterator, u32) const;

View File

@ -11,7 +11,7 @@ class CAnimTreeNode : public IAnimReader
protected: protected:
std::string x4_name; std::string x4_name;
public: public:
CAnimTreeNode(const std::string& name) : x4_name(name) {} CAnimTreeNode(std::string_view name) : x4_name(name) {}
bool IsCAnimTreeNode() const {return true;} bool IsCAnimTreeNode() const {return true;}
virtual u32 Depth() const=0; virtual u32 Depth() const=0;

View File

@ -7,7 +7,7 @@ namespace urde
CAnimTreeSequence::CAnimTreeSequence(const std::vector<std::shared_ptr<IMetaAnim>>& seq, CAnimTreeSequence::CAnimTreeSequence(const std::vector<std::shared_ptr<IMetaAnim>>& seq,
const CAnimSysContext& animSys, const CAnimSysContext& animSys,
const std::string& name) std::string_view name)
: CAnimTreeSingleChild(seq[0]->GetAnimationTree(animSys, CMetaAnimTreeBuildOrders::NoSpecialOrders()), name), : CAnimTreeSingleChild(seq[0]->GetAnimationTree(animSys, CMetaAnimTreeBuildOrders::NoSpecialOrders()), name),
x18_(animSys), x3c_fundamentals(CSequenceHelper(seq, animSys).ComputeSequenceFundamentals()), x94_curTime(0.f) x18_(animSys), x3c_fundamentals(CSequenceHelper(seq, animSys).ComputeSequenceFundamentals()), x94_curTime(0.f)
{ {
@ -16,7 +16,7 @@ CAnimTreeSequence::CAnimTreeSequence(const std::vector<std::shared_ptr<IMetaAnim
CAnimTreeSequence::CAnimTreeSequence(const std::shared_ptr<CAnimTreeNode>& curNode, CAnimTreeSequence::CAnimTreeSequence(const std::shared_ptr<CAnimTreeNode>& curNode,
const std::vector<std::shared_ptr<IMetaAnim>>& metaAnims, const std::vector<std::shared_ptr<IMetaAnim>>& metaAnims,
const CAnimSysContext& animSys, const CAnimSysContext& animSys,
const std::string& name, std::string_view name,
const CSequenceFundamentals& fundamentals, const CSequenceFundamentals& fundamentals,
const CCharAnimTime& time) const CCharAnimTime& time)
: CAnimTreeSingleChild(curNode, name), x18_(animSys), x28_(metaAnims), x3c_fundamentals(fundamentals), x94_curTime(time) : CAnimTreeSingleChild(curNode, name), x18_(animSys), x28_(metaAnims), x3c_fundamentals(fundamentals), x94_curTime(time)

Some files were not shown because too many files have changed in this diff Show More