https://github.com/CacoFFF/XC-UT99/comm ... c3fa81cb5a
Build will be available after some private tests are done.
Chose GCC 5.xxas the target compiler and boy that brought a few problems in.
======================
As some may know, UT was compiled using GCC 2.95 where c++ was not exactly an official feature and the amount of incompabilities and inconveniences go beyond the naming conventions.
- In newer GCC virtual destructors appear to be laid out according to Itanium C++ ABI, you get two destructor entries in the vtable, one for uninitialization and another for deletion.
UT's vtables only have one destructor in the vtable, which performs both tasks.
So in order to make the code generated by the new compiler compatible with the old one I had to remove the destructor function and add a dummy 'virtual void SimulatedDestroy()' which then manually did the destruction.
Code: Select all
#ifdef __GNUC__
//GCC 2.95 uses a single destructor entry (instead of 2)
virtual void SimulatedDestructor() = 0;
#else
virtual ~UObject() {};
#endif
In order to make UT able to call functions from the new grid, and make the grid call functions from UT objects (brush, actor) the new compiler had to generate it's vtables (and function calls) using a similar layout as with the old compiler.
This was solved by adding two dummy functions at the beginning of all classes, the method used was to subclass all UT compatible structs from the following 'GNUFix' class.
Code: Select all
class GNUFix
{
#ifdef __GNUC__
virtual void vPad1() {};
virtual void vPad2() {};
#endif
};
This means that all entry points into CollisionGrid.so (Tick, AddActor, RemoveActor, ActorLineCheck, ActorPointCheck, ActorRadiusCheck, ActorEncroachmentCheck) needed an alignment override so that the packed SSE instructions wouldn't crash the game.
Code: Select all
#define GCC_STACK_ALIGN __attribute__((force_align_arg_pointer))
...
GCC_STACK_ALIGN void FCollisionGrid::AddActor( AActor* Actor)
{
Grid->InsertActor( Actor);
}
MinGW still cannot produce working builds, but Visual Studio 2015 is doing a job more awesome than I ever expected thanks to the library/code tweaks to reduce the DLL size... with a little exception, after updating VS2015 the compiler thinks member function pointers should have a size of 8 bytes, instead of 4 bytes on x86 targets, which is completely wrong and forced me to rewrite some of the assembly code.
With this said I'll be able to look into the replication bug on pawns sooner than expected.