mirror of
https://github.com/dege-diosg/dgVoodoo2
synced 2024-07-08 20:51:02 +02:00
Adding the current version of dgVoodooAPI
This commit is contained in:
parent
d5fed0221a
commit
bb4fc18bab
BIN
dgVoodooAPI/Bin/Release/dgVoodooAPI.dll
Normal file
BIN
dgVoodooAPI/Bin/Release/dgVoodooAPI.dll
Normal file
Binary file not shown.
BIN
dgVoodooAPI/Bin/Spec Release/dgVoodooAPI.dll
Normal file
BIN
dgVoodooAPI/Bin/Spec Release/dgVoodooAPI.dll
Normal file
Binary file not shown.
BIN
dgVoodooAPI/Doc/dgVoodooAPI.chm
Normal file
BIN
dgVoodooAPI/Doc/dgVoodooAPI.chm
Normal file
Binary file not shown.
106
dgVoodooAPI/Inc/APIDebugObj.hpp
Normal file
106
dgVoodooAPI/Inc/APIDebugObj.hpp
Normal file
@ -0,0 +1,106 @@
|
||||
// *****************************************************************************
|
||||
// File: APIDebugObj.hpp
|
||||
//
|
||||
// Description: Debug object for logging and debugging
|
||||
//
|
||||
// Contact person: DG
|
||||
//
|
||||
// *****************************************************************************
|
||||
|
||||
#ifndef APIDEBUGOBJ_HPP
|
||||
#define APIDEBUGOBJ_HPP
|
||||
|
||||
// --- Includes ----------------------------------------------------------------
|
||||
|
||||
#include "APITypes.h"
|
||||
|
||||
// --- Predeclarations ---------------------------------------------------------
|
||||
|
||||
namespace dgVoodoo {
|
||||
|
||||
class IAPIDataStream;
|
||||
|
||||
|
||||
// --- Debug -------------------------------------------------------------------
|
||||
|
||||
struct APIDebugObj
|
||||
{
|
||||
enum InfoLevel
|
||||
{
|
||||
DisableInfo = 0,
|
||||
EnableInfo,
|
||||
EnableInfoAndBreak
|
||||
};
|
||||
|
||||
enum WarningLevel
|
||||
{
|
||||
DisableWarning = 0,
|
||||
EnableWarning,
|
||||
EnableWarningAndBreak
|
||||
};
|
||||
|
||||
enum ErrorLevel
|
||||
{
|
||||
DisableError = 0,
|
||||
EnableError,
|
||||
EnableErrorAndBreak
|
||||
};
|
||||
|
||||
InfoLevel infoLevel;
|
||||
WarningLevel warningLevel;
|
||||
ErrorLevel errorLevel;
|
||||
const char* pPrefixString;
|
||||
UInt32 maxTraceLevel;
|
||||
IAPIDataStream* pOutputStream;
|
||||
|
||||
InfoLevel inline GetInfoLevel () const
|
||||
{
|
||||
return infoLevel;
|
||||
}
|
||||
|
||||
|
||||
WarningLevel inline GetWarningLevel () const
|
||||
{
|
||||
return warningLevel;
|
||||
}
|
||||
|
||||
|
||||
ErrorLevel inline GetErrorLevel () const
|
||||
{
|
||||
return errorLevel;
|
||||
}
|
||||
|
||||
|
||||
UInt32 inline GetMaxTraceLevel () const
|
||||
{
|
||||
return maxTraceLevel;
|
||||
}
|
||||
|
||||
|
||||
void inline SetDebugInfo (InfoLevel _infoLevel, WarningLevel _warningLevel, ErrorLevel _errorLevel,
|
||||
const char* _pPrefixString, UInt32 _maxTraceLevel, IAPIDataStream* _pOutputStream = NULL)
|
||||
{
|
||||
infoLevel = _infoLevel;
|
||||
warningLevel = _warningLevel;
|
||||
errorLevel = _errorLevel;
|
||||
pPrefixString = _pPrefixString;
|
||||
maxTraceLevel = _maxTraceLevel;
|
||||
pOutputStream = _pOutputStream;
|
||||
}
|
||||
|
||||
|
||||
APIDebugObj (InfoLevel _infoLevel, WarningLevel _warningLevel, ErrorLevel _errorLevel,
|
||||
const char* _pPrefixString, UInt32 _maxTraceLevel, IAPIDataStream* _pOutputStream = NULL):
|
||||
infoLevel (_infoLevel),
|
||||
warningLevel (_warningLevel),
|
||||
errorLevel (_errorLevel),
|
||||
pPrefixString (_pPrefixString),
|
||||
maxTraceLevel (_maxTraceLevel),
|
||||
pOutputStream (_pOutputStream)
|
||||
{
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace dgVoodoo
|
||||
|
||||
#endif // !APIDEBUGOBJ_HPP
|
31
dgVoodooAPI/Inc/APIObject.hpp
Normal file
31
dgVoodooAPI/Inc/APIObject.hpp
Normal file
@ -0,0 +1,31 @@
|
||||
// *****************************************************************************
|
||||
// File: APIObject.hpp
|
||||
//
|
||||
// Description: Base interface for objects created by dgVoodoo
|
||||
//
|
||||
// Contact person: DG
|
||||
//
|
||||
// *****************************************************************************
|
||||
|
||||
#ifndef APIOBJECT_HPP
|
||||
#define APIOBJECT_HPP
|
||||
|
||||
// --- Includes ----------------------------------------------------------------
|
||||
|
||||
#include "APITypes.h"
|
||||
|
||||
namespace dgVoodoo {
|
||||
|
||||
// --- APIObject ---------------------------------------------------------------
|
||||
|
||||
class APIObject
|
||||
{
|
||||
public:
|
||||
virtual ~APIObject () {}
|
||||
|
||||
virtual void Release ();
|
||||
};
|
||||
|
||||
} // namespace dgVoodoo
|
||||
|
||||
#endif // APIOBJECT_HPP
|
45
dgVoodooAPI/Inc/APITypes.h
Normal file
45
dgVoodooAPI/Inc/APITypes.h
Normal file
@ -0,0 +1,45 @@
|
||||
// *****************************************************************************
|
||||
// File: APITypes.hpp
|
||||
//
|
||||
// Description: Definitions of basic types
|
||||
//
|
||||
// Contact person: DG
|
||||
//
|
||||
// *****************************************************************************
|
||||
|
||||
#pragma once
|
||||
|
||||
// --- Typedefs ----------------------------------------------------------------
|
||||
|
||||
typedef unsigned __int64 UInt64;
|
||||
typedef unsigned int UInt32;
|
||||
typedef int Int32;
|
||||
typedef unsigned short UInt16;
|
||||
typedef short Int16;
|
||||
typedef unsigned char UInt8;
|
||||
typedef unsigned char Byte;
|
||||
typedef char Int8;
|
||||
|
||||
#if defined(_WIN64)
|
||||
|
||||
typedef unsigned __int64 UIntPtr;
|
||||
|
||||
#else
|
||||
|
||||
typedef unsigned int UIntPtr;
|
||||
|
||||
#endif
|
||||
|
||||
// --- Defines -----------------------------------------------------------------
|
||||
|
||||
#define NULL 0
|
||||
|
||||
#ifdef _APIDLL
|
||||
|
||||
#define API_EXPORT __declspec( dllexport )
|
||||
|
||||
#else
|
||||
|
||||
#define API_EXPORT
|
||||
|
||||
#endif // _APIDLL
|
48
dgVoodooAPI/Inc/IAPIDataStream.hpp
Normal file
48
dgVoodooAPI/Inc/IAPIDataStream.hpp
Normal file
@ -0,0 +1,48 @@
|
||||
// *****************************************************************************
|
||||
// File: IAPIDataStream.hpp
|
||||
//
|
||||
// Description: Interface for seekable data streams
|
||||
//
|
||||
// Contact person: DG
|
||||
//
|
||||
// *****************************************************************************
|
||||
|
||||
#ifndef IAPIDATASTREAM_HPP
|
||||
#define IAPIDATASTREAM_HPP
|
||||
|
||||
// --- Includes-----------------------------------------------------------------
|
||||
|
||||
#include "APITypes.h"
|
||||
|
||||
namespace dgVoodoo {
|
||||
|
||||
// --- IDataStream -------------------------------------------------------------
|
||||
|
||||
class IAPIDataStream
|
||||
{
|
||||
public:
|
||||
|
||||
enum Origin
|
||||
{
|
||||
OSet = 0,
|
||||
OCurr,
|
||||
OEnd
|
||||
};
|
||||
|
||||
enum Status
|
||||
{
|
||||
StatusOk = 0,
|
||||
StatusError
|
||||
};
|
||||
|
||||
public:
|
||||
virtual Status Seek (Int32 move, Origin origin, UInt32* newPos = NULL) const = 0;
|
||||
virtual Status Read (UInt32 count, void* buffer, UInt32* readBytes = NULL) const = 0;
|
||||
virtual Status Write (UInt32 count, void* buffer, UInt32* writtenBytes = NULL) const = 0;
|
||||
virtual UInt32 GetSize () const = 0;
|
||||
};
|
||||
|
||||
|
||||
} // namespace dgVoodoo
|
||||
|
||||
#endif // !IAPIDATASTREAM_HPP
|
108
dgVoodooAPI/Inc/ICPLDDI.hpp
Normal file
108
dgVoodooAPI/Inc/ICPLDDI.hpp
Normal file
@ -0,0 +1,108 @@
|
||||
// *****************************************************************************
|
||||
// File: ICPLDDI.hpp
|
||||
//
|
||||
// Description: dgVoodoo CPL DDI interface for getting API/adapter/output
|
||||
// information
|
||||
//
|
||||
// Contact person: DG
|
||||
//
|
||||
// *****************************************************************************
|
||||
|
||||
#ifndef ICPLDDI_HPP
|
||||
#define ICPLDDI_HPP
|
||||
|
||||
// --- Includes ----------------------------------------------------------------
|
||||
|
||||
#include "dgVoodooConfig.hpp"
|
||||
#include "APIDebugObj.hpp"
|
||||
#include <Windows.h>
|
||||
|
||||
namespace dgVoodoo {
|
||||
|
||||
// --- ICPLDDI -----------------------------------------------------------------
|
||||
|
||||
class ICPLDDI
|
||||
{
|
||||
public:
|
||||
|
||||
enum APIType
|
||||
{
|
||||
AT_Unknown = 0,
|
||||
AT_D3D11,
|
||||
AT_D3D12
|
||||
};
|
||||
|
||||
enum FeatureLevel
|
||||
{
|
||||
FL_Unknown = 0,
|
||||
FL_D3D10_0,
|
||||
FL_D3D10_1,
|
||||
FL_D3D11_0,
|
||||
FL_D3D11_1,
|
||||
FL_D3D12_0,
|
||||
FL_D3D12_1,
|
||||
};
|
||||
|
||||
|
||||
struct OutputDesc
|
||||
{
|
||||
WCHAR name[32];
|
||||
WCHAR desc[128];
|
||||
HMONITOR hMonitor;
|
||||
};
|
||||
|
||||
|
||||
struct ModeDesc
|
||||
{
|
||||
UInt32 xRes;
|
||||
UInt32 yRes;
|
||||
UInt32 refreshRateNumerator;
|
||||
UInt32 refreshRateDenominator;
|
||||
UInt32 refreshRateSimple;
|
||||
|
||||
ModeDesc ():
|
||||
xRes (0),
|
||||
yRes (0),
|
||||
refreshRateNumerator (0),
|
||||
refreshRateDenominator (0),
|
||||
refreshRateSimple (0)
|
||||
{
|
||||
}
|
||||
};
|
||||
|
||||
protected:
|
||||
const APIDebugObj* pDebug;
|
||||
|
||||
public:
|
||||
|
||||
void inline SetDebugObject (const APIDebugObj* _pDebug) { pDebug = _pDebug; }
|
||||
|
||||
virtual const char* GetAPIName () = 0;
|
||||
virtual ConfigGeneral::RendererAPI GetAPI () = 0;
|
||||
virtual APIType GetAPIType () = 0;
|
||||
|
||||
virtual bool Activate () = 0;
|
||||
virtual void Deactivate () = 0;
|
||||
|
||||
virtual UInt32 GetNumberOfAdapters () = 0;
|
||||
virtual bool GetAdapterName (UInt32 adapterIdx, WCHAR* pName) = 0;
|
||||
virtual bool IsAdapterSoftware (UInt32 adapterIdx) = 0;
|
||||
|
||||
virtual UInt32 GetNumberOfOutputs (UInt32 adapterIdx) = 0;
|
||||
virtual bool GetOutputDesc (UInt32 adapterIdx, UInt32 outputIdx, OutputDesc* pDesc) = 0;
|
||||
|
||||
virtual UInt32 GetNumberOfMSAALevels (UInt32 adapterIdx) = 0;
|
||||
virtual UInt32 GetMSAALevel (UInt32 adapterIdx, UInt32 idx) = 0;
|
||||
|
||||
virtual UInt32 GetNumberOfResolutions (UInt32 adapterIdx, UInt32 outputIndex,
|
||||
ConfigGeneral::ScanlineOrder scanlineOrder) = 0;
|
||||
virtual bool GetResolution (UInt32 adapterIdx, UInt32 outputIdx, ConfigGeneral::ScanlineOrder scanlineOrder,
|
||||
UInt32 resIdx, ModeDesc* pDesc) = 0;
|
||||
|
||||
virtual UInt32 GetRefreshRateSimple (UInt32 refRateNumerator, UInt32 refRateDenominator) = 0;
|
||||
};
|
||||
|
||||
|
||||
} // namespace dgVoodoo
|
||||
|
||||
#endif // ICPLDDI_HPP
|
47
dgVoodooAPI/Inc/IConfig.hpp
Normal file
47
dgVoodooAPI/Inc/IConfig.hpp
Normal file
@ -0,0 +1,47 @@
|
||||
// *****************************************************************************
|
||||
// File: IConfig.hpp
|
||||
//
|
||||
// Description: dgVoodoo Config functionality interface
|
||||
//
|
||||
// Contact person: DG
|
||||
//
|
||||
// *****************************************************************************
|
||||
|
||||
#ifndef ICONFIG_HPP
|
||||
#define ICONFIG_HPP
|
||||
|
||||
// --- Includes ----------------------------------------------------------------
|
||||
|
||||
#include "APITypes.h"
|
||||
#include "dgVoodooConfig.hpp"
|
||||
#include "APIDebugObj.hpp"
|
||||
|
||||
namespace dgVoodoo {
|
||||
|
||||
// --- IConfig -----------------------------------------------------------------
|
||||
|
||||
class IConfig
|
||||
{
|
||||
|
||||
public:
|
||||
virtual bool ReadConfig (Config& toConfig, const char* pFileName, const APIDebugObj* pDebug = NULL) = 0;
|
||||
virtual bool ReadConfig (Config& toConfig, const wchar_t* pFileName, const APIDebugObj* pDebug = NULL) = 0;
|
||||
virtual bool ReadConfig (Config& toConfig, HANDLE hFile, const APIDebugObj* pDebug = NULL) = 0;
|
||||
virtual bool ReadConfig (Config& toConfig, IAPIDataStream* pFromStream, const APIDebugObj* pDebug = NULL) = 0;
|
||||
|
||||
virtual bool WriteConfig (const Config& fromConfig, const char* pFileName, const char* pINITemplate = NULL, const APIDebugObj* pDebug = NULL) = 0;
|
||||
virtual bool WriteConfig (const Config& fromConfig, const wchar_t* pFileName, const char* pINITemplate = NULL, const APIDebugObj* pDebug = NULL) = 0;
|
||||
virtual bool WriteConfig (const Config& fromConfig, HANDLE hFile, const char* pINITemplate = NULL, const APIDebugObj* pDebug = NULL) = 0;
|
||||
virtual bool WriteConfig (const Config& fromConfig, IAPIDataStream* pToStream, const char* pINITemplate = NULL, const APIDebugObj* pDebug = NULL) = 0;
|
||||
|
||||
virtual bool ValidateConfig (const Config& config, const APIDebugObj* pDebug = NULL) = 0;
|
||||
virtual const char* GetINITemplate () = 0;
|
||||
|
||||
virtual bool IsResolutionTypeDynamic (UInt32 width, UInt32 height) = 0;
|
||||
};
|
||||
|
||||
|
||||
} // namespace dgVoodoo
|
||||
|
||||
|
||||
#endif // ICONFIG_HPP
|
66
dgVoodooAPI/Inc/IIniParser.hpp
Normal file
66
dgVoodooAPI/Inc/IIniParser.hpp
Normal file
@ -0,0 +1,66 @@
|
||||
// *****************************************************************************
|
||||
// File: IIniParser.hpp
|
||||
//
|
||||
// Description: Ini file parser interface
|
||||
//
|
||||
// Contact person: DG
|
||||
//
|
||||
// *****************************************************************************
|
||||
|
||||
#ifndef IINIPARSER_HPP
|
||||
#define IINIPARSER_HPP
|
||||
|
||||
// --- Includes ----------------------------------------------------------------
|
||||
|
||||
#include "APIObject.hpp"
|
||||
|
||||
namespace dgVoodoo {
|
||||
|
||||
// --- Predeclarations ---------------------------------------------------------
|
||||
|
||||
class IAPIDataStream;
|
||||
|
||||
// --- IIniParser --------------------------------------------------------------
|
||||
|
||||
class IIniParser: public APIObject
|
||||
{
|
||||
public:
|
||||
enum StringType
|
||||
{
|
||||
CaseSensitive = 0,
|
||||
LowerCase,
|
||||
UpperCase
|
||||
};
|
||||
|
||||
public:
|
||||
virtual ~IIniParser () {}
|
||||
|
||||
virtual bool Parse (const char* pFileName, StringType stringType) = 0;
|
||||
virtual bool Parse (const wchar_t* pFileName, StringType stringType) = 0;
|
||||
virtual bool Parse (IAPIDataStream* pStream, StringType stringType) = 0;
|
||||
|
||||
virtual UInt32 GetNumberOfSections () const = 0;
|
||||
virtual const char* GetSectionName (UInt32 sectionIdx) const = 0;
|
||||
|
||||
virtual UInt32 GetNumberOfProperties (UInt32 sectionIdx) const = 0;
|
||||
virtual const char* GetPropertyName (UInt32 sectionIdx, UInt32 propertyIdx) const = 0;
|
||||
|
||||
virtual UInt32 GetNumberOfPropertyValues (UInt32 sectionIdx, UInt32 propertyIdx) const = 0;
|
||||
virtual const char* GetPropertyValueAsString (UInt32 sectionIdx, UInt32 propertyIdx, UInt32 valueIdx) const = 0;
|
||||
virtual bool GetPropertyValueAsInt (UInt32 sectionIdx, UInt32 propertyIdx, UInt32 valueIdx, Int32& value) const = 0;
|
||||
//virtual bool GetPropertyValueAsFloat (UInt32 sectionIdx, UInt32 propertyIdx, UInt32 valueIdx, float& value) const = 0;
|
||||
|
||||
virtual UInt32 GetNumberOfSubProperties (UInt32 sectionIdx, UInt32 propertyIdx) const = 0;
|
||||
virtual const char* GetSubPropertyName (UInt32 sectionIdx, UInt32 propertyIdx, UInt32 subPropertyIdx) const = 0;
|
||||
virtual const char* GetSubPropertyValueAsString (UInt32 sectionIdx, UInt32 propertyIdx, UInt32 subPropertyIdx) const = 0;
|
||||
virtual bool GetSubPropertyValueAsInt (UInt32 sectionIdx, UInt32 propertyIdx, UInt32 subPropertyIdx, Int32& value) const = 0;
|
||||
//virtual bool GetSubPropertyValueAsFloat (UInt32 sectionIdx, UInt32 propertyIdx, UInt32 subPropertyIdx, float& value) const = 0;
|
||||
|
||||
// Debug version only functions
|
||||
|
||||
virtual void DbgDump () = 0;
|
||||
};
|
||||
|
||||
} // namespace dgVoodoo
|
||||
|
||||
#endif // !IINIPARSER_HPP
|
39
dgVoodooAPI/Inc/IMainFactory.hpp
Normal file
39
dgVoodooAPI/Inc/IMainFactory.hpp
Normal file
@ -0,0 +1,39 @@
|
||||
// *****************************************************************************
|
||||
// File: IMainFactory.hpp
|
||||
//
|
||||
// Description: dgVoodoo Main Factory interface
|
||||
//
|
||||
// Contact person: DG
|
||||
//
|
||||
// *****************************************************************************
|
||||
|
||||
// --- Includes ----------------------------------------------------------------
|
||||
|
||||
#include "APITypes.h"
|
||||
#include "ICPLDDI.hpp"
|
||||
#include "IConfig.hpp"
|
||||
#include "IIniParser.hpp"
|
||||
|
||||
using namespace dgVoodoo;
|
||||
|
||||
// --- Factory interface -------------------------------------------------------
|
||||
|
||||
class IMainFactory
|
||||
{
|
||||
public:
|
||||
|
||||
virtual ICPLDDI* GetCPLDDIObject (ConfigGeneral::RendererAPI api, const APIDebugObj* pDebug = NULL) = 0;
|
||||
virtual IConfig* GetIConfig () = 0;
|
||||
virtual IIniParser* CreateIniParser (const APIDebugObj* pDebug = NULL) = 0;
|
||||
};
|
||||
|
||||
|
||||
// --- Functions ---------------------------------------------------------------
|
||||
|
||||
extern "C" {
|
||||
|
||||
IMainFactory API_EXPORT * dgVoodoo_API_Init ();
|
||||
void API_EXPORT dgVoodoo_API_Exit ();
|
||||
UInt32 API_EXPORT dgVoodoo_API_GetVersion ();
|
||||
|
||||
}
|
565
dgVoodooAPI/Inc/dgVoodooConfig.hpp
Normal file
565
dgVoodooAPI/Inc/dgVoodooConfig.hpp
Normal file
@ -0,0 +1,565 @@
|
||||
// *****************************************************************************
|
||||
// File: dgVoodooConfig.hpp
|
||||
//
|
||||
// Description: dgVoodoo configuration
|
||||
//
|
||||
// Contact person: DG
|
||||
//
|
||||
// *****************************************************************************
|
||||
|
||||
#ifndef DGVOODOOCONFIG_HPP
|
||||
#define DGVOODOOCONFIG_HPP
|
||||
|
||||
// --- Includes ----------------------------------------------------------------
|
||||
|
||||
#include "APITypes.h"
|
||||
#include "string.h"
|
||||
|
||||
// --- Defines -----------------------------------------------------------------
|
||||
|
||||
#define MAX_NUM_OF_DX_EXTRA_RESOLUTIONS 16
|
||||
|
||||
// --- Predeclarations ---------------------------------------------------------
|
||||
|
||||
typedef void * HANDLE;
|
||||
|
||||
namespace dgVoodoo {
|
||||
|
||||
class IAPIDataStream;
|
||||
|
||||
// --- Config structures -------------------------------------------------------
|
||||
|
||||
#pragma pack(push)
|
||||
#pragma pack(1)
|
||||
|
||||
// --- General -----------------------------------------------------------------
|
||||
|
||||
struct ConfigGeneral
|
||||
{
|
||||
enum RendererAPI
|
||||
{
|
||||
API_BestAvailable = 0,
|
||||
API_Direct3D11_FL10_0,
|
||||
API_Direct3D11_FL10_1,
|
||||
API_Direct3D11_MS_WARP_FL10_1,
|
||||
API_Direct3D11_FL11_0,
|
||||
API_Direct3D12_FL11_0,
|
||||
API_Direct3D12_FL12_0,
|
||||
|
||||
NumOfAPITypes
|
||||
};
|
||||
|
||||
|
||||
enum Adapter
|
||||
{
|
||||
AdapterAll = 0
|
||||
};
|
||||
|
||||
|
||||
enum ScanlineOrder
|
||||
{
|
||||
SO_OutputDefault = 0,
|
||||
SO_Progressive,
|
||||
SO_Undefined,
|
||||
|
||||
NumOfScanlineOrders
|
||||
};
|
||||
|
||||
|
||||
enum ScalingMode
|
||||
{
|
||||
SM_Unspecified = 0,
|
||||
SM_Centered,
|
||||
SM_Stretched,
|
||||
SM_AspectRatio,
|
||||
SM_AspectRatio4_3,
|
||||
SM_AspectRatio4_3_CRTLike,
|
||||
SM_AspectRatio4_3_C64Like,
|
||||
SM_CenteredAspectRatio,
|
||||
|
||||
NumOfScalingModes
|
||||
};
|
||||
|
||||
|
||||
enum Resolution
|
||||
{
|
||||
R_Unforced = 0,
|
||||
R_Max = 0xFFFFFFFF, // It can have a parameter, the aspect ratio
|
||||
R_Max_ISF = 0xFFFFFFFE,
|
||||
R_MaxFHD = 0xFFFFFFFD,
|
||||
R_MaxFHD_ISF = 0xFFFFFFFC,
|
||||
R_MaxQHD = 0xFFFFFFFB,
|
||||
R_MaxQHD_ISF = 0xFFFFFFFA,
|
||||
R_IntegerScaled = 0xFFFFFFF9, // It has the integer scale value as a parameter
|
||||
|
||||
// Optional parameters for R_Max
|
||||
|
||||
PR_Max_4_3 = 0x100,
|
||||
PR_Max_16_9 = 0x101
|
||||
};
|
||||
|
||||
RendererAPI rendererAPI;
|
||||
UInt32 rendererDevice; // AdapterAll or adapter ordinal
|
||||
UInt32 renderingOutput; // 0 == default
|
||||
UInt32 brightnessScale;
|
||||
UInt32 colorScale;
|
||||
UInt32 contrastScale;
|
||||
ScanlineOrder scanlineOrder;
|
||||
ScalingMode scalingMode;
|
||||
bool windowed;
|
||||
bool keepApectRatio;
|
||||
bool enumerateRefreshRates;
|
||||
bool captureMouse;
|
||||
bool centerAppWindow;
|
||||
bool inheritColorProfile;
|
||||
|
||||
ConfigGeneral ():
|
||||
rendererAPI (API_BestAvailable),
|
||||
rendererDevice (0),
|
||||
renderingOutput (0),
|
||||
brightnessScale (100),
|
||||
colorScale (100),
|
||||
contrastScale (100),
|
||||
scanlineOrder (SO_OutputDefault),
|
||||
scalingMode (SM_Unspecified),
|
||||
windowed (false),
|
||||
keepApectRatio (true),
|
||||
enumerateRefreshRates (false),
|
||||
captureMouse (true),
|
||||
centerAppWindow (false),
|
||||
inheritColorProfile (false)
|
||||
{
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
// --- GeneralExt --------------------------------------------------------------
|
||||
|
||||
struct ConfigGeneralExt
|
||||
{
|
||||
enum Environment
|
||||
{
|
||||
Env_Unspecified = 0,
|
||||
Env_DosBox,
|
||||
Env_QEmu
|
||||
};
|
||||
|
||||
|
||||
enum WindowedAttributes
|
||||
{
|
||||
WA_DefaultAttributes = 0x0,
|
||||
|
||||
WA_BorderlessFlag = 0x1,
|
||||
WA_AlwaysOnTop = 0x2,
|
||||
WA_FullscreenSize = 0x4,
|
||||
|
||||
WA_FlagsMask = 0x7
|
||||
};
|
||||
|
||||
|
||||
enum DisplayROIPosition
|
||||
{
|
||||
DROI_Centered = 0xFFFFFFFF
|
||||
};
|
||||
|
||||
|
||||
enum DisplayROISize
|
||||
{
|
||||
DROI_Rational = 0xFFFFFFFF
|
||||
};
|
||||
|
||||
|
||||
enum Resampling
|
||||
{
|
||||
RS_PointSampled = 0,
|
||||
RS_Bilinear,
|
||||
RS_Bicubic,
|
||||
RS_Lanczos_2,
|
||||
RS_Lanczos_3
|
||||
};
|
||||
|
||||
|
||||
UInt32 desktopResWidth;
|
||||
UInt32 desktopResHeight;
|
||||
UInt32 desktopRefRateNumerator;
|
||||
UInt32 desktopRefRateDenominator;
|
||||
UInt32 desktopBitDepth;
|
||||
UInt32 deframerSize;
|
||||
UInt32 imageXScaleFactor;
|
||||
UInt32 imageYScaleFactor;
|
||||
UInt32 displayROIPosX;
|
||||
UInt32 displayROIPosY;
|
||||
UInt32 displayROISizeX;
|
||||
UInt32 displayROISizeY;
|
||||
Environment environment;
|
||||
UInt32 windowedAttributes;
|
||||
Resampling resampling;
|
||||
bool freeMouse;
|
||||
bool enableGDIHooking;
|
||||
|
||||
ConfigGeneralExt ():
|
||||
desktopResWidth (0),
|
||||
desktopResHeight (0),
|
||||
desktopRefRateNumerator (0),
|
||||
desktopRefRateDenominator (0),
|
||||
desktopBitDepth (0),
|
||||
deframerSize (1),
|
||||
imageXScaleFactor (1),
|
||||
imageYScaleFactor (1),
|
||||
displayROIPosX (0),
|
||||
displayROIPosY (0),
|
||||
displayROISizeX (0),
|
||||
displayROISizeY (0),
|
||||
environment (Env_Unspecified),
|
||||
windowedAttributes (WA_DefaultAttributes),
|
||||
resampling (RS_Bilinear),
|
||||
freeMouse (false),
|
||||
enableGDIHooking (false)
|
||||
{
|
||||
}
|
||||
};
|
||||
|
||||
// --- Glide -------------------------------------------------------------------
|
||||
|
||||
struct ConfigGlide
|
||||
{
|
||||
enum CardType
|
||||
{
|
||||
VoodooGraphics = 0,
|
||||
VoodooRush = 1,
|
||||
Voodoo2 = 2,
|
||||
VoodooBanshee = 3,
|
||||
Other = 4,
|
||||
|
||||
NumOfCardTypes
|
||||
};
|
||||
|
||||
enum TexFilterType
|
||||
{
|
||||
TF_AppDriven = 0,
|
||||
TF_ForcePoint = 0x100,
|
||||
TF_ForceBilinear = 0x200
|
||||
};
|
||||
|
||||
CardType cardType;
|
||||
UInt32 onBoardMemSize;
|
||||
UInt32 texMemSize;
|
||||
Int32 numOfTMUs;
|
||||
UInt32 resWidth;
|
||||
UInt32 resHeight;
|
||||
UInt32 msaaLevel;
|
||||
UInt32 refRateNumerator;
|
||||
UInt32 refRateDenominator;
|
||||
TexFilterType texFilterType;
|
||||
bool disableMipMapping;
|
||||
bool enableGammaRamp;
|
||||
bool pointCastPalette;
|
||||
bool forceVSync;
|
||||
bool forceEmulateLfbPCI;
|
||||
bool use16BitDepthBuffer;
|
||||
bool enable3DfxWaterMark;
|
||||
bool enableSplashScreen;
|
||||
bool enableInactiveAppState;
|
||||
|
||||
ConfigGlide ():
|
||||
cardType (Voodoo2),
|
||||
onBoardMemSize (8*1024*1024),
|
||||
texMemSize (4*1024*1024),
|
||||
numOfTMUs (2),
|
||||
resWidth (0),
|
||||
resHeight (0),
|
||||
msaaLevel (0),
|
||||
refRateNumerator (0),
|
||||
refRateDenominator (0),
|
||||
texFilterType (TF_AppDriven),
|
||||
disableMipMapping (false),
|
||||
enableGammaRamp (true),
|
||||
pointCastPalette (false),
|
||||
forceVSync (true),
|
||||
forceEmulateLfbPCI (false),
|
||||
use16BitDepthBuffer (false),
|
||||
enable3DfxWaterMark (true),
|
||||
enableSplashScreen (false),
|
||||
enableInactiveAppState (false)
|
||||
{
|
||||
}
|
||||
};
|
||||
|
||||
// --- GlideExt ----------------------------------------------------------------
|
||||
|
||||
struct ConfigGlideExt
|
||||
{
|
||||
enum DitheringEffect
|
||||
{
|
||||
DE_Pure32Bit = 0,
|
||||
DE_Dither2x2,
|
||||
DE_Dither4x4,
|
||||
|
||||
NumOfDitherinEffects,
|
||||
};
|
||||
|
||||
enum Dithering
|
||||
{
|
||||
DT_Disabled = 0,
|
||||
DT_AppDriven,
|
||||
DT_ForceAlways,
|
||||
|
||||
NumOfDitheringBehaviors
|
||||
};
|
||||
|
||||
DitheringEffect ditheringEffect;
|
||||
Dithering dithering;
|
||||
UInt32 ditherOrderedMatrixSizeScale;
|
||||
|
||||
ConfigGlideExt ():
|
||||
ditheringEffect (DE_Pure32Bit),
|
||||
dithering (DT_ForceAlways),
|
||||
ditherOrderedMatrixSizeScale (0)
|
||||
{
|
||||
}
|
||||
};
|
||||
|
||||
// --- ConfigDirectX -----------------------------------------------------------
|
||||
|
||||
struct ConfigDirectX
|
||||
{
|
||||
enum CardType
|
||||
{
|
||||
SVGA = 0,
|
||||
Virtual3D,
|
||||
Geforce4Ti4800,
|
||||
Radeon8500,
|
||||
MatroxParhelia512,
|
||||
GeforceFX5700Ultra,
|
||||
|
||||
NumOfCardTypes
|
||||
};
|
||||
|
||||
|
||||
enum TexFilterType
|
||||
{
|
||||
TF_AppDriven = 0,
|
||||
TF_ForcePoint = 0x100,
|
||||
TF_ForceBilinear = 0x200,
|
||||
TF_ForceLinearMip = 0x300,
|
||||
TF_ForceTrilinear = 0x400,
|
||||
TF_ForceAniso1x = 1,
|
||||
TF_ForceAniso2x = 2,
|
||||
TF_ForceAniso3x = 3,
|
||||
TF_ForceAniso4x = 4,
|
||||
TF_ForceAniso5x = 5,
|
||||
TF_ForceAniso6x = 6,
|
||||
TF_ForceAniso7x = 7,
|
||||
TF_ForceAniso8x = 8,
|
||||
TF_ForceAniso9x = 9,
|
||||
TF_ForceAniso10x = 10,
|
||||
TF_ForceAniso11x = 11,
|
||||
TF_ForceAniso12x = 12,
|
||||
TF_ForceAniso13x = 13,
|
||||
TF_ForceAniso14x = 14,
|
||||
TF_ForceAniso15x = 15,
|
||||
TF_ForceAniso16x = 16,
|
||||
|
||||
TF_AnisoMask = 0xFF
|
||||
};
|
||||
|
||||
CardType cardType;
|
||||
UInt64 videoMemSize;
|
||||
UInt32 resWidth;
|
||||
UInt32 resHeight;
|
||||
UInt32 msaaLevel;
|
||||
UInt32 refRateNumerator;
|
||||
UInt32 refRateDenominator;
|
||||
UInt32 texFilterType;
|
||||
bool disabledAndPassThru;
|
||||
bool appControlledScreenState;
|
||||
bool disableAltEnter;
|
||||
bool watermark;
|
||||
bool linearBltStretch;
|
||||
bool applyPhongShading;
|
||||
bool forceVSync;
|
||||
bool disableMipmapping;
|
||||
bool fastVideoMemAccess;
|
||||
|
||||
ConfigDirectX ():
|
||||
cardType (Virtual3D),
|
||||
videoMemSize (256*1024*1024),
|
||||
resWidth (0),
|
||||
resHeight (0),
|
||||
msaaLevel (0),
|
||||
refRateNumerator (0),
|
||||
refRateDenominator (0),
|
||||
texFilterType (TF_AppDriven),
|
||||
disabledAndPassThru (false),
|
||||
appControlledScreenState (true),
|
||||
disableAltEnter (true),
|
||||
watermark (true),
|
||||
linearBltStretch (false),
|
||||
applyPhongShading (false),
|
||||
forceVSync (false),
|
||||
disableMipmapping (false),
|
||||
fastVideoMemAccess (false)
|
||||
{
|
||||
}
|
||||
};
|
||||
|
||||
// --- DirectXExt --------------------------------------------------------------
|
||||
|
||||
struct ConfigDirectXExt
|
||||
{
|
||||
enum AdapterIDType
|
||||
{
|
||||
AIDT_Default = 0,
|
||||
AIDT_nVidia,
|
||||
AIDT_AMD,
|
||||
AIDT_Intel
|
||||
};
|
||||
|
||||
|
||||
enum DitheringEffect
|
||||
{
|
||||
DE_Pure32Bit = 0,
|
||||
DE_Ordered2x2,
|
||||
DE_Ordered4x4,
|
||||
|
||||
NumOfDitheringEffects,
|
||||
};
|
||||
|
||||
|
||||
enum Dithering
|
||||
{
|
||||
DT_Disabled = 0,
|
||||
DT_AppDriven,
|
||||
DT_ForceOn16Bit,
|
||||
DT_ForceAlways,
|
||||
|
||||
NumOfDitheringBehaviors
|
||||
};
|
||||
|
||||
|
||||
enum DepthBufferBitDepth
|
||||
{
|
||||
DBD_AppDriven = 0,
|
||||
DBD_ForceMin24,
|
||||
DBD_Force32,
|
||||
|
||||
NumOfDepthBufferBitDepths
|
||||
};
|
||||
|
||||
|
||||
enum DefEnumResolutions
|
||||
{
|
||||
DER_None = 0,
|
||||
DER_Classics,
|
||||
DER_All,
|
||||
|
||||
NumOfDefEnumResolutions
|
||||
};
|
||||
|
||||
|
||||
enum EnumResBitDepths
|
||||
{
|
||||
ERBD_8 = 0x1,
|
||||
ERBD_16 = 0x2,
|
||||
ERBD_32 = 0x4,
|
||||
|
||||
ERBD_All = 0x7
|
||||
};
|
||||
|
||||
|
||||
struct ExtraResolution
|
||||
{
|
||||
UInt32 width;
|
||||
UInt32 height;
|
||||
UInt32 refRate;
|
||||
};
|
||||
|
||||
AdapterIDType adapterIDType;
|
||||
UInt32 vendorID;
|
||||
UInt32 deviceID;
|
||||
UInt32 subSysID;
|
||||
UInt32 revisionID;
|
||||
ExtraResolution extraResolutions[MAX_NUM_OF_DX_EXTRA_RESOLUTIONS];
|
||||
DitheringEffect ditheringEffect;
|
||||
Dithering dithering;
|
||||
UInt32 ditherOrderedMatrixSizeScale;
|
||||
DepthBufferBitDepth depthBuffersBitDepth;
|
||||
DefEnumResolutions defaultEnumeratedResolutions;
|
||||
UInt32 enumeratedResolutionBitDepths;
|
||||
UInt32 maxVSConstRegisters;
|
||||
bool msD3DDeviceNames;
|
||||
bool rtTexturesForceScaleAndMSAA;
|
||||
bool smoothedDepthSampling;
|
||||
bool deferredScreenModeSwitch;
|
||||
bool primarySurfaceBatchedUpdate;
|
||||
|
||||
ConfigDirectXExt () :
|
||||
adapterIDType (AIDT_Default),
|
||||
vendorID (0xFFFFFFFF),
|
||||
deviceID (0xFFFFFFFF),
|
||||
subSysID (0xFFFFFFFF),
|
||||
revisionID (0xFFFFFFFF),
|
||||
ditheringEffect (DE_Pure32Bit),
|
||||
dithering (DT_ForceAlways),
|
||||
ditherOrderedMatrixSizeScale (0),
|
||||
depthBuffersBitDepth (DBD_AppDriven),
|
||||
defaultEnumeratedResolutions (DER_All),
|
||||
enumeratedResolutionBitDepths (ERBD_All),
|
||||
maxVSConstRegisters (256),
|
||||
msD3DDeviceNames (false),
|
||||
rtTexturesForceScaleAndMSAA (true),
|
||||
smoothedDepthSampling (true),
|
||||
deferredScreenModeSwitch (false),
|
||||
primarySurfaceBatchedUpdate (false)
|
||||
{
|
||||
memset (extraResolutions, 0, sizeof (extraResolutions));
|
||||
}
|
||||
};
|
||||
|
||||
// --- Debug -------------------------------------------------------------------
|
||||
|
||||
struct ConfigDebug
|
||||
{
|
||||
enum Severity
|
||||
{
|
||||
D_Disable,
|
||||
D_Enable,
|
||||
D_EnableBreak
|
||||
};
|
||||
|
||||
Severity info;
|
||||
Severity warning;
|
||||
Severity error;
|
||||
UInt32 maxTraceLevel;
|
||||
bool logToFile;
|
||||
|
||||
ConfigDebug ():
|
||||
info (D_Enable),
|
||||
warning (D_Enable),
|
||||
error (D_Enable),
|
||||
maxTraceLevel (0),
|
||||
logToFile (false)
|
||||
{
|
||||
}
|
||||
};
|
||||
|
||||
// --- Config ------------------------------------------------------------------
|
||||
|
||||
struct Config
|
||||
{
|
||||
ConfigGeneral general;
|
||||
ConfigGlide glide;
|
||||
ConfigDirectX directX;
|
||||
|
||||
ConfigGeneralExt generalExt;
|
||||
ConfigGlideExt glideExt;
|
||||
ConfigDirectXExt directXExt;
|
||||
|
||||
ConfigDebug debug;
|
||||
};
|
||||
|
||||
#pragma pack(pop)
|
||||
|
||||
} // namespace dgVoodoo
|
||||
|
||||
#endif // !DGVOODOOCONFIG_HPP
|
BIN
dgVoodooAPI/Lib/dgVoodooAPI.lib
Normal file
BIN
dgVoodooAPI/Lib/dgVoodooAPI.lib
Normal file
Binary file not shown.
1
dgVoodooAPI/SampleApp/ReadMe.txt
Normal file
1
dgVoodooAPI/SampleApp/ReadMe.txt
Normal file
@ -0,0 +1 @@
|
||||
Copy dgVoodooAPI.dll here either from folder 'Release' or 'Spec Release' to get the sample app to work.
|
332
dgVoodooAPI/SampleApp/SampleApp.cpp
Normal file
332
dgVoodooAPI/SampleApp/SampleApp.cpp
Normal file
@ -0,0 +1,332 @@
|
||||
// SampleApp.cpp : Defines the entry point for the console application.
|
||||
//
|
||||
|
||||
#include "IMainFactory.hpp"
|
||||
#include "IIniParser.hpp"
|
||||
#include "IAPIDataStream.hpp"
|
||||
#include "APIDebugObj.hpp"
|
||||
|
||||
#include "stdio.h"
|
||||
|
||||
|
||||
// --- Config read/write sample ------------------------------------------------
|
||||
|
||||
static void ConfigReadWrite (IMainFactory* pFactory)
|
||||
{
|
||||
printf ("\n==== Config read/write test =====\n\n");
|
||||
|
||||
// --- Config test
|
||||
IConfig* pConfig = pFactory->GetIConfig ();
|
||||
if (pConfig != NULL) {
|
||||
|
||||
// Let's use a debug object for feedback from the debug layer
|
||||
dgVoodoo::APIDebugObj debug (APIDebugObj::EnableInfo, APIDebugObj::EnableWarning, APIDebugObj::EnableError, "[TestApp] ", 0);
|
||||
|
||||
// Read a config file that defines only some of the properties
|
||||
dgVoodoo::Config config;
|
||||
if (pConfig->ReadConfig (config, "TestFiles\\TestConfig.conf", &debug)) {
|
||||
|
||||
printf ("'TestConfig.conf' is successfully read.\n");
|
||||
|
||||
// Let's change scaling mode to 'Centered, keep Aspect Ratio'
|
||||
config.general.scalingMode = dgVoodoo::ConfigGeneral::SM_CenteredAspectRatio;
|
||||
|
||||
// Write a binary and an INI version from it into files
|
||||
const char* pINITemplate = pConfig->GetINITemplate ();
|
||||
if (pConfig->WriteConfig (config, "WrittenTestFiles\\ConfigBin.conf", NULL, &debug)) {
|
||||
printf ("'ConfigBin.conf' is successfully written.\n");
|
||||
}
|
||||
if (pConfig->WriteConfig (config, "WrittenTestFiles\\ConfigINI.conf", pINITemplate, &debug)) {
|
||||
printf ("'ConfigINI.conf' is successfully written.\n");
|
||||
}
|
||||
} else {
|
||||
printf ("Cannot read testconfig.conf. Test failed.\n");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// --- Config read-from-custom-stream and write-to-file sample -----------------
|
||||
|
||||
static void ConfigFromCustomINIStream (IMainFactory* pFactory)
|
||||
{
|
||||
class MyINIStream: public IAPIDataStream
|
||||
{
|
||||
protected:
|
||||
const char* pStreamData;
|
||||
mutable Int32 currentPos;
|
||||
mutable Status status;
|
||||
|
||||
protected:
|
||||
virtual Status Seek (Int32 move, Origin origin, UInt32* newPos = NULL) const override
|
||||
{
|
||||
switch (origin) {
|
||||
case IAPIDataStream::OCurr:
|
||||
currentPos += move;
|
||||
break;
|
||||
|
||||
case IAPIDataStream::OSet:
|
||||
currentPos = move;
|
||||
break;
|
||||
|
||||
case IAPIDataStream::OEnd:
|
||||
currentPos = strlen (pStreamData);
|
||||
break;
|
||||
|
||||
default:
|
||||
currentPos = -1;
|
||||
break;
|
||||
}
|
||||
|
||||
status = (currentPos >= 0 && currentPos < (Int32) strlen (pStreamData)) ? StatusOk : StatusError;
|
||||
return status;
|
||||
}
|
||||
|
||||
|
||||
virtual Status Read (UInt32 count, void* buffer, UInt32* readBytes = NULL) const
|
||||
{
|
||||
if (status == IAPIDataStream::StatusOk) {
|
||||
UInt32 maxReadable = strlen (pStreamData) - currentPos;
|
||||
if (count > maxReadable) {
|
||||
count = maxReadable;
|
||||
}
|
||||
memcpy (buffer, pStreamData + currentPos, count);
|
||||
currentPos += count;
|
||||
if (readBytes != NULL) {
|
||||
*readBytes = count;
|
||||
}
|
||||
}
|
||||
return status;
|
||||
}
|
||||
|
||||
|
||||
virtual Status Write (UInt32 /*count*/, void* /*buffer*/, UInt32* /*writtenBytes*/) const
|
||||
{
|
||||
// no need to implement
|
||||
return StatusError;
|
||||
}
|
||||
|
||||
|
||||
virtual UInt32 GetSize () const
|
||||
{
|
||||
return strlen (pStreamData);
|
||||
}
|
||||
|
||||
public:
|
||||
MyINIStream (const char* pStreamData):
|
||||
currentPos (0),
|
||||
status (IAPIDataStream::StatusOk),
|
||||
pStreamData (pStreamData)
|
||||
{
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
IConfig* pConfig = pFactory->GetIConfig ();
|
||||
if (pConfig != NULL) {
|
||||
|
||||
// --- Test for a right configuration
|
||||
{
|
||||
const char* pStreamData = "version = 0x255\n"\
|
||||
"[general]\n"\
|
||||
"outputapi = d3d11warp\n"\
|
||||
"brightness = 150\n"\
|
||||
"[directxext]\n"\
|
||||
"extraenumeratedresolutions = \"400x300 @ 56\" 1000x800\n"\
|
||||
"ditheringeffect = ordered4x4\n"\
|
||||
"dithering = forceon16bit";
|
||||
|
||||
MyINIStream myStream (pStreamData);
|
||||
|
||||
printf ("\n==== Config read from custom stream and write to file test (right configuration) =====\n\n");
|
||||
|
||||
// Let's use a debug object for feedback from the debug layer
|
||||
dgVoodoo::APIDebugObj debug (APIDebugObj::EnableInfo, APIDebugObj::EnableWarning, APIDebugObj::EnableError, "[TestApp] ", 0);
|
||||
|
||||
// Read the config from out custom INI-stream
|
||||
dgVoodoo::Config config;
|
||||
if (pConfig->ReadConfig (config, &myStream, &debug)) {
|
||||
|
||||
printf ("Config is successfully read from MyStream.\n");
|
||||
|
||||
// Write full config into a file
|
||||
if (pConfig->WriteConfig (config, "WrittenTestFiles\\ConfigFromStreamINI.conf", pConfig->GetINITemplate (), &debug)) {
|
||||
printf ("'ConfigFromStreamINI.conf' is successfully written.\n");
|
||||
}
|
||||
} else {
|
||||
printf ("Couldn't read config from MyStream. Test failed.\n");
|
||||
}
|
||||
}
|
||||
|
||||
// --- Test for a wrong configuration
|
||||
// --- Let's redirect the output of the debug layer from the default output to a custom stream - that writes output to the console window
|
||||
{
|
||||
class DebugLayerOutput: public IAPIDataStream
|
||||
{
|
||||
protected:
|
||||
virtual Status Seek (Int32 move, Origin origin, UInt32* newPos = NULL) const override
|
||||
{
|
||||
// no need to implement
|
||||
return StatusError;
|
||||
}
|
||||
|
||||
|
||||
virtual Status Read (UInt32 count, void* buffer, UInt32* readBytes = NULL) const
|
||||
{
|
||||
// no need to implement
|
||||
return StatusError;
|
||||
}
|
||||
|
||||
|
||||
virtual Status Write (UInt32 count, void* buffer, UInt32* writtenBytes) const
|
||||
{
|
||||
// Ok, it's a lame solution here, serves only demonstrating purposes
|
||||
char localBuffer[1024];
|
||||
memcpy (localBuffer, buffer, count);
|
||||
localBuffer[count] = 0x0;
|
||||
printf ("%s", localBuffer);
|
||||
|
||||
return StatusOk;
|
||||
}
|
||||
|
||||
|
||||
virtual UInt32 GetSize () const
|
||||
{
|
||||
// no need to implement
|
||||
return StatusError;
|
||||
}
|
||||
} debugLayerOutput;
|
||||
|
||||
// 'unknownsection' is invalid for dgVoodoo config property set
|
||||
const char* pStreamData = "version = 0x255\n"\
|
||||
"[unknownsection]\n"\
|
||||
"dithering = forceon16bit";
|
||||
|
||||
MyINIStream myStream (pStreamData);
|
||||
printf ("\n==== Config read from custom stream and write to file test (bad config) =====\n\n");
|
||||
|
||||
// Let's use a debug object for feedback from the debug layer, redirected to our stream
|
||||
dgVoodoo::APIDebugObj debug (APIDebugObj::EnableInfo, APIDebugObj::EnableWarning, APIDebugObj::EnableError, "[TestApp] ", 0, &debugLayerOutput);
|
||||
|
||||
// Read the config from out custom INI-stream
|
||||
dgVoodoo::Config config;
|
||||
pConfig->ReadConfig (config, &myStream, &debug);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// --- INI property set read sample --------------------------------------------
|
||||
|
||||
static void INIPropertySetRead (IMainFactory* pFactory)
|
||||
{
|
||||
printf ("\n==== INI property set test =====\n\n");
|
||||
|
||||
// Let's use a debug object for feedback from the debug layer
|
||||
dgVoodoo::APIDebugObj debug (APIDebugObj::EnableInfo, APIDebugObj::EnableWarning, APIDebugObj::EnableError, "[TestApp] ", 0);
|
||||
|
||||
IIniParser* pParser = pFactory->CreateIniParser (&debug);
|
||||
if (pParser != NULL) {
|
||||
|
||||
if (pParser->Parse ("TestFiles\\INIPropertySet.ini", IIniParser::LowerCase)) {
|
||||
|
||||
printf ("INIPropertySet.ini is successfully parsed. Dumping its content:\n\n");
|
||||
|
||||
// Dump the property set to the console window
|
||||
for (UInt32 i = 0; i < pParser->GetNumberOfSections (); i++) {
|
||||
const char* pSectionName = pParser->GetSectionName (i);
|
||||
printf (pSectionName != NULL ? "[%s]\n" : "{global}\n", pSectionName);
|
||||
|
||||
for (UInt32 j = 0; j < pParser->GetNumberOfProperties (i); j++) {
|
||||
const char* pPropertyName = pParser->GetPropertyName (i, j);
|
||||
printf ("%s = ", pPropertyName);
|
||||
|
||||
for (UInt32 k = 0; k < pParser->GetNumberOfPropertyValues (i, j); k++) {
|
||||
const char* pValue = pParser->GetPropertyValueAsString (i, j, k);
|
||||
printf ("\"%s\" ", pValue);
|
||||
}
|
||||
for (UInt32 k = 0; k < pParser->GetNumberOfSubProperties (i, j); k++) {
|
||||
const char* pName = pParser->GetSubPropertyName (i, j, k);
|
||||
const char* pValue = pParser->GetSubPropertyValueAsString (i, j, k);
|
||||
printf ("%s:%s ", pName, pValue);
|
||||
}
|
||||
printf ("\n");
|
||||
}
|
||||
printf ("\n");
|
||||
}
|
||||
} else {
|
||||
printf ("Parsing INIPropertySet.ini has failed. Test failed.\n");
|
||||
}
|
||||
|
||||
pParser->Release ();
|
||||
} else {
|
||||
printf ("Couldn't create iniparser object. Test failed.\n");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static void DumpGraphicsSystemInformation (IMainFactory* pFactory)
|
||||
{
|
||||
printf ("\n==== Graphics system information test =====\n\n");
|
||||
|
||||
// Let's use a debug object for feedback from the debug layer
|
||||
dgVoodoo::APIDebugObj debug (APIDebugObj::EnableInfo, APIDebugObj::EnableWarning, APIDebugObj::EnableError, "[TestApp] ", 0);
|
||||
|
||||
ICPLDDI* pCPLDDI = pFactory->GetCPLDDIObject (dgVoodoo::ConfigGeneral::API_BestAvailable, &debug);
|
||||
if (pCPLDDI != NULL) {
|
||||
if (pCPLDDI->Activate ()) {
|
||||
|
||||
printf ("\nAPI: %s", pCPLDDI->GetAPIName ());
|
||||
|
||||
UInt32 numAdapters = pCPLDDI->GetNumberOfAdapters ();
|
||||
printf ("\nNumber of adapters: %d", numAdapters);
|
||||
|
||||
for (UInt32 i = 0; i < numAdapters; i++) {
|
||||
WCHAR adapterName[256];
|
||||
|
||||
pCPLDDI->GetAdapterName (i, adapterName);
|
||||
printf ("\nAdapter %i: %ls", i, adapterName);
|
||||
|
||||
UInt32 numOutputs = pCPLDDI->GetNumberOfOutputs (i);
|
||||
printf ("\n Number of outputs: %d\n", numOutputs);
|
||||
for (UInt32 j = 0; j < numOutputs; j++) {
|
||||
UInt32 numRes = pCPLDDI->GetNumberOfResolutions (i, j, dgVoodoo::ConfigGeneral::SO_OutputDefault);
|
||||
printf ("\n Number of resolutions on output %d: %d\n", j, numRes);
|
||||
|
||||
for (UInt32 k = 0; k < numRes; k++) {
|
||||
dgVoodoo::ICPLDDI::ModeDesc desc;
|
||||
if (pCPLDDI->GetResolution (i, j, dgVoodoo::ConfigGeneral::SO_OutputDefault, k, &desc)) {
|
||||
printf ("\n %dx%d, %dHz", desc.xRes, desc.yRes, desc.refreshRateSimple);
|
||||
}
|
||||
}
|
||||
printf ("\n");
|
||||
}
|
||||
}
|
||||
} else {
|
||||
printf ("\nActivating CPL DDI object has failed. Test failed.");
|
||||
}
|
||||
} else {
|
||||
printf ("\nRetrieving CPL DDI object has failed. Test failed.");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
int main()
|
||||
{
|
||||
UInt32 version = dgVoodoo_API_GetVersion ();
|
||||
printf ("\ndgVoodoo API version: %x.%x%x", version >> 8, (version >> 4) & 0xF, (version >> 0) & 0xF);
|
||||
|
||||
IMainFactory* pFactory = dgVoodoo_API_Init ();
|
||||
if (pFactory != NULL) {
|
||||
|
||||
ConfigReadWrite (pFactory);
|
||||
ConfigFromCustomINIStream (pFactory);
|
||||
INIPropertySetRead (pFactory);
|
||||
DumpGraphicsSystemInformation (pFactory);
|
||||
|
||||
dgVoodoo_API_Exit ();
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
22
dgVoodooAPI/SampleApp/SampleApp.sln
Normal file
22
dgVoodooAPI/SampleApp/SampleApp.sln
Normal file
@ -0,0 +1,22 @@
|
||||
|
||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||
# Visual Studio 14
|
||||
VisualStudioVersion = 14.0.25420.1
|
||||
MinimumVisualStudioVersion = 10.0.40219.1
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "SampleApp", "SampleApp.vcxproj", "{CD7EACA5-A639-4264-9F8D-5044F8489A15}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|x86 = Debug|x86
|
||||
Release|x86 = Release|x86
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{CD7EACA5-A639-4264-9F8D-5044F8489A15}.Debug|x86.ActiveCfg = Debug|Win32
|
||||
{CD7EACA5-A639-4264-9F8D-5044F8489A15}.Debug|x86.Build.0 = Debug|Win32
|
||||
{CD7EACA5-A639-4264-9F8D-5044F8489A15}.Release|x86.ActiveCfg = Release|Win32
|
||||
{CD7EACA5-A639-4264-9F8D-5044F8489A15}.Release|x86.Build.0 = Release|Win32
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
EndGlobalSection
|
||||
EndGlobal
|
171
dgVoodooAPI/SampleApp/SampleApp.vcxproj
Normal file
171
dgVoodooAPI/SampleApp/SampleApp.vcxproj
Normal file
@ -0,0 +1,171 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project DefaultTargets="Build" ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup Label="ProjectConfigurations">
|
||||
<ProjectConfiguration Include="Debug|Win32">
|
||||
<Configuration>Debug</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Release|Win32">
|
||||
<Configuration>Release</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Debug|x64">
|
||||
<Configuration>Debug</Configuration>
|
||||
<Platform>x64</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Release|x64">
|
||||
<Configuration>Release</Configuration>
|
||||
<Platform>x64</Platform>
|
||||
</ProjectConfiguration>
|
||||
</ItemGroup>
|
||||
<PropertyGroup Label="Globals">
|
||||
<ProjectGuid>{CD7EACA5-A639-4264-9F8D-5044F8489A15}</ProjectGuid>
|
||||
<Keyword>Win32Proj</Keyword>
|
||||
<RootNamespace>SampleApp</RootNamespace>
|
||||
<WindowsTargetPlatformVersion>10.0.17763.0</WindowsTargetPlatformVersion>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<UseDebugLibraries>true</UseDebugLibraries>
|
||||
<PlatformToolset>v141</PlatformToolset>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<UseDebugLibraries>false</UseDebugLibraries>
|
||||
<PlatformToolset>v141</PlatformToolset>
|
||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<UseDebugLibraries>true</UseDebugLibraries>
|
||||
<PlatformToolset>v141</PlatformToolset>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<UseDebugLibraries>false</UseDebugLibraries>
|
||||
<PlatformToolset>v141</PlatformToolset>
|
||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
||||
<ImportGroup Label="ExtensionSettings">
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="Shared">
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<PropertyGroup Label="UserMacros" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<LinkIncremental>true</LinkIncremental>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
<LinkIncremental>true</LinkIncremental>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<LinkIncremental>false</LinkIncremental>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<LinkIncremental>false</LinkIncremental>
|
||||
</PropertyGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<ClCompile>
|
||||
<PrecompiledHeader>
|
||||
</PrecompiledHeader>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<Optimization>Disabled</Optimization>
|
||||
<PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<SDLCheck>true</SDLCheck>
|
||||
<AdditionalIncludeDirectories>$(SolutionDir)\..\Inc\</AdditionalIncludeDirectories>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Console</SubSystem>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<AdditionalLibraryDirectories>$(SolutionDir)\..\Lib\</AdditionalLibraryDirectories>
|
||||
<AdditionalDependencies>dgVoodooAPI.lib;kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
<ClCompile>
|
||||
<PrecompiledHeader>
|
||||
</PrecompiledHeader>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<Optimization>Disabled</Optimization>
|
||||
<PreprocessorDefinitions>_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<SDLCheck>true</SDLCheck>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Console</SubSystem>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<ClCompile>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<PrecompiledHeader>
|
||||
</PrecompiledHeader>
|
||||
<Optimization>MaxSpeed</Optimization>
|
||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||
<PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<SDLCheck>true</SDLCheck>
|
||||
<AdditionalIncludeDirectories>$(SolutionDir)\..\Inc\</AdditionalIncludeDirectories>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Console</SubSystem>
|
||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||
<OptimizeReferences>true</OptimizeReferences>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<AdditionalLibraryDirectories>$(SolutionDir)\..\Lib\</AdditionalLibraryDirectories>
|
||||
<AdditionalDependencies>dgVoodooAPI.lib;kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<ClCompile>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<PrecompiledHeader>
|
||||
</PrecompiledHeader>
|
||||
<Optimization>MaxSpeed</Optimization>
|
||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||
<PreprocessorDefinitions>NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<SDLCheck>true</SDLCheck>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Console</SubSystem>
|
||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||
<OptimizeReferences>true</OptimizeReferences>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="..\Inc\APIDebugObj.hpp" />
|
||||
<ClInclude Include="..\Inc\APIObject.hpp" />
|
||||
<ClInclude Include="..\Inc\APITypes.h" />
|
||||
<ClInclude Include="..\Inc\dgVoodooConfig.hpp" />
|
||||
<ClInclude Include="..\Inc\IAPIDataStream.hpp" />
|
||||
<ClInclude Include="..\Inc\IConfig.hpp" />
|
||||
<ClInclude Include="..\Inc\ICPLDDI.hpp" />
|
||||
<ClInclude Include="..\Inc\IIniParser.hpp" />
|
||||
<ClInclude Include="..\Inc\IMainFactory.hpp" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="SampleApp.cpp" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||
<ImportGroup Label="ExtensionTargets">
|
||||
</ImportGroup>
|
||||
</Project>
|
10
dgVoodooAPI/SampleApp/TestFiles/INIPropertySet.ini
Normal file
10
dgVoodooAPI/SampleApp/TestFiles/INIPropertySet.ini
Normal file
@ -0,0 +1,10 @@
|
||||
Color1 = BLUE
|
||||
|
||||
[Geometry]
|
||||
Shapes1 = rectangle, triangle
|
||||
Shapes2 = "rotated rectangle" circle
|
||||
Shapes3 =
|
||||
|
||||
[Topology] []
|
||||
|
||||
Color2 = red R:255 G:0 B:0
|
13
dgVoodooAPI/SampleApp/TestFiles/TestConfig.conf
Normal file
13
dgVoodooAPI/SampleApp/TestFiles/TestConfig.conf
Normal file
@ -0,0 +1,13 @@
|
||||
version = 0x255
|
||||
|
||||
[General]
|
||||
|
||||
ScalingMode = stretched_ar
|
||||
|
||||
[Glide]
|
||||
|
||||
Resolution = max
|
||||
|
||||
[DirectX]
|
||||
|
||||
Resolution = 2x
|
Loading…
x
Reference in New Issue
Block a user