2
0
mirror of https://github.com/AxioDL/metaforce.git synced 2025-12-08 12:24:56 +00:00

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

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;
}