本文整理汇总了C++中EMUFILE_FILE::write32le方法的典型用法代码示例。如果您正苦于以下问题:C++ EMUFILE_FILE::write32le方法的具体用法?C++ EMUFILE_FILE::write32le怎么用?C++ EMUFILE_FILE::write32le使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类EMUFILE_FILE
的用法示例。
在下文中一共展示了EMUFILE_FILE::write32le方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: ensure
void BackupDevice::ensure(u32 addr, u8 val, EMUFILE_FILE *fpOut)
{
if (!fpOut && (addr < fsize)) return;
EMUFILE_FILE *fp = fpOut?fpOut:fpMC;
#ifndef _DONT_SAVE_BACKUP
fp->fseek(fsize, SEEK_SET);
#endif
u32 padSize = pad_up_size(addr);
u32 size = padSize - fsize;
info.padSize = info.size = fsize = padSize;
int type = searchFileSaveType(fsize);
if (type != 0xFF) info.type = (type + 1);
#ifndef _DONT_SAVE_BACKUP
if (size > 0)
{
u8 *tmp = new u8[size];
memset(tmp, val, size);
fwrite(tmp, 1, size, fp->get_fp());
delete [] tmp;
}
//this is just for humans to read
fp->fprintf(DESMUME_BACKUP_FOOTER_TXT);
//and now the actual footer
fp->write32le(addr); //the size of data that has actually been written
fp->write32le(padSize); //the size we padded it to
fp->write32le(info.type); //save memory type
fp->write32le(addr_size);
fp->write32le(info.size); //save memory size
fp->write32le((u32)0); //version number
fp->fprintf("%s", kDesmumeSaveCookie); //this is what we'll use to recognize the desmume format save
fp->fflush();
//this is a HORRIBLE IDEA.
//leave the FP positioned to write the final byte
//this is a HACK to make the basic read/write byte operation work when it calls ensure().
//IDEALLY, no assumptions about the file pointer can be made.
//but someone (actually, not really) so very carefully profiled the save IO code and discovered that not fseeking for every byte read/write was a great optimization.
//so, now all this code is depending/assuming on the FP being kept in a precise position, and I dont think its smart to change the main user of this assumption to paper over this bug by making it fseek before read/write, while leaving other unknown assuming clients intact
fpMC->fseek(addr-1, SEEK_SET);
#endif
}
示例2: ensure
void BackupDevice::ensure(u32 addr, u8 val, EMUFILE_FILE *fpOut)
{
if (!fpOut && (addr < fsize)) return;
EMUFILE_FILE *fp = fpOut?fpOut:fpMC;
#ifndef _DONT_SAVE_BACKUP
fp->fseek(fsize, SEEK_SET);
#endif
u32 padSize = pad_up_size(addr);
u32 size = padSize - fsize;
info.padSize = info.size = fsize = padSize;
int type = searchFileSaveType(fsize);
if (type != 0xFF) info.type = (type + 1);
#ifndef _DONT_SAVE_BACKUP
if (size > 0)
{
u8 *tmp = new u8[size];
memset(tmp, val, size);
fwrite(tmp, 1, size, fp->get_fp());
delete [] tmp;
}
//this is just for humans to read
fp->fprintf(DESMUME_BACKUP_FOOTER_TXT);
//and now the actual footer
fp->write32le(addr); //the size of data that has actually been written
fp->write32le(padSize); //the size we padded it to
fp->write32le(info.type); //save memory type
fp->write32le(addr_size);
fp->write32le(info.size); //save memory size
fp->write32le((u32)0); //version number
fp->fprintf("%s", kDesmumeSaveCookie); //this is what we'll use to recognize the desmume format save
fp->fflush();
fp->fseek(addr, SEEK_SET);
#endif
}