Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

friendlier window title #61

Open
skierpage opened this issue Aug 9, 2019 · 2 comments
Open

friendlier window title #61

skierpage opened this issue Aug 9, 2019 · 2 comments

Comments

@skierpage
Copy link

I came across this playing the excellent MS-DOS Game collection at the Internet Archive, great work! I was confused by the games there putting, e.g. "DOSBox SVN, CPU speed: 3000 cycles, Frameskip 0, Program: STUNT" in the window title (thus browser tab and browser history). Tabs and dropdowns cut off the end of this so you don't see what program you're running and it's quite confusing.

Em-DOSBox's GFX_SetTitle() in src/gui/sdlmain.cpp sets the title to the nerdy
"DOSBox %s, CPU speed: %8d cycles, Frameskip %2d, Program: %8s",VERSION,internal_cycles,internal_frameskip,RunningProgram)
a friendlier layout with the key information first would be
"STUNT running in Em-DOSBox v. SVN (CPU speed: 3000 cycles, Frameskip 0)

(the misleading version "number" SVN comes from src/platform/visualc/config.h).

@dreamlayers
Copy link
Owner

The title is just what DOSBox does normally. You can see it as the window title when running DOSBox as a normal application. Here it is done via the JavaScript setWindowTitle function. This is easy to override by assigning something else to that function, although it is a bit tricky to know when to do it. You can add setWindowTitle=function(x){}; to the runWithFS() function in the standard HTML code generated when building.

I don't even know what would be a friendlier title, and think overriding the standard title setting and choosing a custom title should be up to whoever edits the web page containing the emulator.

@leonid-shevtsov
Copy link

alternatively you can excise the title-setting from the DOSBox source code - it ain't glamorous but it works:

diff --git a/src/gui/sdlmain.cpp b/src/gui/sdlmain.cpp
index aaf7c07e..e1ba77f0 100644
--- a/src/gui/sdlmain.cpp
+++ b/src/gui/sdlmain.cpp
@@ -347,11 +347,11 @@ void GFX_SetTitle(Bit32s cycles,int frameskip,bool paused){
 	}
 
 	if (paused) strcat(title," PAUSED");
-#if SDL_VERSION_ATLEAST(2,0,0)
-	SDL_SetWindowTitle(sdl.window,title); // VERSION is gone...
-#else
-	SDL_WM_SetCaption(title,VERSION);
-#endif
+// #if SDL_VERSION_ATLEAST(2,0,0)
+// 	SDL_SetWindowTitle(sdl.window,title); // VERSION is gone...
+// #else
+// 	SDL_WM_SetCaption(title,VERSION);
+// #endif
 }
 
 static unsigned char logo[32*32*4]= {
@@ -2170,11 +2170,11 @@ static void GUI_StartUp(Section * sec) {
 		LOG_MSG("SDL: You are running in 24 bpp mode, this will slow down things!");
 	}
 	GFX_Stop();
-#if SDL_VERSION_ATLEAST(2,0,0)
-	SDL_SetWindowTitle(sdl.window,"DOSBox"); // VERSION is gone...
-#else
-	SDL_WM_SetCaption("DOSBox",VERSION);
-#endif
+// #if SDL_VERSION_ATLEAST(2,0,0)
+// 	SDL_SetWindowTitle(sdl.window,"DOSBox"); // VERSION is gone...
+// #else
+// 	SDL_WM_SetCaption("DOSBox",VERSION);
+// #endif
 
 /* The endian part is intentionally disabled as somehow it produces correct results without according to rhoenie*/
 //#if SDL_BYTEORDER == SDL_BIG_ENDIAN

However then something in emscripten will simply reset the title to empty; this can be mitigated with some JS:

Module.postRun ||= [];
Module.postRun.push(() => {
  window.document.title = "My title";
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants