コード例 #1
0
ファイル: Option.cpp プロジェクト: lioncash/ExtractData
void COption::Init(CSearchToolBar& toolbar, CMainListView& listview)
{
	m_pToolBar = &toolbar;
	m_pListView = &listview;

	LoadIni();

	// Read Susie Plugin
	if (m_option.bSusieUse)
	{
		CSusie susie;
		susie.LoadSpi(m_option.SusieDir);
	}
}
コード例 #2
0
ファイル: Option.cpp プロジェクト: lioncash/ExtractData
void COption::Apply()
{
	// Reflect changes
	CSusie susie;
	susie.Apply();

	// Save ini
	m_option = m_option_tmp;
	SaveIni();

	m_pListView->SetBkColor();
	m_pListView->SetTextColor();
	m_pListView->Update();

	m_pToolBar->SetCheckSearch();
}
コード例 #3
0
ファイル: Option.cpp プロジェクト: lioncash/ExtractData
int COption::PropSheetProc(HWND hWnd, UINT msg, LPARAM lParam)
{
	switch (msg)
	{
		case PSCB_INITIALIZED:
		{
			m_option_tmp = m_option;
			CSusie susie;
			susie.Init();
			const LONG_PTR style = GetWindowLongPtr(hWnd, GWL_EXSTYLE);
			SetWindowLongPtr(hWnd, GWL_EXSTYLE, style & ~WS_EX_CONTEXTHELP);
			break;
		}
	}

	return FALSE;
}
コード例 #4
0
void CWinMain::SetQuickMenuItem(int id)
{
	COption option_dialog;
	SOption& options = option_dialog.GetOpt();

	struct QuickSet
	{
		LPBOOL option;
		int id;
	} quick_set[] = {
		{&options.bHighSearchOgg,  IDM_QUICKSET_STD_SEARCHOGG},
		{&options.bCreateFolder,   IDM_QUICKSET_EXTRACT_CREATEFOLDER},
		{&options.bFixOgg,         IDM_QUICKSET_EXTRACT_FIXOGG},
		{&options.bEasyDecrypt,    IDM_QUICKSET_EXTRACT_EASYDECRYPT},
		{&options.bDstPNG,         IDM_QUICKSET_EXTRACT_DSTPNG},
		{&options.bAlphaBlend,     IDM_QUICKSET_EXTRACT_ALPHABLEND},
		{&options.bSusieUse,       IDM_QUICKSET_SUSIE_USE},
		{&options.bSusieFirst,     IDM_QUICKSET_SUSIE_FIRST}
	};

	for (auto& entry : quick_set)
	{
		if (entry.id == id)
			*entry.option ^= 1;
	}

	if (id == IDM_QUICKSET_EXTRACT_DSTPNG)
	{
		// Extract images as PNG or BMP depending on setting
		options.bDstBMP ^= 1;
	}
	else if (id == IDM_QUICKSET_SUSIE_USE && options.bSusieUse == TRUE)
	{
		// Load Susie Plug-ins
		CSusie susie;
		susie.LoadSpi(options.SusieDir);
	}

	option_dialog.SaveIni();
}
コード例 #5
0
ファイル: WinMain.cpp プロジェクト: Casidi/ExtractData
void CWinMain::SetQuickMenuItem(int nID)
{
	COption clOption;
	SOption& stOption = clOption.GetOpt();

	struct SQuickSet
	{
		LPBOOL pbOption;
		int nID;
	} stQuickSet[] = {
		{&stOption.bHighSearchOgg,  IDM_QUICKSET_STD_SEARCHOGG},
		{&stOption.bCreateFolder,   IDM_QUICKSET_EXTRACT_CREATEFOLDER},
		{&stOption.bFixOgg,         IDM_QUICKSET_EXTRACT_FIXOGG},
		{&stOption.bEasyDecrypt,    IDM_QUICKSET_EXTRACT_EASYDECRYPT},
		{&stOption.bDstPNG,         IDM_QUICKSET_EXTRACT_DSTPNG},
		{&stOption.bAlphaBlend,     IDM_QUICKSET_EXTRACT_ALPHABLEND},
		{&stOption.bSusieUse,       IDM_QUICKSET_SUSIE_USE},
		{&stOption.bSusieFirst,     IDM_QUICKSET_SUSIE_FIRST}
	};

	for (int i = 0; i < ARRAYSIZE(stQuickSet); i++)
	{
		if (stQuickSet[i].nID == nID)
			*stQuickSet[i].pbOption ^= 1;
	}

	if (nID == IDM_QUICKSET_EXTRACT_DSTPNG)
	{
		// Extract images as PNG or BMP depending on setting
		stOption.bDstBMP ^= 1;
	}
	else if (nID == IDM_QUICKSET_SUSIE_USE && stOption.bSusieUse == TRUE)
	{
		// Load Susie Plug-ins
		CSusie clSusie;
		clSusie.LoadSpi(stOption.SusieDir);
	}

	clOption.SaveIni();
}
コード例 #6
0
ファイル: Option.cpp プロジェクト: lioncash/ExtractData
LRESULT COption::SusieProc(HWND hWnd, UINT msg, WPARAM wp, LPARAM lp)
{
	static CFolderDialog FolderDlg;
	static SOption* pOption = &m_option_tmp;

	static CCheckBox SusieCheckUse, SusieCheckFirst;
	static CLabel SusieLabelDir;
	static CEditBox SusieEditDir;
  static CButton SusieBtnDir, SusieBtnUpdate;
  static std::array<CButton, 2> SusieBtn;
	static CSusieListView SusieListView;
	static CSusie susie;

	switch (msg)
	{
		case WM_INITDIALOG:
		{
			UINT ID = 10000;
			const int x = 10;
			const int xx = 15;
			int y = 0;

			SusieCheckUse.Create(hWnd, _T("Use Susie Plugins"), ID++, x + 15, y += 20, 200, 20);
			SusieCheckUse.SetCheck(pOption->bSusieUse);

			SusieLabelDir.Create(hWnd, _T("Susie Folder"), ID++, x + xx, y += 24, 75, 20);
			SusieEditDir.Create(hWnd, pOption->SusieDir, ID++, x + xx + 75, y - 4, 200, 22);
			SusieEditDir.Enable(pOption->bSusieUse);
			SusieBtnDir.Create(hWnd, _T("Browse"), ID++, x + xx + 280, y - 3, 50, 20);
			SusieBtnDir.Enable(pOption->bSusieUse);

			SusieCheckFirst.Create(hWnd, _T("Give Susie plugins priority when decoding"), ID++, x + xx, y += 20, 250, 20);
			SusieCheckFirst.SetCheck(pOption->bSusieFirst);
			SusieCheckFirst.Enable(pOption->bSusieUse);

			SusieListView.Create(hWnd, *pOption, x + xx, y += 30, 500, 190);
			SusieListView.Close();
			SusieListView.Enable(pOption->bSusieUse);
			SusieListView.Show();

			SusieBtnUpdate.Create(hWnd, _T("Update"), ID++, x + 290, y += 200, 50, 20);
			SusieBtnUpdate.Enable(pOption->bSusieUse);
			SusieBtn[0].Create(hWnd, _T("All ON"), ID++, x + 350, y, 80, 20);
			SusieBtn[0].Enable(pOption->bSusieUse);
			SusieBtn[1].Create(hWnd, _T("All OFF"), ID++, x + 430, y, 80, 20);
			SusieBtn[1].Enable(pOption->bSusieUse);

			break;
		}

		case WM_COMMAND:
			// Use Susie plugins
			if (LOWORD(wp) == SusieCheckUse.GetID())
			{
				const BOOL flag = SusieCheckUse.GetCheck();
				SusieEditDir.Enable(flag);
				SusieBtnDir.Enable(flag);
				SusieCheckFirst.Enable(flag);
				SusieListView.Enable(flag);
				SusieBtnUpdate.Enable(flag);
				SusieBtn[0].Enable(flag);
				SusieBtn[1].Enable(flag);
				PropSheet_Changed(::GetParent(hWnd), hWnd);
				// Click here to show / hide the list of checkboxes, de-selected state
				pOption->bSusieUse = flag;
				SusieListView.SetItemSelAll(0);
				break;
			}

			// Susie Folder Browse
			if (LOWORD(wp) == SusieBtnDir.GetID())
			{
				TCHAR szSusieDir[_MAX_DIR];
				SusieEditDir.GetText(szSusieDir, sizeof(szSusieDir));
				if (FolderDlg.DoModal(hWnd, _T("Select the Susie folder"), szSusieDir))
					SusieEditDir.SetText(szSusieDir);
			}

			// Give Susie plugins priority on decoding
			if (LOWORD(wp) == SusieCheckFirst.GetID())
			{
				PropSheet_Changed(::GetParent(hWnd), hWnd);
				break;
			}

			// Update
			if (LOWORD(wp) == SusieBtnUpdate.GetID())
			{
				susie.LoadSpi(pOption->SusieDir);
				susie.Init();
				SusieListView.Show();
				SusieListView.Update();
				break;
			}

			// All ON
			if (LOWORD(wp) == SusieBtn[0].GetID())
			{
				SusieListView.SetCheckAll(true);
				PropSheet_Changed(::GetParent(hWnd), hWnd);
				break;
			}

			// All OFF
			if (LOWORD(wp) == SusieBtn[1].GetID())
			{
				SusieListView.SetCheckAll(false);
				PropSheet_Changed(::GetParent(hWnd), hWnd);
				break;
			}

			// Settings
			if (LOWORD(wp) == IDM_SUSIE_SET)
			{
				const SSusieInfo* const susie_info = SusieListView.GetFocusSusieInfo();

				// Get ConfigurationDlg()
				const auto ConfigurationDlg = reinterpret_cast<ConfigurationDlgProc>(susie_info->plugin.GetProcAddress(_T("ConfigurationDlg")));

				if (ConfigurationDlg == nullptr)
					break;

				// Call settings
				ConfigurationDlg(hWnd, 1);

				break;
			}

			// Contents of the editbox have changed
			if (HIWORD(wp) == EN_CHANGE)
			{
				PropSheet_Changed(::GetParent(hWnd), hWnd);
				break;
			}
			break;

		case WM_NOTIFY:
		{
			const auto* const hdr = reinterpret_cast<LPNMHDR>(lp);

			switch (hdr->code)
			{
				// OK/Apply, Tabbing
				case PSN_APPLY:
				case PSN_KILLACTIVE:
					pOption->bSusieUse = SusieCheckUse.GetCheck();
					pOption->bSusieFirst = SusieCheckFirst.GetCheck();
					SusieEditDir.GetText(pOption->SusieDir);
					SusieListView.SaveIni();
					// OK/Apply
					if (hdr->code == PSN_APPLY)
					{
						const bool update = m_option.SusieDir == pOption->SusieDir;
						Apply();
						// Re-acquire plugin folder only when Susie has been changed
						if (pOption->bSusieUse && update)
						{
							susie.LoadSpi(pOption->SusieDir);
							susie.Init();
							SusieListView.Show();
							SusieListView.Update();
						}
					}
					return TRUE;
				// Check processing
				case NM_CLICK:
				case NM_DBLCLK:
					if (hdr->idFrom == idsSusieList)
					{
						if (SusieListView.SetCheck())
							PropSheet_Changed(::GetParent(hWnd), hWnd);
						break;
					}
			}

			// List view
			if (wp == idsSusieList)
			{
				const auto* const plv = reinterpret_cast<LPNMLISTVIEW>(lp);
				switch (plv->hdr.code)
				{
					// Custom draw
					case NM_CUSTOMDRAW:
						return SusieListView.CustomDraw(reinterpret_cast<LPNMLVCUSTOMDRAW>(lp));
					// Show tool tip
					case LVN_GETINFOTIP:
						SusieListView.ShowTip(reinterpret_cast<LPNMLVGETINFOTIP>(lp));
						break;
					// View
					case LVN_GETDISPINFO:
						SusieListView.Show(reinterpret_cast<NMLVDISPINFO*>(lp));
						break;
				}
			}

			break;
		}

		case WM_MOUSEWHEEL:
		{
			POINT pos;
			GetCursorPos(&pos);
			HWND pWnd = WindowFromPoint(pos);
			if (pWnd == SusieListView.GetHandle())
				SendMessage(pWnd, WM_MOUSEWHEEL, wp, lp);
			break;
		}

		// Right-click menu (Context menu)
		case WM_CONTEXTMENU:
		{
			if (wp == reinterpret_cast<WPARAM>(SusieListView.GetHandle()))
				SusieListView.CreateMenu(lp);
			break;
		}
	}

	return FALSE;
}
コード例 #7
0
ファイル: Option.cpp プロジェクト: lioncash/ExtractData
void COption::SaveIni()
{
	YCIni ini(SBL_STR_INI_EXTRACTDATA);

	ini.SetSection(_T("Option"));

	// List background color
	ini.SetKey(_T("ListBkColor"));
	ini.WriteHex(m_option.ListBkColor, 6);

	// List text color
	ini.SetKey(_T("ListTextColor"));
	ini.WriteHex(m_option.ListTextColor, 6);

	// Increase the accuracy of an OGG search
	ini.SetKey(_T("HighSearchOgg"));
	ini.WriteDec(m_option.bHighSearchOgg);

	// Each folder to extract
	ini.SetKey(_T("ExtFolder"));
	ini.WriteDec(m_option.bCreateFolder);

	// Fix CRC of OGG files on extraction
	ini.SetKey(_T("OggCRC"));
	ini.WriteDec(m_option.bFixOgg);

	// To enable simple decoding
	ini.SetKey(_T("EasyDecrypt"));
	ini.WriteDec(m_option.bEasyDecrypt);

	// Set whether or not to change the extension of scripts
	// ini.SetKey(_T("RenameScriptExt"));
	// ini.WriteDec(m_option.bRenameScriptExt);

	// Output image format
	ini.SetKey(_T("DstBMP"));
	ini.WriteDec(m_option.bDstBMP);
	ini.SetKey(_T("DstPNG"));
	ini.WriteDec(m_option.bDstPNG);

	// PNG Compression level
	ini.SetKey(_T("CmplvPng"));
	ini.WriteDec(m_option.CmplvPng);

	// Alpha blending
	ini.SetKey(_T("AlphaBlend"));
	ini.WriteDec(m_option.bAlphaBlend);

	// Background color alpha blending
	ini.SetKey(_T("BG_RGB"));
	ini.WriteHex(m_option.BgRGB, 6);

	// Destination
	ini.SetKey(_T("SaveMethodSel"));
	ini.WriteDec(m_option.bSaveSel);
	ini.SetKey(_T("SaveMethodSrc"));
	ini.WriteDec(m_option.bSaveSrc);
	ini.SetKey(_T("SaveMethodDir"));
	ini.WriteDec(m_option.bSaveDir);

	// Fixed output folder
	ini.SetKey(_T("SaveDir"));
	ini.WriteStr(m_option.SaveDir);

	// Buffer size
	ini.SetKey(_T("BufSize"));
	ini.WriteDec(m_option.BufSize);

	// Temporary folder
	ini.SetKey(_T("TmpDir"));
	ini.WriteStr(m_option.TmpDir);

	// Susie Settings
	ini.SetSection(_T("Susie"));

	// Use Susie plugins
	ini.SetKey(_T("SusieUse"));
	ini.WriteDec(m_option.bSusieUse);

	// Susie Folder
	ini.SetKey(_T("SusieDir"));
	ini.WriteStr(m_option.SusieDir);

	// Give Susie plugins priority on decoding
	ini.SetKey(_T("SusieFirst"));
	ini.WriteDec(m_option.bSusieFirst);

	// Set of files to search
	ini.SetSection(_T("Search"));

	for (size_t i = 0; i < search_files_labels.size(); i++)
	{
		ini.SetKey(search_files_labels[i]);
		ini.WriteDec(m_option.bSearch[i]);
	}

	// Save Susie plugin settings ON/OFF
	if (m_option.bSusieUse)
	{
		CSusie susie;
		susie.SaveSpi();
	}
}