本文整理汇总了C++中emu_options类的典型用法代码示例。如果您正苦于以下问题:C++ emu_options类的具体用法?C++ emu_options怎么用?C++ emu_options使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了emu_options类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: sizeof
web_engine::web_engine(emu_options &options)
: m_options(options),
m_machine(NULL),
m_ctx(NULL),
m_lastupdatetime(0),
m_exiting_core(false)
{
struct mg_callbacks callbacks;
// List of options. Last element must be NULL.
const char *web_options[] = {
"listening_ports", options.http_port(),
"document_root", options.http_path(),
NULL
};
// Prepare callbacks structure.
memset(&callbacks, 0, sizeof(callbacks));
callbacks.begin_request = begin_request_handler_static;
callbacks.websocket_ready = websocket_ready_handler_static;
callbacks.websocket_data = websocket_data_handler_static;
callbacks.http_error = begin_http_error_handler_static;
// Start the web server.
if (m_options.http()) {
m_ctx = mg_start(&callbacks, this, web_options);
mg_start_thread(websocket_keepalive_static, this);
}
}
示例2: init
void vector_options::init(emu_options& options)
{
s_beam_width_min = options.beam_width_min();
s_beam_width_max = options.beam_width_max();
s_beam_intensity_weight = options.beam_intensity_weight();
s_flicker = options.flicker();
}
示例3: slotiter
machine_config::machine_config(const game_driver &gamedrv, emu_options &options)
: m_minimum_quantum(attotime::zero),
m_watchdog_vblank_count(0),
m_watchdog_time(attotime::zero),
m_nvram_handler(NULL),
m_memcard_handler(NULL),
m_default_layout(NULL),
m_gamedrv(gamedrv),
m_options(options)
{
// construct the config
(*gamedrv.machine_config)(*this, NULL, NULL);
bool is_selected_driver = mame_stricmp(gamedrv.name,options.system_name())==0;
// intialize slot devices - make sure that any required devices have been allocated
slot_interface_iterator slotiter(root_device());
for (device_slot_interface *slot = slotiter.first(); slot != NULL; slot = slotiter.next())
{
device_t &owner = slot->device();
astring temp;
const char *selval = options.main_value(temp, owner.tag()+1);
bool isdefault = (options.priority(owner.tag()+1)==OPTION_PRIORITY_DEFAULT);
if (!is_selected_driver || !options.exists(owner.tag()+1))
selval = slot->default_option();
if (selval != NULL && *selval != 0)
{
const device_slot_option *option = slot->option(selval);
if (option && (isdefault || option->selectable()))
{
device_t *new_dev = device_add(&owner, option->name(), option->devtype(), option->clock());
const char *default_bios = option->default_bios();
if (default_bios != NULL)
device_t::static_set_default_bios_tag(*new_dev, default_bios);
machine_config_constructor additions = option->machine_config();
if (additions != NULL)
(*additions)(const_cast<machine_config &>(*this), new_dev, new_dev);
const input_device_default *input_device_defaults = option->input_device_defaults();
if (input_device_defaults)
device_t::static_set_input_default(*new_dev, input_device_defaults);
}
else
throw emu_fatalerror("Unknown slot option '%s' in slot '%s'", selval, owner.tag()+1);
}
}
// when finished, set the game driver
driver_device::static_set_game(*m_root_device, gamedrv);
// then notify all devices that their configuration is complete
device_iterator iter(root_device());
for (device_t *device = iter.first(); device != NULL; device = iter.next())
if (!device->configured())
device->config_complete();
}
示例4: if
machine_config::machine_config(const game_driver &gamedrv, emu_options &options)
: m_minimum_quantum(attotime::zero),
m_default_layout(nullptr),
m_gamedrv(gamedrv),
m_options(options)
{
// construct the config
(*gamedrv.machine_config)(*this, nullptr, nullptr);
bool is_selected_driver = core_stricmp(gamedrv.name,options.system_name())==0;
// intialize slot devices - make sure that any required devices have been allocated
for (device_slot_interface &slot : slot_interface_iterator(root_device()))
{
device_t &owner = slot.device();
std::string selval;
bool isdefault = (options.priority(owner.tag()+1)==OPTION_PRIORITY_DEFAULT);
if (is_selected_driver && options.exists(owner.tag()+1))
selval = options.main_value(owner.tag()+1);
else if (slot.default_option() != nullptr)
selval.assign(slot.default_option());
if (!selval.empty())
{
const device_slot_option *option = slot.option(selval.c_str());
if (option && (isdefault || option->selectable()))
{
device_t *new_dev = device_add(&owner, option->name(), option->devtype(), option->clock());
const char *default_bios = option->default_bios();
if (default_bios != nullptr)
device_t::static_set_default_bios_tag(*new_dev, default_bios);
machine_config_constructor additions = option->machine_config();
if (additions != nullptr)
(*additions)(const_cast<machine_config &>(*this), new_dev, new_dev);
const input_device_default *input_device_defaults = option->input_device_defaults();
if (input_device_defaults)
device_t::static_set_input_default(*new_dev, input_device_defaults);
}
else
throw emu_fatalerror("Unknown slot option '%s' in slot '%s'", selval.c_str(), owner.tag()+1);
}
}
// when finished, set the game driver
driver_device::static_set_game(*m_root_device, gamedrv);
// then notify all devices that their configuration is complete
for (device_t &device : device_iterator(root_device()))
if (!device.configured())
device.config_complete();
}
示例5:
web_engine::web_engine(emu_options &options)
: m_options(options),
m_machine(NULL),
m_server(NULL),
//m_lastupdatetime(0),
m_exiting_core(false),
m_http(m_options.http())
{
if (m_http) {
m_server = mg_create_server(this, ev_handler);
mg_set_option(m_server, "listening_port", options.http_port());
mg_set_option(m_server, "document_root", options.http_path());
}
}
示例6: image_battery_save_by_name
/*-------------------------------------------------
image_battery_save_by_name - stores the battery
backed RAM for an image. A filename may be supplied
to the function.
-------------------------------------------------*/
void image_battery_save_by_name(emu_options &options, const char *filename, const void *buffer, int length)
{
assert_always(buffer && (length > 0), "Must specify sensical buffer/length");
/* try to open the battery file and write it out, if possible */
emu_file file(options.nvram_directory(), OPEN_FLAG_WRITE | OPEN_FLAG_CREATE | OPEN_FLAG_CREATE_PATHS);
file_error filerr = file.open(filename);
if (filerr == FILERR_NONE)
file.write(buffer, length);
}
示例7: write_config
int image_manager::write_config(emu_options &options, const char *filename, const game_driver *gamedrv)
{
char buffer[128];
int retval = 1;
if (gamedrv != nullptr)
{
sprintf(buffer, "%s.ini", gamedrv->name);
filename = buffer;
}
emu_file file(options.ini_path(), OPEN_FLAG_WRITE | OPEN_FLAG_CREATE);
osd_file::error filerr = file.open(filename);
if (filerr == osd_file::error::NONE)
{
std::string inistring = options.output_ini();
file.puts(inistring.c_str());
retval = 0;
}
return retval;
}
示例8: write_config
static int write_config(emu_options &options, const char *filename, const game_driver *gamedrv)
{
char buffer[128];
int retval = 1;
if (gamedrv != NULL)
{
sprintf(buffer, "%s.ini", gamedrv->name);
filename = buffer;
}
emu_file file(options.ini_path(), OPEN_FLAG_WRITE | OPEN_FLAG_CREATE);
file_error filerr = file.open(filename);
if (filerr == FILERR_NONE)
{
astring inistring;
options.output_ini(inistring);
file.puts(inistring);
retval = 0;
}
return retval;
}
示例9: open_image_file
bool device_image_interface::open_image_file(emu_options &options)
{
const char* path = options.value(instance_name());
if (strlen(path)>0)
{
set_init_phase();
if (load_internal(path, FALSE, 0, NULL, TRUE)==IMAGE_INIT_PASS)
{
if (software_entry()==NULL) return true;
}
}
return false;
}
示例10: open_image_file
bool device_image_interface::open_image_file(emu_options &options)
{
const char* path = options.value(instance_name());
if (*path != 0)
{
set_init_phase();
if (load_internal(path, false, 0, nullptr, true) == image_init_result::PASS)
{
if (software_entry()==nullptr) return true;
}
}
return false;
}
示例11: common_process_file
std::unique_ptr<emu_file> common_process_file(emu_options &options, const char *location, bool has_crc, UINT32 crc, const rom_entry *romp, file_error &filerr)
{
auto image_file = std::make_unique<emu_file>(options.media_path(), OPEN_FLAG_READ);
if (has_crc)
filerr = image_file->open(location, PATH_SEPARATOR, ROM_GETNAME(romp), crc);
else
filerr = image_file->open(location, PATH_SEPARATOR, ROM_GETNAME(romp));
if (filerr != FILERR_NONE)
{
image_file = nullptr;
}
return image_file;
}
示例12: image_battery_load_by_name
void image_battery_load_by_name(emu_options &options, const char *filename, void *buffer, int length, int fill)
{
file_error filerr;
int bytes_read = 0;
assert_always(buffer && (length > 0), "Must specify sensical buffer/length");
/* try to open the battery file and read it in, if possible */
emu_file file(options.nvram_directory(), OPEN_FLAG_READ);
filerr = file.open(filename);
if (filerr == FILERR_NONE)
bytes_read = file.read(buffer, length);
/* fill remaining bytes (if necessary) */
memset(((char *) buffer) + bytes_read, fill, length - bytes_read);
}
示例13: image_battery_load_by_name
void image_battery_load_by_name(emu_options &options, const char *filename, void *buffer, int length, void *def_buffer)
{
file_error filerr;
int bytes_read = 0;
assert_always(buffer && (length > 0), "Must specify sensical buffer/length");
/* try to open the battery file and read it in, if possible */
emu_file file(options.nvram_directory(), OPEN_FLAG_READ);
filerr = file.open(filename);
if (filerr == FILERR_NONE)
bytes_read = file.read(buffer, length);
/* if no file was present, copy the default battery */
if (bytes_read == 0 && def_buffer)
memcpy((char *) buffer, (char *) def_buffer, length);
}
示例14: common_process_file
file_error common_process_file(emu_options &options, const char *location, bool has_crc, UINT32 crc, const rom_entry *romp, emu_file **image_file)
{
*image_file = global_alloc(emu_file(options.media_path(), OPEN_FLAG_READ));
file_error filerr;
if (has_crc)
filerr = (*image_file)->open(location, PATH_SEPARATOR, ROM_GETNAME(romp), crc);
else
filerr = (*image_file)->open(location, PATH_SEPARATOR, ROM_GETNAME(romp));
if (filerr != FILERR_NONE)
{
global_free(*image_file);
*image_file = NULL;
}
return filerr;
}
示例15: 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;
}