예제 #1
0
int GameInpInit()
{
	int nRet = 0;
	// Count the number of inputs
	nGameInpCount = 0;
	nMacroCount = 0;
	nMaxMacro = nMaxPlayers * 8;

	for (unsigned int i = 0; i < 0x1000; i++) {
		nRet = BurnDrvGetInputInfo(NULL,i);
		if (nRet) {														// end of input list
			nGameInpCount = i;
			break;
		}
	}

	// Allocate space for all the inputs
	int nSize = (nGameInpCount + nMaxMacro) * sizeof(struct GameInp);
	GameInputs = (struct GameInp*)malloc(nSize);
	if (GameInputs == NULL) {
		return 1;
	}
	memset(GameInputs, 0, nSize);

	GameInpBlank(1);

	InpDIPSWResetDIPs();

	GameInpInitMacros();

	nAnalogSpeed = 0x0100;

	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;
}