Windows build fixes

This commit is contained in:
Jack Andersen 2018-10-14 10:10:33 -10:00
parent dbd48a39cc
commit 885a2d2154
12 changed files with 161 additions and 161 deletions

View File

@ -655,7 +655,7 @@ void ProjectModel::importSongsData(const QString& path)
amuse::SongConverter::SongToMIDI(song.second.m_data.get(), version, isBig); amuse::SongConverter::SongToMIDI(song.second.m_data.get(), version, isBig);
if (!midiData.empty()) if (!midiData.empty())
{ {
QFileInfo fi(m_dir, SysStringToQString(song.first + _S(".mid"))); QFileInfo fi(m_dir, SysStringToQString(song.first + _SYS_STR(".mid")));
QFile f(fi.filePath()); QFile f(fi.filePath());
if (f.open(QFile::WriteOnly)) if (f.open(QFile::WriteOnly))
{ {

View File

@ -45,9 +45,9 @@ public:
EPlatformType getPlatformType() const { return EPlatformType::Qt; } EPlatformType getPlatformType() const { return EPlatformType::Qt; }
int run() { return 0; } int run() { return 0; }
boo::SystemStringView getUniqueName() const { return _S("amuse-gui"sv); } boo::SystemStringView getUniqueName() const { return _SYS_STR("amuse-gui"sv); }
boo::SystemStringView getFriendlyName() const { return _S("Amuse"sv); } boo::SystemStringView getFriendlyName() const { return _SYS_STR("Amuse"sv); }
boo::SystemStringView getProcessName() const { return _S("amuse-gui"sv); } boo::SystemStringView getProcessName() const { return _SYS_STR("amuse-gui"sv); }
const std::vector<boo::SystemString>& getArgs() const { return m_args; } const std::vector<boo::SystemString>& getArgs() const { return m_args; }
/* Constructors/initializers for sub-objects */ /* Constructors/initializers for sub-objects */

View File

@ -19,14 +19,14 @@ static void ReportConvType(ConvType tp)
switch (tp) switch (tp)
{ {
case ConvN64: case ConvN64:
Log.report(logvisor::Info, _S("using N64 format")); Log.report(logvisor::Info, _SYS_STR("using N64 format"));
break; break;
case ConvPC: case ConvPC:
Log.report(logvisor::Info, _S("using PC format")); Log.report(logvisor::Info, _SYS_STR("using PC format"));
break; break;
case ConvGCN: case ConvGCN:
default: default:
Log.report(logvisor::Info, _S("using GameCube format")); Log.report(logvisor::Info, _SYS_STR("using GameCube format"));
break; break;
} }
} }
@ -43,19 +43,19 @@ static bool ExtractAudioGroup(amuse::SystemStringView inPath, amuse::SystemStrin
if (groups.size()) if (groups.size())
{ {
Log.report(logvisor::Info, _S("Found '%s'"), amuse::ContainerRegistry::TypeToName(type)); Log.report(logvisor::Info, _SYS_STR("Found '%s'"), amuse::ContainerRegistry::TypeToName(type));
amuse::Mkdir(targetPath.data(), 0755); amuse::Mkdir(targetPath.data(), 0755);
Log.report(logvisor::Info, _S("Established directory at %s"), targetPath.data()); Log.report(logvisor::Info, _SYS_STR("Established directory at %s"), targetPath.data());
for (auto& group : groups) for (auto& group : groups)
{ {
Log.report(logvisor::Info, _S("Extracting %s"), group.first.c_str()); Log.report(logvisor::Info, _SYS_STR("Extracting %s"), group.first.c_str());
} }
} }
auto songs = amuse::ContainerRegistry::LoadSongs(inPath.data()); auto songs = amuse::ContainerRegistry::LoadSongs(inPath.data());
amuse::SystemString songsDir = amuse::SystemString(targetPath) + _S("/midifiles"); amuse::SystemString songsDir = amuse::SystemString(targetPath) + _SYS_STR("/midifiles");
bool madeDir = false; bool madeDir = false;
for (auto& pair : songs) for (auto& pair : songs)
{ {
@ -66,11 +66,11 @@ static bool ExtractAudioGroup(amuse::SystemStringView inPath, amuse::SystemStrin
madeDir = true; madeDir = true;
} }
amuse::SystemString songPath = songsDir + _S('/') + pair.first + _S(".mid"); amuse::SystemString songPath = songsDir + _SYS_STR('/') + pair.first + _SYS_STR(".mid");
FILE* fp = amuse::FOpen(songPath.c_str(), _S("wb")); FILE* fp = amuse::FOpen(songPath.c_str(), _SYS_STR("wb"));
if (fp) if (fp)
{ {
Log.report(logvisor::Info, _S("Extracting %s"), pair.first.c_str()); Log.report(logvisor::Info, _SYS_STR("Extracting %s"), pair.first.c_str());
int extractedVersion; int extractedVersion;
bool isBig; bool isBig;
std::vector<uint8_t> mid = std::vector<uint8_t> mid =
@ -85,7 +85,7 @@ static bool ExtractAudioGroup(amuse::SystemStringView inPath, amuse::SystemStrin
static bool BuildSNG(amuse::SystemStringView inPath, amuse::SystemStringView targetPath, int version, bool big) static bool BuildSNG(amuse::SystemStringView inPath, amuse::SystemStringView targetPath, int version, bool big)
{ {
FILE* fp = amuse::FOpen(inPath.data(), _S("rb")); FILE* fp = amuse::FOpen(inPath.data(), _SYS_STR("rb"));
if (!fp) if (!fp)
return false; return false;
@ -100,7 +100,7 @@ static bool BuildSNG(amuse::SystemStringView inPath, amuse::SystemStringView tar
if (out.empty()) if (out.empty())
return false; return false;
fp = amuse::FOpen(targetPath.data(), _S("wb")); fp = amuse::FOpen(targetPath.data(), _SYS_STR("wb"));
fwrite(out.data(), 1, out.size(), fp); fwrite(out.data(), 1, out.size(), fp);
fclose(fp); fclose(fp);
@ -109,7 +109,7 @@ static bool BuildSNG(amuse::SystemStringView inPath, amuse::SystemStringView tar
static bool ExtractSNG(amuse::SystemStringView inPath, amuse::SystemStringView targetPath) static bool ExtractSNG(amuse::SystemStringView inPath, amuse::SystemStringView targetPath)
{ {
FILE* fp = amuse::FOpen(inPath.data(), _S("rb")); FILE* fp = amuse::FOpen(inPath.data(), _SYS_STR("rb"));
if (!fp) if (!fp)
return false; return false;
@ -126,7 +126,7 @@ static bool ExtractSNG(amuse::SystemStringView inPath, amuse::SystemStringView t
if (out.empty()) if (out.empty())
return false; return false;
fp = amuse::FOpen(targetPath.data(), _S("wb")); fp = amuse::FOpen(targetPath.data(), _SYS_STR("wb"));
fwrite(out.data(), 1, out.size(), fp); fwrite(out.data(), 1, out.size(), fp);
fclose(fp); fclose(fp);
@ -150,35 +150,35 @@ int main(int argc, const amuse::SystemChar** argv)
ConvType type = ConvGCN; ConvType type = ConvGCN;
if (argc >= 4) if (argc >= 4)
{ {
if (!amuse::CompareCaseInsensitive(argv[3], _S("n64"))) if (!amuse::CompareCaseInsensitive(argv[3], _SYS_STR("n64")))
type = ConvN64; type = ConvN64;
else if (!amuse::CompareCaseInsensitive(argv[3], _S("gcn"))) else if (!amuse::CompareCaseInsensitive(argv[3], _SYS_STR("gcn")))
type = ConvGCN; type = ConvGCN;
else if (!amuse::CompareCaseInsensitive(argv[3], _S("pc"))) else if (!amuse::CompareCaseInsensitive(argv[3], _SYS_STR("pc")))
type = ConvPC; type = ConvPC;
else else
{ {
Log.report(logvisor::Error, _S("unrecognized format: %s"), argv[3]); Log.report(logvisor::Error, _SYS_STR("unrecognized format: %s"), argv[3]);
return 1; return 1;
} }
} }
bool good = false; bool good = false;
FILE* fin = amuse::FOpen(argv[1], _S("rb")); FILE* fin = amuse::FOpen(argv[1], _SYS_STR("rb"));
if (fin) if (fin)
{ {
fclose(fin); fclose(fin);
amuse::SystemString barePath(argv[1]); amuse::SystemString barePath(argv[1]);
size_t dotPos = barePath.rfind(_S('.')); size_t dotPos = barePath.rfind(_SYS_STR('.'));
const amuse::SystemChar* dot = barePath.c_str() + dotPos; const amuse::SystemChar* dot = barePath.c_str() + dotPos;
if (dotPos != amuse::SystemString::npos) if (dotPos != amuse::SystemString::npos)
{ {
if (!amuse::CompareCaseInsensitive(dot, _S(".mid")) || !amuse::CompareCaseInsensitive(dot, _S(".midi"))) if (!amuse::CompareCaseInsensitive(dot, _SYS_STR(".mid")) || !amuse::CompareCaseInsensitive(dot, _SYS_STR(".midi")))
{ {
ReportConvType(type); ReportConvType(type);
good = BuildSNG(barePath, argv[2], 1, true); good = BuildSNG(barePath, argv[2], 1, true);
} }
else if (!amuse::CompareCaseInsensitive(dot, _S(".son")) || !amuse::CompareCaseInsensitive(dot, _S(".sng"))) else if (!amuse::CompareCaseInsensitive(dot, _SYS_STR(".son")) || !amuse::CompareCaseInsensitive(dot, _SYS_STR(".sng")))
{ {
good = ExtractSNG(argv[1], argv[2]); good = ExtractSNG(argv[1], argv[2]);
} }
@ -194,8 +194,8 @@ int main(int argc, const amuse::SystemChar** argv)
if (!amuse::Stat(argv[1], &theStat) && S_ISDIR(theStat.st_mode)) if (!amuse::Stat(argv[1], &theStat) && S_ISDIR(theStat.st_mode))
{ {
amuse::SystemString projectPath(argv[1]); amuse::SystemString projectPath(argv[1]);
projectPath += _S("/project.yaml"); projectPath += _SYS_STR("/project.yaml");
fin = amuse::FOpen(projectPath.c_str(), _S("rb")); fin = amuse::FOpen(projectPath.c_str(), _SYS_STR("rb"));
if (fin) if (fin)
{ {
fclose(fin); fclose(fin);
@ -207,7 +207,7 @@ int main(int argc, const amuse::SystemChar** argv)
if (!good) if (!good)
{ {
Log.report(logvisor::Error, _S("unable to convert %s to %s"), argv[1], argv[2]); Log.report(logvisor::Error, _SYS_STR("unable to convert %s to %s"), argv[1], argv[2]);
return 1; return 1;
} }

View File

@ -624,7 +624,7 @@ struct AppCallback : boo::IApplicationCallback
int appMain(boo::IApplication* app) int appMain(boo::IApplication* app)
{ {
/* Event window */ /* Event window */
m_win = app->newWindow(_S("amuseplay")); m_win = app->newWindow(_SYS_STR("amuseplay"));
m_win->setCallback(&m_events); m_win->setCallback(&m_events);
m_win->setWindowFrame(100, 100, 100, 100); m_win->setWindowFrame(100, 100, 100, 100);
m_win->setStyle(~boo::EWindowStyle::Resize); m_win->setStyle(~boo::EWindowStyle::Resize);
@ -653,7 +653,7 @@ struct AppCallback : boo::IApplicationCallback
Log.report(logvisor::Error, "invalid/no data at path argument"); Log.report(logvisor::Error, "invalid/no data at path argument");
return 1; return 1;
} }
Log.report(logvisor::Info, _S("Found '%s' Audio Group data"), amuse::ContainerRegistry::TypeToName(cType)); Log.report(logvisor::Info, _SYS_STR("Found '%s' Audio Group data"), amuse::ContainerRegistry::TypeToName(cType));
std::vector<std::pair<amuse::SystemString, amuse::IntrusiveAudioGroupData>> data = std::vector<std::pair<amuse::SystemString, amuse::IntrusiveAudioGroupData>> data =
amuse::ContainerRegistry::LoadContainer(m_argv[1]); amuse::ContainerRegistry::LoadContainer(m_argv[1]);
@ -755,7 +755,7 @@ struct AppCallback : boo::IApplicationCallback
break; break;
} }
} }
amuse::Printf(_S(" %d %s (Group %d, Setup %d)\n"), idx++, pair.first.c_str(), grpId, amuse::Printf(_SYS_STR(" %d %s (Group %d, Setup %d)\n"), idx++, pair.first.c_str(), grpId,
setupId); setupId);
} }
@ -825,12 +825,12 @@ struct AppCallback : boo::IApplicationCallback
printf("Multiple Audio Groups discovered:\n"); printf("Multiple Audio Groups discovered:\n");
for (const auto& pair : allSFXGroups) for (const auto& pair : allSFXGroups)
{ {
amuse::Printf(_S(" %d %s (SFXGroup) %" PRISize " sfx-entries\n"), pair.first.id, amuse::Printf(_SYS_STR(" %d %s (SFXGroup) %" PRISize " sfx-entries\n"), pair.first.id,
pair.second.first->first.c_str(), pair.second.second->m_sfxEntries.size()); pair.second.first->first.c_str(), pair.second.second->m_sfxEntries.size());
} }
for (const auto& pair : allSongGroups) for (const auto& pair : allSongGroups)
{ {
amuse::Printf(_S(" %d %s (SongGroup) %" PRISize " normal-pages, %" PRISize amuse::Printf(_SYS_STR(" %d %s (SongGroup) %" PRISize " normal-pages, %" PRISize
" drum-pages, %" PRISize " MIDI-setups\n"), " drum-pages, %" PRISize " MIDI-setups\n"),
pair.first.id, pair.second.first->first.c_str(), pair.second.second->m_normPages.size(), pair.first.id, pair.second.first->first.c_str(), pair.second.second->m_normPages.size(),
pair.second.second->m_drumPages.size(), pair.second.second->m_midiSetups.size()); pair.second.second->m_drumPages.size(), pair.second.second->m_midiSetups.size());
@ -1034,7 +1034,7 @@ int main(int argc, const boo::SystemChar** argv)
logvisor::RegisterStandardExceptions(); logvisor::RegisterStandardExceptions();
AppCallback app(argc, argv); AppCallback app(argc, argv);
int ret = boo::ApplicationRun(boo::IApplication::EPlatformType::Auto, app, int ret = boo::ApplicationRun(boo::IApplication::EPlatformType::Auto, app,
_S("amuseplay"), _S("Amuse Player"), _SYS_STR("amuseplay"), _SYS_STR("Amuse Player"),
argc, argv, {}, 1, 1, false); argc, argv, {}, 1, 1, false);
printf("IM DYING!!\n"); printf("IM DYING!!\n");
return ret; return ret;

View File

@ -186,7 +186,7 @@ int main(int argc, const boo::SystemChar** argv)
Log.report(logvisor::Error, "invalid/no data at path argument"); Log.report(logvisor::Error, "invalid/no data at path argument");
return 1; return 1;
} }
Log.report(logvisor::Info, _S("Found '%s' Audio Group data"), amuse::ContainerRegistry::TypeToName(cType)); Log.report(logvisor::Info, _SYS_STR("Found '%s' Audio Group data"), amuse::ContainerRegistry::TypeToName(cType));
std::vector<std::pair<amuse::SystemString, amuse::IntrusiveAudioGroupData>> data = std::vector<std::pair<amuse::SystemString, amuse::IntrusiveAudioGroupData>> data =
amuse::ContainerRegistry::LoadContainer(m_args[0].c_str()); amuse::ContainerRegistry::LoadContainer(m_args[0].c_str());
@ -290,7 +290,7 @@ int main(int argc, const boo::SystemChar** argv)
break; break;
} }
} }
amuse::Printf(_S(" %d %s (Group %d, Setup %d)\n"), idx++, pair.first.c_str(), grpId, setupId); amuse::Printf(_SYS_STR(" %d %s (Group %d, Setup %d)\n"), idx++, pair.first.c_str(), grpId, setupId);
} }
int userSel = 0; int userSel = 0;
@ -370,12 +370,12 @@ int main(int argc, const boo::SystemChar** argv)
printf("Multiple Audio Groups discovered:\n"); printf("Multiple Audio Groups discovered:\n");
for (const auto& pair : allSFXGroups) for (const auto& pair : allSFXGroups)
{ {
amuse::Printf(_S(" %d %s (SFXGroup) %" PRISize " sfx-entries\n"), pair.first, amuse::Printf(_SYS_STR(" %d %s (SFXGroup) %" PRISize " sfx-entries\n"), pair.first,
pair.second.first->first.c_str(), pair.second.second->m_sfxEntries.size()); pair.second.first->first.c_str(), pair.second.second->m_sfxEntries.size());
} }
for (const auto& pair : allSongGroups) for (const auto& pair : allSongGroups)
{ {
amuse::Printf(_S(" %d %s (SongGroup) %" PRISize " normal-pages, %" PRISize " drum-pages, %" PRISize amuse::Printf(_SYS_STR(" %d %s (SongGroup) %" PRISize " normal-pages, %" PRISize " drum-pages, %" PRISize
" MIDI-setups\n"), " MIDI-setups\n"),
pair.first, pair.second.first->first.c_str(), pair.second.second->m_normPages.size(), pair.first, pair.second.first->first.c_str(), pair.second.second->m_normPages.size(),
pair.second.second->m_drumPages.size(), pair.second.second->m_midiSetups.size()); pair.second.second->m_drumPages.size(), pair.second.second->m_midiSetups.size());
@ -490,8 +490,8 @@ int main(int argc, const boo::SystemChar** argv)
/* WAV out path */ /* WAV out path */
amuse::SystemChar pathOut[1024]; amuse::SystemChar pathOut[1024];
SNPrintf(pathOut, 1024, _S("%s-%s.wav"), m_groupName->c_str(), m_songName->c_str()); SNPrintf(pathOut, 1024, _SYS_STR("%s-%s.wav"), m_groupName->c_str(), m_songName->c_str());
Log.report(logvisor::Info, _S("Writing to %s"), pathOut); Log.report(logvisor::Info, _SYS_STR("Writing to %s"), pathOut);
/* Build voice engine */ /* Build voice engine */
std::unique_ptr<boo::IAudioVoiceEngine> voxEngine = boo::NewWAVAudioVoiceEngine(pathOut, rate, chCount); std::unique_ptr<boo::IAudioVoiceEngine> voxEngine = boo::NewWAVAudioVoiceEngine(pathOut, rate, chCount);

View File

@ -269,8 +269,8 @@ inline typename std::enable_if_t<!std::is_base_of_v<IObj, Tp>, ObjToken<Tp>> Mak
using SystemString = std::wstring; using SystemString = std::wstring;
using SystemStringView = std::wstring_view; using SystemStringView = std::wstring_view;
using SystemChar = wchar_t; using SystemChar = wchar_t;
#ifndef _S #ifndef _SYS_STR
#define _S(val) L##val #define _SYS_STR(val) L##val
#endif #endif
typedef struct _stat Sstat; typedef struct _stat Sstat;
static inline int Mkdir(const wchar_t* path, int) { return _wmkdir(path); } static inline int Mkdir(const wchar_t* path, int) { return _wmkdir(path); }
@ -279,8 +279,8 @@ static inline int Stat(const wchar_t* path, Sstat* statout) { return _wstat(path
using SystemString = std::string; using SystemString = std::string;
using SystemStringView = std::string_view; using SystemStringView = std::string_view;
using SystemChar = char; using SystemChar = char;
#ifndef _S #ifndef _SYS_STR
#define _S(val) val #define _SYS_STR(val) val
#endif #endif
typedef struct stat Sstat; typedef struct stat Sstat;
static inline int Mkdir(const char* path, mode_t mode) { return mkdir(path, mode); } static inline int Mkdir(const char* path, mode_t mode) { return mkdir(path, mode); }

View File

@ -45,10 +45,10 @@ const SampleEntry* AudioGroup::getSample(SampleId sfxId) const
SystemString AudioGroup::getSampleBasePath(SampleId sfxId) const SystemString AudioGroup::getSampleBasePath(SampleId sfxId) const
{ {
#if _WIN32 #if _WIN32
return m_groupPath + _S('/') + return m_groupPath + _SYS_STR('/') +
athena::utility::utf8ToWide(SampleId::CurNameDB->resolveNameFromId(sfxId)); athena::utility::utf8ToWide(SampleId::CurNameDB->resolveNameFromId(sfxId));
#else #else
return m_groupPath + _S('/') + return m_groupPath + _SYS_STR('/') +
SampleId::CurNameDB->resolveNameFromId(sfxId).data(); SampleId::CurNameDB->resolveNameFromId(sfxId).data();
#endif #endif
} }
@ -112,24 +112,24 @@ void AudioGroupDatabase::renameSample(SampleId id, std::string_view str)
SystemString oldBasePath = getSampleBasePath(id); SystemString oldBasePath = getSampleBasePath(id);
SampleId::CurNameDB->rename(id, str); SampleId::CurNameDB->rename(id, str);
SystemString newBasePath = getSampleBasePath(id); SystemString newBasePath = getSampleBasePath(id);
Rename((oldBasePath + _S(".wav")).c_str(), (newBasePath + _S(".wav")).c_str()); Rename((oldBasePath + _SYS_STR(".wav")).c_str(), (newBasePath + _SYS_STR(".wav")).c_str());
Rename((oldBasePath + _S(".dsp")).c_str(), (newBasePath + _S(".dsp")).c_str()); Rename((oldBasePath + _SYS_STR(".dsp")).c_str(), (newBasePath + _SYS_STR(".dsp")).c_str());
Rename((oldBasePath + _S(".vadpcm")).c_str(), (newBasePath + _S(".vadpcm")).c_str()); Rename((oldBasePath + _SYS_STR(".vadpcm")).c_str(), (newBasePath + _SYS_STR(".vadpcm")).c_str());
} }
void AudioGroupDatabase::deleteSample(SampleId id) void AudioGroupDatabase::deleteSample(SampleId id)
{ {
SystemString basePath = getSampleBasePath(id); SystemString basePath = getSampleBasePath(id);
Unlink((basePath + _S(".wav")).c_str()); Unlink((basePath + _SYS_STR(".wav")).c_str());
Unlink((basePath + _S(".dsp")).c_str()); Unlink((basePath + _SYS_STR(".dsp")).c_str());
Unlink((basePath + _S(".vadpcm")).c_str()); Unlink((basePath + _SYS_STR(".vadpcm")).c_str());
} }
void AudioGroupDatabase::copySampleInto(const SystemString& basePath, const SystemString& newBasePath) void AudioGroupDatabase::copySampleInto(const SystemString& basePath, const SystemString& newBasePath)
{ {
Copy((basePath + _S(".wav")).c_str(), (newBasePath + _S(".wav")).c_str()); Copy((basePath + _SYS_STR(".wav")).c_str(), (newBasePath + _SYS_STR(".wav")).c_str());
Copy((basePath + _S(".dsp")).c_str(), (newBasePath + _S(".dsp")).c_str()); Copy((basePath + _SYS_STR(".dsp")).c_str(), (newBasePath + _SYS_STR(".dsp")).c_str());
Copy((basePath + _S(".vadpcm")).c_str(), (newBasePath + _S(".vadpcm")).c_str()); Copy((basePath + _SYS_STR(".vadpcm")).c_str(), (newBasePath + _SYS_STR(".vadpcm")).c_str());
} }
void AudioGroupDatabase::_recursiveRenameMacro(SoundMacroId id, std::string_view str, int& macroIdx, void AudioGroupDatabase::_recursiveRenameMacro(SoundMacroId id, std::string_view str, int& macroIdx,

View File

@ -233,7 +233,7 @@ AudioGroupPool AudioGroupPool::CreateAudioGroupPool(SystemStringView groupPath)
{ {
AudioGroupPool ret; AudioGroupPool ret;
SystemString poolPath(groupPath); SystemString poolPath(groupPath);
poolPath += _S("/!pool.yaml"); poolPath += _SYS_STR("/!pool.yaml");
athena::io::FileReader fi(poolPath, 32 * 1024, false); athena::io::FileReader fi(poolPath, 32 * 1024, false);
if (!fi.hasError()) if (!fi.hasError())

View File

@ -422,7 +422,7 @@ AudioGroupProject AudioGroupProject::CreateAudioGroupProject(SystemStringView gr
{ {
AudioGroupProject ret; AudioGroupProject ret;
SystemString projPath(groupPath); SystemString projPath(groupPath);
projPath += _S("/!project.yaml"); projPath += _SYS_STR("/!project.yaml");
athena::io::FileReader fi(projPath, 32 * 1024, false); athena::io::FileReader fi(projPath, 32 * 1024, false);
if (!fi.hasError()) if (!fi.hasError())

View File

@ -284,9 +284,9 @@ void AudioGroupSampleDirectory::EntryData::loadLooseWAV(SystemStringView wavPath
void AudioGroupSampleDirectory::Entry::loadLooseData(SystemStringView basePath) void AudioGroupSampleDirectory::Entry::loadLooseData(SystemStringView basePath)
{ {
SystemString wavPath = SystemString(basePath) + _S(".wav"); SystemString wavPath = SystemString(basePath) + _SYS_STR(".wav");
SystemString dspPath = SystemString(basePath) + _S(".dsp"); SystemString dspPath = SystemString(basePath) + _SYS_STR(".dsp");
SystemString vadpcmPath = SystemString(basePath) + _S(".vadpcm"); SystemString vadpcmPath = SystemString(basePath) + _SYS_STR(".vadpcm");
Sstat wavStat, dspStat, vadpcmStat; Sstat wavStat, dspStat, vadpcmStat;
bool wavValid = !Stat(wavPath.c_str(), &wavStat) && S_ISREG(wavStat.st_mode); bool wavValid = !Stat(wavPath.c_str(), &wavStat) && S_ISREG(wavStat.st_mode);
bool dspValid = !Stat(dspPath.c_str(), &dspStat) && S_ISREG(dspStat.st_mode); bool dspValid = !Stat(dspPath.c_str(), &dspStat) && S_ISREG(dspStat.st_mode);
@ -338,9 +338,9 @@ void AudioGroupSampleDirectory::Entry::loadLooseData(SystemStringView basePath)
SampleFileState AudioGroupSampleDirectory::Entry::getFileState(SystemStringView basePath, SystemString* pathOut) const SampleFileState AudioGroupSampleDirectory::Entry::getFileState(SystemStringView basePath, SystemString* pathOut) const
{ {
SystemString wavPath = SystemString(basePath) + _S(".wav"); SystemString wavPath = SystemString(basePath) + _SYS_STR(".wav");
SystemString dspPath = SystemString(basePath) + _S(".dsp"); SystemString dspPath = SystemString(basePath) + _SYS_STR(".dsp");
SystemString vadpcmPath = SystemString(basePath) + _S(".vadpcm"); SystemString vadpcmPath = SystemString(basePath) + _SYS_STR(".vadpcm");
Sstat wavStat, dspStat, vadpcmStat; Sstat wavStat, dspStat, vadpcmStat;
bool wavValid = !Stat(wavPath.c_str(), &wavStat) && S_ISREG(wavStat.st_mode); bool wavValid = !Stat(wavPath.c_str(), &wavStat) && S_ISREG(wavStat.st_mode);
bool dspValid = !Stat(dspPath.c_str(), &dspStat) && S_ISREG(dspStat.st_mode); bool dspValid = !Stat(dspPath.c_str(), &dspStat) && S_ISREG(dspStat.st_mode);
@ -623,9 +623,9 @@ static void SetAudioFileTime(const SystemString& path, const Sstat& stat)
void AudioGroupSampleDirectory::Entry::patchSampleMetadata(SystemStringView basePath) const void AudioGroupSampleDirectory::Entry::patchSampleMetadata(SystemStringView basePath) const
{ {
SystemString wavPath = SystemString(basePath) + _S(".wav"); SystemString wavPath = SystemString(basePath) + _SYS_STR(".wav");
SystemString dspPath = SystemString(basePath) + _S(".dsp"); SystemString dspPath = SystemString(basePath) + _SYS_STR(".dsp");
SystemString vadpcmPath = SystemString(basePath) + _S(".vadpcm"); SystemString vadpcmPath = SystemString(basePath) + _SYS_STR(".vadpcm");
Sstat wavStat, dspStat, vadpcmStat; Sstat wavStat, dspStat, vadpcmStat;
bool wavValid = !Stat(wavPath.c_str(), &wavStat) && S_ISREG(wavStat.st_mode); bool wavValid = !Stat(wavPath.c_str(), &wavStat) && S_ISREG(wavStat.st_mode);
bool dspValid = !Stat(dspPath.c_str(), &dspStat) && S_ISREG(dspStat.st_mode); bool dspValid = !Stat(dspPath.c_str(), &dspStat) && S_ISREG(dspStat.st_mode);
@ -663,14 +663,14 @@ AudioGroupSampleDirectory AudioGroupSampleDirectory::CreateAudioGroupSampleDirec
continue; continue;
SystemString baseName; SystemString baseName;
SystemString basePath; SystemString basePath;
if (!CompareCaseInsensitive(ent.m_name.data() + ent.m_name.size() - 4, _S(".dsp")) || if (!CompareCaseInsensitive(ent.m_name.data() + ent.m_name.size() - 4, _SYS_STR(".dsp")) ||
!CompareCaseInsensitive(ent.m_name.data() + ent.m_name.size() - 4, _S(".wav"))) !CompareCaseInsensitive(ent.m_name.data() + ent.m_name.size() - 4, _SYS_STR(".wav")))
{ {
baseName = SystemString(ent.m_name.begin(), ent.m_name.begin() + ent.m_name.size() - 4); baseName = SystemString(ent.m_name.begin(), ent.m_name.begin() + ent.m_name.size() - 4);
basePath = SystemString(ent.m_path.begin(), ent.m_path.begin() + ent.m_path.size() - 4); basePath = SystemString(ent.m_path.begin(), ent.m_path.begin() + ent.m_path.size() - 4);
} }
else if (ent.m_name.size() > 7 && else if (ent.m_name.size() > 7 &&
!CompareCaseInsensitive(ent.m_name.data() + ent.m_name.size() - 7, _S(".vadpcm"))) !CompareCaseInsensitive(ent.m_name.data() + ent.m_name.size() - 7, _SYS_STR(".vadpcm")))
{ {
baseName = SystemString(ent.m_name.begin(), ent.m_name.begin() + ent.m_name.size() - 7); baseName = SystemString(ent.m_name.begin(), ent.m_name.begin() + ent.m_name.size() - 7);
basePath = SystemString(ent.m_path.begin(), ent.m_path.begin() + ent.m_path.size() - 7); basePath = SystemString(ent.m_path.begin(), ent.m_path.begin() + ent.m_path.size() - 7);
@ -697,15 +697,15 @@ void AudioGroupSampleDirectory::_extractWAV(SampleId id, const EntryData& ent,
amuse::SystemStringView destDir, const unsigned char* samp) amuse::SystemStringView destDir, const unsigned char* samp)
{ {
SystemString path(destDir); SystemString path(destDir);
path += _S("/"); path += _SYS_STR("/");
#ifdef _WIN32 #ifdef _WIN32
path += athena::utility::utf8ToWide(SampleId::CurNameDB->resolveNameFromId(id)); path += athena::utility::utf8ToWide(SampleId::CurNameDB->resolveNameFromId(id));
#else #else
path += SampleId::CurNameDB->resolveNameFromId(id); path += SampleId::CurNameDB->resolveNameFromId(id);
#endif #endif
SystemString dspPath = path; SystemString dspPath = path;
path += _S(".wav"); path += _SYS_STR(".wav");
dspPath += _S(".dsp"); dspPath += _SYS_STR(".dsp");
athena::io::FileWriter w(path); athena::io::FileWriter w(path);
SampleFormat fmt = SampleFormat(ent.m_numSamples >> 24); SampleFormat fmt = SampleFormat(ent.m_numSamples >> 24);
@ -829,7 +829,7 @@ void AudioGroupSampleDirectory::_extractCompressed(SampleId id, const EntryData&
} }
amuse::SystemString path(destDir); amuse::SystemString path(destDir);
path += _S("/"); path += _SYS_STR("/");
#ifdef _WIN32 #ifdef _WIN32
path += athena::utility::utf8ToWide(SampleId::CurNameDB->resolveNameFromId(id)); path += athena::utility::utf8ToWide(SampleId::CurNameDB->resolveNameFromId(id));
#else #else
@ -859,7 +859,7 @@ void AudioGroupSampleDirectory::_extractCompressed(SampleId id, const EntryData&
header.x44_loop_ps = ent.m_ADPCMParms.dsp.m_lps; header.x44_loop_ps = ent.m_ADPCMParms.dsp.m_lps;
header.m_pitch = ent.m_pitch; header.m_pitch = ent.m_pitch;
path += _S(".dsp"); path += _SYS_STR(".dsp");
athena::io::FileWriter w(path); athena::io::FileWriter w(path);
header.write(w); header.write(w);
dataLen = (header.x4_num_nibbles + 1) / 2; dataLen = (header.x4_num_nibbles + 1) / 2;
@ -867,7 +867,7 @@ void AudioGroupSampleDirectory::_extractCompressed(SampleId id, const EntryData&
} }
else if (fmt == SampleFormat::N64) else if (fmt == SampleFormat::N64)
{ {
path += _S(".vadpcm"); path += _SYS_STR(".vadpcm");
athena::io::FileWriter w(path); athena::io::FileWriter w(path);
VADPCMHeader header; VADPCMHeader header;
header.m_pitchSampleRate = ent.m_pitch << 24; header.m_pitchSampleRate = ent.m_pitch << 24;
@ -907,7 +907,7 @@ void AudioGroupSampleDirectory::_extractCompressed(SampleId id, const EntryData&
} }
DSPCorrelateCoefs(samps, numSamples, header.x1c_coef); DSPCorrelateCoefs(samps, numSamples, header.x1c_coef);
path += _S(".dsp"); path += _SYS_STR(".dsp");
athena::io::FileWriter w(path); athena::io::FileWriter w(path);
header.write(w); header.write(w);
@ -984,14 +984,14 @@ void AudioGroupSampleDirectory::reloadSampleData(SystemStringView groupPath)
continue; continue;
SystemString baseName; SystemString baseName;
SystemString basePath; SystemString basePath;
if (!CompareCaseInsensitive(ent.m_name.data() + ent.m_name.size() - 4, _S(".dsp")) || if (!CompareCaseInsensitive(ent.m_name.data() + ent.m_name.size() - 4, _SYS_STR(".dsp")) ||
!CompareCaseInsensitive(ent.m_name.data() + ent.m_name.size() - 4, _S(".wav"))) !CompareCaseInsensitive(ent.m_name.data() + ent.m_name.size() - 4, _SYS_STR(".wav")))
{ {
baseName = SystemString(ent.m_name.begin(), ent.m_name.begin() + ent.m_name.size() - 4); baseName = SystemString(ent.m_name.begin(), ent.m_name.begin() + ent.m_name.size() - 4);
basePath = SystemString(ent.m_path.begin(), ent.m_path.begin() + ent.m_path.size() - 4); basePath = SystemString(ent.m_path.begin(), ent.m_path.begin() + ent.m_path.size() - 4);
} }
else if (ent.m_name.size() > 7 && else if (ent.m_name.size() > 7 &&
!CompareCaseInsensitive(ent.m_name.data() + ent.m_name.size() - 7, _S(".vadpcm"))) !CompareCaseInsensitive(ent.m_name.data() + ent.m_name.size() - 7, _SYS_STR(".vadpcm")))
{ {
baseName = SystemString(ent.m_name.begin(), ent.m_name.begin() + ent.m_name.size() - 7); baseName = SystemString(ent.m_name.begin(), ent.m_name.begin() + ent.m_name.size() - 7);
basePath = SystemString(ent.m_path.begin(), ent.m_path.begin() + ent.m_path.size() - 7); basePath = SystemString(ent.m_path.begin(), ent.m_path.begin() + ent.m_path.size() - 7);
@ -1033,7 +1033,7 @@ AudioGroupSampleDirectory::toGCNData(const AudioGroupDatabase& group) const
for (const auto& ent : SortUnorderedMap(m_entries)) for (const auto& ent : SortUnorderedMap(m_entries))
{ {
amuse::SystemString path = group.getSampleBasePath(ent.first); amuse::SystemString path = group.getSampleBasePath(ent.first);
path += _S(".dsp"); path += _SYS_STR(".dsp");
SampleFileState state = group.getSampleFileState(ent.first, ent.second.get().get(), &path); SampleFileState state = group.getSampleFileState(ent.first, ent.second.get().get(), &path);
switch (state) switch (state)
{ {

View File

@ -120,21 +120,21 @@ const SystemChar* ContainerRegistry::TypeToName(Type tp)
default: default:
return nullptr; return nullptr;
case Type::Raw4: case Type::Raw4:
return _S("4 RAW Chunks"); return _SYS_STR("4 RAW Chunks");
case Type::MetroidPrime: case Type::MetroidPrime:
return _S("Metroid Prime (GCN)"); return _SYS_STR("Metroid Prime (GCN)");
case Type::MetroidPrime2: case Type::MetroidPrime2:
return _S("Metroid Prime 2 (GCN)"); return _SYS_STR("Metroid Prime 2 (GCN)");
case Type::RogueSquadronPC: case Type::RogueSquadronPC:
return _S("Star Wars - Rogue Squadron (PC)"); return _SYS_STR("Star Wars - Rogue Squadron (PC)");
case Type::RogueSquadronN64: case Type::RogueSquadronN64:
return _S("Star Wars - Rogue Squadron (N64)"); return _SYS_STR("Star Wars - Rogue Squadron (N64)");
case Type::Factor5N64Rev: case Type::Factor5N64Rev:
return _S("Factor5 Revision ROM (N64)"); return _SYS_STR("Factor5 Revision ROM (N64)");
case Type::RogueSquadron2: case Type::RogueSquadron2:
return _S("Star Wars - Rogue Squadron 2 (GCN)"); return _SYS_STR("Star Wars - Rogue Squadron 2 (GCN)");
case Type::RogueSquadron3: case Type::RogueSquadron3:
return _S("Star Wars - Rogue Squadron 3 (GCN)"); return _SYS_STR("Star Wars - Rogue Squadron 3 (GCN)");
} }
} }
@ -157,13 +157,13 @@ static SystemString ReadString(FILE* fp)
static bool IsChunkExtension(const SystemChar* path, const SystemChar*& dotOut) static bool IsChunkExtension(const SystemChar* path, const SystemChar*& dotOut)
{ {
const SystemChar* ext = StrRChr(path, _S('.')); const SystemChar* ext = StrRChr(path, _SYS_STR('.'));
if (ext) if (ext)
{ {
if (!CompareCaseInsensitive(ext, _S(".poo")) || !CompareCaseInsensitive(ext, _S(".pool")) || if (!CompareCaseInsensitive(ext, _SYS_STR(".poo")) || !CompareCaseInsensitive(ext, _SYS_STR(".pool")) ||
!CompareCaseInsensitive(ext, _S(".pro")) || !CompareCaseInsensitive(ext, _S(".proj")) || !CompareCaseInsensitive(ext, _SYS_STR(".pro")) || !CompareCaseInsensitive(ext, _SYS_STR(".proj")) ||
!CompareCaseInsensitive(ext, _S(".sdi")) || !CompareCaseInsensitive(ext, _S(".sdir")) || !CompareCaseInsensitive(ext, _SYS_STR(".sdi")) || !CompareCaseInsensitive(ext, _SYS_STR(".sdir")) ||
!CompareCaseInsensitive(ext, _S(".sam")) || !CompareCaseInsensitive(ext, _S(".samp"))) !CompareCaseInsensitive(ext, _SYS_STR(".sam")) || !CompareCaseInsensitive(ext, _SYS_STR(".samp")))
{ {
dotOut = ext; dotOut = ext;
return true; return true;
@ -174,11 +174,11 @@ static bool IsChunkExtension(const SystemChar* path, const SystemChar*& dotOut)
static bool IsSongExtension(const SystemChar* path, const SystemChar*& dotOut) static bool IsSongExtension(const SystemChar* path, const SystemChar*& dotOut)
{ {
const SystemChar* ext = StrRChr(path, _S('.')); const SystemChar* ext = StrRChr(path, _SYS_STR('.'));
if (ext) if (ext)
{ {
if (!CompareCaseInsensitive(ext, _S(".son")) || !CompareCaseInsensitive(ext, _S(".sng")) || if (!CompareCaseInsensitive(ext, _SYS_STR(".son")) || !CompareCaseInsensitive(ext, _SYS_STR(".sng")) ||
!CompareCaseInsensitive(ext, _S(".song"))) !CompareCaseInsensitive(ext, _SYS_STR(".song")))
{ {
dotOut = ext; dotOut = ext;
return true; return true;
@ -466,7 +466,7 @@ static std::vector<std::pair<SystemString, ContainerRegistry::SongData>> LoadMP1
else else
{ {
SystemChar name[128]; SystemChar name[128];
SNPrintf(name, 128, _S("%08X"), id); SNPrintf(name, 128, _SYS_STR("%08X"), id);
ret.emplace_back(name, ContainerRegistry::SongData(std::move(song), sonLength, groupId, midiSetup)); ret.emplace_back(name, ContainerRegistry::SongData(std::move(song), sonLength, groupId, midiSetup));
} }
@ -618,7 +618,7 @@ static std::vector<std::pair<SystemString, IntrusiveAudioGroupData>> LoadMP2(FIL
rem -= dsz; rem -= dsz;
} }
fp = FOpen(_S("amuse_tmp.dat"), _S("rw")); fp = FOpen(_SYS_STR("amuse_tmp.dat"), _SYS_STR("rw"));
rewind(fp); rewind(fp);
fwrite(buf, 1, decompSz, fp); fwrite(buf, 1, decompSz, fp);
rewind(fp); rewind(fp);
@ -671,7 +671,7 @@ static std::vector<std::pair<SystemString, IntrusiveAudioGroupData>> LoadMP2(FIL
if (compressed) if (compressed)
{ {
fclose(fp); fclose(fp);
Unlink(_S("amuse_tmp.dat")); Unlink(_SYS_STR("amuse_tmp.dat"));
} }
fp = old_fp; fp = old_fp;
FSeek(fp, origPos, SEEK_SET); FSeek(fp, origPos, SEEK_SET);
@ -926,7 +926,7 @@ static std::vector<std::pair<SystemString, IntrusiveAudioGroupData>> LoadRS1PC(F
} }
} }
ret.emplace_back(_S("Group"), ret.emplace_back(_SYS_STR("Group"),
IntrusiveAudioGroupData{proj.release(), projSz, pool.release(), poolSz, sdir.release(), IntrusiveAudioGroupData{proj.release(), projSz, pool.release(), poolSz, sdir.release(),
sdirSz, samp.release(), sampSz, false, PCDataTag{}}); sdirSz, samp.release(), sampSz, false, PCDataTag{}});
} }
@ -1128,7 +1128,7 @@ static std::vector<std::pair<SystemString, IntrusiveAudioGroupData>> LoadRS1N64(
} }
} }
ret.emplace_back(_S("Group"), ret.emplace_back(_SYS_STR("Group"),
IntrusiveAudioGroupData{proj.release(), projSz, pool.release(), poolSz, sdir.release(), sdirSz, IntrusiveAudioGroupData{proj.release(), projSz, pool.release(), poolSz, sdir.release(), sdirSz,
samp.release(), sampSz, false, N64DataTag{}}); samp.release(), sampSz, false, N64DataTag{}});
} }
@ -1349,7 +1349,7 @@ static std::vector<std::pair<SystemString, IntrusiveAudioGroupData>> LoadFactor5
} }
} }
ret.emplace_back(_S("Group"), ret.emplace_back(_SYS_STR("Group"),
IntrusiveAudioGroupData{proj.release(), projSz, pool.release(), poolSz, sdir.release(), sdirSz, IntrusiveAudioGroupData{proj.release(), projSz, pool.release(), poolSz, sdir.release(), sdirSz,
samp.release(), sampSz, true, N64DataTag{}}); samp.release(), sampSz, true, N64DataTag{}});
} }
@ -1566,7 +1566,7 @@ static std::vector<std::pair<SystemString, IntrusiveAudioGroupData>> LoadRS2(FIL
if (head.projLen && head.poolLen && head.sdirLen && head.sampLen) if (head.projLen && head.poolLen && head.sdirLen && head.sampLen)
{ {
SystemChar name[128]; SystemChar name[128];
SNPrintf(name, 128, _S("GroupFile%02u"), j); SNPrintf(name, 128, _SYS_STR("GroupFile%02u"), j);
ret.emplace_back(name, IntrusiveAudioGroupData{proj.release(), head.projLen, pool.release(), ret.emplace_back(name, IntrusiveAudioGroupData{proj.release(), head.projLen, pool.release(),
head.poolLen, sdir.release(), head.sdirLen, head.poolLen, sdir.release(), head.sdirLen,
samp.release(), head.sampLen, GCNDataTag{}}); samp.release(), head.sampLen, GCNDataTag{}});
@ -1627,7 +1627,7 @@ static std::vector<std::pair<SystemString, ContainerRegistry::SongData>> LoadRS2
sonHead.swapBig(); sonHead.swapBig();
SystemChar name[128]; SystemChar name[128];
SNPrintf(name, 128, _S("GroupFile%02u-%u"), j, s); SNPrintf(name, 128, _SYS_STR("GroupFile%02u-%u"), j, s);
std::unique_ptr<uint8_t[]> song(new uint8_t[sonHead.length]); std::unique_ptr<uint8_t[]> song(new uint8_t[sonHead.length]);
memmove(song.get(), audData.get() + sonHead.offset, sonHead.length); memmove(song.get(), audData.get() + sonHead.offset, sonHead.length);
ret.emplace_back(name, ContainerRegistry::SongData(std::move(song), sonHead.length, sonHead.groupId, ret.emplace_back(name, ContainerRegistry::SongData(std::move(song), sonHead.length, sonHead.groupId,
@ -1740,7 +1740,7 @@ static std::vector<std::pair<SystemString, IntrusiveAudioGroupData>> LoadRS3(FIL
if (head.projLen && head.poolLen && head.sdirLen && head.sampLen) if (head.projLen && head.poolLen && head.sdirLen && head.sampLen)
{ {
SystemChar name[128]; SystemChar name[128];
SNPrintf(name, 128, _S("GroupFile%02u"), j); SNPrintf(name, 128, _SYS_STR("GroupFile%02u"), j);
ret.emplace_back(name, IntrusiveAudioGroupData{proj.release(), head.projLen, pool.release(), ret.emplace_back(name, IntrusiveAudioGroupData{proj.release(), head.projLen, pool.release(),
head.poolLen, sdir.release(), head.sdirLen, head.poolLen, sdir.release(), head.sdirLen,
samp.release(), head.sampLen, GCNDataTag{}}); samp.release(), head.sampLen, GCNDataTag{}});
@ -1808,7 +1808,7 @@ static std::vector<std::pair<SystemString, ContainerRegistry::SongData>> LoadSta
break; break;
SystemChar name[128]; SystemChar name[128];
SNPrintf(name, 128, _S("Song%u"), i); SNPrintf(name, 128, _SYS_STR("Song%u"), i);
std::unique_ptr<uint8_t[]> song(new uint8_t[len]); std::unique_ptr<uint8_t[]> song(new uint8_t[len]);
memmove(song.get(), data.get() + cur, len); memmove(song.get(), data.get() + cur, len);
ret.emplace_back(name, ContainerRegistry::SongData(std::move(song), len, -1, i)); ret.emplace_back(name, ContainerRegistry::SongData(std::move(song), len, -1, i));
@ -1898,48 +1898,48 @@ ContainerRegistry::Type ContainerRegistry::DetectContainerType(const SystemChar*
SystemChar newpath[1024]; SystemChar newpath[1024];
/* Project */ /* Project */
SNPrintf(newpath, 1024, _S("%.*s.pro"), int(dot - path), path); SNPrintf(newpath, 1024, _SYS_STR("%.*s.pro"), int(dot - path), path);
fp = FOpen(newpath, _S("rb")); fp = FOpen(newpath, _SYS_STR("rb"));
if (!fp) if (!fp)
{ {
SNPrintf(newpath, 1024, _S("%.*s.proj"), int(dot - path), path); SNPrintf(newpath, 1024, _SYS_STR("%.*s.proj"), int(dot - path), path);
fp = FOpen(newpath, _S("rb")); fp = FOpen(newpath, _SYS_STR("rb"));
if (!fp) if (!fp)
return Type::Invalid; return Type::Invalid;
} }
fclose(fp); fclose(fp);
/* Pool */ /* Pool */
SNPrintf(newpath, 1024, _S("%.*s.poo"), int(dot - path), path); SNPrintf(newpath, 1024, _SYS_STR("%.*s.poo"), int(dot - path), path);
fp = FOpen(newpath, _S("rb")); fp = FOpen(newpath, _SYS_STR("rb"));
if (!fp) if (!fp)
{ {
SNPrintf(newpath, 1024, _S("%.*s.pool"), int(dot - path), path); SNPrintf(newpath, 1024, _SYS_STR("%.*s.pool"), int(dot - path), path);
fp = FOpen(newpath, _S("rb")); fp = FOpen(newpath, _SYS_STR("rb"));
if (!fp) if (!fp)
return Type::Invalid; return Type::Invalid;
} }
fclose(fp); fclose(fp);
/* Sample Directory */ /* Sample Directory */
SNPrintf(newpath, 1024, _S("%.*s.sdi"), int(dot - path), path); SNPrintf(newpath, 1024, _SYS_STR("%.*s.sdi"), int(dot - path), path);
fp = FOpen(newpath, _S("rb")); fp = FOpen(newpath, _SYS_STR("rb"));
if (!fp) if (!fp)
{ {
SNPrintf(newpath, 1024, _S("%.*s.sdir"), int(dot - path), path); SNPrintf(newpath, 1024, _SYS_STR("%.*s.sdir"), int(dot - path), path);
fp = FOpen(newpath, _S("rb")); fp = FOpen(newpath, _SYS_STR("rb"));
if (!fp) if (!fp)
return Type::Invalid; return Type::Invalid;
} }
fclose(fp); fclose(fp);
/* Sample */ /* Sample */
SNPrintf(newpath, 1024, _S("%.*s.sam"), int(dot - path), path); SNPrintf(newpath, 1024, _SYS_STR("%.*s.sam"), int(dot - path), path);
fp = FOpen(newpath, _S("rb")); fp = FOpen(newpath, _SYS_STR("rb"));
if (!fp) if (!fp)
{ {
SNPrintf(newpath, 1024, _S("%.*s.samp"), int(dot - path), path); SNPrintf(newpath, 1024, _SYS_STR("%.*s.samp"), int(dot - path), path);
fp = FOpen(newpath, _S("rb")); fp = FOpen(newpath, _SYS_STR("rb"));
if (!fp) if (!fp)
return Type::Invalid; return Type::Invalid;
} }
@ -1949,7 +1949,7 @@ ContainerRegistry::Type ContainerRegistry::DetectContainerType(const SystemChar*
} }
/* Now attempt single-file case */ /* Now attempt single-file case */
fp = FOpen(path, _S("rb")); fp = FOpen(path, _SYS_STR("rb"));
if (fp) if (fp)
{ {
if (ValidateMP1(fp)) if (ValidateMP1(fp))
@ -2019,19 +2019,19 @@ std::vector<std::pair<SystemString, IntrusiveAudioGroupData>> ContainerRegistry:
std::vector<std::pair<SystemString, IntrusiveAudioGroupData>> ret; std::vector<std::pair<SystemString, IntrusiveAudioGroupData>> ret;
SystemString baseName; SystemString baseName;
if (const SystemChar* sep = std::max(StrRChr(path, _S('/')), StrRChr(path, _S('\\')))) if (const SystemChar* sep = std::max(StrRChr(path, _SYS_STR('/')), StrRChr(path, _SYS_STR('\\'))))
baseName = SystemString(sep + 1, dot - sep - 1); baseName = SystemString(sep + 1, dot - sep - 1);
else else
baseName = SystemString(path, dot - path); baseName = SystemString(path, dot - path);
/* Project */ /* Project */
SystemChar projPath[1024]; SystemChar projPath[1024];
SNPrintf(projPath, 1024, _S("%.*s.pro"), int(dot - path), path); SNPrintf(projPath, 1024, _SYS_STR("%.*s.pro"), int(dot - path), path);
fp = FOpen(projPath, _S("rb")); fp = FOpen(projPath, _SYS_STR("rb"));
if (!fp) if (!fp)
{ {
SNPrintf(projPath, 1024, _S("%.*s.proj"), int(dot - path), path); SNPrintf(projPath, 1024, _SYS_STR("%.*s.proj"), int(dot - path), path);
fp = FOpen(projPath, _S("rb")); fp = FOpen(projPath, _SYS_STR("rb"));
if (!fp) if (!fp)
return ret; return ret;
} }
@ -2039,12 +2039,12 @@ std::vector<std::pair<SystemString, IntrusiveAudioGroupData>> ContainerRegistry:
/* Pool */ /* Pool */
SystemChar poolPath[1024]; SystemChar poolPath[1024];
SNPrintf(poolPath, 1024, _S("%.*s.poo"), int(dot - path), path); SNPrintf(poolPath, 1024, _SYS_STR("%.*s.poo"), int(dot - path), path);
fp = FOpen(poolPath, _S("rb")); fp = FOpen(poolPath, _SYS_STR("rb"));
if (!fp) if (!fp)
{ {
SNPrintf(poolPath, 1024, _S("%.*s.pool"), int(dot - path), path); SNPrintf(poolPath, 1024, _SYS_STR("%.*s.pool"), int(dot - path), path);
fp = FOpen(poolPath, _S("rb")); fp = FOpen(poolPath, _SYS_STR("rb"));
if (!fp) if (!fp)
return ret; return ret;
} }
@ -2052,12 +2052,12 @@ std::vector<std::pair<SystemString, IntrusiveAudioGroupData>> ContainerRegistry:
/* Sample Directory */ /* Sample Directory */
SystemChar sdirPath[1024]; SystemChar sdirPath[1024];
SNPrintf(sdirPath, 1024, _S("%.*s.sdi"), int(dot - path), path); SNPrintf(sdirPath, 1024, _SYS_STR("%.*s.sdi"), int(dot - path), path);
fp = FOpen(sdirPath, _S("rb")); fp = FOpen(sdirPath, _SYS_STR("rb"));
if (!fp) if (!fp)
{ {
SNPrintf(sdirPath, 1024, _S("%.*s.sdir"), int(dot - path), path); SNPrintf(sdirPath, 1024, _SYS_STR("%.*s.sdir"), int(dot - path), path);
fp = FOpen(sdirPath, _S("rb")); fp = FOpen(sdirPath, _SYS_STR("rb"));
if (!fp) if (!fp)
return ret; return ret;
} }
@ -2065,39 +2065,39 @@ std::vector<std::pair<SystemString, IntrusiveAudioGroupData>> ContainerRegistry:
/* Sample */ /* Sample */
SystemChar sampPath[1024]; SystemChar sampPath[1024];
SNPrintf(sampPath, 1024, _S("%.*s.sam"), int(dot - path), path); SNPrintf(sampPath, 1024, _SYS_STR("%.*s.sam"), int(dot - path), path);
fp = FOpen(sampPath, _S("rb")); fp = FOpen(sampPath, _SYS_STR("rb"));
if (!fp) if (!fp)
{ {
SNPrintf(sampPath, 1024, _S("%.*s.samp"), int(dot - path), path); SNPrintf(sampPath, 1024, _SYS_STR("%.*s.samp"), int(dot - path), path);
fp = FOpen(sampPath, _S("rb")); fp = FOpen(sampPath, _SYS_STR("rb"));
if (!fp) if (!fp)
return ret; return ret;
} }
fclose(fp); fclose(fp);
fp = FOpen(projPath, _S("rb")); fp = FOpen(projPath, _SYS_STR("rb"));
size_t projLen = FileLength(fp); size_t projLen = FileLength(fp);
if (!projLen) if (!projLen)
return ret; return ret;
std::unique_ptr<uint8_t[]> proj(new uint8_t[projLen]); std::unique_ptr<uint8_t[]> proj(new uint8_t[projLen]);
fread(proj.get(), 1, projLen, fp); fread(proj.get(), 1, projLen, fp);
fp = FOpen(poolPath, _S("rb")); fp = FOpen(poolPath, _SYS_STR("rb"));
size_t poolLen = FileLength(fp); size_t poolLen = FileLength(fp);
if (!poolLen) if (!poolLen)
return ret; return ret;
std::unique_ptr<uint8_t[]> pool(new uint8_t[poolLen]); std::unique_ptr<uint8_t[]> pool(new uint8_t[poolLen]);
fread(pool.get(), 1, poolLen, fp); fread(pool.get(), 1, poolLen, fp);
fp = FOpen(sdirPath, _S("rb")); fp = FOpen(sdirPath, _SYS_STR("rb"));
size_t sdirLen = FileLength(fp); size_t sdirLen = FileLength(fp);
if (!sdirLen) if (!sdirLen)
return ret; return ret;
std::unique_ptr<uint8_t[]> sdir(new uint8_t[sdirLen]); std::unique_ptr<uint8_t[]> sdir(new uint8_t[sdirLen]);
fread(sdir.get(), 1, sdirLen, fp); fread(sdir.get(), 1, sdirLen, fp);
fp = FOpen(sampPath, _S("rb")); fp = FOpen(sampPath, _SYS_STR("rb"));
size_t sampLen = FileLength(fp); size_t sampLen = FileLength(fp);
if (!sampLen) if (!sampLen)
return ret; return ret;
@ -2125,7 +2125,7 @@ std::vector<std::pair<SystemString, IntrusiveAudioGroupData>> ContainerRegistry:
} }
/* Now attempt single-file case */ /* Now attempt single-file case */
fp = FOpen(path, _S("rb")); fp = FOpen(path, _SYS_STR("rb"));
if (fp) if (fp)
{ {
if (ValidateMP1(fp)) if (ValidateMP1(fp))
@ -2198,7 +2198,7 @@ std::vector<std::pair<SystemString, ContainerRegistry::SongData>> ContainerRegis
const SystemChar* dot = nullptr; const SystemChar* dot = nullptr;
if (IsSongExtension(path, dot)) if (IsSongExtension(path, dot))
{ {
fp = FOpen(path, _S("rb")); fp = FOpen(path, _SYS_STR("rb"));
size_t fLen = FileLength(fp); size_t fLen = FileLength(fp);
if (!fLen) if (!fLen)
{ {
@ -2210,12 +2210,12 @@ std::vector<std::pair<SystemString, ContainerRegistry::SongData>> ContainerRegis
fclose(fp); fclose(fp);
std::vector<std::pair<SystemString, SongData>> ret; std::vector<std::pair<SystemString, SongData>> ret;
ret.emplace_back(_S("Song"), SongData(std::move(song), fLen, -1, -1)); ret.emplace_back(_SYS_STR("Song"), SongData(std::move(song), fLen, -1, -1));
return ret; return ret;
} }
/* Now attempt archive-file case */ /* Now attempt archive-file case */
fp = FOpen(path, _S("rb")); fp = FOpen(path, _SYS_STR("rb"));
if (fp) if (fp)
{ {
if (ValidateMP1Songs(fp)) if (ValidateMP1Songs(fp))
@ -2264,9 +2264,9 @@ std::vector<std::pair<SystemString, ContainerRegistry::SongData>> ContainerRegis
{ {
/* Song Description */ /* Song Description */
SystemChar newpath[1024]; SystemChar newpath[1024];
dot = StrRChr(path, _S('.')); dot = StrRChr(path, _SYS_STR('.'));
SNPrintf(newpath, 1024, _S("%.*s.stbl"), int(dot - path), path); SNPrintf(newpath, 1024, _SYS_STR("%.*s.stbl"), int(dot - path), path);
FILE* descFp = FOpen(newpath, _S("rb")); FILE* descFp = FOpen(newpath, _SYS_STR("rb"));
if (descFp) if (descFp)
{ {
auto ret = LoadPaperMarioTTYDSongs(fp, descFp); auto ret = LoadPaperMarioTTYDSongs(fp, descFp);

View File

@ -30,7 +30,7 @@ DirectoryEnumerator::DirectoryEnumerator(SystemStringView path, Mode mode, bool
#if _WIN32 #if _WIN32
SystemString wc(path); SystemString wc(path);
wc += _S("/*"); wc += _SYS_STR("/*");
WIN32_FIND_DATAW d; WIN32_FIND_DATAW d;
HANDLE dir = FindFirstFileW(wc.c_str(), &d); HANDLE dir = FindFirstFileW(wc.c_str(), &d);
if (dir == INVALID_HANDLE_VALUE) if (dir == INVALID_HANDLE_VALUE)
@ -40,12 +40,12 @@ DirectoryEnumerator::DirectoryEnumerator(SystemStringView path, Mode mode, bool
case Mode::Native: case Mode::Native:
do do
{ {
if (!wcscmp(d.cFileName, _S(".")) || !wcscmp(d.cFileName, _S(".."))) if (!wcscmp(d.cFileName, _SYS_STR(".")) || !wcscmp(d.cFileName, _SYS_STR("..")))
continue; continue;
if (noHidden && (d.cFileName[0] == L'.' || (d.dwFileAttributes & FILE_ATTRIBUTE_HIDDEN) != 0)) if (noHidden && (d.cFileName[0] == L'.' || (d.dwFileAttributes & FILE_ATTRIBUTE_HIDDEN) != 0))
continue; continue;
SystemString fp(path); SystemString fp(path);
fp += _S('/'); fp += _SYS_STR('/');
fp += d.cFileName; fp += d.cFileName;
Sstat st; Sstat st;
if (Stat(fp.c_str(), &st)) if (Stat(fp.c_str(), &st))
@ -69,12 +69,12 @@ DirectoryEnumerator::DirectoryEnumerator(SystemStringView path, Mode mode, bool
std::map<SystemString, Entry, CaseInsensitiveCompare> sort; std::map<SystemString, Entry, CaseInsensitiveCompare> sort;
do do
{ {
if (!wcscmp(d.cFileName, _S(".")) || !wcscmp(d.cFileName, _S(".."))) if (!wcscmp(d.cFileName, _SYS_STR(".")) || !wcscmp(d.cFileName, _SYS_STR("..")))
continue; continue;
if (noHidden && (d.cFileName[0] == L'.' || (d.dwFileAttributes & FILE_ATTRIBUTE_HIDDEN) != 0)) if (noHidden && (d.cFileName[0] == L'.' || (d.dwFileAttributes & FILE_ATTRIBUTE_HIDDEN) != 0))
continue; continue;
SystemString fp(path); SystemString fp(path);
fp += _S('/'); fp += _SYS_STR('/');
fp += d.cFileName; fp += d.cFileName;
Sstat st; Sstat st;
if (Stat(fp.c_str(), &st) || !S_ISDIR(st.st_mode)) if (Stat(fp.c_str(), &st) || !S_ISDIR(st.st_mode))
@ -105,12 +105,12 @@ DirectoryEnumerator::DirectoryEnumerator(SystemStringView path, Mode mode, bool
std::multimap<size_t, Entry> sort; std::multimap<size_t, Entry> sort;
do do
{ {
if (!wcscmp(d.cFileName, _S(".")) || !wcscmp(d.cFileName, _S(".."))) if (!wcscmp(d.cFileName, _SYS_STR(".")) || !wcscmp(d.cFileName, _SYS_STR("..")))
continue; continue;
if (noHidden && (d.cFileName[0] == L'.' || (d.dwFileAttributes & FILE_ATTRIBUTE_HIDDEN) != 0)) if (noHidden && (d.cFileName[0] == L'.' || (d.dwFileAttributes & FILE_ATTRIBUTE_HIDDEN) != 0))
continue; continue;
SystemString fp(path); SystemString fp(path);
fp += _S('/'); fp += _SYS_STR('/');
fp += d.cFileName; fp += d.cFileName;
Sstat st; Sstat st;
if (Stat(fp.c_str(), &st) || !S_ISREG(st.st_mode)) if (Stat(fp.c_str(), &st) || !S_ISREG(st.st_mode))
@ -131,12 +131,12 @@ DirectoryEnumerator::DirectoryEnumerator(SystemStringView path, Mode mode, bool
std::map<SystemString, Entry, CaseInsensitiveCompare> sort; std::map<SystemString, Entry, CaseInsensitiveCompare> sort;
do do
{ {
if (!wcscmp(d.cFileName, _S(".")) || !wcscmp(d.cFileName, _S(".."))) if (!wcscmp(d.cFileName, _SYS_STR(".")) || !wcscmp(d.cFileName, _SYS_STR("..")))
continue; continue;
if (noHidden && (d.cFileName[0] == L'.' || (d.dwFileAttributes & FILE_ATTRIBUTE_HIDDEN) != 0)) if (noHidden && (d.cFileName[0] == L'.' || (d.dwFileAttributes & FILE_ATTRIBUTE_HIDDEN) != 0))
continue; continue;
SystemString fp(path); SystemString fp(path);
fp += _S('/'); fp += _SYS_STR('/');
fp += d.cFileName; fp += d.cFileName;
Sstat st; Sstat st;
if (Stat(fp.c_str(), &st) || !S_ISREG(st.st_mode)) if (Stat(fp.c_str(), &st) || !S_ISREG(st.st_mode))