diff --git a/programs/winecfg/En.rc b/programs/winecfg/En.rc index 02d4850..218150a 100644 --- a/programs/winecfg/En.rc +++ b/programs/winecfg/En.rc @@ -79,12 +79,14 @@ BEGIN EDITTEXT IDC_DESKTOP_WIDTH,64,167,40,12,ES_AUTOHSCROLL | ES_NUMBER | WS_DISABLED EDITTEXT IDC_DESKTOP_HEIGHT,117,167,40,12,ES_AUTOHSCROLL | ES_NUMBER | WS_DISABLED - GROUPBOX " Direct3D ",IDC_STATIC,8,189,244,50 + GROUPBOX " Direct3D ",IDC_STATIC,8,189,244,60 LTEXT "Vertex Shader Support: ",IDC_STATIC,15,199,80,30 COMBOBOX IDC_D3D_VSHADER_MODE,100,197,145,70,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP CONTROL "Allow Pixel Shader (if supported by hardware)",IDC_D3D_PSHADER_MODE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,15,216,230,10 + LTEXT "Video Memory Size (in megabytes):",IDC_STATIC,15,232,120,12 + COMBOBOX IDC_VIDEOMEMORY_SIZE_COMBO,130,232,40,112,CBS_DROPDOWN | WS_VSCROLL | WS_TABSTOP | CBS_LOWERCASE END IDD_DLLCFG DIALOG DISCARDABLE 0, 0, 260, 250 diff --git a/programs/winecfg/resource.h b/programs/winecfg/resource.h index 811a115..cabe783 100644 --- a/programs/winecfg/resource.h +++ b/programs/winecfg/resource.h @@ -65,6 +65,7 @@ #define IDC_DESKTOP_BY 1026 #define IDC_XDGA 1027 #define IDC_XSHM 1028 +#define IDC_VIDEOMEMORY_SIZE_COMBO 1081 /* dll editing */ #define IDC_RAD_BUILTIN 1029 diff --git a/programs/winecfg/x11drvdlg.c b/programs/winecfg/x11drvdlg.c index 8fa183e..48e291a 100644 --- a/programs/winecfg/x11drvdlg.c +++ b/programs/winecfg/x11drvdlg.c @@ -36,7 +36,10 @@ WINE_DEFAULT_DEBUG_CHANNEL(winecfg); #define RES_MAXLEN 5 /* the maximum number of characters in a screen dimension. 5 digits should be plenty, what kind of crazy person runs their screen >10,000 pixels across? */ +#define VIDEOMEM_MAXLEN 5 /* the maximum number of characters in a video memory input box */ +#define VIDEOMEM_SIZES_LENGTH 6 /* array length */ +const char * builtin_videomem_sizes[] = { "", "32", "64", "128", "256", "512" }; static struct SHADERMODE { @@ -72,7 +75,7 @@ static void update_gui_for_desktop_mode(HWND dialog) { if (reg_key_exists(config_key, keypath("X11 Driver"), "Desktop")) { char* buf, *bufindex; - CheckDlgButton(dialog, IDC_ENABLE_DESKTOP, BST_CHECKED); + CheckDlgButton(dialog, IDC_ENABLE_DESKTOP, BST_CHECKED); buf = get_reg_key(config_key, keypath("X11 Driver"), "Desktop", "640x480"); /* note: this test must match the one in x11drv */ @@ -114,6 +117,41 @@ static void update_gui_for_desktop_mode(HWND dialog) { updating_ui = FALSE; } +static void update_gui_for_videomem_size(HWND dialog) { + char* buf; + int i; + int matched_index = 0; + int found_in_defaults = -1; + char const * const backup_first = builtin_videomem_sizes[0]; + + SendDlgItemMessage(dialog, IDC_VIDEOMEMORY_SIZE_COMBO, CB_RESETCONTENT, 0, 0); + SendDlgItemMessage(dialog, IDC_VIDEOMEMORY_SIZE_COMBO, EM_LIMITTEXT, VIDEOMEM_MAXLEN, 0); + + buf = get_reg_key(config_key, keypath("Direct3D"), "VideoMemorySize", "64"); + + for (i = 0; i < VIDEOMEM_SIZES_LENGTH ; i++) { + if (strcmp(buf, builtin_videomem_sizes[i]) == 0) { + found_in_defaults = 1; + matched_index = i; + break ; + } + } + if (found_in_defaults == -1) + builtin_videomem_sizes[0] = buf; + + for (i = 0; i < VIDEOMEM_SIZES_LENGTH; i++) + SendDlgItemMessageA(dialog, IDC_VIDEOMEMORY_SIZE_COMBO, CB_ADDSTRING, i, (LPARAM) builtin_videomem_sizes[i]); + + SendDlgItemMessage(dialog, IDC_VIDEOMEMORY_SIZE_COMBO, CB_SETCURSEL, matched_index, 0); + + builtin_videomem_sizes[0] = backup_first; + + enable(IDC_VIDEOMEMORY_SIZE_COMBO); + HeapFree(GetProcessHeap(), 0, buf); + + updating_ui = FALSE; +} + static void init_dialog(HWND dialog) { unsigned int it; @@ -164,6 +202,7 @@ static void init_dialog(HWND dialog) CheckDlgButton(dialog, IDC_D3D_PSHADER_MODE, BST_UNCHECKED); HeapFree(GetProcessHeap(), 0, buf); + update_gui_for_videomem_size(dialog); updating_ui = FALSE; } @@ -208,6 +247,36 @@ static void on_enable_desktop_clicked(HWND dialog) { update_gui_for_desktop_mode(dialog); } +static void set_from_videomemory_size_edits(HWND dialog) { + char buffer[1024]; + + SendDlgItemMessage(dialog, IDC_VIDEOMEMORY_SIZE_COMBO, WM_GETTEXT, sizeof(buffer), (LPARAM) buffer); + + if (strlen(buffer)) + set_reg_key(config_key, keypath("Direct3D"), "VideoMemorySize", buffer); +} + +static void set_from_videomemory_size_changed(HWND dialog) { + char *memsize = HeapAlloc( GetProcessHeap(), 0, 5+2 ); + int sel; + + if (updating_ui) return; + + WINE_TRACE("\n"); + + sel = SendDlgItemMessage(dialog, IDC_VIDEOMEMORY_SIZE_COMBO, CB_GETCURSEL, 0, 0); + strcpy( memsize, builtin_videomem_sizes[sel]); + + if (memsize == NULL || strcmp(memsize, "") == 0) { + HeapFree(GetProcessHeap(), 0, memsize); + memsize = strdupA("64"); + } + + set_reg_key(config_key, keypath("Direct3D"), "VideoMemorySize", memsize); + + HeapFree(GetProcessHeap(), 0, memsize); +} + static void on_enable_managed_clicked(HWND dialog) { WINE_TRACE("\n"); @@ -272,11 +341,18 @@ GraphDlgProc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam) case CBN_SELCHANGE: { SendMessage(GetParent(hDlg), PSM_CHANGED, 0, 0); switch (LOWORD(wParam)) { - case IDC_D3D_VSHADER_MODE: on_d3d_vshader_mode_changed(hDlg); break; - } + case IDC_D3D_VSHADER_MODE: on_d3d_vshader_mode_changed(hDlg); break; + case IDC_VIDEOMEMORY_SIZE_COMBO: set_from_videomemory_size_changed(hDlg); break; + } break; } - + case CBN_EDITCHANGE: + SendMessage(GetParent(hDlg), PSM_CHANGED, 0, 0); + if(LOWORD(wParam) == IDC_VIDEOMEMORY_SIZE_COMBO) + { + set_from_videomemory_size_edits(hDlg); + break; + } default: break; } @@ -306,3 +382,4 @@ GraphDlgProc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam) } return FALSE; } +// vim:sw=4:expandtab