private void button28_Click(object sender, EventArgs e) { m = new Mem("ePSXe"); uint levPtr = 0x80083a48; uint lev = m.ReadPSXUInt32(levPtr); uint size = m.ReadPSXUInt32(lev - 4); uint ptrMeshInfo = m.ReadPSXUInt32(lev - 4); byte[] meshinfodata = m.ReadArray(ptrMeshInfo, 8 * 4); MeshInfo mi; using (BinaryReaderEx br = new BinaryReaderEx(new MemoryStream(meshinfodata))) { mi = new MeshInfo(br); } ushort ind = m.ReadPSXUInt16(mi.ptrQuadBlockArray); textBox5.Text += ind.ToString("X8"); m.WritePSXUInt32((uint)(mi.ptrVertexArray + ind * 16 + 8), 0, textBox5); m.WritePSXUInt32((uint)(mi.ptrVertexArray + ind * 16 + 12), 0, textBox5); //m.WriteArray(lev, b); }
public void Write(Mem mem, string name, string value) { MemMapEntry entry = Entries.Find(x => x.Name == name); if (entry == null) { return; } uint absPtr = (uint)(BasePointer + entry.Offset); Console.WriteLine($"Writing {value} at {absPtr.ToString("X8")}"); switch (entry.Type) { case "uint": uint uintValue = UInt32.Parse(value); mem.WritePSXUInt32((uint)absPtr, uintValue, null); break; case "short": short shortValue = Int16.Parse(value); mem.WritePSXInt16(absPtr, shortValue, null); break; case "byte": byte byteValue = Byte.Parse(value); mem.WritePSXByte(absPtr, byteValue, null); break; default: Console.WriteLine("Unimplemented write type."); break; } }