From d5a16ebba971818efbbe1b83e193de0332aa7161 Mon Sep 17 00:00:00 2001 From: svenhoefer Date: Wed, 31 Mar 2021 22:15:28 +0200 Subject: [PATCH] - fix scart_osd_fix Conflicts: src/gui/osd_setup.cpp src/system/setting_helpers.cpp Signed-off-by: Thilo Graf --- src/gui/osd_setup.cpp | 12 +++--- src/system/setting_helpers.cpp | 72 ++++++++++++++++++++++++++++++++++ src/system/setting_helpers.h | 8 ++++ 3 files changed, 86 insertions(+), 6 deletions(-) diff --git a/src/gui/osd_setup.cpp b/src/gui/osd_setup.cpp index 03185b905..34522a677 100644 --- a/src/gui/osd_setup.cpp +++ b/src/gui/osd_setup.cpp @@ -723,8 +723,8 @@ int COsdSetup::showOsdSetup() mc->setHint("", LOCALE_MENU_HINT_OSD_PRESET); osd_menu->addItem(mc); } -#if 0 -#if !defined BOXMODEL_CST_HD2 + +#if defined BOXMODEL_CST_HD1 int scart_osd_fix_exist = 0; if (file_exists("/var/etc/.scart_osd_fix")) scart_osd_fix_exist = 1; @@ -734,7 +734,7 @@ int COsdSetup::showOsdSetup() mc->setHint(NEUTRINO_ICON_HINT_IMAGELOGO, LOCALE_MENU_HINT_SCART_OSD_FIX); osd_menu->addItem(mc); #endif -#endif + #if 0 // round corners mc = new CMenuOptionChooser(LOCALE_EXTRA_ROUNDED_CORNERS, &g_settings.theme.rounded_corners, MENU_CORNERSETTINGS_TYPE_OPTIONS, MENU_CORNERSETTINGS_TYPE_OPTION_COUNT, true, this); @@ -776,9 +776,9 @@ int COsdSetup::showOsdSetup() CAudioMute::getInstance()->enableMuteIcon(true); } -// #if !defined BOXMODEL_CST_HD2 -// delete scartFileNotifier; -// #endif +#if defined BOXMODEL_CST_HD1 + delete scartFileNotifier; +#endif delete colorInfoclockNotifier; delete screensaverNotifier; delete channellistNotifier; diff --git a/src/system/setting_helpers.cpp b/src/system/setting_helpers.cpp index e29e5b962..dbd28ff02 100644 --- a/src/system/setting_helpers.cpp +++ b/src/system/setting_helpers.cpp @@ -137,6 +137,78 @@ bool CTouchFileNotifier::changeNotify(const neutrino_locale_t, void * data) return true; } +bool CFlagFileNotifier::changeNotify(const neutrino_locale_t, void * data) +{ + std::string flagfile = FLAGDIR; + flagfile += "/."; + flagfile += filename; + + if ((*(int *)data) != 0) + { + FILE * fd = fopen(flagfile.c_str(), "w"); + if (fd) + { + fclose(fd); + if (strstr(filename, "scart_osd_fix")) + { + //change to scart-osd-fix values + g_settings.screen_StartX_b_0 = 30; + g_settings.screen_StartY_b_0 = 45; + g_settings.screen_EndX_b_0 = 690; + g_settings.screen_EndY_b_0 = 535; + g_settings.screen_preset = 1; + + //set values + g_settings.screen_StartX = g_settings.screen_StartX_b_0; + g_settings.screen_StartY = g_settings.screen_StartY_b_0; + g_settings.screen_EndX = g_settings.screen_EndX_b_0; + g_settings.screen_EndY = g_settings.screen_EndY_b_0; + + CFrameBuffer::getInstance()->Clear(); + + g_settings.font_scaling_x = 100; + g_settings.font_scaling_y = 100; + } + else + { + printf("[CFlagFileNotifier] executing \"service %s start\"\n", filename); + if (my_system(3, "service", filename, "start") != 0) + printf("[CFlagFileNotifier] executing failed\n"); + } + } + } + else + { + if (strstr(filename, "scart_osd_fix")) + { + //reset to defaults + g_settings.screen_StartX_b_0 = 22; + g_settings.screen_StartY_b_0 = 12; + g_settings.screen_EndX_b_0 = 1259 - g_settings.screen_StartX_b_0 - 1; + g_settings.screen_EndY_b_0 = 708 - g_settings.screen_StartY_b_0 - 1; + + //set values + g_settings.screen_StartX = g_settings.screen_preset ? g_settings.screen_StartX_b_0 : g_settings.screen_StartX_a_0; + g_settings.screen_StartY = g_settings.screen_preset ? g_settings.screen_StartY_b_0 : g_settings.screen_StartY_a_0; + g_settings.screen_EndX = g_settings.screen_preset ? g_settings.screen_EndX_b_0 : g_settings.screen_EndX_a_0; + g_settings.screen_EndY = g_settings.screen_preset ? g_settings.screen_EndY_b_0 : g_settings.screen_EndY_a_0; + + CFrameBuffer::getInstance()->Clear(); + + g_settings.font_scaling_x = 105; + g_settings.font_scaling_y = 105; + } + else + { + printf("[CFlagFileNotifier] executing \"service %s stop\"\n", filename); + if (my_system(3, "service", filename, "stop") != 0) + printf("[CFlagFileNotifier] executing failed\n"); + } + remove(flagfile.c_str()); + } + return menu_return::RETURN_REPAINT; +} + void CColorSetupNotifier::setPalette() { CFrameBuffer *frameBuffer = CFrameBuffer::getInstance(); diff --git a/src/system/setting_helpers.h b/src/system/setting_helpers.h index 4d4aa1933..c91dba177 100644 --- a/src/system/setting_helpers.h +++ b/src/system/setting_helpers.h @@ -82,6 +82,14 @@ class CTouchFileNotifier : public CChangeObserver bool changeNotify(const neutrino_locale_t, void * data); }; +class CFlagFileNotifier : public CChangeObserver +{ + const char * filename; +public: + inline CFlagFileNotifier(const char * _filename) { filename = _filename; }; + bool changeNotify(const neutrino_locale_t, void * data); +}; + class CColorSetupNotifier : public CChangeObserver { public: