public void DispText(string Numbers) { //stop text from displaying vam.WriteByteArray((IntPtr)(TimerOffset - 0x80000000 + EmuOffset), new byte[] { 0xFF, 0xFF, 0xFF, 0xFF }); byte NewLineChar = Encoding.ASCII.GetBytes("*")[0]; char[] TextToWrite = Numbers.ToCharArray(); byte[] Write = Encoding.ASCII.GetBytes(TextToWrite); //big enough buffer, text shouldn't be longer than 101 anyways byte[] WriteArr = new byte[1024]; Array.Copy(Write, 0, WriteArr, 0, Write.Length); byte[] Empty = new byte[100]; //clear out text buffers vam.WriteByteArray((IntPtr)(StringBuffer - 0x80000000 + EmuOffset), Empty); vam.WriteByteArray((IntPtr)(StringBufferSec - 0x80000000 + EmuOffset), Empty); for (int i = 4; i < WriteArr.Length; i += 4) { //reverse 4 bytes byte[] Temp = new byte[4]; Temp[3] = WriteArr[i - 4]; Temp[2] = WriteArr[i - 3]; Temp[1] = WriteArr[i - 2]; Temp[0] = WriteArr[i - 1]; //replace "*" with \n aka newline if (Temp.Contains(NewLineChar)) { for (int j = 0; j < 4; j++) { if (Temp[j] == NewLineChar) { Temp[j] = 0x0A; } } } //if there's nothing to write if (Temp[0] == 0 && Temp[3] == 0 && Temp[2] == 0 && Temp[1] == 0) { break; } else { //write our flipped array with \n in it vam.WriteByteArray((IntPtr)(StringBuffer - 0x80000000 + EmuOffset + i - 4), Temp); } } //this is no joke the hackiest solution ever. //only reason I had to do this in the first place is due to the second buffer not being 4 byte alligned! //same setup as above with on exception for first run, to make it "byte alligned" int Index = 0; while (Index < WriteArr.Length) { if (Index != 0) { byte[] Temp = new byte[4]; Temp[3] = WriteArr[Index - 4]; Temp[2] = WriteArr[Index - 3]; Temp[1] = WriteArr[Index - 2]; Temp[0] = WriteArr[Index - 1]; if (Temp.Contains(NewLineChar)) { for (int j = 0; j < 4; j++) { if (Temp[j] == NewLineChar) { Temp[j] = 0x0A; } } } if (Temp[0] == 0 && Temp[3] == 0 && Temp[2] == 0 && Temp[1] == 0) { break; } else { vam.WriteByteArray((IntPtr)(StringBufferSec - 0x80000000 + EmuOffset + Index - 1), Temp); } Index += 4; } else { byte[] Temp = new byte[4]; Temp[0] = WriteArr[Index]; Temp[3] = 0; Temp[2] = 0; Temp[1] = 0; vam.WriteByteArray((IntPtr)(StringBufferSec - 0x80000000 + EmuOffset + Index), Temp); Index += 5; } } //vam.WriteByteArray((IntPtr)(StringBufferSec - 0x80000000 + EmuOffset - 1), Output.ToArray()); vam.WriteByteArray((IntPtr)(TimerOffset - 0x80000000 + EmuOffset), new byte[] { 0xC0, 0x03, 0x00, 0x00 }); }