View Single Post
Author Message
Benoist3012
Veteran Member
Join Date: Mar 2014
Location: CWave::ForceFinish()
Old 08-08-2018 , 11:16   CStudioHdr::GetSharedPoseParameter Fix
Reply With Quote #1

Fixes CStudioHdr::GetSharedPoseParameter to avoid out of bound array crash.
Before:
Code:
int CStudioHdr::GetSharedPoseParameter( int iSequence, int iLocalPose ) const {     if (m_pVModel == NULL)     {         return iLocalPose;     }     if (iLocalPose == -1)         return iLocalPose;     Assert( m_pVModel );     int group = m_pVModel->m_seq[iSequence].group;     virtualgroup_t *pGroup = m_pVModel->m_group.IsValidIndex( group ) ? &m_pVModel->m_group[ group ] : NULL;     return pGroup ? pGroup->masterPose[iLocalPose] : iLocalPose; }

After:
Code:
int CStudioHdr::GetSharedPoseParameter(int iSequence, int iLocalPose) {     if (m_pVModel == NULL)     {         return iLocalPose;     }     if (iLocalPose == -1)         return iLocalPose;         if (!m_pVModel->m_seq.IsValidIndex(iSequence))         return iLocalPose;         int group = m_pVModel->m_seq[iSequence].group;     virtualgroup_t *pGroup = m_pVModel->m_group.IsValidIndex( group ) ? &m_pVModel->m_group[ group ] : NULL;     return (pGroup && pGroup->masterPose.IsValidIndex( iLocalPose )) ? pGroup->masterPose[iLocalPose] : iLocalPose; }

Remember this is a fix for unproperly setup models and shouldn't be used as a permanent fix. If you are able to contact the model maker then do so.

Downloads:
Linux
Windows
GameData

Don't forget to create poseparameter_fix.autoload 0 byte file inside your extensions folder, otherwise the extension will not load and you will still crash! Or download the zip attached to this post

Source:
Github
Attached Files
File Type: zip poseparam_fix.zip (374.9 KB, 283 views)

Last edited by Benoist3012; 08-10-2018 at 17:24.
Benoist3012 is offline