From 1604a5edd6a2db7f62342a05b8f0b5f67937cd49 Mon Sep 17 00:00:00 2001 From: Toni Wilen Date: Wed, 14 Apr 2010 19:15:54 +0300 Subject: [PATCH] 2100b22 --- cia.cpp | 4 +- custom.cpp | 7 +++ epsonprinter.cpp | 61 ++++++++++++++++------ od-win32/parser.h | 3 +- od-win32/win32.h | 4 +- od-win32/win32gui.cpp | 46 +++++++++++----- od-win32/winuae_msvc10/winuae_msvc.sln | 1 - od-win32/winuae_msvc10/winuae_msvc.vcxproj | 2 +- 8 files changed, 93 insertions(+), 35 deletions(-) diff --git a/cia.cpp b/cia.cpp index 01cf41e4..b0817703 100644 --- a/cia.cpp +++ b/cia.cpp @@ -746,7 +746,9 @@ static uae_u8 ReadCIAB (unsigned int addr) #endif #ifdef PARALLEL_PORT if (isprinter () > 0) { - tmp |= ciabpra & (0x04 | 0x02 | 0x01); + //tmp |= ciabpra & (0x04 | 0x02 | 0x01); + tmp &= ~3; // clear BUSY and PAPEROUT + tmp |= 4; // set SELECT } else if (isprinter () < 0) { uae_u8 v; parallel_direct_read_status (&v); diff --git a/custom.cpp b/custom.cpp index 92635675..de6a622e 100644 --- a/custom.cpp +++ b/custom.cpp @@ -2557,6 +2557,13 @@ static void finish_decisions (void) diw_hcounter = maxhpos * 2; last_hdiw = 2 - 1; } + + if (next_color_change >= MAX_REG_CHANGE - 30) { + write_log (L"color_change buffer overflow!\n"); + next_color_change = 0; + dip->nr_color_changes = 0; + dip->first_color_change = 0; + } } /* Set the state of all decisions to "undecided" for a new scanline. */ diff --git a/epsonprinter.cpp b/epsonprinter.cpp index 790bc5c5..a390bec4 100644 --- a/epsonprinter.cpp +++ b/epsonprinter.cpp @@ -51,6 +51,7 @@ int pngprint = 0; #define false 0 #ifdef WINFONT +static const TCHAR *epsonprintername; static HFONT curFont; static float curFontHorizPoints, curFontVertPoints; static TCHAR *curFontName; @@ -85,6 +86,7 @@ static struct bitGraphicParams { Bit16u remBytes; Bit8u column[6]; Bit8u readBytesColumn; + int pin9; } bitGraph; static Bit8u densk, densl, densy, densz; static Bit16u curMap[256], charTables[4]; @@ -693,9 +695,9 @@ STATIC_INLINE void getcolor (uae_u8 *Tpage, uae_u8 *Tcpage, int x, int y, int Tp int cindex = 0; while (c) { if (c & 1) { - color_r |= (255 - colors[cindex * 3 + 0]) * pixel / 256; - color_g |= (255 - colors[cindex * 3 + 1]) * pixel / 256; - color_b |= (255 - colors[cindex * 3 + 2]) * pixel / 256; + color_r |= (255 - colors[cindex * 3 + 0]) * pixel / 255; + color_g |= (255 - colors[cindex * 3 + 1]) * pixel / 255; + color_b |= (255 - colors[cindex * 3 + 2]) * pixel / 255; } cindex++; c >>= 1; @@ -716,6 +718,7 @@ static void *prt_thread (void *p) int Tpage_pitch = page_pitch; uae_u8 *Tpage = page; uae_u8 *Tcpage = cpage; + int TcolorPrinter = colorPrinted; write_log (L"EPSONPRINTER: background print thread started\n"); prt_thread_mode = 1; @@ -732,9 +735,9 @@ static void *prt_thread (void *p) write_log (L"EPSONPRINTER: HP=%d WP=%d TM=%d LM=%d W=%d H=%d\n", hz, vz, topmargin, leftmargin, Tpage_w, Tpage_h); - if (colorPrinted) + if (TcolorPrinter) dc = GetDC (NULL); - HBITMAP bitmap = CreateCompatibleBitmap (dc, Tpage_w, Tpage_h); + HBITMAP bitmap = CreateCompatibleBitmap (dc ? dc : TmemHDC, Tpage_w, Tpage_h); SelectObject (TmemHDC, bitmap); BitBlt (TmemHDC, 0, 0, Tpage_w, Tpage_h, NULL, 0, 0, WHITENESS); @@ -821,7 +824,7 @@ static void *prt_thread (void *p) // Allocate an array of scanline pointers row_pointers = (png_bytep*)malloc(Tpage_h*sizeof(png_bytep)); - if (colorPrinted) { + if (TcolorPrinter) { png_set_IHDR(png_ptr, info_ptr, Tpage_w, Tpage_h, 8, PNG_COLOR_TYPE_RGB, PNG_INTERLACE_NONE, PNG_COMPRESSION_TYPE_DEFAULT, PNG_FILTER_TYPE_DEFAULT); @@ -900,6 +903,8 @@ static void newPage(int save) if (page == NULL) { page = xcalloc (uae_u8, pagesize); cpage = xcalloc (uae_u8, pagesize); + printerDC = CreateDC (NULL, epsonprintername, NULL, NULL); + memHDC = CreateCompatibleDC (NULL); } curY = topMargin; memset (page, 0, pagesize); @@ -1004,7 +1009,8 @@ static int printer_init(Bit16u dpi2, Bit16u width, Bit16u height, const TCHAR *p PrintDlg(&pd); printerDC = pd.hDC; #endif - printerDC = CreateDC (NULL, printername, NULL, NULL); + epsonprintername = printername; + printerDC = CreateDC (NULL, epsonprintername, NULL, NULL); if (!printerDC) return 0; @@ -1063,7 +1069,7 @@ static void printer_close(void) }; -static void setupBitImage(Bit8u dens, Bit16u numCols) +static void setupBitImage(Bit8u dens, Bit16u numCols, int pin9) { switch (dens) { @@ -1184,8 +1190,14 @@ static void setupBitImage(Bit8u dens, Bit16u numCols) default: write_log(L"EPSONPRINTER: Unsupported bit image density %i\n", dens); } - if (pins == 9) + bitGraph.pin9 = false; + if (pins == 9) { + if (pin9) { + bitGraph.pin9 = true; + bitGraph.bytesColumn = 2; + } bitGraph.vertDens = 72; + } bitGraph.remBytes = numCols * bitGraph.bytesColumn; bitGraph.readBytesColumn = 0; } @@ -1208,6 +1220,7 @@ static int processCommandChar(Bit8u ch) case 0x0f: // Select condensed printing (ESC SI) case 0x23: // Cancel MSB control (ESC #) case 0x30: // Select 1/8-inch line spacing (ESC 0) + case 0x31: // Select 7/72-inch line spacing (ESC 1) case 0x32: // Select 1/6-inch line spacing (ESC 2) case 0x34: // Select italic font (ESC 4) case 0x35: // Cancel italic font (ESC 5) @@ -1261,6 +1274,7 @@ static int processCommandChar(Bit8u ch) case 0x4c: // Select 120-dpi graphics (ESC L) case 0x59: // Select 120-dpi, double-speed graphics (ESC Y) case 0x5a: // Select 240-dpi graphics (ESC Z) + case 0x5e: // Select 60/120-dpi, 9-pin graphics case 0x5c: // Set relative horizontal print position (ESC \) case 0x63: // Set horizontal motion index (HMI) (ESC c) neededParam = 2; @@ -1446,7 +1460,7 @@ static int processCommandChar(Bit8u ch) } break; case 0x2a: // Select bit image (ESC *) - setupBitImage(params[0], PARAM16(1)); + setupBitImage(params[0], PARAM16(1), false); break; case 0x2b: // Set n/360-inch line spacing (ESC +) lineSpacing = (Real64)params[0]/360; @@ -1467,6 +1481,9 @@ static int processCommandChar(Bit8u ch) case 0x30: // Select 1/8-inch line spacing (ESC 0) lineSpacing = (Real64)1/8; break; + case 0x31: // Select 7/72-inch line spacing (ESC 1) 9-pin ONLY + lineSpacing = (Real64)7/72; + break; case 0x32: // Select 1/6-inch line spacing (ESC 2) lineSpacing = (Real64)1/6; break; @@ -1538,15 +1555,15 @@ static int processCommandChar(Bit8u ch) style &= 0xFFFF - STYLE_DOUBLESTRIKE; break; case 0x4a: // Advance print position vertically (ESC J n) - curY += (Real64)((Real64)params[0] / 180); + curY += (Real64)((Real64)params[0] / (pins == 9 ? 216 : 180)); if (curY > bottomMargin) newPage(true); break; case 0x4b: // Select 60-dpi graphics (ESC K) - setupBitImage(densk, PARAM16(0)); + setupBitImage(densk, PARAM16(0), false); break; case 0x4c: // Select 120-dpi graphics (ESC L) - setupBitImage(densl, PARAM16(0)); + setupBitImage(densl, PARAM16(0), false); break; case 0x4d: // Select 10.5-point, 12-cpi (ESC M) cpi = 12; @@ -1639,10 +1656,13 @@ static int processCommandChar(Bit8u ch) updateFont(); break; case 0x59: // Select 120-dpi, double-speed graphics (ESC Y) - setupBitImage(densy, PARAM16(0)); + setupBitImage(densy, PARAM16(0), false); break; case 0x5a: // Select 240-dpi graphics (ESC Z) - setupBitImage(densz, PARAM16(0)); + setupBitImage(densz, PARAM16(0), false); + break; + case 0x5e: // Select 60/120-dpi, 9-pin graphics + setupBitImage(densy, PARAM16(0), true); break; case 0x5c: // Set relative horizontal print position (ESC \) { @@ -1761,7 +1781,7 @@ static int processCommandChar(Bit8u ch) updateFont(); break; case 0x242: // Bar code setup and print (ESC (B) - write_log(L"EPSONPRINTER: Bardcode printing not supported\n"); + write_log(L"EPSONPRINTER: Barcode printing not supported\n"); // Find out how many bytes to skip neededParam = PARAM16(0); numParam = 0; @@ -1977,6 +1997,8 @@ static void printBitGraph(Bit8u ch) for (j=7; j>=0; j--) { Bit8u pixel = (bitGraph.column[i] >> j) & 0x01; + if (bitGraph.pin9 && i == 1 && j == 7) + pixel = bitGraph.column[i] & 0x01; if (pixel != 0) { @@ -1986,12 +2008,15 @@ static void printBitGraph(Bit8u ch) for (yy=0; yySetOptions (pfos); + opn->nFileOffset = 0; if (guid) pfd->SetClientGuid (*guid); @@ -352,7 +353,7 @@ static BOOL GetFileDialog (OPENFILENAME *opn, const GUID *guid, int mode) DWORD cnt; hr = pitema->GetCount (&cnt); if (SUCCEEDED (hr)) { - int i; + int i, first = true; for (i = 0; i < cnt; i++) { IShellItem *pitem; hr = pitema->GetItemAt (i, &pitem); @@ -360,11 +361,29 @@ static BOOL GetFileDialog (OPENFILENAME *opn, const GUID *guid, int mode) WCHAR *path = NULL; hr = pitem->GetDisplayName (SIGDN_FILESYSPATH, &path); if (SUCCEEDED (hr)) { + TCHAR *ppath = path; TCHAR *p = opn->lpstrFile; while (*p) p += _tcslen (p) + 1; - if (p - opn->lpstrFile + _tcslen (path) + 2 < opn->nMaxFile) { - _tcscpy (p, path); + TCHAR *pathfilename = _tcsrchr (ppath, '\\'); + if (pathfilename) + pathfilename++; + if (first && cnt > 1) { + opn->nFileOffset = pathfilename - ppath; + _tcscpy (p, ppath); + p[opn->nFileOffset - 1] = 0; + p += _tcslen (p) + 1; + *p = 0; + ppath = pathfilename; + } else if (cnt > 1) { + ppath = pathfilename; + } else { + ppath = path; + } + if (!ppath) + ppath = path; + if (p - opn->lpstrFile + _tcslen (ppath) + 2 < opn->nMaxFile) { + _tcscpy (p, ppath); p[_tcslen (p) + 1] = 0; } if (opn->lpstrFileTitle && !opn->lpstrFileTitle[0]) { @@ -372,6 +391,7 @@ static BOOL GetFileDialog (OPENFILENAME *opn, const GUID *guid, int mode) if (p && opn->lpstrFileTitle) _tcscpy (opn->lpstrFileTitle, p); } + first = false; } CoTaskMemFree (path); } @@ -1811,7 +1831,6 @@ int DiskSelection_2 (HWND hDlg, WPARAM wParam, int flag, struct uae_prefs *prefs TCHAR init_path[MAX_DPATH] = L""; BOOL result = FALSE; TCHAR *amiga_path = NULL, *initialdir = NULL, *defext = NULL; - TCHAR description[CFG_DESCRIPTION_LENGTH] = L""; TCHAR *p, *nextp; int all = 1; int next; @@ -1833,27 +1852,27 @@ int DiskSelection_2 (HWND hDlg, WPARAM wParam, int flag, struct uae_prefs *prefs { case 0: case 1: - getfilter(flag, L"FloppyPath", previousfilter, filtername); + getfilter (flag, L"FloppyPath", previousfilter, filtername); fetch_path (L"FloppyPath", init_path, sizeof (init_path) / sizeof (TCHAR)); guid = &diskselectionguids[0]; break; case 2: case 3: - getfilter(flag, L"hdfPath", previousfilter, filtername); + getfilter (flag, L"hdfPath", previousfilter, filtername); fetch_path (L"hdfPath", init_path, sizeof (init_path) / sizeof (TCHAR)); guid = &diskselectionguids[1]; break; case 6: case 7: case 11: - getfilter(flag, L"KickstartPath", previousfilter, filtername); + getfilter (flag, L"KickstartPath", previousfilter, filtername); fetch_path (L"KickstartPath", init_path, sizeof (init_path) / sizeof (TCHAR)); guid = &diskselectionguids[2]; break; case 4: case 5: case 8: - getfilter(flag, L"ConfigurationPath", previousfilter, filtername); + getfilter (flag, L"ConfigurationPath", previousfilter, filtername); fetch_path (L"ConfigurationPath", init_path, sizeof (init_path) / sizeof (TCHAR)); guid = &diskselectionguids[3]; break; @@ -1886,12 +1905,12 @@ int DiskSelection_2 (HWND hDlg, WPARAM wParam, int flag, struct uae_prefs *prefs break; case 15: case 16: - getfilter(flag, L"InputPath", previousfilter, filtername); + getfilter (flag, L"InputPath", previousfilter, filtername); fetch_path (L"InputPath", init_path, sizeof (init_path) / sizeof (TCHAR)); guid = &diskselectionguids[5]; break; case 17: - getfilter(flag, L"CDPath", previousfilter, filtername); + getfilter (flag, L"CDPath", previousfilter, filtername); fetch_path (L"CDPath", init_path, sizeof (init_path) / sizeof (TCHAR)); guid = &diskselectionguids[6]; break; @@ -2065,8 +2084,8 @@ int DiskSelection_2 (HWND hDlg, WPARAM wParam, int flag, struct uae_prefs *prefs setfilter (flag, previousfilter, filtername); } - memcpy (full_path2, full_path, sizeof (full_path) / sizeof (TCHAR)); - memcpy (stored_path, full_path, sizeof (stored_path) / sizeof (TCHAR)); + memcpy (full_path2, full_path, sizeof full_path); + memcpy (stored_path, full_path, sizeof stored_path); next = 0; nextp = full_path2 + openFileName.nFileOffset; if (path_out) { @@ -8815,6 +8834,7 @@ static INT_PTR CALLBACK HarddiskDlgProc (HWND hDlg, UINT msg, WPARAM wParam, LPA clicked_entry = 0; pages[HARDDISK_ID] = hDlg; currentpage = HARDDISK_ID; + Button_SetElevationRequiredState (GetDlgItem (hDlg, IDC_NEW_HD), TRUE); EnableWindow (GetDlgItem (hDlg, IDC_NEW_HD), os_winnt_admin > 1 ? TRUE : FALSE); case WM_USER: @@ -10093,6 +10113,8 @@ static void values_to_portsdlg (HWND hDlg) } SetDlgItemInt (hDlg, IDC_PRINTERAUTOFLUSH, workprefs.parallel_autoflush_time, FALSE); idx = workprefs.parallel_matrix_emulation; + if (idx >= PARALLEL_MATRIX_EPSON24) + idx = PARALLEL_MATRIX_EPSON24; if (workprefs.parallel_postscript_detection) idx = 4; if (workprefs.parallel_postscript_emulation) diff --git a/od-win32/winuae_msvc10/winuae_msvc.sln b/od-win32/winuae_msvc10/winuae_msvc.sln index a7a150d6..090d5ee3 100644 --- a/od-win32/winuae_msvc10/winuae_msvc.sln +++ b/od-win32/winuae_msvc10/winuae_msvc.sln @@ -127,7 +127,6 @@ Global {8627DA33-98D1-4F60-B404-ECCEE0EE7BF9}.Debug|Win32.ActiveCfg = Debug|Win32 {8627DA33-98D1-4F60-B404-ECCEE0EE7BF9}.Debug|x64.ActiveCfg = Debug|Win32 {8627DA33-98D1-4F60-B404-ECCEE0EE7BF9}.FullRelease|Win32.ActiveCfg = Release|Win32 - {8627DA33-98D1-4F60-B404-ECCEE0EE7BF9}.FullRelease|Win32.Build.0 = Release|Win32 {8627DA33-98D1-4F60-B404-ECCEE0EE7BF9}.FullRelease|x64.ActiveCfg = Release|Win32 {8627DA33-98D1-4F60-B404-ECCEE0EE7BF9}.Release|Win32.ActiveCfg = Release|Win32 {8627DA33-98D1-4F60-B404-ECCEE0EE7BF9}.Release|x64.ActiveCfg = Release|x64 diff --git a/od-win32/winuae_msvc10/winuae_msvc.vcxproj b/od-win32/winuae_msvc10/winuae_msvc.vcxproj index 2ae37dd2..12a0a0f7 100644 --- a/od-win32/winuae_msvc10/winuae_msvc.vcxproj +++ b/od-win32/winuae_msvc10/winuae_msvc.vcxproj @@ -435,7 +435,7 @@ %(AdditionalLibraryDirectories) %(AdditionalManifestDependencies) %(IgnoreSpecificDefaultLibraries) - wpcap.dll;packet.dll;d3dx9_42.dll;openal32.dll;wintab32.dll;portaudio_x86.dll;freetype6.dll;ws2_32.dll;msacm32.dll;wtsapi32.dll;dsound.dll;avrt.dll;wininet.dll;%(DelayLoadDLLs) + wpcap.dll;packet.dll;d3dx9_42.dll;openal32.dll;wintab32.dll;portaudio_x86.dll;ws2_32.dll;msacm32.dll;wtsapi32.dll;dsound.dll;wininet.dll;%(DelayLoadDLLs) true .\FullRelease/winuae.pdb Windows -- 2.47.3