mirror of
https://github.com/blawar/GLideN64.git
synced 2024-07-07 03:13:49 +00:00
Fix compilation errors in GLideN64 on Ubuntu64
This commit is contained in:
parent
02de7a1385
commit
bb89ec2dff
|
@ -40,11 +40,12 @@ set(GLideN64_SOURCES
|
|||
)
|
||||
|
||||
include_directories( GLideNHQ )
|
||||
LINK_DIRECTORIES( ${CMAKE_CURRENT_SOURCE_DIR}/GLideNHQ/build )
|
||||
LINK_DIRECTORIES( ${CMAKE_CURRENT_SOURCE_DIR}/GLideNHQ/build64 )
|
||||
|
||||
if(MUPENPLUSAPI)
|
||||
add_definitions(
|
||||
-DMUPENPLUSAPI
|
||||
-DTXFILTER_LIB
|
||||
)
|
||||
include_directories( inc )
|
||||
set(GLideN64_SOURCES_UNIX
|
||||
|
@ -58,6 +59,7 @@ if(MUPENPLUSAPI)
|
|||
set(GLideN64_SOURCES_WIN ${GLideN64_SOURCES_UNIX}
|
||||
windows/GLFunctions.cpp
|
||||
)
|
||||
set(GLideN64_DLL_NAME mupen64plus-video-GLideN64)
|
||||
else(MUPENPLUSAPI)
|
||||
set(GLideN64_SOURCES_WIN
|
||||
ZilmarPluginAPI.cpp
|
||||
|
@ -81,6 +83,7 @@ else(MUPENPLUSAPI)
|
|||
posix/OpenGL_posix.cpp
|
||||
posix/ZilmarAPIImpl_posix.cpp
|
||||
)
|
||||
set(GLideN64_DLL_NAME GLideN64)
|
||||
endif(MUPENPLUSAPI)
|
||||
|
||||
if(UNIX)
|
||||
|
@ -167,14 +170,31 @@ SET( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${GCC_CPP11_COMPILE_FLAGS}" )
|
|||
SET(GCC_STATIC_LINK_FLAGS "-static-libgcc -static-libstdc++")
|
||||
SET( CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${GCC_STATIC_LINK_FLAGS}" )
|
||||
|
||||
add_library( GLideN64 SHARED ${GLideN64_SOURCES})
|
||||
if( CMAKE_BUILD_TYPE STREQUAL "Debug")
|
||||
add_library( ${GLideN64_DLL_NAME} SHARED ${GLideN64_SOURCES})
|
||||
|
||||
SET_TARGET_PROPERTIES(
|
||||
GLideN64
|
||||
${GLideN64_DLL_NAME}
|
||||
PROPERTIES
|
||||
LINKER_LANGUAGE CXX # Or else we get an error message, because cmake can't figure out from the ".o"-suffix that it is a C-linker we need.
|
||||
PREFIX ""
|
||||
LIBRARY_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/plugin
|
||||
LIBRARY_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/plugin/debug
|
||||
)
|
||||
|
||||
target_link_libraries(GLideN64 ${OPENGL_LIBRARIES} ${SDL_LIBRARIES} GLideNHQ )
|
||||
target_link_libraries(${GLideN64_DLL_NAME} ${OPENGL_LIBRARIES} ${SDL_LIBRARIES} GLideNHQd )
|
||||
endif( CMAKE_BUILD_TYPE STREQUAL "Debug")
|
||||
|
||||
if( CMAKE_BUILD_TYPE STREQUAL "Release")
|
||||
add_library( ${GLideN64_DLL_NAME} SHARED ${GLideN64_SOURCES})
|
||||
|
||||
SET_TARGET_PROPERTIES(
|
||||
${GLideN64_DLL_NAME}
|
||||
PROPERTIES
|
||||
LINKER_LANGUAGE CXX # Or else we get an error message, because cmake can't figure out from the ".o"-suffix that it is a C-linker we need.
|
||||
PREFIX ""
|
||||
LIBRARY_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/plugin/release
|
||||
)
|
||||
|
||||
target_link_libraries(${GLideN64_DLL_NAME} ${OPENGL_LIBRARIES} ${SDL_LIBRARIES} GLideNHQ )
|
||||
endif( CMAKE_BUILD_TYPE STREQUAL "Release")
|
||||
|
||||
|
|
31
RSP.cpp
31
RSP.cpp
|
@ -265,6 +265,32 @@ void RSP_SetDefaultState()
|
|||
gDPPipelineMode(G_PM_NPRIMITIVE);
|
||||
}
|
||||
|
||||
static
|
||||
void _findPluginPath()
|
||||
{
|
||||
#ifdef OS_WINDOWS
|
||||
GetModuleFileNameW(NULL, RSP.pluginpath, PLUGIN_PATH_SIZE);
|
||||
#elif OS_LINUX
|
||||
char path[512];
|
||||
int res = readlink("/proc/self/exe", path, 510);
|
||||
if (res != -1) {
|
||||
path[res] = 0;
|
||||
::mbstowcs(RSP.pluginpath, path, PLUGIN_PATH_SIZE);
|
||||
}
|
||||
#elif OS_MAC_OS_X
|
||||
char path[MAXPATHLEN];
|
||||
uint32_t pathLen = MAXPATHLEN*2;
|
||||
if (_NSGetExecutablePath(path, pathLen) == 0) {
|
||||
::mbstowcs(RSP.pluginpath, path, PLUGIN_PATH_SIZE);
|
||||
}
|
||||
#else
|
||||
RSP.pluginpath = L"\0";
|
||||
#endif
|
||||
wstring pluginPath(RSP.pluginpath);
|
||||
wstring::size_type pos = pluginPath.find_last_of(L"\\/");
|
||||
wcscpy(RSP.pluginpath, pluginPath.substr(0, pos).c_str());
|
||||
}
|
||||
|
||||
void RSP_Init()
|
||||
{
|
||||
#ifdef OS_WINDOWS
|
||||
|
@ -307,10 +333,7 @@ void RSP_Init()
|
|||
if (strstr(RSP.romname, (const char *)"OgreBattle64"))
|
||||
config.hacks |= hack_Ogre64;
|
||||
|
||||
GetModuleFileNameW(NULL, RSP.pluginpath, PLUGIN_PATH_SIZE);
|
||||
wstring pluginPath(RSP.pluginpath);
|
||||
wstring::size_type pos = pluginPath.find_last_of(L"\\/");
|
||||
wcscpy(RSP.pluginpath, pluginPath.substr(0, pos).c_str());
|
||||
_findPluginPath();
|
||||
|
||||
RSP_SetDefaultState();
|
||||
}
|
||||
|
|
|
@ -16,6 +16,7 @@
|
|||
#include FT_FREETYPE_H
|
||||
|
||||
#include "TextDrawer.h"
|
||||
#include "RSP.h"
|
||||
#include "Config.h"
|
||||
#include "GLSLCombiner.h"
|
||||
|
||||
|
@ -185,11 +186,14 @@ TextDrawer & TextDrawer::get() {
|
|||
static
|
||||
bool getFontFileName(char * _strName)
|
||||
{
|
||||
char * pWinPath = getenv("WINDIR");
|
||||
if (pWinPath == NULL)
|
||||
#ifdef OS_WINDOWS
|
||||
char * pSysPath = getenv("WINDIR");
|
||||
if (pSysPath == NULL)
|
||||
return false;
|
||||
// sprintf(_strName, "%s/Fonts/ARIALN.TTF", pWinPath);
|
||||
sprintf(_strName, "%s/Fonts/%s", pWinPath, config.font.name.c_str());
|
||||
sprintf(_strName, "%s/Fonts/%s", pSysPath, config.font.name.c_str());
|
||||
#else
|
||||
sprintf(_strName, "/usr/share/fonts/truetype/%s", config.font.name.c_str());
|
||||
#endif
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -201,7 +205,7 @@ void TextDrawer::init()
|
|||
if (m_pAtlas != NULL)
|
||||
return;
|
||||
|
||||
char strBuffer[MAX_PATH];
|
||||
char strBuffer[PLUGIN_PATH_SIZE];
|
||||
const char *fontfilename;
|
||||
if (getFontFileName(strBuffer))
|
||||
fontfilename = strBuffer;
|
||||
|
|
Loading…
Reference in New Issue
Block a user