Raised This Month: $12 Target: $400
 3% 

CStudioHdr::GetSharedPoseParameter Fix


Post New Thread Reply   
 
Thread Tools Display Modes
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, 277 views)

Last edited by Benoist3012; 08-10-2018 at 17:24.
Benoist3012 is offline
asherkin
SourceMod Developer
Join Date: Aug 2009
Location: OnGameFrame()
Old 08-08-2018 , 12:48   Re: CStudioHdr::GetSharedPoseParameter Fix
Reply With Quote #2

It probably makes more sense to just release this in the plugin thread, this isn't really an "extension".
__________________
asherkin is offline
Benoist3012
Veteran Member
Join Date: Mar 2014
Location: CWave::ForceFinish()
Old 08-09-2018 , 02:22   Re: CStudioHdr::GetSharedPoseParameter Fix
Reply With Quote #3

Yeah I wasn't sure if it would have been fine well then I can still move it.
__________________
Benoist3012 is offline
Dagothur
Member
Join Date: Dec 2014
Old 09-07-2018 , 18:25   Re: CStudioHdr::GetSharedPoseParameter Fix
Reply With Quote #4

Does this extension solve this crash? https://forums.alliedmods.net/showthread.php?t=302264
Dagothur is offline
asherkin
SourceMod Developer
Join Date: Aug 2009
Location: OnGameFrame()
Old 09-07-2018 , 18:48   Re: CStudioHdr::GetSharedPoseParameter Fix
Reply With Quote #5

Yes.
__________________
asherkin is offline
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 14:57.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode