// Check for DOPUS5: assignments void startup_check_assign() { BPTR lock; #if !defined(__amigaos3__) && !defined(__amigaos4__) // See if we have a DOPUS5: lock if ((lock=Lock("DOPUS5:",ACCESS_READ))) UnLock(lock); // We don't; assign it to PROGDIR: else #endif if ((lock=DupLock(GetProgramDir()))) { if (!(AssignLock("DOPUS5",lock))) UnLock(lock); } // See if we have a D5THEMES: lock if ((lock=Lock("D5THEMES:",ACCESS_READ))) UnLock(lock); // We don't; assign it to DOpus5:Themes else if ((lock=Lock("DOpus5:Themes",ACCESS_READ))) { if (!(AssignLock("D5THEMES",lock))) UnLock(lock); } }
int main(int argc, char *argv[]) { SHELLEXECUTEINFO SE; memset(&SE,0,sizeof(SE)); SE.fMask = SEE_MASK_NOCLOSEPROCESS ; char szProgramPath[MAX_PATH + 1]; GetProgramDir(szProgramPath); char szProgramDir[MAX_PATH + 1]; GetProgramDir(szProgramDir); SE.lpFile = "javaw"; //strcat(szProgramPath, "lib\\jre\\bin\\javaw"); SE.lpDirectory = szProgramDir; SE.lpParameters = "-cp \"lib/gervill.jar;lib/gluegen-rt.jar;lib/jogl.jar;lib/proxymusic-2.0.jar;lib/tablelayout.jar;lib/viewer.jar\" -Djava.library.path=\"lib/windows-i586\" com.xenoage.zong.app.ViewerMain"; SE.nShow = SW_SHOW; SE.cbSize = sizeof(SE); ShellExecuteEx(&SE); }
static const char *fullprogpath(void) { static char path[MAXPATHLEN*2]; static char prog[MAXPATHLEN]; BPTR dir; extern BOOL from_WB; /* in main.c */ // If the program name contains ':' or '/' it's not in the user's path // and probably set by using Py_SetProgramName. In that case, just // use this. If it exists! strcpy(path,Py_GetProgramName()); if(strchr(path,':') || strchr(path,'/')) { if(!isxfile(path)) { // Error; the specified file does not exist or is no exe path[0]='\0'; } return path; } // Construct the full path of our executable program. if(from_WB) { /* We're launced from WB, GetProgramName() won't work */ /* Use WB's argv[0] as the executable path */ int argc; char **argv; Py_GetArgcArgv(&argc, &argv); if(argc>0) strcpy(path,argv[0]); else strcpy(path,"!error!"); } else { /* Launced from CLI, use GetProgramName */ /* However, first check if the specified name exists */ if(!isxfile(path)) { path[0]='\0'; return path; } path[0]=0; if(dir=GetProgramDir()) { (void)NameFromLock(dir,path,MAXPATHLEN); if(!GetProgramName(prog,MAXPATHLEN)) // this is a dos.library function! strcpy(prog,"!error!"); if(!AddPart(path,prog,MAXPATHLEN*2)) strcpy(path,"!error!"); } } return path; }
/* ================= Sys_SetBinaryPath ================= */ void Sys_SetBinaryPath(const char *path) { #if defined(__AROS__) || defined(__MORPHOS__) NameFromLock(GetProgramDir(), binaryPath, sizeof(binaryPath)); #else Q_strncpyz(binaryPath, path, sizeof(binaryPath)); #endif }
/* ================= Sys_SetBinaryPath ================= */ void Sys_SetBinaryPath(const char *path) { #ifdef __AROS__ if (!strcmp(path, ".")) { NameFromLock(GetProgramDir(), binaryPath, sizeof(binaryPath)); } else #endif { Q_strncpyz(binaryPath, path, sizeof(binaryPath)); } }
int main(int argc, char *argv[]) { struct FileInfoBlock fib; UBYTE buf[256]; BPTR lock; BOOL ok; ok = GetProgramName(buf, 255); Printf("%08lx %s\n", ok, buf); lock = GetProgramDir(); ok = Examine(lock, &fib); Printf("%08lx %s\n", ok, fib.fib_FileName); return 0; }
void LoadRegistry(void) { // first set up defaults, then override any/all with stuff from registry file SetRegistryDefaults(); if (GetPrefsDir().size() > 0) registryFile = GetPrefsDir() + "Preferences"; else registryFile = GetProgramDir() + "Preferences"; auto_ptr<CNcbiIfstream> iniIn(new CNcbiIfstream(registryFile.c_str(), IOS_BASE::in | IOS_BASE::binary)); if (*iniIn) { TRACEMSG("loading program registry " << registryFile); registry.Read(*iniIn, (CNcbiRegistry::ePersistent | CNcbiRegistry::eOverride)); } registryChanged = false; }
const char *archdep_boot_path(void) { if (boot_path == NULL) { char cwd[1024]; BPTR lock; lock = GetProgramDir(); if (NameFromLock(lock, cwd, 1024)) { if (cwd[strlen(cwd) - 1] != ':') { strcat(cwd, "/"); } boot_path = lib_stralloc(cwd); } } return boot_path; }
TSimpleLemmer::TSimpleLemmer(const Stroka& path) { Stroka libPath = path; if (path.length() == 0) { Stroka prgDir = GetProgramDir(); if ((prgDir.length() > 1 && prgDir[1] == ':') || (prgDir.length() > 0 && prgDir[0] == '/')) libPath = prgDir; else libPath = GetCwd() + Stroka("/") + prgDir; SlashFolderLocal(libPath); libPath += Stroka("libmystem_c_binding.so"); //Cerr << "libPath == " << libPath << Endl; } Lib.Open(~libPath, RTLD_NOW | RTLD_DEEPBIND | RTLD_NODELETE); if (!IsInitialized()) yexception() << "Can't load lemmer from \"" << path << "\""; }
CameraParam::CameraParam() { UUIDGenerator uuidCreator; astring strId = uuidCreator.createRandom().toString(); m_Conf.set_ntype(VID_ONVIF_S); m_Conf.set_strid(strId); m_Conf.set_strname("Camera"); m_Conf.set_strip("192.168.0.1"); m_Conf.set_strport("80"); m_Conf.set_struser("admin"); m_Conf.set_strpasswd("admin"); m_Conf.set_strrtspurl("rtsp://192.168.0.1:554/Streaming"); astring filePath = GetProgramDir() + "camera.mp4"; m_Conf.set_strfile(filePath.c_str()); m_Conf.set_stronvifaddress("/onvif/device_service"); m_Conf.set_bprofiletoken(false); m_Conf.set_bhwaccel(false); m_Conf.set_strprofiletoken1("quality_h264"); m_Conf.set_strprofiletoken1("second_h264"); m_Conf.set_bhdfsrecord(false); astring *pSched = m_Conf.add_crecsched(); *pSched = REC_SCHED_ALL_DAY; m_bOnvifUrlGetted = false; m_bHasSubStream = false; m_Conf.set_nconnecttype(VID_CONNECT_TCP); m_Online = false; m_OnlineUrl = false; astring IP = m_Conf.strip(); m_strUrl = "rtsp://" + IP + ":" + "554" + "/Streaming"; m_strUrlSubStream = "rtsp://" + IP + ":" + "554" + "/Streaming"; }
DeviceParam::DeviceParam() { static int CameraNum = 0; memset(&m_Conf, 0, sizeof(m_Conf)); m_Conf.data.conf.nId = 0; m_Conf.data.conf.nType = VSC_DEVICE_CAM; m_Conf.data.conf.nSubType = VSC_SUB_DEVICE_ONVIF; sprintf(m_Conf.data.conf.Name, "Camera"); //strcpy(m_Conf.data.conf.Name, "CAMERA "); strcpy(m_Conf.data.conf.IP, "192.168.0.1"); strcpy(m_Conf.data.conf.Port, "80"); strcpy(m_Conf.data.conf.User, "admin"); strcpy(m_Conf.data.conf.Password, "admin"); strcpy(m_Conf.data.conf.RtspLocation, "/"); string filePath = GetProgramDir() + "/camera.mov"; strcpy(m_Conf.data.conf.FileLocation, filePath.c_str()); strcpy(m_Conf.data.conf.OnvifAddress, "/onvif/device_service"); strcpy(m_Conf.data.conf.CameraIndex, "1"); m_Conf.data.conf.UseProfileToken = 0; m_Conf.data.conf.Recording = 0; //TODO add default m_Conf.data.conf.Mining = 0; m_Conf.data.conf.HWAccel = 0; strcpy(m_Conf.data.conf.OnvifProfileToken, "quality_h264"); strcpy(m_Conf.data.conf.OnvifProfileToken2, "second_h264"); m_bOnvifUrlGetted = FALSE; m_bHasSubStream = FALSE; m_Online = FALSE; m_OnlineUrl = FALSE; astring IP = m_Conf.data.conf.IP; m_strUrl = "rtsp://" + IP + ":" + "554" + "/Streaming"; m_strUrlSubStream = "rtsp://" + IP + ":" + "554" + "/Streaming"; }
bfs::path Upgrader::path(int pathfork) { bfs::path path; switch (pathfork) { case DATA: path = GetDataDir(); break; case PROGRAM: path = GetProgramDir(); break; default: printf("Path not specified!\n"); } return path; }
/********************************************************** ** ** The following function saves the variable name passed in ** 'varname' to the ENV(ARC) system so that the application ** can become AmiUpdate aware. ** **********************************************************/ void SetAmiUpdateENVVariable( CONST_STRPTR varname ) { /* AmiUpdate support code */ BPTR lock; APTR oldwin; /* obtain the lock to the home directory */ if(( lock = GetProgramDir() )) { TEXT progpath[2048]; TEXT varpath[1024] = "AppPaths"; /* get a unique name for the lock, this call uses device names, as there can be multiple volumes with the same name on the system */ if( DevNameFromLock( lock, progpath, sizeof(progpath), DN_FULLPATH )) { /* stop any "Insert volume..." type requesters */ oldwin = SetProcWindow((APTR)-1); /* finally set the variable to the path the executable was run from don't forget to supply the variable name to suit your application */ AddPart( varpath, varname, 1024); SetVar( varpath, progpath, -1, GVF_GLOBAL_ONLY|GVF_SAVE_VAR ); /* turn requesters back on */ SetProcWindow( oldwin ); } } }
int main() { char tmp_path[256]=""; GetProgramDir(tmp_path,sizeof(tmp_path)-1); //初始化 char tmp_log_path[256]=""; #ifdef _WIN32 sprintf(tmp_log_path,"%s\\log",tmp_path); #else sprintf(tmp_log_path,"%s/log",tmp_path); std::stringstream tmp_ss; tmp_ss<<tmp_path<<"/server.conf"; std::string tmp_conf_file_name = tmp_ss.str(); #endif CBaseLog::GetInstance()->Init(tmp_log_path,NULL); CenterServer tmp_server; if(tmp_server.InitServer(tmp_conf_file_name)) tmp_server.StartServer(); std::cout<<"server quit"<<std::endl; return 0; }
bool Engine::RelocateWorkingDir(void) { std::string procdir = GetProgramDir(); if(procdir.length()) { if(SetWorkingDir(procdir)) { logdetail("Working directory successfully changed to program directory:"); logdetail(" '%s'", procdir.c_str()); return true; } else { logerror("Unable to change working directory to program directory:"); logerror(" '%s'", procdir.c_str()); } } else { logerror("WARNING: Unable to detect program directory! Be sure to run this from the correct path or set the working dir manually, " "otherwise the engine may not find its data and will be unable to start up!"); } return false; }
/************* * DESCRIPTION: Loads a image. Invokes the different handlers for the * picture types. Checks the first 16 Byte of the image file. * INPUT: filename name of picture to load * path picture is searched at this paths * OUTPUT: FALSE if failed *************/ BOOL IMAGE::Load(char *filename, char *path) { char name[256]; FILE *typefile; FILE *imagefile; char typebuf[18]; char imagebuf[16]; PICTURE pic; #ifdef __AMIGA__ char handlername[32]; BPTR lock; #else HINSTANCE hPicLib; READWRITEPROC picRead; char buf[256]; #endif int i; BOOL identok=FALSE; UWORD mask; /* expand path with BRUSHPATH */ if(!ExpandPath(path, filename, name)) { /* cannot open picture */ return FALSE; } /* open image and read first 16 Bytes */ imagefile = fopen(name,"rb"); if(!imagefile) return FALSE; if(fread(imagebuf,1,16,imagefile) != 16) { fclose(imagefile); return FALSE; } fclose(imagefile); #ifdef __AMIGA__ // Amiga-version: get directory RayStorm was started from and // search file from there // get a lock to the program directory lock = GetProgramDir(); // make program directory to current directory lock = CurrentDir(lock); typefile = fopen("modules/picture/types","rb"); // change current dir to old dir lock = CurrentDir(lock); #else strcpy(buf, WorkingDirectory); AddPart(buf, "modules", 256); AddPart(buf, "picture", 256); AddPart(buf, "types.dat", 256); typefile = fopen(buf, "rb"); #endif if(!typefile) { return FALSE; } while(!feof(typefile) && !identok) { // Read identification string // Format: // UWORD mask; mask for bytes to test '1'->test; lowest bit -> first byte // UBYTE id[16]; bytes to compare // char name[8]; name of module if(fread(&mask,2,1,typefile) != 1) { fclose(typefile); return FALSE; } #ifdef __SWAP__ mask = SwapW(mask); #endif if(fread(typebuf,1,16,typefile) != 16) { fclose(typefile); return FALSE; } // Compare first 16 bytes of image with identstring identok = TRUE; for(i=0; i<16; i++) { if(mask & 0x8000) { if(typebuf[i] != imagebuf[i]) { identok = FALSE; break; } } mask = mask << 1; } // Read imagename (max. 8 chars) if(fread(typebuf,1,8,typefile) != 8) { fclose(typefile); return FALSE; } } fclose(typefile); if(identok) { typebuf[8] = 0; #ifdef __AMIGA__ // open picture handler library // make program directory current directory lock = CurrentDir(lock); strcpy(handlername,"modules/picture"); AddPart(handlername,typebuf,32); #ifdef __PPC__ strcat(handlername, "ppc"); #endif // Load picture handler PicHandBase = OpenLibrary(handlername, 2L); if(!PicHandBase) return FALSE; // change current dir to old dir CurrentDir(lock); #else // load corresponding DLL strcpy(buf, WorkingDirectory); AddPart(buf, "modules", 256); AddPart(buf, "picture", 256); AddPart(buf, typebuf, 256); strcat(buf, ".dll"); if (!(hPicLib = LoadLibrary(buf))) return FALSE; if (!(picRead = (READWRITEPROC)GetProcAddress(hPicLib, "picRead_"))) return FALSE; if (!picInit()) return FALSE; #endif pic.name = name; pic.caller = NULL; pic.param = NULL; #ifdef __PPC__ pic.malloc = PPC_malloc; #else pic.malloc = malloc; #endif // __PPC__ pic.Progress = NULL; // invoke handler if(picRead(&pic)) { #ifdef __AMIGA__ // failed to load it with own modules -> try it with datatypes if(!LoadAsDatatype(name)) { // can't load it even with datatypes CloseLibrary(PicHandBase); return FALSE; } #else FreeLibrary(hPicLib); return FALSE; #endif // __AMIGA__ } else { width = pic.width; height = pic.height; colormap = pic.colormap; } // free handler library #ifdef __AMIGA__ CloseLibrary(PicHandBase); #else FreeLibrary(hPicLib); #endif // __AMIGA__ } else { #ifdef __AMIGA__ // there is no module for this picture type -> try it with datatypes if(!LoadAsDatatype(name)) { // can't load it even with datatypes return FALSE; } #else return FALSE; #endif } return TRUE; }
bool CPPageFormats::RegisterExt(CString ext, CString strLabel, bool fRegister) { CRegKey key; bool bSetValue; CString strProgID = _T("mplayerc") + ext; if(!fRegister) { if(fRegister != IsRegistered(ext)) SetFileAssociation (ext, strProgID, fRegister); key.Attach(HKEY_CLASSES_ROOT); key.RecurseDeleteKey(strProgID); return(true); } bSetValue = fRegister || (ERROR_SUCCESS != key.Open(HKEY_CLASSES_ROOT, strProgID + _T("\\shell\\open\\command"), KEY_READ)); // Create ProgID for this file type if(ERROR_SUCCESS != key.Create(HKEY_CLASSES_ROOT, strProgID)) return(false); if(ERROR_SUCCESS != key.SetStringValue(NULL, strLabel)) return(false); // Add to playlist option if(f_setContextFiles) { if(ERROR_SUCCESS != key.Create(HKEY_CLASSES_ROOT, strProgID + _T("\\shell\\enqueue"))) return(false); if(ERROR_SUCCESS != key.SetStringValue(NULL, ResStr(IDS_ADD_TO_PLAYLIST))) return(false); if(ERROR_SUCCESS != key.Create(HKEY_CLASSES_ROOT, strProgID + _T("\\shell\\enqueue\\command"))) return(false); if(bSetValue && (ERROR_SUCCESS != key.SetStringValue(NULL, GetEnqueueCommand()))) return(false); } else { key.Close(); key.Attach(HKEY_CLASSES_ROOT); key.RecurseDeleteKey(strProgID + _T("\\shell\\enqueue")); } // Play option if(ERROR_SUCCESS != key.Create(HKEY_CLASSES_ROOT, strProgID + _T("\\shell\\open"))) return(false); if(f_setContextFiles) { if(ERROR_SUCCESS != key.SetStringValue(NULL, ResStr(IDS_OPEN_WITH_MPC))) return(false); } else { if(ERROR_SUCCESS != key.SetStringValue(NULL, _T(""))) return(false); } if(ERROR_SUCCESS != key.Create(HKEY_CLASSES_ROOT, strProgID + _T("\\shell\\open\\command"))) return(false); if(bSetValue && (ERROR_SUCCESS != key.SetStringValue(NULL, GetOpenCommand()))) return(false); if(ERROR_SUCCESS != key.Create(HKEY_LOCAL_MACHINE, g_strRegisteredKey + _T("\\FileAssociations"))) return(false); if(ERROR_SUCCESS != key.SetStringValue(ext, strProgID)) return(false); if(f_setAssociatedWithIcon) { CString AppIcon = _T(""); TCHAR buff[_MAX_PATH]; CString mpciconlib = GetProgramDir() + _T("\\mpciconlib.dll"); if(FileExists(mpciconlib)) { int icon_index = GetIconIndex(ext); CString m_typeicon = mpciconlib; /* icon_index value -1 means no icon was found in the iconlib for the file extension */ if((icon_index >= 0) && ExtractIcon(AfxGetApp()->m_hInstance,(LPCWSTR)m_typeicon, icon_index)) { m_typeicon = "\""+mpciconlib+"\""; AppIcon.Format(_T("%s,%d"), m_typeicon, icon_index); } } /* no icon was found for the file extension, so use MPC's icon */ if((AppIcon.IsEmpty()) && (::GetModuleFileName(AfxGetInstanceHandle(), buff, MAX_PATH))) { AppIcon = buff; AppIcon = "\""+AppIcon+"\""; AppIcon += _T(",0"); } if(ERROR_SUCCESS != key.Create(HKEY_CLASSES_ROOT, strProgID + _T("\\DefaultIcon"))) return(false); if(bSetValue && (ERROR_SUCCESS != key.SetStringValue(NULL, AppIcon))) return(false); } else { key.Attach(HKEY_CLASSES_ROOT); key.RecurseDeleteKey(strProgID + _T("\\DefaultIcon")); } if(fRegister != IsRegistered(ext)) SetFileAssociation (ext, strProgID, fRegister); return(true); }
void Upgrader::launcher(int launchtarget, int launcharg) { if (bfs::exists(GetProgramDir() / targetswitch(launchtarget))) { #ifndef WIN32 std::stringstream pidstream; pidstream << getpid(); std::string pid = pidstream.str(); printf("Parent: %s\n", pid.c_str()); if(!fork()) { if(launchtarget!=UPGRADER) { execl((GetProgramDir() / targetswitch(launchtarget)).c_str(), targetswitch(launchtarget).c_str(), NULL); } else { std::stringstream launcher; #ifdef QT_GUI launcher << QT; #else launcher << DAEMON; #endif execl((GetProgramDir() / targetswitch(launchtarget)).c_str(), targetswitch(launchtarget).c_str(), targetswitch(launcharg).c_str() , pid.c_str(), launcher.str().c_str(), NULL); } } #else PROCESS_INFORMATION ProcessInfo; STARTUPINFO StartupInfo; ZeroMemory(&StartupInfo, sizeof(StartupInfo)); StartupInfo.cb = sizeof StartupInfo; std::string argumentstring = targetswitch(launchtarget); argumentstring.append(" "); argumentstring.append(targetswitch(launcharg)); argumentstring.append(" "); long unsigned int pid = GetCurrentProcessId(); argumentstring.append(boost::lexical_cast<std::string>(pid)); argumentstring.append(" "); #ifdef QT_GUI argumentstring.append(boost::lexical_cast<std::string>(QT)); #else argumentstring.append(boost::lexical_cast<std::string>(DAEMON)); #endif argumentstring.append(" "); char * argument = new char[argumentstring.length() + sizeof(char)]; strcpy(argument, argumentstring.c_str()); std::string programstring = (GetProgramDir() / targetswitch(launchtarget)).string(); char * program = new char[programstring.length()]; strcpy(program, programstring.c_str()); #if defined QT_GUI && defined WIN32 wchar_t* wcProgram = convertCharArrayToLPCWSTR(program); wchar_t* wcArgument = convertCharArrayToLPCWSTR(argument); CreateProcess(wcProgram, wcArgument, NULL, NULL, FALSE, 0, NULL, NULL, &StartupInfo, &ProcessInfo); #else CreateProcess(program, argument, NULL, NULL, FALSE, 0, NULL, NULL, &StartupInfo, &ProcessInfo); #endif delete argument; delete program; #endif } else { printf("Could not find %s\n", targetswitch(launchtarget).c_str()); } #ifndef UPGRADERFLAG StartShutdown(); #endif }
static void SetRegistryDefaults(void) { // default log window startup RegistrySetBoolean(REG_CONFIG_SECTION, REG_SHOW_LOG_ON_START, false); RegistrySetString(REG_CONFIG_SECTION, REG_FAVORITES_NAME, NO_FAVORITES_FILE); RegistrySetInteger(REG_CONFIG_SECTION, REG_MT_DIALOG_POS_X, 50); RegistrySetInteger(REG_CONFIG_SECTION, REG_MT_DIALOG_POS_Y, 50); RegistrySetInteger(REG_CONFIG_SECTION, REG_MT_DIALOG_SIZE_W, 400); RegistrySetInteger(REG_CONFIG_SECTION, REG_MT_DIALOG_SIZE_H, 400); // default animation controls RegistrySetInteger(REG_ANIMATION_SECTION, REG_SPIN_DELAY, 50); RegistrySetDouble(REG_ANIMATION_SECTION, REG_SPIN_INCREMENT, 2.0), RegistrySetInteger(REG_ANIMATION_SECTION, REG_FRAME_DELAY, 500); // default quality settings RegistrySetInteger(REG_QUALITY_SECTION, REG_QUALITY_ATOM_SLICES, 10); RegistrySetInteger(REG_QUALITY_SECTION, REG_QUALITY_ATOM_STACKS, 8); RegistrySetInteger(REG_QUALITY_SECTION, REG_QUALITY_BOND_SIDES, 6); RegistrySetInteger(REG_QUALITY_SECTION, REG_QUALITY_WORM_SIDES, 6); RegistrySetInteger(REG_QUALITY_SECTION, REG_QUALITY_WORM_SEGMENTS, 6); RegistrySetInteger(REG_QUALITY_SECTION, REG_QUALITY_HELIX_SIDES, 12); RegistrySetBoolean(REG_QUALITY_SECTION, REG_HIGHLIGHTS_ON, true); RegistrySetString(REG_QUALITY_SECTION, REG_PROJECTION_TYPE, "Perspective"); if (IsWindowedMode()) { // default font for OpenGL (structure window) wxFont *font = wxFont::New( #if defined(__WXMSW__) 12, #elif defined(__WXGTK__) 14, #elif defined(__WXMAC__) 14, #endif wxSWISS, wxNORMAL, wxBOLD, false); if (font && font->Ok()) RegistrySetString(REG_OPENGL_FONT_SECTION, REG_FONT_NATIVE_FONT_INFO, font->GetNativeFontInfoDesc().c_str()); else ERRORMSG("Can't create default structure window font"); if (font) delete font; // default font for sequence viewers font = wxFont::New( #if defined(__WXMSW__) 10, #elif defined(__WXGTK__) 14, #elif defined(__WXMAC__) 12, #endif wxROMAN, wxNORMAL, wxNORMAL, false); if (font && font->Ok()) RegistrySetString(REG_SEQUENCE_FONT_SECTION, REG_FONT_NATIVE_FONT_INFO, font->GetNativeFontInfoDesc().c_str()); else ERRORMSG("Can't create default sequence window font"); if (font) delete font; } // default cache settings RegistrySetBoolean(REG_CACHE_SECTION, REG_CACHE_ENABLED, true); if (GetPrefsDir().size() > 0) RegistrySetString(REG_CACHE_SECTION, REG_CACHE_FOLDER, GetPrefsDir() + "cache"); else RegistrySetString(REG_CACHE_SECTION, REG_CACHE_FOLDER, GetProgramDir() + "cache"); RegistrySetInteger(REG_CACHE_SECTION, REG_CACHE_MAX_SIZE, 25); // default advanced options RegistrySetBoolean(REG_ADVANCED_SECTION, REG_CDD_ANNOT_READONLY, true); #ifdef __WXGTK__ RegistrySetString(REG_ADVANCED_SECTION, REG_BROWSER_LAUNCH, // for launching netscape in a separate window "( netscape -noraise -remote 'openURL(<URL>,new-window)' || netscape '<URL>' ) >/dev/null 2>&1 &" // for launching netscape in an existing window // "( netscape -raise -remote 'openURL(<URL>)' || netscape '<URL>' ) >/dev/null 2>&1 &" ); #endif RegistrySetInteger(REG_ADVANCED_SECTION, REG_MAX_N_STRUCTS, 10); RegistrySetInteger(REG_ADVANCED_SECTION, REG_FOOTPRINT_RES, 0); // default stereo options RegistrySetDouble(REG_ADVANCED_SECTION, REG_STEREO_SEPARATION, 5.0); RegistrySetBoolean(REG_ADVANCED_SECTION, REG_PROXIMAL_STEREO, true); }
int main(int argc, char *argv[]) { char *rom_name; #ifdef __AMIGA__ BPTR file_lock = GetProgramDir(); SetProgramDir(file_lock); #endif signal(SIGSEGV, catch_me); #ifdef WII // SDL_Init(SDL_INIT_VIDEO | SDL_INIT_JOYSTICK | SDL_INIT_NOPARACHUTE); fatInitDefault(); #endif cf_init(); /* must be the first thing to do */ cf_init_cmd_line(); cf_open_file(NULL); /* Open Default configuration file */ rom_name=cf_parse_cmd_line(argc,argv); /* print effect/blitter list if asked by user */ if (!strcmp(CF_STR(cf_get_item_by_name("effect")),"help")) { print_effect_list(); exit(0); } if (!strcmp(CF_STR(cf_get_item_by_name("blitter")),"help")) { print_blitter_list(); exit(0); } init_sdl(); /* GP2X stuff */ #ifdef GP2X gp2x_init(); #endif if (gn_init_skin()!=SDL_TRUE) { printf("Can't load skin...\n"); exit(1); } reset_frame_skip(); if (conf.debug) conf.sound=0; /* Launch the specified game, or the rom browser if no game was specified*/ if (!rom_name) { // rom_browser_menu(); run_menu(); printf("GAME %s\n",conf.game); if (conf.game==NULL) return 0; } else { if (init_game(rom_name)!=SDL_TRUE) { printf("Can't init %s...\n",rom_name); exit(1); } } /* If asked, do a .gno dump and exit*/ if (CF_BOOL(cf_get_item_by_name("dump"))) { char dump[8+4+1]; sprintf(dump,"%s.gno",rom_name); dr_save_gno(&memory.rom,dump); close_game(); return 0; } if (conf.debug) debug_loop(); else main_loop(); close_game(); return 0; }
/************* * DESCRIPTION: Saves a image. Invokes the different handlers. * INPUT: handler handler name * param parameter to pass to saver * OUTPUT: error code *************/ int IMAGE::Save(RSICONTEXT *rc, char *handler, void *param) { char buf[256]; char error[256]; PICTURE image; #ifdef __AMIGA__ BPTR lock; char buf1[32]; int i; #endif rc->SetImageError(NULL); image.name = name; image.colormap = colormap; image.width = width; image.height = height; image.caller = NULL; image.param = param; image.malloc = malloc; image.Progress = NULL; #ifndef __AMIGA__ if (keyWritePicture) { strcpy(buf, WorkingDirectory); AddPart(buf, "modules", 256); AddPart(buf, "picture", 256); AddPart(buf, handler, 256); strcat(buf, ".dll"); if (!keyWritePicture(buf, &image, error)) { rc->SetImageError(error); return ERR_PICHANDLER; } } return ERR_NONE; #else if(KeyfileBase) { // get directory RayStorm was started from and // search file from there // get a lock to the program directory lock = GetProgramDir(); if(!NameFromLock(lock, buf, 256)) return ERR_PICHANDLER; AddPart(buf, "modules/picture", 256); // we need lower case names because library names are case sensitve i=0; strcpy(buf1, handler); while(buf1[i]) { if((buf1[i] >= 'A') && (buf1[i] <= 'Z')) buf1[i] += 'a'-'A'; i++; } AddPart(buf, buf1, 256); #ifdef __PPC__ strcat(buf, "ppc"); #endif if(!keyWritePicture(buf, &image, error)) { rc->SetImageError(error); return ERR_PICHANDLER; } } return ERR_NONE; #endif // !__AMIGA__ }