#pragma once
#include "Utils/MemoryUtils.h"

#include "SDK/ActorRenderDispatcher.h"
#include "SDK/Actor.h"

namespace Hooks {
	class Actors {
	private:
		typedef void* (__thiscall* actor_renderdispatcher_)(ActorRenderDispatcher*, void*, Actor*, glm::vec3, glm::vec3, glm::vec2, bool);
		inline static actor_renderdispatcher_ actor_renderdispatcher;
		
		static auto callback_actorrenderdispatcher(ActorRenderDispatcher*, void*, Actor*, glm::vec3, glm::vec3, glm::vec2, bool) -> void*;
	public:
		inline static int state = -1;
		static void Init() {
			std::thread([&] {
				void* pattern_actorrenderdispatcher = Utils::Memory::FindPattern(_("48 89 5C 24 20 55 56 57 41 54 41 55 41 56 41 57 48 8D 6C 24 F1 48 81 EC D0"));
				state = Utils::Memory::CreateHook(pattern_actorrenderdispatcher, (void*)&callback_actorrenderdispatcher, &actor_renderdispatcher);
				
				if (state == 0)
					MessageBoxA(0, _("The program was terminated due to an error.\nError code: 1-8"), _("Valkyrie"), MB_ICONERROR);
				else
					std::cout << _("Test 1-8... OK\n");
				}).detach();
		}
	};
}
