rodecomp/Source/Contents/Schedule/CheckGDISchedule.cpp
ragnarok-clanker 2b755e795a Maintenance: [forced, user-approved] Family F6 (closes family F): delete the four headers left empty or orphaned by F1-F5. WindowDial
Batch #10239 by ragnarok-clanker: forced by an admin (0 lower score(s), 0 changed function(s)); checked with 494 compiled unit(s), including every includer of Source/UI/GameSettings/GameSettingsUI.h, Source/UI/RuneSystem/UIRuneSystemWnd.h, Source/UI/Window/UINewMakeCharWnd.h, Source/UI/Window/UIWindowMgr.h, Source/UI/Window/WindowDialogs.h, Source/Client/Mode/ModeTooltip.h, Source/Client/Mode/ModeCursor.h, Source/UI/Window/WindowRegistration.h.
Deletes: Source/UI/Window/WindowDialogs.h, Source/Client/Mode/ModeTooltip.h, Source/Client/Mode/ModeCursor.h, Source/UI/Window/WindowRegistration.h
2026-11-03 11:10:29 +00:00

62 lines
1.7 KiB
C++

#include "Contents/Schedule/CheckGDISchedule.h"
#include "Client/Mode/ModeMgr.h"
#include "Contents/Configuration/ServiceConfiguration.h"
#include "Contents/MessageTable.h"
#include "Contents/ShowRankingScheduler.h"
#include "Network/Connection/Connection.h"
#include "Network/Connection/ConnectionRuntime.h"
#include "UI/Window/UIWindowMgr.h"
#include <cstdlib>
#include <windows.h>
// GLOBAL: gl_24852
char* g_timeScheduler;
// OFFSET: 0x00BA7FE0
// FUNCTION: fn_19716
CCheckGDISchedule::CCheckGDISchedule(const std::uint64_t& timestamp, const std::int64_t& interval, int scheduleType)
: CSchedule(timestamp, interval, scheduleType, ++g_schedulerSerial, 4) {
}
// OFFSET: 0x00BA81B0
// FUNCTION: fn_19718
void CCheckGDISchedule::Process(const std::uint64_t& now) {
this->CSchedule::Process(now);
if (CheckConnectionRuntime()) {
HMODULE gdi32 = LoadLibraryA("gdi32.dll");
if (gdi32 != nullptr) {
FARPROC proc = GetProcAddress(gdi32, "TextOutW");
if (proc != reinterpret_cast<FARPROC>(TextOutW)) {
FreeLibrary(gdi32);
goto perform_check;
}
FreeLibrary(gdi32);
}
if (!IsDebuggerPresent()) {
return;
}
}
perform_check:
if (g_serviceType != 0) {
return;
}
const int roll = static_cast<int>((static_cast<double>(std::rand()) / 32767.0) * 5.0 + 1.0);
if (roll != 2 && roll != 4 && roll != 5) {
return;
}
g_timeScheduler[13] = 1;
if (roll == 2) {
g_windowMgr.Confirm(LookupMessage(857), 0, true, false, 0, "Message", 280, 120, 0);
} else if (roll == 4) {
g_windowMgr.Confirm(LookupMessage(800), 0, true, false, 0, "Message", 280, 120, 0);
}
GetRagConnection().Close();
g_modeMgr.Quit();
}