]> git.unchartedbackwaters.co.uk Git - francis/winuae.git/commitdiff
imported winuaesrc1600b28.zip
authorToni Wilen <twilen@winuae.net>
Sat, 9 May 2009 10:42:39 +0000 (13:42 +0300)
committerToni Wilen <twilen@winuae.net>
Mon, 22 Feb 2010 19:46:18 +0000 (21:46 +0200)
42 files changed:
akiko.c
audio.c
cfgfile.c
custom.c
disk.c
epsonprinter.c [new file with mode: 0644]
filesys [deleted file]
include/audio.h
include/epsonprinter.h [new file with mode: 0644]
include/events.h
include/gensound.h
include/options.h
include/sysconfig.h.win32 [deleted file]
include/tui.h [deleted file]
main.c
ncurses.c [deleted file]
od-generic/exectasks.h [deleted file]
od-generic/joystick.c [deleted file]
od-generic/memory.h [deleted file]
od-generic/sound.c [deleted file]
od-generic/sound.h [deleted file]
od-win32/dxwrap.h
od-win32/parser.c
od-win32/parser.h
od-win32/picasso96_win.c
od-win32/resources/resource
od-win32/resources/winuae.rc
od-win32/sounddep/sound.c
od-win32/sounddep/sound.h
od-win32/win32.c
od-win32/win32.h
od-win32/win32_scale2x.c
od-win32/win32gfx.c
od-win32/win32gui.c
od-win32/winuae_msvc/winuae_msvc.vcproj
od-win32/winuaechangelog.txt
scsi-none.c [deleted file]
sdl-joystick.c [deleted file]
svga.c [deleted file]
svgancui.c [deleted file]
tui.c [deleted file]
uaeunp.c

diff --git a/akiko.c b/akiko.c
index 02a8067b4dc7279d546d334f195d8716d68725a5..41539dd5d4c6404245af4fadd5b5defc54b6ba10 100644 (file)
--- a/akiko.c
+++ b/akiko.c
@@ -397,6 +397,7 @@ static int cdrom_current_sector;
 static int cdrom_data_end, cdrom_leadout;
 static int cdrom_audiotimeout;
 static int cdrom_led;
+static int cdrom_dosomething;
 
 static uae_u8 *sector_buffer_1, *sector_buffer_2;
 static int sector_buffer_sector_1, sector_buffer_sector_2;
@@ -928,6 +929,7 @@ static void cdrom_run_command_run (void)
        len = cdrom_command_multi ();
        break;
        case 5:
+       cdrom_dosomething = 1; // this is a hack
        len = cdrom_command_led ();
        break;
        case 6:
@@ -1028,8 +1030,9 @@ static void akiko_handler (void)
            return;
        }
     }
-    if (cdrom_toc_counter >= 0 && !cdrom_command_active) {
+    if (cdrom_toc_counter >= 0 && !cdrom_command_active && cdrom_dosomething) {
        cdrom_return_data (cdrom_return_toc_entry ());
+       cdrom_dosomething--;
        return;
     }
 }
diff --git a/audio.c b/audio.c
index 19398300c0fe3910962455bb312258e671725b3c..82e7615db715a14b503372890826ded14096f979 100644 (file)
--- a/audio.c
+++ b/audio.c
@@ -78,7 +78,6 @@ struct audio_channel_data {
     uae_u8 dmaen, intreq2;
     uaecptr lc, pt;
     int current_sample, last_sample;
-    int *voltbl;
     int state;
     int per;
     int vol;
@@ -92,6 +91,9 @@ struct audio_channel_data {
     int sinc_queue_length;
 };
 
+static int samplecnt;
+static int extrasamples, outputsample, doublesample;
+
 int sampleripper_enabled;
 struct ripped_sample
 {
@@ -267,45 +269,18 @@ static void do_samplerip (struct audio_channel_data *adp)
 
 static struct audio_channel_data audio_channel[4];
 int sound_available = 0;
-static int sound_table[64][256];
 void (*sample_handler) (void);
 static void (*sample_prehandler) (unsigned long best_evtime);
 
-unsigned long sample_evtime, scaled_sample_evtime;
-
-static unsigned long last_cycles, next_sample_evtime;
-
-void init_sound_table16 (void)
-{
-    int i,j;
-
-    for (i = 0; i < 256; i++)
-       for (j = 0; j < 64; j++)
-           sound_table[j][i] = j * (uae_s8)i * get_audio_ismono() ? 1 : 2;
-}
-
-void init_sound_table8 (void)
-{
-    int i,j;
-
-    for (i = 0; i < 256; i++)
-       for (j = 0; j < 64; j++)
-           sound_table[j][i] = (j * (uae_s8)i * get_audio_ismono() ? 1 : 2) / 256;
-}
+float sample_evtime, scaled_sample_evtime;
 
-#define        MULTIPLICATION_PROFITABLE
+static unsigned long last_cycles;
+static float next_sample_evtime;
 
-#ifdef MULTIPLICATION_PROFITABLE
 typedef uae_s8 sample8_t;
 #define DO_CHANNEL_1(v, c) do { (v) *= audio_channel[c].vol; } while (0)
 #define SBASEVAL16(logn) ((logn) == 1 ? SOUND16_BASE_VAL >> 1 : SOUND16_BASE_VAL)
 #define FINISH_DATA(data, b, logn) do { if (14 - (b) + (logn) > 0) (data) >>= 14 - (b) + (logn); else (data) <<= (b) - 14 - (logn); } while (0);
-#else
-typedef uae_u8 sample8_t;
-#define DO_CHANNEL_1(v, c) do { (v) = audio_channel[c].voltbl[(v)]; } while (0)
-#define SBASEVAL16(logn) SOUND16_BASE_VAL
-#define FINISH_DATA(data, b, logn)
-#endif
 
 static uae_u32 right_word_saved[SOUND_MAX_DELAY_BUFFER];
 static uae_u32 left_word_saved[SOUND_MAX_DELAY_BUFFER];
@@ -351,7 +326,7 @@ enum {
  * and to 1 dB with the filter off.
 */
 
-static int filter(int input, struct filter_state *fs)
+static int filter (int input, struct filter_state *fs)
 {
     int o;
     float normal_output, led_output;
@@ -588,12 +563,16 @@ void sample16_handler (void)
     data0 += data1;
     data0 += data2;
     data0 += data3;
-    {
+    if (outputsample) {
        uae_u32 data = SBASEVAL16(2) + data0;
        FINISH_DATA (data, 16, 2);
        PUT_SOUND_WORD_MONO (data);
+       check_sound_buffers ();
+       if (doublesample) {
+           PUT_SOUND_WORD_MONO (data);
+           check_sound_buffers ();
+       }
     }
-    check_sound_buffers ();
 }
 
 /* This interpolator examines sample points when Paula switches the output
@@ -604,9 +583,15 @@ static void sample16i_anti_handler (void)
 
     samplexx_anti_handler (datas);
     data1 = datas[0] + datas[3] + datas[1] + datas[2];
-    FINISH_DATA (data1, 16, 2);
-    PUT_SOUND_WORD_MONO (data1);
-    check_sound_buffers ();
+    if (outputsample) {
+       FINISH_DATA (data1, 16, 2);
+       PUT_SOUND_WORD_MONO (data1);
+       check_sound_buffers ();
+       if (doublesample) {
+           PUT_SOUND_WORD_MONO (data1);
+           check_sound_buffers ();
+       }
+    }
 }
 
 static void sample16i_rh_handler (void)
@@ -652,12 +637,16 @@ static void sample16i_rh_handler (void)
     delta = audio_channel[3].per;
     ratio = ((audio_channel[3].evtime % delta) << 8) / delta;
     data0 += (data3 * (256 - ratio) + data3p * ratio) >> 8;
-    {
-       uae_u32 data = SBASEVAL16(2) + data0;
+    if (outputsample) {
+       uae_u32 data = SBASEVAL16(2) + data0;
        FINISH_DATA (data, 16, 2);
        PUT_SOUND_WORD_MONO (data);
+       check_sound_buffers ();
+       if (doublesample) {
+           PUT_SOUND_WORD_MONO (data);
+           check_sound_buffers ();
+       }
     }
-    check_sound_buffers ();
 }
 
 static void sample16i_crux_handler (void)
@@ -723,17 +712,21 @@ static void sample16i_crux_handler (void)
     data1 += data2;
     data0 += data3;
     data0 += data1;
-    {
-       uae_u32 data = SBASEVAL16(2) + data0;
+    if (outputsample) {
+       uae_u32 data = SBASEVAL16(2) + data0;
        FINISH_DATA (data, 16, 2);
        PUT_SOUND_WORD_MONO (data);
+       check_sound_buffers ();
+       if (doublesample) {
+           PUT_SOUND_WORD_MONO (data);
+           check_sound_buffers ();
+       }
     }
-    check_sound_buffers ();
 }
 
 #ifdef HAVE_STEREO_SUPPORT
 
-static void make6ch (uae_s32 d0, uae_s32 d1, uae_s32 d2, uae_s32 d3)
+STATIC_INLINE void make6ch (uae_s32 d0, uae_s32 d1, uae_s32 d2, uae_s32 d3)
 {
     uae_s32 sum = d0 + d1 + d2 + d3;
     PUT_SOUND_WORD (sum >> 1);
@@ -756,14 +749,24 @@ void sample16ss_handler (void)
     data2 &= audio_channel[2].adk_mask;
     data3 &= audio_channel[3].adk_mask;
 
-    put_sound_word_left (data0 << 2);
-    put_sound_word_right (data1 << 2);
-    if (currprefs.sound_stereo == SND_6CH)
-       make6ch (data0, data1, data2, data3);
-    put_sound_word_left2 (data3 << 2);
-    put_sound_word_right2 (data2 << 2);
-
-    check_sound_buffers ();
+    if (outputsample) {
+       put_sound_word_left (data0 << 2);
+       put_sound_word_right (data1 << 2);
+       if (currprefs.sound_stereo == SND_6CH)
+           make6ch (data0, data1, data2, data3);
+       put_sound_word_left2 (data3 << 2);
+       put_sound_word_right2 (data2 << 2);
+       check_sound_buffers ();
+       if (doublesample) {
+           put_sound_word_left (data0 << 2);
+           put_sound_word_right (data1 << 2);
+           if (currprefs.sound_stereo == SND_6CH)
+               make6ch (data0, data1, data2, data3);
+           put_sound_word_left2 (data3 << 2);
+           put_sound_word_right2 (data2 << 2);
+           check_sound_buffers ();
+       }
+   }
 }
 
 /* This interpolator examines sample points when Paula switches the output
@@ -774,13 +777,24 @@ void sample16ss_anti_handler (void)
     int datas[4];
 
     samplexx_anti_handler (datas);
-    put_sound_word_left (datas[0] << 2);
-    put_sound_word_right (datas[1] << 2);
-    if (currprefs.sound_stereo == SND_6CH)
-       make6ch (datas[0], datas[1], datas[2], datas[3]);
-    put_sound_word_left2 (datas[3] << 2);
-    put_sound_word_right2 (datas[2] << 2);
-    check_sound_buffers ();
+    if (outputsample) {
+       put_sound_word_left (datas[0] << 2);
+       put_sound_word_right (datas[1] << 2);
+       if (currprefs.sound_stereo == SND_6CH)
+           make6ch (datas[0], datas[1], datas[2], datas[3]);
+       put_sound_word_left2 (datas[3] << 2);
+       put_sound_word_right2 (datas[2] << 2);
+       check_sound_buffers ();
+       if (doublesample) {
+           put_sound_word_left (datas[0] << 2);
+           put_sound_word_right (datas[1] << 2);
+           if (currprefs.sound_stereo == SND_6CH)
+               make6ch (datas[0], datas[1], datas[2], datas[3]);
+           put_sound_word_left2 (datas[3] << 2);
+           put_sound_word_right2 (datas[2] << 2);
+           check_sound_buffers ();
+       }
+    }
 }
 
 static void sample16si_anti_handler (void)
@@ -788,13 +802,20 @@ static void sample16si_anti_handler (void)
     int datas[4], data1, data2;
 
     samplexx_anti_handler (datas);
-    data1 = datas[0] + datas[3];
-    data2 = datas[1] + datas[2];
-    FINISH_DATA (data1, 16, 1);
-    put_sound_word_left (data1);
-    FINISH_DATA (data2, 16, 1);
-    put_sound_word_right (data2);
-    check_sound_buffers ();
+    if (outputsample) {
+       data1 = datas[0] + datas[3];
+       data2 = datas[1] + datas[2];
+       FINISH_DATA (data1, 16, 1);
+       FINISH_DATA (data2, 16, 1);
+       put_sound_word_left (data1);
+       put_sound_word_right (data2);
+       check_sound_buffers ();
+       if (doublesample) {
+           put_sound_word_left (data1);
+           put_sound_word_right (data2);
+           check_sound_buffers ();
+       }
+    }
 }
 
 void sample16ss_sinc_handler (void)
@@ -802,13 +823,24 @@ void sample16ss_sinc_handler (void)
     int datas[4];
 
     samplexx_sinc_handler (datas);
-    put_sound_word_left (datas[0] << 2);
-    put_sound_word_right (datas[1] << 2);
-    if (currprefs.sound_stereo == SND_6CH)
-       make6ch (datas[0], datas[1], datas[2], datas[3]);
-    put_sound_word_left2 (datas[3] << 2);
-    put_sound_word_right2 (datas[2] << 2);
-    check_sound_buffers ();
+    if (outputsample) {
+       put_sound_word_left (datas[0] << 2);
+       put_sound_word_right (datas[1] << 2);
+       if (currprefs.sound_stereo == SND_6CH)
+           make6ch (datas[0], datas[1], datas[2], datas[3]);
+       put_sound_word_left2 (datas[3] << 2);
+       put_sound_word_right2 (datas[2] << 2);
+       check_sound_buffers ();
+       if (doublesample) {
+           put_sound_word_left (datas[0] << 2);
+           put_sound_word_right (datas[1] << 2);
+           if (currprefs.sound_stereo == SND_6CH)
+               make6ch (datas[0], datas[1], datas[2], datas[3]);
+           put_sound_word_left2 (datas[3] << 2);
+           put_sound_word_right2 (datas[2] << 2);
+           check_sound_buffers ();
+       }
+    }
 }
 
 static void sample16si_sinc_handler (void)
@@ -816,13 +848,20 @@ static void sample16si_sinc_handler (void)
     int datas[4], data1, data2;
 
     samplexx_sinc_handler (datas);
-    data1 = datas[0] + datas[3];
-    data2 = datas[1] + datas[2];
-    FINISH_DATA (data1, 16, 1);
-    put_sound_word_left (data1);
-    FINISH_DATA (data2, 16, 1);
-    put_sound_word_right (data2);
-    check_sound_buffers ();
+    if (outputsample) {
+       data1 = datas[0] + datas[3];
+       data2 = datas[1] + datas[2];
+       FINISH_DATA (data1, 16, 1);
+       FINISH_DATA (data2, 16, 1);
+       put_sound_word_left (data1);
+       put_sound_word_right (data2);
+       check_sound_buffers ();
+       if (doublesample) {
+           put_sound_word_left (data1);
+           put_sound_word_right (data2);
+           check_sound_buffers ();
+       }
+    }
 }
 
 void sample16s_handler (void)
@@ -842,20 +881,21 @@ void sample16s_handler (void)
     data3 &= audio_channel[3].adk_mask;
 
     data0 += data3;
-    {
-       uae_u32 data = SBASEVAL16(1) + data0;
-       FINISH_DATA (data, 16, 1);
-       put_sound_word_left (data);
-    }
-
     data1 += data2;
-    {
-       uae_u32 data = SBASEVAL16(1) + data1;
-       FINISH_DATA (data, 16, 1);
-       put_sound_word_right (data);
+    if (outputsample) {
+       data2 = SBASEVAL16(1) + data0;
+       FINISH_DATA (data2, 16, 1);
+       data3 = SBASEVAL16(1) + data1;
+       FINISH_DATA (data3, 16, 1);
+       put_sound_word_left (data2);
+       put_sound_word_right (data3);
+       check_sound_buffers ();
+       if (doublesample) {
+           put_sound_word_left (data2);
+           put_sound_word_right (data3);
+           check_sound_buffers ();
+       }
     }
-
-    check_sound_buffers ();
 }
 
 static void sample16si_crux_handler (void)
@@ -921,18 +961,20 @@ static void sample16si_crux_handler (void)
     }
     data1 += data2;
     data0 += data3;
-    {
-       uae_u32 data = SBASEVAL16(1) + data0;
-       FINISH_DATA (data, 16, 1);
-       put_sound_word_left (data);
-    }
-
-    {
-       uae_u32 data = SBASEVAL16(1) + data1;
-       FINISH_DATA (data, 16, 1);
-       put_sound_word_right (data);
+    if (outputsample) {
+       data2 = SBASEVAL16(1) + data0;
+       FINISH_DATA (data2, 16, 1);
+       data3 = SBASEVAL16(1) + data1;
+       FINISH_DATA (data3, 16, 1);
+       put_sound_word_left (data2);
+       put_sound_word_right (data3);
+       check_sound_buffers ();
+       if (doublesample) {
+           put_sound_word_left (data2);
+           put_sound_word_right (data3);
+           check_sound_buffers ();
+       }
     }
-    check_sound_buffers ();
 }
 
 static void sample16si_rh_handler (void)
@@ -979,18 +1021,20 @@ static void sample16si_rh_handler (void)
     delta = audio_channel[3].per;
     ratio = ((audio_channel[3].evtime % delta) << 8) / delta;
     data0 += (data3 * (256 - ratio) + data3p * ratio) >> 8;
-    {
-       uae_u32 data = SBASEVAL16(1) + data0;
-       FINISH_DATA (data, 16, 1);
-       put_sound_word_left (data);
-    }
-
-    {
-       uae_u32 data = SBASEVAL16(1) + data1;
-       FINISH_DATA (data, 16, 1);
-       put_sound_word_right (data);
+    if (outputsample) {
+       data2 = SBASEVAL16(1) + data0;
+       FINISH_DATA (data2, 16, 1);
+       data3 = SBASEVAL16(1) + data1;
+       FINISH_DATA (data3, 16, 1);
+       put_sound_word_left (data2);
+       put_sound_word_right (data3);
+       check_sound_buffers ();
+       if (doublesample) {
+           put_sound_word_left (data2);
+           put_sound_word_right (data3);
+           check_sound_buffers ();
+       }
     }
-    check_sound_buffers ();
 }
 
 #else
@@ -1029,6 +1073,10 @@ static void audio_event_reset (void)
     }
     schedule_audio ();
     events_schedule ();
+    samplecnt = 0;
+    extrasamples = 0;
+    outputsample = 1;
+    doublesample = 0;
 }
 
 static void audio_deactivate (void)
@@ -1257,9 +1305,6 @@ static void audio_handler (int nr)
            if (audav) {
                if (nr < 3) {
                    (cdp+1)->vol = cdp->dat;
-                   #ifndef MULTIPLICATION_PROFITABLE
-                   (cdp+1)->voltbl = sound_table[cdp->dat];
-                   #endif
                }
            }
        return;
@@ -1282,7 +1327,6 @@ void audio_reset (void)
            cdp = &audio_channel[i];
            memset (cdp, 0, sizeof *audio_channel);
            cdp->per = PERIOD_MAX - 1;
-           cdp->voltbl = sound_table[0];
            cdp->vol = 0;
            cdp->evtime = MAX_EV;
        }
@@ -1293,11 +1337,6 @@ void audio_reset (void)
        }
     }
 
-#ifndef        MULTIPLICATION_PROFITABLE
-    for (i = 0; i < 4; i++)
-       audio_channel[i].voltbl = sound_table[audio_channel[i].vol];
-#endif
-
     last_cycles = get_cycles ();
     next_sample_evtime = scaled_sample_evtime;
     schedule_audio ();
@@ -1497,60 +1536,75 @@ void update_audio (void)
 {
     unsigned long int n_cycles = 0;
 
-    if (!isaudio())
+    if (!isaudio ())
        goto end;
     if (savestate_state == STATE_RESTORE)
        goto end;
-    if (!is_audio_active())
+    if (!is_audio_active ())
        goto end;
 
     n_cycles = get_cycles () - last_cycles;
-    for (;;) {
+    while (n_cycles > 0) {
        unsigned long int best_evtime = n_cycles + 1;
+       unsigned long rounded;
+       int i;
+
+       for (i = 0; i < 4; i++) {
+           if (audio_channel[i].evtime != MAX_EV && best_evtime > audio_channel[i].evtime)
+               best_evtime = audio_channel[i].evtime;
+       }
 
-       if (audio_channel[0].evtime != MAX_EV && best_evtime > audio_channel[0].evtime)
-           best_evtime = audio_channel[0].evtime;
-       if (audio_channel[1].evtime != MAX_EV && best_evtime > audio_channel[1].evtime)
-           best_evtime = audio_channel[1].evtime;
-       if (audio_channel[2].evtime != MAX_EV && best_evtime > audio_channel[2].evtime)
-           best_evtime = audio_channel[2].evtime;
-       if (audio_channel[3].evtime != MAX_EV && best_evtime > audio_channel[3].evtime)
-           best_evtime = audio_channel[3].evtime;
+       /* next_sample_evtime >= 0 so floor() behaves as expected */
+       rounded = floorf (next_sample_evtime);
+       if ((next_sample_evtime - rounded) >= 0.5)
+           rounded++;
 
-       if (currprefs.produce_sound > 1 && best_evtime > next_sample_evtime)
-           best_evtime = next_sample_evtime;
+       if (currprefs.produce_sound > 1 && best_evtime > rounded)
+           best_evtime = rounded;
 
        if (best_evtime > n_cycles)
-           break;
+           best_evtime = n_cycles;
 
-       if (audio_channel[0].evtime != MAX_EV)
-           audio_channel[0].evtime -= best_evtime;
-       if (audio_channel[1].evtime != MAX_EV)
-           audio_channel[1].evtime -= best_evtime;
-       if (audio_channel[2].evtime != MAX_EV)
-           audio_channel[2].evtime -= best_evtime;
-       if (audio_channel[3].evtime != MAX_EV)
-           audio_channel[3].evtime -= best_evtime;
+       /* Decrease time-to-wait counters */
+       next_sample_evtime -= best_evtime;
 
-       n_cycles -= best_evtime;
        if (currprefs.produce_sound > 1) {
-           next_sample_evtime -= best_evtime;
            if (sample_prehandler)
-               sample_prehandler(best_evtime / CYCLE_UNIT);
-           if (next_sample_evtime == 0) {
-               next_sample_evtime = scaled_sample_evtime;
-               (*sample_handler) ();
+               sample_prehandler (best_evtime / CYCLE_UNIT);
+       }
+
+       for (i = 0; i < 4; i++) {
+           if (audio_channel[i].evtime != MAX_EV)
+               audio_channel[i].evtime -= best_evtime;
+       }
+
+       n_cycles -= best_evtime;
+
+       if (currprefs.produce_sound > 1) {
+           /* Test if new sample needs to be outputted */
+           if (rounded == best_evtime) {
+               /* Before the following addition, next_sample_evtime is in range [-0.5, 0.5) */
+               next_sample_evtime += scaled_sample_evtime;
+               if (extrasamples > 0) {
+                   outputsample = 1;
+                   doublesample = 1;
+                   extrasamples--;
+               } else if (extrasamples < 0) {
+                   outputsample = 0;
+                   doublesample = 0;
+                   extrasamples++;
+               } else {
+                   outputsample = 1;
+                   doublesample = 0;
+               }
+               (*sample_handler) ();
            }
        }
 
-       if (audio_channel[0].evtime == 0)
-           audio_handler (0);
-       if (audio_channel[1].evtime == 0)
-           audio_handler (1);
-       if (audio_channel[2].evtime == 0)
-           audio_handler (2);
-       if (audio_channel[3].evtime == 0)
-           audio_handler (3);
+       for (i = 0; i < 4; i++) {
+           if (audio_channel[i].evtime == 0)
+               audio_handler (i);
+       }
     }
 end:
     last_cycles = get_cycles () - n_cycles;
@@ -1741,9 +1795,6 @@ void AUDxVOL (int nr, uae_u16 v)
     audio_activate();
     update_audio ();
     audio_channel[nr].vol = v2;
-#ifndef        MULTIPLICATION_PROFITABLE
-    audio_channel[nr].voltbl = sound_table[v2];
-#endif
 #ifdef DEBUG_AUDIO
     if (debugchannel (nr))
        write_log (L"AUD%dVOL: %d %08X\n", nr, v2, M68K_GETPC);
@@ -1850,3 +1901,35 @@ uae_u8 *save_audio (int i, int *len, uae_u8 *dstptr)
     *len = dst - dstbak;
     return dstbak;
 }
+
+void audio_vsync (void)
+{
+    int i, max, min;
+    static int lastdir;
+
+    min = -5 * 10;
+    max = 5 * 10;
+    extrasamples = 0;
+    if (gui_data.sndbuf < min) {
+       // add extra sample
+       for (i = min; i >= gui_data.sndbuf; i -= 10)
+           extrasamples++;
+       lastdir = 1;
+    } else if (gui_data.sndbuf > max) {
+       // remove one sample
+       for (i = max; i <= gui_data.sndbuf; i += 10)
+           extrasamples--;
+       lastdir = -1;
+    } else if (gui_data.sndbuf > 1 * 50 && lastdir < 0) {
+       extrasamples--;
+    } else if (gui_data.sndbuf < -1 * 50 && lastdir > 0) {
+       extrasamples++;
+    } else {
+       lastdir = 0;
+    }
+
+    if (extrasamples > 10)
+       extrasamples = 10;
+    if (extrasamples < -10)
+       extrasamples = -10;
+}
index 6eb9eebe29ecf0d8263e5ae5f987be6442298411..aae925a2f2112361a1581d7ebd4a1645e6ec910b 100644 (file)
--- a/cfgfile.c
+++ b/cfgfile.c
@@ -165,6 +165,7 @@ static const TCHAR *abspointers[] = { L"none", L"mousehack", L"tablet", 0 };
 static const TCHAR *magiccursors[] = { L"both", L"native", L"host", 0 };
 static const TCHAR *autoscale[] = { L"none", L"scale", L"resize", 0 };
 static const TCHAR *joyportmodes[] = { NULL, L"mouse", L"djoy", L"ajoy", L"cdtvjoy", L"cd32joy", L"lightpen", 0 };
+static const TCHAR *epsonprinter[] = { L"none", L"ascii", L"epson_matrix" };
 
 static const TCHAR *obsolete[] = {
     L"accuracy", L"gfx_opengl", L"gfx_32bit_blits", L"32bit_blits",
@@ -594,7 +595,7 @@ void cfgfile_save_options (struct zfile *f, struct uae_prefs *p, int type)
 
     cfgfile_write_bool (f, L"synchronize_clock", p->tod_hack);
     cfgfile_write (f, L"maprom", L"0x%x", p->maprom);
-    cfgfile_write_bool (f, L"parallel_matrix_emulation", p->parallel_ascii_emulation);
+    cfgfile_dwrite_str (f, L"parallel_matrix_emulation", epsonprinter[p->parallel_matrix_emulation]);
     cfgfile_write_bool (f, L"parallel_postscript_emulation", p->parallel_postscript_emulation);
     cfgfile_write_bool (f, L"parallel_postscript_detection", p->parallel_postscript_detection);
     cfgfile_write_str (f, L"ghostscript_parameters", p->ghostscript_parameters);
@@ -1525,7 +1526,6 @@ static int cfgfile_parse_hardware (struct uae_prefs *p, TCHAR *option, TCHAR *va
        || cfgfile_yesno (option, value, L"cpu_compatible", &p->cpu_compatible)
        || cfgfile_yesno (option, value, L"cpu_24bit_addressing", &p->address_space_24)
        || cfgfile_yesno (option, value, L"parallel_on_demand", &p->parallel_demand)
-       || cfgfile_yesno (option, value, L"parallel_matrix_emulation", &p->parallel_ascii_emulation)
        || cfgfile_yesno (option, value, L"parallel_postscript_emulation", &p->parallel_postscript_emulation)
        || cfgfile_yesno (option, value, L"parallel_postscript_detection", &p->parallel_postscript_detection)
        || cfgfile_yesno (option, value, L"serial_on_demand", &p->serial_demand)
@@ -1583,6 +1583,7 @@ static int cfgfile_parse_hardware (struct uae_prefs *p, TCHAR *option, TCHAR *va
        || cfgfile_strval (option, value, L"comp_trustlong", &p->comptrustlong, compmode, 0)
        || cfgfile_strval (option, value, L"comp_trustnaddr", &p->comptrustnaddr, compmode, 0)
        || cfgfile_strval (option, value, L"collision_level", &p->collision_level, collmode, 0)
+       || cfgfile_strval (option, value, L"parallel_matrix_emulation", &p->parallel_matrix_emulation, epsonprinter, 0)
        || cfgfile_strval (option, value, L"comp_flushmode", &p->comp_hardflush, flushmode, 0))
        return 1;
 
@@ -2152,7 +2153,7 @@ static int cfgfile_load_2 (struct uae_prefs *p, const TCHAR *filename, int real,
     return 1;
 }
 
-int cfgfile_load (struct uae_prefs *p, const TCHAR *filename, int *type, int ignorelink)
+int cfgfile_load (struct uae_prefs *p, const TCHAR *filename, int *type, int ignorelink, int userconfig)
 {
     int v;
     TCHAR tmp[MAX_DPATH];
@@ -2168,18 +2169,20 @@ int cfgfile_load (struct uae_prefs *p, const TCHAR *filename, int *type, int ign
        write_log (L"load failed\n");
        goto end;
     }
+    if (userconfig)
+       target_addtorecent (filename, 0);
     if (!ignorelink) {
        if (p->config_hardware_path[0]) {
            fetch_configurationpath (tmp, sizeof (tmp) / sizeof (TCHAR));
            _tcsncat (tmp, p->config_hardware_path, sizeof (tmp) / sizeof (TCHAR));
            type2 = CONFIG_TYPE_HARDWARE;
-           cfgfile_load (p, tmp, &type2, 1);
+           cfgfile_load (p, tmp, &type2, 1, 0);
        }
        if (p->config_host_path[0]) {
            fetch_configurationpath (tmp, sizeof (tmp) / sizeof (TCHAR));
            _tcsncat (tmp, p->config_host_path, sizeof (tmp) / sizeof (TCHAR));
            type2 = CONFIG_TYPE_HOST;
-           cfgfile_load (p, tmp, &type2, 1);
+           cfgfile_load (p, tmp, &type2, 1, 0);
        }
     }
 end:
@@ -3087,7 +3090,7 @@ void default_prefs (struct uae_prefs *p, int type)
     p->serial_demand = 0;
     p->serial_hwctsrts = 1;
     p->parallel_demand = 0;
-    p->parallel_ascii_emulation = 0;
+    p->parallel_matrix_emulation = 0;
     p->parallel_postscript_emulation = 0;
     p->parallel_postscript_detection = 0;
     p->parallel_autoflush_time = 5;
index 187d03b567889f78ab3323bea2b71306566ee26e..b032a6c9dc908379fa0b2f79615c03705b87dd40 100644 (file)
--- a/custom.c
+++ b/custom.c
@@ -1770,7 +1770,7 @@ STATIC_INLINE void decide_line (int hpos)
     if (fetch_state != fetch_not_started)
        return;
 
-    if (dmaen (DMA_BITPLANE) && diwstate == DIW_waiting_stop) {
+    if (diwstate == DIW_waiting_stop) {
        int ok = 0;
        if (last_decide_line_hpos < plfstrt_start && hpos >= plfstrt_start) {
            if (plfstate == plf_idle)
@@ -1786,7 +1786,7 @@ STATIC_INLINE void decide_line (int hpos)
            if (hpos - 2 == ddfstrt_old_hpos && ddfstrt_old_vpos == vpos)
                ok = 0;
        }
-       if (ok) {
+       if (ok && dmaen (DMA_BITPLANE)) {
            start_bpl_dma (hpos, plfstrt);
            estimate_last_fetch_cycle (plfstrt);
            last_decide_line_hpos = hpos;
@@ -2302,7 +2302,7 @@ static void decide_sprites (int hpos)
        record_sprite (next_lineno, nr, posns[i], sprdata[nr], sprdatb[nr], sprctl[nr]);
        /* get left and right sprite edge if brdsprt enabled */
 #if AUTOSCALE_SPRITES
-       if ((bplcon0 & 1) && (bplcon3 & 0x02) && !(bplcon3 & 0x20)) {
+       if (dmaen (DMA_SPRITE) && (bplcon0 & 1) && (bplcon3 & 0x02) && !(bplcon3 & 0x20)) {
            int j, jj;
            for (j = 0, jj = 0; j < sprite_width; j+= 16, jj++) {
                int nx = fromspritexdiw (posns[i] + j);
@@ -2559,7 +2559,7 @@ void compute_vsynctime (void)
 #endif
     }
     if (currprefs.produce_sound > 1)
-       update_sound (fake_vblank_hz);
+       update_sound (fake_vblank_hz, (bplcon0 & 4) ? -1 : lof);
 }
 
 
@@ -3210,9 +3210,18 @@ static void BPLxPTL (int hpos, uae_u16 v, int num)
     decide_fetch (hpos);
     /* fix for "bitplane dma fetch at the same time while updating BPLxPTL" */
     /* fixes "3v Demo" by Cave and "New Year Demo" by Phoenix */
-    if (is_bitplane_dma (hpos) == num + 1 || is_bitplane_dma (hpos - 1) == num + 1 || is_bitplane_dma (hpos + 1) == num + 1) {
+    if (is_bitplane_dma (hpos) == num + 1 || is_bitplane_dma (hpos - 1) == num + 1) {
        delta = 2 << f_fetchmode;
     }
+
+    // hack until bitplane pipelin is properly emulated
+    if (fetchmode == 0 && fetch_state != fetch_not_started && diwstate == DIW_waiting_stop && f_fm_maxplane == 8) {
+        if (hpos > plfstrt && hpos <= plfstrt + 7) {
+           if (num == 1 && hpos <= plfstrt + 2)
+               delta = 2;
+       }
+    }
+
     f_bplpt[num] = bplpt[num] = (bplpt[num] & 0xffff0000) | ((v + delta) & 0x0000fffe);
     bplptx[num] = (bplptx[num] & 0xffff0000) | ((v + delta) & 0x0000fffe);
     //write_log (L"%d:%d:BPL%dPTL %08X COP=%08x\n", hpos, vpos, num, bplpt[num], cop_state.ip);
@@ -4705,6 +4714,7 @@ static void vsync_handler (void)
 #ifdef PICASSO96
     picasso_handle_vsync ();
 #endif
+    audio_vsync ();
 
     if (quit_program > 0) {
        /* prevent possible infinite loop at wait_cycles().. */
diff --git a/disk.c b/disk.c
index 47fcce47a5dfbc95b8ccb09d30fd8d4571f5e298..1d5b2863a44350eaa22b18ff270fbe5f5c406a2d 100644 (file)
--- a/disk.c
+++ b/disk.c
@@ -2235,6 +2235,7 @@ static void disk_insert_2 (int num, const TCHAR *name, int forced)
 
 void disk_insert (int num, const TCHAR *name)
 {
+    target_addtorecent (name, 0);
     disk_insert_2 (num, name, 0);
 }
 void disk_insert_force (int num, const TCHAR *name)
diff --git a/epsonprinter.c b/epsonprinter.c
new file mode 100644 (file)
index 0000000..c417656
--- /dev/null
@@ -0,0 +1,1953 @@
+/*
+ *  Copyright (C) 2002-2004  The DOSBox Team
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU Library General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ */
+
+/*
+ *  Converted to WinUAE by Toni Wilen 2009
+ */
+
+#include "sysconfig.h"
+#include "sysdeps.h"
+#include "uae.h"
+
+#define C_LIBPNG
+#define FREETYPE2_STATIC
+
+#include "epsonprinter.h"
+#include "win32.h"
+
+#include <math.h>
+
+#ifdef C_LIBPNG
+#include <png.h>
+#endif
+
+#define PARAM16(I) (params[I+1]*256+params[I])
+#define PIXX ((Bitu)floor(curX*dpi+0.5))
+#define PIXY ((Bitu)floor(curY*dpi+0.5))
+
+#define true 1
+#define false 0
+
+static Bit16u confdpi, confwidth, confheight;
+static TCHAR confoutputDevice[50];
+static int confmultipageOutput;
+static FT_Library FTlib;
+static FT_Face curFont;
+static Real64 curX, curY;
+static Bit16u dpi, ESCCmd;
+static int ESCSeen;
+static Bit8u numParam, neededParam;
+static Bit8u params[20];
+static Bit16u style;
+static Real64 cpi, actcpi;
+static Bit8u score;
+static Real64 topMargin, bottomMargin, rightMargin, leftMargin;
+static Real64 pageWidth, pageHeight, defaultPageWidth, defaultPageHeight;
+static Real64 lineSpacing, horiztabs[32];
+static Bit8u numHorizTabs;
+static Real64 verttabs[16];
+static Bit8u numVertTabs, curCharTable, printQuality;
+static enum Typeface LQtypeFace;
+static Real64 extraIntraSpace;
+static int charRead, autoFeed, printUpperContr;
+static struct bitGraphicParams {
+       Bit16u horizDens, vertDens;
+       int adjacent;
+       Bit8u bytesColumn;
+       Bit16u remBytes;
+       Bit8u column[6];
+       Bit8u readBytesColumn;
+} bitGraph;
+static Bit8u densk, densl, densy, densz;
+static Bit16u curMap[256], charTables[4];
+static Real64 definedUnit;
+static int multipoint;
+static Real64 multiPointSize, multicpi, hmi;
+static Bit8u msb;
+static Bit16u numPrintAsChar;
+static TCHAR *output;
+static void *outputHandle;
+static Bit16u multipageOutput, multiPageCounter;
+static HDC printerDC;
+
+static uae_u8 *page;
+static int page_w, page_h, page_pitch;
+static int pagesize;
+static HMODULE ft;
+
+// Various ASCII codepage to unicode maps
+
+static const Bit16u cp437Map[256] = {
+0x0000,0x0001,0x0002,0x0003,0x0004,0x0005,0x0006,0x0007,0x0008,0x0009,0x000a,0x000b,0x000c,0x000d,0x000e,0x000f,
+0x0010,0x0011,0x0012,0x0013,0x0014,0x0015,0x0016,0x0017,0x0018,0x0019,0x001a,0x001b,0x001c,0x001d,0x001e,0x001f,
+0x0020,0x0021,0x0022,0x0023,0x0024,0x0025,0x0026,0x0027,0x0028,0x0029,0x002a,0x002b,0x002c,0x002d,0x002e,0x002f,
+0x0030,0x0031,0x0032,0x0033,0x0034,0x0035,0x0036,0x0037,0x0038,0x0039,0x003a,0x003b,0x003c,0x003d,0x003e,0x003f,
+0x0040,0x0041,0x0042,0x0043,0x0044,0x0045,0x0046,0x0047,0x0048,0x0049,0x004a,0x004b,0x004c,0x004d,0x004e,0x004f,
+0x0050,0x0051,0x0052,0x0053,0x0054,0x0055,0x0056,0x0057,0x0058,0x0059,0x005a,0x005b,0x005c,0x005d,0x005e,0x005f,
+0x0060,0x0061,0x0062,0x0063,0x0064,0x0065,0x0066,0x0067,0x0068,0x0069,0x006a,0x006b,0x006c,0x006d,0x006e,0x006f,
+0x0070,0x0071,0x0072,0x0073,0x0074,0x0075,0x0076,0x0077,0x0078,0x0079,0x007a,0x007b,0x007c,0x007d,0x007e,0x007f,
+0x00c7,0x00fc,0x00e9,0x00e2,0x00e4,0x00e0,0x00e5,0x00e7,0x00ea,0x00eb,0x00e8,0x00ef,0x00ee,0x00ec,0x00c4,0x00c5,
+0x00c9,0x00e6,0x00c6,0x00f4,0x00f6,0x00f2,0x00fb,0x00f9,0x00ff,0x00d6,0x00dc,0x00a2,0x00a3,0x00a5,0x20a7,0x0192,
+0x00e1,0x00ed,0x00f3,0x00fa,0x00f1,0x00d1,0x00aa,0x00ba,0x00bf,0x2310,0x00ac,0x00bd,0x00bc,0x00a1,0x00ab,0x00bb,
+0x2591,0x2592,0x2593,0x2502,0x2524,0x2561,0x2562,0x2556,0x2555,0x2563,0x2551,0x2557,0x255d,0x255c,0x255b,0x2510,
+0x2514,0x2534,0x252c,0x251c,0x2500,0x253c,0x255e,0x255f,0x255a,0x2554,0x2569,0x2566,0x2560,0x2550,0x256c,0x2567,
+0x2568,0x2564,0x2565,0x2559,0x2558,0x2552,0x2553,0x256b,0x256a,0x2518,0x250c,0x2588,0x2584,0x258c,0x2590,0x2580,
+0x03b1,0x00df,0x0393,0x03c0,0x03a3,0x03c3,0x00b5,0x03c4,0x03a6,0x0398,0x03a9,0x03b4,0x221e,0x03c6,0x03b5,0x2229,
+0x2261,0x00b1,0x2265,0x2264,0x2320,0x2321,0x00f7,0x2248,0x00b0,0x2219,0x00b7,0x221a,0x207f,0x00b2,0x25a0,0x00a0
+};
+
+static const Bit16u cp737Map[256] = {
+0x0000,0x0001,0x0002,0x0003,0x0004,0x0005,0x0006,0x0007,0x0008,0x0009,0x000a,0x000b,0x000c,0x000d,0x000e,0x000f,
+0x0010,0x0011,0x0012,0x0013,0x0014,0x0015,0x0016,0x0017,0x0018,0x0019,0x001a,0x001b,0x001c,0x001d,0x001e,0x001f,
+0x0020,0x0021,0x0022,0x0023,0x0024,0x0025,0x0026,0x0027,0x0028,0x0029,0x002a,0x002b,0x002c,0x002d,0x002e,0x002f,
+0x0030,0x0031,0x0032,0x0033,0x0034,0x0035,0x0036,0x0037,0x0038,0x0039,0x003a,0x003b,0x003c,0x003d,0x003e,0x003f,
+0x0040,0x0041,0x0042,0x0043,0x0044,0x0045,0x0046,0x0047,0x0048,0x0049,0x004a,0x004b,0x004c,0x004d,0x004e,0x004f,
+0x0050,0x0051,0x0052,0x0053,0x0054,0x0055,0x0056,0x0057,0x0058,0x0059,0x005a,0x005b,0x005c,0x005d,0x005e,0x005f,
+0x0060,0x0061,0x0062,0x0063,0x0064,0x0065,0x0066,0x0067,0x0068,0x0069,0x006a,0x006b,0x006c,0x006d,0x006e,0x006f,
+0x0070,0x0071,0x0072,0x0073,0x0074,0x0075,0x0076,0x0077,0x0078,0x0079,0x007a,0x007b,0x007c,0x007d,0x007e,0x007f,
+0x0391,0x0392,0x0393,0x0394,0x0395,0x0396,0x0397,0x0398,0x0399,0x039a,0x039b,0x039c,0x039d,0x039e,0x039f,0x03a0,
+0x03a1,0x03a3,0x03a4,0x03a5,0x03a6,0x03a7,0x03a8,0x03a9,0x03b1,0x03b2,0x03b3,0x03b4,0x03b5,0x03b6,0x03b7,0x03b8,
+0x03b9,0x03ba,0x03bb,0x03bc,0x03bd,0x03be,0x03bf,0x03c0,0x03c1,0x03c3,0x03c2,0x03c4,0x03c5,0x03c6,0x03c7,0x03c8,
+0x2591,0x2592,0x2593,0x2502,0x2524,0x2561,0x2562,0x2556,0x2555,0x2563,0x2551,0x2557,0x255d,0x255c,0x255b,0x2510,
+0x2514,0x2534,0x252c,0x251c,0x2500,0x253c,0x255e,0x255f,0x255a,0x2554,0x2569,0x2566,0x2560,0x2550,0x256c,0x2567,
+0x2568,0x2564,0x2565,0x2559,0x2558,0x2552,0x2553,0x256b,0x256a,0x2518,0x250c,0x2588,0x2584,0x258c,0x2590,0x2580,
+0x03c9,0x03ac,0x03ad,0x03ae,0x03ca,0x03af,0x03cc,0x03cd,0x03cb,0x03ce,0x0386,0x0388,0x0389,0x038a,0x038c,0x038e,
+0x038f,0x00b1,0x2265,0x2264,0x03aa,0x03ab,0x00f7,0x2248,0x00b0,0x2219,0x00b7,0x221a,0x207f,0x00b2,0x25a0,0x00a0
+};
+
+static const Bit16u cp775Map[256] = {
+0x0000,0x0001,0x0002,0x0003,0x0004,0x0005,0x0006,0x0007,0x0008,0x0009,0x000a,0x000b,0x000c,0x000d,0x000e,0x000f,
+0x0010,0x0011,0x0012,0x0013,0x0014,0x0015,0x0016,0x0017,0x0018,0x0019,0x001a,0x001b,0x001c,0x001d,0x001e,0x001f,
+0x0020,0x0021,0x0022,0x0023,0x0024,0x0025,0x0026,0x0027,0x0028,0x0029,0x002a,0x002b,0x002c,0x002d,0x002e,0x002f,
+0x0030,0x0031,0x0032,0x0033,0x0034,0x0035,0x0036,0x0037,0x0038,0x0039,0x003a,0x003b,0x003c,0x003d,0x003e,0x003f,
+0x0040,0x0041,0x0042,0x0043,0x0044,0x0045,0x0046,0x0047,0x0048,0x0049,0x004a,0x004b,0x004c,0x004d,0x004e,0x004f,
+0x0050,0x0051,0x0052,0x0053,0x0054,0x0055,0x0056,0x0057,0x0058,0x0059,0x005a,0x005b,0x005c,0x005d,0x005e,0x005f,
+0x0060,0x0061,0x0062,0x0063,0x0064,0x0065,0x0066,0x0067,0x0068,0x0069,0x006a,0x006b,0x006c,0x006d,0x006e,0x006f,
+0x0070,0x0071,0x0072,0x0073,0x0074,0x0075,0x0076,0x0077,0x0078,0x0079,0x007a,0x007b,0x007c,0x007d,0x007e,0x007f,
+0x0106,0x00fc,0x00e9,0x0101,0x00e4,0x0123,0x00e5,0x0107,0x0142,0x0113,0x0156,0x0157,0x012b,0x0179,0x00c4,0x00c5,
+0x00c9,0x00e6,0x00c6,0x014d,0x00f6,0x0122,0x00a2,0x015a,0x015b,0x00d6,0x00dc,0x00f8,0x00a3,0x00d8,0x00d7,0x00a4,
+0x0100,0x012a,0x00f3,0x017b,0x017c,0x017a,0x201d,0x00a6,0x00a9,0x00ae,0x00ac,0x00bd,0x00bc,0x0141,0x00ab,0x00bb,
+0x2591,0x2592,0x2593,0x2502,0x2524,0x0104,0x010c,0x0118,0x0116,0x2563,0x2551,0x2557,0x255d,0x012e,0x0160,0x2510,
+0x2514,0x2534,0x252c,0x251c,0x2500,0x253c,0x0172,0x016a,0x255a,0x2554,0x2569,0x2566,0x2560,0x2550,0x256c,0x017d,
+0x0105,0x010d,0x0119,0x0117,0x012f,0x0161,0x0173,0x016b,0x017e,0x2518,0x250c,0x2588,0x2584,0x258c,0x2590,0x2580,
+0x00d3,0x00df,0x014c,0x0143,0x00f5,0x00d5,0x00b5,0x0144,0x0136,0x0137,0x013b,0x013c,0x0146,0x0112,0x0145,0x2019,
+0x00ad,0x00b1,0x201c,0x00be,0x00b6,0x00a7,0x00f7,0x201e,0x00b0,0x2219,0x00b7,0x00b9,0x00b3,0x00b2,0x25a0,0x00a0
+};
+
+static const Bit16u cp850Map[256] = {
+0x0000,0x0001,0x0002,0x0003,0x0004,0x0005,0x0006,0x0007,0x0008,0x0009,0x000a,0x000b,0x000c,0x000d,0x000e,0x000f,
+0x0010,0x0011,0x0012,0x0013,0x0014,0x0015,0x0016,0x0017,0x0018,0x0019,0x001a,0x001b,0x001c,0x001d,0x001e,0x001f,
+0x0020,0x0021,0x0022,0x0023,0x0024,0x0025,0x0026,0x0027,0x0028,0x0029,0x002a,0x002b,0x002c,0x002d,0x002e,0x002f,
+0x0030,0x0031,0x0032,0x0033,0x0034,0x0035,0x0036,0x0037,0x0038,0x0039,0x003a,0x003b,0x003c,0x003d,0x003e,0x003f,
+0x0040,0x0041,0x0042,0x0043,0x0044,0x0045,0x0046,0x0047,0x0048,0x0049,0x004a,0x004b,0x004c,0x004d,0x004e,0x004f,
+0x0050,0x0051,0x0052,0x0053,0x0054,0x0055,0x0056,0x0057,0x0058,0x0059,0x005a,0x005b,0x005c,0x005d,0x005e,0x005f,
+0x0060,0x0061,0x0062,0x0063,0x0064,0x0065,0x0066,0x0067,0x0068,0x0069,0x006a,0x006b,0x006c,0x006d,0x006e,0x006f,
+0x0070,0x0071,0x0072,0x0073,0x0074,0x0075,0x0076,0x0077,0x0078,0x0079,0x007a,0x007b,0x007c,0x007d,0x007e,0x007f,
+0x00c7,0x00fc,0x00e9,0x00e2,0x00e4,0x00e0,0x00e5,0x00e7,0x00ea,0x00eb,0x00e8,0x00ef,0x00ee,0x00ec,0x00c4,0x00c5,
+0x00c9,0x00e6,0x00c6,0x00f4,0x00f6,0x00f2,0x00fb,0x00f9,0x00ff,0x00d6,0x00dc,0x00f8,0x00a3,0x00d8,0x00d7,0x0192,
+0x00e1,0x00ed,0x00f3,0x00fa,0x00f1,0x00d1,0x00aa,0x00ba,0x00bf,0x00ae,0x00ac,0x00bd,0x00bc,0x00a1,0x00ab,0x00bb,
+0x2591,0x2592,0x2593,0x2502,0x2524,0x00c1,0x00c2,0x00c0,0x00a9,0x2563,0x2551,0x2557,0x255d,0x00a2,0x00a5,0x2510,
+0x2514,0x2534,0x252c,0x251c,0x2500,0x253c,0x00e3,0x00c3,0x255a,0x2554,0x2569,0x2566,0x2560,0x2550,0x256c,0x00a4,
+0x00f0,0x00d0,0x00ca,0x00cb,0x00c8,0x0131,0x00cd,0x00ce,0x00cf,0x2518,0x250c,0x2588,0x2584,0x00a6,0x00cc,0x2580,
+0x00d3,0x00df,0x00d4,0x00d2,0x00f5,0x00d5,0x00b5,0x00fe,0x00de,0x00da,0x00db,0x00d9,0x00fd,0x00dd,0x00af,0x00b4,
+0x00ad,0x00b1,0x2017,0x00be,0x00b6,0x00a7,0x00f7,0x00b8,0x00b0,0x00a8,0x00b7,0x00b9,0x00b3,0x00b2,0x25a0,0x00a0
+};
+
+static const Bit16u cp852Map[256] = {
+0x0000,0x0001,0x0002,0x0003,0x0004,0x0005,0x0006,0x0007,0x0008,0x0009,0x000a,0x000b,0x000c,0x000d,0x000e,0x000f,
+0x0010,0x0011,0x0012,0x0013,0x0014,0x0015,0x0016,0x0017,0x0018,0x0019,0x001a,0x001b,0x001c,0x001d,0x001e,0x001f,
+0x0020,0x0021,0x0022,0x0023,0x0024,0x0025,0x0026,0x0027,0x0028,0x0029,0x002a,0x002b,0x002c,0x002d,0x002e,0x002f,
+0x0030,0x0031,0x0032,0x0033,0x0034,0x0035,0x0036,0x0037,0x0038,0x0039,0x003a,0x003b,0x003c,0x003d,0x003e,0x003f,
+0x0040,0x0041,0x0042,0x0043,0x0044,0x0045,0x0046,0x0047,0x0048,0x0049,0x004a,0x004b,0x004c,0x004d,0x004e,0x004f,
+0x0050,0x0051,0x0052,0x0053,0x0054,0x0055,0x0056,0x0057,0x0058,0x0059,0x005a,0x005b,0x005c,0x005d,0x005e,0x005f,
+0x0060,0x0061,0x0062,0x0063,0x0064,0x0065,0x0066,0x0067,0x0068,0x0069,0x006a,0x006b,0x006c,0x006d,0x006e,0x006f,
+0x0070,0x0071,0x0072,0x0073,0x0074,0x0075,0x0076,0x0077,0x0078,0x0079,0x007a,0x007b,0x007c,0x007d,0x007e,0x007f,
+0x00c7,0x00fc,0x00e9,0x00e2,0x00e4,0x016f,0x0107,0x00e7,0x0142,0x00eb,0x0150,0x0151,0x00ee,0x0179,0x00c4,0x0106,
+0x00c9,0x0139,0x013a,0x00f4,0x00f6,0x013d,0x013e,0x015a,0x015b,0x00d6,0x00dc,0x0164,0x0165,0x0141,0x00d7,0x010d,
+0x00e1,0x00ed,0x00f3,0x00fa,0x0104,0x0105,0x017d,0x017e,0x0118,0x0119,0x00ac,0x017a,0x010c,0x015f,0x00ab,0x00bb,
+0x2591,0x2592,0x2593,0x2502,0x2524,0x00c1,0x00c2,0x011a,0x015e,0x2563,0x2551,0x2557,0x255d,0x017b,0x017c,0x2510,
+0x2514,0x2534,0x252c,0x251c,0x2500,0x253c,0x0102,0x0103,0x255a,0x2554,0x2569,0x2566,0x2560,0x2550,0x256c,0x00a4,
+0x0111,0x0110,0x010e,0x00cb,0x010f,0x0147,0x00cd,0x00ce,0x011b,0x2518,0x250c,0x2588,0x2584,0x0162,0x016e,0x2580,
+0x00d3,0x00df,0x00d4,0x0143,0x0144,0x0148,0x0160,0x0161,0x0154,0x00da,0x0155,0x0170,0x00fd,0x00dd,0x0163,0x00b4,
+0x00ad,0x02dd,0x02db,0x02c7,0x02d8,0x00a7,0x00f7,0x00b8,0x00b0,0x00a8,0x02d9,0x0171,0x0158,0x0159,0x25a0,0x00a0
+};
+
+static const Bit16u cp855Map[256] = {
+0x0000,0x0001,0x0002,0x0003,0x0004,0x0005,0x0006,0x0007,0x0008,0x0009,0x000a,0x000b,0x000c,0x000d,0x000e,0x000f,
+0x0010,0x0011,0x0012,0x0013,0x0014,0x0015,0x0016,0x0017,0x0018,0x0019,0x001a,0x001b,0x001c,0x001d,0x001e,0x001f,
+0x0020,0x0021,0x0022,0x0023,0x0024,0x0025,0x0026,0x0027,0x0028,0x0029,0x002a,0x002b,0x002c,0x002d,0x002e,0x002f,
+0x0030,0x0031,0x0032,0x0033,0x0034,0x0035,0x0036,0x0037,0x0038,0x0039,0x003a,0x003b,0x003c,0x003d,0x003e,0x003f,
+0x0040,0x0041,0x0042,0x0043,0x0044,0x0045,0x0046,0x0047,0x0048,0x0049,0x004a,0x004b,0x004c,0x004d,0x004e,0x004f,
+0x0050,0x0051,0x0052,0x0053,0x0054,0x0055,0x0056,0x0057,0x0058,0x0059,0x005a,0x005b,0x005c,0x005d,0x005e,0x005f,
+0x0060,0x0061,0x0062,0x0063,0x0064,0x0065,0x0066,0x0067,0x0068,0x0069,0x006a,0x006b,0x006c,0x006d,0x006e,0x006f,
+0x0070,0x0071,0x0072,0x0073,0x0074,0x0075,0x0076,0x0077,0x0078,0x0079,0x007a,0x007b,0x007c,0x007d,0x007e,0x007f,
+0x0452,0x0402,0x0453,0x0403,0x0451,0x0401,0x0454,0x0404,0x0455,0x0405,0x0456,0x0406,0x0457,0x0407,0x0458,0x0408,
+0x0459,0x0409,0x045a,0x040a,0x045b,0x040b,0x045c,0x040c,0x045e,0x040e,0x045f,0x040f,0x044e,0x042e,0x044a,0x042a,
+0x0430,0x0410,0x0431,0x0411,0x0446,0x0426,0x0434,0x0414,0x0435,0x0415,0x0444,0x0424,0x0433,0x0413,0x00ab,0x00bb,
+0x2591,0x2592,0x2593,0x2502,0x2524,0x0445,0x0425,0x0438,0x0418,0x2563,0x2551,0x2557,0x255d,0x0439,0x0419,0x2510,
+0x2514,0x2534,0x252c,0x251c,0x2500,0x253c,0x043a,0x041a,0x255a,0x2554,0x2569,0x2566,0x2560,0x2550,0x256c,0x00a4,
+0x043b,0x041b,0x043c,0x041c,0x043d,0x041d,0x043e,0x041e,0x043f,0x2518,0x250c,0x2588,0x2584,0x041f,0x044f,0x2580,
+0x042f,0x0440,0x0420,0x0441,0x0421,0x0442,0x0422,0x0443,0x0423,0x0436,0x0416,0x0432,0x0412,0x044c,0x042c,0x2116,
+0x00ad,0x044b,0x042b,0x0437,0x0417,0x0448,0x0428,0x044d,0x042d,0x0449,0x0429,0x0447,0x0427,0x00a7,0x25a0,0x00a0
+};
+
+static const Bit16u cp857Map[256] = {
+0x0000,0x0001,0x0002,0x0003,0x0004,0x0005,0x0006,0x0007,0x0008,0x0009,0x000a,0x000b,0x000c,0x000d,0x000e,0x000f,
+0x0010,0x0011,0x0012,0x0013,0x0014,0x0015,0x0016,0x0017,0x0018,0x0019,0x001a,0x001b,0x001c,0x001d,0x001e,0x001f,
+0x0020,0x0021,0x0022,0x0023,0x0024,0x0025,0x0026,0x0027,0x0028,0x0029,0x002a,0x002b,0x002c,0x002d,0x002e,0x002f,
+0x0030,0x0031,0x0032,0x0033,0x0034,0x0035,0x0036,0x0037,0x0038,0x0039,0x003a,0x003b,0x003c,0x003d,0x003e,0x003f,
+0x0040,0x0041,0x0042,0x0043,0x0044,0x0045,0x0046,0x0047,0x0048,0x0049,0x004a,0x004b,0x004c,0x004d,0x004e,0x004f,
+0x0050,0x0051,0x0052,0x0053,0x0054,0x0055,0x0056,0x0057,0x0058,0x0059,0x005a,0x005b,0x005c,0x005d,0x005e,0x005f,
+0x0060,0x0061,0x0062,0x0063,0x0064,0x0065,0x0066,0x0067,0x0068,0x0069,0x006a,0x006b,0x006c,0x006d,0x006e,0x006f,
+0x0070,0x0071,0x0072,0x0073,0x0074,0x0075,0x0076,0x0077,0x0078,0x0079,0x007a,0x007b,0x007c,0x007d,0x007e,0x007f,
+0x00c7,0x00fc,0x00e9,0x00e2,0x00e4,0x00e0,0x00e5,0x00e7,0x00ea,0x00eb,0x00e8,0x00ef,0x00ee,0x0131,0x00c4,0x00c5,
+0x00c9,0x00e6,0x00c6,0x00f4,0x00f6,0x00f2,0x00fb,0x00f9,0x0130,0x00d6,0x00dc,0x00f8,0x00a3,0x00d8,0x015e,0x015f,
+0x00e1,0x00ed,0x00f3,0x00fa,0x00f1,0x00d1,0x011e,0x011f,0x00bf,0x00ae,0x00ac,0x00bd,0x00bc,0x00a1,0x00ab,0x00bb,
+0x2591,0x2592,0x2593,0x2502,0x2524,0x00c1,0x00c2,0x00c0,0x00a9,0x2563,0x2551,0x2557,0x255d,0x00a2,0x00a5,0x2510,
+0x2514,0x2534,0x252c,0x251c,0x2500,0x253c,0x00e3,0x00c3,0x255a,0x2554,0x2569,0x2566,0x2560,0x2550,0x256c,0x00a4,
+0x00ba,0x00aa,0x00ca,0x00cb,0x00c8,0x0000,0x00cd,0x00ce,0x00cf,0x2518,0x250c,0x2588,0x2584,0x00a6,0x00cc,0x2580,
+0x00d3,0x00df,0x00d4,0x00d2,0x00f5,0x00d5,0x00b5,0x0000,0x00d7,0x00da,0x00db,0x00d9,0x00ec,0x00ff,0x00af,0x00b4,
+0x00ad,0x00b1,0x0000,0x00be,0x00b6,0x00a7,0x00f7,0x00b8,0x00b0,0x00a8,0x00b7,0x00b9,0x00b3,0x00b2,0x25a0,0x00a0
+};
+
+static const Bit16u cp860Map[256] = {
+0x0000,0x0001,0x0002,0x0003,0x0004,0x0005,0x0006,0x0007,0x0008,0x0009,0x000a,0x000b,0x000c,0x000d,0x000e,0x000f,
+0x0010,0x0011,0x0012,0x0013,0x0014,0x0015,0x0016,0x0017,0x0018,0x0019,0x001a,0x001b,0x001c,0x001d,0x001e,0x001f,
+0x0020,0x0021,0x0022,0x0023,0x0024,0x0025,0x0026,0x0027,0x0028,0x0029,0x002a,0x002b,0x002c,0x002d,0x002e,0x002f,
+0x0030,0x0031,0x0032,0x0033,0x0034,0x0035,0x0036,0x0037,0x0038,0x0039,0x003a,0x003b,0x003c,0x003d,0x003e,0x003f,
+0x0040,0x0041,0x0042,0x0043,0x0044,0x0045,0x0046,0x0047,0x0048,0x0049,0x004a,0x004b,0x004c,0x004d,0x004e,0x004f,
+0x0050,0x0051,0x0052,0x0053,0x0054,0x0055,0x0056,0x0057,0x0058,0x0059,0x005a,0x005b,0x005c,0x005d,0x005e,0x005f,
+0x0060,0x0061,0x0062,0x0063,0x0064,0x0065,0x0066,0x0067,0x0068,0x0069,0x006a,0x006b,0x006c,0x006d,0x006e,0x006f,
+0x0070,0x0071,0x0072,0x0073,0x0074,0x0075,0x0076,0x0077,0x0078,0x0079,0x007a,0x007b,0x007c,0x007d,0x007e,0x007f,
+0x00c7,0x00fc,0x00e9,0x00e2,0x00e3,0x00e0,0x00c1,0x00e7,0x00ea,0x00ca,0x00e8,0x00cd,0x00d4,0x00ec,0x00c3,0x00c2,
+0x00c9,0x00c0,0x00c8,0x00f4,0x00f5,0x00f2,0x00da,0x00f9,0x00cc,0x00d5,0x00dc,0x00a2,0x00a3,0x00d9,0x20a7,0x00d3,
+0x00e1,0x00ed,0x00f3,0x00fa,0x00f1,0x00d1,0x00aa,0x00ba,0x00bf,0x00d2,0x00ac,0x00bd,0x00bc,0x00a1,0x00ab,0x00bb,
+0x2591,0x2592,0x2593,0x2502,0x2524,0x2561,0x2562,0x2556,0x2555,0x2563,0x2551,0x2557,0x255d,0x255c,0x255b,0x2510,
+0x2514,0x2534,0x252c,0x251c,0x2500,0x253c,0x255e,0x255f,0x255a,0x2554,0x2569,0x2566,0x2560,0x2550,0x256c,0x2567,
+0x2568,0x2564,0x2565,0x2559,0x2558,0x2552,0x2553,0x256b,0x256a,0x2518,0x250c,0x2588,0x2584,0x258c,0x2590,0x2580,
+0x03b1,0x00df,0x0393,0x03c0,0x03a3,0x03c3,0x00b5,0x03c4,0x03a6,0x0398,0x03a9,0x03b4,0x221e,0x03c6,0x03b5,0x2229,
+0x2261,0x00b1,0x2265,0x2264,0x2320,0x2321,0x00f7,0x2248,0x00b0,0x2219,0x00b7,0x221a,0x207f,0x00b2,0x25a0,0x00a0
+};
+
+static const Bit16u cp861Map[256] = {
+0x0000,0x0001,0x0002,0x0003,0x0004,0x0005,0x0006,0x0007,0x0008,0x0009,0x000a,0x000b,0x000c,0x000d,0x000e,0x000f,
+0x0010,0x0011,0x0012,0x0013,0x0014,0x0015,0x0016,0x0017,0x0018,0x0019,0x001a,0x001b,0x001c,0x001d,0x001e,0x001f,
+0x0020,0x0021,0x0022,0x0023,0x0024,0x0025,0x0026,0x0027,0x0028,0x0029,0x002a,0x002b,0x002c,0x002d,0x002e,0x002f,
+0x0030,0x0031,0x0032,0x0033,0x0034,0x0035,0x0036,0x0037,0x0038,0x0039,0x003a,0x003b,0x003c,0x003d,0x003e,0x003f,
+0x0040,0x0041,0x0042,0x0043,0x0044,0x0045,0x0046,0x0047,0x0048,0x0049,0x004a,0x004b,0x004c,0x004d,0x004e,0x004f,
+0x0050,0x0051,0x0052,0x0053,0x0054,0x0055,0x0056,0x0057,0x0058,0x0059,0x005a,0x005b,0x005c,0x005d,0x005e,0x005f,
+0x0060,0x0061,0x0062,0x0063,0x0064,0x0065,0x0066,0x0067,0x0068,0x0069,0x006a,0x006b,0x006c,0x006d,0x006e,0x006f,
+0x0070,0x0071,0x0072,0x0073,0x0074,0x0075,0x0076,0x0077,0x0078,0x0079,0x007a,0x007b,0x007c,0x007d,0x007e,0x007f,
+0x00c7,0x00fc,0x00e9,0x00e2,0x00e4,0x00e0,0x00e5,0x00e7,0x00ea,0x00eb,0x00e8,0x00d0,0x00f0,0x00de,0x00c4,0x00c5,
+0x00c9,0x00e6,0x00c6,0x00f4,0x00f6,0x00fe,0x00fb,0x00dd,0x00fd,0x00d6,0x00dc,0x00f8,0x00a3,0x00d8,0x20a7,0x0192,
+0x00e1,0x00ed,0x00f3,0x00fa,0x00c1,0x00cd,0x00d3,0x00da,0x00bf,0x2310,0x00ac,0x00bd,0x00bc,0x00a1,0x00ab,0x00bb,
+0x2591,0x2592,0x2593,0x2502,0x2524,0x2561,0x2562,0x2556,0x2555,0x2563,0x2551,0x2557,0x255d,0x255c,0x255b,0x2510,
+0x2514,0x2534,0x252c,0x251c,0x2500,0x253c,0x255e,0x255f,0x255a,0x2554,0x2569,0x2566,0x2560,0x2550,0x256c,0x2567,
+0x2568,0x2564,0x2565,0x2559,0x2558,0x2552,0x2553,0x256b,0x256a,0x2518,0x250c,0x2588,0x2584,0x258c,0x2590,0x2580,
+0x03b1,0x00df,0x0393,0x03c0,0x03a3,0x03c3,0x00b5,0x03c4,0x03a6,0x0398,0x03a9,0x03b4,0x221e,0x03c6,0x03b5,0x2229,
+0x2261,0x00b1,0x2265,0x2264,0x2320,0x2321,0x00f7,0x2248,0x00b0,0x2219,0x00b7,0x221a,0x207f,0x00b2,0x25a0,0x00a0
+};
+
+static const Bit16u cp862Map[256] = {
+0x0000,0x0001,0x0002,0x0003,0x0004,0x0005,0x0006,0x0007,0x0008,0x0009,0x000a,0x000b,0x000c,0x000d,0x000e,0x000f,
+0x0010,0x0011,0x0012,0x0013,0x0014,0x0015,0x0016,0x0017,0x0018,0x0019,0x001a,0x001b,0x001c,0x001d,0x001e,0x001f,
+0x0020,0x0021,0x0022,0x0023,0x0024,0x0025,0x0026,0x0027,0x0028,0x0029,0x002a,0x002b,0x002c,0x002d,0x002e,0x002f,
+0x0030,0x0031,0x0032,0x0033,0x0034,0x0035,0x0036,0x0037,0x0038,0x0039,0x003a,0x003b,0x003c,0x003d,0x003e,0x003f,
+0x0040,0x0041,0x0042,0x0043,0x0044,0x0045,0x0046,0x0047,0x0048,0x0049,0x004a,0x004b,0x004c,0x004d,0x004e,0x004f,
+0x0050,0x0051,0x0052,0x0053,0x0054,0x0055,0x0056,0x0057,0x0058,0x0059,0x005a,0x005b,0x005c,0x005d,0x005e,0x005f,
+0x0060,0x0061,0x0062,0x0063,0x0064,0x0065,0x0066,0x0067,0x0068,0x0069,0x006a,0x006b,0x006c,0x006d,0x006e,0x006f,
+0x0070,0x0071,0x0072,0x0073,0x0074,0x0075,0x0076,0x0077,0x0078,0x0079,0x007a,0x007b,0x007c,0x007d,0x007e,0x007f,
+0x05d0,0x05d1,0x05d2,0x05d3,0x05d4,0x05d5,0x05d6,0x05d7,0x05d8,0x05d9,0x05da,0x05db,0x05dc,0x05dd,0x05de,0x05df,
+0x05e0,0x05e1,0x05e2,0x05e3,0x05e4,0x05e5,0x05e6,0x05e7,0x05e8,0x05e9,0x05ea,0x00a2,0x00a3,0x00a5,0x20a7,0x0192,
+0x00e1,0x00ed,0x00f3,0x00fa,0x00f1,0x00d1,0x00aa,0x00ba,0x00bf,0x2310,0x00ac,0x00bd,0x00bc,0x00a1,0x00ab,0x00bb,
+0x2591,0x2592,0x2593,0x2502,0x2524,0x2561,0x2562,0x2556,0x2555,0x2563,0x2551,0x2557,0x255d,0x255c,0x255b,0x2510,
+0x2514,0x2534,0x252c,0x251c,0x2500,0x253c,0x255e,0x255f,0x255a,0x2554,0x2569,0x2566,0x2560,0x2550,0x256c,0x2567,
+0x2568,0x2564,0x2565,0x2559,0x2558,0x2552,0x2553,0x256b,0x256a,0x2518,0x250c,0x2588,0x2584,0x258c,0x2590,0x2580,
+0x03b1,0x00df,0x0393,0x03c0,0x03a3,0x03c3,0x00b5,0x03c4,0x03a6,0x0398,0x03a9,0x03b4,0x221e,0x03c6,0x03b5,0x2229,
+0x2261,0x00b1,0x2265,0x2264,0x2320,0x2321,0x00f7,0x2248,0x00b0,0x2219,0x00b7,0x221a,0x207f,0x00b2,0x25a0,0x00a0
+};
+
+static const Bit16u cp863Map[256] = {
+0x0000,0x0001,0x0002,0x0003,0x0004,0x0005,0x0006,0x0007,0x0008,0x0009,0x000a,0x000b,0x000c,0x000d,0x000e,0x000f,
+0x0010,0x0011,0x0012,0x0013,0x0014,0x0015,0x0016,0x0017,0x0018,0x0019,0x001a,0x001b,0x001c,0x001d,0x001e,0x001f,
+0x0020,0x0021,0x0022,0x0023,0x0024,0x0025,0x0026,0x0027,0x0028,0x0029,0x002a,0x002b,0x002c,0x002d,0x002e,0x002f,
+0x0030,0x0031,0x0032,0x0033,0x0034,0x0035,0x0036,0x0037,0x0038,0x0039,0x003a,0x003b,0x003c,0x003d,0x003e,0x003f,
+0x0040,0x0041,0x0042,0x0043,0x0044,0x0045,0x0046,0x0047,0x0048,0x0049,0x004a,0x004b,0x004c,0x004d,0x004e,0x004f,
+0x0050,0x0051,0x0052,0x0053,0x0054,0x0055,0x0056,0x0057,0x0058,0x0059,0x005a,0x005b,0x005c,0x005d,0x005e,0x005f,
+0x0060,0x0061,0x0062,0x0063,0x0064,0x0065,0x0066,0x0067,0x0068,0x0069,0x006a,0x006b,0x006c,0x006d,0x006e,0x006f,
+0x0070,0x0071,0x0072,0x0073,0x0074,0x0075,0x0076,0x0077,0x0078,0x0079,0x007a,0x007b,0x007c,0x007d,0x007e,0x007f,
+0x00c7,0x00fc,0x00e9,0x00e2,0x00c2,0x00e0,0x00b6,0x00e7,0x00ea,0x00eb,0x00e8,0x00ef,0x00ee,0x2017,0x00c0,0x00a7,
+0x00c9,0x00c8,0x00ca,0x00f4,0x00cb,0x00cf,0x00fb,0x00f9,0x00a4,0x00d4,0x00dc,0x00a2,0x00a3,0x00d9,0x00db,0x0192,
+0x00a6,0x00b4,0x00f3,0x00fa,0x00a8,0x00b8,0x00b3,0x00af,0x00ce,0x2310,0x00ac,0x00bd,0x00bc,0x00be,0x00ab,0x00bb,
+0x2591,0x2592,0x2593,0x2502,0x2524,0x2561,0x2562,0x2556,0x2555,0x2563,0x2551,0x2557,0x255d,0x255c,0x255b,0x2510,
+0x2514,0x2534,0x252c,0x251c,0x2500,0x253c,0x255e,0x255f,0x255a,0x2554,0x2569,0x2566,0x2560,0x2550,0x256c,0x2567,
+0x2568,0x2564,0x2565,0x2559,0x2558,0x2552,0x2553,0x256b,0x256a,0x2518,0x250c,0x2588,0x2584,0x258c,0x2590,0x2580,
+0x03b1,0x00df,0x0393,0x03c0,0x03a3,0x03c3,0x00b5,0x03c4,0x03a6,0x0398,0x03a9,0x03b4,0x221e,0x03c6,0x03b5,0x2229,
+0x2261,0x00b1,0x2265,0x2264,0x2320,0x2321,0x00f7,0x2248,0x00b0,0x2219,0x00b7,0x221a,0x207f,0x00b2,0x25a0,0x00a0
+};
+
+static const Bit16u cp864Map[256] = {
+0x0000,0x0001,0x0002,0x0003,0x0004,0x0005,0x0006,0x0007,0x0008,0x0009,0x000a,0x000b,0x000c,0x000d,0x000e,0x000f,
+0x0010,0x0011,0x0012,0x0013,0x0014,0x0015,0x0016,0x0017,0x0018,0x0019,0x001a,0x001b,0x001c,0x001d,0x001e,0x001f,
+0x0020,0x0021,0x0022,0x0023,0x0024,0x066a,0x0026,0x0027,0x0028,0x0029,0x002a,0x002b,0x002c,0x002d,0x002e,0x002f,
+0x0030,0x0031,0x0032,0x0033,0x0034,0x0035,0x0036,0x0037,0x0038,0x0039,0x003a,0x003b,0x003c,0x003d,0x003e,0x003f,
+0x0040,0x0041,0x0042,0x0043,0x0044,0x0045,0x0046,0x0047,0x0048,0x0049,0x004a,0x004b,0x004c,0x004d,0x004e,0x004f,
+0x0050,0x0051,0x0052,0x0053,0x0054,0x0055,0x0056,0x0057,0x0058,0x0059,0x005a,0x005b,0x005c,0x005d,0x005e,0x005f,
+0x0060,0x0061,0x0062,0x0063,0x0064,0x0065,0x0066,0x0067,0x0068,0x0069,0x006a,0x006b,0x006c,0x006d,0x006e,0x006f,
+0x0070,0x0071,0x0072,0x0073,0x0074,0x0075,0x0076,0x0077,0x0078,0x0079,0x007a,0x007b,0x007c,0x007d,0x007e,0x007f,
+0x00b0,0x00b7,0x2219,0x221a,0x2592,0x2500,0x2502,0x253c,0x2524,0x252c,0x251c,0x2534,0x2510,0x250c,0x2514,0x2518,
+0x03b2,0x221e,0x03c6,0x00b1,0x00bd,0x00bc,0x2248,0x00ab,0x00bb,0xfef7,0xfef8,0x0000,0x0000,0xfefb,0xfefc,0x0000,
+0x00a0,0x00ad,0xfe82,0x00a3,0x00a4,0xfe84,0x0000,0x0000,0xfe8e,0xfe8f,0xfe95,0xfe99,0x060c,0xfe9d,0xfea1,0xfea5,
+0x0660,0x0661,0x0662,0x0663,0x0664,0x0665,0x0666,0x0667,0x0668,0x0669,0xfed1,0x061b,0xfeb1,0xfeb5,0xfeb9,0x061f,
+0x00a2,0xfe80,0xfe81,0xfe83,0xfe85,0xfeca,0xfe8b,0xfe8d,0xfe91,0xfe93,0xfe97,0xfe9b,0xfe9f,0xfea3,0xfea7,0xfea9,
+0xfeab,0xfead,0xfeaf,0xfeb3,0xfeb7,0xfebb,0xfebf,0xfec1,0xfec5,0xfecb,0xfecf,0x00a6,0x00ac,0x00f7,0x00d7,0xfec9,
+0x0640,0xfed3,0xfed7,0xfedb,0xfedf,0xfee3,0xfee7,0xfeeb,0xfeed,0xfeef,0xfef3,0xfebd,0xfecc,0xfece,0xfecd,0xfee1,
+0xfe7d,0x0651,0xfee5,0xfee9,0xfeec,0xfef0,0xfef2,0xfed0,0xfed5,0xfef5,0xfef6,0xfedd,0xfed9,0xfef1,0x25a0,
+};
+
+static const Bit16u cp865Map[256] = {
+0x0000,0x0001,0x0002,0x0003,0x0004,0x0005,0x0006,0x0007,0x0008,0x0009,0x000a,0x000b,0x000c,0x000d,0x000e,0x000f,
+0x0010,0x0011,0x0012,0x0013,0x0014,0x0015,0x0016,0x0017,0x0018,0x0019,0x001a,0x001b,0x001c,0x001d,0x001e,0x001f,
+0x0020,0x0021,0x0022,0x0023,0x0024,0x0025,0x0026,0x0027,0x0028,0x0029,0x002a,0x002b,0x002c,0x002d,0x002e,0x002f,
+0x0030,0x0031,0x0032,0x0033,0x0034,0x0035,0x0036,0x0037,0x0038,0x0039,0x003a,0x003b,0x003c,0x003d,0x003e,0x003f,
+0x0040,0x0041,0x0042,0x0043,0x0044,0x0045,0x0046,0x0047,0x0048,0x0049,0x004a,0x004b,0x004c,0x004d,0x004e,0x004f,
+0x0050,0x0051,0x0052,0x0053,0x0054,0x0055,0x0056,0x0057,0x0058,0x0059,0x005a,0x005b,0x005c,0x005d,0x005e,0x005f,
+0x0060,0x0061,0x0062,0x0063,0x0064,0x0065,0x0066,0x0067,0x0068,0x0069,0x006a,0x006b,0x006c,0x006d,0x006e,0x006f,
+0x0070,0x0071,0x0072,0x0073,0x0074,0x0075,0x0076,0x0077,0x0078,0x0079,0x007a,0x007b,0x007c,0x007d,0x007e,0x007f,
+0x00c7,0x00fc,0x00e9,0x00e2,0x00e4,0x00e0,0x00e5,0x00e7,0x00ea,0x00eb,0x00e8,0x00ef,0x00ee,0x00ec,0x00c4,0x00c5,
+0x00c9,0x00e6,0x00c6,0x00f4,0x00f6,0x00f2,0x00fb,0x00f9,0x00ff,0x00d6,0x00dc,0x00f8,0x00a3,0x00d8,0x20a7,0x0192,
+0x00e1,0x00ed,0x00f3,0x00fa,0x00f1,0x00d1,0x00aa,0x00ba,0x00bf,0x2310,0x00ac,0x00bd,0x00bc,0x00a1,0x00ab,0x00a4,
+0x2591,0x2592,0x2593,0x2502,0x2524,0x2561,0x2562,0x2556,0x2555,0x2563,0x2551,0x2557,0x255d,0x255c,0x255b,0x2510,
+0x2514,0x2534,0x252c,0x251c,0x2500,0x253c,0x255e,0x255f,0x255a,0x2554,0x2569,0x2566,0x2560,0x2550,0x256c,0x2567,
+0x2568,0x2564,0x2565,0x2559,0x2558,0x2552,0x2553,0x256b,0x256a,0x2518,0x250c,0x2588,0x2584,0x258c,0x2590,0x2580,
+0x03b1,0x00df,0x0393,0x03c0,0x03a3,0x03c3,0x00b5,0x03c4,0x03a6,0x0398,0x03a9,0x03b4,0x221e,0x03c6,0x03b5,0x2229,
+0x2261,0x00b1,0x2265,0x2264,0x2320,0x2321,0x00f7,0x2248,0x00b0,0x2219,0x00b7,0x221a,0x207f,0x00b2,0x25a0,0x00a0
+};
+
+static const Bit16u cp866Map[256] = {
+0x0000,0x0001,0x0002,0x0003,0x0004,0x0005,0x0006,0x0007,0x0008,0x0009,0x000a,0x000b,0x000c,0x000d,0x000e,0x000f,
+0x0010,0x0011,0x0012,0x0013,0x0014,0x0015,0x0016,0x0017,0x0018,0x0019,0x001a,0x001b,0x001c,0x001d,0x001e,0x001f,
+0x0020,0x0021,0x0022,0x0023,0x0024,0x0025,0x0026,0x0027,0x0028,0x0029,0x002a,0x002b,0x002c,0x002d,0x002e,0x002f,
+0x0030,0x0031,0x0032,0x0033,0x0034,0x0035,0x0036,0x0037,0x0038,0x0039,0x003a,0x003b,0x003c,0x003d,0x003e,0x003f,
+0x0040,0x0041,0x0042,0x0043,0x0044,0x0045,0x0046,0x0047,0x0048,0x0049,0x004a,0x004b,0x004c,0x004d,0x004e,0x004f,
+0x0050,0x0051,0x0052,0x0053,0x0054,0x0055,0x0056,0x0057,0x0058,0x0059,0x005a,0x005b,0x005c,0x005d,0x005e,0x005f,
+0x0060,0x0061,0x0062,0x0063,0x0064,0x0065,0x0066,0x0067,0x0068,0x0069,0x006a,0x006b,0x006c,0x006d,0x006e,0x006f,
+0x0070,0x0071,0x0072,0x0073,0x0074,0x0075,0x0076,0x0077,0x0078,0x0079,0x007a,0x007b,0x007c,0x007d,0x007e,0x007f,
+0x0410,0x0411,0x0412,0x0413,0x0414,0x0415,0x0416,0x0417,0x0418,0x0419,0x041a,0x041b,0x041c,0x041d,0x041e,0x041f,
+0x0420,0x0421,0x0422,0x0423,0x0424,0x0425,0x0426,0x0427,0x0428,0x0429,0x042a,0x042b,0x042c,0x042d,0x042e,0x042f,
+0x0430,0x0431,0x0432,0x0433,0x0434,0x0435,0x0436,0x0437,0x0438,0x0439,0x043a,0x043b,0x043c,0x043d,0x043e,0x043f,
+0x2591,0x2592,0x2593,0x2502,0x2524,0x2561,0x2562,0x2556,0x2555,0x2563,0x2551,0x2557,0x255d,0x255c,0x255b,0x2510,
+0x2514,0x2534,0x252c,0x251c,0x2500,0x253c,0x255e,0x255f,0x255a,0x2554,0x2569,0x2566,0x2560,0x2550,0x256c,0x2567,
+0x2568,0x2564,0x2565,0x2559,0x2558,0x2552,0x2553,0x256b,0x256a,0x2518,0x250c,0x2588,0x2584,0x258c,0x2590,0x2580,
+0x0440,0x0441,0x0442,0x0443,0x0444,0x0445,0x0446,0x0447,0x0448,0x0449,0x044a,0x044b,0x044c,0x044d,0x044e,0x044f,
+0x0401,0x0451,0x0404,0x0454,0x0407,0x0457,0x040e,0x045e,0x00b0,0x2219,0x00b7,0x221a,0x2116,0x00a4,0x25a0,0x00a0
+};
+
+static const Bit16u codepages[15] = {0, 437, 932, 850, 851, 853, 855, 860, 863, 865, 852, 857, 862, 864, 866};
+
+// TODO: Implement all international charsets
+static const Bit16u intCharSets[15][12] =
+{
+       {0x0023, 0x0024, 0x0040, 0x005b, 0x005c, 0x005d, 0x005e, 0x0060, 0x007b, 0x007c, 0x007d, 0x007e}, // USA
+       {0x0023, 0x0024, 0x00e0, 0x00ba, 0x00e7, 0x00a7, 0x005e, 0x0060, 0x00e9, 0x00f9, 0x00e8, 0x00a8}, // France
+       {0x0023, 0x0024, 0x00a7, 0x00c4, 0x00d6, 0x00dc, 0x005e, 0x0060, 0x00e4, 0x00f6, 0x00fc, 0x00df}, // Germany
+       {0x00a3, 0x0024, 0x0040, 0x005b, 0x005c, 0x005d, 0x005e, 0x0060, 0x007b, 0x007c, 0x007d, 0x007e}, // UK
+       {0x0023, 0x0024, 0x0040, 0x005b, 0x005c, 0x005d, 0x005e, 0x0060, 0x007b, 0x007c, 0x007d, 0x007e},
+       {0x0023, 0x0024, 0x0040, 0x005b, 0x005c, 0x005d, 0x005e, 0x0060, 0x007b, 0x007c, 0x007d, 0x007e},
+       {0x0023, 0x0024, 0x0040, 0x005b, 0x005c, 0x005d, 0x005e, 0x0060, 0x007b, 0x007c, 0x007d, 0x007e},
+       {0x0023, 0x0024, 0x0040, 0x005b, 0x005c, 0x005d, 0x005e, 0x0060, 0x007b, 0x007c, 0x007d, 0x007e},
+       {0x0023, 0x0024, 0x0040, 0x005b, 0x005c, 0x005d, 0x005e, 0x0060, 0x007b, 0x007c, 0x007d, 0x007e},
+       {0x0023, 0x0024, 0x0040, 0x005b, 0x005c, 0x005d, 0x005e, 0x0060, 0x007b, 0x007c, 0x007d, 0x007e},
+       {0x0023, 0x0024, 0x0040, 0x005b, 0x005c, 0x005d, 0x005e, 0x0060, 0x007b, 0x007c, 0x007d, 0x007e},
+       {0x0023, 0x0024, 0x0040, 0x005b, 0x005c, 0x005d, 0x005e, 0x0060, 0x007b, 0x007c, 0x007d, 0x007e},
+       {0x0023, 0x0024, 0x0040, 0x005b, 0x005c, 0x005d, 0x005e, 0x0060, 0x007b, 0x007c, 0x007d, 0x007e},
+       {0x0023, 0x0024, 0x0040, 0x005b, 0x005c, 0x005d, 0x005e, 0x0060, 0x007b, 0x007c, 0x007d, 0x007e},
+       {0x0023, 0x0024, 0x00a7, 0x00c4, 0x0027, 0x0022, 0x00b6, 0x0060, 0x00a9, 0x00ae, 0x2020, 0x2122} // Legal
+};
+
+
+static void selectCodepage(Bit16u cp)
+{
+       int i;
+       Bit16u *mapToUse = NULL;
+
+       switch(cp)
+       {
+       case 0: // Italics, use cp437
+       case 437:
+               mapToUse = (Bit16u*)&cp437Map;
+               break;
+       case 737:
+               mapToUse = (Bit16u*)&cp737Map;
+               break;
+       case 775:
+               mapToUse = (Bit16u*)&cp775Map;
+               break;
+       case 850:
+               mapToUse = (Bit16u*)&cp850Map;
+               break;
+       case 852:
+               mapToUse = (Bit16u*)&cp852Map;
+               break;
+       case 855:
+               mapToUse = (Bit16u*)&cp855Map;
+               break;
+       case 857:
+               mapToUse = (Bit16u*)&cp857Map;
+               break;
+       case 860:
+               mapToUse = (Bit16u*)&cp860Map;
+               break;
+       case 861:
+               mapToUse = (Bit16u*)&cp861Map;
+               break;
+       case 863:
+               mapToUse = (Bit16u*)&cp863Map;
+               break;
+       case 864:
+               mapToUse = (Bit16u*)&cp864Map;
+               break;
+       case 865:
+               mapToUse = (Bit16u*)&cp865Map;
+               break;
+       case 866:
+               mapToUse = (Bit16u*)&cp866Map;
+               break;
+       default:
+               write_log(L"Unsupported codepage %i. Using CP437 instead.\n", cp);
+               mapToUse = (Bit16u*)&cp437Map;
+       }
+
+       for (i=0; i<256; i++)
+               curMap[i] = mapToUse[i];
+}
+
+
+static void updateFont(void)
+{
+       Real64 horizPoints = 10.5;
+       Real64 vertPoints = 10.5;
+       char* fontName;
+
+       if (curFont != NULL)
+               FT_Done_Face(curFont);
+
+       switch (LQtypeFace)
+       {
+       case roman:
+               fontName = "roman.ttf";
+               break;
+       case sansserif:
+               fontName = "sansserif.ttf";
+               break;
+       case courier:
+               fontName = "courier.ttf";
+               break;
+       case script:
+               fontName = "script.ttf";
+               break;
+       case ocra:
+       case ocrb:
+               fontName = "ocra.ttf";
+               break;
+       default:
+               fontName = "roman.ttf";
+       }
+
+       if (!ft) {
+           write_log(L"EPSONPRINTER: No freetype6.dll, unable to load font %s\n", fontName);
+           curFont = NULL;
+       } else if (FT_New_Face(FTlib, fontName, 0, &curFont)) {
+               char windowsdir[MAX_DPATH];
+               GetWindowsDirectoryA (windowsdir, sizeof windowsdir);
+               strcat (windowsdir, "\\Fonts\\");
+               strcat (windowsdir, fontName);
+               if (FT_New_Face(FTlib, windowsdir, 0, &curFont))
+               {
+                   GetWindowsDirectoryA (windowsdir, sizeof windowsdir);
+                   strcat (windowsdir, "\\Fonts\\");
+                   strcat (windowsdir, "times.ttf");
+                   if (FT_New_Face(FTlib, windowsdir, 0, &curFont)) {
+                       write_log(L"Unable to load font %s\n", fontName);
+                       curFont = NULL;
+                   }
+               }
+       }
+
+       if (!multipoint)
+       {
+               actcpi = cpi;
+       
+               if (cpi != 10 && !(style & STYLE_CONDENSED))
+               {
+                       horizPoints *= (Real64)10/(Real64)cpi;
+                       vertPoints *= (Real64)10/(Real64)cpi;
+               }
+
+               if (!style & STYLE_PROP)
+               {
+                       if (cpi == 10 && (style & STYLE_CONDENSED))
+                       {
+                               actcpi = 17.14;
+                               horizPoints *= (Real64)10/(Real64)17.14;
+                               vertPoints *= (Real64)10/(Real64)17.14;
+                       }
+               
+                       if (cpi == 12 && (style & STYLE_CONDENSED))
+                       {
+                               actcpi = 20.0;
+                               horizPoints *= (Real64)10/(Real64)20.0;
+                               vertPoints *= (Real64)10/(Real64)20.0;
+                       }       
+               }
+
+               if (style & (STYLE_PROP | STYLE_CONDENSED))
+               {
+                       horizPoints /= (Real64)2.0;
+                       vertPoints /= (Real64)2.0;
+               }
+
+               if ((style & STYLE_DOUBLEWIDTH) || (style & STYLE_DOUBLEWIDTHONELINE))
+               {
+                       actcpi /= 2;
+                       horizPoints *= (Real64)2.0;
+               }
+
+               if (style & STYLE_DOUBLEHEIGHT)
+                       vertPoints *= (Real64)2.0;
+       }
+       else
+       {
+               actcpi = multicpi;
+               horizPoints = vertPoints = multiPointSize;
+       }
+
+       if ((style & STYLE_SUPERSCRIPT) || (style & STYLE_SUBSCRIPT))
+       {
+               horizPoints *= (Real64)2/(Real64)3;
+               vertPoints *= (Real64)2/(Real64)3;
+               actcpi /= (Real64)2/(Real64)3;
+       }
+
+
+       if (curFont)
+           FT_Set_Char_Size(curFont, (Bit16u)horizPoints*64, (Bit16u)vertPoints*64, dpi, dpi);
+       
+       if (style & STYLE_ITALICS || charTables[curCharTable] == 0)
+       {
+               FT_Matrix  matrix;
+               matrix.xx = 0x10000L;
+               matrix.xy = (FT_Fixed)(0.20 * 0x10000L);
+               matrix.yx = 0;
+               matrix.yy = 0x10000L;
+               if (curFont)
+                   FT_Set_Transform(curFont, &matrix, 0);
+       }
+}
+
+static void getfname (TCHAR *fname)
+{
+    TCHAR tmp[MAX_DPATH];
+    int number = 0;
+
+    fetch_screenshotpath (tmp, sizeof tmp / sizeof (TCHAR));
+    for (;;) {
+       FILE *fp;
+       _stprintf (fname, L"%sPRINT_%03d.png", tmp, number);
+        if ((fp = _tfopen (fname, L"rb")) == NULL)
+           return;
+       number++;
+       fclose (fp);
+    }
+}
+
+static void outputPage(void) 
+{
+       Bit16u x, y;
+
+       if (strcasecmp(output, L"printer") == 0)
+       {
+#if defined (WIN32)
+               Bit16u physW = GetDeviceCaps(printerDC, PHYSICALWIDTH);
+               Bit16u physH = GetDeviceCaps(printerDC, PHYSICALHEIGHT);
+               HDC memHDC;
+               HBITMAP bitmap;
+
+               Real64 scaleW, scaleH;
+               Bit32u topX,  topY;
+
+               if (page_w > physW) 
+                   scaleW = (Real64)page_w / (Real64)physW;
+               else 
+                   scaleW = (Real64)physW / (Real64)page_w; 
+               if (page_h > physH) 
+                   scaleH = (Real64)page_h / (Real64)physH;
+               else 
+                   scaleH = (Real64)physH / (Real64)page_h; 
+
+               memHDC = CreateCompatibleDC(printerDC);
+               bitmap = CreateCompatibleBitmap(memHDC, page_w, page_h);
+               SelectObject(memHDC, bitmap);
+
+               // Start new printer job?
+               if (outputHandle == NULL)
+               {
+                       DOCINFO docinfo;
+                       docinfo.cbSize = sizeof(docinfo);
+                       docinfo.lpszDocName = L"WinUAE Printer";
+                       docinfo.lpszOutput = NULL;
+                       docinfo.lpszDatatype = NULL;
+                       docinfo.fwType = 0;
+
+                       StartDoc(printerDC, &docinfo);
+                       multiPageCounter = 1;
+               }
+
+               StartPage(printerDC);
+
+               for (y=0; y<page_h; y++)
+               {
+                       for (x=0; x<page_w; x++)
+                       {
+                               Bit8u pixel = *((Bit8u*)page + x + (y*page_pitch));
+                               Bit32u color = 0;
+                               color |= pixel;
+                               color |= pixel << 8;
+                               color |= pixel << 16;
+                               SetPixel(memHDC, x, y, color);
+                       }
+               }
+       
+               StretchBlt(printerDC, 0, 0, physW, physH, memHDC, 0, 0, page_w, page_h, SRCCOPY);
+
+               EndPage(printerDC);
+
+               if (multipageOutput)
+               {
+                       multiPageCounter++;
+                       outputHandle = printerDC;
+               }
+               else
+               {
+                       EndDoc(printerDC);
+                       outputHandle = NULL;
+               }
+       
+               DeleteDC(memHDC);
+#else
+               write_log(L"EPSONPRINTER: Direct printing not supported under this OS\n");
+#endif
+       }
+#ifdef C_LIBPNG
+       else if (strcasecmp(output, L"png") == 0)
+       {
+               png_structp png_ptr;
+               png_infop info_ptr;
+               png_bytep * row_pointers;
+               png_color palette[256];
+               Bitu i;
+               TCHAR fname[MAX_DPATH];
+               FILE *fp;
+
+               getfname (fname);
+               /* Open the actual file */
+               fp=_tfopen(fname,L"wb");
+               if (!fp) 
+               {
+                       write_log(L"EPSONPRINTER: Can't open file %s for printer output\n", fname);
+                       return;
+               }
+
+               /* First try to alloacte the png structures */
+               png_ptr = png_create_write_struct(PNG_LIBPNG_VER_STRING, NULL,NULL, NULL);
+               if (!png_ptr) return;
+               info_ptr = png_create_info_struct(png_ptr);
+               if (!info_ptr) {
+                       png_destroy_write_struct(&png_ptr,(png_infopp)NULL);
+                       return;
+               }
+
+               /* Finalize the initing of png library */
+               png_init_io(png_ptr, fp);
+               png_set_compression_level(png_ptr,Z_BEST_COMPRESSION);
+               
+               /* set other zlib parameters */
+               png_set_compression_mem_level(png_ptr, 8);
+               png_set_compression_strategy(png_ptr,Z_DEFAULT_STRATEGY);
+               png_set_compression_window_bits(png_ptr, 15);
+               png_set_compression_method(png_ptr, 8);
+               png_set_compression_buffer_size(png_ptr, 8192);
+
+               
+               png_set_IHDR(png_ptr, info_ptr, page_w, page_h,
+                       8, PNG_COLOR_TYPE_PALETTE, PNG_INTERLACE_NONE,
+                       PNG_COMPRESSION_TYPE_DEFAULT, PNG_FILTER_TYPE_DEFAULT);
+               for (i=0;i<256;i++) 
+               {
+                       palette[i].red = 255 - i;
+                       palette[i].green = 255 - i;
+                       palette[i].blue = 255 - i;
+               }
+               png_set_PLTE(png_ptr, info_ptr, palette,256);
+               
+               // Allocate an array of scanline pointers
+               row_pointers = (png_bytep*)malloc(page_h*sizeof(png_bytep));
+               for (i=0; i<page_h; i++) 
+                       row_pointers[i] = ((Bit8u*)page+(i*page_pitch));
+
+               // tell the png library what to encode.
+               png_set_rows(png_ptr, info_ptr, row_pointers);
+               
+               // Write image to file
+               png_write_png(png_ptr, info_ptr, 0, NULL);
+
+               /*close file*/
+               fclose(fp);
+       
+               /*Destroy PNG structs*/
+               png_destroy_write_struct(&png_ptr, &info_ptr);
+               
+               /*clean up dynamically allocated RAM.*/
+               free(row_pointers);
+               ShellExecute (NULL, L"open", fname, NULL, NULL, SW_SHOWNORMAL);
+       }
+#endif
+}
+
+static void newPage(int save)
+{
+       if (save)
+               outputPage();
+
+       curY = topMargin;
+
+       memset (page, 0, pagesize);
+}
+
+static void resetPrinter(void)
+{
+    Bitu i;
+               curX = curY = 0.0;
+               ESCSeen = false;
+               ESCCmd = 0;
+               numParam = neededParam = 0;
+               topMargin = 0.0;
+               leftMargin = 0.0;
+               rightMargin = pageWidth = defaultPageWidth;
+               bottomMargin = pageHeight = defaultPageHeight;
+               lineSpacing = (Real64)1/6;
+               cpi = 10.0;
+               curCharTable = 1;
+               style = 0;
+               extraIntraSpace = 0.0;
+               printUpperContr = true;
+               bitGraph.remBytes = 0;
+               densk = 0;
+               densl = 1;
+               densy = 2;
+               densz = 3;
+               charTables[0] = 0; // Italics
+               charTables[1] = charTables[2] = charTables[3] = 437;
+               definedUnit = -1;
+               multipoint = false;
+               multiPointSize = 0.0;
+               multicpi = 0.0;
+               hmi = -1.0;
+               msb = 255;
+               numPrintAsChar = 0;
+               LQtypeFace = roman;
+
+               selectCodepage(charTables[curCharTable]);
+
+               updateFont();
+
+               newPage(false);
+
+               // Default tabs => Each eight characters
+               for (i=0;i<32;i++)
+                       horiztabs[i] = i*8*(1/(Real64)cpi);
+               numHorizTabs = 32;
+
+               numVertTabs = 255;
+}
+
+static void resetPrinterHard(void)
+{
+       charRead = false;
+       resetPrinter();
+}
+
+static printer_init(Bit16u dpi2, Bit16u width, Bit16u height, TCHAR* output2, int multipageOutput2)
+{
+       if (ft == NULL || FT_Init_FreeType(&FTlib))
+       {
+               write_log(L"EPSONPRINTER: Unable to init Freetype2. ASCII printing disabled\n");
+       }
+       {       
+               Bitu i;
+               dpi = dpi2;
+               output = output2;
+               multipageOutput = multipageOutput2;
+
+               defaultPageWidth = (Real64)width/(Real64)10;
+               defaultPageHeight = (Real64)height/(Real64)10;
+
+               // Create page
+               page_w = (Bitu)(defaultPageWidth*dpi);
+               page_h = (Bitu)(defaultPageHeight*dpi);
+               pagesize =  page_w * page_h;
+               page_pitch = page_w;
+               page = xcalloc (pagesize, 1);
+               curFont = NULL;
+               charRead = false;
+               autoFeed = false;
+               outputHandle = NULL;
+
+               resetPrinter();
+
+               if (strcasecmp(output, L"printer") == 0)
+               {
+#if defined (WIN32)
+                       // Show Print dialog to obtain a printer device context
+
+                       PRINTDLG pd;
+                       pd.lStructSize = sizeof(PRINTDLG); 
+                       pd.hDevMode = (HANDLE) NULL; 
+                       pd.hDevNames = (HANDLE) NULL; 
+                       pd.Flags = PD_RETURNDC; 
+                       pd.hwndOwner = NULL; 
+                       pd.hDC = (HDC) NULL; 
+                       pd.nFromPage = 1; 
+                       pd.nToPage = 1; 
+                       pd.nMinPage = 0; 
+                       pd.nMaxPage = 0; 
+                       pd.nCopies = 1; 
+                       pd.hInstance = NULL; 
+                       pd.lCustData = 0L; 
+                       pd.lpfnPrintHook = (LPPRINTHOOKPROC) NULL; 
+                       pd.lpfnSetupHook = (LPSETUPHOOKPROC) NULL; 
+                       pd.lpPrintTemplateName = (LPWSTR) NULL; 
+                       pd.lpSetupTemplateName = (LPWSTR)  NULL; 
+                       pd.hPrintTemplate = (HANDLE) NULL; 
+                       pd.hSetupTemplate = (HANDLE) NULL; 
+                       PrintDlg(&pd);
+                       printerDC = pd.hDC;
+#endif
+               }
+       }
+};
+
+
+static printer_close(void)
+{
+       if (page != NULL)
+       {
+               xfree (page);
+               page = NULL;
+               if (ft)
+                   FT_Done_FreeType(FTlib);
+               write_log (L"EPSONPRINTER: end\n");
+       }
+#if defined (WIN32)
+       DeleteDC(printerDC);
+#endif
+};
+
+
+static void setupBitImage(Bit8u dens, Bit16u numCols)
+{
+       switch (dens)
+       {
+       case 0:
+               bitGraph.horizDens = 60;
+               bitGraph.vertDens = 60;
+               bitGraph.adjacent = true;
+               bitGraph.bytesColumn = 1;
+               break;
+       case 1:
+               bitGraph.horizDens = 120;
+               bitGraph.vertDens = 60;
+               bitGraph.adjacent = true;
+               bitGraph.bytesColumn = 1;
+               break;
+       case 2:
+               bitGraph.horizDens = 120;
+               bitGraph.vertDens = 60;
+               bitGraph.adjacent = false;
+               bitGraph.bytesColumn = 1;
+               break;
+       case 3:
+               bitGraph.horizDens = 60;
+               bitGraph.vertDens = 240;
+               bitGraph.adjacent = false;
+               bitGraph.bytesColumn = 1;
+               break;
+       case 4:
+               bitGraph.horizDens = 80;
+               bitGraph.vertDens = 60;
+               bitGraph.adjacent = true;
+               bitGraph.bytesColumn = 1;
+               break;
+       case 6:
+               bitGraph.horizDens = 90;
+               bitGraph.vertDens = 60;
+               bitGraph.adjacent = true;
+               bitGraph.bytesColumn = 1;
+               break;
+       case 32:
+               bitGraph.horizDens = 60;
+               bitGraph.vertDens = 180;
+               bitGraph.adjacent = true;
+               bitGraph.bytesColumn = 3;
+               break;
+       case 33:
+               bitGraph.horizDens = 120;
+               bitGraph.vertDens = 180;
+               bitGraph.adjacent = true;
+               bitGraph.bytesColumn = 3;
+               break;
+       case 38:
+               bitGraph.horizDens = 90;
+               bitGraph.vertDens = 180;
+               bitGraph.adjacent = true;
+               bitGraph.bytesColumn = 3;
+               break;
+       case 39:
+               bitGraph.horizDens = 180;
+               bitGraph.vertDens = 180;
+               bitGraph.adjacent = true;
+               bitGraph.bytesColumn = 3;
+               break;
+       case 40:
+               bitGraph.horizDens = 360;
+               bitGraph.vertDens = 180;
+               bitGraph.adjacent = false;
+               bitGraph.bytesColumn = 3;
+               break;
+       case 71:
+               bitGraph.horizDens = 180;
+               bitGraph.vertDens = 360;
+               bitGraph.adjacent = true;
+               bitGraph.bytesColumn = 6;
+               break;
+       case 72:
+               bitGraph.horizDens = 360;
+               bitGraph.vertDens = 360;
+               bitGraph.adjacent = false;
+               bitGraph.bytesColumn = 6;
+               break;
+       case 73:
+               bitGraph.horizDens = 360;
+               bitGraph.vertDens = 360;
+               bitGraph.adjacent = true;
+               bitGraph.bytesColumn = 6;
+               break;
+       default:
+               write_log(L"EPSONPRINTER: Unsupported bit image density %i\n", dens);
+       }
+
+       bitGraph.remBytes = numCols * bitGraph.bytesColumn;
+       bitGraph.readBytesColumn = 0;
+}
+
+static int processCommandChar(Bit8u ch)
+{
+       if (ESCSeen)
+       {
+               ESCCmd = ch;
+               ESCSeen = false;
+               numParam = 0;
+
+               switch (ESCCmd)
+               {
+               case 0x02: // Undocumented
+               case 0x0e: // Select double-width printing (one line) (ESC SO)          
+               case 0x0f: // Select condensed printing (ESC SI)
+               case 0x23: // Cancel MSB control (ESC #)
+               case 0x30: // Select 1/8-inch line spacing (ESC 0)
+               case 0x32: // Select 1/6-inch line spacing (ESC 2)
+               case 0x34: // Select italic font (ESC 4)
+               case 0x35: // Cancel italic font (ESC 5)
+               case 0x36: // Enable printing of upper control codes (ESC 6)
+               case 0x37: // Enable upper control codes (ESC 7)
+               case 0x3c: // Unidirectional mode (one line) (ESC <)
+               case 0x3d: // Set MSB to 0 (ESC =)
+               case 0x3e: // Set MSB to 1 (ESC >)
+               case 0x40: // Initialize printer (ESC @)
+               case 0x45: // Select bold font (ESC E)
+               case 0x46: // Cancel bold font (ESC F)
+               case 0x47: // Select double-strike printing (ESC G)
+               case 0x48: // Cancel double-strike printing (ESC H)
+               case 0x4d: // Select 10.5-point, 12-cpi (ESC M)
+               case 0x4f: // Cancel bottom margin                      
+               case 0x50: // Select 10.5-point, 10-cpi (ESC P)
+               case 0x54: // Cancel superscript/subscript printing (ESC T)
+               case 0x67: // Select 10.5-point, 15-cpi (ESC g)
+               case 0x73: // Select low-speed mode (ESC s)
+                       neededParam = 0;
+                       break;
+               case 0x19: // Control paper loading/ejecting (ESC EM)
+               case 0x20: // Set intercharacter space (ESC SP)
+               case 0x21: // Master select (ESC !)
+               case 0x2b: // Set n/360-inch line spacing (ESC +)
+               case 0x2d: // Turn underline on/off (ESC -)
+               case 0x2f: // Select vertical tab channel (ESC /)
+               case 0x33: // Set n/180-inch line spacing (ESC 3)
+               case 0x41: // Set n/60-inch line spacing
+               case 0x43: // Set page length in lines (ESC C)
+               case 0x4a: // Advance print position vertically (ESC J n)
+               case 0x4e: // Set bottom margin (ESC N)
+               case 0x51: // Set right margin (ESC Q)
+               case 0x52: // Select an international character set (ESC R)
+               case 0x53: // Select superscript/subscript printing (ESC S)
+               case 0x55: // Turn unidirectional mode on/off (ESC U)
+               case 0x57: // Turn double-width printing on/off (ESC W)
+               case 0x61: // Select justification (ESC a)
+               case 0x6b: // Select typeface (ESC k)
+               case 0x6c: // Set left margin (ESC 1)
+               case 0x70: // Turn proportional mode on/off (ESC p)
+               case 0x72: // Select printing color (ESC r)
+               case 0x74: // Select character table (ESC t)
+               case 0x77: // Turn double-height printing on/off (ESC w)
+               case 0x78: // Select LQ or draft (ESC x)
+                       neededParam = 1;
+                       break;
+               case 0x24: // Set absolute horizontal print position (ESC $)
+               case 0x3f: // Reassign bit-image mode (ESC ?)
+               case 0x4b: // Select 60-dpi graphics (ESC K)
+               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 0x5c: // Set relative horizontal print position (ESC \)
+               case 0x63: // Set horizontal motion index (HMI) (ESC c)
+                       neededParam = 2;
+                       break;
+               case 0x2a: // Select bit image (ESC *)
+               case 0x58: // Select font by pitch and point (ESC X)
+                       neededParam = 3;
+                       break;
+               case 0x62: // Set vertical tabs in VFU channels (ESC b)
+               case 0x42: // Set vertical tabs (ESC B)
+                       numVertTabs = 0;
+                       return true;
+               case 0x44: // Set horizontal tabs (ESC D)
+                       numHorizTabs = 0;
+                       return true;
+               case 0x25: // Select user-defined set (ESC %)
+               case 0x26: // Define user-defined characters (ESC &)
+               case 0x3a: // Copy ROM to RAM (ESC :)
+                       write_log(L"User-defined characters not supported!\n");
+                       return true;
+               case 0x28: // Two bytes sequence
+                       return true;
+               default:
+                       write_log(L"EPSONPRINTER: Unknown command ESC %c (%02X). Unable to skip parameters.\n", ESCCmd, ESCCmd);
+                       neededParam = 0;
+                       ESCCmd = 0;
+                       return true;
+               }
+
+               if (neededParam > 0)
+                       return true;
+       }
+
+       // Two bytes sequence
+       if (ESCCmd == 0x28)
+       {
+               ESCCmd = 0x200 + ch;
+
+               switch (ESCCmd)
+               {
+               case 0x242: // Bar code setup and print (ESC (B)
+               case 0x25e: // Print data as characters (ESC (^)
+                       neededParam = 2;
+                       break;
+               case 0x255: // Set unit (ESC (U)
+                       neededParam = 3;
+                       break;
+               case 0x243: // Set page length in defined unit (ESC (C)
+               case 0x256: // Set absolute vertical print position (ESC (V)
+               case 0x276: // Set relative vertical print position (ESC (v)
+                       neededParam = 4;
+                       break;
+               case 0x228: // Assign character table (ESC (t)
+               case 0x22d: // Select line/score (ESC (-)
+                       neededParam = 5;
+                       break;
+               case 0x263: // Set page format (ESC (c)
+                       neededParam = 6;
+                       break;
+               default:
+                       // ESC ( commands are always followed by a "number of parameters" word parameter
+                       write_log(L"EPSONPRINTER: Skipping unsupported command ESC ( %c (%02X).\n", ESCCmd, ESCCmd);
+                       neededParam = 2;
+                       ESCCmd = 0x101;
+                       return true;
+               }
+
+               if (neededParam > 0)
+                       return true;
+       }
+
+       // Ignore VFU channel setting
+       if (ESCCmd == 0x62)
+       {
+               ESCCmd = 0x42;
+               return true;
+       }
+
+       // Collect vertical tabs
+       if (ESCCmd == 0x42) 
+       {
+               if (ch == 0 || (numVertTabs>0 && verttabs[numVertTabs-1] > (Real64)ch*lineSpacing)) // Done
+                       ESCCmd = 0;
+               else
+                       if (numVertTabs < 16)
+                               verttabs[numVertTabs++] = (Real64)ch*lineSpacing;
+       }
+
+       // Collect horizontal tabs
+       if (ESCCmd == 0x44) 
+       {
+               if (ch == 0 || (numHorizTabs>0 && horiztabs[numHorizTabs-1] > (Real64)ch*(1/(Real64)cpi))) // Done
+                       ESCCmd = 0;
+               else
+                       if (numHorizTabs < 32)
+                               horiztabs[numHorizTabs++] = (Real64)ch*(1/(Real64)cpi);
+       }
+
+       if (numParam < neededParam)
+       {
+               params[numParam++] = ch;
+
+               if (numParam < neededParam)
+                       return true;
+       }
+
+       if (ESCCmd != 0)
+       {
+               switch (ESCCmd)
+               {
+               case 0x02: // Undocumented
+                       // Ignore
+                       break;
+               case 0x0e: // Select double-width printing (one line) (ESC SO)          
+                       if (!multipoint)
+                       {
+                               hmi = -1;
+                               style |= STYLE_DOUBLEWIDTHONELINE;
+                               updateFont();
+                       }
+                       break;
+               case 0x0f: // Select condensed printing (ESC SI)
+                       if (!multipoint)
+                       {
+                               hmi = -1;
+                               style |= STYLE_CONDENSED;
+                               updateFont();
+                       }
+                       break;
+               case 0x19: // Control paper loading/ejecting (ESC EM)
+                       // We are not really loading paper, so most commands can be ignored
+                       if (params[0] == 'R')
+                               newPage(true);
+                       break;
+               case 0x20: // Set intercharacter space (ESC SP)
+                       if (!multipoint)
+                       {
+                               extraIntraSpace = (Real64)params[0] / (printQuality==QUALITY_DRAFT?120:180);
+                               hmi = -1;
+                               updateFont();
+                       }
+                       break;
+               case 0x21: // Master select (ESC !)
+                       cpi = params[0] & 0x01 ? 12:10;
+
+                       // Reset first seven bits
+                       style &= 0xFF80;
+                       if (params[0] & 0x02)
+                               style |= STYLE_PROP;
+                       if (params[0] & 0x04)
+                               style |= STYLE_CONDENSED;
+                       if (params[0] & 0x08)
+                               style |= STYLE_BOLD;
+                       if (params[0] & 0x10)
+                               style |= STYLE_DOUBLESTRIKE;
+                       if (params[0] & 0x20)
+                               style |= STYLE_DOUBLEWIDTH;
+                       if (params[0] & 0x40)
+                               style |= STYLE_ITALICS;
+                       if (params[0] & 0x80)
+                       {
+                               score = SCORE_SINGLE;
+                               style |= STYLE_UNDERLINE;
+                       }
+
+                       hmi = -1;
+                       multipoint = false;
+                       updateFont();
+                       break;
+               case 0x23: // Cancel MSB control (ESC #)
+                       msb = 255;
+                       break;
+               case 0x24: // Set absolute horizontal print position (ESC $)
+                       {
+                               Real64 newX;
+                               Real64 unitSize = definedUnit;
+                               if (unitSize < 0)
+                                       unitSize = (Real64)60.0;
+
+                               newX = leftMargin + ((Real64)PARAM16(0)/unitSize);
+                               if (newX <= rightMargin)
+                                       curX = newX;
+                       }
+                       break;
+               case 0x2a: // Select bit image (ESC *)
+                       setupBitImage(params[0], PARAM16(1));
+                       break;
+               case 0x2b: // Set n/360-inch line spacing (ESC +)
+                       lineSpacing = (Real64)params[0]/360;
+                       break;
+               case 0x2d: // Turn underline on/off (ESC -)
+                       if (params[0] == 0 || params[0] == 48)
+                               style &= 0xFFFF - STYLE_UNDERLINE;
+                       if (params[0] == 1 || params[0] == 49)
+                       {
+                               style |= STYLE_UNDERLINE;
+                               score = SCORE_SINGLE;
+                       }
+                       updateFont();
+                       break;
+               case 0x2f: // Select vertical tab channel (ESC /)
+                       // Ignore
+                       break;
+               case 0x30: // Select 1/8-inch line spacing (ESC 0)
+                       lineSpacing = (Real64)1/8;
+                       break;
+               case 0x32: // Select 1/6-inch line spacing (ESC 2)
+                       lineSpacing = (Real64)1/6;
+                       break;
+               case 0x33: // Set n/180-inch line spacing (ESC 3)
+                       lineSpacing = (Real64)params[0]/180;
+                       break;
+               case 0x34: // Select italic font (ESC 4)
+                       style |= STYLE_ITALICS;
+                       updateFont();
+                       break;
+               case 0x35: // Cancel italic font (ESC 5)
+                       style &= 0xFFFF - STYLE_ITALICS;
+                       updateFont();
+                       break;
+               case 0x36: // Enable printing of upper control codes (ESC 6)
+                       printUpperContr = true;
+                       break;
+               case 0x37: // Enable upper control codes (ESC 7)
+                       printUpperContr = false;
+                       break;
+               case 0x3c: // Unidirectional mode (one line) (ESC <)
+                       // We don't have a print head, so just ignore this
+                       break;
+               case 0x3d: // Set MSB to 0 (ESC =)
+                       msb = 0;
+                       break;
+               case 0x3e: // Set MSB to 1 (ESC >)
+                       msb = 1;
+                       break;
+               case 0x3f: // Reassign bit-image mode (ESC ?)
+                       if (params[0] == 75)
+                               densk = params[1];
+                       if (params[0] == 76)
+                               densl = params[1];
+                       if (params[0] == 89)
+                               densy = params[1];
+                       if (params[0] == 90)
+                               densz = params[1];
+                       break;
+               case 0x40: // Initialize printer (ESC @)
+                       resetPrinter();
+                       break;
+               case 0x41: // Set n/60-inch line spacing
+                       lineSpacing = (Real64)params[0]/60;
+                       break;
+               case 0x43: // Set page length in lines (ESC C)
+                       if (params[0] != 0)
+                               pageHeight = bottomMargin = (Real64)params[0] * lineSpacing;
+                       else // == 0 => Set page length in inches
+                       {
+                               neededParam = 1;
+                               numParam = 0;
+                               ESCCmd = 0x100;
+                               return true;
+                       }
+                       break;
+               case 0x45: // Select bold font (ESC E)
+                       style |= STYLE_BOLD;
+                       updateFont();
+                       break;
+               case 0x46: // Cancel bold font (ESC F)
+                       style &= 0xFFFF - STYLE_BOLD;
+                       updateFont();
+                       break;
+               case 0x47: // Select dobule-strike printing (ESC G)
+                       style |= STYLE_DOUBLESTRIKE;
+                       break;
+               case 0x48: // Cancel double-strike printing (ESC H)
+                       style &= 0xFFFF - STYLE_DOUBLESTRIKE;
+                       break;
+               case 0x4a: // Advance print position vertically (ESC J n)
+                       curY += (Real64)((Real64)params[0] / 180);
+                       if (curY > bottomMargin)
+                               newPage(true);
+                       break;
+               case 0x4b: // Select 60-dpi graphics (ESC K)
+                       setupBitImage(densk, PARAM16(0));
+                       break;
+               case 0x4c: // Select 120-dpi graphics (ESC L)
+                       setupBitImage(densl, PARAM16(0));
+                       break;
+               case 0x4d: // Select 10.5-point, 12-cpi (ESC M)
+                       cpi = 12;
+                       hmi = -1;
+                       multipoint = false;
+                       updateFont();
+                       break;
+               case 0x4e: // Set bottom margin (ESC N)
+                       topMargin = 0.0;
+                       bottomMargin = (Real64)params[0] * lineSpacing; 
+                       break;
+               case 0x4f: // Cancel bottom (and top) margin
+                       topMargin = 0.0;
+                       bottomMargin = pageHeight;
+                       break;
+               case 0x50: // Select 10.5-point, 10-cpi (ESC P)
+                       cpi = 10;
+                       hmi = -1;
+                       multipoint = false;
+                       updateFont();
+                       break;
+               case 0x51: // Set right margin
+                       rightMargin = (Real64)(params[0]-1.0) / (Real64)cpi;
+                       break;
+               case 0x52: // Select an international character set (ESC R)
+                       if (params[0] <= 13 || params[0] == 64)
+                       {
+                               if (params[0] == 64)
+                                       params[0] = 14;
+
+                               curMap[0x23] = intCharSets[params[0]][0];
+                               curMap[0x24] = intCharSets[params[0]][1];
+                               curMap[0x40] = intCharSets[params[0]][2];
+                               curMap[0x5b] = intCharSets[params[0]][3];
+                               curMap[0x5c] = intCharSets[params[0]][4];
+                               curMap[0x5d] = intCharSets[params[0]][5];
+                               curMap[0x5e] = intCharSets[params[0]][6];
+                               curMap[0x60] = intCharSets[params[0]][7];
+                               curMap[0x7b] = intCharSets[params[0]][8];
+                               curMap[0x7c] = intCharSets[params[0]][9];
+                               curMap[0x7d] = intCharSets[params[0]][10];
+                               curMap[0x7e] = intCharSets[params[0]][11];
+                       }
+                       break;
+               case 0x53: // Select superscript/subscript printing (ESC S)
+                       if (params[0] == 0 || params[0] == 48)
+                               style |= STYLE_SUBSCRIPT;
+                       if (params[0] == 1 || params[1] == 49)
+                               style |= STYLE_SUPERSCRIPT;
+                       updateFont();
+                       break;
+               case 0x54: // Cancel superscript/subscript printing (ESC T)
+                       style &= 0xFFFF - STYLE_SUPERSCRIPT - STYLE_SUBSCRIPT;
+                       updateFont();
+                       break;
+               case 0x55: // Turn unidirectional mode on/off (ESC U)
+                       // We don't have a print head, so just ignore this
+                       break;
+               case 0x57: // Turn double-width printing on/off (ESC W)
+                       if (!multipoint)
+                       {
+                               hmi = -1;
+                               if (params[0] == 0 || params[0] == 48)
+                                       style &= 0xFFFF - STYLE_DOUBLEWIDTH;
+                               if (params[0] == 1 || params[0] == 49)
+                                       style |= STYLE_DOUBLEWIDTH;
+                               updateFont();
+                       }
+                       break;
+               case 0x58: // Select font by pitch and point (ESC X)
+                       multipoint = true;
+                       // Copy currently non-multipoint CPI if no value was set so far
+                       if (multicpi == 0)
+                               multicpi = cpi;
+                       if (params[0] > 0)  // Set CPI
+                       {
+                               if (params[0] == 1) // Proportional spacing
+                                       style |= STYLE_PROP;
+                               else if (params[0] >= 5)
+                                       multicpi = (Real64)360 / (Real64)params[0];
+                       }
+                       if (multiPointSize == 0)
+                               multiPointSize = (Real64)10.5;
+                       if (PARAM16(1) > 0) // Set points
+                               multiPointSize = ((Real64)PARAM16(1)) / 2;                      
+                       updateFont();
+                       break;
+               case 0x59: // Select 120-dpi, double-speed graphics (ESC Y)
+                       setupBitImage(densy, PARAM16(0));
+                       break;
+               case 0x5a: // Select 240-dpi graphics (ESC Z)
+                       setupBitImage(densz, PARAM16(0));
+                       break;
+               case 0x5c: // Set relative horizontal print position (ESC \)
+                       {
+                               Bit16s toMove = PARAM16(0);
+                               Real64 unitSize = definedUnit;
+                               if (unitSize < 0)
+                                       unitSize = (Real64)(printQuality==QUALITY_DRAFT?120.0:180.0);
+                               curX += (Real64)((Real64)toMove / unitSize);
+                       }
+                       break;
+               case 0x61: // Select justification (ESC a)
+                       // Ignore
+                       break;
+               case 0x63: // Set horizontal motion index (HMI) (ESC c)
+                       hmi = (Real64)PARAM16(0) / (Real64)360.0;
+                       extraIntraSpace = 0.0;
+                       break;
+               case 0x67: // Select 10.5-point, 15-cpi (ESC g)
+                       cpi = 15;
+                       hmi = -1;
+                       multipoint = false;
+                       updateFont();
+                       break;
+               case 0x6b: // Select typeface (ESC k)
+                       if (params[0] <= 11 || params[0] == 30 || params[0] == 31) 
+                               LQtypeFace = params[0];
+                       updateFont();
+                       break;
+               case 0x6c: // Set left margin (ESC 1)
+                       leftMargin =  (Real64)(params[0]-1.0) / (Real64)cpi;
+                       if (curX < leftMargin)
+                               curX = leftMargin;
+                       break;
+               case 0x70: // Turn proportional mode on/off (ESC p)
+                       if (params[0] == 0 || params[0] == 48)
+                               style &= (0xffff - STYLE_PROP);
+                       if (params[0] == 1 || params[0] == 49)
+                       {
+                               style |= STYLE_PROP;
+                               printQuality = QUALITY_LQ;
+                       }
+                       multipoint = false;
+                       hmi = -1;
+                       updateFont();
+                       break;
+               case 0x72: // Select printing color (ESC r)
+                       if (params[0] != 0)
+                           write_log(L"EPSONPRINTER: Color printing not supported\n");
+                       break;
+               case 0x73: // Select low-speed mode (ESC s)
+                       // Ignore
+                       break;
+               case 0x74: // Select character table (ESC t)
+                       if (params[0] < 4)
+                               curCharTable = params[0];
+                       if (params[0] >= 48 && params[0] <= 51)
+                               curCharTable = params[0] - 48;
+                       selectCodepage(charTables[curCharTable]);
+                       updateFont();
+                       break;
+               case 0x77: // Turn double-height printing on/off (ESC w)
+                       if (!multipoint)
+                       {
+                               if (params[0] == 0 || params[0] == 48)
+                                       style &= 0xFFFF - STYLE_DOUBLEHEIGHT;
+                               if (params[0] == 1 || params[0] == 49)
+                                       style |= STYLE_DOUBLEHEIGHT;
+                               updateFont();
+                       }
+                       break;
+               case 0x78: // Select LQ or draft (ESC x)
+                       if (params[0] == 0 || params[0] == 48)
+                               printQuality = QUALITY_DRAFT;
+                       if (params[0] == 1 || params[0] == 49)
+                               printQuality = QUALITY_LQ;
+                       break;
+               case 0x100: // Set page length in inches (ESC C NUL)
+                       pageHeight = (Real64)params[0];
+                       bottomMargin = pageHeight;
+                       topMargin = 0.0;
+                       break;
+               case 0x101: // Skip unsupported ESC ( command
+                       neededParam = PARAM16(0);
+                       numParam = 0;
+                       break;
+               case 0x228: // Assign character table (ESC (t)
+                       if (params[2] < 4 && params[3] < 16)
+                       {
+                               charTables[params[2]] = codepages[params[3]];
+                               if (params[2] == curCharTable)
+                                       selectCodepage(charTables[curCharTable]);
+                       }
+                       break;
+               case 0x22d: // Select line/score (ESC (-) 
+                       style &= 0xFFFF - STYLE_UNDERLINE - STYLE_STRIKETHROUGH - STYLE_OVERSCORE;
+                       score = params[4];
+                       if (score)
+                       {
+                               if (params[3] == 1)
+                                       style |= STYLE_UNDERLINE;
+                               if (params[3] == 2)
+                                       style |= STYLE_STRIKETHROUGH;
+                               if (params[3] == 3)
+                                       style |= STYLE_OVERSCORE;
+                       }
+                       updateFont();
+                       break;
+               case 0x242: // Bar code setup and print (ESC (B)
+                       write_log(L"EPSONPRINTER: Bardcode printing not supported\n");
+                       // Find out how many bytes to skip
+                       neededParam = PARAM16(0);
+                       numParam = 0;
+                       break;
+               case 0x243: // Set page length in defined unit (ESC (C)
+                       if (params[0] != 0 && definedUnit > 0)
+                       {
+                               pageHeight = bottomMargin = ((Real64)PARAM16(2)) * definedUnit;
+                               topMargin = 0.0;
+                       }
+                       break;
+               case 0x255: // Set unit (ESC (U)
+                       definedUnit = (Real64)3600 / (Real64)params[2];
+                       break;
+               case 0x256: // Set absolute vertical print position (ESC (V)
+                       {
+                               Real64 unitSize = definedUnit;
+                               Real64 newPos;
+                               if (unitSize < 0)
+                                       unitSize = (Real64)360.0;
+                               newPos = topMargin + (((Real64)PARAM16(2)) * unitSize);
+                               if (newPos > bottomMargin)
+                                       newPage(true);
+                               else
+                                       curY = newPos;
+                       }
+                       break;
+               case 0x25e: // Print data as characters (ESC (^)
+                       numPrintAsChar = PARAM16(0);
+                       break;
+               case 0x263: // Set page format (ESC (c)
+                       if (definedUnit > 0)
+                       {
+                               topMargin = ((Real64)PARAM16(2)) * definedUnit;
+                               bottomMargin = ((Real64)PARAM16(4)) * definedUnit;
+                       }
+                       break;
+               case 0x276: // Set relative vertical print position (ESC (v)
+                       {
+                               Real64 unitSize = definedUnit;
+                               Real64 newPos;
+                               if (unitSize < 0)
+                                       unitSize = (Real64)360.0;
+                               newPos = curY + ((Real64)((Bit16s)PARAM16(2)) * unitSize);
+                               if (newPos > topMargin)
+                               {
+                                       if (newPos > bottomMargin)
+                                               newPage(true);
+                                       else
+                                               curY = newPos;  
+                               }
+                       }
+                       break;
+               default:
+                       if (ESCCmd < 0x100)
+                               write_log(L"EPSONPRINTER: Skipped unsupported command ESC %c (%02X)\n", ESCCmd, ESCCmd);
+                       else
+                               write_log(L"EPSONPRINTER: Skipped unsupported command ESC ( %c (%02X)\n", ESCCmd-0x200, ESCCmd-0x200);
+               }
+
+               ESCCmd = 0;
+               return true;
+       }
+
+       switch (ch)
+       {
+       case 0x07:  // Beeper (BEL)
+               // BEEEP!
+               return true;
+       case 0x08:      // Backspace (BS)
+               {
+                       Real64 newX = curX - (1/(Real64)actcpi);
+                       if (hmi > 0)
+                               newX = curX - hmi;
+                       if (newX >= leftMargin)
+                               curX = newX;
+               }
+               return true;
+       case 0x09:      // Tab horizontally (HT)
+               {
+                       // Find tab right to current pos
+                       Real64 moveTo = -1;
+                       Bit8u i;
+                       for (i=0; i<numHorizTabs; i++)
+                               if (horiztabs[i] > curX)
+                                       moveTo = horiztabs[i];
+                       // Nothing found => Ignore
+                       if (moveTo > 0 && moveTo < rightMargin)
+                               curX = moveTo;
+               }
+               return true;
+       case 0x0b:      // Tab vertically (VT)
+               if (numVertTabs == 0) // All tabs cancelled => Act like CR
+                       curX = leftMargin;
+               else if (numVertTabs == 255) // No tabs set since reset => Act like LF
+               {
+                       curX = leftMargin;
+                       curY += lineSpacing;
+                       if (curY > bottomMargin)
+                               newPage(true);
+               }
+               else
+               {
+                       // Find tab below current pos
+                       Real64 moveTo = -1;
+                       Bit8u i;
+                       for (i=0; i<numVertTabs; i++)
+                               if (verttabs[i] > curY)
+                                       moveTo = verttabs[i];
+
+                       // Nothing found => Act like FF
+                       if (moveTo > bottomMargin || moveTo < 0)
+                               newPage(true);
+                       else
+                               curY = moveTo;
+               }
+               if (style & STYLE_DOUBLEWIDTHONELINE)
+               {
+                       style &= 0xFFFF - STYLE_DOUBLEWIDTHONELINE;
+                       updateFont();
+               }
+               return true;
+       case 0x0c:              // Form feed (FF)
+               if (style & STYLE_DOUBLEWIDTHONELINE)
+               {
+                       style &= 0xFFFF - STYLE_DOUBLEWIDTHONELINE;
+                       updateFont();
+               }
+               newPage(true);
+               return true;
+       case 0x0d:              // Carriage Return (CR)
+               curX = leftMargin;
+               if (!autoFeed)
+                       return true;
+       case 0x0a:              // Line feed
+               if (style & STYLE_DOUBLEWIDTHONELINE)
+               {
+                       style &= 0xFFFF - STYLE_DOUBLEWIDTHONELINE;
+                       updateFont();
+               }
+               curX = leftMargin;
+               curY += lineSpacing;
+               if (curY > bottomMargin)
+                       newPage(true);
+               return true;
+       case 0x0e:              //Select Real64-width printing (one line) (SO)
+               if (!multipoint)
+               {
+                       hmi = -1;
+                       style |= STYLE_DOUBLEWIDTHONELINE;
+                       updateFont();
+               }
+               return true;
+       case 0x0f:              // Select condensed printing (SI)
+               if (!multipoint)
+               {
+                       hmi = -1;
+                       style |= STYLE_CONDENSED;
+                       updateFont();
+               }
+               return true;
+       case 0x11:              // Select printer (DC1)
+               // Ignore
+               return true;
+       case 0x12:              // Cancel condensed printing (DC2)
+               hmi = -1;
+               style &= 0xFFFF - STYLE_CONDENSED;
+               updateFont();
+               return true;
+       case 0x13:              // Deselect printer (DC3)
+               // Ignore
+               return true;
+       case 0x14:              // Cancel double-width printing (one line) (DC4)
+               hmi = -1;
+               style &= 0xFFFF - STYLE_DOUBLEWIDTHONELINE;
+               updateFont();
+               return true;
+       case 0x18:              // Cancel line (CAN)
+               return true;
+       case 0x1b:              // ESC
+               ESCSeen = true;
+               return true;
+       default:
+               return false;
+       }
+
+       return false;
+}
+
+
+static void printBitGraph(Bit8u ch)
+{
+    Bitu i;
+    Bitu pixsizeX, pixsizeY;
+    Real64 oldY = curY;
+
+       bitGraph.column[bitGraph.readBytesColumn++] = ch;
+       bitGraph.remBytes--;
+
+       // Only print after reading a full column
+       if (bitGraph.readBytesColumn < bitGraph.bytesColumn)
+               return;
+
+       // When page dpi is greater than graphics dpi, the drawn pixels get "bigger"
+       pixsizeX = dpi/bitGraph.horizDens > 0?dpi/bitGraph.horizDens:1;
+       pixsizeY = dpi/bitGraph.vertDens > 0?dpi/bitGraph.vertDens:1;
+
+       for (i=0; i<bitGraph.bytesColumn; i++)
+       {
+               Bits j;
+               for (j=7; j>=0; j--)
+               {
+                       Bit8u pixel = (bitGraph.column[i] >> j) & 0x01;
+
+                       if (pixel != 0)
+                       {
+                               Bitu xx;
+                               for (xx=0; xx<pixsizeX; xx++) {
+                                       Bitu yy;
+                                       for (yy=0; yy<pixsizeY; yy++)
+                                               if (((PIXX + xx) < page_w) && ((PIXY + yy) < page_h))
+                                                       *((Bit8u*)page + PIXX + xx + (PIXY+yy)*page_pitch) = 255;
+                               }
+                       }
+
+                       curY += (Real64)1/(Real64)bitGraph.vertDens;
+               }
+       }
+
+       curY = oldY;
+
+       bitGraph.readBytesColumn = 0;
+
+       // Advance to the left
+       curX += (Real64)1/(Real64)bitGraph.horizDens;
+}
+
+static void blitGlyph(FT_Bitmap bitmap, Bit16u destx, Bit16u desty, int add)
+{
+       Bitu y, x;
+       for (y=0; y<bitmap.rows; y++)
+       {
+               for (x=0; x<bitmap.width; x++)
+               {
+                       // Read pixel from glyph bitmap
+                       Bit8u* source = bitmap.buffer + x + y*bitmap.pitch;
+
+                       // Ignore background and don't go over the border
+                       if (*source != 0 && (destx+x < page_w) && (desty+y < page_h))
+                       {
+                               Bit8u* target = (Bit8u*)page + (x+destx) + (y+desty)*page_pitch;
+                               if (add)
+                               {
+                                       if (*target + *source > 255)
+                                               *target = 255;
+                                       else
+                                               *target += *source;
+                               }
+                               else
+                                       *target = *source;
+                       }
+               }
+       }
+}
+
+static void drawLine(Bit8u fromx, Bit8u tox, Bit8u y, int broken)
+{
+       Bitu x;
+
+       Bitu breakmod = dpi / 15;
+       Bitu gapstart = (breakmod * 4)/5;
+
+       // Draw anti-aliased line
+       for (x=fromx; x<=tox; x++)
+       {
+               // Skip parts if broken line or going over the border
+               if ((!broken || (x%breakmod <= gapstart)) && (x < page_w))
+               {
+                       if (y > 0 && (y-1) < page_h)
+                               *((Bit8u*)page + x + (y-1)*page_pitch) = 120;
+                       if (y < page_h)
+                               *((Bit8u*)page + x + y*page_pitch) = !broken?255:120;
+                       if (y+1 < page_h)
+                               *((Bit8u*)page + x + (y+1)*page_pitch) = 120;
+               }
+       }
+}
+
+static void printChar(Bit8u ch)
+{
+       FT_UInt index;
+       Bit16u penX;
+       Bit16u penY;
+       Bit16u lineStart;
+
+       charRead = true;
+
+       if (page == NULL)
+               return;
+
+       // Don't think that DOS programs uses this but well: Apply MSB if desired
+       if (msb != 255)
+       {
+               if (msb == 0)
+                       ch &= 0x7F;
+               if (msb == 1)
+                       ch |= 0x80;
+       }
+
+       // Are we currently printing a bit graphic?
+       if (bitGraph.remBytes > 0)
+       {
+               printBitGraph(ch);
+               return;
+       }
+
+       // Print everything?
+       if (numPrintAsChar > 0)
+               numPrintAsChar--;
+       else if (processCommandChar(ch))
+               return;
+
+       // Do not print if no font is available
+       if (!curFont)
+               return;
+
+       // Find the glyph for the char to render
+       index = FT_Get_Char_Index(curFont, curMap[ch]);
+       
+       // Load the glyph 
+       FT_Load_Glyph(curFont, index, FT_LOAD_DEFAULT);
+
+       // Render a high-quality bitmap
+       FT_Render_Glyph(curFont->glyph, FT_RENDER_MODE_NORMAL);
+
+       penX = PIXX + curFont->glyph->bitmap_left;
+       penY = PIXY - curFont->glyph->bitmap_top + curFont->size->metrics.ascender/64;
+
+       if (style & STYLE_SUBSCRIPT)
+               penY += curFont->glyph->bitmap.rows / 2;
+
+       // Copy bitmap into page
+
+       blitGlyph(curFont->glyph->bitmap, penX, penY, false);
+
+       // Doublestrike => Print the glyph a second time one pixel below
+       if (style & STYLE_DOUBLESTRIKE)
+               blitGlyph(curFont->glyph->bitmap, penX, penY+1, true);
+
+       // Bold => Print the glyph a second time one pixel to the right
+       if (style & STYLE_BOLD)
+               blitGlyph(curFont->glyph->bitmap, penX+1, penY, true);
+
+       // For line printing
+       lineStart = PIXX;
+
+       if (style & STYLE_PROP)
+               curX += (Real64)((Real64)(curFont->glyph->advance.x)/(Real64)(dpi*64));
+       else
+       {
+               if (hmi < 0)
+                       curX += 1/(Real64)actcpi;
+               else
+                       curX += hmi;
+       }
+
+       curX += extraIntraSpace;
+
+       // Draw lines if desired
+       if (score != SCORE_NONE && (style & (STYLE_UNDERLINE|STYLE_STRIKETHROUGH|STYLE_OVERSCORE)))
+       {
+               // Find out where to put the line
+               Bit16u lineY = PIXY;
+
+               if (style & STYLE_UNDERLINE)
+                       lineY = penY + 5 + curFont->glyph->bitmap.rows;
+               if (style & STYLE_STRIKETHROUGH)
+                       lineY = PIXY + curFont->size->metrics.ascender/128;
+               if (style & STYLE_OVERSCORE)
+                       lineY = PIXY - ((score == SCORE_DOUBLE || score == SCORE_DOUBLEBROKEN)?5:0);
+
+               drawLine(penX, PIXX, lineY, score==SCORE_SINGLEBROKEN || score==SCORE_DOUBLEBROKEN);
+
+               if (score == SCORE_DOUBLE || score == SCORE_DOUBLEBROKEN)
+                       drawLine(lineStart, PIXX, lineY + 5, score==SCORE_SINGLEBROKEN || score==SCORE_DOUBLEBROKEN);
+       }
+}
+
+static int isBlank(void)
+{
+       Bit16u x, y;
+       int blank = true;
+
+       for (y=0; y<page_h; y++)
+               for (x=0; x<page_w; x++)
+                       if (*((Bit8u*)page + x + (y*page_pitch)) != 0)
+                               blank = false;
+
+       return blank;
+}
+
+static int epson_ft (void)
+{
+    if (!ft)
+        ft = WIN32_LoadLibrary (L"freetype6.dll");
+    if (!ft) {
+        write_log (L"EPSONPRINTER: freetype6.dll not found. Text output disabled.");
+       return 0;
+    }
+    return 1;
+}
+
+
+void epson_printchar(uae_u8 c)
+{
+    printChar (c);
+}
+int epson_init(void)
+{
+    epson_ft ();
+    write_log (L"EPSONPRINTER: start\n");
+    return printer_init(300, 83, 117, L"png", 0);
+}
+void epson_close(void)
+{
+    if (page && !isBlank ()) {
+        outputPage();
+    }
+    printer_close();
+}
diff --git a/filesys b/filesys
deleted file mode 100644 (file)
index 847c5e1..0000000
Binary files a/filesys and /dev/null differ
index ad5ccd36cfce79810faa05b9cf97a898bbd6822e..0217f2845012b463b750fcd9977b743d235533ee 100644 (file)
@@ -29,10 +29,11 @@ extern void audio_evhandler (void);
 extern void audio_hsync (int);
 extern void audio_update_adkmasks (void);
 extern void audio_update_irq (uae_u16);
-extern void update_sound (int freq);
+extern void update_sound (int freq, int longframe);
 extern void led_filter_audio (void);
 extern void set_audio (void);
 extern int audio_activate (void);
+extern void audio_vsync (void);
 
 extern void audio_sampleripper(int);
 extern int sampleripper_enabled;
diff --git a/include/epsonprinter.h b/include/epsonprinter.h
new file mode 100644 (file)
index 0000000..880f331
--- /dev/null
@@ -0,0 +1,81 @@
+/*
+ *  Copyright (C) 2002-2004  The DOSBox Team
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU Library General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ */
+
+#define Bit16u uae_u16
+#define Bit16s uae_s16
+#define Bit8u uae_u8
+#define Real64 float
+#define Bitu uae_u32
+#define Bits uae_s32
+#define Bit32u uae_u32
+
+#if !defined __PRINTER_H
+#define __PRINTER_H
+
+#include "ft2build.h"
+#include FT_FREETYPE_H
+
+#if defined (WIN32)
+#include <windows.h>
+#include <winspool.h>
+#endif
+
+#define STYLE_PROP 0x01
+#define STYLE_CONDENSED 0x02
+#define STYLE_BOLD 0x04
+#define STYLE_DOUBLESTRIKE 0x08
+#define STYLE_DOUBLEWIDTH 0x10
+#define STYLE_ITALICS 0x20
+#define STYLE_UNDERLINE 0x40
+#define STYLE_SUPERSCRIPT 0x80
+#define STYLE_SUBSCRIPT 0x100
+#define STYLE_STRIKETHROUGH 0x200
+#define STYLE_OVERSCORE 0x400
+#define STYLE_DOUBLEWIDTHONELINE 0x800
+#define STYLE_DOUBLEHEIGHT 0x1000
+
+#define SCORE_NONE 0x00
+#define SCORE_SINGLE 0x01
+#define SCORE_DOUBLE 0x02
+#define SCORE_SINGLEBROKEN 0x05
+#define SCORE_DOUBLEBROKEN 0x06
+
+#define QUALITY_DRAFT 0x01
+#define QUALITY_LQ 0x02
+
+enum Typeface
+{
+       roman = 0,
+       sansserif,
+       courier,
+       prestige,
+       script,
+       ocrb,
+       ocra,
+       orator,
+       orators,
+       scriptc,
+       romant,
+       sansserifh,
+       svbusaba = 30,
+       svjittra = 31
+};
+
+
+
+#endif
index 21849d86180f32863f0a9d92e9f88a6c89f129cd..fc62616d56c0a7273c11683c7ad17c53b14fd5b2 100644 (file)
@@ -26,7 +26,6 @@ extern void init_eventtab (void);
 extern void do_cycles_ce (long cycles);
 
 extern unsigned long currcycle, nextevent, is_lastline;
-extern unsigned long sample_evtime;
 typedef void (*evfunc)(void);
 typedef void (*evfunc2)(uae_u32);
 
index 1723ca67b6825ca661df31f08b85545ef50add61..2d79c2edb5bd2d879585adc441e35740830be7eb 100644 (file)
@@ -11,10 +11,8 @@ extern int sound_available;
 
 extern void (*sample_handler) (void);
 /* sample_evtime is in normal Amiga cycles; scaled_sample_evtime is in our
-   event cycles.  scaled_sample_evtime_ok is set to 1 by init_sound if the
-   port understands scaled_sample_evtime and set it to something sensible.  */
-extern unsigned long sample_evtime, scaled_sample_evtime;
-extern int scaled_sample_evtime_ok;
+   event cycles. */
+extern float sample_evtime, scaled_sample_evtime;
 
 /* Determine if we can produce any sound at all.  This can be only a guess;
  * if unsure, say yes.  Any call to init_sound may change the value.  */
@@ -33,7 +31,4 @@ extern void sample16ss_handler (void);
 extern void sample16si_rh_handler (void);
 extern void sample16si_crux_handler (void);
 extern void sample8s_handler (void);
-extern void sample_ulaw_handler (void);
-extern void init_sound_table16 (void);
-extern void init_sound_table8 (void);
 
index 2c396c4ea9aa18d058e96f20774693261260c3e2..a109f632d727c4e2b9f0936b44667ba3cb979df1 100644 (file)
@@ -107,7 +107,7 @@ struct uae_prefs {
     int serial_hwctsrts;
     int serial_direct;
     int parallel_demand;
-    int parallel_ascii_emulation;
+    int parallel_matrix_emulation;
     int parallel_postscript_emulation;
     int parallel_postscript_detection;
     int parallel_autoflush_time;
@@ -416,7 +416,7 @@ extern int target_cfgfile_load (struct uae_prefs *, TCHAR *filename, int type, i
 extern void target_quit (void);
 extern void cfgfile_save_options (struct zfile *f, struct uae_prefs *p, int type);
 
-extern int cfgfile_load (struct uae_prefs *p, const TCHAR *filename, int *type, int ignorelink);
+extern int cfgfile_load (struct uae_prefs *p, const TCHAR *filename, int *type, int ignorelink, int userconfig);
 extern int cfgfile_save (struct uae_prefs *p, const TCHAR *filename, int);
 extern void cfgfile_parse_line (struct uae_prefs *p, TCHAR *, int);
 extern int cfgfile_parse_option (struct uae_prefs *p, TCHAR *option, TCHAR *value, int);
diff --git a/include/sysconfig.h.win32 b/include/sysconfig.h.win32
deleted file mode 100644 (file)
index 85eb0b6..0000000
+++ /dev/null
@@ -1,42 +0,0 @@
-/* The number of bytes in a char.  */
-#define SIZEOF_CHAR 1
-
-/* The number of bytes in a int.  */
-#define SIZEOF_INT 4
-
-/* The number of bytes in a long.  */
-#define SIZEOF_LONG 4
-
-#ifdef __GNUC__
-/* The number of bytes in a long long.  */
-#define SIZEOF_LONG_LONG 8
-#define SIZEOF___INT64 0
-#else
-#define SIZEOF_LONG_LONG 0
-#define SIZEOF___INT64 8
-#endif
-
-/* The number of bytes in a short.  */
-#define SIZEOF_SHORT 2
-
-/* Define if you have the <fcntl.h> header file.  */
-#define HAVE_FCNTL_H 1
-
-/* Define if you have the <string.h> header file.  */
-#define HAVE_STRING_H 1
-
-/* Define if you have the <sys/stat.h> header file.  */
-#define HAVE_SYS_STAT_H 1
-
-/* Define if you have the <sys/types.h> header file.  */
-#define HAVE_SYS_TYPES_H 1
-
-// Windows-specific #defines
-#ifndef __GNUC__
-#define REGPARAM
-#define REGPARAM2
-#define __inline__ __inline
-#define __asm__(a) ;
-#define O_NDELAY 0
-#endif
-#define lseek _lseek
diff --git a/include/tui.h b/include/tui.h
deleted file mode 100644 (file)
index d5c5f3b..0000000
+++ /dev/null
@@ -1,39 +0,0 @@
- /*
-  * UAE - The Un*x Amiga Emulator
-  *
-  * Text-based user interface
-  * Sie haben es sich verdient!
-  *
-  * Copyright 1996 Tim Gunn, Bernd Schmidt
-  */
-
-extern void tui_setup(void);
-extern void tui_shutdown(void);
-extern void tui_refresh(void);
-
-extern void tui_curson(void);
-extern void tui_cursoff(void);
-
-extern void tui_cr(void);
-extern void tui_gotoxy(int, int);
-extern void tui_puts(const char *);
-extern void tui_putc(char);
-extern char tui_getc(void);
-extern int tui_gets(char *, int, int, int);
-extern int tui_wgets(char *, const char *, int);
-extern void tui_clrwin(int);
-extern void tui_selwin(int);
-
-extern int tui_dlog(int, int, int, int);
-extern int tui_menubrowse(struct bstring *, int, int, int, int);
-
-extern void tui_dlogdie(int);
-extern char *tui_filereq(char *, char *, const char *);
-extern void tui_drawbox(int);
-extern void tui_hline(int, int, int);
-extern void tui_errorbox(const char *);
-
-extern int tui_cols(void);
-extern int tui_lines(void);
-
-extern int tui_backup_optionsfile(void);
diff --git a/main.c b/main.c
index b2add800ae8d2301787243827e4ddedb7c9d919a..88dd7b33d1f18d3067169fbb4d9f36130239f18d 100644 (file)
--- a/main.c
+++ b/main.c
@@ -392,6 +392,7 @@ void fixup_prefs (struct uae_prefs *p)
 int quit_program = 0;
 static int restart_program;
 static TCHAR restart_config[MAX_DPATH];
+static int default_config;
 
 void uae_reset (int hardreset)
 {
@@ -417,6 +418,7 @@ void uae_restart (int opengui, TCHAR *cfgfile)
     uae_quit ();
     restart_program = opengui > 0 ? 1 : (opengui == 0 ? 2 : 3);
     restart_config[0] = 0;
+    default_config = 0;
     if (cfgfile)
        _tcscpy (restart_config, cfgfile);
 }
@@ -555,7 +557,7 @@ static void parse_cmdline_and_init_file (int argc, TCHAR **argv)
 
     _tcscat (optionsfile, restart_config);
 
-    if (! target_cfgfile_load (&currprefs, optionsfile, 0, 0)) {
+    if (! target_cfgfile_load (&currprefs, optionsfile, 0, default_config)) {
        write_log (L"failed to load config '%s'\n", optionsfile);
 #ifdef OPTIONS_IN_HOME
        /* sam: if not found in $HOME then look in current directory */
@@ -839,8 +841,11 @@ static int real_main2 (int argc, TCHAR **argv)
 void real_main (int argc, TCHAR **argv)
 {
     restart_program = 1;
+
     fetch_configurationpath (restart_config, sizeof (restart_config) / sizeof (TCHAR));
     _tcscat (restart_config, OPTIONSFILENAME);
+    default_config = 1;
+
     while (restart_program) {
        int ret;
        changed_prefs = currprefs;
diff --git a/ncurses.c b/ncurses.c
deleted file mode 100644 (file)
index 0375627..0000000
--- a/ncurses.c
+++ /dev/null
@@ -1,680 +0,0 @@
- /*
-  * UAE - The Un*x Amiga Emulator
-  *
-  * [n]curses output.
-  *
-  * There are 17 color modes:
-  *  -H0/-H1 are black/white output
-  *  -H2 through -H16 give you different color allocation strategies. On my
-  *    system, -H14 seems to give nice results.
-  *
-  * Copyright 1997 Samuel Devulder, Bernd Schmidt
-  */
-
-/****************************************************************************/
-
-#include "sysconfig.h"
-#include "sysdeps.h"
-
-#include <ctype.h>
-#include <signal.h>
-
-/****************************************************************************/
-
-#include "config.h"
-#include "options.h"
-#include "threaddep/thread.h"
-#include "uae.h"
-#include "memory.h"
-#include "custom.h"
-#include "newcpu.h"
-#include "xwin.h"
-#include "keyboard.h"
-#include "keybuf.h"
-#include "disk.h"
-#include "debug.h"
-#include "gui.h"
-
-#ifdef HAVE_NCURSES_H
-#include <ncurses.h>
-#else
-#include <curses.h>
-#endif
-
-/****************************************************************************/
-
-#define MAXGRAYCHAR 128
-
-enum {
-    MYCOLOR_BLACK, MYCOLOR_RED, MYCOLOR_GREEN, MYCOLOR_BLUE,
-    MYCOLOR_YELLOW, MYCOLOR_CYAN, MYCOLOR_MAGENTA, MYCOLOR_WHITE
-};
-
-static int mycolor2curses_map [] = {
-    COLOR_BLACK, COLOR_RED, COLOR_GREEN, COLOR_BLUE,
-    COLOR_YELLOW, COLOR_CYAN, COLOR_MAGENTA, COLOR_WHITE
-};
-
-static int mycolor2pair_map[] = { 1,2,3,4,5,6,7,8 };
-
-static chtype graychar[MAXGRAYCHAR];
-static int maxc,max_graychar;
-static int curses_on;
-
-static int *x2graymap;
-
-/* Keyboard and mouse */
-
-static int keystate[256];
-static int keydelay = 20;
-
-static void curses_exit(void);
-
-/****************************************************************************/
-
-static RETSIGTYPE sigbrkhandler(int foo)
-{
-    curses_exit();
-    activate_debugger();
-}
-
-void setup_brkhandler(void)
-{
-    struct sigaction sa;
-    sa.sa_handler = sigbrkhandler;
-    sa.sa_flags = 0;
-    sa.sa_flags = SA_RESTART;
-    sigemptyset(&sa.sa_mask);
-    sigaction(SIGINT, &sa, NULL);
-}
-
-/***************************************************************************/
-
-static void curses_insert_disk(void)
-{
-    curses_exit();
-    gui_changesettings();
-    flush_screen(0,0);
-}
-
-/****************************************************************************/
-
-/*
- * old:        fmt = " .,:=(Io^vM^vb*X^#M^vX*boI(=:. ^b^vobX^#M" doesn't work: "^vXb*oI(=:. ";
- * good:       fmt = " .':;=(IoJpgFPEB#^vgpJoI(=;:'. ^v^b=(IoJpgFPEB";
- *
- *     fmt = " .,:=(Io*b^vM^vX^#M^vXb*oI(=:. ";
- */
-
-static void init_graychar(void)
-{
-    chtype *p = graychar;
-    chtype attrs;
-    int i,j;
-    char *fmt;
-
-    attrs = termattrs();
-    if ((currprefs.color_mode & 1) == 0 && (attrs & (A_REVERSE | A_BOLD)))
-       fmt = " .':;=(IoJpgFPEB#^vgpJoI(=;:'. ^v^boJpgFPEB";
-    else if ((currprefs.color_mode & 1) == 0 && (attrs & A_REVERSE))
-       fmt = " .':;=(IoJpgFPEB#^vgpJoI(=;:'. ";
-    else
-       /* One could find a better pattern.. */
-       fmt = " .`'^^\",:;i!1Il+=tfjxznuvyZYXHUOQ0MWB";
-    attrs = A_NORMAL | COLOR_PAIR (0);
-    while(*fmt) {
-       if(*fmt == '^') {
-           ++fmt;
-           switch(*fmt) {
-               case 's': case 'S': attrs ^= A_STANDOUT; break;
-               case 'v': case 'V': attrs ^= A_REVERSE; break;
-               case 'b': case 'B': attrs ^= A_BOLD; break;
-               case 'd': case 'D': attrs ^= A_DIM; break;
-               case 'u': case 'U': attrs ^= A_UNDERLINE; break;
-               case 'p': case 'P': attrs  = A_NORMAL; break;
-               case '#': if(ACS_CKBOARD == ':')
-                              *p++ = (attrs | '#');
-                         else *p++ = (attrs | ACS_CKBOARD); break;
-               default:  *p++ = (attrs | *fmt); break;
-           }
-           ++fmt;
-       } else *p++ = (attrs | *fmt++);
-       if(p >= graychar + MAXGRAYCHAR) break;
-    }
-    max_graychar = (p - graychar) - 1;
-
-    for (i = 0; i <= maxc; i++)
-       x2graymap[i] = i * max_graychar / maxc;
-#if 0
-    for(j=0;j<LINES;++j) {
-       move(j,0);
-       for(i=0;i<COLS;++i) addch(graychar[i % (max_graychar+1)]);
-    }
-    refresh();
-    sleep(3);
-#endif
-}
-
-static int x_map[900], y_map[700], y_rev_map [700];
-
-
-/****************************************************************************/
-
-static void init_colors(void)
-{
-    int i;
-
-    maxc = 0;
-
-    for(i = 0; i < 4096; ++i) {
-       int r,g,b,r1,g1,b1;
-       int m, comp;
-       int ctype;
-
-       r =  i >> 8;
-       g = (i >> 4) & 15;
-       b =  i & 15;
-
-       xcolors[i] = (77 * r + 151 * g + 28 * b)/16;
-       if(xcolors[i] > maxc)
-           maxc = xcolors[i];
-       m = r;
-       if (g > m)
-           m = g;
-       if (b > m)
-           m = b;
-       if (m == 0) {
-           xcolors[i] |= MYCOLOR_WHITE << 8; /* to get gray instead of black in dark areas */
-           continue;
-       }
-
-       if ((currprefs.color_mode & ~1) != 0) {
-           r1 = r*15 / m;
-           g1 = g*15 / m;
-           b1 = b*15 / m;
-
-           comp = 8;
-           for (;;) {
-               if (b1 < comp) {
-                   if (r1 < comp)
-                       ctype = MYCOLOR_GREEN;
-                   else if (g1 < comp)
-                       ctype = MYCOLOR_RED;
-                   else
-                       ctype = MYCOLOR_YELLOW;
-               } else {
-                   if (r1 < comp) {
-                       if (g1 < comp)
-                           ctype = MYCOLOR_BLUE;
-                       else
-                           ctype = MYCOLOR_CYAN;
-                   } else if (g1 < comp)
-                           ctype = MYCOLOR_MAGENTA;
-                   else {
-                       comp += 4;
-                       if (comp == 12 && (currprefs.color_mode & 2) != 0)
-                           continue;
-                       ctype = MYCOLOR_WHITE;
-                   }
-               }
-               break;
-           }
-           if (currprefs.color_mode & 8) {
-               if (ctype == MYCOLOR_BLUE && xcolors[i] > /*27*/50)
-                   ctype = r1 > (g1+2) ? MYCOLOR_MAGENTA : MYCOLOR_CYAN;
-               if (ctype == MYCOLOR_RED && xcolors[i] > /*75*/ 90)
-                   ctype = b1 > (g1+6) ? MYCOLOR_MAGENTA : MYCOLOR_YELLOW;
-           }
-           xcolors[i] |= ctype << 8;
-       }
-    }
-    if (currprefs.color_mode & 4) {
-       int j;
-       for (j = MYCOLOR_RED; j < MYCOLOR_WHITE; j++) {
-           int best = 0, maxv = 0;
-           int multi, divi;
-
-           for (i = 0; i < 4096; i++)
-               if ((xcolors[i] & 255) > maxv && (xcolors[i] >> 8) == j) {
-                   best = i;
-                   maxv = (xcolors[best] & 255);
-               }
-           /* Now maxv is the highest intensity a color of type J is supposed to have.
-            * In  reality, it will most likely only have intensity maxv*multi/divi.
-            * We try to correct this. */
-           maxv = maxv * 256 / maxc;
-
-           divi = 256;
-           switch (j) {
-            case MYCOLOR_RED:     multi = 77; break;
-            case MYCOLOR_GREEN:   multi = 151; break;
-            case MYCOLOR_BLUE:    multi = 28; break;
-            case MYCOLOR_YELLOW:  multi = 228; break;
-            case MYCOLOR_CYAN:    multi = 179; break;
-            case MYCOLOR_MAGENTA: multi = 105; break;
-            default: abort();
-           }
-#if 1 /* This makes the correction less extreme */
-           if (! (currprefs.color_mode & 8))
-               multi = (multi + maxv) / 2;
-#endif
-           for (i = 0; i < 4096; i++) {
-               int v = xcolors[i];
-               if ((v >> 8) != j)
-                   continue;
-               v &= 255;
-               /* I don't think either of these is completely correct, but
-                * the first one produces rather good results. */
-#if 1
-               v = v * divi / multi;
-               if (v > maxc)
-                   v = maxc;
-#else
-               v = v * 256 / maxv);
-               if (v > maxc)
-                   /*maxc = v*/abort();
-#endif
-               xcolors[i] = v | (j << 8);
-           }
-       }
-    }
-    x2graymap = (int *)malloc(sizeof(int) * (maxc+1));
-}
-
-static void curses_init(void)
-{
-    initscr ();
-
-    start_color ();
-    if (! has_colors () || COLOR_PAIRS < 20 /* whatever */)
-       currprefs.color_mode &= 1;
-    else {
-       init_pair (1, COLOR_BLACK, COLOR_BLACK);
-       init_pair (2, COLOR_RED, COLOR_BLACK);
-       init_pair (3, COLOR_GREEN, COLOR_BLACK);
-       init_pair (4, COLOR_BLUE, COLOR_BLACK);
-       init_pair (5, COLOR_YELLOW, COLOR_BLACK);
-       init_pair (6, COLOR_CYAN, COLOR_BLACK);
-       init_pair (7, COLOR_MAGENTA, COLOR_BLACK);
-       init_pair (8, COLOR_WHITE, COLOR_BLACK);
-    }
-    printf ("curses_init: %d pairs available\n", COLOR_PAIRS);
-
-    cbreak(); noecho();
-    nonl (); intrflush(stdscr, FALSE); keypad(stdscr, TRUE);
-    nodelay(stdscr, TRUE);
-    leaveok(stdscr, TRUE);
-
-    attron (A_NORMAL | COLOR_PAIR (0));
-    bkgd(' '|COLOR_PAIR(0));
-
-#ifdef NCURSES_MOUSE_VERSION
-    mousemask(BUTTON1_PRESSED | BUTTON1_RELEASED |
-             BUTTON2_PRESSED | BUTTON2_RELEASED |
-             BUTTON3_PRESSED | BUTTON3_RELEASED |
-             REPORT_MOUSE_POSITION, NULL);
-#endif
-
-    init_graychar();
-    curses_on = 1;
-}
-
-static void curses_exit(void)
-{
-#ifdef NCURSES_MOUSE_VERSION
-    mousemask(0, NULL);
-#endif
-
-    nocbreak(); echo(); nl(); intrflush(stdscr, TRUE);
-    keypad(stdscr, FALSE); nodelay(stdscr, FALSE); leaveok(stdscr, FALSE);
-    endwin();
-    curses_on = 0;
-}
-
-/****************************************************************************/
-
-static int getgraycol(int x, int y)
-{
-    uae_u8 *bufpt;
-    int xs, xl, ys, yl, c, cm;
-
-    xl = x_map[x+1] - (xs = x_map[x]);
-    yl = y_map[y+1] - (ys = y_map[y]);
-
-    bufpt = ((uae_u8 *)gfxvidinfo.bufmem) + ys*currprefs.gfx_width + xs;
-
-    cm = c = 0;
-    for(y = 0; y < yl; y++, bufpt += currprefs.gfx_width)
-       for(x = 0; x < xl; x++) {
-           c += bufpt[x];
-           ++cm;
-       }
-    if (cm)
-       c /= cm;
-    if (! currprefs.curses_reverse_video)
-       c = maxc - c;
-    return graychar[x2graymap[c]];
-}
-
-static int getcol(int x, int y)
-{
-    uae_u16 *bufpt;
-    int xs, xl, ys, yl, c, cm;
-    int bestcol = MYCOLOR_BLACK, bestccnt = 0;
-    unsigned char colcnt [8];
-
-    memset (colcnt, 0 , sizeof colcnt);
-
-    xl = x_map[x+1] - (xs = x_map[x]);
-    yl = y_map[y+1] - (ys = y_map[y]);
-
-    bufpt = ((uae_u16 *)gfxvidinfo.bufmem) + ys*currprefs.gfx_width + xs;
-
-    cm = c = 0;
-    for(y = 0; y < yl; y++, bufpt += currprefs.gfx_width)
-       for(x = 0; x < xl; x++) {
-           int v = bufpt[x];
-           int cnt;
-
-           c += v & 0xFF;
-           cnt = ++colcnt[v >> 8];
-           if (cnt > bestccnt) {
-               bestccnt = cnt;
-               bestcol = v >> 8;
-           }
-           ++cm;
-       }
-    if (cm)
-       c /= cm;
-    if (! currprefs.curses_reverse_video)
-       c = maxc - c;
-    return (graychar[x2graymap[c]] & ~A_COLOR) | COLOR_PAIR (mycolor2pair_map[bestcol]);
-}
-
-static void flush_line_txt(int y)
-{
-    int x;
-    move (y,0);
-    if (currprefs.color_mode < 2)
-       for (x = 0; x < COLS; ++x) {
-           int c;
-
-           c = getgraycol(x,y);
-           addch(c);
-       }
-    else
-       for (x = 0; x < COLS; ++x) {
-           int c;
-
-           c = getcol(x,y);
-           addch(c);
-       }
-}
-
-__inline__ void flush_line(int y)
-{
-    if(y < 0 || y >= currprefs.gfx_height) {
-/*       printf("flush_line out of window: %d\n", y); */
-       return;
-    }
-    if(!curses_on)
-       return;
-    flush_line_txt(y_rev_map[y]);
-}
-
-void flush_block (int ystart, int ystop)
-{
-    int y;
-    if(!curses_on)
-       return;
-    ystart = y_rev_map[ystart];
-    ystop  = y_rev_map[ystop];
-    for(y = ystart; y <= ystop; ++y)
-       flush_line_txt(y);
-}
-
-void flush_screen (int ystart, int ystop)
-{
-    if(!debugging && !curses_on) {
-       curses_init();
-       flush_block(0, currprefs.gfx_height - 1);
-    }
-    refresh();
-}
-
-/****************************************************************************/
-
-struct bstring *video_mode_menu = NULL;
-
-void vidmode_menu_selected(int a)
-{
-}
-
-int graphics_setup(void)
-{
-    return 1;
-}
-
-int graphics_init(void)
-{
-    int i;
-
-    if (currprefs.color_mode > 16)
-       write_log ("Bad color mode selected. Using default.\n"), currprefs.color_mode = 0;
-
-    init_colors();
-
-    curses_init();
-    write_log("Using %s.\n",longname());
-
-    if (debugging)
-       curses_exit ();
-
-    /* we have a 320x256x8 pseudo screen */
-
-    currprefs.gfx_width = 320;
-    currprefs.gfx_height = 256;
-    currprefs.gfx_lores = 1;
-
-    gfxvidinfo.width = currprefs.gfx_width;
-    gfxvidinfo.height = currprefs.gfx_height;
-    gfxvidinfo.maxblocklines = 1000;
-    gfxvidinfo.pixbytes = currprefs.color_mode < 2 ? 1 : 2;
-    gfxvidinfo.rowbytes = gfxvidinfo.pixbytes * currprefs.gfx_width;
-    gfxvidinfo.bufmem = (char *)calloc(gfxvidinfo.rowbytes, currprefs.gfx_height+1);
-    gfxvidinfo.linemem = 0;
-    gfxvidinfo.emergmem = 0;
-    gfxvidinfo.can_double = 0;
-    switch (gfxvidinfo.pixbytes) {
-     case 1:
-       for (i = 0; i < 4096; i++)
-           xcolors[i] = xcolors[i] * 0x01010101;
-       gfxvidinfo.can_double = 1;
-       break;
-     case 2:
-       for (i = 0; i < 4096; i++)
-           xcolors[i] = xcolors[i] * 0x00010001;
-       gfxvidinfo.can_double = 1;
-       break;
-    }
-    if(!gfxvidinfo.bufmem) {
-       write_log("Not enough memory.\n");
-       return 0;
-    }
-
-    for (i = 0; i < sizeof x_map / sizeof *x_map; i++)
-       x_map[i] = (i * currprefs.gfx_width) / COLS;
-    for (i = 0; i < sizeof y_map / sizeof *y_map; i++)
-       y_map[i] = (i * currprefs.gfx_height) / LINES;
-    for (i = 0; i < sizeof y_map / sizeof *y_map - 1; i++) {
-       int l1 = y_map[i];
-       int l2 = y_map[i+1];
-       int j;
-       if (l2 >= sizeof y_rev_map / sizeof *y_rev_map)
-           break;
-       for (j = l1; j < l2; j++)
-           y_rev_map[j] = i;
-    }
-
-    buttonstate[0] = buttonstate[1] = buttonstate[2] = 0;
-    for(i=0; i<256; i++)
-       keystate[i] = 0;
-
-    lastmx = lastmy = 0;
-    newmousecounters = 0;
-
-    return 1;
-}
-
-/****************************************************************************/
-
-void graphics_leave(void)
-{
-    curses_exit();
-}
-
-/****************************************************************************/
-
-static int keycode2amiga(int ch)
-{
-    switch(ch) {
-       case KEY_A1:    return AK_NP7;
-       case KEY_UP:    return AK_NP8;
-       case KEY_A3:    return AK_NP9;
-       case KEY_LEFT:  return AK_NP4;
-       case KEY_B2:    return AK_NP5;
-       case KEY_RIGHT: return AK_NP6;
-       case KEY_C1:    return AK_NP1;
-       case KEY_DOWN:  return AK_NP2;
-       case KEY_C3:    return AK_NP3;
-       case KEY_ENTER: return AK_ENT;
-       case 13:        return AK_RET;
-       case ' ':       return AK_SPC;
-       case 27:        return AK_ESC;
-       default: return -1;
-    }
-}
-
-/***************************************************************************/
-
-void handle_events(void)
-{
-    int ch;
-    int kc;
-
-    /* Hack to simulate key release */
-    for(kc = 0; kc < 256; ++kc) {
-       if(keystate[kc]) if(!--keystate[kc]) record_key((kc << 1) | 1);
-    }
-    if(buttonstate[0]) --buttonstate[0];
-    if(buttonstate[1]) --buttonstate[1];
-    if(buttonstate[2]) --buttonstate[2];
-
-    newmousecounters = 0;
-    if(!curses_on) return;
-
-    while((ch = getch())!=ERR) {
-       if(ch == 12) {clearok(stdscr,TRUE);refresh();}
-#ifdef NCURSES_MOUSE_VERSION
-       if(ch == KEY_MOUSE) {
-           MEVENT ev;
-           if(getmouse(&ev) == OK) {
-               lastmx = (ev.x*currprefs.gfx_width)/COLS;
-               lastmy = (ev.y*currprefs.gfx_height)/LINES;
-               if(ev.bstate & BUTTON1_PRESSED)  buttonstate[0] = keydelay;
-               if(ev.bstate & BUTTON1_RELEASED) buttonstate[0] = 0;
-               if(ev.bstate & BUTTON2_PRESSED)  buttonstate[1] = keydelay;
-               if(ev.bstate & BUTTON2_RELEASED) buttonstate[1] = 0;
-               if(ev.bstate & BUTTON3_PRESSED)  buttonstate[2] = keydelay;
-               if(ev.bstate & BUTTON3_RELEASED) buttonstate[2] = 0;
-           }
-       }
-#endif
-       if (ch == 6)  ++lastmx; /* ^F */
-       if (ch == 2)  --lastmx; /* ^B */
-       if (ch == 14) ++lastmy; /* ^N */
-       if (ch == 16) --lastmy; /* ^P */
-       if (ch == 11) {buttonstate[0] = keydelay;ch = 0;} /* ^K */
-       if (ch == 25) {buttonstate[2] = keydelay;ch = 0;} /* ^Y */
-       if (ch == 15) uae_reset (); /* ^O */
-       if (ch == 17) uae_quit (); /* ^Q */
-       if (ch == KEY_F(1)) {
-         curses_insert_disk();
-         ch = 0;
-       }
-
-       if(isupper(ch)) {
-           keystate[AK_LSH] =
-           keystate[AK_RSH] = keydelay;
-           record_key(AK_LSH << 1);
-           record_key(AK_RSH << 1);
-           kc = keycode2amiga(tolower(ch));
-           keystate[kc] = keydelay;
-           record_key(kc << 1);
-       } else if((kc = keycode2amiga(ch)) >= 0) {
-           keystate[kc] = keydelay;
-           record_key(kc << 1);
-       }
-    }
-    gui_handle_events();
-}
-
-/***************************************************************************/
-
-void target_specific_usage(void)
-{
-    printf("----------------------------------------------------------------------------\n");
-    printf("[n]curses specific usage:\n");
-    printf("  -x : Display reverse video.\n");
-    printf("By default uae will assume a black on white display. If yours\n");
-    printf("is light on dark, use -x. In case of graphics garbage, ^L will\n");
-    printf("redisplay the screen. ^K simulate left mouse button, ^Y RMB.\n");
-    printf("If you are using a xterm UAE can use the mouse. Else use ^F ^B\n");
-    printf("^P ^N to emulate mouse mouvements.\n");
-    printf("----------------------------------------------------------------------------\n");
-}
-
-/***************************************************************************/
-
-int check_prefs_changed_gfx (void)
-{
-    return 0;
-}
-
-int debuggable(void)
-{
-    return 1;
-}
-
-int needmousehack(void)
-{
-    return 1;
-}
-
-void LED(int on)
-{
-}
-
-void write_log (const char *buf, ...)
-{
-
-}
-
-int lockscr (void)
-{
-    return 1;
-}
-
-void unlockscr (void)
-{
-}
-
-void target_save_options (FILE *f, struct uae_prefs *p)
-{
-    fprintf (f, "curses.reverse_video=%s\n", p->curses_reverse_video ? "true" : "false");
-}
-
-int target_parse_option (struct uae_prefs *p, char *option, char *value)
-{
-    return (cfgfile_yesno (option, value, "reverse_video", &p->curses_reverse_video));
-}
diff --git a/od-generic/exectasks.h b/od-generic/exectasks.h
deleted file mode 100644 (file)
index f6a93ca..0000000
+++ /dev/null
@@ -1,17 +0,0 @@
- /*
-  * UAE - The Un*x Amiga Emulator
-  *
-  * exec.library multitasking emulation
-  *
-  * Copyright 1996 Bernd Schmidt
-  */
-
-struct switch_struct {
-    int dummy;
-};
-/* Looks weird. I think I had a report once that some compiler chokes if
- * the statement is empty. */
-#define EXEC_SWITCH_TASKS(run, ready) do { int i = 0; i++; } while(0)
-
-#define EXEC_SETUP_SWS(t) do { int i = 0; i++; } while(0)
-
diff --git a/od-generic/joystick.c b/od-generic/joystick.c
deleted file mode 100644 (file)
index 2c390c4..0000000
+++ /dev/null
@@ -1,71 +0,0 @@
- /*
-  * UAE - The Un*x Amiga Emulator
-  *
-  * Joystick emulation stubs
-  *
-  * Copyright 1997 Bernd Schmidt
-  * Copyright 2003 Richard Drummond
-  */
-
-#include "sysconfig.h"
-#include "sysdeps.h"
-
-#include "config.h"
-#include "options.h"
-#include "memory.h"
-#include "custom.h"
-#include "inputdevice.h"
-
-static int init_joysticks (void)
-{
-   return 1;
-}
-
-static void close_joysticks (void)
-{
-}
-
-static int acquire_joystick (int num, int flags)
-{
-    return 0;
-}
-
-static void unacquire_joystick (int num)
-{
-}
-
-static void read_joysticks (void)
-{
-}
-
-static int get_joystick_num (void)
-{
-    return 0;
-}
-
-static char *get_joystick_name (int joy)
-{
-    return 0;
-}
-
-static int get_joystick_widget_num (int joy)
-{
-    return 0;
-}
-
-static int get_joystick_widget_type (int joy, int num, char *name, uae_u32 *code)
-{
-    return IDEV_WIDGET_NONE;
-}
-
-static int get_joystick_widget_first (int joy, int type)
-{
-    return -1;
-}
-
-struct inputdevice_functions inputdevicefunc_joystick = {
-    init_joysticks, close_joysticks, acquire_joystick, unacquire_joystick,
-    read_joysticks, get_joystick_num, get_joystick_name,
-    get_joystick_widget_num, get_joystick_widget_type,
-    get_joystick_widget_first
-};
diff --git a/od-generic/memory.h b/od-generic/memory.h
deleted file mode 100644 (file)
index 5d21b6c..0000000
+++ /dev/null
@@ -1,11 +0,0 @@
- /*
-  * UAE - The Un*x Amiga Emulator
-  *
-  * See if this OS has mmap or equivalent
-  *
-  * Copyright 1996 Bernd Schmidt
-  */
-
-#undef USE_MAPPED_MEMORY
-#undef CAN_MAP_MEMORY
-
diff --git a/od-generic/sound.c b/od-generic/sound.c
deleted file mode 100644 (file)
index 022bf02..0000000
+++ /dev/null
@@ -1,43 +0,0 @@
- /*
-  * UAE - The Un*x Amiga Emulator
-  *
-  * Support for the Mute sound system
-  *
-  * Copyright 1997 Bernd Schmidt
-  * Copyright 2003 Richard Drummond
-  */
-
-#include "sysconfig.h"
-#include "sysdeps.h"
-
-#include "config.h"
-#include "options.h"
-#include "memory.h"
-#include "custom.h"
-#include "audio.h"
-#include "gensound.h"
-#include "sounddep/sound.h"
-
-int init_sound (void)
-{
-    currprefs.produce_sound = 0;
-    return 1;
-}
-
-int setup_sound (void)
-{
-    currprefs.produce_sound = 0;
-    return 1;
-}
-
-void close_sound (void)
-{
-}
-
-void update_sound (int freq)
-{
-}
-
-void reset_sound (void)
-{
-}
diff --git a/od-generic/sound.h b/od-generic/sound.h
deleted file mode 100644 (file)
index 68b211a..0000000
+++ /dev/null
@@ -1,27 +0,0 @@
- /*
-  * UAE - The Un*x Amiga Emulator
-  *
-  * Support for the Mute sound system.
-  *
-  * Copyright 1997 Bernd Schmidt
-  */
-
-static __inline__ void check_sound_buffers (void)
-{
-}
-
-#define PUT_SOUND_BYTE(b) do { ; } while (0)
-#define PUT_SOUND_WORD(b) do { ; } while (0)
-#define SOUND16_BASE_VAL 0
-#define SOUND8_BASE_VAL 0
-
-#define DEFAULT_SOUND_MINB 8192
-#define DEFAULT_SOUND_MAXB 8192
-#define DEFAULT_SOUND_BITS 16
-#define DEFAULT_SOUND_FREQ 44100
-
-#define UNSUPPORTED_OPTION_B
-#define UNSUPPORTED_OPTION_R
-#define UNSUPPORTED_OPTION_b
-#define UNSUPPORTED_OPTION_S
-
index 919461bb8d13dee6c59e2fabe9db88af70430cdf..e49257f9a78d2d5c9fdaf2e7cc4db243bbeb6cf3 100644 (file)
@@ -59,9 +59,11 @@ struct PicassoResolution
     int depth;   /* depth in bytes-per-pixel */
     int residx;
     int refresh[MAX_REFRESH_RATES]; /* refresh-rates in Hz */
+    int refreshtype[MAX_REFRESH_RATES]; /* 0=dx,1=enumdisplaysettings */
     TCHAR name[25];
     /* Bit mask of RGBFF_xxx values.  */
     uae_u32 colormodes;
+    int nondx;
 };
 extern GUID *displayGUID;
 
index 6caaa6eb4e64e20fd0b47d5b011ebf5c273005c0..5a50e4548fcfb734bae9405bb46990ed575a9934 100644 (file)
@@ -255,17 +255,27 @@ static void flushprtbuf (void)
     } else if (prtbufbytes > 0) {
        int pbyt = prtbufbytes;
 
-       if (hPrt == INVALID_HANDLE_VALUE) {
-           if (!doflushprinter ())
-               return;
-           openprinter ();
-       }
-       if (hPrt != INVALID_HANDLE_VALUE) {
-           if (WritePrinter (hPrt, prtbuf, pbyt, &written)) {
-               if (written != pbyt)
-                   write_log (L"PRINTER: Only wrote %d of %d bytes!\n", written, pbyt);
-           } else {
-               write_log (L"PRINTER: Couldn't write data!\n");
+       if (currprefs.parallel_matrix_emulation == 2) {
+           int i;
+           if (!prtopen) {
+               if (epson_init ())
+                   prtopen = 1;
+           }
+           for (i = 0; i < prtbufbytes; i++)
+               epson_printchar (prtbuf[i]);
+       } else {
+           if (hPrt == INVALID_HANDLE_VALUE) {
+               if (!doflushprinter ())
+                   return;
+               openprinter ();
+           }
+           if (hPrt != INVALID_HANDLE_VALUE) {
+               if (WritePrinter (hPrt, prtbuf, pbyt, &written)) {
+                   if (written != pbyt)
+                       write_log (L"PRINTER: Only wrote %d of %d bytes!\n", written, pbyt);
+               } else {
+                   write_log (L"PRINTER: Couldn't write data!\n");
+               }
            }
        }
 
@@ -363,7 +373,7 @@ int load_ghostscript (void)
 
     if (gsdll)
        return 1;
-    _tcscpy(path, L"gsdll32.dll");
+    _tcscpy (path, L"gsdll32.dll");
     gsdll = WIN32_LoadLibrary (path);
     if (!gsdll) {
        if (GetEnvironmentVariable (L"GS_DLL", path, sizeof (path) / sizeof (TCHAR)))
@@ -457,13 +467,15 @@ static void openprinter (void)
     if (currprefs.parallel_postscript_emulation) {
        prtopen = 1;
        return;
+    } else if (currprefs.parallel_matrix_emulation == 2) {
+       epson_init ();
     } else if (hPrt == INVALID_HANDLE_VALUE) {
        flushprtbuf ();
        if (OpenPrinter (currprefs.prtname, &hPrt, NULL)) {
            // Fill in the structure with info about this "document."
            DocInfo.pDocName = L"WinUAE Document";
            DocInfo.pOutputFile = NULL;
-           DocInfo.pDatatype = currprefs.parallel_ascii_emulation ? L"TEXT" : L"RAW";
+           DocInfo.pDatatype = currprefs.parallel_matrix_emulation ? L"TEXT" : L"RAW";
            // Inform the spooler the document is beginning.
            if ((dwJob = StartDocPrinter (hPrt, 1, (LPSTR)&DocInfo)) == 0) {
                ClosePrinter (hPrt );
@@ -486,6 +498,7 @@ void flushprinter (void)
 {
     if (!doflushprinter ())
        return;
+    flushprtbuf ();
     closeprinter ();
 }
 
@@ -513,6 +526,7 @@ void closeprinter (void)
            Sleep (10);
     }
     freepsbuffers ();
+    epson_close ();
     prtbufbytes = 0;
 }
 
index e03c339a0b79a86567ec9a3ab425dd6a7411fea9..7f64f71793422864fdc0fa759960f56a19941a7c 100644 (file)
@@ -46,3 +46,6 @@ extern int enumserialports (void);
 extern void sernametodev (TCHAR*);
 extern void serdevtoname (TCHAR*);
 
+extern void epson_printchar(uae_u8 c);
+extern int epson_init(void);
+extern void epson_close(void);
index 4e09038cab4e5cc620b270556b13914be1bea5eb..d7b7b7821831bd5ada1a214a020f956736bf1dd7 100644 (file)
@@ -2140,10 +2140,12 @@ void picasso96_alloc (TrapContext *ctx)
 
     i = 0;
     while (DisplayModes[i].depth >= 0) {
-       for (j = 0; missmodes[j * 2] >= 0; j++) {
-           if (DisplayModes[i].res.width == missmodes[j * 2 + 0] && DisplayModes[i].res.height == missmodes[j * 2 + 1]) {
-               missmodes[j * 2 + 0] = 0;
-               missmodes[j * 2 + 1] = 0;
+       if (DisplayModes[i].nondx == 0) {
+           for (j = 0; missmodes[j * 2] >= 0; j++) {
+               if (DisplayModes[i].res.width == missmodes[j * 2 + 0] && DisplayModes[i].res.height == missmodes[j * 2 + 1]) {
+                   missmodes[j * 2 + 0] = 0;
+                   missmodes[j * 2 + 1] = 0;
+               }
            }
        }
        i++;
@@ -2151,6 +2153,10 @@ void picasso96_alloc (TrapContext *ctx)
 
     i = 0;
     while (DisplayModes[i].depth >= 0) {
+       if (DisplayModes[i].nondx) {
+           i++;
+           continue;
+       }
        j = i;
        size += PSSO_LibResolution_sizeof;
        while (missmodes[misscnt * 2] == 0)
index 17697b6b60413fe96b0a99c97b2dae8271a8eaab..76fc7791a2dc59062ea3ab5be8a8ab1f575fcb36 100644 (file)
 #define IDS_AUTOSCALE_DISABLED          348
 #define IDS_AUTOSCALE_SCALING           349
 #define IDS_AUTOSCALE_RESIZE            350
+#define IDS_PRINTER_ASCII               351
+#define IDS_PRINTER_EPSON               352
+#define IDS_PRINTER_POSTSCRIPT_DETECTION 353
+#define IDS_PRINTER_POSTSCRIPT_EMULATION 354
+#define IDS_PRINTER_PASSTHROUGH         355
+#define IDS_RES_LORES                   356
+#define IDS_RES_HIRES                   357
+#define IDS_RES_SUPERHIRES              358
 #define IDS_QS_MODELS                   1000
 #define IDS_QS_MODEL_A500               1001
 #define IDS_QS_MODEL_A500P              1002
 #define IDC_CREATELOGFILE               1026
 #define IDC_PORT0_JOYS                  1026
 #define IDC_SCREENMODE_NATIVE           1026
+#define IDC_PRINTERTYPELIST             1026
 #define IDC_FASTMEM                     1027
 #define IDC_SHOWLEDS                    1027
 #define IDC_PORT1_JOYS                  1027
 #define IDC_LORES                       1176
 #define IDC_LORES_SMOOTHED              1179
 #define IDC_FLICKERFIXER                1180
+#define IDC_LORES_SMOOTHED2             1181
+#define IDC_DISPLAY_UNSUPPORTED         1181
 #define IDC_FRAMERATE                   1185
 #define IDC_RATETEXT                    1186
 #define IDC_XSIZE                       1187
 #define IDC_PSPRINTER                   1556
 #define IDC_PSPRINTERDETECT             1557
 #define IDC_UAESERIAL                   1558
-#define IDC_PSPRINTERDETECT2            1559
-#define IDC_ASCIIPRINTER                1559
 #define IDC_VIEWINFO                    1568
 #define IDC_SETINFO                     1569
 #define IDC_FLOPPYSLIDER                1570
index 3eadb21a8e7f6e964a3e8fc2f5c4cd0908c52cb4..d5665f1ff623974157651c8c35abe67d76686542 100644 (file)
@@ -83,7 +83,6 @@ STYLE DS_LOCALEDIT | DS_SETFONT | DS_3DLOOK | DS_CONTROL | WS_CHILD
 FONT 8, "MS Sans Serif", 0, 0, 0x1\r
 BEGIN\r
     GROUPBOX        "Screen",IDC_SCREENRESTEXT,12,0,270,67,BS_LEFT\r
-    RTEXT           "Full screen:",IDC_SELECTRESTEXT,15,17,40,15,SS_CENTERIMAGE\r
     COMBOBOX        IDC_DISPLAYSELECT,59,10,215,150,CBS_DROPDOWNLIST | CBS_HASSTRINGS | WS_VSCROLL | WS_TABSTOP\r
     COMBOBOX        IDC_RESOLUTION,59,27,68,150,CBS_DROPDOWNLIST | CBS_HASSTRINGS | WS_VSCROLL | WS_TABSTOP\r
     COMBOBOX        IDC_REFRESHRATE,187,27,87,150,CBS_DROPDOWNLIST | CBS_HASSTRINGS | WS_VSCROLL | WS_TABSTOP\r
@@ -111,12 +110,13 @@ BEGIN
     COMBOBOX        IDC_SCREENMODE_NATIVE,100,85,102,150,CBS_DROPDOWNLIST | CBS_HASSTRINGS | WS_VSCROLL | WS_TABSTOP\r
     COMBOBOX        IDC_SCREENMODE_RTG,100,103,102,150,CBS_DROPDOWNLIST | CBS_HASSTRINGS | WS_VSCROLL | WS_TABSTOP\r
     RTEXT           "Native mode:",IDC_STATIC,19,85,59,15,SS_CENTERIMAGE\r
-    RTEXT           "Windowed:",IDC_WINDOWEDTEXT,15,51,40,8\r
     RTEXT           "RTG mode:",IDC_STATIC,19,101,59,15,SS_CENTERIMAGE\r
     PUSHBUTTON      "Reset to defaults",IDC_DA_RESET,212,218,73,14\r
     RTEXT           "Resolution:",IDC_STATIC,27,152,59,15,SS_CENTERIMAGE\r
     COMBOBOX        IDC_LORES,100,152,102,150,CBS_DROPDOWNLIST | CBS_HASSTRINGS | WS_VSCROLL | WS_TABSTOP\r
     CONTROL         "Remove interlace artifacts",IDC_FLICKERFIXER,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,19,139,99,10\r
+    RTEXT           "Windowed:",IDC_STATIC,18,46,38,15,SS_CENTERIMAGE\r
+    RTEXT           "Fullscreen:",IDC_STATIC,17,19,38,15,SS_CENTERIMAGE\r
 END\r
 \r
 IDD_MEMORY DIALOGEX 0, 0, 300, 239\r
@@ -349,12 +349,10 @@ BEGIN
     RTEXT           "Printer:",IDC_STATIC,12,15,25,15,SS_CENTERIMAGE\r
     COMBOBOX        IDC_PRINTERLIST,49,15,232,134,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP\r
     PUSHBUTTON      "Flush print job",IDC_FLUSHPRINTER,114,51,58,12\r
-    CONTROL         "PostScript detection",IDC_PSPRINTERDETECT,"Button",BS_AUTOCHECKBOX | BS_VCENTER | WS_TABSTOP,91,35,84,12\r
-    CONTROL         "PostScript printer emulation",IDC_PSPRINTER,"Button",BS_AUTOCHECKBOX | BS_VCENTER | WS_TABSTOP,180,35,111,12\r
-    RTEXT           "Autoflush [] Time in seconds after a pending print job is automatically flushed.",IDC_PRINTERAUTOFLUSHTXT,173,49,86,15,SS_NOTIFY | SS_CENTERIMAGE\r
-    EDITTEXT        IDC_PRINTERAUTOFLUSH,263,50,25,12,ES_NUMBER\r
-    RTEXT           "Ghostscript extra parameters:",IDC_STATIC,12,66,102,15,SS_CENTERIMAGE\r
-    EDITTEXT        IDC_PS_PARAMS,124,67,165,12,ES_AUTOHSCROLL\r
+    RTEXT           "Autoflush [] Time in seconds after a pending print job is automatically flushed.",IDC_PRINTERAUTOFLUSHTXT,176,49,76,15,SS_NOTIFY | SS_CENTERIMAGE\r
+    EDITTEXT        IDC_PRINTERAUTOFLUSH,255,50,25,12,ES_NUMBER\r
+    RTEXT           "Type:",IDC_STATIC,15,33,21,15,SS_CENTERIMAGE\r
+    EDITTEXT        IDC_PS_PARAMS,114,67,167,12,ES_AUTOHSCROLL\r
     GROUPBOX        "Serial Port",IDC_SERIALFRAME,4,92,292,48\r
     COMBOBOX        IDC_SERIAL,49,104,232,65,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP\r
     CONTROL         "Shared",IDC_SER_SHARED,"Button",BS_AUTOCHECKBOX | BS_VCENTER | WS_TABSTOP,15,123,48,12\r
@@ -367,7 +365,8 @@ BEGIN
     CONTROL         "Direct []Use when emulating serial-link games on two PCs running WinUAE",IDC_SER_DIRECT,\r
                     "Button",BS_AUTOCHECKBOX | BS_VCENTER | WS_TABSTOP,135,123,65,12\r
     CONTROL         "uaeserial.device",IDC_UAESERIAL,"Button",BS_AUTOCHECKBOX | BS_VCENTER | WS_TABSTOP,200,123,78,12\r
-    CONTROL         "ASCII Printer",IDC_ASCIIPRINTER,"Button",BS_AUTOCHECKBOX | BS_VCENTER | WS_TABSTOP,13,35,69,12\r
+    COMBOBOX        IDC_PRINTERTYPELIST,49,33,232,134,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP\r
+    RTEXT           "Ghostscript extra parameters:",IDC_STATIC,10,66,102,15,SS_CENTERIMAGE\r
 END\r
 \r
 IDD_GAMEPORTS DIALOGEX 0, 0, 300, 236\r
@@ -1444,6 +1443,19 @@ BEGIN
     IDS_AUTOSCALE_DISABLED  "Disabled"\r
     IDS_AUTOSCALE_SCALING   "Automatic scaling"\r
     IDS_AUTOSCALE_RESIZE    "Automatic resize"\r
+    IDS_PRINTER_ASCII       "ASCII-Only"\r
+END\r
+\r
+STRINGTABLE \r
+BEGIN\r
+    IDS_PRINTER_EPSON       "Epson Matrix Printer Emulation (beta, FreeType required)"\r
+    IDS_PRINTER_POSTSCRIPT_DETECTION "PostScript (Passthrough)"\r
+    IDS_PRINTER_POSTSCRIPT_EMULATION \r
+                            "PostScript (Emulation, GhostScript required)"\r
+    IDS_PRINTER_PASSTHROUGH "Passthrough"\r
+    IDS_RES_LORES           "Lores"\r
+    IDS_RES_HIRES           "Hires (normal)"\r
+    IDS_RES_SUPERHIRES      "SuperHires"\r
 END\r
 \r
 #endif    // English (U.S.) resources\r
index b7cf4a1757f64098418e8332600a3719e446b900..5e7215f70cb0cecbfd858024f4c35e31936c9261 100644 (file)
 #include "sysconfig.h"
 #include "sysdeps.h"
 
+#include <math.h>
+
 #include "options.h"
 #include "audio.h"
 #include "memory.h"
 #include "events.h"
 #include "custom.h"
-#include "gensound.h"
 #include "threaddep/thread.h"
 #include "avioutput.h"
 #include "gui.h"
@@ -25,6 +26,7 @@
 #include "win32.h"
 #include "savestate.h"
 #include "driveclick.h"
+#include "gensound.h"
 
 #include <windows.h>
 #include <mmsystem.h>
@@ -81,8 +83,6 @@ struct sound_dp
     int opacounter;
 };
 
-#include <math.h>
-
 #define ADJUST_SIZE 30
 #define EXP 2.1
 
@@ -121,22 +121,30 @@ static int isvsync (void)
     return currprefs.gfx_avsync && currprefs.gfx_afullscreen;
 }
 
-int scaled_sample_evtime_orig;
-void update_sound (int freq)
+float scaled_sample_evtime_orig;
+void update_sound (int freq, int longframe)
 
 {
     static int lastfreq;
+    float lines = 0;
+
     if (freq < 0)
        freq = lastfreq;
     lastfreq = freq;
+
+    if (longframe < 0)
+       lines += 0.5;
+    else if (longframe > 0)
+       lines += 1.0;
+
     if (have_sound) {
        if (isvsync () || currprefs.chipset_refreshrate) {
            if (currprefs.ntscmode)
-               scaled_sample_evtime_orig = (unsigned long)(MAXHPOS_NTSC * MAXVPOS_NTSC * freq * CYCLE_UNIT + sdp->obtainedfreq - 1) / sdp->obtainedfreq;
+               scaled_sample_evtime_orig = (MAXHPOS_NTSC * (MAXVPOS_NTSC + lines) * freq * CYCLE_UNIT) / (float)sdp->obtainedfreq;
            else
-               scaled_sample_evtime_orig = (unsigned long)(MAXHPOS_PAL * MAXVPOS_PAL * freq * CYCLE_UNIT + sdp->obtainedfreq - 1) / sdp->obtainedfreq;
+               scaled_sample_evtime_orig = (MAXHPOS_PAL * (MAXVPOS_PAL + lines) * freq * CYCLE_UNIT) / (float)sdp->obtainedfreq;
        } else {
-           scaled_sample_evtime_orig = (unsigned long)(312.0 * 50 * CYCLE_UNIT / (sdp->obtainedfreq  / 227.0));
+           scaled_sample_evtime_orig = 227.0 * (lines + 312) * 50 * CYCLE_UNIT / (float)sdp->obtainedfreq;
        }
        scaled_sample_evtime = scaled_sample_evtime_orig;
     }
@@ -304,11 +312,12 @@ const static GUID KSDATAFORMAT_SUBTYPE_PCM = {0x00000001,0x0000,0x0010,
 #define KSAUDIO_SPEAKER_QUAD_SURROUND   (SPEAKER_FRONT_LEFT | SPEAKER_FRONT_RIGHT | \
                                         SPEAKER_SIDE_LEFT  | SPEAKER_SIDE_RIGHT)
 
-static struct dsaudiomodes supportedmodes[16];
+#define MAX_SUPPORTEDMODES 16
+static struct dsaudiomodes supportedmodes[MAX_SUPPORTEDMODES];
 
 static DWORD fillsupportedmodes (struct sound_data *sd, int freq, struct dsaudiomodes *dsam)
 {
-    DWORD speakerconfig;
+    static DWORD speakerconfig;
     DSBUFFERDESC sound_buffer;
     WAVEFORMATEXTENSIBLE wavfmt;
     LPDIRECTSOUNDBUFFER pdsb;
@@ -317,6 +326,10 @@ static DWORD fillsupportedmodes (struct sound_data *sd, int freq, struct dsaudio
     DWORD rn[4];
     struct sound_dp *s = sd->data;
     LPDIRECTSOUND8 lpDS = s->lpDS;
+    static done;
+
+    if (done)
+       return speakerconfig;
 
     mode = 2;
     dsam[0].ch = 1;
@@ -361,15 +374,21 @@ static DWORD fillsupportedmodes (struct sound_data *sd, int freq, struct dsaudio
            sound_buffer.dwFlags = DSBCAPS_GETCURRENTPOSITION2 | DSBCAPS_GLOBALFOCUS;
            sound_buffer.dwFlags |= DSBCAPS_CTRLVOLUME;
            sound_buffer.guid3DAlgorithm = GUID_NULL;
+           pdsb = NULL;
            hr = IDirectSound_CreateSoundBuffer (lpDS, &sound_buffer, &pdsb, NULL);
            if (SUCCEEDED (hr)) {
                IDirectSound_Release (pdsb);
                dsam[mode].ksmode = rn[round];
                dsam[mode].ch = ch;
                mode++;
+               if (mode >= MAX_SUPPORTEDMODES - 1)
+                   break;
            }
        }
     }
+    dsam[mode].ch = 0;
+    dsam[mode].ksmode = 0;
+    done = 1;
     return speakerconfig;
 }
 
@@ -790,8 +809,7 @@ static int open_sound (void)
        return 0;
 
     set_volume (currprefs.sound_volume, sdp->mute);
-    init_sound_table16 ();
-    if (get_audio_amigachannels() == 4)
+    if (get_audio_amigachannels () == 4)
        sample_handler = sample16ss_handler;
     else
        sample_handler = get_audio_ismono () ? sample16_handler : sample16s_handler;
@@ -800,7 +818,7 @@ static int open_sound (void)
 
     have_sound = 1;
     sound_available = 1;
-    update_sound (fake_vblank_hz);
+    update_sound (fake_vblank_hz, 1);
     paula_sndbufsize = sdp->sndbufsize;
     paula_sndbufpt = paula_sndbuffer;
     driveclick_init ();
@@ -874,12 +892,15 @@ static int avioutput_audio;
 
 void sound_setadjust (double v)
 {
-    double mult;
+    float mult;
+
+    if (v >= -5 && v <= 5)
+       v = 0;
 
     mult = (1000.0 + v);
     if (isvsync () || (avioutput_audio && !compiled_code)) {
        vsynctime = vsynctime_orig;
-       scaled_sample_evtime = (long)(((double)scaled_sample_evtime_orig) * mult / 1000.0);
+       scaled_sample_evtime = scaled_sample_evtime_orig * mult / 1000.0;
     } else if (compiled_code || currprefs.m68k_speed != 0) {
        vsynctime = (long)(((double)vsynctime_orig) * mult / 1000.0);
        scaled_sample_evtime = scaled_sample_evtime_orig;
@@ -1125,7 +1146,6 @@ static void finish_sound_buffer_ds (struct sound_data *sd, uae_u16 *sndbuffer)
     DWORD s1, s2;
     int diff;
     int counter;
-    double vdiff, m, skipmode;
     static int statuscnt;
 
     if (sd == sdp) {
@@ -1283,6 +1303,8 @@ static void finish_sound_buffer_ds (struct sound_data *sd, uae_u16 *sndbuffer)
     IDirectSoundBuffer_Unlock (s->lpDSBsecondary, b1, s1, b2, s2);
 
     if (sd == sdp) {
+       double vdiff, m, skipmode;
+
        vdiff = diff - s->snd_writeoffset;
        m = 100.0 * vdiff / s->max_sndbufsize;
 
@@ -1309,7 +1331,7 @@ static void finish_sound_buffer_ds (struct sound_data *sd, uae_u16 *sndbuffer)
        }
 
        if (tfprev != timeframes) {
-           if (sound_debug && !(tfprev % 10))
+           if ((0 || sound_debug) && !(tfprev % 10))
                write_log (L"b=%4d,%5d,%5d,%5d d=%5d vd=%5.0f s=%+02.1f\n",
                    sd->sndbufsize / sd->samplesize, s->snd_configsize / sd->samplesize, s->max_sndbufsize / sd->samplesize,
                    s->dsoundbuf / sd->samplesize, diff / sd->samplesize, vdiff, skipmode);
@@ -1365,7 +1387,7 @@ void finish_sound_buffer (void)
     if (currprefs.sound_stereo_swap_paula) {
        if (get_audio_nativechannels () == 2 || get_audio_nativechannels () == 4)
            channelswap ((uae_s16*)paula_sndbuffer, sdp->sndbufsize / 2);
-       else if (get_audio_nativechannels() == 6)
+       else if (get_audio_nativechannels () == 6)
            channelswap6 ((uae_s16*)paula_sndbuffer, sdp->sndbufsize / 2);
     }
 #ifdef DRIVESOUND
@@ -1537,7 +1559,7 @@ int enumerate_sound_devices (void)
        write_log (L"Enumerating DirectSound devices..\n");
        DirectSoundEnumerate ((LPDSENUMCALLBACK)DSEnumProc, sound_devices);
        DirectSoundCaptureEnumerate ((LPDSENUMCALLBACK)DSEnumProc, record_devices);
-       if (0 && isdllversion (L"openal32.dll", 6, 14, 357, 22)) {
+       if (isdllversion (L"openal32.dll", 6, 14, 357, 22)) {
            write_log (L"Enumerating OpenAL devices..\n");
            if (alcIsExtensionPresent (NULL, "ALC_ENUMERATION_EXT")) {
                const char* ppDefaultDevice = alcGetString (NULL, ALC_DEFAULT_DEVICE_SPECIFIER);
index 017c8f53d9d20bdeb59a5c5ac6ebf7ca72041a21..520832deed9446862fa9c8257862af41f3f20f8d 100644 (file)
@@ -6,7 +6,6 @@
   * Copyright 1997 Bernd Schmidt
   */
 
-extern int sound_fd;
 extern uae_u16 paula_sndbuffer[];
 extern uae_u16 *paula_sndbufpt;
 extern int paula_sndbufsize;
@@ -68,7 +67,7 @@ STATIC_INLINE void check_sound_buffers (void)
        p[1] = sum >> 3;
        paula_sndbufpt = (uae_u16 *)(((uae_u8 *)paula_sndbufpt) + 4 * 2);
     }
-    if ((char *)paula_sndbufpt - (char *)paula_sndbuffer >= paula_sndbufsize) {
+    if ((uae_u8*)paula_sndbufpt - (uae_u8*)paula_sndbuffer >= paula_sndbufsize) {
        finish_sound_buffer ();
        paula_sndbufpt = paula_sndbuffer;
     }
@@ -80,11 +79,8 @@ STATIC_INLINE void clear_sound_buffers (void)
     paula_sndbufpt = paula_sndbuffer;
 }
 
-#define PUT_SOUND_BYTE(b) do { *(uae_u8 *)paula_sndbufpt = b; paula_sndbufpt = (uae_u16 *)(((uae_u8 *)paula_sndbufpt) + 1); } while (0)
 #define PUT_SOUND_WORD(b) do { *(uae_u16 *)paula_sndbufpt = b; paula_sndbufpt = (uae_u16 *)(((uae_u8 *)paula_sndbufpt) + 2); } while (0)
-#define PUT_SOUND_BYTE_LEFT(b) PUT_SOUND_BYTE(b)
 #define PUT_SOUND_WORD_LEFT(b) do { if (currprefs.sound_filter) b = filter (b, &sound_filter_state[0]); PUT_SOUND_WORD(b); } while (0)
-#define PUT_SOUND_BYTE_RIGHT(b) PUT_SOUND_BYTE(b)
 #define PUT_SOUND_WORD_RIGHT(b) do { if (currprefs.sound_filter) b = filter (b, &sound_filter_state[1]); PUT_SOUND_WORD(b); } while (0)
 #define PUT_SOUND_WORD_LEFT2(b) do { if (currprefs.sound_filter) b = filter (b, &sound_filter_state[2]); PUT_SOUND_WORD(b); } while (0)
 #define PUT_SOUND_WORD_RIGHT2(b) do { if (currprefs.sound_filter) b = filter (b, &sound_filter_state[3]); PUT_SOUND_WORD(b); } while (0)
index aec64d6c14dc3f25084b736615ba53e3dfef7f3f..fbbe2713d6ce2ab2e23cb27a00c05e3b1a157236 100644 (file)
@@ -4345,6 +4345,10 @@ typedef HRESULT (CALLBACK* SHCREATEITEMFROMPARSINGNAME)
 
 void target_addtorecent (const TCHAR *name, int t)
 {
+    TCHAR tmp[MAX_DPATH];
+
+    tmp[0] = 0;
+    GetFullPathName (name, sizeof tmp / sizeof (TCHAR), tmp, NULL);
     if (os_win7) {
        SHCREATEITEMFROMPARSINGNAME pSHCreateItemFromParsingName;
        SHARDAPPIDINFO shard;
@@ -4353,12 +4357,12 @@ void target_addtorecent (const TCHAR *name, int t)
        if (!pSHCreateItemFromParsingName)
            return;
        shard.pszAppID = WINUAEAPPNAME;
-       if (SUCCEEDED (pSHCreateItemFromParsingName (name, NULL, &IID_IShellItem, &shard.psi))) {
+       if (SUCCEEDED (pSHCreateItemFromParsingName (tmp, NULL, &IID_IShellItem, &shard.psi))) {
            SHAddToRecentDocs (SHARD_APPIDINFO, &shard);
            IShellItem_Release (shard.psi);
        }
     } else {
-       SHAddToRecentDocs (SHARD_PATH, name);
+       SHAddToRecentDocs (SHARD_PATH, tmp);
     }
 }
 
index 503c15488269a2185a557cf525f2ad4ff283de44..44994c4f7a643be5093c403538f0f5f88d7e0bac 100644 (file)
@@ -17,8 +17,8 @@
 
 #define WINUAEPUBLICBETA 1
 
-#define WINUAEBETA L"27"
-#define WINUAEDATE MAKEBD(2009, 5, 1)
+#define WINUAEBETA L"28"
+#define WINUAEDATE MAKEBD(2009, 5, 9)
 #define WINUAEEXTRA L""
 #define WINUAEREV L""
 
index a83562b8233d8e99b670121352cd83f074a6788c..36c4e5932575106d53f6b5ce431b65ae1142ddef 100644 (file)
@@ -46,6 +46,7 @@ static LPDIRECTDRAWSURFACE7 tempsurf;
 static uae_u8 *tempsurf2, *tempsurf3;
 static int cleartemp;
 static uae_u32 rc[256], gc[256], bc[256];
+static int deskw, deskh;
 
 void getfilteroffset (int *dx, int *dy, int *mx, int *my)
 {
@@ -55,6 +56,19 @@ void getfilteroffset (int *dx, int *dy, int *mx, int *my)
     *my = filterymult;
 }
 
+static void getinit (void)
+{
+    if (isfullscreen ()) {
+       struct MultiDisplay *md = getdisplay (&currprefs);
+
+       deskw = md->rect.right - md->rect.left;
+       deskh = md->rect.bottom - md->rect.top;
+    } else {
+       deskw = dst_width;
+       deskh = dst_height;
+    }
+}
+
 static int vblscale (int v)
 {
     static int o;
@@ -99,6 +113,7 @@ void getfilterrect2 (RECT *sr, RECT *dr, RECT *zr, int dst_width, int dst_height
     int xmult, ymult;
     int v;
 
+    getinit ();
     ahs2 = vblscale (ah) * scale;
     aws = aw * scale;
     ahs = ah * scale;
@@ -215,31 +230,35 @@ void getfilterrect2 (RECT *sr, RECT *dr, RECT *zr, int dst_width, int dst_height
                int diffx = dr->right - dr->left;
                int diffy = dr->bottom - dr->top;
        
-               xratio = dw * 256 / cw;
-               yratio = dh * 256 / ch;
+               xratio = 4 * 256;
+               yratio = 3 * 256;
                if (currprefs.gfx_filter_aspect != 0) {
                    int xm, ym, mult;
                    if (currprefs.gfx_filter_aspect > 0) {
                        xm = (currprefs.gfx_filter_aspect >> 8) * 256;
                        ym = (currprefs.gfx_filter_aspect & 0xff) * 256;
+                   } else if (deskw > 0 && deskh > 0) {
+                       xm = deskw * 256;
+                       ym = deskh * 256;
                    } else {
-                       xm = dst_width * 256;
-                       ym = dst_height * 256;
+                       xm = xratio;
+                       ym = yratio;
                    }
                    mult = currprefs.gfx_resolution - (currprefs.gfx_linedbl ? 1 : 0);
                    if (mult < 0)
                        xm *= 1 << (-mult);
                    else
                        ym *= 1 << mult;
-                   xratio = xratio * ((dw * ym * 256) / (dh * xm)) / 256;
+                   xratio *= ym / 256;
+                   yratio *= xm / 256;
                }
 
-               if (xratio > yratio) {
-                   diff = diffx - diffx * yratio / xratio;
+               if (xratio < yratio) {
+                   diff = diffx - diffx * xratio / yratio;
                    sizeoffset (dr, zr, -diff, 0);
                    filteroffsetx += (diff * cw / dst_width) / 2;
                } else {
-                   diff = diffx - diffx * xratio / yratio;
+                   diff = diffx - diffx * yratio / xratio;
                    sizeoffset (dr, zr, 0, -diff);
                    filteroffsety += diff / 2;
                }
@@ -274,17 +293,18 @@ void getfilterrect2 (RECT *sr, RECT *dr, RECT *zr, int dst_width, int dst_height
        int srcratio, dstratio;
        int xmult2 = xmult;
        int ymult2 = ymult;
+       srcratio = 4 * 256 / 3;
        if (currprefs.gfx_filter_aspect > 0) {
            dstratio = (currprefs.gfx_filter_aspect >> 8) * 256 / (currprefs.gfx_filter_aspect & 0xff);
-           srcratio = dst_width * 256 / dst_height;
+       } else if (deskw > 0 && deskh > 0) {
+           dstratio = deskw * 256 / deskh;
        } else {
-           dstratio = 4 * 256 / 3;
-           srcratio = dst_width * 256 / dst_height;
+           dstratio = srcratio;
        }
        if (srcratio > dstratio) {
-           xmult = xmult * srcratio / dstratio;
+           ymult = ymult * srcratio / dstratio;
        } else {
-           ymult = ymult * dstratio / srcratio;
+           xmult = xmult * dstratio / srcratio;
        }
     }
 
index b26f72da3c910a8befb561e8ee948b652646d7d1..b87627a4f50ce3c2e518f342ced23ca60c2aa2f0 100644 (file)
@@ -402,6 +402,7 @@ static void addmode (struct MultiDisplay *md, int w, int h, int d, int rate, int
            }
            if (j < MAX_REFRESH_RATES) {
                md->DisplayModes[i].refresh[j] = rate;
+               md->DisplayModes[i].refreshtype[j] = nondx;
                md->DisplayModes[i].refresh[j + 1] = 0;
                return;
            }
@@ -413,10 +414,12 @@ static void addmode (struct MultiDisplay *md, int w, int h, int d, int rate, int
        i++;
     if (i >= MAX_PICASSO_MODES - 1)
        return;
+    md->DisplayModes[i].nondx = nondx;
     md->DisplayModes[i].res.width = w;
     md->DisplayModes[i].res.height = h;
     md->DisplayModes[i].depth = d;
     md->DisplayModes[i].refresh[0] = rate;
+    md->DisplayModes[i].refreshtype[0] = nondx;
     md->DisplayModes[i].refresh[1] = 0;
     md->DisplayModes[i].colormodes = ct;
     md->DisplayModes[i + 1].depth = -1;
@@ -467,14 +470,30 @@ static int _cdecl resolution_compare (const void *a, const void *b)
        return 1;
     return ma->depth - mb->depth;
 }
+
 static void sortmodes (struct MultiDisplay *md)
 {
-    int        i = 0, idx = -1;
+    int        i, idx = -1;
     int pw = -1, ph = -1;
+
+    i = 0;
     while (md->DisplayModes[i].depth >= 0)
        i++;
     qsort (md->DisplayModes, i, sizeof (struct PicassoResolution), resolution_compare);
     for (i = 0; md->DisplayModes[i].depth >= 0; i++) {
+       int j, k;
+       for (j = 0; md->DisplayModes[i].refresh[j]; j++) {
+           for (k = j + 1; md->DisplayModes[i].refresh[k]; k++) {
+               if (md->DisplayModes[i].refresh[j] > md->DisplayModes[i].refresh[k]) {
+                   int t = md->DisplayModes[i].refresh[j];
+                   md->DisplayModes[i].refresh[j] = md->DisplayModes[i].refresh[k];
+                   md->DisplayModes[i].refresh[k] = t;
+                   t = md->DisplayModes[i].refreshtype[j];
+                   md->DisplayModes[i].refreshtype[j] = md->DisplayModes[i].refreshtype[k];
+                   md->DisplayModes[i].refreshtype[k] = t;
+               }
+           }
+       }
        if (md->DisplayModes[i].res.height != ph || md->DisplayModes[i].res.width != pw) {
            ph = md->DisplayModes[i].res.height;
            pw = md->DisplayModes[i].res.width;
@@ -490,12 +509,15 @@ static void modesList (struct MultiDisplay *md)
 
     i = 0;
     while (md->DisplayModes[i].depth >= 0) {
-       write_log (L"%d: %s (", i, md->DisplayModes[i].name);
+       write_log (L"%d: %s%s (", i, md->DisplayModes[i].nondx ? L"!" : L"", md->DisplayModes[i].name);
        j = 0;
        while (md->DisplayModes[i].refresh[j] > 0) {
            if (j > 0)
                write_log (L",");
-           write_log (L"%d", md->DisplayModes[i].refresh[j]);
+           if (md->DisplayModes[i].refreshtype[j])
+               write_log (L"!%d", md->DisplayModes[i].refresh[j]);
+           else
+               write_log (L"%d", md->DisplayModes[i].refresh[j]);
            j++;
        }
        write_log (L")\n");
@@ -613,17 +635,27 @@ void sortdisplays (void)
                int w = DirectDraw_CurrentWidth ();
                int h = DirectDraw_CurrentHeight ();
                int b = DirectDraw_GetCurrentDepth ();
-               write_log (L"Desktop: W=%d H=%d B=%d. CXVS=%d CYVS=%d\n", w, h, b,
-                   GetSystemMetrics (SM_CXVIRTUALSCREEN), GetSystemMetrics (SM_CYVIRTUALSCREEN));
+               int maxw = 0, maxh = 0;
+
                DirectDraw_EnumDisplayModes (DDEDM_REFRESHRATES, modesCallback, md1);
+               idx2 = 0;
+               while (md1->DisplayModes[idx2].depth >= 0) {
+                   struct PicassoResolution *pr = &md1->DisplayModes[idx2];
+                   if (pr->res.width > maxw)
+                       maxw = pr->res.width;
+                   if (pr->res.height > maxh)
+                       maxh = pr->res.height;
+                   idx2++;
+               }
+               write_log (L"Desktop: W=%d H=%d B=%d. MaxW=%d MaxH=%d CXVS=%d CYVS=%d\n", w, h, b, maxw, maxh,
+                   GetSystemMetrics (SM_CXVIRTUALSCREEN), GetSystemMetrics (SM_CYVIRTUALSCREEN));
                idx = 0;
                for (;;) {
                    int found;
                    DEVMODE dm;
-
                    dm.dmSize = sizeof dm;
                    dm.dmDriverExtra = 0;
-                   if (!EnumDisplaySettings  (md1->primary ? NULL : md1->name3, idx, &dm))
+                   if (!EnumDisplaySettingsEx (md1->primary ? NULL : md1->name3, idx, &dm, EDS_RAWMODE))
                        break;
                    idx2 = 0;
                    found = 0;
@@ -640,8 +672,20 @@ void sortdisplays (void)
                        idx2++;
                    }
                    if (!found) {
-                       write_log (L"EnumDisplaySettings(%dx%dx%d %dHz)\n", dm.dmPelsWidth, dm.dmPelsHeight, dm.dmBitsPerPel, dm.dmDisplayFrequency);
-                       addmode (md1, dm.dmPelsWidth, dm.dmPelsHeight, dm.dmBitsPerPel, dm.dmDisplayFrequency, 1);
+                       int freq = 0;
+#if 0
+                       write_log (L"EnumDisplaySettings(%dx%dx%d %dHz %08x)\n",
+                           dm.dmPelsWidth, dm.dmPelsHeight, dm.dmBitsPerPel, dm.dmDisplayFrequency, dm.dmFields);
+#endif
+                       if (dm.dmFields & DM_DISPLAYFREQUENCY) {
+                           freq = dm.dmDisplayFrequency;
+                           if (freq < 10)
+                               freq = 0;
+                       }
+                       if (freq < 75) {
+                           if ((dm.dmFields & DM_PELSWIDTH) && (dm.dmFields & DM_PELSHEIGHT) && (dm.dmFields & DM_BITSPERPEL))
+                               addmode (md1, dm.dmPelsWidth, dm.dmPelsHeight, dm.dmBitsPerPel, freq, 1);
+                       }
                    }
                    idx++;
                }
@@ -1358,13 +1402,13 @@ int check_prefs_changed_gfx (void)
 
     if (_tcscmp (currprefs.prtname, changed_prefs.prtname) ||
        currprefs.parallel_autoflush_time != changed_prefs.parallel_autoflush_time ||
-       currprefs.parallel_ascii_emulation != changed_prefs.parallel_ascii_emulation ||
+       currprefs.parallel_matrix_emulation != changed_prefs.parallel_matrix_emulation ||
        currprefs.parallel_postscript_emulation != changed_prefs.parallel_postscript_emulation ||
        currprefs.parallel_postscript_detection != changed_prefs.parallel_postscript_detection ||
        _tcscmp (currprefs.ghostscript_parameters, changed_prefs.ghostscript_parameters)) {
        _tcscpy (currprefs.prtname, changed_prefs.prtname);
        currprefs.parallel_autoflush_time = changed_prefs.parallel_autoflush_time;
-       currprefs.parallel_ascii_emulation = changed_prefs.parallel_ascii_emulation;
+       currprefs.parallel_matrix_emulation = changed_prefs.parallel_matrix_emulation;
        currprefs.parallel_postscript_emulation = changed_prefs.parallel_postscript_emulation;
        currprefs.parallel_postscript_detection = changed_prefs.parallel_postscript_detection;
        _tcscpy (currprefs.ghostscript_parameters, changed_prefs.ghostscript_parameters);
index 93af48d9a516469429c7ba7aa982f5bc887cc131..031b6691489d8854d3bff3407e6373bed0b5a09a 100644 (file)
@@ -1306,7 +1306,7 @@ int target_cfgfile_load (struct uae_prefs *p, TCHAR *filename, int type, int isd
            _tcscpy (fname, filename);
     }
 
-    if (isdefault)
+    if (!isdefault)
        qs_override = 1;
     if (type < 0) {
        type = 0;
@@ -1319,7 +1319,7 @@ int target_cfgfile_load (struct uae_prefs *p, TCHAR *filename, int type, int isd
     if (type == 0)
        default_prefs (p, type);
     regqueryint (NULL, L"ConfigFile_NoAuto", &ct2);
-    v = cfgfile_load (p, fname, &type2, ct2);
+    v = cfgfile_load (p, fname, &type2, ct2, isdefault ? 0 : 1);
     if (!v)
        return v;
     if (type > 0)
@@ -1335,7 +1335,7 @@ int target_cfgfile_load (struct uae_prefs *p, TCHAR *filename, int type, int isd
                fetch_path (L"ConfigurationPath", tmp2, sizeof (tmp2) / sizeof (TCHAR));
                _tcscat (tmp2, tmp1);
                v = i;
-               cfgfile_load (p, tmp2, &v, 1);
+               cfgfile_load (p, tmp2, &v, 1, 0);
            }
        }
     }
@@ -3790,6 +3790,7 @@ static void resetregistry (void)
     regdelete (NULL, L"QuickStartHostConfig");
     regdelete (NULL, L"ConfigurationCache");
     regdelete (NULL, L"DirectDraw_Secondary");
+    regdelete (NULL, L"ShownsupportedModes");
 }
 
 int path_type;
@@ -4056,7 +4057,7 @@ static void quickstarthost (HWND hDlg, TCHAR *name)
     TCHAR tmp[MAX_DPATH];
 
     if (getconfigstorefrompath (name, tmp, CONFIG_TYPE_HOST)) {
-       if (cfgfile_load (&workprefs, tmp, &type, 1))
+       if (cfgfile_load (&workprefs, tmp, &type, 1, 0))
            workprefs.start_gui = 1;
     }
 }
@@ -4513,36 +4514,45 @@ static void LoadNthString( DWORD value, TCHAR *nth, DWORD dwNthMax )
 }
 
 static int fakerefreshrates[] = { 50, 60, 100, 120, 0 };
-static int storedrefreshrates[MAX_REFRESH_RATES + 1];
+struct storedrefreshrate
+{
+    int rate, type;
+};
+static struct storedrefreshrate storedrefreshrates[MAX_REFRESH_RATES + 1];
 
 static void init_frequency_combo (HWND hDlg, int dmode)
 {
-    int i, j, freq, tmp;
+    int i, j, freq;
     TCHAR hz[20], hz2[20], txt[100];
     LRESULT index;
     struct MultiDisplay *md = getdisplay (&workprefs);
 
     i = 0; index = 0;
     while (dmode >= 0 && (freq = md->DisplayModes[dmode].refresh[i]) > 0 && index < MAX_REFRESH_RATES) {
-       storedrefreshrates[index++] = freq;
+       storedrefreshrates[index].rate = freq;
+       storedrefreshrates[index++].type = md->DisplayModes[dmode].refreshtype[i];
        i++;
     }
     i = 0;
     while ((freq = fakerefreshrates[i]) > 0 && index < MAX_REFRESH_RATES) {
        for (j = 0; j < index; j++) {
-           if (storedrefreshrates[j] == freq) break;
+           if (storedrefreshrates[j].rate == freq)
+               break;
+       }
+       if (j == index) {
+           storedrefreshrates[index].rate = -freq;
+           storedrefreshrates[index++].type = 0;
        }
-       if (j == index)
-           storedrefreshrates[index++] = -freq;
        i++;
     }
-    storedrefreshrates[index] = 0;
+    storedrefreshrates[index].rate = 0;
     for (i = 0; i < index; i++) {
        for (j = i + 1; j < index; j++) {
-           if (abs(storedrefreshrates[i]) >= abs(storedrefreshrates[j])) {
-               tmp = storedrefreshrates[i];
-               storedrefreshrates[i] = storedrefreshrates[j];
-               storedrefreshrates[j] = tmp;
+           if (abs (storedrefreshrates[i].rate) >= abs (storedrefreshrates[j].rate)) {
+               struct storedrefreshrate srr;
+               memcpy (&srr, &storedrefreshrates[i], sizeof (struct storedrefreshrate));
+               memcpy (&storedrefreshrates[i], &storedrefreshrates[j], sizeof (struct storedrefreshrate));
+               memcpy (&storedrefreshrates[j], &srr, sizeof (struct storedrefreshrate));
            }
        }
     }
@@ -4552,7 +4562,7 @@ static void init_frequency_combo (HWND hDlg, int dmode)
     WIN32GUI_LoadUIString (IDS_VSYNC_DEFAULT, txt, sizeof (txt) / sizeof (TCHAR));
     SendDlgItemMessage(hDlg, IDC_REFRESHRATE, CB_ADDSTRING, 0, (LPARAM)txt);
     for (i = 0; i < index; i++) {
-       freq = storedrefreshrates[i];
+       freq = storedrefreshrates[i].rate;
        if (freq < 0) {
            freq = -freq;
            _stprintf (hz, L"(%dHz)", freq);
@@ -4563,7 +4573,9 @@ static void init_frequency_combo (HWND hDlg, int dmode)
            _tcscat (hz, L" PAL");
        if (freq == 60 || freq == 120)
            _tcscat (hz, L" NTSC");
-       if (abs(workprefs.gfx_refreshrate) == freq)
+       if (storedrefreshrates[i].type)
+           _tcscat (hz, L" (*)");
+       if (abs (workprefs.gfx_refreshrate) == freq)
            _tcscpy (hz2, hz);
        SendDlgItemMessage (hDlg, IDC_REFRESHRATE, CB_ADDSTRING, 0, (LPARAM)hz);
     }
@@ -4582,20 +4594,20 @@ static void init_frequency_combo (HWND hDlg, int dmode)
 
 static int display_mode_index (uae_u32 x, uae_u32 y, uae_u32 d)
 {
-    int i;
+    int i, j;
     struct MultiDisplay *md = getdisplay (&workprefs);
 
-    i = 0;
-    while (md->DisplayModes[i].depth >= 0) {
+    j = 0;
+    for (i = 0; md->DisplayModes[i].depth >= 0; i++) {
        if (md->DisplayModes[i].res.width == x &&
            md->DisplayModes[i].res.height == y &&
            md->DisplayModes[i].depth == d)
            break;
-       i++;
+       j++;
     }
     if(md->DisplayModes[i].depth < 0)
-       i = -1;
-    return i;
+       j = -1;
+    return j;
 }
 
 static int da_mode_selected;
@@ -4811,7 +4823,7 @@ static void values_to_displaydlg (HWND hDlg)
     SendDlgItemMessage (hDlg, IDC_FRAMERATE, TBM_SETPOS, TRUE, v);
     WIN32GUI_LoadUIString(IDS_FRAMERATE, buffer, sizeof buffer / sizeof (TCHAR));
     LoadNthString (v - 1, Nth, MAX_NTH_LENGTH);
-    if(FormatMessage(FORMAT_MESSAGE_FROM_STRING | FORMAT_MESSAGE_ARGUMENT_ARRAY | FORMAT_MESSAGE_ALLOCATE_BUFFER,
+    if (FormatMessage (FORMAT_MESSAGE_FROM_STRING | FORMAT_MESSAGE_ARGUMENT_ARRAY | FORMAT_MESSAGE_ALLOCATE_BUFFER,
            buffer, 0, 0, (LPTSTR)&string, MAX_FRAMERATE_LENGTH + MAX_NTH_LENGTH, (va_list *)blah ) == 0)
     {
        DWORD dwLastError = GetLastError();
@@ -4853,9 +4865,12 @@ static void values_to_displaydlg (HWND hDlg)
     SendDlgItemMessage(hDlg, IDC_SCREENMODE_RTG, CB_SETCURSEL, display_toselect(workprefs.gfx_pfullscreen, workprefs.gfx_pvsync, 1), 0);
 
     SendDlgItemMessage(hDlg, IDC_LORES, CB_RESETCONTENT, 0, 0);
-    SendDlgItemMessage(hDlg, IDC_LORES, CB_ADDSTRING, 0, (LPARAM)L"Lores");
-    SendDlgItemMessage(hDlg, IDC_LORES, CB_ADDSTRING, 0, (LPARAM)L"Hires (normal)");
-    SendDlgItemMessage(hDlg, IDC_LORES, CB_ADDSTRING, 0, (LPARAM)L"SuperHires");
+    WIN32GUI_LoadUIString(IDS_RES_LORES, buffer, sizeof buffer / sizeof (TCHAR));
+    SendDlgItemMessage(hDlg, IDC_LORES, CB_ADDSTRING, 0, (LPARAM)buffer);
+    WIN32GUI_LoadUIString(IDS_RES_HIRES, buffer, sizeof buffer / sizeof (TCHAR));
+    SendDlgItemMessage(hDlg, IDC_LORES, CB_ADDSTRING, 0, (LPARAM)buffer);
+    WIN32GUI_LoadUIString(IDS_RES_SUPERHIRES, buffer, sizeof buffer / sizeof (TCHAR));
+    SendDlgItemMessage(hDlg, IDC_LORES, CB_ADDSTRING, 0, (LPARAM)buffer);
     SendDlgItemMessage (hDlg, IDC_LORES, CB_SETCURSEL, workprefs.gfx_resolution, 0);
 
     CheckDlgButton (hDlg, IDC_BLACKER_THAN_BLACK, workprefs.gfx_blackerthanblack);
@@ -4870,18 +4885,20 @@ static void values_to_displaydlg (HWND hDlg)
 
 static void init_resolution_combo (HWND hDlg)
 {
-    int i = 0, idx = -1;
+    int i, idx;
     TCHAR tmp[64];
     struct MultiDisplay *md = getdisplay (&workprefs);
 
+    idx = -1;
     SendDlgItemMessage(hDlg, IDC_RESOLUTION, CB_RESETCONTENT, 0, 0);
-    while (md->DisplayModes[i].depth >= 0) {
+    for (i = 0; md->DisplayModes[i].depth >= 0; i++) {
        if (md->DisplayModes[i].depth > 1 && md->DisplayModes[i].residx != idx) {
            _stprintf (tmp, L"%dx%d", md->DisplayModes[i].res.width, md->DisplayModes[i].res.height);
+           if (md->DisplayModes[i].nondx)
+               _tcscat (tmp, L" (*)");
            SendDlgItemMessage(hDlg, IDC_RESOLUTION, CB_ADDSTRING, 0, (LPARAM)tmp);
            idx = md->DisplayModes[i].residx;
        }
-       i++;
     }
 }
 static void init_displays_combo (HWND hDlg)
@@ -5023,7 +5040,7 @@ static void values_from_displaydlg (HWND hDlg, UINT msg, WPARAM wParam, LPARAM l
                workprefs.gfx_refreshrate = 0;
            } else {
                posn1--;
-               workprefs.gfx_refreshrate = storedrefreshrates[posn1];
+               workprefs.gfx_refreshrate = storedrefreshrates[posn1].rate;
            }
            values_to_displaydlg (hDlg);
        } else if (LOWORD (wParam) == IDC_DA_MODE) {
@@ -9300,6 +9317,7 @@ static void values_from_portsdlg (HWND hDlg)
 static void values_to_portsdlg (HWND hDlg)
 {
     LRESULT result = 0;
+    int idx;
 
     if(workprefs.prtname[0]) {
        int i, got = 1;
@@ -9325,9 +9343,13 @@ static void values_to_portsdlg (HWND hDlg)
        }
     }
     SetDlgItemInt (hDlg, IDC_PRINTERAUTOFLUSH, workprefs.parallel_autoflush_time, FALSE);
-    CheckDlgButton (hDlg, IDC_ASCIIPRINTER, workprefs.parallel_ascii_emulation);
-    CheckDlgButton (hDlg, IDC_PSPRINTER, workprefs.parallel_postscript_emulation);
-    CheckDlgButton (hDlg, IDC_PSPRINTERDETECT, workprefs.parallel_postscript_detection);
+    idx = workprefs.parallel_matrix_emulation;
+    if (workprefs.parallel_postscript_detection)
+       idx = 2;
+    if (workprefs.parallel_postscript_emulation)
+       idx = 3;
+    SendDlgItemMessage (hDlg, IDC_PRINTERTYPELIST, CB_SETCURSEL, idx, 0);
+
     SetDlgItemText (hDlg, IDC_PS_PARAMS, workprefs.ghostscript_parameters);
 
     SendDlgItemMessage (hDlg, IDC_PRINTERLIST, CB_SETCURSEL, result, 0);
@@ -9377,6 +9399,7 @@ static void init_portsdlg (HWND hDlg)
     int port, numdevs;
     MIDIOUTCAPS midiOutCaps;
     MIDIINCAPS midiInCaps;
+    TCHAR tmp[MAX_DPATH];
 
     if (!first) {
        first = 1;
@@ -9395,6 +9418,18 @@ static void init_portsdlg (HWND hDlg)
        SendDlgItemMessage (hDlg, IDC_SERIAL, CB_ADDSTRING, 0, (LPARAM)comports[port].name);
     }
 
+    SendDlgItemMessage (hDlg, IDC_PRINTERTYPELIST, CB_RESETCONTENT, 0, 0L);
+    WIN32GUI_LoadUIString (IDS_PRINTER_PASSTHROUGH, tmp, MAX_DPATH);
+    SendDlgItemMessage (hDlg, IDC_PRINTERTYPELIST, CB_ADDSTRING, 0, (LPARAM)tmp);
+    WIN32GUI_LoadUIString (IDS_PRINTER_ASCII, tmp, MAX_DPATH);
+    SendDlgItemMessage (hDlg, IDC_PRINTERTYPELIST, CB_ADDSTRING, 0, (LPARAM)tmp);
+    WIN32GUI_LoadUIString (IDS_PRINTER_EPSON, tmp, MAX_DPATH);
+    SendDlgItemMessage (hDlg, IDC_PRINTERTYPELIST, CB_ADDSTRING, 0, (LPARAM)tmp);
+    WIN32GUI_LoadUIString (IDS_PRINTER_POSTSCRIPT_DETECTION, tmp, MAX_DPATH);
+    SendDlgItemMessage (hDlg, IDC_PRINTERTYPELIST, CB_ADDSTRING, 0, (LPARAM)tmp);
+    WIN32GUI_LoadUIString (IDS_PRINTER_POSTSCRIPT_EMULATION, tmp, MAX_DPATH);
+    SendDlgItemMessage (hDlg, IDC_PRINTERTYPELIST, CB_ADDSTRING, 0, (LPARAM)tmp);
+
     SendDlgItemMessage (hDlg, IDC_PRINTERLIST, CB_RESETCONTENT, 0, 0L);
     SendDlgItemMessage (hDlg, IDC_PRINTERLIST, CB_ADDSTRING, 0, (LPARAM)szNone);
     if(!pInfo) {
@@ -9595,20 +9630,6 @@ static INT_PTR CALLBACK IOPortsDlgProc (HWND hDlg, UINT msg, WPARAM wParam, LPAR
            if (isprinter ()) {
                closeprinter ();
            }
-       } else if (wParam == IDC_ASCIIPRINTER) {
-           workprefs.parallel_ascii_emulation = IsDlgButtonChecked (hDlg, IDC_ASCIIPRINTER) ? 1 : 0;
-           if (workprefs.parallel_ascii_emulation)
-               workprefs.parallel_postscript_detection = 0;
-       } else if (wParam == IDC_PSPRINTER) {
-           workprefs.parallel_postscript_emulation = IsDlgButtonChecked (hDlg, IDC_PSPRINTER) ? 1 : 0;
-           if (workprefs.parallel_postscript_emulation)
-               CheckDlgButton (hDlg, IDC_PSPRINTERDETECT, 1);
-       } else if (wParam == IDC_PSPRINTERDETECT) {
-           workprefs.parallel_postscript_detection = IsDlgButtonChecked (hDlg, IDC_PSPRINTERDETECT) ? 1 : 0;
-           if (!workprefs.parallel_postscript_detection) {
-               CheckDlgButton (hDlg, IDC_PSPRINTER, 0);
-               workprefs.parallel_ascii_emulation = 0;
-           }
        } else if (wParam == IDC_UAESERIAL || wParam == IDC_SER_SHARED || wParam == IDC_SER_DIRECT || wParam == IDC_SER_CTSRTS || wParam == IDC_PRINTERAUTOFLUSH) {
            values_from_portsdlg (hDlg);
        } else {
@@ -9623,6 +9644,27 @@ static INT_PTR CALLBACK IOPortsDlgProc (HWND hDlg, UINT msg, WPARAM wParam, LPAR
                        inputdevice_updateconfig (&workprefs);
                        inputdevice_config_change ();
                    break;
+                   case IDC_PRINTERTYPELIST:
+                   {
+                       int item = SendDlgItemMessage (hDlg, IDC_PRINTERTYPELIST, CB_GETCURSEL, 0, 0L);
+                       workprefs.parallel_postscript_detection = workprefs.parallel_postscript_emulation = workprefs.parallel_matrix_emulation = 0;
+                       switch (item)
+                       {
+                       case 1:
+                           workprefs.parallel_matrix_emulation = 1;
+                       break;
+                       case 2:
+                           workprefs.parallel_matrix_emulation = 2;
+                       break;
+                       case 3:
+                           workprefs.parallel_postscript_detection = 1;
+                       break;
+                       case 4:
+                           workprefs.parallel_postscript_detection = 1;
+                           workprefs.parallel_postscript_emulation = 1;
+                       break;
+                       }
+                   }
                }
            }
        }
index 31f24732ed5673b149a8ae2507cd5d0945faca11..f0609bcaca7dcb3294886c4efaf1d75f5efd57ba 100644 (file)
                        <Tool
                                Name="VCLinkerTool"
                                AdditionalOptions="/MACHINE:I386"
-                               AdditionalDependencies="opengl32.lib glu32.lib ws2_32.lib ddraw.lib dxguid.lib winmm.lib comctl32.lib version.lib vfw32.lib msacm32.lib dsound.lib dinput8.lib d3d9.lib d3dx9.lib winio.lib setupapi.lib wininet.lib capsimg.lib dxerr9.lib shlwapi.lib zlibstat.lib libpng.lib lglcd.lib wpcap.lib packet.lib openal32.lib wintab32.lib portaudio_x86.lib"
+                               AdditionalDependencies="opengl32.lib glu32.lib ws2_32.lib ddraw.lib dxguid.lib winmm.lib comctl32.lib version.lib vfw32.lib msacm32.lib dsound.lib dinput8.lib d3d9.lib d3dx9.lib winio.lib setupapi.lib wininet.lib capsimg.lib dxerr9.lib shlwapi.lib zlibstat.lib libpng.lib lglcd.lib wpcap.lib packet.lib openal32.lib wintab32.lib portaudio_x86.lib freetype.lib"
                                ShowProgress="0"
                                OutputFile="d:\amiga\winuae.exe"
                                LinkIncremental="2"
                                SuppressStartupBanner="true"
                                GenerateManifest="false"
-                               DelayLoadDLLs="wpcap.dll;packet.dll;d3dx9_41.dll;openal32.dll;wintab32.dll;portaudio_x86.dll"
+                               DelayLoadDLLs="wpcap.dll;packet.dll;d3dx9_41.dll;openal32.dll;wintab32.dll;portaudio_x86.dll;freetype6.dll"
                                GenerateDebugInformation="true"
                                ProgramDatabaseFile=".\Debug/winuae.pdb"
                                SubSystem="2"
                        />
                        <Tool
                                Name="VCLinkerTool"
-                               AdditionalDependencies="opengl32.lib glu32.lib ws2_32.lib ddraw.lib dxguid.lib winmm.lib comctl32.lib version.lib vfw32.lib msacm32.lib dsound.lib dinput8.lib d3d9.lib d3dx9.lib winio.lib setupapi.lib wininet.lib dxerr9.lib shlwapi.lib zlibstat.lib libpng.lib lglcd.lib wpcap.lib packet.lib openal32.lib wintab32.lib portaudio_x86.lib"
+                               AdditionalDependencies="opengl32.lib glu32.lib ws2_32.lib ddraw.lib dxguid.lib winmm.lib comctl32.lib version.lib vfw32.lib msacm32.lib dsound.lib dinput8.lib d3d9.lib d3dx9.lib winio.lib setupapi.lib wininet.lib dxerr9.lib shlwapi.lib zlibstat.lib libpng.lib lglcd.lib wpcap.lib packet.lib openal32.lib wintab32.lib portaudio_x86.lib freetype.lib"
                                OutputFile="d:\amiga\winuae.exe"
                                LinkIncremental="1"
                                SuppressStartupBanner="true"
                                AdditionalLibraryDirectories=""
                                GenerateManifest="true"
                                AdditionalManifestDependencies=""
-                               DelayLoadDLLs="wpcap.dll;packet.dll;d3dx9_41.dll;openal32.dll;wintab32.dll;portaudio_x86.dll"
+                               DelayLoadDLLs="wpcap.dll;packet.dll;d3dx9_41.dll;openal32.dll;wintab32.dll;portaudio_x86.dll;freetype6.dll"
                                GenerateDebugInformation="true"
                                ProgramDatabaseFile=".\Release/winuae.pdb"
                                SubSystem="2"
                        />
                        <Tool
                                Name="VCLinkerTool"
-                               AdditionalDependencies="opengl32.lib glu32.lib ws2_32.lib ddraw.lib dxguid.lib winmm.lib comctl32.lib version.lib vfw32.lib msacm32.lib dsound.lib dinput8.lib d3d9.lib d3dx9.lib winio.lib setupapi.lib wininet.lib dxerr9.lib shlwapi.lib zlibstat.lib libpng.lib lglcd.lib wpcap.lib packet.lib openal32.lib wintab32.lib portaudio_x86.lib"
+                               AdditionalDependencies="opengl32.lib glu32.lib ws2_32.lib ddraw.lib dxguid.lib winmm.lib comctl32.lib version.lib vfw32.lib msacm32.lib dsound.lib dinput8.lib d3d9.lib d3dx9.lib winio.lib setupapi.lib wininet.lib dxerr9.lib shlwapi.lib zlibstat.lib libpng.lib lglcd.lib wpcap.lib packet.lib openal32.lib wintab32.lib portaudio_x86.lib freetype.lib"
                                OutputFile="d:\amiga\winuae.exe"
                                LinkIncremental="1"
                                SuppressStartupBanner="true"
                                AdditionalLibraryDirectories=""
                                GenerateManifest="true"
                                AdditionalManifestDependencies=""
-                               DelayLoadDLLs="wpcap.dll;packet.dll;d3dx9_41.dll;openal32.dll;wintab32.dll;portaudio_x86.dll"
+                               DelayLoadDLLs="wpcap.dll;packet.dll;d3dx9_41.dll;openal32.dll;wintab32.dll;portaudio_x86.dll;freetype6.dll"
                                GenerateDebugInformation="true"
                                ProgramDatabaseFile=".\FullRelease/winuae.pdb"
                                SubSystem="2"
                                RelativePath="..\..\enforcer.c"
                                >
                        </File>
+                       <File
+                               RelativePath="..\..\epsonprinter.c"
+                               >
+                       </File>
                        <File
                                RelativePath="..\..\ersatz.c"
                                >
index cf3892035ca269d72d71114bdeba3e6607b742e3..48e5180b0a564e725cf7a2141a2dda2b85277ab0 100644 (file)
@@ -1,4 +1,34 @@
 
+Beta 28: (RC1)
+
+- re-added CD32 emulation hack that was removed in b4, fixes unreliable
+  booting in non-JIT modes (do not return TOC until "turn led on/off"
+  command is received. At that time led command was unknown command,
+  now I am quite sure this can't be the correct way to do it..)
+- Rainbow Islands one missing horizontal line fixed ("Ode to Ramon"
+  scanline fix broke this, OCS-only)
+- printer GUI changed, checkboxes replaced with select menu.
+  Passthrough: no changes, original printing method.
+  ASCII-only: prints only basic ASCII text.
+  Epson matrix printer emulation: you do not need to know. yet.
+  PostScript options: no changes.
+- list also supposedly unsupported modes/refresh rates in resolution
+  list, marked with '*'. Ignore modes that have larger resolution
+  than largest supported mode and modes that have 75Hz or higher
+  refresh rate (just to be in safe side..) Some display drivers
+  don't return custom resolutions in "monitor supported" list..
+- loaded configuration files, disk images and statefiles are added to
+  recent list (includes Windows 7 jump list support)
+- more accurate audio Paula/native rate conversion (from UADE, I was
+  supposed to merge this fix long long time ago..), this fix and some
+  sound sync code updates mean much improved sound sync (SND% should
+  be much more stable now, including vsync modes)
+- filter-panel aspect ratio works as expected, aspect ratio selected
+  is monitor's aspect ratio and automatic = aspect ratio calculated
+  from desktop resolution (if fullscreen) or window size (if windowed)
+- added hack that fixes Pang (and perhaps others) graphics problem,
+  real fix coming (much) later..
+
 Beta 27:
 
 - on screen led was always enabled (b26)
diff --git a/scsi-none.c b/scsi-none.c
deleted file mode 100644 (file)
index 58a1132..0000000
+++ /dev/null
@@ -1,9 +0,0 @@
-#include "sysconfig.h"
-#include "sysdeps.h"
-
-#include "scsidev.h"
-
-uaecptr scsidev_startup (uaecptr resaddr) { return resaddr; }
-void scsidev_install (void) {}
-void scsidev_reset (void) {}
-void scsidev_start_threads (void) {}
diff --git a/sdl-joystick.c b/sdl-joystick.c
deleted file mode 100644 (file)
index 8b34a38..0000000
+++ /dev/null
@@ -1,157 +0,0 @@
- /*
-  * UAE - The Un*x Amiga Emulator
-  *
-  * SDL Joystick code
-  *
-  * Copyright 1997 Bernd Schmidt
-  * Copyright 1998 Krister Walfridsson
-  */
-
-#include "sysconfig.h"
-#include "sysdeps.h"
-
-#include "config.h"
-#include "options.h"
-#include "memory.h"
-#include "custom.h"
-#include "inputdevice.h"
-#include "SDL.h"
-
-static int nr_joysticks;
-
-struct joyinfo {
-    SDL_Joystick *joy;
-    int axles;
-    int buttons;
-};
-
-static struct joyinfo joys[MAX_INPUT_DEVICES];
-
-static int isjoy (int pcport, int amigaport)
-{
-    if (pcport == 0)
-       return JSEM_ISJOY0 (amigaport, &currprefs);
-    else
-       return JSEM_ISJOY1 (amigaport, &currprefs);
-}
-
-static void read_joy(int nr)
-{
-    int num, i, axes, axis;
-    SDL_Joystick *joy;
-
-    if (currprefs.input_selected_setting == 0) {
-       if (nr >= 2)
-           return;
-       if (isjoy (nr, 0)) {
-           if (JSEM_ISNUMPAD (0, &currprefs) || JSEM_ISCURSOR (0, &currprefs) || JSEM_ISSOMEWHEREELSE (0, &currprefs))
-               return;
-       } else if (isjoy (nr, 1)) {
-           if (JSEM_ISNUMPAD (1, &currprefs) || JSEM_ISCURSOR (1, &currprefs) || JSEM_ISSOMEWHEREELSE (1, &currprefs))
-               return;
-       } else
-           return;
-    }
-    joy = joys[nr].joy;
-    axes = SDL_JoystickNumAxes (joy);
-    for (i = 0; i < axes; i++) {
-       axis = SDL_JoystickGetAxis (joy, i);
-       setjoystickstate (nr, i, axis, 32767);
-    }
-
-    num = SDL_JoystickNumButtons (joy);
-    for (i = 0; i < num; i++) {
-       int bs = SDL_JoystickGetButton (joy, i) ? 1 : 0;
-       setjoybuttonstate (nr, i, bs);
-    }
-}
-
-static int get_joystick_num (void)
-{
-    return nr_joysticks;
-}
-
-static int get_joystick_widget_num (int joy)
-{
-    return joys[joy].axles + joys[joy].buttons;
-}
-
-static int get_joystick_widget_type (int joy, int num, char *name)
-{
-    if (num >= joys[joy].axles && num < joys[joy].axles + joys[joy].buttons) {
-       if (name)
-           sprintf (name, "Button %d", num + 1 - joys[joy].axles);
-       return IDEV_WIDGET_BUTTON;
-    } else if (num < joys[joy].axles) {
-       if (name)
-           sprintf (name, "Axis %d", num + 1);
-       return IDEV_WIDGET_AXIS;
-    }
-    return IDEV_WIDGET_NONE;
-}
-
-static int get_joystick_widget_first (int joy, int type)
-{
-    switch (type)
-    {
-       case IDEV_WIDGET_BUTTON:
-       return joys[joy].axles;
-       case IDEV_WIDGET_AXIS:
-       return 0;
-    }
-    return -1;
-}
-
-static char *get_joystick_name (int joy)
-{
-    static char name[100];
-    sprintf (name, "%d: %s", joy + 1, SDL_JoystickName (joy));
-    return name;
-}
-
-static void read_joysticks (void)
-{
-    int i;
-    SDL_JoystickUpdate ();
-    for (i = 0; i < get_joystick_num(); i++)
-       read_joy (i);
-}
-
-static int init_joysticks (void)
-{
-    int i;
-    nr_joysticks = SDL_NumJoysticks ();
-    if (nr_joysticks > MAX_INPUT_DEVICES)
-       nr_joysticks = MAX_INPUT_DEVICES;
-    for (i = 0; i < get_joystick_num(); i++) {
-       joys[i].joy = SDL_JoystickOpen (i);
-       joys[i].axles = SDL_JoystickNumAxes (joys[i].joy);
-       joys[i].buttons = SDL_JoystickNumButtons (joys[i].joy);
-    }
-    return 1;
-}
-
-static void close_joysticks (void)
-{
-    int i;
-    for (i = 0; i < get_joystick_num(); i++) {
-       SDL_JoystickClose (joys[i].joy);
-       joys[i].joy = 0;
-    }
-}
-
-static int acquire_joy (int num, int flags)
-{
-    return 1;
-}
-
-static void unacquire_joy (int num)
-{
-}
-
-struct inputdevice_functions inputdevicefunc_joystick = {
-    init_joysticks, close_joysticks, acquire_joy, unacquire_joy,
-    read_joysticks, get_joystick_num, get_joystick_name,
-    get_joystick_widget_num, get_joystick_widget_type,
-    get_joystick_widget_first
-};
diff --git a/svga.c b/svga.c
deleted file mode 100644 (file)
index df5dea6..0000000
--- a/svga.c
+++ /dev/null
@@ -1,945 +0,0 @@
- /*
-  * UAE - The Un*x Amiga Emulator
-  *
-  * SVGAlib interface.
-  *
-  * (c) 1995 Bernd Schmidt
-  */
-
-#include "sysconfig.h"
-#include "sysdeps.h"
-
-#include <assert.h>
-#include <ctype.h>
-#include <signal.h>
-#include <vga.h>
-#include <vgamouse.h>
-#include <vgakeyboard.h>
-
-#include "config.h"
-#include "options.h"
-#include "threaddep/thread.h"
-#include "uae.h"
-#include "memory.h"
-#include "keyboard.h"
-#include "xwin.h"
-#include "custom.h"
-#include "drawing.h"
-#include "keybuf.h"
-#include "newcpu.h"
-#include "tui.h"
-#include "gui.h"
-#include "picasso96.h"
-
-#define SCODE_CB_UP    103     /* Cursor key block. */
-#define SCODE_CB_LEFT  105
-#define SCODE_CB_RIGHT 106
-#define SCODE_CB_DOWN  108
-
-#define SCODE_INSERT   110
-#define SCODE_HOME     102
-#define SCODE_PGUP     104
-#define SCODE_DELETE   111
-#define SCODE_END      107
-#define SCODE_PGDN     109
-
-#define SCODE_PRTSCR   99
-#define SCODE_SLOCK    70
-#define SCODE_BREAK    119
-
-#define SCODE_NUMLOCK  69
-
-#define SCODE_KEYPAD0  82
-#define SCODE_KEYPAD1  79
-#define SCODE_KEYPAD2  80
-#define SCODE_KEYPAD3  81
-#define SCODE_KEYPAD4  75
-#define SCODE_KEYPAD5  76
-#define SCODE_KEYPAD6  77
-#define SCODE_KEYPAD7  71
-#define SCODE_KEYPAD8  72
-#define SCODE_KEYPAD9  73
-#define SCODE_KEYPADRET        96
-#define SCODE_KEYPADADD        78
-#define SCODE_KEYPADSUB        74
-#define SCODE_KEYPADMUL        55
-#define SCODE_KEYPADDIV        98
-#define SCODE_KEYPADDOT 83
-
-#define SCODE_Q                16
-#define SCODE_W                17
-#define SCODE_E                18
-#define SCODE_R                19
-#define SCODE_T                20
-#define SCODE_Y                21
-#define SCODE_U                22
-#define SCODE_I                23
-#define SCODE_O                24
-#define SCODE_P                25
-
-#define SCODE_A                30
-#define SCODE_S                31
-#define SCODE_D                32
-#define SCODE_F                33
-#define SCODE_G                34
-#define SCODE_H                35
-#define SCODE_J                36
-#define SCODE_K                37
-#define SCODE_L                38
-
-#define SCODE_Z                44
-#define SCODE_X                45
-#define SCODE_C                46
-#define SCODE_V                47
-#define SCODE_B                48
-#define SCODE_N                49
-#define SCODE_M                50
-
-#define SCODE_ESCAPE   1
-#define SCODE_ENTER    28
-#define SCODE_RCONTROL 97
-#define SCODE_CONTROL  97
-#define SCODE_RALT     100
-#define SCODE_LCONTROL 29
-#define SCODE_LALT     56
-#define SCODE_SPACE    57
-
-#define SCODE_F1       59
-#define SCODE_F2       60
-#define SCODE_F3       61
-#define SCODE_F4       62
-#define SCODE_F5       63
-#define SCODE_F6       64
-#define SCODE_F7       65
-#define SCODE_F8       66
-#define SCODE_F9       67
-#define SCODE_F10      68
-#define SCODE_F11      87
-#define SCODE_F12      88
-
-#define SCODE_0                11
-#define SCODE_1                2
-#define SCODE_2                3
-#define SCODE_3                4
-#define SCODE_4                5
-#define SCODE_5                6
-#define SCODE_6                7
-#define SCODE_7                8
-#define SCODE_8                9
-#define SCODE_9        10
-
-#define SCODE_LSHIFT   42
-#define SCODE_RSHIFT   54
-#define SCODE_TAB      15
-
-#define SCODE_BS       14
-
-#define SCODE_asciicircum      41
-
-#define SCODE_bracketleft      26
-#define SCODE_bracketright     27
-#define SCODE_comma    51
-#define SCODE_period   52
-#define SCODE_slash    53
-#define SCODE_semicolon        39
-#define SCODE_grave    40
-#define SCODE_minus    12
-#define SCODE_equal    13
-#define SCODE_numbersign       43
-#define SCODE_ltgt     86
-
-#define SCODE_LWIN95 125
-#define SCODE_RWIN95 126
-#define SCODE_MWIN95 127
-
-void setup_brkhandler(void)
-{
-}
-
-static int bitdepth, bit_unit, using_linear, vgamode, current_vgamode, gui_requested;
-static vga_modeinfo modeinfo;
-static char *linear_mem = NULL;
-static int need_dither;
-static int screen_is_picasso;
-static int picasso_vgamode = -1;
-static char picasso_invalid_lines[1200];
-
-static uae_u8 dither_buf[1000]; /* I hate having to think about array bounds */
-
-#define MAX_SCREEN_MODES 9
-
-static int x_size_table[MAX_SCREEN_MODES] = { 320, 320, 320, 640, 640, 800, 1024, 1152, 1280 };
-static int y_size_table[MAX_SCREEN_MODES] = { 200, 240, 400, 350, 480, 600, 768, 864, 1024 };
-
-static int vga_mode_table[MAX_SCREEN_MODES][MAX_COLOR_MODES+1] =
- { { G320x200x256, G320x200x32K, G320x200x64K, G320x200x256, G320x200x16, G320x200x16M32 },
-   { G320x240x256, -1, -1, G320x240x256, -1, -1 },
-   { G320x400x256, -1, -1, G320x400x256, -1, -1 },
-   { -1, -1, -1, -1, G640x350x16, -1 },
-   { G640x480x256, G640x480x32K, G640x480x64K, G640x480x256, G640x480x16, G640x480x16M32 },
-   { G800x600x256, G800x600x32K, G800x600x64K, G800x600x256, G800x600x16, G800x600x16M32 },
-   { G1024x768x256, G1024x768x32K, G1024x768x64K, G1024x768x256, G1024x768x16, G1024x768x16M32 },
-   { G1152x864x256, G1152x864x32K, G1152x864x64K, G1152x864x256, G1152x864x16, G1152x864x16M32 },
-   { G1280x1024x256, G1280x1024x32K, G1280x1024x64K, G1280x1024x256, G1280x1024x16, G1280x1024x16M32 }
- };
-
-static int mode_bitdepth[MAX_COLOR_MODES+1][3] =
-  { { 8, 8, 0 }, { 15, 16, 0 }, { 16, 16, 0 }, { 8, 8, 1 }, { 4, 8, 1 }, { 24, 32, 0 } };
-
-struct bstring *video_mode_menu = NULL;
-
-void flush_line(int y)
-{
-    int target_y = y;
-    char *addr;
-
-    if (linear_mem != NULL && !need_dither)
-       return;
-
-    addr = gfxvidinfo.linemem;
-    if (addr == NULL)
-       addr = gfxvidinfo.bufmem + y*gfxvidinfo.rowbytes;
-
-    if (linear_mem == NULL) {
-       if (target_y < modeinfo.height && target_y >= 0) {
-           if (need_dither) {
-               DitherLine (dither_buf, (uae_u16 *)addr, 0, y, gfxvidinfo.width, bit_unit);
-               addr = dither_buf;
-           }
-           vga_drawscanline(target_y, addr);
-       }
-    } else {
-       if (need_dither && target_y >= 0) {
-           DitherLine (linear_mem + modeinfo.linewidth * target_y, (uae_u16 *)addr, 0, y,
-                       gfxvidinfo.width, bit_unit);
-       }
-    }
-}
-
-void flush_block (int a, int b)
-{
-    abort();
-}
-
-void flush_screen (int a, int b)
-{
-}
-
-static int colors_allocated;
-static long palette_entries[256][3];
-
-static void restore_vga_colors (void)
-{
-    int i;
-    if (gfxvidinfo.pixbytes != 1)
-       return;
-    for (i = 0; i < 256; i++)
-       vga_setpalette (i, palette_entries[i][0], palette_entries[i][1], palette_entries[i][2]);
-}
-
-static int get_color (int r, int g, int b, xcolnr *cnp)
-{
-    if (colors_allocated == 256)
-       return -1;
-    *cnp = colors_allocated;
-    palette_entries[colors_allocated][0] = doMask (r, 6, 0);
-    palette_entries[colors_allocated][1] = doMask (g, 6, 0);
-    palette_entries[colors_allocated][2] = doMask (b, 6, 0);
-    vga_setpalette(colors_allocated, doMask (r, 6, 0), doMask (g, 6, 0), doMask (b, 6, 0));
-    colors_allocated++;
-    return 1;
-}
-
-static void init_colors (void)
-{
-    int i;
-    if (need_dither) {
-       setup_dither (bitdepth, get_color);
-    } else {
-       int rw = 5, gw = 5, bw = 5;
-       colors_allocated = 0;
-       if (currprefs.color_mode == 2) gw = 6;
-
-       switch (gfxvidinfo.pixbytes) {
-        case 4:
-           alloc_colors64k (8, 8, 8, 16, 8, 0);
-           break;
-        case 2:
-           alloc_colors64k (rw, gw, bw, gw+bw, bw, 0);
-           break;
-        case 1:
-           alloc_colors256 (get_color);
-           break;
-        default:
-           abort();
-       }
-    }
-    switch (gfxvidinfo.pixbytes) {
-     case 2:
-       for (i = 0; i < 4096; i++)
-           xcolors[i] = xcolors[i] * 0x00010001;
-       gfxvidinfo.can_double = 1;
-       break;
-     case 1:
-       for (i = 0; i < 4096; i++)
-           xcolors[i] = xcolors[i] * 0x01010101;
-       gfxvidinfo.can_double = 1;
-       break;
-     default:
-       gfxvidinfo.can_double = 0;
-       break;
-    }
-}
-
-static int keystate[256];
-
-static int scancode2amiga (int scancode)
-{
-    switch (scancode) {
-     case SCODE_A: return AK_A;
-     case SCODE_B: return AK_B;
-     case SCODE_C: return AK_C;
-     case SCODE_D: return AK_D;
-     case SCODE_E: return AK_E;
-     case SCODE_F: return AK_F;
-     case SCODE_G: return AK_G;
-     case SCODE_H: return AK_H;
-     case SCODE_I: return AK_I;
-     case SCODE_J: return AK_J;
-     case SCODE_K: return AK_K;
-     case SCODE_L: return AK_L;
-     case SCODE_M: return AK_M;
-     case SCODE_N: return AK_N;
-     case SCODE_O: return AK_O;
-     case SCODE_P: return AK_P;
-     case SCODE_Q: return AK_Q;
-     case SCODE_R: return AK_R;
-     case SCODE_S: return AK_S;
-     case SCODE_T: return AK_T;
-     case SCODE_U: return AK_U;
-     case SCODE_V: return AK_V;
-     case SCODE_W: return AK_W;
-     case SCODE_X: return AK_X;
-     case SCODE_Y: return AK_Y;
-     case SCODE_Z: return AK_Z;
-
-     case SCODE_0: return AK_0;
-     case SCODE_1: return AK_1;
-     case SCODE_2: return AK_2;
-     case SCODE_3: return AK_3;
-     case SCODE_4: return AK_4;
-     case SCODE_5: return AK_5;
-     case SCODE_6: return AK_6;
-     case SCODE_7: return AK_7;
-     case SCODE_8: return AK_8;
-     case SCODE_9: return AK_9;
-
-     case SCODE_KEYPAD0: return AK_NP0;
-     case SCODE_KEYPAD1: return AK_NP1;
-     case SCODE_KEYPAD2: return AK_NP2;
-     case SCODE_KEYPAD3: return AK_NP3;
-     case SCODE_KEYPAD4: return AK_NP4;
-     case SCODE_KEYPAD5: return AK_NP5;
-     case SCODE_KEYPAD6: return AK_NP6;
-     case SCODE_KEYPAD7: return AK_NP7;
-     case SCODE_KEYPAD8: return AK_NP8;
-     case SCODE_KEYPAD9: return AK_NP9;
-
-     case SCODE_KEYPADADD: return AK_NPADD;
-     case SCODE_KEYPADSUB: return AK_NPSUB;
-     case SCODE_KEYPADMUL: return AK_NPMUL;
-     case SCODE_KEYPADDIV: return AK_NPDIV;
-     case SCODE_KEYPADRET: return AK_ENT;
-     case SCODE_KEYPADDOT: return AK_NPDEL;
-
-     case SCODE_F1: return AK_F1;
-     case SCODE_F2: return AK_F2;
-     case SCODE_F3: return AK_F3;
-     case SCODE_F4: return AK_F4;
-     case SCODE_F5: return AK_F5;
-     case SCODE_F6: return AK_F6;
-     case SCODE_F7: return AK_F7;
-     case SCODE_F8: return AK_F8;
-     case SCODE_F9: return AK_F9;
-     case SCODE_F10: return AK_F10;
-
-     case SCODE_BS: return AK_BS;
-     case SCODE_LCONTROL: return AK_CTRL;
-     case SCODE_RCONTROL: return AK_RCTRL;
-     case SCODE_TAB: return AK_TAB;
-     case SCODE_LALT: return AK_LALT;
-     case SCODE_RALT: return AK_RALT;
-     case SCODE_ENTER: return AK_RET;
-     case SCODE_SPACE: return AK_SPC;
-     case SCODE_LSHIFT: return AK_LSH;
-     case SCODE_RSHIFT: return AK_RSH;
-     case SCODE_ESCAPE: return AK_ESC;
-
-     case SCODE_INSERT: return AK_HELP;
-     case SCODE_END: return AK_NPRPAREN;
-     case SCODE_HOME: return AK_NPLPAREN;
-
-     case SCODE_DELETE: return AK_DEL;
-     case SCODE_CB_UP: return AK_UP;
-     case SCODE_CB_DOWN: return AK_DN;
-     case SCODE_CB_LEFT: return AK_LF;
-     case SCODE_CB_RIGHT: return AK_RT;
-
-     case SCODE_PRTSCR: return AK_BACKSLASH;
-     case SCODE_asciicircum: return AK_BACKQUOTE;
-     case SCODE_bracketleft: return AK_LBRACKET;
-     case SCODE_bracketright: return AK_RBRACKET;
-     case SCODE_comma: return AK_COMMA;
-     case SCODE_period: return AK_PERIOD;
-     case SCODE_slash: return AK_SLASH;
-     case SCODE_semicolon: return AK_SEMICOLON;
-     case SCODE_grave: return AK_QUOTE;
-     case SCODE_minus: return AK_MINUS;
-     case SCODE_equal: return AK_EQUAL;
-
-       /* This one turns off screen updates. */
-     case SCODE_SLOCK: return AK_inhibit;
-
-     case SCODE_PGUP: case SCODE_RWIN95: return AK_RAMI;
-     case SCODE_PGDN: case SCODE_LWIN95: return AK_LAMI;
-
-/*#ifdef KBD_LANG_DE*/
-     case SCODE_numbersign: return AK_NUMBERSIGN;
-     case SCODE_ltgt: return AK_LTGT;
-/*#endif*/
-    }
-    return -1;
-}
-
-static void my_kbd_handler (int scancode, int newstate)
-{
-    int akey = scancode2amiga (scancode);
-
-    assert (scancode >= 0 && scancode < 0x100);
-    if (scancode == SCODE_F12) {
-       uae_quit ();
-    } else if (scancode == SCODE_F11) {
-       gui_requested = 1;
-    }
-    if (keystate[scancode] == newstate)
-       return;
-
-    keystate[scancode] = newstate;
-
-    if (akey == -1)
-       return;
-
-    if (newstate == KEY_EVENTPRESS) {
-       if (akey == AK_inhibit)
-           toggle_inhibit_frame (0);
-       else
-           record_key (akey << 1);
-    } else
-       record_key ((akey << 1) | 1);
-
-    /* "Affengriff" */
-    if ((keystate[AK_CTRL] || keystate[AK_RCTRL]) && keystate[AK_LAMI] && keystate[AK_RAMI])
-       uae_reset ();
-}
-
-static void leave_graphics_mode (void)
-{
-    keyboard_close ();
-    mouse_close ();
-    sleep (1); /* Maybe this will fix the "screen full of garbage" problem */
-    current_vgamode = TEXT;
-    vga_setmode (TEXT);
-}
-
-static int post_enter_graphics (void)
-{
-    vga_setmousesupport (1);
-    mouse_init("/dev/mouse", vga_getmousetype (), 10);
-    if (keyboard_init() != 0) {
-       leave_graphics_mode ();
-       write_log ("Are you sure you have a keyboard??\n");
-       return 0;
-    }
-    keyboard_seteventhandler (my_kbd_handler);
-    keyboard_translatekeys (DONT_CATCH_CTRLC);
-
-    mouse_setxrange (-1000, 1000);
-    mouse_setyrange (-1000, 1000);
-    mouse_setposition (0, 0);
-
-    return 1;
-}
-
-static int enter_graphics_mode (int which)
-{
-    int oldmode = current_vgamode;
-    vga_setmode (TEXT);
-    if (vga_setmode (which) < 0) {
-       sleep(1);
-       vga_setmode (TEXT);
-       write_log ("SVGAlib doesn't like my video mode (%d). Giving up.\n", which);
-       return 0;
-    }
-    current_vgamode = which;
-
-    linear_mem = 0;
-    if ((modeinfo.flags & CAPABLE_LINEAR) && ! currprefs.svga_no_linear) {
-       int val = vga_setlinearaddressing ();
-       int new_ul = val != -1 ? !need_dither : 0;
-       if (using_linear == -1)
-           using_linear = new_ul;
-       else
-           if (using_linear != new_ul) {
-               leave_graphics_mode ();
-               write_log ("SVGAlib feeling not sure about linear modes???\n");
-               abort ();
-           }
-       if (val != -1) {
-           linear_mem = (char *)vga_getgraphmem ();
-           write_log ("Using linear addressing: %p.\n", linear_mem);
-       }
-    }
-
-    return post_enter_graphics ();
-}
-
-static int enter_graphics_mode_picasso (int which)
-{
-    int oldmode = current_vgamode;
-    if (which == oldmode)
-       return 1;
-
-    vga_setmode (TEXT);
-    if (vga_setmode (which) < 0) {
-       sleep (1);
-       vga_setmode (TEXT);
-       write_log ("SVGAlib doesn't like my video mode (%d). Giving up.\n", which);
-       exit (1);
-    }
-    current_vgamode = which;
-
-    linear_mem = 0;
-    if ((modeinfo.flags & CAPABLE_LINEAR) && ! currprefs.svga_no_linear) {
-       int val = vga_setlinearaddressing ();
-       if (val != -1) {
-           linear_mem = (char *)vga_getgraphmem ();
-           write_log ("Using linear addressing: %p.\n", linear_mem);
-       }
-    }
-
-    keyboard_close ();
-    mouse_close ();
-    return post_enter_graphics ();
-}
-
-int graphics_setup (void)
-{
-    int i,j, count = 1;
-
-    vga_init();
-
-    current_vgamode = TEXT;
-
-    for (i = 0; i < MAX_SCREEN_MODES; i++) {
-       /* Ignore the larger modes which only make sense for Picasso screens.  */
-       if (x_size_table[i] > 800 || y_size_table[i] > 600)
-           continue;
-
-       for (j = 0; j < MAX_COLOR_MODES+1; j++) {
-           /* Delete modes which are not available on this card.  */
-           if (!vga_hasmode (vga_mode_table[i][j])) {
-               vga_mode_table[i][j] = -1;
-           }
-
-           if (vga_mode_table[i][j] != -1)
-               count++;
-       }
-    }
-
-    video_mode_menu = (struct bstring *)malloc (sizeof (struct bstring)*count);
-    memset (video_mode_menu, 0, sizeof (struct bstring)*count);
-    count = 0;
-
-    for (i = 0; i < MAX_SCREEN_MODES; i++) {
-       /* Ignore the larger modes which only make sense for Picasso screens.  */
-       if (x_size_table[i] > 800 || y_size_table[i] > 600)
-           continue;
-
-       for (j = 0; j < MAX_COLOR_MODES+1; j++) {
-           char buf[80];
-           if (vga_mode_table[i][j] == -1)
-               continue;
-
-           sprintf (buf, "%3dx%d, %s", x_size_table[i], y_size_table[i],
-                    colormodes[j]);
-           video_mode_menu[count].val = -1;
-           video_mode_menu[count++].data = strdup(buf);
-       }
-    }
-    video_mode_menu[count].val = -3;
-    video_mode_menu[count++].data = NULL;
-    return 1;
-}
-
-void vidmode_menu_selected(int m)
-{
-    int i, j;
-    for (i = 0; i < MAX_SCREEN_MODES; i++) {
-       /* Ignore the larger modes which only make sense for Picasso screens.  */
-       if (x_size_table[i] > 800 || y_size_table[i] > 600)
-           continue;
-       for (j = 0; j < MAX_COLOR_MODES+1; j++) {
-           if (vga_mode_table[i][j] != -1)
-               if (!m--)
-                   goto found;
-
-       }
-    }
-    abort();
-
-    found:
-    currprefs.gfx_width = x_size_table[i];
-    currprefs.gfx_height = y_size_table[i];
-    currprefs.color_mode = j;
-}
-
-static int select_mode_from_prefs (void)
-{
-    int mode_nr0, mode_nr;
-    int i;
-
-    if (currprefs.color_mode > 5)
-       write_log ("Bad color mode selected. Using default.\n"), currprefs.color_mode = 0;
-
-    mode_nr0 = 0;
-    for (i = 1; i < MAX_SCREEN_MODES; i++) {
-       if (x_size_table[mode_nr0] >= currprefs.gfx_width)
-           break;
-       if (x_size_table[i-1] != x_size_table[i])
-           mode_nr0 = i;
-    }
-    mode_nr = -1;
-    for (i = mode_nr0; i < MAX_SCREEN_MODES && x_size_table[i] == x_size_table[mode_nr0]; i++) {
-       if ((y_size_table[i] >= currprefs.gfx_height
-            || i + 1 == MAX_SCREEN_MODES
-            || x_size_table[i+1] != x_size_table[mode_nr0])
-           && vga_mode_table[i][currprefs.color_mode] != -1)
-       {
-           mode_nr = i;
-           break;
-       }
-    }
-    if (mode_nr == -1) {
-       write_log ("Sorry, this combination of color and video mode is not supported.\n");
-       return 0;
-    }
-    vgamode = vga_mode_table[mode_nr][currprefs.color_mode];
-    if (vgamode == -1) {
-       write_log ("Bug!\n");
-       abort ();
-    }
-    write_log ("Desired resolution: %dx%d, using: %dx%d\n",
-            currprefs.gfx_width, currprefs.gfx_height,
-            x_size_table[mode_nr], y_size_table[mode_nr]);
-
-    currprefs.gfx_width = x_size_table[mode_nr];
-    currprefs.gfx_height = y_size_table[mode_nr];
-
-    return 1;
-}
-
-int graphics_init (void)
-{
-    int i;
-    need_dither = 0;
-    screen_is_picasso = 0;
-
-    if (!select_mode_from_prefs ())
-       return 0;
-
-    bitdepth = mode_bitdepth[currprefs.color_mode][0];
-    bit_unit = mode_bitdepth[currprefs.color_mode][1];
-    need_dither = mode_bitdepth[currprefs.color_mode][2];
-
-    modeinfo = *vga_getmodeinfo (vgamode);
-
-    gfxvidinfo.pixbytes = modeinfo.bytesperpixel;
-    if (!need_dither) {
-       if (modeinfo.bytesperpixel == 0) {
-           printf("Got a bogus value from SVGAlib...\n");
-           gfxvidinfo.pixbytes = 1;
-       }
-    } else {
-       gfxvidinfo.pixbytes = 2;
-    }
-
-    using_linear = -1;
-
-    if (!enter_graphics_mode (vgamode))
-       return 0;
-
-    sleep(2);
-    gfxvidinfo.maxblocklines = 0;
-
-    gfxvidinfo.width = modeinfo.width;
-    gfxvidinfo.height = modeinfo.height;
-
-    if (linear_mem != NULL && !need_dither) {
-       gfxvidinfo.bufmem = linear_mem;
-       gfxvidinfo.rowbytes = modeinfo.linewidth;
-    } else {
-       gfxvidinfo.rowbytes = (modeinfo.width * gfxvidinfo.pixbytes + 3) & ~3;
-#if 1
-       gfxvidinfo.bufmem = malloc (gfxvidinfo.rowbytes);
-       gfxvidinfo.linemem = gfxvidinfo.bufmem;
-       memset (gfxvidinfo.bufmem, 0, gfxvidinfo.rowbytes);
-#else
-       gfxvidinfo.bufmem = malloc(gfxvidinfo.rowbytes * modeinfo.height);
-       memset (gfxvidinfo.bufmem, 0, gfxvidinfo.rowbytes * modeinfo.height);
-#endif
-       gfxvidinfo.emergmem = 0;
-    }
-    printf ("rowbytes %d\n", gfxvidinfo.rowbytes);
-    init_colors ();
-    buttonstate[0] = buttonstate[1] = buttonstate[2] = 0;
-    for(i = 0; i < 256; i++)
-       keystate[i] = 0;
-
-    lastmx = lastmy = 0;
-    newmousecounters = 0;
-
-    return 1;
-}
-
-void graphics_leave (void)
-{
-    leave_graphics_mode ();
-    dumpcustom();
-}
-
-void handle_events (void)
-{
-    int button = mouse_getbutton ();
-
-    gui_requested = 0;
-    keyboard_update ();
-    mouse_update ();
-    lastmx += mouse_getx ();
-    lastmy += mouse_gety ();
-    mouse_setposition (0, 0);
-
-    buttonstate[0] = button & 4;
-    buttonstate[1] = button & 2;
-    buttonstate[2] = button & 1;
-
-#ifdef PICASSO96
-    if (screen_is_picasso && !picasso_vidinfo.extra_mem) {
-       int i;
-       char *addr = gfxmemory + (picasso96_state.Address - gfxmem_start);
-       for (i = 0; i < picasso_vidinfo.height; i++, addr += picasso96_state.BytesPerRow) {
-           if (!picasso_invalid_lines[i])
-               continue;
-           picasso_invalid_lines[i] = 0;
-           vga_drawscanline (i, addr);
-       }
-    }
-#endif
-
-    if (!screen_is_picasso && gui_requested) {
-       leave_graphics_mode ();
-       gui_changesettings ();
-       enter_graphics_mode (vgamode);
-       if (linear_mem != NULL && !need_dither)
-           gfxvidinfo.bufmem = linear_mem;
-       restore_vga_colors ();
-       notice_screen_contents_lost ();
-    }
-}
-
-int check_prefs_changed_gfx (void)
-{
-    return 0;
-}
-
-int debuggable (void)
-{
-    return 0;
-}
-
-int needmousehack (void)
-{
-    return 0;
-}
-
-void LED (int on)
-{
-}
-
-#ifdef PICASSO96
-
-void DX_Invalidate (int first, int last)
-{
-    do {
-       picasso_invalid_lines[first] = 1;
-       first++;
-    } while (first <= last);
-}
-
-int DX_BitsPerCannon (void)
-{
-    return 8;
-}
-
-void DX_SetPalette(int start, int count)
-{
-    if (!screen_is_picasso || picasso_vidinfo.pixbytes != 1)
-       return;
-
-    while (count-- > 0) {
-       vga_setpalette(start, picasso96_state.CLUT[start].Red * 63 / 255,
-                      picasso96_state.CLUT[start].Green * 63 / 255,
-                      picasso96_state.CLUT[start].Blue * 63 / 255);
-       start++;
-    }
-}
-
-int DX_FillResolutions (uae_u16 *ppixel_format)
-{
-    int i, count = 0;
-    uae_u16 format = 0;
-
-    for (i = 0; i < MAX_SCREEN_MODES; i++) {
-       int mode = vga_mode_table[i][0];
-       if (mode != -1) {
-           DisplayModes[count].res.width = x_size_table[i];
-           DisplayModes[count].res.height = y_size_table[i];
-           DisplayModes[count].depth = 1;
-           DisplayModes[count].refresh = 75;
-           count++;
-           format |= RGBFF_CHUNKY;
-       }
-       mode = vga_mode_table[i][2];
-       if (mode != -1) {
-           DisplayModes[count].res.width = x_size_table[i];
-           DisplayModes[count].res.height = y_size_table[i];
-           DisplayModes[count].depth = 2;
-           DisplayModes[count].refresh = 75;
-           count++;
-           format |= RGBFF_R5G6B5PC;
-       }
-       mode = vga_mode_table[i][5];
-       if (mode != -1) {
-           DisplayModes[count].res.width = x_size_table[i];
-           DisplayModes[count].res.height = y_size_table[i];
-           DisplayModes[count].depth = 4;
-           DisplayModes[count].refresh = 75;
-           count++;
-           format |= RGBFF_B8G8R8A8;
-       }
-    }
-
-    *ppixel_format = format;
-    return count;
-}
-
-static void set_window_for_picasso (void)
-{
-    enter_graphics_mode_picasso (picasso_vgamode);
-    if (linear_mem != NULL)
-       picasso_vidinfo.extra_mem = 1;
-    else
-       picasso_vidinfo.extra_mem = 0;
-    printf ("em: %d\n", picasso_vidinfo.extra_mem);
-    DX_SetPalette (0, 256);
-}
-
-static void set_window_for_amiga (void)
-{
-    leave_graphics_mode ();
-    enter_graphics_mode (vgamode);
-    if (linear_mem != NULL && !need_dither)
-       gfxvidinfo.bufmem = linear_mem;
-
-    restore_vga_colors ();
-}
-
-void gfx_set_picasso_modeinfo (int w, int h, int depth, int rgbfmt)
-{
-    vga_modeinfo *info;
-    int i, mode;
-
-    for (i = 0; i < MAX_SCREEN_MODES; i++)
-       if (x_size_table[i] == w && y_size_table[i] == h)
-           break;
-    printf ("::: %d %d %d, %d\n", w, h, depth, i);
-    if (i == MAX_SCREEN_MODES)
-       abort ();
-    mode = (depth == 8 ? vga_mode_table[i][0]
-           : depth == 16 ? vga_mode_table[i][2]
-           : depth == 32 ? vga_mode_table[i][5]
-           : -1);
-    printf ("::: %d\n", mode);
-    if (mode == -1)
-       abort ();
-
-    info = vga_getmodeinfo (mode);
-    printf ("::: %d\n", info->linewidth);
-    picasso_vgamode = mode;
-    picasso_vidinfo.width = w;
-    picasso_vidinfo.height = h;
-    picasso_vidinfo.depth = depth;
-    picasso_vidinfo.pixbytes = depth>>3;
-    picasso_vidinfo.rowbytes = info->linewidth;
-    picasso_vidinfo.rgbformat = (depth == 8 ? RGBFB_CHUNKY
-                                : depth == 16 ? RGBFB_R5G6B5PC
-                                : RGBFB_B8G8R8A8);
-    if (screen_is_picasso)
-       set_window_for_picasso ();
-}
-
-void gfx_set_picasso_baseaddr (uaecptr a)
-{
-}
-
-void gfx_set_picasso_state (int on)
-{
-    if (on == screen_is_picasso)
-       return;
-    screen_is_picasso = on;
-    if (on)
-       set_window_for_picasso ();
-    else
-       set_window_for_amiga ();
-}
-
-uae_u8 *gfx_lock_picasso (void)
-{
-    return linear_mem;
-}
-void gfx_unlock_picasso (void)
-{
-}
-#endif
-
-int lockscr (void)
-{
-    return 1;
-}
-
-void unlockscr (void)
-{
-}
-
-void target_save_options (FILE *f, struct uae_prefs *p)
-{
-    fprintf (f, "svga.no_linear=%s\n", p->svga_no_linear ? "true" : "false");
-}
-
-int target_parse_option (struct uae_prefs *p, char *option, char *value)
-{
-    return (cfgfile_yesno (option, value, "no_linear", &p->svga_no_linear));
-}
-
-/* Dummy entry to make it compile */
-void DX_SetPalette_vsync(void)
-{}
diff --git a/svgancui.c b/svgancui.c
deleted file mode 100644 (file)
index 84aeeb5..0000000
+++ /dev/null
@@ -1,577 +0,0 @@
- /*
-  * UAE - The Un*x Amiga Emulator
-  *
-  * ncurses frontend for a text-based user interface.
-  *
-  * Copyright 1996 Bernd Schmidt
-  * If you find the routines in this file useful, you may use them in your
-  * programs without restrictions. Essentially, it's in the public domain.
-  *
-  */
-
-
-#include "sysconfig.h"
-#include "sysdeps.h"
-
-#ifdef HAVE_NCURSES_H
-#include <ncurses.h>
-#else
-#include <curses.h>
-#endif
-#include <ctype.h>
-
-#include "options.h"
-#include "uae.h"
-#include "tui.h"
-
-#ifdef DONT_HAVE_ATTR_T
-typedef int attr_t;
-#endif
-
-static WINDOW *currwin;
-
-static WINDOW *winstack[10]; /* more than enough */
-static int winnr = 0;
-
-void tui_setup(void)
-{
-    int i;
-
-    for (i = 0; i < 10; i++)
-       winstack[i] = NULL;
-    /* From the ncurses manpage... */
-    initscr (); start_color (); cbreak(); noecho(); nonl (); intrflush (stdscr, FALSE); keypad (stdscr, TRUE);
-    currwin = stdscr;
-    if (has_colors ()) {
-       init_pair (1, COLOR_WHITE, COLOR_BLUE);
-       init_pair (2, COLOR_BLACK, COLOR_WHITE);
-       wattron (currwin, COLOR_PAIR (1) | A_BOLD);
-       wbkgd (currwin, ' ' | COLOR_PAIR (1));
-    }
-
-    winstack[0] = stdscr;
-    winnr = 1;
-}
-
-int tui_lines (void)
-{
-    return LINES;
-}
-
-int tui_cols (void)
-{
-    return COLS;
-}
-
-void tui_shutdown (void)
-{
-    endwin ();
-}
-
-void tui_refresh (void)
-{
-    int w;
-    for (w = 0; w < winnr; w++) {
-       touchwin (winstack[w]);
-       wnoutrefresh (winstack[w]);
-    }
-    doupdate ();
-}
-
-void tui_puts (const char *s)
-{
-    waddstr (currwin, s);
-}
-
-void tui_cursoff(void)
-{
-}
-
-void tui_curson (void)
-{
-}
-
-void tui_putc(char c)
-{
-    waddch (currwin, c);
-}
-
-void tui_cr (void)
-{
-    waddch (currwin, '\r');
-}
-
-char tui_getc(void)
-{
-    return getch ();
-}
-
-void tui_gotoxy (int x, int y)
-{
-    x--; y--;
-    wmove (currwin, y, x);
-}
-
-void tui_selwin (int w)
-{
-    currwin = winstack[w];
-}
-
-void tui_clrwin (int w)
-{
-    werase (winstack[w]);
-}
-
-void tui_drawbox(int w)
-{
-    wborder (winstack[w], 0, 0, 0, 0, 0, 0, 0, 0);
-}
-
-void tui_hline (int x1, int y1, int x2)
-{
-    wmove (currwin, y1-1, x1-1);
-    whline (currwin, 0, x2-x1+1);
-}
-
-int tui_dlog(int x1, int y1, int x2, int y2)
-{
-    x1--; y1--;
-    winstack[winnr] = newwin (y2 - y1, x2 - x1, y1, x1);
-    return winnr++;
-}
-
-void tui_dlogdie (int w)
-{
-    if (currwin == winstack[w])
-       currwin = stdscr;
-    delwin (winstack[w]);
-    winstack[w] = NULL;
-    while (winstack[winnr-1] == NULL)
-       winnr--;
-
-    for (w = 0; w < winnr; w++)
-       redrawwin (winstack[w]), wrefresh (winstack[w]);
-}
-
-int tui_gets (char *buf, int x, int y, int n)
-{
-    int i = 0;
-    for (;;) {
-       int c, j;
-
-       buf[i] = 0;
-       wmove (currwin, y, x);
-       for (j = 0; j < i; j++)
-           waddch (currwin, buf[j]);
-       for (; j < n; j++)
-           waddch (currwin, ' ');
-
-       wmove (currwin, y, x + i);
-       wrefresh (currwin);
-
-       c = getch ();
-
-       wmove (currwin, y, x + i);
-       if (c == 13)
-           return 1;
-       else if (c == 27)
-           return 0;
-       else if (i > 0 && c == KEY_BACKSPACE)
-           i--;
-       else if (i + 1 < n && !iscntrl (c))
-           buf[i++] = c;
-    }
-}
-
-int tui_wgets (char *buf, const char *title, int n)
-{
-    int l = strlen (title);
-    int ww = (l > n ? l : n) + 2;
-    int w = tui_dlog((tui_cols ()-ww)/2, tui_lines ()/2-1, (tui_cols ()+ww)/2, tui_lines ()/2+1);
-    int result;
-
-    tui_selwin (w); tui_drawbox(w);
-    wmove (currwin, 0, (ww-l)/2);
-    waddstr (currwin, title);
-    result = tui_gets (buf, 1, 1, n);
-    tui_dlogdie (w);
-    return result;
-}
-
-int tui_menubrowse (struct bstring *menu, int xoff, int yoff, int selected, int height)
-{
-    int count = 0, maxsel = 0, maxw = 0;
-    int i, j, w, s, yp, oldyp;
-    chtype moresave[6][2];
-    int xpos, ypos;
-
-    const char *mtitle = NULL;
-
-    for (i = 0; menu[i].val != -3; i++) {
-       int tmp;
-       if (menu[i].val == -4) {
-           if (maxsel < selected)
-               selected--;
-           continue;
-       }
-       if (menu[i].val != 0) {
-           count++;
-           if (menu[i].val != -2)
-               maxsel++;
-       } else
-           mtitle = menu[i].data;
-       if ((tmp = strlen (menu[i].data)) > maxw)
-           maxw = tmp;
-    }
-    if (height > count)
-       height = count;
-    maxw += 3;
-    if (strlen (mtitle ? mtitle : "") + 8 > maxw)
-       maxw = strlen (mtitle ? mtitle : "") + 8;
-    if (xoff > 0)
-       xpos = xoff;
-    else
-       xpos = tui_cols () + xoff - maxw - 1;
-    if (yoff > 0)
-       ypos = yoff;
-    else
-       ypos = tui_lines () + yoff - height - 2;
-    w = tui_dlog(xpos, ypos, xpos+maxw, ypos+height+1);
-    tui_selwin (w);
-    tui_drawbox(w);
-    if (mtitle != NULL) {
-       mvwaddstr (currwin, 0, 1, mtitle);
-    }
-    for (i = 0; i < 6; i++) {
-       moresave[i][0] = mvwinch (currwin, 0, maxw-6+i);
-       moresave[i][1] = mvwinch (currwin, height+1, maxw-6+i);
-    }
-    s = yp = 0; oldyp = -1;
-    for (;;) {
-       int c;
-       int s2;
-
-       while (selected < yp)
-           yp--;
-       while (selected >= yp + height)
-           yp++;
-       if (yp == 0)
-           for (i = 0; i < 6; i++)
-               mvwaddch (currwin, 0, maxw-6+i, moresave[i][0]);
-       else
-           mvwaddstr (currwin, 0, maxw-6, "(more)");
-       if (yp + height == count)
-           for (i = 0; i < 6; i++)
-               mvwaddch (currwin, height+1, maxw-6+i, moresave[i][1]);
-       else
-           mvwaddstr (currwin, height+1, maxw-6, "(more)");
-       for (i = s2 = j = 0; i < count; i++, j++) {
-           int k, x;
-           attr_t a = s2 == selected ? A_STANDOUT : 0;
-           while (menu[j].val == 0 || menu[j].val == -4)
-               j++;
-           if (i >= yp && i < yp+height) {
-               mvwaddch (currwin, 1+i-yp, 1, ' ' | a);
-               for (k = x = 0; menu[j].data[k]; k++, x++) {
-                   int a2 = 0;
-                   c = menu[j].data[k];
-                   if (c == '_')
-                       c = menu[j].data[++k], a2 = A_UNDERLINE;
-                   mvwaddch (currwin, 1+i-yp, 2+x, c | a | a2);
-               }
-               for (; x < maxw-2; x++) {
-                   mvwaddch (currwin, 1+i-yp, 2+x, ' ' | a);
-               }
-           }
-           if (menu[j].val != -2)
-               s2++;
-       }
-
-       tui_refresh ();
-       c = getch ();
-       if (c == 27) {
-           tui_dlogdie (w);
-           return -1;
-       } else if (c == KEY_ENTER || c == 13 || c == ' ') {
-           tui_dlogdie (w);
-           for (i = s2 = j = 0; s2 <= selected; j++) {
-               if (menu[j].val == -4) {
-                   i++; j++; continue;
-               }
-               while (menu[j].val == 0)
-                   j++;
-               if (s2 == selected)
-                   return i;
-               if (menu[j].val != -2)
-                   s2++, i++;
-           }
-           abort();
-       } else switch (c) {
-        case KEY_UP:
-           if (selected > 0)
-               selected--;
-           break;
-        case KEY_DOWN:
-           if (selected + 1 < count)
-               selected++;
-           break;
-        case KEY_PPAGE:
-           if (selected > height)
-               selected -= height;
-           else
-               selected = 0;
-           break;
-        case KEY_NPAGE:
-           if (selected + height < count)
-               selected += height;
-           else
-               selected = count-1;
-           break;
-        default:
-           for (j = i = 0; menu[i].val != -3; i++)
-               if (menu[i].val == toupper (c)) {
-                   tui_dlogdie (w);
-                   return j;
-               } else if (menu[i].val == -1 || menu[i].val == -4 || menu[i].val > 0) {
-                   j++;
-               }
-
-           break;
-       }
-    }
-    return -1; /* Can't get here */
-}
-
-void tui_errorbox(const char *err)
-{
-    const char *hak = "Hit any key";
-    int n = strlen (hak);
-    int l = strlen (err);
-    int ww = (l > n ? l : n) + 2;
-    int w = tui_dlog((tui_cols ()-ww)/2, tui_lines ()/2-1, (tui_cols ()+ww)/2, tui_lines ()/2+1);
-    tui_selwin (w); tui_drawbox(w);
-
-    wmove (currwin, 0, (ww-6)/2);
-    waddstr (currwin, "Error!");
-    wmove (currwin, 1, (ww-l)/2);
-    waddstr (currwin, err);
-    wmove (currwin, 2, (ww-n)/2);
-    waddstr (currwin, hak);
-
-    wrefresh (currwin);
-    for (;;) {
-       int c = getch ();
-       if (c == 13)
-           break;
-    }
-    tui_dlogdie (w);
-}
-
-static char *pattern;
-static int maxlen;
-
-static void put_filename (char *s, int x, int y, attr_t a)
-{
-    char buf[256];
-    int i;
-
-    tui_gotoxy (x,y);
-    if (strcmp (s, ".") == 0)
-       strcpy (buf, "(none)");
-    else
-       strcpy (buf, s);
-    buf[maxlen] = 0;
-    for (i = 0; i < strlen (buf); i++)
-       waddch (currwin, buf[i] | a);
-    for (; i < maxlen; i++)
-       waddch (currwin, ' ' | a);
-}
-
-static char fsbuf[256];
-
-static int selectfn (const struct dirent *de)
-{
-    int l1, l2;
-
-/*    l1 = strlen (pattern + 1);*/
-    l2 = strlen (de->d_name);
-
-    if (l2 >= tui_cols ()-10) /* Restrict length of filenames so we won't mess up the display */
-       return 0;
-
-    /* No pattern matching for now. But we don't show hidden files. */
-    if (strcmp (de->d_name, ".") != 0 && strcmp (de->d_name, "..") != 0
-       && de->d_name[0] == '.')
-       return 0;
-    if (l2 > maxlen)
-       maxlen = l2;
-    return 1;
-}
-
-static int my_alphasort (const void *a, const void *b)
-{
-    return strcmp ((*(struct dirent **) a)->d_name,
-                  (*(struct dirent **) b)->d_name);
-}
-
-char *tui_filereq(char *s, char *oldfile, const char *title)
-{
-    char cwd[256];
-    char *retval = fsbuf;
-    char *tmp;
-    int fin = 0;
-    chtype moresave[6][2];
-
-    /* Save wd */
-    if (getcwd (cwd, 256) == NULL)
-       return NULL;
-
-    /* Change into directory of old file */
-    strcpy (fsbuf, oldfile);
-    tmp = strrchr (fsbuf, '/');
-    if (tmp != NULL) {
-       *tmp = 0;
-       if (strlen (fsbuf) > 0)
-           chdir (fsbuf);
-    }
-
-    pattern = s;
-    if (s[0] != '*')
-       write_log ("Can't handle wildcard %s\n", s);
-    if (s[1] != 0 && strchr (s+1, '*') != NULL)
-       write_log ("Can't handle wildcard %s\n", s);
-    for (;!fin;) {
-       struct dirent **names;
-       int i, w, n, l, yp, oldyp, s;
-
-       maxlen = 0;
-       n = scandir (".", &names, selectfn, my_alphasort);
-
-       if (n <= 0)
-           return NULL;
-       if (title != NULL && strlen (title) + 6 > maxlen)
-           maxlen = strlen (title) + 6;
-       l = n;
-       if (l > 15)
-           l = 15;
-       yp = s = 0; oldyp = -1;
-       w = tui_dlog (tui_cols () - maxlen - 8, 5, tui_cols () - 5, 5 + l + 1);
-       tui_selwin (w); tui_drawbox (w);
-       if (title)
-           mvwaddstr (currwin, 0, 2, title);
-       for (i = 0; i < 6; i++) {
-           moresave[i][0] = mvwinch (currwin, 0, maxlen-3+i);
-           moresave[i][1] = mvwinch (currwin, l+1, maxlen-3+i);
-       }
-       for (;;) {
-           int c;
-           char tmp[256];
-           while (s < yp)
-               yp--;
-           while (s >= yp + l)
-               yp++;
-           if (oldyp != yp) {
-               oldyp = yp;
-               for (i = 0; i < l; i++) {
-                   put_filename (names[i + yp]->d_name, 3, 2 + i, 0);
-               }
-           }
-           put_filename (names[s]->d_name, 3, 2 + s - yp, A_STANDOUT);
-
-           if (yp == 0)
-               for (i = 0; i < 6; i++)
-                   mvwaddch (currwin, 0, maxlen-3+i, moresave[i][0]);
-           else
-               mvwaddstr (currwin, 0, maxlen-3, "(more)");
-           if (yp + l == n)
-               for (i = 0; i < 6; i++)
-                   mvwaddch (currwin, l+1, maxlen-3+i, moresave[i][1]);
-           else
-               mvwaddstr (currwin, l+1, maxlen-3, "(more)");
-
-           tui_refresh ();
-           c = getch ();
-           put_filename (names[s]->d_name, 3, 2 + s - yp, 0);
-           if (c == 27) {
-               retval = NULL; fin = 1;
-               break;
-           } else if (c == KEY_ENTER || c == 13 || c == ' ') {
-               int err;
-
-               if (strcmp (names[s]->d_name, ".") == 0) {
-                   fin = 1;
-                   strcpy (fsbuf, "");
-                   break;
-               }
-               err = chdir (names[s]->d_name);
-
-               if (err == 0)
-                   break;
-               else if (errno == ENOTDIR) {
-                   fin = 1;
-                   if (getcwd (fsbuf, 256) == NULL)
-                       retval = NULL;
-                   if (strlen (fsbuf) + strlen (names[s]->d_name) + 2 >= 256)
-                       retval = NULL;
-                   else {
-                       strcat(fsbuf, "/");
-                       strcat(fsbuf, names[s]->d_name);
-                   }
-                   break;
-               } /* else what? */
-           }
-           switch (c) {
-            case KEY_UP:
-               if (s > 0)
-                   s--;
-               break;
-            case KEY_DOWN:
-               if (s + 1 < n)
-                   s++;
-               break;
-            case KEY_PPAGE:
-               if (s > l)
-                   s -= l;
-               else
-                   s = 0;
-               break;
-            case KEY_NPAGE:
-               if (s + l < n)
-                   s += l;
-               else
-                   s = n - 1;
-               break;
-            default:
-               i = 0;
-               if (names[s]->d_name[0] == c)
-                   i = s+1;
-               for (; i < n*2; i++) {
-                   int j = i;
-                   if (i >= n)
-                       j -= n;
-                   if (names[j]->d_name[0] == c) {
-                       s = j;
-                       break;
-                   }
-               }
-           }
-       }
-#if 0
-       /* @@@ is this right? */
-       for (i = 0; i < n; i++)
-           free (names[i]);
-       free (names);
-#endif
-       tui_dlogdie (w);
-    }
-    chdir (cwd);
-    return retval;
-}
-
-int tui_backup_optionsfile (void)
-{
-    char tmp[257];
-    strcpy (tmp, optionsfile);
-    strcat (tmp, "~");
-    return rename (optionsfile, tmp);
-}
diff --git a/tui.c b/tui.c
deleted file mode 100644 (file)
index 63dc123..0000000
--- a/tui.c
+++ /dev/null
@@ -1,730 +0,0 @@
- /*
-  * UAE - The Un*x Amiga Emulator
-  *
-  * Text-based user interface
-  * Sie haben es sich verdient!
-  *
-  * Copyright 1996 Tim Gunn, Bernd Schmidt
-  */
-
-#include "sysconfig.h"
-#include "sysdeps.h"
-
-#include <stdio.h>
-#include <ctype.h>
-
-#include "config.h"
-#include "options.h"
-#include "threaddep/thread.h"
-#include "uae.h"
-#include "gensound.h"
-#include "joystick.h"
-#include "keybuf.h"
-#include "autoconf.h"
-#include "xwin.h"
-#include "tui.h"
-#include "gui.h"
-#include "memory.h"
-
-#define MAX_MENU_HEIGHT 15
-#define OPTION_COLUMN 3
-#define MENU_COL_OFFSET -2
-
-int mountok=0;
-
-void gui_led (int led, int on)
-{
-}
-void gui_filename (int num, const char *name)
-{
-}
-static void getline (char *p)
-{
-}
-void gui_handle_events (void)
-{
-}
-void gui_fps (int x)
-{
-}
-static void save_settings (void)
-{
-    FILE *f;
-    tui_backup_optionsfile ();
-    f = fopen (optionsfile, "w");
-    if (f == NULL) {
-       write_log ("Error saving options file!\n");
-       return;
-    }
-    save_options (f, &currprefs);
-    fclose (f);
-}
-
-void gui_exit()
-{
-}
-
-static struct bstring mainmenu[] = {
-    { "UAE configuration", 0 },
-    { "_Disk settings", 'D' },
-    { "_Video settings", 'V' },
-    { "_Memory settings", 'M' },
-    { "_CPU settings", 'C' },
-    { "_Hard disk settings", 'H' },
-    { "_Sound settings", 'S' },
-    { "_Other settings", 'O' },
-    { "S_ave settings", 'A' },
-    { "_Run UAE", 'R' },
-    { NULL, -3 }
-};
-
-static struct bstring mainmenu2[] = {
-    { "UAE configuration", 0 },
-    { "_Disk settings", 'D' },
-/*    { "_Video settings", 'V' },
-    { "_Memory settings", 'M' },
-    { "_Hard disk settings", 'H' },
-    { "_Sound settings", 'S' }, */
-    { "_Other settings", 'O' },
-    { "S_ave settings", 'A' },
-    { "R_eset UAE", 'E' },
-    { "_Quit UAE", 'Q' },
-    { "_Run UAE", 'R' },
-    { NULL, -3 }
-};
-
-static struct bstring diskmenu[] = {
-    { "Floppy disk settings", 0 },
-    { "Change DF_0:", '0' },
-    { "Change DF_1:", '1' },
-    { "Change DF_2:", '2' },
-    { "Change DF_3:", '3' },
-    { NULL, -3 }
-};
-
-static struct bstring videomenu[] = {
-    { "Video settings", 0 },
-    { "Change _width", 'W' },
-    { "Change _height", 'H' },
-    { "Change _color mode", 'C' },
-    { "Select predefined _mode", 'M' },
-    { "Toggle _low resolution", 'L' },
-    { "Change _X centering", 'X' },
-    { "Change _Y centering", 'Y' },
-    { "Toggle line _doubling", 'D' },
-    { "Toggle _aspect _correction", 'A' },
-    { "Change _framerate", 'F' },
-    { "_Graphics card memory", 'P'},
-    { NULL, -3 }
-};
-
-static struct bstring memorymenu[] = {
-    { "Memory settings", 0 },
-    { "Change _fastmem size", 'F' },
-    { "Change _chipmem size", 'C' },
-    { "Change _slowmem size", 'S' },
-    { "Select ROM _image", 'I' },
-    { NULL, -3 }
-};
-
-static struct bstring cpumenu[] = {
-    { "Change _CPU", 'C' },
-    { NULL, -3 }
-};
-
-static struct bstring soundmenu[] = {
-    { "Sound settings", 0 },
-    { "Change _sound emulation accuracy", 'S' },
-    { "Change m_inimum sound buffer size", 'I' },
-    { "Change m_aximum sound buffer size", 'A' },
-    { "Change number of _bits", 'B' },
-    { "Change output _frequency", 'F' },
-    { "Change s_tereo", 'T' },
-    { NULL , -3 }
-};
-
-static struct bstring miscmenu[] = {
-    { "Miscellaneous settings", 0 },
-    { "Toggle joystick port _0 emulation", '0' },
-    { "Toggle joystick port _1 emulation", '1' },
-    { "Set _CPU emulation speed", 'C' },
-    { NULL, -3 }
-};
-
-static struct bstring hdmenu[] = {
-/*    { "Harddisk/CDROM emulation settings", 0 },*/
-    { "_Add a mounted volume", 'A' },
-    { "Add a mounted _volume r/o", 'V' },
-    { "Add a hard_file", 'F' },
-    { "_Delete a mounted volume", 'D' },
-    { NULL, -3 }
-};
-
-static int makemenu (const char **menu, int x, int y)
-{
-    const char **m = menu;
-    int maxlen = 0, count = 0;
-    int w;
-
-    while (*m != NULL) {
-       int l = strlen (*m);
-       if (l > maxlen)
-           maxlen = l;
-       m++; count++;
-    }
-    w = tui_dlog (x, y, x + maxlen + 2, y + count + 1);
-    tui_drawbox (w);
-    tui_selwin (w);
-    y = 2;
-    while (*menu != NULL) {
-       tui_gotoxy (2, y++);
-       tui_puts (*menu++);
-    }
-    tui_selwin (0);
-    return w;
-}
-
-static char tmpbuf[256];
-
-static char *trimfilename(char *s, size_t n)
-{
-    size_t i;
-    if (n > 250)
-       n = 250;
-    if (strlen (s) == 0)
-       strcpy (tmpbuf, "none");
-    else if (strlen (s) < n)
-       strcpy (tmpbuf, s);
-    else {
-       tmpbuf[0] = '^';
-       strcpy (tmpbuf + 1, s + strlen (s) - n + 2);
-    }
-    for (i = strlen(tmpbuf); i < n; i++)
-       tmpbuf[i] = ' ';
-    tmpbuf[i] = 0;
-    return tmpbuf;
-}
-
-static void print_configuration (void)
-{
-    char tmp[256];
-    int y = 5;
-    int i;
-
-    tui_clrwin (0);
-
-    tui_drawbox (0);
-    tui_hline (2, 3, tui_cols () - 1);
-    sprintf (tmp, "UAE %d.%d.%d: The Un*x Amiga Emulator", UAEMAJOR, UAEMINOR, UAESUBREV);
-    tui_gotoxy ((tui_cols () - strlen(tmp))/2, 2); tui_puts (tmp);
-    strcpy(tmp, "Press RETURN/ENTER to run UAE, ESC to exit");
-    tui_gotoxy ((tui_cols () - strlen(tmp))/2, tui_lines ()); tui_puts (tmp);
-
-    tui_gotoxy (OPTION_COLUMN, y++); sprintf (tmp, "Disk file DF0: %s", trimfilename (currprefs.df[0], tui_cols () - 20)); tui_puts (tmp);
-    tui_gotoxy (OPTION_COLUMN, y++); sprintf (tmp, "Disk file DF1: %s", trimfilename (currprefs.df[1], tui_cols () - 20)); tui_puts (tmp);
-    tui_gotoxy (OPTION_COLUMN, y++); sprintf (tmp, "Disk file DF2: %s", trimfilename (currprefs.df[2], tui_cols () - 20)); tui_puts (tmp);
-    tui_gotoxy (OPTION_COLUMN, y++); sprintf (tmp, "Disk file DF3: %s", trimfilename (currprefs.df[3], tui_cols () - 20)); tui_puts (tmp);
-    y++;
-    tui_gotoxy (OPTION_COLUMN, y++);
-    sprintf (tmp, "VIDEO: %d:%d%s %s", currprefs.gfx_width, currprefs.gfx_height,
-           currprefs.gfx_lores ? " (lores)" : "", colormodes[currprefs.color_mode]);
-    tui_puts (tmp);
-
-    tui_gotoxy (OPTION_COLUMN+7, y++);
-    if (currprefs.gfx_linedbl)
-       tui_puts ("Doubling lines, ");
-    if (currprefs.gfx_correct_aspect)
-       tui_puts ("Aspect corrected");
-    else
-       tui_puts ("Not aspect corrected");
-    tui_gotoxy (OPTION_COLUMN+7, y++);
-    if (currprefs.gfx_xcenter)
-       tui_puts ("X centered");
-    if (currprefs.gfx_xcenter == 2)
-       tui_puts (" (clever)");
-    if (currprefs.gfx_ycenter && currprefs.gfx_xcenter)
-       tui_puts (", ");
-    if (currprefs.gfx_ycenter)
-       tui_puts ("Y centered ");
-    if (currprefs.gfx_ycenter == 2)
-       tui_puts (" (clever)");
-    tui_gotoxy (OPTION_COLUMN+7, y++);
-    tui_puts ("drawing every ");
-    switch (currprefs.gfx_framerate) {
-     case 1: break;
-     case 2: tui_puts ("2nd "); break;
-     case 3: tui_puts ("3rd "); break;
-     default: sprintf (tmp, "%dth ",currprefs.gfx_framerate); tui_puts (tmp); break;
-    }
-    tui_puts ("frame.    ");
-
-    tui_gotoxy (OPTION_COLUMN+7, y++);
-    if (currprefs.gfxmem_size) {
-       sprintf (tmp, "Picasso 96 %d MB", currprefs.gfxmem_size / 0x100000);
-       tui_puts(tmp);
-    } else
-       tui_puts ("Picasso 96 Off");
-    y++;
-
-    tui_gotoxy (OPTION_COLUMN, y++);
-    tui_puts ("CPU: ");
-    switch (currprefs.cpu_level) {
-     case 0: tui_puts ("68000"); break;
-     case 1: tui_puts ("68010"); break;
-     case 2: tui_puts ("68020"); break;
-     case 3: tui_puts ("68020/68881"); break;
-    }
-    if (currprefs.address_space_24 && currprefs.cpu_level > 1)
-       tui_puts (" (24 bit addressing)");
-    if (currprefs.cpu_compatible)
-       tui_puts (" (slow but compatible)");
-    tui_gotoxy (OPTION_COLUMN, y++);
-    sprintf (tmp, "MEMORY: %4dK chip; %4dK fast; %4dK slow",
-            currprefs.chipmem_size/1024,
-            currprefs.fastmem_size/1024,
-            currprefs.bogomem_size/1024);
-    tui_puts (tmp);
-
-    tui_gotoxy (OPTION_COLUMN, y++);
-    sprintf (tmp, "ROM IMAGE: %s", trimfilename (currprefs.romfile, tui_cols () - 50));
-    tui_puts (tmp);
-    tui_gotoxy (OPTION_COLUMN, y++);
-    if (!sound_available)
-       tui_puts ("SOUND: Not available");
-    else {
-       switch (currprefs.produce_sound) {
-        case 0: tui_puts ("SOUND: 0 (Off)"); break;
-        case 1: tui_puts ("SOUND: 1 (Off, but emulated)"); break;
-        case 2: tui_puts ("SOUND: 2 (On)"); break;
-        case 3: tui_puts ("SOUND: 3 (On, emulated perfectly)"); break;
-       }
-       tui_gotoxy (OPTION_COLUMN + 7, y++);
-       sprintf (tmp, "%d bits at %d Hz", currprefs.sound_bits, currprefs.sound_freq);
-       tui_puts (tmp);
-       tui_gotoxy (OPTION_COLUMN + 7, y++);
-       sprintf (tmp, "Minimum buffer size %d bytes, maximum %d bytes", currprefs.sound_minbsiz, currprefs.sound_maxbsiz);
-       tui_puts (tmp);
-    }
-
-    tui_gotoxy (OPTION_COLUMN,y++);
-    tui_puts ("GAME PORT 1: "); tui_puts (gameport_state (0));
-    tui_gotoxy (OPTION_COLUMN,y++);
-    tui_puts ("GAME PORT 2: "); tui_puts (gameport_state (1));
-
-    for (i = 0;; i++) {
-       char buf[256];
-
-       tui_gotoxy (OPTION_COLUMN+1,y++);
-       if (sprintf_filesys_unit (currprefs.mountinfo, buf, i) == -1)
-           break;
-       tui_puts (buf);
-    }
-}
-
-static void HDOptions (void)
-{
-    char *buff;
-    char tmp[256];
-    char mountvol[256];
-    char mountdir[256];
-    int c = 0;
-
-    for (;;){
-
-       tui_selwin(0);
-       print_configuration();
-
-       c = tui_menubrowse (hdmenu, MENU_COL_OFFSET, 5, c, MAX_MENU_HEIGHT);
-       if (c == -1)
-           break;
-       else switch (c) {
-        case 0:
-           tui_wgets (mountvol, "Enter mounted volume name", 10);
-           if (strlen (mountvol) == 0)
-               break;
-           if (mountvol[strlen(mountvol)-1]==':')
-               mountvol[strlen(mountvol)-1] = 0;
-           tui_wgets (mountdir, "Enter mounted volume path", 78);
-           add_filesys_unit (currprefs.mountinfo, mountvol, mountdir, 0, 0, 0, 0, 0);
-           break;
-        case 1:
-           tui_wgets (mountvol, "Enter mounted volume name", 10);
-           if (strlen (mountvol) == 0)
-               break;
-           if (mountvol[strlen (mountvol)-1]==':')
-               mountvol[strlen (mountvol)-1] = 0;
-           tui_wgets (mountdir, "Enter mounted volume path", 78);
-           add_filesys_unit (currprefs.mountinfo, mountvol, mountdir, 1, 0, 0, 0, 0);
-           break;
-        case 2:
-           buff = tui_filereq("*", "", "Select the hardfile to be mounted");
-           if (buff == NULL)
-               break;
-           strcpy (mountvol, buff);
-           tui_wgets (mountdir, "Enter number of sectors per track", 4);
-           tui_wgets (mountdir + 10, "Enter number of heads", 4);
-           tui_wgets (mountdir + 20, "Enter number of reserved blocks", 3);
-           tui_wgets (mountdir + 30, "Enter block size", 4);
-           buff = add_filesys_unit (currprefs.mountinfo, 0, mountvol, 1,
-                                    atoi (mountdir), atoi (mountdir + 10),
-                                    atoi (mountdir + 20), atoi (mountdir + 30));
-           if (buff)
-               tui_errorbox (buff);
-           break;
-        case 3:
-           tui_wgets (mountvol, "Enter number of volume to be removed (0 for UAE0:, etc.)", 2);
-           if (kill_filesys_unit (currprefs.mountinfo, atoi (mountvol)) == -1)
-               tui_errorbox ("Volume does not exist");
-           break;
-       }
-    }
-}
-
-static void DiskOptions (void)
-{
-    char tmp[256];
-    int c = 0;
-
-    for (;;) {
-       char *sel;
-
-       tui_selwin(0);
-       print_configuration();
-
-       c = tui_menubrowse (diskmenu, MENU_COL_OFFSET, 5, c, MAX_MENU_HEIGHT);
-       if (c == -1)
-           break;
-       else switch (c) {
-        case 0:
-        case 1:
-        case 2:
-        case 3:
-           sprintf (tmp, "Select a diskfile for DF%d:", c);
-           sel = tui_filereq("*.adf", currprefs.df[c], tmp);
-           if (sel == NULL)
-               break;
-           strcpy (currprefs.df[c], sel);
-           break;
-       }
-    }
-}
-
-static void VideoOptions (void)
-{
-    char tmp[256];
-    int c = 0;
-
-    for (c = 0; c < 10; c++)
-       if (videomenu[c].val == 'M') {
-           if (video_mode_menu == NULL)
-               videomenu[c].val = -4;
-           break;
-       }
-
-    c = 0;
-    for (;;) {
-
-       tui_selwin(0);
-       print_configuration();
-
-       c = tui_menubrowse (videomenu, MENU_COL_OFFSET, 5, c, MAX_MENU_HEIGHT);
-       if (c == -1)
-           break;
-       else switch (c) {
-        case 0:
-           tui_wgets (tmp, "Enter new video mode width", 4);
-           if (atoi (tmp) < 320 || atoi (tmp) > 1600 /* maybe we'll implement SHires */)
-               tui_errorbox ("Insane value for video mode width");
-           else
-               currprefs.gfx_width = atoi (tmp);
-           break;
-        case 1:
-           tui_wgets (tmp, "Enter new video mode height", 4);
-           if (atoi (tmp) < 200 || atoi (tmp) > 800 /* whatever */)
-               tui_errorbox ("Insane value for video mode height");
-           else
-               currprefs.gfx_height = atoi (tmp);
-           break;
-        case 2:
-           currprefs.color_mode++;
-           if (currprefs.color_mode > MAX_COLOR_MODES)
-               currprefs.color_mode=0;
-           break;
-        case 3:
-           c = tui_menubrowse (video_mode_menu, 4, 6, 0, 15);
-           if (c != -1)
-               vidmode_menu_selected(c);
-           c = 3;
-           break;
-        case 4:
-           currprefs.gfx_lores = !currprefs.gfx_lores;
-           break;
-        case 5:
-           currprefs.gfx_xcenter = (currprefs.gfx_xcenter + 1) % 3;
-           break;
-        case 6:
-           currprefs.gfx_ycenter = (currprefs.gfx_ycenter + 1) % 3;
-           break;
-        case 7:
-           currprefs.gfx_linedbl = !currprefs.gfx_linedbl;
-           break;
-        case 8:
-           currprefs.gfx_correct_aspect = !currprefs.gfx_correct_aspect;
-           break;
-        case 9:
-           currprefs.gfx_framerate++;
-           if (currprefs.gfx_framerate > 9)
-               currprefs.gfx_framerate=1;
-           break;
-        case 10:
-           currprefs.gfxmem_size += 0x100000;
-           if (currprefs.gfxmem_size > 0x800000)
-               currprefs.gfxmem_size = 0;
-           break;
-       }
-    }
-}
-
-static void MemoryOptions (void)
-{
-    char *tmp;
-    int c = 0;
-    for (;;) {
-
-       tui_selwin(0);
-       print_configuration ();
-
-       c = tui_menubrowse (memorymenu, MENU_COL_OFFSET, 5, c, MAX_MENU_HEIGHT);
-       if (c == -1)
-           break;
-       else switch (c) {
-        case 0:
-           if (currprefs.fastmem_size == 0)
-               currprefs.fastmem_size = 0x200000;
-           else if (currprefs.fastmem_size == 0x800000)
-               currprefs.fastmem_size = 0;
-           else
-               currprefs.fastmem_size <<= 1;
-           break;
-        case 1:
-           if (currprefs.chipmem_size == 0x800000)
-               currprefs.chipmem_size = 0x80000;
-           else
-               currprefs.chipmem_size <<= 1;
-           if (currprefs.chipmem_size > 0x200000)
-               currprefs.fastmem_size = 0;
-           break;
-        case 2:
-           if (currprefs.bogomem_size == 0)
-               currprefs.bogomem_size = 0x40000;
-           else if (currprefs.bogomem_size == 0x100000)
-               currprefs.bogomem_size = 0;
-           else
-               currprefs.bogomem_size <<= 1;
-           break;
-        case 3:
-           tmp = tui_filereq ("*.rom", currprefs.romfile, "Select a ROM image");
-           if (tmp != NULL)
-               strcpy (currprefs.romfile, tmp);
-           break;
-       }
-    }
-}
-
-static void CPUOptions (void)
-{
-    char *tmp;
-    int c = 0;
-    for (;;) {
-       tui_selwin(0);
-       print_configuration ();
-
-       c = tui_menubrowse (cpumenu, MENU_COL_OFFSET, 5, c, MAX_MENU_HEIGHT);
-       if (c == -1)
-           break;
-       else switch (c) {
-        case 0:
-           currprefs.cpu_level++;
-           if (currprefs.cpu_level > 3)
-               currprefs.cpu_level = 0;
-           /* Default to 32 bit addressing when switching from a 68000/68010 to a 32 bit CPU */
-           if (currprefs.cpu_level == 2)
-               currprefs.address_space_24 = 0;
-           if (currprefs.cpu_level != 0)
-               currprefs.cpu_compatible = 0;
-           break;
-       }
-    }
-}
-
-static void SoundOptions (void)
-{
-    char tmp[256];
-    int c = 0;
-    for (;;) {
-       tui_selwin(0);
-       print_configuration ();
-       c = tui_menubrowse (soundmenu, MENU_COL_OFFSET, 5, c, MAX_MENU_HEIGHT);
-       if (c == -1)
-           break;
-       else switch (c) {
-        case 0:
-           currprefs.produce_sound++;
-           if (currprefs.produce_sound > 3)
-               currprefs.produce_sound = 0;
-           break;
-
-        case 1:
-           tui_wgets (tmp, "Enter new minimum sound buffer size in bytes", 6);
-           if (atoi (tmp) < 128 || atoi (tmp) > 65536 || atoi (tmp) > currprefs.sound_maxbsiz)
-               tui_errorbox ("Insane value for minimum sound buffer size");
-           else
-               currprefs.sound_minbsiz = atoi (tmp);
-           break;
-
-        case 2:
-           tui_wgets (tmp, "Enter new maximum sound buffer size in bytes", 6);
-           if (atoi (tmp) < 128 || atoi (tmp) > 65536 || atoi (tmp) < currprefs.sound_minbsiz)
-               tui_errorbox ("Insane value for maximum sound buffer size");
-           else
-               currprefs.sound_maxbsiz = atoi (tmp);
-           break;
-
-        case 3:
-           tui_wgets (tmp, "Enter new number of bits", 3);
-           if (atoi (tmp)!= 8 && atoi (tmp) != 16)
-               tui_errorbox ("Unsupported number of bits");
-           else
-               currprefs.sound_bits = atoi (tmp);
-           break;
-
-        case 4:
-           tui_wgets (tmp, "Enter new sound output frequency", 6);
-           if (atoi (tmp) < 11025 || atoi (tmp) > 44100)
-               tui_errorbox ("Unsupported frequency");
-           else
-               currprefs.sound_freq = atoi (tmp);
-           break;
-        case 5:
-           currprefs.stereo = (currprefs.stereo + 1) % 3;
-           break;
-       }
-    }
-}
-
-static void OtherOptions (void)
-{
-    char tmp[256];
-    int c = 0;
-
-    for (;;) {
-       tui_selwin (0);
-       print_configuration ();
-       c = tui_menubrowse (miscmenu, MENU_COL_OFFSET, 5, c, MAX_MENU_HEIGHT);
-       if (c == -1) {
-           break;
-       } else switch (c) {
-        case 0:
-           currprefs.jport0 = (currprefs.jport0 + 1) % 6;
-           if (currprefs.jport0 == currprefs.jport1)
-             currprefs.jport1 = (currprefs.jport1 + 5) % 6;
-           break;
-        case 1:
-           currprefs.jport1 = (currprefs.jport1 + 1) % 6;
-           if (currprefs.jport0 == currprefs.jport1)
-             currprefs.jport0 = (currprefs.jport0 + 5) % 6;
-           break;
-        case 2:
-           tui_wgets (tmp, "Enter new CPU emulation speed", 6);
-           if (atoi (tmp) < 1 || atoi (tmp) > 20)
-               tui_errorbox ("Unsupported CPU emulation speed");
-           else
-               currprefs.m68k_speed = atoi (tmp);
-           break;
-       }
-    }
-}
-
-static int do_gui (int mode)
-{
-    char cwd[1024];
-
-    if (getcwd (cwd, 1024) == NULL)
-       return 0;
-
-    tui_setup ();
-
-    for (;;) {
-       int c;
-
-       tui_selwin (0);
-       print_configuration ();
-       c = tui_menubrowse (mode == 0 ? mainmenu2 : mainmenu, MENU_COL_OFFSET, 4, 0, MAX_MENU_HEIGHT);
-       if (c == -1) {
-           tui_shutdown ();
-           return -2;
-       }
-       if (mode == 1) {
-           if (c == 8)
-               break;
-           switch (c) {
-            case 0: DiskOptions (); break;
-            case 1: VideoOptions (); break;
-            case 2: MemoryOptions (); break;
-            case 3: CPUOptions (); break;
-            case 4: HDOptions (); break;
-            case 5: SoundOptions (); break;
-            case 6: OtherOptions (); break;
-            case 7: save_settings (); break;
-           }
-       } else {
-           if (c == 5)
-               break;
-           switch (c) {
-            case 0: DiskOptions (); break;
-            case 1: OtherOptions (); break;
-            case 2: save_settings (); break;
-            case 3: uae_reset (); break;
-            case 4: uae_quit (); break;
-           }
-       }
-    }
-    tui_shutdown ();
-
-    chdir (cwd);
-    return 0;
-}
-
-int gui_init (void)
-{
-    return do_gui (1);
-}
-
-void gui_changesettings (void)
-{
-    struct uae_prefs oldprefs;
-    oldprefs = currprefs;
-
-    if (do_gui(0) == -2)
-       uae_quit ();
-    else {
-       changed_prefs = currprefs;
-       currprefs = oldprefs;
-       currprefs.jport0 = changed_prefs.jport0;
-       currprefs.jport1 = changed_prefs.jport1;
-       joystick_setting_changed ();
-    }
-}
-
-int gui_update (void)
-{
-    return 0;
-}
-
-void gui_lock (void)
-{
-}
-
-void gui_unlock (void)
-{
-}
index 5f37fcbe3dcc599fe30d1f084f6a1083ed6b39d6..0970666c2441b9e6e3d83ba1e29be8ba77b44d6e 100644 (file)
--- a/uaeunp.c
+++ b/uaeunp.c
@@ -16,6 +16,7 @@ TCHAR sep[] = { FSDB_DIR_SEPARATOR, 0 };
 
 struct uae_prefs currprefs;
 static int debug = 1;
+static int amigatest;
 
 #define WRITE_LOG_BUF_SIZE 4096
 void write_log (const TCHAR *format, ...)