⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 gslib_internal.h

📁 网络泡泡被.net管理
💻 H
字号:
 // GSLib_Internal.h: interface for the GSLib_Internal class.
//
//////////////////////////////////////////////////////////////////////

#if !defined(AFX_GSLIB_INTERNAL_H__A762ED56_11CB_4C58_8FEC_338E80E2916F__INCLUDED_)
#define AFX_GSLIB_INTERNAL_H__A762ED56_11CB_4C58_8FEC_338E80E2916F__INCLUDED_

#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000


extern CGsApp* g_pGsApp;

#pragma pack(push, 1)

struct t_PGM_head
{
	long	pos_guid;
	long	size_guid;
	long	pos_pixel;
	long	size_pixel;
	GPOINT	base_point;
	long	width;
	long	height;
	FLAG	flag;
};

struct t_PGM_group_head
{
	long	num_PGM;
	long	pos_guide;
};

#pragma pack(pop)


HMENU	BuildSupportModeMenu(SDxDeviceInfo* m_pDeviceInfo);


class TIMER {
	static DWORD starttime;
	static DWORD CP10K;	// 万分之一秒的周期数
public:
	static DWORD CyclePerSec;	// 一秒 CPU 运行周期
	static int CPU();	//返回 CPU 频率
	static void reset();	// 初始化计时器
	static DWORD timer(int set);	//时间检测(最小单位是 8 时钟周期, 最大周期 P200 上 2 分半)
	static DWORD time();	//返回当前计数值 ( 最小单位为 1/10000 秒)

	static int init(); // 初始化
};

#define WAVEFILE_READ   1
#define WAVEFILE_WRITE  2
class t_wave_file  
{
public:
	t_wave_file();
	virtual ~t_wave_file();
public:
    WAVEFORMATEX* m_pwfx;        // Pointer to WAVEFORMATEX structure
    HMMIO         m_hmmio;       // MM I/O handle for the WAVE
    MMCKINFO      m_ck;          // Multimedia RIFF chunk
    MMCKINFO      m_ckRiff;      // Use in opening a WAVE file
    DWORD         m_dwSize;      // The size of the wave file
    MMIOINFO      m_mmioinfoOut;
    DWORD         m_dwFlags;
    BOOL          m_bIsReadingFromMemory;
    BYTE*         m_pbData;
    BYTE*         m_pbDataCur;
    ULONG         m_ulDataSize;

protected:
    HRESULT ReadMMIO();
    HRESULT WriteMMIO( WAVEFORMATEX *pwfxDest );

public:

    HRESULT Open( LPTSTR strFileName, WAVEFORMATEX* pwfx, DWORD dwFlags );
    HRESULT OpenFromMemory( BYTE* pbData, ULONG ulDataSize, WAVEFORMATEX* pwfx, DWORD dwFlags );
    HRESULT Close();

    HRESULT Read( BYTE* pBuffer, DWORD dwSizeToRead, DWORD* pdwSizeRead );
    HRESULT Write( UINT nSizeToWrite, BYTE* pbData, UINT* pnSizeWrote );

    DWORD   GetSize();
    HRESULT ResetFile();
    WAVEFORMATEX* GetFormat() { return m_pwfx; };
};




//-----------------------------------------------------------------------------
// Name: struct TEXTURESEARCHINFO
// Desc: Structure used to search for texture formats
//-----------------------------------------------------------------------------
struct TEXTURESEARCHINFO
{
    DWORD dwDesiredBPP;   // Input for texture format search
    BOOL  bUseAlpha;
    BOOL  bUsePalette;
    BOOL  bFoundGoodFormat;

    DDPIXELFORMAT* pddpf; // Output of texture format search
};
//-----------------------------------------------------------------------------
// Name: TextureSearchCallback()
// Desc: Enumeration callback routine to find a best-matching texture format.
//       The param data is the DDPIXELFORMAT of the best-so-far matching
//       texture. Note: the desired BPP is passed in the dwSize field, and the
//       default BPP is passed in the dwFlags field.
//-----------------------------------------------------------------------------
static HRESULT CALLBACK TextureSearchCallback( DDPIXELFORMAT* pddpf,
                                               VOID* param )
{
    if( NULL==pddpf || NULL==param )
        return DDENUMRET_OK;

    TEXTURESEARCHINFO* ptsi = (TEXTURESEARCHINFO*)param;

    // Skip any funky modes
    if( pddpf->dwFlags & (DDPF_LUMINANCE|DDPF_BUMPLUMINANCE|DDPF_BUMPDUDV) )
        return DDENUMRET_OK;

    // Check for palettized formats
    if( ptsi->bUsePalette )
    {
        if( !( pddpf->dwFlags & DDPF_PALETTEINDEXED8 ) )
            return DDENUMRET_OK;

        // Accept the first 8-bit palettized format we get
        memcpy( ptsi->pddpf, pddpf, sizeof(DDPIXELFORMAT) );
        ptsi->bFoundGoodFormat = TRUE;
        return DDENUMRET_CANCEL;
    }

    // Else, skip any paletized formats (all modes under 16bpp)
    if( pddpf->dwRGBBitCount < 16 )
        return DDENUMRET_OK;

    // Skip any FourCC formats
    if( pddpf->dwFourCC != 0 )
        return DDENUMRET_OK;

    // Skip any ARGB 4444 formats (which are best used for pre-authored
    // content designed speciafically for an ARGB 4444 format).
    if( pddpf->dwRGBAlphaBitMask == 0x0000f000 )
        return DDENUMRET_OK;

    // Make sure current alpha format agrees with requested format type
    if( (ptsi->bUseAlpha==TRUE) && !(pddpf->dwFlags&DDPF_ALPHAPIXELS) )
        return DDENUMRET_OK;
    if( (ptsi->bUseAlpha==FALSE) && (pddpf->dwFlags&DDPF_ALPHAPIXELS) )
        return DDENUMRET_OK;

    // Check if we found a good match
    if( pddpf->dwRGBBitCount == ptsi->dwDesiredBPP )
    {
        memcpy( ptsi->pddpf, pddpf, sizeof(DDPIXELFORMAT) );
        ptsi->bFoundGoodFormat = TRUE;
        return DDENUMRET_CANCEL;
    }

    return DDENUMRET_OK;
}



//----------------------------------------------------------------------------
// ID for internal use
//----------------------------------------------------------------------------

//-----------------------------------------------------------------------------
// Flag and error definitions
//-----------------------------------------------------------------------------
#define DXENUM_SOFTWAREONLY           0x00000001 // Software-devices only flag

#define DXENUMERR_NODIRECTDRAW        0x81000001 // Could not create DDraw
#define DXENUMERR_ENUMERATIONFAILED   0x81000002 // Enumeration failed
#define DXENUMERR_SUGGESTREFRAST      0x81000003 // Suggest using the RefRast
#define DXENUMERR_NOCOMPATIBLEDEVICES 0x81000004 // No devices were found that
                                                  // meet the app's desired
                                                  // capabilities

//-----------------------------------------------------------------------------
// Name: DxEnum_EnumerateDevices()
// Desc: Enumerates all drivers, devices, and modes. The callback function is
//       called each device, to confirm that the device supports the feature
//       set required by the app.
//-----------------------------------------------------------------------------
HRESULT DxEnum_EnumerateDevices( HRESULT (*fn)(DDCAPS*, D3DDEVICEDESC7*) );

//-----------------------------------------------------------------------------
// Name: DxEnum_FreeResources()
// Desc: Cleans up any memory allocated during device enumeration
//-----------------------------------------------------------------------------
VOID DxEnum_FreeResources();

//-----------------------------------------------------------------------------
// Name: DxEnum_GetDevices()
// Desc: Returns a ptr to the array of enumerated D3DDEVICEINFO structures.
//-----------------------------------------------------------------------------
VOID DxEnum_GetDevices( SDxDeviceInfo** ppDevices, DWORD* pdwCount );

//-----------------------------------------------------------------------------
// Name: DxEnum_SelectDefaultDevice()
// Desc: Picks a driver based on a set of passed in criteria. The
//       DxEnum_SOFTWAREONLY flag can be used to pick a software device.
//-----------------------------------------------------------------------------
HRESULT DxEnum_SelectDefaultDevice( SDxDeviceInfo** pDevice,
                                     DWORD dwFlags = 0L );

HRESULT DxEnum_SetDevice( SDxDeviceInfo* pDevice, DWORD dwModeIndex ); 

//-----------------------------------------------------------------------------
// Name: DxEnum_UserChangeDevice()
// Desc: Pops up a dialog which allows the user to select a new device.
//-----------------------------------------------------------------------------
HRESULT DxEnum_UserChangeDevice( SDxDeviceInfo** ppDevice );




//#define HAVE_BOOLEAN
#ifdef __cplusplus
	extern "C" {
#endif // __cplusplus

#include "..\JpegLib\jpeglib.h"

#ifdef __cplusplus
	}
#endif // __cplusplus


#include <setjmp.h>

// error handler, to avoid those pesky exit(0)'s

struct my_error_mgr {
  struct jpeg_error_mgr pub;	/* "public" fields */

  jmp_buf setjmp_buffer;	/* for return to caller */
};

typedef struct my_error_mgr * my_error_ptr;

//
//
//

METHODDEF(void) my_error_exit (j_common_ptr cinfo);

//
//	to handle fatal errors.
//	the original JPEG code will just exit(0). can't really
//	do that in Windows....
//

METHODDEF(void) my_error_exit (j_common_ptr cinfo)
{
	/* cinfo->err really points to a my_error_mgr struct, so coerce pointer */
	my_error_ptr myerr = (my_error_ptr) cinfo->err;

	char buffer[JMSG_LENGTH_MAX];

	/* Create the message */
	(*cinfo->err->format_message) (cinfo, buffer);

	/* Always display the message. */
	//MessageBox(NULL,buffer,"JPEG Fatal Error",MB_ICONSTOP);


	/* Return control to the setjmp point */
	longjmp(myerr->setjmp_buffer, 1);
}



#endif // !defined(AFX_GSLIB_INTERNAL_H__A762ED56_11CB_4C58_8FEC_338E80E2916F__INCLUDED_)

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -