2015-11-21 01:16:07 +00:00
|
|
|
#include <LogVisor/LogVisor.hpp>
|
|
|
|
#include <boo/boo.hpp>
|
|
|
|
#include <Specter/Specter.hpp>
|
2015-12-02 21:14:31 +00:00
|
|
|
#include <HECL/CVarManager.hpp>
|
2015-11-22 06:51:25 +00:00
|
|
|
#include <Runtime/CGameAllocator.hpp>
|
2015-11-22 08:01:51 +00:00
|
|
|
#include <functional>
|
2015-12-06 01:27:02 +00:00
|
|
|
#include "ViewManager.hpp"
|
2016-02-12 06:06:17 +00:00
|
|
|
#include <Runtime/Particle/CElementGen.hpp>
|
2015-11-21 01:16:07 +00:00
|
|
|
|
2016-01-05 09:53:16 +00:00
|
|
|
namespace URDE
|
2015-11-21 01:16:07 +00:00
|
|
|
{
|
2016-02-15 17:35:20 +00:00
|
|
|
LogVisor::LogModule Log{"URDE"};
|
|
|
|
|
2015-11-21 01:16:07 +00:00
|
|
|
struct Application : boo::IApplicationCallback
|
|
|
|
{
|
2015-11-22 04:35:24 +00:00
|
|
|
HECL::Runtime::FileStoreManager m_fileMgr;
|
2015-12-02 21:14:31 +00:00
|
|
|
HECL::CVarManager m_cvarManager;
|
2016-02-20 05:49:47 +00:00
|
|
|
std::unique_ptr<ViewManager> m_viewManager;
|
2015-12-06 01:27:02 +00:00
|
|
|
|
2015-11-22 04:35:24 +00:00
|
|
|
bool m_running = true;
|
|
|
|
|
2015-11-23 08:47:57 +00:00
|
|
|
Application() :
|
2016-01-05 09:53:16 +00:00
|
|
|
m_fileMgr(_S("urde")),
|
2016-02-20 05:49:47 +00:00
|
|
|
m_cvarManager(m_fileMgr)
|
|
|
|
{
|
|
|
|
m_viewManager.reset(new ViewManager(m_fileMgr, m_cvarManager));
|
|
|
|
}
|
2015-11-22 04:35:24 +00:00
|
|
|
|
2015-11-21 01:16:07 +00:00
|
|
|
int appMain(boo::IApplication* app)
|
|
|
|
{
|
2016-02-15 17:35:20 +00:00
|
|
|
initialize(app);
|
2016-02-20 05:49:47 +00:00
|
|
|
m_viewManager->init(app);
|
2015-11-22 04:35:24 +00:00
|
|
|
while (m_running)
|
|
|
|
{
|
2016-02-20 05:49:47 +00:00
|
|
|
if (!m_viewManager->proc())
|
2015-11-26 23:04:11 +00:00
|
|
|
break;
|
2015-11-22 04:35:24 +00:00
|
|
|
}
|
2016-02-20 05:49:47 +00:00
|
|
|
m_viewManager->stop();
|
2015-12-04 01:44:35 +00:00
|
|
|
m_cvarManager.serialize();
|
2016-02-20 05:49:47 +00:00
|
|
|
m_viewManager.reset();
|
2015-11-21 01:16:07 +00:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
void appQuitting(boo::IApplication*)
|
|
|
|
{
|
2015-11-22 04:35:24 +00:00
|
|
|
m_running = false;
|
2015-11-21 01:16:07 +00:00
|
|
|
}
|
|
|
|
void appFilesOpen(boo::IApplication*, const std::vector<boo::SystemString>&)
|
|
|
|
{
|
|
|
|
|
|
|
|
}
|
2016-02-15 17:35:20 +00:00
|
|
|
|
|
|
|
void initialize(boo::IApplication* app)
|
|
|
|
{
|
|
|
|
Zeus::detectCPU();
|
|
|
|
|
|
|
|
const Zeus::CPUInfo& cpuInf = Zeus::cpuFeatures();
|
2016-02-17 03:42:27 +00:00
|
|
|
Log.report(LogVisor::Info, "CPU Name: %s", cpuInf.cpuBrand);
|
|
|
|
Log.report(LogVisor::Info, "CPU Vendor: %s", cpuInf.cpuVendor);
|
2016-02-15 17:52:43 +00:00
|
|
|
HECL::SystemString features;
|
|
|
|
if (cpuInf.AESNI)
|
|
|
|
features += _S("AES-NI");
|
|
|
|
if (cpuInf.SSE1)
|
|
|
|
{
|
|
|
|
if (!features.empty())
|
|
|
|
features += _S(", SSE1");
|
|
|
|
else
|
|
|
|
features += _S("SSE1");
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
Log.report(LogVisor::FatalError, _S("URDE requires SSE1 minimum"));
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
if (cpuInf.SSE2)
|
|
|
|
features += _S(", SSE2");
|
|
|
|
else
|
|
|
|
{
|
|
|
|
Log.report(LogVisor::FatalError, _S("URDE requires SSE2 minimum"));
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
if (cpuInf.SSE3)
|
|
|
|
features += _S(", SSE3");
|
|
|
|
if (cpuInf.SSSE3)
|
|
|
|
features += _S(", SSSE3");
|
|
|
|
if (cpuInf.SSE4a)
|
|
|
|
features += _S(", SSE4a");
|
|
|
|
if (cpuInf.SSE41)
|
|
|
|
features += _S(", SSE4.1");
|
|
|
|
if (cpuInf.SSE42)
|
|
|
|
features += _S(", SSE4.2");
|
|
|
|
Log.report(LogVisor::Info, _S("CPU Features: %s"), features.c_str());
|
2016-02-15 17:35:20 +00:00
|
|
|
}
|
2015-11-21 01:16:07 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
#if _WIN32
|
|
|
|
int wmain(int argc, const boo::SystemChar** argv)
|
|
|
|
#else
|
|
|
|
int main(int argc, const boo::SystemChar** argv)
|
|
|
|
#endif
|
|
|
|
{
|
|
|
|
LogVisor::RegisterConsoleLogger();
|
2016-01-05 09:53:16 +00:00
|
|
|
URDE::Application appCb;
|
2015-12-06 01:27:02 +00:00
|
|
|
int ret = boo::ApplicationRun(boo::IApplication::EPlatformType::Auto,
|
2016-01-05 09:53:16 +00:00
|
|
|
appCb, _S("urde"), _S("URDE"), argc, argv, false);
|
2015-11-21 01:16:07 +00:00
|
|
|
printf("IM DYING!!\n");
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
|
|
|
#if _WIN32
|
|
|
|
int APIENTRY wWinMain(HINSTANCE hInstance, HINSTANCE, LPWSTR lpCmdLine, int)
|
|
|
|
{
|
|
|
|
int argc = 0;
|
|
|
|
const boo::SystemChar** argv = (const wchar_t**)(CommandLineToArgvW(lpCmdLine, &argc));
|
|
|
|
static boo::SystemChar selfPath[1024];
|
|
|
|
GetModuleFileNameW(nullptr, selfPath, 1024);
|
|
|
|
static const boo::SystemChar* booArgv[32] = {};
|
|
|
|
booArgv[0] = selfPath;
|
|
|
|
for (int i=0 ; i<argc ; ++i)
|
|
|
|
booArgv[i+1] = argv[i];
|
|
|
|
|
|
|
|
LogVisor::CreateWin32Console();
|
|
|
|
return wmain(argc+1, booArgv);
|
|
|
|
}
|
|
|
|
#endif
|