public Z64File ToFile(Z64Game game) { if (!Valid()) { return(new Z64File(null, -1, -1, -1, false)); } if (!Exist()) { return(Z64File.DeletedFile(VRomStart, RomStart, VRomEnd - VRomStart)); } int len = GetSize(); byte[] data = new byte[len]; Buffer.BlockCopy(game.Rom.RawRom, RomStart, data, 0, len); int romEnd = RomStart + data.Length; if (Compressed()) { data = Yaz0.Decompress(data); } return(new Z64File(data, VRomStart, RomStart, romEnd, Compressed())); }
public Z64Memory(Z64Game game) { _game = game; _blocks = new List <MemBlock>(); try { if (game.GetVrom("boot", out int vrom)) { _blocks.Add(new MemBlock(game.Rom.EntryPoint + 0x60, vrom)); } if (Z64Version.CodeInfos.ContainsKey(_game.Version) && Z64Version.CodeInfos[_game.Version].CodeVram.HasValue && game.GetVrom("code", out vrom)) { _blocks.Add(new MemBlock(Z64Version.CodeInfos[game.Version].CodeVram.Value, vrom)); } LoadOvls(); } catch (Exception ex) { throw new Z64MemoryException("Error while creating the memory map. Please check your config file (versions/*.json)"); } }