Following source files in Hatari seem to have some Windows specific code:
- Code: Select all
hatari$ find src | xargs grep -l WIN32
src/CMakeLists.txt
src/file.c
src/gemdos.c
src/ide.c
src/includes/main.h
src/includes/unzip.h
src/main.c
src/paths.c
src/scandir.c
(+ some files in the WinUAE variant of the Hatari CPU cores.)
Besides Windows linking differences,
CMakeLists.txt does just following:
- Code: Select all
# When building for Windows, define specific sources for gui and resources
# and set the subsystem of the resulting .exe to "windows GUI" instead of "console"
if(WIN32)
set(GUIWIN_SOURCES gui-win/opencon.c)
set(GUIWIN_RES gui-win/hatari-winicon.rc)
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -mwindows")
endif(WIN32)
The added
gui-win/opencon.c object has just this:
- Code: Select all
void Win_OpenCon(void)
{
if (!bExceptionDebugging)
return;
AllocConsole();
freopen("CON", "w", stdout);
freopen("CON", "r", stdin);
freopen("CON", "wr", stderr);
}
Which seems to be called from the Hatari
main():
- Code: Select all
#ifdef WIN32
Win_OpenCon();
#endif
The check for
bExceptionDebugging explains why debugger on Windows wrongly needs the -D option. That has the side-effect of enabling debugger also on address, bus and unknown exception handler exceptions which is really annoying as TOS startup triggers also couple of these...
Somebody who uses Windows (none of Hatari developers do[1]) would need to submit a tested[1] patch to fix this so that debugger window is invoked/created e.g. on first debugger invocation by the user.
[1] e.g. I don't know whether the above functionality can on Windows be called after program has been initialized i.e. can the function be called in Debugger invocation shortcut instead, and replace the variable check with a check of some static local variable.