0

I'm trying to learn how to read values from Cemu emulator (game Zelda-Breath of the Wild). I'm using memory.dll but i dont know how to read and write its 4 byte big endian values. I can read in diferent formats but not this type. Please help. Some of my code thus far:

 public partial class Form1 : Form
    {
        public Mem m = new Mem();
        public Form1()
        {
            InitializeComponent();
        }

        bool ProcOpen = false;
        
        public string myHex;

        private void button1_Click(object sender, EventArgs e)
        {
            BigInteger number1 = BigInteger.Parse(textBox4.Text, NumberStyles.HexNumber);            
            BigInteger number2 = BigInteger.Parse("3F8CB488", NumberStyles.HexNumber);
            BigInteger sum = BigInteger.Add(number1, number2);
            myHex = sum.ToString("X");
            textBox1.Text = Convert.ToString(m.ReadInt(myHex));       

        }

       
        private void button2_Click(object sender, EventArgs e)
        {            
            m.WriteMemory(myHex, "Float", textBox2.Text);           
        }

    }
}
  • 1
    Hello, please see this: http://idownvotedbecau.se/imageofcode and [Why not upload images of code/errors when asking a question?](https://meta.stackoverflow.com/a/285557/479251) – Pac0 Dec 26 '20 at 10:32
  • You are probably better served by modifying the source code. In the end it is two source files (https://github.com/erfg12/memory.dll/tree/master/Memory). As the library is written, the method you are using (`WriteMemory`) isn't built to support endianness switching. Or you could convert directly your float to `byte[]`, reverse it and use directly the `WriteBytes` method. If you take a look at `WriteMemory` it is quite clear how it works. – xanatos Dec 26 '20 at 10:54
  • See [IPAddress.HostToNetworkOrder](https://learn.microsoft.com/en-us/dotnet/api/system.net.ipaddress.hosttonetworkorder?view=net-5.0), [IPAddress.NetworkToHostOrder](https://learn.microsoft.com/en-us/dotnet/api/system.net.ipaddress.networktohostorder?view=net-5.0). Read data as is. Then convert. – Alexander Petrov Dec 26 '20 at 11:05
  • Sorry Pac0...your right...i now placed code instead of picture. – Nelson Furtado Dec 26 '20 at 17:31
  • I'm still lost....in line "textBox1.Text = Convert.ToString(m.ReadInt(myHex));" i use m.ReadInt ...... but i want to read the 4Byte Big Endian numer....how could i re-write to get the right value? – Nelson Furtado Dec 26 '20 at 17:46
  • @NelsonFurtado https://stackoverflow.com/a/19560541/613130 – xanatos Dec 26 '20 at 19:02

0 Answers0