66#include <windows.h>
77#include <psapi.h>
88#include <vector>
9+ #include <tlhelp32.h>
910
1011constexpr COLORREF kTargetColor = RGB(43, 137, 254);
1112constexpr DWORD kHotkeyId = 1;
@@ -217,6 +218,34 @@ void HandleCommands() {
217218 LogMessage("\nbye!");
218219}
219220
221+ bool isRobloxOn() {
222+ HANDLE hProcessSnap;
223+ PROCESSENTRY32 pe32;
224+
225+ // Take a snapshot of all processes in the system.
226+ hProcessSnap = CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS, 0);
227+ if (hProcessSnap == INVALID_HANDLE_VALUE) {
228+ return false;
229+ }
230+
231+ pe32.dwSize = sizeof(PROCESSENTRY32);
232+
233+ if (!Process32First(hProcessSnap, &pe32)) {
234+ CloseHandle(hProcessSnap); // clean the snapshot object
235+ return false;
236+ }
237+
238+ do {
239+ if (strcmp(pe32.szExeFile, "RobloxPlayerBeta.exe") == 0) {
240+ CloseHandle(hProcessSnap);
241+ return true;
242+ }
243+ } while (Process32Next(hProcessSnap, &pe32));
244+
245+ CloseHandle(hProcessSnap);
246+ return false;
247+ }
248+
220249int main() {
221250 SetConsoleTitle(TEXT("auto-edger"));
222251 SetPriorityClass(GetCurrentProcess(), HIGH_PRIORITY_CLASS);
@@ -229,6 +258,14 @@ int main() {
229258 int screenHeight = GetSystemMetrics(SM_CYSCREEN);
230259 AccountForDifferentRes(screenWidth, screenHeight);
231260
261+ if (!isRobloxOn()) {
262+ LogMessage("warning: roblox is not running\nturn on roblox, dummy");
263+
264+ while (!isRobloxOn()) {
265+ std::this_thread::sleep_for(std::chrono::milliseconds(1000));
266+ }
267+ }
268+
232269 if (!RegisterHotKey(nullptr, kHotkeyId, 0, VK_F8)) {
233270 LogMessage("failed to register hotkey for f8. use 'autoedge' command to toggle");
234271 } else {
0 commit comments