]> git.unchartedbackwaters.co.uk Git - francis/winuae.git/commitdiff
2100b22
authorToni Wilen <twilen@winuae.net>
Wed, 14 Apr 2010 16:15:54 +0000 (19:15 +0300)
committerToni Wilen <twilen@winuae.net>
Wed, 14 Apr 2010 16:15:54 +0000 (19:15 +0300)
cia.cpp
custom.cpp
epsonprinter.cpp
od-win32/parser.h
od-win32/win32.h
od-win32/win32gui.cpp
od-win32/winuae_msvc10/winuae_msvc.sln
od-win32/winuae_msvc10/winuae_msvc.vcxproj

diff --git a/cia.cpp b/cia.cpp
index 01cf41e49665052a8424e0bec13d39e73e8c31a5..b0817703a529d35161932bd54db4a79bc208ea90 100644 (file)
--- 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);
index 9263567534dc9505a6e583f293fe90b1b42616f8..de6a622eec2cdd58ac605d3d2037410bf5d95133 100644 (file)
@@ -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. */
index 790bc5c540c4e23df8b4d2cd90319aa470a84784..a390bec470cba9eebe5780b98bfaeafb9103a6e6 100644 (file)
@@ -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; yy<pixsizeY; yy++)
                                                if (((PIXX + xx) < page_w) && ((PIXY + yy) < page_h)) {
                                                        *((Bit8u*)page + PIXX + xx + (PIXY+yy)*page_pitch) = 255;
-                                                       *((Bit8u*)cpage + PIXX + xx + (PIXY+yy)*page_pitch) |= 1 < printColor;
+                                                       (*((Bit8u*)cpage + PIXX + xx + (PIXY+yy)*page_pitch)) |= 1 << printColor;
                                                }
                                }
                        }
 
                        curY += (Real64)1/(Real64)bitGraph.vertDens;
+
+                       if (bitGraph.pin9 && i == 1 && j == 7)
+                               break;
                }
        }
 
@@ -2005,6 +2030,8 @@ static void printBitGraph(Bit8u ch)
        else
                curX += (Real64)1/(Real64)bitGraph.horizDens;
 
+       if (printColor)
+               colorPrinted = true;
 }
 
 static void blitGlyph(uae_u8 *gbitmap, int width, int rows, int pitch, int destx, int desty, int add)
index 0204fa3bb542b76344983cb8b4b58f1bd40d2a51..5cae6d2e3db0b3adf11af12a5c158035514332d6 100644 (file)
@@ -53,4 +53,5 @@ extern void epson_close(void);
 #define PARALLEL_MATRIX_TEXT 1
 #define PARALLEL_MATRIX_EPSON 2
 #define PARALLEL_MATRIX_EPSON9 2
-#define PARALLEL_MATRIX_EPSON48 3
+#define PARALLEL_MATRIX_EPSON24 3
+#define PARALLEL_MATRIX_EPSON48 4
index 7e832b380aef40452ae8ff2f7c36cb747b3304d7..a8da19603ac246c323f29ab8d7776c505566883f 100644 (file)
@@ -18,8 +18,8 @@
 #define WINUAEPUBLICBETA 1
 #define LANG_DLL 1
 
-#define WINUAEBETA L"21"
-#define WINUAEDATE MAKEBD(2010, 4, 10)
+#define WINUAEBETA L"22"
+#define WINUAEDATE MAKEBD(2010, 4, 14)
 #define WINUAEEXTRA L""
 #define WINUAEREV L""
 
index b843d549930f4d52b1bbc208ee7ab94abf9088a3..512f08d046c9f5d6d94e2eec827369d486e832d6 100644 (file)
@@ -280,6 +280,7 @@ static BOOL GetFileDialog (OPENFILENAME *opn, const GUID *guid, int mode)
        if (mode < 0)
                pfos |= FOS_PICKFOLDERS;
        pfd->SetOptions (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)
index a7a150d65060cf774d0c0d444d27b15b04326f82..090d5ee3a0f0c48642743cb0491ddc4184bff8e6 100644 (file)
@@ -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
index 2ae37dd2dc72212444f515d2edbc3a804fc61f97..12a0a0f742950e7e0e0b84b56f8bef1c627e2598 100644 (file)
       <AdditionalLibraryDirectories>%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
       <AdditionalManifestDependencies>%(AdditionalManifestDependencies)</AdditionalManifestDependencies>
       <IgnoreSpecificDefaultLibraries>%(IgnoreSpecificDefaultLibraries)</IgnoreSpecificDefaultLibraries>
-      <DelayLoadDLLs>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)</DelayLoadDLLs>
+      <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)</DelayLoadDLLs>
       <GenerateDebugInformation>true</GenerateDebugInformation>
       <ProgramDatabaseFile>.\FullRelease/winuae.pdb</ProgramDatabaseFile>
       <SubSystem>Windows</SubSystem>