本文整理汇总了C++中options_get_string函数的典型用法代码示例。如果您正苦于以下问题:C++ options_get_string函数的具体用法?C++ options_get_string怎么用?C++ options_get_string使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了options_get_string函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: osd_init
void osd_init(running_machine *machine)
{
int watchdog = options_get_int(mame_options(), WINOPTION_WATCHDOG);
const char *stemp;
// thread priority
if (!(machine->debug_flags & DEBUG_FLAG_OSD_ENABLED))
SetThreadPriority(GetCurrentThread(), options_get_int(mame_options(), WINOPTION_PRIORITY));
// ensure we get called on the way out
add_exit_callback(machine, osd_exit);
// get number of processors
stemp = options_get_string(mame_options(), WINOPTION_NUMPROCESSORS);
osd_num_processors = 0;
if (strcmp(stemp, "auto") != 0)
{
osd_num_processors = atoi(stemp);
if (osd_num_processors < 1)
{
mame_printf_warning("Warning: numprocessors < 1 doesn't make much sense. Assuming auto ...\n");
osd_num_processors = 0;
}
}
// initialize the subsystems
winvideo_init(machine);
winsound_init(machine);
wininput_init(machine);
winoutput_init(machine);
// hook up the debugger log
if (options_get_bool(mame_options(), WINOPTION_OSLOG))
add_logerror_callback(machine, output_oslog);
// crank up the multimedia timer resolution to its max
// this gives the system much finer timeslices
timeresult = timeGetDevCaps(&caps, sizeof(caps));
if (timeresult == TIMERR_NOERROR)
timeBeginPeriod(caps.wPeriodMin);
// set our multimedia tasks if we can
// if (av_set_mm_thread_characteristics != NULL)
// mm_task = (*av_set_mm_thread_characteristics)(TEXT("Playback"), &task_index);
start_profiler();
// if a watchdog thread is requested, create one
if (watchdog != 0)
{
watchdog_reset_event = CreateEvent(NULL, FALSE, FALSE, NULL);
assert_always(watchdog_reset_event != NULL, "Failed to create watchdog reset event");
watchdog_exit_event = CreateEvent(NULL, TRUE, FALSE, NULL);
assert_always(watchdog_exit_event != NULL, "Failed to create watchdog exit event");
watchdog_thread = CreateThread(NULL, 0, watchdog_thread_entry, (LPVOID)(FPTR)watchdog, 0, NULL);
assert_always(watchdog_thread != NULL, "Failed to create watchdog thread");
}
}
示例2: cmd_set_option_string
void
cmd_set_option_string(struct cmd_ctx *ctx, struct options *oo,
const struct set_option_entry *entry, char *value, int append)
{
struct options_entry *o;
char *oldvalue, *newvalue;
if (value == NULL) {
ctx->error(ctx, "empty value");
return;
}
if (append) {
oldvalue = options_get_string(oo, entry->name);
xasprintf(&newvalue, "%s%s", oldvalue, value);
} else
newvalue = value;
o = options_set_string(oo, entry->name, "%s", newvalue);
ctx->info(ctx,
"set option: %s -> %s", o->name, cmd_set_option_print(entry, o));
if (newvalue != value)
xfree(newvalue);
}
示例3: config_load_settings
int config_load_settings(running_machine *machine)
{
const char *controller = options_get_string(mame_options(), OPTION_CTRLR);
file_error filerr;
config_type *type;
mame_file *file;
int loaded = 0;
astring *fname;
/* 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 */
fname = astring_assemble_2(astring_alloc(), controller, ".cfg");
filerr = mame_fopen(SEARCHPATH_CTRLR, astring_c(fname), OPEN_FLAG_READ, &file);
astring_free(fname);
if (filerr != FILERR_NONE)
fatalerror("Could not load controller file %s.cfg", controller);
/* load the XML */
if (!config_load_xml(machine, file, CONFIG_TYPE_CONTROLLER))
fatalerror("Could not load controller file %s.cfg", controller);
mame_fclose(file);
}
/* next load the defaults file */
filerr = mame_fopen(SEARCHPATH_CONFIG, "default.cfg", OPEN_FLAG_READ, &file);
if (filerr == FILERR_NONE)
{
config_load_xml(machine, file, CONFIG_TYPE_DEFAULT);
mame_fclose(file);
}
/* finally, load the game-specific file */
fname = astring_assemble_2(astring_alloc(), machine->basename, ".cfg");
filerr = mame_fopen(SEARCHPATH_CONFIG, astring_c(fname), OPEN_FLAG_READ, &file);
astring_free(fname);
if (filerr == FILERR_NONE)
{
loaded = config_load_xml(machine, file, CONFIG_TYPE_GAME);
mame_fclose(file);
}
/* 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;
}
示例4: sound_init
void sound_init(running_machine *machine)
{
attotime update_frequency = SOUND_UPDATE_FREQUENCY;
const char *filename;
/* handle -nosound */
nosound_mode = !options_get_bool(mame_options(), OPTION_SOUND);
if (nosound_mode)
Machine->sample_rate = 11025;
/* count the speakers */
for (totalspeakers = 0; Machine->drv->speaker[totalspeakers].tag; totalspeakers++) ;
VPRINTF(("total speakers = %d\n", totalspeakers));
/* allocate memory for mix buffers */
leftmix = auto_malloc(Machine->sample_rate * sizeof(*leftmix));
rightmix = auto_malloc(Machine->sample_rate * sizeof(*rightmix));
finalmix = auto_malloc(Machine->sample_rate * sizeof(*finalmix));
/* allocate a global timer for sound timing */
sound_update_timer = timer_alloc(sound_update, NULL);
timer_adjust(sound_update_timer, update_frequency, 0, update_frequency);
/* initialize the streams engine */
VPRINTF(("streams_init\n"));
streams_init(machine, update_frequency.attoseconds);
/* now start up the sound chips and tag their streams */
VPRINTF(("start_sound_chips\n"));
start_sound_chips();
/* then create all the speakers */
VPRINTF(("start_speakers\n"));
start_speakers();
/* finally, do all the routing */
VPRINTF(("route_sound\n"));
route_sound();
/* open the output WAV file if specified */
filename = options_get_string(mame_options(), OPTION_WAVWRITE);
if (filename[0] != 0)
wavfile = wav_open(filename, machine->sample_rate, 2);
/* enable sound by default */
global_sound_enabled = TRUE;
sound_muted = FALSE;
sound_set_attenuation(options_get_int(mame_options(), OPTION_VOLUME));
/* register callbacks */
config_register("mixer", sound_load, sound_save);
add_pause_callback(machine, sound_pause);
add_reset_callback(machine, sound_reset);
add_exit_callback(machine, sound_exit);
}
示例5: options_get_string
const char *image_get_device_option(device_image_interface *image)
{
const char *result = NULL;
if (options_get_bool(image->device().machine->options(), OPTION_ADDED_DEVICE_OPTIONS))
{
/* access the option */
result = options_get_string(image->device().machine->options(), image->image_config().instance_name());
}
return result;
}
示例6: server_fill_environ
void
server_fill_environ(struct session *s, struct environ *env)
{
char tmuxvar[MAXPATHLEN], *term;
u_int idx;
if (session_index(s, &idx) != 0)
fatalx("session not found");
xsnprintf(tmuxvar, sizeof tmuxvar,
"%s,%ld,%u", socket_path, (long) getpid(), idx);
environ_set(env, "TMUX", tmuxvar);
term = options_get_string(&s->options, "default-terminal");
environ_set(env, "TERM", term);
}
示例7: format_window_name
char *
format_window_name(struct window *w)
{
struct format_tree *ft;
char *fmt, *name;
ft = format_create(NULL, 0);
format_defaults_window(ft, w);
format_defaults_pane(ft, w->active);
fmt = options_get_string(w->options, "automatic-rename-format");
name = format_expand(ft, fmt);
format_free(ft);
return (name);
}
示例8: options_get
static int options_get(lua_State * L) {
name k = to_name_ext(L, 2);
auto it = get_option_declarations().find(k);
if (it == get_option_declarations().end()) {
throw exception(sstream() << "unknown option '" << k.to_string().c_str() << "'");
} else {
option_declaration const & d = it->second;
switch (d.kind()) {
case BoolOption: return options_get_bool(L);
case IntOption: return options_get_int(L);
case UnsignedOption: return options_get_unsigned(L);
case DoubleOption: return options_get_double(L);
case StringOption: return options_get_string(L);
default: throw exception(sstream() << "unsupported option kind for '" << k.to_string().c_str() << "'");
}
}
}
示例9: sound_init
void sound_init(running_machine *machine)
{
sound_private *global;
const char *filename;
machine->sound_data = global = auto_alloc_clear(machine, sound_private);
/* handle -nosound */
global->nosound_mode = !options_get_bool(machine->options(), OPTION_SOUND);
if (global->nosound_mode)
machine->sample_rate = 11025;
/* count the speakers */
VPRINTF(("total speakers = %d\n", speaker_output_count(machine->config)));
/* allocate memory for mix buffers */
global->leftmix = auto_alloc_array(machine, INT32, machine->sample_rate);
global->rightmix = auto_alloc_array(machine, INT32, machine->sample_rate);
global->finalmix = auto_alloc_array(machine, INT16, machine->sample_rate);
/* allocate a global timer for sound timing */
global->update_timer = timer_alloc(machine, sound_update, NULL);
timer_adjust_periodic(global->update_timer, STREAMS_UPDATE_ATTOTIME, 0, STREAMS_UPDATE_ATTOTIME);
/* finally, do all the routing */
VPRINTF(("route_sound\n"));
route_sound(machine);
/* open the output WAV file if specified */
filename = options_get_string(machine->options(), OPTION_WAVWRITE);
if (filename[0] != 0)
global->wavfile = wav_open(filename, machine->sample_rate, 2);
/* enable sound by default */
global->enabled = TRUE;
global->muted = FALSE;
sound_set_attenuation(machine, options_get_int(machine->options(), OPTION_VOLUME));
/* register callbacks */
config_register(machine, "mixer", sound_load, sound_save);
machine->add_notifier(MACHINE_NOTIFY_PAUSE, sound_pause);
machine->add_notifier(MACHINE_NOTIFY_RESUME, sound_resume);
machine->add_notifier(MACHINE_NOTIFY_RESET, sound_reset);
machine->add_notifier(MACHINE_NOTIFY_EXIT, sound_exit);
}
示例10: set_starting_view
static void set_starting_view(running_machine *machine, int index, sdl_window_info *window, const char *view)
{
const char *defview = options_get_string(machine->options(), SDLOPTION_VIEW( ));
int viewindex;
ASSERT_MAIN_THREAD();
// choose non-auto over auto
if (strcmp(view, "auto") == 0 && strcmp(defview, "auto") != 0)
view = defview;
// query the video system to help us pick a view
viewindex = video_get_view_for_target(machine, window->target, view, index, video_config.numscreens);
// set the view
render_target_set_view(window->target, viewindex);
window->start_viewscreen=viewindex;
}
示例11: status_prompt_find_history_file
/* Find the history file to load/save from/to. */
static char *
status_prompt_find_history_file(void)
{
const char *home, *history_file;
char *path;
history_file = options_get_string(global_options, "history-file");
if (*history_file == '\0')
return (NULL);
if (*history_file == '/')
return (xstrdup(history_file));
if (history_file[0] != '~' || history_file[1] != '/')
return (NULL);
if ((home = find_home()) == NULL)
return (NULL);
xasprintf(&path, "%s%s", home, history_file + 1);
return (path);
}
示例12: cmd_set_option_string
/* Set a string option. */
struct options_entry *
cmd_set_option_string(struct cmd *self, unused struct cmd_q *cmdq,
const struct options_table_entry *oe, struct options *oo, const char *value)
{
struct args *args = self->args;
struct options_entry *o;
char *oldval, *newval;
if (args_has(args, 'a')) {
oldval = options_get_string(oo, oe->name);
xasprintf(&newval, "%s%s", oldval, value);
} else
newval = xstrdup(value);
o = options_set_string(oo, oe->name, "%s", newval);
free(newval);
return (o);
}
示例13: cmd_set_option_string
/* Set a string option. */
struct options_entry *
cmd_set_option_string(struct cmd *self, unused struct cmd_ctx *ctx,
const struct options_table_entry *oe, struct options *oo)
{
struct cmd_target_data *data = self->data;
struct options_entry *o;
char *oldval, *newval;
if (cmd_check_flag(data->chflags, 'a')) {
oldval = options_get_string(oo, oe->name);
xasprintf(&newval, "%s%s", oldval, data->arg2);
} else
newval = data->arg2;
o = options_set_string(oo, oe->name, "%s", newval);
if (newval != data->arg2)
xfree(newval);
return (o);
}
示例14: schedule_exit
void running_machine::schedule_exit()
{
// if we are in-game but we started with the select game menu, return to that instead
if (m_exit_to_game_select && options_get_string(&m_options, OPTION_GAMENAME)[0] != 0)
{
options_set_string(&m_options, OPTION_GAMENAME, "", OPTION_PRIORITY_CMDLINE);
ui_menu_force_game_select(this, render_container_get_ui());
}
// otherwise, exit for real
else
m_exit_pending = true;
// if we're executing, abort out immediately
m_scheduler.eat_all_cycles();
// if we're autosaving on exit, schedule a save as well
if (options_get_bool(&m_options, OPTION_AUTOSAVE) && (m_game.flags & GAME_SUPPORTS_SAVE))
schedule_save("auto");
}
示例15: lookup_and_connect
static void lookup_and_connect(void)
{
struct evutil_addrinfo hints;
const char *tmate_server_host;
if (!tmate_session.ev_dnsbase)
tmate_session.ev_dnsbase = evdns_base_new(tmate_session.ev_base, 1);
if (!tmate_session.ev_dnsbase)
tmate_fatal("Cannot initialize the DNS lookup service");
memset(&hints, 0, sizeof(hints));
hints.ai_family = AF_UNSPEC;
hints.ai_flags = EVUTIL_AI_ADDRCONFIG;
hints.ai_socktype = SOCK_STREAM;
hints.ai_protocol = IPPROTO_TCP;
tmate_server_host = options_get_string(global_options,
"tmate-server-host");
tmate_info("Looking up %s...", tmate_server_host);
(void)evdns_getaddrinfo(tmate_session.ev_dnsbase, tmate_server_host, NULL,
&hints, dns_cb, (void *)tmate_server_host);
}