本文整理汇总了C++中LoadFile函数的典型用法代码示例。如果您正苦于以下问题:C++ LoadFile函数的具体用法?C++ LoadFile怎么用?C++ LoadFile使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了LoadFile函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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);
}
示例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] );
}
示例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.
//.........这里部分代码省略.........
示例4: strcpy
void MYIniReadTools::SetFileName(char str[])
{
strcpy(FileName,str);
LoadFile();
}
示例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);
}
}
//.........这里部分代码省略.........
示例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)
//.........这里部分代码省略.........
示例7: LoadFile
wxBitmap::wxBitmap(const wxString &filename, wxBitmapType type)
{
LoadFile(filename, type);
}
示例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 );
}
//.........这里部分代码省略.........
示例9: m_xFile
t3DSParser::t3DSParser(const QString& filename)
: m_xFile()
, m_Header()
{
LoadFile(filename);
}
示例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);
//.........这里部分代码省略.........
示例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");
}
示例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);
}
示例13: LoadFile
void Musicplayer::LoadCurrentFile()
{
LoadFile(CurrentFileName->c_str());
}
示例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;
}
示例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);
}