re-run new DOSBox-X instance

This commit is contained in:
Wengier
2021-07-22 08:07:06 -04:00
parent f9569d649e
commit 9fd27e081a
9 changed files with 30 additions and 12 deletions

View File

@@ -3114,6 +3114,9 @@ Mapper-defined
:MENU:showdetails
Show FPS and RT speed in title bar
.
:MENU:restartinst
Re-run DOSBox-X instance
.
:MENU:restartconf
Restart DOSBox-X with config file...
.

View File

@@ -3095,6 +3095,9 @@ Definido por Mapeador: F11
:MENU:showdetails
Mostrar FPS y velocidad RT en barra de título
.
:MENU:restartinst
Vuelva a ejecutar la instancia de DOSBox-X
.
:MENU:restartconf
Reiniciar DOSBox-X con archivo config...
.

View File

@@ -3077,6 +3077,9 @@ Mapper-defined
:MENU:showdetails
FPS とRT スピードをタイトルバーに表示
.
:MENU:restartinst
DOSBox-Xインスタンスを再実行します
.
:MENU:restartconf
設定ファイルを用いてDOSBox-X を再起動 ...
.

View File

@@ -3079,6 +3079,9 @@ DOS 命令
:MENU:showdetails
标题栏上显示速度
.
:MENU:restartinst
重启 DOSBox-X 实例
.
:MENU:restartconf
重启 DOSBox-X 并调用指定配置文件...
.

View File

@@ -3079,6 +3079,9 @@ DOS 命令
:MENU:showdetails
標題列上顯示速度
.
:MENU:restartinst
重開 DOSBox-X 實例
.
:MENU:restartconf
重開 DOSBox-X 並調用指定組態檔案...
.

View File

@@ -140,11 +140,7 @@ static const char *def_menu_main[] =
"--",
"mapper_reset",
"mapper_reboot",
#endif
#if defined(MACOSX)
"mapper_newinst",
#endif
#if !defined(C_EMSCRIPTEN)//FIXME: Shutdown causes problems with Emscripten
"restartinst",
"--",
"restartconf",
"restartlang",

View File

@@ -146,7 +146,7 @@ void RebootConfig(std::string filename, bool confirm=false) {
}
void RebootLanguage(std::string filename, bool confirm=false) {
std::string exepath=GetDOSBoxXPath(true), tmpconfig = "~dbxtemp.conf", para="-lang \""+filename+"\"";
std::string exepath=GetDOSBoxXPath(true), tmpconfig = "~dbxtemp.conf", para=filename.size()?"-lang \""+filename+"\"":"";
struct stat st;
if ((!confirm||CheckQuit())&&exepath.size()) {
if (!stat(tmpconfig.c_str(), &st)) remove(tmpconfig.c_str());
@@ -1643,7 +1643,7 @@ public:
ToplevelWindow(parent, x, y, 400, 150 + GUI::titlebar_y_stop, title) {
new GUI::Label(this, 5, 10, MSG_Get("LANG_FILENAME"));
name = new GUI::Input(this, 5, 30, width - 10 - border_left - border_right);
name->setText(control->opt_lang != "" ? control->opt_lang.c_str() : "messages.txt");
name->setText(control->opt_lang != "" ? control->opt_lang.c_str() : "messages.lng");
new GUI::Label(this, 5, 60, MSG_Get("LANG_LANGNAME"));
lang = new GUI::Input(this, 5, 80, width - 10 - border_left - border_right);
lang->setText(langname.c_str());

View File

@@ -303,6 +303,7 @@ unsigned int sendkeymap=0;
std::string configfile = "";
std::string strPasteBuffer = "";
ScreenSizeInfo screen_size_info;
void RebootLanguage(std::string filename, bool confirm=false);
bool CodePageHostToGuestUTF16(char *d/*CROSS_LEN*/,const uint16_t *s/*CROSS_LEN*/);
bool CodePageGuestToHostUTF16(uint16_t *d/*CROSS_LEN*/,const char *s/*CROSS_LEN*/);
@@ -5663,7 +5664,7 @@ static void GUI_StartUp() {
item->set_text("Quick launch program...");
#endif
#if defined(MACOSX)
#if defined(MACOSX) && 0
MAPPER_AddHandler(NewInstanceEvent, MK_nothing, 0, "newinst", "Start new instance", &item);
item->set_text("Start new instance");
{
@@ -10939,10 +10940,7 @@ void Restart_language_file() {
while (*name == CROSS_FILESPLIT) name++;
}
if (*name) {
void RebootLanguage(std::string filename, bool confirm=false);
RebootLanguage(name, true);
}
if (*name) RebootLanguage(name, true);
}
if(chdir(Temp_CurrentDir) == -1) {
LOG(LOG_GUI, LOG_ERROR)("Restart_language_file failed to change directories.");
@@ -12129,6 +12127,13 @@ bool showdetails_menu_callback(DOSBoxMenu * const xmenu, DOSBoxMenu::item * cons
return true;
}
bool restartinst_menu_callback(DOSBoxMenu * const xmenu, DOSBoxMenu::item * const menuitem) {
(void)xmenu;//UNUSED
(void)menuitem;//UNUSED
RebootLanguage("", true);
return true;
}
bool restartconf_menu_callback(DOSBoxMenu * const xmenu, DOSBoxMenu::item * const menuitem) {
(void)xmenu;//UNUSED
(void)menuitem;//UNUSED
@@ -14434,6 +14439,7 @@ int main(int argc, char* argv[]) SDL_MAIN_NOEXCEPT {
/* more */
std::string doubleBufString = std::string("desktop.doublebuf");
mainMenu.alloc_item(DOSBoxMenu::item_type_id,"showdetails").set_text("Show FPS and RT speed in title bar").set_callback_function(showdetails_menu_callback).check(!menu.hidecycles && menu.showrt);
mainMenu.alloc_item(DOSBoxMenu::item_type_id,"restartinst").set_text("Re-run DOSBox-X instance").set_callback_function(restartinst_menu_callback);
mainMenu.alloc_item(DOSBoxMenu::item_type_id,"restartconf").set_text("Restart DOSBox-X with config file...").set_callback_function(restartconf_menu_callback);
mainMenu.alloc_item(DOSBoxMenu::item_type_id,"restartlang").set_text("Restart DOSBox-X with language file...").set_callback_function(restartlang_menu_callback);
mainMenu.alloc_item(DOSBoxMenu::item_type_id,"auto_lock_mouse").set_text("Autolock mouse").set_callback_function(autolock_mouse_menu_callback).check(sdl.mouse.autoenable);

View File

@@ -281,6 +281,7 @@ void MSG_Init() {
if (control->opt_lang != "") {
LoadMessageFile(control->opt_lang.c_str());
SetVal("dosbox", "language", control->opt_lang.c_str());
}
else {
Prop_path* pathprop = section->Get_path("language");