ADDED Extended Fullscreen Settings dialog for Direct3D.
This commit is contained in:
parent
e5d6588153
commit
4fddbeaff1
12
VBA.vcproj
12
VBA.vcproj
|
@ -901,6 +901,10 @@
|
|||
RelativePath=".\src\win32\FileDlg.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\src\win32\FullscreenSettings.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\src\win32\GameOverrides.cpp"
|
||||
>
|
||||
|
@ -1463,6 +1467,10 @@
|
|||
RelativePath=".\src\win32\FileDlg.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\src\win32\FullscreenSettings.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\src\win32\GBACheats.h"
|
||||
>
|
||||
|
@ -1706,6 +1714,10 @@
|
|||
RelativePath=".\res\ReadMe.txt"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\src\win32\VBA-M.ico"
|
||||
>
|
||||
</File>
|
||||
</Filter>
|
||||
<Filter
|
||||
Name="hq"
|
||||
|
|
|
@ -20,8 +20,7 @@ Important:
|
|||
|
||||
|
||||
Less important:
|
||||
- Update 7-Zip code from 4.23 to current (4.57)
|
||||
-> Dropped: New 7-Zip code has too many problems, bad documentation
|
||||
- Support D3DFMT_A2R10G10B10 (10 bit per color component) color format
|
||||
|
||||
- Add documentation for VBA-M (configuration guide)
|
||||
|
||||
|
|
|
@ -29,6 +29,7 @@
|
|||
#include "Display.h"
|
||||
|
||||
#include "MainWnd.h"
|
||||
#include "FullscreenSettings.h"
|
||||
|
||||
#include "../System.h"
|
||||
#include "../GBA.h"
|
||||
|
@ -161,7 +162,7 @@ void Direct3DDisplay::prepareDisplayMode()
|
|||
dpp.BackBufferWidth = !dpp.Windowed ? theApp.fsWidth : theApp.surfaceSizeX;
|
||||
dpp.BackBufferHeight = !dpp.Windowed ? theApp.fsHeight : theApp.surfaceSizeY;
|
||||
dpp.hDeviceWindow = theApp.m_pMainWnd->GetSafeHwnd();
|
||||
dpp.FullScreen_RefreshRateInHz = dpp.Windowed ? 0 : theApp.fsFrequency;
|
||||
dpp.FullScreen_RefreshRateInHz = ( dpp.Windowed == TRUE ) ? 0 : theApp.fsFrequency;
|
||||
dpp.Flags = 0;
|
||||
dpp.PresentationInterval = theApp.vsync ? D3DPRESENT_INTERVAL_ONE : D3DPRESENT_INTERVAL_IMMEDIATE;
|
||||
// D3DPRESENT_INTERVAL_ONE means VSync ON
|
||||
|
@ -216,7 +217,7 @@ bool Direct3DDisplay::initialize()
|
|||
DXTRACE_ERR_MSGBOX( _T("Error creating Direct3D object"), 0 );
|
||||
return false;
|
||||
}
|
||||
pD3D->GetAdapterDisplayMode(D3DADAPTER_DEFAULT, &mode);
|
||||
pD3D->GetAdapterDisplayMode(theApp.fsAdapter, &mode);
|
||||
|
||||
theApp.mode320Available = FALSE;
|
||||
theApp.mode640Available = FALSE;
|
||||
|
@ -249,11 +250,12 @@ bool Direct3DDisplay::initialize()
|
|||
screenFormat = mode.Format;
|
||||
|
||||
switch(mode.Format) {
|
||||
case D3DFMT_R8G8B8:
|
||||
systemColorDepth = 24;
|
||||
systemRedShift = 19;
|
||||
systemGreenShift = 11;
|
||||
systemBlueShift = 3;
|
||||
case D3DFMT_A2R10G10B10:
|
||||
systemColorDepth = 32;
|
||||
systemRedShift = 25;
|
||||
systemGreenShift = 15;
|
||||
systemBlueShift = 5;
|
||||
Init_2xSaI(32); // TODO: verify
|
||||
break;
|
||||
case D3DFMT_X8R8G8B8:
|
||||
systemColorDepth = 32;
|
||||
|
@ -298,10 +300,11 @@ bool Direct3DDisplay::initialize()
|
|||
|
||||
|
||||
// create device
|
||||
// Direct3D will use the selected full screen adapter for windowed mode as well
|
||||
prepareDisplayMode();
|
||||
|
||||
HRESULT hret = pD3D->CreateDevice(
|
||||
D3DADAPTER_DEFAULT,
|
||||
theApp.fsAdapter,
|
||||
D3DDEVTYPE_HAL,
|
||||
theApp.m_pMainWnd->GetSafeHwnd(),
|
||||
D3DCREATE_FPU_PRESERVE |
|
||||
|
@ -520,32 +523,32 @@ void Direct3DDisplay::resize( int w, int h )
|
|||
|
||||
bool Direct3DDisplay::selectFullScreenMode( VIDEO_MODE &mode )
|
||||
{
|
||||
// TODO: Add display mode enumeration dialog
|
||||
if( !pD3D ) return false;
|
||||
D3DDISPLAYMODE m;
|
||||
pD3D->GetAdapterDisplayMode( D3DADAPTER_DEFAULT, &m );
|
||||
mode.adapter = D3DADAPTER_DEFAULT;
|
||||
mode.width = m.Width;
|
||||
mode.height = m.Height;
|
||||
mode.frequency = m.RefreshRate;
|
||||
switch( m.Format )
|
||||
FullscreenSettings dlg;
|
||||
dlg.setAPI( this->getType() );
|
||||
INT_PTR ret = dlg.DoModal();
|
||||
if( ret == IDOK ) {
|
||||
mode.adapter = dlg.m_device;
|
||||
switch( dlg.m_colorDepth )
|
||||
{
|
||||
case D3DFMT_X1R5G5B5:
|
||||
case D3DFMT_R5G6B5:
|
||||
mode.bitDepth = 16;
|
||||
break;
|
||||
case D3DFMT_R8G8B8:
|
||||
mode.bitDepth = 24;
|
||||
break;
|
||||
case D3DFMT_X8R8G8B8:
|
||||
mode.bitDepth = 32;
|
||||
break;
|
||||
default:
|
||||
case 30:
|
||||
// TODO: support
|
||||
return false;
|
||||
break;
|
||||
case 24:
|
||||
mode.bitDepth = 32;
|
||||
break;
|
||||
case 16:
|
||||
case 15:
|
||||
mode.bitDepth = 16;
|
||||
break;
|
||||
}
|
||||
mode.width = dlg.m_width;
|
||||
mode.height = dlg.m_height;
|
||||
mode.frequency = dlg.m_refreshRate;
|
||||
return true;
|
||||
// return false; when cancel is clicked
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -35,11 +35,11 @@ class IDisplay {
|
|||
struct VIDEO_MODE
|
||||
{
|
||||
GUID *adapter_ddraw;
|
||||
unsigned char adapter;
|
||||
unsigned short width;
|
||||
unsigned short height;
|
||||
unsigned char bitDepth;
|
||||
unsigned char frequency;
|
||||
unsigned int adapter;
|
||||
unsigned int width;
|
||||
unsigned int height;
|
||||
unsigned int bitDepth;
|
||||
unsigned int frequency;
|
||||
};
|
||||
|
||||
virtual bool initialize() = 0;
|
||||
|
|
|
@ -0,0 +1,320 @@
|
|||
// VisualBoyAdvance - Nintendo Gameboy/GameboyAdvance (TM) emulator.
|
||||
// Copyright (C) 2008 VBA-M development team
|
||||
|
||||
// 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 2, 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, write to the Free Software Foundation,
|
||||
// Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
|
||||
|
||||
#include "stdafx.h"
|
||||
#include "FullscreenSettings.h"
|
||||
|
||||
|
||||
// FullscreenSettings dialog
|
||||
|
||||
IMPLEMENT_DYNAMIC(FullscreenSettings, CDialog)
|
||||
|
||||
FullscreenSettings::FullscreenSettings(CWnd* pParent /*=NULL*/)
|
||||
: CDialog(FullscreenSettings::IDD, pParent)
|
||||
{
|
||||
m_device = 0;
|
||||
m_colorDepth = 0;
|
||||
m_width = 0;
|
||||
m_height = 0;
|
||||
m_refreshRate = 0;
|
||||
|
||||
failed = false;
|
||||
#ifndef NO_D3D
|
||||
pD3D = NULL;
|
||||
#endif
|
||||
}
|
||||
|
||||
FullscreenSettings::~FullscreenSettings()
|
||||
{
|
||||
#ifndef NO_D3D
|
||||
if( pD3D ) {
|
||||
pD3D->Release();
|
||||
pD3D = NULL;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
void FullscreenSettings::DoDataExchange(CDataExchange* pDX)
|
||||
{
|
||||
CDialog::DoDataExchange(pDX);
|
||||
DDX_Control(pDX, IDC_COMBO_DEVICE, combo_device);
|
||||
DDX_Control(pDX, IDC_COMBO_RESOLUTION, combo_resolution);
|
||||
DDX_Control(pDX, IDC_COMBO_COLOR_DEPTH, combo_color_depth);
|
||||
DDX_Control(pDX, IDC_COMBO_REFRESH_RATE, combo_refresh_rate);
|
||||
}
|
||||
|
||||
|
||||
BEGIN_MESSAGE_MAP(FullscreenSettings, CDialog)
|
||||
ON_CBN_SELCHANGE(IDC_COMBO_DEVICE, &FullscreenSettings::OnCbnSelchangeComboDevice)
|
||||
ON_CBN_SELCHANGE(IDC_COMBO_COLOR_DEPTH, &FullscreenSettings::OnCbnSelchangeComboColorDepth)
|
||||
ON_CBN_SELCHANGE(IDC_COMBO_RESOLUTION, &FullscreenSettings::OnCbnSelchangeComboResolution)
|
||||
END_MESSAGE_MAP()
|
||||
|
||||
|
||||
// FullscreenSettings message handlers
|
||||
|
||||
BOOL FullscreenSettings::OnInitDialog()
|
||||
{
|
||||
CDialog::OnInitDialog();
|
||||
|
||||
#ifndef NO_D3D
|
||||
if( api == DIRECT_3D ) {
|
||||
pD3D = Direct3DCreate9( D3D_SDK_VERSION );
|
||||
if( pD3D == NULL) {
|
||||
failed = true;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
// enumerate devices
|
||||
UINT nAdapters = pD3D->GetAdapterCount();
|
||||
if( nAdapters < 1 ) {
|
||||
failed = true;
|
||||
pD3D->Release();
|
||||
pD3D = NULL;
|
||||
return TRUE;
|
||||
}
|
||||
combo_device.ResetContent();
|
||||
for( UINT i = 0 ; i < nAdapters ; i++ ) {
|
||||
D3DADAPTER_IDENTIFIER9 id;
|
||||
pD3D->GetAdapterIdentifier( i, 0, &id );
|
||||
int index = combo_device.AddString( id.Description );
|
||||
combo_device.SetItemData( index, (DWORD_PTR)i );
|
||||
}
|
||||
combo_device.SetCurSel( 0 );
|
||||
OnCbnSelchangeComboDevice();
|
||||
}
|
||||
#endif
|
||||
|
||||
//#ifndef NO_OGL
|
||||
//case OPENGL:
|
||||
//break;
|
||||
//#endif
|
||||
|
||||
// TODO: Add extra initialization here
|
||||
|
||||
return TRUE; // return TRUE unless you set the focus to a control
|
||||
// EXCEPTION: OCX Property Pages should return FALSE
|
||||
}
|
||||
|
||||
|
||||
// Call this function to select the API for the display mode enumeration.
|
||||
void FullscreenSettings::setAPI( DISPLAY_TYPE type )
|
||||
{
|
||||
api = type;
|
||||
}
|
||||
|
||||
|
||||
void FullscreenSettings::OnCbnSelchangeComboDevice()
|
||||
{
|
||||
if( failed ) return;
|
||||
|
||||
#ifndef NO_D3D
|
||||
if( api == DIRECT_3D ) {
|
||||
int selection;
|
||||
|
||||
selection = combo_device.GetCurSel();
|
||||
if( selection == LB_ERR ) return;
|
||||
UINT adapter = (UINT)combo_device.GetItemData( selection );
|
||||
|
||||
// enumerate color depths
|
||||
HRESULT res;
|
||||
D3DDISPLAYMODE mode;
|
||||
combo_color_depth.ResetContent();
|
||||
|
||||
res = pD3D->EnumAdapterModes( adapter, D3DFMT_A2R10G10B10, 0, &mode );
|
||||
if( res == D3D_OK ) {
|
||||
int index = combo_color_depth.AddString( _T("32bit+ (A2R10G10B10)") );
|
||||
combo_color_depth.SetItemData( index, (DWORD_PTR)D3DFMT_A2R10G10B10 );
|
||||
}
|
||||
|
||||
res = pD3D->EnumAdapterModes( adapter, D3DFMT_X8R8G8B8, 0, &mode );
|
||||
if( res == D3D_OK ) {
|
||||
int index = combo_color_depth.AddString( _T("32bit (X8R8G8B8)") );
|
||||
combo_color_depth.SetItemData( index, (DWORD_PTR)D3DFMT_X8R8G8B8 );
|
||||
}
|
||||
|
||||
res = pD3D->EnumAdapterModes( adapter, D3DFMT_R5G6B5, 0, &mode );
|
||||
if( res == D3D_OK ) {
|
||||
int index = combo_color_depth.AddString( _T("16bit+ (R5G6B5)") );
|
||||
combo_color_depth.SetItemData( index, (DWORD_PTR)D3DFMT_R5G6B5 );
|
||||
}
|
||||
|
||||
res = pD3D->EnumAdapterModes( adapter, D3DFMT_X1R5G5B5, 0, &mode );
|
||||
if( res == D3D_OK ) {
|
||||
int index = combo_color_depth.AddString( _T("16bit (X1R5G5B5)") );
|
||||
combo_color_depth.SetItemData( index, (DWORD_PTR)D3DFMT_X1R5G5B5 );
|
||||
}
|
||||
|
||||
if( combo_color_depth.GetCount() == 0 ) {
|
||||
failed = true;
|
||||
return;
|
||||
}
|
||||
|
||||
combo_color_depth.SetCurSel( 0 );
|
||||
OnCbnSelchangeComboColorDepth();
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
void FullscreenSettings::OnCbnSelchangeComboColorDepth()
|
||||
{
|
||||
if( failed ) return;
|
||||
|
||||
#ifndef NO_D3D
|
||||
if( api == DIRECT_3D ) {
|
||||
int selection;
|
||||
|
||||
selection = combo_device.GetCurSel();
|
||||
if( selection == LB_ERR ) return;
|
||||
UINT adapter = (UINT)combo_device.GetItemData( selection );
|
||||
|
||||
selection = combo_color_depth.GetCurSel();
|
||||
if( selection == LB_ERR ) return;
|
||||
D3DFORMAT format = (D3DFORMAT)combo_color_depth.GetItemData( selection );
|
||||
|
||||
// enumerate resolutions
|
||||
HRESULT res;
|
||||
D3DDISPLAYMODE mode;
|
||||
UINT nModes = pD3D->GetAdapterModeCount( adapter, format );
|
||||
D3DDISPLAYMODE *allModes = new D3DDISPLAYMODE[nModes];
|
||||
ZeroMemory( allModes, sizeof(D3DDISPLAYMODE) * nModes );
|
||||
combo_resolution.ResetContent();
|
||||
|
||||
for( UINT i = 0 ; i < nModes ; i++ ) {
|
||||
res = pD3D->EnumAdapterModes( adapter, format, i, &mode );
|
||||
if( res == D3D_OK ) {
|
||||
CString temp;
|
||||
temp.Format( _T("%4u x %4u"), mode.Width, mode.Height );
|
||||
bool alreadyPresent = false;
|
||||
for( UINT surf = 0 ; surf < i ; surf++ ) {
|
||||
// ignore same resolution with different refresh rate
|
||||
if( ( allModes[surf].Width == mode.Width ) &&
|
||||
( allModes[surf].Height == mode.Height ) ) {
|
||||
alreadyPresent = true;
|
||||
}
|
||||
}
|
||||
|
||||
if( !alreadyPresent ) {
|
||||
int index = combo_resolution.AddString( temp );
|
||||
combo_resolution.SetItemData( index, (DWORD_PTR)i );
|
||||
}
|
||||
allModes[i] = mode;
|
||||
}
|
||||
}
|
||||
|
||||
delete [] allModes;
|
||||
|
||||
int count = combo_resolution.GetCount();
|
||||
combo_resolution.SetCurSel( count - 1 ); // select last item
|
||||
OnCbnSelchangeComboResolution();
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
void FullscreenSettings::OnCbnSelchangeComboResolution()
|
||||
{
|
||||
if( failed ) return;
|
||||
|
||||
#ifndef NO_D3D
|
||||
if( api == DIRECT_3D ) {
|
||||
int selection;
|
||||
|
||||
selection = combo_device.GetCurSel();
|
||||
if( selection == LB_ERR ) return;
|
||||
UINT adapter = (UINT)combo_device.GetItemData( selection );
|
||||
|
||||
selection = combo_color_depth.GetCurSel();
|
||||
if( selection == LB_ERR ) return;
|
||||
D3DFORMAT format = (D3DFORMAT)combo_color_depth.GetItemData( selection );
|
||||
|
||||
selection = combo_resolution.GetCurSel();
|
||||
if( selection == LB_ERR ) return;
|
||||
UINT iMode = (UINT)combo_resolution.GetItemData( selection );
|
||||
|
||||
// enumerate refresh rates
|
||||
HRESULT res;
|
||||
D3DDISPLAYMODE mode, mode2;
|
||||
pD3D->EnumAdapterModes( adapter, format, iMode, &mode );
|
||||
UINT nModes = pD3D->GetAdapterModeCount( adapter, format );
|
||||
combo_refresh_rate.ResetContent();
|
||||
|
||||
for( UINT i = 0 ; i < nModes ; i++ ) {
|
||||
res = pD3D->EnumAdapterModes( adapter, format, i, &mode2 );
|
||||
if( ( res == D3D_OK ) &&
|
||||
( mode2.Width == mode.Width ) &&
|
||||
( mode2.Height == mode.Height ) )
|
||||
{
|
||||
CString temp;
|
||||
temp.Format( _T("%3u Hz"), mode2.RefreshRate );
|
||||
int index = combo_refresh_rate.AddString( temp );
|
||||
combo_refresh_rate.SetItemData( index, (DWORD_PTR)i );
|
||||
}
|
||||
}
|
||||
|
||||
int count = combo_refresh_rate.GetCount();
|
||||
combo_refresh_rate.SetCurSel( count - 1 ); // select last item
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
void FullscreenSettings::OnOK()
|
||||
{
|
||||
if( failed ) return;
|
||||
|
||||
int selection;
|
||||
|
||||
selection = combo_device.GetCurSel();
|
||||
if( selection == LB_ERR ) return;
|
||||
UINT adapter = (UINT)combo_device.GetItemData( selection );
|
||||
|
||||
selection = combo_color_depth.GetCurSel();
|
||||
if( selection == LB_ERR ) return;
|
||||
D3DFORMAT format = (D3DFORMAT)combo_color_depth.GetItemData( selection );
|
||||
|
||||
selection = combo_refresh_rate.GetCurSel();
|
||||
if( selection == LB_ERR ) return;
|
||||
UINT selectedMode = (UINT)combo_refresh_rate.GetItemData( selection );
|
||||
|
||||
D3DDISPLAYMODE mode;
|
||||
pD3D->EnumAdapterModes( adapter, format, selectedMode, &mode );
|
||||
|
||||
m_device = (unsigned int)adapter;
|
||||
switch( mode.Format )
|
||||
{ // TODO: use these assignments for VBA as well
|
||||
case D3DFMT_A2R10G10B10:
|
||||
m_colorDepth = 30;
|
||||
break;
|
||||
case D3DFMT_X8R8G8B8:
|
||||
m_colorDepth = 24;
|
||||
break;
|
||||
case D3DFMT_R5G6B5:
|
||||
m_colorDepth = 16;
|
||||
break;
|
||||
case D3DFMT_X1R5G5B5:
|
||||
m_colorDepth = 15;
|
||||
break;
|
||||
}
|
||||
m_width = (unsigned int)mode.Width;
|
||||
m_height = (unsigned int)mode.Height;
|
||||
m_refreshRate = (unsigned int)mode.RefreshRate;
|
||||
|
||||
|
||||
CDialog::OnOK();
|
||||
}
|
|
@ -0,0 +1,80 @@
|
|||
// VisualBoyAdvance - Nintendo Gameboy/GameboyAdvance (TM) emulator.
|
||||
// Copyright (C) 2008 VBA-M development team
|
||||
|
||||
// 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 2, 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, write to the Free Software Foundation,
|
||||
// Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "afxwin.h"
|
||||
#include "Display.h"
|
||||
|
||||
|
||||
#ifndef NO_D3D
|
||||
#pragma comment( lib, "d3d9.lib" )
|
||||
#ifdef _DEBUG
|
||||
#define D3D_DEBUG_INFO
|
||||
#endif
|
||||
#define DIRECT3D_VERSION 0x0900
|
||||
#include <d3d9.h>
|
||||
#endif
|
||||
|
||||
|
||||
// FullscreenSettings dialog
|
||||
|
||||
class FullscreenSettings : public CDialog
|
||||
{
|
||||
DECLARE_DYNAMIC(FullscreenSettings)
|
||||
|
||||
public:
|
||||
FullscreenSettings(CWnd* pParent = NULL); // standard constructor
|
||||
virtual ~FullscreenSettings();
|
||||
|
||||
// Dialog Data
|
||||
enum { IDD = IDD_FULLSCREEN };
|
||||
|
||||
// Call this function to select the API for the display mode enumeration.
|
||||
void setAPI( DISPLAY_TYPE type );
|
||||
afx_msg void OnCbnSelchangeComboDevice();
|
||||
afx_msg void OnCbnSelchangeComboColorDepth();
|
||||
afx_msg void OnCbnSelchangeComboResolution();
|
||||
|
||||
unsigned int m_device;
|
||||
unsigned int m_colorDepth;
|
||||
unsigned int m_width;
|
||||
unsigned int m_height;
|
||||
unsigned int m_refreshRate;
|
||||
|
||||
protected:
|
||||
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
|
||||
virtual void OnOK();
|
||||
|
||||
DECLARE_MESSAGE_MAP()
|
||||
|
||||
private:
|
||||
DISPLAY_TYPE api;
|
||||
bool failed;
|
||||
|
||||
#ifndef NO_D3D
|
||||
LPDIRECT3D9 pD3D;
|
||||
#endif
|
||||
|
||||
virtual BOOL OnInitDialog();
|
||||
|
||||
CComboBox combo_device;
|
||||
CComboBox combo_resolution;
|
||||
CComboBox combo_color_depth;
|
||||
CComboBox combo_refresh_rate;
|
||||
};
|
|
@ -1,279 +0,0 @@
|
|||
// source\win32\UniVideoModeDlg.cpp : Implementierungsdatei
|
||||
//
|
||||
|
||||
#include ".\univideomodedlg.h"
|
||||
|
||||
// UniVideoModeDlg-Dialogfeld
|
||||
|
||||
IMPLEMENT_DYNAMIC(UniVideoModeDlg, CDialog)
|
||||
UniVideoModeDlg::UniVideoModeDlg(CWnd* pParent /*=NULL*/, int *width, int *height, int *BPP, int *freq, int *adapt)
|
||||
: CDialog(UniVideoModeDlg::IDD, pParent)
|
||||
{
|
||||
WidthList = 0;
|
||||
HeightList = 0;
|
||||
BPPList = 0;
|
||||
FreqList = 0;
|
||||
iDisplayDevice = 0;
|
||||
SelectedWidth = width;
|
||||
SelectedHeight = height;
|
||||
SelectedBPP = BPP;
|
||||
SelectedFreq = freq;
|
||||
SelectedAdapter = adapt;
|
||||
pD3D = NULL;
|
||||
d3dDLL = NULL;
|
||||
nAdapters = 1;
|
||||
}
|
||||
|
||||
UniVideoModeDlg::~UniVideoModeDlg()
|
||||
{
|
||||
if (WidthList) delete [] WidthList;
|
||||
if (HeightList) delete [] HeightList;
|
||||
if (BPPList) delete [] BPPList;
|
||||
if (FreqList) delete [] FreqList;
|
||||
}
|
||||
|
||||
void UniVideoModeDlg::DoDataExchange(CDataExchange* pDX)
|
||||
{
|
||||
CDialog::DoDataExchange(pDX);
|
||||
}
|
||||
|
||||
|
||||
BEGIN_MESSAGE_MAP(UniVideoModeDlg, CDialog)
|
||||
ON_WM_CREATE()
|
||||
ON_BN_CLICKED(IDOK, OnBnClickedOk)
|
||||
ON_BN_CLICKED(IDCANCEL, OnBnClickedCancel)
|
||||
// ON_STN_CLICKED(IDC_DISPLAYDEVICE, OnStnClickedDisplaydevice)
|
||||
//ON_STN_CLICKED(IDC_DISPLAYDEVICE, OnStnClickedDisplaydevice)
|
||||
ON_STN_CLICKED(IDC_DISPLAYDEVICE, OnStnClickedDisplaydevice)
|
||||
ON_BN_CLICKED(IDC_BUTTON_MAXSCALE, OnBnClickedButtonMaxscale)
|
||||
ON_BN_CLICKED(IDC_CHECK_STRETCHTOFIT, OnBnClickedCheckStretchtofit)
|
||||
END_MESSAGE_MAP()
|
||||
|
||||
|
||||
// UniVideoModeDlg-Meldungshandler
|
||||
|
||||
int UniVideoModeDlg::OnCreate(LPCREATESTRUCT lpCreateStruct)
|
||||
{
|
||||
if (CDialog::OnCreate(lpCreateStruct) == -1)
|
||||
return -1;
|
||||
|
||||
// TODO: Fügen Sie Ihren spezialisierten Erstellcode hier ein.
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
BOOL UniVideoModeDlg::OnInitDialog()
|
||||
{
|
||||
CDialog::OnInitDialog();
|
||||
|
||||
CButton* check_stretchtofit = (CButton*)GetDlgItem(IDC_CHECK_STRETCHTOFIT);
|
||||
check_stretchtofit->SetCheck(theApp.fullScreenStretch ? BST_CHECKED : BST_UNCHECKED);
|
||||
|
||||
CStatic* apiname = (CStatic*)GetDlgItem(IDC_APINAME);
|
||||
CStatic* devicename = (CStatic*)GetDlgItem(IDC_DISPLAYDEVICE);
|
||||
CListBox* listmodes = (CListBox*)GetDlgItem(IDC_LISTMODES);
|
||||
CString temp;
|
||||
DWORD w, h, b, f;
|
||||
UINT nModes16, nModes32;
|
||||
|
||||
switch (theApp.display->getType())
|
||||
{
|
||||
case GDI:
|
||||
apiname->SetWindowText("Windows GDI");
|
||||
DISPLAY_DEVICE dd;
|
||||
dd.cb = sizeof(dd);
|
||||
EnumDisplayDevices(NULL, iDisplayDevice, &dd, 0);
|
||||
devicename->SetWindowText(dd.DeviceString);
|
||||
DEVMODE dm;
|
||||
dm.dmSize = sizeof(DEVMODE);
|
||||
dm.dmDriverExtra = 0;
|
||||
DWORD maxMode;
|
||||
DWORD i;
|
||||
for (i=0; 0 != EnumDisplaySettings(dd.DeviceName, i, &dm); i++) {}
|
||||
maxMode = i-1;
|
||||
listmodes->InitStorage(i, 25);
|
||||
if (WidthList!=0) delete [] WidthList;
|
||||
if (HeightList!=0) delete [] HeightList;
|
||||
if (BPPList!=0) delete [] BPPList;
|
||||
if (FreqList!=0) delete [] FreqList;
|
||||
WidthList = new DWORD[i];
|
||||
HeightList = new DWORD[i];
|
||||
BPPList = new DWORD[i];
|
||||
FreqList = new DWORD[i];
|
||||
listmodes->ResetContent();
|
||||
for (i=0; i<maxMode+1; i++)
|
||||
{
|
||||
EnumDisplaySettings(dd.DeviceName, i, &dm);
|
||||
w = dm.dmPelsWidth;
|
||||
h = dm.dmPelsHeight;
|
||||
b = dm.dmBitsPerPel;
|
||||
f = dm.dmDisplayFrequency;
|
||||
|
||||
temp.Format("%dx%dx%d @%dHz", w, h, b, f);
|
||||
listmodes->AddString(temp);
|
||||
WidthList[i] = w;
|
||||
HeightList[i] = h;
|
||||
BPPList[i] = b;
|
||||
FreqList[i] = f;
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
case DIRECT_DRAW:
|
||||
apiname->SetWindowText("DirectDraw 7");
|
||||
break;
|
||||
|
||||
|
||||
case DIRECT_3D:
|
||||
apiname->SetWindowText("Direct3D 9");
|
||||
// Load DirectX DLL
|
||||
d3dDLL = LoadLibrary("D3D9.DLL");
|
||||
LPDIRECT3D9 (WINAPI *D3DCreate)(UINT);
|
||||
D3DCreate = (LPDIRECT3D9 (WINAPI *)(UINT))
|
||||
GetProcAddress(d3dDLL, "Direct3DCreate9");
|
||||
pD3D = D3DCreate(D3D_SDK_VERSION);
|
||||
nAdapters = pD3D->GetAdapterCount();
|
||||
D3DADAPTER_IDENTIFIER9 id;
|
||||
pD3D->GetAdapterIdentifier(iDisplayDevice, 0, &id);
|
||||
devicename->SetWindowText(id.Description);
|
||||
|
||||
D3DDISPLAYMODE d3ddm;
|
||||
|
||||
nModes16 = pD3D->GetAdapterModeCount(iDisplayDevice, D3DFMT_R5G6B5);
|
||||
nModes32 = pD3D->GetAdapterModeCount(iDisplayDevice, D3DFMT_X8R8G8B8);
|
||||
|
||||
listmodes->InitStorage(nModes16+nModes32, 25);
|
||||
listmodes->ResetContent();
|
||||
|
||||
if (WidthList!=0) delete [] WidthList;
|
||||
if (HeightList!=0) delete [] HeightList;
|
||||
if (BPPList!=0) delete [] BPPList;
|
||||
if (FreqList!=0) delete [] FreqList;
|
||||
WidthList = new DWORD[nModes16+nModes32];
|
||||
HeightList = new DWORD[nModes16+nModes32];
|
||||
BPPList = new DWORD[nModes16+nModes32];
|
||||
FreqList = new DWORD[nModes16+nModes32];
|
||||
|
||||
b = 16;
|
||||
for (UINT i = 0; i < nModes16; i++)
|
||||
{
|
||||
pD3D->EnumAdapterModes(iDisplayDevice, D3DFMT_R5G6B5, i, &d3ddm);
|
||||
w = d3ddm.Width;
|
||||
h = d3ddm.Height;
|
||||
f = d3ddm.RefreshRate;
|
||||
|
||||
temp.Format("%dx%dx%d @%dHz", w, h, b, f);
|
||||
listmodes->AddString(temp);
|
||||
|
||||
WidthList[i] = w;
|
||||
HeightList[i] = h;
|
||||
BPPList[i] = b;
|
||||
FreqList[i] = f;
|
||||
}
|
||||
b = 32;
|
||||
for (UINT i = 0; i < nModes32; i++)
|
||||
{
|
||||
pD3D->EnumAdapterModes(iDisplayDevice, D3DFMT_X8R8G8B8, i, &d3ddm);
|
||||
w = d3ddm.Width;
|
||||
h = d3ddm.Height;
|
||||
f = d3ddm.RefreshRate;
|
||||
|
||||
temp.Format("%dx%dx%d @%dHz", w, h, b, f);
|
||||
listmodes->AddString(temp);
|
||||
|
||||
WidthList[i+nModes16] = w;
|
||||
HeightList[i+nModes16] = h;
|
||||
BPPList[i+nModes16] = b;
|
||||
FreqList[i+nModes16] = f;
|
||||
}
|
||||
|
||||
// Clean up
|
||||
pD3D->Release();
|
||||
pD3D = NULL;
|
||||
if(d3dDLL != NULL)
|
||||
{
|
||||
FreeLibrary(d3dDLL);
|
||||
d3dDLL = NULL;
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
case OPENGL:
|
||||
apiname->SetWindowText("OpenGL");
|
||||
break;
|
||||
}
|
||||
|
||||
return TRUE; // return TRUE unless you set the focus to a control
|
||||
// EXCEPTION: OCX Property Pages should return FALSE
|
||||
}
|
||||
|
||||
|
||||
void UniVideoModeDlg::OnBnClickedOk()
|
||||
{
|
||||
CListBox* listmodes = (CListBox*)GetDlgItem(IDC_LISTMODES);
|
||||
int selection = listmodes->GetCurSel();
|
||||
if (selection == LB_ERR)
|
||||
{
|
||||
MessageBox("No mode selected!", "Error", MB_OK | MB_ICONWARNING);
|
||||
return;
|
||||
}
|
||||
*SelectedWidth = WidthList[selection];
|
||||
*SelectedHeight = HeightList[selection];
|
||||
*SelectedBPP = BPPList[selection];
|
||||
*SelectedFreq = FreqList[selection];
|
||||
*SelectedAdapter = iDisplayDevice;
|
||||
|
||||
EndDialog(0);
|
||||
}
|
||||
|
||||
void UniVideoModeDlg::OnBnClickedCancel()
|
||||
{
|
||||
EndDialog(-1);
|
||||
}
|
||||
void UniVideoModeDlg::OnStnClickedDisplaydevice()
|
||||
{
|
||||
DWORD old = iDisplayDevice;
|
||||
switch (theApp.display->getType())
|
||||
{
|
||||
case GDI:
|
||||
DISPLAY_DEVICE dd;
|
||||
dd.cb = sizeof(dd);
|
||||
if (0 == EnumDisplayDevices(NULL, ++iDisplayDevice, &dd, 0))
|
||||
iDisplayDevice = 0;
|
||||
break;
|
||||
|
||||
|
||||
case DIRECT_DRAW:
|
||||
break;
|
||||
|
||||
|
||||
case DIRECT_3D:
|
||||
iDisplayDevice++;
|
||||
if (iDisplayDevice == nAdapters) iDisplayDevice = 0;
|
||||
break;
|
||||
|
||||
|
||||
case OPENGL:
|
||||
break;
|
||||
}
|
||||
|
||||
if (iDisplayDevice != old)
|
||||
OnInitDialog();
|
||||
}
|
||||
|
||||
void UniVideoModeDlg::OnBnClickedButtonMaxscale()
|
||||
{
|
||||
MaxScale dlg;
|
||||
theApp.winCheckFullscreen();
|
||||
dlg.DoModal();
|
||||
}
|
||||
|
||||
void UniVideoModeDlg::OnBnClickedCheckStretchtofit()
|
||||
{
|
||||
theApp.fullScreenStretch = !theApp.fullScreenStretch;
|
||||
theApp.updateWindowSize(theApp.videoOption);
|
||||
if(theApp.display)
|
||||
theApp.display->clear();
|
||||
this->SetFocus();
|
||||
}
|
|
@ -1,47 +0,0 @@
|
|||
#pragma once
|
||||
|
||||
#include "stdafx.h"
|
||||
#include <d3d9.h>
|
||||
#include "VBA.h"
|
||||
#include "MaxScale.h"
|
||||
|
||||
// UniVideoModeDlg-Dialogfeld
|
||||
|
||||
class UniVideoModeDlg : public CDialog
|
||||
{
|
||||
DECLARE_DYNAMIC(UniVideoModeDlg)
|
||||
|
||||
public:
|
||||
UniVideoModeDlg(CWnd* pParent = NULL, int *width=0, int *height=0, int *BPP=0, int *freq=0, int *adapt=0); // Standardkonstruktor
|
||||
virtual ~UniVideoModeDlg();
|
||||
|
||||
// Dialogfelddaten
|
||||
enum { IDD = IDD_UNIVIDMODE };
|
||||
|
||||
protected:
|
||||
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV-Unterstützung
|
||||
|
||||
DECLARE_MESSAGE_MAP()
|
||||
public:
|
||||
afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct);
|
||||
afx_msg void OnBnClickedOk();
|
||||
BOOL OnInitDialog();
|
||||
afx_msg void OnBnClickedCancel();
|
||||
|
||||
private:
|
||||
DWORD *WidthList, *HeightList, *BPPList, *FreqList;
|
||||
DWORD iDisplayDevice;
|
||||
HINSTANCE d3dDLL;
|
||||
LPDIRECT3D9 pD3D;
|
||||
UINT nAdapters;
|
||||
public:
|
||||
int
|
||||
*SelectedWidth,
|
||||
*SelectedHeight,
|
||||
*SelectedBPP,
|
||||
*SelectedFreq,
|
||||
*SelectedAdapter;
|
||||
afx_msg void OnStnClickedDisplaydevice();
|
||||
afx_msg void OnBnClickedButtonMaxscale();
|
||||
afx_msg void OnBnClickedCheckStretchtofit();
|
||||
};
|
|
@ -32,12 +32,16 @@ BEGIN
|
|||
"resource.\0"
|
||||
END
|
||||
|
||||
|
||||
3 TEXTINCLUDE
|
||||
BEGIN
|
||||
"\r\0"
|
||||
END
|
||||
|
||||
2 TEXTINCLUDE
|
||||
BEGIN
|
||||
"#include ""afxres.h""\r\0"
|
||||
END
|
||||
|
||||
#endif // APSTUDIO_INVOKED
|
||||
|
||||
#endif // German (Germany) resources
|
||||
|
@ -911,15 +915,15 @@ BEGIN
|
|||
LTEXT "Available drivers:",IDC_STATIC,7,7,194,8
|
||||
END
|
||||
|
||||
IDD_THROTTLE DIALOG 0, 0, 186, 63
|
||||
IDD_THROTTLE DIALOGEX 0, 0, 126, 60
|
||||
STYLE DS_SETFONT | DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
|
||||
CAPTION "Throttle"
|
||||
FONT 8, "MS Sans Serif"
|
||||
FONT 8, "MS Sans Serif", 0, 0, 0x0
|
||||
BEGIN
|
||||
EDITTEXT IDC_THROTTLE,7,20,172,14,ES_AUTOHSCROLL
|
||||
DEFPUSHBUTTON "OK",ID_OK,37,42,50,14
|
||||
PUSHBUTTON "Cancel",ID_CANCEL,99,42,50,14
|
||||
LTEXT "Enter desired throttle (5%...1000%):",IDC_STATIC,7,7,172,8
|
||||
EDITTEXT IDC_THROTTLE,6,18,114,12,ES_CENTER | ES_AUTOHSCROLL
|
||||
DEFPUSHBUTTON "OK",ID_OK,6,36,54,18
|
||||
PUSHBUTTON "Cancel",ID_CANCEL,66,36,54,18
|
||||
CTEXT "Enter desired throttle (5%...1000%):",IDC_STATIC,6,6,114,8
|
||||
END
|
||||
|
||||
IDD_GB_DISASSEMBLE DIALOG 0, 0, 344, 225
|
||||
|
@ -1193,6 +1197,23 @@ BEGIN
|
|||
PUSHBUTTON "...",IDC_SELECT_GBA_BIOS_PATH,192,60,18,12
|
||||
END
|
||||
|
||||
IDD_FULLSCREEN DIALOGEX 0, 0, 167, 96
|
||||
STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU
|
||||
CAPTION "Fullscreen Settings"
|
||||
FONT 8, "MS Shell Dlg", 400, 0, 0x1
|
||||
BEGIN
|
||||
DEFPUSHBUTTON "OK",IDOK,60,78,48,12
|
||||
PUSHBUTTON "Cancel",IDCANCEL,114,78,48,12
|
||||
COMBOBOX IDC_COMBO_RESOLUTION,60,42,102,12,CBS_DROPDOWNLIST | CBS_SORT | WS_VSCROLL | WS_TABSTOP
|
||||
RTEXT "Resolution:",IDC_STATIC,6,42,48,12
|
||||
RTEXT "Color depth:",IDC_STATIC,6,24,48,12
|
||||
COMBOBOX IDC_COMBO_COLOR_DEPTH,60,24,102,12,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
|
||||
RTEXT "Refresh rate:",IDC_STATIC,6,60,48,12
|
||||
COMBOBOX IDC_COMBO_REFRESH_RATE,60,60,102,12,CBS_DROPDOWNLIST | CBS_SORT | WS_VSCROLL | WS_TABSTOP
|
||||
COMBOBOX IDC_COMBO_DEVICE,60,6,102,12,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
|
||||
RTEXT "Device:",IDC_STATIC,6,6,48,12
|
||||
END
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
|
@ -1458,9 +1479,9 @@ BEGIN
|
|||
IDD_THROTTLE, DIALOG
|
||||
BEGIN
|
||||
LEFTMARGIN, 7
|
||||
RIGHTMARGIN, 179
|
||||
RIGHTMARGIN, 119
|
||||
TOPMARGIN, 7
|
||||
BOTTOMMARGIN, 56
|
||||
BOTTOMMARGIN, 53
|
||||
END
|
||||
|
||||
IDD_GB_DISASSEMBLE, DIALOG
|
||||
|
@ -1550,6 +1571,14 @@ BEGIN
|
|||
TOPMARGIN, 7
|
||||
BOTTOMMARGIN, 119
|
||||
END
|
||||
|
||||
IDD_FULLSCREEN, DIALOG
|
||||
BEGIN
|
||||
LEFTMARGIN, 7
|
||||
RIGHTMARGIN, 160
|
||||
TOPMARGIN, 7
|
||||
BOTTOMMARGIN, 89
|
||||
END
|
||||
END
|
||||
#endif // APSTUDIO_INVOKED
|
||||
|
||||
|
|
|
@ -100,6 +100,7 @@
|
|||
#define IDD_SELECT_PLUGIN 159
|
||||
#define IDD_OAL_CONFIG 160
|
||||
#define IDD_BIOS 161
|
||||
#define IDD_FULLSCREEN 162
|
||||
#define IDC_R0 1000
|
||||
#define IDC_EDIT_UP 1000
|
||||
#define IDC_R1 1001
|
||||
|
@ -524,6 +525,10 @@
|
|||
#define IDC_SELECT_GB_BIOS_PATH 1277
|
||||
#define IDC_SELECT_GBA_BIOS_PATH 1278
|
||||
#define IDC_CLEAR_ALL 1278
|
||||
#define IDC_COMBO_RESOLUTION 1280
|
||||
#define IDC_COMBO_COLOR_DEPTH 1281
|
||||
#define IDC_COMBO_REFRESH_RATE 1282
|
||||
#define IDC_COMBO_DEVICE 1283
|
||||
#define IDS_OAL_NODEVICE 2000
|
||||
#define IDS_OAL_NODLL 2001
|
||||
#define IDS_AVI_CANNOT_CREATE_AVI 2002
|
||||
|
@ -845,9 +850,9 @@
|
|||
//
|
||||
#ifdef APSTUDIO_INVOKED
|
||||
#ifndef APSTUDIO_READONLY_SYMBOLS
|
||||
#define _APS_NEXT_RESOURCE_VALUE 162
|
||||
#define _APS_NEXT_RESOURCE_VALUE 163
|
||||
#define _APS_NEXT_COMMAND_VALUE 40359
|
||||
#define _APS_NEXT_CONTROL_VALUE 1279
|
||||
#define _APS_NEXT_CONTROL_VALUE 1284
|
||||
#define _APS_NEXT_SYMED_VALUE 103
|
||||
#endif
|
||||
#endif
|
||||
|
|
Loading…
Reference in New Issue