本文整理汇总了C++中MDFN_printf函数的典型用法代码示例。如果您正苦于以下问题:C++ MDFN_printf函数的具体用法?C++ MDFN_printf怎么用?C++ MDFN_printf使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了MDFN_printf函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: LoadIPS
// Return FALSE on fatal error(IPS file found but couldn't be applied),
// or TRUE on success(IPS patching succeeded, or IPS file not found).
static bool LoadIPS(MDFNFILE &GameFile, const char *path)
{
FILE *IPSFile;
MDFN_printf(_("Applying IPS file \"%s\"...\n"), path);
IPSFile = fopen(path, "rb");
if(!IPSFile)
{
ErrnoHolder ene(errno);
MDFN_printf(_("Failed: %s\n"), ene.StrError());
if(ene.Errno() == ENOENT)
return(1);
else
{
MDFN_PrintError(_("Error opening IPS file: %s\n"), ene.StrError());
return(0);
}
}
if(!GameFile.ApplyIPS(IPSFile))
{
fclose(IPSFile);
return(0);
}
fclose(IPSFile);
return(1);
}
示例2: Load
static int Load(const char *name, MDFNFILE *fp)
{
lynxie = new CSystem(GET_FDATA_PTR(fp), GET_FSIZE_PTR(fp));
int rot = lynxie->CartGetRotate();
if(rot == CART_ROTATE_LEFT) MDFNGameInfo->rotated = MDFN_ROTATE270;
else if(rot == CART_ROTATE_RIGHT) MDFNGameInfo->rotated = MDFN_ROTATE90;
gAudioEnabled = 1;
memcpy(MDFNGameInfo->MD5, lynxie->mCart->MD5, 16);
MDFNGameInfo->GameSetMD5Valid = FALSE;
MDFN_printf(_("ROM: %dKiB\n"), (lynxie->mCart->InfoROMSize + 1023) / 1024);
MDFN_printf(_("ROM CRC32: 0x%08x\n"), lynxie->mCart->CRC32());
MDFN_printf(_("ROM MD5: 0x%s\n"), md5_context::asciistr(MDFNGameInfo->MD5, 0).c_str());
MDFNGameInfo->fps = (uint32)(59.8 * 65536 * 256);
if(MDFN_GetSettingB("lynx.lowpass"))
{
lynxie->mMikie->miksynth.treble_eq(-35);
}
else
{
lynxie->mMikie->miksynth.treble_eq(0);
}
return(1);
}
示例3: LoadCPalette
static void LoadCPalette(const char *syspalname, uint8 **ptr, uint32 num_entries)
{
std::string colormap_fn = MDFN_MakeFName(MDFNMKF_PALETTE, 0, syspalname).c_str();
MDFN_printf(_("Loading custom palette from \"%s\"...\n"), colormap_fn.c_str());
MDFN_indent(1);
try
{
FileStream fp(colormap_fn.c_str(), FileStream::MODE_READ);
*ptr = new uint8[num_entries * 3];
fp.read(*ptr, num_entries * 3);
}
catch(MDFN_Error &e)
{
MDFN_printf(_("Error: %s\n"), e.what());
MDFN_indent(-1);
if(e.GetErrno() != ENOENT)
throw;
return;
}
catch(std::exception &e)
{
MDFN_printf(_("Error: %s\n"), e.what());
MDFN_indent(-1);
throw;
}
MDFN_indent(-1);
}
示例4: DINF
static void DINF(Stream *fp)
{
union
{
struct
{
char name[100];
uint8 raw_date[4];
char method[100];
};
uint8 raw[100 + 4 + 100];
} dinf;
uint8 d, m;
uint16 y;
fp->read(dinf.raw, sizeof(dinf.raw));
d = dinf.raw_date[0];
m = dinf.raw_date[1];
y = MDFN_de16lsb(&dinf.raw_date[2]);
dinf.name[99] = dinf.method[99] = 0;
MDFN_RemoveControlChars(dinf.name);
MDFN_RemoveControlChars(dinf.method);
MDFN_printf(_("Dumped by: %s\n"), dinf.name);
MDFN_printf(_("Dumped with: %s\n"), dinf.method);
{
const char* months[12]={_("January"),_("February"),_("March"),_("April"),_("May"),_("June"),_("July"),
_("August"),_("September"),_("October"),_("November"),_("December")};
MDFN_printf(_("Dumped on: %s %d, %d\n"),months[(m-1)%12],d,y);
}
}
示例5: CDIF_DumpCD
bool CDIF_DumpCD(const char *fn)
{
FILE *fp;
if(!(fp = fopen(fn, "wb")))
{
ErrnoHolder ene(errno);
MDFN_printf("File open error: %s\n", ene.StrError());
return(0);
}
for(long long i = 0; i < toc.tracks[100].lba; i++)
{
uint8 buf[2352 + 96];
CDIF_ReadRawSector(buf, i);
if(fwrite(buf, 1, 2352 + 96, fp) != 2352 + 96)
{
ErrnoHolder ene(errno);
MDFN_printf("File write error: %s\n", ene.StrError());
}
}
if(fclose(fp))
{
ErrnoHolder ene(errno);
MDFN_printf("fclose error: %s\n", ene.StrError());
}
return(1);
}
示例6: MemoryStream
void MDFNFILE::ApplyIPS(Stream *ips)
{
//
// If the stream is not a MemoryStream, turn it into one.
//
//if(!(str->attributes() & Stream::ATTRIBUTE_WRITEABLE))
if(dynamic_cast<MemoryStream*>(str.get()) == nullptr)
{
str.reset(new MemoryStream(str.release(), MaxROMImageSize));
}
{
MDFN_AutoIndent aind(1);
uint32 count;
count = IPSPatcher::Apply(ips, str.get());
MDFN_printf(_("IPS EOF: Did %u patches\n\n"), count);
if(ips->tell() < ips->size())
{
MDFN_AutoIndent aindw(1);
MDFN_printf(_("Warning: trailing unused data in IPS file.\n"));
}
}
}
示例7: rom_hack
//=============================================================================
static void rom_hack(void)
{
//=============================
// SPECIFIC ROM HACKS !
//=============================
//"Neo-Neo! V1.0 (PD)"
if (MATCH_CATALOG(0, 16))
{
ngpc_rom.data[0x23] = 0x10; // Fix rom header
MDFN_printf("HACK: \"Neo-Neo! V1.0 (PD)\"\n");
}
//"Cool Cool Jam SAMPLE (U)"
if (MATCH_CATALOG(4660, 161))
{
ngpc_rom.data[0x23] = 0x10; // Fix rom header
MDFN_printf("HACK: \"Cool Cool Jam SAMPLE (U)\"\n");
}
//"Dokodemo Mahjong (J)"
if (MATCH_CATALOG(51, 33))
{
ngpc_rom.data[0x23] = 0x00; // Fix rom header
MDFN_printf("HACK: \"Dokodemo Mahjong (J)\"\n");
}
}
示例8: cdif_open_sub
static bool cdif_open_sub(const char *device_name)
{
MDFN_printf(_("Loading %s...\n\n"), device_name ? device_name : _("PHYSICAL CDROM DISC"));
MDFN_indent(1);
if(!(p_cdrfile = cdrfile_open(device_name)))
{
MDFN_indent(-1);
return(0);
}
CD_Info.NumTracks = cdrfile_get_num_tracks(p_cdrfile);
if(CD_Info.NumTracks < 1 || CD_Info.NumTracks > 100)
{
MDFN_indent(-1);
return(0);
}
CD_Info.FirstTrack = cdrfile_get_first_track_num(p_cdrfile);
for(track_t track = CD_Info.FirstTrack; track < CD_Info.FirstTrack + CD_Info.NumTracks; track++)
{
CD_Info.Tracks[track].LSN = cdrfile_get_track_lsn(p_cdrfile, track);
CD_Info.Tracks[track].Format = cdrfile_get_track_format(p_cdrfile, track);
MDFN_printf(_("Track %2d, LSN: %6d %s\n"), track, CD_Info.Tracks[track].LSN, track_format2str[CD_Info.Tracks[track].Format]);
}
MDFN_indent(-1);
return(1);
}
示例9: LoadCPalette
static bool LoadCPalette(const char *syspalname, uint8 **ptr, uint32 num_entries)
{
std::string colormap_fn = MDFN_MakeFName(MDFNMKF_PALETTE, 0, syspalname).c_str();
MDFN_printf(_("Loading custom palette from \"%s\"...\n"), colormap_fn.c_str());
MDFN_indent(1);
*ptr = NULL;
try
{
FileStream fp(colormap_fn.c_str(), FileStream::MODE_READ);
if(!(*ptr = (uint8 *)MDFN_malloc(num_entries * 3, _("custom color map"))))
{
MDFN_indent(-1);
return(false);
}
fp.read(*ptr, num_entries * 3);
}
catch(MDFN_Error &e)
{
if(*ptr)
{
MDFN_free(*ptr);
*ptr = NULL;
}
MDFN_printf(_("Error: %s\n"), e.what());
MDFN_indent(-1);
return(e.GetErrno() == ENOENT); // Return fatal error if it's an error other than the file not being found.
}
catch(std::exception &e)
{
if(*ptr)
{
MDFN_free(*ptr);
*ptr = NULL;
}
MDFN_printf(_("Error: %s\n"), e.what());
MDFN_indent(-1);
return(false);
}
MDFN_indent(-1);
return(true);
}
示例10: Load
static void Load(MDFNFILE *fp)
{
try
{
const uint64 fp_size = fp->size();
if(fp_size > 1024 * 1024 * 8) // 4MiB maximum ROM size, 2* to be a little tolerant of garbage.
throw MDFN_Error(0, _("NGP/NGPC ROM image is too large."));
ngpc_rom.length = fp_size;
ngpc_rom.data = new uint8[ngpc_rom.length];
fp->read(ngpc_rom.data, ngpc_rom.length);
md5_context md5;
md5.starts();
md5.update(ngpc_rom.data, ngpc_rom.length);
md5.finish(MDFNGameInfo->MD5);
rom_loaded();
MDFN_printf(_("ROM: %uKiB\n"), (ngpc_rom.length + 1023) / 1024);
MDFN_printf(_("ROM MD5: 0x%s\n"), md5_context::asciistr(MDFNGameInfo->MD5, 0).c_str());
FLASH_LoadNV();
MDFNMP_Init(1024, 1024 * 1024 * 16 / 1024);
NGPGfx = new NGPGFX_CLASS();
MDFNGameInfo->fps = (uint32)((uint64)6144000 * 65536 * 256 / 515 / 198); // 3072000 * 2 * 10000 / 515 / 198
MDFNGameInfo->GameSetMD5Valid = FALSE;
MDFNNGPCSOUND_Init();
MDFNMP_AddRAM(16384, 0x4000, CPUExRAM);
SetFRM(); // Set up fast read memory mapping
bios_install();
//main_timeaccum = 0;
z80_runtime = 0;
reset();
}
catch(...)
{
Cleanup();
throw;
}
}
示例11: Load
static void Load(MDFNFILE *fp)
{
try
{
lynxie = new CSystem(fp);
switch(lynxie->CartGetRotate())
{
case CART_ROTATE_LEFT:
MDFNGameInfo->rotated = MDFN_ROTATE270;
break;
case CART_ROTATE_RIGHT:
MDFNGameInfo->rotated = MDFN_ROTATE90;
break;
}
MDFNGameInfo->GameSetMD5Valid = false;
if(lynxie->mRam->InfoRAMSize)
{
memcpy(MDFNGameInfo->MD5, lynxie->mRam->MD5, 16);
MDFN_printf(_("RAM: %u bytes\n"), lynxie->mRam->InfoRAMSize);
MDFN_printf(_("RAM MD5: 0x%s\n"), md5_context::asciistr(MDFNGameInfo->MD5, 0).c_str());
}
else
{
memcpy(MDFNGameInfo->MD5, lynxie->mCart->MD5, 16);
MDFN_printf(_("ROM: %dKiB\n"), (lynxie->mCart->InfoROMSize + 1023) / 1024);
MDFN_printf(_("ROM MD5: 0x%s\n"), md5_context::asciistr(MDFNGameInfo->MD5, 0).c_str());
}
MDFNGameInfo->fps = (uint32)(59.8 * 65536 * 256);
if(MDFN_GetSettingB("lynx.lowpass"))
{
lynxie->mMikie->miksynth.treble_eq(-35);
}
else
{
lynxie->mMikie->miksynth.treble_eq(0);
}
}
catch(std::exception &e)
{
Cleanup();
throw;
}
}
示例12: MPCReader
MPCReader(FILE *fp)
{
fseek(fp, 0, SEEK_SET);
lseek(fileno(fp), 0, SEEK_SET);
memset(&MPCReaderFile, 0, sizeof(MPCReaderFile));
memset(&MPCStreamInfo, 0, sizeof(MPCStreamInfo));
memset(&MPCDecoder, 0, sizeof(MPCDecoder));
memset(MPCBuffer, 0, sizeof(MPCBuffer));
mpc_streaminfo_init(&MPCStreamInfo);
mpc_reader_setup_file_reader(&MPCReaderFile, fp);
if(mpc_streaminfo_read(&MPCStreamInfo, &MPCReaderFile.reader) != ERROR_CODE_OK)
{
throw(0);
}
mpc_decoder_setup(&MPCDecoder, &MPCReaderFile.reader);
if(!mpc_decoder_initialize(&MPCDecoder, &MPCStreamInfo))
{
MDFN_printf(_("Error initializing MusePack decoder!\n"));
throw(0);
}
}
示例13: PCECD_Init
int32 PCECD_Init()
{
if (!CDIF_Init())
return -1;
CDDAVolumeSetting = (double)MDFN_GetSettingUI("pce.cddavolume");
if(CDDAVolumeSetting != 100)
{
MDFN_printf(_("CD-DA Volume: %d%%\n"), (int)CDDAVolumeSetting);
}
CDDAVolumeSetting /= 100;
CurrentCDVolume = InitialCdVolume = 65536;
VolumeStep = InitialCdVolume / 100;
bFadeOut = FALSE;
bFadeIn = FALSE;
ADPCM_SetNotificationFunction(adpcm_state_notification_callback_function);
SCSICD_Init(SCSICD_PCE, 1 * pce_overclocked, &sbuf[0], &sbuf[1], 126000 * MDFN_GetSettingUI("pce.cdspeed"), 7159091 * pce_overclocked, CDIRQ, StuffSubchannel);
SyncCDVolume();
#ifdef WANT_DEBUGGER
MDFNDBG_AddRegGroup(&PCECDRegsGroup);
#endif
return 0;
}
示例14: LoadPRG
static void LoadPRG(Stream *fp)
{
uint32 t;
unsigned z;
z = uchead.ID[3] - '0'; // FIXME hex
if(z > 15)
throw MDFN_Error(0, "Invalid PRG ROM index '%c'.\n", uchead.ID[3]);
MDFN_printf(_("PRG ROM %u size: %u\n"), z, uchead.info);
if(malloced[z])
free(malloced[z]);
t = FixRomSize(uchead.info, 2048);
malloced[z] = (uint8 *)MDFN_malloc_T(t, _("PRG ROM"));
mallocedsizes[z] = t;
memset(malloced[z] + uchead.info, 0xFF, t - uchead.info);
fp->read(malloced[z], uchead.info);
SetupCartPRGMapping(z,malloced[z],t,0);
}
示例15: MakeSFMap
static void MakeSFMap(SFORMAT *sf, SFMap_t &sfmap)
{
while(sf->size || sf->name) // Size can sometimes be zero, so also check for the text name. These two should both be zero only at the end of a struct.
{
if(!sf->size || !sf->v)
{
sf++;
continue;
}
if(sf->size == (uint32)~0) /* Link to another SFORMAT structure. */
MakeSFMap((SFORMAT *)sf->v, sfmap);
else
{
assert(sf->name);
if(sfmap.find(sf->name) != sfmap.end())
MDFN_printf("Duplicate save state variable in internal emulator structures(CLUB THE PROGRAMMERS WITH BREADSTICKS): %s\n", sf->name);
sfmap[sf->name] = sf;
}
sf++;
}
}