JACoders / OpenJK

Community effort to maintain and improve Jedi Academy (SP & MP) + Jedi Outcast (SP only) released by Raven Software
GNU General Public License v2.0
2.03k stars 615 forks source link

Load savegame crash when removing weapon mod #434

Open Razish opened 11 years ago

Razish commented 11 years ago

Consistently crashing on a particular savegame, which was made yesterday whilst playing with Ashura's E-11 replacement When I remove the PK3, I can no longer load any saves made when that model was being used. This probably happens with every model replacement? Or perhaps it's because there are enemies with that weapon equipped. Download savegame

>   rdsp-vanilla_x86.dll!CBoneCache::EvalLow(int index) Line 135    C++
    rdsp-vanilla_x86.dll!CBoneCache::EvalLow(int index) Line 142    C++
    rdsp-vanilla_x86.dll!CBoneCache::Eval(int index) Line 346   C++
    rdsp-vanilla_x86.dll!G2_ProcessSurfaceBolt2(CBoneCache & boneCache, const mdxmSurface_t * surface, int boltNum, std::vector<boltInfo_t,std::allocator<boltInfo_t> > & boltList, const surfaceInfo_t * surfInfo, const model_s * mod, mdxaBone_t & retMatrix) Line 2081  C++
    rdsp-vanilla_x86.dll!G2_GetBoltMatrixLow(CGhoul2Info & ghoul2, int boltNum, const float * scale, mdxaBone_t & retMatrix) Line 2179  C++
    rdsp-vanilla_x86.dll!G2API_GetBoltMatrix(CGhoul2Info_v & ghoul2, const int modelIndex, const int boltIndex, mdxaBone_t * matrix, const float * angles, const float * position, const int AframeNum, int * modelList, const float * scale) Line 1574 C++
    jagamex86.dll!CG_Player(centity_s * cent) Line 7716 C++

        index   9615849 int
        mCurrentTouch   5   int
+       mFinalBones 0x11c4e09c {touchRender=0 boneMatrix={matrix=0x11c4e0a0 {0x11c4e0a0 {0.000000000, 0.000000000, 0.000000000, ...}, ...} } ...}   CTransformBone *
+       mFinalBones[index]  {touchRender=??? boneMatrix={matrix=0x3428733c {0x3428733c {???, ???, ???, ???}, 0x3428734c {???, ???, ...}, ...} } ...}    CTransformBone
        mNumBones   1   int
+       this    0x0aee7bf0 {frameSize=0 header=0x0af35aa4 {ident=1095191602 version=6 name=0x0af35aac "*default" ...} ...}  CBoneCache *

Renamed the save from auto.sav to t2_trip_crash.sav and got a very similar crash:

>   rdsp-vanilla_x86.dll!CBoneCache::Eval(int index) Line 342   C++
    rdsp-vanilla_x86.dll!G2_ProcessSurfaceBolt2(CBoneCache & boneCache, const mdxmSurface_t * surface, int boltNum, std::vector<boltInfo_t,std::allocator<boltInfo_t> > & boltList, const surfaceInfo_t * surfInfo, const model_s * mod, mdxaBone_t & retMatrix) Line 2081  C++
    rdsp-vanilla_x86.dll!G2_GetBoltMatrixLow(CGhoul2Info & ghoul2, int boltNum, const float * scale, mdxaBone_t & retMatrix) Line 2179  C++
    rdsp-vanilla_x86.dll!G2API_GetBoltMatrix(CGhoul2Info_v & ghoul2, const int modelIndex, const int boltIndex, mdxaBone_t * matrix, const float * angles, const float * position, const int AframeNum, int * modelList, const float * scale) Line 1574 C++
    jagamex86.dll!CG_Player(centity_s * cent) Line 7716 C++

        index   24  int
        mCurrentTouch   5   int
+       mFinalBones 0x1119ef84 {touchRender=0 boneMatrix={matrix=0x1119ef88 {0x1119ef88 {0.000000000, 0.000000000, 0.000000000, ...}, ...} } ...}   CTransformBone *
+       mFinalBones[index]  {touchRender=??? boneMatrix={matrix=0x1119f528 {0x1119f528 {???, ???, ???, ???}, 0x1119f538 {???, ???, ...}, ...} } ...}    CTransformBone
        mNumBones   1   int
+       this    0x0aedf2f0 {frameSize=0 header=0x0af301b4 {ident=1095191602 version=6 name=0x0af301bc "*default" ...} ...}  CBoneCache *

In both cases, the offending code is

        if (mFinalBones[index].touch!=mCurrentTouch)

where index is some bogus value (24, 9615849) and mFinalBones is an array of size mNumBones (1)

xycaleth commented 9 years ago

Seems to be due to the weapon mod having more surfaces than the weapon it replaced. When you removed the weapon mod, it tried to access the surface which was previously there, in the regular model, and then badness ensues.

Razish commented 9 years ago

Should we find a way to add a check for the same g2 data, and flush the model if it's different? =\

xycaleth commented 9 years ago

I'm considering removing this from milestone 1. How often do people change out weapon mods and then continue using a save game?

redsaurus commented 9 years ago

This might not be a problem with the start of level autosaves - if you can still use at least those saves you're unlikely to lose too much progress.