fix code v5

pull/203/head
root 10 years ago
parent e27ca878a1
commit 3cd98e5259

@ -63,6 +63,11 @@ ADD_DEFINITIONS(-DNOT_ANDROID)
endif()
if (ANDROID)
ADD_DEFINITIONS(-DANDROID)
endif()
# doxygen main page
configure_file ("${OpenMW_SOURCE_DIR}/docs/mainpage.hpp.cmake" "${OpenMW_SOURCE_DIR}/docs/mainpage.hpp")

@ -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
engine.cpp
)
endif()
if(NOT WIN32 OR NOT ANDROID)
if(NOT WIN32 AND NOT ANDROID)
set(GAME ${GAME} crashcatcher.cpp)
endif()
@ -97,6 +100,7 @@ set(BOOST_COMPONENTS system filesystem program_options thread wave atomic)
else ()
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,8 +143,6 @@ target_link_libraries(openmw
)
if (ANDROID)
target_link_libraries(openmw
${OGRE_STATIC_PLUGINS}
EGL
@ -158,7 +157,6 @@ 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()));

@ -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

@ -261,12 +261,10 @@ if (OGRE_STATIC)
if (ANDROID)
set(OGRE_LIBRARIES ${OGRE_LIBRARIES} ${OGRE_LIBRARY_FWK} ${ZZip_LIBRARIES} ${ZLIB_LIBRARIES}
${FreeImage_LIBRARIES} ${FREETYPE_LIBRARIES}
${Cocoa_LIBRARIES} ${Carbon_LIBRARIES})
else ()
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})
endif()

@ -8,7 +8,6 @@
#include <unistd.h>
#include <boost/filesystem/fstream.hpp>
namespace
{
boost::filesystem::path getUserHome()
@ -54,30 +53,22 @@ AndroidPath::AndroidPath(const std::string& application_name)
boost::filesystem::path AndroidPath::getUserConfigPath() const
{
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;
}
@ -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 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,7 +9,6 @@
#include <components/files/linuxpath.hpp>
namespace Files { typedef LinuxPath TargetPathType; }
#else
#include <components/files/androidpath.hpp>
namespace Files { typedef AndroidPath TargetPathType; }
#endif
@ -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,33 +54,22 @@ 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;
}
boost::filesystem::path LinuxPath::getCachePath() const
{
return getEnv("XDG_CACHE_HOME", getUserHome() / ".cache") / mName;
}
boost::filesystem::path LinuxPath::getGlobalConfigPath() const
{
boost::filesystem::path globalPath("/etc/");
return globalPath / mName;
}
@ -95,9 +80,7 @@ boost::filesystem::path LinuxPath::getLocalPath() const
boost::filesystem::path LinuxPath::getGlobalDataPath() const
{
boost::filesystem::path globalDataPath("/usr/share/games/");
return globalDataPath / mName;
}

@ -96,7 +96,6 @@ namespace OgreInit
{
#ifdef NOT_ANDROID
// Set up logging first
new Ogre::LogManager;
Ogre::Log *log = Ogre::LogManager::getSingleton().createLog(logPath);
@ -145,7 +144,6 @@ namespace OgreInit
delete mGLES2Plugin;
mGLES2Plugin = NULL;
#endif
#ifdef ENABLE_PLUGIN_Direct3D9
delete mD3D9Plugin;
mD3D9Plugin = NULL;
@ -174,7 +172,6 @@ namespace OgreInit
mGLES2Plugin = new Ogre::GLES2Plugin();
mRoot->installPlugin(mGLES2Plugin);
#endif
#ifdef ENABLE_PLUGIN_Direct3D9
mD3D9Plugin = new Ogre::D3D9Plugin();
mRoot->installPlugin(mD3D9Plugin);

@ -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;
@ -75,7 +71,6 @@ namespace OgreInit
#ifdef ENABLE_PLUGIN_GLES2
Ogre::GLES2Plugin* mGLES2Plugin;
#endif
#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:
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,6 +60,7 @@ 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));
#endif

@ -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)
@ -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