private void InternalRead(BinaryReader reader) { while (true) { BMDDialogToken token; byte b = reader.ReadByte(); if (b == 0x00) { break; } // Check if it is a command if ((b & 0xF0) == 0xF0) { int numParams = ((b & 0x0F) - 1) << 1; byte b2 = reader.ReadByte(); byte funcCategory = (byte)((b2 & 0xE0) >> 5); byte funcID = (byte)(b2 & 0x1F); token = new BMDFunctionToken(funcCategory, funcID, reader.ReadBytes(numParams)); } else { List<byte> textBytes = new List<byte>(); while (true) { if ((b & 0xF0) == 0xF0 || b == 0x00) { reader.BaseStream.Seek(-1, SeekOrigin.Current); break; } else if ((b & 0x80) == 0x80) // japanese extended encoding { textBytes.Add(b); textBytes.Add(reader.ReadByte()); } else { textBytes.Add(b); } b = reader.ReadByte(); } token = new BMDTextToken(textBytes.ToArray()); } _dialogTokens.Add(token); } }
private static string DecFuncVplay(BMDFunctionToken func) { return string.Format("vplay {0} {1} {2}", func.Parameters[0], func.Parameters[1], func.Parameters[6], func.Parameters[7]); }
private static string DecFuncBustup(BMDFunctionToken func) { return string.Format("bup {0} {1} {2}", func.Parameters[0]-1, func.Parameters[2]-1, func.Parameters[6]-1); }
private static string DecFuncPname(BMDFunctionToken func) { return "pname"; }
private static string DecFuncWait(BMDFunctionToken func) { return "wait"; }
private static string GetFuncString(BMDFunctionToken func) { /* DecompileFunc decFunc; if (!_msgFuncToDecDelegateP4.TryGetValue((uint)(func.FunctionCategory << 16 | func.FunctionID), out decFunc)) { return func.ToString(); } else { return decFunc(func); } */ return func.ToString(); }