mirror of
				https://github.com/vcmi/vcmi.git
				synced 2025-10-31 00:07:39 +02:00 
			
		
		
		
	VCMIDirs update #5 fix
- Updated old OS detect macros. - Fixed 1 misspell.
This commit is contained in:
		| @@ -7,7 +7,7 @@ | ||||
| #define strcpy_s(a, b, c) strncpy(a, c, b) | ||||
| #endif | ||||
|  | ||||
| #ifdef __ANDROID__ | ||||
| #ifdef VCMI_ANDROID | ||||
| #define GetGlobalAiVersion BattleAI_GetGlobalAiVersion | ||||
| #define GetAiName BattleAI_GetAiName | ||||
| #define GetNewBattleAI BattleAI_GetNewBattleAI | ||||
|   | ||||
| @@ -7,7 +7,7 @@ | ||||
| #define strcpy_s(a, b, c) strncpy(a, c, b) | ||||
| #endif | ||||
|  | ||||
| #ifdef __ANDROID__ | ||||
| #ifdef VCMI_ANDROID | ||||
| #define GetGlobalAiVersion StupidAI_GetGlobalAiVersion | ||||
| #define GetAiName StupidAI_GetAiName | ||||
| #define GetNewBattleAI StupidAI_GetNewBattleAI | ||||
|   | ||||
| @@ -5,7 +5,7 @@ | ||||
| #define strcpy_s(a, b, c) strncpy(a, c, b) | ||||
| #endif | ||||
|  | ||||
| #ifdef __ANDROID__ | ||||
| #ifdef VCMI_ANDROID | ||||
| #define GetGlobalAiVersion VCAI_GetGlobalAiVersion | ||||
| #define GetAiName VCAI_GetAiName | ||||
| #define GetNewAI VCAI_GetNewAI | ||||
|   | ||||
| @@ -40,7 +40,7 @@ | ||||
| #include "gui/CGuiHandler.h" | ||||
| #include "../lib/logging/CBasicLogConfigurator.h" | ||||
|  | ||||
| #ifdef _WIN32 | ||||
| #ifdef VCMI_WINDOWS | ||||
| #include "SDL_syswm.h" | ||||
| #endif | ||||
| #include "../lib/UnlockGuard.h" | ||||
| @@ -99,7 +99,7 @@ static void mainLoop(); | ||||
| void startGame(StartInfo * options, CConnection *serv = nullptr); | ||||
| void endGame(); | ||||
|  | ||||
| #ifndef _WIN32 | ||||
| #ifndef VCMI_WINDOWS | ||||
| #ifndef _GNU_SOURCE | ||||
| #define _GNU_SOURCE | ||||
| #endif | ||||
| @@ -182,19 +182,19 @@ static void prog_help(const po::options_description &opts) | ||||
| // 	printf("  -v, --version     display version information and exit\n"); | ||||
| } | ||||
|  | ||||
| #ifdef __APPLE__ | ||||
| #ifdef VCMI_APPLE | ||||
| void OSX_checkForUpdates(); | ||||
| #endif | ||||
|  | ||||
| #if defined(_WIN32) && !defined (__GNUC__) | ||||
| #if defined(VCMI_WINDOWS) && !defined (__GNUC__) | ||||
| int wmain(int argc, wchar_t* argv[]) | ||||
| #elif defined(__APPLE__) | ||||
| #elif defined(VCMI_APPLE) | ||||
| int SDL_main(int argc, char *argv[]) | ||||
| #else | ||||
| int main(int argc, char** argv) | ||||
| #endif | ||||
| { | ||||
| #ifdef __APPLE__ | ||||
| #ifdef VCMI_APPLE | ||||
| 	// Correct working dir executable folder (not bundle folder) so we can use executable relative paths | ||||
|     std::string executablePath = argv[0]; | ||||
|     std::string workDir = executablePath.substr(0, executablePath.rfind('/')); | ||||
| @@ -387,7 +387,7 @@ int main(int argc, char** argv) | ||||
|  | ||||
|     logGlobal->infoStream()<<"\tInitializing video: "<<pomtime.getDiff(); | ||||
|  | ||||
| #if defined(__ANDROID__) | ||||
| #if defined(VCMI_ANDROID) | ||||
| 	//on Android threaded init is broken | ||||
| 	#define VCMI_NO_THREADED_LOAD | ||||
| #endif // defined | ||||
| @@ -711,7 +711,7 @@ void processCommand(const std::string &message) | ||||
| 		{ | ||||
| 			CDefEssential * cde = CDefHandler::giveDefEss(URI); | ||||
|  | ||||
| 			const bfs::path outPath = VCMIDirs::get().userCachePath() / "extraced" / URI; | ||||
| 			const bfs::path outPath = VCMIDirs::get().userCachePath() / "extracted" / URI; | ||||
| 			bfs::create_directories(outPath); | ||||
|  | ||||
| 			for (size_t i = 0; i < cde->ourImages.size(); ++i) | ||||
| @@ -1010,7 +1010,7 @@ static void setScreenRes(int w, int h, int bpp, bool fullscreen, bool resetVideo | ||||
| 	SDL_ShowCursor(SDL_DISABLE); | ||||
| 	SDL_EnableKeyRepeat(SDL_DEFAULT_REPEAT_DELAY, SDL_DEFAULT_REPEAT_INTERVAL); | ||||
|  | ||||
| #ifdef _WIN32 | ||||
| #ifdef VCMI_WINDOWS | ||||
| 	SDL_SysWMinfo wm; | ||||
| 	SDL_VERSION(&wm.version); | ||||
| 	int getwm = SDL_GetWMInfo(&wm); | ||||
|   | ||||
| @@ -23,7 +23,7 @@ static bool keyDown() | ||||
| } | ||||
| #endif | ||||
|  | ||||
| #if defined(_WIN32)  &&  (_MSC_VER < 1800 ||  !defined(USE_FFMPEG)) | ||||
| #if defined(VCMI_WINDOWS)  &&  (_MSC_VER < 1800 ||  !defined(USE_FFMPEG)) | ||||
|  | ||||
| void checkForError(bool throwing = true) | ||||
| { | ||||
|   | ||||
| @@ -43,7 +43,7 @@ public: | ||||
| }; | ||||
|  | ||||
|  | ||||
| #if defined(_WIN32)  &&  (_MSC_VER < 1800 ||  !defined(USE_FFMPEG)) | ||||
| #if defined(VCMI_WINDOWS)  &&  (_MSC_VER < 1800 ||  !defined(USE_FFMPEG)) | ||||
|  | ||||
| #define WIN32_LEAN_AND_MEAN //excludes rarely used stuff from windows headers - delete this line if something is missing | ||||
| #include <windows.h> | ||||
|   | ||||
| @@ -17,7 +17,7 @@ | ||||
| #include "../lib/CBuildingHandler.h" | ||||
| #include "../lib/CSpellHandler.h" | ||||
| #include "../lib/Connection.h" | ||||
| #ifndef __ANDROID__ | ||||
| #ifndef VCMI_ANDROID | ||||
| #include "../lib/Interprocess.h" | ||||
| #endif | ||||
| #include "../lib/NetPacks.h" | ||||
| @@ -37,7 +37,7 @@ | ||||
| #include "CMT.h" | ||||
|  | ||||
| extern std::string NAME; | ||||
| #ifndef __ANDROID__ | ||||
| #ifndef VCMI_ANDROID | ||||
| namespace intpr = boost::interprocess; | ||||
| #endif | ||||
|  | ||||
| @@ -811,7 +811,7 @@ void CServerHandler::waitForServer() | ||||
| 		startServer(); | ||||
|  | ||||
| 	th.update(); | ||||
| #ifndef __ANDROID__ | ||||
| #ifndef VCMI_ANDROID | ||||
| 	intpr::scoped_lock<intpr::interprocess_mutex> slock(shared->sr->mutex); | ||||
| 	while(!shared->sr->ready) | ||||
| 	{ | ||||
| @@ -824,7 +824,7 @@ void CServerHandler::waitForServer() | ||||
|  | ||||
| CConnection * CServerHandler::connectToServer() | ||||
| { | ||||
| #ifndef __ANDROID__ | ||||
| #ifndef VCMI_ANDROID | ||||
| 	if(!shared->sr->ready) | ||||
| 		waitForServer(); | ||||
| #else | ||||
| @@ -847,7 +847,7 @@ CServerHandler::CServerHandler(bool runServer /*= false*/) | ||||
| 	port = boost::lexical_cast<std::string>(settings["server"]["port"].Float()); | ||||
| 	verbose = true; | ||||
|  | ||||
| #ifndef __ANDROID__ | ||||
| #ifndef VCMI_ANDROID | ||||
| 	boost::interprocess::shared_memory_object::remove("vcmi_memory"); //if the application has previously crashed, the memory may not have been removed. to avoid problems - try to destroy it | ||||
| 	try | ||||
| 	{ | ||||
|   | ||||
| @@ -50,7 +50,7 @@ DLL_LINKAGE CConsoleHandler * console = nullptr; | ||||
|  | ||||
| static TColor defColor; | ||||
|  | ||||
| #ifdef _WIN32 | ||||
| #ifdef VCMI_WINDOWS | ||||
|  | ||||
| void printWinError() | ||||
| { | ||||
| @@ -200,7 +200,7 @@ int CConsoleHandler::run() | ||||
|  | ||||
| 	while ( std::cin.good() ) | ||||
| 	{ | ||||
| #ifndef _WIN32 | ||||
| #ifndef VCMI_WINDOWS | ||||
| 		//check if we have some unreaded symbols | ||||
| 		if (std::cin.rdbuf()->in_avail()) | ||||
| 		{ | ||||
| @@ -222,7 +222,7 @@ int CConsoleHandler::run() | ||||
| } | ||||
| CConsoleHandler::CConsoleHandler() : thread(nullptr) | ||||
| { | ||||
| #ifdef _WIN32 | ||||
| #ifdef VCMI_WINDOWS | ||||
| 	handleIn = GetStdHandle(STD_INPUT_HANDLE); | ||||
| 	handleOut = GetStdHandle(STD_OUTPUT_HANDLE); | ||||
| 	handleErr = GetStdHandle(STD_ERROR_HANDLE); | ||||
| @@ -252,7 +252,7 @@ void CConsoleHandler::end() | ||||
| { | ||||
| 	if (thread) | ||||
| 	{ | ||||
| #ifndef _WIN32 | ||||
| #ifndef VCMI_WINDOWS | ||||
| 		thread->interrupt(); | ||||
| #else | ||||
| 		TerminateThread(thread->native_handle(),0); | ||||
|   | ||||
| @@ -38,7 +38,7 @@ public: | ||||
|     template<typename T> void print(const T &data, bool addNewLine = false, EConsoleTextColor::EConsoleTextColor color = EConsoleTextColor::DEFAULT, bool printToStdErr = false) | ||||
| 	{ | ||||
|         TLockGuard _(smx); | ||||
| #ifndef _WIN32 | ||||
| #ifndef VCMI_WINDOWS | ||||
| 		// with love from ffmpeg - library is trying to print some warnings from separate thread | ||||
| 		// this results in broken console on Linux. Lock stdout to print all our data at once | ||||
| 		flockfile(stdout); | ||||
| @@ -70,7 +70,7 @@ public: | ||||
|         } | ||||
|  | ||||
|         if(color != EConsoleTextColor::DEFAULT) setColor(EConsoleTextColor::DEFAULT); | ||||
| #ifndef _WIN32 | ||||
| #ifndef VCMI_WINDOWS | ||||
| 		funlockfile(stdout); | ||||
| #endif | ||||
| 	} | ||||
|   | ||||
| @@ -1,9 +1,9 @@ | ||||
| #include "StdInc.h" | ||||
| #include "CThreadHelper.h" | ||||
|  | ||||
| #ifdef _WIN32 | ||||
| #ifdef VCMI_WINDOWS | ||||
| 	#include <windows.h> | ||||
| #elif !defined(__APPLE__) | ||||
| #elif !defined(VCMI_APPLE) | ||||
| 	#include <sys/prctl.h> | ||||
| #endif | ||||
| /* | ||||
| @@ -49,7 +49,7 @@ void CThreadHelper::processTasks() | ||||
| // NOTE: on *nix string will be trimmed to 16 symbols | ||||
| void setThreadName(const std::string &name) | ||||
| { | ||||
| #ifdef _WIN32 | ||||
| #ifdef VCMI_WINDOWS | ||||
| #ifndef __GNUC__ | ||||
| 	//follows http://msdn.microsoft.com/en-us/library/xcb2z8hs.aspx | ||||
| 	const DWORD MS_VC_EXCEPTION=0x406D1388; | ||||
|   | ||||
| @@ -18,7 +18,7 @@ | ||||
| #include "CVCMIServer.h" | ||||
| #include "../lib/StartInfo.h" | ||||
| #include "../lib/mapping/CMap.h" | ||||
| #ifndef __ANDROID__ | ||||
| #ifndef VCMI_ANDROID | ||||
| #include "../lib/Interprocess.h" | ||||
| #endif | ||||
| #include "../lib/VCMI_Lib.h" | ||||
| @@ -32,7 +32,7 @@ | ||||
|  | ||||
| #include "../lib/UnlockGuard.h" | ||||
|  | ||||
| #if defined(__GNUC__) && !defined (__MINGW32__) && !defined(__ANDROID__) | ||||
| #if defined(__GNUC__) && !defined (__MINGW32__) && !defined(VCMI_ANDROID) | ||||
| #include <execinfo.h> | ||||
| #endif | ||||
|  | ||||
| @@ -41,7 +41,7 @@ std::string NAME = GameConstants::VCMI_VERSION + std::string(" (") + NAME_AFFIX | ||||
| using namespace boost; | ||||
| using namespace boost::asio; | ||||
| using namespace boost::asio::ip; | ||||
| #ifndef __ANDROID__ | ||||
| #ifndef VCMI_ANDROID | ||||
| namespace intpr = boost::interprocess; | ||||
| #endif | ||||
| bool end2 = false; | ||||
| @@ -393,7 +393,7 @@ void CVCMIServer::newPregame() | ||||
|  | ||||
| void CVCMIServer::start() | ||||
| { | ||||
| #ifndef __ANDROID__ | ||||
| #ifndef VCMI_ANDROID | ||||
| 	ServerReady *sr = nullptr; | ||||
| 	intpr::mapped_region *mr; | ||||
| 	try | ||||
| @@ -416,7 +416,7 @@ void CVCMIServer::start() | ||||
|     logNetwork->infoStream()<<"Listening for connections at port " << acceptor->local_endpoint().port(); | ||||
| 	auto  s = new tcp::socket(acceptor->get_io_service()); | ||||
| 	boost::thread acc(std::bind(vaccept,acceptor,s,&error)); | ||||
| #ifndef __ANDROID__ | ||||
| #ifndef VCMI_ANDROID | ||||
| 	sr->setToTrueAndNotify(); | ||||
| 	delete mr; | ||||
| #endif | ||||
| @@ -560,7 +560,7 @@ static void handleCommandOptions(int argc, char *argv[]) | ||||
| 	} | ||||
| } | ||||
|  | ||||
| #if defined(__GNUC__) && !defined (__MINGW32__) && !defined(__ANDROID__) | ||||
| #if defined(__GNUC__) && !defined (__MINGW32__) && !defined(VCMI_ANDROID) | ||||
| void handleLinuxSignal(int sig) | ||||
| { | ||||
| 	const int STACKTRACE_SIZE = 100; | ||||
| @@ -591,7 +591,7 @@ int main(int argc, char** argv) | ||||
| { | ||||
| 	// Installs a sig sev segmentation violation handler | ||||
| 	// to log stacktrace | ||||
| 	#if defined(__GNUC__) && !defined (__MINGW32__) && !defined(__ANDROID__) | ||||
| 	#if defined(__GNUC__) && !defined (__MINGW32__) && !defined(VCMI_ANDROID) | ||||
| 	signal(SIGSEGV, handleLinuxSignal); | ||||
| 	#endif | ||||
|  | ||||
|   | ||||
		Reference in New Issue
	
	Block a user