Example #1
0
bool GSHacksDlg::OnMessage(UINT message, WPARAM wParam, LPARAM lParam)
{
    switch(message)
    {
    case WM_COMMAND:
    {
        int id = LOWORD(wParam);

        switch(id)
        {
        case IDOK:
        {
            INT_PTR data;
            if (ComboBoxGetSelData(IDC_ROUND_SPRITE, data))
            {
                theApp.SetConfig("UserHacks_round_sprite_offset", (int)data);
            }
            if (ComboBoxGetSelData(IDC_SPRITEHACK, data))
            {
                theApp.SetConfig("UserHacks_SpriteHack", (int)data);
            }
            theApp.SetConfig("UserHacks_MSAA", cb2msaa[(int)SendMessage(GetDlgItem(m_hWnd, IDC_MSAACB), CB_GETCURSEL, 0, 0)]);
            theApp.SetConfig("UserHacks_AlphaHack", (int)IsDlgButtonChecked(m_hWnd, IDC_ALPHAHACK));
            theApp.SetConfig("UserHacks_HalfPixelOffset", (int)IsDlgButtonChecked(m_hWnd, IDC_OFFSETHACK));
            theApp.SetConfig("UserHacks_SkipDraw", (int)SendMessage(GetDlgItem(m_hWnd, IDC_SKIPDRAWHACK), UDM_GETPOS, 0, 0));
            theApp.SetConfig("UserHacks_WildHack", (int)IsDlgButtonChecked(m_hWnd, IDC_WILDHACK));
            theApp.SetConfig("UserHacks_AlphaStencil", (int)IsDlgButtonChecked(m_hWnd, IDC_ALPHASTENCIL));
            theApp.SetConfig("preload_frame_with_gs_data", (int)IsDlgButtonChecked(m_hWnd, IDC_PRELOAD_GS));
            theApp.SetConfig("Userhacks_align_sprite_X", (int)IsDlgButtonChecked(m_hWnd, IDC_ALIGN_SPRITE));

            unsigned int TCOFFSET  =  SendMessage(GetDlgItem(m_hWnd, IDC_TCOFFSETX), UDM_GETPOS, 0, 0) & 0xFFFF;
            TCOFFSET |= (SendMessage(GetDlgItem(m_hWnd, IDC_TCOFFSETY), UDM_GETPOS, 0, 0) & 0xFFFF) << 16;

            theApp.SetConfig("UserHacks_TCOffset", TCOFFSET);

            EndDialog(m_hWnd, id);
        }
        break;
        }

    }
    break;

    case WM_CLOSE:
        EndDialog(m_hWnd, IDCANCEL);
        break;

    default:
        return false;
    }

    return true;
}
Example #2
0
void GSSettingsDlg::UpdateControls()
{
	INT_PTR i;

	bool allowHacks = !!theApp.GetConfig("allowHacks", 0);

	if(ComboBoxGetSelData(IDC_RENDERER, i))
	{
		bool dx9 = i >= 0 && i <= 2;
		bool dx10 = i >= 3 && i <= 5;
		bool dx11 = i >= 6 && i <= 8;
		bool ogl = i >= 9 && i <= 12;
		bool hw = i == 0 || i == 3 || i == 6 || i == 9;
		bool sw = i == 1 || i == 4 || i == 7 || i == 10;
		bool native = !!IsDlgButtonChecked(m_hWnd, IDC_NATIVERES);

		ShowWindow(GetDlgItem(m_hWnd, IDC_LOGO9), dx9 ? SW_SHOW : SW_HIDE);
		ShowWindow(GetDlgItem(m_hWnd, IDC_LOGO10), dx10 ? SW_SHOW : SW_HIDE);
		// TODO: ShowWindow(GetDlgItem(m_hWnd, IDC_LOGO11), dx11 ? SW_SHOW : SW_HIDE);
		// TODO: ShowWindow(GetDlgItem(m_hWnd, IDC_LOGO_OGL), ogl ? SW_SHOW : SW_HIDE);

		EnableWindow(GetDlgItem(m_hWnd, IDC_WINDOWED), dx9);
		EnableWindow(GetDlgItem(m_hWnd, IDC_RESX), hw && !native);
		EnableWindow(GetDlgItem(m_hWnd, IDC_RESX_EDIT), hw && !native);
		EnableWindow(GetDlgItem(m_hWnd, IDC_RESY), hw && !native);
		EnableWindow(GetDlgItem(m_hWnd, IDC_RESY_EDIT), hw && !native);
		EnableWindow(GetDlgItem(m_hWnd, IDC_UPSCALE_MULTIPLIER), hw && !native);
		EnableWindow(GetDlgItem(m_hWnd, IDC_NATIVERES), hw);
		EnableWindow(GetDlgItem(m_hWnd, IDC_FILTER), hw && !native);
		EnableWindow(GetDlgItem(m_hWnd, IDC_PALTEX), hw);
		EnableWindow(GetDlgItem(m_hWnd, IDC_LOGZ), dx9 && hw);
		EnableWindow(GetDlgItem(m_hWnd, IDC_FBA), dx9 && hw);
		EnableWindow(GetDlgItem(m_hWnd, IDC_AA1), sw);
		EnableWindow(GetDlgItem(m_hWnd, IDC_SWTHREADS_EDIT), sw);
		EnableWindow(GetDlgItem(m_hWnd, IDC_SWTHREADS), sw);
		EnableWindow(GetDlgItem(m_hWnd, IDC_MSAAEDIT), hw);
		EnableWindow(GetDlgItem(m_hWnd, IDC_MSAA), hw);

		//ShowWindow(GetDlgItem(m_hWnd, IDC_USERHACKS), allowHacks && hw)?SW_SHOW:SW_HIDE;  //Don't disable the "Hacks" frame
		ShowWindow(GetDlgItem(m_hWnd, IDC_MSAAEDIT), allowHacks && hw)?SW_SHOW:SW_HIDE;
		ShowWindow(GetDlgItem(m_hWnd, IDC_MSAA), allowHacks && hw)?SW_SHOW:SW_HIDE;
		ShowWindow(GetDlgItem(m_hWnd, IDC_STATIC_TEXT_HWAA), allowHacks && hw)?SW_SHOW:SW_HIDE;
		
		ShowWindow(GetDlgItem(m_hWnd, IDC_ALPHAHACK), allowHacks && hw)?SW_SHOW:SW_HIDE;
		ShowWindow(GetDlgItem(m_hWnd, IDC_OFFSETHACK), allowHacks && hw)?SW_SHOW:SW_HIDE;
		
		ShowWindow(GetDlgItem(m_hWnd, IDC_SKIPDRAWHACKEDIT), allowHacks && hw)?SW_SHOW:SW_HIDE;
		ShowWindow(GetDlgItem(m_hWnd, IDC_SKIPDRAWHACK), allowHacks && hw)?SW_SHOW:SW_HIDE;
		ShowWindow(GetDlgItem(m_hWnd, IDC_STATIC_TEXT_SKIPDRAW), allowHacks && hw)?SW_SHOW:SW_HIDE;
	}
}
Example #3
0
bool CDVDSettingsDlg::OnCommand(HWND hWnd, UINT id, UINT code)
{
	if(id == IDOK)
	{
		INT_PTR data = 0;

		if(!ComboBoxGetSelData(IDC_COMBO1, data))
		{
			data = -1;
		}

		theApp.SetConfig("drive", (int)data);

		theApp.SetConfig("iso", GetText(IDC_EDIT1).c_str());
	}
	else if(id == IDC_BUTTON1 && code == BN_CLICKED)
	{
		char buff[MAX_PATH] = {0};

		OPENFILENAME ofn;

		memset(&ofn, 0, sizeof(ofn));

		ofn.lStructSize = sizeof(ofn);
		ofn.hwndOwner = m_hWnd;
		ofn.lpstrFile = buff;
		ofn.nMaxFile = countof(buff);
		ofn.lpstrFilter = "ISO 文件\0*.iso\0所有文件\0*.*\0";
		ofn.Flags = OFN_EXPLORER | OFN_ENABLESIZING | OFN_PATHMUSTEXIST | OFN_FILEMUSTEXIST | OFN_NOCHANGEDIR;

		strcpy(ofn.lpstrFile, GetText(IDC_EDIT1).c_str());

		if(GetOpenFileName(&ofn))
		{
			SetText(IDC_EDIT1, ofn.lpstrFile);

			HWND hWnd = GetDlgItem(m_hWnd, IDC_COMBO1);

			SendMessage(hWnd, CB_SETCURSEL, SendMessage(hWnd, CB_GETCOUNT, 0, 0) - 1, 0);
		}

		return true;
	}

	return __super::OnCommand(hWnd, id, code);
}
Example #4
0
int GSCaptureDlg::GetSelCodec(Codec& c)
{
	INT_PTR data = 0;

	if(ComboBoxGetSelData(IDC_CODECS, data))
	{
		if(data == 0) return 2;

		c = *(Codec*)data;

		if(!c.filter)
		{
			c.moniker->BindToObject(NULL, NULL, __uuidof(IBaseFilter), (void**)&c.filter);

			if(!c.filter) return 0;
		}

		return 1;
	}

	return 0;
}
Example #5
0
void GSSettingsDlg::UpdateRenderers()
{
    INT_PTR i;

    if (!ComboBoxGetSelData(IDC_ADAPTER, i))
        return;

    // Ugggh
    HacksDlg.SetAdapter(adapters[(int)i].id);

    D3D_FEATURE_LEVEL level = adapters[(int)i].level;

    vector<GSSetting> renderers;

    unsigned renderer_setting = theApp.GetConfig("Renderer", 0);
    unsigned renderer_sel = 0;

    for(size_t i = 0; i < theApp.m_gs_renderers.size(); i++)
    {
        GSSetting r = theApp.m_gs_renderers[i];

        if(r.id >= 3 && r.id <= 5 || r.id == 15)
        {
            if(level < D3D_FEATURE_LEVEL_10_0) continue;

            r.name += (level >= D3D_FEATURE_LEVEL_11_0 ? "11" : "10");
        }

        renderers.push_back(r);

        if(r.id == renderer_setting)
        {
            renderer_sel = renderer_setting;
        }
    }

    ComboBoxInit(IDC_RENDERER, renderers, renderer_sel);
}
Example #6
0
bool GSSettingsDlg::OnCommand(HWND hWnd, UINT id, UINT code)
{
	if(id == IDC_RENDERER && code == CBN_SELCHANGE)
	{
		UpdateControls();
	}
	else if(id == IDC_NATIVERES && code == BN_CLICKED)
	{
		UpdateControls();
	}
	else if(id == IDOK)
	{
		INT_PTR data;

		if(!m_IsOpen2 && ComboBoxGetSelData(IDC_RESOLUTION, data))
		{
			const D3DDISPLAYMODE* mode = (D3DDISPLAYMODE*)data;

			theApp.SetConfig("ModeWidth", (int)mode->Width);
			theApp.SetConfig("ModeHeight", (int)mode->Height);
			theApp.SetConfig("ModeRefreshRate", (int)mode->RefreshRate);
		}

		if(ComboBoxGetSelData(IDC_RENDERER, data))
		{
			theApp.SetConfig("Renderer", (int)data);
		}

		if(ComboBoxGetSelData(IDC_INTERLACE, data))
		{
			theApp.SetConfig("Interlace", (int)data);
		}

		if(ComboBoxGetSelData(IDC_ASPECTRATIO, data))
		{
			theApp.SetConfig("AspectRatio", (int)data);
		}

		if(ComboBoxGetSelData(IDC_UPSCALE_MULTIPLIER, data))
		{
			theApp.SetConfig("upscale_multiplier", (int)data);
		}
		else
		{
			theApp.SetConfig("upscale_multiplier", 1);
		}

		theApp.SetConfig("windowed", (int)IsDlgButtonChecked(m_hWnd, IDC_WINDOWED));
		theApp.SetConfig("filter", (int)IsDlgButtonChecked(m_hWnd, IDC_FILTER));
		theApp.SetConfig("paltex", (int)IsDlgButtonChecked(m_hWnd, IDC_PALTEX));
		theApp.SetConfig("vsync", (int)IsDlgButtonChecked(m_hWnd, IDC_VSYNC));
		theApp.SetConfig("logz", (int)IsDlgButtonChecked(m_hWnd, IDC_LOGZ));
		theApp.SetConfig("fba", (int)IsDlgButtonChecked(m_hWnd, IDC_FBA));
		theApp.SetConfig("aa1", (int)IsDlgButtonChecked(m_hWnd, IDC_AA1));
		theApp.SetConfig("nativeres", (int)IsDlgButtonChecked(m_hWnd, IDC_NATIVERES));
		theApp.SetConfig("resx", (int)SendMessage(GetDlgItem(m_hWnd, IDC_RESX), UDM_GETPOS, 0, 0));
		theApp.SetConfig("resy", (int)SendMessage(GetDlgItem(m_hWnd, IDC_RESY), UDM_GETPOS, 0, 0));
		theApp.SetConfig("swthreads", (int)SendMessage(GetDlgItem(m_hWnd, IDC_SWTHREADS), UDM_GETPOS, 0, 0));
		theApp.SetConfig("msaa", (int)SendMessage(GetDlgItem(m_hWnd, IDC_MSAA), UDM_GETPOS, 0, 0));
		// Hacks
		theApp.SetConfig("UserHacks_AlphaHack", (int)IsDlgButtonChecked(m_hWnd, IDC_ALPHAHACK));
		theApp.SetConfig("UserHacks_HalfPixelOffset", (int)IsDlgButtonChecked(m_hWnd, IDC_OFFSETHACK));
		theApp.SetConfig("UserHacks_SkipDraw", (int)SendMessage(GetDlgItem(m_hWnd, IDC_SKIPDRAWHACK), UDM_GETPOS, 0, 0));

		bool allowHacks = !!theApp.GetConfig("allowHacks", 0);
		theApp.SetConfig("allowHacks", allowHacks);
	}

	return __super::OnCommand(hWnd, id, code);
}
Example #7
0
void GSSettingsDlg::UpdateControls()
{
    INT_PTR i;

    int integer_scaling = 0; // in case reading the combo doesn't work, enable the custom res control anyway

    if(ComboBoxGetSelData(IDC_UPSCALE_MULTIPLIER, i))
    {
        integer_scaling = (int)i;
    }

    if(ComboBoxGetSelData(IDC_RENDERER, i))
    {
        bool dx9 = i >= 0 && i <= 2 || i == 14;
        bool dx11 = i >= 3 && i <= 5 || i == 15;
        bool ogl = i >= 12 && i <= 13 || i == 17;
        bool hw = i == 0 || i == 3 || i == 12;
        //bool sw = i == 1 || i == 4 || i == 10 || i == 13;
        bool ocl = i >= 14 && i <= 17;


        ShowWindow(GetDlgItem(m_hWnd, IDC_LOGO9), dx9 ? SW_SHOW : SW_HIDE);
        ShowWindow(GetDlgItem(m_hWnd, IDC_LOGO11), dx11 ? SW_SHOW : SW_HIDE);
        ShowWindow(GetDlgItem(m_hWnd, IDC_LOGOGL), ogl ? SW_SHOW : SW_HIDE);

        ShowWindow(GetDlgItem(m_hWnd, IDC_LOGZ), dx9? SW_SHOW: SW_HIDE);
        ShowWindow(GetDlgItem(m_hWnd, IDC_FBA), dx9 ? SW_SHOW : SW_HIDE);

        ShowWindow(GetDlgItem(m_hWnd, IDC_ACCURATE_DATE), ogl ? SW_SHOW : SW_HIDE);
        ShowWindow(GetDlgItem(m_hWnd, IDC_ACCURATE_BLEND_UNIT), ogl ? SW_SHOW : SW_HIDE);
        ShowWindow(GetDlgItem(m_hWnd, IDC_ACCURATE_BLEND_UNIT_TEXT), ogl ? SW_SHOW : SW_HIDE);
        ShowWindow(GetDlgItem(m_hWnd, IDC_TC_DEPTH), ogl ? SW_SHOW : SW_HIDE);

        EnableWindow(GetDlgItem(m_hWnd, IDC_CRC_LEVEL), hw);
        EnableWindow(GetDlgItem(m_hWnd, IDC_CRC_LEVEL_TEXT), hw);
        EnableWindow(GetDlgItem(m_hWnd, IDC_OPENCL_DEVICE), ocl);
        EnableWindow(GetDlgItem(m_hWnd, IDC_RESX), hw && !integer_scaling);
        EnableWindow(GetDlgItem(m_hWnd, IDC_RESX_EDIT), hw && !integer_scaling);
        EnableWindow(GetDlgItem(m_hWnd, IDC_RESY), hw && !integer_scaling);
        EnableWindow(GetDlgItem(m_hWnd, IDC_RESY_EDIT), hw && !integer_scaling);
        EnableWindow(GetDlgItem(m_hWnd, IDC_CUSTOM_TEXT), hw && !integer_scaling);
        EnableWindow(GetDlgItem(m_hWnd, IDC_UPSCALE_MULTIPLIER), hw);
        EnableWindow(GetDlgItem(m_hWnd, IDC_UPSCALE_MULTIPLIER_TEXT), hw);
        EnableWindow(GetDlgItem(m_hWnd, IDC_FILTER), hw);
        EnableWindow(GetDlgItem(m_hWnd, IDC_PALTEX), hw);
        EnableWindow(GetDlgItem(m_hWnd, IDC_LOGZ), dx9 && hw);
        EnableWindow(GetDlgItem(m_hWnd, IDC_FBA), dx9 && hw);

        INT_PTR filter;
        if (ComboBoxGetSelData(IDC_FILTER, filter))
        {
            EnableWindow(GetDlgItem(m_hWnd, IDC_AFCOMBO), hw && filter && !IsDlgButtonChecked(m_hWnd, IDC_PALTEX));
        }
        EnableWindow(GetDlgItem(m_hWnd, IDC_AFCOMBO_TEXT), hw);
        EnableWindow(GetDlgItem(m_hWnd, IDC_FILTER_TEXT), hw);
        EnableWindow(GetDlgItem(m_hWnd, IDC_ACCURATE_DATE), ogl && hw);
        EnableWindow(GetDlgItem(m_hWnd, IDC_ACCURATE_BLEND_UNIT), ogl && hw);
        EnableWindow(GetDlgItem(m_hWnd, IDC_ACCURATE_BLEND_UNIT_TEXT), ogl && hw);
        EnableWindow(GetDlgItem(m_hWnd, IDC_TC_DEPTH), ogl && hw);

        //EnableWindow(GetDlgItem(m_hWnd, IDC_AA1), sw); // Let uers set software params regardless of renderer used
        //EnableWindow(GetDlgItem(m_hWnd, IDC_SWTHREADS_EDIT), sw);
        //EnableWindow(GetDlgItem(m_hWnd, IDC_SWTHREADS), sw);

        // Hacks
        EnableWindow(GetDlgItem(m_hWnd, IDC_HACKS_ENABLED), hw);
        EnableWindow(GetDlgItem(m_hWnd, IDC_HACKSBUTTON), hw && IsDlgButtonChecked(m_hWnd, IDC_HACKS_ENABLED));
    }

    // External shader
    bool external_shader_selected = IsDlgButtonChecked(m_hWnd, IDC_SHADER_FX) == BST_CHECKED;
    EnableWindow(GetDlgItem(m_hWnd, IDC_SHADER_FX_TEXT), external_shader_selected);
    EnableWindow(GetDlgItem(m_hWnd, IDC_SHADER_FX_EDIT), external_shader_selected);
    EnableWindow(GetDlgItem(m_hWnd, IDC_SHADER_FX_BUTTON), external_shader_selected);
    EnableWindow(GetDlgItem(m_hWnd, IDC_SHADER_FX_CONF_TEXT), external_shader_selected);
    EnableWindow(GetDlgItem(m_hWnd, IDC_SHADER_FX_CONF_EDIT), external_shader_selected);
    EnableWindow(GetDlgItem(m_hWnd, IDC_SHADER_FX_CONF_BUTTON), external_shader_selected);

    // Shade Boost
    EnableWindow(GetDlgItem(m_hWnd, IDC_SHADEBUTTON), IsDlgButtonChecked(m_hWnd, IDC_SHADEBOOST) == BST_CHECKED);
}
Example #8
0
bool GSSettingsDlg::OnCommand(HWND hWnd, UINT id, UINT code)
{
    switch (id)
    {
    case IDC_ADAPTER:
        if (code == CBN_SELCHANGE)
        {
            UpdateRenderers();
            UpdateControls();
        }
        break;
    case IDC_RENDERER:
    case IDC_UPSCALE_MULTIPLIER:
    case IDC_FILTER:
        if (code == CBN_SELCHANGE)
            UpdateControls();
        break;
    case IDC_SHADEBOOST:
    case IDC_SHADER_FX:
    case IDC_PALTEX:
    case IDC_HACKS_ENABLED:
        if (code == BN_CLICKED)
            UpdateControls();
        break;
    case IDC_SHADEBUTTON:
        if (code == BN_CLICKED)
            ShadeBoostDlg.DoModal();
        break;
    case IDC_HACKSBUTTON:
        if (code == BN_CLICKED)
            HacksDlg.DoModal();
        break;
    case IDC_SHADER_FX_BUTTON:
        if (code == BN_CLICKED)
            OpenFileDialog(IDC_SHADER_FX_EDIT, "Select External Shader");
        break;
    case IDC_SHADER_FX_CONF_BUTTON:
        if (code == BN_CLICKED)
            OpenFileDialog(IDC_SHADER_FX_CONF_EDIT, "Select External Shader Config");
        break;
    case IDOK:
    {
        INT_PTR data;

        if(ComboBoxGetSelData(IDC_ADAPTER, data))
        {
            theApp.SetConfig("Adapter", adapters[(int)data].id.c_str());
        }

        if(ComboBoxGetSelData(IDC_OPENCL_DEVICE, data))
        {
            if ((int)data < m_ocl_devs.size()) {
                theApp.SetConfig("ocldev", m_ocl_devs[(int)data].name.c_str());
            }
        }

        if(ComboBoxGetSelData(IDC_RENDERER, data))
        {
            theApp.SetConfig("Renderer", (int)data);
        }

        if(ComboBoxGetSelData(IDC_INTERLACE, data))
        {
            theApp.SetConfig("Interlace", (int)data);
        }

        if(ComboBoxGetSelData(IDC_UPSCALE_MULTIPLIER, data))
        {
            theApp.SetConfig("upscale_multiplier", (int)data);
        }
        else
        {
            theApp.SetConfig("upscale_multiplier", 1);
        }

        if (ComboBoxGetSelData(IDC_FILTER, data))
        {
            theApp.SetConfig("filter", (int)data);
        }

        if(ComboBoxGetSelData(IDC_ACCURATE_BLEND_UNIT, data))
        {
            theApp.SetConfig("accurate_blending_unit", (int)data);
        }

        if (ComboBoxGetSelData(IDC_CRC_LEVEL, data))
        {
            theApp.SetConfig("crc_hack_level", (int)data);
        }

        if(ComboBoxGetSelData(IDC_AFCOMBO, data))
        {
            theApp.SetConfig("MaxAnisotropy", (int)data);
        }

        theApp.SetConfig("paltex", (int)IsDlgButtonChecked(m_hWnd, IDC_PALTEX));
        theApp.SetConfig("logz", (int)IsDlgButtonChecked(m_hWnd, IDC_LOGZ));
        theApp.SetConfig("fba", (int)IsDlgButtonChecked(m_hWnd, IDC_FBA));
        theApp.SetConfig("aa1", (int)IsDlgButtonChecked(m_hWnd, IDC_AA1));
        theApp.SetConfig("mipmap", (int)IsDlgButtonChecked(m_hWnd, IDC_MIPMAP));
        theApp.SetConfig("resx", (int)SendMessage(GetDlgItem(m_hWnd, IDC_RESX), UDM_GETPOS, 0, 0));
        theApp.SetConfig("resy", (int)SendMessage(GetDlgItem(m_hWnd, IDC_RESY), UDM_GETPOS, 0, 0));
        theApp.SetConfig("extrathreads", (int)SendMessage(GetDlgItem(m_hWnd, IDC_SWTHREADS), UDM_GETPOS, 0, 0));
        theApp.SetConfig("accurate_date", (int)IsDlgButtonChecked(m_hWnd, IDC_ACCURATE_DATE));
        theApp.SetConfig("texture_cache_depth", (int)IsDlgButtonChecked(m_hWnd, IDC_TC_DEPTH));

        // Shade Boost
        theApp.SetConfig("ShadeBoost", (int)IsDlgButtonChecked(m_hWnd, IDC_SHADEBOOST));

        // FXAA shader
        theApp.SetConfig("Fxaa", (int)IsDlgButtonChecked(m_hWnd, IDC_FXAA));

        // External FX Shader
        theApp.SetConfig("shaderfx", (int)IsDlgButtonChecked(m_hWnd, IDC_SHADER_FX));

        // External FX Shader(OpenGL)
        int shader_fx_length = (int)SendMessage(GetDlgItem(m_hWnd, IDC_SHADER_FX_EDIT), WM_GETTEXTLENGTH, 0, 0);
        int shader_fx_conf_length = (int)SendMessage(GetDlgItem(m_hWnd, IDC_SHADER_FX_CONF_EDIT), WM_GETTEXTLENGTH, 0, 0);
        int length = std::max(shader_fx_length, shader_fx_conf_length) + 1;
        char *buffer = new char[length];

        SendMessage(GetDlgItem(m_hWnd, IDC_SHADER_FX_EDIT), WM_GETTEXT, (WPARAM)length, (LPARAM)buffer);
        theApp.SetConfig("shaderfx_glsl", buffer); // Not really glsl only ;)
        SendMessage(GetDlgItem(m_hWnd, IDC_SHADER_FX_CONF_EDIT), WM_GETTEXT, (WPARAM)length, (LPARAM)buffer);
        theApp.SetConfig("shaderfx_conf", buffer);

        delete [] buffer;

        theApp.SetConfig("UserHacks", (int)IsDlgButtonChecked(m_hWnd, IDC_HACKS_ENABLED));
    }
    break;
    }

    return __super::OnCommand(hWnd, id, code);
}
Example #9
0
void CDVDSettingsDlg::UpdateDrives()
{
	int drive = theApp.GetConfig("drive", -1);

	INT_PTR data = 0;

	if(ComboBoxGetSelData(IDC_COMBO1, data))
	{
		drive = (int)data;
	}

	vector<CDVDSetting> drives;

	for(int i = 'A'; i <= 'Z'; i++)
	{
		string path = format("%c:", i);

		if(GetDriveType(path.c_str()) == DRIVE_CDROM)
		{
			string label = path;

			path = format("\\\\.\\%c:", i);

			CDVD cdvd;

			if(cdvd.Open(path.c_str()))
			{
				string str = cdvd.GetLabel();

				if(str.empty())
				{
					str = "(no label)";
				}

				label = "[" + label + "] " + str;
			}
			else
			{
				label = "[" + label + "] (未检测到)";
			}

			CDVDSetting s;

			s.id = i;
			s.name = label;

			drives.push_back(s);
		}
	}

	{
		CDVDSetting s;

		s.id = -1;
		s.name = "其它...";

		drives.push_back(s);
	}

	ComboBoxInit(IDC_COMBO1, &drives[0], drives.size(), drive);
}