Skip to content

Commit

Permalink
Merge pull request mamedev#15 from mamesick/patch-1
Browse files Browse the repository at this point in the history
UI LANGUAGE and PLUGINS support
  • Loading branch information
Robbbert committed May 4, 2016
2 parents 729906d + eb1b0b0 commit 1b3f735
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 5 deletions.
19 changes: 17 additions & 2 deletions src/osd/winui/mui_opts.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1073,17 +1073,32 @@ BOOL GetSortReverse(void)
return settings.bool_value( MUIOPTION_SORT_REVERSED);
}

const char* GetLanguage(void)
const char* GetLanguage(void) // this is unused I guess
{
return settings.value( MUIOPTION_LANGUAGE);
}

void SetLanguage(const char* lang)
void SetLanguage(const char* lang) // same as above, time to remove it?
{
std::string error_string;
settings.set_value(MUIOPTION_LANGUAGE, lang, OPTION_PRIORITY_CMDLINE,error_string);
}

const char* GetLanguageUI(void)
{
return global.value(OPTION_LANGUAGE);
}

bool GetEnablePlugins(void)
{
return global.bool_value(OPTION_PLUGINS);
}

const char* GetPlugins(void)
{
return global.value(OPTION_PLUGIN);
}

const char* GetRomDirs(void)
{
return global.media_path();
Expand Down
6 changes: 6 additions & 0 deletions src/osd/winui/mui_opts.h
Original file line number Diff line number Diff line change
Expand Up @@ -230,6 +230,12 @@ BOOL GetSortReverse(void);
const char* GetLanguage(void);
void SetLanguage(const char* lang);

const char* GetLanguageUI(void);

bool GetEnablePlugins(void);

const char* GetPlugins(void);

const char* GetRomDirs(void);
void SetRomDirs(const char* paths);

Expand Down
14 changes: 11 additions & 3 deletions src/osd/winui/winui.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -886,17 +886,23 @@ static DWORD RunMAME(int nGameIndex, const play_options *playopts)
time_t start, end;
double elapsedtime;
int i;
mame_options mame_opts;
//mame_options mame_opts; seems useless....
windows_options global_opts;
std::string error_string;
// set up MAME options
// mame_opts = mame_options_init(mame_win_options);
// mame_opts = mame_options_init(mame_win_options);

// Tell mame were to get the INIs
SetDirectories(global_opts);

// set some startup options
global_opts.set_value(OPTION_LANGUAGE, GetLanguageUI(), OPTION_PRIORITY_CMDLINE, error_string);
global_opts.set_value(OPTION_PLUGINS, GetEnablePlugins(), OPTION_PRIORITY_CMDLINE, error_string);
global_opts.set_value(OPTION_PLUGIN, GetPlugins(), OPTION_PRIORITY_CMDLINE, error_string);

// add image specific device options
mame_opts.set_system_name(global_opts, driver_list::driver(nGameIndex).name);
//mame_opts.set_system_name(global_opts, driver_list::driver(nGameIndex).name);
global_opts.set_value(OPTION_SYSTEMNAME, driver_list::driver(nGameIndex).name, OPTION_PRIORITY_CMDLINE, error_string);

// set any specified play options
if (playopts_apply == 0x57)
Expand Down Expand Up @@ -932,6 +938,8 @@ static DWORD RunMAME(int nGameIndex, const play_options *playopts)
osd_output::push(&winerror);
osd.register_options();
mame_machine_manager *manager = mame_machine_manager::instance(global_opts, osd);
load_translation(global_opts);
manager->start_luaengine();
manager->execute();
osd_output::pop(&winerror);
global_free(manager);
Expand Down

0 comments on commit 1b3f735

Please sign in to comment.