From dc138e491221da91e7821abc91462548f8aef0be Mon Sep 17 00:00:00 2001 From: Louis Gombert Date: Mon, 13 May 2024 23:20:53 +0200 Subject: [PATCH] Remove DDAccess.h header, and associated DD_ACCESS_RING definition This definition was used to control the accessibility of some class members, changing protected qualifiers to public. This introduced unnecessary coupling between components and headers. All conditional access specifiers have been set to public, which should not be a problem given the low number of classes that actually used affected members. Another albeit more complex solution could have been to use friend classes. --- Descent3/intellivibe.cpp | 1 - dd_grwin32/ddgrWin32DX.cpp | 1 - dd_grwin32/ddgrWin32GDI.cpp | 1 - dd_lnxsound/sdlsound.cpp | 3 -- dd_sndlib/Ds3dlib.cpp | 3 -- dd_vidwin32/video_win32.cpp | 1 - ddio_lnx/lnxforcefeedback.cpp | 1 - ddio_win/winforcefeedback.cpp | 1 - ddio_win/winio.cpp | 2 -- ddio_win/winkey.cpp | 1 - ddio_win/winmouse.cpp | 1 - lib/DDAccess.h | 59 ----------------------------------- lib/Ddgr.h | 2 -- lib/TaskSystem.h | 8 ----- lib/renderer.h | 2 -- lib/win/win32app.h | 9 ------ linux/lnxcon.cpp | 1 - linux/lnxcon_null.cpp | 1 - linux/lnxcon_raw.cpp | 1 - movie/d3movie.cpp | 1 - renderer/HardwareOpenGL.cpp | 1 - win32/wincon.cpp | 1 - win32/wintask.cpp | 3 -- 23 files changed, 105 deletions(-) delete mode 100644 lib/DDAccess.h diff --git a/Descent3/intellivibe.cpp b/Descent3/intellivibe.cpp index 57780e12..21a05a4b 100644 --- a/Descent3/intellivibe.cpp +++ b/Descent3/intellivibe.cpp @@ -41,7 +41,6 @@ * $NoKeywords: $ */ -#define DD_ACCESS_RING #include "vibeinterface.h" #ifndef WIN32 diff --git a/dd_grwin32/ddgrWin32DX.cpp b/dd_grwin32/ddgrWin32DX.cpp index ed9008f7..bf1b8ecc 100644 --- a/dd_grwin32/ddgrWin32DX.cpp +++ b/dd_grwin32/ddgrWin32DX.cpp @@ -33,7 +33,6 @@ * $NoKeywords: $ */ -#include "DDAccess.h" // Allow this module full DD access #include "ddgrWin32.h" #include "ddgrWin32DX.h" #include "Application.h" diff --git a/dd_grwin32/ddgrWin32GDI.cpp b/dd_grwin32/ddgrWin32GDI.cpp index 0417b3e7..23a9a59c 100644 --- a/dd_grwin32/ddgrWin32GDI.cpp +++ b/dd_grwin32/ddgrWin32GDI.cpp @@ -73,7 +73,6 @@ * $NoKeywords: $ */ -#include "DDAccess.h" // Allow this module full DD access #include "ddgrWin32.h" #include "ddgrWin32GDI.h" #include "Application.h" diff --git a/dd_lnxsound/sdlsound.cpp b/dd_lnxsound/sdlsound.cpp index 40866f1e..11c09296 100644 --- a/dd_lnxsound/sdlsound.cpp +++ b/dd_lnxsound/sdlsound.cpp @@ -16,9 +16,6 @@ * along with this program. If not, see . */ -// NEED THIS SINCE DDSNDLIB is a DD library. -#include "DDAccess.h" - #include #include #include diff --git a/dd_sndlib/Ds3dlib.cpp b/dd_sndlib/Ds3dlib.cpp index decb8e92..08d930ca 100644 --- a/dd_sndlib/Ds3dlib.cpp +++ b/dd_sndlib/Ds3dlib.cpp @@ -203,9 +203,6 @@ * $NoKeywords: $ */ -// NEED THIS SINCE DDSNDLIB is a DD library. -#include "DDAccess.h" - #include "ds3dlib_internal.h" #include diff --git a/dd_vidwin32/video_win32.cpp b/dd_vidwin32/video_win32.cpp index 0efc372f..fd0c239b 100644 --- a/dd_vidwin32/video_win32.cpp +++ b/dd_vidwin32/video_win32.cpp @@ -47,7 +47,6 @@ * $NoKeywords: $ */ -#include "DDAccess.h" // DD Access enabled #include "ddvidlib.h" #include "pserror.h" diff --git a/ddio_lnx/lnxforcefeedback.cpp b/ddio_lnx/lnxforcefeedback.cpp index 63894622..0cd59192 100644 --- a/ddio_lnx/lnxforcefeedback.cpp +++ b/ddio_lnx/lnxforcefeedback.cpp @@ -40,7 +40,6 @@ * $NoKeywords: $ */ -#include "DDAccess.h" #include #include #include diff --git a/ddio_win/winforcefeedback.cpp b/ddio_win/winforcefeedback.cpp index 6897c3c2..62795d21 100644 --- a/ddio_win/winforcefeedback.cpp +++ b/ddio_win/winforcefeedback.cpp @@ -94,7 +94,6 @@ #include #include -#include "DDAccess.h" #include #include diff --git a/ddio_win/winio.cpp b/ddio_win/winio.cpp index 1a4c2d43..76efc8fe 100644 --- a/ddio_win/winio.cpp +++ b/ddio_win/winio.cpp @@ -108,8 +108,6 @@ #include #include -#include "DDAccess.h" - #include #include "pserror.h" diff --git a/ddio_win/winkey.cpp b/ddio_win/winkey.cpp index db2daf79..d4d2ba24 100644 --- a/ddio_win/winkey.cpp +++ b/ddio_win/winkey.cpp @@ -175,7 +175,6 @@ // ---------------------------------------------------------------------------- // Keyboard Interface // ---------------------------------------------------------------------------- -#include "DDAccess.h" #include "pserror.h" #include "mono.h" diff --git a/ddio_win/winmouse.cpp b/ddio_win/winmouse.cpp index 91bbff55..ce3c4117 100644 --- a/ddio_win/winmouse.cpp +++ b/ddio_win/winmouse.cpp @@ -23,7 +23,6 @@ #include #include -#include "DDAccess.h" #include "pserror.h" #include "mono.h" #include "ddio.h" diff --git a/lib/DDAccess.h b/lib/DDAccess.h deleted file mode 100644 index 6e27acc2..00000000 --- a/lib/DDAccess.h +++ /dev/null @@ -1,59 +0,0 @@ -/* -* Descent 3 -* Copyright (C) 2024 Parallax Software -* -* This program is free software: you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation, either version 3 of the License, or -* (at your option) any later version. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with this program. If not, see . - ---- HISTORICAL COMMENTS FOLLOW --- - - * $Logfile: /DescentIII/Main/lib/DDAccess.h $ - * $Revision: 3 $ - * $Date: 8/13/97 3:02p $ - * $Author: Samir $ - * - * Device Dependant Access Manager. (Allow access of libraries to OS information) - * - * $Log: /DescentIII/Main/lib/DDAccess.h $ - * - * 3 8/13/97 3:02p Samir - * A 'cleaner' way to do DirectInput mouse stuff. - * - * 2 8/01/97 7:31p Samir - * Slightly better interface. - * - * 1 5/23/97 4:07p Samir - * Device Dependant Data Access Manager. - * - * $NoKeywords: $ - */ - -#ifndef DDACCESS_H -#define DDACCESS_H - -// allows access to DD system information, such as OS specific info. - -#define DD_ACCESS_RING - -// Win32 region of DD_ACCESS -// Include the standard windows header since API calls are available in DD_ACCESS_RING -// Define any additional messages too. - -#if defined(WIN32) - -// Messages -#define WM_SYNCMOUSEACQUIRE (WM_USER + 0) - -#endif // WIN32 - -#endif diff --git a/lib/Ddgr.h b/lib/Ddgr.h index 8762e0e3..9fab6ddb 100644 --- a/lib/Ddgr.h +++ b/lib/Ddgr.h @@ -172,7 +172,6 @@ typedef struct ddgr_surface { int locks; // lock count. } ddgr_surface; -#if defined(DD_ACCESS_RING) // only available to DD_ACCESS libraries. #if defined(WIN32) /* ddraw_surf = true if this is a true DirectDraw surface, false if a GDI surface @@ -183,7 +182,6 @@ void ddgr_surf_GetPrivateData(ddgr_surface *sf, bool *ddraw_surf, uint *object_p // you must typecase this return value to LPDIRECTDRAW unsigned ddgr_GetDDrawObject(); #endif // WIN32 -#endif // DD_ACCESS_RING /* Surface Functions */ diff --git a/lib/TaskSystem.h b/lib/TaskSystem.h index 44c8d6fd..9381c4f7 100644 --- a/lib/TaskSystem.h +++ b/lib/TaskSystem.h @@ -50,11 +50,7 @@ typedef enum tTaskPriority { TASKPRIORITY_HIGHEST, TASKPRIORITY_NORMAL, TASKPRIO // handle multitasking differently. class osEvent { -#if defined(DD_ACCESS_RING) public: -#else -private: -#endif // DD_ACCESS_RING_0 #if defined(WIN32) unsigned event_os_handle; // this is the Win32 Event Handle #endif // WIN32 @@ -71,11 +67,7 @@ public: }; class osTask { -#if defined(DD_ACCESS_RING) public: -#else -private: -#endif // DD_ACCESS_RING_0 #if defined(WIN32) unsigned task_os_handle; // This is the Win32 EventHandle unsigned task_os_id; // Win32 Thread ID diff --git a/lib/renderer.h b/lib/renderer.h index 56a9423b..8ea7b4c5 100644 --- a/lib/renderer.h +++ b/lib/renderer.h @@ -680,11 +680,9 @@ void rend_CopyBitmapToFramebuffer(int bm_handle, int x, int y); // Gets a renderer ready for a framebuffer copy, or stops a framebuffer copy void rend_SetFrameBufferCopyState(bool state); -#if defined(DD_ACCESS_RING) #if defined(WIN32) // returns the direct draw object void *rend_RetrieveDirectDrawObj(void **frontsurf, void **backsurf); #endif -#endif #endif diff --git a/lib/win/win32app.h b/lib/win/win32app.h index 04b4702b..5bf1020e 100644 --- a/lib/win/win32app.h +++ b/lib/win/win32app.h @@ -212,12 +212,7 @@ public: // detect if application can handle what we want of it. static bool GetSystemSpecs(const char *fname); -// These variables are only accessable to modules that have DD_ACCESS. -#if defined(DD_ACCESS_RING) public: -#else -protected: -#endif HWnd m_hWnd; // handles created by the system HInstance m_hInstance; unsigned m_Flags; @@ -227,11 +222,7 @@ private: void os_init(); // initializes OS components. }; -// the following data is communicated by the application library to other DDAccessed libraries. -#if defined(DD_ACCESS_RING) - // system mouse info. extern short w32_msewhl_delta; // value of mouse wheel delta for frame #endif -#endif diff --git a/linux/lnxcon.cpp b/linux/lnxcon.cpp index f75abb4f..a0deaf0a 100644 --- a/linux/lnxcon.cpp +++ b/linux/lnxcon.cpp @@ -56,7 +56,6 @@ * $NoKeywords: $ */ -#include "DDAccess.h" #include "application.h" #include "AppConsole.h" #include "TaskSystem.h" diff --git a/linux/lnxcon_null.cpp b/linux/lnxcon_null.cpp index 82f5625a..5aa5517e 100644 --- a/linux/lnxcon_null.cpp +++ b/linux/lnxcon_null.cpp @@ -45,7 +45,6 @@ * $NoKeywords: $ */ -#include "DDAccess.h" #include "application.h" #include "AppConsole.h" #include "TaskSystem.h" diff --git a/linux/lnxcon_raw.cpp b/linux/lnxcon_raw.cpp index ab6f3e6d..756d5b7b 100644 --- a/linux/lnxcon_raw.cpp +++ b/linux/lnxcon_raw.cpp @@ -39,7 +39,6 @@ * $NoKeywords: $ */ -#include "DDAccess.h" #include "application.h" #include "AppConsole.h" #include "TaskSystem.h" diff --git a/movie/d3movie.cpp b/movie/d3movie.cpp index 782ba8ef..d0201b88 100644 --- a/movie/d3movie.cpp +++ b/movie/d3movie.cpp @@ -26,7 +26,6 @@ #define O_BINARY 0 #endif -#include "DDAccess.h" #ifdef WIN32 #include diff --git a/renderer/HardwareOpenGL.cpp b/renderer/HardwareOpenGL.cpp index 2e6a1600..8e68ddb3 100644 --- a/renderer/HardwareOpenGL.cpp +++ b/renderer/HardwareOpenGL.cpp @@ -25,7 +25,6 @@ #else #endif -#include "DDAccess.h" #include "pstypes.h" #include "pserror.h" #include "mono.h" diff --git a/win32/wincon.cpp b/win32/wincon.cpp index 6dbb54bc..abaec4c6 100644 --- a/win32/wincon.cpp +++ b/win32/wincon.cpp @@ -67,7 +67,6 @@ #include #include -#include "DDAccess.h" #include "Application.h" #include "AppConsole.h" #include "TaskSystem.h" diff --git a/win32/wintask.cpp b/win32/wintask.cpp index 90fc4370..b536b431 100644 --- a/win32/wintask.cpp +++ b/win32/wintask.cpp @@ -44,9 +44,6 @@ * $NoKeywords: $ */ -// Allow Full DD system access. -#include "DDAccess.h" - // Library includes #include "TaskSystem.h" #include "pserror.h"