cmake build system + OS X support / cleanups for Humble Release #8
|
@ -83,7 +83,8 @@ void Config::read()
|
||||||
|
|
||||||
po::variables_map vm;
|
po::variables_map vm;
|
||||||
|
|
||||||
if (confFile) {
|
if (confFile)
|
||||||
|
{
|
||||||
GUARD_ALL( po::store(po::parse_config_file(confFile, podesc, true), vm); )
|
GUARD_ALL( po::store(po::parse_config_file(confFile, podesc, true), vm); )
|
||||||
po::notify(vm);
|
po::notify(vm);
|
||||||
}
|
}
|
||||||
|
@ -107,7 +108,8 @@ void Config::readGameINI()
|
||||||
if (!customScript.empty())
|
if (!customScript.empty())
|
||||||
{
|
{
|
||||||
size_t pos = customScript.find_last_of("/\\");
|
size_t pos = customScript.find_last_of("/\\");
|
||||||
if (pos == customScript.npos) pos = 0;
|
if (pos == customScript.npos)
|
||||||
|
pos = 0;
|
||||||
game.title = customScript.substr(pos);
|
game.title = customScript.substr(pos);
|
||||||
|
|
||||||
return;
|
return;
|
||||||
|
@ -135,9 +137,11 @@ void Config::readGameINI()
|
||||||
|
|
||||||
strReplace(game.scripts, '\\', '/');
|
strReplace(game.scripts, '\\', '/');
|
||||||
|
|
||||||
if (game.title.empty()) {
|
if (game.title.empty())
|
||||||
|
{
|
||||||
size_t pos = gameFolder.find_last_of("/\\");
|
size_t pos = gameFolder.find_last_of("/\\");
|
||||||
if (pos == gameFolder.npos) pos = 0;
|
if (pos == gameFolder.npos)
|
||||||
|
pos = 0;
|
||||||
game.title = gameFolder.substr(pos);
|
game.title = gameFolder.substr(pos);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
68
src/main.cpp
68
src/main.cpp
|
@ -37,12 +37,7 @@
|
||||||
|
|
||||||
#include "binding.h"
|
#include "binding.h"
|
||||||
|
|
||||||
static const char *reqExt[] =
|
#include <unistd.h>
|
||||||
{
|
|
||||||
// Everything we are using is CORE in OpenGL 2.0 except FBOs and VAOs which we'll handle in a special function
|
|
||||||
0
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
rgssThreadError(RGSSThreadData *rtData, const std::string &msg)
|
rgssThreadError(RGSSThreadData *rtData, const std::string &msg)
|
||||||
|
@ -70,13 +65,17 @@ printGLInfo()
|
||||||
static bool
|
static bool
|
||||||
setupOptionalGLExtensions(RGSSThreadData* threadData)
|
setupOptionalGLExtensions(RGSSThreadData* threadData)
|
||||||
{
|
{
|
||||||
if (!GLEW_ARB_framebuffer_object) {
|
if (!GLEW_ARB_framebuffer_object)
|
||||||
if (!GLEW_EXT_framebuffer_object && !GLEW_EXT_framebuffer_blit) {
|
{
|
||||||
|
if (!GLEW_EXT_framebuffer_object && !GLEW_EXT_framebuffer_blit)
|
||||||
|
{
|
||||||
rgssThreadError(threadData, "GL extensions \"GL_ARB_framebuffer_object\" or compatible extensiosns GL_EXT_framebuffer_object and GL_EXT_framebuffer_blit are not present");
|
rgssThreadError(threadData, "GL extensions \"GL_ARB_framebuffer_object\" or compatible extensiosns GL_EXT_framebuffer_object and GL_EXT_framebuffer_blit are not present");
|
||||||
return false;
|
return false;
|
||||||
} else {
|
}
|
||||||
// setup compat
|
else
|
||||||
// From EXT_framebuffer_object
|
{
|
||||||
|
/* setup compat */
|
||||||
|
/* From EXT_framebuffer_object */
|
||||||
glGenRenderbuffers = glGenRenderbuffersEXT;
|
glGenRenderbuffers = glGenRenderbuffersEXT;
|
||||||
glDeleteRenderbuffers = glDeleteRenderbuffersEXT;
|
glDeleteRenderbuffers = glDeleteRenderbuffersEXT;
|
||||||
glBindRenderbuffer = glBindRenderbufferEXT;
|
glBindRenderbuffer = glBindRenderbufferEXT;
|
||||||
|
@ -88,26 +87,32 @@ setupOptionalGLExtensions(RGSSThreadData* threadData)
|
||||||
glFramebufferTexture2D = glFramebufferTexture2DEXT;
|
glFramebufferTexture2D = glFramebufferTexture2DEXT;
|
||||||
glFramebufferRenderbuffer = glFramebufferRenderbufferEXT;
|
glFramebufferRenderbuffer = glFramebufferRenderbufferEXT;
|
||||||
|
|
||||||
// From EXT_framebuffer_blit
|
/* From EXT_framebuffer_blit */
|
||||||
glBlitFramebuffer = glBlitFramebufferEXT;
|
glBlitFramebuffer = glBlitFramebufferEXT;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!GLEW_ARB_timer_query && GLEW_EXT_timer_query) {
|
if (!GLEW_ARB_timer_query && GLEW_EXT_timer_query)
|
||||||
|
{
|
||||||
glGetQueryObjecti64v = glGetQueryObjecti64vEXT;
|
glGetQueryObjecti64v = glGetQueryObjecti64vEXT;
|
||||||
glGetQueryObjectui64v = glGetQueryObjectui64vEXT;
|
glGetQueryObjectui64v = glGetQueryObjectui64vEXT;
|
||||||
}
|
}
|
||||||
if (!GLEW_ARB_vertex_array_object ) {
|
if (!GLEW_ARB_vertex_array_object )
|
||||||
if (!GLEW_APPLE_vertex_array_object) {
|
{
|
||||||
|
if (!GLEW_APPLE_vertex_array_object)
|
||||||
|
{
|
||||||
rgssThreadError(threadData, "GL extensions \"GL_ARB_vertex_array_object\" or compatible extensiosn GL_APPLE_vertex_array_object are not present");
|
rgssThreadError(threadData, "GL extensions \"GL_ARB_vertex_array_object\" or compatible extensiosn GL_APPLE_vertex_array_object are not present");
|
||||||
return false;
|
return false;
|
||||||
} else {
|
}
|
||||||
// setup compat
|
else
|
||||||
|
{
|
||||||
|
/* setup compat */
|
||||||
glBindVertexArray = glBindVertexArrayAPPLE;
|
glBindVertexArray = glBindVertexArrayAPPLE;
|
||||||
// the cast is because apple's uses const GLuint* and ARB doesn't
|
/* the cast is because apple's uses const GLuint* and ARB doesn't */
|
||||||
glGenVertexArrays = (PFNGLGENVERTEXARRAYSPROC)glGenVertexArraysAPPLE;
|
glGenVertexArrays = (PFNGLGENVERTEXARRAYSPROC)glGenVertexArraysAPPLE;
|
||||||
glDeleteVertexArrays = glDeleteVertexArraysAPPLE;
|
glDeleteVertexArrays = glDeleteVertexArraysAPPLE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -154,20 +159,9 @@ int rgssThreadFun(void *userdata)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Check for required GL extensions */
|
|
||||||
for (int i = 0; reqExt[i]; ++i)
|
|
||||||
{
|
|
||||||
if (!glewIsSupported(reqExt[i]))
|
|
||||||
{
|
|
||||||
rgssThreadError(threadData, std::string("Required GL extension \"")
|
|
||||||
+ reqExt[i] + "\" not present");
|
|
||||||
SDL_GL_DeleteContext(glCtx);
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
/* Setup optional GL extensions */
|
/* Setup optional GL extensions */
|
||||||
if (!setupOptionalGLExtensions(threadData)) {
|
if (!setupOptionalGLExtensions(threadData))
|
||||||
|
{
|
||||||
SDL_GL_DeleteContext(glCtx);
|
SDL_GL_DeleteContext(glCtx);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -232,7 +226,7 @@ int rgssThreadFun(void *userdata)
|
||||||
|
|
||||||
int main(int, char *argv[])
|
int main(int, char *argv[])
|
||||||
{
|
{
|
||||||
// initialize SDL first
|
/* initialize SDL first */
|
||||||
if (SDL_Init(SDL_INIT_VIDEO | SDL_INIT_JOYSTICK) < 0)
|
if (SDL_Init(SDL_INIT_VIDEO | SDL_INIT_JOYSTICK) < 0)
|
||||||
{
|
{
|
||||||
Debug() << "Error initializing SDL:" << SDL_GetError();
|
Debug() << "Error initializing SDL:" << SDL_GetError();
|
||||||
|
@ -240,14 +234,16 @@ int main(int, char *argv[])
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
// set working directory
|
/* set working directory */
|
||||||
char *dataDir = SDL_GetBasePath();
|
char *dataDir = SDL_GetBasePath();
|
||||||
if (dataDir) {
|
if (dataDir)
|
||||||
chdir(dataDir);
|
{
|
||||||
|
int result = chdir(dataDir);
|
||||||
|
(void)result;
|
||||||
SDL_free(dataDir);
|
SDL_free(dataDir);
|
||||||
}
|
}
|
||||||
|
|
||||||
// now we load the config
|
/* now we load the config */
|
||||||
Config conf;
|
Config conf;
|
||||||
|
|
||||||
conf.read();
|
conf.read();
|
||||||
|
|
Loading…
Reference in New Issue