fix code v5

deque
root 10 years ago
parent e27ca878a1
commit 3cd98e5259

@ -55,11 +55,16 @@ endif(EXISTS ${PROJECT_SOURCE_DIR}/.git)
include(OpenMWMacros)
if (ANDROID)
set(CMAKE_FIND_ROOT_PATH ${OPENMW_DEPENDENCIES_DIR} "${CMAKE_FIND_ROOT_PATH}")
set(CMAKE_FIND_ROOT_PATH ${OPENMW_DEPENDENCIES_DIR} "${CMAKE_FIND_ROOT_PATH}")
endif (ANDROID)
if (NOT ANDROID)
ADD_DEFINITIONS(-DNOT_ANDROID)
ADD_DEFINITIONS(-DNOT_ANDROID)
endif()
if (ANDROID)
ADD_DEFINITIONS(-DANDROID)
endif()
@ -245,7 +250,7 @@ if(OGRE_STATIC)
if (ANDROID)
add_static_ogre_plugin(RenderSystem_GLES2)
else ()
add_static_ogre_plugin(RenderSystem_GL)
add_static_ogre_plugin(RenderSystem_GL)
endif ()
if(WIN32)

@ -1,17 +1,20 @@
# local files
if (NOT ANDROID)
set(GAME
main.cpp
engine.cpp
)
else()
set(GAME
main.cpp
#ifdef ANDROID
android_main.c
#endif
android_main.c
engine.cpp
)
endif()
if(NOT WIN32 OR NOT ANDROID)
if(NOT WIN32 AND NOT ANDROID)
set(GAME ${GAME} crashcatcher.cpp)
endif()
@ -93,10 +96,11 @@ add_openmw_dir (mwbase
# Main executable
if (ANDROID)
set(BOOST_COMPONENTS system filesystem program_options thread wave atomic)
set(BOOST_COMPONENTS system filesystem program_options thread wave atomic)
else ()
set(BOOST_COMPONENTS system filesystem program_options thread wave)
set(BOOST_COMPONENTS system filesystem program_options thread wave)
endif ()
if(WIN32)
set(BOOST_COMPONENTS ${BOOST_COMPONENTS} locale)
endif(WIN32)
@ -111,14 +115,11 @@ add_executable(openmw
${APPLE_BUNDLE_RESOURCES}
)
else ()
add_library(openmw SHARED
${OPENMW_LIBS} ${OPENMW_LIBS_HEADER}
${OPENMW_FILES}
${GAME} ${GAME_HEADER}
${APPLE_BUNDLE_RESOURCES}
)
endif ()
# Sound stuff - here so CMake doesn't stupidly recompile EVERYTHING
@ -142,23 +143,20 @@ target_link_libraries(openmw
)
if (ANDROID)
target_link_libraries(openmw
${OGRE_STATIC_PLUGINS}
EGL
android
log
dl
MyGUI.OgrePlatform
MyGUIEngineStatic
Plugin_StrangeButtonStatic
cpufeatures
BulletCollision
BulletDynamics
LinearMath
${OGRE_STATIC_PLUGINS}
EGL
android
log
dl
MyGUI.OgrePlatform
MyGUIEngineStatic
Plugin_StrangeButtonStatic
cpufeatures
BulletCollision
BulletDynamics
LinearMath
)
endif (ANDROID)
if (USE_SYSTEM_TINYXML)

@ -192,9 +192,7 @@ OMW::Engine::Engine(Files::ConfigurationManager& configurationManager)
//kindly ask SDL not to trash our OGL context
//might this be related to http://bugzilla.libsdl.org/show_bug.cgi?id=748 ?
SDL_SetHint(SDL_HINT_RENDER_DRIVER, "software");
SDL_SetMainReady();
if(SDL_Init(flags) != 0)
{
throw std::runtime_error("Could not initialize SDL! " + std::string(SDL_GetError()));
@ -578,4 +576,4 @@ void OMW::Engine::setScriptBlacklist (const std::vector<std::string>& list)
void OMW::Engine::setScriptBlacklistUse (bool use)
{
mScriptBlacklistUse = use;
}
}

@ -21,7 +21,6 @@
#endif
#if OGRE_PLATFORM == OGRE_PLATFORM_LINUX || OGRE_PLATFORM == OGRE_PLATFORM_APPLE
#include <csignal>
extern int cc_install_handlers(int argc, char **argv, int num_signals, int *sigs, const char *logfile, int (*user_info)(char*, char*));
@ -406,7 +405,3 @@ int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine
return main(__argc, __argv);
}
#endif

@ -259,16 +259,14 @@ if (OGRE_STATIC)
endif ()
if (ANDROID)
set(OGRE_LIBRARIES ${OGRE_LIBRARIES} ${OGRE_LIBRARY_FWK} ${ZZip_LIBRARIES} ${ZLIB_LIBRARIES}
set(OGRE_LIBRARIES ${OGRE_LIBRARIES} ${OGRE_LIBRARY_FWK} ${ZZip_LIBRARIES} ${ZLIB_LIBRARIES}
${FreeImage_LIBRARIES} ${FREETYPE_LIBRARIES}
${Cocoa_LIBRARIES} ${Carbon_LIBRARIES})
${Cocoa_LIBRARIES} ${Carbon_LIBRARIES})
else ()
set(OGRE_LIBRARIES ${OGRE_LIBRARIES} ${OGRE_LIBRARY_FWK} ${ZZip_LIBRARIES} ${ZLIB_LIBRARIES}
set(OGRE_LIBRARIES ${OGRE_LIBRARIES} ${OGRE_LIBRARY_FWK} ${ZZip_LIBRARIES} ${ZLIB_LIBRARIES}
${FreeImage_LIBRARIES} ${FREETYPE_LIBRARIES}
${X11_LIBRARIES} ${X11_Xt_LIBRARIES} ${XAW_LIBRARY} ${X11_Xrandr_LIB}
${Cocoa_LIBRARIES} ${Carbon_LIBRARIES})
${Cocoa_LIBRARIES} ${Carbon_LIBRARIES})
endif()
if (NOT ZLIB_FOUND OR NOT ZZip_FOUND)

@ -8,7 +8,6 @@
#include <unistd.h>
#include <boost/filesystem/fstream.hpp>
namespace
{
boost::filesystem::path getUserHome()
@ -54,31 +53,23 @@ AndroidPath::AndroidPath(const std::string& application_name)
boost::filesystem::path AndroidPath::getUserConfigPath() const
{
return getEnv("XDG_CONFIG_HOME", "/sdcard/morrowind/config") / mName;
return getEnv("XDG_CONFIG_HOME", "/sdcard/morrowind/config") / mName;
}
boost::filesystem::path AndroidPath::getUserDataPath() const
{
return getEnv("XDG_DATA_HOME", "/sdcard/morrowind/share") / mName;
}
boost::filesystem::path AndroidPath::getCachePath() const
{
return getEnv("XDG_CACHE_HOME", "/sdcard/morrowind/cache") / mName;
}
boost::filesystem::path AndroidPath::getGlobalConfigPath() const
{
boost::filesystem::path globalPath("/sdcard/morrowind/");
return globalPath / mName;
boost::filesystem::path globalPath("/sdcard/morrowind/");
return globalPath / mName;
}
boost::filesystem::path AndroidPath::getLocalPath() const
@ -88,83 +79,11 @@ boost::filesystem::path AndroidPath::getLocalPath() const
boost::filesystem::path AndroidPath::getGlobalDataPath() const
{
boost::filesystem::path globalDataPath("/sdcard/morrowind/data");
return globalDataPath / mName;
boost::filesystem::path globalDataPath("/sdcard/morrowind/data");
return globalDataPath / mName;
}
boost::filesystem::path AndroidPath::getInstallPath() const
{
boost::filesystem::path installPath;
boost::filesystem::path homePath = getUserHome();
if (!homePath.empty())
{
boost::filesystem::path wineDefaultRegistry(homePath);
wineDefaultRegistry /= ".wine/system.reg";
if (boost::filesystem::is_regular_file(wineDefaultRegistry))
{
boost::filesystem::ifstream file(wineDefaultRegistry);
bool isRegEntry = false;
std::string line;
std::string mwpath;
while (std::getline(file, line))
{
if (line[0] == '[') // we found an entry
{
if (isRegEntry)
{
break;
}
isRegEntry = (line.find("Softworks\\\\Morrowind]") != std::string::npos);
}
else if (isRegEntry)
{
if (line[0] == '"') // empty line means new registry key
{
std::string key = line.substr(1, line.find('"', 1) - 1);
if (strcasecmp(key.c_str(), "Installed Path") == 0)
{
std::string::size_type valuePos = line.find('=') + 2;
mwpath = line.substr(valuePos, line.rfind('"') - valuePos);
std::string::size_type pos = mwpath.find("\\");
while (pos != std::string::npos)
{
mwpath.replace(pos, 2, "/");
pos = mwpath.find("\\", pos + 1);
}
break;
}
}
}
}
if (!mwpath.empty())
{
// Change drive letter to lowercase, so we could use
// ~/.wine/dosdevices symlinks
mwpath[0] = tolower(mwpath[0]);
installPath /= homePath;
installPath /= ".wine/dosdevices/";
installPath /= mwpath;
if (!boost::filesystem::is_directory(installPath))
{
installPath.clear();
}
}
}
}
return installPath;
}
} /* namespace Files */
#endif /* defined(__linux__) || defined(__FreeBSD__) */
#endif /* defined(__Android__) */

@ -1,5 +1,5 @@
#ifndef COMPONENTS_FILES_LINUXPATH_H
#define COMPONENTS_FILES_LINUXPATH_H
#ifndef COMPONENTS_FILES_ANDROIDPATH_H
#define COMPONENTS_FILES_ANDROIDPATH_H
#if defined(__ANDROID__)
@ -42,16 +42,11 @@ struct AndroidPath
*/
boost::filesystem::path getCachePath() const;
/**
* \brief Gets the path of the installed Morrowind version if there is one.
*/
boost::filesystem::path getInstallPath() const;
std::string mName;
};
} /* namespace Files */
#endif /* defined(__linux__) || defined(__FreeBSD__) */
#endif /* defined(__Android__) */
#endif /* COMPONENTS_FILES_LINUXPATH_H */
#endif /* COMPONENTS_FILES_ANDROIDPATH_H */

@ -9,8 +9,7 @@
#include <components/files/linuxpath.hpp>
namespace Files { typedef LinuxPath TargetPathType; }
#else
#include <components/files/androidpath.hpp>
#include <components/files/androidpath.hpp>
namespace Files { typedef AndroidPath TargetPathType; }
#endif
#elif defined(__WIN32) || defined(__WINDOWS__) || defined(_WIN32)
@ -51,6 +50,7 @@ struct FixedPath
*
* \param [in] application_name - Name of the application
*/
#ifdef NOT_ADNROID
FixedPath(const std::string& application_name)
: mPath(application_name + "/")
, mUserConfigPath(mPath.getUserConfigPath())
@ -62,7 +62,18 @@ struct FixedPath
, mCachePath(mPath.getCachePath())
{
}
#else
FixedPath(const std::string& application_name)
: mPath(application_name + "/")
, mUserConfigPath(mPath.getUserConfigPath())
, mUserDataPath(mPath.getUserDataPath())
, mGlobalConfigPath(mPath.getGlobalConfigPath())
, mLocalPath(mPath.getLocalPath())
, mGlobalDataPath(mPath.getGlobalDataPath())
, mCachePath(mPath.getCachePath())
{
}
#endif
/**
* \brief Return path pointing to the user local configuration directory.
*/
@ -92,11 +103,12 @@ struct FixedPath
return mLocalPath;
}
#ifndef NOT_ANDROID
const boost::filesystem::path& getInstallPath() const
{
return mInstallPath;
}
#endif
const boost::filesystem::path& getGlobalDataPath() const
{
return mGlobalDataPath;

@ -7,11 +7,7 @@
#include <pwd.h>
#include <unistd.h>
#include <boost/filesystem/fstream.hpp>
/*bool flag=false;
#ifdef ENABLE_PLUGIN_GLES2
flag=true;
#endif
*/
namespace
{
@ -58,34 +54,23 @@ LinuxPath::LinuxPath(const std::string& application_name)
boost::filesystem::path LinuxPath::getUserConfigPath() const
{
return getEnv("XDG_CONFIG_HOME", getUserHome() / ".config") / mName;
}
boost::filesystem::path LinuxPath::getUserDataPath() const
{
return getEnv("XDG_DATA_HOME", getUserHome() / ".local/share") / mName;
return getEnv("XDG_DATA_HOME", getUserHome() / ".local/share") / mName;
}
boost::filesystem::path LinuxPath::getCachePath() const
{
return getEnv("XDG_CACHE_HOME", getUserHome() / ".cache") / mName;
return getEnv("XDG_CACHE_HOME", getUserHome() / ".cache") / mName;
}
boost::filesystem::path LinuxPath::getGlobalConfigPath() const
{
boost::filesystem::path globalPath("/etc/");
return globalPath / mName;
boost::filesystem::path globalPath("/etc/");
return globalPath / mName;
}
boost::filesystem::path LinuxPath::getLocalPath() const
@ -95,10 +80,8 @@ boost::filesystem::path LinuxPath::getLocalPath() const
boost::filesystem::path LinuxPath::getGlobalDataPath() const
{
boost::filesystem::path globalDataPath("/usr/share/games/");
return globalDataPath / mName;
boost::filesystem::path globalDataPath("/usr/share/games/");
return globalDataPath / mName;
}
boost::filesystem::path LinuxPath::getInstallPath() const

@ -83,7 +83,7 @@ namespace OgreInit
#ifdef ENABLE_PLUGIN_GL
, mGLPlugin(NULL)
#endif
#ifdef ENABLE_PLUGIN_GLES2
#ifdef ENABLE_PLUGIN_GLES2
, mGLES2Plugin(NULL)
#endif
@ -96,19 +96,18 @@ namespace OgreInit
{
#ifdef NOT_ANDROID
// Set up logging first
new Ogre::LogManager;
Ogre::Log *log = Ogre::LogManager::getSingleton().createLog(logPath);
#if OGRE_PLATFORM == OGRE_PLATFORM_WIN32
#if OGRE_PLATFORM == OGRE_PLATFORM_WIN32
// Use custom listener only on Windows
log->addListener(new LogListener(logPath));
#endif
#endif
// Disable logging to cout/cerr
log->setDebugOutputEnabled(false);
#endif
#endif
mRoot = new Ogre::Root("", "", "");
#if defined(ENABLE_PLUGIN_GL) || (ENABLE_PLUGIN_GLES2) || defined(ENABLE_PLUGIN_Direct3D9) || defined(ENABLE_PLUGIN_CgProgramManager) || defined(ENABLE_PLUGIN_OctreeSceneManager) || defined(ENABLE_PLUGIN_ParticleFX)
@ -141,12 +140,11 @@ namespace OgreInit
delete mGLPlugin;
mGLPlugin = NULL;
#endif
#ifdef ENABLE_PLUGIN_GLES2
#ifdef ENABLE_PLUGIN_GLES2
delete mGLES2Plugin;
mGLES2Plugin = NULL;
#endif
#ifdef ENABLE_PLUGIN_Direct3D9
#endif
#ifdef ENABLE_PLUGIN_Direct3D9
delete mD3D9Plugin;
mD3D9Plugin = NULL;
#endif
@ -170,12 +168,11 @@ namespace OgreInit
mGLPlugin = new Ogre::GLPlugin();
mRoot->installPlugin(mGLPlugin);
#endif
#ifdef ENABLE_PLUGIN_GLES2
#ifdef ENABLE_PLUGIN_GLES2
mGLES2Plugin = new Ogre::GLES2Plugin();
mRoot->installPlugin(mGLES2Plugin);
#endif
#ifdef ENABLE_PLUGIN_Direct3D9
#endif
#ifdef ENABLE_PLUGIN_Direct3D9
mD3D9Plugin = new Ogre::D3D9Plugin();
mRoot->installPlugin(mD3D9Plugin);
#endif

@ -17,7 +17,6 @@
#ifdef ENABLE_PLUGIN_GL
# include "OgreGLPlugin.h"
#endif
#ifdef ENABLE_PLUGIN_GLES2
# include "OgreGLES2Plugin.h"
#endif
@ -56,9 +55,6 @@ namespace OgreInit
void loadStaticPlugins();
void loadPlugins();
void loadParticleFactories();
//bool flag1=false;
#ifdef ENABLE_PLUGIN_CgProgramManager
Ogre::CgPlugin* mCgPlugin;
@ -72,11 +68,10 @@ namespace OgreInit
#ifdef ENABLE_PLUGIN_GL
Ogre::GLPlugin* mGLPlugin;
#endif
#ifdef ENABLE_PLUGIN_GLES2
#ifdef ENABLE_PLUGIN_GLES2
Ogre::GLES2Plugin* mGLES2Plugin;
#endif
#ifdef ENABLE_PLUGIN_Direct3D9
#ifdef ENABLE_PLUGIN_Direct3D9
Ogre::D3D9Plugin* mD3D9Plugin;
#endif

@ -10,7 +10,6 @@
#if OGRE_PLATFORM == OGRE_PLATFORM_APPLE
#include "osx_utils.h"
#endif
//bool flag1=false;
namespace SFO
{
@ -41,28 +40,19 @@ SDLWindowHelper::SDLWindowHelper (SDL_Window* window, int w, int h,
//required to make OGRE play nice with our window
params.insert(std::make_pair("macAPI", "cocoa"));
params.insert(std::make_pair("macAPICocoaUseNSView", "true"));
winHandle = Ogre::StringConverter::toString(WindowContentViewHandle(wmInfo));
break;
#elif ANDROID
case SDL_SYSWM_ANDROID:
#elif ANDROID
case SDL_SYSWM_ANDROID:
winHandle = Ogre::StringConverter::toString((unsigned long)wmInfo.info.android.window);
winHandleSurface = Ogre::StringConverter::toString((unsigned long)wmInfo.info.android.surface);
break;
#else
case SDL_SYSWM_X11:
winHandle = Ogre::StringConverter::toString((unsigned long)wmInfo.info.x11.window);
break;
#endif
default:
throw std::runtime_error("Unexpected WM!");
break;
@ -70,10 +60,11 @@ SDLWindowHelper::SDLWindowHelper (SDL_Window* window, int w, int h,
/// \todo externalWindowHandle is deprecated according to the source code. Figure out a way to get parentWindowHandle
/// to work properly. On Linux/X11 it causes an occasional GLXBadDrawable error.
#ifdef ANDROID
params.insert(std::make_pair("externalSurface", winHandleSurface));
params.insert(std::make_pair("externalSurface", winHandleSurface));
#endif
params.insert(std::make_pair("externalWindowHandle", winHandle));
params.insert(std::make_pair("externalWindowHandle", winHandle));
mWindow = Ogre::Root::getSingleton().createRenderWindow(title, w, h, fullscreen, &params);
}

@ -1,5 +1,4 @@
#include "renderer.hpp"
#include "fader.hpp"
#include <SDL.h>
@ -27,9 +26,6 @@ using namespace OEngine::Render;
void OgreRenderer::cleanup()
{
delete mFader;
mFader = NULL;
if (mWindow)
Ogre::Root::getSingleton().destroyRenderTarget(mWindow);
mWindow = NULL;
@ -46,7 +42,6 @@ void OgreRenderer::cleanup()
void OgreRenderer::update(float dt)
{
mFader->update(dt);
}
void OgreRenderer::screenshot(const std::string &file)
@ -138,7 +133,7 @@ void OgreRenderer::createWindow(const std::string &title, const WindowSettings&
settings.window_x, // width, in pixels
settings.window_y, // height, in pixels
SDL_WINDOW_SHOWN
| (settings.fullscreen ? SDL_WINDOW_FULLSCREEN : 0) | SDL_WINDOW_RESIZABLE
| (settings.fullscreen ? SDL_WINDOW_FULLSCREEN : 0) | SDL_WINDOW_RESIZABLE
);
SFO::SDLWindowHelper helper(mSDLWindow, settings.window_x, settings.window_y, title, settings.fullscreen, params);
@ -161,8 +156,6 @@ void OgreRenderer::createWindow(const std::string &title, const WindowSettings&
mScene = mRoot->createSceneManager(ST_GENERIC);
mFader = new Fader(mScene);
mCamera = mScene->createCamera("cam");
// Create one viewport, entire window

Loading…
Cancel
Save