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?
No Scumm VM Window while debugging
Moderator: ScummVM Team
- dreammaster
- ScummVM Developer
- Posts: 559
- Joined: Fri Nov 04, 2005 2:16 am
- Location: San Jose, California, USA
Re: No Scumm VM Window while debugging
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.
Re: No Scumm VM Window while debugging
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
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
- dreammaster
- ScummVM Developer
- Posts: 559
- Joined: Fri Nov 04, 2005 2:16 am
- Location: San Jose, California, USA
Re: No Scumm VM Window while debugging
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.
Re: No Scumm VM Window while debugging
Do I need to AllocConsole first and if not where does the output appear in Visual Studio?
- dreammaster
- ScummVM Developer
- Posts: 559
- Joined: Fri Nov 04, 2005 2:16 am
- Location: San Jose, California, USA
Re: No Scumm VM Window while debugging
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.
Re: No Scumm VM Window while debugging
Can't see any console. Could it be hiding?
- dreammaster
- ScummVM Developer
- Posts: 559
- Joined: Fri Nov 04, 2005 2:16 am
- Location: San Jose, California, USA
Re: No Scumm VM Window while debugging
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.