From 7cc02e4417b541f8c9053adecc29adbbba4be044 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miloslav=20=C4=8C=C3=AD=C5=BE?= Date: Wed, 5 Aug 2020 20:44:33 +0200 Subject: [PATCH] Add malware check --- main.c | 11 +++++++++-- platform_sdl.h | 4 ++++ settings.h | 7 +++++++ texts.h | 6 ++++++ 4 files changed, 26 insertions(+), 2 deletions(-) diff --git a/main.c b/main.c index b6503ce..73b2e70 100755 --- a/main.c +++ b/main.c @@ -3686,6 +3686,8 @@ void SFG_drawMenu() uint8_t i = 0; + uint8_t blink = (SFG_game.frame / SFG_BLINK_PERIOD_FRAMES) % 2; + while (1) { uint8_t item = SFG_getMenuItem(i); @@ -3714,8 +3716,7 @@ void SFG_drawMenu() SFG_drawText(text,drawX,y,SFG_FONT_SIZE_MEDIUM,textColor,0,0); if ((item == SFG_MENU_ITEM_PLAY || item == SFG_MENU_ITEM_SOUND) && - ((i != SFG_game.selectedMenuItem) || - ((SFG_game.frame / SFG_BLINK_PERIOD_FRAMES) % 2))) + ((i != SFG_game.selectedMenuItem) || blink)) { //uint8_t blink = (SFG_game.frame / SFG_BLINK_PERIOD_FRAMES) % 2; @@ -3744,6 +3745,12 @@ void SFG_drawMenu() SFG_drawText("0.7 CC0",SFG_HUD_MARGIN,SFG_GAME_RESOLUTION_Y - SFG_HUD_MARGIN - SFG_FONT_SIZE_SMALL * SFG_FONT_CHARACTER_SIZE,SFG_FONT_SIZE_SMALL,4,0,0); + #if SFG_OS_IS_MALWARE + if (blink) + SFG_drawText(SFG_MALWARE_WARNING,SFG_HUD_MARGIN,SFG_HUD_MARGIN, + SFG_FONT_SIZE_MEDIUM,95,0,0); + #endif + #undef MAX_ITEMS #undef BACKGROUND_SCALE #undef SCROLL_PIXELS_PER_FRAME diff --git a/platform_sdl.h b/platform_sdl.h index 5e40c06..99db251 100644 --- a/platform_sdl.h +++ b/platform_sdl.h @@ -20,6 +20,10 @@ #ifndef _SFG_PLATFORM_H #define _SFG_PLATFORM_H +#if defined(_WIN32) || defined(WIN32) || defined(__WIN32__) || defined(__NT__) || defined(__APPLE__) + #define SFG_OS_IS_MALWARE 1 +#endif + #include "settings.h" #include diff --git a/settings.h b/settings.h index e0b8d65..942ad3a 100644 --- a/settings.h +++ b/settings.h @@ -205,6 +205,13 @@ */ #define SFG_MONSTER_AIM_RANDOMNESS 4 +/** + Boolean value indicating whether current OS is malware. +*/ +#ifndef SFG_OS_IS_MALWARE + #define SFG_OS_IS_MALWARE 0 +#endif + //------ developer/debug settings ------ /** diff --git a/texts.h b/texts.h index aaa140d..05e2b8b 100644 --- a/texts.h +++ b/texts.h @@ -31,4 +31,10 @@ SFG_PROGRAM_MEMORY char *SFG_introText = "only destroy, not suffer - it is not wrong to end them! You grab your gear " "and run towards Macrochip HQ."; +#define SFG_MALWARE_WARNING "" + +#if SFG_OS_IS_MALWARE + #define SFG_MALWARE_WARNING "MALWARE OS DETECTED" +#endif + #endif // gaurd