Reply 20 of 49, by wd
I'll fix that crashing by times, but it only hides that something else is
wrong as the video can't be initialized with =directx.
I'll fix that crashing by times, but it only hides that something else is
wrong as the video can't be initialized with =directx.
But what? I also launched dxdiag, and verified that hardware accelleration was on (card is NVIDIA GeForce Go 7800 with somewhat recent drivers: 78.59). Also tried with hw-accelleration off. No change.
DOSBox 60 seconds guide | How to ask questions
_________________
Lenovo M58p | Core 2 Quad Q8400 @ 2.66 GHz | Radeon R7 240 | LG HL-DT-ST DVDRAM GH40N | Fedora 32
SDL needs some modifications to support ddraw
Ran all the SDL-test programs with SDL_VIDEOMODE=directx. No failures in the test-programs, but dosbox crashes.
DOSBox 60 seconds guide | How to ask questions
_________________
Lenovo M58p | Core 2 Quad Q8400 @ 2.66 GHz | Radeon R7 240 | LG HL-DT-ST DVDRAM GH40N | Fedora 32
wrote:SDL needs some modifications to support ddraw
I recompled 1.2.11 with
--- SDL_dx5video.c.ORIG Tue Jun 27 05:48:31 2006
+++ SDL_dx5video.c Fri Mar 9 21:15:04 2007
@@ -1489,7 +1489,7 @@
}
}
dd_surface3 = NULL;
-#if 0 /* FIXME: enable this when SDL consistently reports lost surfaces */
+#if 1 /* FIXME: enable this when SDL consistently reports lost surfaces */
if ( (flags & SDL_HWSURFACE) == SDL_HWSURFACE ) {
video->flags |= SDL_HWSURFACE;
} else {
but it made no difference.
DOSBox 60 seconds guide | How to ask questions
_________________
Lenovo M58p | Core 2 Quad Q8400 @ 2.66 GHz | Radeon R7 240 | LG HL-DT-ST DVDRAM GH40N | Fedora 32
But what?
Erm i didn't say it's caused by the hardware acceleration setting. I don't
know why it does that (i would have guessed that the change gulikoza
posted would help, but well) and didn't really bother yet. Qbix's compile
works fine.
wrote:Ran all the SDL-test programs with SDL_VIDEOMODE=directx. No failures in the test-programs, but dosbox crashes.
UPS!!! That was totally wrong. Noticed that it is not SDL_VIDEOMODE, it is SDL_VIDEODRIVER!
Re-did the test with SDL_VIDEODRIVER=directx, and SDL_VIDEODRIVER=ddraw, and now the test-programs that creates windows fails. They don't even show the SDL-window - they just silently dies.
Edit: A stderr.txt file is left saying "Couldn't initialize SDL: No available video device".
DOSBox 60 seconds guide | How to ask questions
_________________
Lenovo M58p | Core 2 Quad Q8400 @ 2.66 GHz | Radeon R7 240 | LG HL-DT-ST DVDRAM GH40N | Fedora 32
SDL_VIDEODRIVER=ddraw does not exist, that's why sdl crashes. directx and windib are the only available options. Why don't you compile in debug mode and check where it crashes? 😀
I will - I am on a steep learning curve here. I have identified 2 points in sdlmain.cpp where SDL_InitSubSystem is being called. I am recompiling now. Will try with ./configure --enable-debug next.
DOSBox 60 seconds guide | How to ask questions
_________________
Lenovo M58p | Core 2 Quad Q8400 @ 2.66 GHz | Radeon R7 240 | LG HL-DT-ST DVDRAM GH40N | Fedora 32
here are my changes
patch -p1 < sdl11rel.diff
Water flows down the stream
How to ask questions the smart way!
wrote:SDL_VIDEODRIVER=ddraw does not exist, that's why sdl crashes. directx and windib are the only available options. Why don't you compile in debug mode and check where it crashes? 😀
It dies (as expected) in sdlmain.cpp:main(), around line 1379:
#if defined (WIN32)
#if SDL_VERSION_ATLEAST(1, 2, 10)
sdl.using_windib=true;
#else
sdl.using_windib=false;
#endif
char sdl_drv_name[128];
if (getenv("SDL_VIDEODRIVER")==NULL) {
if (SDL_VideoDriverName(sdl_drv_name,128)!=NULL) {
if (strcmp(sdl_drv_name,"directx")!=0) {
SDL_QuitSubSystem(SDL_INIT_VIDEO);
putenv("SDL_VIDEODRIVER=directx");
/* JBA2 */ if( SDL_InitSubSystem(SDL_INIT_VIDEO) < 0 )
E_Exit("JBA2: Could not initialize SDL: %s",SDL_GetError());
}
sdl.using_windib=false;
}
} else {
char* sdl_videodrv = getenv("SDL_VIDEODRIVER");
if (strcmp(sdl_videodrv,"directx")==0) sdl.using_windib = false;
else if (strcmp(sdl_videodrv,"windib")==0) sdl.using_windib = true;
}
if (SDL_VideoDriverName(sdl_drv_name,128)!=NULL) {
if (strcmp(sdl_drv_name,"windib")==0) LOG_MSG("SDL_Init: Starting up with SDL windib video driver.\n Try to update
your video card and directx drivers!");
}
#endif
with the message:
Exit to error: JBA2: Could not initialize SDL: No available video device
DOSBox 60 seconds guide | How to ask questions
_________________
Lenovo M58p | Core 2 Quad Q8400 @ 2.66 GHz | Radeon R7 240 | LG HL-DT-ST DVDRAM GH40N | Fedora 32
Added a little debugging output to SDL_video.c:SDL_VideoInit():
for ( i=0; bootstrap[i]; ++i ) {
fprintf( stderr, "JBA3: Checking for driver '%s' against bs[%i]('%s')\n", driver_name, i, bootstrap[i]->name );
if ( SDL_strncmp(bootstrap[i]->name, driver_name,
SDL_strlen(bootstrap[i]->name)) == 0 ) {
if ( bootstrap[i]->available() ) {
video = bootstrap[i]->create(index);
break;
}
}
}
} else {
for ( i=0; bootstrap[i]; ++i ) {
if ( bootstrap[i]->available() ) {
fprintf( stderr, "JBA4: No driver name. First available driver bs[%i]('%s')\n", i, bootstrap[i]->name );
video = bootstrap[i]->create(index);
if ( video != NULL ) {
break;
}
}
}
}
If I explicitly select SDL_VIDEODRIVER=windib, SDL_video.c:SDL_VideoInit succesfully finds the driver in the bootstrap-list:
JBA3: Checking for driver 'windib' against bs[0]('windib')
SDL_Init: Starting up with SDL windib video driver.
Try to update your video card and directx drivers!
CONFIG: Using default settings. Create a configfile to change them
MIDI:Opened device:win32
Selecting directx fails, because the bootstrap[] does not contain a driver with that name:
JBA3: Checking for driver 'directx' against bs[0]('windib')
JBA3: Checking for driver 'directx' against bs[1]('dummy')
Exit to error: Can't init SDL No available video device
Without an SDL_VIDEODRIVER specified, I see something strange:
JBA4: No driver name. First available driver bs[0]('windib')
JBA3: Checking for driver 'directx' against bs[0]('windib')
JBA3: Checking for driver 'directx' against bs[1]('dummy')
Exit to error: JBA2: Could not initialize SDL No available video device
I assume that it is some logic in DOSBox that first calls SDL_VideoInit without a named driver, then checks the returned name (windib), and decides to force directx - which fails.
So the question is: Why is there no directx in my bootstrap[] list?
/me digs deeper into SDL...
DOSBox 60 seconds guide | How to ask questions
_________________
Lenovo M58p | Core 2 Quad Q8400 @ 2.66 GHz | Radeon R7 240 | LG HL-DT-ST DVDRAM GH40N | Fedora 32
You need directx headers for directx to be compiled. Check the configure...you should see some lines - checking for ddraw.h...
Aha! Thanks gulikoza: Looks like configure don't find ddraw.h:
$ grep ddraw config.log
configure:20: checking ddraw.h usability
conftest.c:124:19: ddraw.h: No such file or directory
| #include <ddraw.h>
configure:65: checking ddraw.h presence
conftest.c:90:19: ddraw.h: No such file or directory
| #include <ddraw.h>
configure:136: checking for ddraw.h
ac_cv_header_ddraw_h=no
Edit: Looks like this article contains the basics for getting the MS DirectX stuff into my MinGW setup. Guess I need to download, extract, and re-confgure SDL with the headers and libs in pkace.
Found the latest SDK here:
http://msdn.microsoft.com/library/default.asp … tentid=28000410
It will take quite some time for that to download, so this will be the end of tonights debugging session. It has been interesting 😀
DOSBox 60 seconds guide | How to ask questions
_________________
Lenovo M58p | Core 2 Quad Q8400 @ 2.66 GHz | Radeon R7 240 | LG HL-DT-ST DVDRAM GH40N | Fedora 32
wrote:here are my changes
patch -p1 < sdl11rel.diff
I look at those diffs, and here is my interpretation:
SDL_video.c: Switch the order of the WINDIB and DDRAW drivers in the bootstrap-list, so DDRAW comes before WINDIB. But why? What do this accomplish? DDRAW is faster/better/more compatible across Windows platforms?
SDL_dx5events.c: A change to let DOSBox handle all keyinput? It is an ugly way to do it by removing a break, and let the code fall-through to the return(0) . I would have kept with the structure of the original code and added a separate return(0) for WM_SYSKEYUP/DOWN (and - for style - I would have inserted break's after each return(0)'s.
SDL_dx5video.c: I can read the comments as well as anyone else. Is this a particular problem with DOSBox on some platforms, or is it just to prevent problems, should they happen?
DOSBox 60 seconds guide | How to ask questions
_________________
Lenovo M58p | Core 2 Quad Q8400 @ 2.66 GHz | Radeon R7 240 | LG HL-DT-ST DVDRAM GH40N | Fedora 32
I can read the comments as well as anyone else.
Nice, thanks for telling.
DDRAW is faster/better/more compatible across Windows platforms?
The windib driver has some bugs (fullscreen, keyboard) on many pcs.
A change to let DOSBox handle all keyinput?
No, reverting a change.
It is an ugly way to do it by removing a break
No it's not. If you don't like it don't do it.
wrote:A change to let DOSBox handle all keyinput?
No, reverting a change.
So with an unmodified SDL, the SDL-application would get control of the PrtScr/SysRq key on the keyboard? And with DOSBox, that is not desired? If so, why not keep SDL unchanged, accept the event in DOSBox, and pass it back to the window manager?
DOSBox 60 seconds guide | How to ask questions
_________________
Lenovo M58p | Core 2 Quad Q8400 @ 2.66 GHz | Radeon R7 240 | LG HL-DT-ST DVDRAM GH40N | Fedora 32
why not keep SDL unchanged, accept the event in DOSBox
Because you don't get it then. Leave it out and hit ALT.
Okay - I think I understand the WM_SYSKEY issue now. The standard SDL-1.2.11 correctly passes these SYSKEY-events (e.g. ALT-key, F10, ..) to the Windows window-manager(?) so ordinary SDL/Windows applications will behave like they they always do and focus on the window-menu (with File, Edit, Help, ...) or close the window when ALT-F4 is pressed.
But DOSBox do not want this to happen. It wants full control of ALT, Right-CTRL and similar system-keys. By doing a return(0) SDL is told that there is no special handler for this event, and the application (DOSBos) gets to handle the ALT-key.
This means, that to build and run DOSBox, I need
DOSBox 60 seconds guide | How to ask questions
_________________
Lenovo M58p | Core 2 Quad Q8400 @ 2.66 GHz | Radeon R7 240 | LG HL-DT-ST DVDRAM GH40N | Fedora 32
wrote:SDL_dx5video.c: I can read the comments as well as anyone else. Is this a particular problem with DOSBox on some platforms, or is it just to prevent problems, should they happen?
It was this diff:
-#if 0 /* FIXME: enable this when SDL consistently reports lost surfaces */
+#if 1 /* FIXME: enable this when SDL consistently reports lost surfaces */
if ( (flags & SDL_HWSURFACE) == SDL_HWSURFACE ) {
video->flags |= SDL_HWSURFACE;
} else {
Why is this recommended when building SDL for DOSBox?
DOSBox 60 seconds guide | How to ask questions
_________________
Lenovo M58p | Core 2 Quad Q8400 @ 2.66 GHz | Radeon R7 240 | LG HL-DT-ST DVDRAM GH40N | Fedora 32