using System.
Diagnostics;
using [Link];
using [Link];
using System;
using [Link];
using Memory;
namespace WinFormsApp2
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
KeyPreview = true;
}
private Keys bindKey = [Link];
private bool isBinding = false;
private bool isInjected = false;
private bool alreadyToggled = false;
private bool bindJustSet = false;
private List<long> savedAddresses = new List<long>();
private Mem memory = new Mem();
// Adicione esta declaração no escopo da classe
[DllImport("[Link]")]
private static extern short GetAsyncKeyState(Keys vKey);
private async void button1_Click(object sender, EventArgs e)
{
if (!isBinding)
{
isBinding = true;
[Link] = "Pressione uma tecla...";
[Link] = "Aguardando tecla...";
[Link]();
[Link]();
[Link] += BindKeyHandler;
return;
}
await ToggleInjection();
}
private async void BindKeyHandler(object sender, KeyEventArgs e)
{
if (isBinding)
{
bindKey = [Link];
isBinding = false;
bindJustSet = true;
// Botão mostra APENAS a tecla bindada
[Link] = $"Tecla: {bindKey}";
// Label mostra confirmação
[Link] = $"Tecla {bindKey} configurada!";
[Link] -= BindKeyHandler;
[Link] keyTimer = new
[Link]();
[Link] = 50;
[Link] += (s, args) => CheckKeyPress();
[Link]();
}
}
private async void CheckKeyPress()
{
if (bindJustSet)
{
if (!IsKeyDown(bindKey))
bindJustSet = false;
return;
}
if (bindKey != [Link] && IsKeyDown(bindKey) && !alreadyToggled)
{
alreadyToggled = true;
await ToggleInjection();
}
if (!IsKeyDown(bindKey))
alreadyToggled = false;
}
private async Task ToggleInjection()
{
const string searchPattern = "00 00 00 00 00 00 80 3f 00 00 00 00 00 00
00 00 00 00 80 bf 00 00 00 00 00 00 80 bf 00 00 00 00 00 00 00 00 00 00 80 3f 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 80 3f 00 00 00 00 00 00 00 00 00 00
80 bf 00 00 80 7f 00 00 80 7f 00 00 80 7f 00 00 80 ff"; // Seu padrão
const string injectBytes = "00 00 00 00 00 00 00 43 00 00 00 00 00 00
00 00 00 00 80 bf 00 00 00 00 00 00 80 bf 00 00 00 00 00 00 00 00 00 00 80 3f 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 80 3f 00 00 00 00 00 00 00 00 00 00
80 bf 00 00 80 7f 00 00 80 7f 00 00 80 7f 00 00 80 ff"; // Seu padrão
const string originalBytes = "00 00 00 00 00 00 80 3f 00 00 00 00 00 00
00 00 00 00 80 bf 00 00 00 00 00 00 80 bf 00 00 00 00 00 00 00 00 00 00 80 3f 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 80 3f 00 00 00 00 00 00 00 00 00 00
80 bf 00 00 80 7f 00 00 80 7f 00 00 80 7f 00 00 80 ff"; // Seu padrão
if (!isInjected)
{
if ([Link]("HD-Player").Length == 0)
{
[Link] = "Erro: Emulador fechado!";
return;
}
try
{
[Link]("HD-Player");
if ([Link] == 0)
{
[Link] = "Procurando padrão...";
var results = await [Link](searchPattern, writable:
true);
if (![Link]())
{
[Link] = "Erro: Padrão não encontrado!";
return;
}
savedAddresses = [Link]();
}
foreach (var addr in savedAddresses)
[Link]([Link]("X"), "bytes",
injectBytes);
isInjected = true;
[Link] = "Injetado!";
// Botão mantém "Tecla: [tecla]" sem (ON)
}
catch
{
[Link] = "Erro na injeção!";
}
}
else
{
foreach (var addr in savedAddresses)
[Link]([Link]("X"), "bytes", originalBytes);
isInjected = false;
[Link] = "Desinjetado!";
// Botão mantém "Tecla: [tecla]" sem (OFF)
}
}
private bool IsKeyDown(Keys key)
{
return (GetAsyncKeyState(key) & 0x8000) != 0;
}
private void label1_Click(object sender, EventArgs e)
{
}
}
}