本文整理汇总了C++中MDFN_Error函数的典型用法代码示例。如果您正苦于以下问题:C++ MDFN_Error函数的具体用法?C++ MDFN_Error怎么用?C++ MDFN_Error使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了MDFN_Error函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: return
bool CDIF_ST::Eject(bool eject_status)
{
if(UnrecoverableError)
return(false);
try
{
int32_t old_de = DiscEjected;
DiscEjected = eject_status;
if(old_de != DiscEjected)
{
disc_cdaccess->Eject(eject_status);
if(!eject_status) // Re-read the TOC
{
disc_cdaccess->Read_TOC(&disc_toc);
if(disc_toc.first_track < 1 || disc_toc.last_track > 99 || disc_toc.first_track > disc_toc.last_track)
throw(MDFN_Error(0, _("TOC first(%d)/last(%d) track numbers bad."), disc_toc.first_track, disc_toc.last_track));
}
}
}
catch(std::exception &e)
{
log_cb(RETRO_LOG_ERROR, "%s\n", e.what());
return(false);
}
return(true);
}
开发者ID:Warriors-Blade,项目名称:beetle-psx-libretro-Simias,代码行数:32,代码来源:cdromif.cpp
示例2: data_buffer
MemoryStream::MemoryStream() : data_buffer(NULL), data_buffer_size(0), data_buffer_alloced(0), position(0)
{
data_buffer_size = 0;
data_buffer_alloced = 64;
if(!(data_buffer = (uint8*)realloc(data_buffer, data_buffer_alloced)))
throw MDFN_Error(ErrnoHolder(errno));
}
开发者ID:libretro,项目名称:beetle-pcfx-libretro,代码行数:7,代码来源:MemoryStream.cpp
示例3: 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);
}
开发者ID:Oggom,项目名称:mednafen-git,代码行数:25,代码来源:unif.cpp
示例4: va_start
void Stream::print_format(const char *format, ...)
{
char *str = NULL;
int rc;
va_list ap;
va_start(ap, format);
rc = trio_vasprintf(&str, format, ap);
va_end(ap);
if(rc < 0)
throw MDFN_Error(0, "Error in trio_vasprintf()");
else
{
try // Bleck
{
write(str, rc);
}
catch(...)
{
free(str);
throw;
}
free(str);
}
}
开发者ID:BadyRaty,项目名称:Mednafen-Core,代码行数:29,代码来源:Stream.cpp
示例5: throw
void CDIF_MT::RT_EjectDisc(bool eject_status, bool skip_actual_eject)
{
int32_t old_de = DiscEjected;
DiscEjected = eject_status;
if(old_de != DiscEjected)
{
if(!skip_actual_eject)
disc_cdaccess->Eject(eject_status);
if(!eject_status) // Re-read the TOC
{
disc_cdaccess->Read_TOC(&disc_toc);
if(disc_toc.first_track < 1 || disc_toc.last_track > 99 || disc_toc.first_track > disc_toc.last_track)
throw(MDFN_Error(0, _("TOC first(%d)/last(%d) track numbers bad."), disc_toc.first_track, disc_toc.last_track));
}
SBWritePos = 0;
ra_lba = 0;
ra_count = 0;
last_read_lba = ~0U;
memset(SectorBuffers, 0, SBSize * sizeof(CDIF_Sector_Buffer));
}
}
开发者ID:Warriors-Blade,项目名称:beetle-psx-libretro-Simias,代码行数:26,代码来源:cdromif.cpp
示例6: slock_lock
// Returns FALSE if message not read, TRUE if it was read. Will always return TRUE if "blocking" is set.
// Will throw MDFN_Error if the read message code is CDIF_MSG_FATAL_ERROR
bool CDIF_Queue::Read(CDIF_Message *message, bool blocking)
{
bool ret = true;
slock_lock((slock_t*)ze_mutex);
if(blocking)
{
while(ze_queue.size() == 0) // while, not just if.
scond_wait((scond_t*)ze_cond, (slock_t*)ze_mutex);
}
if(ze_queue.size() == 0)
ret = false;
else
{
*message = ze_queue.front();
ze_queue.pop();
}
slock_unlock((slock_t*)ze_mutex);
if(ret && message->message == CDIF_MSG_FATAL_ERROR)
throw MDFN_Error(0, "%s", message->str_message.c_str());
return(ret);
}
开发者ID:Warriors-Blade,项目名称:beetle-psx-libretro-Simias,代码行数:29,代码来源:cdromif.cpp
示例7: SendIntegrity
// Integrity checking is experimental, and needs work to function properly(in the emulator cores).
static int SendIntegrity(void)
{
StateMem sm;
md5_context md5;
uint8 digest[16];
memset(&sm, 0, sizeof(StateMem));
// Do not do a raw/data-only state for speed, due to lack of endian and bool conversion.
if(!MDFNSS_SaveSM(&sm, 0, false))
{
throw MDFN_Error(0, _("Error during save state generation."));
}
md5.starts();
md5.update(sm.data, sm.len);
md5.finish(digest);
free(sm.data);
//for(int i = 15; i >= 0; i--)
// printf("%02x", digest[i]);
//puts("");
SendCommand(MDFNNPCMD_INTEGRITY_RES, 16, digest);
return(1);
}
开发者ID:XeresRazor,项目名称:Provenance,代码行数:29,代码来源:netplay.cpp
示例8: data_buffer
MemoryStream::MemoryStream(uint64 size_hint) : data_buffer(NULL), data_buffer_size(0), data_buffer_alloced(0), position(0)
{
data_buffer_size = 0;
data_buffer_alloced = (size_hint > SIZE_MAX) ? SIZE_MAX : size_hint;
if(!(data_buffer = (uint8*)realloc(data_buffer, (size_t)data_buffer_alloced)))
throw MDFN_Error(ErrnoHolder(errno));
}
开发者ID:Warriors-Blade,项目名称:beetle-psx-libretro-Simias,代码行数:8,代码来源:MemoryStream.cpp
示例9: OpenedMode
FileWrapper::FileWrapper(const char *path, const int mode, const char *purpose) : OpenedMode(mode)
{
path_save = std::string(path);
if(mode == MODE_READ)
fp = fopen(path, "rb");
else if(mode == MODE_WRITE)
fp = fopen(path, "wb");
else if(mode == MODE_WRITE_SAFE) // SO ANNOYING
{
int open_flags = O_WRONLY | O_CREAT | O_EXCL;
#ifdef O_BINARY
open_flags |= O_BINARY;
#elif defined(_O_BINARY)
open_flags |= _O_BINARY;
#endif
#if defined(S_IRGRP) && defined(S_IROTH)
int tmpfd = open(path, open_flags, S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH);
#else
int tmpfd = open(path, open_flags, S_IRUSR | S_IWUSR);
#endif
if(tmpfd == -1)
{
ErrnoHolder ene(errno);
if(purpose)
throw(MDFN_Error(ene.Errno(), _("Error opening file \"%s\" for \"%s\": %s"), path_save.c_str(), purpose, ene.StrError()));
else
throw(MDFN_Error(ene.Errno(), _("Error opening file \"%s\": %s"), path_save.c_str(), ene.StrError()));
}
fp = fdopen(tmpfd, "wb");
}
if(!fp)
{
ErrnoHolder ene(errno);
if(purpose)
throw(MDFN_Error(ene.Errno(), _("Error opening file \"%s\" for \"%s\": %s"), path_save.c_str(), purpose, ene.StrError()));
else
throw(MDFN_Error(ene.Errno(), _("Error opening file \"%s\": %s"), path_save.c_str(), ene.StrError()));
}
}
开发者ID:Chegwin,项目名称:GBA4iOS-2.0-Beta-4,代码行数:45,代码来源:FileWrapper.cpp
示例10: ene
void FileWrapper::flush(void)
{
if(fflush(fp) == EOF)
{
ErrnoHolder ene(errno);
throw(MDFN_Error(ene.Errno(), _("Error flushing to opened file \"%s\": %s"), path_save.c_str(), ene.StrError()));
}
}
开发者ID:Chegwin,项目名称:GBA4iOS-2.0-Beta-4,代码行数:9,代码来源:FileWrapper.cpp
示例11: ene
void FileStream::truncate(uint64 length)
{
if(fflush(fp) == EOF)
{
ErrnoHolder ene(errno);
throw(MDFN_Error(ene.Errno(), _("Error truncating opened file \"%s\": %s"), path_save.c_str(), ene.StrError()));
}
}
开发者ID:gameblabla,项目名称:pce-fast-nspire,代码行数:9,代码来源:FileStream.cpp
示例12: OpenedMode
FileStream::FileStream(const std::string& path, const int mode) : OpenedMode(mode), mapping(NULL), mapping_size(0)
{
path_save = path;
if(mode == MODE_READ)
fp = fopen(path.c_str(), "rb");
else if(mode == MODE_WRITE)
fp = fopen(path.c_str(), "wb");
else if(mode == MODE_WRITE_SAFE || mode == MODE_WRITE_INPLACE) // SO ANNOYING
{
int open_flags = O_WRONLY | O_CREAT;
if(mode == MODE_WRITE_SAFE)
open_flags |= O_EXCL;
#ifdef O_BINARY
open_flags |= O_BINARY;
#elif defined(_O_BINARY)
open_flags |= _O_BINARY;
#endif
#if defined(S_IRGRP) && defined(S_IROTH)
int tmpfd = open(path.c_str(), open_flags, S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH);
#else
int tmpfd = open(path.c_str(), open_flags, S_IRUSR | S_IWUSR);
#endif
if(tmpfd == -1)
{
ErrnoHolder ene(errno);
throw(MDFN_Error(ene.Errno(), _("Error opening file \"%s\": %s"), path_save.c_str(), ene.StrError()));
}
fp = fdopen(tmpfd, "wb");
}
else
abort();
if(!fp)
{
ErrnoHolder ene(errno);
throw(MDFN_Error(ene.Errno(), _("Error opening file \"%s\": %s"), path_save.c_str(), ene.StrError()));
}
}
开发者ID:ircluzar,项目名称:RTC,代码行数:44,代码来源:FileStream.cpp
示例13: MDFN_Error
MCGenjin::MCGenjin(Blip_Buffer *bb, const uint8 *rr, uint32 rr_size)
{
uint8 revision, num256_pages, region, cs_di[2];
if(rr_size < 8192)
throw MDFN_Error(0, _("MCGenjin ROM size is too small!"));
if(memcmp(rr + 0x1FD0, "MCGENJIN", 8))
throw MDFN_Error(0, _("MC Genjin header magic missing!"));
rom.resize(round_up_pow2(rr_size));
memcpy(&rom[0], rr, rr_size);
revision = rom[0x1FD8];
num256_pages = rom[0x1FD9];
region = rom[0x1FDA];
cs_di[0] = rom[0x1FDB];
cs_di[1] = rom[0x1FDC];
for(unsigned i = 0; i < 2; i++)
{
switch(cs_di[i])
{
default:
for(unsigned si = 0; si < i; si++) // FIXME: auto ptr to make this not necessary
delete cs[si];
throw MDFN_Error(0, _("Unsupported MCGENJIN device on CS%d: 0x%02x"), i, cs_di[i]);
break;
case 0x00:
MDFN_printf(_("CS%d: Unused\n"), i);
cs[i] = new MCGenjin_CS_Device();
break;
case 0x10 ... 0x18:
case 0x20 ... 0x28:
MDFN_printf(_("CS%d: %uKiB %sRAM\n"), i, 8 << (cs_di[i] & 0xF), (cs_di[i] & 0x20) ? "Nonvolatile " : "");
cs[i] = new MCGenjin_CS_Device_RAM(8192 << (cs_di[i] & 0xF), (bool)(cs_di[i] & 0x20));
break;
}
}
}
开发者ID:chipsoftwaretester,项目名称:OpenEmu,代码行数:44,代码来源:mcgenjin.cpp
示例14: ene
void FileStream::truncate(uint64 length)
{
//not needed by mednadisc
//if(fflush(fp) == EOF || ftruncate(fileno(fp), length) != 0)
{
ErrnoHolder ene(errno);
throw(MDFN_Error(ene.Errno(), _("Error truncating opened file \"%s\": %s"), path_save.c_str(), ene.StrError()));
}
}
开发者ID:ircluzar,项目名称:RTC,代码行数:10,代码来源:FileStream.cpp
示例15: RecvState
static void RecvState(const uint32 clen)
{
StateMem sm;
std::vector<uint8> cbuf;
std::vector<uint8> buf;
memset(&sm, 0, sizeof(StateMem));
if(clen < 4)
{
throw MDFN_Error(0, _("Compressed save state data is too small: %u"), clen);
}
if(clen > 8 * 1024 * 1024) // Compressed length sanity check - 8 MiB max.
{
throw MDFN_Error(0, _("Compressed save state data is too large: %u"), clen);
}
cbuf.resize(clen);
MDFND_RecvData(&cbuf[0], clen);
uLongf len = MDFN_de32lsb(&cbuf[0]);
if(len > 12 * 1024 * 1024) // Uncompressed length sanity check - 12 MiB max.
{
throw MDFN_Error(0, _("Uncompressed save state data is too large: %llu"), (unsigned long long)len);
}
buf.resize(len);
uncompress((Bytef *)&buf[0], &len, (Bytef *)&cbuf[0] + 4, clen - 4);
sm.data = &buf[0];
sm.len = len;
if(!MDFNSS_LoadSM(&sm, 0, 0))
{
throw MDFN_Error(0, _("Error during save state loading."));
}
if(MDFNMOV_IsRecording())
MDFNMOV_RecordState();
}
开发者ID:XeresRazor,项目名称:Provenance,代码行数:43,代码来源:netplay.cpp
示例16: CCD_ReadInt
static T CCD_ReadInt(CCD_Section &s, const std::string &propname, const bool have_defval = false, const int defval = 0)
{
CCD_Section::iterator zit = s.find(propname);
if(zit == s.end())
{
if(have_defval)
return defval;
else
throw MDFN_Error(0, _("Missing property: %s"), propname.c_str());
}
const std::string &v = zit->second;
int scan_base = 10;
size_t scan_offset = 0;
long ret = 0;
if(v.length() >= 3 && v[0] == '0' && v[1] == 'x')
{
scan_base = 16;
scan_offset = 2;
}
const char *vp = v.c_str() + scan_offset;
char *ep = NULL;
if(std::numeric_limits<T>::is_signed)
ret = strtol(vp, &ep, scan_base);
else
ret = strtoul(vp, &ep, scan_base);
if(!vp[0] || ep[0])
{
throw MDFN_Error(0, _("Property %s: Malformed integer: %s"), propname.c_str(), v.c_str());
}
//if(ret < minv || ret > maxv)
//{
// throw MDFN_Error(0, _("Property %s: Integer %ld out of range(accepted: %d through %d)."), propname.c_str(), ret, minv, maxv);
//}
return ret;
}
开发者ID:libretro,项目名称:beetle-supergrafx-libretro,代码行数:43,代码来源:CDAccess_CCD.cpp
示例17: MDFNSS_LoadSM
void MDFNSS_LoadSM(Stream *st, bool data_only)
{
if(MDFN_LIKELY(data_only))
{
StateMem sm(st);
MDFN_StateAction(&sm, MEDNAFEN_VERSION_NUMERIC, true);
sm.ThrowDeferred();
}
else
{
uint8 header[32];
uint32 width, height, preview_len;
uint32 stateversion;
uint32 total_len;
int64 start_pos;
bool svbe;
start_pos = st->tell();
st->read(header, 32);
if(memcmp(header, "MEDNAFENSVESTATE", 16) && memcmp(header, "MDFNSVST", 8))
throw MDFN_Error(0, _("Missing/Wrong save state header ID."));
stateversion = MDFN_de32lsb(header + 16);
total_len = MDFN_de32lsb(header + 20) & 0x7FFFFFFF;
svbe = MDFN_de32lsb(header + 20) & 0x80000000;
width = MDFN_de32lsb(header + 24);
height = MDFN_de32lsb(header + 28);
preview_len = width * height * 3;
if((int)stateversion < 0x900) // Ensuring that (int)stateversion is > 0 is the most important part.
throw MDFN_Error(0, _("Invalid/Unsupported version in save state header."));
st->seek(preview_len, SEEK_CUR); // Skip preview
StateMem sm(st, start_pos + total_len, svbe);
MDFN_StateAction(&sm, stateversion, false); // Load state data.
sm.ThrowDeferred();
st->seek(start_pos + total_len, SEEK_SET); // Seek to just beyond end of save state before returning.
}
}
开发者ID:Oggom,项目名称:mednafen-git,代码行数:42,代码来源:state.cpp
示例18: MDFN_Error
MemoryStream::MemoryStream(const MemoryStream *zs)
{
data_buffer_size = zs->data_buffer_size;
data_buffer_alloced = zs->data_buffer_alloced;
if(!(data_buffer = (uint8*)malloc((size_t)data_buffer_alloced)))
throw MDFN_Error(ErrnoHolder(errno));
memcpy(data_buffer, zs->data_buffer, (size_t)data_buffer_size);
position = zs->position;
}
开发者ID:Warriors-Blade,项目名称:beetle-psx-libretro-Simias,代码行数:11,代码来源:MemoryStream.cpp
示例19: filestream_open
FileStream::FileStream(const char *path, const int mode)
{
fp = filestream_open(path, (mode == MODE_WRITE || mode == MODE_WRITE_INPLACE) ? RETRO_VFS_FILE_ACCESS_WRITE : RETRO_VFS_FILE_ACCESS_READ, RETRO_VFS_FILE_ACCESS_HINT_NONE);
if (!fp)
{
ErrnoHolder ene(errno);
MDFN_Error(ene.Errno(), "Error opening file:\n%s\n%s", path, ene.StrError());
}
}
开发者ID:aliaspider,项目名称:beetle-psx-libretro,代码行数:11,代码来源:FileStream.cpp
示例20: disc_cdaccess
CDIF_ST::CDIF_ST(CDAccess *cda) : disc_cdaccess(cda)
{
//puts("***WARNING USING SINGLE-THREADED CD READER***");
UnrecoverableError = false;
DiscEjected = false;
disc_cdaccess->Read_TOC(&disc_toc);
if(disc_toc.first_track < 1 || disc_toc.last_track > 99 || disc_toc.first_track > disc_toc.last_track)
throw(MDFN_Error(0, _("TOC first(%d)/last(%d) track numbers bad."), disc_toc.first_track, disc_toc.last_track));
}
开发者ID:Warriors-Blade,项目名称:beetle-psx-libretro-Simias,代码行数:12,代码来源:cdromif.cpp
注:本文中的MDFN_Error函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论