OpenJKDF2 icon indicating copy to clipboard operation
OpenJKDF2 copied to clipboard

[Improvement] Command autocompletion in the command console

Open Alex3474247 opened this issue 2 years ago • 4 comments

I suggest to improve the command console so that, for example, every time the "forward" key is pressed on the keyboard, the last console command is pasted (cycling the commands out of 5 previously entered), as in Deus Ex or Unreal. + it's better that the command autocompletion works after entering part of the letters of the command when pressing the Tab key so that the game autofills the command or offers a list of available commands as in Half-life(Xash3d). I understand that the console works exactly like in vanilla, but I suggest improving it.

Alex3474247 avatar Jan 11 '23 19:01 Alex3474247

Good. Partially implemented. I want, each time when you press an "Up Arrow" key, last 5 or 10 commands previously entered, are repeated (pasted).

Alex3474247 avatar Jan 27 '23 16:01 Alex3474247

I have just detected a crash, suddenly, when I type jediwannabe, then I press Tab, type "on" and then I press Tab again. The console should write me "No matches", but an exception occurs. I think you should just make a stub for this exception: Exception thrown at 0x00007FF6CB0F4F0B in openjkdf2-64.exe: 0xC0000094: Integer division by zero. Unhandled exception at 0x00007FF6CB0F4F0B in openjkdf2-64.exe: 0xC0000094: Integer division by zero.

openjkdf2-64.exe!jkQuakeConsole_SendInput(char wParam) Line 374 C openjkdf2-64.exe!jkQuakeConsole_WmHandler(HWND__ * a1, unsigned int msg, unsigned int64 wParam, HWND * a4, int64 * a5) Line 442 C openjkdf2-64.exe!Window_msg_main_handler(HWND * hWnd, unsigned int Msg, unsigned __int64 wParam, __int64 lParam) Line 239 C openjkdf2-64.exe!Window_SdlUpdate(...) Line 792 C openjkdf2-64.exe!stdDisplay_DDrawGdiSurfaceFlip(...) Line 215 C openjkdf2-64.exe!jkGame_Update(...) Line 272 C openjkdf2-64.exe!jkMain_GameplayTick(int a2) Line 720 C openjkdf2-64.exe!jkMain_GuiAdvance(...) Line 309 C openjkdf2-64.exe!Window_Main_Loop(...) Line 1189 C openjkdf2-64.exe!Window_Main_Linux(int argc, char * * argv) Line 1301 C openjkdf2-64.exe!SDL_main(int argc, char * * argv) Line 313 C openjkdf2-64.exe!main_getcmdline() Line 82 C

And 1 small improvement, if the command tab'd, for example: jediwannabe, the console doesn't paste the "space" symbol, so you have to press a Space key yourself and then type "on" or "off", 1 or 0 to complete the command. It's only for commands which have "on" and "off", or 1 or 0 states (jediwannabe on/off, boinga 1/0, statuesque 1/0, gospeedgo 1/0 and etc). As far as I remember, this is how it is implemented in Quake, Xash3d, i.e. a space is inserted after the command. The other commands are OK.

Alex3474247 avatar Jan 28 '23 04:01 Alex3474247

Quick fix for this crash: the code: jkQuakeConsole_tabIdx %= idx; replaced by: if (idx != 0) { jkQuakeConsole_tabIdx %= idx; } There may be a better solution, but I haven't analyzed the code in detail.

Alex3474247 avatar Jan 28 '23 06:01 Alex3474247

There is a crash left when I try to bind a command (for example noclip cheat) The game hangs and crashes, you can see it in the video: https://user-images.githubusercontent.com/17110303/218812103-00485430-6a65-4af5-a156-623fd3a77513.mp4

ucrtbased.dll!00007ffba1ad7a20()	Unknown

openjkdf2-64.exe!sithCommand_CmdBind(stdDebugConsoleCmd * pCmd, const char * pArgStr) Line 777 C openjkdf2-64.exe!sithConsole_TryCommand(char * cmd) Line 180 C openjkdf2-64.exe!jkQuakeConsole_ExecuteCommand(const char * pCmd) Line 401 C openjkdf2-64.exe!jkQuakeConsole_SendInput(char wParam, int bIsChar) Line 427 C openjkdf2-64.exe!jkQuakeConsole_WmHandler(HWND__ * a1, unsigned int msg, unsigned int64 wParam, HWND * a4, int64 * a5) Line 710 C openjkdf2-64.exe!Window_msg_main_handler(HWND * hWnd, unsigned int Msg, unsigned __int64 wParam, __int64 lParam) Line 244 C openjkdf2-64.exe!Window_SdlUpdate(...) Line 794 C openjkdf2-64.exe!stdDisplay_DDrawGdiSurfaceFlip(...) Line 215 C openjkdf2-64.exe!jkGame_Update(...) Line 272 C openjkdf2-64.exe!jkMain_GameplayTick(int a2) Line 731 C openjkdf2-64.exe!jkMain_GuiAdvance(...) Line 320 C openjkdf2-64.exe!Window_Main_Loop(...) Line 1224 C openjkdf2-64.exe!Window_Main_Linux(int argc, char * * argv) Line 1337 C openjkdf2-64.exe!SDL_main(int argc, char * * argv) Line 313 C openjkdf2-64.exe!main_getcmdline() Line 82 C [External Code] Exception thrown at 0x00007FFBA1AD7A20 (ucrtbased.dll) in openjkdf2-64.exe: 0xC0000005: Access violation reading location 0xFFFFFFFFF6917285.

img_604

Alex3474247 avatar Feb 14 '23 17:02 Alex3474247