#include "win32_uaenet.h"
#include "crc32.h"
-static int a2065_log = 1;
+static int a2065_log = 0;
#define RAP 0x4002
#define RDP 0x4000
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;
}
if (rs || cnt > 100)
return;
- rs = xmalloc(sizeof(struct ripped_sample));
+ rs = xmalloc (sizeof(struct ripped_sample));
if (prev)
prev->next = rs;
else
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);
}
/* 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;
/* 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;
}
#endif
(*sample_handler) ();
-#if SOUNDSTUFF > 0
+#if SOUNDSTUFF > 1
if (outputsample == 0)
outputsample = -1;
else if (outputsample < 0)
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)
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) {
lastdir = 0;
}
- if (extrasamples > 10)
- extrasamples = 10;
- if (extrasamples < -10)
- extrasamples = -10;
-
+ if (extrasamples > 99)
+ extrasamples = 99;
+ if (extrasamples < -99)
+ extrasamples = -99;
#endif
}
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
}
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[] =
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)
{
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
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:
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))
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:
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;
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;
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)
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;
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)
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
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
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;
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;
dr->reg = reg;
dr->dat = dat;
dr->addr = addr;
+ dr->type = type;
return dr;
}
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;
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;
}
#define LEVIATHAN 8
#define LOGISTIX 10
-static int type = 0;
static int flag;
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
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) {
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))
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)
val |= 0x0101;
}
break;
+ case LEVIATHAN:
+ if (port == 0) {
+ val &= ~0x0303;
+ val |= 0x0101;
+ }
+ break;
case RUGBYCOACH:
if (port == 1) {
val &= ~0x0303;
void dongle_potgo (uae_u16 val)
{
- if (!type)
+ if (!currprefs.dongle)
return;
- switch (type)
+ switch (currprefs.dongle)
{
case ITALY90:
case LOGISTIX:
uae_u16 dongle_potgor (uae_u16 val)
{
- if (!type)
+ if (!currprefs.dongle)
return val;
- switch (type)
+ switch (currprefs.dongle)
{
case LOGISTIX:
val |= 1 << 14;
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)
#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;
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
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 ();
#include "epsonprinter.h"
#include "win32.h"
+#include "parser.h"
#include <math.h>
static int page_w, page_h, page_pitch;
static int pagesize;
static HMODULE ft;
+static int pins = 24;
// Various ASCII codepage to unicode maps
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");
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;
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;
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;
}
{
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)
{
uae_u16 dat;
uae_u32 addr;
uae_u16 evt;
+ int type;
};
#define DMA_EVENT_BLITIRQ 1
#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
+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;
struct zfile *parent;
uae_u64 offset;
int opencnt;
+ ZFILEREAD zfileread;
+ ZFILEWRITE zfilewrite;
+ ZFILESEEK zfileseek;
+ void *userdata;
+ int useparent;
};
#define ZNODE_FILE 0
inputdevice_updateconfig (&currprefs);
}
+ if (currprefs.dongle != changed_prefs.dongle) {
+ currprefs.dongle = changed_prefs.dongle;
+ dongle_reset ();
+ }
}
void inputdevice_vsync (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);
} 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++)
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)) {
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
#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
#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
PUSHBUTTON "Save As...",IDC_SAVE,175,225,44,15\r
END\r
\r
-IDD_IOPORTS DIALOGEX 0, 0, 300, 208\r
+IDD_IOPORTS DIALOGEX 0, 0, 300, 228\r
STYLE DS_LOCALEDIT | DS_SETFONT | DS_3DLOOK | DS_CONTROL | WS_CHILD\r
FONT 8, "MS Sans Serif", 0, 0, 0x1\r
BEGIN\r
- GROUPBOX "Parallel Port",IDC_SERPARFRAME,5,2,291,86\r
+ GROUPBOX "Parallel Port",IDC_STATIC,5,2,291,86\r
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
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
+ GROUPBOX "Serial Port",IDC_STATIC,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
CONTROL "RTS/CTS",IDC_SER_CTSRTS,"Button",BS_AUTOCHECKBOX | BS_VCENTER | WS_TABSTOP,75,123,55,12\r
- GROUPBOX "MIDI",IDC_MIDIFRAME,4,143,292,50\r
RTEXT "Out:",IDC_MIDI,10,154,34,15,SS_CENTERIMAGE\r
COMBOBOX IDC_MIDIOUTLIST,49,154,232,130,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP\r
RTEXT "In:",IDC_MIDI2,10,174,29,15,SS_CENTERIMAGE\r
CONTROL "uaeserial.device",IDC_UAESERIAL,"Button",BS_AUTOCHECKBOX | BS_VCENTER | WS_TABSTOP,200,123,78,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
+ GROUPBOX "MIDI",IDC_STATIC,5,143,291,51,BS_LEFT\r
+ GROUPBOX "Protection Dongle",IDC_STATIC,5,197,292,30,BS_LEFT\r
+ COMBOBOX IDC_DONGLELIST,50,208,232,130,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP\r
END\r
\r
IDD_GAMEPORTS DIALOGEX 0, 0, 300, 236\r
\r
STRINGTABLE \r
BEGIN\r
- IDS_PRINTER_EPSON "Epson Matrix Printer Emulation (beta, FreeType required)"\r
+ IDS_PRINTER_EPSON9 "Epson Matrix Printer Emulation, 9pin"\r
IDS_PRINTER_POSTSCRIPT_DETECTION "PostScript (Passthrough)"\r
IDS_PRINTER_POSTSCRIPT_EMULATION \r
"PostScript (Emulation, GhostScript required)"\r
IDS_RES_LORES "Lores"\r
IDS_RES_HIRES "Hires (normal)"\r
IDS_RES_SUPERHIRES "SuperHires"\r
+ IDS_PRINTER_EPSON48 "Epson Matrix Printer Emulation, 48pin"\r
END\r
\r
#endif // English (Neutral) resources\r
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
STATIC_INLINE void check_sound_buffers (void)
{
-#if SOUNDSTUFF > 0
+#if SOUNDSTUFF > 1
int len;
#endif
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;
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;
static void checkpause (void)
{
- if (currprefs.win32_inactive_pause)
+ if (currprefs.win32_inactive_pause) {
setpaused ();
+ setpriority (&priorities[currprefs.win32_inactive_priority]);
+ }
}
static int showcursor;
setcursor (-30000, -30000);
}
inputdevice_acquire (TRUE);
+ setpriority (&priorities[currprefs.win32_active_priority]);
} else {
inputdevice_acquire (FALSE);
}
focus = 1;
pri = &priorities[currprefs.win32_inactive_priority];
-#ifndef _DEBUG
if (!minimized)
pri = &priorities[currprefs.win32_active_priority];
-#endif
setpriority (pri);
if (!avioutput_video) {
{
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);
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;
}
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)) {
HMODULE language_load (WORD language)
{
HMODULE result = NULL;
+#if WINUAEPUBLICBETA == 0
TCHAR dllbuf[MAX_DPATH];
TCHAR *dllname;
result = NULL;
}
}
+#endif
return result;
}
#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""
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) {
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);
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) {
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)"");
}
}
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");
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];
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)
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);
workprefs.use_serial = 1;
}
}
+ SendDlgItemMessage (hDlg, IDC_DONGLELIST, CB_SETCURSEL, workprefs.dongle, 0L);
+
}
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++) {
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);
case IDC_SERIAL:
case IDC_MIDIOUTLIST:
case IDC_MIDIINLIST:
+ case IDC_DONGLELIST:
values_from_portsdlg (hDlg);
inputdevice_updateconfig (&workprefs);
inputdevice_config_change ();
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;
}
+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 <val>" 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
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) <path>\"\n");
_tprintf (L"List all recursively: \"uaeunp -l <path> **\"\n");
_tprintf (L"Output to console: \"uaeunp (-x) -o <path> <filename>\"\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");
}
/*
+ 0.7:
+
+ - vhd read support
+
0.6:
- rdb handling optimization (no more huge memory usage)
xfree (f->name);
xfree (f->data);
xfree (f->mode);
+ xfree (f->userdata);
xfree (f);
}
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];
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")) {
}
-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)
{
uae_u8 header[32];
int i;
- if (*retcode)
+ if (retcode)
*retcode = 0;
if (!mask)
return NULL;
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);
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);
l->offset = offset;
for (;;) {
l->parent = z;
+ l->useparent = 1;
if (!z->parent)
break;
l->offset += z->offset;
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);
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)
{
}
return ret;
} else {
- if (z->parent) {
+ if (z->parent && z->useparent) {
switch (mode)
{
case SEEK_SET:
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)
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);
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;
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)