Exemplo n.º 1
0
static void applyRelations(int id)
{
	if (!bEnforceDep || !hasAssist || id < 0) {
		return;
	}

	int checked = _TreeView_GetCheckState(hIpsList, hPatchHandlesIndex[id]);
	string _datName = WtoA(szDataNames[id]);
	lowerString(_datName);
	itemStateTable[_datName] = checked ? 0 : 1;

	// validate relation
	validateConf(_datName);
	validateDep(_datName);

	// reset checkbox state
	string datName;
	for (int i = 0; i < nNumPatches; i++) {
		datName = WtoA(szDataNames[i]);
		lowerString(datName);
		checked = itemStateTable[datName];
		_TreeView_SetCheckState(hIpsList, hPatchHandlesIndex[i], checked ? TRUE : FALSE);
	}

	// set reverse state to current checkbox
	checked = itemStateTable[_datName];
	_TreeView_SetCheckState(hIpsList, hPatchHandlesIndex[id], checked ? FALSE : TRUE);
}
Exemplo n.º 2
0
static void clearPatches()
{
	int nChecked = 0;
	for (int i = 0; i < nNumPatches; i++) {
		nChecked = _TreeView_GetCheckState(hIpsList, hPatchHandlesIndex[i]);
		if (nChecked) {
			_TreeView_SetCheckState(hIpsList, hPatchHandlesIndex[i], FALSE);
		}
	}

	// clear ips relation
	itemStateTable.clear();
}
Exemplo n.º 3
0
static void CheckActivePatches()
{
	LoadIpsActivePatches();
	
	int nActivePatches = GetIpsNumActivePatches();
	
	for (int i = 0; i < nActivePatches; i++) {
		for (int j = 0; j < nNumPatches; j++) {
			if (!_tcsicmp(szIpsActivePatches[i], szPatchFileNames[j])) {
				_TreeView_SetCheckState(hIpsList, hPatchHandlesIndex[j], TRUE);
			}
		}
	}
}
Exemplo n.º 4
0
static void checkActivePatches()
{
	loadActivePatches();

	const int nActivePatches = getNumActivePatches();

	for (int i = 0; i < nActivePatches; i++) {
		for (int j = 0; j < nNumPatches; j++) {
			if (!_tcsicmp(szActivePatches[i], szPatchFileNames[j])) {
				_TreeView_SetCheckState(hIpsList, hPatchHandlesIndex[j], TRUE);
			}
		}
	}

	// ips relation
	initRelations();
}
Exemplo n.º 5
0
static INT_PTR CALLBACK DefInpProc(HWND hDlg, UINT Msg, WPARAM wParam, LPARAM lParam)
{
	switch (Msg) {
		case WM_INITDIALOG: {
			hIpsDlg = hDlg;
			
			hWhiteBGBrush = CreateSolidBrush(RGB(0xFF,0xFF,0xFF));
			hPreview = PNGLoadBitmap(hIpsDlg, NULL, 304, 228, 2);
			SendDlgItemMessage(hIpsDlg, IDC_SCREENSHOT_H, STM_SETIMAGE, IMAGE_BITMAP, (LPARAM)hPreview);
			
			LONG_PTR Style;
			Style = GetWindowLongPtr (GetDlgItem(hIpsDlg, IDC_TREE1), GWL_STYLE);
			Style |= TVS_CHECKBOXES;
			SetWindowLongPtr (GetDlgItem(hIpsDlg, IDC_TREE1), GWL_STYLE, Style);
		
			IpsManagerInit();

			WndInMid(hDlg, hScrnWnd);
			SetFocus(hDlg);											// Enable Esc=close
			break;
		}
		
		case WM_COMMAND: {
			int wID = LOWORD(wParam);
			int Notify = HIWORD(wParam);
						
			if (Notify == BN_CLICKED) {
				switch (wID) {
					case IDOK: {
						IpsOkay();
						break;
					}
				
					case IDCANCEL: {
						SendMessage(hDlg, WM_CLOSE, 0, 0);
						return 0;
					}
					
					case IDC_IPSMAN_DESELECTALL: {
						for (int i = 0; i < nNumPatches; i++) {
							for (int j = 0; j < nNumPatches; j++) {
								_TreeView_SetCheckState(hIpsList, hPatchHandlesIndex[j], FALSE);
							}
						}
						break;
					}
				}
			}
			
			if (wID == IDC_CHOOSE_LIST && Notify == CBN_SELCHANGE) {
				nIpsSelectedLanguage = SendMessage(GetDlgItem(hIpsDlg, IDC_CHOOSE_LIST), CB_GETCURSEL, 0, 0);
				TreeView_DeleteAllItems(hIpsList);
				FillListBox();
				RefreshPatch();
				return 0;
			}
			
			break;
		}
		
		case WM_NOTIFY: {
			NMHDR* pNmHdr = (NMHDR*)lParam;
			
			if (LOWORD(wParam) == IDC_TREE1 && pNmHdr->code == TVN_SELCHANGED) {
				RefreshPatch();
				
				return 1;
			}
			
			if (LOWORD(wParam) == IDC_TREE1 && pNmHdr->code == NM_DBLCLK) {
				// disable double-click node-expand
				SetWindowLongPtr(hIpsDlg, DWLP_MSGRESULT, 1);

				return 1;
			}
			
			if (LOWORD(wParam) == IDC_TREE1 && pNmHdr->code == NM_CLICK) {
				POINT cursorPos;
				GetCursorPos(&cursorPos);
				ScreenToClient(hIpsList, &cursorPos);

				TVHITTESTINFO thi;
				thi.pt = cursorPos;
				TreeView_HitTest(hIpsList, &thi);

				if (thi.flags == TVHT_ONITEMSTATEICON) {
					TreeView_SelectItem(hIpsList, thi.hItem);
				}
			
				return 1;
			}

			SetWindowLongPtr(hIpsDlg, DWLP_MSGRESULT, CDRF_DODEFAULT);
			return 1;
		}
	
		case WM_CTLCOLORSTATIC: {
			if ((HWND)lParam == GetDlgItem(hIpsDlg, IDC_TEXTCOMMENT)) {
				return (INT_PTR)hWhiteBGBrush;
			}
			break;
		}
		
		case WM_CLOSE: {
			IpsManagerExit();
			break;
		}
	}

	return 0;
}