Exemplo n.º 1
0
Arquivo: config.c Projeto: VCCE/VCC
void UpdateConfig (void)
{
	SetResize(CurrentConfig.Resize);
	SetAspect(CurrentConfig.Aspect);
	SetScanLines(CurrentConfig.ScanLines);
	SetFrameSkip(CurrentConfig.FrameSkip);
	SetAutoStart(CurrentConfig.AutoStart);
	SetSpeedThrottle(CurrentConfig.SpeedThrottle);
	SetCPUMultiplyer(CurrentConfig.CPUMultiplyer);
	SetRamSize(CurrentConfig.RamSize);
	SetCpuType(CurrentConfig.CpuType);
	SetMonitorType(CurrentConfig.MonitorType);
	SetCartAutoStart(CurrentConfig.CartAutoStart);
	if (CurrentConfig.RebootNow)
	{
		DoReboot();
	}
	CurrentConfig.RebootNow = 0;
}
Exemplo n.º 2
0
Arquivo: Vcc.c Projeto: vcc6809/VCC
// The Window Procedure
LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
{
	int wmId, wmEvent;
	unsigned int x,y;
	unsigned char kb_char; 
	kb_char=(unsigned char)wParam;
	static unsigned char OEMscan=0;
	static char ascii=0;
	static RECT ClientSize;
	static unsigned long Width,Height;

	switch (message) 
	{
		case WM_COMMAND:
			wmId    = LOWORD(wParam); 
			wmEvent = HIWORD(wParam); 
			// Parse the menu selections:
			// Added for Dynamic menu system
			if ( (wmId >=ID_SDYNAMENU) & (wmId <=ID_EDYNAMENU) )
			{
				DynamicMenuActivated (wmId - ID_SDYNAMENU);	//Calls to the loaded DLL so it can do the right thing
				break;
			}

			switch (wmId)
			{	
				case IDM_HELP_ABOUT:
					DialogBox(EmuState.WindowInstance, (LPCTSTR)IDD_ABOUTBOX, hWnd, (DLGPROC)About);
				    break;

				case ID_CONFIGURE_OPTIONS:
					
					if (EmuState.ConfigDialog==NULL)
					{
						EmuState.ConfigDialog = CreateDialog (NULL,(LPCTSTR)IDD_TCONFIG,EmuState.WindowHandle,(DLGPROC) Config) ;
						ShowWindow (EmuState.ConfigDialog, SW_SHOWNORMAL) ;
					}
				//	DialogBox(EmuState.WindowInstance, (LPCTSTR)IDD_TCONFIG, hWnd, (DLGPROC)Config);
				    break;


				case IDOK:
					SendMessage (hWnd, WM_CLOSE, 0, 0);
					break;

				case ID_FILE_EXIT:
					BinaryRunning=0;
					break;

				case ID_FILE_RESET:
					if (EmuState.EmulationRunning)
						EmuState.ResetPending=2;
					break;

				case ID_FILE_RUN:
					EmuState.EmulationRunning=TRUE;
					InvalidateBoarder();
					break;

				case ID_FILE_RESET_SFT:
					if (EmuState.EmulationRunning)
						EmuState.ResetPending=1;
					break;

				case ID_FILE_LOAD:
					LoadIniFile();
					EmuState.ResetPending=2;
					SetClockSpeed(1); //Default clock speed .89 MHZ	
					break;

				default:
				   return DefWindowProc(hWnd, message, wParam, lParam);
			}
			break;

//		case WM_CREATE:
//				
//			break;
//		case WM_SETFOCUS:
//			Set8BitPalette();
//			break;

		case WM_CLOSE:
			BinaryRunning=0;
			break;

		case WM_CHAR:
//			OEMscan=(unsigned char)((lParam & 0xFF0000)>>16);
//			ascii=kb_char;
//			sprintf(ttbuff,"Getting REAL CHAR %i",ascii);
//			WriteLine ( ttbuff);
//			KeyboardEvent(kb_char,OEMscan,1); //Capture ascii value for scancode
			return 0;
			break;

		case WM_KEYUP:
		case WM_SYSKEYUP:
			OEMscan=(unsigned char)((lParam & 0xFF0000)>>16);
			KeyboardEvent(kb_char,OEMscan,0);
			return 0;
		break;

		case WM_KEYDOWN: 
		case WM_SYSKEYDOWN:
			OEMscan=(unsigned char)((lParam & 0xFF0000)>>16);

			switch (OEMscan)
			{
				case 61:	//F3

				break;
				case 62:	//F4

				break;

				case 63:	//F5
					if (EmuState.EmulationRunning)
						EmuState.ResetPending=1;
				break;

				case 64:	//F6
					SetMonitorType(!SetMonitorType(QUERY));
				break;

	//			case 65:	//F7
	//				SetArtifacts(!SetArtifacts(QUERY));
	//			break;

				case 66:	//F8
					SetSpeedThrottle(!SetSpeedThrottle(QUERY));
				break;

				case 67:	//F9
					EmuState.EmulationRunning=!EmuState.EmulationRunning;
					if (EmuState.EmulationRunning)
						EmuState.ResetPending=2;
					else
						SetStatusBarText("",&EmuState);
				break;

				case 68:	//F10
					SetInfoBand(!SetInfoBand(QUERY));
					InvalidateBoarder();
				break;
				
				case 87:	//F11
				if (FlagEmuStop==TH_RUNNING)
				{
					FlagEmuStop=TH_REQWAIT;
					EmuState.FullScreen=!EmuState.FullScreen;
				}
		
				break;

	//			case 88:	//F12
	//				CpuDump();
	//				break;

				default:
					if (EmuState.EmulationRunning)
						KeyboardEvent(kb_char,OEMscan,2);		
					break;
			}
			return 0;
		break;

		case WM_LBUTTONDOWN:  //0 = Left 1=right
			SetButtonStatus(0,1);
			break;

		case WM_LBUTTONUP:
			SetButtonStatus(0,0);
			break;

		case WM_RBUTTONDOWN:
			SetButtonStatus(1,1);
			break;

		case WM_RBUTTONUP:
			SetButtonStatus(1,0);
			break;

		case WM_MOUSEMOVE:
			if (EmuState.EmulationRunning)
			{
				x = LOWORD( lParam ) ;
				y = HIWORD( lParam ) ;
				GetClientRect(EmuState.WindowHandle,&ClientSize);
				x/=((ClientSize.right-ClientSize.left)>>6);
				y/=(((ClientSize.bottom-ClientSize.top)-20)>>6);
				joystick(x,y);
			}
			return(0);
			break;
//		default:
//			return DefWindowProc(hWnd, message, wParam, lParam);
   }