本文整理汇总了C++中running_machine::options方法的典型用法代码示例。如果您正苦于以下问题:C++ running_machine::options方法的具体用法?C++ running_machine::options怎么用?C++ running_machine::options使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类running_machine
的用法示例。
在下文中一共展示了running_machine::options方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: hiscore_load
static void hiscore_load (running_machine &machine)
{
file_error filerr;
emu_file f(machine.options().hiscore_directory(), OPEN_FLAG_READ);
filerr = f.open(machine.basename(), ".hi");
state.hiscores_have_been_loaded = 1;
if (filerr == FILERR_NONE)
{
memory_range *mem_range = state.mem_range;
while (mem_range)
{
UINT8 *data = global_alloc_array(UINT8, mem_range->num_bytes);
if (data)
{
/* this buffer will almost certainly be small
enough to be dynamically allocated, but let's
avoid memory trashing just in case */
f.read(data, mem_range->num_bytes);
copy_to_memory (machine,mem_range->cpu, mem_range->addr, data, mem_range->num_bytes);
global_free_array(data);
}
mem_range = mem_range->next;
}
f.close();
}
}
示例2: memcard_eject
void memcard_eject(running_machine &machine)
{
generic_machine_private *state = machine.generic_machine_data;
char name[16];
/* if no card is preset, just ignore */
if (state->memcard_inserted == -1)
return;
/* create a name */
memcard_name(state->memcard_inserted, name);
/* open the file; if we can't, it's an error */
emu_file file(machine.options().memcard_directory(), OPEN_FLAG_WRITE | OPEN_FLAG_CREATE | OPEN_FLAG_CREATE_PATHS);
file_error filerr = file.open(machine.basename(), PATH_SEPARATOR, name);
if (filerr != FILERR_NONE)
return;
/* initialize and then load the card */
if (machine.config().m_memcard_handler)
(*machine.config().m_memcard_handler)(machine, file, MEMCARD_EJECT);
/* close the file */
state->memcard_inserted = -1;
}
示例3: draw13_init
int draw13_init(running_machine &machine, sdl_draw_info *callbacks)
{
const char *stemp;
// fill in the callbacks
callbacks->exit = draw13_exit;
callbacks->attach = draw13_attach;
mame_printf_verbose("Using SDL native texturing driver (SDL 2.0+)\n");
expand_copy_info(blit_info_default);
//FIXME: -opengl16 should be -opengl -prefer16bpp
//if (video_config.prefer16bpp_tex)
expand_copy_info(blit_info_16bpp);
// Load the GL library now - else MT will fail
stemp = downcast<sdl_options &>(machine.options()).gl_lib();
if (stemp != NULL && strcmp(stemp, SDLOPTVAL_AUTO) == 0)
stemp = NULL;
// No fatalerror here since not all video drivers support GL !
if (SDL_GL_LoadLibrary(stemp) != 0) // Load library (default for e==NULL
mame_printf_verbose("Warning: Unable to load opengl library: %s\n", stemp ? stemp : "<default>");
else
mame_printf_verbose("Loaded opengl shared library: %s\n", stemp ? stemp : "<default>");
return 0;
}
示例4:
cheat_manager::cheat_manager(running_machine &machine)
: m_machine(machine),
m_disabled(true),
m_symtable(&machine)
{
// if the cheat engine is disabled, we're done
if (!machine.options().cheat())
return;
m_output.resize(UI_TARGET_FONT_ROWS*2);
m_justify.resize(UI_TARGET_FONT_ROWS*2);
// request a callback
machine.add_notifier(MACHINE_NOTIFY_FRAME, machine_notify_delegate(FUNC(cheat_manager::frame_update), this));
// create a global symbol table
m_symtable.add("frame", symbol_table::READ_ONLY, &m_framecount);
m_symtable.add("frombcd", nullptr, 1, 1, execute_frombcd);
m_symtable.add("tobcd", nullptr, 1, 1, execute_tobcd);
// we rely on the debugger expression callbacks; if the debugger isn't
// enabled, we must jumpstart them manually
if ((machine.debug_flags & DEBUG_FLAG_ENABLED) == 0)
{
m_cpu = std::make_unique<debugger_cpu>(machine);
// configure for memory access (shared with debugger)
m_cpu->configure_memory(m_symtable);
}
// load the cheats
reload();
}
示例5: memcard_insert
int memcard_insert(running_machine &machine, int index)
{
generic_machine_private *state = machine.generic_machine_data;
char name[16];
/* if a card is already inserted, eject it first */
if (state->memcard_inserted != -1)
memcard_eject(machine);
assert(state->memcard_inserted == -1);
/* create a name */
memcard_name(index, name);
/* open the file; if we can't, it's an error */
emu_file file(machine.options().memcard_directory(), OPEN_FLAG_READ);
file_error filerr = file.open(machine.basename(), PATH_SEPARATOR, name);
if (filerr != FILERR_NONE)
return 1;
/* initialize and then load the card */
if (machine.config().m_memcard_handler)
(*machine.config().m_memcard_handler)(machine, file, MEMCARD_INSERT);
/* close the file */
state->memcard_inserted = index;
return 0;
}
示例6: winvideo_init
void winvideo_init(running_machine &machine)
{
int index;
// ensure we get called on the way out
machine.add_notifier(MACHINE_NOTIFY_EXIT, machine_notify_delegate(FUNC(winvideo_exit), &machine));
// extract data from the options
extract_video_config(machine);
// set up monitors first
init_monitors();
// initialize the window system so we can make windows
winwindow_init(machine);
// create the windows
windows_options &options = downcast<windows_options &>(machine.options());
for (index = 0; index < video_config.numscreens; index++)
winwindow_video_window_create(machine, index, pick_monitor(options, index), &video_config.window[index]);
if (video_config.mode != VIDEO_MODE_NONE)
SetForegroundWindow(win_window_list->hwnd);
// possibly create the debug window, but don't show it yet
if (machine.debug_flags & DEBUG_FLAG_OSD_ENABLED)
debugwin_init_windows(machine);
}
示例7:
cheat_manager::cheat_manager(running_machine &machine)
: m_machine(machine),
m_cheatlist(machine.respool()),
m_disabled(true),
m_symtable(&machine)
{
// if the cheat engine is disabled, we're done
if (!machine.options().cheat())
return;
// request a callback
machine.add_notifier(MACHINE_NOTIFY_FRAME, machine_notify_delegate(FUNC(cheat_manager::frame_update), this));
// create a global symbol table
m_symtable.add("frame", symbol_table::READ_ONLY, &m_framecount);
m_symtable.add("frombcd", NULL, 1, 1, execute_frombcd);
m_symtable.add("tobcd", NULL, 1, 1, execute_tobcd);
// we rely on the debugger expression callbacks; if the debugger isn't
// enabled, we must jumpstart them manually
if ((machine.debug_flags & DEBUG_FLAG_ENABLED) == 0)
debug_cpu_init(machine);
// configure for memory access (shared with debugger)
debug_cpu_configure_memory(machine, m_symtable);
// load the cheats
reload();
}
示例8:
ui_menu_misc_options::ui_menu_misc_options(running_machine &machine, render_container *container) : ui_menu(machine, container)
{
for (int d = 1; d < ARRAY_LENGTH(m_options); ++d)
if (machine.ui().options().exists(m_options[d].option))
m_options[d].status = machine.ui().options().bool_value(m_options[d].option);
else
m_options[d].status = machine.options().bool_value(m_options[d].option);
}
示例9: winsound_init
void winsound_init(running_machine &machine)
{
// if no sound, don't create anything
if (!machine.options().sound())
return;
#ifdef USE_AUDIO_SYNC
audio_sync = machine.options().bool_value(WINOPTION_AUDIO_SYNC);
#endif /* USE_AUDIO_SYNC */
// ensure we get called on the way out
machine.add_notifier(MACHINE_NOTIFY_EXIT, machine_notify_delegate(FUNC(sound_exit), &machine));
// attempt to initialize directsound
// don't make it fatal if we can't -- we'll just run without sound
dsound_init(machine);
}
示例10: strcmp
ui_menu_sound_options::ui_menu_sound_options(running_machine &machine, render_container *container) : ui_menu(machine, container)
{
osd_options &options = downcast<osd_options &>(machine.options());
m_sample_rate = machine.options().sample_rate();
m_sound = (strcmp(options.sound(), OSDOPTVAL_NONE) && strcmp(options.sound(), "0"));
m_samples = machine.options().samples();
int total = ARRAY_LENGTH(m_sound_rate);
for (m_cur_rates = 0; m_cur_rates < total; m_cur_rates++)
if (m_sample_rate == m_sound_rate[m_cur_rates])
break;
if (m_cur_rates == total)
m_cur_rates = 2;
}
示例11: config_load_settings
int config_load_settings(running_machine &machine)
{
const char *controller = machine.options().ctrlr();
config_type *type;
int loaded = 0;
/* loop over all registrants and call their init function */
for (type = typelist; type; type = type->next)
type->load(CONFIG_TYPE_INIT, NULL);
/* now load the controller file */
if (controller[0] != 0)
{
/* open the config file */
emu_file file(machine.options().ctrlr_path(), OPEN_FLAG_READ);
file_error filerr = file.open(controller, ".cfg");
if (filerr != FILERR_NONE)
throw emu_fatalerror(_("Could not load controller file %s.cfg"), controller);
/* load the XML */
if (!config_load_xml(machine, file, CONFIG_TYPE_CONTROLLER))
throw emu_fatalerror(_("Could not load controller file %s.cfg"), controller);
}
/* next load the defaults file */
emu_file file(machine.options().cfg_directory(), OPEN_FLAG_READ);
file_error filerr = file.open("default.cfg");
if (filerr == FILERR_NONE)
config_load_xml(machine, file, CONFIG_TYPE_DEFAULT);
/* finally, load the game-specific file */
filerr = file.open(machine.basename(), ".cfg");
if (filerr == FILERR_NONE)
loaded = config_load_xml(machine, file, CONFIG_TYPE_GAME);
/* loop over all registrants and call their final function */
for (type = typelist; type; type = type->next)
type->load(CONFIG_TYPE_FINAL, NULL);
/* if we didn't find a saved config, return 0 so the main core knows that it */
/* is the first time the game is run and it should diplay the disclaimer. */
return loaded;
}
示例12: extract_video_config
static void extract_video_config(running_machine &machine)
{
windows_options &options = downcast<windows_options &>(machine.options());
const char *stemp;
// global options: extract the data
video_config.windowed = options.window();
video_config.prescale = options.prescale();
video_config.keepaspect = options.keep_aspect();
video_config.numscreens = options.numscreens();
// if we are in debug mode, never go full screen
if (machine.debug_flags & DEBUG_FLAG_OSD_ENABLED)
video_config.windowed = TRUE;
// per-window options: extract the data
const char *default_resolution = options.resolution();
get_resolution(default_resolution, options.resolution(0), &video_config.window[0], TRUE);
get_resolution(default_resolution, options.resolution(1), &video_config.window[1], TRUE);
get_resolution(default_resolution, options.resolution(2), &video_config.window[2], TRUE);
get_resolution(default_resolution, options.resolution(3), &video_config.window[3], TRUE);
// video options: extract the data
stemp = options.video();
if (strcmp(stemp, "d3d") == 0)
video_config.mode = VIDEO_MODE_D3D;
else if (strcmp(stemp, "auto") == 0)
video_config.mode = VIDEO_MODE_D3D;
else if (strcmp(stemp, "ddraw") == 0)
video_config.mode = VIDEO_MODE_DDRAW;
else if (strcmp(stemp, "gdi") == 0)
video_config.mode = VIDEO_MODE_GDI;
else if (strcmp(stemp, "none") == 0)
{
video_config.mode = VIDEO_MODE_NONE;
if (options.seconds_to_run() == 0)
osd_printf_warning("Warning: -video none doesn't make much sense without -seconds_to_run\n");
}
else
{
osd_printf_warning("Invalid video value %s; reverting to gdi\n", stemp);
video_config.mode = VIDEO_MODE_GDI;
}
video_config.waitvsync = options.wait_vsync();
video_config.syncrefresh = options.sync_refresh();
video_config.triplebuf = options.triple_buffer();
video_config.switchres = options.switch_res();
// ddraw options: extract the data
video_config.hwstretch = options.hwstretch();
// d3d options: extract the data
video_config.filter = options.filter();
if (video_config.prescale == 0)
video_config.prescale = 1;
}
示例13: display_ui_chooser
void emulator_info::display_ui_chooser(running_machine& machine)
{
// force the UI to show the game select screen
if (strcmp(machine.options().ui(), "simple") == 0) {
ui_simple_menu_select_game::force_game_select(machine, &machine.render().ui_container());
}
else {
ui_menu_select_game::force_game_select(machine, &machine.render().ui_container());
}
}
示例14: display_ui_chooser
void emulator_info::display_ui_chooser(running_machine& machine)
{
// force the UI to show the game select screen
mame_ui_manager &mui = mame_machine_manager::instance()->ui();
render_container &container = machine.render().ui_container();
if (machine.options().ui() == emu_options::UI_SIMPLE)
ui::simple_menu_select_game::force_game_select(mui, container);
else
ui::menu_select_game::force_game_select(mui, container);
}
示例15: path
ui_menu_custom_ui::ui_menu_custom_ui(running_machine &machine, render_container *container) : ui_menu(machine, container)
{
// load languages
file_enumerator path(machine.options().language_path());
const char *lang = machine.options().language();
const osd_directory_entry *dirent;
int cnt = 0;
while ((dirent = path.next()) != nullptr)
if (dirent->type == ENTTYPE_DIR && strcmp(dirent->name, ".") != 0 && strcmp(dirent->name, "..") != 0)
{
auto name = std::string(dirent->name);
int i = strreplace(name, "_", " (");
if (i > 0) name = name.append(")");
m_lang.push_back(name);
if (strcmp(name.c_str(), lang) == 0)
m_currlang = cnt;
++cnt;
}
}