Commit graph

8989 commits

Author SHA1 Message Date
Bill Currie
b5f2da0b78 Copy the entity leaf leak from qw. 2012-11-29 10:15:52 +09:00
Bill Currie
a12eb940f1 Remove the hard-coded bsp maximum depths.
The depth limits in the gl and glsl renderers and in the trace code really
bothered me, but then the fix hit me: at load-time, recurse the trees
normally and record the depth in the appropriate place. The node stacks can
then be allocated as necessary (I chose to add a paranoia buffer of 2, but
I expect the maximum depth will rarely be used).
2012-11-28 21:29:03 +09:00
Bill Currie
7c3ad46b48 Correct the endianess.
mips-linux is little endian (missed edit from the copy from ps3)
2012-11-28 19:15:38 +09:00
Bill Currie
1cd58b30f4 Fix the library dependencies for the servers.
It's so rarely I build without clients...
2012-11-27 13:18:23 +09:00
Bill Currie
62bac6e7b4 Add scripts for cross-compiling for mipsel-linux.
These are based on the ps3dev scripts, so native qfcc and pak are built
automatically.

Note that there may be a need to replace or even just nuke bison in the
toolchain as it is too old and can't build qfcc.
2012-11-27 13:18:23 +09:00
Bill Currie
67b796f851 Fix a silly error in bsp extents checking.
Found while hunting for rhinodemons.
2012-11-23 14:38:15 +09:00
Bill Currie
fe9fb41f93 Correct some very suspicious looking code.
While accessing short foo[2][4]; as foo[0][0..7] should work in theory, who
knows what gcc does with it when optimizing. I don't know if this will fix
johnnyonflame's bsp loading problem, but no point in having rhinodemonic
code hanging around.
2012-11-23 14:35:34 +09:00
Bill Currie
65024af8c4 Ignore some files.
The problem with building out-of-tree :P
2012-11-23 14:34:48 +09:00
Bill Currie
1d34da26f7 Add an option to dump frame files.
After running across a question about lists of animation frames and states,
I decided giving qfcc the ability to generate such lists might be a nice
distraction from the optimizer :) Works for both progs.src and separate
compilation. No frame file is generated if no macros have been created.
2012-11-21 20:50:45 +09:00
Bill Currie
d0c37bbc51 Change the int<->float conversion opcode string.
Using "=" was rather confusing, so changing it to "<CONV>" seems to be a
good idea. As the string is used only for selecting opcodes at compile
time, only qfcc is affected.
2012-11-16 14:47:54 +09:00
Bill Currie
fb82a96cc7 Better handling of progs.dat and line numbers.
Not enough testing :P
2012-11-15 15:04:51 +09:00
Bill Currie
d5c831b6da Add a little test case for accessing types.
Using ruamoko to access ruamoko type encodings is actually quite pleasant
:)
2012-11-15 13:40:11 +09:00
Bill Currie
ee8247ec61 Support using enums as array indices. 2012-11-15 13:39:23 +09:00
Bill Currie
f18a4d3c4a Support pointer - pointer. 2012-11-15 13:38:57 +09:00
Bill Currie
552142497e Support progs.dat when dumping type encodings.
Knock up a quick and dirty progs-to-qfo "converter" (strings and types
only) to re-use the qfo types dumper.
2012-11-15 11:58:13 +09:00
Bill Currie
9691b50f0f Make .type_encodings more useful.
Rather than just a pointer, it is now a struct with a pointer and size
indicating the extent of the type encodings block.
2012-11-15 11:57:16 +09:00
Bill Currie
74ac4ee142 Fix a misplaced line. 2012-11-15 11:00:51 +09:00
Bill Currie
206ab9a997 Whitespace. 2012-11-14 20:54:35 +09:00
Bill Currie
9a53531d3b Fix a braino in Object's -init.
I'd forgotten AutoreleasePool doesn't like receiving -retain when I did the
retainCount change, and thus Object's -init was a little too naive.
2012-11-14 20:45:29 +09:00
Bill Currie
39c1034afb Relocate the data in the type encodings space.
Because of the way it is used, the data in the type encodings space needs
to always be correct (ie, relocated), even for partially linked object
files.
2012-11-14 20:37:19 +09:00
Bill Currie
453ac11bc3 Correct some comments. 2012-11-14 17:13:14 +09:00
Bill Currie
2685d38059 More paranoia when dumping qfo type encodings. 2012-11-14 16:32:41 +09:00
Bill Currie
3b3e013d4a Do not demand a defined def is actually global.
Rather, only that it is neither external nor local. The idea was to catch
myself swapping the arguments to resolve_external_def, but for some reason
I decided type encoding defs would not be global (save game reasons?).
2012-11-14 15:50:55 +09:00
Bill Currie
acc188d62b Ressurect the builtin symbol type fixup.
I was a little overzealous when gutting process_type_space :P
2012-11-14 15:49:19 +09:00
Bill Currie
9d7b8a4cf2 Add optional arguments to the todo list.
Interesting alternative to overloaded functions.
2012-11-14 14:55:36 +09:00
Bill Currie
ef7678fcec Use DWARF debugging with recent gcc.
Oh, wow, I wish I'd known about it before. C macro evaluation in gdb!!!
*sob*
2012-11-14 14:51:23 +09:00
Bill Currie
33eb3f2418 A bit of pointer saftey in add_defs.
Directly accessing odef after can be dangerous (probably not here, but
hey), so use the defref instead.
2012-11-14 13:25:30 +09:00
Bill Currie
00c87434bf A touch of whitespace. 2012-11-14 13:25:03 +09:00
Bill Currie
281e203545 Make process_data_def use the correct def tables.
Fixes the bogus redefined errors when entity fields are used.

Also, rename extern_defs and defined_defs to extern_data_defs and
defined_data_defs (more consistent with the other tables).
2012-11-14 13:14:54 +09:00
Bill Currie
e05c12e16d Make linker_add_def take a pointer for the value.
While it looks like I might not use it for the type encodings, it should be
useful in the future.
2012-11-14 13:12:58 +09:00
Bill Currie
51236b0693 Fix the incorrect type space reloc offsets.
The problem was caused by add_relocs and process_loose_relocs adjusting the
reloc offset based on the reloc's space's base address. This is fine for
most relocs, but as relocs for the type space have already been adjusted by
process_type_space, those relocs must be left alone by add_relocs and
process_loose_relocs. As a bonus, the duplicate code has been refactored
into a separate function :)
2012-11-14 10:29:45 +09:00
Bill Currie
31739f4dbf Rewrite the type_space processing.
Now each encoding is copied across def by def using memcpy, with the
expectation that any references to other types will be handled via the
reloc system. Unfortunately, it seems there's an off-by-4 (hmm, suspicious
number...) in the reloc offsets, but I'll look into that after I get some
sleep.
2012-11-13 21:55:54 +09:00
Bill Currie
8625964634 Fix some careless inernal_error changes.
Back when I did the abort->internal_error change, I wasn't paying attention
and forgot I should use linker_internal_error in linker.c.
2012-11-13 21:51:16 +09:00
Bill Currie
f80a74228c Add (and use) alloc_data for work qfo data allocations.
defspace_alloc_loc can cause a realloc which will break the work qfo space
data pointers, so wrap it with alloc_data, which updates the appropriate
pointers and sizes.
2012-11-13 21:48:46 +09:00
Bill Currie
5b7b49b100 Add a QFO_TYPE macro to get a qfot_type_t pointer.
In the end, it wasn't used, but it could be handy in the future.
2012-11-13 21:45:54 +09:00
Bill Currie
d782622e74 Be more paranoid when dumping qfo type encodings. 2012-11-13 21:24:48 +09:00
Bill Currie
f002f3ad7a Escape strings for reloc dumps.
Line feeds messing up the output wasn't nice :P.
2012-11-13 21:14:51 +09:00
Bill Currie
1dd8f34190 Refactor process_def.
The field/data def handling has been moved into process_data_def and
process_field def. The code for handling external defs has been moved into
its own function (extern_def()),

In passing, rename add_space to add_data_space, since it is limited to
handling data spaces.
2012-11-13 13:16:45 +09:00
Bill Currie
ba6fb5802d Make add_defs take a function to process the defs.
For now, no other change has been made, but I'll be able to split up
process_def for data def vs field def processing and add a function for
processing type encoding defs.
2012-11-13 12:40:40 +09:00
Bill Currie
93b007b1f8 Take care of relocs when defining external defs.
For most of the cases, some relocs may have been lost, but they were
certainly lost for type encodings. Now that all seems to be fixed.
2012-11-12 16:14:09 +09:00
Bill Currie
eb5581c7bd Fix class type encoding.
First, the class def needed to be created before the class type, then the
def space indices had to be set early, otherwise the relocs wound up with
space 0 instead of the correct space.
2012-11-12 12:46:15 +09:00
Bill Currie
c96718493a A bit of a cleanup before fixing class type defs.
All internal structs now have "proper" names, and fit the naming convention
(eg, obj_module (like objective-c's types, but obj instead of objc). Some
redundant types got removed (holdovers from before proper struct tag
handling).

Also, it has proven to be unnecessary to build internal classes, so
make_class and make_class_struct are gone, too.
2012-11-12 11:12:33 +09:00
Bill Currie
dc22d06905 Fix an out-by-one in the definition of INT_MAX.
INT_MAX wound up being INT_MIN :/
2012-11-12 10:28:31 +09:00
Bill Currie
6ec5bb1884 Change the FIXME to a comment as to why nothing is done.
Of course, the relocation record still needs to be written (don't know why
it isn't), but that's next :)
2012-11-11 20:36:25 +09:00
Bill Currie
d13ce81b4f Ensure the type's encoding string is valid.
When encoding a type to a qfo file, the type's encoding string is written
and thus needs to be valid prior to actually doing the encoding. The
problem occurs mostly in self-referential structs (particularly, obj_class)
because the struct is being encoded prior to the pointer to the struct.
2012-11-11 20:22:48 +09:00
Bill Currie
8710977323 Rework transfer_type to avoid infinite recursion.
This is similar to the problem with infinite recursion when encoding types.
The problem is with structs with self-referential pointers (eg, struct foo
{struct foo *bar}). The solution is to copy the type data to a buffer and
mark the buffer as transfered before actually processing the type. Further
processing of the type is done via the buffer.
2012-11-11 20:20:07 +09:00
Bill Currie
edd381931e Create obj_object after obj_class.
obj_class is self-referential,but obj_object refers to obj_class. This gets
obj_class encoded properly.
2012-11-11 19:08:15 +09:00
Bill Currie
96110a0f54 Treat messages to id and Class separately.
As id and Class do not point to real objects as such, trying to get the
class from their types doesn't work, so instead send the message to a
"null" class that skips the method checks.
2012-11-11 17:39:12 +09:00
Bill Currie
ee28f3869c Fix the checking for assignments between id and Class.
With Class now being struct obj_class rather than an actual class or
object, checking for Class now needs to be explicit.
2012-11-11 17:24:33 +09:00
Bill Currie
694b268f53 Correct the type of id.
It should be struct obj_object * rather than Object *.
2012-11-11 17:22:57 +09:00