mirror of
https://github.com/crskycode/GARbro.git
synced 2024-11-27 07:34:00 +08:00
(NemesisDecodeContext): replaced asserts with exceptions.
This commit is contained in:
parent
95a0d8c9bf
commit
34209251c4
@ -123,7 +123,8 @@ namespace GameRes.Formats.Entis
|
||||
{
|
||||
break;
|
||||
}
|
||||
Debug.Assert ((uint)pModel.SubModel[iLast].Symbol < pBase.dwWorkUsed);
|
||||
if ((uint)pModel.SubModel[iLast].Symbol >= pBase.dwWorkUsed)
|
||||
throw new InvalidFormatException ("Invalid Nemesis encoding sequence");
|
||||
pModel = pBase.ptrProbIndex[pModel.SubModel[iLast].Symbol];
|
||||
}
|
||||
int iSym = DecodeERISACodeIndex (pModel);
|
||||
@ -192,7 +193,8 @@ namespace GameRes.Formats.Entis
|
||||
else
|
||||
{
|
||||
m_nNemesisNext = (int)phrase.index[(phrase.first - nPhraseIndex) & Nemesis.IndexMask];
|
||||
Debug.Assert (m_pNemesisBuf[m_nNemesisNext] == bytLastSymbol);
|
||||
if (m_pNemesisBuf[m_nNemesisNext] != bytLastSymbol)
|
||||
throw new InvalidFormatException ("Invalid Nemesis encoding sequence");
|
||||
m_nNemesisNext = (m_nNemesisNext + 1) & Nemesis.BufMask;
|
||||
}
|
||||
continue;
|
||||
@ -213,7 +215,8 @@ namespace GameRes.Formats.Entis
|
||||
if ((pBase.dwWorkUsed < ErisaProbBase.SlotMax) && (iDeg < 4))
|
||||
{
|
||||
int iSymbol = ((byte)nSymbol) >> ErisaProbBase.m_nShiftCount[iDeg];
|
||||
Debug.Assert (iSymbol < ErisaProbModel.SubSortMax);
|
||||
if (iSymbol >= ErisaProbModel.SubSortMax)
|
||||
throw new InvalidFormatException ("Invalid Nemesis encoding sequence");
|
||||
if (++pModel.SubModel[iSymbol].Occured >= ErisaProbBase.m_nNewProbLimit[iDeg])
|
||||
{
|
||||
int i;
|
||||
@ -227,7 +230,8 @@ namespace GameRes.Formats.Entis
|
||||
{
|
||||
break;
|
||||
}
|
||||
Debug.Assert ((uint)pModel.SubModel[iSymbol].Symbol < pBase.dwWorkUsed);
|
||||
if ((uint)pModel.SubModel[iSymbol].Symbol >= pBase.dwWorkUsed)
|
||||
throw new InvalidFormatException ("Invalid Nemesis encoding sequence");
|
||||
pModel = pBase.ptrProbIndex[pModel.SubModel[iSymbol].Symbol];
|
||||
}
|
||||
if ((i <= iDeg) && (pModel.SubModel[iSymbol].Symbol < 0))
|
||||
|
Loading…
Reference in New Issue
Block a user