From: Toni Wilen Date: Sun, 10 Dec 2017 16:58:06 +0000 (+0200) Subject: 3600b11 X-Git-Tag: 3600~37 X-Git-Url: https://git.unchartedbackwaters.co.uk/w/?a=commitdiff_plain;h=ba6f08a1f26c15160caeaee9cf2b8d6d92dcc5a4;p=francis%2Fwinuae.git 3600b11 --- diff --git a/cfgfile.cpp b/cfgfile.cpp index 84836d2c..be0c67dc 100644 --- a/cfgfile.cpp +++ b/cfgfile.cpp @@ -1882,6 +1882,9 @@ void cfgfile_save_options (struct zfile *f, struct uae_prefs *p, int type) write_resolution (f, _T("gfx_width_fullscreen"), _T("gfx_height_fullscreen"), &p->gfx_size_fs); cfgfile_write (f, _T("gfx_refreshrate"), _T("%d"), p->gfx_apmode[0].gfx_refreshrate); cfgfile_dwrite (f, _T("gfx_refreshrate_rtg"), _T("%d"), p->gfx_apmode[1].gfx_refreshrate); + cfgfile_write_bool(f, _T("gfx_tearing"), p->gfx_apmode[0].gfx_tearing); + cfgfile_write_bool(f, _T("gfx_tearing_rtg"), p->gfx_apmode[1].gfx_tearing); + cfgfile_write (f, _T("gfx_autoresolution"), _T("%d"), p->gfx_autoresolution); cfgfile_dwrite (f, _T("gfx_autoresolution_delay"), _T("%d"), p->gfx_autoresolution_delay); cfgfile_dwrite (f, _T("gfx_autoresolution_min_vertical"), vertmode[p->gfx_autoresolution_minv + 1]); @@ -2968,7 +2971,9 @@ static int cfgfile_parse_host (struct uae_prefs *p, TCHAR *option, TCHAR *value) || cfgfile_intval (option, value, _T("gfx_backbuffers"), &p->gfx_apmode[APMODE_NATIVE].gfx_backbuffers, 1) || cfgfile_intval (option, value, _T("gfx_backbuffers_rtg"), &p->gfx_apmode[APMODE_RTG].gfx_backbuffers, 1) || cfgfile_yesno (option, value, _T("gfx_interlace"), &p->gfx_apmode[APMODE_NATIVE].gfx_interlaced) - || cfgfile_yesno (option, value, _T("gfx_interlace_rtg"), &p->gfx_apmode[APMODE_RTG].gfx_interlaced) + || cfgfile_yesno(option, value, _T("gfx_interlace_rtg"), &p->gfx_apmode[APMODE_RTG].gfx_interlaced) + || cfgfile_yesno(option, value, _T("gfx_tearing"), &p->gfx_apmode[APMODE_NATIVE].gfx_tearing) + || cfgfile_yesno(option, value, _T("gfx_tearing_rtg"), &p->gfx_apmode[APMODE_RTG].gfx_tearing) || cfgfile_intval(option, value, _T("gfx_black_frame_insertion_ratio"), &p->lightboost_strobo_ratio, 1) || cfgfile_intval (option, value, _T("gfx_center_horizontal_position"), &p->gfx_xcenter_pos, 1) @@ -6259,9 +6264,6 @@ int cfgfile_get_description (struct uae_prefs *p, const TCHAR *filename, TCHAR * p = xmalloc(struct uae_prefs, 1); alloc = true; } - p->description[0] = 0; - p->config_host_path[0] = 0; - p->config_hardware_path[0] = 0; if (!p) { alloc = true; p = cfgfile_open(filename, type); diff --git a/include/options.h b/include/options.h index 8de8fd15..e9414883 100644 --- a/include/options.h +++ b/include/options.h @@ -318,6 +318,7 @@ struct apmode int gfx_backbuffers; bool gfx_interlaced; int gfx_refreshrate; + bool gfx_tearing; }; #define MAX_LUA_STATES 16 diff --git a/main.cpp b/main.cpp index 5c3ef461..a543bf6f 100644 --- a/main.cpp +++ b/main.cpp @@ -191,7 +191,7 @@ void fixup_prefs_dimensions (struct uae_prefs *prefs) if (prefs->gfx_api && ap->gfx_backbuffers < 1) ap->gfx_backbuffers = 1; if (ap->gfx_vflip) - ap->gfx_strobo = prefs->lightboost_strobo;; + ap->gfx_strobo = prefs->lightboost_strobo; } } else { // no vsync: wait if triple bufferirng diff --git a/od-win32/resources/resource.h b/od-win32/resources/resource.h index a37b2638..915ea4db 100644 --- a/od-win32/resources/resource.h +++ b/od-win32/resources/resource.h @@ -759,6 +759,7 @@ #define IDC_OCS 1520 #define IDC_HDFLOPPY 1520 #define IDC_SETTINGSTEXT3 1520 +#define IDC_DISPLAY_TEARING 1520 #define IDC_ECS_AGNUS 1521 #define IDC_ECS_DENISE 1522 #define IDC_ECS 1523 diff --git a/od-win32/resources/winuae.rc b/od-win32/resources/winuae.rc index 781f3007..f3bf34e2 100644 --- a/od-win32/resources/winuae.rc +++ b/od-win32/resources/winuae.rc @@ -153,11 +153,11 @@ BEGIN RTEXT "Fullscreen:",IDC_STATIC,3,33,51,15,SS_CENTERIMAGE COMBOBOX IDC_RESOLUTION,59,33,76,150,CBS_DROPDOWNLIST | CBS_HASSTRINGS | WS_VSCROLL | WS_TABSTOP COMBOBOX IDC_RESOLUTIONDEPTH,144,33,62,150,CBS_DROPDOWNLIST | CBS_HASSTRINGS | WS_VSCROLL | WS_TABSTOP - COMBOBOX IDC_REFRESHRATE,266,33,119,150,CBS_DROPDOWNLIST | CBS_HASSTRINGS | WS_VSCROLL | WS_TABSTOP + COMBOBOX IDC_REFRESHRATE,263,34,122,150,CBS_DROPDOWNLIST | CBS_HASSTRINGS | WS_VSCROLL | WS_TABSTOP RTEXT "Windowed:",IDC_STATIC,2,54,51,15,SS_CENTERIMAGE - EDITTEXT IDC_XSIZE,59,56,56,12,ES_NUMBER - EDITTEXT IDC_YSIZE,122,56,56,12,ES_NUMBER - COMBOBOX IDC_DISPLAY_BUFFERCNT,266,56,119,150,CBS_DROPDOWNLIST | CBS_HASSTRINGS | WS_VSCROLL | WS_TABSTOP + EDITTEXT IDC_XSIZE,59,56,43,12,ES_NUMBER + EDITTEXT IDC_YSIZE,113,56,43,12,ES_NUMBER + COMBOBOX IDC_DISPLAY_BUFFERCNT,263,56,122,150,CBS_DROPDOWNLIST | CBS_HASSTRINGS | WS_VSCROLL | WS_TABSTOP GROUPBOX "Settings",IDC_SETTINGSTEXT,1,86,283,183 RTEXT "Native:",IDC_STATIC,9,98,48,15,SS_CENTERIMAGE COMBOBOX IDC_SCREENMODE_NATIVE,61,98,71,150,CBS_DROPDOWNLIST | CBS_HASSTRINGS | WS_VSCROLL | WS_TABSTOP @@ -203,6 +203,7 @@ BEGIN CONTROL "Double, frames",IDC_LM_IDOUBLED,"Button",BS_AUTORADIOBUTTON | BS_LEFT | WS_TABSTOP,299,251,90,10 CONTROL "Double, fields",IDC_LM_IDOUBLED2,"Button",BS_AUTORADIOBUTTON | BS_LEFT | WS_TABSTOP,299,264,90,10 CONTROL "Double, fields+",IDC_LM_IDOUBLED3,"Button",BS_AUTORADIOBUTTON | BS_LEFT | WS_TABSTOP,299,277,90,10 + CONTROL "Allow tearing",IDC_DISPLAY_TEARING,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,170,58,84,10 END IDD_MEMORY DIALOGEX 0, 0, 396, 266 @@ -820,7 +821,7 @@ BEGIN EDITTEXT IDC_CS_DENISEREV,311,298,45,13,ES_AUTOHSCROLL COMBOBOX IDC_CS_UNMAPPED,125,212,113,75,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP RTEXT "Unmapped address space:",IDC_STATIC,15,215,101,9 - CONTROL "Toshiba Gary",IDC_CS_TOSHIBAGARY,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,14,197,125,12 + CONTROL "Toshiba Gary",IDC_CS_TOSHIBAGARY,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,14,197,106,12 CONTROL "KS ROM has Chip RAM speed",IDC_CS_ROMISSLOW,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,127,198,125,12 CONTROL "CIA 391078-01 [] CIA revision that can't read IO pin status in output mode",IDC_CS_CIA, "Button",BS_AUTOCHECKBOX | WS_TABSTOP,264,198,125,12 diff --git a/od-win32/win32.cpp b/od-win32/win32.cpp index d956565e..36f74c49 100644 --- a/od-win32/win32.cpp +++ b/od-win32/win32.cpp @@ -3715,7 +3715,7 @@ void target_fixup_options (struct uae_prefs *p) p->color_mode = 5; if (p->ppc_model && !p->gfx_api) { error_log (_T("Graphics board and PPC: Direct3D enabled.")); - p->gfx_api = 1; + p->gfx_api = os_win7 ? 2 : 1; } } @@ -3770,7 +3770,7 @@ void target_default_options (struct uae_prefs *p, int type) p->win32_commandpathstart[0] = 0; p->win32_commandpathend[0] = 0; p->win32_statusbar = 1; - p->gfx_api = os_vista ? 1 : 0; + p->gfx_api = os_win7 ? 2 : (os_vista ? 1 : 0); if (p->gf[APMODE_NATIVE].gfx_filter == 0 && p->gfx_api) p->gf[APMODE_NATIVE].gfx_filter = 1; if (p->gf[APMODE_RTG].gfx_filter == 0 && p->gfx_api) @@ -5054,6 +5054,16 @@ static void WIN32_HandleRegistryStuff (void) else regsetint(NULL, _T("ArtCache"), artcache); + if (regexists(NULL, _T("ArtImageCount"))) + regqueryint(NULL, _T("ArtImageCount"), &max_visible_boxart_images); + else + regsetint(NULL, _T("ArtImageCount"), max_visible_boxart_images); + + if (regexists(NULL, _T("ArtImageWidth"))) + regqueryint(NULL, _T("ArtImageWidth"), &stored_boxart_window_width); + else + regsetint(NULL, _T("ArtImageWidth"), stored_boxart_window_width); + if (regexists (NULL, _T("SaveImageOriginalPath"))) regqueryint (NULL, _T("SaveImageOriginalPath"), &saveimageoriginalpath); else @@ -6457,6 +6467,7 @@ static int PASCAL WinMain2 (HINSTANCE hInstance, HINSTANCE hPrevInstance, LPWSTR WIN32_InitHtmlHelp (); DirectDraw_Release (); unicode_init (); + can_D3D11(false); if (betamessage ()) { keyboard_settrans (); #ifdef CATWEASEL diff --git a/od-win32/win32.h b/od-win32/win32.h index 09de7a83..4612a78a 100644 --- a/od-win32/win32.h +++ b/od-win32/win32.h @@ -20,12 +20,12 @@ #define LANG_DLL_FULL_VERSION_MATCH 1 #if WINUAEPUBLICBETA -#define WINUAEBETA _T("10") +#define WINUAEBETA _T("11") #else #define WINUAEBETA _T("") #endif -#define WINUAEDATE MAKEBD(2017, 12, 4) +#define WINUAEDATE MAKEBD(2017, 12, 10) //#define WINUAEEXTRA _T("AmiKit Preview") //#define WINUAEEXTRA _T("Amiga Forever Edition") diff --git a/od-win32/win32gfx.cpp b/od-win32/win32gfx.cpp index 15e7770a..30c4e3d1 100644 --- a/od-win32/win32gfx.cpp +++ b/od-win32/win32gfx.cpp @@ -4924,6 +4924,3 @@ void releasehdc (HDC hdc) #endif DirectDraw_ReleaseDC (hdc); } - - - diff --git a/od-win32/win32gui.cpp b/od-win32/win32gui.cpp index 1d866485..5871c9c4 100644 --- a/od-win32/win32gui.cpp +++ b/od-win32/win32gui.cpp @@ -2081,6 +2081,16 @@ end: return ret; } +static void box_art_check(struct uae_prefs *p) +{ + TCHAR tmp1[MAX_DPATH]; + if (cfgfile_detect_art(p, tmp1)) { + show_box_art(tmp1); + } else { + show_box_art(NULL); + } +} + struct ConfigStruct { TCHAR Name[MAX_DPATH]; TCHAR Path[MAX_DPATH]; @@ -2163,11 +2173,7 @@ int target_cfgfile_load (struct uae_prefs *p, const TCHAR *filename, int type, i return v; if (type > 0) return v; - if (cfgfile_detect_art(p, tmp1)) { - show_box_art(tmp1); - } else { - show_box_art(NULL); - } + box_art_check(p); for (i = 1; i <= 2; i++) { if (type != i) { size = sizeof (ct); @@ -5455,7 +5461,10 @@ static INT_PTR CALLBACK LoadSaveDlgProc (HWND hDlg, UINT msg, WPARAM wParam, LPA recursive--; return TRUE; - case WM_USER: + case WM_USER + 1: + if (config) { + show_box_art(config && config->Artpath[0] ? config->Artpath : NULL); + } break; case WM_CONTEXTMENU: @@ -5804,6 +5813,8 @@ static void resetregistry (void) regdelete(NULL, _T("RelativePaths")); regdelete(NULL, _T("DirectDraw_Secondary")); regdelete(NULL, _T("ShownsupportedModes")); + regdelete(NULL, _T("ArtImageCount")); + regdelete(NULL, _T("ArtImageWidth")); } #include "zip.h" @@ -6801,7 +6812,6 @@ static void enable_for_displaydlg (HWND hDlg) CheckDlgButton (hDlg, IDC_AUTORESOLUTIONVGA, workprefs.gfx_autoresolution_vga); } - bool isdouble = workprefs.gfx_vresolution > 0; ew (hDlg, IDC_LM_NORMAL, !workprefs.gfx_autoresolution); @@ -6814,6 +6824,9 @@ static void enable_for_displaydlg (HWND hDlg) ew (hDlg, IDC_LM_IDOUBLED, !workprefs.gfx_autoresolution && isdouble); ew (hDlg, IDC_LM_IDOUBLED2, !workprefs.gfx_autoresolution && isdouble); ew (hDlg, IDC_LM_IDOUBLED3, !workprefs.gfx_autoresolution && isdouble); + + hide(hDlg, IDC_DISPLAY_TEARING, TRUE); + //hide(hDlg, IDC_DISPLAY_TEARING, !(workprefs.gfx_api == 2 && (can_D3D11(false) & 2))); } static void enable_for_chipsetdlg (HWND hDlg) @@ -7368,6 +7381,8 @@ static void values_to_displaydlg (HWND hDlg) SendDlgItemMessage(hDlg, IDC_DISPLAY_BUFFERCNT, CB_ADDSTRING, 0, (LPARAM)buffer); SendDlgItemMessage (hDlg, IDC_DISPLAY_BUFFERCNT, CB_SETCURSEL, workprefs.gfx_apmode[0].gfx_backbuffers, 0); + CheckDlgButton(hDlg, IDC_DISPLAY_TEARING, workprefs.gfx_apmode[0].gfx_tearing); + init_da (hDlg); } @@ -7615,6 +7630,8 @@ static void values_from_displaydlg (HWND hDlg, UINT msg, WPARAM wParam, LPARAM l workprefs.gfx_xcenter = ischecked (hDlg, IDC_XCENTER) ? 2 : 0; /* Smart centering */ workprefs.gfx_ycenter = ischecked (hDlg, IDC_YCENTER) ? 2 : 0; /* Smart centering */ + workprefs.gfx_apmode[0].gfx_tearing = ischecked(hDlg, IDC_DISPLAY_TEARING); + LRESULT posn1 = SendDlgItemMessage (hDlg, IDC_AUTORESOLUTIONSELECT, CB_GETCURSEL, 0, 0); if (posn1 != CB_ERR) { if (posn1 == 0) @@ -20633,6 +20650,10 @@ static int GetSettings (int all_options, HWND hwnd) MapDialogRect (dhwnd, &dialog_rect); hGUIWnd = dhwnd; + if (currentpage == LOADSAVE_ID) { + // update boxart + SendMessage(pages[LOADSAVE_ID], WM_USER + 1, 0, 0); + } if (devicechangetimer < 0) SetTimer(dhwnd, 4, 2000, NULL); diff --git a/od-win32/win32gui.h b/od-win32/win32gui.h index a8f9f5b8..3366164c 100644 --- a/od-win32/win32gui.h +++ b/od-win32/win32gui.h @@ -51,4 +51,6 @@ extern bool show_box_art(const TCHAR*); extern void move_box_art_window(void); extern void close_box_art_window(void); extern LRESULT CALLBACK BoxArtWindowProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam); +extern int max_visible_boxart_images; +extern int stored_boxart_window_width; #endif diff --git a/od-win32/win32gui_extra.cpp b/od-win32/win32gui_extra.cpp index 02ad25b6..e79748a4 100644 --- a/od-win32/win32gui_extra.cpp +++ b/od-win32/win32gui_extra.cpp @@ -694,22 +694,29 @@ int scaleresource_choosefont (HWND hDlg, int fonttype) #include -#define MAX_BOX_ART_IMAGES 12 +#define MAX_BOX_ART_IMAGES 20 +#define MAX_BOX_ART_TYPES 4 +#define MAX_VISIBLE_IMAGES 2 static bool boxart_inited; static ULONG_PTR gdiplusToken; static HWND boxarthwnd; static int boxart_window_width; static int boxart_window_height; -static const int box_art_width = 400; -static const int hgap = 10; -static const int wgap = 10; +static const int hgap = 8; +static const int wgap = 8; static Gdiplus::Image *images[MAX_BOX_ART_IMAGES]; static int total_height; static int max_width; static int total_images; static int imagemode; static bool imagemodereset; +static int lastimage; +static TCHAR image_path[MAX_DPATH]; +static int image_coords[MAX_VISIBLE_IMAGES + 1]; + +int max_visible_boxart_images = MAX_VISIBLE_IMAGES; +int stored_boxart_window_width = 400; static void boxart_init(void) { @@ -717,20 +724,11 @@ static void boxart_init(void) Gdiplus::GdiplusStartup(&gdiplusToken, &gdiplusStartupInput, NULL); } -static const TCHAR *boxartnames[MAX_BOX_ART_IMAGES + 1] = { +static const TCHAR *boxartnames[MAX_BOX_ART_TYPES] = { _T("Boxart"), - _T("SShot"), _T("Title"), - _T("Misc1"), - _T("Misc2"), - _T("Misc3"), - _T("Misc4"), - _T("Misc5"), - _T("Misc6"), - _T("Misc7"), - _T("Misc8"), - _T("Misc9"), - NULL + _T("SShot"), + _T("Misc"), }; typedef HRESULT(CALLBACK* DWMGETWINDOWATTRIBUTE)(HWND hwnd, DWORD dwAttribute, PVOID pvAttribute, DWORD cbAttribute); @@ -756,7 +754,7 @@ static void getpos(RECT *r) r->left = r1.right - ((r2.left - r1.left) + (r1.right - r2.right)); r->top = r1.top; r->bottom = r1.bottom; - r->right = r->left + box_art_width; + r->right = r->left + stored_boxart_window_width; } void move_box_art_window(void) @@ -771,7 +769,7 @@ void move_box_art_window(void) void close_box_art_window(void) { - for (int i = 0; boxartnames[i]; i++) { + for (int i = 0; i < MAX_BOX_ART_IMAGES; i++) { if (images[i]) { delete images[i]; images[i] = NULL; @@ -799,7 +797,7 @@ static bool open_box_art_window(void) _T("BoxArt"), _T("WinUAE"), style, r.left, r.top, - box_art_width, r.bottom - r.top, + stored_boxart_window_width, r.bottom - r.top, hGUIWnd, NULL, hInst, NULL); if (boxarthwnd) { RECT r; @@ -816,8 +814,14 @@ static bool open_box_art_window(void) static void boxartpaint(HDC hdc, HWND hwnd) { - if (!total_images) - return; + int cnt; + RECT r; + + r.left = 0; + r.top = 0; + r.right = boxart_window_width; + r.bottom = boxart_window_height; + FillRect(hdc, &r, (HBRUSH)(COLOR_BTNFACE + 1)); int image_count = total_images; int image_total_height = total_height; @@ -836,6 +840,7 @@ static void boxartpaint(HDC hdc, HWND hwnd) Gdiplus::Image *img = images[imagemode - 1]; image_count = 1; image_total_height = img->GetHeight(); + max_width = img->GetWidth(); img = NULL; break; } @@ -867,13 +872,29 @@ static void boxartpaint(HDC hdc, HWND hwnd) scale = scaley; Gdiplus::Graphics graphics(hdc); + Gdiplus::Pen pen(Gdiplus::Color(170, 170, 0, 0), 1); + int y = hgap; + cnt = 0; + for (int i = 0; i < MAX_BOX_ART_IMAGES; i++) { + if (!imagemode && cnt >= max_visible_boxart_images) + break; + if (images[i]) { + Gdiplus::Image *img = images[i]; + int h = img->GetHeight(); + y += h; + cnt++; + } + } - Gdiplus::Pen pen(Gdiplus::Color(170, 170, 0, 0), 1); + y = hgap + (window_h - (int)(y * scale + 0.5)) / 2; - for (int i = 0; boxartnames[i]; i++) { + cnt = 0; + for (int i = 0; i < MAX_BOX_ART_IMAGES; i++) { if (imagemode && imagemode - 1 != i) continue; + if (!imagemode && cnt >= max_visible_boxart_images) + break; if (images[i]) { Gdiplus::Image *img = images[i]; int w = img->GetWidth(); @@ -894,11 +915,14 @@ static void boxartpaint(HDC hdc, HWND hwnd) Gdiplus::Rect d(x1, y1, x2, y2); graphics.DrawImage(img, d); - Gdiplus::Rect d2(x1 - 1, y1 - 1, x2 + 2, y2 + 2); + Gdiplus::Rect d2(x1 - 1, y1 - 1, x2 + 1, y2 + 1); graphics.DrawRectangle(&pen, d2); + image_coords[cnt] = y1 + y2 + hgap / 2; + y += h; y += hgap; + cnt++; } } } @@ -907,7 +931,7 @@ bool show_box_art(const TCHAR *path) { TCHAR tmp1[MAX_DPATH]; - for (int i = 0; boxartnames[i]; i++) { + for (int i = 0; i < MAX_BOX_ART_IMAGES; i++) { if (images[i]) { delete images[i]; images[i] = NULL; @@ -925,72 +949,127 @@ bool show_box_art(const TCHAR *path) boxart_init(); boxart_inited = true; } - if (isfullscreen() > 0 || !hGUIWnd) { close_box_art_window(); return false; } - if (!open_box_art_window()) return false; + if (path != image_path) + _tcscpy(image_path, path); + + if (max_visible_boxart_images < 1 || max_visible_boxart_images > 3) + max_visible_boxart_images = 2; + total_height = 2 * hgap; max_width = 0; total_images = 0; + lastimage = 0; write_log(_T("Box art path '%s'\n"), path); - for (int i = 0; boxartnames[i]; i++) { - Gdiplus::Image *image; - _tcscpy(tmp1, path); - _tcscat(tmp1, _T("___")); - _tcscat(tmp1, boxartnames[i]); - _tcscat(tmp1, _T(".png")); - - image = Gdiplus::Image::FromFile(tmp1); - // above returns out of memory if file does not exist! - if (image->GetLastStatus() != Gdiplus::Ok) { - _tcscpy(tmp1 + _tcslen(tmp1) - 3, _T("jpg")); + int cnt = 0; + for (int arttype = 0; arttype < MAX_BOX_ART_TYPES; arttype++) { + for (int j = 0; j < 10; j++) { + + if (total_images >= MAX_BOX_ART_IMAGES) + break; + images[cnt] = NULL; + + Gdiplus::Image *image; + _tcscpy(tmp1, path); + _tcscat(tmp1, _T("___")); + _tcscat(tmp1, boxartnames[arttype]); + if (j > 0) + _stprintf(tmp1 + _tcslen(tmp1), _T("%d"), j + 1); + _tcscat(tmp1, _T(".png")); + image = Gdiplus::Image::FromFile(tmp1); + // above returns out of memory if file does not exist! + if (image->GetLastStatus() != Gdiplus::Ok) { + _tcscpy(tmp1 + _tcslen(tmp1) - 3, _T("jpg")); + image = Gdiplus::Image::FromFile(tmp1); + } + if (image->GetLastStatus() == Gdiplus::Ok) { + int w = image->GetWidth(); + int h = image->GetHeight(); + write_log(_T("Image '%s' loaded %d*%d\n"), tmp1, w, h); + images[cnt++] = image; + if (total_images < max_visible_boxart_images) { + if (w > max_width) + max_width = w; + total_height += h; + total_images++; + } + } else { + delete image; + break; + } + image = NULL; } - if (image->GetLastStatus() == Gdiplus::Ok) { - int w = image->GetWidth(); - int h = image->GetHeight(); - write_log(_T("Image '%s' loaded %d*%d\n"), tmp1, w, h); - images[i] = image; - if (w > max_width) - max_width = w; - total_height += h; - total_images++; - } else { - delete image; - images[i] = NULL; - } - image = NULL; } + images[cnt] = NULL; - if (!total_images) + if (!total_images) { + close_box_art_window(); return false; + } total_height += hgap * (total_images - 1); + InvalidateRect(boxarthwnd, NULL, TRUE); ShowWindow(boxarthwnd, SW_SHOWNOACTIVATE); return true; } +static void image_reload(int cnt) +{ + max_visible_boxart_images = cnt; + regsetint(NULL, _T("ArtImageCount"), max_visible_boxart_images); + show_box_art(image_path); +} + LRESULT CALLBACK BoxArtWindowProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) { + int oldmode = imagemode; switch (message) { case WM_LBUTTONDOWN: - imagemode++; - imagemodereset = false; - InvalidateRect(hWnd, NULL, TRUE); + if (imagemode) { + lastimage = imagemode - 1; + imagemode = 0; + } else { + int y = (short)(lParam >> 16); + imagemode = 0; + for (int i = 1; i < max_visible_boxart_images; i++) { + if (y >= image_coords[i - 1]) + imagemode = i; + } + while (imagemode > 0) { + if (images[imagemode]) + break; + imagemode--; + } + imagemode++; + } + lastimage = imagemode - 1; + imagemodereset = true; + if (oldmode != imagemode) + InvalidateRect(hWnd, NULL, TRUE); break; case WM_RBUTTONDOWN: - imagemode = imagemode ? 0 : 1; + if (imagemode) { + imagemode++; + lastimage = imagemode - 1; + } else { + imagemode = lastimage + 1; + if (imagemode <= 0) + imagemode = 1; + } imagemodereset = false; - InvalidateRect(hWnd, NULL, TRUE); + if (oldmode != imagemode) + InvalidateRect(hWnd, NULL, TRUE); break; case WM_PAINT: { @@ -1004,15 +1083,41 @@ LRESULT CALLBACK BoxArtWindowProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM close_box_art_window(); return 0; case WM_CHAR: - if (wParam == 27) + switch (wParam) + { + case 27: DestroyWindow(hWnd); - if (wParam == ' ') { + break; + case ' ': imagemode++; imagemodereset = true; InvalidateRect(hWnd, NULL, TRUE); + break; + case '1': + image_reload(1); + break; + case '2': + image_reload(2); + break; + case '3': + image_reload(3); + break; } break; + case WM_EXITSIZEMOVE: + regsetint(NULL, _T("ArtImageWidth"), stored_boxart_window_width); + image_reload(max_visible_boxart_images); + break; case WM_SIZING: + { + RECT *r = (RECT*)lParam, r2; + getpos(&r2); + r->left = r2.left; + r->top = r2.top; + r->bottom = r2.bottom; + boxart_window_width = stored_boxart_window_width = r->right - r->left; + } + return FALSE; case WM_MOVING: { RECT *r = (RECT*)lParam, r2; diff --git a/od-win32/winuae_msvc15/winuae_msvc.vcxproj b/od-win32/winuae_msvc15/winuae_msvc.vcxproj index 6ab3441f..6a485985 100644 --- a/od-win32/winuae_msvc15/winuae_msvc.vcxproj +++ b/od-win32/winuae_msvc15/winuae_msvc.vcxproj @@ -39,7 +39,7 @@ {4ADAA943-1AC8-4FB5-82E5-4FB753B6C2DA} winuae 8.1 - 10.0.15063.0 + 8.1 @@ -65,7 +65,7 @@ Application false Unicode - v141 + v141_xp Application diff --git a/od-win32/winuaechangelog.txt b/od-win32/winuaechangelog.txt index db8213a9..7548f73b 100644 --- a/od-win32/winuaechangelog.txt +++ b/od-win32/winuaechangelog.txt @@ -4,6 +4,16 @@ JIT Direct current rules are less complex now. It automatically switches off onl - RTG VRAM is outside of reserved natmem space. Workaround: Move RTG in earlier position using Hardware info GUI panel. Note that in 64-bit version RTG VRAM must be inside of reserved natmem space. (Outside = error message and return back to GUI) +Beta 11: + +- Updated to MSVC 2017 15.5 +- Config file Description field caching broke in b9. +- Ignore WM_DEVICECHANGE messages during first 2 seconds when WinUAE GUI opens for the first time. Some systems seem to send spurious WM_DEVICECHANGE at program startup. +- Simple box art/screenshot config file support. (See http://eab.abime.net/showthread.php?t=89014 for details.) +- Direct3D11 mode OSD/RTG HW cursor support. All basic features are now implemented. Improved vsync and custom shaders to do. +- D3D11 is now the default (=config file does not override it) if Windows 7 or newer. +- Entering and exiting GUI in D3D11 fullscreen mode restored wrong texture size. +- If Wait for Blitter is enabled and blit size makes no sense (larger than chip ram size), don't wait. (Fixes long delay in Vital / Mystic) Beta 10: