本文整理汇总了C++中core_fsize函数的典型用法代码示例。如果您正苦于以下问题:C++ core_fsize函数的具体用法?C++ core_fsize怎么用?C++ core_fsize使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了core_fsize函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: core_fsize
hash_collection &emu_file::hashes(const char *types)
{
// determine which hashes we need
astring needed;
for (const char *scan = types; *scan != 0; scan++)
if (m_hashes.hash(*scan) == NULL)
needed.cat(*scan);
// if we need nothing, skip it
if (!needed)
return m_hashes;
// load the ZIP file if needed
if (m_zipfile != NULL && load_zipped_file() != FILERR_NONE)
return m_hashes;
if (m_file == NULL)
return m_hashes;
// if we have ZIP data, just hash that directly
if (m_zipdata != NULL)
{
m_hashes.compute(m_zipdata, m_ziplength, needed);
return m_hashes;
}
// read the data if we can
const UINT8 *filedata = (const UINT8 *)core_fbuffer(m_file);
if (filedata == NULL)
return m_hashes;
// compute the hash
m_hashes.compute(filedata, core_fsize(m_file), needed);
return m_hashes;
}
开发者ID:rogerjowett,项目名称:ClientServerMAME,代码行数:34,代码来源:fileio.c
示例2: core_fsize
void sega8_cart_slot_device::get_default_card_software(std::string &result)
{
if (open_image_file(mconfig().options()))
{
const char *slot_string = "rom";
UINT32 len = core_fsize(m_file), offset = 0;
dynamic_buffer rom(len);
int type;
core_fread(m_file, &rom[0], len);
if ((len % 0x4000) == 512)
offset = 512;
type = get_cart_type(&rom[offset], len - offset);
slot_string = sega8_get_slot(type);
//printf("type: %s\n", slot_string);
clear();
result.assign(slot_string);
return;
}
software_get_default_slot(result, "rom");
}
开发者ID:BrandoCommando,项目名称:mame,代码行数:26,代码来源:sega8_slot.c
示例3: core_fsize
void apf_cart_slot_device::get_default_card_software(astring &result)
{
if (open_image_file(mconfig().options()))
{
const char *slot_string = "std";
UINT32 size = core_fsize(m_file);
int type = APF_STD;
// attempt to identify Space Destroyer, which needs 1K of additional RAM
if (size == 0x1800)
type = APF_SPACEDST;
if (size > 0x2000)
type = APF_BASIC;
slot_string = apf_get_slot(type);
//printf("type: %s\n", slot_string);
clear();
result.cpy(slot_string);
return;
}
software_get_default_slot(result, "std");
}
开发者ID:crazii,项目名称:mameplus,代码行数:25,代码来源:slot.c
示例4: core_fsize
void vc4000_cart_slot_device::get_default_card_software(std::string &result)
{
if (open_image_file(mconfig().options()))
{
const char *slot_string = "std";
UINT32 size = core_fsize(m_file);
int type = VC4000_STD;
// attempt to identify the non-standard types
if (size > 0x1000) // 6k rom + 1k ram - Chess2 only
type = VC4000_CHESS2;
else if (size > 0x0800) // some 4k roms have 1k of mirrored ram
type = VC4000_RAM1K;
slot_string = vc4000_get_slot(type);
//printf("type: %s\n", slot_string);
clear();
result.assign(slot_string);
return;
}
software_get_default_slot(result, "std");
}
开发者ID:DanielAeolusLaude,项目名称:mame,代码行数:25,代码来源:slot.c
示例5: head
void a5200_cart_slot_device::get_default_card_software(std::string &result)
{
if (open_image_file(mconfig().options()))
{
const char *slot_string = "a5200";
dynamic_buffer head(0x10);
UINT32 len = core_fsize(m_file);
int type = A5200_8K;
// check whether there is an header, to identify the cart type
if ((len % 0x1000) == 0x10)
{
core_fread(m_file, &head[0], 0x10);
type = identify_cart_type(&head[0]);
std::string info;
if (hashfile_extrainfo(*this, info) && info.compare("A13MIRRORING")==0)
type = A5200_16K_2CHIPS;
}
if (type < A5200_4K)
osd_printf_info("This game is not designed for A5200. You might want to run it in A800 or A800XL.\n");
slot_string = a800_get_slot(type);
clear();
result.assign(slot_string);
}
else
software_get_default_slot(result, "a5200");
}
开发者ID:stengun,项目名称:mame,代码行数:31,代码来源:a800_slot.cpp
示例6: core_fload
file_error core_fload(const char *filename, dynamic_buffer &data)
{
core_file *file = NULL;
file_error err;
UINT64 size;
/* attempt to open the file */
err = core_fopen(filename, OPEN_FLAG_READ, &file);
if (err != FILERR_NONE)
return err;
/* get the size */
size = core_fsize(file);
if ((UINT32)size != size)
{
core_fclose(file);
return FILERR_OUT_OF_MEMORY;
}
/* allocate memory */
data.resize(size);
/* read the data */
if (core_fread(file, &data[0], size) != size)
{
core_fclose(file);
data.clear();
return FILERR_FAILURE;
}
/* close the file and return data */
core_fclose(file);
return FILERR_NONE;
}
开发者ID:BrandoCommando,项目名称:mame,代码行数:34,代码来源:corefile.c
示例7: core_fsize
std::string vectrex_cart_slot_device::get_default_card_software()
{
if (open_image_file(mconfig().options()))
{
const char *slot_string;
UINT32 size = core_fsize(m_file);
dynamic_buffer rom(size);
int type = VECTREX_STD;
core_fread(m_file, &rom[0], size);
if (!memcmp(&rom[0x06], "SRAM", 4))
type = VECTREX_SRAM;
if (size > 0x8000)
type = VECTREX_64K;
slot_string = vectrex_get_slot(type);
//printf("type: %s\n", slot_string);
clear();
return std::string(slot_string);
}
return software_get_default_slot("vec_rom");
}
开发者ID:BenjaminSiskoo,项目名称:mame,代码行数:26,代码来源:slot.cpp
示例8: core_fsize
const char * sega8_cart_slot_device::get_default_card_software(const machine_config &config, emu_options &options)
{
if (open_image_file(options))
{
const char *slot_string = "rom";
UINT32 len = core_fsize(m_file), offset = 0;
UINT8 *ROM = global_alloc_array(UINT8, len);
int type;
core_fread(m_file, ROM, len);
if ((len % 0x4000) == 512)
offset = 512;
type = get_cart_type(ROM + offset, len - offset);
slot_string = sega8_get_slot(type);
//printf("type: %s\n", slot_string);
global_free(ROM);
clear();
return slot_string;
}
return software_get_default_slot(config, options, this, "rom");
}
开发者ID:CJBass,项目名称:mame2013-libretro,代码行数:26,代码来源:sega8_slot.c
示例9: CDI_init
void CDI_init (FILE *fsource, image_s *image, char *fsourcename)
{
image->length = core_fsize(fsource);
if (image->length < 8) printf( "Image file is too short");
fseek(fsource, image->length-8, SEEK_SET);
fread(&image->version, 4, 1, fsource);
fread(&image->header_offset, 4, 1, fsource);
if (image->header_offset == 0) printf( "Bad image format");
}
开发者ID:libretro,项目名称:reicast-emulator,代码行数:12,代码来源:cdipsr.cpp
示例10: core_fsize
hash_collection &emu_file::hashes(const char *types)
{
// determine the hashes we already have
std::string already_have;
m_hashes.hash_types(already_have);
// determine which hashes we need
std::string needed;
for (const char *scan = types; *scan != 0; scan++)
if (already_have.find_first_of(*scan) == -1)
needed.push_back(*scan);
// if we need nothing, skip it
if (needed.empty())
return m_hashes;
// load the ZIP file if needed
if (compressed_file_ready())
return m_hashes;
if (m_file == nullptr)
return m_hashes;
// if we have ZIP data, just hash that directly
if (!m__7zdata.empty())
{
m_hashes.compute(&m__7zdata[0], m__7zdata.size(), needed.c_str());
return m_hashes;
}
if (!m_zipdata.empty())
{
m_hashes.compute(&m_zipdata[0], m_zipdata.size(), needed.c_str());
return m_hashes;
}
// read the data if we can
const UINT8 *filedata = (const UINT8 *)core_fbuffer(m_file);
if (filedata == nullptr)
return m_hashes;
// compute the hash
m_hashes.compute(filedata, core_fsize(m_file), needed.c_str());
return m_hashes;
}
开发者ID:ursine,项目名称:mame,代码行数:44,代码来源:fileio.cpp
示例11: core_fsize
hash_collection &emu_file::hashes(const char *types)
{
// determine the hashes we already have
astring already_have;
m_hashes.hash_types(already_have);
// determine which hashes we need
astring needed;
for (const char *scan = types; *scan != 0; scan++)
if (already_have.chr(0, *scan) == -1)
needed.cat(*scan);
// if we need nothing, skip it
if (!needed)
return m_hashes;
// load the ZIP file if needed
if (compressed_file_ready())
return m_hashes;
if (m_file == NULL)
return m_hashes;
// if we have ZIP data, just hash that directly
if (m__7zdata.count() != 0)
{
m_hashes.compute(m__7zdata, m__7zdata.count(), needed);
return m_hashes;
}
if (m_zipdata.count() != 0)
{
m_hashes.compute(m_zipdata, m_zipdata.count(), needed);
return m_hashes;
}
// read the data if we can
const UINT8 *filedata = (const UINT8 *)core_fbuffer(m_file);
if (filedata == NULL)
return m_hashes;
// compute the hash
m_hashes.compute(filedata, core_fsize(m_file), needed);
return m_hashes;
}
开发者ID:Gu1,项目名称:libretro-mame,代码行数:44,代码来源:fileio.c
示例12: core_fsize
void crvision_cart_slot_device::get_default_card_software(std::string &result)
{
if (open_image_file(mconfig().options()))
{
const char *slot_string;
UINT32 size = core_fsize(m_file);
int type = CRV_4K;
switch (size)
{
case 0x4800:
type = CRV_18K;
break;
case 0x4000:
type = CRV_16K;
break;
case 0x3000:
type = CRV_12K;
break;
case 0x2800:
type = CRV_10K;
break;
case 0x2000:
type = CRV_8K;
break;
case 0x1800:
type = CRV_6K;
break;
case 0x1000:
default:
break;
}
slot_string = crvision_get_slot(type);
//printf("type: %s\n", slot_string);
clear();
result.assign(slot_string);
return;
}
software_get_default_slot(result, "crv_rom4k");
}
开发者ID:ursine,项目名称:mame,代码行数:44,代码来源:slot.cpp
示例13: core_fsize
void vcs_cart_slot_device::get_default_card_software(astring &result)
{
if (open_image_file(mconfig().options()))
{
const char *slot_string = "a26_4k";
UINT32 len = core_fsize(m_file);
dynamic_buffer rom(len);
int type;
core_fread(m_file, rom, len);
type = identify_cart_type(rom, len);
slot_string = vcs_get_slot(type);
clear();
result.cpy(slot_string);
}
else
software_get_default_slot(result, "a26_4k");
}
开发者ID:jbaicoianu,项目名称:mame,代码行数:21,代码来源:vcs_slot.c
示例14: CDI_init
bool CDI_init (FILE *fsource, image_s *image, const char *fsourcename)
{
image->length = core_fsize(fsource);
if (image->length < 8)
{
printf("%s: Image file is too short\n", fsourcename);
return false;
}
fseek(fsource, image->length-8, SEEK_SET);
fread(&image->version, 4, 1, fsource);
fread(&image->header_offset, 4, 1, fsource);
if ((image->version != CDI_V2 && image->version != CDI_V3 && image->version != CDI_V35)
|| image->header_offset == 0)
{
printf("%s: Bad image format\n", fsourcename);
return false;
}
return true;
}
开发者ID:twinaphex,项目名称:reicast-emulator,代码行数:22,代码来源:cdipsr.cpp
示例15: core_fsize
std::string channelf_cart_slot_device::get_default_card_software()
{
if (open_image_file(mconfig().options()))
{
const char *slot_string;
UINT32 len = core_fsize(m_file);
int type;
if (len == 0x40000)
type = CF_MULTI;
else
type = CF_CHESS; // is there any way to detect the other carts from fullpath?
slot_string = chanf_get_slot(type);
//printf("type: %s\n", slot_string);
clear();
return std::string(slot_string);
}
return software_get_default_slot("chess");
}
开发者ID:DragonMinded,项目名称:mame,代码行数:22,代码来源:slot.cpp
示例16: core_fsize
void gba_cart_slot_device::get_default_card_software(std::string &result)
{
if (open_image_file(mconfig().options()))
{
const char *slot_string = "gba_rom";
UINT32 len = core_fsize(m_file);
dynamic_buffer rom(len);
int type;
core_fread(m_file, &rom[0], len);
type = get_cart_type(&rom[0], len);
slot_string = gba_get_slot(type);
//printf("type: %s\n", slot_string);
clear();
result.assign(slot_string);
return;
}
software_get_default_slot(result, "gba_rom");
}
开发者ID:dientaufan,项目名称:mame,代码行数:23,代码来源:gba_slot.c
示例17: core_fsize
const char * gba_cart_slot_device::get_default_card_software(const machine_config &config, emu_options &options)
{
if (open_image_file(options))
{
const char *slot_string = "gba_rom";
UINT32 len = core_fsize(m_file);
UINT8 *ROM = global_alloc_array(UINT8, len);
int type;
core_fread(m_file, ROM, len);
type = get_cart_type(ROM, len);
slot_string = gba_get_slot(type);
//printf("type: %s\n", slot_string);
global_free(ROM);
clear();
return slot_string;
}
return software_get_default_slot(config, options, this, "gba_rom");
}
开发者ID:antervud,项目名称:MAMEHub,代码行数:23,代码来源:gba_slot.c
示例18: core_fload
file_error core_fload(const char *filename, void **data, UINT32 *length)
{
core_file *file = NULL;
file_error err;
UINT64 size;
/* attempt to open the file */
err = core_fopen(filename, OPEN_FLAG_READ, &file);
if (err != FILERR_NONE)
return err;
/* get the size */
size = core_fsize(file);
if ((UINT32)size != size)
{
core_fclose(file);
return FILERR_OUT_OF_MEMORY;
}
/* allocate memory */
*data = osd_malloc(size);
if (length != NULL)
*length = (UINT32)size;
/* read the data */
if (core_fread(file, *data, size) != size)
{
core_fclose(file);
free(*data);
return FILERR_FAILURE;
}
/* close the file and return data */
core_fclose(file);
return FILERR_NONE;
}
开发者ID:LibXenonProject,项目名称:mame-lx,代码行数:36,代码来源:corefile.c
示例19: core_fsize
void msx_slot_cartridge_device::get_default_card_software(std::string &result)
{
if (open_image_file(mconfig().options()))
{
const char *slot_string = "nomapper";
UINT32 length = core_fsize(m_file);
dynamic_buffer rom(length);
int type = NOMAPPER;
// Check if there's some mapper related information in the hashfiles
std::string extrainfo;
if (hashfile_extrainfo(*this, extrainfo))
{
int extrainfo_type = -1;
if (1 == sscanf(extrainfo.c_str(), "%d", &extrainfo_type))
{
static const struct { int extrainfo; int mapper; } extrainfo_map[] = {
//{ 0, NOMAPPER },
{ 1, MSXDOS2 },
{ 2, KONAMI_SCC },
{ 3, KONAMI },
{ 4, ASCII8 },
{ 5, ASCII16 },
{ 6, GAMEMASTER2 },
{ 7, ASCII8_SRAM },
{ 8, ASCII16_SRAM },
{ 9, RTYPE },
{ 10, MAJUTSUSHI },
{ 11, FMPAC },
{ 12, SUPERLODERUNNER },
{ 13, SYNTHESIZER },
{ 14, CROSSBLAIM },
{ 15, DISK_ROM },
{ 16, KOREAN_80IN1 },
{ 17, KOREAN_126IN1 }
};
for (int i = 0; i < ARRAY_LENGTH(extrainfo_map); i++)
{
if (extrainfo_map[i].extrainfo == extrainfo_type)
{
type = extrainfo_map[i].mapper;
}
}
}
}
if (type == NOMAPPER)
{
// Not identified through hashfile, try automatic detection
type = get_cart_type(&rom[0], length);
}
if (type > NOMAPPER)
{
slot_string = msx_cart_get_slot_option(type);
}
result.assign(slot_string);
return;
}
software_get_default_slot(result, "nomapper");
}
开发者ID:DanielAeolusLaude,项目名称:mame,代码行数:63,代码来源:cartridge.c
示例20: head
void a78_cart_slot_device::get_default_card_software(astring &result)
{
if (open_image_file(mconfig().options()))
{
const char *slot_string = "a78_rom";
dynamic_buffer head(128);
int type = A78_TYPE0, mapper;
// Load and check the header
core_fread(m_file, head, 128);
// let's try to auto-fix some common errors in the header
mapper = validate_header((head[53] << 8) | head[54], FALSE);
switch (mapper & 0x2e)
{
case 0x0000:
type = BIT(mapper, 0) ? A78_TYPE1 : A78_TYPE0;
break;
case 0x0002:
type = BIT(mapper, 0) ? A78_TYPE3 : A78_TYPE2;
break;
case 0x0006:
type = A78_TYPE6;
break;
case 0x000a:
type = A78_TYPEA;
break;
case 0x0022:
case 0x0026:
if (core_fsize(m_file) > 0x40000)
type = A78_MEGACART;
else
type = A78_VERSABOARD;
break;
}
// check if cart has a POKEY at $0450 (typically a VersaBoard variant)!
if (mapper & 0x40)
{
if (type != A78_TYPE2)
{
type &= ~0x02;
type += A78_POKEY0450;
}
}
// check special bits, which override the previous
if ((mapper & 0xff00) == 0x0100)
type = A78_ACTIVISION;
else if ((mapper & 0xff00) == 0x0200)
type = A78_ABSOLUTE;
logerror("Cart type: %x\n", type);
slot_string = a78_get_slot(type);
clear();
result.cpy(slot_string);
}
else
software_get_default_slot(result, "a78_rom");
}
开发者ID:Ander-son,项目名称:libretro-mame,代码行数:63,代码来源:a78_slot.c
注:本文中的core_fsize函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论