commit x64 compilation from lulu cause the other branch dont seems to compile properly at home
This commit is contained in:
79
include/platform/platform.cpp
Normal file
79
include/platform/platform.cpp
Normal file
@ -0,0 +1,79 @@
|
||||
/* -----------------------------------------------------------------------------
|
||||
GSFramework
|
||||
Copyright 2001-2013 Emmanuel Julien. All Rights Reserved.
|
||||
----------------------------------------------------------------------------- */
|
||||
|
||||
|
||||
#include "platform.h"
|
||||
#include "async/job.h"
|
||||
#include "filesystem/filesystem.h"
|
||||
#include "filesystem/io_base.h"
|
||||
#include "input/input_system.h"
|
||||
#include "licensing/licensing.h"
|
||||
#include "analytics/analytics.h"
|
||||
#include "billing/billing.h"
|
||||
#include "log/file_log.h"
|
||||
#include "log/log.h"
|
||||
|
||||
using namespace GS;
|
||||
|
||||
#define __ENABLE_PLATFORM_TRACE 0
|
||||
|
||||
template<> Platform *Singleton <Platform> ::i = NULL;
|
||||
String Platform::app_dir;
|
||||
|
||||
static int g_start_clock = 0;
|
||||
static Time g_start_time;
|
||||
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
void Platform::Trace(const char *trace, const char *source, int line)
|
||||
{
|
||||
#if __ENABLE_PLATFORM_TRACE
|
||||
static FileLog platform_trace("c:/platform_trace.log");
|
||||
platform_trace << trace << "(" << source << "@" << line << ")\n";
|
||||
#endif
|
||||
}
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
String Platform::GetAppPluginPath(const char *plugin) const
|
||||
{ return ((app_dir + "/") + plugin).CleanFilePath(); }
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
uint Types::getPOT(uint v)
|
||||
{ uint n = 1; for (; n < v; n *= 2) {} return n; }
|
||||
bool Types::isPOT(uint v)
|
||||
{ return ((v != 0) && ((v & (~v + 1)) == v)); }
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
int Platform::GetStartClock() const
|
||||
{ return g_start_clock; }
|
||||
Time Platform::GetStartTime() const
|
||||
{ return g_start_time; }
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
void Platform::Initialize()
|
||||
{
|
||||
if (initialized)
|
||||
return;
|
||||
|
||||
g_start_clock = GetClock();
|
||||
g_start_time = GetTime();
|
||||
|
||||
job_manager->CreateJobThreadPool(Types::Max(GetSystemCoreCount() - 1, 1)); // keep 1 core for the master thread
|
||||
|
||||
initialized = true;
|
||||
}
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
Platform::Platform() : initialized(false)
|
||||
{
|
||||
io = new IO::Filesystem;
|
||||
job_manager = new ASync::JobManager;
|
||||
}
|
||||
//------------------------------------------------------------------------------
|
||||
Reference in New Issue
Block a user