sdlcl icon indicating copy to clipboard operation
sdlcl copied to clipboard

Instruction for ETQW?

Open rea987 opened this issue 7 years ago • 18 comments

Hello,

I am interested in using the library with Enemy Territory: Quake Wars on Ubuntu Mate 17.10. Can I get some compiling and usage instruction, please? Thank you very much!

Kind regards.

Edit: Here is the name list that I adapted from #9:

nm -D etqw.x86 | grep SDL
         U SDL_EnableKeyRepeat
         U SDL_EnableUNICODE
         U SDL_FreeSurface
         U SDL_GetError
         U SDL_GetVideoInfo
         U SDL_GL_GetAttribute
         U SDL_GL_GetProcAddress
         U SDL_GL_LoadLibrary
         U SDL_GL_SetAttribute
         U SDL_GL_SwapBuffers
         U SDL_Init
         U SDL_JoystickClose
         U SDL_JoystickEventState
         U SDL_JoystickName
         U SDL_JoystickOpen
         U SDL_ListModes
         U SDL_LoadBMP_RW
         U SDL_MapRGB
         U SDL_NumJoysticks
         U SDL_PollEvent
         U SDL_Quit
         U SDL_RWFromFile
         U SDL_SetColorKey
         U SDL_SetGammaRamp
         U SDL_SetVideoMode
         U SDL_ShowCursor
         U SDL_WarpMouse
         U SDL_WM_GrabInput
         U SDL_WM_SetCaption
         U SDL_WM_SetIcon
nm -D etqw-rthread.x86 | grep SDL
         U SDL_EnableKeyRepeat
         U SDL_EnableUNICODE
         U SDL_FreeSurface
         U SDL_GetError
         U SDL_GetVideoInfo
         U SDL_GL_DisableContext
         U SDL_GL_EnableContext_Thread
         U SDL_GL_GetAttribute
         U SDL_GL_GetProcAddress
         U SDL_GL_LoadLibrary
         U SDL_GL_SetAttribute
         U SDL_GL_SwapBuffers
         U SDL_Init
         U SDL_JoystickClose
         U SDL_JoystickEventState
         U SDL_JoystickName
         U SDL_JoystickOpen
         U SDL_ListModes
         U SDL_LoadBMP_RW
         U SDL_MapRGB
         U SDL_NumJoysticks
         U SDL_PollEvent
         U SDL_Quit
         U SDL_RWFromFile
         U SDL_SetColorKey
         U SDL_SetGammaRamp
         U SDL_SetVideoMode
         U SDL_ShowCursor
         U SDL_WarpMouse
         U SDL_WM_GrabInput
         U SDL_WM_SetCaption
         U SDL_WM_SetIcon

Enemy Territory: Quake Wars demo: https://ftp.gwdg.de/pub/misc/ftp.idsoftware.com/idstuff/etqw/ETQW-demo2-client-full.r1.x86.run

rea987 avatar Jan 10 '18 21:01 rea987

According to #8, only missing functions are SDL_GL_DisableContext and SDL_GL_EnableContext_Thread. However, finding those only in SM accelerated binary of Quake 4 and renderer threading binary of ETQW makes me suspect that those are the part of proprietary libSDL-1.2.id.so.0. Can they be ported?

nm -D quake4smp.x86 | grep SDL
         U SDL_EnableKeyRepeat
         U SDL_EnableUNICODE
         U SDL_FreeSurface
         U SDL_GetError
         U SDL_GetVideoInfo
         U SDL_GL_DisableContext
         U SDL_GL_EnableContext_Thread
         U SDL_GL_GetAttribute
         U SDL_GL_GetProcAddress
         U SDL_GL_LoadLibrary
         U SDL_GL_SetAttribute
         U SDL_GL_SwapBuffers
         U SDL_Init
         U SDL_ListModes
         U SDL_LoadBMP_RW
         U SDL_MapRGB
         U SDL_PollEvent
         U SDL_Quit
         U SDL_RWFromFile
         U SDL_SetColorKey
         U SDL_SetGammaRamp
         U SDL_SetVideoMode
         U SDL_ShowCursor
         U SDL_WarpMouse
         U SDL_WM_GrabInput
         U SDL_WM_SetCaption
         U SDL_WM_SetIcon

https://github.com/liflg/etqw_1.5-multilingual_x86/blob/master/data/sdl.1.2.12.patch https://github.com/liflg/etqw_1.5-multilingual_x86/blob/master/data/libSDL-1.2.id.so.0 https://github.com/liflg/etqw_1.5-multilingual_x86

https://github.com/liflg/quake.4_1.4.2-multilingual_x86

rea987 avatar Jan 10 '18 22:01 rea987

I managed to compile libSDL-1.2.so.0 but as SDL_GL_DisableContext and SDL_GL_EnableContext_Thread functions aren't available I am unable to use threaded renderer which results poor framerate. Is it possible to port those functions?

rea987 avatar Jan 12 '18 16:01 rea987

SDL2 makes implementing this easy enough using SDL_GL_MakeCurrent(). It should work now.

MrAlert avatar Mar 07 '18 00:03 MrAlert

Thanks for the update!

Vanilla game works okay with a minor issue but in case of switching to a mod, the game segfaults.

  • Makefile is edited to make the custom SDL library;

TARGET = libSDL-1.2.id.so.0

  • The code is compiled in 32 bit mode;

make CC="gcc -m32"

https://github.com/MrAlert/sdlcl/issues/11#issuecomment-371180674

Results and issues:

  1. Backspace button doesn't work with SDLCL whereas it works with stock libSDL-1.2.id.so.0.

  2. Switching to a mod or switching to vanilla game from a mod via connecting a server or Mods menu crashes the game. Explanation; ETQW restarts itself in case of custom content; mods, custom maps, etc. When the game restarts to switch to a mod, it crashes during "SDL_ListModes" phase which lists supported resolutions. Changing r_useSDLModes value into 0 or 1 in ~/.etqwcl/base/etqwconfig.cfg and/or ~/.etqwcl/moddirectory/etqwconfig.cfg doesn't change the result. If the mod is directly launched with +set fs_game moddirectory argument, the mod launches without an issue.

To reproduce the crash issue:

  • Download ETQW retail iso and install with LIFLG installer.
  • Start the game with etqw-rthread script, create an offline account which doesn't require license code, quit.
  • Download and extract Quake Wars: Tactical Assault mod into ~/.etqwcl directory.
  • Start the game with etqw-rthread script and try to switch to Quake Wars: Tactical Assault mod, see the crash.

Terminal outputs:

  • Attempting to switch to a mod from Mods menu: https://pastebin.com/c1YqVD91

  • Launching the mod directly with +set fs_game moddirectory argument: https://pastebin.com/rXTDsP4t

rea987 avatar Mar 08 '18 09:03 rea987

Is there any development regarding the issue? Is more information required?

rea987 avatar Mar 26 '18 12:03 rea987

Sorry for taking a while. I've looked into it with the ETQW demo, and found that when restarting (I did it by restoring default settings in the settings menu) it calls SDL_Quit() and then calls SDL_Init() again in the same process. SDLCL actually doesn't currently support doing this properly, as it doesn't do any of its own initialization on SDL_Init() or deinitalization on SDL_Quit(). I've commited a quick fix (c963491cf8777e2bad1260d25deb147b8026979c) that appears to resolve the issue here, but proper initialization and deinitialization is still something I'll have to do at some point.

MrAlert avatar Mar 30 '18 03:03 MrAlert

The last commit (c963491) seems to fix the "unable to restart" issue. Thank you! However, backspace button still doesn't function with SDLCL. Please let me know if additional data required.

rea987 avatar Mar 30 '18 14:03 rea987

Adding Unicode control codes manually for certain keys (2d3cc735136c258aaa6fc6b915a648cbe1765fcb) seems to fix the backspace issue.

MrAlert avatar Mar 30 '18 20:03 MrAlert

Yes, (2d3cc73) has resolved the backspace problem. Thank you! It looks like ETQW is now fully supported. As you are looking forward to implement "proper initialization and deinitialization", I leave this open but if you are satisfied with current state, feel free to close. Thanks for caring and making old games benefit from modern features!

rea987 avatar Mar 31 '18 06:03 rea987

As I have just discovered, ETQW shows black screen if following options are changed;

  • Aspect Ratio and Resolution in Settings >Simple > Video
  • Texture Quality in Settings > Advanced

Normally, when those settings are changed and applied, the game shows an initial black screen then immediately return to game screen with new settings. However, with SDLCL, the game remains at black screen which requires killing the process. Texture Quality may require hard restart depending on the settings but that's not related with the issue.

rea987 avatar May 13 '18 14:05 rea987

Any development on the latest issue? https://github.com/MrAlert/sdlcl/issues/14#issuecomment-388630899

rea987 avatar Jun 02 '18 07:06 rea987

Further information regarding https://github.com/MrAlert/sdlcl/issues/14#issuecomment-388630899;

Switching between fullscreen and windowed mode in the game also results black screen. Using or not using r_useSDLModes doesn't make a difference.

rea987 avatar Jul 06 '18 12:07 rea987

As @MrAlert is back, let me kindly bump following black screen issue;

https://github.com/MrAlert/sdlcl/issues/14#issuecomment-388630899

rea987 avatar Nov 30 '18 20:11 rea987

Alright, I think I know what the problem is. In X11_SetVideoMode, SDL 1.2 resizes the existing window if certain flags and the color depth are the same. SDLCL currently destroys the window and creates a new one, which also destroys the OpenGL context. Since the game isn't expecting this, it then tries to use OpenGL objects that no longer exist. It'll take me a while to fix this, but afterwards it should be easy to implement SDL_RESIZABLE as well.

MrAlert avatar Nov 30 '18 21:11 MrAlert

@MrAlert I do not know if it is related or not, but simply clicking Apply button without changing anything in Settings causes black screen.

rea987 avatar Nov 30 '18 21:11 rea987

ETQW probably always calls SDL_SetVideoMode when you click Apply regardless of whether you actually changed any settings or not.

MrAlert avatar Nov 30 '18 22:11 MrAlert

@MrAlert As it has been more than 6 months since the last update, is there any news regarding the bug;

https://github.com/MrAlert/sdlcl/issues/14#issuecomment-388630899 https://github.com/MrAlert/sdlcl/issues/14#issuecomment-443352611

rea987 avatar Jul 06 '19 17:07 rea987

Greetings @MrAlert,

Is there any development regarding black screen bug on Enemy Territory: Quake Wars?

https://github.com/MrAlert/sdlcl/issues/14#issuecomment-388630899 https://github.com/MrAlert/sdlcl/issues/14#issuecomment-443350037

rea987 avatar Apr 02 '20 13:04 rea987