本文整理汇总了C++中chd_file类的典型用法代码示例。如果您正苦于以下问题:C++ chd_file类的具体用法?C++ chd_file怎么用?C++ chd_file使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了chd_file类的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: read_chd
static bool read_chd(chd_file &file, UINT32 field, movie_info &info, UINT32 soundoffs)
{
// configure the codec
avhuff_decompress_config avconfig;
avconfig.video.wrap(info.bitmap, info.bitmap.cliprect());
avconfig.maxsamples = info.lsound.count();
avconfig.actsamples = &info.samples;
avconfig.audio[0] = info.lsound + soundoffs;
avconfig.audio[1] = info.rsound + soundoffs;
// configure the decompressor for this field
file.codec_configure(CHD_CODEC_AVHUFF, AVHUFF_CODEC_DECOMPRESS_CONFIG, &avconfig);
// read the field
chd_error chderr = file.read_hunk(field, NULL);
return (chderr == CHDERR_NONE);
}
开发者ID:relimited,项目名称:mame,代码行数:17,代码来源:ldresample.c
示例2: open_chd
static chd_error open_chd(chd_file &file, const char *filename, movie_info &info)
{
// open the file
chd_error chderr = file.open(filename);
if (chderr != CHDERR_NONE)
{
fprintf(stderr, "Error opening CHD file: %s\n", chd_file::error_string(chderr));
return chderr;
}
// get the metadata
astring metadata;
chderr = file.read_metadata(AV_METADATA_TAG, 0, metadata);
if (chderr != CHDERR_NONE)
{
fprintf(stderr, "Error getting A/V metadata: %s\n", chd_file::error_string(chderr));
return chderr;
}
// extract the info
int fps, fpsfrac, width, height, interlaced, channels, rate;
if (sscanf(metadata.c_str(), AV_METADATA_FORMAT, &fps, &fpsfrac, &width, &height, &interlaced, &channels, &rate) != 7)
{
fprintf(stderr, "Improperly formatted metadata\n");
return CHDERR_INVALID_DATA;
}
// extract movie info
info.iframerate = fps * 1000000 + fpsfrac;
info.framerate = info.iframerate / 1000000.0;
info.numfields = file.hunk_count();
info.width = width;
info.height = height;
info.interlaced = interlaced;
info.samplerate = rate;
info.channels = channels;
// allocate buffers
info.bitmap.resize(info.width, info.height);
info.lsound.resize(info.samplerate);
info.rsound.resize(info.samplerate);
return CHDERR_NONE;
}
开发者ID:relimited,项目名称:mame,代码行数:43,代码来源:ldresample.c
示例3: open_disk_diff
static chd_error open_disk_diff(emu_options &options, const char *name, chd_file &source, chd_file &diff_chd)
{
std::string fname = std::string(name).append(".dif");
/* try to open the diff */
//printf("Opening differencing image file: %s\n", fname.c_str());
emu_file diff_file(options.diff_directory(), OPEN_FLAG_READ | OPEN_FLAG_WRITE);
osd_file::error filerr = diff_file.open(fname.c_str());
if (filerr == osd_file::error::NONE)
{
std::string fullpath(diff_file.fullpath());
diff_file.close();
//printf("Opening differencing image file: %s\n", fullpath.c_str());
return diff_chd.open(fullpath.c_str(), true, &source);
}
/* didn't work; try creating it instead */
//printf("Creating differencing image: %s\n", fname.c_str());
diff_file.set_openflags(OPEN_FLAG_READ | OPEN_FLAG_WRITE | OPEN_FLAG_CREATE | OPEN_FLAG_CREATE_PATHS);
filerr = diff_file.open(fname.c_str());
if (filerr == osd_file::error::NONE)
{
std::string fullpath(diff_file.fullpath());
diff_file.close();
/* create the CHD */
//printf("Creating differencing image file: %s\n", fupointllpath.c_str());
chd_codec_type compression[4] = { CHD_CODEC_NONE };
chd_error err = diff_chd.create(fullpath.c_str(), source.logical_bytes(), source.hunk_bytes(), compression, source);
if (err != CHDERR_NONE)
return err;
return diff_chd.clone_all_metadata(source);
}
return CHDERR_FILE_NOT_FOUND;
}
开发者ID:GiuseppeGorgoglione,项目名称:mame,代码行数:38,代码来源:harddriv.cpp
示例4: open_disk_diff
static chd_error open_disk_diff(emu_options &options, const rom_entry *romp, chd_file &source, chd_file &diff_chd)
{
astring fname(ROM_GETNAME(romp), ".dif");
/* try to open the diff */
LOG(("Opening differencing image file: %s\n", fname.cstr()));
emu_file diff_file(options.diff_directory(), OPEN_FLAG_READ | OPEN_FLAG_WRITE);
file_error filerr = diff_file.open(fname);
if (filerr == FILERR_NONE)
{
astring fullpath(diff_file.fullpath());
diff_file.close();
LOG(("Opening differencing image file: %s\n", fullpath.cstr()));
return diff_chd.open(fullpath, true, &source);
}
/* didn't work; try creating it instead */
LOG(("Creating differencing image: %s\n", fname.cstr()));
diff_file.set_openflags(OPEN_FLAG_READ | OPEN_FLAG_WRITE | OPEN_FLAG_CREATE | OPEN_FLAG_CREATE_PATHS);
filerr = diff_file.open(fname);
if (filerr == FILERR_NONE)
{
astring fullpath(diff_file.fullpath());
diff_file.close();
/* create the CHD */
LOG(("Creating differencing image file: %s\n", fullpath.cstr()));
chd_codec_type compression[4] = { CHD_CODEC_NONE };
chd_error err = diff_chd.create(fullpath, source.logical_bytes(), source.hunk_bytes(), compression, source);
if (err != CHDERR_NONE)
return err;
return diff_chd.clone_all_metadata(source);
}
return CHDERR_FILE_NOT_FOUND;
}
开发者ID:jiangzhonghui,项目名称:mame,代码行数:38,代码来源:romload.c
示例5: create_chd
static chd_error create_chd(chd_file_compressor &file, const char *filename, chd_file &source, const movie_info &info)
{
// create the file
chd_codec_type compression[4] = { CHD_CODEC_AVHUFF };
chd_error chderr = file.create(filename, source.logical_bytes(), source.hunk_bytes(), source.unit_bytes(), compression);
if (chderr != CHDERR_NONE)
{
fprintf(stderr, "Error creating new CHD file: %s\n", chd_file::error_string(chderr));
return chderr;
}
// clone the metadata
chderr = file.clone_all_metadata(source);
if (chderr != CHDERR_NONE)
{
fprintf(stderr, "Error cloning metadata: %s\n", chd_file::error_string(chderr));
return chderr;
}
// begin compressing
file.compress_begin();
return CHDERR_NONE;
}
开发者ID:relimited,项目名称:mame,代码行数:23,代码来源:ldresample.c
示例6: open_disk_image
int open_disk_image(emu_options &options, const game_driver *gamedrv, const rom_entry *romp, chd_file &image_chd, const char *locationtag)
{
emu_file image_file(options.media_path(), OPEN_FLAG_READ);
const rom_entry *region, *rom;
file_error filerr;
chd_error err;
/* attempt to open the properly named file, scanning up through parent directories */
filerr = FILERR_NOT_FOUND;
for (int searchdrv = driver_list::find(*gamedrv); searchdrv != -1 && filerr != FILERR_NONE; searchdrv = driver_list::clone(searchdrv))
filerr = common_process_file(options, driver_list::driver(searchdrv).name, ".chd", romp, image_file);
if (filerr != FILERR_NONE)
filerr = common_process_file(options, NULL, ".chd", romp, image_file);
/* look for the disk in the locationtag too */
if (filerr != FILERR_NONE && locationtag != NULL)
{
// check if we are dealing with softwarelists. if so, locationtag
// is actually a concatenation of: listname + setname + parentname
// separated by '%' (parentname being present only for clones)
astring tag1(locationtag), tag2, tag3, tag4, tag5;
bool is_list = FALSE;
bool has_parent = FALSE;
int separator1 = tag1.chr(0, '%');
if (separator1 != -1)
{
is_list = TRUE;
// we are loading through softlists, split the listname from the regiontag
tag4.cpysubstr(tag1, separator1 + 1, tag1.len() - separator1 + 1);
tag1.del(separator1, tag1.len() - separator1);
tag1.cat(PATH_SEPARATOR);
// check if we are loading a clone (if this is the case also tag1 have a separator '%')
int separator2 = tag4.chr(0, '%');
if (separator2 != -1)
{
has_parent = TRUE;
// we are loading a clone through softlists, split the setname from the parentname
tag5.cpysubstr(tag4, separator2 + 1, tag4.len() - separator2 + 1);
tag4.del(separator2, tag4.len() - separator2);
}
// prepare locations where we have to load from: list/parentname (if any) & list/clonename
astring swlist(tag1.cstr());
tag2.cpy(swlist.cat(tag4));
if (has_parent)
{
swlist.cpy(tag1);
tag3.cpy(swlist.cat(tag5));
}
}
if (tag5.chr(0, '%') != -1)
fatalerror("We do not support clones of clones!\n");
// try to load from the available location(s):
// - if we are not using lists, we have locationtag only;
// - if we are using lists, we have: list/clonename, list/parentname, clonename, parentname
if (!is_list)
filerr = common_process_file(options, locationtag, ".chd", romp, image_file);
else
{
// try to load from list/setname
if ((filerr != FILERR_NONE) && (tag2.cstr() != NULL))
filerr = common_process_file(options, tag2.cstr(), ".chd", romp, image_file);
// try to load from list/parentname (if any)
if ((filerr != FILERR_NONE) && has_parent && (tag3.cstr() != NULL))
filerr = common_process_file(options, tag3.cstr(), ".chd", romp, image_file);
// try to load from setname
if ((filerr != FILERR_NONE) && (tag4.cstr() != NULL))
filerr = common_process_file(options, tag4.cstr(), ".chd", romp, image_file);
// try to load from parentname (if any)
if ((filerr != FILERR_NONE) && has_parent && (tag5.cstr() != NULL))
filerr = common_process_file(options, tag5.cstr(), ".chd", romp, image_file);
// only for CHD we also try to load from list/
if ((filerr != FILERR_NONE) && (tag1.cstr() != NULL))
{
tag1.del(tag1.len() - 1, 1); // remove the PATH_SEPARATOR
filerr = common_process_file(options, tag1.cstr(), ".chd", romp, image_file);
}
}
}
/* did the file open succeed? */
if (filerr == FILERR_NONE)
{
astring fullpath(image_file.fullpath());
image_file.close();
/* try to open the CHD */
err = image_chd.open(fullpath);
if (err == CHDERR_NONE)
return err;
}
else
err = CHDERR_FILE_NOT_FOUND;
//.........这里部分代码省略.........
开发者ID:jiangzhonghui,项目名称:mame,代码行数:101,代码来源:romload.c
注:本文中的chd_file类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论