From: Toni Wilen Date: Fri, 16 Oct 2009 18:17:33 +0000 (+0300) Subject: imported winuaesrc2000b18.zip X-Git-Tag: 2100~53 X-Git-Url: https://git.unchartedbackwaters.co.uk/w/?a=commitdiff_plain;h=794f6bc42b6a399f852270877eb69cba7d9ad597;p=francis%2Fwinuae.git imported winuaesrc2000b18.zip --- diff --git a/a2065.c b/a2065.c index b9540f56..c30b2015 100644 --- a/a2065.c +++ b/a2065.c @@ -18,7 +18,7 @@ #include "win32_uaenet.h" #include "crc32.h" -static int a2065_log = 1; +static int a2065_log = 0; #define RAP 0x4002 #define RDP 0x4000 @@ -578,18 +578,21 @@ static void chip_wput (uaecptr addr, uae_u16 v) reg |= CSR0_TXON; if (!(am_mode & MODE_DRX)) reg |= CSR0_RXON; - write_log (L"A2065: START\n"); + if (a2065_log) + write_log (L"A2065: START\n"); } if ((reg & CSR0_STOP) && !(oreg & CSR0_STOP)) { reg = CSR0_STOP; - write_log (L"A2065: STOP\n"); + if (a2065_log) + write_log (L"A2065: STOP\n"); csr[3] = 0; am_initialized = 0; } if ((reg & CSR0_INIT) && am_initialized == 0) { - write_log (L"A2065: INIT\n"); + if (a2065_log) + write_log (L"A2065: INIT\n"); chip_init (); reg |= CSR0_IDON; am_initialized = 1; diff --git a/audio.c b/audio.c index 6e062ae0..91832481 100644 --- a/audio.c +++ b/audio.c @@ -256,7 +256,7 @@ static void do_samplerip (struct audio_channel_data *adp) } if (rs || cnt > 100) return; - rs = xmalloc(sizeof(struct ripped_sample)); + rs = xmalloc (sizeof(struct ripped_sample)); if (prev) prev->next = rs; else @@ -264,7 +264,7 @@ static void do_samplerip (struct audio_channel_data *adp) rs->len = len; rs->per = adp->per / CYCLE_UNIT; rs->sample = xmalloc (len); - memcpy(rs->sample, smp, len); + memcpy (rs->sample, smp, len); rs->next = NULL; rs->changed = 1; write_log (L"SAMPLERIPPER: sample added (%06X, %d bytes), total %d samples\n", adp->pt, len, ++cnt); @@ -508,7 +508,7 @@ static void sinc_prehandler (unsigned long best_evtime) } /* make room for new and add the new value */ memmove (&acd->sinc_queue[1], &acd->sinc_queue[0], - sizeof(acd->sinc_queue[0]) * acd->sinc_queue_length); + sizeof (acd->sinc_queue[0]) * acd->sinc_queue_length); acd->sinc_queue_length += 1; acd->sinc_queue[0].age = best_evtime; acd->sinc_queue[0].output = output - acd->sinc_output_state; @@ -1547,8 +1547,8 @@ void update_audio (void) /* 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 SOUNDSTUFF > 0 + next_sample_evtime += scaled_sample_evtime - extrasamples * 15; +#if SOUNDSTUFF > 1 doublesample = 0; if (--samplecounter <= 0) { samplecounter = currprefs.sound_freq / 1000; @@ -1564,7 +1564,7 @@ void update_audio (void) } #endif (*sample_handler) (); -#if SOUNDSTUFF > 0 +#if SOUNDSTUFF > 1 if (outputsample == 0) outputsample = -1; else if (outputsample < 0) @@ -1646,7 +1646,7 @@ void audio_hsync (int hpos) alloc_cycle_ext (13 + nr * 2, CYCLE_MISC); #ifdef DEBUGGER if (debug_dma) - record_dma (0xaa + nr * 16, cdp->dat2, cdp->pt, 13 + nr * 2, vpos); + record_dma (0xaa + nr * 16, cdp->dat2, cdp->pt, 13 + nr * 2, vpos, DMARECORD_AUDIO); #endif } if (cdp->request_word == 1 || cdp->request_word == 2) @@ -1891,16 +1891,11 @@ void audio_vsync (void) min = -10 * 10; max = (isfullscreen () > 0 && currprefs.gfx_avsync > 0) ? 10 * 10 : 20 * 10; extrasamples = 0; - if (gui_data.sndbuf < min) { - // add extra sample - for (i = min; i >= gui_data.sndbuf; i -= 10) - extrasamples++; + if (gui_data.sndbuf < min) { // +1 + extrasamples = (min - gui_data.sndbuf) / 10; 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 > max) { // -1 + extrasamples = (max - gui_data.sndbuf) / 10; } else if (gui_data.sndbuf > 1 * 50 && lastdir < 0) { extrasamples--; } else if (gui_data.sndbuf < -1 * 50 && lastdir > 0) { @@ -1909,10 +1904,9 @@ void audio_vsync (void) lastdir = 0; } - if (extrasamples > 10) - extrasamples = 10; - if (extrasamples < -10) - extrasamples = -10; - + if (extrasamples > 99) + extrasamples = 99; + if (extrasamples < -99) + extrasamples = -99; #endif } diff --git a/blitter.c b/blitter.c index c0bbc934..25474aa9 100644 --- a/blitter.c +++ b/blitter.c @@ -219,8 +219,14 @@ void build_blitfilltable (void) STATIC_INLINE void record_dma_blit (uae_u16 reg, uae_u16 dat, uae_u32 addr, int hpos) { #ifdef DEBUGGER + int type; + + if (blitline) + type = DMARECORD_BLITTER_LINE; + else + type = DMARECORD_BLITTER; if (debug_dma) - record_dma (reg, dat, addr, hpos, vpos); + record_dma (reg, dat, addr, hpos, vpos, type); #endif } diff --git a/cfgfile.c b/cfgfile.c index b6d5a854..f3e1ed91 100644 --- a/cfgfile.c +++ b/cfgfile.c @@ -165,7 +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", 0 }; +static const TCHAR *epsonprinter[] = { L"none", L"ascii", L"epson_matrix_9pin", L"epson_matrix_24pin", L"epson_matrix_48pin", 0 }; static const TCHAR *aspects[] = { L"none", L"vga", L"tv", 0 }; static const TCHAR *vsyncmodes[] = { L"false", L"true", L"autoswitch", 0 }; static const TCHAR *dongles[] = diff --git a/custom.c b/custom.c index 0149ac54..085a837b 100644 --- a/custom.c +++ b/custom.c @@ -1028,7 +1028,7 @@ STATIC_INLINE void fetch (int nr, int fm, int hpos) bpl1dat_written = 1; #ifdef DEBUGGER if (debug_dma) - record_dma (0x110 + nr * 2, chipmem_agnus_wget (p), p, hpos, vpos); + record_dma (0x110 + nr * 2, chipmem_agnus_wget (p), p, hpos, vpos, DMARECORD_BITPLANE); #endif switch (fm) { @@ -1670,7 +1670,7 @@ STATIC_INLINE void update_fetch (int until, int fm) if (plf_state < plf_passed_stop && ddf_change != vpos && ddf_change + 1 != vpos && dma && (fetch_cycle & fetchstart_mask) == (fm_maxplane & fetchstart_mask) - && !badmode + && !badmode && !debug_dma # if 0 /* @@@ We handle this case, but the code would be simpler if we * disallowed it - it may even be possible to guarantee that @@ -4109,7 +4109,7 @@ static void update_copper (int until_hpos) alloc_cycle (old_hpos, CYCLE_COPPER); #ifdef DEBUGGER if (debug_dma) - record_dma (0x8c, chipmem_agnus_wget (cop_state.ip), cop_state.ip, old_hpos, vpos); + record_dma (0x8c, chipmem_agnus_wget (cop_state.ip), cop_state.ip, old_hpos, vpos, DMARECORD_COPPER); #endif break; case COP_strobe_delay2: @@ -4121,7 +4121,7 @@ static void update_copper (int until_hpos) cop_state.state = COP_read1; alloc_cycle (old_hpos, CYCLE_COPPER); if (debug_dma) - record_dma (0x1fe, chipmem_agnus_wget (cop_state.ip + 2), cop_state.ip + 2, old_hpos, vpos); + record_dma (0x1fe, chipmem_agnus_wget (cop_state.ip + 2), cop_state.ip + 2, old_hpos, vpos, DMARECORD_COPPER); break; case COP_start_delay: if (copper_cant_read (old_hpos, 1)) @@ -4129,7 +4129,7 @@ static void update_copper (int until_hpos) cop_state.state = COP_read1; alloc_cycle (old_hpos, CYCLE_COPPER); if (debug_dma) - record_dma (0x1fe, 0, 0xffffffff, old_hpos, vpos); + record_dma (0x1fe, 0, 0xffffffff, old_hpos, vpos, DMARECORD_COPPER); break; case COP_read1: @@ -4139,7 +4139,7 @@ static void update_copper (int until_hpos) alloc_cycle (old_hpos, CYCLE_COPPER); #ifdef DEBUGGER if (debug_dma) - record_dma (0x8c, cop_state.i1, cop_state.ip, old_hpos, vpos); + record_dma (0x8c, cop_state.i1, cop_state.ip, old_hpos, vpos, DMARECORD_COPPER); #endif cop_state.ip += 2; cop_state.state = COP_read2; @@ -4163,7 +4163,7 @@ static void update_copper (int until_hpos) cop_state.state = COP_wait_in2; #ifdef DEBUGGER if (debug_dma) - record_dma (0x8c, cop_state.i2, cop_state.ip - 2, old_hpos, vpos); + record_dma (0x8c, cop_state.i2, cop_state.ip - 2, old_hpos, vpos, DMARECORD_COPPER); #endif } else { // MOVE unsigned int reg = cop_state.i1 & 0x1FE; @@ -4171,7 +4171,7 @@ static void update_copper (int until_hpos) cop_state.state = COP_read1; #ifdef DEBUGGER if (debug_dma) - record_dma (reg, data, cop_state.ip - 2, old_hpos, vpos); + record_dma (reg, data, cop_state.ip - 2, old_hpos, vpos, DMARECORD_COPPER); #endif test_copper_dangerous (reg); if (! copper_enabled_thisline) @@ -4429,7 +4429,7 @@ STATIC_INLINE uae_u16 sprite_fetch (struct sprite *s, int dma, int hpos, int cyc alloc_cycle (hpos, CYCLE_SPRITE); #ifdef DEBUGGER if (debug_dma) - record_dma ((s - &spr[0]) * 2 + 0x120, data, s->pt, hpos, vpos); + record_dma ((s - &spr[0]) * 2 + 0x120, data, s->pt, hpos, vpos, DMARECORD_SPRITE); #endif } s->pt += 2; @@ -5200,7 +5200,7 @@ static void hsync_handler (void) alloc_cycle (hp, i == 0 ? CYCLE_STROBE : CYCLE_REFRESH); /* strobe */ #ifdef DEBUGGER if (debug_dma) - record_dma (i == 0 ? (vpos + 1 == maxvpos + lof ? 0x38 : 0x3c) : 0x1fe, 0xffff, 0xffffffff, hp, vpos); + record_dma (i == 0 ? (vpos + 1 == maxvpos + lof ? 0x38 : 0x3c) : 0x1fe, 0xffff, 0xffffffff, hp, vpos, DMARECORD_REFRESH); #endif hp += 2; if (hp >= maxhpos) @@ -6737,7 +6737,7 @@ uae_u32 wait_cpu_cycle_read (uaecptr addr, int mode) hpos = dma_cycle (); #ifdef DEBUGGER if (debug_dma) { - dr = record_dma (0x1000, v, addr, hpos, vpos); + dr = record_dma (0x1000, v, addr, hpos, vpos, DMARECORD_CPU); checknasty (hpos, vpos); } #endif @@ -6762,7 +6762,7 @@ void wait_cpu_cycle_write (uaecptr addr, int mode, uae_u32 v) hpos = dma_cycle (); #ifdef DEBUGGER if (debug_dma) { - record_dma (0x1001, v, addr, hpos, vpos); + record_dma (0x1001, v, addr, hpos, vpos, DMARECORD_CPU); checknasty (hpos, vpos); } #endif diff --git a/debug.c b/debug.c index 6d5a4f6d..c8246649 100644 --- a/debug.c +++ b/debug.c @@ -728,6 +728,95 @@ void record_copper_reset (void) nr_cop_records[curr_cop_set] = 0; } +STATIC_INLINE uae_u32 ledcolor (uae_u32 c, uae_u32 *rc, uae_u32 *gc, uae_u32 *bc, uae_u32 *a) +{ + uae_u32 v = rc[(c >> 16) & 0xff] | gc[(c >> 8) & 0xff] | bc[(c >> 0) & 0xff]; + if (a) + v |= a[255 - ((c >> 24) & 0xff)]; + return v; +} + +STATIC_INLINE void putpixel (uae_u8 *buf, int bpp, int x, xcolnr c8) +{ + if (x <= 0) + return; + + switch (bpp) { + case 1: + buf[x] = (uae_u8)c8; + break; + case 2: + { + uae_u16 *p = (uae_u16*)buf + x; + *p = (uae_u16)c8; + break; + } + case 3: + /* no 24 bit yet */ + break; + case 4: + { + uae_u32 *p = (uae_u32*)buf + x; + *p = c8; + break; + } + } +} + +#define lc(x) ledcolor (x, xredcolors, xgreencolors, xbluecolors, NULL); +void debug_draw_cycles (uae_u8 *buf, int bpp, int line, int width, int height, uae_u32 *xredcolors, uae_u32 *xgreencolors, uae_u32 *xbluescolors) +{ + int y, x, xx, dx, xplus, yplus; + struct dma_rec *dr; + int t; + uae_u32 cc[DMARECORD_MAX]; + + if (debug_dma >= 4) + yplus = 2; + else + yplus = 1; + if (debug_dma >= 3) + xplus = 2; + else + xplus = 1; + + t = dma_record_toggle ^ 1; + y = line / yplus; + + if (y > maxvpos) + return; + if (y >= height) + return; + + dx = width - xplus * ((maxhpos + 1) & ~1) - 16; + + cc[0] = lc(0x222222); + cc[DMARECORD_REFRESH] = lc(0x444444); + cc[DMARECORD_CPU] = lc(0x888888); + cc[DMARECORD_COPPER] = lc(0xeeee00); + cc[DMARECORD_AUDIO] = lc(0xff0000); + cc[DMARECORD_BLITTER] = lc(0x00ff00); + cc[DMARECORD_BLITTER_LINE] = lc(0x008800); + cc[DMARECORD_BITPLANE] = lc(0x0000ff); + cc[DMARECORD_SPRITE] = lc(0xff00ff); + cc[DMARECORD_DISK] = lc(0xffffff); + + for (x = 0; x < maxhpos; x++) { + uae_u32 c = cc[0]; + xx = x * xplus + dx; + dr = &dma_record[t][y * NR_DMA_REC_HPOS + x]; + if (dr->reg != 0xffff) { + c = cc[dr->type]; + } + putpixel (buf, bpp, xx, c); + if (xplus) + putpixel (buf, bpp, xx + 1, c); + } +} + + + + void record_dma_event (int evt, int hpos, int vpos) { struct dma_rec *dr; @@ -735,12 +824,12 @@ void record_dma_event (int evt, int hpos, int vpos) if (!dma_record[0]) return; if (hpos >= NR_DMA_REC_HPOS || vpos >= NR_DMA_REC_VPOS) - return ; + return; dr = &dma_record[dma_record_toggle][vpos * NR_DMA_REC_HPOS + hpos]; dr->evt |= evt; } -struct dma_rec *record_dma (uae_u16 reg, uae_u16 dat, uae_u32 addr, int hpos, int vpos) +struct dma_rec *record_dma (uae_u16 reg, uae_u16 dat, uae_u32 addr, int hpos, int vpos, int type) { struct dma_rec *dr; @@ -760,6 +849,7 @@ struct dma_rec *record_dma (uae_u16 reg, uae_u16 dat, uae_u32 addr, int hpos, in dr->reg = reg; dr->dat = dat; dr->addr = addr; + dr->type = type; return dr; } @@ -3077,8 +3167,8 @@ static void debug_1 (void) if (debug_dma) { decode_dma_record (v2, v1, cmd == 'v'); } else { - debug_dma = 1; - console_out_f (L"DMA debugger enabled.\n"); + debug_dma = v1 < 0 ? -v1 : 1; + console_out_f (L"DMA debugger enabled, mode=%d.\n", debug_dma); } } break; diff --git a/disk.c b/disk.c index 945bb01b..6466c372 100644 --- a/disk.c +++ b/disk.c @@ -2575,7 +2575,7 @@ static void diskdma (uae_u32 pt, uae_u16 w, int write) if (!cycle_line[i]) { cycle_line[i] = CYCLE_MISC; if (debug_dma) - record_dma (write ? 0x26 : 0x08, w, pt, i, vpos); + record_dma (write ? 0x26 : 0x08, w, pt, i, vpos, DMARECORD_DISK); got = 1; break; } diff --git a/dongle.c b/dongle.c index 3ac79bfe..fead7542 100644 --- a/dongle.c +++ b/dongle.c @@ -25,7 +25,6 @@ #define LEVIATHAN 8 #define LOGISTIX 10 -static int type = 0; static int flag; static unsigned int cycles; @@ -65,7 +64,7 @@ static unsigned int cycles; - must continuously change state Leviathan - - not implemented yet + - same as Leaderboard but in mouse port Logistix/SuperBase - second button must be high @@ -80,16 +79,15 @@ static uae_u8 oldcia[2][16]; void dongle_reset (void) { - type = currprefs.dongle; flag = 0; memset (oldcia, 0, sizeof oldcia); } uae_u8 dongle_cia_read (int cia, int reg, uae_u8 val) { - if (!type) + if (!currprefs.dongle) return val; - switch (type) + switch (currprefs.dongle) { case BAT2: if (cia == 1 && reg == 0) { @@ -107,9 +105,9 @@ uae_u8 dongle_cia_read (int cia, int reg, uae_u8 val) void dongle_cia_write (int cia, int reg, uae_u8 val) { - if (!type) + if (!currprefs.dongle) return; - switch (type) + switch (currprefs.dongle) { case ROBOCOP3: if (cia == 0 && reg == 0 && (val & 0x80)) @@ -131,9 +129,9 @@ void dongle_joytest (uae_u16 val) uae_u16 dongle_joydat (int port, uae_u16 val) { - if (!type) + if (!currprefs.dongle) return val; - switch (type) + switch (currprefs.dongle) { case ROBOCOP3: if (port == 1 && flag) @@ -145,6 +143,12 @@ uae_u16 dongle_joydat (int port, uae_u16 val) val |= 0x0101; } break; + case LEVIATHAN: + if (port == 0) { + val &= ~0x0303; + val |= 0x0101; + } + break; case RUGBYCOACH: if (port == 1) { val &= ~0x0303; @@ -167,9 +171,9 @@ uae_u16 dongle_joydat (int port, uae_u16 val) void dongle_potgo (uae_u16 val) { - if (!type) + if (!currprefs.dongle) return; - switch (type) + switch (currprefs.dongle) { case ITALY90: case LOGISTIX: @@ -182,9 +186,9 @@ void dongle_potgo (uae_u16 val) uae_u16 dongle_potgor (uae_u16 val) { - if (!type) + if (!currprefs.dongle) return val; - switch (type) + switch (currprefs.dongle) { case LOGISTIX: val |= 1 << 14; @@ -196,9 +200,9 @@ uae_u16 dongle_potgor (uae_u16 val) int dongle_analogjoy (int joy, int axis) { int v = -1; - if (!type) + if (!currprefs.dongle) return -1; - switch (type) + switch (currprefs.dongle) { case ITALY90: if (joy == 1 && axis == 0) diff --git a/drawing.c b/drawing.c index 8965c11e..d9a985b5 100644 --- a/drawing.c +++ b/drawing.c @@ -45,12 +45,10 @@ #include "gui.h" #include "picasso96.h" #include "drawing.h" -#ifdef JIT -#include "jit/compemu.h" -#endif #include "savestate.h" #include "statusline.h" #include "inputdevice.h" +#include "debug.h" extern int sprite_buffer_res; int lores_factor, lores_shift; @@ -2606,6 +2604,14 @@ static void draw_status_line (int line) draw_status_line_single (buf, bpp, y, gfxvidinfo.width, xredcolors, xgreencolors, xbluecolors, NULL); } +static void draw_debug_status_line (int line) +{ + xlinebuffer = gfxvidinfo.linemem; + if (xlinebuffer == 0) + xlinebuffer = row_map[line]; + debug_draw_cycles (xlinebuffer, gfxvidinfo.pixbytes, line, gfxvidinfo.width, gfxvidinfo.height, xredcolors, xgreencolors, xbluecolors); +} + #define LIGHTPEN_HEIGHT 12 #define LIGHTPEN_WIDTH 17 @@ -2753,6 +2759,13 @@ void finish_drawing_frame (void) do_flush_line (line); } } + if (debug_dma > 1) { + for (i = 0; i < gfxvidinfo.height; i++) { + int line = i; + draw_debug_status_line (line); + do_flush_line (line); + } + } if (lightpen_x > 0 || lightpen_y > 0) lightpen_update (); diff --git a/epsonprinter.c b/epsonprinter.c index f70dbf33..3c6d6cbc 100644 --- a/epsonprinter.c +++ b/epsonprinter.c @@ -29,6 +29,7 @@ #include "epsonprinter.h" #include "win32.h" +#include "parser.h" #include @@ -89,6 +90,7 @@ static uae_u8 *page; static int page_w, page_h, page_pitch; static int pagesize; static HMODULE ft; +static int pins = 24; // Various ASCII codepage to unicode maps @@ -793,8 +795,9 @@ static void resetPrinterHard(void) resetPrinter(); } -static printer_init(Bit16u dpi2, Bit16u width, Bit16u height, TCHAR* output2, int multipageOutput2) +static printer_init(Bit16u dpi2, Bit16u width, Bit16u height, TCHAR* output2, int multipageOutput2, int numpins) { + pins = numpins; if (ft == NULL || FT_Init_FreeType(&FTlib)) { write_log(L"EPSONPRINTER: Unable to init Freetype2. ASCII printing disabled\n"); @@ -904,12 +907,24 @@ static void setupBitImage(Bit8u dens, Bit16u numCols) bitGraph.adjacent = true; bitGraph.bytesColumn = 1; break; + case 5: + bitGraph.horizDens = 80; + bitGraph.vertDens = 72; + bitGraph.adjacent = true; + bitGraph.bytesColumn = 1; + break; case 6: bitGraph.horizDens = 90; bitGraph.vertDens = 60; bitGraph.adjacent = true; bitGraph.bytesColumn = 1; break; + case 7: + bitGraph.horizDens = 144; + bitGraph.vertDens = 72; + bitGraph.adjacent = true; + bitGraph.bytesColumn = 1; + break; case 32: bitGraph.horizDens = 60; bitGraph.vertDens = 180; @@ -940,6 +955,24 @@ static void setupBitImage(Bit8u dens, Bit16u numCols) bitGraph.adjacent = false; bitGraph.bytesColumn = 3; break; + case 64: + bitGraph.horizDens = 60; + bitGraph.vertDens = 360; + bitGraph.adjacent = true; + bitGraph.bytesColumn = 6; + break; + case 65: + bitGraph.horizDens = 120; + bitGraph.vertDens = 360; + bitGraph.adjacent = true; + bitGraph.bytesColumn = 6; + break; + case 70: + bitGraph.horizDens = 90; + bitGraph.vertDens = 360; + bitGraph.adjacent = true; + bitGraph.bytesColumn = 6; + break; case 71: bitGraph.horizDens = 180; bitGraph.vertDens = 360; @@ -961,7 +994,8 @@ static void setupBitImage(Bit8u dens, Bit16u numCols) default: write_log(L"EPSONPRINTER: Unsupported bit image density %i\n", dens); } - + if (pins == 9) + bitGraph.vertDens = 72; bitGraph.remBytes = numCols * bitGraph.bytesColumn; bitGraph.readBytesColumn = 0; } @@ -1942,11 +1976,15 @@ void epson_printchar(uae_u8 c) { printChar (c); } -int epson_init(void) +int epson_init(int type) { + if (type == PARALLEL_MATRIX_EPSON9) + pins = 9; + else + pins = 48; epson_ft (); - write_log (L"EPSONPRINTER: start\n"); - return printer_init(300, 83, 117, L"png", 0); + write_log (L"EPSONPRINTER%d: start\n", pins); + return printer_init(300, 83, 117, L"png", 0, pins); } void epson_close(void) { diff --git a/include/debug.h b/include/debug.h index 2271081d..ec9c1677 100644 --- a/include/debug.h +++ b/include/debug.h @@ -78,6 +78,7 @@ struct dma_rec uae_u16 dat; uae_u32 addr; uae_u16 evt; + int type; }; #define DMA_EVENT_BLITIRQ 1 @@ -86,9 +87,21 @@ struct dma_rec #define DMA_EVENT_BPLFETCHUPDATE 8 #define DMA_EVENT_COPPERWAKE 16 -extern struct dma_rec *record_dma (uae_u16 reg, uae_u16 dat, uae_u32 addr, int hpos, int vpos); +#define DMARECORD_REFRESH 1 +#define DMARECORD_CPU 2 +#define DMARECORD_COPPER 3 +#define DMARECORD_AUDIO 4 +#define DMARECORD_BLITTER 5 +#define DMARECORD_BLITTER_LINE 6 +#define DMARECORD_BITPLANE 7 +#define DMARECORD_SPRITE 8 +#define DMARECORD_DISK 9 +#define DMARECORD_MAX 10 + +extern struct dma_rec *record_dma (uae_u16 reg, uae_u16 dat, uae_u32 addr, int hpos, int vpos, int type); extern void record_dma_reset (void); extern void record_dma_event (int evt, int hpos, int vpos); +extern void debug_draw_cycles (uae_u8 *buf, int bpp, int line, int width, int height, uae_u32 *xredcolors, uae_u32 *xgreencolors, uae_u32 *xbluescolors); #else diff --git a/include/zarchive.h b/include/zarchive.h index db65a2cc..fc8f1a28 100644 --- a/include/zarchive.h +++ b/include/zarchive.h @@ -1,10 +1,15 @@ +typedef uae_s64 (*ZFILEREAD)(void*, uae_u64, uae_u64, struct zfile*); +typedef uae_s64 (*ZFILEWRITE)(void*, uae_u64, uae_u64, struct zfile*); +typedef uae_s64 (*ZFILESEEK)(struct zfile*, uae_s64, int); + struct zfile { TCHAR *name; TCHAR *zipname; TCHAR *mode; FILE *f; uae_u8 *data; + int dataseek; uae_s64 size; uae_s64 seek; int deleteafterclose; @@ -14,6 +19,11 @@ struct zfile { struct zfile *parent; uae_u64 offset; int opencnt; + ZFILEREAD zfileread; + ZFILEWRITE zfilewrite; + ZFILESEEK zfileseek; + void *userdata; + int useparent; }; #define ZNODE_FILE 0 diff --git a/inputdevice.c b/inputdevice.c index d14bfc64..0f63cb2b 100644 --- a/inputdevice.c +++ b/inputdevice.c @@ -2587,6 +2587,10 @@ static void inputdevice_checkconfig (void) inputdevice_updateconfig (&currprefs); } + if (currprefs.dongle != changed_prefs.dongle) { + currprefs.dongle = changed_prefs.dongle; + dongle_reset (); + } } void inputdevice_vsync (void) diff --git a/od-win32/caps/caps_win32.c b/od-win32/caps/caps_win32.c index aa34fa4b..008dcf38 100644 --- a/od-win32/caps/caps_win32.c +++ b/od-win32/caps/caps_win32.c @@ -52,7 +52,7 @@ int caps_init (void) h = WIN32_LoadLibrary (dllname); if (!h) { TCHAR tmp[MAX_DPATH]; - if (SUCCEEDED(SHGetFolderPath (NULL, CSIDL_PROGRAM_FILES_COMMON, NULL, 0, tmp))) { + if (SUCCEEDED (SHGetFolderPath (NULL, CSIDL_PROGRAM_FILES_COMMON, NULL, 0, tmp))) { _tcscat (tmp, L"\\Software Preservation Society\\"); _tcscat (tmp, dllname); h = LoadLibrary (tmp); diff --git a/od-win32/parser.c b/od-win32/parser.c index c49ee3dd..cd47f6b5 100644 --- a/od-win32/parser.c +++ b/od-win32/parser.c @@ -256,10 +256,10 @@ static void flushprtbuf (void) } else if (prtbufbytes > 0) { int pbyt = prtbufbytes; - if (currprefs.parallel_matrix_emulation == 2) { + if (currprefs.parallel_matrix_emulation >= PARALLEL_MATRIX_EPSON) { int i; if (!prtopen) { - if (epson_init ()) + if (epson_init (currprefs.parallel_matrix_emulation)) prtopen = 1; } for (i = 0; i < prtbufbytes; i++) @@ -468,8 +468,8 @@ static void openprinter (void) if (currprefs.parallel_postscript_emulation) { prtopen = 1; return; - } else if (currprefs.parallel_matrix_emulation == 2) { - epson_init (); + } else if (currprefs.parallel_matrix_emulation >= PARALLEL_MATRIX_EPSON) { + epson_init (currprefs.parallel_matrix_emulation); } else if (hPrt == INVALID_HANDLE_VALUE) { flushprtbuf (); if (OpenPrinter (currprefs.prtname, &hPrt, NULL)) { diff --git a/od-win32/parser.h b/od-win32/parser.h index 7f64f717..c65e3386 100644 --- a/od-win32/parser.h +++ b/od-win32/parser.h @@ -47,5 +47,10 @@ extern void sernametodev (TCHAR*); extern void serdevtoname (TCHAR*); extern void epson_printchar(uae_u8 c); -extern int epson_init(void); +extern int epson_init(int pins); extern void epson_close(void); + +#define PARALLEL_MATRIX_TEXT 1 +#define PARALLEL_MATRIX_EPSON 2 +#define PARALLEL_MATRIX_EPSON9 2 +#define PARALLEL_MATRIX_EPSON48 3 diff --git a/od-win32/resources/resource b/od-win32/resources/resource index e24258a3..9ad628f7 100644 --- a/od-win32/resources/resource +++ b/od-win32/resources/resource @@ -321,12 +321,15 @@ #define IDS_PRINTER_ASCII 351 #define IDD_EXPANSION 351 #define IDS_PRINTER_EPSON 352 +#define IDS_PRINTER_EPSON9 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_PRIRNTER_EPSON48 359 +#define IDS_PRINTER_EPSON48 359 #define IDS_QS_MODELS 1000 #define IDS_QS_MODEL_A500 1001 #define IDS_QS_MODEL_A500P 1002 @@ -364,9 +367,9 @@ #define IDC_SHOWLEDS 1027 #define IDC_PORT1_JOYS 1027 #define IDC_SCREENMODE_RTG 1027 +#define IDC_DONGLELIST 1027 #define IDC_MBMEM1 1028 #define IDC_PORT_TABLET_CURSOR 1028 -#define IDC_SHOWLEDS2 1028 #define IDC_SHOWLEDSRTG 1028 #define IDC_PORT0_JOYSMODE 1029 #define IDC_SLOWMEM 1030 diff --git a/od-win32/resources/winuae.rc b/od-win32/resources/winuae.rc index 267c34b8..e2e66e8a 100644 --- a/od-win32/resources/winuae.rc +++ b/od-win32/resources/winuae.rc @@ -368,11 +368,11 @@ BEGIN PUSHBUTTON "Save As...",IDC_SAVE,175,225,44,15 END -IDD_IOPORTS DIALOGEX 0, 0, 300, 208 +IDD_IOPORTS DIALOGEX 0, 0, 300, 228 STYLE DS_LOCALEDIT | DS_SETFONT | DS_3DLOOK | DS_CONTROL | WS_CHILD FONT 8, "MS Sans Serif", 0, 0, 0x1 BEGIN - GROUPBOX "Parallel Port",IDC_SERPARFRAME,5,2,291,86 + GROUPBOX "Parallel Port",IDC_STATIC,5,2,291,86 RTEXT "Printer:",IDC_STATIC,12,15,25,15,SS_CENTERIMAGE COMBOBOX IDC_PRINTERLIST,49,15,232,134,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP PUSHBUTTON "Flush print job",IDC_FLUSHPRINTER,114,51,58,12 @@ -380,11 +380,10 @@ BEGIN EDITTEXT IDC_PRINTERAUTOFLUSH,255,50,25,12,ES_NUMBER RTEXT "Type:",IDC_STATIC,15,33,21,15,SS_CENTERIMAGE EDITTEXT IDC_PS_PARAMS,114,67,167,12,ES_AUTOHSCROLL - GROUPBOX "Serial Port",IDC_SERIALFRAME,4,92,292,48 + GROUPBOX "Serial Port",IDC_STATIC,4,92,292,48 COMBOBOX IDC_SERIAL,49,104,232,65,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP CONTROL "Shared",IDC_SER_SHARED,"Button",BS_AUTOCHECKBOX | BS_VCENTER | WS_TABSTOP,15,123,48,12 CONTROL "RTS/CTS",IDC_SER_CTSRTS,"Button",BS_AUTOCHECKBOX | BS_VCENTER | WS_TABSTOP,75,123,55,12 - GROUPBOX "MIDI",IDC_MIDIFRAME,4,143,292,50 RTEXT "Out:",IDC_MIDI,10,154,34,15,SS_CENTERIMAGE COMBOBOX IDC_MIDIOUTLIST,49,154,232,130,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP RTEXT "In:",IDC_MIDI2,10,174,29,15,SS_CENTERIMAGE @@ -394,6 +393,9 @@ BEGIN CONTROL "uaeserial.device",IDC_UAESERIAL,"Button",BS_AUTOCHECKBOX | BS_VCENTER | WS_TABSTOP,200,123,78,12 COMBOBOX IDC_PRINTERTYPELIST,49,33,232,134,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP RTEXT "Ghostscript extra parameters:",IDC_STATIC,10,66,102,15,SS_CENTERIMAGE + GROUPBOX "MIDI",IDC_STATIC,5,143,291,51,BS_LEFT + GROUPBOX "Protection Dongle",IDC_STATIC,5,197,292,30,BS_LEFT + COMBOBOX IDC_DONGLELIST,50,208,232,130,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP END IDD_GAMEPORTS DIALOGEX 0, 0, 300, 236 @@ -1476,7 +1478,7 @@ END STRINGTABLE BEGIN - IDS_PRINTER_EPSON "Epson Matrix Printer Emulation (beta, FreeType required)" + IDS_PRINTER_EPSON9 "Epson Matrix Printer Emulation, 9pin" IDS_PRINTER_POSTSCRIPT_DETECTION "PostScript (Passthrough)" IDS_PRINTER_POSTSCRIPT_EMULATION "PostScript (Emulation, GhostScript required)" @@ -1484,6 +1486,7 @@ BEGIN IDS_RES_LORES "Lores" IDS_RES_HIRES "Hires (normal)" IDS_RES_SUPERHIRES "SuperHires" + IDS_PRINTER_EPSON48 "Epson Matrix Printer Emulation, 48pin" END #endif // English (Neutral) resources diff --git a/od-win32/sounddep/sound.h b/od-win32/sounddep/sound.h index d94e39f0..68ad9a6b 100644 --- a/od-win32/sounddep/sound.h +++ b/od-win32/sounddep/sound.h @@ -60,7 +60,7 @@ static uae_u16 *paula_sndbufpt_prev, *paula_sndbufpt_start; STATIC_INLINE void set_sound_buffers (void) { -#if SOUNDSTUFF > 0 +#if SOUNDSTUFF > 1 paula_sndbufpt_prev = paula_sndbufpt_start; paula_sndbufpt_start = paula_sndbufpt; #endif @@ -68,7 +68,7 @@ STATIC_INLINE void set_sound_buffers (void) STATIC_INLINE void check_sound_buffers (void) { -#if SOUNDSTUFF > 0 +#if SOUNDSTUFF > 1 int len; #endif @@ -86,7 +86,7 @@ STATIC_INLINE void check_sound_buffers (void) p[1] = sum / 8; paula_sndbufpt = (uae_u16 *)(((uae_u8 *)paula_sndbufpt) + 4 * 2); } -#if SOUNDSTUFF > 0 +#if SOUNDSTUFF > 1 if (outputsample == 0) return; len = paula_sndbufpt - paula_sndbufpt_start; @@ -104,7 +104,7 @@ STATIC_INLINE void check_sound_buffers (void) finish_sound_buffer (); paula_sndbufpt = paula_sndbuffer; } -#if SOUNDSTUFF > 0 +#if SOUNDSTUFF > 1 while (doublesample-- > 0) { memcpy (paula_sndbufpt, paula_sndbufpt_start, len * 2); paula_sndbufpt += len; diff --git a/od-win32/win32.c b/od-win32/win32.c index 7e1a0ef0..0f533c9c 100644 --- a/od-win32/win32.c +++ b/od-win32/win32.c @@ -439,8 +439,10 @@ void setpaused (void) static void checkpause (void) { - if (currprefs.win32_inactive_pause) + if (currprefs.win32_inactive_pause) { setpaused (); + setpriority (&priorities[currprefs.win32_inactive_priority]); + } } static int showcursor; @@ -597,6 +599,7 @@ void setmouseactive (int active) setcursor (-30000, -30000); } inputdevice_acquire (TRUE); + setpriority (&priorities[currprefs.win32_active_priority]); } else { inputdevice_acquire (FALSE); } @@ -622,10 +625,8 @@ static void winuae_active (HWND hWnd, int minimized) focus = 1; pri = &priorities[currprefs.win32_inactive_priority]; -#ifndef _DEBUG if (!minimized) pri = &priorities[currprefs.win32_active_priority]; -#endif setpriority (pri); if (!avioutput_video) { @@ -1201,7 +1202,7 @@ static LRESULT CALLBACK AmigaWindowProc (HWND hWnd, UINT message, WPARAM wParam, { LPNMMOUSE lpnm = (LPNMMOUSE) lParam; int num = (int)lpnm->dwItemSpec; - if (num >= 7 && num <= 10) { + if (num >= 7 && num <= 10) { // DF0-DF3 num -= 7; if (nm->code == NM_RCLICK) { disk_eject (num); @@ -1210,10 +1211,15 @@ static LRESULT CALLBACK AmigaWindowProc (HWND hWnd, UINT message, WPARAM wParam, disk_insert (num, changed_prefs.df[num]); } } else if (num == 4) { - if (nm->code == NM_CLICK) + if (nm->code == NM_CLICK) // POWER inputdevice_add_inputcode (AKS_ENTERGUI, 1); else uae_reset (0); + } else if (num == 3) { + if (pause_emulation) { + resumepaused (); + setmouseactive (1); + } } return TRUE; } @@ -1387,14 +1393,15 @@ static LRESULT CALLBACK MainWindowProc (HWND hWnd, UINT message, WPARAM wParam, WIN32GFX_WindowMove (); if (hAmigaWnd && isfullscreen () <= 0) { DWORD aw, ah; - if (!IsIconic (hWnd)) + int iconic = IsIconic (hWnd); + if (!iconic) GetWindowRect (hAmigaWnd, &amigawin_rect); aw = amigawin_rect.right - amigawin_rect.left; ah = amigawin_rect.bottom - amigawin_rect.top; if (in_sizemove > 0) break; - if (isfullscreen() == 0 && hAmigaWnd) { + if (isfullscreen() == 0 && hAmigaWnd && !iconic) { static int store_xy; RECT rc2; if (GetWindowRect (hMainWnd, &rc2)) { @@ -1789,6 +1796,7 @@ static PGETUSERDEFAULTUILANGUAGE pGetUserDefaultUILanguage; HMODULE language_load (WORD language) { HMODULE result = NULL; +#if WINUAEPUBLICBETA == 0 TCHAR dllbuf[MAX_DPATH]; TCHAR *dllname; @@ -1854,6 +1862,7 @@ HMODULE language_load (WORD language) result = NULL; } } +#endif return result; } diff --git a/od-win32/win32.h b/od-win32/win32.h index 5cc68856..b63aa07b 100644 --- a/od-win32/win32.h +++ b/od-win32/win32.h @@ -17,8 +17,8 @@ #define WINUAEPUBLICBETA 1 -#define WINUAEBETA L"17" -#define WINUAEDATE MAKEBD(2009, 10, 7) +#define WINUAEBETA L"18" +#define WINUAEDATE MAKEBD(2009, 10, 16) #define WINUAEEXTRA L"" #define WINUAEREV L"" diff --git a/od-win32/win32gui.c b/od-win32/win32gui.c index d0f186a0..c468890e 100644 --- a/od-win32/win32gui.c +++ b/od-win32/win32gui.c @@ -6078,11 +6078,6 @@ static INT_PTR CALLBACK ExpansionDlgProc (HWND hDlg, UINT msg, WPARAM wParam, LP if (tmp[0]) workprefs.win32_rtgvblankrate = _tstol (tmp); break; - case IDC_SCSIMODE: - v = SendDlgItemMessage (hDlg, IDC_SCSIMODE, CB_GETCURSEL, 0, 0L); - if (v != CB_ERR) - workprefs.win32_uaescsimode = v + 1; - break; case IDC_NETDEVICE: v = SendDlgItemMessage (hDlg, IDC_NETDEVICE, CB_GETCURSEL, 0, 0L); if (v != CB_ERR) { @@ -6571,7 +6566,7 @@ static void values_to_miscdlg (HWND hDlg) SendDlgItemMessage (hDlg, IDC_DD_SURFACETYPE, CB_RESETCONTENT, 0, 0); SendDlgItemMessage (hDlg, IDC_DD_SURFACETYPE, CB_ADDSTRING, 0, (LPARAM)L"NonLocalVRAM"); - SendDlgItemMessage (hDlg, IDC_DD_SURFACETYPE, CB_ADDSTRING, 0, (LPARAM)L"DefaultRAM"); + SendDlgItemMessage (hDlg, IDC_DD_SURFACETYPE, CB_ADDSTRING, 0, (LPARAM)L"DefaultRAM *"); SendDlgItemMessage (hDlg, IDC_DD_SURFACETYPE, CB_ADDSTRING, 0, (LPARAM)L"LocalVRAM"); SendDlgItemMessage (hDlg, IDC_DD_SURFACETYPE, CB_ADDSTRING, 0, (LPARAM)L"SystemRAM"); SendDlgItemMessage (hDlg, IDC_DD_SURFACETYPE, CB_SETCURSEL, ddforceram, 0); @@ -6681,6 +6676,11 @@ static INT_PTR MiscDlgProc (HWND hDlg, UINT msg, WPARAM wParam, LPARAM lParam) regsetint (NULL, L"DirectDraw_Secondary", ddforceram); } break; + case IDC_SCSIMODE: + v = SendDlgItemMessage (hDlg, IDC_SCSIMODE, CB_GETCURSEL, 0, 0L); + if (v != CB_ERR) + workprefs.win32_uaescsimode = v + 1; + break; } } } else if (currentpage == MISC2_ID) { @@ -6914,11 +6914,15 @@ static void values_to_cpudlg (HWND hDlg) CheckDlgButton (hDlg, IDC_JITENABLE, workprefs.cachesize > 0); CheckDlgButton (hDlg, IDC_MMUENABLE, workprefs.cpu_model == 68040 && workprefs.cachesize == 0 && workprefs.mmu_model == 68040); - if (workprefs.cpu_clock_multiplier) { - TCHAR txt[20]; - double f = getcpufreq (workprefs.cpu_clock_multiplier); - _stprintf (txt, L"%.6f", f / 1000000.0); - SendDlgItemMessage (hDlg, IDC_CPU_FREQUENCY2, WM_SETTEXT, 0, (LPARAM)txt); + if (workprefs.cpu_cycle_exact) { + if (workprefs.cpu_clock_multiplier) { + TCHAR txt[20]; + double f = getcpufreq (workprefs.cpu_clock_multiplier); + _stprintf (txt, L"%.6f", f / 1000000.0); + SendDlgItemMessage (hDlg, IDC_CPU_FREQUENCY2, WM_SETTEXT, 0, (LPARAM)txt); + } + } else { + SendDlgItemMessage (hDlg, IDC_CPU_FREQUENCY2, WM_SETTEXT, 0, (LPARAM)""); } } @@ -7063,14 +7067,7 @@ static INT_PTR CALLBACK CPUDlgProc (HWND hDlg, UINT msg, WPARAM wParam, LPARAM l SendDlgItemMessage (hDlg, IDC_CACHE, TBM_SETPAGESIZE, 0, 1); SendDlgItemMessage (hDlg, IDC_CPUIDLE, TBM_SETRANGE, TRUE, MAKELONG (0, 10)); SendDlgItemMessage (hDlg, IDC_CPUIDLE, TBM_SETPAGESIZE, 0, 1); -#if 0 - SendDlgItemMessage (hDlg, IDC_CPU_MULTIPLIER, CB_RESETCONTENT, 0, 0); - SendDlgItemMessage (hDlg, IDC_CPU_MULTIPLIER, CB_ADDSTRING, 0, (LPARAM)L"-"); - SendDlgItemMessage (hDlg, IDC_CPU_MULTIPLIER, CB_ADDSTRING, 0, (LPARAM)L"1 (3.5MHz)"); - SendDlgItemMessage (hDlg, IDC_CPU_MULTIPLIER, CB_ADDSTRING, 0, (LPARAM)L"2 (7.1MHz)"); - SendDlgItemMessage (hDlg, IDC_CPU_MULTIPLIER, CB_ADDSTRING, 0, (LPARAM)L"4 (14.2MHz)"); - SendDlgItemMessage (hDlg, IDC_CPU_MULTIPLIER, CB_ADDSTRING, 0, (LPARAM)L"8 (28.4MHz)"); -#endif + SendDlgItemMessage (hDlg, IDC_CPU_FREQUENCY, CB_RESETCONTENT, 0, 0); SendDlgItemMessage (hDlg, IDC_CPU_FREQUENCY, CB_ADDSTRING, 0, (LPARAM)L"A500"); SendDlgItemMessage (hDlg, IDC_CPU_FREQUENCY, CB_ADDSTRING, 0, (LPARAM)L"A1200"); @@ -7078,12 +7075,22 @@ static INT_PTR CALLBACK CPUDlgProc (HWND hDlg, UINT msg, WPARAM wParam, LPARAM l SendDlgItemMessage (hDlg, IDC_CPU_FREQUENCY, CB_ADDSTRING, 0, (LPARAM)L"Custom"); idx = 3; - if (workprefs.cpu_clock_multiplier == 2 << 8) + if (workprefs.cpu_clock_multiplier == 2 << 8 || (workprefs.cpu_clock_multiplier == 0 && workprefs.cpu_frequency == 0 && workprefs.cpu_model <= 68010)) { idx = 0; - if (workprefs.cpu_clock_multiplier == 4 << 8) + workprefs.cpu_clock_multiplier = 2 << 8; + } + if (workprefs.cpu_clock_multiplier == 4 << 8 || (workprefs.cpu_clock_multiplier == 0 && workprefs.cpu_frequency == 0 && workprefs.cpu_model >= 68020)) { idx = 1; - if (workprefs.cpu_clock_multiplier == 8 << 8) + workprefs.cpu_clock_multiplier = 4 << 8; + } + if (workprefs.cpu_clock_multiplier == 8 << 8) { idx = 2; + } + if (!workprefs.cpu_cycle_exact) { + idx = 3; + workprefs.cpu_clock_multiplier = 0; + workprefs.cpu_frequency = 0; + } SendDlgItemMessage (hDlg, IDC_CPU_FREQUENCY, CB_SETCURSEL, idx, 0); if (!workprefs.cpu_clock_multiplier) { TCHAR txt[20]; @@ -9573,6 +9580,10 @@ static void values_from_portsdlg (HWND hDlg) if (success) workprefs.parallel_autoflush_time = v; + item = SendDlgItemMessage (hDlg, IDC_DONGLELIST, CB_GETCURSEL, 0, 0L); + if (item != CB_ERR) + workprefs.dongle = item; + } static void values_to_portsdlg (HWND hDlg) @@ -9606,9 +9617,9 @@ static void values_to_portsdlg (HWND hDlg) SetDlgItemInt (hDlg, IDC_PRINTERAUTOFLUSH, workprefs.parallel_autoflush_time, FALSE); idx = workprefs.parallel_matrix_emulation; if (workprefs.parallel_postscript_detection) - idx = 3; - if (workprefs.parallel_postscript_emulation) idx = 4; + if (workprefs.parallel_postscript_emulation) + idx = 5; SendDlgItemMessage (hDlg, IDC_PRINTERTYPELIST, CB_SETCURSEL, idx, 0); SetDlgItemText (hDlg, IDC_PS_PARAMS, workprefs.ghostscript_parameters); @@ -9652,6 +9663,8 @@ static void values_to_portsdlg (HWND hDlg) workprefs.use_serial = 1; } } + SendDlgItemMessage (hDlg, IDC_DONGLELIST, CB_SETCURSEL, workprefs.dongle, 0L); + } static void init_portsdlg (HWND hDlg) @@ -9673,6 +9686,17 @@ static void init_portsdlg (HWND hDlg) workprefs.parallel_postscript_emulation = 0; } + SendDlgItemMessage (hDlg, IDC_DONGLELIST, CB_RESETCONTENT, 0, 0L); + SendDlgItemMessage (hDlg, IDC_DONGLELIST, CB_ADDSTRING, 0, (LPARAM)szNone); + SendDlgItemMessage (hDlg, IDC_DONGLELIST, CB_ADDSTRING, 0, (LPARAM)L"Robocop 3"); + SendDlgItemMessage (hDlg, IDC_DONGLELIST, CB_ADDSTRING, 0, (LPARAM)L"Leaderboard"); + SendDlgItemMessage (hDlg, IDC_DONGLELIST, CB_ADDSTRING, 0, (LPARAM)L"B.A.T. II"); + SendDlgItemMessage (hDlg, IDC_DONGLELIST, CB_ADDSTRING, 0, (LPARAM)L"Italy'90 Soccer"); + SendDlgItemMessage (hDlg, IDC_DONGLELIST, CB_ADDSTRING, 0, (LPARAM)L"Dames Grand Maitre"); + SendDlgItemMessage (hDlg, IDC_DONGLELIST, CB_ADDSTRING, 0, (LPARAM)L"Rugby Coach"); + SendDlgItemMessage (hDlg, IDC_DONGLELIST, CB_ADDSTRING, 0, (LPARAM)L"Cricket Captain"); + SendDlgItemMessage (hDlg, IDC_DONGLELIST, CB_ADDSTRING, 0, (LPARAM)L"Leviathan"); + SendDlgItemMessage (hDlg, IDC_SERIAL, CB_RESETCONTENT, 0, 0L); SendDlgItemMessage (hDlg, IDC_SERIAL, CB_ADDSTRING, 0, (LPARAM)szNone); for (port = 0; port < MAX_SERIAL_PORTS && comports[port].name; port++) { @@ -9684,7 +9708,9 @@ static void init_portsdlg (HWND hDlg) 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); + WIN32GUI_LoadUIString (IDS_PRINTER_EPSON9, tmp, MAX_DPATH); + SendDlgItemMessage (hDlg, IDC_PRINTERTYPELIST, CB_ADDSTRING, 0, (LPARAM)tmp); + WIN32GUI_LoadUIString (IDS_PRINTER_EPSON48, 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); @@ -9901,6 +9927,7 @@ static INT_PTR CALLBACK IOPortsDlgProc (HWND hDlg, UINT msg, WPARAM wParam, LPAR case IDC_SERIAL: case IDC_MIDIOUTLIST: case IDC_MIDIINLIST: + case IDC_DONGLELIST: values_from_portsdlg (hDlg); inputdevice_updateconfig (&workprefs); inputdevice_config_change (); @@ -9912,16 +9939,19 @@ static INT_PTR CALLBACK IOPortsDlgProc (HWND hDlg, UINT msg, WPARAM wParam, LPAR switch (item) { case 1: - workprefs.parallel_matrix_emulation = 1; + workprefs.parallel_matrix_emulation = PARALLEL_MATRIX_TEXT; break; case 2: - workprefs.parallel_matrix_emulation = 2; + workprefs.parallel_matrix_emulation = PARALLEL_MATRIX_EPSON9; break; case 3: - workprefs.parallel_postscript_detection = 1; + workprefs.parallel_matrix_emulation = PARALLEL_MATRIX_EPSON48; break; case 4: workprefs.parallel_postscript_detection = 1; + break; + case 5: + workprefs.parallel_postscript_detection = 1; workprefs.parallel_postscript_emulation = 1; break; } diff --git a/od-win32/winuaechangelog.txt b/od-win32/winuaechangelog.txt index 3a2f9385..d4d90c99 100644 --- a/od-win32/winuaechangelog.txt +++ b/od-win32/winuaechangelog.txt @@ -1,4 +1,23 @@ +Beta 18: + +- dongle GUI selection added (IO Ports), Leviathan dongle supported +- added 9pin Epson matrix printer option (9pin printer has different + graphics aspect ratio than 24/48pin) +- visual DMA debugger (possibly useless but cool!) different colors + mark different DMA channels, "v " to enable, no parameter or -1 = + normal,-2 = small visual, -3 = wide and -4 = big. CE-only + Current colors: yellow = copper, green = blitter (light=normal, + dark=line), blue = bitplane, cpu = gray, audio = red, sprite = + white, disk = purple +- disable bitplane "speedup" optimization if dma debugger enabled +- beta versions do not load language dlls anymore +- SCSI mode GUI fixed +- minimizing: priority was set wrong, closing when minimized: + remembered windowed mode size was reset (old bugs) +- unpause when clicking on "PAUSED" fps led +- some vsync sound sync experiments again.. + Beta 17: - fixed uaescsi.device TD_GETGEOMETRY total number of blocks off by one diff --git a/uaeunp.c b/uaeunp.c index d229e24f..0c3b69f1 100644 --- a/uaeunp.c +++ b/uaeunp.c @@ -692,7 +692,7 @@ int wmain (int argc, wchar_t *argv[], wchar_t *envp[]) ok = 1; } if (!ok) { - _tprintf (L"UAE unpacker uaeunp 0.6 by Toni Wilen (c)2009\n"); + _tprintf (L"UAE unpacker uaeunp 0.7 by Toni Wilen (c)2009\n"); _tprintf (L"\n"); _tprintf (L"List: \"uaeunp (-l) \"\n"); _tprintf (L"List all recursively: \"uaeunp -l **\"\n"); @@ -703,7 +703,7 @@ int wmain (int argc, wchar_t *argv[], wchar_t *envp[]) _tprintf (L"Output to console: \"uaeunp (-x) -o \"\n"); _tprintf (L"\n"); _tprintf (L"Supported disk image formats:\n"); - _tprintf (L" ADF, HDF, DMS, encrypted DMS, IPF, FDI, DSQ, WRP\n"); + _tprintf (L" ADF, HDF (VHD), DMS, encrypted DMS, IPF, FDI, DSQ, WRP\n"); _tprintf (L"Supported filesystems:\n"); _tprintf (L" OFS, FFS, SFS, SFS2 and FAT12\n"); _tprintf (L"Supported archive formats:\n"); @@ -717,6 +717,10 @@ int wmain (int argc, wchar_t *argv[], wchar_t *envp[]) } /* + 0.7: + + - vhd read support + 0.6: - rdb handling optimization (no more huge memory usage) diff --git a/zfile.c b/zfile.c index ef62b521..2568ae50 100644 --- a/zfile.c +++ b/zfile.c @@ -61,6 +61,7 @@ static void zfile_free (struct zfile *f) xfree (f->name); xfree (f->data); xfree (f->mode); + xfree (f->userdata); xfree (f); } @@ -166,6 +167,208 @@ int zfile_gettype (struct zfile *z) return ZFILE_UNKNOWN; } +#define VHD_DYNAMIC 3 +#define VHD_FIXED 2 + +STATIC_INLINE uae_u32 gl (uae_u8 *p) +{ + return (p[0] << 24) | (p[1] << 16) | (p[2] << 8) | (p[3] << 0); +} + +static uae_u32 vhd_checksum (uae_u8 *p, int offset) +{ + int i; + uae_u32 sum; + + sum = 0; + for (i = 0; i < 512; i++) { + if (offset >= 0 && i >= offset && i < offset + 4) + continue; + sum += p[i]; + } + return ~sum; +} + +struct zfile_vhd +{ + int vhd_type; + uae_u64 virtsize; + uae_u32 vhd_bamoffset; + uae_u32 vhd_blocksize; + uae_u8 *vhd_header, *vhd_sectormap; + uae_u64 vhd_footerblock; + uae_u32 vhd_bamsize; + uae_u64 vhd_sectormapblock; + uae_u32 vhd_bitmapsize; +}; + + +static uae_u64 vhd_fread2 (struct zfile *zf, uae_u8 *dataptr, uae_u64 offset, uae_u64 len) +{ + uae_u32 bamoffset; + uae_u32 sectoroffset; + uae_u64 read; + struct zfile *zp = zf->parent; + struct zfile_vhd *zvhd = zf->userdata; + + //write_log (L"%08x %08x\n", (uae_u32)offset, (uae_u32)len); + read = 0; + if (offset & 511) + return read; + if (len & 511) + return read; + while (len > 0) { + bamoffset = (offset / zvhd->vhd_blocksize) * 4 + zvhd->vhd_bamoffset; + sectoroffset = gl (zvhd->vhd_header + bamoffset); + if (sectoroffset == 0xffffffff) { + memset (dataptr, 0, 512); + read += 512; + } else { + int bitmapoffsetbits; + int bitmapoffsetbytes; + int sectormapblock; + + bitmapoffsetbits = (offset / 512) % (zvhd->vhd_blocksize / 512); + bitmapoffsetbytes = bitmapoffsetbits / 8; + sectormapblock = sectoroffset * 512 + (bitmapoffsetbytes & ~511); + if (zvhd->vhd_sectormapblock != sectormapblock) { + // read sector bitmap + //write_log (L"BM %08x\n", sectormapblock); + zfile_fseek (zp, sectormapblock, SEEK_SET); + if (zfile_fread (zvhd->vhd_sectormap, 1, 512, zp) != 512) + return read; + zvhd->vhd_sectormapblock = sectormapblock; + } + // block allocated in bitmap? + if (zvhd->vhd_sectormap[bitmapoffsetbytes & 511] & (1 << (7 - (bitmapoffsetbits & 7)))) { + // read data block + int block = sectoroffset * 512 + zvhd->vhd_bitmapsize + bitmapoffsetbits * 512; + //write_log (L"DB %08x\n", block); + zfile_fseek (zp, block, SEEK_SET); + if (zfile_fread (dataptr, 1, 512, zp) != 512) + return read; + } else { + memset (dataptr, 0, 512); + } + read += 512; + } + len -= 512; + dataptr += 512; + offset += 512; + } + return read; +} +static uae_u64 vhd_fread (uae_u8 *data, uae_u64 l1, uae_u64 l2, struct zfile *zf) +{ + uae_u64 size = l1 * l2; + uae_u64 out = 0; + int len = 0; + + if ((zf->seek & 511) || (size & 511)) { + int seek; + uae_u8 tmp[512]; + + if (zf->seek & 511) { + int s; + s = 512 - (zf->seek & 511); + vhd_fread2 (zf, tmp, zf->seek & ~511, 512); + memcpy (data + len, tmp + 512 - s, s); + len += s; + out += s; + zf->seek += s; + } + while (size > 0) { + int s = size > 512 ? 512 : size; + vhd_fread2 (zf, tmp, zf->seek, 512); + memcpy (data + len, tmp, s); + zf->seek += s; + size -= s; + out += s; + } + } else { + out = vhd_fread2 (zf, data, zf->seek, size); + zf->seek += out; + out /= l1; + } + return out; +} + +static struct zfile *vhd (struct zfile *z) +{ + uae_u8 tmp[512], tmp2[512]; + uae_u32 v; + struct zfile_vhd *zvhd; + uae_u64 fsize; + + zvhd = xcalloc (sizeof (struct zfile_vhd), 1); + zfile_fseek (z, 0, SEEK_END); + fsize = zfile_ftell (z); + zfile_fseek (z, 0, SEEK_SET); + if (zfile_fread (tmp, 1, 512, z) != 512) + goto nonvhd; + v = gl (tmp + 8); // features + if ((v & 3) != 2) + goto nonvhd; + v = gl (tmp + 8 + 4); // version + if ((v >> 16) != 1) + goto nonvhd; + zvhd->vhd_type = gl (tmp + 8 + 4 + 4 + 8 + 4 + 4 + 4 + 4 + 8 + 8 + 4); + if (zvhd->vhd_type != VHD_FIXED && zvhd->vhd_type != VHD_DYNAMIC) + goto nonvhd; + v = gl (tmp + 8 + 4 + 4 + 8 + 4 + 4 + 4 + 4 + 8 + 8 + 4 + 4); + if (v == 0) + goto nonvhd; + if (vhd_checksum (tmp, 8 + 4 + 4 + 8 + 4 + 4 + 4 + 4 + 8 + 8 + 4 + 4) != v) + goto nonvhd; + zfile_fseek (z, fsize - sizeof tmp2, SEEK_SET); + if (zfile_fread (tmp2, 1, 512, z) != 512) + goto end; + if (memcmp (tmp, tmp2, sizeof tmp)) + goto nonvhd; + zvhd->vhd_footerblock = fsize - 512; + zvhd->virtsize = (uae_u64)(gl (tmp + 8 + 4 + 4 + 8 + 4 + 4 +4 + 4 + 8)) << 32; + zvhd->virtsize |= gl (tmp + 8 + 4 + 4 + 8 + 4 + 4 +4 + 4 + 8 + 4); + if (zvhd->vhd_type == VHD_DYNAMIC) { + uae_u32 size; + zvhd->vhd_bamoffset = gl (tmp + 8 + 4 + 4 + 4); + if (zvhd->vhd_bamoffset == 0 || zvhd->vhd_bamoffset >= fsize) + goto end; + zfile_fseek (z, zvhd->vhd_bamoffset, SEEK_SET); + if (zfile_fread (tmp, 1, 512, z) != 512) + goto end; + v = gl (tmp + 8 + 8 + 8 + 4 + 4 + 4); + if (vhd_checksum (tmp, 8 + 8 + 8 + 4 + 4 + 4) != v) + goto end; + v = gl (tmp + 8 + 8 + 8); + if ((v >> 16) != 1) + goto end; + zvhd->vhd_blocksize = gl (tmp + 8 + 8 + 8 + 4 + 4); + zvhd->vhd_bamoffset = gl (tmp + 8 + 8 + 4); + zvhd->vhd_bamsize = (((zvhd->virtsize + zvhd->vhd_blocksize - 1) / zvhd->vhd_blocksize) * 4 + 511) & ~511; + size = zvhd->vhd_bamoffset + zvhd->vhd_bamsize; + zvhd->vhd_header = xmalloc (size); + zfile_fseek (z, 0, SEEK_SET); + if (zfile_fread (zvhd->vhd_header, 1, size, z) != size) + goto end; + zvhd->vhd_sectormap = xmalloc (512); + zvhd->vhd_sectormapblock = -1; + zvhd->vhd_bitmapsize = ((zvhd->vhd_blocksize / (8 * 512)) + 511) & ~511; + } + z = zfile_fopen_parent (z, NULL, 0, zvhd->virtsize); + z->useparent = 0; + z->dataseek = 1; + z->userdata = zvhd; + z->zfileread = vhd_fread; + write_log (L"%s is VHD %s image, virtual size=%dK\n", + zfile_getname (z), + zvhd->vhd_type == 2 ? L"fixed" : L"dynamic", + zvhd->virtsize / 1024); + return z; +nonvhd: +end: + return z; +} + struct zfile *zfile_gunzip (struct zfile *z) { uae_u8 header[2 + 1 + 1 + 4 + 1 + 1]; @@ -559,7 +762,7 @@ static struct zfile *dms (struct zfile *z) ret = DMS_Process_File (z, zo, CMD_UNPACK, OPT_VERBOSE, 0, 0, 0); if (ret == NO_PROBLEM || ret == DMS_FILE_END) { int off = zfile_ftell (zo); - if (off >= 1760 * 512 / 3 && off <= 1760 * 512 * 3 / 4) { // possibly split dms? + if (off >= 1760 * 512 / 3 && off <= 1760 * 512 * 3 / 4) { // possible split dms? if (_tcslen (orgname) > 5) { TCHAR *s = orgname + _tcslen (orgname) - 5; if (!_tcsicmp (s, L"a.dms")) { @@ -615,14 +818,14 @@ int zfile_is_diskimage (const TCHAR *name) } -static const TCHAR *plugins_7z[] = { L"7z", L"rar", L"zip", L"lha", L"lzh", L"lzx", L"adf", L"dsq", NULL }; -static const uae_char *plugins_7z_x[] = { "7z", "Rar!", "MK", NULL, NULL, NULL, NULL, NULL, NULL }; +static const TCHAR *plugins_7z[] = { L"7z", L"rar", L"zip", L"lha", L"lzh", L"lzx", L"adf", L"dsq", L"hdf", NULL }; +static const uae_char *plugins_7z_x[] = { "7z", "Rar!", "MK", NULL, NULL, NULL, NULL, NULL, NULL, NULL }; static const int plugins_7z_t[] = { ArchiveFormat7Zip, ArchiveFormatRAR, ArchiveFormatZIP, ArchiveFormatLHA, ArchiveFormatLHA, ArchiveFormatLZX, - ArchiveFormatADF, ArchiveFormatADF }; + ArchiveFormatADF, ArchiveFormatADF, ArchiveFormatADF }; static const int plugins_7z_m[] = { ZFD_ARCHIVE, ZFD_ARCHIVE, ZFD_ARCHIVE, ZFD_ARCHIVE, ZFD_ARCHIVE, ZFD_ARCHIVE, - ZFD_ADF, ZFD_ADF }; + ZFD_ADF, ZFD_ADF, ZFD_ADF }; int iszip (struct zfile *z) { @@ -709,7 +912,7 @@ struct zfile *zuncompress (struct znode *parent, struct zfile *z, int dodefault, uae_u8 header[32]; int i; - if (*retcode) + if (retcode) *retcode = 0; if (!mask) return NULL; @@ -779,6 +982,9 @@ struct zfile *zuncompress (struct znode *parent, struct zfile *z, int dodefault, zfile_fseek (z, 0, SEEK_SET); zfile_fread (header, sizeof (header), 1, z); zfile_fseek (z, 0, SEEK_SET); + if (!memcmp (header, "conectix", 8)) + return vhd (z); + if (mask & ZFD_UNPACK) { if (header[0] == 0x1f && header[1] == 0x8b) return zfile_gunzip (z); @@ -1109,7 +1315,11 @@ struct zfile *zfile_dup (struct zfile *zf) struct zfile *nzf; if (!zf) return NULL; - if (zf->data) { + if (zf->userdata) + return NULL; + if (!zf->data && zf->dataseek) { + nzf = zfile_create (zf); + } else if (zf->data) { nzf = zfile_create (zf); nzf->data = xmalloc (zf->size); memcpy (nzf->data, zf->data, zf->size); @@ -1181,6 +1391,7 @@ struct zfile *zfile_fopen_parent (struct zfile *z, const TCHAR *name, uae_u64 of l->offset = offset; for (;;) { l->parent = z; + l->useparent = 1; if (!z->parent) break; l->offset += z->offset; @@ -1205,7 +1416,7 @@ struct zfile *zfile_fopen_data (const TCHAR *name, uae_u64 size, uae_u8 *data) uae_s64 zfile_ftell (struct zfile *z) { uae_s64 v; - if (z->data) + if (z->data || z->dataseek) return z->seek; if (z->parent) { v = _ftelli64 (z->parent->f); @@ -1218,7 +1429,9 @@ uae_s64 zfile_ftell (struct zfile *z) uae_s64 zfile_fseek (struct zfile *z, uae_s64 offset, int mode) { - if (z->data) { + if (z->zfileseek) + return z->zfileseek (z, offset, mode); + if (z->data || z->dataseek) { int ret = 0; switch (mode) { @@ -1242,7 +1455,7 @@ uae_s64 zfile_fseek (struct zfile *z, uae_s64 offset, int mode) } return ret; } else { - if (z->parent) { + if (z->parent && z->useparent) { switch (mode) { case SEEK_SET: @@ -1285,6 +1498,8 @@ uae_s64 zfile_fseek (struct zfile *z, uae_s64 offset, int mode) size_t zfile_fread (void *b, size_t l1, size_t l2,struct zfile *z) { + if (z->zfileread) + return z->zfileread (b, l1, l2, z); if (z->data) { if (z->seek + l1 * l2 > z->size) { if (l1) @@ -1298,7 +1513,7 @@ size_t zfile_fread (void *b, size_t l1, size_t l2,struct zfile *z) z->seek += l1 * l2; return l2; } - if (z->parent) { + if (z->parent && z->useparent) { uae_s64 v; uae_s64 size = z->size; v = zfile_ftell (z); @@ -1317,7 +1532,9 @@ size_t zfile_fread (void *b, size_t l1, size_t l2,struct zfile *z) size_t zfile_fwrite (void *b, size_t l1, size_t l2, struct zfile *z) { - if (z->parent) + if (z->zfilewrite) + return z->zfilewrite (b, l1, l2, z); + if (z->parent && z->useparent) return 0; if (z->data) { int off = z->seek + l1 * l2; diff --git a/zfile_archive.c b/zfile_archive.c index 2e8c1040..26dede37 100644 --- a/zfile_archive.c +++ b/zfile_archive.c @@ -907,20 +907,22 @@ struct zvolume *archive_directory_plain (struct zfile *z) xfree (data); } zf = zfile_dup (z); - zf2 = zuncompress (NULL, zf, 0, ZFD_ALL, &rc); - if (zf2) { - zf = NULL; - zai.name = zfile_getfilename (zf2); - zai.flags = -1; - zfile_fseek (zf2, 0, SEEK_END); - zai.size = zfile_ftell (zf2); - zfile_fseek (zf2, 0, SEEK_SET); - zn = zvolume_addfile_abs (zv, &zai); - if (zn) - zn->offset = 1; - zfile_fclose (zf2); + if (zf) { + zf2 = zuncompress (NULL, zf, 0, ZFD_ALL, &rc); + if (zf2) { + zf = NULL; + zai.name = zfile_getfilename (zf2); + zai.flags = -1; + zfile_fseek (zf2, 0, SEEK_END); + zai.size = zfile_ftell (zf2); + zfile_fseek (zf2, 0, SEEK_SET); + zn = zvolume_addfile_abs (zv, &zai); + if (zn) + zn->offset = 1; + zfile_fclose (zf2); + } + zfile_fclose (zf); } - zfile_fclose (zf); return zv; } struct zfile *archive_access_plain (struct znode *zn)