public static ByteSearch ( byte searchIn, byte searchBytes, int start ) : int | ||
searchIn | byte | |
searchBytes | byte | |
start | int | |
return | int |
public void DumpRaw(int offset, string savePath, int nextOffset = -1) { if (nextOffset == -1) { nextOffset = SearchForByte.ByteSearch(_tiMtexture, _stage, offset); } byte[] rawData = new byte[nextOffset - offset]; Buffer.BlockCopy(_stage, offset, rawData, 0, nextOffset - offset); File.WriteAllBytes(savePath, rawData); }
private void SearchObjects() { _tim = SearchForByte.ByteSearch(_stage, _tiMtexture); _index = 0x5d4 + 1000; _itemOffsets = new List <int>(); while (true) { _pass = SearchForByte.ByteSearch(_stage, _geom, _index); if (_pass == -1) { break; } _passOk = _pass; _index = _pass + 1; if (_passOk < _tim) { _verts = BitConverter.ToUInt16(_stage, _passOk + 4); if (_verts < 10000) { _absolutePolygon = _passOk + 6 + (_verts * 6); if (_absolutePolygon < _stage.Length) { _triangles = BitConverter.ToUInt16(_stage, _absolutePolygon + 4 + (_absolutePolygon % 4)); _quads = BitConverter.ToUInt16(_stage, _absolutePolygon + 6 + (_absolutePolygon % 4)); if (_triangles > 10000 || _quads > 10000 || _verts > 10000 || _verts == 0) { } else { Console.WriteLine($"BS: Found working geometry at: {_passOk}"); _itemOffsets.Add(_passOk); _index += _verts * 6 + _triangles * 20 + _quads * 24; } } } } else { break; } } }