Repository: xbmc/xbmc
File: xbmc/games/dialogs/osd/DialogGameVideoFilter.cpp (C++)

Code before:
      if (m_gameVideoHandle->SupportsScalingMethod(scalingMethodProps.scalingMethod))
      {
        RETRO::CRenderVideoSettings videoSettings;
        videoSettings.SetScalingMethod(scalingMethodProps.scalingMethod);

        CFileItemPtr item =
            std::make_shared<CFileItem>(g_localizeStrings.Get(scalingMethodProps.nameIndex));
        item->SetLabel2(g_localizeStrings.Get(scalingMethodProps.categoryIndex));
        item->SetProperty("game.videofilter", CVariant{videoSettings.GetVideoFilter()});
        item->SetProperty("game.videofilterdescription",
                          CVariant{g_localizeStrings.Get(scalingMethodProps.descriptionIndex)});
        m_items.Add(std::move(item));
      }
    }
  }
}

void CDialogGameVideoFilter::InitVideoFilters()
{

  std::vector<VideoFilterProperties> videoFilters;

  std::string xmlPath;
  std::unique_ptr<CXBMCTinyXML> xml;

  //! @todo Have the add-on give us the xml as a string (or parse it)
  std::string xmlFilename;
#ifdef TARGET_WINDOWS
  xmlFilename = "ShaderPresetsHLSLP.xml";
#else
  xmlFilename = "ShaderPresetsGLSLP.xml";
#endif

  const std::string homeAddonPath = CSpecialProtocol::TranslatePath(
      URIUtils::AddFileToFolder("special://home", "addons", PRESETS_ADDON_NAME));
  const std::string systemAddonPath = CSpecialProtocol::TranslatePath(
      URIUtils::AddFileToFolder("special://xbmc", "addons", PRESETS_ADDON_NAME));
  const std::string binAddonPath = CSpecialProtocol::TranslatePath(
      URIUtils::AddFileToFolder("special://xbmcbinaddons", PRESETS_ADDON_NAME));

  for (const auto& basePath : {homeAddonPath, systemAddonPath, binAddonPath})
  {
    xmlPath = URIUtils::AddFileToFolder(basePath, "resources", xmlFilename);

    CLog::LogF(LOGERROR, "Looking for shader preset XML at {}", CURL::GetRedacted(xmlPath));

    if (XFILE::CFile::Exists(xmlPath))
    {
      xml = std::make_unique<CXBMCTinyXML>(xmlPath);
      if (xml->LoadFile())
        break;

Review comment (bug):
While reviewing this I expanded the code below and saw:


```c++
CLog::LogF(LOGERROR, "Looking for shader preset XML at {}", CURL::GetRedacted(xmlPath));
```

Wanna change this to LOGDEBUG?

Code after:
      if (m_gameVideoHandle->SupportsScalingMethod(scalingMethodProps.scalingMethod))
      {
        RETRO::CRenderVideoSettings videoSettings;
        videoSettings.SetScalingMethod(scalingMethodProps.scalingMethod);

        CFileItemPtr item =
            std::make_shared<CFileItem>(g_localizeStrings.Get(scalingMethodProps.nameIndex));
        item->SetLabel2(g_localizeStrings.Get(scalingMethodProps.categoryIndex));
        item->SetProperty("game.videofilter", CVariant{videoSettings.GetVideoFilter()});
        item->SetProperty("game.videofilterdescription",
                          CVariant{g_localizeStrings.Get(scalingMethodProps.descriptionIndex)});
        m_items.Add(std::move(item));
      }
    }
  }
}

void CDialogGameVideoFilter::InitVideoFilters()
{

  std::vector<VideoFilterProperties> videoFilters;

  std::string xmlPath;
  std::unique_ptr<CXBMCTinyXML> xml;

  //! @todo Have the add-on give us the xml as a string (or parse it)
  std::string xmlFilename;
#ifdef TARGET_WINDOWS
  xmlFilename = "ShaderPresetsHLSLP.xml";
#else
  xmlFilename = "ShaderPresetsGLSLP.xml";
#endif

  const std::string homeAddonPath = CSpecialProtocol::TranslatePath(
      URIUtils::AddFileToFolder("special://home", "addons", PRESETS_ADDON_NAME));
  const std::string systemAddonPath = CSpecialProtocol::TranslatePath(
      URIUtils::AddFileToFolder("special://xbmc", "addons", PRESETS_ADDON_NAME));
  const std::string binAddonPath = CSpecialProtocol::TranslatePath(
      URIUtils::AddFileToFolder("special://xbmcbinaddons", PRESETS_ADDON_NAME));

  for (const auto& basePath : {homeAddonPath, systemAddonPath, binAddonPath})
  {
    xmlPath = URIUtils::AddFileToFolder(basePath, "resources", xmlFilename);

    CLog::LogF(LOGDEBUG, "Looking for shader preset XML at {}", CURL::GetRedacted(xmlPath));

    if (XFILE::CFile::Exists(xmlPath))
    {
      xml = std::make_unique<CXBMCTinyXML>(xmlPath);
      if (xml->LoadFile())
        break;