Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- if (display)
- {
- CJNIDisplayMode m = display.getMode();
- if (m)
- {
- if (m.getPhysicalWidth() > m.getPhysicalHeight()) // Assume unusable if portrait is returned
- {
- s_hasModeApi = true;
- // My Code Start!
- std::string displaySize;
- int alt_iWidth = 0;
- int alt_iHeight = 0;
- displaySize = CJNISystemProperties::get("sys.display-size", "");
- if (!displaySize.empty())
- {
- std::vector<std::string> aSize = StringUtils::Split(displaySize, "x");
- if (aSize.size() == 2)
- {
- alt_iWidth = StringUtils::IsInteger(aSize[0]) ? atoi(aSize[0].c_str()) : 0;
- alt_iHeight = StringUtils::IsInteger(aSize[1]) ? atoi(aSize[1].c_str()) : 0;
- }
- }
- CLog::Log(LOGDEBUG, "CAndroidUtils: [Alt] display-size: {}({}x{})", displaySize, alt_iWidth, alt_iHeight);
- // My Code End !
- CLog::Log(LOGDEBUG, "CAndroidUtils: current mode: {}: {}x{}@{:f}", m.getModeId(),
- m.getPhysicalWidth(), m.getPhysicalHeight(), m.getRefreshRate());
- s_res_cur_displayMode.strId = std::to_string(m.getModeId());
- s_res_cur_displayMode.iWidth = s_res_cur_displayMode.iScreenWidth = alt_iWidth; // here
- s_res_cur_displayMode.iHeight = s_res_cur_displayMode.iScreenHeight = alt_iHeight; // here
- s_res_cur_displayMode.fRefreshRate = m.getRefreshRate();
- s_res_cur_displayMode.dwFlags = D3DPRESENTFLAG_PROGRESSIVE;
- s_res_cur_displayMode.bFullScreen = true;
- s_res_cur_displayMode.iSubtitles = s_res_cur_displayMode.iHeight;
- s_res_cur_displayMode.fPixelRatio = 1.0f;
- s_res_cur_displayMode.strMode = StringUtils::Format(
- "{}x{} @ {:.6f}{} - Full Screen", s_res_cur_displayMode.iScreenWidth,
- s_res_cur_displayMode.iScreenHeight, s_res_cur_displayMode.fRefreshRate,
- s_res_cur_displayMode.dwFlags & D3DPRESENTFLAG_INTERLACED ? "i" : "");
- std::vector<CJNIDisplayMode> modes = display.getSupportedModes();
- for (CJNIDisplayMode& m : modes)
- {
- CLog::Log(LOGDEBUG, "CAndroidUtils: available mode: {}: {}x{}@{:f}", m.getModeId(),
- m.getPhysicalWidth(), m.getPhysicalHeight(), m.getRefreshRate());
- RESOLUTION_INFO res;
- res.strId = std::to_string(m.getModeId());
- res.iWidth = res.iScreenWidth = alt_iWidth; // here
- res.iHeight = res.iScreenHeight = alt_iHeight; // here
- res.fRefreshRate = m.getRefreshRate();
- res.dwFlags = D3DPRESENTFLAG_PROGRESSIVE;
- res.bFullScreen = true;
- res.iSubtitles = res.iHeight;
- res.fPixelRatio = 1.0f;
- res.strMode = StringUtils::Format("{}x{} @ {:.6f}{} - Full Screen", res.iScreenWidth,
- res.iScreenHeight, res.fRefreshRate,
- res.dwFlags & D3DPRESENTFLAG_INTERLACED ? "i" : "");
- s_res_displayModes.push_back(res);
- }
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement