Commit Graph

831 Commits

Author SHA1 Message Date
Bill Currie faa98d8198 [gamecode] Use a struct for offset/count pairs
This cleans up dprograms_t, making it easier to read and see what chunks
are in it (I was surprised to see only 6, the explicit pairs made it
seem to have more).
2022-01-26 19:30:25 +09:00
Bill Currie 9c51c3d2e1 [gamecode] Add a data pointer passed to builtin functions
This is part of the work for #26 (Record resource pointer with builtin
function data). Currently, the data pointer gets as far as the
per-instance VM function table (I don't feel like tackling the job of
converting all the builtin functions tonight). All the builtin modules
that register a resources data block pass that block on to
PR_RegisterBuiltins.
2022-01-24 00:20:05 +09:00
Bill Currie a6b932025c [gamecode] Provide builtins with information about their parameters
This will make it possible for the engine to set up their parameter
pointers when running Ruamoko progs. At this stage, it doesn't matter
*too* much, except for varargs functions, because no builtin yet takes
anything larger than a float quaternion, but it will be critical when
double or long vec3 and vec4 values are passed.
2022-01-23 22:27:27 +09:00
Bill Currie f72e8ef551 [qwaq] Fix a couple of errors in debug
Update qdb_get_string's mangling for qfcc's new unsigned int support and
fix an incorrect cast of the param pointer passed by prd_runerror that
caused a segfault when trying to use the string. Attempting to use
qwaq-app (ie, the qc debugger) on Ruamoko ISA progs mostly works, but
the defs are decidedly unhappy (due to the base registers).
2022-01-23 02:04:28 +09:00
Bill Currie ac785ca752 [qwaq] Send app focus event on startup
Terminal apps effectively always have focus (unless I find a way to know
when an xterm loses/gains focus). Fixes input-app not updating on evdev
events.
2022-01-21 00:44:04 +09:00
Bill Currie 4ae9474396 [ruamoko] Use pr_type_names for type sizes
short and ushort are "wrong" (1 instead of 0, because qfcc currently
uses int for short), but now the array will always be in sync with the
enum.
2022-01-19 21:26:44 +09:00
Bill Currie 25f8d3a23d [gamecode] Use pr_type_names.h for type sizes
The goal of the previous mess of commits. Ruamoko needs to wait until
qfcc has the new types.
2022-01-18 17:05:12 +09:00
Bill Currie e9e54d08c0 [gamecode] Rename func_t to pr_func_t
Even more consistency.
2022-01-18 15:36:58 +09:00
Bill Currie afd1eb775b [gamecode] Rename ev_pointer to ev_ptr
Rather short (no worse than ev_int, though) but more consistency is
usually a good thing.
2022-01-18 14:36:06 +09:00
Bill Currie 2f6c3c8ffb [ruamoko] Use pr_type_names.h for Ruamoko
Keeping the two sets of definitions in sync has always been a pain.
2022-01-18 14:21:09 +09:00
Bill Currie cfe7c44df0 [gamecode] Rename ev_integer to ev_int
And other related fields so integer is now int (and uinteger is uint). I
really don't know why I went with integer in the first place, but this
will make using macros easier for dealing with types.
2022-01-18 13:27:19 +09:00
Bill Currie 2df64384c1 [gamecode] Clean up string_t and pointer_t
They are both gone, and pr_pointer_t is now pr_ptr_t (pointer may be a
little clearer than ptr, but ptr is consistent with things like intptr,
and keeps the type name short).
2022-01-18 12:11:14 +09:00
Bill Currie 4111d44dcc [gamecode] Move progs auxiliary headers into a subdirectory
Just another step along the road of tidying up the QF include directory
(and desirable for generated data).
2022-01-09 00:26:52 +09:00
Bill Currie 14d95f81d1 [gamecode] Remove PR_Opcode_Init
It was idempotent, then it became impotent. Now it's just not needed.
2022-01-07 19:25:34 +09:00
Bill Currie be474d9937 [gamecode] Remove the wart from def and function names
I never liked the leading s_ (though I guess it means one is supposed to
interpret the int as a string pointer, but meh).
2021-12-31 15:02:31 +09:00
Bill Currie 2dc806cff5 [ruamoko] Clean up Entity a little
Hide own, and add some class spawn methods.
2021-12-30 13:26:36 +09:00
Bill Currie 8385046486 [qfcc] Warn when super dealloc invocation is missing
Forgetting to invoke [super dealloc] in a derived class's -dealloc
method has caused me to waste far too much time chasing down the
resulting memory leaks and crashes. This is actually the main focus of
issue #24, but I want to take care of multiple paths before I consider
the issue to be done.

However, as a bonus, four cases were found :)
2021-12-24 22:45:43 +09:00
Bill Currie bcf80650f3 [ruamoko] Use the right index in disabled code
I have no idea why the code is disabled (especially considering the
comment), so leaving it that way for now, but this makes the code
compile when enabled.
2021-12-24 06:45:13 +09:00
Bill Currie 2b25748cc4 [ruamoko] Correct SetIterator memory handling
This makes SetIterator more compatible with autorelease.
2021-12-24 06:45:13 +09:00
Bill Currie 3ffdaccd50 [qwaq] Add an event handler for graphics
It's very much a hack, but it will do for now until I can rewrite the
whole thing: it's not at all thread safe, but it is over eight years
old and has survived a lot of bit-rot.
2021-12-24 06:45:13 +09:00
Bill Currie f3918471d5 [ruamoko] Add bindings for the main IMT functions
IMT_SetContextCbuf is not bound as that requires cbuf to be bound.
However, imt contexts can be created, fetched and set.
2021-12-24 06:45:13 +09:00
Bill Currie 241785e952 [ruamoko] Move older math functions
The old math functions from quake and quakeworld don't belong with the
newer ones as their presence in the same object file causes invalid
builtin warnings when pr_cmds isn't present.
2021-12-24 06:45:13 +09:00
Bill Currie a89aa7fc33 [ruamoko] Clean up ruamoko/lib rules
They were ok before the update to non-recursive make, but with the extra
bits of path, the rules got very hard to read.
2021-12-24 06:45:13 +09:00
Bill Currie dcd1fa28ba [ruamoko] Get the input bindings working
With some hacks that are not included (plan on handling events and
contexts properly), button inputs, including using listeners, are
working nicely: my little game is working again. While the trampoline
code was a bit repetitive (and I do want to clean that up), connecting
button listeners directly to Ruamoko instance methods proved to be quite
nice.
2021-12-24 06:45:13 +09:00
Bill Currie 23e3b4c2e5 [ruamoko] Retrieve a plitem_t from PropertyList
And also internally for cross-builtin use.
2021-12-24 06:45:13 +09:00
Bill Currie 5e273a3693 [ruamoko] Make plitem_t easier to use
Or more accurately, struct plitem_s. Including the pointer in the
typedef made things a little awkward.
2021-12-24 06:45:13 +09:00
Bill Currie f1d097c0c4 [ruamoko] Add bindings for Mercenne Twister 2021-12-24 06:45:13 +09:00
Bill Currie 6411518603 [ruamoko] Make some progress on the input bindings 2021-12-24 06:45:13 +09:00
Bill Currie 33e48025dd [ruamoko] Replace rua_key with rua_input
And create rua_game to coordinate other game builtins.

Menus are broken for key handling, but have been since the input rewrite
anyway. rua_input adds the ability to create buttons and axes (but not
destroy them). More work needs to be done to flesh things out, though.
2021-12-24 06:45:13 +09:00
Bill Currie 8e08f5f84e [qwaq] Drop qwaq-graphics.log
For now, at least. The client console takes over Sys_Printf and breaks
the logging.
2021-12-24 06:45:13 +09:00
Bill Currie 2cb987fdb5 [build] Clean up a pile of distcheck issues 2021-12-24 06:45:13 +09:00
Bill Currie ad83422c56 [qwaq] Adapt startup code for use in a game engine
Until now, the new qwaq startup was used only in command-line tools and
console applications where things like Ruamoko security and having a
hunk were not an issue. Now the start up code (qwaq-*.c) can specify
that Ruamoko is to be secured and provide a hunk on a per-thread basis,
and the thread data is passed into the progs code via a progs resource.
2021-12-24 06:45:13 +09:00
Bill Currie d3853a2430 [qwaq] Update qwaq-x11's initialization
It now uses the advanced command line parsing used by qwaq-curses and
qwaq-cmd, but currently disables multi-threading (I don't want to deal
with threading in the engine just yet). The int file is -graphics
because qwaq-x11 is really just the X11 target, qwaq-win is built for
windows, but they use the same basic startup (I hope).
2021-12-24 06:45:13 +09:00
Bill Currie 0e7e88815c [qwaq] Fix up file headers 2021-12-24 06:45:13 +09:00
Bill Currie 97c3cbf719 [qwaq] Rename input.c
It's very specialized toward terminal input (ie, for qwaq-curses).
2021-12-24 06:45:13 +09:00
Bill Currie 7892382639 [qwaq] Remove obsolete file
I don't remember when it was last used, and deleting it saves me the
hassle of sorting out its header :P
2021-12-24 06:45:13 +09:00
Bill Currie 2086125e0b [quakefs] Take in the pointer to the global hunk
This is needed for cleaning up excess memsets when loading files because
Hunk_RawAllocName has nonnull on its hunk pointer (as the rest of the
hunk functions really should, but not just yet).
2021-12-24 06:45:13 +09:00
Bill Currie 84a24dbb34 [renderer] Make R_RenderView private
This is actually a better solution to the renderer directly accessing
client code than provided by 7e078c7f9c.

Essentially, V_RenderView should not have been calling R_RenderView, and
CL_UpdateScreen should have been calling V_RenderView directly. The
issue was that the renderers expected the world entity model to be valid
at all times. Now, R_RenderView checks the world entity model's validity
and immediately bails if it is not, and R_ClearState (which is called
whenever the client disconnects and thus no longer has a world to
render) clears the world entity model. Thus R_RenderView can (and is)
now called unconditionally from within the renderer, simplifying
renderer-specific variants.
2021-12-24 06:45:12 +09:00
Bill Currie d8a836e9da [input] Add broadcast events for app focus gain/loss
These are for when the application itself gains or loses focus, rather
than individual event handlers.
2021-11-22 14:59:32 +09:00
Bill Currie 3ac6d2aa22 [x11] Use barriers to trap the pointer in the window
This should be a much friendlier way of "grabbing" input, though I
suspect that using raw keyboard events will result in a keyboard grab,
which is part of the reason for wanting a friendly grab.

There does seem to be a problem with the mouse sneaking out of the
top-right and bottom-left corners. I currently suspect a bug in the X
server, but further investigation is needed.
2021-11-22 14:59:27 +09:00
Bill Currie 52c5f0545b [input] Add broadcast event for application window changes
This is the first step in the long-sought goal of allowing the window
size to change, but is required for passing on getting window position
and size information (though size is in viddef, it makes sense to pass
both together).
2021-11-22 13:20:13 +09:00
Bill Currie e45d19835c [x11] Add initial support for XInput2
Right now, only raw pointer motion and button events are handled, and
the mouse escapes the window, and there are some issues with focus in
focus-follows-mouse environments. However, this should be a much nicer
setup than DGA.
2021-11-21 23:42:33 +09:00
Bill Currie b892ce637a [input] Nuke IN_Move from orbit
gotta be sure :)

On a serious note, it was always a problem in that it had
client-specific code and concepts embedded in the libraries.
2021-11-19 08:58:02 +09:00
Bill Currie b95c749438 [input] Add a per-device event data pointer
This might pose a problem with multiple event targets (we'll see), but
it will make connecting input devices to bindings much easier.
2021-11-10 13:22:10 +09:00
Bill Currie 4898a44263 [console] Hook up new input system
This has smashed the keydest handling for many things, and bindings, but
seems to be a good start with the new input system: the console in
qw-client-x11 is usable (keyboard-only).

The button and axis values have been removed from the knum_t enum as
mouse events are separate from key events, and other button and axis
inputs will be handled separately.

keys.c has been disabled in the build as it is obsolute (thus much of
the breakage).
2021-11-08 11:20:04 +09:00
Bill Currie 825d8b7a49 [input] Make a start on the new binding system
Input Mapping Tables are still at the core as they are a good concept,
however they include both axis and button mappings, and the size is not
hard-coded, but dependent on the known devices. Not much actually works
yet (nq segfaults when a key is pressed).
2021-11-03 19:02:39 +09:00
Bill Currie 09e3e62a0a [input] Move in_event.h and binding defs
They now live in the include QF/input directory. This cleans up include/QF
a little, and input.h as well.
2021-11-01 13:05:05 +09:00
Bill Currie 665790f562 [video] Remove libQFjs
It is now redundant with the libQFinput, though nothing actually works yet.
2021-11-01 12:30:45 +09:00
Bill Currie abe77523ae [qwaq] Disable xterm mouse handling on shutdown
Getting mouse escape codes on the command line is not very pleasant
(even if display-only).
2021-10-29 10:16:42 +09:00
Bill Currie cacf0be7f6 [util] Wrap fd_set
While select itself is reasonably portable, it turns out that including
the declaration for fd_set makes a bit of a mess for QF's clean headers.
2021-09-28 10:53:51 +09:00
Bill Currie 7f408351b9 [input] Use a single select call for all drivers
For drivers that support it. Polling is still supported and forces the
select timeout to 0 if any driver requires polling. For now, the default
timeout when all drivers use select is 10ms.
2021-09-26 15:11:07 +09:00
Bill Currie 1d86a18eb1 [qwaq] Be paranoid about memcpy and null pointers
Although I suspect memcpy does the right thing when the byte count is 0,
the man page wasn't explicit and this is more portable.
2021-09-26 12:05:16 +09:00
Bill Currie ac25d9f1c1 [qwaq] Fix window closure
Now the device windows close properly when an input device is removed.
2021-09-26 10:35:24 +09:00
Bill Currie 13bc38a55b [input,ruamoko,qwaq] Fix incorrect use of PR_RESMAP
I had forgotten that _size was the number of rows in the map, not the
number of objects (1024 objects per row). This fixes the missed device
removal messages. And probably a slew of other bugs I'd yet to encounter
:P
2021-09-25 15:50:16 +09:00
Bill Currie 4057500acc [qwaq] Implement device management for input-app
Currently shows only the axes (along with dev "path" and name), but it
has done a good job of pushing dev of other bits of code :)
2021-09-25 14:22:19 +09:00
Bill Currie 1a5cce4374 [qwaq] Set table cell size in the correct place
I have no idea why I made LocalsData set the size instead of TableView,
but now the cells are correctly sized automatically.
2021-09-25 13:27:55 +09:00
Bill Currie 0df16fb210 [qwaq] Fix TableView's scrolling 2021-09-25 10:53:39 +09:00
Bill Currie 0a60f46a64 [qwaq] Implement more debugger def views
Structs and arrays now work (though could be better, eg collapsible).
2021-09-25 01:42:36 +09:00
Bill Currie 6f71ef6657 [qwaq] Separate out mouse (de)init code
This is the simplest fix for the curses/input initialization order
issue. The terminal io code should still be moved to its own file,
really, but I think it can wait.
2021-09-23 13:14:42 +09:00
Bill Currie 72900fd16b [qwaq] Move input handling to its own thread
As it is now a completely separate sub-system, there is a bit of trouble
with mouse handling in that curses must be initialized before input for
the mouse to work properly, but the basic scheme seems to be working
nicely. I suspect the solution to the init order issue is to make have
the curses sub-system initialize the terminal input driver, at least for
mouse input (ie, maybe just enable/disable mouse handing).
2021-09-22 16:22:11 +09:00
Bill Currie e942fe6528 [qwaq] Add input test app
The queues in the curses resources struct have been cleaned up and the
threading support code (including for the queues (pipes, really)) has
been moved to its own file.

The input test app currently just prints the devices and the events as
they come in, but demonstrates the new input system working in a
separate thread (though it is currently in with the curses thread).
2021-09-21 12:58:10 +09:00
Bill Currie 106ab86c3e [qwaq] Move the ui code into a library 2021-09-20 15:31:50 +09:00
Bill Currie 5d1e515e9e [qwaq] Hook up input to a certain extent
Really, just enough to show that the initialization process and hotplug
are working. The qwaq input driver is not yet properly integrated.
2021-08-30 09:59:30 +09:00
Bill Currie a91dac60d9 [input] Start work on improved input system
The common input code (input outer loop and event handling) has been
moved into libQFinput, and modified to have the concept of input drivers
that are registered by the appropriate system-level code (x11, win,
etc).

As well, my evdev input library code (with hotplug support) has been
added, but is not yet fully functional. However, the idea is that it
will be available on all systems that support evdev (Linux, and from
what I've read, FreeBSD).
2021-08-27 09:10:21 +09:00
Bill Currie 54604d9aa2 [util] Make hunk (optionally) thread-safe
For now, the functions check for a null hunk pointer and use the global
hunk (initialized via Memory_Init) if necessary. However, Hunk_Init is
available (and used by Memory_Init) to create a hunk from any arbitrary
memory block. So long as that block is 64-byte aligned, allocations
within the hunk will remain 64-byte aligned.
2021-07-29 11:43:27 +09:00
Bill Currie 49c3dacbbc [util] Rename set_size to set_count
After seeing set_size and thinking it redundant (thought it returned the
capacity of the set until I checked), I realized set_count would be a
much better name (set_count (node->successors) in qfcc does make much
more sense).
2021-07-27 11:52:21 +09:00
Bill Currie 40a26e4bc8 [scene] Rename libQFentity to libQFscene
And start working on scene management.
2021-07-24 14:20:59 +09:00
Bill Currie e799a7ae45 [qwaq] Readd libQFruamoko_client to qwaq-x11
Turned out it was needed after all (bad build test)
2021-07-22 18:08:13 +09:00
Bill Currie e089234f38 [console] Link against libQFruamoko_console
Fixes shared plugin not loading due to missing symbol.
2021-07-22 18:01:18 +09:00
Bill Currie 34dd434147 [qwaq] Fix missing gib library references
Not sure why static builds worked and dynamic didn't, but...
2021-07-10 18:31:22 +09:00
Bill Currie f18e1366ba [vulkan] Silence vkgen's debug output
It was hidden by qwaq-curses, but the switch to using qwaq-cmd made it
pretty obvious.
2021-07-06 12:27:21 +09:00
Bill Currie ae58a8ba5d [qwaq] Create a commandline-only version of qwaq
qwaq-curses has its place, but its use for running vkgen was really a
placeholder because I didn't feel like sorting out the different
initialization requirements at the time. qwaq-cmd has the (currently
unnecessary) threading power of qwaq-curses, but doesn't include any UI
stuff and thus doesn't need curses. The work also paves the way for
qwaq-x11 to become a proper engine (though sorting out its init will be
taken care of later).

Fixes #15.
2021-07-06 12:25:24 +09:00
Bill Currie e81d690b51 [input] Create QF input library using keys.c
This refactors (as such) keys.c so that it no longer depends on console
or gib, and pulls keys out of video targets. The eventual plan is to
move all high-level general input handling into libQFinput, and probably
low-level (eg, /dev/input handling for joysticks etc on Linux).

Fixes #8
2021-07-05 16:26:07 +09:00
Bill Currie 12ab283c22 [qwaq] Add a little z-transform program
And fix an error in floatview.

The z-transform program is so I can test out my math and eventually
develop some hopefully interesting sound generators.
2021-06-19 11:25:05 +09:00
Bill Currie 8db1957452 [ruamoko] Add bindings for exp() 2021-06-19 11:23:51 +09:00
Bill Currie 813497a1aa [ui] Create library for UI support code
Currently this has text buffer, input line, vrect and view code.
2021-06-12 22:50:51 +09:00
Bill Currie 2572011a4b [qwaq] Fix various scrollbar related issues
The editor now uses the vertical scrollbar for handling mouse wheel
scrolling, thus keeping the scrollbar in sync.

Scrollbar index can now cover the full range (not sure why I had that
-1), and the potential divide by zero is avoided properly.

Thumb-tab now positioned properly when the range is 0.
2021-06-12 01:30:44 +09:00
Bill Currie f09810b595 [qwaq] Implement the remaining basic cursor motion
This gets all the basic cursor motion from my old editor working.
arrow keys: left/right/up/down char/line
home/end: beginning/end of line
page up/down

and ctrl versions where left/right are prev/next work, up/down skip over
indents, home/end are beginning/end of screen, and page up/down are
beginning/end of text.
2021-06-11 23:34:43 +09:00
Bill Currie 3cd0d68774 [qwaq] Implement word left and right
The word boundaries are currently vary simple, just transitions from
alnum_ (as it was in my old editor and in Borland's editors), but the
basic logic is working.
2021-06-11 10:14:07 +09:00
Bill Currie 75ce07a14c [qwaq] Implement home and end
Currently, home always moves the cursor to the very first column, but
I'm considering making it move the cursor to the first non-space
character of the line if it's not already there, otherwise to the first
column (ie, the cursor will toggle between the two positions if it's in
one of them).
2021-06-10 14:29:32 +09:00
Bill Currie 055ea46337 [qwaq] Fix page up/down and deal with tabs 2021-06-10 12:13:55 +09:00
Bill Currie 2a38135dd9 [qwaq] Fix scrollbar thumbtab covering button
Caused by an out-by-one error.
2021-06-09 08:33:50 +09:00
Bill Currie d23c9582f1 [qwaq] Implement execute-to-cursor
Support for finding the first address associated with a source line was
added to the engine, returning 0 if not found.

A temporary breakpoint is set and the progs allowed to run free.
However, better handling of temporary breakpoitns is needed as currently
a "permanent" breakpoint will be cleared without clearing the temporary
breakpoing if the permanent breakpoing is hit while execut-to-cursor is
running.
2021-06-08 16:54:04 +09:00
Bill Currie c818a2abf9 [qwaq] Support base filename and cursor fetching
Getting the base filename and the current cursor position is needed for
execute-to-line support in the debugger.
2021-06-08 16:50:30 +09:00
Bill Currie c06acd3b53 [qwaq] Update line and char indices with cursor motion 2021-06-08 16:48:24 +09:00
Bill Currie 1f6a4ed941 [qwaq] Implement cursor motion in the editor
Basic arrow key motion, and it's currently limited to not scrolling
horizontally (need to figure out how to handle max scroll), but this
also fixes the cursor handling on focus switching :)
2021-06-07 22:21:48 +09:00
Bill Currie 551236511d [qwaq] Make the editor show the cursor
As well as showing the cursor, it keeps the cursor's position up to date
(for now, just at 0,y as only gotoLine is implemented, no cursor motion
yet)
2021-06-07 16:20:15 +09:00
Bill Currie 5892008306 [qwaq] Add char get/put/insert methods to EditBuffer 2021-06-07 16:05:32 +09:00
Bill Currie 48bf6fff13 [qwaq] Get the cursor mostly working
It's a little flakey with respect to redraws and changes of focus, but I
think that's just updating the cursor state in more places.
2021-06-07 15:58:19 +09:00
Bill Currie d36a75e3de [qwaq] Fix incorrect screen refresh
Or, at least, I think it's incorrect, since stdscr (which was being
refreshed) should not be used when using panels.
2021-06-07 15:56:57 +09:00
Bill Currie 5e8376340d [qwaq] Add method to get group's owning view 2021-06-07 15:56:20 +09:00
Bill Currie 3d42f986c3 [qwaq] Add wrapper for wmove 2021-06-07 15:53:35 +09:00
Bill Currie f50d27ec11 [qwaq] Show dereferenced data for poitner defs
The code currently assumes a single value is referenced rather than the
beginning of an array.
2021-06-04 13:35:53 +09:00
Bill Currie 22b9bb29f6 [qwaq] Calculate type sizes for compound types 2021-06-04 13:34:15 +09:00
Bill Currie 7275d9bbf5 [qwaq] Fully load target types into debugger
Fully loading the types means that code using the target's type
definitions does not need to worry about pulling in sub-types for
structured data.
2021-06-04 13:31:43 +09:00
Bill Currie 5e29cecf44 [ruamoko] Add pr_type_size array to types.[rh] 2021-06-04 13:29:27 +09:00
Bill Currie 53b553e892 [qwaq] Rework def views to support multi-row defs
Needed for structured types (arrays, structs, etc). The multiple rows
aren't implemented yet, but the initial groundwork is done.
2021-06-01 23:52:04 +09:00
Bill Currie 5ca792c40e [ruamoko] Add some stdlib function wrappers
For now, just bsearch (normal and fuzzy), qsort, and prefixsum (not in
C's stdlib that I know of, but I think having native implementations of
float and int prefix sums will be useful.
2021-06-01 18:53:53 +09:00
Bill Currie d98c92a5c4 [qwaq] Start work on cursor management
For now, the cursor is always hidden, but the plan is to have it visible
in only the focused view if that view has enabled the cursor.
2021-06-01 18:53:53 +09:00
Bill Currie 00fb0972a8 [qwaq] Fix some incorrect parameter acesses
They weren't wrong as such (the data was being accessed correctly
anyway, just not ideal as the parameter access was slightly hidden.
2021-06-01 18:53:53 +09:00
Bill Currie 73cffe283a [qwaq] Ensure qwaq_event_t's when is aligned
While qfcc will always align double values to 8 bytes (really, two
global words) regardless of the underlying hardware, gcc does not:
doubles are only 4-byte aligned on 32-bit hardware.

This fixes the invalid debug target handle when running on i686.
2021-06-01 18:53:53 +09:00
Bill Currie 1e9329ccf6 [nq,qw] Stop wring to config.cfg
QF now uses its own configuration file (quakeforge.cfg for now) rather
than overwriting config.cfg so that people trying out QF in their normal
quake installs don't trash their config.cfg for other quake clients. If
quakeforge.cfg is present, all other config files are ignored except
that quake.rc is scanned for a startdemos command and that is executed.
2021-04-12 22:09:09 +09:00
Bill Currie 7e6928d7d5 [qwaq] Work around a gcc non-conformance
*sigh*
2021-04-03 00:27:43 +09:00
Bill Currie a5df5867b6 [qwaq] Avoid ignored return val warning
If those particular writes file (and it matters), we probably have
bigger problems.
2021-04-03 00:14:49 +09:00
Bill Currie 64f51bda6e [build] Get make distcheck working again
again...

This covers only the basic check with a build in debian, but it's a good
start.
2021-03-29 17:35:30 +09:00
Bill Currie 6fea5f5e1a [build] Add -Wformat-non-literal option
While this caused some trouble for pr_strings and configurable strftime
(evil hacks abound), it's the result of discovering an ancient (from
maybe as early as 2004, definitely before 2012) bug in qwaq's printing
that somehow got past months of trial-by-fire testing (origin understood
thanks to the warning finding it).
2021-03-29 17:27:06 +09:00
Bill Currie 88ff254f42 Get QF cross-compiling using MXE/mingw32
This includes -win clients (no clue if anything actually works yet).
2021-03-27 20:09:37 +09:00
Bill Currie a9bd436837 [build] Autoconfiscate printf format attribute
I don't know if gnu_printf is appropriate for all cases, but it is
needed for mingw32.
2021-03-27 19:52:59 +09:00
Bill Currie c9f1d770e0 Merge master into csqc-improvements
That was a mess
2021-03-25 22:01:31 +09:00
Bill Currie 56cf181a11 [gamecode] Make PR_RESMAP macros more function-like
I never liked that some of the macros needed the type as a parameter
(yay typeof and __auto_type) or those that returned a value hid the
return statement so they couldn't be used in assignments.
2021-03-21 21:26:36 +09:00
Bill Currie fbc1bd9f6e [renderer] Clean up entity_t to a certain extent
This is the first step towards component-based entities.

There's still some transform-related stuff in the struct that needs to
be moved, but it's all entirely client related (rather than renderer)
and will probably go into a "client" component. Also, the current
components are directly included structs rather than references as I
didn't want to deal with the object management at this stage.

As part of the process (because transforms use simd) this also starts
the process of moving QF to using simd for vectors and matrices. There's
now a mess of simd and sisd code mixed together, but it works
surprisingly well together.
2021-03-10 00:01:41 +09:00
Bill Currie 0bfb60775e [util] Ensure hunk allocs are cache alligned
This doesn't seem to make much difference in the vulkan renderer, but it
certainly doesn't hurt.
2021-02-03 13:19:19 +09:00
Bill Currie 7970525ef4 [util] Make va thread-safe
It now takes a context pointer (opaque data) that holds the buffers it
uses for the temporary strings. If the context pointer is null, a static
context is used (making those uses of va NOT thread-safe). Most calls to
va use the static context, but all such calls have been formatted
consistently so they are easy to find when it comes time to do a full
audit.
2021-01-31 16:05:48 +09:00
Bill Currie cad1eb42fd [qwaq] Put my qdb script in a safe place
The paths are generally wrong, and it's not overly complicated, but
having a reference helps me remember how to use the thing.
2021-01-30 14:45:47 +09:00
Bill Currie 328a529a94 Create RB_ACQUIRE and RB_RELEASE
RB_RELEASE is actually RB_DROP_DATA renamed, but RB_ACQUIRE and
RB_RELEASE work well when working with more structured ring buffer
contents.
2021-01-23 11:56:45 +09:00
Bill Currie e6704b85e1 Make RB_PEEK_DATA return the address of the data
This makes it a little more generally useful.
2021-01-22 18:29:35 +09:00
Bill Currie 6e636a27d0 [renderer] Continue the job of merging SCR_UpdateScreen
I think this is probably as merged as it will get (though the update
callbacks can probably do with some merging).
2021-01-11 16:57:31 +09:00
Bill Currie 37b6d11c01 [ruamoko] Add binding for str_upper
I can't believe I didn't do that when I did str_lower.
2021-01-05 18:24:18 +09:00
Bill Currie e1e2a0e712 [ruamoko] Add a wrapper for PL_Line
Makes error reporting in rua code easier.
2020-12-23 21:52:42 +09:00
Bill Currie ab04a1915e [build] Fix a pile of gcc 10 issues
gcc got stricter about array accesses, complicating progs macros, and
much better at detecting buffer overflows.
2020-12-21 14:14:29 +09:00
Bill Currie 8290e3800f [qwaq] Ensure main thread return code gets returned
Needed for catching vkgen errors during the build.
2020-07-16 22:14:19 +09:00
Bill Currie 7a478b4ce7 [libr] Make PLItem more useful
I can't say that I like what's there even now, but at least PLItem can
be used without a lot of casting. Really, Ruamoko needs dictionary and
string classes so reading a property list can build more natural object
trees rather than this mess from when I knew too little.
2020-07-05 16:53:35 +09:00
Bill Currie 1914fa2756 [qwaq] Use full file path for file search
Fixes the memory leak (over 300 editors...)
2020-07-05 16:53:35 +09:00
Bill Currie 225ee0ed3c [qwaq] Use an actual condition variable for control
I think I wasn't sure at the time whether the simple variable was
required for pthread_cond_wait (and friends) to work properly, but it
is: the time between the target posting the debug event and the target
waiting on the condition variable turns out to sometimes be enough for
the debugger to handle the event and signal the target to continue,
resulting in the target waiting on a signal that will never come because
another debug event will not be sent by the target until AFTER it has
exited from the debug handler.
2020-07-05 16:53:35 +09:00
Bill Currie 1910941426 [qwaq] Handle key events differently when running
Pressing F8 (or n) while the debug target was running would cause it to
stop at that point. While it's certainly desirable to stop a runaway
target on demand, that should be with a different input. Now, commands
that start the target running are ignored while the target is running.
No commands for when the target is running have been implemented yet,
but the provision is there.
2020-07-05 16:53:35 +09:00
Bill Currie 64100efe78 [qwaq] Fix a typo 2020-07-05 16:53:35 +09:00
Bill Currie 7f96b0fbed [qwaq] Fix incorrect setting of progs argc/argv 2020-06-28 18:30:01 +09:00
Bill Currie aa8aaaaca9 [build] Support silent rules for qfcc 2020-06-26 10:52:06 +09:00
Bill Currie c2559c7511 [qwaq] PR_RunPostLoadFuncs for qwaq-x11
Same issue as for the menus. But now I know why PR_LoadProgsFile is used
instead of PR_LoadProgs (at least for qwaq): avoidance of the gamedir
restriction (however, the menus are supposed to be restricted).
2020-06-25 19:38:33 +09:00
Bill Currie 86b5b30b45 Merge branch 'master' into vulkan 2020-06-25 14:03:52 +09:00
Bill Currie 6d5ffa9f8e [build] Move to non-recursive make
There's still some cleanup to do, but everything seems to be working
nicely: `make -j` works, `make distcheck` passes. There is probably
plenty of bitrot in the package directories (RPM, debian), though.

The vc project files have been removed since those versions are way out
of date and quakeforge is pretty much dependent on gcc now anyway.

Most of the old Makefile.am files  are now Makemodule.am.  This should
allow for new Makefile.am files that allow local building (to be added
on an as-needed bases).  The current remaining Makefile.am files are for
standalone sub-projects.a

The installable bins are currently built in the top-level build
directory. This may change if the clutter gets to be too much.

While this does make a noticeable difference in build times, the main
reason for the switch was to take care of the growing dependency issues:
now it's possible to build tools for code generation (eg, using qfcc and
ruamoko programs for code-gen).
2020-06-25 11:35:37 +09:00
Bill Currie 54f2e417dc [ruamoko] Fix daft str_str abi
Returning a string was a bad idea as it makes str_str difficult to use
with str_mid. (actually, iirc, it was the only reason I moved all
strings into progs memory... hmm).
2020-04-08 21:54:41 +09:00
Bill Currie b7b8df0801 [ruamoko] Add str_lower builtin
This returns a string with all chars lower-cased.
2020-04-08 21:53:53 +09:00
Bill Currie d88c1e2f40 [libr] Fix missing alias meta name 2020-04-04 15:46:37 +09:00
Bill Currie e80344c58e [qwaq] Use full file path for loading source files 2020-04-04 14:34:18 +09:00
Bill Currie 6291a3c503 [qwaq] Hold the editor filename
It may be an ephemeral string.
2020-04-04 14:33:56 +09:00
Bill Currie 63714c7c55 [qwaq] Add builtin to get a file's full path
If the file's base directory cannot be found, the file name is returned
as-is.
2020-04-04 12:51:42 +09:00
Bill Currie 686fc4c43e [qwaq] Guard qwaq_debug_data with a pthread cond
I should have realized this would be prone to races.
2020-04-04 12:23:28 +09:00
Bill Currie d69db50cf9 [qfcc] Remove path stripping
It never really helped sort out the path issues when using build
directories. It worked well enough for single directory projects, but
things got messy very quickly, especially when mixing ruamoko libs with
external progs. A better method based on dwarf is coming.
2020-04-03 00:50:06 +09:00
Bill Currie 9b1ce44fda [qwaq] Fix some issues with fetching type encodings
Now struct defs show FIXME instead of void data.
2020-04-02 19:31:11 +09:00
Bill Currie 63caa5794d [qwaq] Implement step-over tracing
I decided that stopping in between function calls that are on the same
line is a good thing as it gives a chance to skip over the first but
step into the second.
2020-04-02 17:44:53 +09:00
Bill Currie c09f57c39e [gamecode] Delay .ctor calls if debugging
This allows a debugger to do any symbol lookups and other preparations
between loading progs and the first code execution. .ctors are called as
per normal if debug_handler is not set.
2020-04-02 17:39:11 +09:00
Bill Currie ea1e85905c [qwaq] Implement source-level stepping
Now the debugger stops only when the source line has changed or the
statement address is stuck.
2020-04-02 13:07:50 +09:00
Bill Currie 7e51f26b10 [qwaq] Move all the def views into a subdirectory
More declutter.
2020-04-02 13:06:31 +09:00
Bill Currie 6d8bc395f4 [qwaq] Make debug event data available 2020-04-02 12:30:59 +09:00
Bill Currie 118fba8df5 [qwaq] Cope with functions that don't have locals
In this case, .ctor functions.
2020-04-02 00:51:22 +09:00
Bill Currie 1d5058d267 [qwaq] Move progs create and load into the threads
While this does answer the question of how I'll go about restarting the
target progs (when I get to that point), it was required just to start
full-on ruamoko progs because .ctor was getting run in the main thread
and blocking due to trace.
2020-04-02 00:11:47 +09:00
Bill Currie d9668a1185 [qwaq] Silence some more debug
I was wondering where those sprintfs were going
2020-04-02 00:11:34 +09:00
Bill Currie 154da7653d [qwaq] Quote the string value before display 2020-04-01 21:29:42 +09:00
Bill Currie 6b9d4a747d [ruamoko] Add a builtin to quote strings
All unprintable chars are converted to either standard escape sequences
or \xHH.
2020-04-01 21:28:25 +09:00