Example #1
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 #2
0
void GSSettingsDlg::OnInit()
{
	__super::OnInit();

	m_modes.clear();

	if(!m_IsOpen2)
	{
		D3DDISPLAYMODE mode;
		memset(&mode, 0, sizeof(mode));
		m_modes.push_back(mode);

		ComboBoxAppend(IDC_RESOLUTION, "Please select...", (LPARAM)&m_modes.back(), true);

		if(CComPtr<IDirect3D9> d3d = Direct3DCreate9(D3D_SDK_VERSION))
		{
			uint32 w = theApp.GetConfig("ModeWidth", 0);
			uint32 h = theApp.GetConfig("ModeHeight", 0);
			uint32 hz = theApp.GetConfig("ModeRefreshRate", 0);

			uint32 n = d3d->GetAdapterModeCount(D3DADAPTER_DEFAULT, D3DFMT_R5G6B5);

			for(uint32 i = 0; i < n; i++)
			{
				if(S_OK == d3d->EnumAdapterModes(D3DADAPTER_DEFAULT, D3DFMT_R5G6B5, i, &mode))
				{
					m_modes.push_back(mode);

					string str = format("%dx%d %dHz", mode.Width, mode.Height, mode.RefreshRate);

					ComboBoxAppend(IDC_RESOLUTION, str.c_str(), (LPARAM)&m_modes.back(), w == mode.Width && h == mode.Height && hz == mode.RefreshRate);
				}
			}
		}
	}

	bool isdx11avail_config = GSUtil::IsDirect3D11Available();

	vector<GSSetting> renderers;

	for(size_t i = 0; i < countof(g_renderers); i++)
	{
		if(i >= 3 && i <= 5)
		{
			if(!isdx11avail_config) continue;
			g_renderers[i].name = std::string("Direct3D") + (GSUtil::HasD3D11Features() ? "11" : "10");
		}

		renderers.push_back(g_renderers[i]);
	}

	ComboBoxInit(IDC_RENDERER, &renderers[0], renderers.size(), theApp.GetConfig("Renderer", 0));
	ComboBoxInit(IDC_INTERLACE, g_interlace, countof(g_interlace), theApp.GetConfig("Interlace", 0));
	ComboBoxInit(IDC_ASPECTRATIO, g_aspectratio, countof(g_aspectratio), theApp.GetConfig("AspectRatio", 1));
	ComboBoxInit(IDC_UPSCALE_MULTIPLIER, g_upscale_multiplier, countof(g_upscale_multiplier), theApp.GetConfig("upscale_multiplier", 1));

	CheckDlgButton(m_hWnd, IDC_WINDOWED, theApp.GetConfig("windowed", 1));
	CheckDlgButton(m_hWnd, IDC_FILTER, theApp.GetConfig("filter", 2));
	CheckDlgButton(m_hWnd, IDC_PALTEX, theApp.GetConfig("paltex", 0));
	CheckDlgButton(m_hWnd, IDC_VSYNC, theApp.GetConfig("vsync", 0));
	CheckDlgButton(m_hWnd, IDC_LOGZ, theApp.GetConfig("logz", 1));
	CheckDlgButton(m_hWnd, IDC_FBA, theApp.GetConfig("fba", 1));
	CheckDlgButton(m_hWnd, IDC_AA1, theApp.GetConfig("aa1", 0));
	CheckDlgButton(m_hWnd, IDC_NATIVERES, theApp.GetConfig("nativeres", 0));
	// Hacks
	CheckDlgButton(m_hWnd, IDC_ALPHAHACK, theApp.GetConfig("UserHacks_AlphaHack", 0));
	CheckDlgButton(m_hWnd, IDC_OFFSETHACK, theApp.GetConfig("UserHacks_HalfPixelOffset", 0));
	SendMessage(GetDlgItem(m_hWnd, IDC_SKIPDRAWHACK), UDM_SETRANGE, 0, MAKELPARAM(1000, 0));
	SendMessage(GetDlgItem(m_hWnd, IDC_SKIPDRAWHACK), UDM_SETPOS, 0, MAKELPARAM(theApp.GetConfig("UserHacks_SkipDraw", 0), 0));

	SendMessage(GetDlgItem(m_hWnd, IDC_RESX), UDM_SETRANGE, 0, MAKELPARAM(8192, 256));
	SendMessage(GetDlgItem(m_hWnd, IDC_RESX), UDM_SETPOS, 0, MAKELPARAM(theApp.GetConfig("resx", 1024), 0));

	SendMessage(GetDlgItem(m_hWnd, IDC_RESY), UDM_SETRANGE, 0, MAKELPARAM(8192, 256));
	SendMessage(GetDlgItem(m_hWnd, IDC_RESY), UDM_SETPOS, 0, MAKELPARAM(theApp.GetConfig("resy", 1024), 0));

	SendMessage(GetDlgItem(m_hWnd, IDC_MSAA), UDM_SETRANGE, 0, MAKELPARAM(16, 0));
	SendMessage(GetDlgItem(m_hWnd, IDC_MSAA), UDM_SETPOS, 0, MAKELPARAM(theApp.GetConfig("msaa", 0), 0));

	SendMessage(GetDlgItem(m_hWnd, IDC_SWTHREADS), UDM_SETRANGE, 0, MAKELPARAM(16, 1));
	SendMessage(GetDlgItem(m_hWnd, IDC_SWTHREADS), UDM_SETPOS, 0, MAKELPARAM(theApp.GetConfig("swthreads", 1), 0));

	UpdateControls();
}
Example #3
0
void GSHacksDlg::OnInit()
{
    HWND hwnd_renderer = GetDlgItem(GetParent(m_hWnd), IDC_RENDERER);
    int renderer = SendMessage(hwnd_renderer, CB_GETITEMDATA, SendMessage(hwnd_renderer, CB_GETCURSEL, 0, 0), 0);
    // It can only be accessed with a HW renderer, so this is sufficient.
    bool dx9 = renderer == 0;
    // bool dx11 = renderer == 3;
    bool ogl = renderer == 12;
    unsigned short cb = 0;

    if(dx9) for(unsigned short i = 0; i < 17; i++)
        {
            if( i == 1) continue;

            int depth = GSDevice9::GetMaxDepth(i, adapter_id);

            if(depth)
            {
                char text[32] = {0};
                sprintf(text, depth == 32 ? "%dx Z-32" : "%dx Z-24", i);
                SendMessage(GetDlgItem(m_hWnd, IDC_MSAACB), CB_ADDSTRING, 0, (LPARAM)text);

                msaa2cb[i] = cb;
                cb2msaa[cb] = i;
                cb++;
            }
        }
    else for(unsigned short j = 0; j < 5; j++) // TODO: Make the same kind of check for d3d11, eventually....
        {
            unsigned short i = j == 0 ? 0 : 1 << j;

            msaa2cb[i] = j;
            cb2msaa[j] = i;

            char text[32] = {0};
            sprintf(text, "%dx ", i);

            SendMessage(GetDlgItem(m_hWnd, IDC_MSAACB), CB_ADDSTRING, 0, (LPARAM)text);
        }

    SendMessage(GetDlgItem(m_hWnd, IDC_MSAACB), CB_SETCURSEL, msaa2cb[min(theApp.GetConfig("UserHacks_MSAA", 0), 16)], 0);

    CheckDlgButton(m_hWnd, IDC_ALPHAHACK, theApp.GetConfig("UserHacks_AlphaHack", 0));
    CheckDlgButton(m_hWnd, IDC_OFFSETHACK, theApp.GetConfig("UserHacks_HalfPixelOffset", 0));
    CheckDlgButton(m_hWnd, IDC_WILDHACK, theApp.GetConfig("UserHacks_WildHack", 0));
    CheckDlgButton(m_hWnd, IDC_ALPHASTENCIL, theApp.GetConfig("UserHacks_AlphaStencil", 0));
    CheckDlgButton(m_hWnd, IDC_PRELOAD_GS, theApp.GetConfig("preload_frame_with_gs_data", 0));
    CheckDlgButton(m_hWnd, IDC_ALIGN_SPRITE, theApp.GetConfig("UserHacks_align_sprite_X", 0));

    ComboBoxInit(IDC_ROUND_SPRITE, theApp.m_gs_hack, theApp.GetConfig("UserHacks_round_sprite_offset", 0));
    ComboBoxInit(IDC_SPRITEHACK, theApp.m_gs_hack, theApp.GetConfig("UserHacks_SpriteHack", 0));

    SendMessage(GetDlgItem(m_hWnd, IDC_SKIPDRAWHACK), UDM_SETRANGE, 0, MAKELPARAM(1000, 0));
    SendMessage(GetDlgItem(m_hWnd, IDC_SKIPDRAWHACK), UDM_SETPOS, 0, MAKELPARAM(theApp.GetConfig("UserHacks_SkipDraw", 0), 0));

    SendMessage(GetDlgItem(m_hWnd, IDC_TCOFFSETX), UDM_SETRANGE, 0, MAKELPARAM(10000, 0));
    SendMessage(GetDlgItem(m_hWnd, IDC_TCOFFSETX), UDM_SETPOS, 0, MAKELPARAM(theApp.GetConfig("UserHacks_TCOffset", 0) & 0xFFFF, 0));

    SendMessage(GetDlgItem(m_hWnd, IDC_TCOFFSETY), UDM_SETRANGE, 0, MAKELPARAM(10000, 0));
    SendMessage(GetDlgItem(m_hWnd, IDC_TCOFFSETY), UDM_SETPOS, 0, MAKELPARAM((theApp.GetConfig("UserHacks_TCOffset", 0) >> 16) & 0xFFFF, 0));

    ShowWindow(GetDlgItem(m_hWnd, IDC_ALPHASTENCIL), ogl ? SW_HIDE : SW_SHOW);
    ShowWindow(GetDlgItem(m_hWnd, IDC_ALPHAHACK), ogl ? SW_HIDE : SW_SHOW);

    AddTooltip(IDC_SKIPDRAWHACKEDIT);
    AddTooltip(IDC_SKIPDRAWHACK);
    AddTooltip(IDC_ALPHAHACK);
    AddTooltip(IDC_OFFSETHACK);
    AddTooltip(IDC_SPRITEHACK);
    AddTooltip(IDC_WILDHACK);
    AddTooltip(IDC_MSAACB);
    AddTooltip(IDC_ALPHASTENCIL);
    AddTooltip(IDC_ALIGN_SPRITE);
    AddTooltip(IDC_ROUND_SPRITE);
    AddTooltip(IDC_TCOFFSETX);
    AddTooltip(IDC_TCOFFSETX2);
    AddTooltip(IDC_TCOFFSETY);
    AddTooltip(IDC_TCOFFSETY2);
    AddTooltip(IDC_PRELOAD_GS);
}
Example #4
0
void GSSettingsDlg::OnInit()
{
    __super::OnInit();

    CComPtr<IDirect3D9> d3d9;

    d3d9.Attach(Direct3DCreate9(D3D_SDK_VERSION));

    CComPtr<IDXGIFactory1> dxgi_factory;

    if(GSUtil::CheckDXGI())
    {
        CreateDXGIFactory1(__uuidof(IDXGIFactory1), (void**)&dxgi_factory);
    }
    adapters.clear();
    adapters.push_back(Adapter("Default Hardware Device", "default", GSUtil::CheckDirect3D11Level(NULL, D3D_DRIVER_TYPE_HARDWARE)));
    adapters.push_back(Adapter("Reference Device", "ref", GSUtil::CheckDirect3D11Level(NULL, D3D_DRIVER_TYPE_REFERENCE)));

    if(dxgi_factory)
    {
        for(int i = 0;; i++)
        {
            CComPtr<IDXGIAdapter1> adapter;

            if(S_OK != dxgi_factory->EnumAdapters1(i, &adapter))
                break;

            DXGI_ADAPTER_DESC1 desc;

            HRESULT hr = adapter->GetDesc1(&desc);

            if(S_OK == hr)
            {
                D3D_FEATURE_LEVEL level = GSUtil::CheckDirect3D11Level(adapter, D3D_DRIVER_TYPE_UNKNOWN);
                // GSDX isn't unicode!?
#if 1
                int size = WideCharToMultiByte(CP_ACP, 0, desc.Description, sizeof(desc.Description), NULL, 0, NULL, NULL);
                char *buf = new char[size];
                WideCharToMultiByte(CP_ACP, 0, desc.Description, sizeof(desc.Description), buf, size, NULL, NULL);
                adapters.push_back(Adapter(buf, GSAdapter(desc), level));
                delete[] buf;
#else
                adapters.push_back(Adapter(desc.Description, GSAdapter(desc), level));
#endif
            }
        }
    }
    else if(d3d9)
    {
        int n = d3d9->GetAdapterCount();
        for(int i = 0; i < n; i++)
        {
            D3DADAPTER_IDENTIFIER9 desc;

            if(D3D_OK != d3d9->GetAdapterIdentifier(i, 0, &desc))
                break;

            // GSDX isn't unicode!?
#if 0
            wchar_t buf[sizeof desc.Description * sizeof(WCHAR)];
            MultiByteToWideChar(CP_ACP /* I have no idea if this is right */, 0, desc.Description, sizeof(desc.Description), buf, sizeof buf / sizeof *buf);
            adapters.push_back(Adapter(buf, GSAdapter(desc), (D3D_FEATURE_LEVEL)0));
#else
            adapters.push_back(Adapter(desc.Description, GSAdapter(desc), (D3D_FEATURE_LEVEL)0));
#endif
        }
    }

    std::string adapter_setting = theApp.GetConfig("Adapter", "default");
    vector<GSSetting> adapter_settings;
    unsigned int adapter_sel = 0;

    for(unsigned int i = 0; i < adapters.size(); i++)
    {
        if(adapters[i].id == adapter_setting)
        {
            adapter_sel = i;
        }

        adapter_settings.push_back(GSSetting(i, adapters[i].name.c_str(), ""));
    }

    std::string ocldev = theApp.GetConfig("ocldev", "");

    unsigned int ocl_sel = 0;

    for(unsigned int i = 0; i < m_ocl_devs.size(); i++)
    {
        if(ocldev == m_ocl_devs[i].name)
        {
            ocl_sel = i;

            break;
        }
    }

    ComboBoxInit(IDC_ADAPTER, adapter_settings, adapter_sel);
    ComboBoxInit(IDC_OPENCL_DEVICE, m_ocl_devs, ocl_sel);

    UpdateRenderers();

    ComboBoxInit(IDC_INTERLACE, theApp.m_gs_interlace, theApp.GetConfig("Interlace", 7)); // 7 = "auto", detects interlace based on SMODE2 register
    ComboBoxInit(IDC_UPSCALE_MULTIPLIER, theApp.m_gs_upscale_multiplier, theApp.GetConfig("upscale_multiplier", 1));
    ComboBoxInit(IDC_AFCOMBO, theApp.m_gs_max_anisotropy, theApp.GetConfig("MaxAnisotropy", 0));
    ComboBoxInit(IDC_FILTER, theApp.m_gs_filter, theApp.GetConfig("filter", 2));
    ComboBoxInit(IDC_ACCURATE_BLEND_UNIT, theApp.m_gs_acc_blend_level, theApp.GetConfig("accurate_blending_unit", 1));
    ComboBoxInit(IDC_CRC_LEVEL, theApp.m_gs_crc_level, theApp.GetConfig("crc_hack_level", 3));

    CheckDlgButton(m_hWnd, IDC_PALTEX, theApp.GetConfig("paltex", 0));
    CheckDlgButton(m_hWnd, IDC_LOGZ, theApp.GetConfig("logz", 1));
    CheckDlgButton(m_hWnd, IDC_FBA, theApp.GetConfig("fba", 1));
    CheckDlgButton(m_hWnd, IDC_AA1, theApp.GetConfig("aa1", 0));
    CheckDlgButton(m_hWnd, IDC_MIPMAP, theApp.GetConfig("mipmap", 1));
    CheckDlgButton(m_hWnd, IDC_ACCURATE_DATE, theApp.GetConfig("accurate_date", 0));
    CheckDlgButton(m_hWnd, IDC_TC_DEPTH, theApp.GetConfig("texture_cache_depth", 0));

    // Shade Boost
    CheckDlgButton(m_hWnd, IDC_SHADEBOOST, theApp.GetConfig("ShadeBoost", 0));

    // FXAA shader
    CheckDlgButton(m_hWnd, IDC_FXAA, theApp.GetConfig("Fxaa", 0));

    // External FX shader
    CheckDlgButton(m_hWnd, IDC_SHADER_FX, theApp.GetConfig("shaderfx", 0));
    SendMessage(GetDlgItem(m_hWnd, IDC_SHADER_FX_EDIT), WM_SETTEXT, 0, (LPARAM)theApp.GetConfig("shaderfx_glsl", "shaders\\GSdx.fx").c_str());
    SendMessage(GetDlgItem(m_hWnd, IDC_SHADER_FX_CONF_EDIT), WM_SETTEXT, 0, (LPARAM)theApp.GetConfig("shaderfx_conf", "shaders\\GSdx_FX_Settings.ini").c_str());

    // Hacks
    CheckDlgButton(m_hWnd, IDC_HACKS_ENABLED, theApp.GetConfig("UserHacks", 0));

    SendMessage(GetDlgItem(m_hWnd, IDC_RESX), UDM_SETRANGE, 0, MAKELPARAM(8192, 256));
    SendMessage(GetDlgItem(m_hWnd, IDC_RESX), UDM_SETPOS, 0, MAKELPARAM(theApp.GetConfig("resx", 1024), 0));

    SendMessage(GetDlgItem(m_hWnd, IDC_RESY), UDM_SETRANGE, 0, MAKELPARAM(8192, 256));
    SendMessage(GetDlgItem(m_hWnd, IDC_RESY), UDM_SETPOS, 0, MAKELPARAM(theApp.GetConfig("resy", 1024), 0));

    SendMessage(GetDlgItem(m_hWnd, IDC_SWTHREADS), UDM_SETRANGE, 0, MAKELPARAM(16, 0));
    SendMessage(GetDlgItem(m_hWnd, IDC_SWTHREADS), UDM_SETPOS, 0, MAKELPARAM(theApp.GetConfig("extrathreads", 0), 0));

    AddTooltip(IDC_FILTER);
    AddTooltip(IDC_CRC_LEVEL);
    AddTooltip(IDC_PALTEX);
    AddTooltip(IDC_ACCURATE_DATE);
    AddTooltip(IDC_ACCURATE_BLEND_UNIT);
    AddTooltip(IDC_TC_DEPTH);
    AddTooltip(IDC_AFCOMBO);
    AddTooltip(IDC_AA1);
    AddTooltip(IDC_MIPMAP);
    AddTooltip(IDC_SWTHREADS);
    AddTooltip(IDC_SWTHREADS_EDIT);
    AddTooltip(IDC_SHADEBOOST);
    AddTooltip(IDC_SHADER_FX);
    AddTooltip(IDC_FXAA);
    AddTooltip(IDC_FBA);
    AddTooltip(IDC_LOGZ);

    UpdateControls();
}
Example #5
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);
}