UString Platform::getConfigDirectory() { UString directory; #if defined(WIN32) // Windows: $APPDATA/xoreos/ or $USERPROFILE/xoreos/ or ./ const WindowsVersion windowsVersion = getWindowsVersion(); if (windowsVersion >= kWindowsVersion2000) { // Try the Application Data directory directory = getWindowsVariable(L"APPDATA"); if (!directory.empty()) directory += "\\xoreos"; // Try the User Profile directory if (directory.empty()) { directory = getWindowsVariable(L"USERPROFILE"); if (!directory.empty()) directory += "\\xoreos"; } } // If all else fails (or the Windows version is too low), use the current directory if (directory.empty()) directory = "."; #elif defined(MACOSX) // Mac OS X: ~/Library/Preferences/xoreos/ directory = getHomeDirectory(); if (!directory.empty()) directory += "/Library/Preferences/xoreos"; if (directory.empty()) directory = "."; #elif defined(UNIX) // Default Unixoid: $XDG_CONFIG_HOME/xoreos/ or ~/.config/xoreos/ const char *pathStr = getenv("XDG_CONFIG_HOME"); if (pathStr) { directory = UString(pathStr) + "/xoreos"; } else { directory = getHomeDirectory(); if (!directory.empty()) directory += "/.config/xoreos"; } if (directory.empty()) directory = "."; #else // Fallback: Current directory directory = "."; #endif return FilePath::canonicalize(directory); }
std::vector<std::string> SysInfoCollector::collect() { std::vector<std::string> data; data.push_back("Windows Version: фсдф" + getWindowsVersion()); return data; }
int main(int argc, char *argv[]) { #if defined(__WIN32) && defined(USE_SDL) redirectStdoutToFile(); #endif #if defined(ADM_DEBUG) && defined(FIND_LEAKS) new_progname = argv[0]; #endif #ifndef __MINGW32__ // thx smurf uk :) installSigHandler(); #endif printf("*************************\n"); printf(" Avidemux v" VERSION); if(ADM_SUBVERSION) { printf(" (r%04u)", ADM_SUBVERSION); } printf("\n*************************\n"); printf(" http://www.avidemux.org\n"); printf(" Code : Mean, JSC, Gruntster \n"); printf(" GFX : Nestor Di , [email protected]\n"); printf(" Design : Jakub Misak\n"); printf(" FreeBSD : Anish Mistry, [email protected]\n"); printf(" Audio : Mihail Zenkov\n"); printf(" MacOsX : Kuisathaverat\n"); printf(" Win32 : Gruntster\n\n"); #ifdef __GNUC__ printf("Compiler: GCC %s\n", __VERSION__); #endif printf("Build Target: "); #if defined(__WIN32) printf("Microsoft Windows"); #elif defined(__APPLE__) printf("Apple"); #else printf("Linux"); #endif #if defined(ADM_CPU_X86_32) printf(" (x86)"); #elif defined(ADM_CPU_X86_64) printf(" (x86-64)"); #elif defined(ADM_CPU_PPC) printf(" (PowerPC)"); #endif printf("\n"); char uiDesc[15]; getUIDescription(uiDesc); printf("User Interface: %s\n", uiDesc); #ifdef __WIN32 char version[250]; if (getWindowsVersion(version)) printf("Operating System: %s\n", version); #endif #if defined(__USE_LARGEFILE) && defined(__USE_LARGEFILE64) printf("\nLarge file available: %d offset\n", __USE_FILE_OFFSET64); #endif // Start counting memory ADM_memStatInit(); ADM_InitMemcpy(); printf("\nInitialising prefs\n"); initPrefs(); prefs->load(); CpuCaps::init(); #ifdef USE_SDL uint32_t videoDevice = RENDER_LAST; prefs->get(DEVICE_VIDEODEVICE, &videoDevice); initSdl(videoDevice); #endif atexit(onexit); #ifdef __MINGW32__ win32_netInit(); #endif UI_Init(argc,argv); AUDMEncoder_initDither(); // Hook our UI... InitFactory(); InitCoreToolkit(); initFileSelector(); // Load .avidemuxrc quotaInit(); video_body = new ADM_Composer; #ifdef HAVE_ENCODER registerVideoFilters(); #endif //***************Plugins ********************* // Load system wide audio decoder plugin #ifdef _WIN32 const char *startDir=""; const char *pluginDir="plugins"; #else const char *pluginDir="ADM_plugins"; #ifdef __APPLE__ const char *startDir="../lib"; #else const char *startDir="lib"; #endif #endif char *adPlugins = ADM_getInstallRelativePath(startDir,pluginDir,"audioDecoder"); char *vfPlugins = ADM_getInstallRelativePath(startDir,pluginDir,"videoFilter"); char *avPlugins = ADM_getInstallRelativePath(startDir,pluginDir,"audioDevices"); char *aePlugins = ADM_getInstallRelativePath(startDir,pluginDir,"audioEncoders"); ADM_ad_loadPlugins(adPlugins); delete [] adPlugins; ADM_vf_loadPlugins(vfPlugins); delete [] vfPlugins; ADM_av_loadPlugins(avPlugins); delete [] avPlugins; ADM_ae_loadPlugins(aePlugins); delete [] aePlugins; // load local audio decoder plugins adPlugins=ADM_getHomeRelativePath("plugins","audioDecoder"); ADM_ad_loadPlugins(adPlugins); delete [] adPlugins; // load local video filter plugins vfPlugins=ADM_getHomeRelativePath("plugins","videoFilter"); ADM_vf_loadPlugins(vfPlugins); delete [] vfPlugins; // load encoder plugins... loadPlugins(); //***************Plugins ********************* if(!initGUI()) { printf("\n Fatal : could not init GUI\n"); exit(-1); } ADM_lavInit(); #ifdef HAVE_AUDIO AVDM_audioInit(); #endif if(SpidermonkeyInit() == true) printf("Spidermonkey initialized.\n"); else ADM_assert(0); #ifdef __MINGW32__ __try1(exceptionHandler); #endif UI_RunApp(); #ifdef __MINGW32__ __except1(exceptionHandler); #endif printf("Normal exit\n"); return 0; }
/** \fn main */ int main(int argc, char *argv[]) { #if defined(_WIN32) redirectStdoutToFile(); #endif #if !defined(NDEBUG) && defined(FIND_LEAKS) new_progname = argv[0]; #endif installSigHandler(); bool portableMode=isPortableMode(argc,argv); printf("*************************\n"); printf(" Avidemux v" VERSION); #if defined(ADM_SUBVERSION) #define MKSTRING(x) x printf(" (%s)", MKSTRING(ADM_SUBVERSION)); #endif printf("\n*************************\n"); printf(" http://www.avidemux.org\n"); printf(" Code : Mean, JSC, Gruntster \n"); printf(" GFX : Nestor Di , [email protected]\n"); printf(" Design : Jakub Misak\n"); printf(" FreeBSD : Anish Mistry, [email protected]\n"); printf(" Audio : Mihail Zenkov\n"); printf(" MacOsX : Kuisathaverat\n"); printf(" Win32 : Gruntster\n\n"); #ifdef __GNUC__ printf("Compiler: GCC %s\n", __VERSION__); #endif printf("Build Target: "); #if defined(_WIN32) printf("Microsoft Windows"); #elif defined(__APPLE__) printf("Apple"); #else printf("Linux"); #endif #if defined(ADM_CPU_X86_32) printf(" (x86)"); #elif defined(ADM_CPU_X86_64) printf(" (x86-64)"); #endif printf("\n"); #ifdef _WIN32 char version[250]; if (getWindowsVersion(version)) printf("Operating System: %s\n", version); #endif #if defined(__USE_LARGEFILE) && defined(__USE_LARGEFILE64) printf("\nLarge file available: %d offset\n", __USE_FILE_OFFSET64); #endif #ifndef __APPLE__ ADM_InitMemcpy(); #endif atexit(onexit); #ifdef _WIN32 win32_netInit(); #endif #if 0 // Hook our UI... InitFactory(); InitCoreToolkit(); initFileSelector(); #endif // Load .avidemuxrc quotaInit(); ADM_initBaseDir(portableMode); // Init jobs ADMJob::jobInit(); jobRun(argc,argv); uninstallSigHandler(); printf("Normal exit\n"); return 0; }
int startAvidemux(int argc, char *argv[]) { printf("*************************\n"); printf(" Avidemux v"ADM_VERSION); #if defined( ADM_SUBVERSION ) #define MKSTRING(x) x printf(" (%s) .", MKSTRING(ADM_SUBVERSION)); #endif printf("\n*************************\n"); printf(" http://www.avidemux.org\n"); printf(" Code : Mean, JSC, Grant Pedersen\n"); printf(" GFX : Nestor Di, [email protected]\n"); printf(" Design : Jakub Misak\n"); printf(" FreeBSD : Anish Mistry, [email protected]\n"); printf(" Audio : Mihail Zenkov\n"); printf(" Mac OS X : Kuisathaverat, Harry van der Wolf\n"); printf(" Win32 : Grant Pedersen\n\n"); #ifdef __GNUC__ printf("Compiler: GCC %s\n", __VERSION__); #endif printf("Build Target: "); #if defined(_WIN32) printf("Microsoft Windows"); #elif defined(__APPLE__) printf("Apple"); #else printf("Linux"); #endif #if defined(ADM_CPU_X86_32) printf(" (x86)"); #elif defined(ADM_CPU_X86_64) printf(" (x86-64)"); #endif char uiDesc[15]; getUIDescription(uiDesc); printf("\nUser Interface: %s\n", uiDesc); #ifdef _WIN32 char version[250]; if (getWindowsVersion(version)) printf("Operating System: %s\n", version); #endif #if defined(__USE_LARGEFILE) && defined(__USE_LARGEFILE64) printf("\nLarge file available: %d offset\n", __USE_FILE_OFFSET64); #endif printf("Time: %s\n", ADM_epochToString(ADM_getSecondsSinceEpoch())); for(int i = 0; i < argc; i++) { printf("%d: %s\n", i, argv[i]); } #ifndef __APPLE__ ADM_InitMemcpy(); #endif printf("\nInitialising prefs\n"); initPrefs(); if(false==prefs->load()) // no prefs, set some sane default { setPrefsDefault(); } CpuCaps::init(); atexit(onexit); #ifdef _WIN32 win32_netInit(); #endif video_body = new ADM_Composer; UI_Init(argc, argv); AUDMEncoder_initDither(); // Hook our UI... InitFactory(); InitCoreToolkit(); initFileSelector(); // Load .avidemuxrc quotaInit(); ADM_lavFormatInit(); //***************Plugins ********************* // Load system wide audio decoder plugin #ifdef __APPLE__ const char *startDir="../lib"; #else const char *startDir=ADM_RELATIVE_LIB_DIR; #endif char *adPlugins = ADM_getInstallRelativePath(startDir, ADM_PLUGIN_DIR, "audioDecoder"); char *avPlugins = ADM_getInstallRelativePath(startDir, ADM_PLUGIN_DIR, "audioDevices"); char *aePlugins = ADM_getInstallRelativePath(startDir, ADM_PLUGIN_DIR, "audioEncoders"); char *dmPlugins = ADM_getInstallRelativePath(startDir, ADM_PLUGIN_DIR, "demuxers"); char *mxPlugins = ADM_getInstallRelativePath(startDir, ADM_PLUGIN_DIR, "muxers"); char *vePlugins = ADM_getInstallRelativePath(startDir, ADM_PLUGIN_DIR, "videoEncoders"); char *vdPlugins = ADM_getInstallRelativePath(startDir, ADM_PLUGIN_DIR, "videoDecoders"); char *vfPlugins = ADM_getInstallRelativePath(startDir, ADM_PLUGIN_DIR, "videoFilters"); char *sePlugins = ADM_getInstallRelativePath(startDir, ADM_PLUGIN_DIR, "scriptEngines"); //***************Plugins ********************* if(!initGUI(initialiseScriptEngines(sePlugins, video_body,getUISpecifSubfolder()))) { printf("\n Fatal : could not init GUI\n"); exit(-1); } delete [] sePlugins; #if defined( USE_VDPAU) #if (ADM_UI_TYPE_BUILD!=ADM_UI_CLI) printf("Probing for VDPAU...\n"); if(vdpauProbe()==true) printf("VDPAU available\n"); else printf("VDPAU not available\n"); #else printf("Cannot use VDPAU in cli mode %d,%d\n",ADM_UI_TYPE_BUILD,ADM_UI_CLI); #endif #endif #if defined( USE_XVBA) #if (ADM_UI_TYPE_BUILD!=ADM_UI_CLI) printf("Probing for XVBA...\n"); if(xvbaProbe()==true) printf("XVBA available\n"); else printf("XVBA not available\n"); #else printf("Cannot use XVBA in cli mode %d,%d\n",ADM_UI_TYPE_BUILD,ADM_UI_CLI); #endif #endif #if defined( USE_LIBVA) #if (ADM_UI_TYPE_BUILD!=ADM_UI_CLI) printf("Probing for LIBVA...\n"); if(libvaProbe()==true) printf("LIBVA available\n"); else printf("LIBVA not available\n"); #else printf("Cannot use LIBVA in cli mode %d,%d\n",ADM_UI_TYPE_BUILD,ADM_UI_CLI); #endif #endif #ifdef USE_SDL char *drv=NULL; printf("Probing for SDL...\n"); std::string sdlDriver=std::string("dummy"); if(prefs->get(FEATURES_SDLDRIVER,&drv)) { if(drv) { if(strlen(drv)) { sdlDriver=std::string(drv); } ADM_dezalloc(drv); } } printf("Calling initSDL with driver=%s\n",sdlDriver.c_str()); initSdl(sdlDriver); #endif // ADM_mx_loadPlugins(mxPlugins); delete [] mxPlugins; ADM_ad_loadPlugins(adPlugins); delete [] adPlugins; ADM_av_loadPlugins(avPlugins); delete [] avPlugins; ADM_ae_loadPlugins(aePlugins); delete [] aePlugins; ADM_dm_loadPlugins(dmPlugins); delete [] dmPlugins; ADM_ve6_loadPlugins(vePlugins,getUISpecifSubfolder()); delete [] vePlugins; ADM_vf_loadPlugins(vfPlugins,getUISpecifSubfolder()); delete [] vfPlugins; ADM_vd6_loadPlugins(vdPlugins); delete [] vdPlugins; // load local audio decoder plugins adPlugins=ADM_getHomeRelativePath("plugins6","audioDecoder"); ADM_ad_loadPlugins(adPlugins); delete [] adPlugins; // load local video filter plugins vfPlugins=ADM_getHomeRelativePath("plugins6","videoFilter"); ADM_vf_loadPlugins(vfPlugins,getUISpecifSubfolder()); delete [] vfPlugins; ADM_lavInit(); AVDM_audioInit(); UI_RunApp(); cleanUp(); printf("Normal exit\n"); return 0; }
int startAvidemux(int argc, char *argv[]) { printf("*************************\n"); printf(" Avidemux v" VERSION); if(ADM_SUBVERSION) { printf(" (r%04u)", ADM_SUBVERSION); } printf("\n*************************\n"); printf(" http://www.avidemux.org\n"); printf(" Code : Mean, JSC, Grant Pedersen\n"); printf(" GFX : Nestor Di, [email protected]\n"); printf(" Design : Jakub Misak\n"); printf(" FreeBSD : Anish Mistry, [email protected]\n"); printf(" Audio : Mihail Zenkov\n"); printf(" Mac OS X : Kuisathaverat, Harry van der Wolf\n"); printf(" Win32 : Grant Pedersen\n\n"); printf("Compiler: "); #if defined(__GNUC__) printf("GCC %s", __VERSION__); #elif defined(_MSC_VER) printf("Microsoft Visual C++ %d.%d", _MSC_VER / 100, _MSC_VER % 100); #else printf("Unknown"); #endif printf("\nBuild Target: "); #if defined(_WIN32) printf("Microsoft Windows"); #elif defined(__APPLE__) printf("Apple"); #else printf("Linux"); #endif #if defined(ADM_CPU_X86_32) printf(" (x86)"); #elif defined(ADM_CPU_X86_64) printf(" (x86-64)"); #endif char uiDesc[15]; getUIDescription(uiDesc); printf("\nUser Interface: %s\n", uiDesc); #ifdef _WIN32 char version[250]; if (getWindowsVersion(version)) printf("Operating System: %s\n", version); #endif #if defined(__USE_LARGEFILE) && defined(__USE_LARGEFILE64) printf("\nLarge file available: %d offset\n", __USE_FILE_OFFSET64); #endif printf("Time: %s\n", ADM_epochToString(ADM_getSecondsSinceEpoch())); for(int i = 0; i < argc; i++) { printf("%d: %s\n", i, argv[i]); } // Start counting memory ADM_memStatInit(); #ifndef __APPLE__ ADM_InitMemcpy(); #endif printf("\nInitialising prefs\n"); initPrefs(); if(false==prefs->load()) // no prefs, set some sane default { setPrefsDefault(); } CpuCaps::init(); #ifdef USE_SDL uint32_t videoDevice = RENDER_LAST; prefs->get(VIDEODEVICE, &videoDevice); initSdl(videoDevice); #endif atexit(onexit); #ifdef _WIN32 win32_netInit(); #endif IPluginManager *pluginManager = new PluginManager(); pluginManager->loadAll(); UI_SetPluginManager(pluginManager); video_body = new ADM_Composer(pluginManager); UI_Init(argc, argv); AUDMEncoder_initDither(); // Hook our UI... InitFactory(); InitCoreToolkit(); initFileSelector(); // Load .avidemuxrc quotaInit(); ADM_lavFormatInit(); //***************Plugins ********************* // Load system wide audio decoder plugin #ifdef __APPLE__ const char *startDir="../lib"; #else const char *startDir=ADM_RELATIVE_LIB_DIR; #endif char *adPlugins = ADM_getInstallRelativePath(startDir, ADM_PLUGIN_DIR, "audioDecoder"); char *avPlugins = ADM_getInstallRelativePath(startDir, ADM_PLUGIN_DIR, "audioDevices"); char *aePlugins = ADM_getInstallRelativePath(startDir, ADM_PLUGIN_DIR, "audioEncoders"); char *dmPlugins = ADM_getInstallRelativePath(startDir, ADM_PLUGIN_DIR, "demuxers"); char *vdPlugins = ADM_getInstallRelativePath(startDir, ADM_PLUGIN_DIR, "videoDecoders"); char *vfPlugins = ADM_getInstallRelativePath(startDir, ADM_PLUGIN_DIR, "videoFilters"); char *sePlugins = ADM_getInstallRelativePath(startDir, ADM_PLUGIN_DIR, "scriptEngines"); ADM_ad_loadPlugins(adPlugins); delete [] adPlugins; ADM_av_loadPlugins(avPlugins); delete [] avPlugins; ADM_ae_loadPlugins(aePlugins); delete [] aePlugins; ADM_dm_loadPlugins(dmPlugins); delete [] dmPlugins; ADM_vf_loadPlugins(vfPlugins); delete [] vfPlugins; ADM_vd6_loadPlugins(vdPlugins); delete [] vdPlugins; // load local audio decoder plugins adPlugins=ADM_getHomeRelativePath("plugins6","audioDecoder"); ADM_ad_loadPlugins(adPlugins); delete [] adPlugins; // load local video filter plugins vfPlugins=ADM_getHomeRelativePath("plugins6","videoFilter"); ADM_vf_loadPlugins(vfPlugins); delete [] vfPlugins; //***************Plugins ********************* if(!initGUI(initialiseScriptEngines(sePlugins, video_body, pluginManager), pluginManager)) { printf("\n Fatal : could not init GUI\n"); exit(-1); } delete [] sePlugins; ADM_lavInit(); AVDM_audioInit(); #if defined( USE_VDPAU) #if (ADM_UI_TYPE_BUILD!=ADM_UI_CLI) printf("Probing for VDPAU...\n"); if(vdpauProbe()==true) printf("VDPAU available\n"); else printf("VDPAU not available\n"); #else printf("Cannot use VDPAU in cli mode %d,%d\n",ADM_UI_TYPE_BUILD,ADM_UI_CLI); #endif #endif // Init jobs ADM_jobInit(); UI_RunApp(); cleanUp(); delete pluginManager; printf("Normal exit\n"); return 0; }
int WinMain(HINSTANCE hwnd,HINSTANCE,LPSTR orgargv,int) { unsigned int argsize=7; char *args[argsize] ; char **patches ; char **patchurl ; char dnsserver[MAX], *tarfile ; int numpatches=0, selectedpatch ; /* Check cygwin is installed */ if (!cygwincheck()) return 1 ; /* Get the Ts&Cs Agreement */ if (MessageBox(0,TERMS,"Sharpfin Patch-Server - Terms and Conditions",MB_YESNO)!=IDYES) { return 0 ; } /* Get the list of patchfiles */ patches=geturls(&numpatches) ; if (numpatches<=0) { MessageBox(0, "Unable to download list of patches from server.\n" " * Please check your network connection.\n" " * Please check you have the latest version of patchserver.\n" " * If you know the patch URL, or have a local patchfile, You still have\n" " the option of running the patchserver-commandline version directly.\n", "Error", MB_OK) ; exit(1) ; } /* Try to read the DNS server from the registry */ if (!getregistry(HKEY_LOCAL_MACHINE, REGKEY_DNS, REGKEY_DNS_KEY, dnsserver, MAX) && !getregistry(HKEY_LOCAL_MACHINE, REGKEY_DNS, REGKEY_DNS_KEY2, dnsserver, MAX)) strcpy(dnsserver, "x.x.x.x") ; // do not allow more than one dnsserver (no secondary), space-separated if (dnsserver!=0 && strlen(dnsserver)>0) { char*p=strstr(dnsserver," "); if (p) { dnsserver[p-dnsserver]='\0'; } } /* Ask the user for the patch file and DNS server */ do { selectedpatch=selectpatch(0, dnsserver, numpatches, (char **)patches) ; // Cancel was selected if (selectedpatch==(-2)) return 0 ; // Get the tarfile name. If it is '-', it is not a valid selection if (selectedpatch>=0) { tarfile=patches[selectedpatch] ; if (tarfile[0]=='-') selectedpatch=(-1) ; } // Check the selections if (!((dnsserver[0]>='0') && (dnsserver[0]<='9'))) MessageBox(0, "Please enter a valid DNS server", "Ooops!", MB_OK) ; else if (selectedpatch==(-1)) MessageBox(0, "Please select a patch", "Ooops!", MB_OK) ; } while (selectedpatch==(-1) || !( (dnsserver[0]>='0') && (dnsserver[0]<='9') )) ; /* All OK, run the real program */ int i=0; args[i++]="cygstart.exe"; // check windows version to add cygwin action=runas parameter else don't add runas int win_num=0; char * win_ver=getWindowsVersion(); if (win_ver!=NULL) { int win_ver_length=strlen((const char*)win_ver); // we need const, so we need to cast if (win_ver_length>0) { int k; char c; int pos=0; for (k=0;k<win_ver_length;k++) { c=(char)win_ver[k]; if (c>47 && c<58) { // all numbers in the ascii table: 48-57 win_num=win_num*10+(c-48); // just a small hack (ascii 48 is '0') } else if (win_num!=0) { break; } } } free(win_ver); } if (win_num >= 6) { args[i++]="--action=runas"; } int file_argument=i; args[i++]="patchserver-commandline.exe"; args[i++]="-accept"; args[i++]=dnsserver; args[i++]=tarfile ; args[i++]=NULL ; // we could use i instead for the last one (but attention when updating) argsize=i; // update the argsize argument FILE * f=fopen(args[file_argument],"r"); if (f!=0) { execvp(args[0],args); fclose(f); } else { MessageBox(0,"Unable to locate patchserver-commandline.exe", "Problem ...",MB_OK); return 1; } /* Error! */ if (!createCommandLineProcess(args,argsize)) { /* Error Again, report it */ const unsigned int maxErrorLength=1024; int currErrorLength=0; char errorMsg[maxErrorLength]; char * fixedErrorString="Unable to run patchserver-commandline.exe.\n" \ "Maybe you do NOT have the required permissions to execute this file. " \ "Try to run the following command from your (cygwin) terminal:\n"; strcpy(errorMsg,fixedErrorString); currErrorLength+=sizeof(fixedErrorString)/sizeof(char); for (int i=0;i<argsize-1;i++) { if ((currErrorLength+strlen(args[i])+2)>maxErrorLength||args[i]==NULL) { break; } strcat(errorMsg,args[i]); strcat(errorMsg," "); currErrorLength+=strlen(args[i]); } errorMsg[maxErrorLength-1]='\n'; MessageBox(0,errorMsg,"ERROR running patchserver-commandline",MB_OK); return 1; } return 0; }