Commit graph

83 commits

Author SHA1 Message Date
Daniel Gibson
2de8c22f3b Fix MSVC + Tools build
afxv_w32.h (apparently included indirectly viw edit_gui_common.h)
complained that windows.h (included indirectly via DebuggerServer.h
-> platform.h) was included first, apparently that's not allowed..

this was broken by the recent "fix mingw build" commit; now hopefully
both work (MinGW doesn't support building the tools, because they need MFC
which only works with MSVC)
2023-01-21 20:33:14 +01:00
Daniel Gibson
07985cc5ea Fix MinGW build, #505
<intrin.h>, included by SDL_cpuinfo.h via SDL.h, defines strcmp.
If the idlib/Str.h `#define strcmp idStr::Cmp` hack is visible when
that file is parsed, there's a compiler error (because strcmp in
intrin.h is replaced with idStr::Cmp then).
So I reorderedd includes a bit until it compiled again..
2023-01-16 03:15:21 +01:00
Daniel Gibson
996947eec6 Fix -Wmismatched-new-delete warnings
totally valid, how didn't we find them yet (ok, maybe because those
functions aren't called much)
2023-01-05 07:56:16 +01:00
Daniel Gibson
957176d659 Fix GCC -W(maybe-)uninitialized warnings that at least kinda had a point 2023-01-05 07:51:59 +01:00
Daniel Gibson
5844af62ce Don't use "register" keyword, it was deprecated in C++11
.. and even removed in C++17 - and before that it probably didn't do
much in most compilers
2023-01-05 05:07:53 +01:00
Daniel Gibson
279a40a981 Fix -Wformat-security warnings - thanks James Addison!
This is based on https://github.com/dhewm/dhewm3/pull/500
by https://github.com/jayaddison

See also https://github.com/blendogames/quadrilateralcowboy/pull/4
2023-01-05 04:45:34 +01:00
Daniel Gibson
177740ca88 Fix crash in Radiant Model Preview Dialog, fix #496
the problem was a double-free on files, because USE_COLLADA is not defined.
I'm not even sure why this USE_COLLADA code exists, as we don't have any
real collada support code anywhere..
2022-10-22 20:47:33 +02:00
Daniel Gibson
a2929d9062 Fix Light Editor in Radiant (#456)
When selecting a light in the Radiant (builtin Windows-only level editor)
and pressing `j`, the light editor opened (as expected) but said that
no entity was selected.
That was because com_editorActive was false, most probably because of
  e8a1eb8b Fix mouse remaining ungrabbed when running map from Radiant
which sets com_editorActive to false (via com->ActivateTool(false)) if
the Radiant window loses focus, which should be the case when opening
the light editor window.

`com_editors & EDITOR_RADIANT` is != 0 as long as the radiant is
running, no matter which window currently has focus, so it works better.
2022-05-30 00:33:16 +02:00
Daniel Gibson
0f9e066bf6 Fix running script debugger if fs_basepath is used
I don't think fs_cdpath is relevant (anymore? has it ever been?), but
fs_basepath sure is.
2022-05-18 04:22:25 +02:00
Daniel Gibson
e8a1eb8baf Fix mouse remaining ungrabbed when running map from Radiant 2022-05-18 04:01:33 +02:00
Daniel Gibson
ae63021d00 Add absolute mouse mode and refactor mouse grabbing code
There were lots of places in the code that called Sys_GrabInput(),
some of them each frame.
Most of this is unified in events.cpp now, in handleMouseGrab() which
is called once per frame by Sys_GenerateEvents() - this makes reasoning
about when the mouse is grabbed and when not a lot easier.
Sys_GrabInput(false) still is called in a few places, before operations
that tend to take long (like loading a map or vid_restart), but
(hopefully) not regularly anymore.

The other big change is that the game now uses SDLs absolute mouse mode
for fullscreen menus (except the PDA which is an ugly hack), so the
ingame cursor is at the same position as the system cursor, which
especially helps when debugging with `in_nograb 1` and should also help
if someone wants to integrate an additional GUI toolkit like Dear ImGui.
2022-01-10 00:46:32 +01:00
Daniel Gibson
8cb4843022 Shorten file path in backtraces
The build dir isn't relevant, only the source path starting with neo/ is

Also removed instances of nullptr
2022-01-08 17:02:24 +01:00
Daniel Gibson
3e039ca898 Fix misleading indentation in roq codec.cpp 2022-01-08 16:59:10 +01:00
HarrievG
0b00c78dc0 - another margin size fix 2021-07-18 22:06:38 +02:00
Daniel Gibson
06ff49c6b6 Restore C++98 compatibility (NULL instead of nullptr)
and print a message when libcurl has been found
2021-07-17 18:24:46 +02:00
Daniel Gibson
21f1ba3161 Script Debugger: Scale script text according to DPI scaling
and scale the breakpoint dots accordingly - now they don't looked all
squashed anymore.

I think ResizeImageList() is more correct now, at least this helped with
the breakpoint dots.
2021-07-16 02:19:27 +02:00
Daniel Gibson
c3d77abd2b Script Debugger: Support line numbers up to 9999
but it's still a bit wonky with DPI-scaling

I also made the rect calculations a bit more intuitive
and removed a misleading comment in my breakpoint list code
2021-07-15 02:31:40 +02:00
HarrievG
764d23a394 - fixed lnr range after zoom/resize 2021-07-14 23:37:28 +02:00
HarrievG
5c3d95efee - Added line nrs to script richedit 2021-07-14 23:32:28 +02:00
HarrievG
b9833e7e6e - Fixed Once Breakpoints
- Send scriptlist on connect.
- upped version info
2021-07-13 20:36:53 +02:00
Daniel Gibson
6211d6e724 Debugger: Implement List of Breakpoints
Double-clicking an entry opens the script at the correct line.
Single-clicking the breakpoint symbol in the list removes the breakpoint,
and so does selecting the breakpoint in the list and pressing the Del key.
2021-07-13 06:12:44 +02:00
Daniel Gibson
fbd188853c Debugger: Make "Filename" colums wider
and "Line" column narrower.

The "Filename" columns weren't wide enough for many script filenames
2021-07-13 06:12:29 +02:00
Daniel Gibson
4172b006cc Debugger: Support OnceOnly-Breakpoints ("Run To Cursor") 2021-07-13 06:11:45 +02:00
HarrievG
d7eff865af - automatically scroll the console output to last line on print 2021-07-05 10:37:29 +02:00
HarrievG
fe162e626f - removed unused onceOnly flag for debugger breakpoints. 2021-07-03 21:46:16 +02:00
HarrievG
784f1d567c - Moved debugger intialistion after GameDll load
- DebuggerServer will not intialize when the additional function FT_UpdateDebugger is not set
2021-07-03 01:14:49 +02:00
HarrievG
ebf53cdc21 rev feedback v1. 2021-07-01 01:09:15 +02:00
HarrievG
d4db77b9ed - Unbreaking Game and GameEdit API / ABI for game debugger use 2021-06-28 23:38:38 +02:00
HarrievG
7e367a0e62 - Added Console input / command exec to debugger 2021-06-21 14:59:28 +02:00
Daniel Gibson
40fa8a7dfa Fix script debugging when server is running on Linux
the script paths were wrong, on Linux they were like
"pak000.pk4/script/doom_util.script" while on Windows it's only
"script/doom_util.script".
Fixed idFileSystemLocal::OSPathToRelativePath() to skip ...pk4/

also fixed GCC compile error in Common.cpp
2021-06-19 21:30:26 +02:00
Daniel Gibson
07da116640 Fix debugger resume 2021-06-19 21:30:26 +02:00
HarrievG
d455ac5223 - set com_editors appropiately when debugger forces connection. 2021-06-19 21:30:26 +02:00
HarrievG
5260de58c4 - fixed command line arguments for game when debugger client launches it. 2021-06-19 21:30:26 +02:00
HarrievG
d7be3964d4 - always accept debugger messages from loopback 2021-06-19 21:30:26 +02:00
HarrievG
02dcd00788 - Hide game window when launching script debugger 2021-06-19 21:30:26 +02:00
HarrievG
8a455c3c7a - Debugger server can be toggled with : com_enableDebuggerServer [1 / 0]
- Added com_dbgClientAdr for debugger server to connect to
- Added com_dbgServerAdr for the debugger client to connect to
2021-06-19 21:30:26 +02:00
Daniel Gibson
2cff2ae137 DebuggerServer: should now also work with SDL1.2 2021-06-19 21:30:26 +02:00
Daniel Gibson
6b6b28a401 Make DebuggerServer portable (use SDL instead of WinAPI) 2021-06-19 21:30:26 +02:00
HarrievG
3ce93c7749 - Debuggersever now always builds, but is disabled by default in runtime.
- use com_enableDebuggerServer=1 to enable debugger server.
2021-06-17 05:44:23 +02:00
HarrievG
5ebda5eab5 - removed clientside use of mBreakprogram ptr 2021-06-17 05:44:23 +02:00
HarrievG
a8709206d8 - Whitespace fix 2021-06-17 05:44:23 +02:00
HarrievG
46157857b5 - Always write 64b program pointer 2021-06-17 05:44:23 +02:00
HarrievG
5e27330233 - 64bit debugger fixes 2021-06-17 05:44:23 +02:00
HarrievG
7a2ccee330 debugger 2021-06-17 05:44:23 +02:00
Daniel Gibson
b054261a0e Make MFC Tools work with MSAA enabled
The problem was that the editors called ChoosePixelFormat() instead of
wglChoosePixelFormatARB() - and the normal ChoosePixelFormat() has no
attribute for MSAA, so if MSAA is enabled (by SDL2 which calls the wgl
variant), ChoosePixelFormat() will return an incomaptible format and
the editors don't get a working OpenGL context.
So I wrote a wrapper around ChoosePixelFormat() that calls the wgl variant
if available, and all the necessary plumbing around that.

While at it, removed the unused qwgl*PixelFormat function pointers and
supressed the "inconsistent dll linkage" warnings for the gl stubs
2021-05-11 00:39:00 +02:00
Daniel Gibson
c3d480afe4 Rename GetWindowScalingFactor() to Win_GetW.., support older Win versions
Minimum required Windows version is XP again (instead of Win10).
Win_GetWindowScalingFactor() tries to use two dynamically loaded functions
from newer windows versions (8.1+, Win10 1607+) and has a fallback for
older versions that also seems to work (at least if all displays have
the same DPI).

Moved the function to win_main.cpp so the dynamically loaded functions
can be loaded at startup; so edit_gui_common.cpp could be removed again.
2021-05-10 03:18:24 +02:00
HarrievG
e67b77ba5d - Wrapped GetDpiForWindow in GetWindowScalingFactor
- Use GetDeviceCaps for dpi on anything else than win10.
2021-05-10 01:09:47 +02:00
HarrievG
86866b73d5 - 4K / DPI aware Tool fixes
- Nullptr guard/Crashfix in material editor : meMainFrame can be null
  when starting immedeatly from commandline.
2021-05-10 01:09:47 +02:00
Daniel Gibson
5f137955ac Make rvGEWindowWrapper (for GUI editor) 64bit clean
it wants to store a pointer to itself in an idWinVar - on 32bit idWinInt
was suitable for that, on 64bit it's not, so instead convert the pointer
to a hex-string and stuff it in a idWinStr

also fix a crash when adding a choiceDef in the gui editor
2021-05-08 07:03:55 +02:00
Daniel Gibson
5dc9b69374 Fix most (according to warnings) remaining 64bit issues in tool code
rvGEWindowWrapper is still TODO - it's not as straightforward, because
it insists on storing a pointer in an idWinVar (using idWinInt), but there
is no idWinVar type for pointers
2021-05-08 05:43:52 +02:00