예제 #1
0
파일: FileIO.cpp 프로젝트: Jammerx2/Durazno
void INI_SaveSettings()
{
	wchar_t filename[] = L".\\Durazno.ini";

	SaveEntry(L"General", -1, L"INIversion", INIversion, filename);
	SaveString(L"General", -1, L"LoadDLL", customDLL, filename);

	for(s32 port = 0; port < 4; port++)
	{
		SaveEntry(L"Controller", port, L"Disable", settings[port].isDisabled?1:0, filename);
		SaveEntry(L"Controller", port, L"Dummy", settings[port].isDummy?1:0, filename);
		
		SaveEntry(L"Controller", port, L"AxisInvertedLX", settings[port].axisInverted[GP_AXIS_LX]?1:0, filename);
		SaveEntry(L"Controller", port, L"AxisInvertedLY", settings[port].axisInverted[GP_AXIS_LY]?1:0, filename);
		SaveEntry(L"Controller", port, L"AxisInvertedRX", settings[port].axisInverted[GP_AXIS_RX]?1:0, filename);
		SaveEntry(L"Controller", port, L"AxisInvertedRY", settings[port].axisInverted[GP_AXIS_RY]?1:0, filename);

		SaveEntry(L"Controller", port, L"TriggerMin", settings[port].triggerMin, filename);
		SaveEntry(L"Controller", port, L"TriggerMax", settings[port].triggerMax, filename);
		SaveEntry(L"Controller", port, L"Linearity", (s32)(settings[port].linearity*10) +30, filename);
		SaveEntry(L"Controller", port, L"Deadzone", (s32)(settings[port].deadzone * 100), filename);
		SaveEntry(L"Controller", port, L"AntiDeadzone", (s32)(settings[port].antiDeadzone * 100), filename);
		SaveEntry(L"Controller", port, L"Rumble", (s32)(settings[port].rumble * 100), filename);
		SaveEntry(L"Controller", port, L"Port", (s32)(settings[port].port), filename);

		SaveRemap(port, filename);
	}
}
예제 #2
0
void CSearchDialog::StartSearching()
{
	ShowWindow(GetDlgItem(m_hDlg, IDC_LINK_STATUS), SW_HIDE);
	ShowWindow(GetDlgItem(m_hDlg, IDC_STATIC_STATUS), SW_SHOW);

	m_AwaitingSearchItems.clear();
	m_SearchItemsMapInternal.clear();

	ListView_DeleteAllItems(GetDlgItem(m_hDlg, IDC_LISTVIEW_SEARCHRESULTS));

	TCHAR szBaseDirectory[MAX_PATH];
	TCHAR szSearchPattern[MAX_PATH];

	/* Get the directory and name, and remove leading and
	trailing whitespace. */
	/* TODO: Verify fields. */
	GetDlgItemText(m_hDlg, IDC_COMBO_DIRECTORY, szBaseDirectory,
		SIZEOF_ARRAY(szBaseDirectory));
	PathRemoveBlanks(szBaseDirectory);
	GetDlgItemText(m_hDlg, IDC_COMBO_NAME, szSearchPattern,
		SIZEOF_ARRAY(szSearchPattern));
	PathRemoveBlanks(szSearchPattern);

	BOOL bSearchSubFolders = IsDlgButtonChecked(m_hDlg, IDC_CHECK_SEARCHSUBFOLDERS) ==
		BST_CHECKED;

	BOOL bUseRegularExpressions = IsDlgButtonChecked(m_hDlg, IDC_CHECK_USEREGULAREXPRESSIONS) ==
		BST_CHECKED;

	BOOL bCaseInsensitive = IsDlgButtonChecked(m_hDlg, IDC_CHECK_CASEINSENSITIVE) ==
		BST_CHECKED;

	/* Turn search patterns of the form '???' into '*???*', and
	use this modified string to search. */
	if(!bUseRegularExpressions && lstrlen(szSearchPattern) > 0)
	{
		if(szSearchPattern[0] != '*' &&
			szSearchPattern[lstrlen(szSearchPattern) - 1] != '*')
		{
			TCHAR szTemp[MAX_PATH];

			StringCchPrintf(szTemp, SIZEOF_ARRAY(szTemp), _T("*%s*"),
				szSearchPattern);
			StringCchCopy(szSearchPattern, SIZEOF_ARRAY(szSearchPattern),
				szTemp);
		}
	}

	DWORD dwAttributes = 0;

	if(IsDlgButtonChecked(m_hDlg, IDC_CHECK_ARCHIVE) == BST_CHECKED)
		dwAttributes |= FILE_ATTRIBUTE_ARCHIVE;

	if(IsDlgButtonChecked(m_hDlg, IDC_CHECK_HIDDEN) == BST_CHECKED)
		dwAttributes |= FILE_ATTRIBUTE_HIDDEN;

	if(IsDlgButtonChecked(m_hDlg, IDC_CHECK_READONLY) == BST_CHECKED)
		dwAttributes |= FILE_ATTRIBUTE_READONLY;

	if(IsDlgButtonChecked(m_hDlg, IDC_CHECK_SYSTEM) == BST_CHECKED)
		dwAttributes |= FILE_ATTRIBUTE_SYSTEM;

	m_pSearch = new CSearch(m_hDlg, szBaseDirectory, szSearchPattern,
		dwAttributes, bUseRegularExpressions, bCaseInsensitive, bSearchSubFolders);
	m_pSearch->AddRef();

	/* Save the search directory and search pattern (only if they are not
	the same as the most recent entry). */
	BOOL bSaveEntry = FALSE;

	if(m_sdps->m_pSearchDirectories->empty() ||
		lstrcmp(szBaseDirectory, m_sdps->m_pSearchDirectories->begin()->c_str()) != 0)
	{
		bSaveEntry = TRUE;
	}

	if(bSaveEntry)
	{
		SaveEntry(IDC_COMBO_DIRECTORY, *m_sdps->m_pSearchDirectories);
	}

	bSaveEntry = FALSE;

	if(m_sdps->m_pSearchPatterns->empty() ||
		lstrcmp(szSearchPattern, m_sdps->m_pSearchPatterns->begin()->c_str()) != 0)
	{
		bSaveEntry = TRUE;
	}

	if(bSaveEntry)
	{
		SaveEntry(IDC_COMBO_NAME, *m_sdps->m_pSearchPatterns);
	}

	GetDlgItemText(m_hDlg, IDSEARCH, m_szSearchButton, SIZEOF_ARRAY(m_szSearchButton));

	TCHAR szTemp[64];

	LoadString(GetInstance(), IDS_STOP, szTemp, SIZEOF_ARRAY(szTemp));
	SetDlgItemText(m_hDlg, IDSEARCH, szTemp);

	m_bSearching = TRUE;

	/* Create a background thread, and search using it... */
	HANDLE hThread = CreateThread(NULL, 0, NSearchDialog::SearchThread,
		reinterpret_cast<LPVOID>(m_pSearch), 0, NULL);
	CloseHandle(hThread);
}
예제 #3
0
파일: FileIO.cpp 프로젝트: M-Taye/Durazno
void INI_SaveSettings(SETTINGS *settings)
{
	wchar_t filename[] = L".\\Durazno.ini";

	SaveEntry(L"General", -1, L"INIversion", INIversion, filename);
	SaveString(L"General", -1, L"LoadDLL", customDLL, filename);

	for(s32 port = 0; port < 4; port++)
	{
		SETTINGS &set = settings[port];

		SaveEntry(L"Controller", port, L"Port", (s32)(set.port), filename);
		SaveEntry(L"Controller", port, L"Dummy", set.isDummy ? 1 : 0, filename);
		SaveEntry(L"Controller", port, L"Disable", set.isDisabled ? 1 : 0, filename);
		SaveEntry(L"Controller", port, L"LinearDZ", set.linearDZ ? 1 : 0, filename);
		SaveEntry(L"Controller", port, L"LinearADZ", set.linearADZ ? 1 : 0, filename);

		SaveEntry(L"Controller", port, L"AxisInvertedLX", set.stickL.invertedX ? 1 : 0, filename);
		SaveEntry(L"Controller", port, L"AxisInvertedLY", set.stickL.invertedY ? 1 : 0, filename);
		SaveEntry(L"Controller", port, L"AxisInvertedRX", set.stickR.invertedX ? 1 : 0, filename);
		SaveEntry(L"Controller", port, L"AxisInvertedRY", set.stickR.invertedY ? 1 : 0, filename);

		SaveEntry(L"Controller", port, L"TriggerMin", set.triggerMin, filename);
		SaveEntry(L"Controller", port, L"TriggerMax", set.triggerMax, filename);

		SaveEntry(L"Controller", port, L"Rumble", (s32)(set.rumble * FACTOR), filename);

		SaveEntry(L"Controller", port, L"L_Linearity", (s32)(set.stickL.linearity * 100.0) + 300, filename);
		SaveEntry(L"Controller", port, L"L_Deadzone", (s32)(set.stickL.deadzone * FACTOR), filename);
		SaveEntry(L"Controller", port, L"L_AntiDeadzone", (s32)(set.stickL.antiDeadzone * FACTOR), filename);

		SaveEntry(L"Controller", port, L"R_Linearity", (s32)(set.stickR.linearity * 100.0) + 300, filename);
		SaveEntry(L"Controller", port, L"R_Deadzone", (s32)(set.stickR.deadzone * FACTOR), filename);
		SaveEntry(L"Controller", port, L"R_AntiDeadzone", (s32)(set.stickR.antiDeadzone * FACTOR), filename);

		SaveRemap(port, filename, settings);
	}
}