Please help with synchronization mutexes in sample hook EndScene for D3
Code:
int j = 0;
while (true && j<=5)
{
/* Мы дождались конца отрисовки кадра и вызова Present в игре */
if (eventPresentInvoked.WaitOne(_executorTimeout))
{
//This code works
//Clear();
//AppendLine("push 0");
//AppendLine("push {0}", memCaption.BaseAddress);
//AppendLine("push {0}", memText.BaseAddress);
//AppendLine("push 0");
//AppendLine("call {0}", _memory["user32.dll"]["MessageBoxW"].BaseAddress);
//AppendLine("retn");
//_callee.Write(_callee.BaseAddress + 4);
//_memory.Assembly.Inject(_asm.ToString(), _callee.BaseAddress + 4);
//Console.WriteLine("Кадр");
//This code does not work as you want. Need to operate at the end of each frame.
var player = ActorCommonDataHelper.GetLocalAcd();
var hz = ActorHelper.GetLocalActor();
var hp = player.x188_Hitpoints;
Console.WriteLine(hp);
/* Говорим нашему исполнителю что мы впихнули код и он может его выполнить */
eventInjectedCode.Set();
eventPresentInvoked.WaitOne(_executorTimeout);
j++;
}
else
{
Console.WriteLine("Превышен таймаут завершения отрисовки кадра ({0} сек)!", _executorTimeout);
}
}
Source Code
SampleHookD3.rar