Advertisement
ppongoo

Untitled

Sep 5th, 2022 (edited)
237
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 2.96 KB | None | 0 0
  1. if (display)
  2.   {
  3.     CJNIDisplayMode m = display.getMode();
  4.     if (m)
  5.     {
  6.       if (m.getPhysicalWidth() > m.getPhysicalHeight()) // Assume unusable if portrait is returned
  7.       {
  8.         s_hasModeApi = true;
  9.  
  10.         // My Code Start!
  11.         std::string displaySize;
  12.         int alt_iWidth = 0;
  13.         int alt_iHeight = 0;
  14.  
  15.         displaySize = CJNISystemProperties::get("sys.display-size", "");  
  16.         if (!displaySize.empty())
  17.          {
  18.           std::vector<std::string> aSize = StringUtils::Split(displaySize, "x");
  19.           if (aSize.size() == 2)
  20.            {
  21.             alt_iWidth = StringUtils::IsInteger(aSize[0]) ? atoi(aSize[0].c_str()) : 0;
  22.             alt_iHeight = StringUtils::IsInteger(aSize[1]) ? atoi(aSize[1].c_str()) : 0;
  23.            }    
  24.          }
  25.  
  26.         CLog::Log(LOGDEBUG, "CAndroidUtils: [Alt] display-size: {}({}x{})", displaySize, alt_iWidth, alt_iHeight);
  27.         // My Code End !   
  28.  
  29.         CLog::Log(LOGDEBUG, "CAndroidUtils: current mode: {}: {}x{}@{:f}", m.getModeId(),
  30.                 m.getPhysicalWidth(), m.getPhysicalHeight(), m.getRefreshRate());  
  31.        
  32.        
  33.                
  34.         s_res_cur_displayMode.strId = std::to_string(m.getModeId());
  35.         s_res_cur_displayMode.iWidth = s_res_cur_displayMode.iScreenWidth = alt_iWidth; // here
  36.         s_res_cur_displayMode.iHeight = s_res_cur_displayMode.iScreenHeight = alt_iHeight; // here
  37.         s_res_cur_displayMode.fRefreshRate = m.getRefreshRate();
  38.         s_res_cur_displayMode.dwFlags = D3DPRESENTFLAG_PROGRESSIVE;
  39.         s_res_cur_displayMode.bFullScreen = true;
  40.         s_res_cur_displayMode.iSubtitles = s_res_cur_displayMode.iHeight;
  41.         s_res_cur_displayMode.fPixelRatio = 1.0f;
  42.         s_res_cur_displayMode.strMode = StringUtils::Format(
  43.             "{}x{} @ {:.6f}{} - Full Screen", s_res_cur_displayMode.iScreenWidth,
  44.             s_res_cur_displayMode.iScreenHeight, s_res_cur_displayMode.fRefreshRate,
  45.             s_res_cur_displayMode.dwFlags & D3DPRESENTFLAG_INTERLACED ? "i" : "");
  46.  
  47.         std::vector<CJNIDisplayMode> modes = display.getSupportedModes();
  48.         for (CJNIDisplayMode& m : modes)
  49.         {
  50.           CLog::Log(LOGDEBUG, "CAndroidUtils: available mode: {}: {}x{}@{:f}", m.getModeId(),
  51.                     m.getPhysicalWidth(), m.getPhysicalHeight(), m.getRefreshRate());                
  52.           RESOLUTION_INFO res;
  53.           res.strId = std::to_string(m.getModeId());
  54.           res.iWidth = res.iScreenWidth = alt_iWidth; // here
  55.           res.iHeight = res.iScreenHeight = alt_iHeight; // here
  56.           res.fRefreshRate = m.getRefreshRate();
  57.           res.dwFlags = D3DPRESENTFLAG_PROGRESSIVE;
  58.           res.bFullScreen = true;
  59.           res.iSubtitles = res.iHeight;
  60.           res.fPixelRatio = 1.0f;
  61.           res.strMode = StringUtils::Format("{}x{} @ {:.6f}{} - Full Screen", res.iScreenWidth,
  62.                                             res.iScreenHeight, res.fRefreshRate,
  63.                                             res.dwFlags & D3DPRESENTFLAG_INTERLACED ? "i" : "");
  64.  
  65.           s_res_displayModes.push_back(res);
  66.         }
  67.       }
  68.     }
  69.   }
  70. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement