#include "Initialization/Initialization.h"
#include "Backend/Steam/Steam.h"
#include "Backend/Injector/Injector.h"
#include <raylib.h>
#include "Menu/Menu.h"

int main(bool failed_to_find_pattern = false) {
	auto Init = Initialization::Get();
	auto MenuMgr = menu::Injector::Get();
	auto BackendInjector = injector::Get();

	if (Init->Init_Windows())
		return 1;

	if (failed_to_find_pattern)
		Init->SetFailedToFindPattern(failed_to_find_pattern);

	while (!RLWindowShouldClose() && !Init->ShouldClose() && !MenuMgr->GetInjectionStatus()) {
		Init->UpdateWindowDrag();
		Init->Renderer();
	}
	Init->Clear();

	// 等待注入线程完成（已在 DrawInjectorMenu 中由新线程启动）
	if (MenuMgr->GetInjectionStatus())
		BackendInjector->Wait();
}