mirror of
https://github.com/AxioDL/amuse.git
synced 2025-12-10 22:17:56 +00:00
Windows build fixes
This commit is contained in:
@@ -19,14 +19,14 @@ static void ReportConvType(ConvType tp)
|
||||
switch (tp)
|
||||
{
|
||||
case ConvN64:
|
||||
Log.report(logvisor::Info, _S("using N64 format"));
|
||||
Log.report(logvisor::Info, _SYS_STR("using N64 format"));
|
||||
break;
|
||||
case ConvPC:
|
||||
Log.report(logvisor::Info, _S("using PC format"));
|
||||
Log.report(logvisor::Info, _SYS_STR("using PC format"));
|
||||
break;
|
||||
case ConvGCN:
|
||||
default:
|
||||
Log.report(logvisor::Info, _S("using GameCube format"));
|
||||
Log.report(logvisor::Info, _SYS_STR("using GameCube format"));
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -43,19 +43,19 @@ static bool ExtractAudioGroup(amuse::SystemStringView inPath, amuse::SystemStrin
|
||||
|
||||
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);
|
||||
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)
|
||||
{
|
||||
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());
|
||||
amuse::SystemString songsDir = amuse::SystemString(targetPath) + _S("/midifiles");
|
||||
amuse::SystemString songsDir = amuse::SystemString(targetPath) + _SYS_STR("/midifiles");
|
||||
bool madeDir = false;
|
||||
for (auto& pair : songs)
|
||||
{
|
||||
@@ -66,11 +66,11 @@ static bool ExtractAudioGroup(amuse::SystemStringView inPath, amuse::SystemStrin
|
||||
madeDir = true;
|
||||
}
|
||||
|
||||
amuse::SystemString songPath = songsDir + _S('/') + pair.first + _S(".mid");
|
||||
FILE* fp = amuse::FOpen(songPath.c_str(), _S("wb"));
|
||||
amuse::SystemString songPath = songsDir + _SYS_STR('/') + pair.first + _SYS_STR(".mid");
|
||||
FILE* fp = amuse::FOpen(songPath.c_str(), _SYS_STR("wb"));
|
||||
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;
|
||||
bool isBig;
|
||||
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)
|
||||
{
|
||||
FILE* fp = amuse::FOpen(inPath.data(), _S("rb"));
|
||||
FILE* fp = amuse::FOpen(inPath.data(), _SYS_STR("rb"));
|
||||
if (!fp)
|
||||
return false;
|
||||
|
||||
@@ -100,7 +100,7 @@ static bool BuildSNG(amuse::SystemStringView inPath, amuse::SystemStringView tar
|
||||
if (out.empty())
|
||||
return false;
|
||||
|
||||
fp = amuse::FOpen(targetPath.data(), _S("wb"));
|
||||
fp = amuse::FOpen(targetPath.data(), _SYS_STR("wb"));
|
||||
fwrite(out.data(), 1, out.size(), 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)
|
||||
{
|
||||
FILE* fp = amuse::FOpen(inPath.data(), _S("rb"));
|
||||
FILE* fp = amuse::FOpen(inPath.data(), _SYS_STR("rb"));
|
||||
if (!fp)
|
||||
return false;
|
||||
|
||||
@@ -126,7 +126,7 @@ static bool ExtractSNG(amuse::SystemStringView inPath, amuse::SystemStringView t
|
||||
if (out.empty())
|
||||
return false;
|
||||
|
||||
fp = amuse::FOpen(targetPath.data(), _S("wb"));
|
||||
fp = amuse::FOpen(targetPath.data(), _SYS_STR("wb"));
|
||||
fwrite(out.data(), 1, out.size(), fp);
|
||||
fclose(fp);
|
||||
|
||||
@@ -150,35 +150,35 @@ int main(int argc, const amuse::SystemChar** argv)
|
||||
ConvType type = ConvGCN;
|
||||
if (argc >= 4)
|
||||
{
|
||||
if (!amuse::CompareCaseInsensitive(argv[3], _S("n64")))
|
||||
if (!amuse::CompareCaseInsensitive(argv[3], _SYS_STR("n64")))
|
||||
type = ConvN64;
|
||||
else if (!amuse::CompareCaseInsensitive(argv[3], _S("gcn")))
|
||||
else if (!amuse::CompareCaseInsensitive(argv[3], _SYS_STR("gcn")))
|
||||
type = ConvGCN;
|
||||
else if (!amuse::CompareCaseInsensitive(argv[3], _S("pc")))
|
||||
else if (!amuse::CompareCaseInsensitive(argv[3], _SYS_STR("pc")))
|
||||
type = ConvPC;
|
||||
else
|
||||
{
|
||||
Log.report(logvisor::Error, _S("unrecognized format: %s"), argv[3]);
|
||||
Log.report(logvisor::Error, _SYS_STR("unrecognized format: %s"), argv[3]);
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
bool good = false;
|
||||
FILE* fin = amuse::FOpen(argv[1], _S("rb"));
|
||||
FILE* fin = amuse::FOpen(argv[1], _SYS_STR("rb"));
|
||||
if (fin)
|
||||
{
|
||||
fclose(fin);
|
||||
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;
|
||||
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);
|
||||
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]);
|
||||
}
|
||||
@@ -194,8 +194,8 @@ int main(int argc, const amuse::SystemChar** argv)
|
||||
if (!amuse::Stat(argv[1], &theStat) && S_ISDIR(theStat.st_mode))
|
||||
{
|
||||
amuse::SystemString projectPath(argv[1]);
|
||||
projectPath += _S("/project.yaml");
|
||||
fin = amuse::FOpen(projectPath.c_str(), _S("rb"));
|
||||
projectPath += _SYS_STR("/project.yaml");
|
||||
fin = amuse::FOpen(projectPath.c_str(), _SYS_STR("rb"));
|
||||
if (fin)
|
||||
{
|
||||
fclose(fin);
|
||||
@@ -207,7 +207,7 @@ int main(int argc, const amuse::SystemChar** argv)
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user