fix: DxLib.EncryptedStream.ReadByte implementation

This commit is contained in:
Crsky
2026-06-11 20:02:25 +08:00
parent 2f752b84ac
commit caa46020a3

View File

@@ -563,10 +563,11 @@ namespace GameRes.Formats.DxLib
public override int ReadByte () public override int ReadByte ()
{ {
long pos = Position;
int b = BaseStream.ReadByte(); int b = BaseStream.ReadByte();
if (m_key.Length !=0) if (m_key.Length !=0)
{ {
int key_pos = (int)((m_base_pos + Position) % m_key.Length); int key_pos = (int)((m_base_pos + pos) % m_key.Length);
if (-1 != b) if (-1 != b)
{ {
b ^= m_key[key_pos]; b ^= m_key[key_pos];