Jump to content

Recommended Posts

  • Active+ Member

I was browsing through the code during my graphics work, looking for anything that could be considered "junk," when I came across the 16-bit color controls.The 16-bit era was more or less completely lost to history around Windows 7, and no monitor is physically limited to 16-bit these days. The worst monitors are currently 24-bit, which indirectly supports 32-bit color.Therefore, I decided to purge the source code of any code that provided extra controls for this, or that was useless even though it existed.

If you are not using a monitor like this, you can easily do this cleaning process:

Spoiler

spacer.png

 

So let's get started, but let me state it again; read the explanation carefully and follow the steps carefully.

This is the hidden content, please


That's all there is to it; those who wish can make these edits using macros. Any conflicts with external edits you make to your project are your responsibility.
 

Edited by blaxis
added not
  • Metin2 Dev 61
  • Good 5
  • Love 1
  • Love 19
Link to comment
https://metin2.dev/topic/34006-remove-16bit-color-support-unused/
Share on other sites

  • 1 month later...
  • Active+ Member

For a more in-depth cleanup, you can remove BPP from config and source as it's useless now.

 

Spoiler

diff --git a/CHANGELOG.txt b/CHANGELOG.txt
index 2a99e44..0b39110 100644
--- a/CHANGELOG.txt
+++ b/CHANGELOG.txt
@@ -4,7 +4,7 @@
 +------------+
 | 15.11.2025 |
 +------------+
-~ Removed 16bit color support.
+~ Removed 16bit color support and BPP setting from config.
 
 +------------+
 | 14.11.2025 |
diff --git a/Client/Source/UserInterface/PythonApplication.cpp b/Client/Source/UserInterface/PythonApplication.cpp
index d4e2485..4589d0e 100644
--- a/Client/Source/UserInterface/PythonApplication.cpp
+++ b/Client/Source/UserInterface/PythonApplication.cpp
@@ -1199,7 +1199,7 @@ bool CPythonApplication::Create (PyObject * poSelf, const char* c_szName, int wi
 	{
 		m_isWindowed = false;
 		m_isWindowFullScreenEnable = TRUE;
-		__SetFullScreenWindow (GetWindowHandle(), width, height, m_pySystem.GetBPP());
+		__SetFullScreenWindow (GetWindowHandle(), width, height);
 
 		Windowed = true;
 	}
diff --git a/Client/Source/UserInterface/PythonApplication.h b/Client/Source/UserInterface/PythonApplication.h
index 4cde31e..382d9b4 100644
--- a/Client/Source/UserInterface/PythonApplication.h
+++ b/Client/Source/UserInterface/PythonApplication.h
@@ -334,7 +334,7 @@ class CPythonApplication : public CMSApplication, public CInputKeyboard, public
 
 		void __UpdateCamera();
 
-		void __SetFullScreenWindow (HWND hWnd, DWORD dwWidth, DWORD dwHeight, DWORD dwBPP);
+		void __SetFullScreenWindow (HWND hWnd, DWORD dwWidth, DWORD dwHeight);
 		void __MinimizeFullScreenWindow (HWND hWnd, DWORD dwWidth, DWORD dwHeight);
 
 
diff --git a/Client/Source/UserInterface/PythonApplicationProcedure.cpp b/Client/Source/UserInterface/PythonApplicationProcedure.cpp
index a05fa9d..208c174 100644
--- a/Client/Source/UserInterface/PythonApplicationProcedure.cpp
+++ b/Client/Source/UserInterface/PythonApplicationProcedure.cpp
@@ -22,14 +22,13 @@ void CPythonApplication::SafeReleaseCapture()
 	}
 }
 
-void CPythonApplication::__SetFullScreenWindow (HWND hWnd, DWORD dwWidth, DWORD dwHeight, DWORD dwBPP)
+void CPythonApplication::__SetFullScreenWindow (HWND hWnd, DWORD dwWidth, DWORD dwHeight)
 {
 	DEVMODE DevMode;
 	DevMode.dmSize = sizeof (DevMode);
-	DevMode.dmBitsPerPel = dwBPP;
 	DevMode.dmPelsWidth = dwWidth;
 	DevMode.dmPelsHeight = dwHeight;
-	DevMode.dmFields = DM_BITSPERPEL | DM_PELSWIDTH | DM_PELSHEIGHT;
+	DevMode.dmFields = DM_PELSWIDTH | DM_PELSHEIGHT;
 
 	LONG Error = ChangeDisplaySettings (&DevMode, CDS_FULLSCREEN);
 	if (Error == DISP_CHANGE_RESTART)
@@ -69,7 +68,7 @@ LRESULT CPythonApplication::WindowProcedure (HWND hWnd, UINT uiMsg, WPARAM wPara
 
 				if (m_isWindowFullScreenEnable)
 				{
-					__SetFullScreenWindow (hWnd, m_dwWidth, m_dwHeight, m_pySystem.GetBPP());
+					__SetFullScreenWindow (hWnd, m_dwWidth, m_dwHeight);
 				}
 			}
 			else
diff --git a/Client/Source/UserInterface/PythonSystem.cpp b/Client/Source/UserInterface/PythonSystem.cpp
index ecc66bf..b318fd7 100644
--- a/Client/Source/UserInterface/PythonSystem.cpp
+++ b/Client/Source/UserInterface/PythonSystem.cpp
@@ -59,15 +59,11 @@ void CPythonSystem::GetDisplaySettings()
 		if (DisplayMode.Format != D3DFMT_X8R8G8B8 && DisplayMode.Format != D3DFMT_A8R8G8B8)
 			continue;
 
-		DWORD bpp = 32;
-
 		int check_res = false;
 
 		for (int i = 0; !check_res && i < m_ResolutionCount; ++i)
 		{
-			if (m_ResolutionList[i].bpp != bpp ||
-										   m_ResolutionList[i].width != DisplayMode.Width ||
-																		m_ResolutionList[i].height != DisplayMode.Height)
+			if (m_ResolutionList[i].width != DisplayMode.Width || m_ResolutionList[i].height != DisplayMode.Height)
 			{
 				continue;
 			}
@@ -100,7 +96,6 @@ void CPythonSystem::GetDisplaySettings()
 			{
 				m_ResolutionList[m_ResolutionCount].width			= DisplayMode.Width;
 				m_ResolutionList[m_ResolutionCount].height			= DisplayMode.Height;
-				m_ResolutionList[m_ResolutionCount].bpp				= bpp;
 				m_ResolutionList[m_ResolutionCount].frequency[0]	= DisplayMode.RefreshRate;
 				m_ResolutionList[m_ResolutionCount].frequency_count	= 1;
 
@@ -125,7 +120,7 @@ int CPythonSystem::GetFrequencyCount (int index)
 	return m_ResolutionList[index].frequency_count;
 }
 
-bool CPythonSystem::GetResolution (int index, OUT DWORD *width, OUT DWORD *height, OUT DWORD *bpp)
+bool CPythonSystem::GetResolution (int index, OUT DWORD *width, OUT DWORD *height)
 {
 	if (index >= m_ResolutionCount)
 	{
@@ -134,7 +129,6 @@ bool CPythonSystem::GetResolution (int index, OUT DWORD *width, OUT DWORD *heigh
 
 	*width = m_ResolutionList[index].width;
 	*height = m_ResolutionList[index].height;
-	*bpp = m_ResolutionList[index].bpp;
 	return true;
 }
 
@@ -154,16 +148,15 @@ bool CPythonSystem::GetFrequency (int index, int freq_index, OUT DWORD *frequncy
 	return true;
 }
 
-int	CPythonSystem::GetResolutionIndex (DWORD width, DWORD height, DWORD bit)
+int	CPythonSystem::GetResolutionIndex (DWORD width, DWORD height)
 {
-	DWORD re_width, re_height, re_bit;
+	DWORD re_width, re_height;
 	int i = 0;
 
-	while (GetResolution (i, &re_width, &re_height, &re_bit))
+	while (GetResolution (i, &re_width, &re_height))
 	{
 		if (re_width == width)
 			if (re_height == height)
-				if (re_bit == bit)
 				{
 					return i;
 				}
@@ -200,10 +193,6 @@ DWORD CPythonSystem::GetHeight()
 {
 	return m_Config.height;
 }
-DWORD CPythonSystem::GetBPP()
-{
-	return m_Config.bpp;
-}
 DWORD CPythonSystem::GetFrequency()
 {
 	return m_Config.frequency;
@@ -297,7 +286,6 @@ void CPythonSystem::SetDefaultConfig()
 
 	m_Config.width				= 1280;
 	m_Config.height				= 720;
-	m_Config.bpp				= 32;
 	m_Config.bWindowed			= true;
 
 	m_Config.is_software_cursor	= false;
@@ -410,10 +398,6 @@ bool CPythonSystem::LoadConfig()
 		{
 			m_Config.height	= atoi (value);
 		}
-		else if (!stricmp (command, "BPP"))
-		{
-			m_Config.bpp		= atoi (value);
-		}
 		else if (!stricmp (command, "FREQUENCY"))
 		{
 			m_Config.frequency = atoi (value);
@@ -529,10 +513,9 @@ bool CPythonSystem::LoadConfig()
 
 	fclose (fp);
 
-	//	Tracef("LoadConfig: Resolution: %dx%d %dBPP %dHZ Software Cursor: %d, Music/Voice Volume: %d/%d Gamma: %d\n",
+	//	Tracef("LoadConfig: Resolution: %dx%d %dHZ Software Cursor: %d, Music/Voice Volume: %d/%d Gamma: %d\n",
 	//		m_Config.width,
 	//		m_Config.height,
-	//		m_Config.bpp,
 	//		m_Config.frequency,
 	//		m_Config.is_software_cursor,
 	//		m_Config.music_volume,
@@ -553,7 +536,6 @@ bool CPythonSystem::SaveConfig()
 
 	fprintf (fp, "WIDTH\t\t\t\t\t%d\n", m_Config.width);
 	fprintf (fp, "HEIGHT\t\t\t\t\t%d\n", m_Config.height);
-	fprintf (fp, "BPP\t\t\t\t\t\t%d\n", m_Config.bpp);
 	fprintf (fp, "FREQUENCY\t\t\t\t%d\n", m_Config.frequency);
 	fprintf (fp, "SOFTWARE_CURSOR\t\t\t%d\n", m_Config.is_software_cursor);
 	fprintf (fp, "OBJECT_CULLING\t\t\t%d\n", m_Config.is_object_culling);
diff --git a/Client/Source/UserInterface/PythonSystem.h b/Client/Source/UserInterface/PythonSystem.h
index f927f80..a39e65b 100644
--- a/Client/Source/UserInterface/PythonSystem.h
+++ b/Client/Source/UserInterface/PythonSystem.h
@@ -30,7 +30,6 @@ class CPythonSystem : public CSingleton<CPythonSystem>
 		{
 			DWORD	width;
 			DWORD	height;
-			DWORD	bpp;		// bits per pixel (high-color = 16bpp, true-color = 32bpp)
 
 			DWORD	frequency[20];
 			BYTE	frequency_count;
@@ -50,7 +49,6 @@ class CPythonSystem : public CSingleton<CPythonSystem>
 		{
 			DWORD			width;
 			DWORD			height;
-			DWORD			bpp;
 			DWORD			frequency;
 
 			bool			is_software_cursor;
@@ -106,7 +104,6 @@ class CPythonSystem : public CSingleton<CPythonSystem>
 
 		DWORD							GetWidth();
 		DWORD							GetHeight();
-		DWORD							GetBPP();
 		DWORD							GetFrequency();
 		bool							IsSoftwareCursor();
 		bool							IsWindowed();
@@ -134,9 +131,9 @@ class CPythonSystem : public CSingleton<CPythonSystem>
 
 		int								GetResolutionCount();
 		int								GetFrequencyCount (int index);
-		bool							GetResolution (int index, OUT DWORD *width, OUT DWORD *height, OUT DWORD *bpp);
+		bool							GetResolution (int index, OUT DWORD *width, OUT DWORD *height);
 		bool							GetFrequency (int index, int freq_index, OUT DWORD *frequncy);
-		int								GetResolutionIndex (DWORD width, DWORD height, DWORD bpp);
+		int								GetResolutionIndex (DWORD width, DWORD height);
 		int								GetFrequencyIndex (int res_index, DWORD frequency);
 		bool							isViewCulling();
 
diff --git a/Client/Source/UserInterface/PythonSystemModule.cpp b/Client/Source/UserInterface/PythonSystemModule.cpp
index 673da67..a673a8a 100644
--- a/Client/Source/UserInterface/PythonSystemModule.cpp
+++ b/Client/Source/UserInterface/PythonSystemModule.cpp
@@ -104,7 +104,7 @@ PyObject* systemGetConfig (PyObject * poSelf, PyObject * poArgs)
 {
 	CPythonSystem::TConfig *tmp = CPythonSystem::Instance().GetConfig();
 
-	int iRes = CPythonSystem::Instance().GetResolutionIndex (tmp->width, tmp->height, tmp->bpp);
+	int iRes = CPythonSystem::Instance().GetResolutionIndex (tmp->width, tmp->height);
 	int iFrequency = CPythonSystem::Instance().GetFrequencyIndex (iRes, tmp->frequency);
 
 	return Py_BuildValue ("iiiiiiii",  iRes,
@@ -263,7 +263,6 @@ PyObject* systemSetConfig (PyObject * poSelf, PyObject * poArgs)
 	int res_index;
 	int width;
 	int height;
-	int bpp;
 	int frequency_index;
 	int frequency;
 	int software_cursor;
@@ -319,7 +318,7 @@ PyObject* systemSetConfig (PyObject * poSelf, PyObject * poArgs)
 		return Py_BuildException();
 	}
 
-	if (!CPythonSystem::Instance().GetResolution (res_index, (DWORD*) &width, (DWORD*) &height, (DWORD*) &bpp))
+	if (!CPythonSystem::Instance().GetResolution (res_index, (DWORD*) &width, (DWORD*) &height))
 	{
 		return Py_BuildNone();
 	}
@@ -335,7 +334,6 @@ PyObject* systemSetConfig (PyObject * poSelf, PyObject * poArgs)
 
 	tmp.width				= width;
 	tmp.height				= height;
-	tmp.bpp					= bpp;
 	tmp.frequency			= frequency;
 	tmp.is_software_cursor	= software_cursor ? true : false;
 	tmp.is_object_culling	= object_culling ? true : false;
@@ -380,21 +378,21 @@ PyObject* systemGetFrequencyCount (PyObject * poSelf, PyObject * poArgs)
 PyObject* systemGetResolution (PyObject * poSelf, PyObject * poArgs)
 {
 	int	index;
-	DWORD width = 0, height = 0, bpp = 0;
+	DWORD width = 0, height = 0;
 
 	if (!PyTuple_GetInteger (poArgs, 0, &index))
 	{
 		return Py_BuildException();
 	}
 
-	CPythonSystem::Instance().GetResolution (index, &width, &height, &bpp);
-	return Py_BuildValue ("iii", width, height, bpp);
+	CPythonSystem::Instance().GetResolution (index, &width, &height);
+	return Py_BuildValue ("ii", width, height);
 }
 
 PyObject* systemGetCurrentResolution (PyObject * poSelf, PyObject *poArgs)
 {
 	CPythonSystem::TConfig *tmp = CPythonSystem::Instance().GetConfig();
-	return Py_BuildValue ("iii", tmp->width, tmp->height, tmp->bpp);
+	return Py_BuildValue ("ii", tmp->width, tmp->height);
 }
 
 PyObject* systemGetFrequency (PyObject * poSelf, PyObject * poArgs)
diff --git a/Client/Source/WorldEditor/DockingBar/mapterraintexturepreview.cpp b/Client/Source/WorldEditor/DockingBar/mapterraintexturepreview.cpp
index b22abed..beed757 100644
--- a/Client/Source/WorldEditor/DockingBar/mapterraintexturepreview.cpp
+++ b/Client/Source/WorldEditor/DockingBar/mapterraintexturepreview.cpp
@@ -90,7 +90,6 @@ void CMapTerrainTexturePreview::OnPaint()
 		DWORD * pdwSrc = (DWORD*)ilGetData();
 		int iwidth = ilGetInteger (IL_IMAGE_WIDTH);
 		int iheight = ilGetInteger (IL_IMAGE_HEIGHT);
-		int iBPP = ilGetInteger (IL_IMAGE_BYTES_PER_PIXEL);
 
 		for (int y = 0; y < iheight; ++y)
 		{

 

 

  • Metin2 Dev 1

Don't use any images from : imgur, turkmmop, freakgamers, inforge, hizliresim... Or your content will be deleted without notice...
Use : https://metin2.download/media/add/

Please use https://metin2.download/ when uploading files smaller than 100MB, otherwise the approval will take longer due to manual upload.

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
×
×
  • Create New...

Important Information

Terms of Use / Privacy Policy / Guidelines / We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.