Windows fixes

This commit is contained in:
Jack Andersen 2018-10-14 10:16:21 -10:00
parent 1559163f98
commit 1851308021
68 changed files with 1343 additions and 968 deletions

1
.gitignore vendored
View File

@ -7,3 +7,4 @@ docs/*
.idea/dictionaries
.idea/workspace.xml
.idea/misc.xml
Editor/platforms/win/urde.rc

View File

@ -62,9 +62,12 @@ if(MSVC)
endif()
# Shaddup MSVC
add_definitions(-DUNICODE=1 -D_UNICODE=1 -D__SSE__=1 -D_CRT_SECURE_NO_WARNINGS=1 -DD_SCL_SECURE_NO_WARNINGS=1
-D_SCL_SECURE_NO_DEPRECATE=1 -D_CRT_NONSTDC_NO_WARNINGS=1 /IGNORE:4221 /wd4018 /wd4800 /wd4005 /wd4311
/wd4267 /wd4244 /wd4200 /wd4305 /wd4067 /wd4146 /wd4309 /wd4805 ${VS_DEFINES})
add_definitions(-DUNICODE=1 -D_UNICODE=1 -D__SSE__=1
-D_CRT_SECURE_NO_WARNINGS=1 -DD_SCL_SECURE_NO_WARNINGS=1
-D_SCL_SECURE_NO_DEPRECATE=1 -D_CRT_NONSTDC_NO_WARNINGS=1
/IGNORE:4221 /wd4018 /wd4800 /wd4005 /wd4311
/wd4267 /wd4244 /wd4200 /wd4305 /wd4067 /wd4146 /wd4309 /wd4805
-D_ENABLE_EXTENDED_ALIGNED_STORAGE=1 ${VS_DEFINES})
if(WINDOWS_STORE)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /AI\"$ENV{PROGRAMFILES\(X86\)}/Microsoft Visual Studio/2017/Community/Common7/IDE/VC/vcpackages\" /AI\"$ENV{PROGRAMFILES\(X86\)}/Windows Kits/10/UnionMetadata\"")

View File

@ -37,7 +37,7 @@ void LoadAssetMap(athena::io::MemoryReader& ar)
if (ar.length() >= 4)
ar.readBytesToBuf(&magic, 4);
if (magic != FOURCC('AIDM'))
Log.report(logvisor::Warning, _S("Unable to load asset map; Assets will not have proper filenames for most files."));
Log.report(logvisor::Warning, _SYS_STR("Unable to load asset map; Assets will not have proper filenames for most files."));
else
{
uint32_t assetCount = ar.readUint32Big();

View File

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

View File

@ -125,7 +125,7 @@ bool MAPU::Cook(const hecl::blender::MapUniverse& mapuIn, const hecl::ProjectPat
mapu.worlds.emplace_back();
MAPU::World& wldOut = mapu.worlds.back();
wldOut.name = wld.name;
wldOut.mlvl = hecl::ProjectPath(wld.worldPath, _S("!world.*"));
wldOut.mlvl = hecl::ProjectPath(wld.worldPath, _SYS_STR("!world.*"));
wldOut.transform.xf[0] = wld.xf.val[0];
wldOut.transform.xf[1] = wld.xf.val[1];
wldOut.transform.xf[2] = wld.xf.val[2];

View File

@ -16,7 +16,7 @@ bool ReadMLVLToBlender(hecl::blender::Connection& conn,
bool force,
std::function<void(const hecl::SystemChar*)> fileChanged)
{
hecl::ProjectPath blendPath = outPath.getWithExtension(_S(".blend"), true);
hecl::ProjectPath blendPath = outPath.getWithExtension(_SYS_STR(".blend"), true);
if (!force && blendPath.isFile())
return true;

View File

@ -1,4 +1,4 @@
#include <athena/Types.hpp>
#include "athena/Types.hpp"
#include "OBBTreeBuilder.hpp"
#include "zeus/CTransform.hpp"
#include "DataSpec/DNAMP1/DCLN.hpp"
@ -48,7 +48,9 @@ static FittedOBB BuildFromCovarianceMatrix(gmm::dense_matrix<float>& C,
// extract the eigenvalues and eigenvectors from C
gmm::dense_matrix<float> eigvec(3,3);
std::vector<float> eigval(3);
gmm::symmetric_qr_algorithm(C, eigval, eigvec);
using namespace gmm;
using MAT1 = gmm::dense_matrix<float>;
gmm::symmetric_qr_algorithm(C, eigval, eigvec, default_tol_for_qr);
// find the right, up and forward vectors from the eigenvectors
zeus::CVector3f r(eigvec(0,0), eigvec(1,0), eigvec(2,0));

View File

@ -264,7 +264,7 @@ hecl::ProjectPath PAKRouter<BRIDGETYPE>::getCharacterWorking(const EntryType* en
if (entry->type == FOURCC('EVNT'))
{
hecl::SystemStringConv wideStr(characterSearch->second.second);
return characterPath.getWithExtension((hecl::SystemString(_S(".")) + wideStr.c_str()).c_str(), true);
return characterPath.getWithExtension((hecl::SystemString(_SYS_STR(".")) + wideStr.c_str()).c_str(), true);
}
return characterPath.ensureAuxInfo(characterSearch->second.second);
}
@ -299,7 +299,7 @@ hecl::ProjectPath PAKRouter<BRIDGETYPE>::getWorking(const EntryType* entry,
if (extractor.fileExts[0] && !extractor.fileExts[1])
entName += extractor.fileExts[0];
else if (extractor.fileExts[0])
entName += _S(".*");
entName += _SYS_STR(".*");
else if (hecl::ProjectPath chWork = getCharacterWorking(entry))
return chWork;
return hecl::ProjectPath(pakPath, entName).ensureAuxInfo(auxInfo);
@ -320,7 +320,7 @@ hecl::ProjectPath PAKRouter<BRIDGETYPE>::getWorking(const EntryType* entry,
if (extractor.fileExts[0] && !extractor.fileExts[1])
entName += extractor.fileExts[0];
else if (extractor.fileExts[0])
entName += _S(".*");
entName += _SYS_STR(".*");
else if (hecl::ProjectPath chWork = getCharacterWorking(entry))
return chWork;
if (bridge.getPAK().m_noShare)
@ -347,7 +347,7 @@ hecl::ProjectPath PAKRouter<BRIDGETYPE>::getWorking(const EntryType* entry,
if (extractor.fileExts[0] && !extractor.fileExts[1])
entName += extractor.fileExts[0];
else if (extractor.fileExts[0])
entName += _S(".*");
entName += _SYS_STR(".*");
else if (hecl::ProjectPath chWork = getCharacterWorking(entry))
return chWork;
hecl::ProjectPath sharedPath(m_sharedWorking, entName);
@ -442,7 +442,7 @@ hecl::SystemString PAKRouter<BRIDGETYPE>::getResourceRelativePath(const EntryTyp
hecl::ProjectPath aPath = getWorking(&a, BRIDGETYPE::LookupExtractor(*node, *pak, a));
hecl::SystemString ret;
for (int i=0 ; i<aPath.levelCount() ; ++i)
ret += _S("../");
ret += _SYS_STR("../");
hecl::ProjectPath bPath = getWorking(be, BRIDGETYPE::LookupExtractor(*node, *pak, *be));
ret += bPath.getRelativePath();
return ret;
@ -543,7 +543,7 @@ bool PAKRouter<BRIDGETYPE>::extractResources(const BRIDGETYPE& pakBridge, bool f
{
cooked.makeDirChain(false);
PAKEntryReadStream s = entryPtr->beginReadStream(*node);
FILE* fout = hecl::Fopen(cooked.getAbsolutePath().data(), _S("wb"));
FILE* fout = hecl::Fopen(cooked.getAbsolutePath().data(), _SYS_STR("wb"));
fwrite(s.data(), 1, s.length(), fout);
fclose(fout);
}

View File

@ -1013,11 +1013,11 @@ bool TXTR::Extract(PAKEntryReadStream& rs, const hecl::ProjectPath& outPath)
uint16_t height = rs.readUint16Big();
uint32_t numMips = rs.readUint32Big();
FILE* fp = hecl::Fopen(outPath.getAbsolutePath().data(), _S("wb"));
FILE* fp = hecl::Fopen(outPath.getAbsolutePath().data(), _SYS_STR("wb"));
if (!fp)
{
Log.report(logvisor::Error,
_S("Unable to open '%s' for writing"),
_SYS_STR("Unable to open '%s' for writing"),
outPath.getAbsolutePath().data());
return false;
}
@ -1271,11 +1271,11 @@ static int GetNumPaletteEntriesForGCN(png_structp png, png_infop info)
bool TXTR::Cook(const hecl::ProjectPath& inPath, const hecl::ProjectPath& outPath)
{
FILE* inf = hecl::Fopen(inPath.getAbsolutePath().data(), _S("rb"));
FILE* inf = hecl::Fopen(inPath.getAbsolutePath().data(), _SYS_STR("rb"));
if (!inf)
{
Log.report(logvisor::Error,
_S("Unable to open '%s' for reading"),
_SYS_STR("Unable to open '%s' for reading"),
inPath.getAbsolutePath().data());
return false;
}
@ -1285,7 +1285,7 @@ bool TXTR::Cook(const hecl::ProjectPath& inPath, const hecl::ProjectPath& outPat
fread(header, 1, 8, inf);
if (png_sig_cmp((png_const_bytep)header, 0, 8))
{
Log.report(logvisor::Error, _S("invalid PNG signature in '%s'"),
Log.report(logvisor::Error, _SYS_STR("invalid PNG signature in '%s'"),
inPath.getAbsolutePath().data());
fclose(inf);
return false;
@ -1310,7 +1310,7 @@ bool TXTR::Cook(const hecl::ProjectPath& inPath, const hecl::ProjectPath& outPat
if (setjmp(png_jmpbuf(pngRead)))
{
Log.report(logvisor::Error, _S("unable to initialize libpng I/O for '%s'"),
Log.report(logvisor::Error, _SYS_STR("unable to initialize libpng I/O for '%s'"),
inPath.getAbsolutePath().data());
fclose(inf);
png_destroy_read_struct(&pngRead, &info, nullptr);
@ -1356,7 +1356,7 @@ bool TXTR::Cook(const hecl::ProjectPath& inPath, const hecl::ProjectPath& outPat
if (bitDepth != 8)
{
Log.report(logvisor::Error, _S("'%s' is not 8 bits-per-channel"),
Log.report(logvisor::Error, _SYS_STR("'%s' is not 8 bits-per-channel"),
inPath.getAbsolutePath().data());
fclose(inf);
png_destroy_read_struct(&pngRead, &info, nullptr);
@ -1390,7 +1390,7 @@ bool TXTR::Cook(const hecl::ProjectPath& inPath, const hecl::ProjectPath& outPat
nComps = 1;
break;
default:
Log.report(logvisor::Error, _S("unsupported color type in '%s'"),
Log.report(logvisor::Error, _SYS_STR("unsupported color type in '%s'"),
inPath.getAbsolutePath().data());
fclose(inf);
png_destroy_read_struct(&pngRead, &info, nullptr);
@ -1413,7 +1413,7 @@ bool TXTR::Cook(const hecl::ProjectPath& inPath, const hecl::ProjectPath& outPat
if (setjmp(png_jmpbuf(pngRead)))
{
Log.report(logvisor::Error, _S("unable to read image in '%s'"),
Log.report(logvisor::Error, _SYS_STR("unable to read image in '%s'"),
inPath.getAbsolutePath().data());
fclose(inf);
png_destroy_read_struct(&pngRead, &info, nullptr);
@ -1629,7 +1629,7 @@ bool TXTR::Cook(const hecl::ProjectPath& inPath, const hecl::ProjectPath& outPat
if (outf.hasError())
{
Log.report(logvisor::Error,
_S("Unable to open '%s' for writing"),
_SYS_STR("Unable to open '%s' for writing"),
outPath.getAbsolutePath().data());
return false;
}
@ -1645,11 +1645,11 @@ bool TXTR::Cook(const hecl::ProjectPath& inPath, const hecl::ProjectPath& outPat
bool TXTR::CookPC(const hecl::ProjectPath& inPath, const hecl::ProjectPath& outPath)
{
FILE* inf = hecl::Fopen(inPath.getAbsolutePath().data(), _S("rb"));
FILE* inf = hecl::Fopen(inPath.getAbsolutePath().data(), _SYS_STR("rb"));
if (!inf)
{
Log.report(logvisor::Error,
_S("Unable to open '%s' for reading"),
_SYS_STR("Unable to open '%s' for reading"),
inPath.getAbsolutePath().data());
return false;
}
@ -1659,7 +1659,7 @@ bool TXTR::CookPC(const hecl::ProjectPath& inPath, const hecl::ProjectPath& outP
fread(header, 1, 8, inf);
if (png_sig_cmp((png_const_bytep)header, 0, 8))
{
Log.report(logvisor::Error, _S("invalid PNG signature in '%s'"),
Log.report(logvisor::Error, _SYS_STR("invalid PNG signature in '%s'"),
inPath.getAbsolutePath().data());
fclose(inf);
return false;
@ -1684,7 +1684,7 @@ bool TXTR::CookPC(const hecl::ProjectPath& inPath, const hecl::ProjectPath& outP
if (setjmp(png_jmpbuf(pngRead)))
{
Log.report(logvisor::Error, _S("unable to initialize libpng I/O for '%s'"),
Log.report(logvisor::Error, _SYS_STR("unable to initialize libpng I/O for '%s'"),
inPath.getAbsolutePath().data());
fclose(inf);
png_destroy_read_struct(&pngRead, &info, nullptr);
@ -1722,7 +1722,7 @@ bool TXTR::CookPC(const hecl::ProjectPath& inPath, const hecl::ProjectPath& outP
if (bitDepth != 8)
{
Log.report(logvisor::Error, _S("'%s' is not 8 bits-per-channel"),
Log.report(logvisor::Error, _SYS_STR("'%s' is not 8 bits-per-channel"),
inPath.getAbsolutePath().data());
fclose(inf);
png_destroy_read_struct(&pngRead, &info, nullptr);
@ -1754,7 +1754,7 @@ bool TXTR::CookPC(const hecl::ProjectPath& inPath, const hecl::ProjectPath& outP
paletteBuf = ReadPalette(pngRead, info, paletteSize);
break;
default:
Log.report(logvisor::Error, _S("unsupported color type in '%s'"),
Log.report(logvisor::Error, _SYS_STR("unsupported color type in '%s'"),
inPath.getAbsolutePath().data());
fclose(inf);
png_destroy_read_struct(&pngRead, &info, nullptr);
@ -1775,7 +1775,7 @@ bool TXTR::CookPC(const hecl::ProjectPath& inPath, const hecl::ProjectPath& outP
if (setjmp(png_jmpbuf(pngRead)))
{
Log.report(logvisor::Error, _S("unable to read image in '%s'"),
Log.report(logvisor::Error, _SYS_STR("unable to read image in '%s'"),
inPath.getAbsolutePath().data());
fclose(inf);
png_destroy_read_struct(&pngRead, &info, nullptr);
@ -1908,7 +1908,7 @@ bool TXTR::CookPC(const hecl::ProjectPath& inPath, const hecl::ProjectPath& outP
if (outf.hasError())
{
Log.report(logvisor::Error,
_S("Unable to open '%s' for writing"),
_SYS_STR("Unable to open '%s' for writing"),
outPath.getAbsolutePath().data());
return false;
}

View File

@ -195,7 +195,7 @@ bool AGSC::Extract(PAKEntryReadStream& rs, const hecl::ProjectPath& dir)
/* Write out project/pool */
{
auto projd = group.getProj().toYAML();
athena::io::FileWriter fo(hecl::ProjectPath(dir, _S("!project.yaml")).getAbsolutePath());
athena::io::FileWriter fo(hecl::ProjectPath(dir, _SYS_STR("!project.yaml")).getAbsolutePath());
if (fo.hasError())
return false;
fo.writeUBytes(projd.data(), projd.size());
@ -203,7 +203,7 @@ bool AGSC::Extract(PAKEntryReadStream& rs, const hecl::ProjectPath& dir)
{
auto poold = group.getPool().toYAML();
athena::io::FileWriter fo(hecl::ProjectPath(dir, _S("!pool.yaml")).getAbsolutePath());
athena::io::FileWriter fo(hecl::ProjectPath(dir, _SYS_STR("!pool.yaml")).getAbsolutePath());
if (fo.hasError())
return false;
fo.writeUBytes(poold.data(), poold.size());

View File

@ -1089,9 +1089,9 @@ bool ANCS::Extract(const SpecBase& dataSpec,
hecl::blender::Token& btok,
std::function<void(const hecl::SystemChar*)> fileChanged)
{
hecl::ProjectPath yamlPath = outPath.getWithExtension(_S(".yaml"), true);
hecl::ProjectPath yamlPath = outPath.getWithExtension(_SYS_STR(".yaml"), true);
hecl::ProjectPath::Type yamlType = yamlPath.getPathType();
hecl::ProjectPath blendPath = outPath.getWithExtension(_S(".blend"), true);
hecl::ProjectPath blendPath = outPath.getWithExtension(_SYS_STR(".blend"), true);
hecl::ProjectPath::Type blendType = blendPath.getPathType();
ANCS ancs;
@ -1123,9 +1123,9 @@ bool ANCS::Extract(const SpecBase& dataSpec,
if (res.second.evntId)
{
hecl::SystemStringConv sysStr(res.second.name);
hecl::ProjectPath evntYamlPath = outPath.getWithExtension((hecl::SystemString(_S(".")) +
hecl::ProjectPath evntYamlPath = outPath.getWithExtension((hecl::SystemString(_SYS_STR(".")) +
sysStr.c_str() +
_S(".evnt.yaml")).c_str(), true);
_SYS_STR(".evnt.yaml")).c_str(), true);
hecl::ProjectPath::Type evntYamlType = evntYamlPath.getPathType();
if (force || evntYamlType == hecl::ProjectPath::Type::None)
@ -1148,26 +1148,26 @@ bool ANCS::Cook(const hecl::ProjectPath& outPath,
const DNAANCS::Actor& actor)
{
/* Search for yaml */
hecl::ProjectPath yamlPath = inPath.getWithExtension(_S(".yaml"), true);
hecl::ProjectPath yamlPath = inPath.getWithExtension(_SYS_STR(".yaml"), true);
if (!yamlPath.isFile())
Log.report(logvisor::Fatal, _S("'%s' not found as file"),
Log.report(logvisor::Fatal, _SYS_STR("'%s' not found as file"),
yamlPath.getRelativePath().data());
athena::io::FileReader reader(yamlPath.getAbsolutePath());
if (!reader.isOpen())
Log.report(logvisor::Fatal, _S("can't open '%s' for reading"),
Log.report(logvisor::Fatal, _SYS_STR("can't open '%s' for reading"),
yamlPath.getRelativePath().data());
if (!athena::io::ValidateFromYAMLStream<ANCS>(reader))
{
Log.report(logvisor::Fatal, _S("'%s' is not urde::DNAMP1::ANCS type"),
Log.report(logvisor::Fatal, _SYS_STR("'%s' is not urde::DNAMP1::ANCS type"),
yamlPath.getRelativePath().data());
}
athena::io::YAMLDocReader yamlReader;
if (!yamlReader.parse(&reader))
{
Log.report(logvisor::Fatal, _S("unable to parse '%s'"),
Log.report(logvisor::Fatal, _SYS_STR("unable to parse '%s'"),
yamlPath.getRelativePath().data());
}
ANCS ancs;
@ -1183,7 +1183,7 @@ bool ANCS::Cook(const hecl::ProjectPath& outPath,
ch.cskrIce = UniqueID32Zero{};
hecl::SystemStringConv chSysName(ch.name);
ch.cskr = inPath.ensureAuxInfo(hecl::SystemString(chSysName.sys_str()) + _S(".CSKR"));
ch.cskr = inPath.ensureAuxInfo(hecl::SystemString(chSysName.sys_str()) + _SYS_STR(".CSKR"));
int subtypeIdx = 0;
ch.animAABBs.clear();
@ -1207,7 +1207,7 @@ bool ANCS::Cook(const hecl::ProjectPath& outPath,
{
const DNAANCS::Armature& arm = actor.armatures[sub.armature];
hecl::SystemStringConv armSysName(arm.name);
ch.cinf = inPath.ensureAuxInfo(hecl::SystemString(armSysName.sys_str()) + _S(".CINF"));
ch.cinf = inPath.ensureAuxInfo(hecl::SystemString(armSysName.sys_str()) + _SYS_STR(".CINF"));
ch.cmdl = sub.mesh;
auto search = std::find_if(sub.overlayMeshes.cbegin(), sub.overlayMeshes.cend(),
[](const auto& p) { return p.first == "ICE"; });
@ -1215,8 +1215,8 @@ bool ANCS::Cook(const hecl::ProjectPath& outPath,
{
hecl::SystemStringConv overlaySys(search->first);
ch.cmdlIce = search->second;
ch.cskrIce = inPath.ensureAuxInfo(hecl::SystemString(chSysName.sys_str()) + _S('.') +
overlaySys.c_str() + _S(".CSKR"));
ch.cskrIce = inPath.ensureAuxInfo(hecl::SystemString(chSysName.sys_str()) + _SYS_STR('.') +
overlaySys.c_str() + _SYS_STR(".CSKR"));
}
}
@ -1235,7 +1235,7 @@ bool ANCS::Cook(const hecl::ProjectPath& outPath,
ancs.enumeratePrimitives([&](AnimationSet::MetaAnimPrimitive& prim) -> bool
{
hecl::SystemStringConv sysStr(prim.animName);
hecl::ProjectPath pathOut = inPath.ensureAuxInfo(hecl::SystemString(sysStr.sys_str()) + _S(".ANIM"));
hecl::ProjectPath pathOut = inPath.ensureAuxInfo(hecl::SystemString(sysStr.sys_str()) + _SYS_STR(".ANIM"));
prim.animId = pathOut;
return true;
});
@ -1245,16 +1245,16 @@ bool ANCS::Cook(const hecl::ProjectPath& outPath,
for (const DNAANCS::Action& act : actor.actions)
{
hecl::SystemStringConv sysStr(act.name);
hecl::ProjectPath pathOut = inPath.ensureAuxInfo(hecl::SystemString(sysStr.sys_str()) + _S(".ANIM"));
hecl::ProjectPath pathOut = inPath.ensureAuxInfo(hecl::SystemString(sysStr.sys_str()) + _SYS_STR(".ANIM"));
ancs.animationSet.animResources.emplace_back();
ancs.animationSet.animResources.back().animId = pathOut;
/* Check for associated EVNT YAML */
hecl::ProjectPath evntYamlPath = inPath.getWithExtension((hecl::SystemString(_S(".")) +
hecl::ProjectPath evntYamlPath = inPath.getWithExtension((hecl::SystemString(_SYS_STR(".")) +
sysStr.c_str() +
_S(".evnt.yaml")).c_str(), true);
evntYamlPath = evntYamlPath.ensureAuxInfo(_S(""));
_SYS_STR(".evnt.yaml")).c_str(), true);
evntYamlPath = evntYamlPath.ensureAuxInfo(_SYS_STR(""));
if (evntYamlPath.isFile())
ancs.animationSet.animResources.back().evntId = evntYamlPath;
}
@ -1299,7 +1299,7 @@ bool ANCS::CookCSKR(const hecl::ProjectPath& outPath,
hecl::SystemString subName(inPath.getAuxInfo().begin(),
inPath.getAuxInfo().end() - 5);
hecl::SystemString overName;
auto dotPos = subName.rfind(_S('.'));
auto dotPos = subName.rfind(_SYS_STR('.'));
if (dotPos != hecl::SystemString::npos)
{
overName = hecl::SystemString(subName.begin() + dotPos + 1, subName.end());
@ -1316,7 +1316,7 @@ bool ANCS::CookCSKR(const hecl::ProjectPath& outPath,
}
const DNAANCS::Actor::Subtype* subtype = nullptr;
if (subName != "ATTACH")
if (subName != _SYS_STR("ATTACH"))
{
for (const DNAANCS::Actor::Subtype& sub : actor.subtypes)
{
@ -1327,11 +1327,11 @@ bool ANCS::CookCSKR(const hecl::ProjectPath& outPath,
}
}
if (!subtype)
Log.report(logvisor::Fatal, _S("unable to find subtype '%s'"), subName.c_str());
Log.report(logvisor::Fatal, _SYS_STR("unable to find subtype '%s'"), subName.c_str());
}
const hecl::ProjectPath* modelPath = nullptr;
if (subName == "ATTACH")
if (subName == _SYS_STR("ATTACH"))
{
const DNAANCS::Actor::Attachment* attachment = nullptr;
for (const DNAANCS::Actor::Attachment& att : actor.attachments)
@ -1343,7 +1343,7 @@ bool ANCS::CookCSKR(const hecl::ProjectPath& outPath,
}
}
if (!attachment)
Log.report(logvisor::Fatal, _S("unable to find attachment '%s'"), overName.c_str());
Log.report(logvisor::Fatal, _SYS_STR("unable to find attachment '%s'"), overName.c_str());
modelPath = &attachment->mesh;
}
else if (overName.empty())
@ -1360,19 +1360,19 @@ bool ANCS::CookCSKR(const hecl::ProjectPath& outPath,
}
}
if (!modelPath)
Log.report(logvisor::Fatal, _S("unable to resolve model path of %s:%s"), subName.c_str(), overName.c_str());
Log.report(logvisor::Fatal, _SYS_STR("unable to resolve model path of %s:%s"), subName.c_str(), overName.c_str());
if (!modelPath->isFile())
Log.report(logvisor::Fatal, _S("unable to resolve '%s'"), modelPath->getRelativePath().data());
Log.report(logvisor::Fatal, _SYS_STR("unable to resolve '%s'"), modelPath->getRelativePath().data());
hecl::ProjectPath skinIntPath = modelPath->getCookedPath(SpecEntMP1).getWithExtension(_S(".skinint"));
hecl::ProjectPath skinIntPath = modelPath->getCookedPath(SpecEntMP1).getWithExtension(_SYS_STR(".skinint"));
if (!skinIntPath.isFileOrGlob() || skinIntPath.getModtime() < modelPath->getModtime())
if (!modelCookFunc(*modelPath))
Log.report(logvisor::Fatal, _S("unable to cook '%s'"), modelPath->getRelativePath().data());
Log.report(logvisor::Fatal, _SYS_STR("unable to cook '%s'"), modelPath->getRelativePath().data());
athena::io::FileReader skinIO(skinIntPath.getAbsolutePath(), 1024*32, false);
if (skinIO.hasError())
Log.report(logvisor::Fatal, _S("unable to open '%s'"), skinIntPath.getRelativePath().data());
Log.report(logvisor::Fatal, _SYS_STR("unable to open '%s'"), skinIntPath.getRelativePath().data());
std::vector<std::string> boneNames;
uint32_t boneNameCount = skinIO.readUint32Big();
@ -1437,7 +1437,7 @@ bool ANCS::CookCSKRPC(const hecl::ProjectPath& outPath,
hecl::SystemString subName(inPath.getAuxInfo().begin(),
inPath.getAuxInfo().end() - 5);
hecl::SystemString overName;
auto dotPos = subName.rfind(_S('.'));
auto dotPos = subName.rfind(_SYS_STR('.'));
if (dotPos != hecl::SystemString::npos)
{
overName = hecl::SystemString(subName.begin() + dotPos + 1, subName.end());
@ -1454,7 +1454,7 @@ bool ANCS::CookCSKRPC(const hecl::ProjectPath& outPath,
}
const DNAANCS::Actor::Subtype* subtype = nullptr;
if (subName != "ATTACH")
if (subName != _SYS_STR("ATTACH"))
{
for (const DNAANCS::Actor::Subtype& sub : actor.subtypes)
{
@ -1465,11 +1465,11 @@ bool ANCS::CookCSKRPC(const hecl::ProjectPath& outPath,
}
}
if (!subtype)
Log.report(logvisor::Fatal, _S("unable to find subtype '%s'"), subName.c_str());
Log.report(logvisor::Fatal, _SYS_STR("unable to find subtype '%s'"), subName.c_str());
}
const hecl::ProjectPath* modelPath = nullptr;
if (subName == "ATTACH")
if (subName == _SYS_STR("ATTACH"))
{
const DNAANCS::Actor::Attachment* attachment = nullptr;
for (const DNAANCS::Actor::Attachment& att : actor.attachments)
@ -1481,7 +1481,7 @@ bool ANCS::CookCSKRPC(const hecl::ProjectPath& outPath,
}
}
if (!attachment)
Log.report(logvisor::Fatal, _S("unable to find attachment '%s'"), overName.c_str());
Log.report(logvisor::Fatal, _SYS_STR("unable to find attachment '%s'"), overName.c_str());
modelPath = &attachment->mesh;
}
else if (overName.empty())
@ -1498,19 +1498,19 @@ bool ANCS::CookCSKRPC(const hecl::ProjectPath& outPath,
}
}
if (!modelPath)
Log.report(logvisor::Fatal, _S("unable to resolve model path of %s:%s"), subName.c_str(), overName.c_str());
Log.report(logvisor::Fatal, _SYS_STR("unable to resolve model path of %s:%s"), subName.c_str(), overName.c_str());
if (!modelPath->isFile())
Log.report(logvisor::Fatal, _S("unable to resolve '%s'"), modelPath->getRelativePath().data());
Log.report(logvisor::Fatal, _SYS_STR("unable to resolve '%s'"), modelPath->getRelativePath().data());
hecl::ProjectPath skinIntPath = modelPath->getCookedPath(SpecEntMP1PC).getWithExtension(_S(".skinint"));
hecl::ProjectPath skinIntPath = modelPath->getCookedPath(SpecEntMP1PC).getWithExtension(_SYS_STR(".skinint"));
if (!skinIntPath.isFileOrGlob() || skinIntPath.getModtime() < modelPath->getModtime())
if (!modelCookFunc(*modelPath))
Log.report(logvisor::Fatal, _S("unable to cook '%s'"), modelPath->getRelativePath().data());
Log.report(logvisor::Fatal, _SYS_STR("unable to cook '%s'"), modelPath->getRelativePath().data());
athena::io::FileReader skinIO(skinIntPath.getAbsolutePath(), 1024*32, false);
if (skinIO.hasError())
Log.report(logvisor::Fatal, _S("unable to open '%s'"), skinIntPath.getRelativePath().data());
Log.report(logvisor::Fatal, _SYS_STR("unable to open '%s'"), skinIntPath.getRelativePath().data());
std::vector<std::vector<uint32_t>> skinBanks;
uint32_t bankCount = skinIO.readUint32Big();
@ -1605,7 +1605,7 @@ bool ANCS::CookANIM(const hecl::ProjectPath& outPath,
DNAANCS::Action action = ds.compileActionChannelsOnly(actNameView.str());
if (!actor.armatures.size())
Log.report(logvisor::Fatal, _S("0 armatures in %s"),
Log.report(logvisor::Fatal, _SYS_STR("0 armatures in %s"),
inPath.getRelativePath().data());
/* Build bone ID map */
@ -1629,9 +1629,9 @@ bool ANCS::CookANIM(const hecl::ProjectPath& outPath,
ANIM anim(action, boneIdMap, *rigInv, pc);
/* Check for associated EVNT YAML */
hecl::ProjectPath evntYamlPath = inPath.getWithExtension((hecl::SystemString(_S(".")) + actName +
_S(".evnt.yaml")).c_str(), true);
evntYamlPath = evntYamlPath.ensureAuxInfo(_S(""));
hecl::ProjectPath evntYamlPath = inPath.getWithExtension((hecl::SystemString(_SYS_STR(".")) + actName +
_SYS_STR(".evnt.yaml")).c_str(), true);
evntYamlPath = evntYamlPath.ensureAuxInfo(_SYS_STR(""));
if (evntYamlPath.isFile())
anim.m_anim->evnt = evntYamlPath;

View File

@ -36,14 +36,14 @@ bool CMDL::Extract(const SpecBase& dataSpec,
#if 0
/* Cook and re-extract test */
hecl::ProjectPath tempOut = outPath.getWithExtension(_S(".recook"), true);
hecl::ProjectPath tempOut = outPath.getWithExtension(_SYS_STR(".recook"), true);
hecl::blender::Connection::DataStream ds = conn.beginData();
DNACMDL::Mesh mesh = ds.compileMesh(hecl::TopologyTriStrips, -1);
ds.close();
DNACMDL::WriteCMDL<MaterialSet, DNACMDL::SurfaceHeader_1_2, 2>(tempOut, outPath, mesh);
athena::io::FileReader reader(tempOut.getAbsolutePath());
hecl::ProjectPath tempBlend = outPath.getWithExtension(_S(".recook.blend"), true);
hecl::ProjectPath tempBlend = outPath.getWithExtension(_SYS_STR(".recook.blend"), true);
if (!conn.createBlend(tempBlend, hecl::blender::Connection::TypeMesh))
return false;
DNACMDL::ReadCMDLToBlender<PAKRouter<PAKBridge>, MaterialSet, std::pair<CSKR*,CINF*>, DNACMDL::SurfaceHeader_1_2, 2>
@ -51,7 +51,7 @@ bool CMDL::Extract(const SpecBase& dataSpec,
return conn.saveBlend();
#elif 0
/* HMDL cook test */
hecl::ProjectPath tempOut = outPath.getWithExtension(_S(".recook"), true);
hecl::ProjectPath tempOut = outPath.getWithExtension(_SYS_STR(".recook"), true);
hecl::blender::Connection::DataStream ds = conn.beginData();
DNACMDL::Mesh mesh = ds.compileMesh(hecl::HMDLTopology::TriStrips, 16);
ds.close();
@ -73,7 +73,7 @@ bool CMDL::Cook(const hecl::ProjectPath& outPath,
/* Output skinning intermediate */
auto vertCountIt = skinMesh.contiguousSkinVertCounts.cbegin();
athena::io::FileWriter writer(outPath.getWithExtension(_S(".skinint")).getAbsolutePath());
athena::io::FileWriter writer(outPath.getWithExtension(_SYS_STR(".skinint")).getAbsolutePath());
writer.writeUint32Big(skinMesh.boneNames.size());
for (const std::string& boneName : skinMesh.boneNames)
writer.writeString(boneName);
@ -109,7 +109,7 @@ bool CMDL::HMDLCook(const hecl::ProjectPath& outPath,
return false;
/* Output skinning intermediate */
athena::io::FileWriter writer(outPath.getWithExtension(_S(".skinint")).getAbsolutePath());
athena::io::FileWriter writer(outPath.getWithExtension(_SYS_STR(".skinint")).getAbsolutePath());
writer.writeUint32Big(mesh.skinBanks.banks.size());
for (const DNACMDL::Mesh::SkinBanks::Bank& sb : mesh.skinBanks.banks)
{

View File

@ -6,8 +6,8 @@ namespace DataSpec::DNAMP1
bool CSNG::Extract(PAKEntryReadStream& rs, const hecl::ProjectPath& outPath)
{
hecl::ProjectPath midPath = outPath.getWithExtension(_S(".mid"), true);
hecl::ProjectPath yamlPath = outPath.getWithExtension(_S(".yaml"), true);
hecl::ProjectPath midPath = outPath.getWithExtension(_SYS_STR(".mid"), true);
hecl::ProjectPath yamlPath = outPath.getWithExtension(_SYS_STR(".yaml"), true);
Header head;
head.read(rs);
@ -38,9 +38,9 @@ bool CSNG::Extract(PAKEntryReadStream& rs, const hecl::ProjectPath& outPath)
}
/* Update !songs.yaml for Amuse editor */
hecl::ProjectPath audGrp(outPath.getParentPath().getParentPath(), _S("AudioGrp"));
hecl::ProjectPath audGrp(outPath.getParentPath().getParentPath(), _SYS_STR("AudioGrp"));
audGrp.makeDirChain(true);
hecl::ProjectPath songsPath(audGrp, _S("!songs.yaml"));
hecl::ProjectPath songsPath(audGrp, _SYS_STR("!songs.yaml"));
std::experimental::optional<athena::io::FileReader> r;
if (songsPath.isFile())
r.emplace(songsPath.getAbsolutePath());
@ -57,8 +57,8 @@ bool CSNG::Extract(PAKEntryReadStream& rs, const hecl::ProjectPath& outPath)
bool CSNG::Cook(const hecl::ProjectPath& inPath, const hecl::ProjectPath& outPath)
{
hecl::ProjectPath midPath = inPath.getWithExtension(_S(".mid"), true);
hecl::ProjectPath yamlPath = inPath.getWithExtension(_S(".yaml"), true);
hecl::ProjectPath midPath = inPath.getWithExtension(_SYS_STR(".mid"), true);
hecl::ProjectPath yamlPath = inPath.getWithExtension(_SYS_STR(".yaml"), true);
std::vector<uint8_t> sngData;
{

View File

@ -1,6 +1,6 @@
#pragma once
#include <athena/Types.hpp>
#include "athena/Types.hpp"
#include "DataSpec/DNACommon/DeafBabe.hpp"
#include "DataSpec/DNACommon/PAK.hpp"
#include "DataSpec/DNACommon/OBBTreeBuilder.hpp"

View File

@ -83,7 +83,7 @@ PAKBridge::PAKBridge(const nod::Node& node, bool doExtract)
STRG mlvlName;
mlvlName.read(rs);
if (m_levelString.size())
m_levelString += _S(", ");
m_levelString += _SYS_STR(", ");
m_levelString += mlvlName.getSystemString(FOURCC('ENGL'), 0);
}
}
@ -94,8 +94,8 @@ static hecl::SystemString LayerName(std::string_view name)
{
hecl::SystemString ret(hecl::SystemStringConv(name).sys_str());
for (auto& ch : ret)
if (ch == _S('/') || ch == _S('\\'))
ch = _S('-');
if (ch == _SYS_STR('/') || ch == _SYS_STR('\\'))
ch = _SYS_STR('-');
return ret;
}
@ -162,10 +162,10 @@ void PAKBridge::build()
if (areaDeps.name.empty())
{
std::string idStr = area.areaMREAId.toString();
areaDeps.name = hecl::SystemString(_S("MREA_")) + hecl::SystemStringConv(idStr).c_str();
areaDeps.name = hecl::SystemString(_SYS_STR("MREA_")) + hecl::SystemStringConv(idStr).c_str();
}
hecl::SystemChar num[16];
hecl::SNPrintf(num, 16, _S("%02u "), ai);
hecl::SNPrintf(num, 16, _SYS_STR("%02u "), ai);
areaDeps.name = num + areaDeps.name;
std::string lowerName(hecl::SystemUTF8Conv(areaDeps.name).str());
@ -191,7 +191,7 @@ void PAKBridge::build()
layer.active = layerFlags.flags >> (l-1) & 0x1;
layer.name = hecl::StringUtils::TrimWhitespace(layer.name);
hecl::SNPrintf(num, 16, _S("%02u "), l-1);
hecl::SNPrintf(num, 16, _SYS_STR("%02u "), l-1);
layer.name = num + layer.name;
layer.resources.reserve(area.depLayers[l] - r);
@ -307,7 +307,7 @@ void PAKBridge::addMAPATransforms(PAKRouter<PAKBridge>& pakRouter,
hecl::ProjectPath mlvlDirPath = pakRouter.getWorking(&entry.second).getParentPath();
if (mlvl.worldNameId)
pathOverrides[mlvl.worldNameId] = hecl::ProjectPath(mlvlDirPath, _S("!name.yaml"));
pathOverrides[mlvl.worldNameId] = hecl::ProjectPath(mlvlDirPath, _SYS_STR("!name.yaml"));
for (const MLVL::Area& area : mlvl.areas)
{
@ -327,7 +327,7 @@ void PAKBridge::addMAPATransforms(PAKRouter<PAKBridge>& pakRouter,
hecl::ProjectPath areaDirPath = pakRouter.getWorking(area.areaMREAId).getParentPath();
if (area.areaNameId)
pathOverrides[area.areaNameId] = hecl::ProjectPath(areaDirPath, _S("!name.yaml"));
pathOverrides[area.areaNameId] = hecl::ProjectPath(areaDirPath, _SYS_STR("!name.yaml"));
}
if (mlvl.worldMap)
@ -365,57 +365,57 @@ ResExtractor<PAKBridge> PAKBridge::LookupExtractor(const nod::Node& pakNode, con
switch (entry.type)
{
case SBIG('STRG'):
return {STRG::Extract, {_S(".yaml")}};
return {STRG::Extract, {_SYS_STR(".yaml")}};
case SBIG('SCAN'):
return {SCAN::Extract, {_S(".yaml")}, 0, SCAN::Name};
return {SCAN::Extract, {_SYS_STR(".yaml")}, 0, SCAN::Name};
case SBIG('HINT'):
return {HINT::Extract, {_S(".yaml")}};
return {HINT::Extract, {_SYS_STR(".yaml")}};
case SBIG('SAVW'):
return {SAVWCommon::ExtractSAVW<SAVW>, {_S(".yaml")}};
return {SAVWCommon::ExtractSAVW<SAVW>, {_SYS_STR(".yaml")}};
case SBIG('TXTR'):
return {TXTR::Extract, {_S(".png")}};
return {TXTR::Extract, {_SYS_STR(".png")}};
case SBIG('AFSM'):
return {AFSM::Extract, {_S(".yaml")}};
return {AFSM::Extract, {_SYS_STR(".yaml")}};
case SBIG('FRME'):
return {FRME::Extract, {_S(".blend")}, 2};
return {FRME::Extract, {_SYS_STR(".blend")}, 2};
case SBIG('CMDL'):
return {CMDL::Extract, {_S(".blend")}, 1, CMDL::Name};
return {CMDL::Extract, {_SYS_STR(".blend")}, 1, CMDL::Name};
case SBIG('DCLN'):
return {DCLN::Extract, {_S(".blend")}};
return {DCLN::Extract, {_SYS_STR(".blend")}};
case SBIG('ANCS'):
return {ANCS::Extract, {_S(".yaml"), _S(".blend")}, 2};
return {ANCS::Extract, {_SYS_STR(".yaml"), _SYS_STR(".blend")}, 2};
case SBIG('MLVL'):
return {MLVL::Extract, {_S(".yaml"), _S(".blend")}, 3};
return {MLVL::Extract, {_SYS_STR(".yaml"), _SYS_STR(".blend")}, 3};
case SBIG('MREA'):
return {MREA::Extract, {_S(".blend")}, 4, MREA::Name};
return {MREA::Extract, {_SYS_STR(".blend")}, 4, MREA::Name};
case SBIG('MAPA'):
return {MAPA::Extract, {_S(".blend")}, 4};
return {MAPA::Extract, {_SYS_STR(".blend")}, 4};
case SBIG('MAPU'):
return {MAPU::Extract, {_S(".blend")}, 5};
return {MAPU::Extract, {_SYS_STR(".blend")}, 5};
case SBIG('PATH'):
return {PATH::Extract, {_S(".blend")}, 5};
return {PATH::Extract, {_SYS_STR(".blend")}, 5};
case SBIG('PART'):
return {DNAParticle::ExtractGPSM<UniqueID32>, {_S(".gpsm.yaml")}};
return {DNAParticle::ExtractGPSM<UniqueID32>, {_SYS_STR(".gpsm.yaml")}};
case SBIG('ELSC'):
return {DNAParticle::ExtractELSM<UniqueID32>, {_S(".elsm.yaml")}};
return {DNAParticle::ExtractELSM<UniqueID32>, {_SYS_STR(".elsm.yaml")}};
case SBIG('SWHC'):
return {DNAParticle::ExtractSWSH<UniqueID32>, {_S(".swsh.yaml")}};
return {DNAParticle::ExtractSWSH<UniqueID32>, {_SYS_STR(".swsh.yaml")}};
case SBIG('CRSC'):
return {DNAParticle::ExtractCRSM<UniqueID32>, {_S(".crsm.yaml")}};
return {DNAParticle::ExtractCRSM<UniqueID32>, {_SYS_STR(".crsm.yaml")}};
case SBIG('WPSC'):
return {DNAParticle::ExtractWPSM<UniqueID32>, {_S(".wpsm.yaml")}};
return {DNAParticle::ExtractWPSM<UniqueID32>, {_SYS_STR(".wpsm.yaml")}};
case SBIG('DPSC'):
return {DNAParticle::ExtractDPSM<UniqueID32>, {_S(".dpsm.yaml")}};
return {DNAParticle::ExtractDPSM<UniqueID32>, {_SYS_STR(".dpsm.yaml")}};
case SBIG('FONT'):
return {DNAFont::ExtractFONT<UniqueID32>, {_S(".yaml")}};
return {DNAFont::ExtractFONT<UniqueID32>, {_SYS_STR(".yaml")}};
case SBIG('DGRP'):
return {DNADGRP::ExtractDGRP<UniqueID32>, {_S(".yaml")}};
return {DNADGRP::ExtractDGRP<UniqueID32>, {_SYS_STR(".yaml")}};
case SBIG('AGSC'):
return {AGSC::Extract, {}};
case SBIG('CSNG'):
return {CSNG::Extract, {_S(".mid"), _S(".yaml")}};
return {CSNG::Extract, {_SYS_STR(".mid"), _SYS_STR(".yaml")}};
case SBIG('ATBL'):
return {DNAAudio::ATBL::Extract, {_S(".yaml")}};
return {DNAAudio::ATBL::Extract, {_SYS_STR(".yaml")}};
case SBIG('CTWK'):
case SBIG('DUMB'):
{
@ -424,37 +424,37 @@ ResExtractor<PAKBridge> PAKBridge::LookupExtractor(const nod::Node& pakNode, con
if (named)
{
if (!name.compare("PlayerRes"))
return {ExtractTweak<CTweakPlayerRes>, {_S(".yaml")}};
return {ExtractTweak<CTweakPlayerRes>, {_SYS_STR(".yaml")}};
if (!name.compare("GunRes"))
return {ExtractTweak<CTweakGunRes>, {_S(".yaml")}};
return {ExtractTweak<CTweakGunRes>, {_SYS_STR(".yaml")}};
if (!name.compare("Player"))
return {ExtractTweak<CTweakPlayer>, {_S(".yaml")}};
return {ExtractTweak<CTweakPlayer>, {_SYS_STR(".yaml")}};
if (!name.compare("CameraBob"))
return {ExtractTweak<CTweakCameraBob>, {_S(".yaml")}};
return {ExtractTweak<CTweakCameraBob>, {_SYS_STR(".yaml")}};
if (!name.compare("SlideShow"))
return {ExtractTweak<CTweakSlideShow>, {_S(".yaml")}};
return {ExtractTweak<CTweakSlideShow>, {_SYS_STR(".yaml")}};
if (!name.compare("Game"))
return {ExtractTweak<CTweakGame>, {_S(".yaml")}};
return {ExtractTweak<CTweakGame>, {_SYS_STR(".yaml")}};
if (!name.compare("Targeting"))
return {ExtractTweak<CTweakTargeting>, {_S(".yaml")}};
return {ExtractTweak<CTweakTargeting>, {_SYS_STR(".yaml")}};
if (!name.compare("Gui"))
return {ExtractTweak<CTweakGui>, {_S(".yaml")}};
return {ExtractTweak<CTweakGui>, {_SYS_STR(".yaml")}};
if (!name.compare("AutoMapper"))
return {ExtractTweak<CTweakAutoMapper>, {_S(".yaml")}};
return {ExtractTweak<CTweakAutoMapper>, {_SYS_STR(".yaml")}};
if (!name.compare("PlayerControls") || !name.compare("PlayerControls2"))
return {ExtractTweak<CTweakPlayerControl>, {_S(".yaml")}};
return {ExtractTweak<CTweakPlayerControl>, {_SYS_STR(".yaml")}};
if (!name.compare("Ball"))
return {ExtractTweak<CTweakBall>, {_S(".yaml")}};
return {ExtractTweak<CTweakBall>, {_SYS_STR(".yaml")}};
if (!name.compare("Particle"))
return {ExtractTweak<CTweakParticle>, {_S(".yaml")}};
return {ExtractTweak<CTweakParticle>, {_SYS_STR(".yaml")}};
if (!name.compare("GuiColors"))
return {ExtractTweak<CTweakGuiColors>, {_S(".yaml")}};
return {ExtractTweak<CTweakGuiColors>, {_SYS_STR(".yaml")}};
if (!name.compare("PlayerGun"))
return {ExtractTweak<CTweakPlayerGun>, {_S(".yaml")}};
return {ExtractTweak<CTweakPlayerGun>, {_SYS_STR(".yaml")}};
if (!name.compare("DUMB_MazeSeeds"))
return {ExtractTweak<MazeSeeds>, {_S(".yaml")}};
return {ExtractTweak<MazeSeeds>, {_SYS_STR(".yaml")}};
if (!name.compare("DUMB_SnowForces"))
return {ExtractTweak<SnowForces>, {_S(".yaml")}};
return {ExtractTweak<SnowForces>, {_SYS_STR(".yaml")}};
}
break;
}

View File

@ -73,7 +73,7 @@ void FRME::Widget::Enumerate<BigDNA::Read>(athena::io::IStreamReader& __dna_read
case SBIG('TBGP'): widgetInfo.reset(new TBGPInfo); break;
case SBIG('SLGP'): widgetInfo.reset(new SLGPInfo); break;
default:
Log.report(logvisor::Fatal, _S("Unsupported FRME widget type %.8X"), type.toUint32());
Log.report(logvisor::Fatal, _SYS_STR("Unsupported FRME widget type %.8X"), type.toUint32());
}
/* widgetInfo */
@ -159,7 +159,7 @@ void FRME::Widget::CAMRInfo::Enumerate<BigDNA::Read>(athena::io::IStreamReader&
else if (projectionType == ProjectionType::Orthographic)
projection.reset(new OrthographicProjection);
else
Log.report(logvisor::Fatal, _S("Invalid CAMR projection mode! %i"), int(projectionType));
Log.report(logvisor::Fatal, _SYS_STR("Invalid CAMR projection mode! %i"), int(projectionType));
projection->read(__dna_reader);
}
@ -168,9 +168,9 @@ template <>
void FRME::Widget::CAMRInfo::Enumerate<BigDNA::Write>(athena::io::IStreamWriter& __dna_writer)
{
if (!projection)
Log.report(logvisor::Fatal, _S("Invalid CAMR projection object!"));
Log.report(logvisor::Fatal, _SYS_STR("Invalid CAMR projection object!"));
if (projection->type != projectionType)
Log.report(logvisor::Fatal, _S("CAMR projection type does not match actual projection type!"));
Log.report(logvisor::Fatal, _SYS_STR("CAMR projection type does not match actual projection type!"));
__dna_writer.writeUint32Big(atUint32(projectionType));
projection->write(__dna_writer);

View File

@ -31,13 +31,13 @@ bool MLVL::Extract(const SpecBase& dataSpec, PAKEntryReadStream& rs, const hecl:
{
hecl::ProjectPath areaDir = pakRouter.getWorking(area.areaMREAId).getParentPath();
{
athena::io::FileWriter fw(hecl::ProjectPath(areaDir, _S("!memoryid.yaml")).getAbsolutePath());
athena::io::FileWriter fw(hecl::ProjectPath(areaDir, _SYS_STR("!memoryid.yaml")).getAbsolutePath());
athena::io::YAMLDocWriter w(nullptr);
w.writeUint32("memoryid", area.areaId);
w.finish(&fw);
}
{
athena::io::FileWriter fw(hecl::ProjectPath(areaDir, _S("!memoryrelays.yaml")).getAbsolutePath());
athena::io::FileWriter fw(hecl::ProjectPath(areaDir, _SYS_STR("!memoryrelays.yaml")).getAbsolutePath());
athena::io::YAMLDocWriter w(nullptr);
std::vector<atUint32> relayIds;
@ -52,12 +52,12 @@ bool MLVL::Extract(const SpecBase& dataSpec, PAKEntryReadStream& rs, const hecl:
w.finish(&fw);
}
if (pakRouter.mreaHasDupeResources(area.areaMREAId))
athena::io::FileWriter(hecl::ProjectPath(areaDir, _S("!duperes")).getAbsolutePath());
athena::io::FileWriter(hecl::ProjectPath(areaDir, _SYS_STR("!duperes")).getAbsolutePath());
areaIdx++;
}
athena::io::FileWriter writer(outPath.getWithExtension(_S(".yaml"), true).getAbsolutePath());
athena::io::FileWriter writer(outPath.getWithExtension(_SYS_STR(".yaml"), true).getAbsolutePath());
athena::io::ToYAMLStream(mlvl, writer, &MLVL::writeMeta);
hecl::blender::Connection& conn = btok.getBlenderConnection();
return DNAMLVL::ReadMLVLToBlender(conn, mlvl, outPath, pakRouter, entry, force, fileChanged);
@ -98,18 +98,18 @@ bool MLVL::Cook(const hecl::ProjectPath& outPath, const hecl::ProjectPath& inPat
hecl::blender::Token& btok)
{
MLVL mlvl = {};
athena::io::FileReader reader(inPath.getWithExtension(_S(".yaml"), true).getAbsolutePath());
athena::io::FileReader reader(inPath.getWithExtension(_SYS_STR(".yaml"), true).getAbsolutePath());
athena::io::FromYAMLStream(mlvl, reader, &MLVL::readMeta);
mlvl.magic = 0xDEAFBABE;
mlvl.version = 0x11;
hecl::ProjectPath namePath(inPath.getParentPath(), _S("!name.yaml"));
hecl::ProjectPath namePath(inPath.getParentPath(), _SYS_STR("!name.yaml"));
if (namePath.isFile())
mlvl.worldNameId = namePath;
hecl::ProjectPath globPath = inPath.getWithExtension(_S(".*"), true);
hecl::ProjectPath savwPath = globPath.ensureAuxInfo(_S("SAVW"));
hecl::ProjectPath globPath = inPath.getWithExtension(_SYS_STR(".*"), true);
hecl::ProjectPath savwPath = globPath.ensureAuxInfo(_SYS_STR("SAVW"));
mlvl.saveWorldId = savwPath;
hecl::ProjectPath mapwPath = globPath.ensureAuxInfo(_S("MAPW"));
hecl::ProjectPath mapwPath = globPath.ensureAuxInfo(_SYS_STR("MAPW"));
mlvl.worldMap = mapwPath;
size_t areaIdx = 0;
@ -119,13 +119,13 @@ bool MLVL::Cook(const hecl::ProjectPath& outPath, const hecl::ProjectPath& inPat
if (area.path.getPathType() != hecl::ProjectPath::Type::Directory)
continue;
hecl::ProjectPath areaPath(area.path, _S("!area.blend"));
hecl::ProjectPath areaPath(area.path, _SYS_STR("!area.blend"));
if (!areaPath.isFile())
continue;
Log.report(logvisor::Info, _S("Visiting %s"), area.path.getRelativePath().data());
Log.report(logvisor::Info, _SYS_STR("Visiting %s"), area.path.getRelativePath().data());
hecl::ProjectPath memRelayPath(area.path, _S("!memoryrelays.yaml"));
hecl::ProjectPath memRelayPath(area.path, _SYS_STR("!memoryrelays.yaml"));
std::vector<atUint32> memRelays;
@ -155,7 +155,7 @@ bool MLVL::Cook(const hecl::ProjectPath& outPath, const hecl::ProjectPath& inPat
else
layerName = hecl::StringUtils::TrimWhitespace(hecl::SystemString(endCh));
hecl::ProjectPath objectsPath(area.path, e.m_name + _S("/!objects.yaml"));
hecl::ProjectPath objectsPath(area.path, e.m_name + _SYS_STR("/!objects.yaml"));
if (objectsPath.isNone())
continue;
@ -177,7 +177,7 @@ bool MLVL::Cook(const hecl::ProjectPath& outPath, const hecl::ProjectPath& inPat
layerResources.beginLayer();
/* Set active flag state */
hecl::ProjectPath defActivePath(area.path, e.m_name + _S("/!defaultactive"));
hecl::ProjectPath defActivePath(area.path, e.m_name + _SYS_STR("/!defaultactive"));
bool active = defActivePath.isNone() ? false : true;
if (!areaInit)
@ -189,7 +189,7 @@ bool MLVL::Cook(const hecl::ProjectPath& outPath, const hecl::ProjectPath& inPat
mlvl.areas.emplace_back();
MLVL::Area& areaOut = mlvl.areas.back();
hecl::ProjectPath namePath(area.path, _S("!name.yaml"));
hecl::ProjectPath namePath(area.path, _SYS_STR("!name.yaml"));
if (namePath.isFile())
areaOut.areaNameId = namePath;
@ -201,7 +201,7 @@ bool MLVL::Cook(const hecl::ProjectPath& outPath, const hecl::ProjectPath& inPat
areaOut.areaMREAId = areaPath;
areaOut.areaId = 0xffffffff;
hecl::ProjectPath memIdPath(area.path, _S("!memoryid.yaml"));
hecl::ProjectPath memIdPath(area.path, _SYS_STR("!memoryid.yaml"));
if (memIdPath.isFile())
{
athena::io::FileReader fr(memIdPath.getAbsolutePath());
@ -316,7 +316,7 @@ bool MLVL::Cook(const hecl::ProjectPath& outPath, const hecl::ProjectPath& inPat
}
if (!areaInit)
Log.report(logvisor::Info, _S("No layer directories for area %s"), area.path.getRelativePath().data());
Log.report(logvisor::Info, _SYS_STR("No layer directories for area %s"), area.path.getRelativePath().data());
/* Build deplist */
MLVL::Area& areaOut = mlvl.areas.back();
@ -369,7 +369,7 @@ bool MLVL::Cook(const hecl::ProjectPath& outPath, const hecl::ProjectPath& inPat
}
}
hecl::ProjectPath pathPath(areaPath.getParentPath(), _S("!path.blend"));
hecl::ProjectPath pathPath(areaPath.getParentPath(), _SYS_STR("!path.blend"));
urde::SObjectTag pathTag = g_curSpec->buildTagFromPath(pathPath, btok);
if (pathTag.id.IsValid())
{
@ -416,7 +416,7 @@ bool MLVL::CookMAPW(const hecl::ProjectPath& outPath,
continue;
/* Area map */
hecl::ProjectPath mapPath(area.path, _S("/!map.blend"));
hecl::ProjectPath mapPath(area.path, _SYS_STR("/!map.blend"));
if (mapPath.isFile())
mapaTags.push_back(g_curSpec->buildTagFromPath(mapPath, btok));
}
@ -451,11 +451,11 @@ bool MLVL::CookSAVW(const hecl::ProjectPath& outPath,
if (area.path.getPathType() != hecl::ProjectPath::Type::Directory)
continue;
hecl::ProjectPath areaPath(area.path, _S("/!area.blend"));
hecl::ProjectPath areaPath(area.path, _SYS_STR("/!area.blend"));
if (!areaPath.isFile())
continue;
hecl::ProjectPath memRelayPath(area.path, _S("/!memoryrelays.yaml"));
hecl::ProjectPath memRelayPath(area.path, _SYS_STR("/!memoryrelays.yaml"));
std::vector<atUint32> memRelays;
if (memRelayPath.isFile())
{
@ -478,7 +478,7 @@ bool MLVL::CookSAVW(const hecl::ProjectPath& outPath,
else
layerName = hecl::StringUtils::TrimWhitespace(hecl::SystemString(endCh));
hecl::ProjectPath objectsPath(area.path, e.m_name + _S("/!objects.yaml"));
hecl::ProjectPath objectsPath(area.path, e.m_name + _SYS_STR("/!objects.yaml"));
if (objectsPath.isNone())
continue;

View File

@ -323,7 +323,7 @@ bool MREA::Extract(const SpecBase& dataSpec,
{
rs.seek(secStart, athena::Begin);
auto visiData = rs.readUBytes(head.secSizes[curSec]);
athena::io::FileWriter visiOut(outPath.getWithExtension(_S(".visi"), true).getAbsolutePath());
athena::io::FileWriter visiOut(outPath.getWithExtension(_SYS_STR(".visi"), true).getAbsolutePath());
visiOut.writeUBytes(visiData.get(), head.secSizes[curSec]);
rs.seek(secStart + 4, athena::Begin);
}
@ -340,7 +340,7 @@ bool MREA::Extract(const SpecBase& dataSpec,
visiWriter.writeUint32(nullptr, entityId);
}
}
hecl::ProjectPath visiMetadataPath(outPath.getParentPath(), _S("!visi.yaml"));
hecl::ProjectPath visiMetadataPath(outPath.getParentPath(), _SYS_STR("!visi.yaml"));
athena::io::FileWriter visiMetadata(visiMetadataPath.getAbsolutePath());
visiWriter.finish(&visiMetadata);
}
@ -439,7 +439,7 @@ bool MREA::Cook(const hecl::ProjectPath& outPath,
false, false, true);
for (const hecl::DirectoryEnumerator::Entry& ent : dEnum)
{
hecl::ProjectPath layerScriptPath(areaDirPath, ent.m_name + _S("/!objects.yaml"));
hecl::ProjectPath layerScriptPath(areaDirPath, ent.m_name + _SYS_STR("/!objects.yaml"));
if (layerScriptPath.isFile())
layerScriptPaths.push_back(std::move(layerScriptPath));
}
@ -523,7 +523,7 @@ bool MREA::Cook(const hecl::ProjectPath& outPath,
#if DUMP_OCTREE
hecl::blender::Connection& conn = btok.getBlenderConnection();
if (!conn.createBlend(inPath.getWithExtension(_S(".octree.blend"), true), hecl::blender::BlendType::Area))
if (!conn.createBlend(inPath.getWithExtension(_SYS_STR(".octree.blend"), true), hecl::blender::BlendType::Area))
return false;
/* Open Py Stream and read sections */
@ -594,7 +594,7 @@ bool MREA::Cook(const hecl::ProjectPath& outPath,
#if DUMP_OCTREE
hecl::blender::Connection& conn = btok.getBlenderConnection();
if (!conn.createBlend(inPath.getWithExtension(_S(".coctree.blend"), true), hecl::blender::BlendType::Area))
if (!conn.createBlend(inPath.getWithExtension(_SYS_STR(".coctree.blend"), true), hecl::blender::BlendType::Area))
return false;
/* Open Py Stream and read sections */
@ -666,7 +666,7 @@ bool MREA::Cook(const hecl::ProjectPath& outPath,
}
/* VISI */
hecl::ProjectPath visiMetadataPath(areaDirPath, _S("!visi.yaml"));
hecl::ProjectPath visiMetadataPath(areaDirPath, _SYS_STR("!visi.yaml"));
bool visiGood = false;
if (visiMetadataPath.isFile())
{
@ -698,7 +698,7 @@ bool MREA::Cook(const hecl::ProjectPath& outPath,
}
// Check if pre-generated visi exists, recycle if able
hecl::ProjectPath preVisiPath = inPath.getWithExtension(_S(".visi"), true);
hecl::ProjectPath preVisiPath = inPath.getWithExtension(_SYS_STR(".visi"), true);
if (preVisiPath.getPathType() == hecl::ProjectPath::Type::File)
{
athena::io::FileReader preVisiReader(preVisiPath.getAbsolutePath());
@ -733,7 +733,7 @@ bool MREA::Cook(const hecl::ProjectPath& outPath,
#if !WINDOWS_STORE
if (!visiGood)
{
hecl::ProjectPath visiIntOut = outPath.getWithExtension(_S(".visiint"));
hecl::ProjectPath visiIntOut = outPath.getWithExtension(_SYS_STR(".visiint"));
athena::io::FileWriter w(visiIntOut.getAbsolutePath());
w.writeUint32Big(meshes.size());
for (const DNACMDL::Mesh& mesh : meshes)
@ -775,17 +775,17 @@ bool MREA::Cook(const hecl::ProjectPath& outPath,
w.close();
hecl::SystemString VisiGenPath = ExeDir + _S("/visigen");
hecl::SystemString VisiGenPath = ExeDir + _SYS_STR("/visigen");
#if _WIN32
VisiGenPath += _S(".exe");
VisiGenPath += _SYS_STR(".exe");
#endif
hecl::SystemChar thrIdx[16];
hecl::SNPrintf(thrIdx, 16, _S("%d"), hecl::ClientProcess::GetThreadWorkerIdx());
hecl::SNPrintf(thrIdx, 16, _SYS_STR("%d"), hecl::ClientProcess::GetThreadWorkerIdx());
hecl::SystemChar parPid[32];
#if _WIN32
hecl::SNPrintf(parPid, 32, _S("%lluX"), reinterpret_cast<unsigned long long>(GetCurrentProcess()));
hecl::SNPrintf(parPid, 32, _SYS_STR("%lluX"), reinterpret_cast<unsigned long long>(GetCurrentProcess()));
#else
hecl::SNPrintf(parPid, 32, _S("%lluX"), (unsigned long long)getpid());
hecl::SNPrintf(parPid, 32, _SYS_STR("%lluX"), (unsigned long long)getpid());
#endif
const hecl::SystemChar* args[] = {VisiGenPath.c_str(),
visiIntOut.getAbsolutePath().data(),
@ -801,7 +801,7 @@ bool MREA::Cook(const hecl::ProjectPath& outPath,
}
else
{
Log.report(logvisor::Fatal, _S("Unable to launch %s"), VisiGenPath.c_str());
Log.report(logvisor::Fatal, _SYS_STR("Unable to launch %s"), VisiGenPath.c_str());
}
}
#endif
@ -812,7 +812,7 @@ bool MREA::Cook(const hecl::ProjectPath& outPath,
/* PATH */
{
hecl::ProjectPath pathPath(inPath.getParentPath(), _S("!path.blend"));
hecl::ProjectPath pathPath(inPath.getParentPath(), _SYS_STR("!path.blend"));
UniqueID32 pathId = pathPath;
secs.emplace_back(4, 0);
athena::io::MemoryWriter w(secs.back().data(), secs.back().size());

View File

@ -51,10 +51,10 @@ void SCLY::exportToLayerDirectories(const PAK::Entry& entry, PAKRouter<PAKBridge
if (active)
{
hecl::ProjectPath activePath(layerPath, "!defaultactive");
fclose(hecl::Fopen(activePath.getAbsolutePath().data(), _S("wb")));
fclose(hecl::Fopen(activePath.getAbsolutePath().data(), _SYS_STR("wb")));
}
hecl::ProjectPath yamlFile(layerPath, _S("!objects.yaml"));
hecl::ProjectPath yamlFile(layerPath, _SYS_STR("!objects.yaml"));
if (force || yamlFile.isNone())
{
athena::io::FileWriter writer(yamlFile.getAbsolutePath());
@ -134,11 +134,11 @@ void SCLY::ScriptLayer::Enumerate<BigDNA::Read>(athena::io::IStreamReader& rs)
objects.push_back(std::move(obj));
size_t actualLen = rs.position() - start;
if (actualLen != len)
Log.report(logvisor::Fatal, _S("Error while reading object of type 0x%.2X, did not read the expected amount of data, read 0x%x, expected 0x%x"), (atUint32)type, actualLen, len);
Log.report(logvisor::Fatal, _SYS_STR("Error while reading object of type 0x%.2X, did not read the expected amount of data, read 0x%x, expected 0x%x"), (atUint32)type, actualLen, len);
rs.seek(start + len, athena::Begin);
}
else
Log.report(logvisor::Fatal, _S("Unable to find type 0x%X in object database"), (atUint32)type);
Log.report(logvisor::Fatal, _SYS_STR("Unable to find type 0x%X in object database"), (atUint32)type);
}
}
@ -168,7 +168,7 @@ void SCLY::ScriptLayer::Enumerate<BigDNA::ReadYaml>(athena::io::YAMLDocReader& r
objects.push_back(std::move(obj));
}
else
Log.report(logvisor::Fatal, _S("Unable to find type 0x%X in object database"), (atUint32)type);
Log.report(logvisor::Fatal, _SYS_STR("Unable to find type 0x%X in object database"), (atUint32)type);
}
}
}

View File

@ -21,7 +21,7 @@ zeus::CAABox Actor::getVISIAABB(hecl::blender::Token& btok) const
{
hecl::ProjectPath path = UniqueIDBridge::TranslatePakIdToPath(
animationParameters.animationCharacterSet);
conn.openBlend(path.getWithExtension(_S(".blend"), true));
conn.openBlend(path.getWithExtension(_SYS_STR(".blend"), true));
hecl::blender::DataStream ds = conn.beginData();
auto aabb = ds.getMeshAABB();
aabbOut = zeus::CAABox(aabb.first, aabb.second);

View File

@ -13,7 +13,7 @@ zeus::CAABox DoorArea::getVISIAABB(hecl::blender::Token& btok) const
{
hecl::ProjectPath path = UniqueIDBridge::TranslatePakIdToPath(
animationParameters.animationCharacterSet);
conn.openBlend(path.getWithExtension(_S(".blend"), true));
conn.openBlend(path.getWithExtension(_SYS_STR(".blend"), true));
hecl::blender::DataStream ds = conn.beginData();
auto aabb = ds.getMeshAABB();
aabbOut = zeus::CAABox(aabb.first, aabb.second);

View File

@ -21,7 +21,7 @@ zeus::CAABox Platform::getVISIAABB(hecl::blender::Token& btok) const
{
hecl::ProjectPath path = UniqueIDBridge::TranslatePakIdToPath(
animationParameters.animationCharacterSet);
conn.openBlend(path.getWithExtension(_S(".blend"), true));
conn.openBlend(path.getWithExtension(_SYS_STR(".blend"), true));
hecl::blender::DataStream ds = conn.beginData();
auto aabb = ds.getMeshAABB();
aabbOut = zeus::CAABox(aabb.first, aabb.second);

View File

@ -32,7 +32,7 @@ bool AGSC::Extract(PAKEntryReadStream& rs, const hecl::ProjectPath& dir)
/* Write out project/pool */
{
auto projd = group.getProj().toYAML();
athena::io::FileWriter fo(hecl::ProjectPath(dir, _S("!project.yaml")).getAbsolutePath());
athena::io::FileWriter fo(hecl::ProjectPath(dir, _SYS_STR("!project.yaml")).getAbsolutePath());
if (fo.hasError())
return false;
fo.writeUBytes(projd.data(), projd.size());
@ -40,7 +40,7 @@ bool AGSC::Extract(PAKEntryReadStream& rs, const hecl::ProjectPath& dir)
{
auto poold = group.getPool().toYAML();
athena::io::FileWriter fo(hecl::ProjectPath(dir, _S("!pool.yaml")).getAbsolutePath());
athena::io::FileWriter fo(hecl::ProjectPath(dir, _SYS_STR("!pool.yaml")).getAbsolutePath());
if (fo.hasError())
return false;
fo.writeUBytes(poold.data(), poold.size());

View File

@ -225,9 +225,9 @@ struct ANCS : BigDNA
hecl::blender::Token& btok,
std::function<void(const hecl::SystemChar*)> fileChanged)
{
hecl::ProjectPath yamlPath = outPath.getWithExtension(_S(".yaml"), true);
hecl::ProjectPath yamlPath = outPath.getWithExtension(_SYS_STR(".yaml"), true);
hecl::ProjectPath::Type yamlType = yamlPath.getPathType();
hecl::ProjectPath blendPath = outPath.getWithExtension(_S(".blend"), true);
hecl::ProjectPath blendPath = outPath.getWithExtension(_SYS_STR(".blend"), true);
hecl::ProjectPath::Type blendType = blendPath.getPathType();
if (force ||

View File

@ -55,7 +55,7 @@ PAKBridge::PAKBridge(const nod::Node& node,
STRG mlvlName;
mlvlName.read(rs);
if (m_levelString.size())
m_levelString += _S(", ");
m_levelString += _SYS_STR(", ");
m_levelString += mlvlName.getSystemString(FOURCC('ENGL'), 0);
}
}
@ -66,8 +66,8 @@ static hecl::SystemString LayerName(std::string_view name)
{
hecl::SystemString ret(hecl::SystemStringConv(name).sys_str());
for (auto& ch : ret)
if (ch == _S('/') || ch == _S('\\'))
ch = _S('-');
if (ch == _SYS_STR('/') || ch == _SYS_STR('\\'))
ch = _SYS_STR('-');
return ret;
}
@ -128,11 +128,11 @@ void PAKBridge::build()
if (areaDeps.name.empty())
{
std::string idStr = area.areaMREAId.toString();
areaDeps.name = hecl::SystemString(_S("MREA_")) + hecl::SystemStringConv(idStr).c_str();
areaDeps.name = hecl::SystemString(_SYS_STR("MREA_")) + hecl::SystemStringConv(idStr).c_str();
}
}
hecl::SystemChar num[16];
hecl::SNPrintf(num, 16, _S("%02u "), ai);
hecl::SNPrintf(num, 16, _SYS_STR("%02u "), ai);
areaDeps.name = num + areaDeps.name;
areaDeps.layers.reserve(area.depLayerCount-1);
@ -144,7 +144,7 @@ void PAKBridge::build()
layer.name = LayerName(mlvl.layerNames[layerIdx++]);
layer.active = layerFlags.flags >> (l-1) & 0x1;
layer.name = hecl::StringUtils::TrimWhitespace(layer.name);
hecl::SNPrintf(num, 16, _S("%02u "), l-1);
hecl::SNPrintf(num, 16, _SYS_STR("%02u "), l-1);
layer.name = num + layer.name;
layer.resources.reserve(area.depLayers[l] - r);
@ -211,13 +211,13 @@ void PAKBridge::addMAPATransforms(PAKRouter<PAKBridge>& pakRouter,
hecl::ProjectPath mlvlDirPath = pakRouter.getWorking(&entry.second).getParentPath();
if (mlvl.worldNameId)
pathOverrides[mlvl.worldNameId] = hecl::ProjectPath(mlvlDirPath, _S("!name.yaml"));
pathOverrides[mlvl.worldNameId] = hecl::ProjectPath(mlvlDirPath, _SYS_STR("!name.yaml"));
for (const MLVL::Area& area : mlvl.areas)
{
hecl::ProjectPath areaDirPath = pakRouter.getWorking(area.areaMREAId).getParentPath();
if (area.areaNameId)
pathOverrides[area.areaNameId] = hecl::ProjectPath(areaDirPath, _S("!name.yaml"));
pathOverrides[area.areaNameId] = hecl::ProjectPath(areaDirPath, _SYS_STR("!name.yaml"));
}
if (mlvl.worldMap)
@ -256,39 +256,39 @@ ResExtractor<PAKBridge> PAKBridge::LookupExtractor(const nod::Node& pakNode, con
switch (entry.type)
{
case SBIG('HINT'):
return {DNAMP1::HINT::Extract, {_S(".yaml")}};
return {DNAMP1::HINT::Extract, {_SYS_STR(".yaml")}};
case SBIG('STRG'):
return {STRG::Extract, {_S(".yaml")}};
return {STRG::Extract, {_SYS_STR(".yaml")}};
case SBIG('TXTR'):
return {TXTR::Extract, {_S(".png")}};
return {TXTR::Extract, {_SYS_STR(".png")}};
case SBIG('AFSM'):
return {AFSM::Extract, {_S(".yaml")}};
return {AFSM::Extract, {_SYS_STR(".yaml")}};
case SBIG('SAVW'):
return {SAVWCommon::ExtractSAVW<SAVW>, {_S(".yaml")}};
return {SAVWCommon::ExtractSAVW<SAVW>, {_SYS_STR(".yaml")}};
case SBIG('CMDL'):
return {CMDL::Extract, {_S(".blend")}, 1};
return {CMDL::Extract, {_SYS_STR(".blend")}, 1};
case SBIG('ANCS'):
return {ANCS::Extract, {_S(".yaml"), _S(".blend")}, 2};
return {ANCS::Extract, {_SYS_STR(".yaml"), _SYS_STR(".blend")}, 2};
case SBIG('MLVL'):
return {MLVL::Extract, {_S(".yaml"), _S(".blend")}, 3};
return {MLVL::Extract, {_SYS_STR(".yaml"), _SYS_STR(".blend")}, 3};
case SBIG('MREA'):
return {MREA::Extract, {_S(".blend")}, 4};
return {MREA::Extract, {_SYS_STR(".blend")}, 4};
case SBIG('MAPA'):
return {MAPA::Extract, {_S(".blend")}, 4};
return {MAPA::Extract, {_SYS_STR(".blend")}, 4};
case SBIG('MAPU'):
return {MAPU::Extract, {_S(".blend")}, 5};
return {MAPU::Extract, {_SYS_STR(".blend")}, 5};
case SBIG('FSM2'):
return {DNAFSM2::ExtractFSM2<UniqueID32>, {_S(".yaml")}};
return {DNAFSM2::ExtractFSM2<UniqueID32>, {_SYS_STR(".yaml")}};
case SBIG('FONT'):
return {DNAFont::ExtractFONT<UniqueID32>, {_S(".yaml")}};
return {DNAFont::ExtractFONT<UniqueID32>, {_SYS_STR(".yaml")}};
case SBIG('DGRP'):
return {DNADGRP::ExtractDGRP<UniqueID32>, {_S(".yaml")}};
return {DNADGRP::ExtractDGRP<UniqueID32>, {_SYS_STR(".yaml")}};
case SBIG('AGSC'):
return {AGSC::Extract, {}};
case SBIG('CSNG'):
return {DNAMP1::CSNG::Extract, {_S(".mid"), _S(".yaml")}};
return {DNAMP1::CSNG::Extract, {_SYS_STR(".mid"), _SYS_STR(".yaml")}};
case SBIG('ATBL'):
return {DNAAudio::ATBL::Extract, {_S(".yaml")}};
return {DNAAudio::ATBL::Extract, {_SYS_STR(".yaml")}};
}
return {};
}

View File

@ -102,7 +102,7 @@ struct MLVL : BigDNA
{
MLVL mlvl;
mlvl.read(rs);
athena::io::FileWriter writer(outPath.getWithExtension(_S(".yaml"), true).getAbsolutePath());
athena::io::FileWriter writer(outPath.getWithExtension(_SYS_STR(".yaml"), true).getAbsolutePath());
athena::io::ToYAMLStream(mlvl, writer);
hecl::blender::Connection& conn = btok.getBlenderConnection();
return DNAMLVL::ReadMLVLToBlender(conn, mlvl, outPath, pakRouter,

View File

@ -182,7 +182,7 @@ bool MREA::Extract(const SpecBase& dataSpec,
/* MREA decompression stream */
StreamReader drs(rs, head.compressedBlockCount);
hecl::ProjectPath decompPath = outPath.getCookedPath(SpecEntMP2ORIG).getWithExtension(_S(".decomp"));
hecl::ProjectPath decompPath = outPath.getCookedPath(SpecEntMP2ORIG).getWithExtension(_SYS_STR(".decomp"));
decompPath.makeDirChain(false);
athena::io::FileWriter mreaDecompOut(decompPath.getAbsolutePath());
head.write(mreaDecompOut);

View File

@ -316,9 +316,9 @@ struct CHAR : BigDNA
hecl::blender::Token& btok,
std::function<void(const hecl::SystemChar*)> fileChanged)
{
hecl::ProjectPath yamlPath = outPath.getWithExtension(_S(".yaml"), true);
hecl::ProjectPath yamlPath = outPath.getWithExtension(_SYS_STR(".yaml"), true);
hecl::ProjectPath::Type yamlType = yamlPath.getPathType();
hecl::ProjectPath blendPath = outPath.getWithExtension(_S(".blend"), true);
hecl::ProjectPath blendPath = outPath.getWithExtension(_SYS_STR(".blend"), true);
hecl::ProjectPath::Type blendType = blendPath.getPathType();
if (force ||

View File

@ -61,7 +61,7 @@ PAKBridge::PAKBridge(const nod::Node& node,
for (const hecl::SystemString& str : uniq)
{
if (comma)
m_levelString += _S(", ");
m_levelString += _SYS_STR(", ");
comma = true;
m_levelString += str;
}
@ -71,8 +71,8 @@ static hecl::SystemString LayerName(std::string_view name)
{
hecl::SystemString ret(hecl::SystemStringConv(name).sys_str());
for (auto& ch : ret)
if (ch == _S('/') || ch == _S('\\'))
ch = _S('-');
if (ch == _SYS_STR('/') || ch == _SYS_STR('\\'))
ch = _SYS_STR('-');
return ret;
}
@ -133,11 +133,11 @@ void PAKBridge::build()
if (areaDeps.name.empty())
{
std::string idStr = area.areaMREAId.toString();
areaDeps.name = hecl::SystemString(_S("MREA_")) + hecl::SystemStringConv(idStr).c_str();
areaDeps.name = hecl::SystemString(_SYS_STR("MREA_")) + hecl::SystemStringConv(idStr).c_str();
}
}
hecl::SystemChar num[16];
hecl::SNPrintf(num, 16, _S("%02u "), ai);
hecl::SNPrintf(num, 16, _SYS_STR("%02u "), ai);
areaDeps.name = num + areaDeps.name;
const MLVL::LayerFlags& layerFlags = *layerFlagsIt++;
@ -151,7 +151,7 @@ void PAKBridge::build()
layer.name = LayerName(mlvl.layerNames[layerIdx++]);
layer.active = layerFlags.flags >> (l-1) & 0x1;
layer.name = hecl::StringUtils::TrimWhitespace(layer.name);
hecl::SNPrintf(num, 16, _S("%02u "), l-1);
hecl::SNPrintf(num, 16, _SYS_STR("%02u "), l-1);
layer.name = num + layer.name;
}
}
@ -221,13 +221,13 @@ void PAKBridge::addMAPATransforms(PAKRouter<PAKBridge>& pakRouter,
hecl::ProjectPath mlvlDirPath = pakRouter.getWorking(&entry.second).getParentPath();
if (mlvl.worldNameId)
pathOverrides[mlvl.worldNameId] = hecl::ProjectPath(mlvlDirPath, _S("!name.yaml"));
pathOverrides[mlvl.worldNameId] = hecl::ProjectPath(mlvlDirPath, _SYS_STR("!name.yaml"));
for (const MLVL::Area& area : mlvl.areas)
{
hecl::ProjectPath areaDirPath = pakRouter.getWorking(area.areaMREAId).getParentPath();
if (area.areaNameId)
pathOverrides[area.areaNameId] = hecl::ProjectPath(areaDirPath, _S("!name.yaml"));
pathOverrides[area.areaNameId] = hecl::ProjectPath(areaDirPath, _SYS_STR("!name.yaml"));
}
if (mlvl.worldMap)
@ -265,31 +265,31 @@ ResExtractor<PAKBridge> PAKBridge::LookupExtractor(const nod::Node& pakNode, con
switch (entry.type)
{
// case SBIG('CAUD'):
// return {CAUD::Extract, {_S(".yaml")}};
// return {CAUD::Extract, {_SYS_STR(".yaml")}};
case SBIG('STRG'):
return {STRG::Extract, {_S(".yaml")}};
return {STRG::Extract, {_SYS_STR(".yaml")}};
case SBIG('TXTR'):
return {TXTR::Extract, {_S(".png")}};
return {TXTR::Extract, {_SYS_STR(".png")}};
case SBIG('SAVW'):
return {SAVWCommon::ExtractSAVW<SAVW>, {_S(".yaml")}};
return {SAVWCommon::ExtractSAVW<SAVW>, {_SYS_STR(".yaml")}};
case SBIG('HINT'):
return {HINT::Extract, {_S(".yaml")}};
return {HINT::Extract, {_SYS_STR(".yaml")}};
case SBIG('CMDL'):
return {CMDL::Extract, {_S(".blend")}, 1};
return {CMDL::Extract, {_SYS_STR(".blend")}, 1};
case SBIG('CHAR'):
return {CHAR::Extract, {_S(".yaml"), _S(".blend")}, 2};
return {CHAR::Extract, {_SYS_STR(".yaml"), _SYS_STR(".blend")}, 2};
case SBIG('MLVL'):
return {MLVL::Extract, {_S(".yaml"), _S(".blend")}, 3};
return {MLVL::Extract, {_SYS_STR(".yaml"), _SYS_STR(".blend")}, 3};
case SBIG('MREA'):
return {MREA::Extract, {_S(".blend")}, 4};
return {MREA::Extract, {_SYS_STR(".blend")}, 4};
case SBIG('MAPA'):
return {MAPA::Extract, {_S(".blend")}, 4};
return {MAPA::Extract, {_SYS_STR(".blend")}, 4};
case SBIG('FSM2'):
return {DNAFSM2::ExtractFSM2<UniqueID64>, {_S(".yaml")}};
return {DNAFSM2::ExtractFSM2<UniqueID64>, {_SYS_STR(".yaml")}};
case SBIG('FONT'):
return {DNAFont::ExtractFONT<UniqueID64>, {_S(".yaml")}};
return {DNAFont::ExtractFONT<UniqueID64>, {_SYS_STR(".yaml")}};
case SBIG('DGRP'):
return {DNADGRP::ExtractDGRP<UniqueID64>, {_S(".yaml")}};
return {DNADGRP::ExtractDGRP<UniqueID64>, {_SYS_STR(".yaml")}};
}
return {};
}

View File

@ -91,7 +91,7 @@ struct MLVL : BigDNA
{
MLVL mlvl;
mlvl.read(rs);
athena::io::FileWriter writer(outPath.getWithExtension(_S(".yaml"), true).getAbsolutePath());
athena::io::FileWriter writer(outPath.getWithExtension(_SYS_STR(".yaml"), true).getAbsolutePath());
athena::io::ToYAMLStream(mlvl, writer);
hecl::blender::Connection& conn = btok.getBlenderConnection();
return DNAMLVL::ReadMLVLToBlender(conn, mlvl, outPath, pakRouter,

View File

@ -92,7 +92,7 @@ bool MREA::Extract(const SpecBase& dataSpec,
/* MREA decompression stream */
StreamReader drs(rs, head.compressedBlockCount, head.secIndexCount);
hecl::ProjectPath decompPath = outPath.getCookedPath(SpecEntMP3ORIG).getWithExtension(_S(".decomp"));
hecl::ProjectPath decompPath = outPath.getCookedPath(SpecEntMP3ORIG).getWithExtension(_SYS_STR(".decomp"));
decompPath.makeDirChain(false);
athena::io::FileWriter mreaDecompOut(decompPath.getAbsolutePath());
head.write(mreaDecompOut);

View File

@ -24,18 +24,18 @@ static logvisor::Module Log("urde::SpecBase");
static const hecl::SystemChar* MomErr[] =
{
_S("Your metroid is in another castle"),
_S("HECL is experiencing a PTSD attack"),
_S("Unable to freeze metroids"),
_S("Ridley ate your homework"),
_S("Expected 0 maternal symbolisms, found 2147483647"),
_S("Contradictive narratives unsupported"),
_S("Wiimote profile \"NES + Zapper\" not recognized"),
_S("Unable to find Waldo"),
_S("Expected Ridley, found furby"),
_S("Adam has not authorized this, please do not bug the developers"),
_S("Lady returned objection"),
_S("Unterminated plot thread 'Deleter' detected")
_SYS_STR("Your metroid is in another castle"),
_SYS_STR("HECL is experiencing a PTSD attack"),
_SYS_STR("Unable to freeze metroids"),
_SYS_STR("Ridley ate your homework"),
_SYS_STR("Expected 0 maternal symbolisms, found 2147483647"),
_SYS_STR("Contradictive narratives unsupported"),
_SYS_STR("Wiimote profile \"NES + Zapper\" not recognized"),
_SYS_STR("Unable to find Waldo"),
_SYS_STR("Expected Ridley, found furby"),
_SYS_STR("Adam has not authorized this, please do not bug the developers"),
_SYS_STR("Lady returned objection"),
_SYS_STR("Unterminated plot thread 'Deleter' detected")
};
constexpr uint32_t MomErrCount = std::extent<decltype(MomErr)>::value;
@ -53,10 +53,10 @@ SpecBase::~SpecBase()
cancelBackgroundIndex();
}
static const hecl::SystemString regNONE = _S("");
static const hecl::SystemString regE = _S("NTSC");
static const hecl::SystemString regJ = _S("NTSC-J");
static const hecl::SystemString regP = _S("PAL");
static const hecl::SystemString regNONE = _SYS_STR("");
static const hecl::SystemString regE = _SYS_STR("NTSC");
static const hecl::SystemString regJ = _SYS_STR("NTSC-J");
static const hecl::SystemString regP = _SYS_STR("PAL");
void SpecBase::setThreadProject()
{
@ -98,7 +98,7 @@ IDRestorer<IDType>::IDRestorer(const hecl::ProjectPath& yamlPath, const hecl::Da
return a.first < b.first;
});
Log.report(logvisor::Info, _S("Loaded Original IDs '%s'"), yamlPath.getRelativePath().data());
Log.report(logvisor::Info, _SYS_STR("Loaded Original IDs '%s'"), yamlPath.getRelativePath().data());
}
template <typename IDType>
@ -180,19 +180,19 @@ void SpecBase::doExtract(const ExtractPassInfo& info, const hecl::MultiProgressP
if (m_isWii)
{
/* Extract root files for repacking later */
hecl::ProjectPath outDir(m_project.getProjectWorkingPath(), _S("out"));
hecl::ProjectPath outDir(m_project.getProjectWorkingPath(), _SYS_STR("out"));
outDir.makeDirChain(true);
nod::ExtractionContext ctx = {info.force, nullptr};
if (!m_standalone)
{
progress.print(_S("Trilogy Files"), _S(""), 0.0);
progress.print(_SYS_STR("Trilogy Files"), _SYS_STR(""), 0.0);
nod::IPartition* data = m_disc->getDataPartition();
const nod::Node& root = data->getFSTRoot();
for (const nod::Node& child : root)
if (child.getKind() == nod::Node::Kind::File)
child.extractToDirectory(outDir.getAbsolutePath(), ctx);
progress.print(_S("Trilogy Files"), _S(""), 1.0);
progress.print(_SYS_STR("Trilogy Files"), _SYS_STR(""), 1.0);
}
}
extractFromDisc(*m_disc, info.force, progress);
@ -201,19 +201,19 @@ void SpecBase::doExtract(const ExtractPassInfo& info, const hecl::MultiProgressP
static bool IsPathAudioGroup(const hecl::ProjectPath& path)
{
return (path.getPathType() == hecl::ProjectPath::Type::Directory &&
hecl::ProjectPath(path, _S("!project.yaml")).isFile() &&
hecl::ProjectPath(path, _S("!pool.yaml")).isFile());
hecl::ProjectPath(path, _SYS_STR("!project.yaml")).isFile() &&
hecl::ProjectPath(path, _SYS_STR("!pool.yaml")).isFile());
}
static bool IsPathSong(const hecl::ProjectPath& path)
{
if (path.getPathType() != hecl::ProjectPath::Type::Glob ||
!path.getWithExtension(_S(".mid"), true).isFile() ||
!path.getWithExtension(_S(".yaml"), true).isFile())
!path.getWithExtension(_SYS_STR(".mid"), true).isFile() ||
!path.getWithExtension(_SYS_STR(".yaml"), true).isFile())
{
if (path.isFile() &&
!hecl::StrCmp(_S("mid"), path.getLastComponentExt().data()) &&
path.getWithExtension(_S(".yaml"), true).isFile())
!hecl::StrCmp(_SYS_STR("mid"), path.getLastComponentExt().data()) &&
path.getWithExtension(_SYS_STR(".yaml"), true).isFile())
return true;
return false;
}
@ -227,7 +227,7 @@ bool SpecBase::canCook(const hecl::ProjectPath& path, hecl::blender::Token& btok
hecl::ProjectPath asBlend;
if (path.getPathType() == hecl::ProjectPath::Type::Glob)
asBlend = path.getWithExtension(_S(".blend"), true);
asBlend = path.getWithExtension(_SYS_STR(".blend"), true);
else
asBlend = path;
@ -278,20 +278,20 @@ const hecl::Database::DataSpecEntry* SpecBase::overrideDataSpec(const hecl::Proj
hecl::ProjectPath asBlend;
if (path.getPathType() == hecl::ProjectPath::Type::Glob)
asBlend = path.getWithExtension(_S(".blend"), true);
asBlend = path.getWithExtension(_SYS_STR(".blend"), true);
else
asBlend = path;
if (hecl::IsPathBlend(asBlend))
{
if (hecl::StringUtils::EndsWith(path.getAuxInfo(), _S(".CSKR")) ||
hecl::StringUtils::EndsWith(path.getAuxInfo(), _S(".ANIM")))
if (hecl::StringUtils::EndsWith(path.getAuxInfo(), _SYS_STR(".CSKR")) ||
hecl::StringUtils::EndsWith(path.getAuxInfo(), _SYS_STR(".ANIM")))
return oldEntry;
hecl::blender::Connection& conn = btok.getBlenderConnection();
if (!conn.openBlend(asBlend))
{
Log.report(logvisor::Error, _S("unable to cook '%s'"),
Log.report(logvisor::Error, _SYS_STR("unable to cook '%s'"),
path.getAbsolutePath().data());
return nullptr;
}
@ -315,7 +315,7 @@ void SpecBase::doCook(const hecl::ProjectPath& path, const hecl::ProjectPath& co
hecl::ProjectPath asBlend;
if (path.getPathType() == hecl::ProjectPath::Type::Glob)
asBlend = path.getWithExtension(_S(".blend"), true);
asBlend = path.getWithExtension(_SYS_STR(".blend"), true);
else
asBlend = path;
@ -425,7 +425,7 @@ void SpecBase::flattenDependenciesBlend(const hecl::ProjectPath& in,
}
case hecl::blender::BlendType::Actor:
{
hecl::ProjectPath asGlob = in.getWithExtension(_S(".*"), true);
hecl::ProjectPath asGlob = in.getWithExtension(_SYS_STR(".*"), true);
hecl::blender::DataStream ds = conn.beginData();
hecl::blender::Actor actor = ds.compileActorCharacterOnly();
auto actNames = ds.getActionNames();
@ -442,11 +442,11 @@ void SpecBase::flattenDependenciesBlend(const hecl::ProjectPath& in,
}
hecl::SystemStringConv chSysName(sub.name);
pathsOut.push_back(asGlob.ensureAuxInfo(hecl::SystemString(chSysName.sys_str()) + _S(".CSKR")));
pathsOut.push_back(asGlob.ensureAuxInfo(hecl::SystemString(chSysName.sys_str()) + _SYS_STR(".CSKR")));
const auto& arm = actor.armatures[sub.armature];
hecl::SystemStringConv armSysName(arm.name);
pathsOut.push_back(asGlob.ensureAuxInfo(hecl::SystemString(armSysName.sys_str()) + _S(".CINF")));
pathsOut.push_back(asGlob.ensureAuxInfo(hecl::SystemString(armSysName.sys_str()) + _SYS_STR(".CINF")));
for (const auto& overlay : sub.overlayMeshes)
{
hecl::SystemStringConv ovelaySys(overlay.first);
@ -455,8 +455,8 @@ void SpecBase::flattenDependenciesBlend(const hecl::ProjectPath& in,
flattenDependenciesBlend(overlay.second, pathsOut, btok);
pathsOut.push_back(overlay.second);
}
pathsOut.push_back(asGlob.ensureAuxInfo(hecl::SystemString(chSysName.sys_str()) + _S('.') +
ovelaySys.c_str() + _S(".CSKR")));
pathsOut.push_back(asGlob.ensureAuxInfo(hecl::SystemString(chSysName.sys_str()) + _SYS_STR('.') +
ovelaySys.c_str() + _SYS_STR(".CSKR")));
}
}
};
@ -475,28 +475,28 @@ void SpecBase::flattenDependenciesBlend(const hecl::ProjectPath& in,
}
hecl::SystemStringConv chSysName(att.name);
pathsOut.push_back(asGlob.ensureAuxInfo(hecl::SystemString(_S("ATTACH.")) +
chSysName.c_str() + _S(".CSKR")));
pathsOut.push_back(asGlob.ensureAuxInfo(hecl::SystemString(_SYS_STR("ATTACH.")) +
chSysName.c_str() + _SYS_STR(".CSKR")));
if (att.armature >= 0)
{
const auto& arm = actor.armatures[att.armature];
hecl::SystemStringConv armSysName(arm.name);
pathsOut.push_back(asGlob.ensureAuxInfo(hecl::SystemString(armSysName.sys_str()) + _S(".CINF")));
pathsOut.push_back(asGlob.ensureAuxInfo(hecl::SystemString(armSysName.sys_str()) + _SYS_STR(".CINF")));
}
}
for (const auto& act : actNames)
{
hecl::SystemStringConv actSysName(act);
pathsOut.push_back(asGlob.ensureAuxInfo(hecl::SystemString(actSysName.sys_str()) + _S(".ANIM")));
hecl::ProjectPath evntPath = asGlob.ensureAuxInfo({}).getWithExtension(
hecl::SysFormat(_S(".%s.evnt.yaml"), actSysName.c_str()).c_str(), true);
pathsOut.push_back(asGlob.ensureAuxInfo(hecl::SystemString(actSysName.sys_str()) + _SYS_STR(".ANIM")));
hecl::ProjectPath evntPath = asGlob.ensureAuxInfo(hecl::SystemStringView{}).getWithExtension(
hecl::SysFormat(_SYS_STR(".%s.evnt.yaml"), actSysName.c_str()).c_str(), true);
if (evntPath.isFile())
pathsOut.push_back(evntPath);
}
hecl::ProjectPath yamlPath = asGlob.getWithExtension(_S(".yaml"), true);
hecl::ProjectPath yamlPath = asGlob.getWithExtension(_SYS_STR(".yaml"), true);
if (yamlPath.isFile())
{
athena::io::FileReader reader(yamlPath.getAbsolutePath());
@ -528,7 +528,7 @@ void SpecBase::flattenDependencies(const hecl::ProjectPath& path,
hecl::ProjectPath asBlend;
if (path.getPathType() == hecl::ProjectPath::Type::Glob)
asBlend = path.getWithExtension(_S(".blend"), true);
asBlend = path.getWithExtension(_SYS_STR(".blend"), true);
else
asBlend = path;
@ -579,8 +579,8 @@ void SpecBase::recursiveBuildResourceList(std::vector<urde::SObjectTag>& listOut
hecl::ProjectPath childPath(path, ent.m_name);
if (ent.m_isDir)
{
if (hecl::ProjectPath(childPath, _S("!project.yaml")).isFile() &&
hecl::ProjectPath(childPath, _S("!pool.yaml")).isFile())
if (hecl::ProjectPath(childPath, _SYS_STR("!project.yaml")).isFile() &&
hecl::ProjectPath(childPath, _SYS_STR("!pool.yaml")).isFile())
{
/* Handle AudioGroup case */
if (urde::SObjectTag tag = tagFromPath(childPath, btok))
@ -624,7 +624,7 @@ void SpecBase::copyBuildListData(std::vector<std::tuple<size_t, size_t, bool>>&
int loadIdx = 0;
for (const auto& tag : buildList)
{
hecl::SystemString str = hecl::SysFormat(_S("Copying %.4") FMT_CSTR_SYS " %08X",
hecl::SystemString str = hecl::SysFormat(_SYS_STR("Copying %.4") FMT_CSTR_SYS " %08X",
tag.type.getChars(), (unsigned int)tag.id.Value());
progress.print(str.c_str(), nullptr, ++loadIdx / float(buildList.size()));
@ -635,7 +635,7 @@ void SpecBase::copyBuildListData(std::vector<std::tuple<size_t, size_t, bool>>&
{
auto search = mlvlData.find(tag.id);
if (search == mlvlData.end())
Log.report(logvisor::Fatal, _S("Unable to find MLVL %08X"), tag.id.Value());
Log.report(logvisor::Fatal, _SYS_STR("Unable to find MLVL %08X"), tag.id.Value());
std::get<0>(thisIdx) = pakOut.position();
std::get<1>(thisIdx) = ROUND_UP_32(search->second.size());
@ -651,7 +651,7 @@ void SpecBase::copyBuildListData(std::vector<std::tuple<size_t, size_t, bool>>&
hecl::ProjectPath cooked = getCookedPath(path, true);
athena::io::FileReader r(cooked.getAbsolutePath());
if (r.hasError())
Log.report(logvisor::Fatal, _S("Unable to open resource %s"), cooked.getRelativePath().data());
Log.report(logvisor::Fatal, _SYS_STR("Unable to open resource %s"), cooked.getRelativePath().data());
atUint64 size = r.length();
auto data = r.readUBytes(size);
auto compData = compressPakData(tag, data.get(), size);
@ -688,16 +688,16 @@ void SpecBase::doPackage(const hecl::ProjectPath& path, const hecl::Database::Da
waitForIndexComplete();
/* Name pak based on root-relative components */
auto components = path.getWithExtension(_S(""), true).getPathComponents();
auto components = path.getWithExtension(_SYS_STR(""), true).getPathComponents();
if (components.size() <= 1)
return;
hecl::ProjectPath outPath;
if (hecl::ProjectPath(m_project.getProjectWorkingPath(), _S("out/files/") + components[0]).isDirectory())
if (hecl::ProjectPath(m_project.getProjectWorkingPath(), _SYS_STR("out/files/") + components[0]).isDirectory())
outPath.assign(m_project.getProjectWorkingPath(),
_S("out/files/") + components[0] + _S("/") + components[1] + entry->m_pakExt.data());
_SYS_STR("out/files/") + components[0] + _SYS_STR("/") + components[1] + entry->m_pakExt.data());
else
outPath.assign(m_project.getProjectWorkingPath(),
_S("out/files/") + components[1] + entry->m_pakExt.data());
_SYS_STR("out/files/") + components[1] + entry->m_pakExt.data());
outPath.makeDirChain(false);
/* Output file */
@ -707,7 +707,7 @@ void SpecBase::doPackage(const hecl::ProjectPath& path, const hecl::Database::Da
std::unordered_map<urde::CAssetId, std::vector<uint8_t>> mlvlData;
if (path.getPathType() == hecl::ProjectPath::Type::File &&
!hecl::StrCmp(path.getLastComponent().data(), _S("!world.blend"))) /* World PAK */
!hecl::StrCmp(path.getLastComponent().data(), _SYS_STR("!world.blend"))) /* World PAK */
{
/* Force-cook MLVL and write resource list structure */
m_project.cookPath(path, progress, false, true, fast, entry, cp);
@ -779,7 +779,7 @@ void SpecBase::doPackage(const hecl::ProjectPath& path, const hecl::Database::Da
/* Async cook resource list if using ClientProcess */
if (cp)
{
Log.report(logvisor::Info, _S("Validating resources"));
Log.report(logvisor::Info, _SYS_STR("Validating resources"));
progress.setMainIndeterminate(true);
for (int i=0 ; i<entry->m_numCookPasses ; ++i)
{
@ -794,7 +794,7 @@ void SpecBase::doPackage(const hecl::ProjectPath& path, const hecl::Database::Da
hecl::ProjectPath depPath = pathFromTag(tag);
if (!depPath)
{
Log.report(logvisor::Fatal, _S("Unable to resolve %.4s %08X"),
Log.report(logvisor::Fatal, _SYS_STR("Unable to resolve %.4s %08X"),
tag.type.getChars(), tag.id.Value());
}
m_project.cookPath(depPath, progress, false, false, fast, entry, cp, i);
@ -807,7 +807,7 @@ void SpecBase::doPackage(const hecl::ProjectPath& path, const hecl::Database::Da
/* Write resource data and build file index */
std::vector<std::tuple<size_t, size_t, bool>> fileIndex;
Log.report(logvisor::Info, _S("Copying data into %s"), outPath.getRelativePath().data());
Log.report(logvisor::Info, _SYS_STR("Copying data into %s"), outPath.getRelativePath().data());
copyBuildListData(fileIndex, buildList, entry, fast, progress, pakOut, mlvlData);
/* Write file index */
@ -848,20 +848,20 @@ static inline uint8_t Convert4To8(uint8_t v)
void SpecBase::extractRandomStaticEntropy(const uint8_t* buf, const hecl::ProjectPath& noAramPath)
{
hecl::ProjectPath entropyPath(noAramPath, _S("RandomStaticEntropy.png"));
hecl::ProjectPath catalogPath(noAramPath, _S("!catalog.yaml"));
hecl::ProjectPath entropyPath(noAramPath, _SYS_STR("RandomStaticEntropy.png"));
hecl::ProjectPath catalogPath(noAramPath, _SYS_STR("!catalog.yaml"));
if (FILE* fp = hecl::Fopen(catalogPath.getAbsolutePath().data(), _S("a")))
if (FILE* fp = hecl::Fopen(catalogPath.getAbsolutePath().data(), _SYS_STR("a")))
{
fprintf(fp, "RandomStaticEntropy: %s\n", entropyPath.getRelativePathUTF8().data());
fclose(fp);
}
FILE* fp = hecl::Fopen(entropyPath.getAbsolutePath().data(), _S("wb"));
FILE* fp = hecl::Fopen(entropyPath.getAbsolutePath().data(), _SYS_STR("wb"));
if (!fp)
{
Log.report(logvisor::Error,
_S("Unable to open '%s' for writing"),
_SYS_STR("Unable to open '%s' for writing"),
entropyPath.getAbsolutePath().data());
return;
}
@ -1130,7 +1130,7 @@ void SpecBase::backgroundIndexRecursiveCatalogs(const hecl::ProjectPath& dir,
continue;
/* Read catalog.yaml for .pak directory if exists */
if (level == 1 && !ent.m_name.compare(_S("!catalog.yaml")))
if (level == 1 && !ent.m_name.compare(_SYS_STR("!catalog.yaml")))
{
readCatalog(path, nameWriter);
continue;
@ -1160,7 +1160,7 @@ bool SpecBase::addFileToIndex(const hecl::ProjectPath& path,
return true;
/* Try as glob */
hecl::ProjectPath asGlob = path.getWithExtension(_S(".*"), true);
hecl::ProjectPath asGlob = path.getWithExtension(_SYS_STR(".*"), true);
if (m_pathToTag.find(asGlob.hash()) != m_pathToTag.cend())
return true;
@ -1190,7 +1190,7 @@ bool SpecBase::addFileToIndex(const hecl::ProjectPath& path,
for (const std::string& arm : armatureNames)
{
hecl::SystemStringConv sysStr(arm);
hecl::ProjectPath subPath = asGlob.ensureAuxInfo(hecl::SystemString(sysStr.sys_str()) + _S(".CINF"));
hecl::ProjectPath subPath = asGlob.ensureAuxInfo(hecl::SystemString(sysStr.sys_str()) + _SYS_STR(".CINF"));
urde::SObjectTag pathTag = buildTagFromPath(subPath, m_backgroundBlender);
m_tagToPath[pathTag] = subPath;
m_pathToTag[subPath.hash()] = pathTag;
@ -1203,7 +1203,7 @@ bool SpecBase::addFileToIndex(const hecl::ProjectPath& path,
for (const std::string& sub : subtypeNames)
{
hecl::SystemStringConv sysStr(sub);
hecl::ProjectPath subPath = asGlob.ensureAuxInfo(hecl::SystemString(sysStr.sys_str()) + _S(".CSKR"));
hecl::ProjectPath subPath = asGlob.ensureAuxInfo(hecl::SystemString(sysStr.sys_str()) + _SYS_STR(".CSKR"));
urde::SObjectTag pathTag = buildTagFromPath(subPath, m_backgroundBlender);
m_tagToPath[pathTag] = subPath;
m_pathToTag[subPath.hash()] = pathTag;
@ -1216,8 +1216,8 @@ bool SpecBase::addFileToIndex(const hecl::ProjectPath& path,
for (const auto& overlay : overlayNames)
{
hecl::SystemStringConv overlaySys(overlay);
hecl::ProjectPath subPath = asGlob.ensureAuxInfo(hecl::SystemString(sysStr.sys_str()) + _S('.') +
overlaySys.c_str() + _S(".CSKR"));
hecl::ProjectPath subPath = asGlob.ensureAuxInfo(hecl::SystemString(sysStr.sys_str()) + _SYS_STR('.') +
overlaySys.c_str() + _SYS_STR(".CSKR"));
urde::SObjectTag pathTag = buildTagFromPath(subPath, m_backgroundBlender);
m_tagToPath[pathTag] = subPath;
m_pathToTag[subPath.hash()] = pathTag;
@ -1232,8 +1232,8 @@ bool SpecBase::addFileToIndex(const hecl::ProjectPath& path,
for (const auto& attachment : attachmentNames)
{
hecl::SystemStringConv attachmentSys(attachment);
hecl::ProjectPath subPath = asGlob.ensureAuxInfo(hecl::SystemString(_S("ATTACH.")) +
attachmentSys.c_str() + _S(".CSKR"));
hecl::ProjectPath subPath = asGlob.ensureAuxInfo(hecl::SystemString(_SYS_STR("ATTACH.")) +
attachmentSys.c_str() + _SYS_STR(".CSKR"));
urde::SObjectTag pathTag = buildTagFromPath(subPath, m_backgroundBlender);
m_tagToPath[pathTag] = subPath;
m_pathToTag[subPath.hash()] = pathTag;
@ -1246,7 +1246,7 @@ bool SpecBase::addFileToIndex(const hecl::ProjectPath& path,
for (const std::string& act : actionNames)
{
hecl::SystemStringConv sysStr(act);
hecl::ProjectPath subPath = asGlob.ensureAuxInfo(hecl::SystemString(sysStr.sys_str()) + _S(".ANIM"));
hecl::ProjectPath subPath = asGlob.ensureAuxInfo(hecl::SystemString(sysStr.sys_str()) + _SYS_STR(".ANIM"));
urde::SObjectTag pathTag = buildTagFromPath(subPath, m_backgroundBlender);
m_tagToPath[pathTag] = subPath;
m_pathToTag[subPath.hash()] = pathTag;
@ -1262,7 +1262,7 @@ bool SpecBase::addFileToIndex(const hecl::ProjectPath& path,
pathTag = {SBIG('MLVL'), asGlob.hash().val32()};
useGlob = true;
hecl::ProjectPath subPath = asGlob.ensureAuxInfo(_S("MAPW"));
hecl::ProjectPath subPath = asGlob.ensureAuxInfo(_SYS_STR("MAPW"));
urde::SObjectTag pathTag = buildTagFromPath(subPath, m_backgroundBlender);
m_tagToPath[pathTag] = subPath;
m_pathToTag[subPath.hash()] = pathTag;
@ -1271,7 +1271,7 @@ bool SpecBase::addFileToIndex(const hecl::ProjectPath& path,
DumpCacheAdd(pathTag, subPath);
#endif
subPath = asGlob.ensureAuxInfo(_S("SAVW"));
subPath = asGlob.ensureAuxInfo(_SYS_STR("SAVW"));
pathTag = buildTagFromPath(subPath, m_backgroundBlender);
m_tagToPath[pathTag] = subPath;
m_pathToTag[subPath.hash()] = pathTag;
@ -1333,7 +1333,7 @@ void SpecBase::backgroundIndexRecursiveProc(const hecl::ProjectPath& dir,
continue;
/* Read catalog.yaml for .pak directory if exists */
if (level == 1 && !ent.m_name.compare(_S("!catalog.yaml")))
if (level == 1 && !ent.m_name.compare(_SYS_STR("!catalog.yaml")))
{
readCatalog(path, nameWriter);
continue;
@ -1349,8 +1349,8 @@ void SpecBase::backgroundIndexProc()
{
logvisor::RegisterThreadName("Resource Index");
hecl::ProjectPath tagCachePath(m_project.getProjectCookedPath(getOriginalSpec()), _S("tag_cache.yaml"));
hecl::ProjectPath nameCachePath(m_project.getProjectCookedPath(getOriginalSpec()), _S("name_cache.yaml"));
hecl::ProjectPath tagCachePath(m_project.getProjectCookedPath(getOriginalSpec()), _SYS_STR("tag_cache.yaml"));
hecl::ProjectPath nameCachePath(m_project.getProjectCookedPath(getOriginalSpec()), _SYS_STR("name_cache.yaml"));
hecl::ProjectPath specRoot(m_project.getProjectWorkingPath(), getOriginalSpec().m_name);
/* Cache will be overwritten with validated entries afterwards */
@ -1363,7 +1363,7 @@ void SpecBase::backgroundIndexProc()
athena::io::FileReader reader(tagCachePath.getAbsolutePath());
if (reader.isOpen())
{
Log.report(logvisor::Info, _S("Cache index of '%s' loading"), getOriginalSpec().m_name.data());
Log.report(logvisor::Info, _SYS_STR("Cache index of '%s' loading"), getOriginalSpec().m_name.data());
athena::io::YAMLDocReader cacheReader;
if (cacheReader.parse(&reader))
{
@ -1397,13 +1397,13 @@ void SpecBase::backgroundIndexProc()
}
fprintf(stderr, "\r %" PRISize " / %" PRISize "\n", loadIdx, tagCount);
}
Log.report(logvisor::Info, _S("Cache index of '%s' loaded; %d tags"),
Log.report(logvisor::Info, _SYS_STR("Cache index of '%s' loaded; %d tags"),
getOriginalSpec().m_name.data(), m_tagToPath.size());
if (nameCachePath.isFile())
{
/* Read in name cache */
Log.report(logvisor::Info, _S("Name index of '%s' loading"), getOriginalSpec().m_name.data());
Log.report(logvisor::Info, _SYS_STR("Name index of '%s' loading"), getOriginalSpec().m_name.data());
athena::io::FileReader nreader(nameCachePath.getAbsolutePath());
athena::io::YAMLDocReader nameReader;
if (nameReader.parse(&nreader))
@ -1425,7 +1425,7 @@ void SpecBase::backgroundIndexProc()
}
}
}
Log.report(logvisor::Info, _S("Name index of '%s' loaded; %d names"),
Log.report(logvisor::Info, _SYS_STR("Name index of '%s' loaded; %d names"),
getOriginalSpec().m_name.data(), m_catalogNameToTag.size());
}
}
@ -1440,7 +1440,7 @@ void SpecBase::backgroundIndexProc()
m_catalogTagToNames[oidsTag].insert("MP1OriginalIDs");
}
Log.report(logvisor::Info, _S("Background index of '%s' started"), getOriginalSpec().m_name.data());
Log.report(logvisor::Info, _SYS_STR("Background index of '%s' started"), getOriginalSpec().m_name.data());
backgroundIndexRecursiveProc(specRoot, cacheWriter, nameWriter, 0);
tagCachePath.makeDirChain(false);
@ -1451,7 +1451,7 @@ void SpecBase::backgroundIndexProc()
nameWriter.finish(&nwriter);
m_backgroundBlender.shutdown();
Log.report(logvisor::Info, _S("Background index of '%s' complete; %d tags, %d names"),
Log.report(logvisor::Info, _SYS_STR("Background index of '%s' complete; %d tags, %d names"),
getOriginalSpec().m_name.data(), m_tagToPath.size(), m_catalogNameToTag.size());
m_backgroundRunning = false;
}

View File

@ -192,8 +192,8 @@ struct SpecMP1 : SpecBase
SpecMP1(const hecl::Database::DataSpecEntry* specEntry, hecl::Database::Project& project, bool pc)
: SpecBase(specEntry, project, pc)
, m_workPath(project.getProjectWorkingPath(), _S("MP1"))
, m_cookPath(project.getProjectCookedPath(SpecEntMP1), _S("MP1"))
, m_workPath(project.getProjectWorkingPath(), _SYS_STR("MP1"))
, m_cookPath(project.getProjectCookedPath(SpecEntMP1), _SYS_STR("MP1"))
, m_pakRouter(*this, m_workPath, m_cookPath)
, m_idRestorer({project.getProjectWorkingPath(), "MP1/!original_ids.yaml"}, project)
{
@ -289,13 +289,13 @@ struct SpecMP1 : SpecBase
/* Root Report */
reps.emplace_back();
ExtractReport& rep = reps.back();
rep.name = _S("MP1");
rep.desc = _S("Metroid Prime ") + regstr;
rep.name = _SYS_STR("MP1");
rep.desc = _SYS_STR("Metroid Prime ") + regstr;
if (buildInfo)
{
std::string buildStr(buildInfo);
hecl::SystemStringConv buildView(buildStr);
rep.desc += _S(" (") + buildView + _S(")");
rep.desc += _SYS_STR(" (") + buildView + _SYS_STR(")");
}
/* Iterate PAKs and build level options */
@ -317,13 +317,13 @@ struct SpecMP1 : SpecBase
{
hecl::SystemString lowerArg = arg;
hecl::ToLower(lowerArg);
if (!lowerArg.compare(0, 3, _S("mp1")))
if (!lowerArg.compare(0, 3, _SYS_STR("mp1")))
{
doExtract = true;
mp1args.reserve(args.size());
size_t slashPos = arg.find(_S('/'));
size_t slashPos = arg.find(_SYS_STR('/'));
if (slashPos == hecl::SystemString::npos)
slashPos = arg.find(_S('\\'));
slashPos = arg.find(_SYS_STR('\\'));
if (slashPos != hecl::SystemString::npos)
mp1args.emplace_back(hecl::SystemString(arg.begin() + slashPos + 1, arg.end()));
}
@ -351,13 +351,13 @@ struct SpecMP1 : SpecBase
/* Root Report */
reps.emplace_back();
ExtractReport& rep = reps.back();
rep.name = _S("MP1");
rep.desc = _S("Metroid Prime ") + regstr;
rep.name = _SYS_STR("MP1");
rep.desc = _SYS_STR("Metroid Prime ") + regstr;
if (buildInfo)
{
std::string buildStr(buildInfo);
hecl::SystemStringConv buildView(buildStr);
rep.desc += _S(" (") + buildView + _S(")");
rep.desc += _SYS_STR(" (") + buildView + _SYS_STR(")");
}
/* Iterate PAKs and build level options */
@ -375,37 +375,37 @@ struct SpecMP1 : SpecBase
bool extractFromDisc(nod::DiscBase& disc, bool force, const hecl::MultiProgressPrinter& progress)
{
m_project.enableDataSpecs({_S("MP1-PC")});
m_project.enableDataSpecs({_SYS_STR("MP1-PC")});
nod::ExtractionContext ctx = {force, nullptr};
m_workPath.makeDir();
progress.startNewLine();
progress.print(_S("Indexing PAKs"), _S(""), 0.0);
m_pakRouter.build(m_paks, [&progress](float factor) { progress.print(_S("Indexing PAKs"), _S(""), factor); });
progress.print(_S("Indexing PAKs"), _S(""), 1.0);
progress.print(_SYS_STR("Indexing PAKs"), _SYS_STR(""), 0.0);
m_pakRouter.build(m_paks, [&progress](float factor) { progress.print(_SYS_STR("Indexing PAKs"), _SYS_STR(""), factor); });
progress.print(_SYS_STR("Indexing PAKs"), _SYS_STR(""), 1.0);
hecl::ProjectPath outPath(m_project.getProjectWorkingPath(), _S("out"));
hecl::ProjectPath outPath(m_project.getProjectWorkingPath(), _SYS_STR("out"));
outPath.makeDir();
disc.getDataPartition()->extractSysFiles(outPath.getAbsolutePath(), ctx);
hecl::ProjectPath mp1OutPath(outPath, m_standalone ? _S("files") : _S("files/MP1"));
hecl::ProjectPath mp1OutPath(outPath, m_standalone ? _SYS_STR("files") : _SYS_STR("files/MP1"));
mp1OutPath.makeDirChain(true);
/* Extract non-pak files */
progress.startNewLine();
progress.print(_S("MP1 Root"), _S(""), 0.0);
progress.print(_SYS_STR("MP1 Root"), _SYS_STR(""), 0.0);
int prog = 0;
ctx.progressCB = [&](std::string_view name, float) {
hecl::SystemStringConv nameView(name);
progress.print(_S("MP1 Root"), nameView.c_str(), prog / (float)m_nonPaks.size());
progress.print(_SYS_STR("MP1 Root"), nameView.c_str(), prog / (float)m_nonPaks.size());
};
for (const nod::Node* node : m_nonPaks)
{
node->extractToDirectory(mp1OutPath.getAbsolutePath(), ctx);
prog++;
}
progress.print(_S("MP1 Root"), _S(""), 1.0);
progress.print(_SYS_STR("MP1 Root"), _SYS_STR(""), 1.0);
/* Extract unique resources */
hecl::ClientProcess process;
@ -445,7 +445,7 @@ struct SpecMP1 : SpecBase
process.waitUntilComplete();
/* Extract part of .dol for RandomStatic entropy */
hecl::ProjectPath noAramPath(m_project.getProjectWorkingPath(), _S("MP1/NoARAM"));
hecl::ProjectPath noAramPath(m_project.getProjectWorkingPath(), _SYS_STR("MP1/NoARAM"));
extractRandomStaticEntropy(m_dolBuf.get() + 0x4f60, noAramPath);
/* Generate original ID mapping for MLVL and SCAN entries - marks complete project */
@ -462,7 +462,7 @@ struct SpecMP1 : SpecBase
bool checkPathPrefix(const hecl::ProjectPath& path) const
{
return path.getRelativePath().compare(0, 4, _S("MP1/")) == 0;
return path.getRelativePath().compare(0, 4, _SYS_STR("MP1/")) == 0;
}
bool validateYAMLDNAType(athena::io::IStreamReader& fp) const
@ -540,20 +540,20 @@ struct SpecMP1 : SpecBase
urde::SObjectTag buildTagFromPath(const hecl::ProjectPath& path, hecl::blender::Token& btok) const
{
if (hecl::StringUtils::EndsWith(path.getAuxInfo(), _S(".CINF")))
if (hecl::StringUtils::EndsWith(path.getAuxInfo(), _SYS_STR(".CINF")))
return {SBIG('CINF'), path.hash().val32()};
else if (hecl::StringUtils::EndsWith(path.getAuxInfo(), _S(".CSKR")))
else if (hecl::StringUtils::EndsWith(path.getAuxInfo(), _SYS_STR(".CSKR")))
return {SBIG('CSKR'), path.hash().val32()};
else if (hecl::StringUtils::EndsWith(path.getAuxInfo(), _S(".ANIM")))
else if (hecl::StringUtils::EndsWith(path.getAuxInfo(), _SYS_STR(".ANIM")))
return {SBIG('ANIM'), path.hash().val32()};
else if (const hecl::SystemChar* ext = path.getLastComponentExt().data())
{
if (ext[0] == _S('*') || !hecl::StrCmp(ext, _S("mid")))
if (ext[0] == _SYS_STR('*') || !hecl::StrCmp(ext, _SYS_STR("mid")))
{
if (path.getWithExtension(_S(".mid"), true).isFile() &&
path.getWithExtension(_S(".yaml"), true).isFile())
if (path.getWithExtension(_SYS_STR(".mid"), true).isFile() &&
path.getWithExtension(_SYS_STR(".yaml"), true).isFile())
{
hecl::ProjectPath glob = path.getWithExtension(_S(".*"), true);
hecl::ProjectPath glob = path.getWithExtension(_SYS_STR(".*"), true);
return {SBIG('CSNG'), glob.hash().val32()};
}
}
@ -561,14 +561,14 @@ struct SpecMP1 : SpecBase
if (path.getPathType() == hecl::ProjectPath::Type::Directory)
{
if (hecl::ProjectPath(path, _S("!project.yaml")).isFile() &&
hecl::ProjectPath(path, _S("!pool.yaml")).isFile())
if (hecl::ProjectPath(path, _SYS_STR("!project.yaml")).isFile() &&
hecl::ProjectPath(path, _SYS_STR("!pool.yaml")).isFile())
return {SBIG('AGSC'), path.hash().val32()};
}
hecl::ProjectPath asBlend;
if (path.getPathType() == hecl::ProjectPath::Type::Glob)
asBlend = path.getWithExtension(_S(".blend"), true);
asBlend = path.getWithExtension(_SYS_STR(".blend"), true);
else
asBlend = path;
@ -589,26 +589,26 @@ struct SpecMP1 : SpecBase
case hecl::blender::BlendType::Actor:
if (path.getAuxInfo().size())
{
if (hecl::StringUtils::EndsWith(path.getAuxInfo(), _S(".CINF")))
return {SBIG('CINF'), path.getWithExtension(_S(".*"), true).hash().val32()};
else if (hecl::StringUtils::EndsWith(path.getAuxInfo(), _S(".CSKR")))
return {SBIG('CSKR'), path.getWithExtension(_S(".*"), true).hash().val32()};
else if (hecl::StringUtils::EndsWith(path.getAuxInfo(), _S(".ANIM")))
return {SBIG('ANIM'), path.getWithExtension(_S(".*"), true).hash().val32()};
if (hecl::StringUtils::EndsWith(path.getAuxInfo(), _SYS_STR(".CINF")))
return {SBIG('CINF'), path.getWithExtension(_SYS_STR(".*"), true).hash().val32()};
else if (hecl::StringUtils::EndsWith(path.getAuxInfo(), _SYS_STR(".CSKR")))
return {SBIG('CSKR'), path.getWithExtension(_SYS_STR(".*"), true).hash().val32()};
else if (hecl::StringUtils::EndsWith(path.getAuxInfo(), _SYS_STR(".ANIM")))
return {SBIG('ANIM'), path.getWithExtension(_SYS_STR(".*"), true).hash().val32()};
}
return {SBIG('ANCS'), path.getWithExtension(_S(".*"), true).hash().val32()};
return {SBIG('ANCS'), path.getWithExtension(_SYS_STR(".*"), true).hash().val32()};
case hecl::blender::BlendType::Area:
return {SBIG('MREA'), path.hash().val32()};
case hecl::blender::BlendType::World:
{
if (path.getAuxInfo().size())
{
if (hecl::StringUtils::EndsWith(path.getAuxInfo(), _S("MAPW")))
return {SBIG('MAPW'), path.getWithExtension(_S(".*"), true).hash().val32()};
else if (hecl::StringUtils::EndsWith(path.getAuxInfo(), _S("SAVW")))
return {SBIG('SAVW'), path.getWithExtension(_S(".*"), true).hash().val32()};
if (hecl::StringUtils::EndsWith(path.getAuxInfo(), _SYS_STR("MAPW")))
return {SBIG('MAPW'), path.getWithExtension(_SYS_STR(".*"), true).hash().val32()};
else if (hecl::StringUtils::EndsWith(path.getAuxInfo(), _SYS_STR("SAVW")))
return {SBIG('SAVW'), path.getWithExtension(_SYS_STR(".*"), true).hash().val32()};
}
return {SBIG('MLVL'), path.getWithExtension(_S(".*"), true).hash().val32()};
return {SBIG('MLVL'), path.getWithExtension(_SYS_STR(".*"), true).hash().val32()};
}
case hecl::blender::BlendType::MapArea:
return {SBIG('MAPA'), path.hash().val32()};
@ -626,7 +626,7 @@ struct SpecMP1 : SpecBase
}
else if (hecl::IsPathYAML(path))
{
FILE* fp = hecl::Fopen(path.getAbsolutePath().data(), _S("r"));
FILE* fp = hecl::Fopen(path.getAbsolutePath().data(), _SYS_STR("r"));
if (!fp)
return {};
@ -764,7 +764,7 @@ struct SpecMP1 : SpecBase
{
Mesh mesh =
ds.compileMesh(fast ? hecl::HMDLTopology::Triangles : hecl::HMDLTopology::TriStrips, m_pc ? 16 : -1,
[&progress](int surfCount) { progress(hecl::SysFormat(_S("%d"), surfCount).c_str()); });
[&progress](int surfCount) { progress(hecl::SysFormat(_SYS_STR("%d"), surfCount).c_str()); });
if (m_pc)
DNAMP1::CMDL::HMDLCook(out, in, mesh);
@ -791,12 +791,12 @@ struct SpecMP1 : SpecBase
void cookActor(const hecl::ProjectPath& out, const hecl::ProjectPath& in, BlendStream& ds, bool fast,
hecl::blender::Token& btok, FCookProgress progress)
{
if (hecl::StringUtils::EndsWith(in.getAuxInfo(), _S(".CINF")))
if (hecl::StringUtils::EndsWith(in.getAuxInfo(), _SYS_STR(".CINF")))
{
Actor actor = ds.compileActorCharacterOnly();
DNAMP1::ANCS::CookCINF(out, in, actor);
}
else if (hecl::StringUtils::EndsWith(in.getAuxInfo(), _S(".CSKR")))
else if (hecl::StringUtils::EndsWith(in.getAuxInfo(), _SYS_STR(".CSKR")))
{
Actor actor = ds.compileActorCharacterOnly();
ds.close();
@ -817,7 +817,7 @@ struct SpecMP1 : SpecBase
});
}
}
else if (hecl::StringUtils::EndsWith(in.getAuxInfo(), _S(".ANIM")))
else if (hecl::StringUtils::EndsWith(in.getAuxInfo(), _SYS_STR(".ANIM")))
{
Actor actor = ds.compileActorCharacterOnly();
DNAMP1::ANCS::CookANIM(out, in, actor, ds, m_pc);
@ -841,7 +841,7 @@ struct SpecMP1 : SpecBase
{
if (ent2.m_isDir)
{
hecl::ProjectPath wldPath(pakPath, ent2.m_name + _S("/!world.blend"));
hecl::ProjectPath wldPath(pakPath, ent2.m_name + _SYS_STR("/!world.blend"));
if (wldPath.isFile())
{
if (!conn.openBlend(wldPath))
@ -872,16 +872,16 @@ struct SpecMP1 : SpecBase
if (!mesh.compare("CMESH"))
{
colMesh = ds.compileColMesh(mesh);
progress(_S("Collision Mesh"));
progress(_SYS_STR("Collision Mesh"));
continue;
}
meshCompiles.push_back(ds.compileMesh(
mesh, fast ? hecl::HMDLTopology::Triangles : hecl::HMDLTopology::TriStrips, -1, !m_pc,
[&](int surfCount) { progress(hecl::SysFormat(_S("%s %d"), meshSys.c_str(), surfCount).c_str()); }));
[&](int surfCount) { progress(hecl::SysFormat(_SYS_STR("%s %d"), meshSys.c_str(), surfCount).c_str()); }));
}
if (!colMesh)
Log.report(logvisor::Fatal, _S("unable to find mesh named 'CMESH' in %s"), in.getAbsolutePath().data());
Log.report(logvisor::Fatal, _SYS_STR("unable to find mesh named 'CMESH' in %s"), in.getAbsolutePath().data());
std::vector<Light> lights = ds.compileLights();
@ -900,13 +900,13 @@ struct SpecMP1 : SpecBase
void cookWorld(const hecl::ProjectPath& out, const hecl::ProjectPath& in, BlendStream& ds, bool fast,
hecl::blender::Token& btok, FCookProgress progress)
{
if (hecl::StringUtils::EndsWith(in.getAuxInfo(), _S("MAPW")))
if (hecl::StringUtils::EndsWith(in.getAuxInfo(), _SYS_STR("MAPW")))
{
hecl::blender::World world = ds.compileWorld();
ds.close();
DNAMP1::MLVL::CookMAPW(out, world, btok);
}
else if (hecl::StringUtils::EndsWith(in.getAuxInfo(), _S("SAVW")))
else if (hecl::StringUtils::EndsWith(in.getAuxInfo(), _SYS_STR("SAVW")))
{
hecl::blender::World world = ds.compileWorld();
ds.close();
@ -1125,7 +1125,7 @@ struct SpecMP1 : SpecBase
OriginalIDs::Cook(in, out);
}
}
progress(_S("Done"));
progress(_SYS_STR("Done"));
}
void flattenDependenciesYAML(athena::io::IStreamReader& fin, std::vector<hecl::ProjectPath>& pathsOut)
@ -1243,7 +1243,7 @@ struct SpecMP1 : SpecBase
{
athena::io::FileReader r(worldPathCooked.getAbsolutePath());
if (r.hasError())
Log.report(logvisor::Fatal, _S("Unable to open world %s"), worldPathCooked.getRelativePath().data());
Log.report(logvisor::Fatal, _SYS_STR("Unable to open world %s"), worldPathCooked.getRelativePath().data());
mlvl.read(r);
}
@ -1262,7 +1262,7 @@ struct SpecMP1 : SpecBase
}
listOut.reserve(count);
urde::SObjectTag worldTag = tagFromPath(worldPath.getWithExtension(_S(".*"), true), btok);
urde::SObjectTag worldTag = tagFromPath(worldPath.getWithExtension(_SYS_STR(".*"), true), btok);
w.writeUint32Big(m_pc ? 0x80030005 : 0x00030005);
w.writeUint32Big(0);
@ -1283,7 +1283,7 @@ struct SpecMP1 : SpecBase
bool dupeRes = false;
if (hecl::ProjectPath areaDir = pathFromTag(areaTag).getParentPath())
dupeRes = hecl::ProjectPath(areaDir, _S("!duperes")).isFile();
dupeRes = hecl::ProjectPath(areaDir, _SYS_STR("!duperes")).isFile();
urde::SObjectTag nameTag(FOURCC('STRG'), originalToNew(area.areaNameId));
if (nameTag)
@ -1350,10 +1350,10 @@ struct SpecMP1 : SpecBase
{
athena::io::FileReader r(mapCookedPath.getAbsolutePath());
if (r.hasError())
Log.report(logvisor::Fatal, _S("Unable to open %s"), mapCookedPath.getRelativePath().data());
Log.report(logvisor::Fatal, _SYS_STR("Unable to open %s"), mapCookedPath.getRelativePath().data());
if (r.readUint32Big() != 0xDEADF00D)
Log.report(logvisor::Fatal, _S("Corrupt MAPW %s"), mapCookedPath.getRelativePath().data());
Log.report(logvisor::Fatal, _SYS_STR("Corrupt MAPW %s"), mapCookedPath.getRelativePath().data());
r.readUint32Big();
atUint32 mapaCount = r.readUint32Big();
for (int i=0 ; i<mapaCount ; ++i)
@ -1380,7 +1380,7 @@ struct SpecMP1 : SpecBase
{
urde::SObjectTag texTag = tagFromPath(tex, btok);
if (!texTag)
Log.report(logvisor::Fatal, _S("Unable to resolve %s"), tex.getRelativePath().data());
Log.report(logvisor::Fatal, _SYS_STR("Unable to resolve %s"), tex.getRelativePath().data());
listOut.push_back(texTag);
}
}
@ -1505,13 +1505,13 @@ struct SpecMP1 : SpecBase
void cookAudioGroup(const hecl::ProjectPath& out, const hecl::ProjectPath& in, FCookProgress progress)
{
DNAMP1::AGSC::Cook(in, out);
progress(_S("Done"));
progress(_SYS_STR("Done"));
}
void cookSong(const hecl::ProjectPath& out, const hecl::ProjectPath& in, FCookProgress progress)
{
DNAMP1::CSNG::Cook(in, out);
progress(_S("Done"));
progress(_SYS_STR("Done"));
}
void cookMapArea(const hecl::ProjectPath& out, const hecl::ProjectPath& in,
@ -1521,7 +1521,7 @@ struct SpecMP1 : SpecBase
hecl::blender::MapArea mapa = ds.compileMapArea();
ds.close();
DNAMP1::MAPA::Cook(mapa, out);
progress(_S("Done"));
progress(_SYS_STR("Done"));
}
void cookMapUniverse(const hecl::ProjectPath& out, const hecl::ProjectPath& in,
@ -1531,18 +1531,18 @@ struct SpecMP1 : SpecBase
hecl::blender::MapUniverse mapu = ds.compileMapUniverse();
ds.close();
DNAMAPU::MAPU::Cook(mapu, out);
progress(_S("Done"));
progress(_SYS_STR("Done"));
}
};
hecl::Database::DataSpecEntry SpecEntMP1 = {
_S("MP1"sv), _S("Data specification for original Metroid Prime engine"sv), _S(".pak"sv), 2,
_SYS_STR("MP1"sv), _SYS_STR("Data specification for original Metroid Prime engine"sv), _SYS_STR(".pak"sv), 2,
[](hecl::Database::Project& project, hecl::Database::DataSpecTool) -> std::unique_ptr<hecl::Database::IDataSpec> {
return std::make_unique<SpecMP1>(&SpecEntMP1, project, false);
}};
hecl::Database::DataSpecEntry SpecEntMP1PC = {
_S("MP1-PC"sv), _S("Data specification for PC-optimized Metroid Prime engine"sv), _S(".upak"sv), 2,
_SYS_STR("MP1-PC"sv), _SYS_STR("Data specification for PC-optimized Metroid Prime engine"sv), _SYS_STR(".upak"sv), 2,
[](hecl::Database::Project& project, hecl::Database::DataSpecTool tool) -> std::unique_ptr<hecl::Database::IDataSpec> {
if (tool != hecl::Database::DataSpecTool::Extract)
return std::make_unique<SpecMP1>(&SpecEntMP1PC, project, true);
@ -1550,5 +1550,5 @@ hecl::Database::DataSpecEntry SpecEntMP1PC = {
}};
hecl::Database::DataSpecEntry SpecEntMP1ORIG = {
_S("MP1-ORIG"sv), _S("Data specification for unmodified Metroid Prime resources"sv), {}, 2, {}};
_SYS_STR("MP1-ORIG"sv), _SYS_STR("Data specification for unmodified Metroid Prime resources"sv), {}, 2, {}};
}

View File

@ -153,8 +153,8 @@ struct SpecMP2 : SpecBase
SpecMP2(const hecl::Database::DataSpecEntry* specEntry, hecl::Database::Project& project, bool pc)
: SpecBase(specEntry, project, pc),
m_workPath(project.getProjectWorkingPath(), _S("MP2")),
m_cookPath(project.getProjectCookedPath(SpecEntMP2), _S("MP2")),
m_workPath(project.getProjectWorkingPath(), _SYS_STR("MP2")),
m_cookPath(project.getProjectCookedPath(SpecEntMP2), _SYS_STR("MP2")),
m_pakRouter(*this, m_workPath, m_cookPath),
m_idRestorer({project.getProjectWorkingPath(), "MP2/!original_ids.yaml"}, project)
{
@ -252,11 +252,11 @@ struct SpecMP2 : SpecBase
/* Root Report */
reps.emplace_back();
ExtractReport& rep = reps.back();
rep.name = _S("MP2");
rep.desc = _S("Metroid Prime 2 ") + regstr;
rep.name = _SYS_STR("MP2");
rep.desc = _SYS_STR("Metroid Prime 2 ") + regstr;
std::string buildStr(buildInfo);
hecl::SystemStringConv buildView(buildStr);
rep.desc += _S(" (") + buildView + _S(")");
rep.desc += _SYS_STR(" (") + buildView + _SYS_STR(")");
/* Iterate PAKs and build level options */
nod::Node& root = partition->getFSTRoot();
@ -279,13 +279,13 @@ struct SpecMP2 : SpecBase
{
hecl::SystemString lowerArg = arg;
hecl::ToLower(lowerArg);
if (!lowerArg.compare(0, 3, _S("mp2")))
if (!lowerArg.compare(0, 3, _SYS_STR("mp2")))
{
doExtract = true;
mp2args.reserve(args.size());
size_t slashPos = arg.find(_S('/'));
size_t slashPos = arg.find(_SYS_STR('/'));
if (slashPos == hecl::SystemString::npos)
slashPos = arg.find(_S('\\'));
slashPos = arg.find(_SYS_STR('\\'));
if (slashPos != hecl::SystemString::npos)
mp2args.emplace_back(hecl::SystemString(arg.begin() + slashPos + 1, arg.end()));
}
@ -313,13 +313,13 @@ struct SpecMP2 : SpecBase
/* Root Report */
reps.emplace_back();
ExtractReport& rep = reps.back();
rep.name = _S("MP2");
rep.desc = _S("Metroid Prime 2 ") + regstr;
rep.name = _SYS_STR("MP2");
rep.desc = _SYS_STR("Metroid Prime 2 ") + regstr;
if (buildInfo)
{
std::string buildStr(buildInfo);
hecl::SystemStringConv buildView(buildStr);
rep.desc += _S(" (") + buildView + _S(")");
rep.desc += _SYS_STR(" (") + buildView + _SYS_STR(")");
}
/* Iterate PAKs and build level options */
@ -342,32 +342,32 @@ struct SpecMP2 : SpecBase
m_workPath.makeDir();
progress.startNewLine();
progress.print(_S("Indexing PAKs"), _S(""), 0.0);
progress.print(_SYS_STR("Indexing PAKs"), _SYS_STR(""), 0.0);
m_pakRouter.build(m_paks, [&progress](float factor)
{
progress.print(_S("Indexing PAKs"), _S(""), factor);
progress.print(_SYS_STR("Indexing PAKs"), _SYS_STR(""), factor);
});
progress.print(_S("Indexing PAKs"), _S(""), 1.0);
progress.print(_SYS_STR("Indexing PAKs"), _SYS_STR(""), 1.0);
hecl::ProjectPath outPath(m_project.getProjectWorkingPath(), _S("out"));
hecl::ProjectPath outPath(m_project.getProjectWorkingPath(), _SYS_STR("out"));
outPath.makeDir();
disc.getDataPartition()->extractSysFiles(outPath.getAbsolutePath(), ctx);
hecl::ProjectPath mp2OutPath(outPath, m_standalone ? _S("files") : _S("files/MP2"));
hecl::ProjectPath mp2OutPath(outPath, m_standalone ? _SYS_STR("files") : _SYS_STR("files/MP2"));
mp2OutPath.makeDirChain(true);
progress.startNewLine();
progress.print(_S("MP2 Root"), _S(""), 0.0);
progress.print(_SYS_STR("MP2 Root"), _SYS_STR(""), 0.0);
int prog = 0;
ctx.progressCB = [&prog, &progress](std::string_view name, float) {
hecl::SystemStringConv nameView(name);
progress.print(_S("MP2 Root"), nameView.c_str(), prog);
progress.print(_SYS_STR("MP2 Root"), nameView.c_str(), prog);
};
for (const nod::Node* node : m_nonPaks)
{
node->extractToDirectory(mp2OutPath.getAbsolutePath(), ctx);
prog++;
}
progress.print(_S("MP2 Root"), _S(""), 1.0);
progress.print(_SYS_STR("MP2 Root"), _SYS_STR(""), 1.0);
hecl::ClientProcess process;
progress.startNewLine();
@ -417,7 +417,7 @@ struct SpecMP2 : SpecBase
bool checkPathPrefix(const hecl::ProjectPath& path) const
{
return path.getRelativePath().compare(0, 4, _S("MP2/")) == 0;
return path.getRelativePath().compare(0, 4, _SYS_STR("MP2/")) == 0;
}
bool validateYAMLDNAType(athena::io::IStreamReader& fp) const
@ -500,14 +500,14 @@ struct SpecMP2 : SpecBase
FCookProgress progress)
{
DNAMP2::AGSC::Cook(in, out);
progress(_S("Done"));
progress(_SYS_STR("Done"));
}
void cookSong(const hecl::ProjectPath& out, const hecl::ProjectPath& in,
FCookProgress progress)
{
DNAMP1::CSNG::Cook(in, out);
progress(_S("Done"));
progress(_SYS_STR("Done"));
}
void cookMapArea(const hecl::ProjectPath& out, const hecl::ProjectPath& in,
@ -517,7 +517,7 @@ struct SpecMP2 : SpecBase
hecl::blender::MapArea mapa = ds.compileMapArea();
ds.close();
DNAMP2::MAPA::Cook(mapa, out);
progress(_S("Done"));
progress(_SYS_STR("Done"));
}
void cookMapUniverse(const hecl::ProjectPath& out, const hecl::ProjectPath& in,
@ -527,7 +527,7 @@ struct SpecMP2 : SpecBase
hecl::blender::MapUniverse mapu = ds.compileMapUniverse();
ds.close();
DNAMAPU::MAPU::Cook(mapu, out);
progress(_S("Done"));
progress(_SYS_STR("Done"));
}
UniqueID32 newToOriginal(urde::CAssetId id) const
@ -547,16 +547,16 @@ struct SpecMP2 : SpecBase
hecl::Database::DataSpecEntry SpecEntMP2
(
_S("MP2"sv),
_S("Data specification for original Metroid Prime 2 engine"sv), _S(".pak"sv), 2,
_SYS_STR("MP2"sv),
_SYS_STR("Data specification for original Metroid Prime 2 engine"sv), _SYS_STR(".pak"sv), 2,
[](hecl::Database::Project& project, hecl::Database::DataSpecTool)
-> std::unique_ptr<hecl::Database::IDataSpec> {return std::make_unique<SpecMP2>(&SpecEntMP2, project, false);}
);
hecl::Database::DataSpecEntry SpecEntMP2PC =
{
_S("MP2-PC"sv),
_S("Data specification for PC-optimized Metroid Prime 2 engine"sv), _S(".upak"sv), 2,
_SYS_STR("MP2-PC"sv),
_SYS_STR("Data specification for PC-optimized Metroid Prime 2 engine"sv), _SYS_STR(".upak"sv), 2,
[](hecl::Database::Project& project, hecl::Database::DataSpecTool tool)
-> std::unique_ptr<hecl::Database::IDataSpec>
{
@ -568,8 +568,8 @@ hecl::Database::DataSpecEntry SpecEntMP2PC =
hecl::Database::DataSpecEntry SpecEntMP2ORIG =
{
_S("MP2-ORIG"sv),
_S("Data specification for unmodified Metroid Prime 2 resources"sv),
_SYS_STR("MP2-ORIG"sv),
_SYS_STR("Data specification for unmodified Metroid Prime 2 resources"sv),
{}, 2, {}
};

View File

@ -146,11 +146,11 @@ struct SpecMP3 : SpecBase
SpecMP3(const hecl::Database::DataSpecEntry* specEntry, hecl::Database::Project& project, bool pc)
: SpecBase(specEntry, project, pc),
m_workPath(project.getProjectWorkingPath(), _S("MP3")),
m_cookPath(project.getProjectCookedPath(SpecEntMP3), _S("MP3")),
m_workPath(project.getProjectWorkingPath(), _SYS_STR("MP3")),
m_cookPath(project.getProjectCookedPath(SpecEntMP3), _SYS_STR("MP3")),
m_pakRouter(*this, m_workPath, m_cookPath),
m_feWorkPath(project.getProjectWorkingPath(), _S("fe")),
m_feCookPath(project.getProjectCookedPath(SpecEntMP3), _S("fe")),
m_feWorkPath(project.getProjectWorkingPath(), _SYS_STR("fe")),
m_feCookPath(project.getProjectCookedPath(SpecEntMP3), _SYS_STR("fe")),
m_fePakRouter(*this, m_feWorkPath, m_feCookPath),
m_idRestorer({project.getProjectWorkingPath(), "MP3/!original_ids.yaml"}, project)
{
@ -261,13 +261,13 @@ struct SpecMP3 : SpecBase
else if (!item.first.compare("Metroid6.pak"))
{
/* Phaaze doesn't have a world name D: */
childRep.desc = _S("Phaaze");
childRep.desc = _SYS_STR("Phaaze");
continue;
}
else if (!item.first.compare("Metroid8.pak"))
{
/* Space world is misnamed */
childRep.desc = _S("Space");
childRep.desc = _SYS_STR("Space");
continue;
}
childRep.desc = item.second->getLevelString();
@ -293,11 +293,11 @@ struct SpecMP3 : SpecBase
/* Root Report */
reps.emplace_back();
ExtractReport& rep = reps.back();
rep.name = _S("MP3");
rep.desc = _S("Metroid Prime 3 ") + regstr;
rep.name = _SYS_STR("MP3");
rep.desc = _SYS_STR("Metroid Prime 3 ") + regstr;
std::string buildStr(buildInfo);
hecl::SystemStringConv buildView(buildStr);
rep.desc += _S(" (") + buildView + _S(")");
rep.desc += _SYS_STR(" (") + buildView + _SYS_STR(")");
/* Iterate PAKs and build level options */
nod::Node& root = partition->getFSTRoot();
@ -320,13 +320,13 @@ struct SpecMP3 : SpecBase
{
hecl::SystemString lowerArg = arg;
hecl::ToLower(lowerArg);
if (!lowerArg.compare(0, 3, _S("mp3")))
if (!lowerArg.compare(0, 3, _SYS_STR("mp3")))
{
doMP3 = true;
mp3args.reserve(args.size());
size_t slashPos = arg.find(_S('/'));
size_t slashPos = arg.find(_SYS_STR('/'));
if (slashPos == hecl::SystemString::npos)
slashPos = arg.find(_S('\\'));
slashPos = arg.find(_SYS_STR('\\'));
if (slashPos != hecl::SystemString::npos)
mp3args.emplace_back(hecl::SystemString(arg.begin() + slashPos + 1, arg.end()));
}
@ -336,13 +336,13 @@ struct SpecMP3 : SpecBase
{
hecl::SystemString lowerArg = arg;
hecl::ToLower(lowerArg);
if (!lowerArg.compare(0, 2, _S("fe")))
if (!lowerArg.compare(0, 2, _SYS_STR("fe")))
{
doMPTFE = true;
feargs.reserve(args.size());
size_t slashPos = arg.find(_S('/'));
size_t slashPos = arg.find(_SYS_STR('/'));
if (slashPos == hecl::SystemString::npos)
slashPos = arg.find(_S('\\'));
slashPos = arg.find(_SYS_STR('\\'));
if (slashPos != hecl::SystemString::npos)
feargs.emplace_back(hecl::SystemString(arg.begin() + slashPos + 1, arg.end()));
}
@ -389,12 +389,12 @@ struct SpecMP3 : SpecBase
/* Root Report */
reps.emplace_back();
ExtractReport& rep = reps.back();
rep.name = _S("MP3");
rep.desc = _S("Metroid Prime 3 ") + regstr;
rep.name = _SYS_STR("MP3");
rep.desc = _SYS_STR("Metroid Prime 3 ") + regstr;
std::string buildStr(buildInfo);
hecl::SystemStringConv buildView(buildStr);
rep.desc += _S(" (") + buildView + _S(")");
rep.desc += _SYS_STR(" (") + buildView + _SYS_STR(")");
/* Iterate PAKs and build level options */
@ -424,13 +424,13 @@ struct SpecMP3 : SpecBase
/* Root Report */
reps.emplace_back();
ExtractReport& rep = reps.back();
rep.name = _S("fe");
rep.desc = _S("Metroid Prime Trilogy Frontend ") + regstr;
rep.name = _SYS_STR("fe");
rep.desc = _SYS_STR("Metroid Prime Trilogy Frontend ") + regstr;
if (buildInfo)
{
std::string buildStr(buildInfo);
hecl::SystemStringConv buildView(buildStr);
rep.desc += _S(" (") + buildView + _S(")");
rep.desc += _SYS_STR(" (") + buildView + _SYS_STR(")");
}
/* Iterate PAKs and build level options */
@ -449,7 +449,7 @@ struct SpecMP3 : SpecBase
bool extractFromDisc(nod::DiscBase& disc, bool force, const hecl::MultiProgressPrinter& progress)
{
hecl::SystemString currentTarget = _S("");
hecl::SystemString currentTarget = _SYS_STR("");
size_t nodeCount = 0;
int prog = 0;
nod::ExtractionContext ctx = {force,
@ -463,22 +463,22 @@ struct SpecMP3 : SpecBase
m_workPath.makeDir();
progress.startNewLine();
progress.print(_S("Indexing PAKs"), _S(""), 0.0);
progress.print(_SYS_STR("Indexing PAKs"), _SYS_STR(""), 0.0);
m_pakRouter.build(m_paks, [&progress](float factor)
{
progress.print(_S("Indexing PAKs"), _S(""), factor);
progress.print(_SYS_STR("Indexing PAKs"), _SYS_STR(""), factor);
});
progress.print(_S("Indexing PAKs"), _S(""), 1.0);
progress.print(_SYS_STR("Indexing PAKs"), _SYS_STR(""), 1.0);
progress.startNewLine();
hecl::ProjectPath outPath(m_project.getProjectWorkingPath(), _S("out"));
hecl::ProjectPath outPath(m_project.getProjectWorkingPath(), _SYS_STR("out"));
outPath.makeDir();
disc.getDataPartition()->extractSysFiles(outPath.getAbsolutePath(), ctx);
hecl::ProjectPath mp3OutPath(outPath, m_standalone ? _S("files") : _S("files/MP3"));
hecl::ProjectPath mp3OutPath(outPath, m_standalone ? _SYS_STR("files") : _SYS_STR("files/MP3"));
mp3OutPath.makeDirChain(true);
currentTarget = _S("MP3 Root");
progress.print(currentTarget.c_str(), _S(""), 0.0);
currentTarget = _SYS_STR("MP3 Root");
progress.print(currentTarget.c_str(), _SYS_STR(""), 0.0);
prog = 0;
nodeCount = m_nonPaks.size();
@ -490,7 +490,7 @@ struct SpecMP3 : SpecBase
}
ctx.progressCB = nullptr;
progress.print(currentTarget.c_str(), _S(""), 1.0);
progress.print(currentTarget.c_str(), _SYS_STR(""), 1.0);
progress.startNewLine();
hecl::ClientProcess process;
@ -525,22 +525,22 @@ struct SpecMP3 : SpecBase
m_feWorkPath.makeDir();
progress.startNewLine();
progress.print(_S("Indexing PAKs"), _S(""), 0.0);
progress.print(_SYS_STR("Indexing PAKs"), _SYS_STR(""), 0.0);
m_fePakRouter.build(m_fePaks, [&progress](float factor)
{
progress.print(_S("Indexing PAKs"), _S(""), factor);
progress.print(_SYS_STR("Indexing PAKs"), _SYS_STR(""), factor);
});
progress.print(_S("Indexing PAKs"), _S(""), 1.0);
progress.print(_SYS_STR("Indexing PAKs"), _SYS_STR(""), 1.0);
progress.startNewLine();
hecl::ProjectPath outPath(m_project.getProjectWorkingPath(), _S("out"));
hecl::ProjectPath outPath(m_project.getProjectWorkingPath(), _SYS_STR("out"));
outPath.makeDir();
disc.getDataPartition()->extractSysFiles(outPath.getAbsolutePath(), ctx);
hecl::ProjectPath feOutPath(outPath, m_standalone ? _S("files") : _S("files/fe"));
hecl::ProjectPath feOutPath(outPath, m_standalone ? _SYS_STR("files") : _SYS_STR("files/fe"));
feOutPath.makeDirChain(true);
currentTarget = _S("fe Root");
progress.print(currentTarget.c_str(), _S(""), 0.0);
currentTarget = _SYS_STR("fe Root");
progress.print(currentTarget.c_str(), _SYS_STR(""), 0.0);
prog = 0;
nodeCount = m_feNonPaks.size();
@ -550,7 +550,7 @@ struct SpecMP3 : SpecBase
node->extractToDirectory(feOutPath.getAbsolutePath(), ctx);
prog++;
}
progress.print(currentTarget.c_str(), _S(""), 1.0);
progress.print(currentTarget.c_str(), _SYS_STR(""), 1.0);
progress.startNewLine();
hecl::ClientProcess process;
@ -596,7 +596,7 @@ struct SpecMP3 : SpecBase
bool checkPathPrefix(const hecl::ProjectPath& path) const
{
return path.getRelativePath().compare(0, 4, _S("MP3/")) == 0;
return path.getRelativePath().compare(0, 4, _SYS_STR("MP3/")) == 0;
}
bool validateYAMLDNAType(athena::io::IStreamReader& fp) const
@ -687,7 +687,7 @@ struct SpecMP3 : SpecBase
hecl::blender::MapArea mapa = ds.compileMapArea();
ds.close();
DNAMP3::MAPA::Cook(mapa, out);
progress(_S("Done"));
progress(_SYS_STR("Done"));
}
void cookMapUniverse(const hecl::ProjectPath& out, const hecl::ProjectPath& in,
@ -714,16 +714,16 @@ struct SpecMP3 : SpecBase
hecl::Database::DataSpecEntry SpecEntMP3
(
_S("MP3"sv),
_S("Data specification for original Metroid Prime 3 engine"sv), _S(".pak"sv), 2,
_SYS_STR("MP3"sv),
_SYS_STR("Data specification for original Metroid Prime 3 engine"sv), _SYS_STR(".pak"sv), 2,
[](hecl::Database::Project& project, hecl::Database::DataSpecTool)
-> std::unique_ptr<hecl::Database::IDataSpec> {return std::make_unique<SpecMP3>(&SpecEntMP3, project, false);}
);
hecl::Database::DataSpecEntry SpecEntMP3PC =
{
_S("MP3-PC"sv),
_S("Data specification for PC-optimized Metroid Prime 3 engine"sv), _S(".upak"sv), 2,
_SYS_STR("MP3-PC"sv),
_SYS_STR("Data specification for PC-optimized Metroid Prime 3 engine"sv), _SYS_STR(".upak"sv), 2,
[](hecl::Database::Project& project, hecl::Database::DataSpecTool tool)
-> std::unique_ptr<hecl::Database::IDataSpec>
{
@ -735,8 +735,8 @@ hecl::Database::DataSpecEntry SpecEntMP3PC =
hecl::Database::DataSpecEntry SpecEntMP3ORIG =
{
_S("MP3-ORIG"sv),
_S("Data specification for unmodified Metroid Prime 3 resources"sv),
_SYS_STR("MP3-ORIG"sv),
_SYS_STR("Data specification for unmodified Metroid Prime 3 resources"sv),
{}, 2, {}
};

View File

@ -56,7 +56,7 @@ bool ProjectManager::newProject(hecl::SystemStringView path)
hecl::ProjectRootPath projPath = hecl::SearchForProject(path);
if (projPath)
{
Log.report(logvisor::Warning, _S("project already exists at '%s'"), path.data());
Log.report(logvisor::Warning, _SYS_STR("project already exists at '%s'"), path.data());
return false;
}
@ -73,7 +73,7 @@ bool ProjectManager::newProject(hecl::SystemStringView path)
saveProject();
hecl::SystemString windowTitle(m_proj->getProjectRootPath().getLastComponent());
windowTitle += _S(" - URDE [") + hecl::SystemString(m_vm.platformName()) + _S("]");
windowTitle += _SYS_STR(" - URDE [") + hecl::SystemString(m_vm.platformName()) + _SYS_STR("]");
m_vm.m_mainWindow->setTitle(windowTitle.c_str());
m_vm.DismissSplash();
m_vm.FadeInEditors();
@ -87,7 +87,7 @@ bool ProjectManager::openProject(hecl::SystemStringView path)
hecl::ProjectRootPath projPath = hecl::SearchForProject(path, subPath);
if (!projPath)
{
Log.report(logvisor::Warning, _S("project doesn't exist at '%s'"), path.data());
Log.report(logvisor::Warning, _SYS_STR("project doesn't exist at '%s'"), path.data());
return false;
}
@ -98,7 +98,7 @@ bool ProjectManager::openProject(hecl::SystemStringView path)
return false;
}
hecl::ProjectPath urdeSpacesPath(*m_proj, _S(".hecl/urde_spaces.yaml"));
hecl::ProjectPath urdeSpacesPath(*m_proj, _SYS_STR(".hecl/urde_spaces.yaml"));
athena::io::FileReader reader(urdeSpacesPath.getAbsolutePath());
bool needsSave = false;
@ -132,7 +132,7 @@ makeProj:
else
m_vm.SetupEditorView();
bool doRun = hecl::StringUtils::BeginsWith(subPath, _S("out"));
bool doRun = hecl::StringUtils::BeginsWith(subPath, _SYS_STR("out"));
if (doRun)
{
m_mainMP1.emplace(nullptr, nullptr, m_vm.m_mainBooFactory,
@ -145,7 +145,7 @@ makeProj:
{
hecl::SystemString windowTitle(m_proj->getProjectRootPath().getLastComponent());
windowTitle += _S(" - URDE [") + hecl::SystemString(m_vm.platformName()) + _S("]");
windowTitle += _SYS_STR(" - URDE [") + hecl::SystemString(m_vm.platformName()) + _SYS_STR("]");
m_vm.m_mainWindow->setTitle(windowTitle.c_str());
}
m_vm.DismissSplash();
@ -164,7 +164,7 @@ bool ProjectManager::saveProject()
if (!m_proj)
return false;
hecl::ProjectPath oldSpacesPath(*m_proj, _S(".hecl/~urde_spaces.yaml"));
hecl::ProjectPath oldSpacesPath(*m_proj, _SYS_STR(".hecl/~urde_spaces.yaml"));
athena::io::FileWriter writer(oldSpacesPath.getAbsolutePath());
if (!writer.isOpen())
return false;
@ -174,7 +174,7 @@ bool ProjectManager::saveProject()
if (!w.finish(&writer))
return false;
hecl::ProjectPath newSpacesPath(*m_proj, _S(".hecl/urde_spaces.yaml"));
hecl::ProjectPath newSpacesPath(*m_proj, _SYS_STR(".hecl/urde_spaces.yaml"));
hecl::Unlink(newSpacesPath.getAbsolutePath().data());
hecl::Rename(oldSpacesPath.getAbsolutePath().data(),

View File

@ -23,7 +23,7 @@ void ProjectResourceFactoryBase::BeginBackgroundIndex
bool ProjectResourceFactoryBase::SyncCook(const hecl::ProjectPath& working)
{
Log.report(logvisor::Warning, _S("sync-cooking %s"), working.getRelativePath().data());
Log.report(logvisor::Warning, _SYS_STR("sync-cooking %s"), working.getRelativePath().data());
return m_clientProc.syncCook(working, m_cookSpec.get(), hecl::blender::SharedBlenderToken,
false, false);
}
@ -66,7 +66,7 @@ void ProjectResourceFactoryBase::AsyncTask::EnsurePath(const urde::SObjectTag& t
/* Ensure requested resource is on the filesystem */
if (!path.isFileOrGlob())
{
Log.report(logvisor::Error, _S("unable to find resource path '%s'"),
Log.report(logvisor::Error, _SYS_STR("unable to find resource path '%s'"),
path.getRelativePath().data());
m_failed = true;
return;
@ -83,7 +83,7 @@ void ProjectResourceFactoryBase::AsyncTask::EnsurePath(const urde::SObjectTag& t
urde::SObjectTag verifyTag = m_parent.TagFromPath(path, hecl::blender::SharedBlenderToken);
if (verifyTag.type != tag.type)
{
Log.report(logvisor::Error, _S("%s: expected type '%.4s', found '%.4s'"),
Log.report(logvisor::Error, _SYS_STR("%s: expected type '%.4s', found '%.4s'"),
path.getRelativePath().data(),
tag.type.getChars(), verifyTag.type.getChars());
m_failed = true;
@ -114,7 +114,7 @@ void ProjectResourceFactoryBase::AsyncTask::CookComplete()
athena::io::FileReader fr(m_cookedPath.getAbsolutePath(), 32 * 1024, false);
if (fr.hasError())
{
Log.report(logvisor::Error, _S("unable to open cooked resource path '%s'"),
Log.report(logvisor::Error, _SYS_STR("unable to open cooked resource path '%s'"),
m_cookedPath.getAbsolutePath().data());
m_failed = true;
return;
@ -218,7 +218,7 @@ ProjectResourceFactoryBase::PrepForReadSync(const SObjectTag& tag,
/* Ensure requested resource is on the filesystem */
if (!path.isFileOrGlob())
{
Log.report(logvisor::Error, _S("unable to find resource path '%s'"),
Log.report(logvisor::Error, _SYS_STR("unable to find resource path '%s'"),
path.getAbsolutePath().data());
return false;
}
@ -234,7 +234,7 @@ ProjectResourceFactoryBase::PrepForReadSync(const SObjectTag& tag,
urde::SObjectTag verifyTag = TagFromPath(path, hecl::blender::SharedBlenderToken);
if (verifyTag.type != tag.type)
{
Log.report(logvisor::Error, _S("%s: expected type '%.4s', found '%.4s'"),
Log.report(logvisor::Error, _SYS_STR("%s: expected type '%.4s', found '%.4s'"),
path.getRelativePath().data(),
tag.type.getChars(), verifyTag.type.getChars());
return false;
@ -250,7 +250,7 @@ ProjectResourceFactoryBase::PrepForReadSync(const SObjectTag& tag,
/* Do a blocking cook here */
if (!SyncCook(path))
{
Log.report(logvisor::Error, _S("unable to cook resource path '%s'"),
Log.report(logvisor::Error, _SYS_STR("unable to cook resource path '%s'"),
path.getAbsolutePath().data());
return false;
}
@ -261,7 +261,7 @@ ProjectResourceFactoryBase::PrepForReadSync(const SObjectTag& tag,
fr.emplace(cooked.getAbsolutePath(), 32 * 1024, false);
if (fr->hasError())
{
Log.report(logvisor::Error, _S("unable to open cooked resource path '%s'"),
Log.report(logvisor::Error, _SYS_STR("unable to open cooked resource path '%s'"),
cooked.getAbsolutePath().data());
return false;
}
@ -491,7 +491,7 @@ bool ProjectResourceFactoryBase::AsyncPumpTask(ItType& it)
{
if (!static_cast<DataSpec::SpecBase&>(*m_cookSpec).backgroundIndexRunning())
{
Log.report(logvisor::Error, _S("unable to find async load resource (%.4s, %08X)"),
Log.report(logvisor::Error, _SYS_STR("unable to find async load resource (%.4s, %08X)"),
task.x0_tag.type.getChars(), task.x0_tag.id);
it = _RemoveTask(it);
}

View File

@ -44,8 +44,8 @@ void ResourceBrowser::pathButtonActivated(size_t idx)
for (const hecl::SystemString& d : m_comps)
{
if (needSlash)
dir += _S('/');
if (d.compare(_S("/")))
dir += _SYS_STR('/');
if (d.compare(_SYS_STR("/")))
needSlash = true;
dir += d;
if (++i > idx)

View File

@ -76,19 +76,19 @@ void SplashScreen::think()
if (m_newProjBind.m_deferPath.size())
{
Log.report(logvisor::Info, _S("Making project '%s'"), m_newProjBind.m_deferPath.c_str());
Log.report(logvisor::Info, _SYS_STR("Making project '%s'"), m_newProjBind.m_deferPath.c_str());
m_vm.projectManager().newProject(m_newProjBind.m_deferPath);
m_newProjBind.m_deferPath.clear();
}
else if (m_openProjBind.m_deferPath.size())
{
Log.report(logvisor::Info, _S("Opening project '%s'"), m_openProjBind.m_deferPath.c_str());
Log.report(logvisor::Info, _SYS_STR("Opening project '%s'"), m_openProjBind.m_deferPath.c_str());
m_vm.projectManager().openProject(m_openProjBind.m_deferPath);
m_openProjBind.m_deferPath.clear();
}
else if (m_extractProjBind.m_deferPath.size())
{
Log.report(logvisor::Info, _S("Extracting game '%s'"), m_extractProjBind.m_deferPath.c_str());
Log.report(logvisor::Info, _SYS_STR("Extracting game '%s'"), m_extractProjBind.m_deferPath.c_str());
m_vm.projectManager().extractGame(m_extractProjBind.m_deferPath);
m_extractProjBind.m_deferPath.clear();
}

View File

@ -170,7 +170,7 @@ void ViewManager::RootSpaceViewBuilt(specter::View* view)
void ViewManager::ProjectChanged(hecl::Database::Project& proj)
{
CDvdFile::Shutdown();
CDvdFile::Initialize(hecl::ProjectPath(proj.getProjectWorkingPath(), _S("out/files")));
CDvdFile::Initialize(hecl::ProjectPath(proj.getProjectWorkingPath(), _SYS_STR("out/files")));
}
void ViewManager::SetupEditorView()
@ -212,14 +212,14 @@ ViewManager::ViewManager(hecl::Runtime::FileStoreManager& fileMgr, hecl::CVarMan
, m_projManager(*this)
, m_fontCache(fileMgr)
, m_translator(urde::SystemLocaleOrEnglish())
, m_recentProjectsPath(hecl::SysFormat(_S("%s/recent_projects.txt"), fileMgr.getStoreRoot().data()))
, m_recentFilesPath(hecl::SysFormat(_S("%s/recent_files.txt"), fileMgr.getStoreRoot().data()))
, m_recentProjectsPath(hecl::SysFormat(_SYS_STR("%s/recent_projects.txt"), fileMgr.getStoreRoot().data()))
, m_recentFilesPath(hecl::SysFormat(_SYS_STR("%s/recent_files.txt"), fileMgr.getStoreRoot().data()))
{
Space::SpaceMenuNode::InitializeStrings(*this);
char path[2048];
hecl::Sstat theStat;
FILE* fp = hecl::Fopen(m_recentProjectsPath.c_str(), _S("r"), hecl::FileLockType::Read);
FILE* fp = hecl::Fopen(m_recentProjectsPath.c_str(), _SYS_STR("r"), hecl::FileLockType::Read);
if (fp)
{
while (fgets(path, 2048, fp))
@ -233,7 +233,7 @@ ViewManager::ViewManager(hecl::Runtime::FileStoreManager& fileMgr, hecl::CVarMan
fclose(fp);
}
fp = hecl::Fopen(m_recentFilesPath.c_str(), _S("r"), hecl::FileLockType::Read);
fp = hecl::Fopen(m_recentFilesPath.c_str(), _SYS_STR("r"), hecl::FileLockType::Read);
if (fp)
{
while (fgets(path, 2048, fp))
@ -258,7 +258,7 @@ void ViewManager::pushRecentProject(hecl::SystemStringView path)
return;
}
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(), _SYS_STR("w"), hecl::FileLockType::Write);
if (fp)
{
for (hecl::SystemString& pPath : m_recentProjects)
@ -275,7 +275,7 @@ void ViewManager::pushRecentFile(hecl::SystemStringView path)
return;
}
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(), _SYS_STR("w"), hecl::FileLockType::Write);
if (fp)
{
for (hecl::SystemString& pPath : m_recentFiles)
@ -286,7 +286,7 @@ void ViewManager::pushRecentFile(hecl::SystemStringView path)
void ViewManager::init(boo::IApplication* app)
{
m_mainWindow = app->newWindow(_S("URDE"));
m_mainWindow = app->newWindow(_SYS_STR("URDE"));
m_mainWindow->showWindow();
m_mainWindow->setWaitCursor(true);
@ -296,7 +296,7 @@ void ViewManager::init(boo::IApplication* app)
m_pipelineConv = hecl::NewPipelineConverter(m_mainBooFactory);
hecl::conv = m_pipelineConv.get();
m_mainPlatformName = m_mainBooFactory->platformName();
m_mainWindow->setTitle(_S("URDE [") + hecl::SystemString(m_mainPlatformName) + _S("]"));
m_mainWindow->setTitle(_SYS_STR("URDE [") + hecl::SystemString(m_mainPlatformName) + _SYS_STR("]"));
m_mainCommandQueue = m_mainWindow->getCommandQueue();
m_viewResources.init(m_mainBooFactory, &m_fontCache, &m_themeData, pixelFactor);
InitializeIcons(m_viewResources);
@ -316,9 +316,9 @@ void ViewManager::init(boo::IApplication* app)
{
if (m_deferedProject.empty() && hecl::SearchForProject(arg))
m_deferedProject = arg;
if (arg == _S("--no-shader-warmup"))
if (arg == _SYS_STR("--no-shader-warmup"))
m_noShaderWarmup = true;
else if (arg == _S("--no-sound"))
else if (arg == _SYS_STR("--no-sound"))
m_voiceEngine->setVolume(0.f);
}
@ -329,8 +329,8 @@ void ViewManager::init(boo::IApplication* app)
{
hecl::SystemString rootPath(root.getAbsolutePath());
hecl::Sstat theStat;
if (!hecl::Stat((rootPath + _S("/out/files/Metroid1.upak")).c_str(), &theStat) && S_ISREG(theStat.st_mode))
m_deferedProject = rootPath + _S("/out");
if (!hecl::Stat((rootPath + _SYS_STR("/out/files/Metroid1.upak")).c_str(), &theStat) && S_ISREG(theStat.st_mode))
m_deferedProject = rootPath + _SYS_STR("/out");
}
}
}

View File

@ -28,29 +28,29 @@ static hecl::SystemString CPUFeatureString(const zeus::CPUInfo& cpuInf)
auto AddFeature = [&features](const hecl::SystemChar* str)
{
if (!features.empty())
features += _S(", ");
features += _SYS_STR(", ");
features += str;
};
if (cpuInf.AESNI)
AddFeature(_S("AES-NI"));
AddFeature(_SYS_STR("AES-NI"));
if (cpuInf.SSE1)
AddFeature(_S("SSE"));
AddFeature(_SYS_STR("SSE"));
if (cpuInf.SSE2)
AddFeature(_S("SSE2"));
AddFeature(_SYS_STR("SSE2"));
if (cpuInf.SSE3)
AddFeature(_S("SSE3"));
AddFeature(_SYS_STR("SSE3"));
if (cpuInf.SSSE3)
AddFeature(_S("SSSE3"));
AddFeature(_SYS_STR("SSSE3"));
if (cpuInf.SSE4a)
AddFeature(_S("SSE4a"));
AddFeature(_SYS_STR("SSE4a"));
if (cpuInf.SSE41)
AddFeature(_S("SSE4.1"));
AddFeature(_SYS_STR("SSE4.1"));
if (cpuInf.SSE42)
AddFeature(_S("SSE4.2"));
AddFeature(_SYS_STR("SSE4.2"));
if (cpuInf.AVX)
AddFeature(_S("AVX"));
AddFeature(_SYS_STR("AVX"));
if (cpuInf.AVX2)
AddFeature(_S("AVX2"));
AddFeature(_SYS_STR("AVX2"));
return features;
}
@ -64,7 +64,7 @@ struct Application : boo::IApplicationCallback
std::atomic_bool m_running = {true};
Application() :
m_fileMgr(_S("urde")),
m_fileMgr(_SYS_STR("urde")),
m_cvarManager(m_fileMgr),
m_cvarCommons(m_cvarManager)
{
@ -111,7 +111,7 @@ struct Application : boo::IApplicationCallback
createGlobalCVars();
for (const boo::SystemString& arg : app->getArgs())
{
if (arg.find(_S("--verbosity=")) == 0 || arg.find(_S("-v=")) == 0)
if (arg.find(_SYS_STR("--verbosity=")) == 0 || arg.find(_SYS_STR("-v=")) == 0)
{
hecl::SystemUTF8Conv utf8Arg(arg.substr(arg.find_last_of('=') + 1));
hecl::VerbosityLevel = atoi(utf8Arg.c_str());
@ -124,7 +124,7 @@ struct Application : boo::IApplicationCallback
const zeus::CPUInfo& cpuInf = zeus::cpuFeatures();
Log.report(logvisor::Info, "CPU Name: %s", cpuInf.cpuBrand);
Log.report(logvisor::Info, "CPU Vendor: %s", cpuInf.cpuVendor);
Log.report(logvisor::Info, _S("CPU Features: %s"), CPUFeatureString(cpuInf).c_str());
Log.report(logvisor::Info, _SYS_STR("CPU Features: %s"), CPUFeatureString(cpuInf).c_str());
}
std::string getGraphicsApi() const
@ -192,7 +192,7 @@ static void SetupBasics(bool logging)
static bool IsClientLoggingEnabled(int argc, const boo::SystemChar** argv)
{
for (int i = 1; i < argc; ++i)
if (!hecl::StrNCmp(argv[i], _S("-l"), 2))
if (!hecl::StrNCmp(argv[i], _SYS_STR("-l"), 2))
return true;
return false;
}
@ -204,7 +204,7 @@ int wmain(int argc, const boo::SystemChar** argv)
int main(int argc, const boo::SystemChar** argv)
#endif
{
if (argc > 1 && !hecl::StrCmp(argv[1], _S("--dlpackage")))
if (argc > 1 && !hecl::StrCmp(argv[1], _SYS_STR("--dlpackage")))
{
printf("%s\n", URDE_DLPACKAGE);
return 100;
@ -215,16 +215,16 @@ int main(int argc, const boo::SystemChar** argv)
if (hecl::SystemChar* cwd = hecl::Getcwd(CwdBuf, 1024))
{
if (hecl::PathRelative(argv[0]))
ExeDir = hecl::SystemString(cwd) + _S('/');
ExeDir = hecl::SystemString(cwd) + _SYS_STR('/');
hecl::SystemString Argv0(argv[0]);
hecl::SystemString::size_type lastIdx = Argv0.find_last_of(_S("/\\"));
hecl::SystemString::size_type lastIdx = Argv0.find_last_of(_SYS_STR("/\\"));
if (lastIdx != hecl::SystemString::npos)
ExeDir.insert(ExeDir.end(), Argv0.begin(), Argv0.begin() + lastIdx);
}
urde::Application appCb;
int ret = boo::ApplicationRun(boo::IApplication::EPlatformType::Auto,
appCb, _S("urde"), _S("URDE"), argc, argv, appCb.getGraphicsApi(),
appCb, _SYS_STR("urde"), _SYS_STR("URDE"), argc, argv, appCb.getGraphicsApi(),
appCb.getSamples(), appCb.getAnisotropy(), appCb.getDeepColor(), false);
//printf("IM DYING!!\n");
return ret;
@ -240,7 +240,7 @@ int WINAPIV main(Platform::Array<Platform::String^>^ params)
{
SetupBasics(false);
urde::Application appCb;
auto viewProvider = ref new boo::ViewProvider(appCb, _S("urde"), _S("URDE"), _S("urde"), params, false);
auto viewProvider = ref new boo::ViewProvider(appCb, _SYS_STR("urde"), _SYS_STR("URDE"), _SYS_STR("urde"), params, false);
CoreApplication::Run(viewProvider);
return 0;
}

View File

@ -48,7 +48,7 @@ void CGameAllocator::Free(u8* ptr)
SChunkDescription* info = reinterpret_cast<SChunkDescription*>(ptr - sizeof(SChunkDescription));
if (info->magic != 0xE8E8E8E8 || info->sentinal != 0xEFEFEFEF)
{
AllocLog.report(logvisor::Fatal, _S("Invalid chunk description, memory corruption!"));
AllocLog.report(logvisor::Fatal, _SYS_STR("Invalid chunk description, memory corruption!"));
return;
}

View File

@ -24,11 +24,11 @@ kabufuda::SystemString CMemoryCardSys::ResolveDolphinCardPath(kabufuda::ECardSlo
/* Check our registry keys */
HKEY hkey;
kabufuda::SystemChar configPath[MAX_PATH] = {0};
if (RegOpenKeyEx(HKEY_CURRENT_USER, _S("Software\\Dolphin Emulator"), 0, KEY_QUERY_VALUE,
if (RegOpenKeyEx(HKEY_CURRENT_USER, _SYS_STR("Software\\Dolphin Emulator"), 0, KEY_QUERY_VALUE,
&hkey) == ERROR_SUCCESS)
{
DWORD size = MAX_PATH;
if (RegQueryValueEx(hkey, _S("UserConfigPath"), nullptr, nullptr, (LPBYTE)configPath,
if (RegQueryValueEx(hkey, _SYS_STR("UserConfigPath"), nullptr, nullptr, (LPBYTE)configPath,
&size) != ERROR_SUCCESS)
configPath[0] = 0;
RegCloseKey(hkey);
@ -43,7 +43,7 @@ kabufuda::SystemString CMemoryCardSys::ResolveDolphinCardPath(kabufuda::ECardSlo
if (configPath[0]) /* Case 1 */
path = configPath;
else if (my_documents_found) /* Case 2 */
path = kabufuda::SystemString(my_documents) + _S("/Dolphin Emulator");
path = kabufuda::SystemString(my_documents) + _SYS_STR("/Dolphin Emulator");
else /* Unable to find */
return {};
#else
@ -51,8 +51,8 @@ kabufuda::SystemString CMemoryCardSys::ResolveDolphinCardPath(kabufuda::ECardSlo
kabufuda::SystemString path(localFolder->Path->Data());
#endif
path += hecl::SysFormat(_S("/GC/MemoryCard%c.USA.raw"),
slot == kabufuda::ECardSlot::SlotA ? _S('A') : _S('B'));
path += hecl::SysFormat(_SYS_STR("/GC/MemoryCard%c.USA.raw"),
slot == kabufuda::ECardSlot::SlotA ? _SYS_STR('A') : _SYS_STR('B'));
hecl::Sstat theStat;
if (hecl::Stat(path.c_str(), &theStat) || !S_ISREG(theStat.st_mode))
@ -74,11 +74,11 @@ kabufuda::SystemString CMemoryCardSys::_CreateDolphinCard(kabufuda::ECardSlot sl
/* Check our registry keys */
HKEY hkey;
kabufuda::SystemChar configPath[MAX_PATH] = {0};
if (RegOpenKeyEx(HKEY_CURRENT_USER, _S("Software\\Dolphin Emulator"), 0, KEY_QUERY_VALUE,
if (RegOpenKeyEx(HKEY_CURRENT_USER, _SYS_STR("Software\\Dolphin Emulator"), 0, KEY_QUERY_VALUE,
&hkey) == ERROR_SUCCESS)
{
DWORD size = MAX_PATH;
if (RegQueryValueEx(hkey, _S("UserConfigPath"), nullptr, nullptr, (LPBYTE)configPath,
if (RegQueryValueEx(hkey, _SYS_STR("UserConfigPath"), nullptr, nullptr, (LPBYTE)configPath,
&size) != ERROR_SUCCESS)
configPath[0] = 0;
RegCloseKey(hkey);
@ -93,7 +93,7 @@ kabufuda::SystemString CMemoryCardSys::_CreateDolphinCard(kabufuda::ECardSlot sl
if (configPath[0]) /* Case 1 */
path = configPath;
else if (my_documents_found) /* Case 2 */
path = kabufuda::SystemString(my_documents) + _S("/Dolphin Emulator");
path = kabufuda::SystemString(my_documents) + _SYS_STR("/Dolphin Emulator");
else /* Unable to find */
return {};
#else
@ -101,13 +101,13 @@ kabufuda::SystemString CMemoryCardSys::_CreateDolphinCard(kabufuda::ECardSlot sl
kabufuda::SystemString path(localFolder->Path->Data());
#endif
path += _S("/GC");
path += _SYS_STR("/GC");
if (hecl::RecursiveMakeDir(path.c_str()) < 0)
return {};
path += hecl::SysFormat(_S("/MemoryCard%c.USA.raw"),
slot == kabufuda::ECardSlot::SlotA ? _S('A') : _S('B'));
FILE* fp = hecl::Fopen(path.c_str(), _S("wb"));
path += hecl::SysFormat(_SYS_STR("/MemoryCard%c.USA.raw"),
slot == kabufuda::ECardSlot::SlotA ? _SYS_STR('A') : _SYS_STR('B'));
FILE* fp = hecl::Fopen(path.c_str(), _SYS_STR("wb"));
if (!fp)
return {};
fclose(fp);

View File

@ -30,7 +30,7 @@ CLineRenderer::CLineRenderer(boo::IGraphicsDataFactory::Context& ctx,
{
if (maxVerts < 2)
{
LineRendererLog.report(logvisor::Fatal, _S("maxVerts < 2, maxVerts = %i"), maxVerts);
LineRendererLog.report(logvisor::Fatal, _SYS_STR("maxVerts < 2, maxVerts = %i"), maxVerts);
return;
}
m_textured = texture;
@ -66,7 +66,7 @@ CLineRenderer::CLineRenderer(EPrimitiveMode mode, u32 maxVerts,
{
if (maxVerts < 2)
{
LineRendererLog.report(logvisor::Fatal, _S("maxVerts < 2, maxVerts = %i"), maxVerts);
LineRendererLog.report(logvisor::Fatal, _SYS_STR("maxVerts < 2, maxVerts = %i"), maxVerts);
return;
}
m_textured = texture;

View File

@ -128,11 +128,11 @@ private:
BindingPair BuildBinding(boo::GLDataFactory::Context& ctx, const ShaderPair& pipeline);
#endif
#if _WIN32
static ShaderPair BuildShader(boo::D3DDataFactory::Context& ctx,
static ShaderPair BuildShader(boo::D3D11DataFactory::Context& ctx,
const SFluidPlaneShaderInfo& info);
static ShaderPair BuildShader(boo::D3DDataFactory::Context& ctx,
static ShaderPair BuildShader(boo::D3D11DataFactory::Context& ctx,
const SFluidPlaneDoorShaderInfo& info);
BindingPair BuildBinding(boo::D3DDataFactory::Context& ctx, const ShaderPair& pipeline);
BindingPair BuildBinding(boo::D3D11DataFactory::Context& ctx, const ShaderPair& pipeline);
#endif
#if BOO_HAS_METAL
static ShaderPair BuildShader(boo::MetalDataFactory::Context& ctx,

View File

@ -204,7 +204,7 @@ CModelShaders::ShaderPipelines CModelShaders::BuildExtendedShader(const hecl::Ba
return search->second;
ShaderPipelines& newPipelines = g_ShaderPipelines[tag.val64()];
newPipelines = std::make_shared<ShaderPipelinesData>();
int idx = 0;
size_t idx = 0;
for (const auto& ext : g_ExtensionSlots)
(*newPipelines)[idx++] = hecl::conv->convert(hecl::HECLIR(ir, tag, ext));
return newPipelines;

View File

@ -6,6 +6,7 @@
#include "zeus/CVector3f.hpp"
#include "zeus/CColor.hpp"
#include "Graphics/CGraphics.hpp"
#include <array>
#define URDE_MAX_LIGHTS 8

View File

@ -896,7 +896,7 @@ boo::IWindow* CMain::GetMainWindow() const
int CMain::appMain(boo::IApplication* app)
{
zeus::detectCPU();
mainWindow = app->newWindow(_S("Metroid Prime 1 Reimplementation vZygote"), 1);
mainWindow = app->newWindow(_SYS_STR("Metroid Prime 1 Reimplementation vZygote"), 1);
mainWindow->showWindow();
TOneStatic<CGameGlobalObjects> globalObjs;
InitializeSubsystems();

View File

@ -63,7 +63,7 @@ public:
PipelineInfo({in.m_additive ? boo::BlendFactor::One : boo::BlendFactor::SrcAlpha,
in.m_additive ? boo::BlendFactor::One : boo::BlendFactor::InvSrcAlpha,
boo::Primitive::TriStrips, boo::ZTest::LEqual, false, true, false,
boo::CullMode::None, tessellation ? 1 : 0}),
boo::CullMode::None, tessellation ? 1u : 0u}),
HasTessellation(tessellation) {}
const boo::VertexFormatInfo VtxFmt;
@ -114,18 +114,6 @@ public:
#define UNIVERSAL_PIPELINES_shader_CFluidPlaneShader \
::Shader_CFluidPlaneShader \
::Shader_CFluidPlaneDoorShader
#define OPENGL_STAGES_shader_CFluidPlaneShader \
STAGE_SPECIALIZATIONS(::StageObject_CFluidPlaneShader, hecl::PlatformType::OpenGL) \
STAGE_SPECIALIZATIONS(::StageObject_CFluidPlaneDoorShader, hecl::PlatformType::OpenGL)
#define VULKAN_STAGES_shader_CFluidPlaneShader \
STAGE_SPECIALIZATIONS(::StageObject_CFluidPlaneShader, hecl::PlatformType::Vulkan) \
STAGE_SPECIALIZATIONS(::StageObject_CFluidPlaneDoorShader, hecl::PlatformType::Vulkan)
#define D3D11_STAGES_shader_CFluidPlaneShader \
STAGE_SPECIALIZATIONS(::StageObject_CFluidPlaneShader, hecl::PlatformType::D3D11) \
STAGE_SPECIALIZATIONS(::StageObject_CFluidPlaneDoorShader, hecl::PlatformType::D3D11)
#define METAL_STAGES_shader_CFluidPlaneShader \
STAGE_SPECIALIZATIONS(::StageObject_CFluidPlaneShader, hecl::PlatformType::Metal) \
STAGE_SPECIALIZATIONS(::StageObject_CFluidPlaneDoorShader, hecl::PlatformType::Metal)
#define NX_STAGES_shader_CFluidPlaneShader \
STAGE_SPECIALIZATIONS(::StageObject_CFluidPlaneShader, hecl::PlatformType::NX) \
STAGE_SPECIALIZATIONS(::StageObject_CFluidPlaneDoorShader, hecl::PlatformType::NX)
#define STAGES_shader_CFluidPlaneShader(P, S) \
::StageObject_CFluidPlaneShader<P, S>, \
::StageObject_CFluidPlaneDoorShader<P, S>,

View File

@ -668,57 +668,21 @@ static std::string _BuildVS(const SFluidPlaneShaderInfo& info, bool tessellation
return ret;
}
template <>
std::string StageObject_CFluidPlaneShader<hecl::PlatformType::OpenGL, hecl::PipelineStage::Vertex>::BuildShader
(const SFluidPlaneShaderInfo& in, bool tessellation)
{
return _BuildVS(in, tessellation);
}
template <>
std::string StageObject_CFluidPlaneShader<hecl::PlatformType::Vulkan, hecl::PipelineStage::Vertex>::BuildShader
(const SFluidPlaneShaderInfo& in, bool tessellation)
{
return _BuildVS(in, tessellation);
}
template <>
std::string StageObject_CFluidPlaneShader<hecl::PlatformType::NX, hecl::PipelineStage::Vertex>::BuildShader
std::string StageObject_CFluidPlaneShader<hecl::PlatformType::D3D11, hecl::PipelineStage::Vertex>::BuildShader
(const SFluidPlaneShaderInfo& in, bool tessellation)
{
return _BuildVS(in, tessellation);
}
template <>
std::string StageObject_CFluidPlaneShader<hecl::PlatformType::OpenGL, hecl::PipelineStage::Fragment>::BuildShader
(const SFluidPlaneShaderInfo& in, bool tessellation)
{
return _BuildFS(in);
}
template <>
std::string StageObject_CFluidPlaneShader<hecl::PlatformType::Vulkan, hecl::PipelineStage::Fragment>::BuildShader
(const SFluidPlaneShaderInfo& in, bool tessellation)
{
return _BuildFS(in);
}
template <>
std::string StageObject_CFluidPlaneShader<hecl::PlatformType::NX, hecl::PipelineStage::Fragment>::BuildShader
std::string StageObject_CFluidPlaneShader<hecl::PlatformType::D3D11, hecl::PipelineStage::Fragment>::BuildShader
(const SFluidPlaneShaderInfo& in, bool tessellation)
{
return _BuildFS(in);
}
template <>
std::string StageObject_CFluidPlaneShader<hecl::PlatformType::OpenGL, hecl::PipelineStage::Control>::BuildShader
(const SFluidPlaneShaderInfo& in, bool tessellation)
{
return TessCS;
}
template <>
std::string StageObject_CFluidPlaneShader<hecl::PlatformType::Vulkan, hecl::PipelineStage::Control>::BuildShader
(const SFluidPlaneShaderInfo& in, bool tessellation)
{
return TessCS;
}
template <>
std::string StageObject_CFluidPlaneShader<hecl::PlatformType::NX, hecl::PipelineStage::Control>::BuildShader
std::string StageObject_CFluidPlaneShader<hecl::PlatformType::D3D11, hecl::PipelineStage::Control>::BuildShader
(const SFluidPlaneShaderInfo& in, bool tessellation)
{
return TessCS;
@ -752,20 +716,75 @@ static std::string BuildES(const SFluidPlaneShaderInfo& info)
return ret;
}
template <>
std::string StageObject_CFluidPlaneShader<hecl::PlatformType::OpenGL, hecl::PipelineStage::Evaluation>::BuildShader
std::string StageObject_CFluidPlaneShader<hecl::PlatformType::D3D11, hecl::PipelineStage::Evaluation>::BuildShader
(const SFluidPlaneShaderInfo& in, bool tessellation)
{
return BuildES(in);
}
static std::string _BuildVS(const SFluidPlaneDoorShaderInfo& info)
{
char *finalVSs;
asprintf(&finalVSs, VS, "");
std::string ret(finalVSs);
free(finalVSs);
return ret;
}
static std::string _BuildFS(const SFluidPlaneDoorShaderInfo& info)
{
int nextTex = 0;
std::string textures;
std::string combiner;
if (info.m_hasPatternTex1)
{
textures += hecl::Format("Texture2D patternTex1 : register(t%d);\n", nextTex++);
}
if (info.m_hasPatternTex2)
{
textures += hecl::Format("Texture2D patternTex2 : register(t%d);\n", nextTex++);
}
if (info.m_hasColorTex)
{
textures += hecl::Format("Texture2D colorTex : register(t%d);\n", nextTex++);
}
// Tex0 * kColor0 * Tex1 + Tex2
if (info.m_hasPatternTex1 && info.m_hasPatternTex2)
{
combiner += " colorOut = patternTex1.Sample(samp, vtf.uvs[0]) * kColor0 *\n"
" patternTex2.Sample(samp, vtf.uvs[1]);\n";
}
else
{
combiner += " colorOut = float4(0.0);\n";
}
if (info.m_hasColorTex)
{
combiner += " colorOut += colorTex.Sample(samp, vtf.uvs[2]);\n";
}
combiner += " colorOut.a = kColor0.a;\n";
char *finalFSs;
asprintf(&finalFSs, FSDoor, textures.c_str(), combiner.c_str());
std::string ret(finalFSs);
free(finalFSs);
return ret;
}
template <>
std::string StageObject_CFluidPlaneShader<hecl::PlatformType::Vulkan, hecl::PipelineStage::Evaluation>::BuildShader
(const SFluidPlaneShaderInfo& in, bool tessellation)
std::string StageObject_CFluidPlaneDoorShader<hecl::PlatformType::D3D11, hecl::PipelineStage::Vertex>::BuildShader
(const SFluidPlaneDoorShaderInfo& in)
{
return BuildES(in);
return _BuildVS(in);
}
template <>
std::string StageObject_CFluidPlaneShader<hecl::PlatformType::NX, hecl::PipelineStage::Evaluation>::BuildShader
(const SFluidPlaneShaderInfo& in, bool tessellation)
std::string StageObject_CFluidPlaneDoorShader<hecl::PlatformType::D3D11, hecl::PipelineStage::Fragment>::BuildShader
(const SFluidPlaneDoorShaderInfo& in)
{
return BuildES(in);
return _BuildFS(in);
}

2
amuse

@ -1 +1 @@
Subproject commit dbd48a39cc4eb746bde103e2721d5054d11c4c30
Subproject commit 885a2d2154a9ddc00b878b9707d8ad01817ea4e7

View File

@ -154,15 +154,15 @@ enum class FileLockType
#if IS_UCS2
typedef wchar_t SystemChar;
typedef std::wstring SystemString;
#ifndef _S
#define _S(val) L##val
#ifndef _SYS_STR
#define _SYS_STR(val) L##val
#endif
typedef struct _stat Sstat;
#else
typedef char SystemChar;
typedef std::string SystemString;
#ifndef _S
#define _S(val) val
#ifndef _SYS_STR
#define _SYS_STR(val) val
#endif
typedef struct stat Sstat;
#endif
@ -205,7 +205,7 @@ int main(int argc, const char* argv[])
logvisor::RegisterConsoleLogger();
if (argc < 3)
{
Log.report(logvisor::Error, _S("Usage: %s <input> <output>"), argv[0]);
Log.report(logvisor::Error, _SYS_STR("Usage: %s <input> <output>"), argv[0]);
return 1;
}
@ -214,20 +214,20 @@ int main(int argc, const char* argv[])
tinyxml2::XMLDocument doc;
std::vector<SAsset> assets;
FILE* docF = Fopen(inPath.c_str(), _S("rb"));
FILE* docF = Fopen(inPath.c_str(), _SYS_STR("rb"));
if (!doc.LoadFile(docF))
{
const tinyxml2::XMLElement* elm = doc.RootElement();
if (strcmp(elm->Name(), "AssetNameMap"))
{
Log.report(logvisor::Fatal, _S("Invalid database supplied"));
Log.report(logvisor::Fatal, _SYS_STR("Invalid database supplied"));
return 1;
}
elm = elm->FirstChildElement("AssetNameMap");
if (elm == nullptr)
{
Log.report(logvisor::Fatal, _S("Malformed AssetName database"));
Log.report(logvisor::Fatal, _SYS_STR("Malformed AssetName database"));
return 1;
}
@ -240,7 +240,7 @@ int main(int argc, const char* argv[])
if (!keyElm || !valueElm)
{
Log.report(logvisor::Fatal, _S("Malformed Asset entry, [Key,Value] required"));
Log.report(logvisor::Fatal, _SYS_STR("Malformed Asset entry, [Key,Value] required"));
return 0;
}
@ -250,7 +250,7 @@ int main(int argc, const char* argv[])
if (!nameElm || !dirElm || ! typeElm)
{
Log.report(logvisor::Fatal, _S("Malformed Value entry, [Name,Directory,Type] required"));
Log.report(logvisor::Fatal, _SYS_STR("Malformed Value entry, [Name,Directory,Type] required"));
return 0;
}
assets.emplace_back();
@ -262,10 +262,10 @@ int main(int argc, const char* argv[])
elm = elm->NextSiblingElement("Asset");
}
FILE* f = Fopen(outPath.c_str(), _S("wb"));
FILE* f = Fopen(outPath.c_str(), _SYS_STR("wb"));
if (!f)
{
Log.report(logvisor::Fatal, _S("Unable to open destination"));
Log.report(logvisor::Fatal, _SYS_STR("Unable to open destination"));
return 0;
}
@ -294,6 +294,6 @@ int main(int argc, const char* argv[])
if (docF)
fclose(docF);
Log.report(logvisor::Fatal, _S("failed to load"));
Log.report(logvisor::Fatal, _SYS_STR("failed to load"));
return 1;
}

7
gmm/gmm_arch_config.h Normal file
View File

@ -0,0 +1,7 @@
# ifndef _SRC_GMM_GMM_ARCH_CONFIG_H
#define _SRC_GMM_GMM_ARCH_CONFIG_H 1
// enable the following line for OpenMP support
// #define GMM_HAVE_OPENMP
//
/* once: _SRC_GMM_GMM_ARCH_CONFIG_H */
#endif

View File

@ -651,6 +651,38 @@ namespace gmm {
return res;
}
/** 1-distance between two vectors */
template <typename V1, typename V2> inline
typename number_traits<typename linalg_traits<V1>::value_type>
::magnitude_type
vect_dist1(const V1 &v1, const V2 &v2) { // not fully optimized
typedef typename linalg_traits<V1>::value_type T;
typedef typename number_traits<T>::magnitude_type R;
auto it1 = vect_const_begin(v1), ite1 = vect_const_end(v1);
auto it2 = vect_const_begin(v2), ite2 = vect_const_end(v2);
size_type k1(0), k2(0);
R res(0);
while (it1 != ite1 && it2 != ite2) {
size_type i1 = index_of_it(it1, k1,
typename linalg_traits<V1>::storage_type());
size_type i2 = index_of_it(it2, k2,
typename linalg_traits<V2>::storage_type());
if (i1 == i2) {
res += gmm::abs(*it2 - *it1); ++it1; ++k1; ++it2; ++k2;
}
else if (i1 < i2) {
res += gmm::abs(*it1); ++it1; ++k1;
}
else {
res += gmm::abs(*it2); ++it2; ++k2;
}
}
while (it1 != ite1) { res += gmm::abs(*it1); ++it1; }
while (it2 != ite2) { res += gmm::abs(*it2); ++it2; }
return res;
}
/* ******************************************************************** */
/* vector Infinity norm */
/* ******************************************************************** */
@ -666,6 +698,38 @@ namespace gmm {
return res;
}
/** Infinity distance between two vectors */
template <typename V1, typename V2> inline
typename number_traits<typename linalg_traits<V1>::value_type>
::magnitude_type
vect_distinf(const V1 &v1, const V2 &v2) { // not fully optimized
typedef typename linalg_traits<V1>::value_type T;
typedef typename number_traits<T>::magnitude_type R;
auto it1 = vect_const_begin(v1), ite1 = vect_const_end(v1);
auto it2 = vect_const_begin(v2), ite2 = vect_const_end(v2);
size_type k1(0), k2(0);
R res(0);
while (it1 != ite1 && it2 != ite2) {
size_type i1 = index_of_it(it1, k1,
typename linalg_traits<V1>::storage_type());
size_type i2 = index_of_it(it2, k2,
typename linalg_traits<V2>::storage_type());
if (i1 == i2) {
res = std::max(res, gmm::abs(*it2 - *it1)); ++it1; ++k1; ++it2; ++k2;
}
else if (i1 < i2) {
res = std::max(res, gmm::abs(*it1)); ++it1; ++k1;
}
else {
res = std::max(res, gmm::abs(*it2)); ++it2; ++k2;
}
}
while (it1 != ite1) { res = std::max(res, gmm::abs(*it1)); ++it1; }
while (it2 != ite2) { res = std::max(res, gmm::abs(*it2)); ++it2; }
return res;
}
/* ******************************************************************** */
/* matrix norm1 */
/* ******************************************************************** */

View File

@ -151,13 +151,13 @@ namespace gmm {
/* BLAS functions used. */
/* ********************************************************************* */
extern "C" {
void daxpy_(const int *n, const double *alpha, const double *x,
const int *incx, double *y, const int *incy);
void dgemm_(const char *tA, const char *tB, const int *m,
const int *n, const int *k, const double *alpha,
const double *A, const int *ldA, const double *B,
const int *ldB, const double *beta, double *C,
const int *ldC);
void daxpy_(const long *n, const double *alpha, const double *x,
const long *incx, double *y, const long *incy);
void dgemm_(const char *tA, const char *tB, const long *m,
const long *n, const long *k, const double *alpha,
const double *A, const long *ldA, const double *B,
const long *ldB, const double *beta, double *C,
const long *ldC);
void sgemm_(...); void cgemm_(...); void zgemm_(...);
void sgemv_(...); void dgemv_(...); void cgemv_(...); void zgemv_(...);
void strsv_(...); void dtrsv_(...); void ctrsv_(...); void ztrsv_(...);
@ -180,7 +180,7 @@ namespace gmm {
inline number_traits<base_type >::magnitude_type \
vect_norm2(param1(base_type)) { \
GMMLAPACK_TRACE("nrm2_interface"); \
int inc(1), n(int(vect_size(x))); trans1(base_type); \
long inc(1), n(long(vect_size(x))); trans1(base_type); \
return blas_name(&n, &x[0], &inc); \
}
@ -200,7 +200,7 @@ namespace gmm {
blas_name, base_type) \
inline base_type vect_sp(param1(base_type), param2(base_type)) { \
GMMLAPACK_TRACE("dot_interface"); \
trans1(base_type); trans2(base_type); int inc(1), n(int(vect_size(y)));\
trans1(base_type); trans2(base_type); long inc(1), n(long(vect_size(y)));\
return mult1 mult2 blas_name(&n, &x[0], &inc, &y[0], &inc); \
}
@ -267,7 +267,7 @@ namespace gmm {
blas_name, base_type) \
inline base_type vect_hp(param1(base_type), param2(base_type)) { \
GMMLAPACK_TRACE("dotc_interface"); \
trans1(base_type); trans2(base_type); int inc(1), n(int(vect_size(y)));\
trans1(base_type); trans2(base_type); long inc(1), n(long(vect_size(y)));\
return mult1 mult2 blas_name(&n, &x[0], &inc, &y[0], &inc); \
}
@ -332,7 +332,7 @@ namespace gmm {
# define axpy_interface(param1, trans1, blas_name, base_type) \
inline void add(param1(base_type), std::vector<base_type > &y) { \
GMMLAPACK_TRACE("axpy_interface"); \
int inc(1), n(int(vect_size(y))); trans1(base_type); \
long inc(1), n(long(vect_size(y))); trans1(base_type); \
if (n == 0) return; \
blas_name(&n, &a, &x[0], &inc, &y[0], &inc); \
}
@ -367,7 +367,7 @@ namespace gmm {
std::vector<base_type > &z, orien) { \
GMMLAPACK_TRACE("gemv_interface"); \
trans1(base_type); trans2(base_type); base_type beta(1); \
int m(int(mat_nrows(A))), lda(m), n(int(mat_ncols(A))), inc(1); \
long m(long(mat_nrows(A))), lda(m), n(long(mat_ncols(A))), inc(1); \
if (m && n) blas_name(&t, &m, &n, &alpha, &A(0,0), &lda, &x[0], &inc, \
&beta, &z[0], &inc); \
else gmm::clear(z); \
@ -489,7 +489,7 @@ namespace gmm {
std::vector<base_type > &z, orien) { \
GMMLAPACK_TRACE("gemv_interface2"); \
trans1(base_type); trans2(base_type); base_type beta(0); \
int m(int(mat_nrows(A))), lda(m), n(int(mat_ncols(A))), inc(1); \
long m(long(mat_nrows(A))), lda(m), n(long(mat_ncols(A))), inc(1); \
if (m && n) \
blas_name(&t, &m, &n, &alpha, &A(0,0), &lda, &x[0], &inc, &beta, \
&z[0], &inc); \
@ -586,8 +586,8 @@ namespace gmm {
const std::vector<base_type > &V, \
const std::vector<base_type > &W) { \
GMMLAPACK_TRACE("ger_interface"); \
int m(int(mat_nrows(A))), lda = m, n(int(mat_ncols(A))); \
int incx = 1, incy = 1; \
long m(long(mat_nrows(A))), lda = m, n(long(mat_ncols(A))); \
long incx = 1, incy = 1; \
base_type alpha(1); \
if (m && n) \
blas_name(&m, &n, &alpha, &V[0], &incx, &W[0], &incy, &A(0,0), &lda);\
@ -604,8 +604,8 @@ namespace gmm {
const std::vector<base_type > &W) { \
GMMLAPACK_TRACE("ger_interface"); \
gemv_trans2_s(base_type); \
int m(int(mat_nrows(A))), lda = m, n(int(mat_ncols(A))); \
int incx = 1, incy = 1; \
long m(long(mat_nrows(A))), lda = m, n(long(mat_ncols(A))); \
long incx = 1, incy = 1; \
if (m && n) \
blas_name(&m, &n, &alpha, &x[0], &incx, &W[0], &incy, &A(0,0), &lda);\
}
@ -621,8 +621,8 @@ namespace gmm {
gemv_p2_s(base_type)) { \
GMMLAPACK_TRACE("ger_interface"); \
gemv_trans2_s(base_type); \
int m(int(mat_nrows(A))), lda = m, n(int(mat_ncols(A))); \
int incx = 1, incy = 1; \
long m(long(mat_nrows(A))), lda = m, n(long(mat_ncols(A))); \
long incx = 1, incy = 1; \
base_type al2 = gmm::conj(alpha); \
if (m && n) \
blas_name(&m, &n, &al2, &V[0], &incx, &x[0], &incy, &A(0,0), &lda); \
@ -643,9 +643,9 @@ namespace gmm {
dense_matrix<base_type > &C, c_mult) { \
GMMLAPACK_TRACE("gemm_interface_nn"); \
const char t = 'N'; \
int m(int(mat_nrows(A))), lda = m, k(int(mat_ncols(A))); \
int n(int(mat_ncols(B))); \
int ldb = k, ldc = m; \
long m(long(mat_nrows(A))), lda = m, k(long(mat_ncols(A))); \
long n(long(mat_ncols(B))); \
long ldb = k, ldc = m; \
base_type alpha(1), beta(0); \
if (m && k && n) \
blas_name(&t, &t, &m, &n, &k, &alpha, \
@ -671,8 +671,8 @@ namespace gmm {
dense_matrix<base_type > &A \
= const_cast<dense_matrix<base_type > &>(*(linalg_origin(A_))); \
const char t = 'T', u = 'N'; \
int m(int(mat_ncols(A))), k(int(mat_nrows(A))), n(int(mat_ncols(B))); \
int lda = k, ldb = k, ldc = m; \
long m(long(mat_ncols(A))), k(long(mat_nrows(A))), n(long(mat_ncols(B))); \
long lda = k, ldb = k, ldc = m; \
base_type alpha(1), beta(0); \
if (m && k && n) \
blas_name(&t, &u, &m, &n, &k, &alpha, \
@ -701,9 +701,9 @@ namespace gmm {
dense_matrix<base_type > &B \
= const_cast<dense_matrix<base_type > &>(*(linalg_origin(B_))); \
const char t = 'N', u = 'T'; \
int m(int(mat_nrows(A))), lda = m, k(int(mat_ncols(A))); \
int n(int(mat_nrows(B))); \
int ldb = n, ldc = m; \
long m(long(mat_nrows(A))), lda = m, k(long(mat_ncols(A))); \
long n(long(mat_nrows(B))); \
long ldb = n, ldc = m; \
base_type alpha(1), beta(0); \
if (m && k && n) \
blas_name(&t, &u, &m, &n, &k, &alpha, \
@ -735,8 +735,8 @@ namespace gmm {
dense_matrix<base_type > &B \
= const_cast<dense_matrix<base_type > &>(*(linalg_origin(B_))); \
const char t = 'T', u = 'T'; \
int m(int(mat_ncols(A))), k(int(mat_nrows(A))), n(int(mat_nrows(B))); \
int lda = k, ldb = n, ldc = m; \
long m(long(mat_ncols(A))), k(long(mat_nrows(A))), n(long(mat_nrows(B))); \
long lda = k, ldb = n, ldc = m; \
base_type alpha(1), beta(0); \
if (m && k && n) \
blas_name(&t, &u, &m, &n, &k, &alpha, \
@ -775,8 +775,8 @@ namespace gmm {
dense_matrix<base_type > &A \
= const_cast<dense_matrix<base_type > &>(*(linalg_origin(A_))); \
const char t = 'C', u = 'N'; \
int m(int(mat_ncols(A))), k(int(mat_nrows(A))), n(int(mat_ncols(B))); \
int lda = k, ldb = k, ldc = m; \
long m(long(mat_ncols(A))), k(long(mat_nrows(A))), n(long(mat_ncols(B))); \
long lda = k, ldb = k, ldc = m; \
base_type alpha(1), beta(0); \
if (m && k && n) \
blas_name(&t, &u, &m, &n, &k, &alpha, \
@ -801,8 +801,8 @@ namespace gmm {
dense_matrix<base_type > &B \
= const_cast<dense_matrix<base_type > &>(*(linalg_origin(B_))); \
const char t = 'N', u = 'C'; \
int m(int(mat_nrows(A))), lda = m, k(int(mat_ncols(A))); \
int n(int(mat_nrows(B))), ldb = n, ldc = m; \
long m(long(mat_nrows(A))), lda = m, k(long(mat_ncols(A))); \
long n(long(mat_nrows(B))), ldb = n, ldc = m; \
base_type alpha(1), beta(0); \
if (m && k && n) \
blas_name(&t, &u, &m, &n, &k, &alpha, \
@ -830,8 +830,8 @@ namespace gmm {
dense_matrix<base_type > &B \
= const_cast<dense_matrix<base_type > &>(*(linalg_origin(B_))); \
const char t = 'C', u = 'C'; \
int m(int(mat_ncols(A))), k(int(mat_nrows(A))), lda = k; \
int n(int(mat_nrows(B))), ldb = n, ldc = m; \
long m(long(mat_ncols(A))), k(long(mat_nrows(A))), lda = k; \
long n(long(mat_nrows(B))), ldb = n, ldc = m; \
base_type alpha(1), beta(0); \
if (m && k && n) \
blas_name(&t, &u, &m, &n, &k, &alpha, \
@ -853,7 +853,7 @@ namespace gmm {
size_type k, bool is_unit) { \
GMMLAPACK_TRACE("trsv_interface"); \
loru; trans1(base_type); char d = is_unit ? 'U' : 'N'; \
int lda(int(mat_nrows(A))), inc(1), n = int(k); \
long lda(long(mat_nrows(A))), inc(1), n = long(k); \
if (lda) blas_name(&l, &t, &d, &n, &A(0,0), &lda, &x[0], &inc); \
}

View File

@ -923,22 +923,21 @@ namespace gmm {
template <typename IT, typename ORG, typename VECT> inline
void set_to_end(IT &, ORG, const VECT *, linalg_const) { }
template <typename IT, typename ORG, typename VECT> inline
void set_to_begin(IT &, ORG, VECT *v, linalg_modifiable)
{ GMM_ASSERT3(!is_sparse(*v), "internal_error"); v = 0; }
{ GMM_ASSERT3(!is_sparse(*v), "internal_error"); (void)v; }
template <typename IT, typename ORG, typename VECT> inline
void set_to_begin(IT &, ORG, const VECT *v, linalg_modifiable)
{ GMM_ASSERT3(!is_sparse(*v), "internal_error"); v = 0; }
{ GMM_ASSERT3(!is_sparse(*v), "internal_error"); (void)v; }
template <typename IT, typename ORG, typename VECT> inline
void set_to_end(IT &, ORG, VECT *v, linalg_modifiable)
{ GMM_ASSERT3(!is_sparse(*v), "internal_error"); v = 0; }
{ GMM_ASSERT3(!is_sparse(*v), "internal_error"); (void)v; }
template <typename IT, typename ORG, typename VECT> inline
void set_to_end(IT &, ORG, const VECT *v, linalg_modifiable)
{ GMM_ASSERT3(!is_sparse(*v), "internal_error"); v = 0; }
{ GMM_ASSERT3(!is_sparse(*v), "internal_error"); (void)v; }
/* ******************************************************************** */
/* General index for certain algorithms. */

View File

@ -70,10 +70,50 @@
#define GMM_DENSE_LU_H
#include "gmm_dense_Householder.h"
#include "gmm_opt.h"
namespace gmm {
/* ********************************************************************** */
/* IPVT structure. */
/* ********************************************************************** */
// For compatibility with lapack version with 64 or 32 bit integer.
// Should be replaced by std::vector<size_type> if 32 bit integer version
// of lapack is not used anymore (and lapack_ipvt_int set to size_type)
// Do not use iterators of this interface container
class lapack_ipvt : public std::vector<size_type> {
bool is_int64;
size_type &operator[](size_type i)
{ return std::vector<size_type>::operator[](i); }
size_type operator[] (size_type i) const
{ return std::vector<size_type>::operator[](i); }
void begin(void) const {}
void begin(void) {}
void end(void) const {}
void end(void) {}
public:
void set_to_int32() { is_int64 = false; }
const size_type *pfirst() const
{ return &(*(std::vector<size_type>::begin())); }
size_type *pfirst() { return &(*(std::vector<size_type>::begin())); }
lapack_ipvt(size_type n) : std::vector<size_type>(n), is_int64(true) {}
size_type get(size_type i) const {
const size_type *p = pfirst();
return is_int64 ? p[i] : size_type(((const int *)(p))[i]);
}
void set(size_type i, size_type val) {
size_type *p = pfirst();
if (is_int64) p[i] = val; else ((int *)(p))[i] = int(val);
}
};
}
#include "gmm_opt.h"
namespace gmm {
/** LU Factorization of a general (dense) matrix (real or complex).
@ -85,24 +125,23 @@ namespace gmm {
The pivot indices in ipvt are indexed starting from 1
so that this is compatible with LAPACK (Fortran).
*/
template <typename DenseMatrix, typename Pvector>
size_type lu_factor(DenseMatrix& A, Pvector& ipvt) {
template <typename DenseMatrix>
size_type lu_factor(DenseMatrix& A, lapack_ipvt& ipvt) {
typedef typename linalg_traits<DenseMatrix>::value_type T;
typedef typename linalg_traits<Pvector>::value_type int_T;
typedef typename number_traits<T>::magnitude_type R;
size_type info(0), i, j, jp, M(mat_nrows(A)), N(mat_ncols(A));
size_type NN = std::min(M, N);
std::vector<T> c(M), r(N);
GMM_ASSERT2(ipvt.size()+1 >= NN, "IPVT too small");
for (i = 0; i+1 < NN; ++i) ipvt[i] = int_T(i);
for (i = 0; i+1 < NN; ++i) ipvt.set(i, i);
if (M || N) {
for (j = 0; j+1 < NN; ++j) {
R max = gmm::abs(A(j,j)); jp = j;
for (i = j+1; i < M; ++i) /* find pivot. */
if (gmm::abs(A(i,j)) > max) { jp = i; max = gmm::abs(A(i,j)); }
ipvt[j] = int_T(jp + 1);
ipvt.set(j, jp + 1);
if (max == R(0)) { info = j + 1; break; }
if (jp != j) for (i = 0; i < N; ++i) std::swap(A(jp, i), A(j, i));
@ -112,7 +151,7 @@ namespace gmm {
rank_one_update(sub_matrix(A, sub_interval(j+1, M-j-1),
sub_interval(j+1, N-j-1)), c, conjugated(r));
}
ipvt[NN-1] = int_T(NN);
ipvt.set(NN-1, NN);
}
return info;
}
@ -126,7 +165,7 @@ namespace gmm {
typedef typename linalg_traits<DenseMatrix>::value_type T;
copy(b, x);
for(size_type i = 0; i < pvector.size(); ++i) {
size_type perm = pvector[i]-1; // permutations stored in 1's offset
size_type perm = pvector.get(i)-1; // permutations stored in 1's offset
if(i != perm) { T aux = x[i]; x[i] = x[perm]; x[perm] = aux; }
}
/* solve Ax = b -> LUx = b -> Ux = L^-1 b. */
@ -138,7 +177,7 @@ namespace gmm {
void lu_solve(const DenseMatrix &A, VectorX &x, const VectorB &b) {
typedef typename linalg_traits<DenseMatrix>::value_type T;
dense_matrix<T> B(mat_nrows(A), mat_ncols(A));
std::vector<int> ipvt(mat_nrows(A));
lapack_ipvt ipvt(mat_nrows(A));
gmm::copy(A, B);
size_type info = lu_factor(B, ipvt);
GMM_ASSERT1(!info, "Singular system, pivot = " << info);
@ -154,10 +193,9 @@ namespace gmm {
lower_tri_solve(transposed(LU), x, false);
upper_tri_solve(transposed(LU), x, true);
for(size_type i = pvector.size(); i > 0; --i) {
size_type perm = pvector[i-1]-1; // permutations stored in 1's offset
size_type perm = pvector.get(i-1)-1; // permutations stored in 1's offset
if(i-1 != perm) { T aux = x[i-1]; x[i-1] = x[perm]; x[perm] = aux; }
}
}
@ -212,7 +250,7 @@ namespace gmm {
typedef typename linalg_traits<DenseMatrix>::value_type T;
DenseMatrix& A = const_cast<DenseMatrix&>(A_);
dense_matrix<T> B(mat_nrows(A), mat_ncols(A));
std::vector<int> ipvt(mat_nrows(A));
lapack_ipvt ipvt(mat_nrows(A));
gmm::copy(A, B);
size_type info = lu_factor(B, ipvt);
if (doassert) GMM_ASSERT1(!info, "Non invertible matrix, pivot = "<<info);
@ -229,7 +267,7 @@ namespace gmm {
for (size_type j = 0; j < std::min(mat_nrows(LU), mat_ncols(LU)); ++j)
det *= LU(j,j);
for(size_type i = 0; i < pvector.size(); ++i)
if (i != size_type(pvector[i]-1)) { det = -det; }
if (i != size_type(pvector.get(i)-1)) { det = -det; }
return det;
}
@ -238,7 +276,7 @@ namespace gmm {
lu_det(const DenseMatrix& A) {
typedef typename linalg_traits<DenseMatrix>::value_type T;
dense_matrix<T> B(mat_nrows(A), mat_ncols(A));
std::vector<int> ipvt(mat_nrows(A));
lapack_ipvt ipvt(mat_nrows(A));
gmm::copy(A, B);
lu_factor(B, ipvt);
return lu_det(B, ipvt);

View File

@ -81,7 +81,7 @@ namespace gmm {
std::vector<size_type> ns(dim), na(dim), nu(dim);
for (size_type i = 0; i < nbpts; ++i) {
for (int k = 0; k < dim; ++k) {
double a = (pts[i][k] - pmin[k]) / msize;
register double a = (pts[i][k] - pmin[k]) / msize;
ns[k] = size_type(a) - 1; na[k] = 0;
pts1[k] = int(a + overlap); pts2[k] = int(ceil(a-1.0-overlap));
}

View File

@ -39,10 +39,12 @@
#ifndef GMM_EXCEPT_H__
#define GMM_EXCEPT_H__
#include <sstream>
#include "gmm_std.h"
#include "gmm_feedback_management.h"
//provides external implementation of gmm_exception and logging.
#ifndef EXTERNAL_EXCEPT_
namespace gmm {
@ -50,17 +52,26 @@ namespace gmm {
/* GetFEM++ generic errors. */
/* *********************************************************************** */
// std logic_error with error level information
class gmm_error: public std::logic_error {
public:
gmm_error(const std::string& what_arg): std::logic_error (what_arg) {}
gmm_error(const std::string& what_arg, int errorLevel = 1):
std::logic_error (what_arg), errorLevel_(errorLevel) {}
int errLevel() {return errorLevel_;}
private:
int errorLevel_;
};
#ifdef GETFEM_HAVE_PRETTY_FUNCTION
# define GMM_PRETTY_FUNCTION __PRETTY_FUNCTION__
#elif _MSC_VER
# define GMM_PRETTY_FUNCTION __FUNCTION__
#else
# define GMM_PRETTY_FUNCTION ""
#endif
// Errors : GMM_THROW should not be used on its own.
// GMM_ASSERT1 : Non-maskable errors. Typically for in/ouput and
// when the test do not significantly reduces the performance.
@ -85,6 +96,16 @@ namespace gmm {
<< errormsg << std::ends; \
throw (type)(msg__.str()); \
}
# define GMM_THROW_AT_LEVEL(errormsg, level) \
{ \
std::stringstream msg; \
msg << "Error in " << __FILE__ << ", line " \
<< __LINE__ << " " << GMM_PRETTY_FUNCTION << ": \n" \
<< errormsg << std::ends; \
throw gmm::gmm_error(msg.str(), level); \
}
#else
#ifndef _MSC_VER
# define abort_no_return() ::abort()
@ -110,41 +131,53 @@ namespace gmm {
std::cerr << msg__.str() << std::endl; \
abort_no_return(); \
}
# define GMM_THROW_AT_LEVEL(errormsg, level) \
{ \
std::stringstream msg__; \
msg__ << "Error in " << __FILE__ << ", line " \
<< __LINE__ << " " << GMM_PRETTY_FUNCTION << ": \n" \
<< errormsg << " at level " << level; \
std::cerr << msg__.str() << std::endl; \
abort_no_return(); \
}
#endif
# define GMM_ASSERT1(test, errormsg) \
{ if (!(test)) GMM_THROW_(gmm::gmm_error, errormsg); }
inline void GMM_THROW() {}
#define GMM_THROW(a, b) { GMM_THROW_(a,b); gmm::GMM_THROW(); }
# define GMM_THROW_DEFAULT(errormsg) GMM_THROW_AT_LEVEL(errormsg, 1)
// This allows not to compile some assertions
#ifndef GMM_ASSERT_LEVEL
#if defined(NDEBUG)
# define GMM_ASSERT_LEVEL 1
#elif defined(DEBUG_MODE)
# define GMM_ASSERT_LEVEL 3
#else
# define GMM_ASSERT_LEVEL 2
#endif
#endif
# define GMM_ASSERT1(test, errormsg) { if (!(test)) GMM_THROW_AT_LEVEL(errormsg, 1); }
#if GMM_ASSERT_LEVEL < 2
# define GMM_ASSERT2(test, errormsg) {}
# define GMM_ASSERT3(test, errormsg) {}
#elif !defined(GMM_FULL_NDEBUG)
# define GMM_ASSERT2(test, errormsg) \
{ if (!(test)) GMM_THROW_(gmm::gmm_error, errormsg); }
# define GMM_ASSERT3(test, errormsg) \
{ if (!(test)) GMM_THROW_(gmm::gmm_error, errormsg); }
#elif GMM_ASSERT_LEVEL < 3
# define GMM_ASSERT2(test, errormsg){ if (!(test)) GMM_THROW_AT_LEVEL(errormsg, 2); }
# define GMM_ASSERT3(test, errormsg){}
#else
# define GMM_ASSERT2(test, errormsg) \
{ if (!(test)) GMM_THROW_(gmm::gmm_error, errormsg); }
# define GMM_ASSERT3(test, errormsg)
# define GMM_ASSERT2(test, errormsg){ if (!(test)) GMM_THROW_AT_LEVEL(errormsg, 2); }
# define GMM_ASSERT3(test, errormsg){ if (!(test)) GMM_THROW_AT_LEVEL(errormsg, 3); }
#endif
/* *********************************************************************** */
/* GetFEM++ warnings. */
/* *********************************************************************** */
// This allows to dynamically hide warnings
struct warning_level {
static int level(int l = -2)
{ static int level_ = 3; return (l != -2) ? (level_ = l) : level_; }
};
inline void set_warning_level(int l) { warning_level::level(std::max(0,l)); }
inline int get_warning_level(void) { return warning_level::level(-2); }
// This allows not to compile some Warnings
#ifndef GMM_WARNING_LEVEL
# define GMM_WARNING_LEVEL 4
@ -160,35 +193,36 @@ namespace gmm {
std::stringstream msg__; \
msg__ << "Level " << level_ << " Warning in " << __FILE__ << ", line " \
<< __LINE__ << ": " << thestr; \
std::cerr << msg__.str() << std::endl; \
gmm::feedback_manager::manage()->send(msg__.str(), gmm::FeedbackType::WARNING, level_); \
}
#define GMM_WARNING0(thestr) GMM_WARNING_MSG(0, thestr)
#if GMM_WARNING_LEVEL > 0
# define GMM_WARNING1(thestr) \
{ if (1 <= gmm::warning_level::level()) GMM_WARNING_MSG(1, thestr) }
{ if (1 <= gmm::feedback_manager::warning_level()) GMM_WARNING_MSG(1, thestr) }
#else
# define GMM_WARNING1(thestr) {}
#endif
#if GMM_WARNING_LEVEL > 1
# define GMM_WARNING2(thestr) \
{ if (2 <= gmm::warning_level::level()) GMM_WARNING_MSG(2, thestr) }
{ if (2 <= gmm::feedback_manager::warning_level()) GMM_WARNING_MSG(2, thestr) }
#else
# define GMM_WARNING2(thestr) {}
#endif
#if GMM_WARNING_LEVEL > 2
# define GMM_WARNING3(thestr) \
{ if (3 <= gmm::warning_level::level()) GMM_WARNING_MSG(3, thestr) }
{ if (3 <= gmm::feedback_manager::warning_level()) GMM_WARNING_MSG(3, thestr) }
#else
# define GMM_WARNING3(thestr) {}
#endif
#if GMM_WARNING_LEVEL > 3
# define GMM_WARNING4(thestr) \
{ if (4 <= gmm::warning_level::level()) GMM_WARNING_MSG(4, thestr) }
{ if (4 <= gmm::feedback_manager::warning_level()) GMM_WARNING_MSG(4, thestr) }
#else
# define GMM_WARNING4(thestr) {}
#endif
@ -197,14 +231,6 @@ namespace gmm {
/* GetFEM++ traces. */
/* *********************************************************************** */
// This allows to dynamically hide traces
struct traces_level {
static int level(int l = -2)
{ static int level_ = 3; return (l != -2) ? (level_ = l) : level_; }
};
inline void set_traces_level(int l) { traces_level::level(std::max(0,l)); }
// This allow not too compile some Warnings
#ifndef GMM_TRACES_LEVEL
# define GMM_TRACES_LEVEL 4
@ -222,90 +248,144 @@ namespace gmm {
std::stringstream msg__; \
msg__ << "Trace " << level_ << " in " << __FILE__ << ", line " \
<< __LINE__ << ": " << thestr; \
std::cout << msg__.str() << std::endl; \
gmm::feedback_manager::send(msg__.str(), gmm::FeedbackType::TRACE, level_); \
} \
}
#define GMM_TRACE_SIMPLE_MSG(level_, thestr) { \
GMM_TRACE_MSG_MPI { \
std::stringstream msg__; \
msg__ << "Trace " << level_ << ": " << thestr; \
gmm::feedback_manager::send(msg__.str(), gmm::FeedbackType::TRACE, level_); \
} \
}
#define GMM_TRACE0(thestr) GMM_TRACE_MSG(0, thestr)
#define GMM_SIMPLE_TRACE0(thestr) GMM_TRACE_MSG_SIMPLE(0, thestr)
#if GMM_TRACES_LEVEL > 0
# define GMM_TRACE1(thestr) \
{ if (1 <= gmm::traces_level::level()) GMM_TRACE_MSG(1, thestr) }
{ if (1 <= gmm::feedback_manager::traces_level()) GMM_TRACE_MSG(1, thestr) }
# define GMM_SIMPLE_TRACE1(thestr) \
{ if (1 <= gmm::feedback_manager::traces_level()) GMM_TRACE_SIMPLE_MSG(1, thestr) }
#else
# define GMM_TRACE1(thestr) {}
# define GMM_SIMPLE_TRACE1(thestr) {}
#endif
#if GMM_TRACES_LEVEL > 1
# define GMM_TRACE2(thestr) \
{ if (2 <= gmm::traces_level::level()) GMM_TRACE_MSG(2, thestr) }
{ if (2 <= gmm::feedback_manager::traces_level()) GMM_TRACE_MSG(2, thestr) }
# define GMM_SIMPLE_TRACE2(thestr) \
{ if (2 <= gmm::feedback_manager::traces_level()) GMM_TRACE_SIMPLE_MSG(2, thestr) }
#else
# define GMM_TRACE2(thestr) {}
# define GMM_SIMPLE_TRACE2(thestr) {}
#endif
#if GMM_TRACES_LEVEL > 2
# define GMM_TRACE3(thestr) \
{ if (3 <= gmm::traces_level::level()) GMM_TRACE_MSG(3, thestr) }
{ if (3 <= gmm::feedback_manager::traces_level()) GMM_TRACE_MSG(3, thestr) }
# define GMM_SIMPLE_TRACE3(thestr) \
{ if (3 <= gmm::feedback_manager::traces_level()) GMM_TRACE_SIMPLE_MSG(3, thestr) }
#else
# define GMM_TRACE3(thestr) {}
# define GMM_SIMPLE_TRACE3(thestr) {}
#endif
#if GMM_TRACES_LEVEL > 3
# define GMM_TRACE4(thestr) \
{ if (4 <= gmm::traces_level::level()) GMM_TRACE_MSG(4, thestr) }
{ if (4 <= gmm::feedback_manager::traces_level()) GMM_TRACE_MSG(4, thestr) }
# define GMM_SIMPLE_TRACE4(thestr) \
{ if (4 <= gmm::feedback_manager::traces_level()) GMM_TRACE_SIMPLE_MSG(4, thestr) }
#else
# define GMM_TRACE4(thestr) {}
# define GMM_SIMPLE_TRACE4(thestr) {}
#endif
/* ********************************************************************* */
/* Definitions for compatibility with old versions. */
/* ********************************************************************* */
#define GMM_STANDARD_CATCH_ERROR catch(std::logic_error e) \
#define GMM_STANDARD_CATCH_ERROR \
catch(gmm::gmm_error e) \
{ \
std::cerr << "============================================\n"; \
std::cerr << "| An error has been detected !!! |\n"; \
std::cerr << "============================================\n"; \
std::cerr << e.what() << std::endl << std::endl; \
exit(1); \
std::stringstream strStream; \
strStream << "============================================\n"; \
strStream << "| A GMM error has been detected !!! |\n"; \
strStream << "============================================\n"; \
strStream << e.what() << std::endl << std::endl; \
gmm::feedback_manager::send(strStream.str(), \
gmm::FeedbackType::ASSERT, e.errLevel()); \
gmm::feedback_manager::terminating_action(); \
} \
catch(const std::runtime_error &e) \
catch(std::logic_error e) \
{ \
std::cerr << "============================================\n"; \
std::cerr << "| An error has been detected !!! |\n"; \
std::cerr << "============================================\n"; \
std::cerr << e.what() << std::endl << std::endl; \
exit(1); \
std::stringstream strStream; \
strStream << "============================================\n"; \
strStream << "| An error has been detected !!! |\n"; \
strStream << "============================================\n"; \
strStream << e.what() << std::endl << std::endl; \
gmm::feedback_manager::send(strStream.str(), \
gmm::FeedbackType::ASSERT, 0); \
gmm::feedback_manager::terminating_action(); \
} \
catch(const std::bad_alloc &) { \
std::cerr << "============================================\n"; \
std::cerr << "| A bad allocation has been detected !!! |\n"; \
std::cerr << "============================================\n"; \
exit(1); \
catch(std::runtime_error e) \
{ \
std::stringstream strStream; \
strStream << "============================================\n"; \
strStream << "| A runtime error has been detected !!! |\n"; \
strStream << "============================================\n"; \
strStream << e.what() << std::endl << std::endl; \
gmm::feedback_manager::send(strStream.str(), \
gmm::FeedbackType::ASSERT, 0); \
gmm::feedback_manager::terminating_action(); \
} \
catch(const std::bad_typeid &) { \
std::cerr << "============================================\n"; \
std::cerr << "| A bad typeid has been detected !!! |\n"; \
std::cerr << "============================================\n"; \
exit(1); \
catch(std::bad_alloc) \
{ \
std::stringstream strStream; \
strStream << "============================================\n"; \
strStream << "| A bad allocation has been detected !!! |\n"; \
strStream << "============================================\n"; \
gmm::feedback_manager::send(strStream.str(), \
gmm::FeedbackType::ASSERT, 0); \
gmm::feedback_manager::terminating_action(); \
} \
catch(const std::bad_exception &) { \
std::cerr << "============================================\n"; \
std::cerr << "| A bad exception has been detected !!! |\n"; \
std::cerr << "============================================\n"; \
exit(1); \
catch(std::bad_typeid) \
{ \
std::stringstream strStream; \
strStream << "============================================\n"; \
strStream << "| A bad typeid has been detected !!! |\n"; \
strStream << "============================================\n"; \
gmm::feedback_manager::send(strStream.str(), \
gmm::FeedbackType::ASSERT, 0); \
gmm::feedback_manager::terminating_action(); \
} \
catch(const std::bad_cast &) { \
std::cerr << "============================================\n"; \
std::cerr << "| A bad cast has been detected !!! |\n"; \
std::cerr << "============================================\n"; \
exit(1); \
catch(std::bad_exception) \
{ \
std::stringstream strStream; \
strStream << "============================================\n"; \
strStream << "| A bad exception has been detected !!! |\n"; \
strStream << "============================================\n"; \
gmm::feedback_manager::send(strStream.str(), \
gmm::FeedbackType::ASSERT, 0); \
gmm::feedback_manager::terminating_action(); \
} \
catch(...) { \
std::cerr << "============================================\n"; \
std::cerr << "| An unknown error has been detected !!! |\n"; \
std::cerr << "============================================\n"; \
exit(1); \
catch(std::bad_cast) \
{ \
std::stringstream strStream; \
strStream << "============================================\n"; \
strStream << "| A bad_cast has been detected !!! |\n"; \
strStream << "============================================\n"; \
gmm::feedback_manager::send(strStream.str(), \
gmm::FeedbackType::ASSERT, 0); \
gmm::feedback_manager::terminating_action(); \
} \
catch(...) \
{ \
std::stringstream strStream; \
strStream << "============================================\n"; \
strStream << "| An unknown error has been detected !!! |\n"; \
strStream << "============================================\n"; \
gmm::feedback_manager::send(strStream.str(), \
gmm::FeedbackType::ASSERT, 0); \
gmm::feedback_manager::terminating_action(); \
}
// catch(ios_base::failure) {
// std::cerr << "============================================\n";
@ -321,8 +401,6 @@ namespace gmm {
# define GMM_SET_EXCEPTION_DEBUG
#endif
}
#else
#include <external_except.h>
#endif /* EXTERNAL_EXCEPT_*/
} // namespace gmm
#endif /* GMM_EXCEPT_H__ */

View File

@ -0,0 +1,174 @@
/* -*- c++ -*- (enables emacs c++ mode) */
/*===========================================================================
Copyright (C) 2002-2017 Yves Renard
This file is a part of GetFEM++
GetFEM++ is free software; you can redistribute it and/or modify it
under the terms of the GNU Lesser General Public License as published
by the Free Software Foundation; either version 3 of the License, or
(at your option) any later version along with the GCC Runtime Library
Exception either version 3.1 or (at your option) any later version.
This program is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
License and GCC Runtime Library Exception for more details.
You should have received a copy of the GNU Lesser General Public License
along with this program; if not, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
As a special exception, you may use this file as it is a part of a free
software library without restriction. Specifically, if other files
instantiate templates or use macros or inline functions from this file,
or you compile this file and link it with other files to produce an
executable, this file does not by itself cause the resulting executable
to be covered by the GNU Lesser General Public License. This exception
does not however invalidate any other reasons why the executable file
might be covered by the GNU Lesser General Public License.
===========================================================================*/
/** @file gmm_feedback_management.h
@date July 03, 2017.
@brief Support for run time management of trace, warning and assert
feedback.
*/
#ifndef GMM_FEEDBACK_MANAGEMENT_H__
#define GMM_FEEDBACK_MANAGEMENT_H__
#include <iostream>
#include <string>
#include <memory>
namespace gmm {
/* *********************************************************************** */
/* GetFEM++ warnings. */
/* *********************************************************************** */
// This allows to dynamically hide warnings
struct warning_level {
static int level(int l = -2)
{ static int level_ = 3; return (l != -2) ? (level_ = l) : level_; }
};
inline void set_warning_level(int l) { warning_level::level(l>0 ? l : 0); }
inline int get_warning_level(void) { return warning_level::level(-2); }
/* *********************************************************************** */
/* GetFEM++ traces. */
/* *********************************************************************** */
// This allows to dynamically hide traces
struct traces_level {
static int level(int l = -2)
{ static int level_ = 3; return (l != -2) ? (level_ = l) : level_; }
};
inline void set_traces_level(int l) { traces_level::level(l>0 ? l : 0); }
inline int get_traces_level(void) { return traces_level::level(); }
/* *********************************************************************** */
/* GetFEM++ feedback management */
/* *********************************************************************** */
enum class FeedbackType {
TRACE = 0,
WARNING,
ASSERT
};
// Abstract class providing feedback management interface.
// The interface consist of three functions:
// * for sending feedback message
// * for getting traces level
// * for getting warning level
// * for action to be done after feedback is handled
struct base_feedback_handler {
virtual ~base_feedback_handler() = default;
virtual void send(const std::string &message, FeedbackType messageType, size_t level) = 0;
virtual size_t traces_level() { return get_traces_level(); }
virtual size_t warning_level() { return get_warning_level(); }
virtual void terminating_action() = 0;
};
// Provides the default implementation of feedback handling.
struct default_feedback_handler final : public base_feedback_handler {
void send(const std::string &message, FeedbackType, size_t) override {
std::cerr << message << std::endl;
}
void terminating_action() override {
std::exit(1);
}
};
// This class acts as a run-time dispatcher for sending feedback
// messages and getting trace and warning levels.
class feedback_manager {
public:
// Management actions
enum Action {
SET, // Sets the feedback handler, releasing the one previously set.
GET, // Returns currently managed handler (it is still managed).
REPLACE, // Replace manager with a new one, stop managing the old one
// and returns it unmanaged to the caller. The caller is
// then responsible for managing the memory of the handler.
};
// Steals the pointer to a messenger object that provides
// feedback handling implementation.
//
// Example:
// feedback_manager::manage(new default_feedback_handler);
//
static base_feedback_handler* manage(enum Action action=GET, base_feedback_handler *pHandler=nullptr);
static void send(const std::string &message, FeedbackType type, size_t level);
static size_t traces_level();
static size_t warning_level();
// Action to be taken when feedback handling is done
static void terminating_action();
};
// Depending on action either gets, sets or replaces feedback handler. Setting handler to null resets
// it to gmm::default_feedback_handler.
inline base_feedback_handler* feedback_manager::manage(enum Action action, base_feedback_handler *pHandler) {
static std::unique_ptr<base_feedback_handler> pHandler_ =
std::move(std::unique_ptr<base_feedback_handler>(new default_feedback_handler));
base_feedback_handler *rethandler = nullptr;
switch(action) {
case SET:
pHandler_.reset(pHandler != nullptr ? pHandler : new default_feedback_handler);
rethandler = pHandler_.get();
break;
case GET:
rethandler = pHandler_.get();
break;
case REPLACE:
rethandler = pHandler_.release();
pHandler_.reset(pHandler != nullptr ? pHandler : new default_feedback_handler);
break;
}
return rethandler;
}
inline void feedback_manager::send(const std::string &message, FeedbackType type, size_t level) {
feedback_manager::manage()->send(message, type, level);
}
inline void feedback_manager::terminating_action() {
feedback_manager::manage()->terminating_action();
}
inline size_t feedback_manager::traces_level() {
return feedback_manager::manage()->traces_level();
}
inline size_t feedback_manager::warning_level() {
return feedback_manager::manage()->warning_level();
}
} // namespace gmm
#endif /* GMM_FEEDBACK_MANAGEMENT_H__ */

View File

@ -47,18 +47,18 @@
namespace gmm {
/* ********************************************************************* */
/* ********************************************************************** */
/* Operations interfaced for T = float, double, std::complex<float> */
/* or std::complex<double> : */
/* */
/* lu_factor(dense_matrix<T>, std::vector<int>) */
/* lu_factor(dense_matrix<T>, std::vector<long>) */
/* lu_solve(dense_matrix<T>, std::vector<T>, std::vector<T>) */
/* lu_solve(dense_matrix<T>, std::vector<int>, std::vector<T>, */
/* lu_solve(dense_matrix<T>, std::vector<long>, std::vector<T>, */
/* std::vector<T>) */
/* lu_solve_transposed(dense_matrix<T>, std::vector<int>, std::vector<T>,*/
/* lu_solve_transposed(dense_matrix<T>, std::vector<long>, std::vector<T>,*/
/* std::vector<T>) */
/* lu_inverse(dense_matrix<T>) */
/* lu_inverse(dense_matrix<T>, std::vector<int>, dense_matrix<T>) */
/* lu_inverse(dense_matrix<T>, std::vector<long>, dense_matrix<T>) */
/* */
/* qr_factor(dense_matrix<T>, dense_matrix<T>, dense_matrix<T>) */
/* */
@ -78,11 +78,11 @@ namespace gmm {
/* svd(dense_matrix<T>, dense_matrix<T>, dense_matrix<T>, */
/* std::vector<std::complex<T> >) */
/* */
/* ********************************************************************* */
/* ********************************************************************** */
/* ********************************************************************* */
/* ********************************************************************** */
/* LAPACK functions used. */
/* ********************************************************************* */
/* ********************************************************************** */
extern "C" {
void sgetrf_(...); void dgetrf_(...); void cgetrf_(...); void zgetrf_(...);
@ -97,16 +97,19 @@ namespace gmm {
void sgesvd_(...); void dgesvd_(...); void cgesvd_(...); void zgesvd_(...);
}
/* ********************************************************************* */
/* ********************************************************************** */
/* LU decomposition. */
/* ********************************************************************* */
/* ********************************************************************** */
# define getrf_interface(lapack_name, base_type) inline \
size_type lu_factor(dense_matrix<base_type > &A, std::vector<int> &ipvt){\
size_type lu_factor(dense_matrix<base_type > &A, lapack_ipvt &ipvt){ \
GMMLAPACK_TRACE("getrf_interface"); \
int m = int(mat_nrows(A)), n = int(mat_ncols(A)), lda(m), info(0); \
if (m && n) lapack_name(&m, &n, &A(0,0), &lda, &ipvt[0], &info); \
return size_type(info); \
long m = long(mat_nrows(A)), n = long(mat_ncols(A)), lda(m), info(-1L); \
if (m && n) lapack_name(&m, &n, &A(0,0), &lda, ipvt.pfirst(), &info); \
if ((info & 0xFFFFFFFF00000000L) && !(info & 0x00000000FFFFFFFFL)) \
/* For compatibility with lapack version with 32 bit integer. */ \
ipvt.set_to_int32(); \
return size_type(int(info & 0x00000000FFFFFFFFL)); \
}
getrf_interface(sgetrf_, BLAS_S)
@ -120,13 +123,13 @@ namespace gmm {
# define getrs_interface(f_name, trans1, lapack_name, base_type) inline \
void f_name(const dense_matrix<base_type > &A, \
const std::vector<int> &ipvt, std::vector<base_type > &x, \
const lapack_ipvt &ipvt, std::vector<base_type > &x, \
const std::vector<base_type > &b) { \
GMMLAPACK_TRACE("getrs_interface"); \
int n = int(mat_nrows(A)), info, nrhs(1); \
long n = long(mat_nrows(A)), info(0), nrhs(1); \
gmm::copy(b, x); trans1; \
if (n) \
lapack_name(&t, &n, &nrhs, &(A(0,0)),&n,&ipvt[0], &x[0], &n, &info); \
lapack_name(&t,&n,&nrhs,&(A(0,0)),&n,ipvt.pfirst(),&x[0],&n,&info); \
}
# define getrs_trans_n const char t = 'N'
@ -147,14 +150,17 @@ namespace gmm {
# define getri_interface(lapack_name, base_type) inline \
void lu_inverse(const dense_matrix<base_type > &LU, \
std::vector<int> &ipvt, const dense_matrix<base_type > &A_) { \
const lapack_ipvt &ipvt, const dense_matrix<base_type > &A_) { \
GMMLAPACK_TRACE("getri_interface"); \
dense_matrix<base_type> &A \
= const_cast<dense_matrix<base_type > &>(A_); \
int n = int(mat_nrows(A)), info, lwork(10000); base_type work[10000]; \
dense_matrix<base_type >& \
A = const_cast<dense_matrix<base_type > &>(A_); \
long n = int(mat_nrows(A)), info(0), lwork(-1); base_type work1; \
if (n) { \
std::copy(LU.begin(), LU.end(), A.begin()); \
lapack_name(&n, &A(0,0), &n, &ipvt[0], &work[0], &lwork, &info); \
gmm::copy(LU, A); \
lapack_name(&n, &A(0,0), &n, ipvt.pfirst(), &work1, &lwork, &info); \
lwork = int(gmm::real(work1)); \
std::vector<base_type > work(lwork); \
lapack_name(&n, &A(0,0), &n, ipvt.pfirst(), &work[0], &lwork,&info); \
} \
}
@ -163,20 +169,19 @@ namespace gmm {
getri_interface(cgetri_, BLAS_C)
getri_interface(zgetri_, BLAS_Z)
/* ********************************************************************* */
/* ********************************************************************** */
/* QR factorization. */
/* ********************************************************************* */
/* ********************************************************************** */
# define geqrf_interface(lapack_name1, base_type) inline \
void qr_factor(dense_matrix<base_type > &A){ \
GMMLAPACK_TRACE("geqrf_interface"); \
int m = int(mat_nrows(A)), n = int(mat_ncols(A)), info, lwork(-1); \
long m = long(mat_nrows(A)), n=long(mat_ncols(A)), info(0), lwork(-1); \
base_type work1; \
if (m && n) { \
std::vector<base_type > tau(n); \
lapack_name1(&m, &n, &A(0,0), &m, &tau[0], &work1 , &lwork, &info); \
lwork = int(gmm::real(work1)); \
lwork = long(gmm::real(work1)); \
std::vector<base_type > work(lwork); \
lapack_name1(&m, &n, &A(0,0), &m, &tau[0], &work[0], &lwork, &info); \
GMM_ASSERT1(!info, "QR factorization failed"); \
@ -194,19 +199,19 @@ namespace gmm {
void qr_factor(const dense_matrix<base_type > &A, \
dense_matrix<base_type > &Q, dense_matrix<base_type > &R) { \
GMMLAPACK_TRACE("geqrf_interface2"); \
int m = int(mat_nrows(A)), n = int(mat_ncols(A)), info, lwork(-1); \
long m = long(mat_nrows(A)), n=long(mat_ncols(A)), info(0), lwork(-1); \
base_type work1; \
if (m && n) { \
std::copy(A.begin(), A.end(), Q.begin()); \
std::vector<base_type > tau(n); \
lapack_name1(&m, &n, &Q(0,0), &m, &tau[0], &work1 , &lwork, &info); \
lwork = int(gmm::real(work1)); \
lwork = long(gmm::real(work1)); \
std::vector<base_type > work(lwork); \
lapack_name1(&m, &n, &Q(0,0), &m, &tau[0], &work[0], &lwork, &info); \
GMM_ASSERT1(!info, "QR factorization failed"); \
base_type *p = &R(0,0), *q = &Q(0,0); \
for (int j = 0; j < n; ++j, q += m-n) \
for (int i = 0; i < n; ++i, ++p, ++q) \
for (long j = 0; j < n; ++j, q += m-n) \
for (long i = 0; i < n; ++i, ++p, ++q) \
*p = (j < i) ? base_type(0) : *q; \
lapack_name2(&m, &n, &n, &Q(0,0), &m,&tau[0],&work[0],&lwork,&info); \
} \
@ -218,9 +223,9 @@ namespace gmm {
geqrf_interface2(cgeqrf_, cungqr_, BLAS_C)
geqrf_interface2(zgeqrf_, zungqr_, BLAS_Z)
/* ********************************************************************* */
/* ********************************************************************** */
/* QR algorithm for eigenvalues search. */
/* ********************************************************************* */
/* ********************************************************************** */
# define gees_interface(lapack_name, base_type) \
template <typename VECT> inline void implicit_qr_algorithm( \
@ -229,14 +234,14 @@ namespace gmm {
double tol=gmm::default_tol(base_type()), bool compvect = true) { \
GMMLAPACK_TRACE("gees_interface"); \
typedef bool (*L_fp)(...); L_fp p = 0; \
int n = int(mat_nrows(A)), info, lwork(-1), sdim; base_type work1; \
long n=long(mat_nrows(A)), info(0), lwork(-1), sdim; base_type work1; \
if (!n) return; \
dense_matrix<base_type > H(n,n); gmm::copy(A, H); \
char jobvs = (compvect ? 'V' : 'N'), sort = 'N'; \
std::vector<double> rwork(n), eigv1(n), eigv2(n); \
lapack_name(&jobvs, &sort, p, &n, &H(0,0), &n, &sdim, &eigv1[0], \
&eigv2[0], &Q(0,0), &n, &work1, &lwork, &rwork[0], &info); \
lwork = int(gmm::real(work1)); \
lwork = long(gmm::real(work1)); \
std::vector<base_type > work(lwork); \
lapack_name(&jobvs, &sort, p, &n, &H(0,0), &n, &sdim, &eigv1[0], \
&eigv2[0], &Q(0,0), &n, &work[0], &lwork, &rwork[0],&info);\
@ -251,14 +256,14 @@ namespace gmm {
double tol=gmm::default_tol(base_type()), bool compvect = true) { \
GMMLAPACK_TRACE("gees_interface2"); \
typedef bool (*L_fp)(...); L_fp p = 0; \
int n = int(mat_nrows(A)), info, lwork(-1), sdim; base_type work1; \
long n=long(mat_nrows(A)), info(0), lwork(-1), sdim; base_type work1; \
if (!n) return; \
dense_matrix<base_type > H(n,n); gmm::copy(A, H); \
char jobvs = (compvect ? 'V' : 'N'), sort = 'N'; \
std::vector<double> rwork(n), eigvv(n*2); \
lapack_name(&jobvs, &sort, p, &n, &H(0,0), &n, &sdim, &eigvv[0], \
&Q(0,0), &n, &work1, &lwork, &rwork[0], &rwork[0], &info); \
lwork = int(gmm::real(work1)); \
lwork = long(gmm::real(work1)); \
std::vector<base_type > work(lwork); \
lapack_name(&jobvs, &sort, p, &n, &H(0,0), &n, &sdim, &eigvv[0], \
&Q(0,0), &n, &work[0], &lwork, &rwork[0], &rwork[0],&info);\
@ -280,14 +285,14 @@ namespace gmm {
const dense_matrix<base_type > &A, const VECT &eigval_, \
dense_matrix<base_type > &Q) { \
GMMLAPACK_TRACE("geev_interface"); \
int n = int(mat_nrows(A)), info, lwork(-1); base_type work1; \
long n = long(mat_nrows(A)), info(0), lwork(-1); base_type work1; \
if (!n) return; \
dense_matrix<base_type > H(n,n); gmm::copy(A, H); \
jobv_ ## side \
std::vector<base_type > eigvr(n), eigvi(n); \
lapack_name(&jobvl, &jobvr, &n, &H(0,0), &n, &eigvr[0], &eigvi[0], \
&Q(0,0), &n, &Q(0,0), &n, &work1, &lwork, &info); \
lwork = int(gmm::real(work1)); \
lwork = long(gmm::real(work1)); \
std::vector<base_type > work(lwork); \
lapack_name(&jobvl, &jobvr, &n, &H(0,0), &n, &eigvr[0], &eigvi[0], \
&Q(0,0), &n, &Q(0,0), &n, &work[0], &lwork, &info); \
@ -301,7 +306,7 @@ namespace gmm {
const dense_matrix<base_type > &A, const VECT &eigval_, \
dense_matrix<base_type > &Q) { \
GMMLAPACK_TRACE("geev_interface"); \
int n = int(mat_nrows(A)), info, lwork(-1); base_type work1; \
long n = long(mat_nrows(A)), info(0), lwork(-1); base_type work1; \
if (!n) return; \
dense_matrix<base_type > H(n,n); gmm::copy(A, H); \
jobv_ ## side \
@ -309,7 +314,7 @@ namespace gmm {
std::vector<base_type> eigv(n); \
lapack_name(&jobvl, &jobvr, &n, &H(0,0), &n, &eigv[0], &Q(0,0), &n, \
&Q(0,0), &n, &work1, &lwork, &rwork[0], &info); \
lwork = int(gmm::real(work1)); \
lwork = long(gmm::real(work1)); \
std::vector<base_type > work(lwork); \
lapack_name(&jobvl, &jobvr, &n, &H(0,0), &n, &eigv[0], &Q(0,0), &n, \
&Q(0,0), &n, &work[0], &lwork, &rwork[0], &info); \
@ -328,28 +333,28 @@ namespace gmm {
geev_interface2(zgeev_, BLAS_Z, left)
/* ********************************************************************* */
/* ********************************************************************** */
/* SCHUR algorithm: */
/* A = Q*S*(Q^T), with Q orthogonal and S upper quasi-triangula */
/* ********************************************************************* */
/* ********************************************************************** */
# define geesx_interface(lapack_name, base_type) inline \
void schur(dense_matrix<base_type> &A, \
dense_matrix<base_type> &S, \
dense_matrix<base_type> &Q) { \
GMMLAPACK_TRACE("geesx_interface"); \
int m = int(mat_nrows(A)), n = int(mat_ncols(A)); \
long m = long(mat_nrows(A)), n = long(mat_ncols(A)); \
GMM_ASSERT1(m == n, "Schur decomposition requires square matrix"); \
char jobvs = 'V', sort = 'N', sense = 'N'; \
bool select = false; \
int lwork = 8*n, sdim = 0, liwork = 1; \
long lwork = 8*n, sdim = 0, liwork = 1; \
std::vector<base_type> work(lwork), wr(n), wi(n); \
std::vector<int> iwork(liwork); \
std::vector<int> bwork(1); \
std::vector<long> iwork(liwork); \
std::vector<long> bwork(1); \
resize(S, n, n); copy(A, S); \
resize(Q, n, n); \
base_type rconde(0), rcondv(0); \
int info = -1; \
long info(0); \
lapack_name(&jobvs, &sort, &select, &sense, &n, &S(0,0), &n, \
&sdim, &wr[0], &wi[0], &Q(0,0), &n, &rconde, &rcondv, \
&work[0], &lwork, &iwork[0], &liwork, &bwork[0], &info);\
@ -361,18 +366,18 @@ namespace gmm {
dense_matrix<base_type> &S, \
dense_matrix<base_type> &Q) { \
GMMLAPACK_TRACE("geesx_interface"); \
int m = int(mat_nrows(A)), n = int(mat_ncols(A)); \
long m = long(mat_nrows(A)), n = long(mat_ncols(A)); \
GMM_ASSERT1(m == n, "Schur decomposition requires square matrix"); \
char jobvs = 'V', sort = 'N', sense = 'N'; \
bool select = false; \
int lwork = 8*n, sdim = 0; \
long lwork = 8*n, sdim = 0; \
std::vector<base_type::value_type> rwork(lwork); \
std::vector<base_type> work(lwork), w(n); \
std::vector<int> bwork(1); \
std::vector<long> bwork(1); \
resize(S, n, n); copy(A, S); \
resize(Q, n, n); \
base_type rconde(0), rcondv(0); \
int info = -1; \
long info(0); \
lapack_name(&jobvs, &sort, &select, &sense, &n, &S(0,0), &n, \
&sdim, &w[0], &Q(0,0), &n, &rconde, &rcondv, \
&work[0], &lwork, &rwork[0], &bwork[0], &info); \
@ -391,10 +396,10 @@ namespace gmm {
}
/* ********************************************************************* */
/* ********************************************************************** */
/* Interface to SVD. Does not correspond to a Gmm++ functionnality. */
/* Author : Sebastian Nowozin <sebastian.nowozin@tuebingen.mpg.de> */
/* ********************************************************************* */
/* ********************************************************************** */
# define gesvd_interface(lapack_name, base_type) inline \
void svd(dense_matrix<base_type> &X, \
@ -402,15 +407,15 @@ namespace gmm {
dense_matrix<base_type> &Vtransposed, \
std::vector<base_type> &sigma) { \
GMMLAPACK_TRACE("gesvd_interface"); \
int m = int(mat_nrows(X)), n = int(mat_ncols(X)); \
int mn_min = m < n ? m : n; \
long m = long(mat_nrows(X)), n = long(mat_ncols(X)); \
long mn_min = m < n ? m : n; \
sigma.resize(mn_min); \
std::vector<base_type> work(15 * mn_min); \
int lwork = int(work.size()); \
long lwork = long(work.size()); \
resize(U, m, m); \
resize(Vtransposed, n, n); \
char job = 'A'; \
int info = -1; \
long info(0); \
lapack_name(&job, &job, &m, &n, &X(0,0), &m, &sigma[0], &U(0,0), \
&m, &Vtransposed(0,0), &n, &work[0], &lwork, &info); \
}
@ -421,16 +426,16 @@ namespace gmm {
dense_matrix<base_type> &Vtransposed, \
std::vector<base_type2> &sigma) { \
GMMLAPACK_TRACE("gesvd_interface"); \
int m = int(mat_nrows(X)), n = int(mat_ncols(X)); \
int mn_min = m < n ? m : n; \
long m = long(mat_nrows(X)), n = long(mat_ncols(X)); \
long mn_min = m < n ? m : n; \
sigma.resize(mn_min); \
std::vector<base_type> work(15 * mn_min); \
std::vector<base_type2> rwork(5 * mn_min); \
int lwork = int(work.size()); \
long lwork = long(work.size()); \
resize(U, m, m); \
resize(Vtransposed, n, n); \
char job = 'A'; \
int info = -1; \
long info(0); \
lapack_name(&job, &job, &m, &n, &X(0,0), &m, &sigma[0], &U(0,0), \
&m, &Vtransposed(0,0), &n, &work[0], &lwork, \
&rwork[0], &info); \

View File

@ -37,6 +37,8 @@
#ifndef GMM_OPT_H__
#define GMM_OPT_H__
#include <gmm/gmm_dense_lu.h>
namespace gmm {
/* ********************************************************************* */
@ -58,7 +60,7 @@ namespace gmm {
default :
{
dense_matrix<T> B(mat_nrows(A), mat_ncols(A));
std::vector<size_type> ipvt(mat_nrows(A));
lapack_ipvt ipvt(mat_nrows(A));
gmm::copy(A, B);
lu_factor(B, ipvt);
return lu_det(B, ipvt);
@ -69,13 +71,13 @@ namespace gmm {
}
template <typename T> T lu_inverse(const dense_matrix<T> &A_, bool doassert = true) {
template <typename T> T lu_inverse(const dense_matrix<T> &A_,
bool doassert = true) {
dense_matrix<T>& A = const_cast<dense_matrix<T> &>(A_);
size_type N = mat_nrows(A);
T det(1);
if (N) {
T *p = &(A(0,0));
if (N <= 2) {
switch (N) {
case 1 : {
det = *p;
@ -90,28 +92,28 @@ namespace gmm {
std::swap(*p, *(p+3));
*p++ /= det; *p++ /= -det; *p++ /= -det; *p++ /= det;
} break;
// case 3 : { // not stable for nearly singular matrices
// T a, b, c, d, e, f, g, h, i;
// a = (*(p+4)) * (*(p+8)) - (*(p+5)) * (*(p+7));
// b = - (*(p+1)) * (*(p+8)) + (*(p+2)) * (*(p+7));
// c = (*(p+1)) * (*(p+5)) - (*(p+2)) * (*(p+4));
// d = - (*(p+3)) * (*(p+8)) + (*(p+5)) * (*(p+6));
// e = (*(p+0)) * (*(p+8)) - (*(p+2)) * (*(p+6));
// f = - (*(p+0)) * (*(p+5)) + (*(p+2)) * (*(p+3));
// g = (*(p+3)) * (*(p+7)) - (*(p+4)) * (*(p+6));
// h = - (*(p+0)) * (*(p+7)) + (*(p+1)) * (*(p+6));
// i = (*(p+0)) * (*(p+4)) - (*(p+1)) * (*(p+3));
// det = (*p) * a + (*(p+1)) * d + (*(p+2)) * g;
// GMM_ASSERT1(det!=T(0), "non invertible matrix");
// *p++ = a / det; *p++ = b / det; *p++ = c / det;
// *p++ = d / det; *p++ = e / det; *p++ = f / det;
// *p++ = g / det; *p++ = h / det; *p++ = i / det;
// } break;
case 3 : { // not stable for nearly singular matrices
T a, b, c, d, e, f, g, h, i;
a = (*(p+4)) * (*(p+8)) - (*(p+5)) * (*(p+7));
b = - (*(p+1)) * (*(p+8)) + (*(p+2)) * (*(p+7));
c = (*(p+1)) * (*(p+5)) - (*(p+2)) * (*(p+4));
d = - (*(p+3)) * (*(p+8)) + (*(p+5)) * (*(p+6));
e = (*(p+0)) * (*(p+8)) - (*(p+2)) * (*(p+6));
f = - (*(p+0)) * (*(p+5)) + (*(p+2)) * (*(p+3));
g = (*(p+3)) * (*(p+7)) - (*(p+4)) * (*(p+6));
h = - (*(p+0)) * (*(p+7)) + (*(p+1)) * (*(p+6));
i = (*(p+0)) * (*(p+4)) - (*(p+1)) * (*(p+3));
det = (*p) * a + (*(p+1)) * d + (*(p+2)) * g;
if (std::abs(det) > 1e-5) {
*p++ = a / det; *p++ = b / det; *p++ = c / det;
*p++ = d / det; *p++ = e / det; *p++ = f / det;
*p++ = g / det; *p++ = h / det; *p++ = i / det;
break;
}
}
else {
default : {
dense_matrix<T> B(mat_nrows(A), mat_ncols(A));
std::vector<int> ipvt(mat_nrows(A));
lapack_ipvt ipvt(mat_nrows(A));
gmm::copy(A, B);
size_type info = lu_factor(B, ipvt);
GMM_ASSERT1(!info, "non invertible matrix");
@ -119,6 +121,7 @@ namespace gmm {
return lu_det(B, ipvt);
}
}
}
return det;
}

View File

@ -38,8 +38,6 @@
#ifndef GMM_STD_H__
#define GMM_STD_H__
//#include <getfem/getfem_arch_config.h>
#ifndef __USE_STD_IOSTREAM
# define __USE_STD_IOSTREAM
#endif
@ -83,13 +81,6 @@ inline void GMM_NOPERATION_(int) { }
/* Compilers detection. */
/* ********************************************************************** */
/* for sun CC 5.0 ...
#if defined(__SUNPRO_CC) && __SUNPRO_CC >= 0x500
# include <stdcomp.h>
# undef _RWSTD_NO_CLASS_PARTIAL_SPEC
# undef _RWSTD_NO_NAMESPACE
#endif
*/
/* for VISUAL C++ ...
#if defined(_MSC_VER) // && !defined(__MWERKS__)
#define _GETFEM_MSVCPP_ _MSC_VER
@ -133,6 +124,8 @@ inline void GMM_NOPERATION_(int) { }
#include <array>
#include <locale.h>
#include <gmm/gmm_arch_config.h>
namespace std {
#if defined(__GNUC__) && (__cplusplus <= 201103L)
template<typename _Tp>
@ -181,7 +174,7 @@ namespace std {
#ifdef GETFEM_HAVE_OPENMP
#ifdef GMM_HAVE_OPENMP
#include <omp.h>
/**number of OpenMP threads*/
@ -222,7 +215,7 @@ namespace gmm {
}
};
#else
/**this is the above solutions for linux, but I still needs to be tested.*/
/**this is the above solutions for linux, but it still needs to be tested.*/
//class standard_locale {
// locale_t oldloc;
// locale_t temploc;

2
hecl

@ -1 +1 @@
Subproject commit 62e5d91fe64ecbdd7417c126b0134f266b900c4f
Subproject commit 012d0a4514fb7b0716ca873b888db651b80f770d

@ -1 +1 @@
Subproject commit 670633992e5f3ebc63b4b8953536ff97082bb56f
Subproject commit f5ab863cf18a0024237b8c5274a17bd5631f21b6

@ -1 +1 @@
Subproject commit e84546be2dcf64c628971cdda601c35cc07b14d1
Subproject commit bd1c3e99f2690f2b7e9543a053661f17dacfd757

2
nod

@ -1 +1 @@
Subproject commit e964a013fe26ff097c4b69b9f607b015505dee0e
Subproject commit f87b286ff3c1f46b4294f15fdc6e849cc4f4d296

@ -1 +1 @@
Subproject commit e7cf4931c734caceeae07f013ba049d5ec887396
Subproject commit 472852162e34e55a1087ffbd743ccf1885fdc16e