/// <summary> /// Returns a tuple of keycodes to press corresponding to the correct sequence of moves . /// </summary> /// <returns>A Tuple </returns> public VirtualKeyCode[] ExtractSequence() { // Read the byte representation of the sequence from the game byte[] sequence = new byte[3]; sequence[0] = MemoryHelper.Read <byte>(MHWProcess, SequenceAddress); sequence[1] = MemoryHelper.Read <byte>(MHWProcess, SequenceAddress + 1); sequence[2] = MemoryHelper.Read <byte>(MHWProcess, SequenceAddress + 2); // return null if they are are all zero (indicates the minigame hasnt started) if (sequence.AllIdentical()) { if (sequence[0] == 0) { return(null); } else { throw new Exception("Error interpretting sequence [" + string.Join(", ", sequence.Select(x => x.ToString())) + "]"); } } // Capcom has likely done some manipulation so we need to do some twidling because the sequences aren't as straightforward as we'd like. // Kudos to https://github.com/Geobryn for figuring this out, if (sequence[0] == 2 && sequence[1] == 0 && sequence[2] == 1) { sequence[0] = 1; sequence[1] = 2; sequence[2] = 0; } else if (sequence[0] == 1 && sequence[1] == 2 && sequence[2] == 0) { sequence[0] = 2; sequence[1] = 0; sequence[2] = 1; } // Return the array of key code presses extracted from the bytes return(StaticHelpers.KeyCodeSequenceFromBytes(sequence)); }