No Scumm VM Window while debugging

General chat related to ScummVM, adventure gaming, and so on.

Moderator: ScummVM Team

Post Reply
Manannan
Posts: 8
Joined: Wed Sep 25, 2019 11:17 am

No Scumm VM Window while debugging

Post by Manannan »

Hello,
I have being a C# dev for nearly a decade.

I decided to challenge myself by learning C++ and hacking the Scumm VM.

I am using, you guessed it, Visual Studio.
When I debug the Scumm VM there is no game screen window.

I note that when I debug a different thread it appears.

Is it a known issue? Is there any fix for this?
User avatar
dreammaster
ScummVM Developer
Posts: 557
Joined: Fri Nov 04, 2005 2:16 am
Location: San Jose, California, USA

Re: No Scumm VM Window while debugging

Post by dreammaster »

Manannan wrote: Wed Oct 30, 2019 12:15 pmWhen I debug the Scumm VM there is no game screen window.
I use Visual Studio myself; and I haven't noticed any issue with the ScummVM window disappearing. The only thing slightly similar I know of is that when code execution is paused in the Visual Studio debugger, it's rarely seen the game window lose it's contents, particularly if I Visual Studio was overlapping the game screen and I was switching back and forth between them. Though I generally don't play around with switching threads, except when I do a pause in VS, and have to switch to the main thread from whichever thread it was first paused in.

Something to keep in mind that may be related is that if you're debugging the main thread, it won't have any chance for the screen to update, since it's code in the engine (main thread) that calls g_system->updateScreen() multiple times every second to render the game window contents. So in cases where you're setting breakpoints in other threads, it may be why the game window shows up in that case, since the main thread is still running normally.
Manannan
Posts: 8
Joined: Wed Sep 25, 2019 11:17 am

Re: No Scumm VM Window while debugging

Post by Manannan »

Thanks for the reply.

I think based on what you said I may have to switch to writing output to the console.

I made a console appear with a FreeConsole and a AllocConsole but when I write to with cout or common::debug nothing happens.

I can see the calls being hit by the debugger

What is the correct procedure to see output in the console?

It has to work in run mode so that I can also access the Scumm VM window due to the issue I mentioned in my first post.

Thanks
User avatar
dreammaster
ScummVM Developer
Posts: 557
Joined: Fri Nov 04, 2005 2:16 am
Location: San Jose, California, USA

Re: No Scumm VM Window while debugging

Post by dreammaster »

Manannan wrote: Thu Oct 31, 2019 3:20 amWhat is the correct procedure to see output in the console?
The simplest way is to #Include "common/debug.h" in any source file and then call the global debug method. There are several variations that allow debug output to occur depending on a global "debug level" you can set on the command line when starting ScumMVM, but at it's simplest, you just pass a string into the method and it'll display it in the console.
Manannan
Posts: 8
Joined: Wed Sep 25, 2019 11:17 am

Re: No Scumm VM Window while debugging

Post by Manannan »

Do I need to AllocConsole first and if not where does the output appear in Visual Studio?
User avatar
dreammaster
ScummVM Developer
Posts: 557
Joined: Fri Nov 04, 2005 2:16 am
Location: San Jose, California, USA

Re: No Scumm VM Window while debugging

Post by dreammaster »

Manannan wrote: Thu Oct 31, 2019 7:42 am Do I need to AllocConsole first and if not where does the output appear in Visual Studio?
When you run ScummVM in Visual Studio, by default it should automatically open a console window where text output from calls to debug(), warning(), and/or error() get printed.
Manannan
Posts: 8
Joined: Wed Sep 25, 2019 11:17 am

Re: No Scumm VM Window while debugging

Post by Manannan »

Can't see any console. Could it be hiding?
User avatar
dreammaster
ScummVM Developer
Posts: 557
Joined: Fri Nov 04, 2005 2:16 am
Location: San Jose, California, USA

Re: No Scumm VM Window while debugging

Post by dreammaster »

Manannan wrote: Sat Nov 02, 2019 9:49 am Can't see any console. Could it be hiding?
That's weird. The default project created by create_project should have the console turned on by default. You might want to check out this section of the Compiling in Visual Studio document. It deals with turning off the console; try reversing it, and making sure you have /SUBSYSTEM:WINDOWS in your project.
Post Reply