本文整理汇总了C++中core_fsize函数的典型用法代码示例。如果您正苦于以下问题:C++ core_fsize函数的具体用法?C++ core_fsize怎么用?C++ core_fsize使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了core_fsize函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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;
}
示例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");
}
示例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");
}
示例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");
}
示例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");
}
示例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;
}
示例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");
}
示例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");
}
示例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");
}
示例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;
}
示例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;
}
示例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");
}
示例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");
}
示例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;
}
示例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");
}