Linux implementation. Include changes for gcc x64.

This commit is contained in:
LuisAntonRebollo 2015-01-24 22:08:26 +01:00
parent 4e52824a42
commit 4e9034854d
56 changed files with 1108 additions and 3075 deletions

View file

@ -26,10 +26,19 @@
#include "platformX86UNIX/platformX86UNIX.h"
#include "platformX86UNIX/x86UNIXStdConsole.h"
#include "platformX86UNIX/x86UNIXState.h"
extern void InitWindowingSystem();
//------------------------------------------------------------------------------
void Platform::init()
{
StdConsole::create();
stdConsole->enable(true);
// init process control stuff
ProcessControlInit();
Con::printf("Initializing platform...");
// Set the platform variable for the scripts
@ -42,69 +51,13 @@ void Platform::init()
Con::setVariable( "$platformUnixType", "Unknown" );
#endif
StdConsole::create();
Input::init();
//installRedBookDevices();
#if 0
#ifndef TORQUE_DEDICATED
// if we're not dedicated do more initialization
if (!x86UNIXState->isDedicated())
{
// init SDL
if (!InitSDL())
{
DisplayErrorAlert("Unable to initialize SDL.");
ImmediateShutdown(1);
}
Con::printf( "Video Init:" );
// load gl library
if (!GLLoader::OpenGLInit())
{
DisplayErrorAlert("Unable to initialize OpenGL.");
ImmediateShutdown(1);
}
// initialize video
Video::init();
if ( Video::installDevice( OpenGLDevice::create() ) )
Con::printf( " OpenGL display device detected." );
else
Con::printf( " OpenGL display device not detected." );
Con::printf(" ");
}
#endif
// if we are dedicated, do sleep timing and display results
if (x86UNIXState->isDedicated())
{
const S32 MaxSleepIter = 10;
U32 totalSleepTime = 0;
U32 start;
for (S32 i = 0; i < MaxSleepIter; ++i)
{
start = Platform::getRealMilliseconds();
Sleep(0, 1000000);
totalSleepTime += Platform::getRealMilliseconds() - start;
}
U32 average = static_cast<U32>(totalSleepTime / MaxSleepIter);
Con::printf("Sleep latency: %ums", average);
// dPrintf as well, since console output won't be visible yet
dPrintf("Sleep latency: %ums\n", average);
if (!x86UNIXState->getDSleep() && average < 10)
{
const char* msg = "Sleep latency ok, enabling dsleep for lower cpu " \
"utilization";
Con::printf("%s", msg);
dPrintf("%s\n", msg);
x86UNIXState->setDSleep(true);
}
}
InitWindowingSystem();
#endif
}
@ -143,7 +96,9 @@ extern "C"
extern S32 TorqueMain(S32 argc, const char **argv);
#if !defined(TORQUE_SHARED)
int main(int argc, const char **argv)
{
return TorqueMain(argc, argv);
}
#endif