mirror of
https://github.com/glest/glest-source.git
synced 2025-08-12 03:14:00 +02:00
- remove unused code as debian flagged it as potentially unsafe
This commit is contained in:
@@ -2906,144 +2906,13 @@ int glestMain(int argc, char** argv) {
|
|||||||
Properties::setApplicationPath(executable_path(argv[0]));
|
Properties::setApplicationPath(executable_path(argv[0]));
|
||||||
Properties::setGameVersion(glestVersionString);
|
Properties::setGameVersion(glestVersionString);
|
||||||
|
|
||||||
/*
|
|
||||||
#if defined(WIN32)
|
|
||||||
printf("Path [%s]\n",executable_path(argv[0]).c_str());
|
|
||||||
if(GlobalStaticFlags::getIsNonGraphicalModeEnabled() == false &&
|
|
||||||
folderExists(executable_path(argv[0]) + "plugins\\") == false) {
|
|
||||||
if(SystemFlags::VERBOSE_MODE_ENABLED) printf("*** VLC START ****\n");
|
|
||||||
if(SystemFlags::VERBOSE_MODE_ENABLED) printf("Trying [%s]\n",getenv("VLC_PLUGIN_PATH"));
|
|
||||||
if(getenv("VLC_PLUGIN_PATH") == NULL) {
|
|
||||||
//printf("*** VLC C ****\n");
|
|
||||||
|
|
||||||
// For windows check registry for install path
|
|
||||||
std::string strValue = getRegKey("Software\\VideoLAN\\VLC", "InstallDir");
|
|
||||||
if(strValue != "") {
|
|
||||||
if(strValue.length() >= 2) {
|
|
||||||
if(strValue[0] == '"') {
|
|
||||||
strValue = strValue.erase(0);
|
|
||||||
}
|
|
||||||
if(strValue[strValue.length()-1] == '"') {
|
|
||||||
strValue = strValue.erase(strValue.length()-1);
|
|
||||||
}
|
|
||||||
if(strValue[strValue.length()-1] != '\\') {
|
|
||||||
strValue += "\\";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
strValue += "plugins";
|
|
||||||
string newstrValue = "VLC_PLUGIN_PATH=" + strValue;
|
|
||||||
_putenv(newstrValue.c_str());
|
|
||||||
//bool result = SetEnvironmentVariableA("VLC_PLUGIN_PATH",strValue.c_str());
|
|
||||||
|
|
||||||
//Open the registry key.
|
|
||||||
wstring subKey = L"Environment";
|
|
||||||
HKEY keyHandle;
|
|
||||||
DWORD dwDisposition;
|
|
||||||
RegCreateKeyEx(HKEY_CURRENT_USER,subKey.c_str(),0, NULL, 0, KEY_ALL_ACCESS, NULL, &keyHandle, &dwDisposition);
|
|
||||||
//Set the value.
|
|
||||||
std::auto_ptr<wchar_t> wstr(Ansi2WideString(strValue.c_str()));
|
|
||||||
|
|
||||||
wstring vlcPluginPath = wstring(wstr.get());
|
|
||||||
DWORD len = (DWORD) sizeof(wchar_t) * vlcPluginPath.length() + 1;
|
|
||||||
RegSetValueEx(keyHandle, L"VLC_PLUGIN_PATH", 0, REG_SZ, (PBYTE)vlcPluginPath.c_str(), len);
|
|
||||||
RegCloseKey(keyHandle);
|
|
||||||
|
|
||||||
subKey = L"System\\CurrentControlSet\\Control\\Session Manager\\Environment";
|
|
||||||
RegCreateKeyEx(HKEY_LOCAL_MACHINE,subKey.c_str(),0, NULL, 0, KEY_ALL_ACCESS, NULL, &keyHandle, &dwDisposition);
|
|
||||||
//Set the value.
|
|
||||||
wstr.reset(Ansi2WideString(strValue.c_str()));
|
|
||||||
vlcPluginPath = wstring(wstr.get());
|
|
||||||
len = (DWORD) sizeof(wchar_t) * vlcPluginPath.length() + 1;
|
|
||||||
RegSetValueEx(keyHandle, L"VLC_PLUGIN_PATH", 0, REG_SZ, (PBYTE)vlcPluginPath.c_str(), len);
|
|
||||||
RegCloseKey(keyHandle);
|
|
||||||
|
|
||||||
RegFlushKey(keyHandle);
|
|
||||||
|
|
||||||
//string test = "SET " + newstrValue;
|
|
||||||
//system(test.c_str());
|
|
||||||
DWORD dwReturnValue=0;
|
|
||||||
LRESULT error1 = SendMessageTimeout(HWND_BROADCAST, WM_SETTINGCHANGE, 0, (LPARAM)
|
|
||||||
L"Environment", SMTO_ABORTIFHUNG, 5000, &dwReturnValue);
|
|
||||||
//SendMessageTimeout(HWND_BROADCAST, WM_SETTINGCHANGE, 0, (LPARAM) "Environment", SMTO_ABORTIFHUNG, 10000, NULL );
|
|
||||||
//SendMessageTimeout(HWND_BROADCAST, WM_SETTINGCHANGE, 0, (LPARAM) L"Environment", SMTO_ABORTIFHUNG, 10000, NULL );
|
|
||||||
//SendMessageTimeout(HWND_BROADCAST, WM_SETTINGCHANGE, 0, (LPARAM) TEXT("Environment"), SMTO_ABORTIFHUNG,10000, &dwReturnValue);
|
|
||||||
|
|
||||||
//printf("*** VLC D [%s] error1 = %d dwReturnValue = %d ****\n",getenv("VLC_PLUGIN_PATH"),error1,dwReturnValue);
|
|
||||||
if(SystemFlags::VERBOSE_MODE_ENABLED) printf("*** VLC D [%s] error1 = %d dwReturnValue = %d ****\n",getenv("VLC_PLUGIN_PATH"),error1,dwReturnValue);
|
|
||||||
//system(argv[0]);
|
|
||||||
SDL_Quit();
|
|
||||||
|
|
||||||
_flushall();
|
|
||||||
// Gotta do this or else the process hangs on exit
|
|
||||||
// Windows has no support for FD_CLOEXEC :(
|
|
||||||
fclose(stdin);
|
|
||||||
fclose(stdout);
|
|
||||||
fclose(stderr);
|
|
||||||
|
|
||||||
// int myin = _dup(_fileno(stdin));
|
|
||||||
// int myout = _dup(_fileno(stdout));
|
|
||||||
// int myerr = _dup(_fileno(stderr));
|
|
||||||
|
|
||||||
// fclose(stdin);
|
|
||||||
// fclose(stdout);
|
|
||||||
// fclose(stderr);
|
|
||||||
|
|
||||||
// _dup2(myin,0);
|
|
||||||
// _dup2(myout,1);
|
|
||||||
// _dup2(myerr,2);
|
|
||||||
|
|
||||||
//fcntl(fd, F_SETFD, FD_CLOEXEC);
|
|
||||||
//fcntl(fd, F_SETFL, fcntl(fd, F_GETFD) | FD_CLOEXEC));
|
|
||||||
|
|
||||||
const char *const *newargv = argv;
|
|
||||||
if(_execv(argv[0], newargv) == -1) {
|
|
||||||
perror("Unable to relaunch!");
|
|
||||||
}
|
|
||||||
abort();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
//fclose(stdin);
|
|
||||||
//fclose(stdout);
|
|
||||||
//fclose(stderr);
|
|
||||||
}
|
|
||||||
if(SystemFlags::VERBOSE_MODE_ENABLED) printf("*** VLC E [%s]\n",getenv("VLC_PLUGIN_PATH"));
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
*/
|
|
||||||
|
|
||||||
ServerSocket::setMaxPlayerCount(GameConstants::maxPlayers);
|
ServerSocket::setMaxPlayerCount(GameConstants::maxPlayers);
|
||||||
|
|
||||||
//vector<string> results;
|
|
||||||
//findAll("/home/softcoder/Code/megaglest/trunk/mk/linux//äöüß/maps/*.gbm", results, false, true);
|
|
||||||
//findAll("C:\\Documents and Settings\\SoftCoder\\Application Data\\人間五\\maps\\*", results, false, true);
|
|
||||||
//for(unsigned int i = 0; i < results.size(); ++i) {
|
|
||||||
// string file = results[i];
|
|
||||||
// printf("FILE: [%s]\n",file.c_str());
|
|
||||||
//}
|
|
||||||
//return -1;
|
|
||||||
|
|
||||||
if(hasCommandArgument(argc, argv,GAME_ARGS[GAME_ARG_DISABLE_BACKTRACE]) == true) {
|
if(hasCommandArgument(argc, argv,GAME_ARGS[GAME_ARG_DISABLE_BACKTRACE]) == true) {
|
||||||
disableBacktrace = true;
|
disableBacktrace = true;
|
||||||
}
|
}
|
||||||
PlatformExceptionHandler::disableBacktrace= disableBacktrace;
|
PlatformExceptionHandler::disableBacktrace= disableBacktrace;
|
||||||
|
|
||||||
// UErrorCode status = U_ZERO_ERROR;
|
|
||||||
// u_init(&status);
|
|
||||||
// if (U_SUCCESS(status)) {
|
|
||||||
// printf("everything is OK\n");
|
|
||||||
// }
|
|
||||||
// else {
|
|
||||||
// printf("error %s opening resource\n", u_errorName(status));
|
|
||||||
// }
|
|
||||||
|
|
||||||
// TEST:
|
|
||||||
//string testfile = "/home/softcoder/Code/megaglest/trunk/mk/linux/techs/megapack/factions/egypt/units/desert_camp/../../upgrades/spear_weapons/images/piercing.bmp";
|
|
||||||
//updatePathClimbingParts(testfile);
|
|
||||||
//return -1;
|
|
||||||
//CHANGED relative path from [/home/softcoder/Code/megaglest/trunk/mk/linux/techs/megapack/factions/egypt/units/desert_camp/../../upgrades/spear_weapons/images/piercing.bmp] to [/home/softcoder/Code/megaglest/trunk/mk/linux/techs/megapack/factions/egypt/units/desert_camp/upgrades/spear_weapons/images/piercing.bmp]
|
|
||||||
|
|
||||||
|
|
||||||
#if defined(CUSTOM_DATA_INSTALL_PATH)
|
#if defined(CUSTOM_DATA_INSTALL_PATH)
|
||||||
if(SystemFlags::VERBOSE_MODE_ENABLED) printf("\n\nCUSTOM_DATA_INSTALL_PATH = [%s]\n\n",formatPath(TOSTRING(CUSTOM_DATA_INSTALL_PATH)).c_str());
|
if(SystemFlags::VERBOSE_MODE_ENABLED) printf("\n\nCUSTOM_DATA_INSTALL_PATH = [%s]\n\n",formatPath(TOSTRING(CUSTOM_DATA_INSTALL_PATH)).c_str());
|
||||||
#endif
|
#endif
|
||||||
@@ -3063,11 +2932,6 @@ int glestMain(int argc, char** argv) {
|
|||||||
return 2;
|
return 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
//off_t fileSize = getFileSize(argv[0]);
|
|
||||||
//double fSize = ((double)fileSize / 1048576.0);
|
|
||||||
//printf("[%ld] [%.2f]\n",fileSize,fSize);
|
|
||||||
//return -1;
|
|
||||||
|
|
||||||
#ifdef WIN32
|
#ifdef WIN32
|
||||||
SocketManager winSockManager;
|
SocketManager winSockManager;
|
||||||
#endif
|
#endif
|
||||||
|
@@ -56,7 +56,6 @@ public:
|
|||||||
// =====================================================
|
// =====================================================
|
||||||
// Misc
|
// Misc
|
||||||
// =====================================================
|
// =====================================================
|
||||||
int MessageBox(int handle, const char *msg, const char *title, int buttons);
|
|
||||||
void message(string message);
|
void message(string message);
|
||||||
bool ask(string message);
|
bool ask(string message);
|
||||||
void exceptionMessage(const exception &excp);
|
void exceptionMessage(const exception &excp);
|
||||||
|
@@ -12,10 +12,9 @@
|
|||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include "util.h"
|
#include "util.h"
|
||||||
#include "conversion.h"
|
#include "conversion.h"
|
||||||
|
|
||||||
// For gcc backtrace on crash!
|
// For gcc backtrace on crash!
|
||||||
//#if defined(__GNUC__) && !defined(__MINGW32__) && !defined(__FreeBSD__) && !defined(BSD)
|
|
||||||
#if defined(HAS_GCC_BACKTRACE)
|
#if defined(HAS_GCC_BACKTRACE)
|
||||||
//#include <mcheck.h>
|
|
||||||
|
|
||||||
#include <execinfo.h>
|
#include <execinfo.h>
|
||||||
#include <cxxabi.h>
|
#include <cxxabi.h>
|
||||||
@@ -34,20 +33,6 @@ namespace Shared{ namespace Platform{
|
|||||||
string PlatformExceptionHandler::application_binary="";
|
string PlatformExceptionHandler::application_binary="";
|
||||||
bool PlatformExceptionHandler::disableBacktrace = false;
|
bool PlatformExceptionHandler::disableBacktrace = false;
|
||||||
|
|
||||||
// This was the simplest, most portable solution i could find in 5 mins for linux
|
|
||||||
int MessageBox(int handle, const char *msg, const char *title, int buttons) {
|
|
||||||
char cmd[8096]="";
|
|
||||||
snprintf(cmd, 8096,"gdialog --title \"%s\" --msgbox \"%s\"", title, msg);
|
|
||||||
|
|
||||||
//if(fork()==0){
|
|
||||||
//close(1); close(2);
|
|
||||||
int ret = system(cmd);
|
|
||||||
//exit(0);
|
|
||||||
//}
|
|
||||||
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
|
|
||||||
void message(string message) {
|
void message(string message) {
|
||||||
std::cerr << "******************************************************\n";
|
std::cerr << "******************************************************\n";
|
||||||
std::cerr << " " << message << "\n";
|
std::cerr << " " << message << "\n";
|
||||||
@@ -63,17 +48,14 @@ bool ask(string message) {
|
|||||||
|
|
||||||
void exceptionMessage(const exception &excp) {
|
void exceptionMessage(const exception &excp) {
|
||||||
std::cerr << "Exception: " << excp.what() << std::endl;
|
std::cerr << "Exception: " << excp.what() << std::endl;
|
||||||
//int result = MessageBox(NULL, excp.what(), "Error", 0);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//#if defined(__GNUC__) && !defined(__FreeBSD__) && !defined(BSD)
|
|
||||||
#if defined(HAS_GCC_BACKTRACE)
|
#if defined(HAS_GCC_BACKTRACE)
|
||||||
static int getFileAndLine(char *function, void *address, char *file, size_t flen) {
|
static int getFileAndLine(char *function, void *address, char *file, size_t flen) {
|
||||||
int line=-1;
|
int line=-1;
|
||||||
if(PlatformExceptionHandler::application_binary != "") {
|
if(PlatformExceptionHandler::application_binary != "") {
|
||||||
const int maxbufSize = 8096;
|
const int maxbufSize = 8096;
|
||||||
char buf[maxbufSize+1]="";
|
char buf[maxbufSize+1]="";
|
||||||
//char *p=NULL;
|
|
||||||
|
|
||||||
// prepare command to be executed
|
// prepare command to be executed
|
||||||
// our program need to be passed after the -e parameter
|
// our program need to be passed after the -e parameter
|
||||||
@@ -166,7 +148,6 @@ string PlatformExceptionHandler::getStackTrace() {
|
|||||||
return errMsg;
|
return errMsg;
|
||||||
}
|
}
|
||||||
|
|
||||||
//#if defined(__GNUC__) && !defined(__MINGW32__) && !defined(__FreeBSD__) && !defined(BSD)
|
|
||||||
#if defined(HAS_GCC_BACKTRACE)
|
#if defined(HAS_GCC_BACKTRACE)
|
||||||
// if(disableBacktrace == false && sdl_quitCalled == false) {
|
// if(disableBacktrace == false && sdl_quitCalled == false) {
|
||||||
//errMsg = "\nStack Trace:\n";
|
//errMsg = "\nStack Trace:\n";
|
||||||
|
Reference in New Issue
Block a user