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

📄 wince_options.cpp

📁 这个是延伸mame的在wince平台下的游戏模拟器的代码
💻 CPP
字号:
/* PocketCultMAME - MAME Emulator for PocketPC
   (c) Copyright 2006 Manuel Castrillo Mart韓ez

   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 of the License, or
   (at your option) any later version.

   This program is distributed in the hope that it will be useful,
   but WITHOUT ANY WARRANTY; without even the implied warranty of
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
   GNU General Public License for more details.

   You should have received a copy of the GNU General Public License
   along with this program; if not, write to the Free Software
   Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/

#define WIN32_LEAN_AND_MEAN		// Exclude rarely-used stuff from Windows headers
#include <windows.h>
#include <windowsx.h>
#include <wingdi.h>
#include <aygshell.h>
#include <commctrl.h>
#include <winuser.h>
#include <gx.h>

#include "wince_driver.h"
#include "wince_options.h"
#include "wince_cfg.h"
#include "osdepend.h"
#include "vidsys.h"
#include "audio.h"

#include "resource.h"

extern "C"
{
	extern void setFullScreenDialog( HWND hDlg );

	extern cfgStruct GameConfig;		// from wince_cfg.cpp
	extern cfgStruct DefConfig;
}

extern HWND hWnd;					// from wince_mame.cpp
extern HINSTANCE g_hInstance;

cfgStruct ModConfig;

int GameIndexToConfigure = -1;

int KeyToChange_key;
short KeyToChange_code;

int buttonsValues[] = { OSD_JOY_UP, OSD_JOY_DOWN, OSD_JOY_LEFT, OSD_JOY_RIGHT, 
						OSD_JOY_FIRE1, OSD_JOY_FIRE2, OSD_JOY_FIRE3, OSD_JOY_FIRE4, OSD_JOY_FIRE5,
						OSD_KEY_1, OSD_KEY_3, OSD_KEY_ESC, -1 };

//
// Forward declarations.
//

LRESULT CALLBACK dlgSoundConfig(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam);
LRESULT CALLBACK dlgVideoConfig(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam);
LRESULT CALLBACK dlgInputConfig(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam);
LRESULT CALLBACK dlgVoidKey(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam);


int findValue( int *valueList, int value )
{
	int returnValue = 0;

	for( returnValue = 0; returnValue < 256; returnValue++ )
	{
		if( valueList[returnValue] == value || valueList[returnValue] == -1 )
			break;	// If value or end of list is found, finish the search
	}

	return(returnValue);
}


void updateGameName( HWND hDlg )
{

	char gameCompleteName[256];
	TCHAR gameWCompleteName[256];

	if( GameIndexToConfigure < 0 )
	{
		strcpy( gameCompleteName, " > Configure default options" );
		Button_Enable( GetDlgItem( hDlg, IDC_btnSaveGameConfig ), FALSE );
		ModConfig = DefConfig;
	}
	else
	{
		strcpy( gameCompleteName, " > Configure " );
		strcat( gameCompleteName, (char *)gameDescriptionByIndex( GameIndexToConfigure ) );
		ModConfig = GameConfig;
	}

	mbstowcs( gameWCompleteName, gameCompleteName, 256 );
	Static_SetText( GetDlgItem( hDlg, IDC_stcOptions ) , gameWCompleteName );

}



LRESULT CALLBACK dlgOptions(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
{

	SHINITDLGINFO shidi;

	switch (message)
	{

		case WM_INITDIALOG:

			RECT rect;
			SystemParametersInfo(SPI_GETWORKAREA, 0, &rect, 0);
            shidi.dwMask = SHIDIM_FLAGS;
            shidi.dwFlags = SHIDIF_SIZEDLGFULLSCREEN | SHIDIF_DONEBUTTON | SHIDIF_FULLSCREENNOMENUBAR;
			shidi.hDlg = hDlg;
			SHInitDialog(&shidi);
			setFullScreenDialog( hDlg );

			updateGameName(hDlg);

            UpdateWindow(hDlg);

			return TRUE; 

		case WM_COMMAND:

			switch( LOWORD(wParam) )
			{

				case IDC_btnChangeVideoConfig :
					DialogBox( g_hInstance, (LPCTSTR)IDD_dlgVideoConfig, hWnd, (DLGPROC)dlgVideoConfig);
					SetForegroundWindow(hDlg);
					SHFullScreen(hDlg, SHFS_HIDETASKBAR | SHFS_HIDESIPBUTTON);
					UpdateWindow(hDlg);
					break;

				case IDC_btnChangeSoundConfig :
					DialogBox( g_hInstance, (LPCTSTR)IDD_dlgSoundConfig, hWnd, (DLGPROC)dlgSoundConfig);
					SetForegroundWindow(hDlg);
					SHFullScreen(hDlg, SHFS_HIDETASKBAR | SHFS_HIDESIPBUTTON);
					UpdateWindow(hDlg);
					break;

				case IDC_btnChangeInputConfig :
					DialogBox( g_hInstance, (LPCTSTR)IDD_dlgInputConfig, hWnd, (DLGPROC)dlgInputConfig);
					SetForegroundWindow(hDlg);
					SHFullScreen(hDlg, SHFS_HIDETASKBAR | SHFS_HIDESIPBUTTON);
					UpdateWindow(hDlg);
					break;

				case IDC_btnLoadDefaultConfig :
					if( MessageBox( hDlg, _T("The current configuration will not be saved, continue?"), _T("Confirmation"), MB_OKCANCEL | MB_ICONWARNING ) == IDOK )
					{
						loadConfiguration( "default", ModConfig );
						MessageBox( hDlg, _T("Default configuration loaded for the selected game."), _T("Ok"), MB_OK | MB_ICONASTERISK );
					}
					break;

				case IDC_btnSaveDefaultConfig :
					saveConfiguration( "default", ModConfig );
					MessageBox( hDlg, _T("Default configuration saved!"), _T("Ok"), MB_OK | MB_ICONASTERISK );
					DefConfig = ModConfig; // Uses the current configuration as default
					EndDialog(hDlg, 0);
					break;

				case IDC_btnSaveGameConfig :
					saveConfiguration( (char *)gameNameByIndex( GameIndexToConfigure ), ModConfig );
					MessageBox( hDlg, _T("Configuration for the selected game saved!"), _T("Ok"), MB_OK | MB_ICONASTERISK );
					GameConfig = ModConfig;	// Uses the current configuration for the game selected
					EndDialog(hDlg, 0);
					break;

				case IDC_btnCancelSaveConfig :
					EndDialog(hDlg, 0);
					break;

			}

	}

	return FALSE;

}


///
/// Video configuration
///

LRESULT CALLBACK dlgVideoConfig(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
{

	HWND cmbOrientation = GetDlgItem( hDlg, IDC_cmbVideoOrientation );
	HWND cmbScaling = GetDlgItem( hDlg, IDC_cmbVideoScaling );
	HWND cmbFx = GetDlgItem( hDlg, IDC_cmbVideoFX );

	SHINITDLGINFO shidi;

	switch (message)
	{

		case WM_INITDIALOG:

			RECT rect;
			SystemParametersInfo(SPI_GETWORKAREA, 0, &rect, 0);
            shidi.dwMask = SHIDIM_FLAGS;
            shidi.dwFlags = SHIDIF_SIZEDLGFULLSCREEN | SHIDIF_DONEBUTTON | SHIDIF_FULLSCREENNOMENUBAR;
			shidi.hDlg = hDlg;
			SHInitDialog(&shidi);
			setFullScreenDialog( hDlg );

			// Screen orientation

			ComboBox_AddString( cmbOrientation, _T("Auto, landscape 90

⌨️ 快捷键说明

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