Add malware check

This commit is contained in:
Miloslav Číž 2020-08-05 20:44:33 +02:00
parent 5ecdd195cd
commit 7cc02e4417
4 changed files with 26 additions and 2 deletions

11
main.c
View File

@ -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

View File

@ -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 <stdio.h>

View File

@ -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 ------
/**

View File

@ -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