• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C++ LoadFile函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中LoadFile函数的典型用法代码示例。如果您正苦于以下问题:C++ LoadFile函数的具体用法?C++ LoadFile怎么用?C++ LoadFile使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了LoadFile函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: common_boot


//.........这里部分代码省略.........
			}
			
			ret = GetFileInfo("/System/Library/", "Extensions", &flags, &exttime);
			if ((ret == 0) && ((flags & kFileTypeMask) == kFileTypeDirectory)
				&& (cachetime < exttime)) {
				trycache = 0;
                verbose("trycache0 : 3\n");
				break;
			}
			
			if (ret == 0 && kerneltime > exttime) {
				exttime = kerneltime;
			}
			
			if (ret == 0 && cachetime < (exttime + 1)) {
				trycache = 0;
                verbose("trycache0 : 4\n");
				break;
			}
		} while (0);

        // sleep(5);

		do {
			if (trycache) {
				bootFile = gBootKernelCacheFile;
				
				verbose("Loading kernel cache %s\n", bootFile);
				
				if ((checkOSVersion("10.7")) || (checkOSVersion("10.8"))) {
					ret = LoadThinFatFile(bootFile, &binary);
				}
				else {
					ret = LoadFile(bootFile);
					binary = (void *)kLoadAddr;
				}
				
				if (ret >= 0)
					break;
				
				verbose("Kernel cache did not load %s\n ", bootFile);
			}
			
			if ((checkOSVersion("10.7")) || (checkOSVersion("10.8"))) {
				bootFile = gBootKernelCacheFile;
			}
			else {
				sprintf(bootFile, "\%s", bootInfo->bootFile);
			}
			
			// Try to load kernel image from alternate locations on boot helper partitions.
			sprintf(bootFileSpec, "com.apple.boot.P%s", bootFile);
			ret = GetFileInfo(NULL, bootFileSpec, &flags, &time); 
			if (ret == -1)
			{
				sprintf(bootFileSpec, "com.apple.boot.R%s", bootFile);
				ret = GetFileInfo(NULL, bootFileSpec, &flags, &time); 
				if (ret == -1)
				{
					sprintf(bootFileSpec, "com.apple.boot.S%s", bootFile);
					ret = GetFileInfo(NULL, bootFileSpec, &flags, &time); 
					if (ret == -1)
					{
						// No alternate location found, using the original kernel image path.
						strcpy(bootFileSpec, bootInfo->bootFile);
					}
开发者ID:fxtentacle,项目名称:chameleon-chimera-hajo,代码行数:67,代码来源:boot.c


示例2: LoadFile

void wxTextCtrl::OnDropFiles(wxDropFilesEvent& event)
{
    // By default, load the first file into the text window.
    if (event.GetNumberOfFiles() > 0)
        LoadFile( event.GetFiles()[0] );
}
开发者ID:iokto,项目名称:newton-dynamics,代码行数:6,代码来源:textctrl_osx.cpp


示例3: GCMemROM

int GCMemROM(int size)
{
	bool biosError = false;

	ResetGameLoaded();

	CloseGame();
	GameInfo = new FCEUGI();
	memset(GameInfo, 0, sizeof(FCEUGI));

	GameInfo->filename = strdup(romFilename);
	GameInfo->archiveCount = 0;

	/*** Set some default values ***/
	GameInfo->name=0;
	GameInfo->type=GIT_CART;
	GameInfo->vidsys=(EGIV)GCSettings.timing;
	GameInfo->input[0]=GameInfo->input[1]=SI_UNSET;
	GameInfo->inputfc=SIFC_UNSET;
	GameInfo->cspecial=SIS_NONE;

	/*** Set internal sound information ***/
	SetSampleRate();
	FCEUI_SetSoundVolume(100); // 0-100
	FCEUI_SetLowPass(0);

	FCEUFILE * fceufp = new FCEUFILE();
	fceufp->size = size;
	fceufp->filename = romFilename;
	fceufp->mode = FCEUFILE::READ; // read only
	EMUFILE_MEMFILE *fceumem = new EMUFILE_MEMFILE(nesrom, size);
	fceufp->stream = fceumem;

	romLoaded = iNESLoad(romFilename, fceufp, 1);

	if(!romLoaded)
	{
		romLoaded = UNIFLoad(romFilename, fceufp);
	}

	if(!romLoaded)
	{
		romLoaded = NSFLoad(romFilename, fceufp);
	}

	if(!romLoaded)
	{
		// read FDS BIOS into FDSBIOS - should be 8192 bytes
		if (FDSBIOS[1] == 0)
		{
			size_t biosSize = 0;
			char * tmpbuffer = (char *) memalign(32, 64 * 1024);

			char filepath[1024];

			sprintf (filepath, "%s%s/disksys.rom", pathPrefix[GCSettings.LoadMethod], APPFOLDER);
			biosSize = LoadFile(tmpbuffer, filepath, 0, SILENT);
			if(biosSize == 0 && strlen(appPath) > 0)
			{
				sprintf (filepath, "%s/disksys.rom", appPath);
				biosSize = LoadFile(tmpbuffer, filepath, 0, SILENT);
			}

			if (biosSize == 8192)
			{
				memcpy(FDSBIOS, tmpbuffer, 8192);
			}
			else
			{
				biosError = true;

				if (biosSize > 0)
					ErrorPrompt("FDS BIOS file is invalid!");
				else
					ErrorPrompt("FDS BIOS file not found!");
			}
			free(tmpbuffer);
		}
		if (FDSBIOS[1] != 0)
		{
			romLoaded = FDSLoad(romFilename, fceufp);
		}
	}

	delete fceufp;

	if (romLoaded)
	{
		FCEU_ResetVidSys();

		if(GameInfo->type!=GIT_NSF)
			if(FSettings.GameGenie)
				OpenGameGenie();
		PowerNES();

		//if(GameInfo->type!=GIT_NSF)
		//	FCEU_LoadGamePalette();

		FCEU_ResetPalette();
		FCEU_ResetMessages();	// Save state, status messages, etc.
//.........这里部分代码省略.........
开发者ID:CJB100,项目名称:fceugc,代码行数:101,代码来源:fceuload.cpp


示例4: strcpy

void MYIniReadTools::SetFileName(char str[])
{
	strcpy(FileName,str);
	LoadFile();
}
开发者ID:Quanhua-Guan,项目名称:cgame,代码行数:5,代码来源:MYIniReadTools.cpp


示例5: main_HInit

int main_HInit(int argc, char *argv[])
{
   char *datafn, *s;
   int nSeg;
   void Initialise(void);
   void LoadFile(char *fn);
   void EstimateModel(void);
   void SaveModel(char *outfn);
   
   if(InitShell(argc,argv,hinit_version,hinit_vc_id)<SUCCESS)
      HError(2100,"HInit: InitShell failed");
   InitMem();   InitLabel();
   InitMath();  InitSigP();
   InitWave();  InitAudio();
   InitVQ();    InitModel();
   if(InitParm()<SUCCESS)  
      HError(2100,"HInit: InitParm failed");
   InitTrain(); InitUtil();

   if (!InfoPrinted() && NumArgs() == 0)
      ReportUsageHInit();
   if (NumArgs() == 0) return(0);
   SetConfParmsHInit();

   CreateHMMSet(&hset,&gstack,FALSE);
   while (NextArg() == SWITCHARG) {
      s = GetSwtArg();
      if (strlen(s)!=1) 
         HError(2119,"HInit: Bad switch %s; must be single letter",s);
      switch(s[0]){
      case 'e':
         epsilon = GetChkedFlt(0.0,1.0,s); break;
      case 'i':
         maxIter = GetChkedInt(0,100,s); break;
      case 'l':
         if (NextArg() != STRINGARG)
            HError(2119,"HInit: Segment label expected");
         segLab = GetStrArg();
         break;
      case 'm':
         minSeg = GetChkedInt(1,1000,s); break;
      case 'n':
         newModel = FALSE; break;
      case 'o':
         outfn = GetStrArg();
         break;
      case 'u':
         SetuFlags(); break;
      case 'v':
         minVar = GetChkedFlt(0.0,10.0,s); break;
      case 'w':
         mixWeightFloor = MINMIX * GetChkedFlt(0.0,10000.0,s); 
         break;
      case 'B':
         saveBinary = TRUE;
         break;
      case 'F':
         if (NextArg() != STRINGARG)
            HError(2119,"HInit: Data File format expected");
         if((dff = Str2Format(GetStrArg())) == ALIEN)
            HError(-2189,"HInit: Warning ALIEN Data file format set");
         break;
      case 'G':
         if (NextArg() != STRINGARG)
            HError(2119,"HInit: Label File format expected");
         if((lff = Str2Format(GetStrArg())) == ALIEN)
            HError(-2189,"HInit: Warning ALIEN Label file format set");
         break;
      case 'H':
         if (NextArg() != STRINGARG)
            HError(2119,"HInit: HMM macro file name expected");
         AddMMF(&hset,GetStrArg());
         break;
      case 'I':
         if (NextArg() != STRINGARG)
            HError(2119,"HInit: MLF file name expected");
         LoadMasterFile(GetStrArg());
         break;
      case 'L':
         if (NextArg()!=STRINGARG)
            HError(2119,"HInit: Label file directory expected");
         labDir = GetStrArg(); break;
      case 'M':
         if (NextArg()!=STRINGARG)
            HError(2119,"HInit: Output macro file directory expected");
         outDir = GetStrArg();
         break;
      case 'T':
         if (NextArg() != INTARG)
            HError(2119,"HInit: Trace value expected");
         trace = GetChkedInt(0,01777,s);
         break;
      case 'X':
         if (NextArg()!=STRINGARG)
            HError(2119,"HInit: Label file extension expected");
         labExt = GetStrArg(); break;
      default:
         HError(2119,"HInit: Unknown switch %s",s);
      }
   }
//.........这里部分代码省略.........
开发者ID:cfxccn,项目名称:HTKLocker,代码行数:101,代码来源:Tool_HInit.c


示例6: LogFatal

bool C4GraphicsResource::Init()
{
	if (!RegisterGlobalGraphics())
		return false;
	// update group set
	if (!RegisterMainGroups())
	{
		LogFatal(LoadResStr("IDS_ERR_GFX_REGISTERMAIN"));
		return false;
	}

#ifndef USE_CONSOLE
	// Pre-load all shader files
	Files.PreCacheEntries(C4CFN_ShaderFiles);
	if (!pGL->InitShaders(&Files))
	{
		LogFatal(LoadResStr("IDS_ERR_GFX_INITSHADERS"));
		return false;
	}
#endif

	Game.SetInitProgress(11.0f);
	ProgressStart = 12.0f; ProgressIncrement = 0.35f; // TODO: This should be changed so that it stops at 25%, no matter how many graphics we load.
	// The progress bar is the only graphic besides the background that is
	// used during startup, so load it early
	if (!LoadFile(fctProgressBar, "GUIProgress", Files, C4FCT_Full, C4FCT_Full, false, 0)) return false;
	fctProgressBar.Set(fctProgressBar.Surface, 1,0, fctProgressBar.Wdt-2, fctProgressBar.Hgt);

	if (!InitFonts()) return false;

	// load GUI files
	if (!LoadFile(sfcCaption, "GUICaption", Files, idSfcCaption, 0)) return false;
	barCaption.SetHorizontal(sfcCaption, sfcCaption.Hgt, 32);
	if (!LoadFile(sfcButton, "GUIButton", Files, idSfcButton, 0)) return false;
	barButton.SetHorizontal(sfcButton);
	if (!LoadFile(sfcButtonD, "GUIButtonDown", Files, idSfcButtonD, 0)) return false;
	barButtonD.SetHorizontal(sfcButtonD);
	if (!LoadFile(fctButtonHighlight, "GUIButtonHighlight", Files, C4FCT_Full, C4FCT_Full, false, 0)) return false;
	if (!LoadFile(fctButtonHighlightRound, "GUIButtonHighlightRound", Files, C4FCT_Full, C4FCT_Full, false, 0)) return false;
	if (!LoadFile(fctIcons, "GUIIcons", Files, C4FCT_Full, C4FCT_Full, false, 0)) return false;
	fctIcons.Set(fctIcons.Surface,0,0,C4GUI_IconWdt,C4GUI_IconHgt);
	if (!LoadFile(fctIconsEx, "GUIIcons2", Files, C4FCT_Full, C4FCT_Full, false, 0)) return false;
	fctIconsEx.Set(fctIconsEx.Surface,0,0,C4GUI_IconExWdt,C4GUI_IconExHgt);
	if (!LoadFile(sfcScroll, "GUIScroll", Files, idSfcScroll, 0)) return false;
	sfctScroll.Set(C4Facet(&sfcScroll,0,0,32,32));
	if (!LoadFile(sfcContext, "GUIContext", Files, idSfcContext, 0)) return false;
	fctContext.Set(&sfcContext,0,0,16,16);
	if (!LoadFile(fctSubmenu, "GUISubmenu", Files, C4FCT_Full, C4FCT_Full, false, 0)) return false;
	if (!LoadFile(fctCheckbox, "GUICheckbox", Files, C4FCT_Full, C4FCT_Full, false, 0)) return false;
	fctCheckbox.Set(fctCheckbox.Surface, 0,0,fctCheckbox.Hgt,fctCheckbox.Hgt);
	if (!LoadFile(fctBigArrows, "GUIBigArrows", Files, C4FCT_Full, C4FCT_Full, false, 0)) return false;
	fctBigArrows.Set(fctBigArrows.Surface, 0,0, fctBigArrows.Wdt/4, fctBigArrows.Hgt);

	// Control
	if (!LoadFile(sfcControl, "Control", Files, idSfcControl, 0)) return false;
	fctKeyboard.Set(&sfcControl,0,0,80,36);
	fctCommand.Set(&sfcControl,0,36,32,32);
	fctKey.Set(&sfcControl,0,100,64,64);
	fctOKCancel.Set(&sfcControl,128,100,32,32);
	fctMouse.Set(&sfcControl,198,100,32,32);

	// Clonk style selection
	if (!LoadFile(sfcClonkSkins, "ClonkSkins",  Files, idSfcClonkSkins, 0)) return false;
	fctClonkSkin.Set(&sfcClonkSkins,0,0,64,64);

	// Facet bitmap resources
	if (!LoadFile(fctFire,        "Fire",         Files, C4FCT_Height, C4FCT_Full, false, 0))             return false;
	if (!LoadFile(fctBackground,  "Background",   Files, C4FCT_Full,   C4FCT_Full, false, C4SF_Tileable)) return false; // tileable
	if (!LoadFile(fctFlag,        "Flag",         Files, C4FCT_Full,   C4FCT_Full, false, 0))             return false; // (new format)
	if (!LoadFile(fctCrew,        "Crew",         Files, C4FCT_Full,   C4FCT_Full, false, 0))             return false; // (new format)
	if (!LoadFile(fctWealth,      "Wealth",       Files, C4FCT_Full,   C4FCT_Full, false, 0))             return false; // (new)
	if (!LoadFile(fctPlayer,      "Player",       Files, C4FCT_Full,   C4FCT_Full, false, 0))             return false; // (new format)
	if (!LoadFile(fctRank,        "Rank",         Files, C4FCT_Height, C4FCT_Full, false, 0))             return false;
	if (!LoadFile(fctCaptain,     "Captain",      Files, C4FCT_Full,   C4FCT_Full, false, 0))             return false;
	if (!LoadCursorGfx())                                                                                 return false;
	if (!LoadFile(fctSelectMark,  "SelectMark",   Files, C4FCT_Height, C4FCT_Full, false, 0))             return false;
	if (!LoadFile(fctMenu,        "Menu",         Files, 35,           35,         false, 0))             return false;
	if (!LoadFile(fctLogo,        "Logo",         Files, C4FCT_Full,   C4FCT_Full, false, 0))             return false;
	if (!LoadFile(fctConstruction,"Construction", Files, C4FCT_Full,   C4FCT_Full, false, 0))             return false; // (new)
	if (!LoadFile(fctEnergy,      "Energy",       Files, C4FCT_Full,   C4FCT_Full, false, 0))             return false; // (new)
	if (!LoadFile(fctOptions,     "Options",      Files, C4FCT_Height, C4FCT_Full, false, 0))             return false;
	if (!LoadFile(fctUpperBoard,  "UpperBoard",   Files, C4FCT_Full,   C4FCT_Full, false, C4SF_Tileable)) return false; // tileable
	if (!LoadFile(fctArrow,       "Arrow",        Files, C4FCT_Height, C4FCT_Full, false, 0))             return false;
	if (!LoadFile(fctExit,        "Exit",         Files, C4FCT_Full,   C4FCT_Full, false, 0))             return false;
	if (!LoadFile(fctHand,        "Hand",         Files, C4FCT_Height, C4FCT_Full, false, 0))             return false;
	if (!LoadFile(fctGamepad,     "Gamepad",      Files, 80,           C4FCT_Full, false, 0))             return false;
	if (!LoadFile(fctBuild,       "Build",        Files, C4FCT_Full,   C4FCT_Full, false, 0))             return false;

	// achievements
	if (!Achievements.Init(Files)) return false;

	// create ColorByOwner overlay surfaces
	if (fctCrew.idSourceGroup != fctCrewClr.idSourceGroup)
	{
		if (!fctCrewClr.CreateClrByOwner(fctCrew.Surface)) { LogFatal("ClrByOwner error! (1)"); return false; }
		fctCrewClr.Wdt=fctCrew.Wdt;
		fctCrewClr.Hgt=fctCrew.Hgt;
		fctCrewClr.idSourceGroup = fctCrew.idSourceGroup;
	}
	if (fctFlag.idSourceGroup != fctFlagClr.idSourceGroup)
//.........这里部分代码省略.........
开发者ID:Rocket-Fish,项目名称:openclonk,代码行数:101,代码来源:C4GraphicsResource.cpp


示例7: LoadFile

wxBitmap::wxBitmap(const wxString &filename, wxBitmapType type)
{
    LoadFile(filename, type);
}
开发者ID:EdgarTx,项目名称:wx,代码行数:4,代码来源:bitmap.cpp


示例8: LoadSurfaceExtraFile

void LoadSurfaceExtraFile( const char *path )
{
	char			srfPath[ 1024 ];
	surfaceExtra_t	*se;
	int				surfaceNum, size;
	byte			*buffer;
	
	
	/* dummy check */
	if( path == NULL || path[ 0 ] == '\0' )
		return;
	
	/* load the file */
	strcpy( srfPath, path );
	StripExtension( srfPath );
	strcat( srfPath, ".srf" );
	Sys_Printf( "Loading %s\n", srfPath );
	size = LoadFile( srfPath, (void**) &buffer );
	if( size <= 0 )
	{
		Sys_Printf( "WARNING: Unable to find surface file %s, using defaults.\n", srfPath );
		return;
	}
	
	/* parse the file */
	ParseFromMemory( buffer, size );
	
	/* tokenize it */
	while( 1 )
	{
		/* test for end of file */
		if( !GetToken( qtrue ) )
			break;
		
		/* default? */
		if( !Q_stricmp( token, "default" ) )
			se = &seDefault;

		/* surface number */
		else
		{
			surfaceNum = atoi( token );
			if( surfaceNum < 0 || surfaceNum > MAX_MAP_DRAW_SURFS )
				Error( "ReadSurfaceExtraFile(): %s, line %d: bogus surface num %d", srfPath, scriptline, surfaceNum );
			while( surfaceNum >= numSurfaceExtras )
				se = AllocSurfaceExtra();
			se = &surfaceExtras[ surfaceNum ];
		}
		
		/* handle { } section */
		if( !GetToken( qtrue ) || strcmp( token, "{" ) )
			Error( "ReadSurfaceExtraFile(): %s, line %d: { not found", srfPath, scriptline );
		while( 1 )
		{
			if( !GetToken( qtrue ) )
				break;
			if( !strcmp( token, "}" ) )
				break;
			
			/* shader */
			if( !Q_stricmp( token, "shader" ) )
			{
				GetToken( qfalse );
				se->si = ShaderInfoForShader( token );
			}
			
			/* parent surface number */
			else if( !Q_stricmp( token, "parent" ) )
			{
				GetToken( qfalse );
				se->parentSurfaceNum = atoi( token );
			}
			
			/* entity number */
			else if( !Q_stricmp( token, "entity" ) )
			{
				GetToken( qfalse );
				se->entityNum = atoi( token );
			}
			
			/* cast shadows */
			else if( !Q_stricmp( token, "castShadows" ) )
			{
				GetToken( qfalse );
				se->castShadows = atoi( token );
			}
			
			/* recv shadows */
			else if( !Q_stricmp( token, "receiveShadows" ) )
			{
				GetToken( qfalse );
				se->recvShadows = atoi( token );
			}
			
			/* lightmap sample size */
			else if( !Q_stricmp( token, "sampleSize" ) )
			{
				GetToken( qfalse );
				se->sampleSize = atoi( token );
			}
//.........这里部分代码省略.........
开发者ID:Garey27,项目名称:urt-bumpy-q3map2,代码行数:101,代码来源:surface_extra.c


示例9: m_xFile

t3DSParser::t3DSParser(const QString& filename)
: m_xFile()
, m_Header()
{
    LoadFile(filename);
}
开发者ID:dulton,项目名称:53_hero,代码行数:6,代码来源:3DSParser.cpp


示例10: sMin

sBool sTextControl::OnCommand(sU32 cmd)
{
  sInt s0,s1,len;
  sDiskItem *di;
  sChar buffer[sDI_PATHSIZE];
  sChar *t;

  s0 = sMin(SelPos,Cursor);
  s1 = sMax(SelPos,Cursor);
  len = s1-s0;

  switch(cmd)
  {
  case sTCC_CUT:
    if(SelMode && s0!=s1)
    {
      sGui->ClipboardClear();
      sGui->ClipboardAddText(Text+s0,len);
      Engine(s0,len,0);
      Post(DoneCmd);
      SelMode = 0;
      Cursor = s0;
    }
    return sTRUE;
  case sTCC_COPY:
    if(SelMode && s0!=s1)
    {
      sGui->ClipboardClear();
      sGui->ClipboardAddText(Text+s0,len);
      SelMode = 0;
    }
    return sTRUE;
  case sTCC_PASTE:
    t = sGui->ClipboardFindText();
    if(t && t[0])
    {
      Engine(Cursor,sGetStringLen(t),t);
      Cursor+=sGetStringLen(t);
      Post(DoneCmd);
    }
    return sTRUE;
  case sTCC_BLOCK:
    if(SelMode==0)
    {
      SelMode = 2;
      SelPos = Cursor;
    }
    else
    {
      SelMode = 0;
    }  
    return sTRUE;

  case 3:     // Cancel File Requester
    if(File)
    {
      File->Parent->RemChild(File);
      File = 0;
    }
    return sTRUE;
  case sTCC_OPEN:
    if(!File)
    {
      File = new sFileWindow;
      File->AddTitle("Open File");
      sGui->AddApp(File);
    }
    sGui->SetFocus(File);
    File->OkCmd = 4;
    File->CancelCmd = 3;
    File->SendTo = this;
    Modal = File;
    File->SetPath(PathName);
    return sTRUE;
  case 4:
    if(File)
    {
      File->GetPath(buffer,sizeof(buffer));
      OnCommand(3);
      if(!LoadFile(buffer))
      {
        SetText("");
        (new sDialogWindow)->InitOk(this,"Open File","Load failed",0);
      }
    }
    return sTRUE;

  case sTCC_CLEAR:
    SetText("");
    return sTRUE;      


  case sTCC_SAVEAS:
    if(!File)
    {
      File = new sFileWindow;
      File->AddTitle("Open File");
      sGui->AddApp(File);
    }
    sGui->SetFocus(File);
//.........这里部分代码省略.........
开发者ID:Ambrevar,项目名称:fr_public,代码行数:101,代码来源:apptext.cpp


示例11: boot


//.........这里部分代码省略.........
		getAndProcessBootArguments(kernelFlags);

		// Initialize bootFile (defaults to: mach_kernel).
		strcpy(bootFile, bootInfo->bootFile);

#if PRE_LINKED_KERNEL_SUPPORT

		// Preliminary checks to prevent us from doing useless things.
        mayUseKernelCache = ((gBootMode & kBootModeSafe) == 0);
		
		/* 
		 * A pre-linked kernel, or kernelcache, requires you to have all essential kexts for your
		 * configuration, including FakeSMC.kext in: /System/Library/Extensions/ 
		 * Not in /Extra/Extensions/ because this directory will be ignored, completely when a 
		 * pre-linked kernel or kernelcache is used!
		 *
		 * Note: Not following this word of advise will render your system incapable of booting!
		 */
		
		if (mayUseKernelCache)
		{
			_BOOT_DEBUG_DUMP("Kernelcache path: %s\n", gPlatform.KernelCachePath);

			/*
			 * We might have been fired up from a USB thumbdrive (kickstart boot) and 
			 * thus we have to check the kernel cache path first (might not be there).
			 */

			if (GetFileInfo(NULL, gPlatform.KernelCachePath, &flags, &cachetime) == 0)
			{
#if ((MAKE_TARGET_OS & LION) == LION) // Also for Mountain Lion, which has bit 2 set like Lion.

				_BOOT_DEBUG_DUMP("Checking for kernelcache...\n");

				// Do we have a kernelcache to work with?
				if (GetFileInfo(gPlatform.KernelCachePath, (char *)kKernelCache, &flags, &cachetime) == 0)
				{
					/*
					 * Starting with Lion, we can take a shortcut by simply pointing 
					 * the 'bootFile' to the kernel cache and we are done.
					 */
					
					sprintf(bootFile, "%s/%s", gPlatform.KernelCachePath, kKernelCache);

					_BOOT_DEBUG_DUMP("Kernelcache found.\n");
				}

				_BOOT_DEBUG_ELSE_DUMP("Failed to locate the kernelcache. Will load: %s!\n", bootInfo->bootFile);
			}

			_BOOT_DEBUG_ELSE_DUMP("Failed to locate the cache directory!\n");
		}
#else // Not for Lion, go easy with the Snow Leopard.

				static char preLinkedKernelPath[128];
				static char adler32Key[PLATFORM_NAME_LEN + ROOT_PATH_LEN];

				unsigned long adler32 = 0;

				preLinkedKernelPath[0] = '\0';

				_BOOT_DEBUG_DUMP("Checking for pre-linked kernel...\n");

				// Zero out platform info (name and kernel root path).
				bzero(adler32Key, sizeof(adler32Key));
				
				// Construct key for the pre-linked kernel checksum (generated by adler32). 
				sprintf(adler32Key, gPlatform.ModelID);
				sprintf(adler32Key + PLATFORM_NAME_LEN, "%s", BOOT_DEVICE_PATH);
				sprintf(adler32Key + (PLATFORM_NAME_LEN + 38), "%s", bootInfo->bootFile);
				
				adler32 = Adler32((unsigned char *)adler32Key, sizeof(adler32Key));
				
				_BOOT_DEBUG_DUMP("adler32: %08X\n", adler32);
				
				// Create path to pre-linked kernel.
				sprintf(preLinkedKernelPath, "%s/%s_%s.%08lX", gPlatform.KernelCachePath, kKernelCache, 
						((gArchCPUType == CPU_TYPE_X86_64) ? "x86_64" : "i386"), adler32);

				// Check if this file exists.
				if ((GetFileInfo(NULL, preLinkedKernelPath, &flags, &cachetime) == 0) && ((flags & kFileTypeMask) == kFileTypeFlat))
				{
					_BOOT_DEBUG_DUMP("Pre-linked kernel cache located!\nLoading pre-linked kernel: %s\n", preLinkedKernelPath);
					
					// Returns -1 on error, or the actual filesize.
					if (LoadFile((const char *)preLinkedKernelPath))
					{
						retStatus = 1;
						binary = (void *)kLoadAddr;
						bootFile[0] = 0;
					}

					_BOOT_DEBUG_ELSE_DUMP("Failed to load the pre-linked kernel. Will load: %s!\n", bootInfo->bootFile);
				}

				_BOOT_DEBUG_ELSE_DUMP("Failed to locate the pre-linked kernel!\n");
			}

			_BOOT_DEBUG_ELSE_DUMP("Failed to locate the cache directory!\n");
		}
开发者ID:Dawn13,项目名称:RevoBoot,代码行数:101,代码来源:boot.c


示例12: main


//.........这里部分代码省略.........
			printf("globals\n");
			printf("=======================\n");
			PrintGlobals ();
			printf("\n=======================\n");
			printf("pr_globals\n");
			printf("=======================\n");
			PrintPRGlobals ();
			printf("\n=======================\n");
			printf("statements\n");
			printf("=======================\n");
			Printstatements();
			exit (0);
		}

		p = CheckParm("-asm");
		if (p)
		{
			for (p++; p < argc; p++)
			{
				if (argv[p][0] == '-')
					break;
				PR_PrintFunction(argv[p]);
			}
		}
		else
		{
			Dcc_Functions ();
			stop = GetTime ();
			printf("\n%d seconds elapsed.\n", (int)(stop-start));
		}

		exit (0);
	}

	sprintf(filename, "%sprogs.src", sourcedir);
	LoadFile(filename, &src);
	psrc = (char *) src;

	psrc = COM_Parse(psrc);
	if (!psrc)
	{
		Error("No destination filename.  HCC -help for info.\n");
	}

	strcpy(destfile, com_token);
	printf("outputfile: %s\n", destfile);

	pr_dumpasm = false;

	PR_BeginCompilation();

	// compile all the files
	do
	{
		psrc = COM_Parse(psrc);
		if (!psrc)
			break;

		sprintf (filename, "%s%s", sourcedir, com_token);
		printf ("compiling %s\n", filename);
		LoadFile (filename, &src2);

		if (!PR_CompileFile((char *)src2, filename))
			exit (1);

	} while (1);

	if (!PR_FinishCompilation())
	{
		Error ("compilation errors");
	}

	p = CheckParm("-asm");
	if (p)
	{
		for (p++; p < argc; p++)
		{
			if (argv[p][0] == '-')
			{
				break;
			}
			PrintFunction(argv[p]);
		}
	}

	// write progdefs.h
	crc = PR_WriteProgdefs("progdefs.h");
//	crc = 14046;	// FIXME: cheap hack for now!!!!!!!!!!!!!

	// write data file
	WriteData(crc);

	// write files.dat
	WriteFiles();

	stop = GetTime ();
	printf("\n%d seconds elapsed.\n", (int)(stop-start));

	exit (0);
}
开发者ID:crutchwalkfactory,项目名称:motocakerteam,代码行数:101,代码来源:hcc.c


示例13: LoadFile

void Musicplayer::LoadCurrentFile()
{
	LoadFile(CurrentFileName->c_str());
}
开发者ID:CHASECAREY123456789,项目名称:wiiflow,代码行数:4,代码来源:MusicPlayer.cpp


示例14: PSP_Init

bool PSP_Init(const CoreParameter &coreParam, std::string *error_string)
{
	INFO_LOG(HLE, "PPSSPP %s", PPSSPP_GIT_VERSION);

	coreParameter = coreParam;
	currentCPU = &mipsr4k;
	numCPUs = 1;

	// Default memory settings
	// Seems to be the safest place currently..
	Memory::g_MemorySize = 0x2000000; // 32 MB of ram by default
	g_RemasterMode = false;
	g_DoubleTextureCoordinates = false;

	std::string filename = coreParam.fileToStart;
	EmuFileType type = Identify_File(filename);

	if(type == FILETYPE_PSP_ISO || type == FILETYPE_PSP_ISO_NP || type == FILETYPE_PSP_DISC_DIRECTORY)
		InitMemoryForGameISO(filename);

	Memory::Init();
	mipsr4k.Reset();
	mipsr4k.pc = 0;

	host->AttemptLoadSymbolMap();

	if (coreParameter.enableSound)
	{
		mixer = new PSPMixer();
		host->InitSound(mixer);
	}

	if (coreParameter.disableG3Dlog)
	{
		LogManager::GetInstance()->SetEnable(LogTypes::G3D, false);
	}

	CoreTiming::Init();

	// Init all the HLE modules
	HLEInit();

	// TODO: Check Game INI here for settings, patches and cheats, and modify coreParameter accordingly

	// Why did we check for CORE_POWERDOWN here?
	if (!LoadFile(filename, error_string)) { // || coreState == CORE_POWERDOWN) {
		pspFileSystem.Shutdown();
		CoreTiming::Shutdown();
		__KernelShutdown();
		HLEShutdown();
		host->ShutdownSound();
		Memory::Shutdown();
		coreParameter.fileToStart = "";
		return false;
	}

	if (coreParam.updateRecent)
		g_Config.AddRecent(filename);

	// Setup JIT here.
	if (coreParameter.startPaused)
		coreState = CORE_STEPPING;
	else
		coreState = CORE_RUNNING;
	return true;
}
开发者ID:Ekaseo,项目名称:ppsspp,代码行数:66,代码来源:System.cpp


示例15: sizeof

void Model::GenerateToolPath()
{
	unsigned int numItems = m_levels.size() * NUM_DEGREE;
	Buffer outputBuffer, modelBuffer;

	modelBuffer = m_computeSystem->CreateBuffer(m_levels.data(), numItems, sizeof(float));
	outputBuffer = m_computeSystem->CreateBuffer(nullptr, numItems, sizeof(Vector4));

	m_generateToolPathShader->ClearBuffers();
	m_generateToolPathShader->AddBuffer(modelBuffer);
	m_generateToolPathShader->AddBuffer(outputBuffer);

	float levelHeight = 0.1f;
	float numDegree = NUM_DEGREE;

	m_computeSystem->SetFloatAttrib(m_generateToolPathShader, "levelHeight", &levelHeight, 1);
	m_computeSystem->SetFloatAttrib(m_generateToolPathShader, "numDegree", &numDegree, 1);

	m_generateToolPathShader->SetComputeSize(NUM_DEGREE, m_levels.size(), 1);
	m_generateToolPathShader->SetGroupSize(1, 1, 1);

	m_computeSystem->DispatchCompute(m_generateToolPathShader);	

	outputBuffer = m_generateToolPathShader->GetBuffer(1);
	Vector4* data = m_computeSystem->GetValues<Vector4>(outputBuffer);

	/*for (unsigned int i = 0; i < numItems; ++i)
	{
		Log::Info("Index[" + std::to_string(i) + "] " + std::to_string(data[i].y));
	}*/

	Buffer vertexBuffer, indexBuffer;
	unsigned int numVerts = numItems * 4;
	unsigned int numInds = numItems * 6;

	vertexBuffer = m_computeSystem->CreateBuffer(nullptr, numVerts, sizeof(Vector4));
	indexBuffer = m_computeSystem->CreateBuffer(nullptr, numInds, sizeof(unsigned int));

	m_buildToolPathVertsShader->ClearBuffers();
	m_buildToolPathVertsShader->AddBuffer(outputBuffer);
	m_buildToolPathVertsShader->AddBuffer(vertexBuffer);
	m_buildToolPathVertsShader->AddBuffer(indexBuffer);

	m_buildToolPathVertsShader->SetComputeSize(NUM_DEGREE, m_levels.size(), 1);
	m_buildToolPathVertsShader->SetGroupSize(1, 1, 1);

	m_computeSystem->DispatchCompute(m_buildToolPathVertsShader);
	
	Buffer vb = m_buildToolPathVertsShader->GetBuffer(1);
	Vector4* vd = m_computeSystem->GetValues<Vector4>(vb);

	Buffer ib = m_buildToolPathVertsShader->GetBuffer(2);
	unsigned int* id = m_computeSystem->GetValues<unsigned int>(ib);

	/*for (unsigned int i = 0; i < numVerts; ++i)
	{
	Log::Info("Index[" + std::to_string(i) + "] " + std::to_string(vd[i].x) + ", " + std::to_string(vd[i].y) + ", " + std::to_string(vd[i].z));
	}*/

	m_toolPathRO = m_renderer->CreateRenderObject(vd, numVerts, id, numInds, LoadFile(RESOURCE_PATH + "vs.vs"), LoadFile(RESOURCE_PATH + "fs.fs"));

	m_computeSystem->ReleaseBuffer(&modelBuffer);
	m_computeSystem->ReleaseBuffer(&outputBuffer);
}
开发者ID:AlexMerritt,项目名称:ComputeShader,代码行数:64,代码来源:Model.cpp


示例16: MemsetZero

VSTPresets::ErrorCode VSTPresets::LoadFile(FileReader &file, CVstPlugin &plugin)
//------------------------------------------------------------------------------
{
	const bool firstChunk = file.GetPosition() == 0;
	ChunkHeader header;
	if(!file.ReadConvertEndianness(header) || header.chunkMagic != cMagic)
	{
		return invalidFile;
	}
	if(header.fxID != plugin.GetUID())
	{
		return wrongPlugin;
	}

	if(header.fxMagic == fMagic || header.fxMagic == chunkPresetMagic)
	{
		// Program
		PlugParamIndex numParams = file.ReadUint32BE();

		VstPatchChunkInfo info;
		info.version = 1;
		info.pluginUniqueID = header.fxID;
		info.pluginVersion = header.fxVersion;
		info.numElements = numParams;
		MemsetZero(info.future);
		plugin.Dispatch(effBeginLoadProgram, 0, 0, &info, 0.0f);
		plugin.Dispatch(effBeginSetProgram, 0, 0, nullptr, 0.0f);

		char prgName[28];
		file.ReadString<mpt::String::maybeNullTerminated>(prgName, 28);
		plugin.Dispatch(effSetProgramName, 0, 0, prgName, 0.0f);

		if(header.fxMagic == fMagic)
		{
			if(plugin.GetNumParameters() != numParams)
			{
				return wrongParameters;
			}
			for(PlugParamIndex p = 0; p < numParams; p++)
			{
				plugin.SetParameter(p, file.ReadFloatBE());
			}
		} else
		{
			FileReader chunk = file.ReadChunk(file.ReadUint32BE());
			plugin.Dispatch(effSetChunk, 1, chunk.GetLength(), const_cast<char *>(chunk.GetRawData()), 0);
		}
		plugin.Dispatch(effEndSetProgram, 0, 0, nullptr, 0.0f);
	} else if((header.fxMagic == bankMagic || header.fxMagic == chunkBankMagic) && firstChunk)
	{
		// Bank - only read if it's the first chunk in the file, not if it's a sub chunk.
		uint32 numProgs = file.ReadUint32BE();
		uint32 currentProgram = file.ReadUint32BE();
		file.Skip(124);

		VstPatchChunkInfo info;
		info.version = 1;
		info.pluginUniqueID = header.fxID;
		info.pluginVersion = header.fxVersion;
		info.numElements = numProgs;
		MemsetZero(info.future);
		plugin.Dispatch(effBeginLoadBank, 0, 0, &info, 0.0f);

		if(header.fxMagic == bankMagic)
		{
			VstInt32 oldCurrentProgram = plugin.GetCurrentProgram();
			for(uint32 p = 0; p < numProgs; p++)
			{
				plugin.Dispatch(effBeginSetProgram, 0, 0, nullptr, 0.0f);
				plugin.Dispatch(effSetProgram, 0, 0, nullptr, 0.0f);
				ErrorCode retVal = LoadFile(file, plugin);
				if(retVal != noError)
				{
					return retVal;
				}
				plugin.Dispatch(effEndSetProgram, 0, 0, nullptr, 0.0f);
			}
			plugin.SetCurrentProgram(oldCurrentProgram);
		} else
		{
			FileReader chunk = file.ReadChunk(file.ReadUint32BE());
			plugin.Dispatch(effSetChunk, 0, chunk.GetLength(), const_cast<char *>(chunk.GetRawData()), 0);
		}
		if(header.version >= 2)
		{
			plugin.SetCurrentProgram(currentProgram);
		}
	}

	return noError;
}
开发者ID:ksnydertn,项目名称:modplug,代码行数:91,代码来源:VstPresets.cpp


示例17: SampleDisplayFileContent

void SampleDisplayFileContent(const char* fileName)
{
	char content[16] = { 0 };
	LoadFile(fileName, content);
	Print("Content: '%s'\n", content);
}
开发者ID:elliot627,项目名称:CS2270,代码行数:6,代码来源:Main.cpp


示例18: LoadSound

bool LoadSound(const char* filename, bool sfxr)
{
    auto it = sound_files.find(filename);
    Sound snd;

    if (it == sound_files.end())
    {
        size_t len = 0;
        uchar *buf = LoadFile(filename, &len);
        if (!buf)
            return false;

        if (sfxr)
        {
            snd.buf = buf;
            snd.len = len;
        }
        else
        {
            SDL_AudioSpec wav_spec;
            Uint32 wav_len;
            auto wav_spec_ret = SDL_LoadWAV_RW(SDL_RWFromMem(buf, (int)len), true, &wav_spec, &snd.buf, &wav_len);

            free(buf);

            if (!wav_spec_ret)
                return false;

            snd.len = wav_len;

            SDL_AudioCVT  wav_cvt;
            int ret = SDL_BuildAudioCVT(&wav_cvt,
                        wav_spec.format, wav_spec.channels, wav_spec.freq,
                        playbackspec.format, playbackspec.channels, playbackspec.freq);

            if (ret < 0)
            {
                SDL_FreeWAV(snd.buf);
                return false;
            }

            if (ret)
            {
                wav_cvt.buf = (uchar *)malloc(snd.len * wav_cvt.len_mult);
                wav_cvt.len = (int)snd.len;
                memcpy(wav_cvt.buf, snd.buf, snd.len);

                SDL_FreeWAV(snd.buf);

                SDL_ConvertAudio(&wav_cvt);

                snd.buf = wav_cvt.buf;
                // caution: len is not size of buffer anymore, but size of valid data..
                // that works ok with SDL_FreeWAV/free
                snd.len = size_t(wav_cvt.len * wav_cvt.len_ratio);
            }
        }

        snd.sfxr = sfxr;

        sound_files[filename] = snd;
    }
    else
    {
        snd = it->second;

        if (sfxr != snd.sfxr)   // wav file and sfxr file with same name? should be very rare :)
            return false;
    }

    if (sfxr)
    {
        uchar *file = snd.buf;

        int version = 0;
        fread_mem(&version, 1, sizeof(int), file);
        if(version!=102)
            return false;

        fread_mem(&wave_type, 1, sizeof(int), file);

        fread_mem(&sound_vol, 1, sizeof(float), file);

        fread_mem(&p_base_freq, 1, sizeof(float), file);
        fread_mem(&p_freq_limit, 1, sizeof(float), file);
        fread_mem(&p_freq_ramp, 1, sizeof(float), file);
        fread_mem(&p_freq_dramp, 1, sizeof(float), file);
        fread_mem(&p_duty, 1, sizeof(float), file);
        fread_mem(&p_duty_ramp, 1, sizeof(float), file);

        fread_mem(&p_vib_strength, 1, sizeof(float), file);
        fread_mem(&p_vib_speed, 1, sizeof(float), file);
        fread_mem(&p_vib_delay, 1, sizeof(float), file);

        fread_mem(&p_env_attack, 1, sizeof(float), file);
        fread_mem(&p_env_sustain, 1, sizeof(float), file);
        fread_mem(&p_env_decay, 1, sizeof(float), file);
        fread_mem(&p_env_punch, 1, sizeof(float), file);

        fread_mem(&filter_on, 1, sizeof(bool), file);
//.........这里部分代码省略.........
开发者ID:OrangeKnife,项目名称:lobster,代码行数:101,代码来源:sdlaudiosfxr.cpp


示例19: NGCUnfreezeGame

/****************************************************************************
 * NGCUnfreezeGame
 ***************************************************************************/
int
NGCUnfreezeGame (int method, bool8 silent)
{
	char filepath[1024];
	int offset = 0;
	int result = 0;
	char msg[80];

	bufoffset = 0;

	ShowAction ((char*) "Loading...");

    if(method == METHOD_AUTO)
		method = autoSaveMethod(); // we use 'Save' because snapshot needs R/W

    if(!MakeFilePath(filepath, FILE_SNAPSHOT, method))
        return 0;

    AllocSaveBuffer ();

    offset = LoadFile(filepath, method, silent);

	if(method == METHOD_MC_SLOTA || method == METHOD_MC_SLOTB) // MC in slot A or slot B
	{
		if (offset)
		{
			char * zipbuffer = (char *)malloc(SAVEBUFFERSIZE);
			memset (zipbuffer, 0, SAVEBUFFERSIZE);

			// skip the saveicon and comment
			offset = (sizeof(saveicon) + 64);
			uLongf zipsize = 0;
			uLongf decompressedsize = 0;

			memcpy (&zipsize, savebuffer+offset, 4);
			offset += 4;

			memcpy (&decompressedsize, savebuffer+offset, 4);
			offset += 4;

			uLongf DestBuffSize = SAVEBUFFERSIZE;
			int err= uncompress((Bytef*)zipbuffer, (uLongf*)&DestBuffSize, (const Bytef*)(savebuffer + offset), zipsize);

			if ( err!=Z_OK )
			{
				sprintf (msg, "Unzip error %s ",zError(err));
				WaitPrompt (msg);
			}
			else if ( DestBuffSize != decompressedsize )
			{
				WaitPrompt((char*) "Unzipped size doesn't match expected size!");
			}
			else
			{
				offset = SAVEBUFFERSIZE;
				memcpy (savebuffer, zipbuffer, SAVEBUFFERSIZE);
			}
			free(zipbuffer);
		}
    }

	if(offset > 0)
	{
		if (S9xUnfreezeGame ("AGAME") == SUCCESS)
			result = 1;
		else
			WaitPrompt((char*) "Error thawing");
	}
	else
	{
		if(!silent)
			WaitPrompt((char*) "Freeze file not found");
	}
	FreeSaveBuffer ();
	return result;
}
开发者ID:feraligatr,项目名称:snes9xgx,代码行数:79,代码来源:freeze.cpp


示例20: LoadFile

该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ LoadFont函数代码示例发布时间:2022-05-30
下一篇:
C++ LoadDoorData函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap