Code cleanup
This commit is contained in:
Родитель
4a330bf5c9
Коммит
2b97f55618
|
@ -0,0 +1,68 @@
|
|||
# DirectX Capabilities Viewer
|
||||
#
|
||||
# Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
# Licensed under the MIT License.
|
||||
#
|
||||
# https://github.com/walbourn/dxcapsviewer
|
||||
|
||||
cmake_minimum_required (VERSION 3.11)
|
||||
|
||||
project (dxcapsviewer LANGUAGES CXX)
|
||||
|
||||
option(ENABLE_CODE_ANALYSIS "Use Static Code Analysis on build" ON)
|
||||
|
||||
set(CMAKE_CXX_STANDARD 14)
|
||||
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
||||
set(CMAKE_CXX_EXTENSIONS OFF)
|
||||
|
||||
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_SOURCE_DIR}/bin/CMake")
|
||||
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY "${CMAKE_SOURCE_DIR}/bin/CMake")
|
||||
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${CMAKE_SOURCE_DIR}/bin/CMake")
|
||||
|
||||
if(MSVC)
|
||||
# Use max Warning Level
|
||||
string(REPLACE "/W3 " "/W4 " CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS})
|
||||
string(REPLACE "/W3 " "/W4 " CMAKE_CXX_FLAGS_DEBUG ${CMAKE_CXX_FLAGS_DEBUG})
|
||||
string(REPLACE "/W3 " "/W4 " CMAKE_CXX_FLAGS_RELEASE ${CMAKE_CXX_FLAGS_RELEASE})
|
||||
|
||||
# Not using typeid or dynamic_cast, so disable RTTI to save binary size
|
||||
string(REPLACE "/GR " "/GR- " CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS})
|
||||
string(REPLACE "/GR " "/GR- " CMAKE_CXX_FLAGS_DEBUG ${CMAKE_CXX_FLAGS_DEBUG})
|
||||
string(REPLACE "/GR " "/GR- " CMAKE_CXX_FLAGS_RELEASE ${CMAKE_CXX_FLAGS_RELEASE})
|
||||
endif()
|
||||
|
||||
add_executable(${PROJECT_NAME} WIN32
|
||||
ddraw.cpp
|
||||
dxg.cpp
|
||||
dxgi.cpp
|
||||
dxprint.cpp
|
||||
dxview.h
|
||||
dxview.cpp
|
||||
resource.h
|
||||
dxview.rc)
|
||||
|
||||
target_link_libraries(${PROJECT_NAME} PRIVATE dxguid.lib comctl32.lib version.lib)
|
||||
|
||||
if ( CMAKE_CXX_COMPILER_ID MATCHES "Clang" )
|
||||
target_compile_options(${PROJECT_NAME} PRIVATE
|
||||
"-Wpedantic" "-Wextra"
|
||||
"-Wno-c++98-compat" "-Wno-c++98-compat-pedantic"
|
||||
"-Wno-language-extension-token" "-Wno-switch"
|
||||
"-Wno-missing-field-initializers")
|
||||
target_compile_options(${PROJECT_NAME} PRIVATE ${WarningsEXE})
|
||||
endif()
|
||||
if ( CMAKE_CXX_COMPILER_ID MATCHES "MSVC" )
|
||||
target_compile_options(${PROJECT_NAME} PRIVATE /permissive- /JMC- /Zc:__cplusplus)
|
||||
|
||||
if(ENABLE_CODE_ANALYSIS)
|
||||
target_compile_options(${PROJECT_NAME} PRIVATE /analyze)
|
||||
endif()
|
||||
|
||||
if (CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 19.26)
|
||||
target_compile_options(${PROJECT_NAME} PRIVATE /Zc:preprocessor /wd5105)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(WIN32)
|
||||
target_compile_definitions(${PROJECT_NAME} PRIVATE _MBCS _WIN32_WINNT=0x0601)
|
||||
endif()
|
|
@ -0,0 +1,76 @@
|
|||
{
|
||||
"configurations": [
|
||||
{
|
||||
"name": "x86-Clang-Debug",
|
||||
"generator": "Ninja",
|
||||
"configurationType": "Debug",
|
||||
"buildRoot": "${projectDir}\\out\\build\\${name}",
|
||||
"installRoot": "${projectDir}\\out\\install\\${name}",
|
||||
"cmakeCommandArgs": "",
|
||||
"buildCommandArgs": "-v",
|
||||
"ctestCommandArgs": "",
|
||||
"inheritEnvironments": [ "clang_cl_x86" ],
|
||||
"variables": []
|
||||
},
|
||||
{
|
||||
"name": "x86-Clang-Release",
|
||||
"generator": "Ninja",
|
||||
"configurationType": "RelWithDebInfo",
|
||||
"buildRoot": "${projectDir}\\out\\build\\${name}",
|
||||
"installRoot": "${projectDir}\\out\\install\\${name}",
|
||||
"cmakeCommandArgs": "",
|
||||
"buildCommandArgs": "-v",
|
||||
"ctestCommandArgs": "",
|
||||
"inheritEnvironments": [ "clang_cl_x86" ],
|
||||
"variables": []
|
||||
},
|
||||
{
|
||||
"name": "x64-Clang-Debug",
|
||||
"generator": "Ninja",
|
||||
"configurationType": "Debug",
|
||||
"buildRoot": "${projectDir}\\out\\build\\${name}",
|
||||
"installRoot": "${projectDir}\\out\\install\\${name}",
|
||||
"cmakeCommandArgs": "",
|
||||
"buildCommandArgs": "-v",
|
||||
"ctestCommandArgs": "",
|
||||
"inheritEnvironments": [ "clang_cl_x64" ],
|
||||
"variables": []
|
||||
},
|
||||
{
|
||||
"name": "x64-Clang-Release",
|
||||
"generator": "Ninja",
|
||||
"configurationType": "RelWithDebInfo",
|
||||
"buildRoot": "${projectDir}\\out\\build\\${name}",
|
||||
"installRoot": "${projectDir}\\out\\install\\${name}",
|
||||
"cmakeCommandArgs": "",
|
||||
"buildCommandArgs": "-v",
|
||||
"ctestCommandArgs": "",
|
||||
"inheritEnvironments": [ "clang_cl_x64" ],
|
||||
"variables": []
|
||||
},
|
||||
{
|
||||
"name": "x64-Debug",
|
||||
"generator": "Ninja",
|
||||
"configurationType": "Debug",
|
||||
"buildRoot": "${projectDir}\\out\\build\\${name}",
|
||||
"installRoot": "${projectDir}\\out\\install\\${name}",
|
||||
"cmakeCommandArgs": "",
|
||||
"buildCommandArgs": "-v",
|
||||
"ctestCommandArgs": "",
|
||||
"inheritEnvironments": [ "msvc_x64_x64" ],
|
||||
"variables": []
|
||||
},
|
||||
{
|
||||
"name": "x64-Release",
|
||||
"generator": "Ninja",
|
||||
"configurationType": "Release",
|
||||
"buildRoot": "${projectDir}\\out\\build\\${name}",
|
||||
"installRoot": "${projectDir}\\out\\install\\${name}",
|
||||
"cmakeCommandArgs": "",
|
||||
"buildCommandArgs": "-v",
|
||||
"ctestCommandArgs": "",
|
||||
"inheritEnvironments": [ "msvc_x64_x64" ],
|
||||
"variables": []
|
||||
}
|
||||
]
|
||||
}
|
1660
ddraw.cpp
1660
ddraw.cpp
Разница между файлами не показана из-за своего большого размера
Загрузить разницу
3097
dxg.cpp
3097
dxg.cpp
Разница между файлами не показана из-за своего большого размера
Загрузить разницу
9989
dxgi.cpp
9989
dxgi.cpp
Разница между файлами не показана из-за своего большого размера
Загрузить разницу
1220
dxprint.cpp
1220
dxprint.cpp
Разница между файлами не показана из-за своего большого размера
Загрузить разницу
1506
dxview.cpp
1506
dxview.cpp
Разница между файлами не показана из-за своего большого размера
Загрузить разницу
47
dxview.h
47
dxview.h
|
@ -1,24 +1,19 @@
|
|||
//-----------------------------------------------------------------------------
|
||||
// Name: DXView.h
|
||||
//
|
||||
// Desc: DirectX Device Viewer - Common header file
|
||||
// Desc: DirectX Capabilities Viewer Common Header
|
||||
//
|
||||
//@@BEGIN_MSINTERNAL
|
||||
//
|
||||
// Hist: 05.24.99 - mwetzel - I didn't write this, I'm just cleaning it up, so
|
||||
// don't complain to me how horrid this app is.
|
||||
//
|
||||
//@@END_MSINTERNAL
|
||||
// Copyright (c) Microsoft Corporation. All Rights Reserved.
|
||||
//-----------------------------------------------------------------------------
|
||||
#include <windows.h>
|
||||
#include <Windows.h>
|
||||
#include <mmsystem.h>
|
||||
#include <commctrl.h>
|
||||
#include <tchar.h>
|
||||
#include <time.h>
|
||||
#include "resource.h"
|
||||
#include <stdio.h>
|
||||
|
||||
#include "resource.h"
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Defines
|
||||
//-----------------------------------------------------------------------------
|
||||
|
@ -34,7 +29,7 @@
|
|||
|
||||
#define TIMER_PERIOD 500
|
||||
|
||||
|
||||
#define SAFE_RELEASE(p) { if (p) { (p)->Release(); (p)=nullptr; } }
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
@ -54,8 +49,8 @@ struct PRINTCBINFO
|
|||
BOOL fStartPage; // In/Out: need to a start new page ?!?
|
||||
};
|
||||
|
||||
typedef HRESULT (*DISPLAYCALLBACK)( LPARAM lParam1, LPARAM lParam2, PRINTCBINFO* pPrintInfo );
|
||||
typedef HRESULT (*DISPLAYCALLBACKEX)( LPARAM lParam1, LPARAM lParam2, LPARAM lParam3, PRINTCBINFO* pPrintInfo );
|
||||
using DISPLAYCALLBACK = HRESULT(*)(LPARAM lParam1, LPARAM lParam2, _In_opt_ PRINTCBINFO* pPrintInfo);
|
||||
using DISPLAYCALLBACKEX = HRESULT(*)(LPARAM lParam1, LPARAM lParam2, LPARAM lParam3, _In_opt_ PRINTCBINFO* pPrintInfo);
|
||||
|
||||
struct NODEINFO
|
||||
{
|
||||
|
@ -70,17 +65,17 @@ struct NODEINFO
|
|||
|
||||
struct CAPDEF
|
||||
{
|
||||
CHAR* strName; // Name of cap
|
||||
DWORD dwOffset; // Offset to cap
|
||||
DWORD dwFlag; // Bit flag for cal
|
||||
DWORD dwCapsFlags; // used for optional caps and such (see DXV_ values above)
|
||||
const CHAR* strName; // Name of cap
|
||||
LONG dwOffset; // Offset to cap
|
||||
DWORD dwFlag; // Bit flag for cal
|
||||
DWORD dwCapsFlags; // used for optional caps and such (see DXV_ values above)
|
||||
};
|
||||
|
||||
struct CAPDEFS
|
||||
{
|
||||
CHAR* strName; // Name of cap
|
||||
DISPLAYCALLBACK fnDisplayCallback;
|
||||
LPARAM lParam2;
|
||||
const CHAR* strName; // Name of cap
|
||||
DISPLAYCALLBACK fnDisplayCallback;
|
||||
LPARAM lParam2;
|
||||
};
|
||||
|
||||
|
||||
|
@ -116,15 +111,15 @@ VOID AddCapsToTV( HTREEITEM hParent, CAPDEFS *pcds, LPARAM lParam1 );
|
|||
VOID AddColsToLV();
|
||||
VOID AddCapsToLV( CAPDEF* pcd, VOID* pv );
|
||||
VOID AddMoreCapsToLV( CAPDEF* pcd, VOID* pv );
|
||||
HRESULT PrintCapsToDC( CAPDEF* pcd, VOID* pv, PRINTCBINFO* pInfo );
|
||||
HRESULT PrintCapsToDC( CAPDEF* pcd, VOID* pv, _In_ PRINTCBINFO* pInfo );
|
||||
|
||||
// Printer Helper functions
|
||||
HRESULT PrintStartPage( PRINTCBINFO* pci );
|
||||
HRESULT PrintEndPage( PRINTCBINFO* pci );
|
||||
HRESULT PrintLine( int x, int y, LPCTSTR lpszBuff, DWORD cchBuff, PRINTCBINFO* pci );
|
||||
HRESULT PrintNextLine( PRINTCBINFO* pci );
|
||||
|
||||
|
||||
HRESULT PrintLine(int x, int y, _In_count_(cchBuff) LPCTSTR lpszBuff, size_t cchBuff, _In_ PRINTCBINFO* pci);
|
||||
HRESULT PrintNextLine(_In_ PRINTCBINFO* pci );
|
||||
HRESULT PrintValueLine(_In_z_ const char* szText, DWORD dwValue, _In_ PRINTCBINFO* lpInfo);
|
||||
HRESULT PrintHexValueLine(_In_z_ const CHAR* szText, DWORD dwValue, _In_ PRINTCBINFO* lpInfo);
|
||||
HRESULT PrintStringValueLine(_In_z_ const CHAR* szText, const CHAR* szText2, _In_ PRINTCBINFO* lpInfo);
|
||||
HRESULT PrintStringLine(_In_z_ const CHAR* szText, _In_ PRINTCBINFO* lpInfo);
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
|
83
dxview.rc
83
dxview.rc
|
@ -1,5 +1,6 @@
|
|||
//Microsoft Developer Studio generated resource script.
|
||||
// Microsoft Visual C++ generated resource script.
|
||||
//
|
||||
|
||||
#include "resource.h"
|
||||
|
||||
#define APSTUDIO_READONLY_SYMBOLS
|
||||
|
@ -8,27 +9,18 @@
|
|||
// Generated from the TEXTINCLUDE 2 resource.
|
||||
//
|
||||
#include <winresrc.h>
|
||||
#include <verinfo.h>
|
||||
|
||||
#define VERSIONTYPE VFT_APP
|
||||
#define VERSIONSUBTYPE VFT2_UNKNOWN
|
||||
#define VERSIONDESCRIPTION "Microsoft DirectX Caps Viewer\0"
|
||||
#define VERSIONNAME "dxcapsviewer.exe\0"
|
||||
#include <verinfo.ver>
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
#undef APSTUDIO_READONLY_SYMBOLS
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// English (U.S.) resources
|
||||
// English (United States) resources
|
||||
|
||||
#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)
|
||||
#ifdef _WIN32
|
||||
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
|
||||
#pragma code_page(1252)
|
||||
#endif //_WIN32
|
||||
|
||||
CREATEPROCESS_MANIFEST_RESOURCE_ID RT_MANIFEST "DxCapsViewer.manifest"
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
|
@ -55,8 +47,6 @@ BEGIN
|
|||
END
|
||||
POPUP "&Help"
|
||||
BEGIN
|
||||
MENUITEM "&Help", IDM_HELP
|
||||
MENUITEM SEPARATOR
|
||||
MENUITEM "&About", IDM_ABOUT
|
||||
END
|
||||
END
|
||||
|
@ -120,28 +110,24 @@ IDC_SPLIT CURSOR DISCARDABLE "Split.cur"
|
|||
// TEXTINCLUDE
|
||||
//
|
||||
|
||||
1 TEXTINCLUDE DISCARDABLE
|
||||
1 TEXTINCLUDE
|
||||
BEGIN
|
||||
"resource.h\0"
|
||||
"resource.h\0"
|
||||
END
|
||||
|
||||
2 TEXTINCLUDE DISCARDABLE
|
||||
2 TEXTINCLUDE
|
||||
BEGIN
|
||||
"#include <winresrc.h>\r\n"
|
||||
"#define IDC_STATIC -1\r\n"
|
||||
"#include ""verinfo.h""\r\n"
|
||||
"#define VERSIONNAME ""dxcapsviewer.exe\\0""\r\n"
|
||||
"#define VERSIONDESCRIPTION ""Microsoft DirectX Caps Viewer\\0""\r\n"
|
||||
"#define VERSIONTYPE VFT_APP\r\n"
|
||||
"#define VERSIONSUBTYPE VFT2_UNKNOWN\r\n"
|
||||
"#include ""verinfo.ver""\r\n"
|
||||
"\0"
|
||||
"#define IDC_STATIC -1\r\n"
|
||||
"#include <winresrc.h>\r\n"
|
||||
"\r\n"
|
||||
"\r\n"
|
||||
"\0"
|
||||
END
|
||||
|
||||
3 TEXTINCLUDE DISCARDABLE
|
||||
3 TEXTINCLUDE
|
||||
BEGIN
|
||||
"\r\n"
|
||||
"\0"
|
||||
"\r\n"
|
||||
"\0"
|
||||
END
|
||||
|
||||
#endif // APSTUDIO_INVOKED
|
||||
|
@ -159,6 +145,45 @@ BEGIN
|
|||
IDS_PRINT_NOROOT "Unable to print, DX View Tree not properly set up."
|
||||
END
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Version
|
||||
//
|
||||
|
||||
VS_VERSION_INFO VERSIONINFO
|
||||
FILEVERSION 1, 0, 0, 0
|
||||
PRODUCTVERSION 1, 0, 0, 0
|
||||
FILEFLAGSMASK 0x3fL
|
||||
#ifdef _DEBUG
|
||||
FILEFLAGS 0x1L
|
||||
#else
|
||||
FILEFLAGS 0x0L
|
||||
#endif
|
||||
FILEOS 0x40004L
|
||||
FILETYPE 0x1L
|
||||
FILESUBTYPE 0x0L
|
||||
BEGIN
|
||||
BLOCK "StringFileInfo"
|
||||
BEGIN
|
||||
BLOCK "040904b0"
|
||||
BEGIN
|
||||
VALUE "CompanyName", "Microsoft Corp"
|
||||
VALUE "FileDescription", "Microsoft DirectX Caps Viewer"
|
||||
VALUE "FileVersion", "1.0.0.0"
|
||||
VALUE "InternalName", "dxcapsviewer.exe"
|
||||
VALUE "LegalCopyright", "Copyright (c) Microsoft Corp."
|
||||
VALUE "OriginalFilename", "dxcapsviewer.exe"
|
||||
VALUE "ProductName", "Microsoft DirectX Caps Viewer"
|
||||
VALUE "ProductVersion", "1.0.0.0"
|
||||
END
|
||||
END
|
||||
BLOCK "VarFileInfo"
|
||||
BEGIN
|
||||
VALUE "Translation", 0x409, 1200
|
||||
END
|
||||
END
|
||||
|
||||
#endif // English (U.S.) resources
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
|
|
@ -23,7 +23,6 @@
|
|||
#define IDM_PRINTSUBTREETOFILE 40008
|
||||
#define IDM_COPY 40009
|
||||
#define IDM_VIEW9EX 40010
|
||||
#define IDM_HELP 40011
|
||||
|
||||
// Next default values for new objects
|
||||
//
|
||||
|
|
Загрузка…
Ссылка в новой задаче