10
10
*****************************************************************************/
11
11
12
12
#include " StdInc.h"
13
- #include < algorithm>
14
- #include < vector>
15
13
#include < core/CClientCommands.h>
16
14
#include < game/CGame.h>
17
15
#include < game/CSettings.h>
@@ -1149,6 +1147,7 @@ void CSettings::CreateGUI()
1149
1147
m_pDebugSettingCombo->AddItem (" #0000 Lua trace" )->SetData ((void *)EDiagnosticDebug::LUA_TRACE_0000);
1150
1148
m_pDebugSettingCombo->AddItem (" #0000 Resize always" )->SetData ((void *)EDiagnosticDebug::RESIZE_ALWAYS_0000);
1151
1149
m_pDebugSettingCombo->AddItem (" #0000 Resize never" )->SetData ((void *)EDiagnosticDebug::RESIZE_NEVER_0000);
1150
+ m_pDebugSettingCombo->AddItem (" #0000 Memory allocation debug" )->SetData ((void *)EDiagnosticDebug::BAD_ALLOC);
1152
1151
m_pDebugSettingCombo->SetReadOnly (true );
1153
1152
vecTemp.fY += fLineHeight ;
1154
1153
@@ -1694,15 +1693,6 @@ void CSettings::UpdateVideoTab()
1694
1693
m_pPlayerMapImageCombo->SetSelectedItemByIndex (iVar);
1695
1694
}
1696
1695
1697
- struct ResolutionData
1698
- {
1699
- int width;
1700
- int height;
1701
- int depth;
1702
- int vidMode;
1703
- bool isWidescreen;
1704
- };
1705
-
1706
1696
//
1707
1697
// PopulateResolutionComboBox
1708
1698
//
@@ -1716,86 +1706,47 @@ void CSettings::PopulateResolutionComboBox()
1716
1706
bool bShowUnsafeResolutions = m_pCheckBoxShowUnsafeResolutions->GetSelected ();
1717
1707
1718
1708
CGameSettings* gameSettings = CCore::GetSingleton ().GetGame ()->GetSettings ();
1719
- if (!gameSettings)
1720
- return ;
1721
1709
1722
1710
VideoMode vidModemInfo;
1723
1711
int vidMode, numVidModes;
1724
- std::vector<ResolutionData> resolutions;
1725
1712
1726
- if (!m_pComboResolution)
1727
- return ;
1728
-
1729
1713
m_pComboResolution->Clear ();
1730
1714
numVidModes = gameSettings->GetNumVideoModes ();
1731
1715
1732
1716
for (vidMode = 0 ; vidMode < numVidModes; vidMode++)
1733
1717
{
1734
- if (!gameSettings->GetVideoModeInfo (&vidModemInfo, vidMode))
1735
- continue ;
1718
+ gameSettings->GetVideoModeInfo (&vidModemInfo, vidMode);
1736
1719
1737
1720
// Remove resolutions that will make the gui unusable
1738
1721
if (vidModemInfo.width < 640 || vidModemInfo.height < 480 )
1739
1722
continue ;
1740
1723
1741
- // Check resolution is below desktop res unless that is allowed
1742
- if (gameSettings->IsUnsafeResolution (vidModemInfo.width , vidModemInfo.height ) && !bShowUnsafeResolutions)
1743
- continue ;
1744
-
1745
- if (!(vidModemInfo.flags & rwVIDEOMODEEXCLUSIVE))
1746
- continue ;
1747
-
1748
- ResolutionData resData;
1749
- resData.width = vidModemInfo.width ;
1750
- resData.height = vidModemInfo.height ;
1751
- resData.depth = vidModemInfo.depth ;
1752
- resData.vidMode = vidMode;
1753
- resData.isWidescreen = (vidModemInfo.flags & rwVIDEOMODE_XBOX_WIDESCREEN) != 0 ;
1754
-
1755
1724
// Check resolution hasn't already been added
1756
1725
bool bDuplicate = false ;
1757
- for (const auto & existing : resolutions )
1726
+ for (int i = 1 ; i < vidMode; i++ )
1758
1727
{
1759
- if (existing.width == resData.width && existing.height == resData.height && existing.depth == resData.depth )
1760
- {
1728
+ VideoMode info;
1729
+ gameSettings->GetVideoModeInfo (&info, i);
1730
+ if (info.width == vidModemInfo.width && info.height == vidModemInfo.height && info.depth == vidModemInfo.depth )
1761
1731
bDuplicate = true ;
1762
- break ;
1763
- }
1764
1732
}
1765
-
1766
- if (!bDuplicate)
1767
- resolutions.push_back (resData);
1768
- }
1733
+ if (bDuplicate)
1734
+ continue ;
1769
1735
1770
- if (resolutions.empty ())
1771
- return ;
1736
+ // Check resolution is below desktop res unless that is allowed
1737
+ if (gameSettings->IsUnsafeResolution (vidModemInfo.width , vidModemInfo.height ) && !bShowUnsafeResolutions)
1738
+ continue ;
1772
1739
1773
- // Sort resolutions by width (descending), then by height, then by depth
1774
- std::sort (resolutions.begin (), resolutions.end (), [](const ResolutionData& a, const ResolutionData& b) {
1775
- if (a.width != b.width )
1776
- return a.width > b.width ;
1777
- if (a.height != b.height )
1778
- return a.height > b.height ;
1779
- return a.depth > b.depth ;
1780
- });
1781
-
1782
- SString selectedText;
1783
- VideoMode currentInfo;
1784
- if (gameSettings->GetVideoModeInfo (¤tInfo, iNextVidMode))
1785
- {
1786
- for (const auto & res : resolutions)
1787
- {
1788
- SString strMode (" %d x %d x %d" , res.width , res.height , res.depth );
1789
- CGUIListItem* pItem = m_pComboResolution->AddItem (strMode);
1790
- if (pItem)
1791
- pItem->SetData ((void *)res.vidMode );
1740
+ SString strMode (" %lu x %lu x %lu" , vidModemInfo.width , vidModemInfo.height , vidModemInfo.depth );
1792
1741
1793
- if (currentInfo.width == res.width && currentInfo.height == res.height && currentInfo.depth == res.depth )
1794
- selectedText = strMode;
1795
- }
1742
+ if (vidModemInfo.flags & rwVIDEOMODEEXCLUSIVE)
1743
+ m_pComboResolution->AddItem (strMode)->SetData ((void *)vidMode);
1744
+
1745
+ VideoMode currentInfo;
1746
+ gameSettings->GetVideoModeInfo (¤tInfo, iNextVidMode);
1796
1747
1797
- if (!selectedText. empty () )
1798
- m_pComboResolution->SetText (selectedText );
1748
+ if (currentInfo. width == vidModemInfo. width && currentInfo. height == vidModemInfo. height && currentInfo. depth == vidModemInfo. depth )
1749
+ m_pComboResolution->SetText (strMode );
1799
1750
}
1800
1751
}
1801
1752
0 commit comments