OpenParsec / openparsec

GNU General Public License v2.0
51 stars 8 forks source link

Scrolling through ships in 64-bit release crashes #67

Closed uberlinuxguy closed 2 years ago

uberlinuxguy commented 2 years ago

Scrolling through the ships in the 64 bit release via the menu option crashes

(gdb) bt
#0  0x00007ffff79fa885 in  () at /lib/x86_64-linux-gnu/libc.so.6
#1  0x0000555555594699 in CLIP_VolumeGenObject(GenObject*, Plane3*, unsigned int) (clipobj=0x55555634eb20, volume=0x5555557983e0 <Object_ViewVolume>, cullmask=63)
    at ../../../../src/libparsec/utl_clpo.cpp:1077
#2  0x000055555567c644 in RO_ReCalcAndRenderSubObject(GenObject*, float const (*) [4]) (objectp=0x55555634eb20, objtoview=0x555555706e64 <_DestXmatrx+4>) at ../../../../src/parsec/ro_obj.cpp:956
#3  0x000055555567c842 in R_ReCalcAndRenderObject(GenObject*, float const (*) [4]) (objectp=0x55555634eb20, camera=0x555555765600 <SpacecraftCamera>) at ../../../../src/parsec/ro_obj.cpp:1033
#4  0x0000555555646453 in DrawSpacecraft() () at ../../../../src/parsec/m_viewer.cpp:641
#5  0x0000555555646f13 in DrawSpacecraftViewer() () at ../../../../src/parsec/m_viewer.cpp:1035
#6  0x0000555555641906 in DrawMenuItems() () at ../../../../src/parsec/m_main.cpp:821
#7  0x000055555564192f in DrawFloatingMenu() () at ../../../../src/parsec/m_main.cpp:849
#8  0x0000555555603a5d in GameLoop() () at ../../../../src/parsec/g_gameloop.cpp:1238
#9  0x0000555555685002 in SLm_StartUpGame() () at ../../../../src/parsec/sl_main.cpp:227
#10 0x0000555555685248 in main(int, char**) (argc=1, argv=0x7fffffffdfd8) at ../../../../src/parsec/sl_main.cpp:401
CrazySpence commented 2 years ago

Confirmed crashes here: memcpy( clp_vtxlist, vtxlist, clipobj->NumVerts * sizeof( Vertex3 ) );

Easily reproduce-able

uberlinuxguy commented 2 years ago

That crashes because of this:

VtxAnimMakeCurrent (gobj=0x5555563535c0, animid=0) at ../../../../src/parsec/e_vtxani.cpp:73

Look at the baseinfo array.... and weep. They are loading the whole GenObject into an array of dword sized elements. Nope. Won't work in a 64bit env.... That's going to need fixing. It only crashes on one ship because it's the only ship with an animation moving around it.

There may be other things that crash the game because of this.

@tribad You may be interested in this assessment if you get to look at it.

I don't have cycles to fix and test this tonight, it's already getting late.

uberlinuxguy commented 2 years ago

TLDR: Animations are broken. The code contains dword size assumptions for pointers.

basically, that file: src/parsec/e_vtxani.cpp needs pointers/dword reference fixed. This will also probably relate to VtxAnimState in src/libparsec/includes/od_struct.h and ANYTHING that calls it.

uberlinuxguy commented 2 years ago

If no one gets to it, I'll grab this ticket and take a whack at it in the next day or so.

tribad commented 2 years ago

I will check that in my fork. Ok. Looks like the whole animation stuff needs a rework. Starting!

tribad commented 2 years ago

Done it!

slime73 commented 2 years ago

Fixed via #73