コード例 #1
0
ファイル: inpdipsw.cpp プロジェクト: Cpasjuste/libarcade
static int InpDIPSWInit()
{
	BurnDIPInfo bdi;
	struct GameInp *pgi;

	InpDIPSWGetOffset();

	InpDIPSWListBegin();
	InpDIPSWListMake();

	for (int i = 0, j = 0; BurnDrvGetDIPInfo(&bdi, i) == 0; i++) {
		if (bdi.nInput >= 0  && bdi.nFlags == 0xFF) {
			pgi = GameInp + bdi.nInput + nDIPOffset;
			nPrevDIPSettings[j] = pgi->Input.Constant.nConst;
			j++;
		}
	}

	return 0;
}
コード例 #2
0
ファイル: inpdipsw.cpp プロジェクト: tmaul/FBA4PSP
static BOOL CALLBACK DialogProc(HWND hDlg, UINT Msg, WPARAM wParam, LPARAM lParam)
{
	if (Msg == WM_INITDIALOG) {

//		EnableWindow(hScrnWnd, FALSE);

		hInpDIPSWDlg = hDlg;
		InpDIPSWInit();
		if (!kNetGame && bAutoPause) {
			bRunPause = 1;
		}
		return TRUE;
	}

    if (Msg == WM_CLOSE) {
		EnableWindow(hScrnWnd, TRUE);
		DestroyWindow(hInpDIPSWDlg);
		return 0;
	}

	if (Msg == WM_DESTROY) {
		InpDIPSWCancel();
		InpDIPSWExit();
		return 0;
	}

	if (Msg == WM_COMMAND) {
		int Id = LOWORD(wParam);
		int Notify = HIWORD(wParam);

		if (Id == IDOK && Notify == BN_CLICKED) {			// OK button
			bOK = true;
			SendMessage(hDlg, WM_CLOSE, 0, 0);
			return 0;
		}
		if (Id == IDCANCEL && Notify == BN_CLICKED) {		// cancel = close
			SendMessage(hDlg, WM_CLOSE, 0, 0);
			return 0;
		}

		// New DIPswitch value selected
		if (Id == IDC_INPCX1_VALUE && Notify == CBN_SELCHANGE) {
			BurnDIPInfo bdi = {0, 0, 0, 0, NULL};
			struct GameInp *pgi;
			int nSel = SendMessage(GetDlgItem(hInpDIPSWDlg, IDC_INPCX1_VALUE), CB_GETCURSEL, 0, 0);
			int j = 0;
			for (int i = 0; i <= nSel; i++) {
				do {
					BurnDrvGetDIPInfo(&bdi, nDIPGroup + 1 + j++);
				} while (bdi.nFlags == 0);
			}
			pgi = GameInp + bdi.nInput + nDIPOffset;
			pgi->Input.Constant.nConst = (pgi->Input.Constant.nConst & ~bdi.nMask) | (bdi.nSetting & bdi.nMask);
			if (bdi.nFlags & 0x40) {
				while (BurnDrvGetDIPInfo(&bdi, nDIPGroup + 1 + j++) == 0) {
					if (bdi.nFlags == 0) {
						pgi = GameInp + bdi.nInput + nDIPOffset;
						pgi->Input.Constant.nConst = (pgi->Input.Constant.nConst & ~bdi.nMask) | (bdi.nSetting & bdi.nMask);
					} else {
						break;
					}
				}
			}

			InpDIPSWListMake();
			return 0;
		}

		// New DIPswitch selected
		if (Id == IDC_INPC_RESET && Notify == BN_CLICKED) {

			InpDIPSWResetDIPs();

			InpDIPSWListMake();								// refresh view
			SendMessage(GetDlgItem(hInpDIPSWDlg, IDC_INPCX1_VALUE), CB_RESETCONTENT, 0, 0);
			return 0;
	   }

	}

	if (Msg == WM_NOTIFY && lParam) {
		int Id = LOWORD(wParam);
		NMHDR* pnm = (NMHDR*)lParam;

		if (Id == IDC_INPCHEAT_LIST && pnm->code == LVN_ITEMCHANGED) {
			if (((NM_LISTVIEW*)lParam)->uNewState & LVIS_SELECTED) {
				InpDIPSWSelect();
			}
			return 0;
		}

		if (Id == IDC_INPCHEAT_LIST && pnm->code == NM_CUSTOMDRAW) {
			NMLVCUSTOMDRAW* plvcd = (NMLVCUSTOMDRAW*)lParam;

			switch (plvcd->nmcd.dwDrawStage) {
				case CDDS_PREPAINT: {
                    SetWindowLong(hInpDIPSWDlg, DWL_MSGRESULT, CDRF_NOTIFYITEMDRAW);
					return 1;
				}
				case CDDS_ITEMPREPAINT: {
					BurnDIPInfo bdi;
					BurnDrvGetDIPInfo(&bdi, plvcd->nmcd.lItemlParam);
					if (bdi.nFlags == 0xFD) {
						plvcd->clrTextBk = RGB(0xFF, 0xDF, 0xBB);
    					SetWindowLong(hInpDIPSWDlg, DWL_MSGRESULT, CDRF_NEWFONT);
					}

					return 1;
				}
			}
		}
	}

	return 0;
}
コード例 #3
0
ファイル: inpdx2.cpp プロジェクト: tmaul/finalburnalpha_2001
static INT_PTR CALLBACK DialogProc(HWND hDlg,UINT Msg,WPARAM wParam,LPARAM lParam)
{
	(void)lParam;
	(void)wParam;
	(void)hDlg;
	if (Msg==WM_INITDIALOG)
	{
		hInpdX2Dlg=hDlg;    // 1 = we didn't set focus?
		InpdX2Init();
		return 1;
	}
	if (Msg==WM_CLOSE)
	{
		DestroyWindow(hInpdX2Dlg);
		return 0;
	}
	if (Msg==WM_DESTROY)
	{
		InpdX2Exit();
		return 0;
	}

	if (Msg==WM_COMMAND)
	{
		int Id=LOWORD(wParam);
		int Notify=HIWORD(wParam);
		if (Id==IDOK     && Notify==BN_CLICKED)
		{
			SendMessage(hDlg,WM_CLOSE,0,0);    // OK=close
			return 0;
		}
		if (Id==IDCANCEL && Notify==BN_CLICKED)
		{
			SendMessage(hDlg,WM_CLOSE,0,0);    // cancel=close
			return 0;
		}

		if (Id==IDC_RADIO_ENABLED)
		{
			// 1) mask out the previous value
			// 2) OR it with the (user's choice AND mask)
			pgi=GameInp+(nGameInpCount-(68-pInpdX2DIPSWInfo->chDIPSWSlot));
			*nDIPSW[pInpdX2DIPSWInfo->chDIPSWSlot-65]&=~pInpdX2DIPSWInfo->nDIPSWMask;
			*nDIPSW[pInpdX2DIPSWInfo->chDIPSWSlot-65]|=(~pInpdX2DIPSWInfo->pDIPSWChoice->nChoiceWriteValue&pInpdX2DIPSWInfo->nDIPSWMask);
			pgi->nConst=*nDIPSW[pInpdX2DIPSWInfo->chDIPSWSlot-65];

			bEnabled=1;
			pgi->nInput=1;
			InpDIPSWListMake();
			RefreshPanel();
			return 0;
		}

		if (Id==IDC_RADIO_DISABLED)
		{
			// 1) mask out the previous value
			// 2) OR it with the (user's enabled value AND mask)
			pgi=GameInp+(nGameInpCount-(68-pInpdX2DIPSWInfo->chDIPSWSlot));
			*nDIPSW[pInpdX2DIPSWInfo->chDIPSWSlot-65]&=~pInpdX2DIPSWInfo->nDIPSWMask;
			*nDIPSW[pInpdX2DIPSWInfo->chDIPSWSlot-65]|=(~pInpdX2DIPSWInfo->pDIPSWChoice->pNext->nChoiceWriteValue&pInpdX2DIPSWInfo->nDIPSWMask);
			pgi->nConst=*nDIPSW[pInpdX2DIPSWInfo->chDIPSWSlot-65];

			bEnabled=0;
			pgi->nInput=1;
			InpDIPSWListMake();
			RefreshPanel();
			return 0;
		}
	}
	return 0;
}