From 99ddb2e31b5f4df13e5d9dff66d03bf924c4dda8 Mon Sep 17 00:00:00 2001 From: Toni Wilen Date: Sun, 19 Sep 2004 17:05:02 +0300 Subject: [PATCH] imported winuaesrc0992b2.zip --- cdtv.c | 230 +++++ custom.c | 102 +- disk.c | 10 +- drawing.c | 8 +- driveclick.c | 5 +- expansion.c | 141 +-- include/cdtv.h | 12 + include/unzip.h | 15 + include/zfile.h | 3 +- memory.c | 8 +- od-win32/7z/DLL.h | 56 - od-win32/7z/Defs.h | 22 - od-win32/7z/FileIO.h | 98 -- od-win32/7z/FileStreams.h | 55 - od-win32/7z/IArchive.h | 172 --- od-win32/7z/IMyUnknown.h | 71 -- od-win32/7z/IProgress.h | 32 - od-win32/7z/IStream.h | 64 -- od-win32/7z/MyCom.h | 187 ---- od-win32/7z/PropID.h | 51 - od-win32/7z/PropVariant.h | 60 -- od-win32/7z/PropVariantConversions.h | 17 - od-win32/7z/String.h | 672 ------------ od-win32/7z/StringConvert.h | 72 -- od-win32/7z/Types.h | 19 - od-win32/7z/Vector.h | 177 ---- od-win32/7z/win32_decompress.cpp | 76 -- od-win32/7zplugin.c | 127 +++ od-win32/avioutput.c | 20 +- od-win32/build68k_msvc/build68k_msvc.vcproj | 62 ++ od-win32/caps/caps_win32.c | 59 +- .../genblitter_msvc/genblitter_msvc.vcproj | 70 ++ od-win32/gencomp_msvc/gencomp_msvc.vcproj | 62 ++ od-win32/gencpu_msvc/gencpu_msvc.vcproj | 67 ++ od-win32/ioport.c | 37 +- od-win32/parser.c | 23 +- od-win32/resources/resource.h | 9 +- od-win32/resources/winuae.rc | 39 +- od-win32/screenshot.c | 32 +- od-win32/serial_win32.c | 2 +- od-win32/win32.c | 55 +- od-win32/win32.h | 5 +- od-win32/win32gfx.c | 8 +- od-win32/win32gui.c | 124 ++- od-win32/winuae_msvc/winuae_msvc.vcproj | 975 +++++++++++++++++- unzip.c | 10 +- zfile.c | 416 +++++++- 47 files changed, 2375 insertions(+), 2262 deletions(-) create mode 100755 cdtv.c create mode 100755 include/cdtv.h delete mode 100755 od-win32/7z/DLL.h delete mode 100755 od-win32/7z/Defs.h delete mode 100755 od-win32/7z/FileIO.h delete mode 100755 od-win32/7z/FileStreams.h delete mode 100755 od-win32/7z/IArchive.h delete mode 100755 od-win32/7z/IMyUnknown.h delete mode 100755 od-win32/7z/IProgress.h delete mode 100755 od-win32/7z/IStream.h delete mode 100755 od-win32/7z/MyCom.h delete mode 100755 od-win32/7z/PropID.h delete mode 100755 od-win32/7z/PropVariant.h delete mode 100755 od-win32/7z/PropVariantConversions.h delete mode 100755 od-win32/7z/String.h delete mode 100755 od-win32/7z/StringConvert.h delete mode 100755 od-win32/7z/Types.h delete mode 100755 od-win32/7z/Vector.h delete mode 100755 od-win32/7z/win32_decompress.cpp create mode 100755 od-win32/7zplugin.c diff --git a/cdtv.c b/cdtv.c new file mode 100755 index 00000000..d6cb2f58 --- /dev/null +++ b/cdtv.c @@ -0,0 +1,230 @@ + /* + * UAE - The Un*x Amiga Emulator + * + * CDTV DMAC/CDROM controller emulation + * + * Copyright 2004 Toni Wilen + * + */ + +#define CDTV_DEBUG + +#include "sysconfig.h" +#include "sysdeps.h" + +#include "config.h" +#include "options.h" +#include "uae.h" +#include "memory.h" +#include "custom.h" +#include "newcpu.h" +#include "debug.h" +#include "cdtv.h" + +static uae_u32 dmac_lget (uaecptr) REGPARAM; +static uae_u32 dmac_wget (uaecptr) REGPARAM; +static uae_u32 dmac_bget (uaecptr) REGPARAM; +static void dmac_lput (uaecptr, uae_u32) REGPARAM; +static void dmac_wput (uaecptr, uae_u32) REGPARAM; +static void dmac_bput (uaecptr, uae_u32) REGPARAM; + +static uae_u8 dmacmemory[0x100]; +static uae_u8 wd[0x1f]; + +static int cdtv_command_len; +static uae_u8 cdtv_command_buf[6]; + +static void cdtv_do_interrupt (void) +{ + if (dmacmemory[0x41] & 0x10) { + write_log ("cdtv doint\n"); + INTREQ (0x8008); + } +} + +static void cdtv_interrupt (void) +{ + write_log ("cdtv int\n"); + wd[0x1f] |= 0x80; + dmacmemory[0x41] |= (1 << 4) | (1 << 6); /* ISTR */ + cdtv_do_interrupt (); +} + +static void write_register (uae_u8 b) +{ + switch (dmacmemory[0x91]) + { + case 0x18: + write_log ("command=%02.2X\n", b); + cdtv_interrupt (); + break; + } +} + +static uae_u32 dmac_bget2 (uaecptr addr) +{ + addr -= DMAC_START; + addr &= 65535; + switch (addr) + { + case 0x41: + return 0x10|0x40; + case 0x91: /* AUXILIARY STATUS */ + return 0x80 | 0x01; + + case 0x93: + case 0xa3: + switch (dmacmemory[0x91]) + { + case 0x17: /* SCSI STATUS */ + return 0x22; + + default: + return dmacmemory[0x93]; + } + break; + } + return dmacmemory[addr]; +} + +uae_u32 REGPARAM2 dmac_lget (uaecptr addr) +{ + uae_u32 v; +#ifdef JIT + special_mem |= S_READ; +#endif + v = (dmac_bget2 (addr) << 24) | (dmac_bget2 (addr + 1) << 16) | + (dmac_bget2 (addr + 2) << 8) | (dmac_bget2 (addr + 3)); +#ifdef CDTV_DEBUG + write_log ("dmac_lget %08.8X=%08.8X PC=%08.8X\n", addr, v, m68k_getpc()); +#endif + return v; +} + +uae_u32 REGPARAM2 dmac_wget (uaecptr addr) +{ + uae_u32 v; +#ifdef JIT + special_mem |= S_READ; +#endif + v = (dmac_bget2 (addr) << 8) | dmac_bget2 (addr + 1); +#ifdef CDTV_DEBUG + write_log ("dmac_wget %08.8X=%04.4X PC=%08.8X\n", addr, v, m68k_getpc()); +#endif + return v; +} + +uae_u32 REGPARAM2 dmac_bget (uaecptr addr) +{ + uae_u32 v; +#ifdef JIT + special_mem |= S_READ; +#endif + v = dmac_bget2 (addr); +#ifdef CDTV_DEBUG + write_log ("dmac_bget %08.8X=%02.2X PC=%08.8X\n", addr, v, m68k_getpc()); +#endif + return v; +} + +static void dmac_bput2 (uaecptr addr, uae_u32 b) +{ + int i; + + addr -= DMAC_START; + addr &= 65535; +#ifdef CDTV_DEBUG + dmacmemory[addr] = b; + switch (addr) + { + case 0x43: + cdtv_do_interrupt (); + break; + case 0x93: + case 0xa3: + write_register (b); + break; + case 0xa1: + if ((dmacmemory[0xb3] & 3) == 0) { /* PRB /CMD and /ENABLE */ + if (cdtv_command_len >= sizeof (cdtv_command_buf)) + cdtv_command_len = sizeof (cdtv_command_buf) - 1; + cdtv_command_buf[cdtv_command_len++] = b; + } else { + cdtv_command_len = 0; + } + if (cdtv_command_len == 6) + cdtv_interrupt (); + break; + case 0xa5: + cdtv_command_len = 0; + break; + case 0xb3: + if (!(dmacmemory[0xb3] & 1) && (b & 1)) { /* command sent? */ + write_log ("CMD: "); + for (i = 0; i < cdtv_command_len; i++) { + write_log ("%02.2X ", cdtv_command_buf[i]); + } + write_log("\n"); + } + break; + case 0xe0: + write_log ("DMA PTR=%x LEN=%d\n", dmac_lget (0x84), dmac_lget (0x80)); + break; + case 0xe4: /* CINT */ + dmacmemory[0x41] = 0; + break; + case 0xe8: /* FLUSH */ + cdtv_command_len = 0; + break; + } +#endif +} + +static void REGPARAM2 dmac_lput (uaecptr addr, uae_u32 l) +{ +#ifdef JIT + special_mem |= S_WRITE; +#endif +#ifdef CDTV_DEBUG + write_log ("dmac_lput %08.8X=%08.8X PC=%08.8X\n", addr, l, m68k_getpc()); +#endif + dmac_bput2 (addr, l >> 24); + dmac_bput2 (addr + 1, l >> 16); + dmac_bput2 (addr + 2, l >> 8); + dmac_bput2 (addr + 3, l); +} + +static void REGPARAM2 dmac_wput (uaecptr addr, uae_u32 w) +{ +#ifdef JIT + special_mem |= S_WRITE; +#endif +#ifdef CDTV_DEBUG + write_log ("dmac_wput %04.4X=%04.4X PC=%08.8X\n", addr, w & 65535, m68k_getpc()); +#endif + dmac_bput2 (addr, w >> 8); + dmac_bput2 (addr + 1, w); +} + +static void REGPARAM2 dmac_bput (uaecptr addr, uae_u32 b) +{ +#ifdef JIT + special_mem |= S_WRITE; +#endif +#ifdef CDTV_DEBUG + write_log ("dmac_bput %08.8X=%02.2X PC=%08.8X\n", addr, b & 255, m68k_getpc()); +#endif + dmac_bput2 (addr, b); +} + +void dmac_init (void) +{ + dmacmemory[6] = ~(2 << 4); /* CDTV DMAC product id */ +} + +addrbank dmac_bank = { + dmac_lget, dmac_wget, dmac_bget, + dmac_lput, dmac_wput, dmac_bput, + default_xlate, default_check, NULL +}; + diff --git a/custom.c b/custom.c index 1b482913..b2e7b6f4 100755 --- a/custom.c +++ b/custom.c @@ -12,8 +12,8 @@ #define DEBUG_COPPER 0 #define SPRITE_DEBUG 0 #define SPRITE_DEBUG_MINY 50 -#define SPRITE_DEBUG_MAXY 200 -//#define DISABLE_SPRITES +#define SPRITE_DEBUG_MAXY 101 +#define SPRITE_MASK (1|2|4|8|16|32|64|128) #define SPR0_HPOS 0x15 #define MAX_SPRITES 8 #define SPRITE_COLLISIONS @@ -1944,9 +1944,6 @@ static void decide_sprites (int hpos) if (nodraw () || hpos < 0x14 || nr_armed == 0 || point == last_sprite_point) return; -#ifdef DISABLE_SPRITES - return; -#endif decide_diw (hpos); decide_line (hpos); @@ -1963,6 +1960,10 @@ static void decide_sprites (int hpos) int window_xp = coord_hw_to_window_x (hw_xp) + (DIW_DDF_OFFSET << lores_shift); int j, bestp; +#if (SPRITE_MASK) != 255 + if (!((SPRITE_MASK) & (1 << i))) + continue; +#endif if (! spr[i].armed || sprxp < 0 || hw_xp <= last_sprite_point || hw_xp > point) continue; if ( !(bplcon3 & 2) && /* sprites outside playfields enabled? */ @@ -1986,7 +1987,7 @@ static void decide_sprites (int hpos) count++; } for (i = 0; i < count; i++) { - int nr = nrs[i]; + int nr = nrs[i]; record_sprite (next_lineno, nr, spr[nr].xpos, sprdata[nr], sprdatb[nr], sprctl[nr]); } last_sprite_point = point; @@ -2982,11 +2983,28 @@ static void BLTSIZH (uae_u16 v) return; maybe_blit (current_hpos(), 0); blt_info.hblitsize = v & 0x7FF; - if (!blt_info.vblitsize) blt_info.vblitsize = 32768; - if (!blt_info.hblitsize) blt_info.hblitsize = 0x800; + if (!blt_info.vblitsize) + blt_info.vblitsize = 32768; + if (!blt_info.hblitsize) + blt_info.hblitsize = 0x800; do_blitter (current_hpos()); } +STATIC_INLINE spr_arm (int num, int state) +{ + switch (state) + { + case 0: + nr_armed -= spr[num].armed; + spr[num].armed = 0; + break; + default: + nr_armed += 1 - spr[num].armed; + spr[num].armed = 1; + break; + } +} + STATIC_INLINE void SPRxCTLPOS (int num) { int sprxp; @@ -3020,13 +3038,12 @@ STATIC_INLINE void SPRxCTL_1 (uae_u16 v, int num, int hpos) { struct sprite *s = &spr[num]; sprctl[num] = v; - nr_armed -= s->armed; - s->armed = 0; + spr_arm (num, 0); SPRxCTLPOS (num); #if SPRITE_DEBUG > 0 if (vpos >= SPRITE_DEBUG_MINY && vpos <= SPRITE_DEBUG_MAXY) { - write_log ("%d:%d:SPR%dCTL %04.4X VSTRT=%d VSTOP=%d HSTRT=%d DMA=%d ARM=%d COP=%x PC=%x\n", - vpos, hpos, num, v, s->vstart, s->vstop, s->xpos, spr[num].dmastate, spr[num].armed, cop_state.ip, m68k_getpc()); + write_log ("%d:%d:SPR%dCTL %04.4X P=%06.6X VSTRT=%d VSTOP=%d HSTRT=%d DMA=%d ARM=%d COP=%x PC=%x\n", + vpos, hpos, num, v, s->pt, s->vstart, s->vstop, s->xpos, spr[num].dmastate, spr[num].armed, cop_state.ip, m68k_getpc()); } #endif @@ -3038,8 +3055,8 @@ STATIC_INLINE void SPRxPOS_1 (uae_u16 v, int num, int hpos) SPRxCTLPOS (num); #if SPRITE_DEBUG > 0 if (vpos >= SPRITE_DEBUG_MINY && vpos <= SPRITE_DEBUG_MAXY) { - write_log ("%d:%d:SPR%dPOS %04.4X VSTRT=%d VSTOP=%d HSTRT=%d DMA=%d ARM=%d COP=%x PC=%x\n", - vpos, hpos, num, v, s->vstart, s->vstop, s->xpos, spr[num].dmastate, spr[num].armed, cop_state.ip, m68k_getpc()); + write_log ("%d:%d:SPR%dPOS %04.4X P=%06.6X VSTRT=%d VSTOP=%d HSTRT=%d DMA=%d ARM=%d COP=%x PC=%x\n", + vpos, hpos, num, v, s->pt, s->vstart, s->vstop, s->xpos, spr[num].dmastate, spr[num].armed, cop_state.ip, m68k_getpc()); } #endif } @@ -3051,12 +3068,11 @@ STATIC_INLINE void SPRxDATA_1 (uae_u16 v, int num, int hpos) sprdata[num][2] = v; sprdata[num][3] = v; #endif - nr_armed += 1 - spr[num].armed; - spr[num].armed = 1; + spr_arm (num, 1); #if SPRITE_DEBUG > 1 if (vpos >= SPRITE_DEBUG_MINY && vpos <= SPRITE_DEBUG_MAXY) { - write_log ("%d:%d:SPR%dDATA %04.4X DMA=%d ARM=%d PC=%x\n", - vpos, hpos, num, v, spr[num].dmastate, spr[num].armed, m68k_getpc()); + write_log ("%d:%d:SPR%dDATA %04.4X P=%06.6X DMA=%d ARM=%d PC=%x\n", + vpos, hpos, num, v, spr[num].pt, spr[num].dmastate, spr[num].armed, m68k_getpc()); } #endif } @@ -3070,8 +3086,8 @@ STATIC_INLINE void SPRxDATB_1 (uae_u16 v, int num, int hpos) #endif #if SPRITE_DEBUG > 1 if (vpos >= SPRITE_DEBUG_MINY && vpos <= SPRITE_DEBUG_MAXY) { - write_log ("%d:%d:SPR%dDATB %04.4X DMA=%d ARM=%d PC=%x\n", - vpos, hpos, num, v, spr[num].dmastate, spr[num].armed, m68k_getpc()); + write_log ("%d:%d:SPR%dDATB %04.4X P=%06.6X DMA=%d ARM=%d PC=%x\n", + vpos, hpos, num, v, spr[num].pt, spr[num].dmastate, spr[num].armed, m68k_getpc()); } #endif } @@ -3086,7 +3102,7 @@ static void SPRxPTH (int hpos, uae_u16 v, int num) spr[num].pt |= (uae_u32)v << 16; #if SPRITE_DEBUG > 0 if (vpos >= SPRITE_DEBUG_MINY && vpos <= SPRITE_DEBUG_MAXY) { - write_log ("%d:%d:SPR%dPTH %08.8X\n", vpos, hpos, num, spr[num].pt); + write_log ("%d:%d:SPR%dPTH %06.6X\n", vpos, hpos, num, spr[num].pt); } #endif } @@ -3097,7 +3113,7 @@ static void SPRxPTL (int hpos, uae_u16 v, int num) spr[num].pt |= v; #if SPRITE_DEBUG > 0 if (vpos >= SPRITE_DEBUG_MINY && vpos <= SPRITE_DEBUG_MAXY) { - write_log ("%d:%d:SPR%dPTL %08.8X\n", vpos, hpos, num, spr[num].pt); + write_log ("%d:%d:SPR%dPTL %06.6X\n", vpos, hpos, num, spr[num].pt); } #endif } @@ -3830,7 +3846,7 @@ STATIC_INLINE void sync_copper_with_cpu (int hpos, int do_schedule, unsigned int update_copper (hpos); } -STATIC_INLINE uae_u16 sprite_fetch (struct sprite *s, int dma, int hpos) +STATIC_INLINE uae_u16 sprite_fetch (struct sprite *s, int dma, int hpos, int cycle, int mode) { uae_u16 data = last_custom_value; if (dma) { @@ -3849,17 +3865,23 @@ STATIC_INLINE void do_sprites_1 (int num, int cycle, int hpos) int dma, posctl = 0; uae_u16 data; +#if SPRITE_DEBUG > 2 + if (vpos >= SPRITE_DEBUG_MINY && vpos <= SPRITE_DEBUG_MAXY) + write_log("%d:%d:slot%d:%d\n", vpos, hpos, num, cycle); +#endif if (vpos == s->vstart) { - s->dmastate = 1; #if SPRITE_DEBUG > 0 - write_log ("%d:SPR%d START\n", vpos, num); + if (!s->dmastate && vpos >= SPRITE_DEBUG_MINY && vpos <= SPRITE_DEBUG_MAXY) + write_log ("%d:%d:SPR%d START\n", vpos, hpos, num); #endif + s->dmastate = 1; } if (vpos == s->vstop || vpos == sprite_vblank_endline) { - s->dmastate = 0; #if SPRITE_DEBUG > 0 - write_log ("%d:SPR%d STOP\n", vpos, num); + if (s->dmastate && vpos >= SPRITE_DEBUG_MINY && vpos <= SPRITE_DEBUG_MAXY) + write_log ("%d:%d:SPR%d STOP\n", vpos, hpos, num); #endif + s->dmastate = 0; } if (!dmaen (DMA_SPRITE)) return; @@ -3868,14 +3890,22 @@ STATIC_INLINE void do_sprites_1 (int num, int cycle, int hpos) s->dmastate = 0; posctl = 1; if (dma) { - data = sprite_fetch (s, dma, hpos); - s->pt += (sprite_width >> 3) - 2; + data = sprite_fetch (s, dma, hpos, cycle, 0); + switch (sprite_width) + { + case 64: + sprite_fetch (s, dma, hpos, cycle, 0); + sprite_fetch (s, dma, hpos, cycle, 0); + case 32: + sprite_fetch (s, dma, hpos, cycle, 0); + break; + } } else { data = cycle == 0 ? sprpos[num] : sprctl[num]; } #if SPRITE_DEBUG > 1 if (vpos >= SPRITE_DEBUG_MINY && vpos <= SPRITE_DEBUG_MAXY) { - write_log ("dma:"); + write_log ("%d:%d:dma:P=%06.6X ", vpos, hpos, s->pt); } #endif if (cycle == 0) @@ -3884,13 +3914,13 @@ STATIC_INLINE void do_sprites_1 (int num, int cycle, int hpos) SPRxCTL_1 (data, num, hpos); } if (s->dmastate && !posctl) { - uae_u16 data = sprite_fetch (s, dma, hpos); + uae_u16 data = sprite_fetch (s, dma, hpos, cycle, 1); /* Hack for X mouse auto-calibration */ if (num == 0 && cycle == 0) mousehack_handle (sprctl[0], sprpos[0]); #if SPRITE_DEBUG > 1 if (vpos >= SPRITE_DEBUG_MINY && vpos <= SPRITE_DEBUG_MAXY) { - write_log ("dma:"); + write_log ("%d:%d:dma:P=%06.6X ", vpos, hpos, s->pt); } #endif if (cycle == 0) @@ -3902,9 +3932,9 @@ STATIC_INLINE void do_sprites_1 (int num, int cycle, int hpos) { case 64: { - uae_u16 data32 = sprite_fetch (s, dma, hpos); - uae_u16 data641 = sprite_fetch (s, dma, hpos); - uae_u16 data642 = sprite_fetch (s, dma, hpos); + uae_u16 data32 = sprite_fetch (s, dma, hpos, cycle, 1); + uae_u16 data641 = sprite_fetch (s, dma, hpos, cycle, 1); + uae_u16 data642 = sprite_fetch (s, dma, hpos, cycle, 1); if (dma) { if (cycle == 0) { sprdata[num][3] = data642; @@ -3920,7 +3950,7 @@ STATIC_INLINE void do_sprites_1 (int num, int cycle, int hpos) break; case 32: { - uae_u16 data32 = sprite_fetch (s, dma, hpos); + uae_u16 data32 = sprite_fetch (s, dma, hpos, cycle, 1); if (dma) { if (cycle == 0) sprdata[num][1] = data32; diff --git a/disk.c b/disk.c index 3cd96c8a..2624ebf7 100755 --- a/disk.c +++ b/disk.c @@ -1330,7 +1330,7 @@ static uae_u32 getmfmlong (uae_u16 *mbuf, int shift) return ((getmfmword (mbuf, shift) << 16) | getmfmword (mbuf + 1, shift)) & MFMMASK; } -static int decode_buffer (uae_u16 *mbuf, int cyl, int drvsec, int ddhd, int filetype, int *drvsecp) +static int decode_buffer (uae_u16 *mbuf, int cyl, int drvsec, int ddhd, int filetype, int *drvsecp, int checkmode) { int i, secwritten = 0; int fwlen = FLOPPY_WRITE_LEN * ddhd; @@ -1382,13 +1382,13 @@ static int decode_buffer (uae_u16 *mbuf, int cyl, int drvsec, int ddhd, int file mbuf += 2; dlong = (odd << 1) | even; - if (dlong) { + if (dlong && !checkmode) { if (filetype == ADF_EXT2) return 6; secwritten = -200; } chksum ^= odd ^ even; - } /* could check here if the label is nonstandard */ + } /* could check here if the label is nonstandard */ mbuf += 8; odd = getmfmlong (mbuf, shift); even = getmfmlong (mbuf + 2, shift); @@ -1440,7 +1440,7 @@ static int drive_write_adf_amigados (drive * drv) { int drvsec, i; - if (decode_buffer (drv->bigmfmbuf, drv->cyl, drv->num_secs, drv->ddhd, drv->filetype, &drvsec)) + if (decode_buffer (drv->bigmfmbuf, drv->cyl, drv->num_secs, drv->ddhd, drv->filetype, &drvsec, 0)) return 2; if (!drvsec) return 2; @@ -2625,7 +2625,7 @@ int DISK_examine_image (struct uae_prefs *p, int num, uae_u32 *crc32) if (!drv->diskfile) return 1; *crc32 = zfile_crc32 (drv->diskfile); - if (decode_buffer (drv->bigmfmbuf, drv->cyl, 11, drv->ddhd, drv->filetype, &drvsec)) { + if (decode_buffer (drv->bigmfmbuf, drv->cyl, 11, drv->ddhd, drv->filetype, &drvsec, 1)) { ret = 2; goto end; } diff --git a/drawing.c b/drawing.c index 6164d2ce..422b8e51 100755 --- a/drawing.c +++ b/drawing.c @@ -119,7 +119,7 @@ static uae_u32 ham_linebuf[MAX_PIXELS_PER_LINE * 2]; char *xlinebuffer; static int *amiga2aspect_line_map, *native2amiga_line_map; -static char *row_map[MAX_VIDHEIGHT]; +static char *row_map[MAX_VIDHEIGHT + 1]; static int max_drawn_amiga_line; /* line_draw_funcs: pfield_do_linetoscr, pfield_do_fill_line, decode_ham */ @@ -135,7 +135,6 @@ typedef void (*line_draw_func)(int, int); #define LINE_DONE_AS_PREVIOUS 8 #define LINE_REMEMBERED_AS_PREVIOUS 9 -static char *line_drawn; static char linestate[(MAXVPOS + 1)*2 + 1]; uae_u8 line_data[(MAXVPOS + 1) * 2][MAX_PLANES * MAX_WORDS_PER_LINE * 2]; @@ -1465,7 +1464,7 @@ STATIC_INLINE void pfield_draw_line (int lineno, int gfx_ypos, int follow_ypos) draw_sprites_ecs (curr_sprite_entries + dip_for_drawing->first_sprite_entry + i); } } - if (plf2pri > 5 && bplplanecnt > 4 && !(currprefs.chipset_mask & CSMASK_AGA)) + if (plf2pri > 5 && bplplanecnt > 4 && bplplanecnt < 6 && !(currprefs.chipset_mask & CSMASK_AGA)) weird_bitplane_fix (); } @@ -2045,9 +2044,6 @@ void reset_drawing (void) init_aspect_maps (); - if (line_drawn == 0) - line_drawn = (char *)malloc (gfxvidinfo.height); - init_row_map(); last_redraw_point = 0; diff --git a/driveclick.c b/driveclick.c index 2f4d2d39..ebd23f57 100755 --- a/driveclick.c +++ b/driveclick.c @@ -93,7 +93,7 @@ static void freesample (struct drvsample *s) void driveclick_init(void) { int v, vv, i, j; - char tmp[1000]; + char tmp[MAX_DPATH]; driveclick_free (); vv = 0; @@ -120,6 +120,8 @@ void driveclick_init(void) for (j = 0; j < DS_END; j++) freesample (&drvs[i][j]); currprefs.dfxclick[i] = changed_prefs.dfxclick[i] = 0; + } else { + vv++; } for (j = 0; j < DS_END; j++) drvs[i][j].len <<= DS_SHIFT; @@ -129,7 +131,6 @@ void driveclick_init(void) drvs[i][DS_CLICK].multisize = drvs[i][DS_CLICK].len / CLICK_TRACKS; drvs[i][DS_CLICK].multilen = (drvs[i][DS_CLICK].multisize * 9) / 10; } - vv += currprefs.dfxclick[i]; } } if (vv > 0) { diff --git a/expansion.c b/expansion.c index 3cbd1f2f..1005bf11 100755 --- a/expansion.c +++ b/expansion.c @@ -23,6 +23,7 @@ #include "savestate.h" #include "zfile.h" #include "catweasel.h" +#include "cdtv.h" #define MAX_EXPANSION_BOARDS 8 @@ -539,136 +540,6 @@ static void expamem_init_catweasel (void) #endif -/* - * CDTV DMAC - */ - -//#define CDTV_DEBUG - -static uae_u32 dmac_lget (uaecptr) REGPARAM; -static uae_u32 dmac_wget (uaecptr) REGPARAM; -static uae_u32 dmac_bget (uaecptr) REGPARAM; -static void dmac_lput (uaecptr, uae_u32) REGPARAM; -static void dmac_wput (uaecptr, uae_u32) REGPARAM; -static void dmac_bput (uaecptr, uae_u32) REGPARAM; - -static uae_u32 dmac_start = 0xe90000; -static uae_u8 dmacmemory[0x100]; - -static int cdtv_command_len; -static uae_u8 cdtv_command_buf[6]; - -static void cdtv_interrupt (int v) -{ - write_log ("cdtv int %d\n", v); - dmacmemory[0x41] = (1 << 4) | (1 << 6); - Interrupt (6); -} - -uae_u32 REGPARAM2 dmac_lget (uaecptr addr) -{ -#ifdef JIT - special_mem |= S_READ; -#endif -#ifdef CDTV_DEBUG - write_log ("dmac_lget %08.8X\n", addr); -#endif - return (dmac_wget (addr) << 16) | dmac_wget (addr + 2); -} - -uae_u32 REGPARAM2 dmac_wget (uaecptr addr) -{ -#ifdef JIT - special_mem |= S_READ; -#endif -#ifdef CDTV_DEBUG - write_log ("dmac_wget %08.8X PC=%X\n", addr, m68k_getpc()); -#endif - return (dmac_bget (addr) << 8) | dmac_bget (addr + 1); -} - -uae_u32 REGPARAM2 dmac_bget (uaecptr addr) -{ -#ifdef JIT - special_mem |= S_READ; -#endif -#ifdef CDTV_DEBUG - write_log ("dmac_bget %08.8X PC=%X\n", addr, m68k_getpc()); -#endif - addr -= dmac_start; - addr &= 65535; - switch (addr) - { - case 0xa3: - return 1; - } - return dmacmemory[addr]; -} - -static void REGPARAM2 dmac_lput (uaecptr addr, uae_u32 l) -{ -#ifdef JIT - special_mem |= S_WRITE; -#endif -#ifdef CDTV_DEBUG - write_log ("dmac_lput %08.8X = %08.8X\n", addr, l); -#endif - dmac_wput (addr, l >> 16); - dmac_wput (addr + 2, l); -} - -static void REGPARAM2 dmac_wput (uaecptr addr, uae_u32 w) -{ -#ifdef JIT - special_mem |= S_WRITE; -#endif -#ifdef CDTV_DEBUG - write_log ("dmac_wput %04.4X = %04.4X\n", addr, w & 65535); -#endif - dmac_bput (addr, w >> 8); - dmac_bput (addr, w); -} - -static void REGPARAM2 dmac_bput (uaecptr addr, uae_u32 b) -{ -#ifdef JIT - special_mem |= S_WRITE; -#endif -#ifdef CDTV_DEBUG - write_log ("dmac_bput %08.8X = %02.2X PC=%X\n", addr, b & 255, m68k_getpc()); -#endif - addr -= dmac_start; - addr &= 65535; -#ifdef CDTV_DEBUG - dmacmemory[addr] = b; - switch (addr) - { - case 0xa1: - if (cdtv_command_len >= sizeof (cdtv_command_buf)) - cdtv_command_len = sizeof (cdtv_command_buf) - 1; - cdtv_command_buf[cdtv_command_len++] = b; - if (cdtv_command_len == 6) { - cdtv_interrupt (1); - } - break; - case 0xa5: - cdtv_command_len = 0; - break; - case 0xe4: - dmacmemory[0x41] = 0; - write_log ("cdtv interrupt cleared\n"); - activate_debugger(); - break; - } -#endif -} - -addrbank dmac_bank = { - dmac_lget, dmac_wget, dmac_bget, - dmac_lput, dmac_wput, dmac_bput, - default_xlate, default_check, NULL -}; - /* * Filesystem device ROM * This is very simple, the Amiga shouldn't be doing things with it. @@ -1152,8 +1023,14 @@ void expamem_reset (void) allocate_expamem (); - if (cdtv_enabled) - map_banks (&dmac_bank, dmac_start >> 16, 0x10000 >> 16, 0x10000); +#ifdef CDTV +#if 0 + if (cdtv_enabled) { + map_banks (&dmac_bank, DMAC_START >> 16, 0x10000 >> 16, 0x10000); + dmac_init (); + } +#endif +#endif /* check if Kickstart version is below 1.3 */ if (! ersatzkickfile && kickstart_version diff --git a/include/cdtv.h b/include/cdtv.h new file mode 100755 index 00000000..7aeb21a9 --- /dev/null +++ b/include/cdtv.h @@ -0,0 +1,12 @@ + +#ifdef CDTV + +extern int cdtv_enabled; +extern addrbank dmac_bank; + +#define DMAC_START 0xe90000 + +extern void dmac_init (void); + +#endif + diff --git a/include/unzip.h b/include/unzip.h index 091b8dfe..3c76300e 100755 --- a/include/unzip.h +++ b/include/unzip.h @@ -49,6 +49,21 @@ extern "C" { #include "zlib.h" #endif +typedef int (ZEXPORT *INFLATEINIT2)(z_streamp strm, int windowBits, const char *version, int stream_size); +typedef int (ZEXPORT *INFLATEINIT)(z_streamp strm, const char *version, int stream_size); +typedef int (ZEXPORT *INFLATEEND)(z_streamp strm); +typedef int (ZEXPORT *INFLATE)(z_streamp strm, int flush); +typedef int (ZEXPORT *DEFLATEINIT)(z_streamp strm, int level, const char *version, int stream_size); +typedef int (ZEXPORT *DEFLATEEND)(z_streamp strm); +typedef int (ZEXPORT *DEFLATE)(z_streamp strm, int flush); +typedef uLong (ZEXPORT *CRC32)(uLong crc, const Bytef *buf, uInt len); + +extern INFLATEINIT2 pinflateInit2; +extern INFLATEINIT pinflateInit; +extern INFLATEEND pinflateEnd; +extern INFLATE pinflate; +extern CRC32 pcrc32; + #if defined(STRICTUNZIP) || defined(STRICTZIPUNZIP) /* like the STRICT of WIN32, we define a pointer that cannot be converted from (void*) without cast */ diff --git a/include/zfile.h b/include/zfile.h index 05eb9ffc..583ff0e0 100755 --- a/include/zfile.h +++ b/include/zfile.h @@ -37,4 +37,5 @@ extern uae_u32 zfile_crc32 (struct zfile *f); #define ZFILE_KEY 4 #define ZFILE_HDF 5 #define ZFILE_STATEFILE 6 -#define ZFILE_NVR 7 \ No newline at end of file +#define ZFILE_NVR 7 + diff --git a/memory.c b/memory.c index e3ce3720..418f3aff 100755 --- a/memory.c +++ b/memory.c @@ -23,6 +23,7 @@ #include "ar.h" #include "crc32.h" #include "gui.h" +#include "cdtv.h" #ifdef JIT int canbang; @@ -36,9 +37,6 @@ int ersatzkickfile; #ifdef CD32 extern int cd32_enabled; #endif -#ifdef CDTV -extern int cdtv_enabled; -#endif uae_u32 allocated_chipmem; uae_u32 allocated_fastmem; @@ -1829,6 +1827,10 @@ void memory_reset (void) #ifdef CDTV case EXTENDED_ROM_CDTV: map_banks (&extendedkickmem_bank, 0xF0, 4, 0); + //extendedkickmemory[0x61a2] = 0x60; + //extendedkickmemory[0x61a3] = 0x00; + //extendedkickmemory[0x61a4] = 0x01; + //extendedkickmemory[0x61a5] = 0x1a; cdtv_enabled = 1; break; #endif diff --git a/od-win32/7z/DLL.h b/od-win32/7z/DLL.h deleted file mode 100755 index 2e75a89a..00000000 --- a/od-win32/7z/DLL.h +++ /dev/null @@ -1,56 +0,0 @@ -// Windows/DLL.h - -#ifndef __WINDOWS_DLL_H -#define __WINDOWS_DLL_H - -#pragma once - -#include "String.h" - -namespace NWindows { -namespace NDLL { - -class CLibrary -{ - bool LoadOperations(HMODULE newModule); -protected: - HMODULE _module; -public: - operator HMODULE() const { return _module; } - HMODULE* operator&() { return &_module; } - - CLibrary():_module(NULL) {}; - ~CLibrary(); - void Attach(HMODULE m) - { - Free(); - _module = m; - } - HMODULE Detach() - { - HMODULE m = _module; - _module = NULL; - return m; - } - - // operator HMODULE() const { return _module; }; - // bool IsLoaded() const { return (_module != NULL); }; - bool Free(); - bool LoadEx(LPCTSTR fileName, DWORD flags = LOAD_LIBRARY_AS_DATAFILE); - bool Load(LPCTSTR fileName); - #ifndef _UNICODE - bool LoadEx(LPCWSTR fileName, DWORD flags = LOAD_LIBRARY_AS_DATAFILE); - bool Load(LPCWSTR fileName); - #endif - FARPROC GetProcAddress(LPCSTR procName) const - { return ::GetProcAddress(_module, procName); } -}; - -bool MyGetModuleFileName(HMODULE hModule, CSysString &result); -#ifndef _UNICODE -bool MyGetModuleFileName(HMODULE hModule, UString &result); -#endif - -}} - -#endif diff --git a/od-win32/7z/Defs.h b/od-win32/7z/Defs.h deleted file mode 100755 index bfaaa6c9..00000000 --- a/od-win32/7z/Defs.h +++ /dev/null @@ -1,22 +0,0 @@ -// Common/Defs.h - -// #pragma once - -#ifndef __COMMON_DEFS_H -#define __COMMON_DEFS_H - -template inline T MyMin(T a, T b) - { return a < b ? a : b; } -template inline T MyMax(T a, T b) - { return a > b ? a : b; } - -template inline int MyCompare(T a, T b) - { return a < b ? -1 : (a == b ? 0 : 1); } - -inline int BoolToInt(bool value) - { return (value ? 1: 0); } - -inline bool IntToBool(int value) - { return (value != 0); } - -#endif diff --git a/od-win32/7z/FileIO.h b/od-win32/7z/FileIO.h deleted file mode 100755 index a8360c0c..00000000 --- a/od-win32/7z/FileIO.h +++ /dev/null @@ -1,98 +0,0 @@ -// Windows/FileIO.h - -#pragma once - -#ifndef __WINDOWS_FILEIO_H -#define __WINDOWS_FILEIO_H - -namespace NWindows { -namespace NFile { -namespace NIO { - -struct CByHandleFileInfo -{ - DWORD Attributes; - FILETIME CreationTime; - FILETIME LastAccessTime; - FILETIME LastWriteTime; - DWORD VolumeSerialNumber; - UINT64 Size; - DWORD NumberOfLinks; - UINT64 FileIndex; -}; - -class CFileBase -{ -protected: - bool _fileIsOpen; - HANDLE _handle; - bool Create(LPCTSTR fileName, DWORD desiredAccess, - DWORD shareMode, DWORD creationDisposition, DWORD flagsAndAttributes); - #ifndef _UNICODE - bool Create(LPCWSTR fileName, DWORD desiredAccess, - DWORD shareMode, DWORD creationDisposition, DWORD flagsAndAttributes); - #endif - -public: - CFileBase(): - _fileIsOpen(false){}; - virtual ~CFileBase(); - - virtual bool Close(); - - bool GetPosition(UINT64 &position) const; - bool GetLength(UINT64 &length) const; - - bool Seek(INT64 distanceToMove, DWORD moveMethod, UINT64 &newPosition) const; - bool Seek(UINT64 position, UINT64 &newPosition); - bool SeekToBegin(); - bool SeekToEnd(UINT64 &newPosition); - - bool GetFileInformation(CByHandleFileInfo &fileInfo) const; -}; - -class CInFile: public CFileBase -{ -public: - bool Open(LPCTSTR fileName, DWORD shareMode, - DWORD creationDisposition, DWORD flagsAndAttributes); - bool Open(LPCTSTR fileName); - #ifndef _UNICODE - bool Open(LPCWSTR fileName, DWORD shareMode, - DWORD creationDisposition, DWORD flagsAndAttributes); - bool Open(LPCWSTR fileName); - #endif - bool Read(void *data, UINT32 size, UINT32 &processedSize); -}; - -class COutFile: public CFileBase -{ - DWORD m_CreationDisposition; -public: - COutFile(): m_CreationDisposition(CREATE_NEW){}; - bool Open(LPCTSTR fileName, DWORD shareMode, - DWORD creationDisposition, DWORD flagsAndAttributes); - bool Open(LPCTSTR fileName); - - #ifndef _UNICODE - bool Open(LPCWSTR fileName, DWORD shareMode, - DWORD creationDisposition, DWORD flagsAndAttributes); - bool Open(LPCWSTR fileName); - #endif - - void SetOpenCreationDisposition(DWORD creationDisposition) - { m_CreationDisposition = creationDisposition; } - void SetOpenCreationDispositionCreateAlways() - { m_CreationDisposition = CREATE_ALWAYS; } - - bool SetTime(const FILETIME *creationTime, - const FILETIME *lastAccessTime, const FILETIME *lastWriteTime); - bool SetLastWriteTime(const FILETIME *lastWriteTime); - bool Write(const void *data, UINT32 size, UINT32 &processedSize); - bool SetEndOfFile(); - bool SetLength(UINT64 length); -}; - -}}} - -#endif diff --git a/od-win32/7z/FileStreams.h b/od-win32/7z/FileStreams.h deleted file mode 100755 index b288ce4b..00000000 --- a/od-win32/7z/FileStreams.h +++ /dev/null @@ -1,55 +0,0 @@ -// FileStreams.h - -#pragma once - -#ifndef __FILESTREAMS_H -#define __FILESTREAMS_H - -#include "FileIO.h" - -#include "IStream.h" -#include "MyCom.h" - -class CInFileStream: - public IInStream, - public IStreamGetSize, - public CMyUnknownImp -{ -public: - NWindows::NFile::NIO::CInFile File; - CInFileStream() {} - bool Open(LPCTSTR fileName); - #ifndef _UNICODE - bool Open(LPCWSTR fileName); - #endif - - MY_UNKNOWN_IMP1(IStreamGetSize) - - STDMETHOD(Read)(void *data, UINT32 size, UINT32 *processedSize); - STDMETHOD(ReadPart)(void *data, UINT32 size, UINT32 *processedSize); - STDMETHOD(Seek)(INT64 offset, UINT32 seekOrigin, UINT64 *newPosition); - - STDMETHOD(GetSize)(UINT64 *size); -}; - -class COutFileStream: - public IOutStream, - public CMyUnknownImp -{ -public: - NWindows::NFile::NIO::COutFile File; - COutFileStream() {} - bool Open(LPCTSTR fileName); - #ifndef _UNICODE - bool Open(LPCWSTR fileName); - #endif - - MY_UNKNOWN_IMP - - STDMETHOD(Write)(const void *data, UINT32 size, UINT32 *processedSize); - STDMETHOD(WritePart)(const void *data, UINT32 size, UINT32 *processedSize); - STDMETHOD(Seek)(INT64 offset, UINT32 seekOrigin, UINT64 *newPosition); - STDMETHOD(SetSize)(INT64 newSize); -}; - -#endif diff --git a/od-win32/7z/IArchive.h b/od-win32/7z/IArchive.h deleted file mode 100755 index 63728680..00000000 --- a/od-win32/7z/IArchive.h +++ /dev/null @@ -1,172 +0,0 @@ -// IArchive.h - -#ifndef __IARCHIVE_H -#define __IARCHIVE_H - -#include "IStream.h" -#include "IProgress.h" -#include "PropID.h" - -namespace NFileTimeType -{ - enum EEnum - { - kWindows, - kUnix, - kDOS - }; -} - -namespace NArchive -{ - enum - { - kName = 0, - kClassID, - kExtension, - kAddExtension, - kUpdate, - kKeepName, - }; - - namespace NExtract - { - namespace NAskMode - { - enum - { - kExtract = 0, - kTest, - kSkip, - }; - } - namespace NOperationResult - { - enum - { - kOK = 0, - kUnSupportedMethod, - kDataError, - kCRCError, - }; - } - } - namespace NUpdate - { - namespace NOperationResult - { - enum - { - kOK = 0, - kError, - }; - } - } -} - -// {23170F69-40C1-278A-0000-000100010000} -DEFINE_GUID(IID_IArchiveOpenCallback, -0x23170F69, 0x40C1, 0x278A, 0x00, 0x00, 0x00, 0x01, 0x00, 0x01, 0x00, 0x00); -MIDL_INTERFACE("23170F69-40C1-278A-0000-000100010000") -IArchiveOpenCallback: public IUnknown -{ -public: - STDMETHOD(SetTotal)(const UINT64 *files, const UINT64 *bytes) PURE; - STDMETHOD(SetCompleted)(const UINT64 *files, const UINT64 *bytes) PURE; -}; - -// {23170F69-40C1-278A-0000-000100090000} -DEFINE_GUID(IID_IArchiveExtractCallback, -0x23170F69, 0x40C1, 0x278A, 0x00, 0x00, 0x00, 0x01, 0x00, 0x09, 0x00, 0x00); -MIDL_INTERFACE("23170F69-40C1-278A-0000-000100090000") -IArchiveExtractCallback: public IProgress -{ -public: - STDMETHOD(GetStream)(UINT32 index, ISequentialOutStream **outStream, - INT32 askExtractMode) PURE; - STDMETHOD(PrepareOperation)(INT32 askExtractMode) PURE; - STDMETHOD(SetOperationResult)(INT32 resultEOperationResult) PURE; -}; - - -// {23170F69-40C1-278A-0000-0001000D0000} -DEFINE_GUID(IID_IArchiveOpenVolumeCallback, -0x23170F69, 0x40C1, 0x278A, 0x00, 0x00, 0x00, 0x01, 0x00, 0x0D, 0x00, 0x00); -MIDL_INTERFACE("23170F69-40C1-278A-0000-0001000D0000") -IArchiveOpenVolumeCallback: public IUnknown -{ -public: - STDMETHOD(GetProperty)(PROPID propID, PROPVARIANT *value) PURE; - STDMETHOD(GetStream)(const wchar_t *name, IInStream **inStream) PURE; -}; - - -// {23170F69-40C1-278A-0000-000100080000} -DEFINE_GUID(IID_IInArchive, -0x23170F69, 0x40C1, 0x278A, 0x00, 0x00, 0x00, 0x01, 0x00, 0x08, 0x00, 0x00); -MIDL_INTERFACE("23170F69-40C1-278A-0000-000100080000") -IInArchive: public IUnknown -{ -public: - STDMETHOD(Open)(IInStream *stream, const UINT64 *maxCheckStartPosition, - IArchiveOpenCallback *openArchiveCallback) PURE; - STDMETHOD(Close)() PURE; - STDMETHOD(GetNumberOfItems)(UINT32 *numItems) PURE; - STDMETHOD(GetProperty)(UINT32 index, PROPID propID, PROPVARIANT *value) PURE; - STDMETHOD(Extract)(const UINT32* indices, UINT32 numItems, - INT32 testMode, IArchiveExtractCallback *extractCallback) PURE; - - STDMETHOD(GetArchiveProperty)(PROPID propID, PROPVARIANT *value) PURE; - - STDMETHOD(GetNumberOfProperties)(UINT32 *numProperties) PURE; - STDMETHOD(GetPropertyInfo)(UINT32 index, - BSTR *name, PROPID *propID, VARTYPE *varType) PURE; - - STDMETHOD(GetNumberOfArchiveProperties)(UINT32 *numProperties) PURE; - STDMETHOD(GetArchivePropertyInfo)(UINT32 index, - BSTR *name, PROPID *propID, VARTYPE *varType) PURE; -}; - - -// {23170F69-40C1-278A-0000-000100040000} -DEFINE_GUID(IID_IArchiveUpdateCallback, -0x23170F69, 0x40C1, 0x278A, 0x00, 0x00, 0x00, 0x01, 0x00, 0x04, 0x00, 0x00); -MIDL_INTERFACE("23170F69-40C1-278A-0000-000100040000") -IArchiveUpdateCallback: public IProgress -{ -public: - // STDMETHOD(EnumProperties)(IEnumSTATPROPSTG **enumerator) PURE; - STDMETHOD(GetUpdateItemInfo)(UINT32 index, - INT32 *newData, // 1 - new data, 0 - old data - INT32 *newProperties, // 1 - new properties, 0 - old properties - UINT32 *indexInArchive // -1 if there is no in archive, or if doesn't matter - ) PURE; - STDMETHOD(GetProperty)(UINT32 index, PROPID propID, PROPVARIANT *value) PURE; - STDMETHOD(GetStream)(UINT32 index, IInStream **inStream) PURE; - STDMETHOD(SetOperationResult)(INT32 operationResult) PURE; - // STDMETHOD(GetVolumeSize)(UINT32 index, UINT64 *size) PURE; - // STDMETHOD(GetVolumeStream)(UINT32 index, IOutStream **volumeStream) PURE; -}; - -// {23170F69-40C1-278A-0000-000100020000} -DEFINE_GUID(IID_IOutArchive, -0x23170F69, 0x40C1, 0x278A, 0x00, 0x00, 0x00, 0x01, 0x00, 0x02, 0x00, 0x00); -MIDL_INTERFACE("23170F69-40C1-278A-0000-000100020000") -IOutArchive: public IUnknown -{ - STDMETHOD(UpdateItems)(IOutStream *outStream, UINT32 numItems, - IArchiveUpdateCallback *updateCallback) PURE; - STDMETHOD(GetFileTimeType)(UINT32 *type) PURE; -}; - -// {23170F69-40C1-278A-0000-000100030000} -DEFINE_GUID(IID_ISetProperties, -0x23170F69, 0x40C1, 0x278A, 0x00, 0x00, 0x00, 0x01, 0x00, 0x03, 0x00, 0x00); -MIDL_INTERFACE("23170F69-40C1-278A-0000-000100030000") -ISetProperties: public IUnknown -{ - STDMETHOD(SetProperties)(const BSTR *names, const PROPVARIANT *values, INT32 numProperties) PURE; -}; - - -#endif diff --git a/od-win32/7z/IMyUnknown.h b/od-win32/7z/IMyUnknown.h deleted file mode 100755 index d614d99a..00000000 --- a/od-win32/7z/IMyUnknown.h +++ /dev/null @@ -1,71 +0,0 @@ -// IMyUnknown.h - -// #pragma once - -#ifndef __MYUNKNOWN_H -#define __MYUNKNOWN_H - -#ifdef WIN32 - -// #include -#include - -#else - -#define HRESULT LONG -#define STDMETHODCALLTYPE __stdcall -#define STDMETHOD_(t, f) virtual t STDMETHODCALLTYPE f -#define STDMETHOD(f) STDMETHOD_(HRESULT, f) -#define STDMETHODIMP_(type) type STDMETHODCALLTYPE -#define STDMETHODIMP STDMETHODIMP_(HRESULT) - -#define PURE = 0; - -typedef struct { - unsigned long Data1; - unsigned short Data2; - unsigned short Data3; - unsigned char Data4[8]; -} GUID; - -#ifdef __cplusplus - #define MY_EXTERN_C extern "C" -#else - #define MY_EXTERN_C extern -#endif - -#ifdef INITGUID - #define MY_DEFINE_GUID(name, l, w1, w2, b1, b2, b3, b4, b5, b6, b7, b8) \ - MY_EXTERN_C const GUID name = { l, w1, w2, { b1, b2, b3, b4, b5, b6, b7, b8 } } -#else - #define MY_DEFINE_GUID(name, l, w1, w2, b1, b2, b3, b4, b5, b6, b7, b8) \ - MY_EXTERN_C const GUID name -#endif - -#ifdef __cplusplus -#define REFGUID const GUID & -#else -#define REFGUID const GUID * __MIDL_CONST -#endif - -#define MIDL_INTERFACE(x) struct -inline int operator==(REFGUID g1, REFGUID g2) -{ - for (int i = 0; i < sizeof(g1); i++) - if (((unsigned char *)&g1)[i] != ((unsigned char *)&g2)[i]) - return false; - return true; -} -inline int operator!=(REFGUID &g1, REFGUID &g2) - { return !(g1 == g2); } - -struct IUnknown -{ - STDMETHOD(QueryInterface) (const GUID *iid, void **outObject) PURE; - STDMETHOD_(ULONG, AddRef)() PURE; - STDMETHOD_(ULONG, Release)() PURE; -}; - -#endif - -#endif diff --git a/od-win32/7z/IProgress.h b/od-win32/7z/IProgress.h deleted file mode 100755 index db14b051..00000000 --- a/od-win32/7z/IProgress.h +++ /dev/null @@ -1,32 +0,0 @@ -// Interface/IProgress.h - -// #pragma once - -#ifndef __IPROGRESS_H -#define __IPROGRESS_H - -// {23170F69-40C1-278A-0000-000000050000} -DEFINE_GUID(IID_IProgress, -0x23170F69, 0x40C1, 0x278A, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00); -MIDL_INTERFACE("23170F69-40C1-278A-0000-000000050000") -IProgress: public IUnknown -{ -public: - STDMETHOD(SetTotal)(UINT64 total) PURE; - STDMETHOD(SetCompleted)(const UINT64 *completeValue) PURE; -}; - -/* -// {23170F69-40C1-278A-0000-000000050002} -DEFINE_GUID(IID_IProgress2, -0x23170F69, 0x40C1, 0x278A, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x02); -MIDL_INTERFACE("23170F69-40C1-278A-0000-000000050002") -IProgress2: public IUnknown -{ -public: - STDMETHOD(SetTotal)(const UINT64 *total) PURE; - STDMETHOD(SetCompleted)(const UINT64 *completeValue) PURE; -}; -*/ - -#endif diff --git a/od-win32/7z/IStream.h b/od-win32/7z/IStream.h deleted file mode 100755 index 147be411..00000000 --- a/od-win32/7z/IStream.h +++ /dev/null @@ -1,64 +0,0 @@ -// IStream.h - -// #pragma once - -#ifndef __ISTREAMS_H -#define __ISTREAMS_H - -#include "IMyUnknown.h" - -// {23170F69-40C1-278A-0000-000000010000} -DEFINE_GUID(IID_ISequentialInStream, -0x23170F69, 0x40C1, 0x278A, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00); -MIDL_INTERFACE("23170F69-40C1-278A-0000-000000010000") -ISequentialInStream : public IUnknown -{ -public: - // out: if (processedSize == 0) then there are no more bytes - STDMETHOD(Read)(void *data, UINT32 size, UINT32 *processedSize) = 0; - STDMETHOD(ReadPart)(void *data, UINT32 size, UINT32 *processedSize) = 0; -}; - -// {23170F69-40C1-278A-0000-000000020000} -DEFINE_GUID(IID_ISequentialOutStream, -0x23170F69, 0x40C1, 0x278A, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00); -MIDL_INTERFACE("23170F69-40C1-278A-0000-000000020000") -ISequentialOutStream : public IUnknown -{ -public: - STDMETHOD(Write)(const void *data, UINT32 size, UINT32 *processedSize) = 0; - STDMETHOD(WritePart)(const void *data, UINT32 size, UINT32 *processedSize) = 0; -}; - -// {23170F69-40C1-278A-0000-000000030000} -DEFINE_GUID(IID_IInStream, -0x23170F69, 0x40C1, 0x278A, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00); -MIDL_INTERFACE("23170F69-40C1-278A-0000-000000030000") -IInStream : public ISequentialInStream -{ -public: - STDMETHOD(Seek)(INT64 offset, UINT32 seekOrigin, UINT64 *newPosition) = 0; -}; - -// {23170F69-40C1-278A-0000-000000040000} -DEFINE_GUID(IID_IOutStream, -0x23170F69, 0x40C1, 0x278A, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00); -MIDL_INTERFACE("23170F69-40C1-278A-0000-000000040000") -IOutStream : public ISequentialOutStream -{ -public: - STDMETHOD(Seek)(INT64 offset, UINT32 seekOrigin, UINT64 *newPosition) = 0; - STDMETHOD(SetSize)(INT64 aNewSize) = 0; -}; - -// {23170F69-40C1-278A-0000-000000060000} -DEFINE_GUID(IID_IStreamGetSize, -0x23170F69, 0x40C1, 0x278A, 0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00); -MIDL_INTERFACE("23170F69-40C1-278A-0000-000000060000") -IStreamGetSize : public IUnknown -{ -public: - STDMETHOD(GetSize)(UINT64 *size) = 0; -}; - -#endif diff --git a/od-win32/7z/MyCom.h b/od-win32/7z/MyCom.h deleted file mode 100755 index 40e4ce29..00000000 --- a/od-win32/7z/MyCom.h +++ /dev/null @@ -1,187 +0,0 @@ -// MyCom.h - -// #pragma once - -#ifndef __MYCOM_H -#define __MYCOM_H - -#define RINOK(x) { HRESULT __result_ = (x); if(__result_ != S_OK) return __result_; } - -template -class CMyComPtr -{ - T* _p; -public: - // typedef T _PtrClass; - CMyComPtr() { _p = NULL;} - CMyComPtr(T* p) {if ((_p = p) != NULL) p->AddRef(); } - CMyComPtr(const CMyComPtr& lp) - { - if ((_p = lp._p) != NULL) - _p->AddRef(); - } - ~CMyComPtr() { if (_p) _p->Release(); } - void Release() { if (_p) { _p->Release(); _p = NULL; } } - operator T*() const { return (T*)_p; } - // T& operator*() const { return *_p; } - T** operator&() { return &_p; } - T* operator->() const { return _p; } - T* operator=(T* p) - { - if (p != 0) - p->AddRef(); - if (_p) - _p->Release(); - _p = p; - return p; - } - T* operator=(const CMyComPtr& lp) { return (*this = lp._p); } - bool operator!() const { return (_p == NULL); } - // bool operator==(T* pT) const { return _p == pT; } - // Compare two objects for equivalence - void Attach(T* p2) - { - Release(); - _p = p2; - } - T* Detach() - { - T* pt = _p; - _p = NULL; - return pt; - } - HRESULT CoCreateInstance(REFCLSID rclsid, REFIID iid, LPUNKNOWN pUnkOuter = NULL, DWORD dwClsContext = CLSCTX_ALL) - { - return ::CoCreateInstance(rclsid, pUnkOuter, dwClsContext, iid, (void**)&_p); - } - /* - HRESULT CoCreateInstance(LPCOLESTR szProgID, LPUNKNOWN pUnkOuter = NULL, DWORD dwClsContext = CLSCTX_ALL) - { - CLSID clsid; - HRESULT hr = CLSIDFromProgID(szProgID, &clsid); - ATLASSERT(_p == NULL); - if (SUCCEEDED(hr)) - hr = ::CoCreateInstance(clsid, pUnkOuter, dwClsContext, __uuidof(T), (void**)&_p); - return hr; - } - */ - template - HRESULT QueryInterface(REFGUID iid, Q** pp) const - { - return _p->QueryInterface(iid, (void**)pp); - } -}; - -////////////////////////////////////////////////////////// - -class CMyComBSTR -{ -public: - BSTR m_str; - CMyComBSTR() { m_str = NULL; } - CMyComBSTR(LPCOLESTR pSrc) { m_str = ::SysAllocString(pSrc); } - // CMyComBSTR(int nSize) { m_str = ::SysAllocStringLen(NULL, nSize); } - // CMyComBSTR(int nSize, LPCOLESTR sz) { m_str = ::SysAllocStringLen(sz, nSize); } - CMyComBSTR(const CMyComBSTR& src) { m_str = src.MyCopy(); } - /* - CMyComBSTR(REFGUID src) - { - LPOLESTR szGuid; - StringFromCLSID(src, &szGuid); - m_str = ::SysAllocString(szGuid); - CoTaskMemFree(szGuid); - } - */ - ~CMyComBSTR() { ::SysFreeString(m_str); } - CMyComBSTR& operator=(const CMyComBSTR& src) - { - if (m_str != src.m_str) - { - if (m_str) - ::SysFreeString(m_str); - m_str = src.MyCopy(); - } - return *this; - } - CMyComBSTR& operator=(LPCOLESTR pSrc) - { - ::SysFreeString(m_str); - m_str = ::SysAllocString(pSrc); - return *this; - } - unsigned int Length() const { return ::SysStringLen(m_str); } - operator BSTR() const { return m_str; } - BSTR* operator&() { return &m_str; } - BSTR MyCopy() const - { - int byteLen = ::SysStringByteLen(m_str); - BSTR res = ::SysAllocStringByteLen(NULL, byteLen); - memmove(res, m_str, byteLen); - return res; - } - void Attach(BSTR src) { m_str = src; } - BSTR Detach() - { - BSTR s = m_str; - m_str = NULL; - return s; - } - void Empty() - { - ::SysFreeString(m_str); - m_str = NULL; - } - bool operator!() const { return (m_str == NULL); } -}; - - -////////////////////////////////////////////////////////// - -class CMyUnknownImp -{ -public: - ULONG __m_RefCount; - CMyUnknownImp(): __m_RefCount(0) {} -}; - -#define MY_QUERYINTERFACE_BEGIN STDMETHOD(QueryInterface) \ - (REFGUID iid, void **outObject) { -#define MY_QUERYINTERFACE_ENTRY(i) if (iid == IID_ ## i) \ - { *outObject = (void *)(i *)this; AddRef(); return S_OK; } -#define MY_QUERYINTERFACE_END return E_NOINTERFACE; } - -#define MY_ADDREF_RELEASE \ -STDMETHOD_(ULONG, AddRef)() { return ++__m_RefCount; } \ -STDMETHOD_(ULONG, Release)() { if (--__m_RefCount != 0) \ - return __m_RefCount; delete this; return 0; } - -#define MY_UNKNOWN_IMP_SPEC(i) \ - MY_QUERYINTERFACE_BEGIN \ - i \ - MY_QUERYINTERFACE_END \ - MY_ADDREF_RELEASE - - -#define MY_UNKNOWN_IMP MY_UNKNOWN_IMP_SPEC(;) - -#define MY_UNKNOWN_IMP1(i) MY_UNKNOWN_IMP_SPEC( \ - MY_QUERYINTERFACE_ENTRY(i) \ - ) - -#define MY_UNKNOWN_IMP2(i1, i2) MY_UNKNOWN_IMP_SPEC( \ - MY_QUERYINTERFACE_ENTRY(i1) \ - MY_QUERYINTERFACE_ENTRY(i2) \ - ) -#define MY_UNKNOWN_IMP3(i1, i2, i3) MY_UNKNOWN_IMP_SPEC( \ - MY_QUERYINTERFACE_ENTRY(i1) \ - MY_QUERYINTERFACE_ENTRY(i2) \ - MY_QUERYINTERFACE_ENTRY(i3) \ - ) -#define MY_UNKNOWN_IMP4(i1, i2, i3, i4) MY_UNKNOWN_IMP_SPEC( \ - MY_QUERYINTERFACE_ENTRY(i1) \ - MY_QUERYINTERFACE_ENTRY(i2) \ - MY_QUERYINTERFACE_ENTRY(i3) \ - MY_QUERYINTERFACE_ENTRY(i4) \ - ) - -#endif diff --git a/od-win32/7z/PropID.h b/od-win32/7z/PropID.h deleted file mode 100755 index d0e8e86e..00000000 --- a/od-win32/7z/PropID.h +++ /dev/null @@ -1,51 +0,0 @@ -// Interface/PropID.h - -// #pragma once - -#ifndef __INTERFACE_PROPID_H -#define __INTERFACE_PROPID_H - -enum -{ - kpidNoProperty = 0, - - kpidHandlerItemIndex = 2, - kpidPath, - kpidName, - kpidExtension, - kpidIsFolder, - kpidSize, - kpidPackedSize, - kpidAttributes, - kpidCreationTime, - kpidLastAccessTime, - kpidLastWriteTime, - kpidSolid, - kpidCommented, - kpidEncrypted, - kpidSplitBefore, - kpidSplitAfter, - kpidDictionarySize, - kpidCRC, - kpidType, - kpidIsAnti, - kpidMethod, - kpidHostOS, - kpidFileSystem, - kpidUser, - kpidGroup, - kpidBlock, - kpidComment, - - kpidTotalSize = 0x1100, - kpidFreeSpace, - kpidClusterSize, - kpidVolumeName, - - kpidLocalName = 0x1200, - kpidProvider, - - kpidUserDefined = 0x10000 -}; - -#endif diff --git a/od-win32/7z/PropVariant.h b/od-win32/7z/PropVariant.h deleted file mode 100755 index 44fd74f5..00000000 --- a/od-win32/7z/PropVariant.h +++ /dev/null @@ -1,60 +0,0 @@ -// Windows/PropVariant.h - -// #pragma once - -#ifndef __WINDOWS_PROPVARIANT_H -#define __WINDOWS_PROPVARIANT_H - -namespace NWindows { -namespace NCOM { - -class CPropVariant : public tagPROPVARIANT -{ -public: - CPropVariant() { vt = VT_EMPTY; } - ~CPropVariant() { Clear(); } - CPropVariant(const PROPVARIANT& varSrc); - CPropVariant(const CPropVariant& varSrc); - CPropVariant(BSTR bstrSrc); - CPropVariant(LPCOLESTR lpszSrc); - CPropVariant(bool bSrc) { vt = VT_BOOL; boolVal = (bSrc ? VARIANT_TRUE : VARIANT_FALSE); }; - CPropVariant(UINT32 value) { vt = VT_UI4; ulVal = value; } - CPropVariant(UINT64 value) { vt = VT_UI8; uhVal = *(ULARGE_INTEGER*)&value; } - CPropVariant(const FILETIME &value) { vt = VT_FILETIME; filetime = value; } - CPropVariant(int value) { vt = VT_I4; lVal = value; } - CPropVariant(BYTE value) { vt = VT_UI1; bVal = value; } - CPropVariant(short value) { vt = VT_I2; iVal = value; } - CPropVariant(long value, VARTYPE vtSrc = VT_I4) { vt = vtSrc; lVal = value; } - - CPropVariant& operator=(const CPropVariant& varSrc); - CPropVariant& operator=(const PROPVARIANT& varSrc); - CPropVariant& operator=(BSTR bstrSrc); - CPropVariant& operator=(LPCOLESTR lpszSrc); - CPropVariant& operator=(bool bSrc); - CPropVariant& operator=(UINT32 value); - CPropVariant& operator=(UINT64 value); - CPropVariant& operator=(const FILETIME &value); - - CPropVariant& operator=(int value); - CPropVariant& operator=(BYTE value); - CPropVariant& operator=(short value); - CPropVariant& operator=(long value); - - HRESULT Clear(); - HRESULT Copy(const PROPVARIANT* pSrc); - HRESULT Attach(PROPVARIANT* pSrc); - HRESULT Detach(PROPVARIANT* pDest); - HRESULT ChangeType(VARTYPE vtNew, const PROPVARIANT* pSrc = NULL); - - HRESULT InternalClear(); - void InternalCopy(const PROPVARIANT* pSrc); - - HRESULT WriteToStream(ISequentialStream *stream) const; - HRESULT ReadFromStream(ISequentialStream *stream); - - int Compare(const CPropVariant &a1); -}; - -}} - -#endif diff --git a/od-win32/7z/PropVariantConversions.h b/od-win32/7z/PropVariantConversions.h deleted file mode 100755 index a32baccc..00000000 --- a/od-win32/7z/PropVariantConversions.h +++ /dev/null @@ -1,17 +0,0 @@ -// Windows/PropVariantConversions.h - -#pragma once - -#ifndef __PROPVARIANTCONVERSIONS_H -#define __PROPVARIANTCONVERSIONS_H - -#include "String.h" - -// CSysString ConvertFileTimeToString(const FILETIME &fileTime, bool includeTime = true); -UString ConvertFileTimeToString2(const FILETIME &fileTime, bool includeTime = true, - bool includeSeconds = true); -UString ConvertPropVariantToString(const PROPVARIANT &propVariant); - -UINT64 ConvertPropVariantToUINT64(const PROPVARIANT &propVariant); - -#endif diff --git a/od-win32/7z/String.h b/od-win32/7z/String.h deleted file mode 100755 index be273271..00000000 --- a/od-win32/7z/String.h +++ /dev/null @@ -1,672 +0,0 @@ -// Common/String.h - -#pragma once - -#ifndef __COMMON_STRING_H -#define __COMMON_STRING_H - -#include "Vector.h" - -extern bool g_IsNT; - -static const char *kTrimDefaultCharSet = " \n\t"; - -template -inline size_t MyStringLen(const T *s) -{ - int i; - for (i = 0; s[i] != '\0'; i++); - return i; -} - -template -inline T * MyStringCopy(T *dest, const T *src) -{ - T *destStart = dest; - while((*dest++ = *src++) != 0); - return destStart; -} - -inline wchar_t* MyStringGetNextCharPointer(wchar_t *p) - { return (p + 1); } -inline const wchar_t* MyStringGetNextCharPointer(const wchar_t *p) - { return (p + 1); } -inline wchar_t* MyStringGetPrevCharPointer(const wchar_t *base, wchar_t *p) - { return (p - 1); } -inline const wchar_t* MyStringGetPrevCharPointer(const wchar_t *base, const wchar_t *p) - { return (p - 1); } - -#ifdef WIN32 - -inline char* MyStringGetNextCharPointer(char *p) - { return CharNextA(p); } -inline const char* MyStringGetNextCharPointer(const char *p) - { return CharNextA(p); } - -inline char* MyStringGetPrevCharPointer(char *base, char *p) - { return CharPrevA(base, p); } -inline const char* MyStringGetPrevCharPointer(const char *base, const char *p) - { return CharPrevA(base, p); } - -inline char MyCharUpper(char c) - { return (char)CharUpperA((LPSTR)(unsigned char)c); } -#ifdef _UNICODE -inline wchar_t MyCharUpper(wchar_t c) - { return (wchar_t)CharUpperW((LPWSTR)c); } -#else -wchar_t MyCharUpper(wchar_t c); -#endif - -inline char MyCharLower(char c) - { return (char)CharLowerA((LPSTR)(unsigned char)c); } -#ifdef _UNICODE -inline wchar_t MyCharLower(wchar_t c) - { return (wchar_t)CharLowerW((LPWSTR)c); } -#else -wchar_t MyCharLower(wchar_t c); -#endif - - -inline char * MyStringUpper(char *s) - { return CharUpperA(s); } -#ifdef _UNICODE -inline wchar_t * MyStringUpper(wchar_t *s) - { return CharUpperW(s); } -#else -wchar_t * MyStringUpper(wchar_t *s); -#endif - -inline char * MyStringLower(char *s) - { return CharLowerA(s); } -#ifdef _UNICODE -inline wchar_t * MyStringLower(wchar_t *s) - { return CharLowerW(s); } -#else -wchar_t * MyStringLower(wchar_t *s); -#endif - - -////////////////////////////////////// -// Compare - -inline int ConvertCompareResult(int r) - { return r - 2; } - -inline int MyStringCollate(const char *s1, const char *s2) - { return ConvertCompareResult(CompareStringA( - LOCALE_USER_DEFAULT, SORT_STRINGSORT, s1, -1, s2, -1)); } -#ifdef _UNICODE -inline int MyStringCollate(const wchar_t *s1, const wchar_t *s2) - { return ConvertCompareResult(CompareStringW( - LOCALE_USER_DEFAULT, SORT_STRINGSORT, s1, -1, s2, -1)); } -#else -int MyStringCollate(const wchar_t *s1, const wchar_t *s2); -#endif - -inline int MyStringCollateNoCase(const char *s1, const char *s2) - { return ConvertCompareResult(CompareStringA( - LOCALE_USER_DEFAULT, NORM_IGNORECASE | SORT_STRINGSORT, s1, -1, s2, -1)); } -#ifdef _UNICODE -inline int MyStringCollateNoCase(const wchar_t *s1, const wchar_t *s2) - { return ConvertCompareResult(CompareStringW( - LOCALE_USER_DEFAULT, NORM_IGNORECASE | SORT_STRINGSORT, s1, -1, s2, -1)); } -#else -int MyStringCollateNoCase(const wchar_t *s1, const wchar_t *s2); -#endif - -#else // Standard-C - -inline NormalizeCompareResult(int res) -{ - if (res < 0) - return -1; - if (res > 0) - return 1; - return 0; -} - -inline wchar_t MyCharUpper(wchar_t c) - { return towupper(c); } - -inline int MyStringCollateNoCase(const wchar_t *s1, const wchar_t *s2) - { return NormalizeCompareResult(wcscoll(s1, s2)); } - -#endif - - -template -inline int MyStringCompare(const T *s1, const T *s2) -{ - while (true) - { - unsigned int c1 = (unsigned int)*s1++; - unsigned int c2 = (unsigned int)*s2++; - if (c1 < c2) - return -1; - if (c1 > c2) - return 1; - if (c1 == 0) - return 0; - } -} - -template -inline int MyStringCompareNoCase(const T *s1, const T *s2) - { return MyStringCollateNoCase(s1, s2); } - -template -class CStringBase -{ - void TrimLeftWithCharSet(const CStringBase &charSet) - { - const T *p = _chars; - while (charSet.Find(*p) >= 0 && (*p != 0)) - p = GetNextCharPointer(p); - Delete(0, p - _chars); - } - void TrimRightWithCharSet(const CStringBase &charSet) - { - const T *p = _chars; - const T *pLast = NULL; - while (*p != 0) - { - if (charSet.Find(*p) >= 0) - { - if (pLast == NULL) - pLast = p; - } - else - pLast = NULL; - p = GetNextCharPointer(p); - } - if(pLast != NULL) - { - int i = pLast - _chars; - Delete(i, _length - i); - } - - } - void MoveItems(int destIndex, int srcIndex) - { - memmove(_chars + destIndex, _chars + srcIndex, - sizeof(T) * (_length - srcIndex + 1)); - } - - void InsertSpace(int &index, int size) - { - CorrectIndex(index); - GrowLength(size); - MoveItems(index + size, index); - } - - static T *GetNextCharPointer(T *p) - { return MyStringGetNextCharPointer(p); } - static const T *GetNextCharPointer(const T *p) - { return MyStringGetNextCharPointer(p); } - static T *GetPrevCharPointer(T *base, T *p) - { return MyStringGetPrevCharPointer(base, p); } - static const T *GetPrevCharPointer(const T *base, const T *p) - { return MyStringGetPrevCharPointer(base, p); } -protected: - T *_chars; - int _length; - int _capacity; - - void SetCapacity(int newCapacity) - { - int realCapacity = newCapacity + 1; - if(realCapacity == _capacity) - return; - /* - const int kMaxStringSize = 0x20000000; - #ifndef _WIN32_WCE - if(newCapacity > kMaxStringSize || newCapacity < _length) - throw 1052337; - #endif - */ - T *newBuffer = new T[realCapacity]; - if(_capacity > 0) - { - for (int i = 0; i < (_length + 1); i++) - newBuffer[i] = _chars[i]; - delete []_chars; - _chars = newBuffer; - } - else - { - _chars = newBuffer; - _chars[0] = 0; - } - _capacity = realCapacity; - } - - void GrowLength(int n) - { - int freeSize = _capacity - _length - 1; - if (n <= freeSize) - return; - int delta; - if (_capacity > 64) - delta = _capacity / 2; - else if (_capacity > 8) - delta = 16; - else - delta = 4; - if (freeSize + delta < n) - delta = n - freeSize; - SetCapacity(_capacity + delta); - } - - void CorrectIndex(int &index) const - { - if (index > _length) - index = _length; - } - -public: - CStringBase(): _chars(0), _length(0), _capacity(0) - { SetCapacity(16 - 1); } - CStringBase(T c): _chars(0), _length(0), _capacity(0) - { - SetCapacity(1); - _chars[0] = c; - _chars[1] = 0; - _length = 1; - } - CStringBase(const T *chars): _chars(0), _length(0), _capacity(0) - { - int length = MyStringLen(chars); - SetCapacity(length); - MyStringCopy(_chars, chars); // can be optimized by memove() - _length = length; - } - CStringBase(const CStringBase &s): _chars(0), _length(0), _capacity(0) - { - SetCapacity(s._length); - MyStringCopy(_chars, s._chars); - _length = s._length; - } - ~CStringBase() { delete []_chars; } - - operator const T*() const { return _chars;} - - // The minimum size of the character buffer in characters. - // This value does not include space for a null terminator. - T* GetBuffer(int minBufLength) - { - if(minBufLength >= _capacity) - SetCapacity(minBufLength + 1); - return _chars; - } - void ReleaseBuffer() { ReleaseBuffer(MyStringLen(_chars)); } - void ReleaseBuffer(int newLength) - { - /* - #ifndef _WIN32_WCE - if(newLength >= _capacity) - throw 282217; - #endif - */ - _chars[newLength] = 0; - _length = newLength; - } - - CStringBase& operator=(T c) - { - Empty(); - SetCapacity(1); - _chars[0] = c; - _chars[1] = 0; - _length = 1; - return *this; - } - CStringBase& operator=(const T *chars) - { - Empty(); - int length = MyStringLen(chars); - SetCapacity(length); - MyStringCopy(_chars, chars); - _length = length; - return *this; - } - CStringBase& operator=(const CStringBase& s) - { - if(&s == this) - return *this; - Empty(); - SetCapacity(s._length); - MyStringCopy(_chars, s._chars); - _length = s._length; - return *this; - } - - CStringBase& operator+=(T c) - { - GrowLength(1); - _chars[_length] = c; - _chars[++_length] = 0; - return *this; - } - CStringBase& operator+=(const T *s) - { - int len = MyStringLen(s); - GrowLength(len); - MyStringCopy(_chars + _length, s); - _length += len; - return *this; - } - CStringBase& operator+=(const CStringBase &s) - { - GrowLength(s._length); - MyStringCopy(_chars + _length, s._chars); - _length += s._length; - return *this; - } - void Empty() - { - _length = 0; - _chars[0] = 0; - } - int Length() const { return _length; } - bool IsEmpty() const { return (_length == 0); } - - CStringBase Mid(int startIndex) const - { return Mid(startIndex, _length - startIndex); } - CStringBase Mid(int startIndex, int count ) const - { - if (startIndex + count > _length) - count = _length - startIndex; - - if (startIndex == 0 && startIndex + count == _length) - return *this; - - CStringBase result; - result.SetCapacity(count); - // MyStringNCopy(result._chars, _chars + startIndex, count); - for (int i = 0; i < count; i++) - result._chars[i] = _chars[startIndex + i]; - result._chars[count] = 0; - result._length = count; - return result; - } - CStringBase Left(int count) const - { return Mid(0, count); } - CStringBase Right(int count) const - { - if (count > _length) - count = _length; - return Mid(_length - count, count); - } - - void MakeUpper() - { MyStringUpper(_chars); } - void MakeLower() - { MyStringLower(_chars); } - - int Compare(const CStringBase& s) const - { return MyStringCompare(_chars, s._chars); } - - int CompareNoCase(const CStringBase& s) const - { return MyStringCompareNoCase(_chars, s._chars); } - int Collate(const CStringBase& s) const - { return MyStringCollate(_chars, s._chars); } - int CollateNoCase(const CStringBase& s) const - { return MyStringCollateNoCase(_chars, s._chars); } - - int Find(T c) const { return Find(c, 0); } - int Find(T c, int startIndex) const - { - T *p = _chars + startIndex; - while (true) - { - if (*p == c) - return p - _chars; - if (*p == 0) - return -1; - p = GetNextCharPointer(p); - } - } - int Find(const CStringBase &s) const { return Find(s, 0); } - int Find(const CStringBase &s, int startIndex) const - { - if (s.IsEmpty()) - return startIndex; - for (; startIndex < _length; startIndex++) - { - int j; - for (j = 0; j < s._length && startIndex + j < _length; j++) - if (_chars[startIndex+j] != s._chars[j]) - break; - if (j == s._length) - return startIndex; - } - return -1; - } - int ReverseFind(T c) const - { - if (_length == 0) - return -1; - T *p = _chars + _length - 1; - while (true) - { - if (*p == c) - return p - _chars; - if (p == _chars) - return -1; - p = GetPrevCharPointer(_chars, p); - } - } - int FindOneOf(const CStringBase &s) const - { - for(int i = 0; i < _length; i++) - if (s.Find(_chars[i]) >= 0) - return i; - return -1; - } - - void TrimLeft(T c) - { - const T *p = _chars; - while (c == *p) - p = GetNextCharPointer(p); - Delete(0, p - _chars); - } - void TrimLeft() - { - CStringBase charSet; - for(int i = 0; i < sizeof(kTrimDefaultCharSet) / - sizeof(kTrimDefaultCharSet[0]); i++) - charSet += kTrimDefaultCharSet[i]; - TrimLeftWithCharSet(charSet); - } - void TrimRight() - { - CStringBase charSet; - for(int i = 0; i < sizeof(kTrimDefaultCharSet) / - sizeof(kTrimDefaultCharSet[0]); i++) - charSet += kTrimDefaultCharSet[i]; - TrimRightWithCharSet(charSet); - } - void TrimRight(T c) - { - const T *p = _chars; - const T *pLast = NULL; - while (*p != 0) - { - if (*p == c) - { - if (pLast == NULL) - pLast = p; - } - else - pLast = NULL; - p = GetNextCharPointer(p); - } - if(pLast != NULL) - { - int i = pLast - _chars; - Delete(i, _length - i); - } - } - void Trim() - { - TrimRight(); - TrimLeft(); - } - - int Insert(int index, T c) - { - InsertSpace(index, 1); - _chars[index] = c; - _length++; - return _length; - } - int Insert(int index, const CStringBase &s) - { - CorrectIndex(index); - if (s.IsEmpty()) - return _length; - int numInsertChars = s.Length(); - InsertSpace(index, numInsertChars); - for(int i = 0; i < numInsertChars; i++) - _chars[index + i] = s[i]; - _length += numInsertChars; - return _length; - } - - // !!!!!!!!!!!!!!! test it if newChar = '\0' - int Replace(T oldChar, T newChar) - { - if (oldChar == newChar) - return 0; - int number = 0; - int pos = 0; - while (pos < Length()) - { - pos = Find(oldChar, pos); - if (pos < 0) - break; - _chars[pos] = newChar; - pos++; - number++; - } - return number; - } - int Replace(const CStringBase &oldString, const CStringBase &newString) - { - if (oldString.IsEmpty()) - return 0; - if (oldString == newString) - return 0; - int oldStringLength = oldString.Length(); - int newStringLength = newString.Length(); - int number = 0; - int pos = 0; - while (pos < _length) - { - pos = Find(oldString, pos); - if (pos < 0) - break; - Delete(pos, oldStringLength); - Insert(pos, newString); - pos += newStringLength; - number++; - } - return number; - } - int Delete(int index, int count = 1 ) - { - if (index + count > _length) - count = _length - index; - if (count > 0) - { - MoveItems(index, index + count); - _length -= count; - } - return _length; - } -}; - -template -CStringBase operator+(const CStringBase& s1, const CStringBase& s2) -{ - CStringBase result(s1); - result += s2; - return result; -} - -template -CStringBase operator+(const CStringBase& s, T c) -{ - CStringBase result(s); - result += c; - return result; -} - -template -CStringBase operator+(T c, const CStringBase& s) -{ - CStringBase result(c); - result += s; - return result; -} - -template -CStringBase operator+(const CStringBase& s, const T * chars) -{ - CStringBase result(s); - result += chars; - return result; -} - -template -CStringBase operator+(const T * chars, const CStringBase& s) -{ - CStringBase result(chars); - result += s; - return result; -} - -template -bool operator==(const CStringBase& s1, const CStringBase& s2) - { return (s1.Compare(s2) == 0); } - -template -bool operator<(const CStringBase& s1, const CStringBase& s2) - { return (s1.Compare(s2) < 0); } - -template -bool operator==(const T *s1, const CStringBase& s2) - { return (s2.Compare(s1) == 0); } - -template -bool operator==(const CStringBase& s1, const T *s2) - { return (s1.Compare(s2) == 0); } - -template -bool operator!=(const CStringBase& s1, const CStringBase& s2) - { return (s1.Compare(s2) != 0); } - -template -bool operator!=(const T *s1, const CStringBase& s2) - { return (s2.Compare(s1) != 0); } - -template -bool operator!=(const CStringBase& s1, const T *s2) - { return (s1.Compare(s2) != 0); } - -typedef CStringBase AString; -typedef CStringBase UString; - -typedef CObjectVector AStringVector; -typedef CObjectVector UStringVector; - -#ifdef _UNICODE - typedef UString CSysString; -#else - typedef AString CSysString; -#endif - -typedef CObjectVector CSysStringVector; - -#endif diff --git a/od-win32/7z/StringConvert.h b/od-win32/7z/StringConvert.h deleted file mode 100755 index 982fb897..00000000 --- a/od-win32/7z/StringConvert.h +++ /dev/null @@ -1,72 +0,0 @@ -// Common/StringConvert.h - -#pragma once - -#ifndef __COMMON_STRINGCONVERT_H -#define __COMMON_STRINGCONVERT_H - -#include "String.h" -#include "Types.h" - -UString MultiByteToUnicodeString(const AString &srcString, UINT codePage = CP_ACP); -AString UnicodeStringToMultiByte(const UString &srcString, UINT codePage = CP_ACP); - -inline const wchar_t* GetUnicodeString(const wchar_t* unicodeString) - { return unicodeString; } -inline const UString& GetUnicodeString(const UString &unicodeString) - { return unicodeString; } -inline UString GetUnicodeString(const AString &ansiString) - { return MultiByteToUnicodeString(ansiString); } -inline UString GetUnicodeString(const AString &multiByteString, UINT codePage) - { return MultiByteToUnicodeString(multiByteString, codePage); } -inline const wchar_t* GetUnicodeString(const wchar_t* unicodeString, UINT codePage) - { return unicodeString; } -inline const UString& GetUnicodeString(const UString &unicodeString, UINT codePage) - { return unicodeString; } - -inline const char* GetAnsiString(const char* ansiString) - { return ansiString; } -inline const AString& GetAnsiString(const AString &ansiString) - { return ansiString; } -inline AString GetAnsiString(const UString &unicodeString) - { return UnicodeStringToMultiByte(unicodeString); } - -inline const char* GetOemString(const char* oemString) - { return oemString; } -inline const AString& GetOemString(const AString &oemString) - { return oemString; } -inline AString GetOemString(const UString &unicodeString) - { return UnicodeStringToMultiByte(unicodeString, CP_OEMCP); } - - -#ifdef _UNICODE - inline const wchar_t* GetSystemString(const wchar_t* unicodeString) - { return unicodeString;} - inline const UString& GetSystemString(const UString &unicodeString) - { return unicodeString;} - inline const wchar_t* GetSystemString(const wchar_t* unicodeString, UINT codePage) - { return unicodeString;} - inline const UString& GetSystemString(const UString &unicodeString, UINT codePage) - { return unicodeString;} - inline UString GetSystemString(const AString &multiByteString, UINT codePage) - { return MultiByteToUnicodeString(multiByteString, codePage);} - inline UString GetSystemString(const AString &multiByteString) - { return MultiByteToUnicodeString(multiByteString);} -#else - inline const char* GetSystemString(const char *ansiString) - { return ansiString; } - inline const AString& GetSystemString(const AString &multiByteString, UINT codePage) - { return multiByteString; } - inline const char * GetSystemString(const char *multiByteString, UINT codePage) - { return multiByteString; } - inline AString GetSystemString(const UString &unicodeString) - { return UnicodeStringToMultiByte(unicodeString); } - inline AString GetSystemString(const UString &unicodeString, UINT codePage) - { return UnicodeStringToMultiByte(unicodeString, codePage); } -#endif - -#ifndef _WIN32_WCE -AString SystemStringToOemString(const CSysString &srcString); -#endif - -#endif diff --git a/od-win32/7z/Types.h b/od-win32/7z/Types.h deleted file mode 100755 index 02853e0d..00000000 --- a/od-win32/7z/Types.h +++ /dev/null @@ -1,19 +0,0 @@ -// Common/Types.h - -// #pragma once - -#ifndef __COMMON_TYPES_H -#define __COMMON_TYPES_H - -#include - -typedef unsigned char UINT8; -typedef unsigned short UINT16; -typedef short INT16; -#ifndef _WINDOWS_ - // typedef unsigned long UINT32; - typedef UINT8 BYTE; -#endif - -#endif - diff --git a/od-win32/7z/Vector.h b/od-win32/7z/Vector.h deleted file mode 100755 index 051d4e46..00000000 --- a/od-win32/7z/Vector.h +++ /dev/null @@ -1,177 +0,0 @@ -// Common/Vector.h - -#pragma once - -#ifndef __COMMON_VECTOR_H -#define __COMMON_VECTOR_H - -#include "Defs.h" - -class CBaseRecordVector -{ - void MoveItems(int destIndex, int srcIndex); -protected: - int _capacity; - int _size; - void *_items; - size_t _itemSize; - - void ReserveOnePosition(); - void InsertOneItem(int index); - void TestIndexAndCorrectNum(int index, int &num) const - { if (index + num > _size) num = _size - index; } -public: - CBaseRecordVector(size_t itemSize): - _size(0), _capacity(0), _items(0), _itemSize(itemSize) {} - virtual ~CBaseRecordVector(); - int Size() const { return _size; } - bool IsEmpty() const { return (_size == 0); } - void Reserve(int newCapacity); - virtual void Delete(int index, int num = 1); - void Clear(); - void DeleteFrom(int index); - void DeleteBack(); -}; - -template -class CRecordVector: public CBaseRecordVector -{ -public: - CRecordVector():CBaseRecordVector(sizeof(T)){}; - CRecordVector(const CRecordVector &v): - CBaseRecordVector(sizeof(T)) { *this = v;} - CRecordVector& operator=(const CRecordVector &v) - { - Clear(); - return (*this += v); - } - CRecordVector& operator+=(const CRecordVector &v) - { - int size = v.Size(); - Reserve(Size() + size); - for(int i = 0; i < size; i++) - Add(v[i]); - return *this; - } - int Add(T item) - { - ReserveOnePosition(); - ((T *)_items)[_size] = item; - return _size++; - } - void Insert(int index, T item) - { - InsertOneItem(index); - ((T *)_items)[index] = item; - } - // T* GetPointer() const { return (T*)_items; } - // operator const T *() const { return _items; }; - const T& operator[](int index) const { return ((T *)_items)[index]; } - T& operator[](int index) { return ((T *)_items)[index]; } - const T& Front() const { return operator[](0); } - T& Front() { return operator[](0); } - const T& Back() const { return operator[](_size - 1); } - T& Back() { return operator[](_size - 1); } - static int __cdecl CompareRecordItems(const void *a1, const void *a2) - { return MyCompare(*((const T *)a1), *((const T *)a2)); } - void Sort() - { qsort(&Front(), Size(), _itemSize, CompareRecordItems); } -}; - -typedef CRecordVector CIntVector; -typedef CRecordVector CUIntVector; -typedef CRecordVector CBoolVector; -typedef CRecordVector CByteVector; -typedef CRecordVector CPointerVector; - -template -class CObjectVector: public CPointerVector -{ -public: - CObjectVector(){}; - ~CObjectVector() { Clear(); } - CObjectVector(const CObjectVector &objectVector) - { *this = objectVector; } - CObjectVector& operator=(const CObjectVector &objectVector) - { - Clear(); - return (*this += objectVector); - } - CObjectVector& operator+=(const CObjectVector &objectVector) - { - int size = objectVector.Size(); - Reserve(Size() + size); - for(int i = 0; i < size; i++) - Add(objectVector[i]); - return *this; - } - const T& operator[](int index) const { return *((T *)CPointerVector::operator[](index)); } - T& operator[](int index) { return *((T *)CPointerVector::operator[](index)); } - T& Front() { return operator[](0); } - const T& Front() const { return operator[](0); } - T& Back() { return operator[](_size - 1); } - const T& Back() const { return operator[](_size - 1); } - int Add(const T& item) - { return CPointerVector::Add(new T(item)); } - void Insert(int index, const T& item) - { CPointerVector::Insert(index, new T(item)); } - virtual void Delete(int index, int num = 1) - { - TestIndexAndCorrectNum(index, num); - for(int i = 0; i < num; i++) - delete (T *)(((void **)_items)[index + i]); - CPointerVector::Delete(index, num); - } - int Find(const T& item) const - { - for(int i = 0; i < Size(); i++) - if (item == (*this)[mid]) - return i; - return -1; - } - int FindInSorted(const T& item) const - { - int left = 0, right = Size(); - while (left != right) - { - int mid = (left + right) / 2; - const T& midValue = (*this)[mid]; - if (item == midValue) - return mid; - if (item < midValue) - right = mid; - else - left = mid + 1; - } - return -1; - } - int AddToSorted(const T& item) - { - int left = 0, right = Size(); - while (left != right) - { - int mid = (left + right) / 2; - const T& midValue = (*this)[mid]; - if (item == midValue) - { - right = mid + 1; - break; - } - if (item < midValue) - right = mid; - else - left = mid + 1; - } - Insert(right, item); - return right; - } - static int __cdecl CompareObjectItems(const void *a1, const void *a2) - { return MyCompare(*(*((const T **)a1)), *(*((const T **)a2))); } - void Sort() - { - CPointerVector &pointerVector = *this; - qsort(&pointerVector[0], Size(), sizeof(void *), CompareObjectItems); - } -}; - -#endif diff --git a/od-win32/7z/win32_decompress.cpp b/od-win32/7z/win32_decompress.cpp deleted file mode 100755 index 708e2ac4..00000000 --- a/od-win32/7z/win32_decompress.cpp +++ /dev/null @@ -1,76 +0,0 @@ - /* - * UAE - The Un*x Amiga Emulator - * - * 7z decompression library support - * - */ - -#include "sysconfig.h" -#include "sysdeps.h" - -#include -#include -#include - -#include "config.h" -#include "options.h" -#include "zfile.h" - -#include "IArchive.h" -#include "DLL.h" -#include "MyCom.h" -#include "FileStreams.h" -#include "PropVariant.h" -#include "PropVariantConversions.h" -#include "StringConvert.h" - -typedef UINT32 (WINAPI * CreateObjectFunc)( - const GUID *clsID, - const GUID *interfaceID, - void **outObject); - -DEFINE_GUID (CLSID_CFormat7z, 0x23170F69, 0x40C1, 0x278A, 0x10, 0x00, 0x00, 0x01, 0x10, 0x05, 0x00, 0x00); - -void test7z (void) -{ - NWindows::NDLL::CLibrary library; - if (!library.Load("7z.dll")) - { - return; - } - CreateObjectFunc createObjectFunc = (CreateObjectFunc)library.GetProcAddress("CreateObject"); - CMyComPtr archive; - if (createObjectFunc(&CLSID_CFormat7z, - &IID_IInArchive, (void **)&archive) != S_OK) - { - return; - } - - CInFileStream *fileSpec = new CInFileStream; - CMyComPtr file = fileSpec; - - if (!fileSpec->Open("test.7z")) - { - return; - } - if (archive->Open(file, 0, 0) != S_OK) - return; - UINT32 numItems = 0; - archive->GetNumberOfItems(&numItems); - for (UINT32 i = 0; i < numItems; i++) - { - NWindows::NCOM::CPropVariant propVariant; - archive->GetProperty(i, kpidPath, &propVariant); - UString s = ConvertPropVariantToString(propVariant); - printf("%s\n", (LPCSTR)GetOemString(s)); - } -} - - - - - - - - - \ No newline at end of file diff --git a/od-win32/7zplugin.c b/od-win32/7zplugin.c new file mode 100755 index 00000000..9610fad1 --- /dev/null +++ b/od-win32/7zplugin.c @@ -0,0 +1,127 @@ + /* + * UAE - The Un*x Amiga Emulator + * + * 7-zip DLL-plugin support + * + * (c) 2004 Toni Wilen + * + */ + +#include "sysconfig.h" +#include "sysdeps.h" + +#include "config.h" +#include "options.h" +#include "zfile.h" +#include "unzip.h" +#include "disk.h" +#include "dms/pfile.h" +#include "gui.h" +#include "crc32.h" + +#include + +struct FileInArchiveInfo { + int ArchiveHandle; + uae_u64 CompressedFileSize; + uae_u64 UncompressedFileSize; + int attributes; + int IsDir; + FILETIME LastWriteTime; + char path[MAX_DPATH]; +}; + +typedef HRESULT (__stdcall *ReadCallback)(int StreamID, uae_u64 offset, uae_u32 count, void* buf, uae_u32 *processedSize); +typedef HRESULT (__stdcall *WriteCallback)(int StreamID, uae_u32 count, const void *buf, uae_u32 *processedSize); + +typedef int (CALLBACK *pOpenArchive)(ReadCallback function, int StreamID, uae_u64 FileSize, int ArchiveType, int *result); +static pOpenArchive openArchive; +typedef int (CALLBACK *pGetFileCount)(int ArchiveHandle); +static pGetFileCount getFileCount; +typedef int (CALLBACK *pGetFileInfo)(int ArchiveHandle, int FileNum, struct FileInArchiveInfo *FileInfo); +static pGetFileInfo getFileInfo; +typedef int (CALLBACK *pExtract)(int ArchiveHandle, int FileNum, int StreamID, WriteCallback WriteFunc); +static pExtract extract; +typedef int (CALLBACK *pCloseArchive)(int ArchiveHandle); +static pCloseArchive closeArchive; + +static HRESULT __stdcall readCallback (int StreamID, uae_u64 offset, uae_u32 count, void* buf, uae_u32 *processedSize) +{ + FILE *f = (FILE*)StreamID; + int ret; + + fseek (f, (long)offset, SEEK_SET); + ret = fread (buf, 1, count, f); + if (processedSize) + *processedSize = ret; + return S_OK; +} +HRESULT __stdcall writeCallback (int StreamID, uae_u32 count, const void* buf, uae_u32 *processedSize) +{ + return 0; +} + +static HMODULE arcacc_mod; + +void arcacc_free (void) +{ + if (arcacc_mod) + FreeLibrary (arcacc_mod); + arcacc_mod = NULL; +} + +int arcacc_init (void) +{ + if (arcacc_mod) + return 1; + arcacc_mod = LoadLibrary ("archiveaccess-debug.dll"); + if (!arcacc_mod) + return 0; + openArchive = (pOpenArchive) GetProcAddress (arcacc_mode, "openArchive"); + getFileCount = (pGetFileCount) GetProcAddress (arcacc_mode, "getFileCount"); + getFileInfo = (pGetFileInfo) GetProcAddress (arcacc_mode, "getFileInfo"); + extract = (pExtract) GetProcAddress (arcacc_mode, "extract"); + closeArchive = (pCloseArchive) GetProcAddress (arcacc_mode, "closeArchive"); + if (!OpenArchive || !getFileCount || !getFileInfo || !extract || !closeArchive) { + arcacc_free (); + return 0; + } + return 1; +} + +void test (void) +{ + int ah, i; + uae_u64 size; + int status; + FILE *f; + struct FileInArchiveInfo fi; + + if (!arcacc_init ()) + return; + + f = fopen ("d:\\amiga\\test.7z", "rb"); + fseek (f, 0, SEEK_END); + size = ftell (f); + fseek (f, 0, SEEK_SET); + + ah = openArchive (readCallback, (int)f, size, 7, &status); + if (1 || status == 0) { + int fc = getFileCount (ah); + for (i = 0; i < fc; i++) { + memset (&fi, 0, sizeof (fi)); + getFileInfo (ah, i, &fi); + } + closeArchive (ah); + } + FreeLibrary (m); +} + + + + + + + + + diff --git a/od-win32/avioutput.c b/od-win32/avioutput.c index 8caab8e4..9c6a4f96 100755 --- a/od-win32/avioutput.c +++ b/od-win32/avioutput.c @@ -31,8 +31,6 @@ #include "resource.h" #include "avioutput.h" -static int newmode = 1; - #define MAX_AVI_SIZE (0x80000000 - 0x1000000) static int avioutput_init = 0; @@ -260,11 +258,9 @@ LPSTR AVIOutput_ChooseVideoCodec(HWND hwnd) AVIOutput_ReleaseVideo(); - if (newmode) { - avioutput_width = workprefs.gfx_width; - avioutput_height = workprefs.gfx_height; - avioutput_bits = workprefs.color_mode == 2 ? 16 : workprefs.color_mode > 2 ? 32 : 8; - } + avioutput_width = workprefs.gfx_width; + avioutput_height = workprefs.gfx_height; + avioutput_bits = workprefs.color_mode == 2 ? 16 : workprefs.color_mode > 2 ? 32 : 8; if(!(lpbi = (LPBITMAPINFOHEADER) malloc(sizeof(BITMAPINFOHEADER) + (((avioutput_bits <= 8) ? 1 << avioutput_bits : 0) * sizeof(RGBQUAD))))) return NULL; @@ -547,13 +543,9 @@ void AVIOutput_WriteVideo(void) if(!avioutput_init) goto error; - if (newmode) { - actual_width = gfxvidinfo.width; - actual_height = gfxvidinfo.height; - } else { - actual_width = WIN32GFX_GetWidth(); - actual_height = WIN32GFX_GetHeight(); - } + actual_width = gfxvidinfo.width; + actual_height = gfxvidinfo.height; + #if defined (GFXFILTER) if (!usedfilter || (usedfilter && usedfilter->x[0]) || WIN32GFX_IsPicassoScreen ()) v = getFromDC((LPBITMAPINFO)lpbi); diff --git a/od-win32/build68k_msvc/build68k_msvc.vcproj b/od-win32/build68k_msvc/build68k_msvc.vcproj index 9a00c02c..991a29fa 100755 --- a/od-win32/build68k_msvc/build68k_msvc.vcproj +++ b/od-win32/build68k_msvc/build68k_msvc.vcproj @@ -136,6 +136,68 @@ + + + + + + + + + + + + + + + diff --git a/od-win32/caps/caps_win32.c b/od-win32/caps/caps_win32.c index 831fbb32..9796f81f 100755 --- a/od-win32/caps/caps_win32.c +++ b/od-win32/caps/caps_win32.c @@ -7,16 +7,37 @@ #include "caps_win32.h" #include "zfile.h" #include "gui.h" +#include "win32.h" #include "ComType.h" #include "CapsAPI.h" -#include "CapsLib.h" static SDWORD caps_cont[4]= {-1, -1, -1, -1}; static int caps_locked[4]; static int caps_flags = DI_LOCK_DENVAR|DI_LOCK_DENNOISE|DI_LOCK_NOISE|DI_LOCK_UPDATEFD|DI_LOCK_TYPE; #define LIB_TYPE 1 +typedef SDWORD (__cdecl* CAPSINIT)(void); +static CAPSINIT pCAPSInit; +typedef SDWORD (__cdecl* CAPSADDIMAGE)(void); +static CAPSADDIMAGE pCAPSAddImage; +typedef SDWORD (__cdecl* CAPSLOCKIMAGEMEMORY)(SDWORD,PUBYTE,UDWORD,UDWORD); +static CAPSLOCKIMAGEMEMORY pCAPSLockImageMemory; +typedef SDWORD (__cdecl* CAPSUNLOCKIMAGE)(SDWORD); +static CAPSUNLOCKIMAGE pCAPSUnlockImage; +typedef SDWORD (__cdecl* CAPSLOADIMAGE)(SDWORD,UDWORD); +static CAPSLOADIMAGE pCAPSLoadImage; +typedef SDWORD (__cdecl* CAPSGETIMAGEINFO)(PCAPSIMAGEINFO,SDWORD); +static CAPSGETIMAGEINFO pCAPSGetImageInfo; +typedef SDWORD (__cdecl* CAPSLOCKTRACK)(PCAPSTRACKINFO,SDWORD,UDWORD,UDWORD,UDWORD); +static CAPSLOCKTRACK pCAPSLockTrack; +typedef SDWORD (__cdecl* CAPSUNLOCKTRACK)(SDWORD,UDWORD); +static CAPSUNLOCKTRACK pCAPSUnlockTrack; +typedef SDWORD (__cdecl* CAPSUNLOCKALLTRACKS)(SDWORD); +static CAPSUNLOCKALLTRACKS pCAPSUnlockAllTracks; +typedef SDWORD (__cdecl* CAPSGETVERSIONINFO)(PCAPSVERSIONINFO,UDWORD); +static CAPSGETVERSIONINFO pCAPSGetVersionInfo; + int caps_init (void) { static int init, noticed; @@ -24,8 +45,9 @@ int caps_init (void) HMODULE h; struct CapsVersionInfo cvi; - if (init) return 1; - h = LoadLibrary ("CAPSImg.dll"); + if (init) + return 1; + h = WIN32_LoadLibrary ("CAPSImg.dll"); if (!h) { if (noticed) return 0; @@ -40,13 +62,22 @@ int caps_init (void) noticed = 1; return 0; } - FreeLibrary (h); + pCAPSInit = (CAPSINIT)GetProcAddress (h, "CAPSInit"); + pCAPSAddImage = (CAPSADDIMAGE)GetProcAddress (h, "CAPSAddImage"); + pCAPSLockImageMemory = (CAPSLOCKIMAGEMEMORY)GetProcAddress (h, "CAPSLockImageMemory"); + pCAPSUnlockImage = (CAPSUNLOCKIMAGE)GetProcAddress (h, "CAPSUnlockImage"); + pCAPSLoadImage = (CAPSLOADIMAGE)GetProcAddress (h, "CAPSLoadImage"); + pCAPSGetImageInfo = (CAPSGETIMAGEINFO)GetProcAddress (h, "CAPSGetImageInfo"); + pCAPSLockTrack = (CAPSLOCKTRACK)GetProcAddress (h, "CAPSLockTrack"); + pCAPSUnlockTrack = (CAPSUNLOCKTRACK)GetProcAddress (h, "CAPSUnlockTrack"); + pCAPSUnlockAllTracks = (CAPSUNLOCKALLTRACKS)GetProcAddress (h, "CAPSUnlockAllTracks"); + pCAPSGetVersionInfo = (CAPSGETVERSIONINFO)GetProcAddress (h, "CAPSGetVersionInfo"); init = 1; cvi.type = LIB_TYPE; - CAPSGetVersionInfo (&cvi, 0); + pCAPSGetVersionInfo (&cvi, 0); write_log ("CAPS: library version %d.%d\n", cvi.release, cvi.revision); for (i = 0; i < 4; i++) - caps_cont[i] = CAPSAddImage(); + caps_cont[i] = pCAPSAddImage(); return 1; } @@ -54,8 +85,8 @@ void caps_unloadimage (int drv) { if (!caps_locked[drv]) return; - CAPSUnlockAllTracks (caps_cont[drv]); - CAPSUnlockImage (caps_cont[drv]); + pCAPSUnlockAllTracks (caps_cont[drv]); + pCAPSUnlockImage (caps_cont[drv]); caps_locked[drv] = 0; } @@ -78,16 +109,16 @@ int caps_loadimage (struct zfile *zf, int drv, int *num_tracks) return 0; if (zfile_fread (buf, len, 1, zf) == 0) return 0; - ret = CAPSLockImageMemory(caps_cont[drv], buf, len, 0); + ret = pCAPSLockImageMemory(caps_cont[drv], buf, len, 0); free (buf); if (ret != imgeOk) { free (buf); return 0; } caps_locked[drv] = 1; - CAPSGetImageInfo(&ci, caps_cont[drv]); + pCAPSGetImageInfo(&ci, caps_cont[drv]); *num_tracks = (ci.maxcylinder - ci.mincylinder + 1) * (ci.maxhead - ci.minhead + 1); - CAPSLoadImage(caps_cont[drv], caps_flags); + pCAPSLoadImage(caps_cont[drv], caps_flags); cdt = &ci.crdt; sprintf (s1, "%d.%d.%d %d:%d:%d", cdt->day, cdt->month, cdt->year, cdt->hour, cdt->min, cdt->sec); write_log ("caps: type:%d date:%s rel:%d rev:%d\n", @@ -110,7 +141,7 @@ static void outdisk (void) if (!f) return; for (tr = 0; tr < 160; tr++) { - CAPSLockTrack(&ci, caps_cont[0], tr / 2, tr & 1, caps_flags); + pCAPSLockTrack(&ci, caps_cont[0], tr / 2, tr & 1, caps_flags); fwrite (ci.trackdata[0], ci.tracksize[0], 1, f); fwrite ("XXXX", 4, 1, f); } @@ -125,7 +156,7 @@ int caps_loadrevolution (uae_u16 *mfmbuf, int drv, int track, int *tracklength) struct CapsTrackInfoT1 ci; ci.type = LIB_TYPE; - CAPSLockTrack((PCAPSTRACKINFO)&ci, caps_cont[drv], track / 2, track & 1, caps_flags); + pCAPSLockTrack((PCAPSTRACKINFO)&ci, caps_cont[drv], track / 2, track & 1, caps_flags); len = ci.tracklen; *tracklength = len * 8; mfm = mfmbuf; @@ -144,7 +175,7 @@ int caps_loadtrack (uae_u16 *mfmbuf, uae_u16 *tracktiming, int drv, int track, i ci.type = LIB_TYPE; *tracktiming = 0; - CAPSLockTrack((PCAPSTRACKINFO)&ci, caps_cont[drv], track / 2, track & 1, caps_flags); + pCAPSLockTrack((PCAPSTRACKINFO)&ci, caps_cont[drv], track / 2, track & 1, caps_flags); mfm = mfmbuf; *multirev = (ci.type & CTIT_FLAG_FLAKEY) ? 1 : 0; type = ci.type & CTIT_MASK_TYPE; diff --git a/od-win32/genblitter_msvc/genblitter_msvc.vcproj b/od-win32/genblitter_msvc/genblitter_msvc.vcproj index a2a121c0..2fe497ec 100755 --- a/od-win32/genblitter_msvc/genblitter_msvc.vcproj +++ b/od-win32/genblitter_msvc/genblitter_msvc.vcproj @@ -152,6 +152,76 @@ del ..\..\blittable.c + + + + + + + + + + + + + + + diff --git a/od-win32/gencomp_msvc/gencomp_msvc.vcproj b/od-win32/gencomp_msvc/gencomp_msvc.vcproj index d5b68360..d5122b9a 100755 --- a/od-win32/gencomp_msvc/gencomp_msvc.vcproj +++ b/od-win32/gencomp_msvc/gencomp_msvc.vcproj @@ -137,6 +137,68 @@ od-win32\gencomp_msvc\gencomp.exe + + + + + + + + + + + + + + + diff --git a/od-win32/gencpu_msvc/gencpu_msvc.vcproj b/od-win32/gencpu_msvc/gencpu_msvc.vcproj index 7a3479be..767fab6a 100755 --- a/od-win32/gencpu_msvc/gencpu_msvc.vcproj +++ b/od-win32/gencpu_msvc/gencpu_msvc.vcproj @@ -130,6 +130,73 @@ od-win32\gencpu_msvc\gencpu.exe CommandLine="del ..\..\cputbl.h del ..\..\cpustbl.c del ..\..\cpuemu.c +"/> + + + + + + + + + + + + + + + +#include "win32.h" + +typedef bool (_stdcall* INITIALIZEWINIO)(void); +static INITIALIZEWINIO pInitializeWinIo; +typedef void (_stdcall* SHUTDOWNWINIO)(void); +static SHUTDOWNWINIO pShutdownWinIo; +typedef bool (_stdcall* GETPORTVAL)(WORD,PDWORD,BYTE); +static GETPORTVAL pGetPortVal; +typedef bool (_stdcall* SETPORTVAL)(WORD,DWORD,BYTE); +static SETPORTVAL pSetPortVal; +static HMODULE ioh; #ifndef IOPORT_EMU #include @@ -23,8 +34,20 @@ int ioport_init (void) if (initialized) return 1; #ifndef IOPORT_EMU + ioh = WIN32_LoadLibrary ("winio.dll"); + if (!ioh) + return 0; + pInitializeWinIo = (INITIALIZEWINIO)GetProcAddress (ioh, "InitializeWinIo"); + pShutdownWinIo = (SHUTDOWNWINIO)GetProcAddress (ioh, "ShutdownWinIo"); + pGetPortVal = (GETPORTVAL)GetProcAddress (ioh, "GetPortVal"); + pSetPortVal = (SETPORTVAL)GetProcAddress (ioh, "SetPortVal"); + if (!pInitializeWinIo || !pShutdownWinIo || !pGetPortVal || !pSetPortVal) { + io_log ("incompatible winio.dll\n"); + FreeLibrary (ioh); + return 0; + } __try { - initialized = InitializeWinIo(); + initialized = pInitializeWinIo(); } __except (EXCEPTION_EXECUTE_HANDLER) { initialized = 0; } @@ -38,8 +61,10 @@ int ioport_init (void) void ioport_free (void) { #ifndef IOPORT_EMU - if (initialized) - ShutdownWinIo(); + if (initialized) { + pShutdownWinIo(); + FreeLibrary (ioh); + } #endif io_log ("io freed\n"); initialized = 0; @@ -49,7 +74,7 @@ uae_u8 ioport_read (int port) { DWORD v = 0; #ifndef IOPORT_EMU - GetPortVal (port, &v, 1); + pGetPortVal (port, &v, 1); #endif io_log ("ioport_read %04.4X returned %02.2X\n", port, v); return (uae_u8)v; @@ -58,7 +83,7 @@ uae_u8 ioport_read (int port) void ioport_write (int port, uae_u8 v) { #ifndef IOPORT_EMU - SetPortVal (port, v, 1); + pSetPortVal (port, v, 1); #endif io_log ("ioport_write %04.4X %02.2X\n", port, v); } @@ -107,7 +132,7 @@ int paraport_init (void) HANDLE pp; paraport_free (); - para = LoadLibrary("ParaPort.dll"); + para = WIN32_LoadLibrary("ParaPort.dll"); if (!para) { write_log ("PARAPORT: no ParaPort.dll, direct parallel port emulation disabled\n"); return 0; diff --git a/od-win32/parser.c b/od-win32/parser.c index afb67296..2d686111 100755 --- a/od-win32/parser.c +++ b/od-win32/parser.c @@ -7,6 +7,8 @@ * Copyright 1998-1999 Brian King - added MIDI output support */ +//#define PS_PRINT_DUMP + #include "config.h" #include "sysconfig.h" #include @@ -62,7 +64,7 @@ static volatile int prt_running; static volatile int prt_started; static smp_comm_pipe prt_requests; -#ifdef PRINT_DUMP +#ifdef PS_PRINT_DUMP static struct zfile *prtdump; #endif @@ -139,7 +141,7 @@ static int openprinter_ps (void) write_log("GS crashed\n"); return 0; } - psmode = 1; + psmode = 1; return 1; } @@ -197,11 +199,10 @@ static void flushprtbuf (void) if (!prtbufbytes) return; -#ifdef PRINT_DUMP +#ifdef PS_PRINT_DUMP if (prtdump) zfile_fwrite (prtbuf, prtbufbytes, 1, prtdump); #endif - if (currprefs.parallel_postscript_emulation) { if (psmode) { uae_u8 *p; @@ -248,6 +249,10 @@ static void DoSomeWeirdPrintingStuff (char val) prtbufbytes = 1; flushprtbuf (); write_log ("PostScript end detected..\n"); +#ifdef PS_PRINT_DUMP + zfile_fclose (prtdump); + prtdump = NULL; +#endif if (currprefs.parallel_postscript_emulation) { prt_started = 0; if (uae_start_thread (prt_thread, psbuffer, &prt_tid)) { @@ -262,11 +267,14 @@ static void DoSomeWeirdPrintingStuff (char val) freepsbuffers (); return; } else if (!psmode && !stricmp (prev, "%!PS")) { +#ifdef PS_PRINT_DUMP + prtdump = zfile_fopen ("psdump.dat", "wb"); +#endif psmode = 1; psbuffer = malloc (sizeof (uae_u8*)); psbuffer[0] = 0; psbuffers = 0; - strcpy (prtbuf, "%!PS\n"); + strcpy (prtbuf, "%!PS"); prtbufbytes = strlen (prtbuf); flushprtbuf (); write_log ("PostScript start detected..\n"); @@ -307,7 +315,7 @@ int load_ghostscript (void) if (gsdll) return 1; - gsdll = LoadLibrary ("gsdll32.dll"); + gsdll = WIN32_LoadLibrary ("gsdll32.dll"); if (!gsdll) { if (GetEnvironmentVariable ("GS_DLL", path, sizeof (path))) gsdll = LoadLibrary (path); @@ -387,9 +395,6 @@ void openprinter( void ) closeprinter (); if (!strcasecmp(currprefs.prtname,"none")) return; -#ifdef PRINT_DUMP - prtdump = zfile_fopen ("c:\\prtdump.dat", "wb"); -#endif if (currprefs.parallel_postscript_emulation) { prtopen = 1; diff --git a/od-win32/resources/resource.h b/od-win32/resources/resource.h index 2ac43003..db95a3c6 100755 --- a/od-win32/resources/resource.h +++ b/od-win32/resources/resource.h @@ -211,6 +211,8 @@ #define IDS_NOHARDDRIVES 240 #define IDS_DEFAULT_HOST 241 #define IDS_SOUND_4CHANNEL 242 +#define IDS_HF_FS_CUSTOM 243 +#define IDS_SELECTFS 244 #define IDS_NUMSG_NEEDEXT2 300 #define IDS_NUMSG_NOROMKEY 301 #define IDS_NUMSG_KSROMCRCERROR 302 @@ -267,7 +269,6 @@ #define IDC_FASTMEM 1027 #define IDC_SHOWLEDS 1027 #define IDC_PORT1_JOYS 1027 -#define IDC_PRINTERLIST2 1028 #define IDC_SLOWMEM 1030 #define IDC_PARALLEL 1033 #define IDC_JULIAN 1040 @@ -452,9 +453,12 @@ #define IDC_EDITPATH 1410 #define IDC_HDF_RDB 1500 #define IDC_HFSIZE 1501 +#define IDC_HF_SIZE 1501 #define IDC_LINEMODE 1502 #define IDC_CREATEHF 1502 +#define IDC_HF_CREATE 1502 #define IDC_SOCKETS 1503 +#define IDC_HF_DOSTYPE 1503 #define IDC_RESETAMIGA 1504 #define IDC_QUITEMU 1505 #define IDC_TEST16BIT 1506 @@ -783,6 +787,7 @@ #define IDC_FILTERVZV 1695 #define IDC_PS_PARAMS 1695 #define IDC_FILTERHZV 1696 +#define IDC_HF_TYPE 1696 #define ID__FLOPPYDRIVES 40004 #define ID_FLOPPYDRIVES_DF0 40005 #define ID_ST_CONFIGURATION 40010 @@ -803,7 +808,7 @@ #define _APS_3D_CONTROLS 1 #define _APS_NEXT_RESOURCE_VALUE 245 #define _APS_NEXT_COMMAND_VALUE 40021 -#define _APS_NEXT_CONTROL_VALUE 1696 +#define _APS_NEXT_CONTROL_VALUE 1697 #define _APS_NEXT_SYMED_VALUE 101 #endif #endif diff --git a/od-win32/resources/winuae.rc b/od-win32/resources/winuae.rc index 2e54d478..4bcc4313 100755 --- a/od-win32/resources/winuae.rc +++ b/od-win32/resources/winuae.rc @@ -563,23 +563,23 @@ BEGIN WS_VSCROLL | WS_TABSTOP END -IDD_HARDFILE DIALOGEX 0, 0, 299, 180 +IDD_HARDFILE DIALOGEX 0, 0, 299, 212 STYLE DS_SETFONT | DS_MODALFRAME | DS_SETFOREGROUND | DS_3DLOOK | DS_CENTER | DS_CENTERMOUSE | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU CAPTION "Hardfile Settings" FONT 8, "MS Sans Serif", 0, 0, 0x0 BEGIN GROUPBOX "Hard File Settings",IDC_STATIC,10,5,280,113 - RTEXT "Path:",IDC_HARDFILE_DIR_TEXT,19,21,22,10 - EDITTEXT IDC_PATH_NAME,44,15,222,15,ES_AUTOHSCROLL + RTEXT "Path:",IDC_HARDFILE_DIR_TEXT,26,18,22,10 + EDITTEXT IDC_PATH_NAME,52,15,213,15,ES_AUTOHSCROLL PUSHBUTTON "...",IDC_SELECTOR,271,15,11,15 - RTEXT "FileSys:",IDC_HARDFILE_FILESYS_TEXT,16,36,26,10 - EDITTEXT IDC_PATH_FILESYS,44,34,221,15,ES_AUTOHSCROLL + RTEXT "Filesystem:",IDC_HARDFILE_FILESYS_TEXT,14,37,34,10 + EDITTEXT IDC_PATH_FILESYS,52,34,213,15,ES_AUTOHSCROLL PUSHBUTTON "...",IDC_FILESYS_SELECTOR,271,34,11,15 - RTEXT "Device:",IDC_HARDFILE_DEVICE_TEXT,16,58,25,10 - EDITTEXT IDC_HARDFILE_DEVICE,44,54,40,15,ES_AUTOHSCROLL - RTEXT "BootPri:",IDC_HARDFILE_BOOTPRI_TEXT,11,80,30,8 - EDITTEXT IDC_HARDFILE_BOOTPRI,44,75,40,15 + RTEXT "Device:",IDC_HARDFILE_DEVICE_TEXT,17,58,31,10 + EDITTEXT IDC_HARDFILE_DEVICE,52,54,40,15,ES_AUTOHSCROLL + RTEXT "BootPri:",IDC_HARDFILE_BOOTPRI_TEXT,18,79,30,8 + EDITTEXT IDC_HARDFILE_BOOTPRI,52,75,40,15 CONTROL "Read/Write",IDC_RW,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,110,57,50,10 PUSHBUTTON "Enable RDB-mode",IDC_HDF_RDB,192,55,92,14 @@ -591,12 +591,17 @@ BEGIN EDITTEXT IDC_SECTORS,147,96,35,15,ES_NUMBER RTEXT "Block-Size:",IDC_BLOCKSIZE_TEXT,197,101,35,10 EDITTEXT IDC_BLOCKSIZE,237,96,35,15,ES_NUMBER - GROUPBOX "New Hard File",IDC_STATIC,10,120,280,35 - PUSHBUTTON "Create",IDC_CREATEHF,40,135,85,14 - EDITTEXT IDC_HFSIZE,141,135,61,15,ES_NUMBER - LTEXT "MB",IDC_RESERVED_TEXT2,214,138,39,9,NOT WS_GROUP - PUSHBUTTON "OK",IDOK,102,161,50,14 - PUSHBUTTON "Cancel",IDCANCEL,158,161,50,14 + GROUPBOX "New Hard File",IDC_STATIC,10,120,280,62 + PUSHBUTTON "Create",IDC_HF_CREATE,50,135,80,14 + EDITTEXT IDC_HF_SIZE,146,135,61,15,ES_NUMBER + PUSHBUTTON "OK",IDOK,102,191,50,14 + PUSHBUTTON "Cancel",IDCANCEL,158,191,50,14 + EDITTEXT IDC_HF_DOSTYPE,146,158,61,15 + COMBOBOX IDC_HF_TYPE,50,158,80,150,CBS_DROPDOWNLIST | + CBS_HASSTRINGS | WS_VSCROLL | WS_TABSTOP + RTEXT "DosType",IDC_STATIC,212,160,30,10,SS_CENTERIMAGE + RTEXT "Megabytes",IDC_STATIC,212,138,35,10,SS_CENTERIMAGE + RTEXT "Type:",IDC_STATIC,18,160,25,10,SS_CENTERIMAGE END IDD_FILESYS DIALOGEX 15, 25, 299, 111 @@ -1226,7 +1231,7 @@ BEGIN IDS_SELECTFILESYSROOT "Please select your file-system root directory..." IDS_DEFAULTMIDIOUT "Default MIDI-Out Device" IDS_CONTRIBUTORS1 "Bernd Schmidt - The Grand-Master\nSam Jordan - Custom-chip, floppy-DMA, etc.\nMathias Ortmann - Original WinUAE Main Guy, BSD Socket support\nBrian King - Picasso96 Support, Integrated GUI for WinUAE, previous WinUAE Main Guy\nToni Wilen - Core updates, WinUAE Main Guy\nGustavo Goedert/Peter Remmers/Michael Sontheimer/Tomi Hakala/Tim Gunn/Nemo Pohle - DOS Port Stuff\nSamuel Devulder/Olaf Barthel/Sam Jordan - Amiga Ports\nKrister Bergman - XFree86 and OS/2 Port\nA. Blanchard/Ernesto Corvi - MacOS Port\nChristian Bauer - BeOS Port\nIan Stephenson - NextStep Port\nPeter Teichmann - Acorn/RiscOS Port\nStefan Reinauer - ZorroII/III AutoConfig, Serial Support\nChristian Schmitt/Chris Hames - Serial Support\nHerman ten Brugge - 68020/68881 Emulation Code\nTauno Taipaleenmaki - Various UAE-Control/UAE-Library Support\nBrett Eden/Tim Gunn/Paolo Besser/Nemo Pohle - Various Docs and Web-Sites\nGeorg Veichtlbauer - Help File coordinator, German GUI\nFulvio Leonardi - Italian translator for WinUAE\n" - IDS_CONTRIBUTORS2 "Bill Panagouleas - Hardware support\nSpecial thanks to Alexander Kneer and Tobias Abt (The Picasso96 Team)\n" + IDS_CONTRIBUTORS2 "Bill Panagouleas - Hardware support\nSpecial thanks to Alexander Kneer and Tobias Abt (The Picasso96 Team)\nSteven Weiser - Postscript printing emulation idea and testing." IDS_INVALIDPRTPORT "The printer you have in this configuration is not valid on this machine.\n" IDS_RESTOREUSS "Restore a UAE Snap-Shot File" IDS_USS "UAE Snap-Shot Files" @@ -1358,6 +1363,8 @@ BEGIN IDS_NOHARDDRIVES "No Amiga formatted or completely empty harddrives detected." IDS_DEFAULT_HOST "Default Configuration" IDS_SOUND_4CHANNEL "4 Channels" + IDS_HF_FS_CUSTOM "Custom" + IDS_SELECTFS "Select filesystem handler (FastFileSystem, SmartFilesystem,...)" END STRINGTABLE diff --git a/od-win32/screenshot.c b/od-win32/screenshot.c index 63198e9a..db9129f9 100755 --- a/od-win32/screenshot.c +++ b/od-win32/screenshot.c @@ -14,7 +14,23 @@ #include "direct3d.h" #include "opengl.h" -static char config_filename[] = { 0 }; +static void namesplit (char *s) +{ + int l; + + l = strlen (s) - 1; + while (l >= 0) { + if (s[l] == '.') + s[l] = 0; + if (s[l] == '\\' || s[l] == '/' || s[l] == ':' || s[l] == '?') { + l++; + break; + } + l--; + } + if (l > 0) + memmove (s, s + l, strlen (s + l) + 1); +} static int toclipboard (BITMAPINFO *bi, void *bmp) { @@ -117,19 +133,23 @@ void screenshot(int mode) } else { char filename[MAX_DPATH]; char extension[] = "bmp"; - char tmpstr[MAX_DPATH]; char path[MAX_DPATH]; + char name[MAX_DPATH]; + char underline[] = "_"; int number = 0; fetch_path ("ScreenshotPath", path, sizeof (path)); CreateDirectory (path, NULL); - tmpstr[0] = 0; - if(config_filename[0]) - sprintf (tmpstr, "%s_", config_filename); + name[0] = 0; + if (currprefs.dfxtype[0] >= 0) + strcpy (name, currprefs.df[0]); + if (!name[0]) + underline[0] = 0; + namesplit (name); while(++number < 1000) // limit 999 iterations / screenshots { - sprintf(filename, "%s%s%03.3d.%s", path, tmpstr, number, extension); + sprintf(filename, "%s%s%s%03d.%s", path, name, underline, number, extension); if((fp = fopen(filename, "r")) == NULL) // does file not exist? { diff --git a/od-win32/serial_win32.c b/od-win32/serial_win32.c index 6092195d..67e253a5 100755 --- a/od-win32/serial_win32.c +++ b/od-win32/serial_win32.c @@ -430,7 +430,7 @@ void serial_open(void) #ifdef SERIAL_PORT if (serdev) return; - + serper = 0; if( !openser( currprefs.sername ) ) { write_log( "SERIAL: Could not open device %s\n", currprefs.sername ); diff --git a/od-win32/win32.c b/od-win32/win32.c index 9d0a159d..ba3dfb07 100755 --- a/od-win32/win32.c +++ b/od-win32/win32.c @@ -282,6 +282,9 @@ static int figure_processor_speed (void) if (rpt_available) write_log ("CLOCKFREQ: CPU throttling detected, using QPF instead of RDTSC\n"); qpfinit = 1; + } else if (qpc_avail && freq.QuadPart >= 999000000) { + write_log ("CLOCKFREQ: Using QPF (QPF >= 1GHz)\n"); + qpfinit = 1; } if (qpfinit) { useqpc = qpc_avail; @@ -1454,7 +1457,7 @@ static HMODULE LoadGUI( void ) sprintf (dllbuf, "%sguidll.dll", start_path); else sprintf (dllbuf, "%sWinUAE_%s.dll", start_path, dllname); - result = LoadLibrary (dllbuf); + result = WIN32_LoadLibrary (dllbuf); if( result) { dwFileVersionInfoSize = GetFileVersionInfoSize(dllbuf, &dwVersionHandle ); @@ -2001,6 +2004,7 @@ static void WIN32_HandleRegistryStuff( void ) strcat (path, "Hardware"); CreateDirectory (path, NULL); fetch_path ("StatefilePath", path, sizeof (path)); + CreateDirectory (path, NULL); strcat (path, "default.uss"); strcpy (savestate_fname, path); fkey = read_disk_history (); @@ -2013,17 +2017,6 @@ static void betamessage (void) { } -static void init_zlib (void) -{ - HMODULE h = LoadLibrary ("zlib1.dll"); - if (h) { - is_zlib = 1; - FreeLibrary(h); - } else { - write_log ("zlib1.dll not found, gzip/zip support disabled\n"); - } -} - static int dxdetect (void) { /* believe or not but this is MS supported way of detecting DX8+ */ @@ -2124,6 +2117,8 @@ static int osdetect (void) os_winnt_admin = isadminpriv (); return 1; } + + extern void test (void); static int PASCAL WinMain2 (HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow) { @@ -2164,7 +2159,6 @@ __asm{ #ifdef AVIOUTPUT AVIOutput_Initialize(); #endif - init_zlib (); #ifdef __MINGW32__ argc = _argc; argv = _argv; @@ -2202,11 +2196,7 @@ __asm{ if( WIN32_RegisterClasses() && WIN32_InitLibraries() && DirectDraw_Start(NULL) ) { - struct foo { - DEVMODE actual_devmode; - char overrun[8]; - } devmode; - + DEVMODE devmode; DWORD i = 0; DirectDraw_Release (); @@ -2216,13 +2206,11 @@ __asm{ sortdisplays (); write_log ("done\n"); - memset( &devmode, 0, sizeof(DEVMODE) + 8 ); - devmode.actual_devmode.dmSize = sizeof(DEVMODE); - devmode.actual_devmode.dmDriverExtra = 8; -#define ENUM_CURRENT_SETTINGS ((DWORD)-1) - if( EnumDisplaySettings( NULL, ENUM_CURRENT_SETTINGS, (LPDEVMODE)&devmode ) ) + memset (&devmode, 0, sizeof(devmode)); + devmode.dmSize = sizeof(DEVMODE); + if (EnumDisplaySettings (NULL, ENUM_CURRENT_SETTINGS, &devmode)) { - default_freq = devmode.actual_devmode.dmDisplayFrequency; + default_freq = devmode.dmDisplayFrequency; if( default_freq >= 70 ) default_freq = 70; else @@ -2387,7 +2375,7 @@ static LONG WINAPI ExceptionFilter( struct _EXCEPTION_POINTERS * pExceptionPoint strcpy (path2, path); if (slash) { strcpy (slash + 1, "DBGHELP.DLL"); - dll = LoadLibrary (path); + dll = WIN32_LoadLibrary (path); } slash = strrchr (path2, '\\'); if (slash) @@ -2397,7 +2385,7 @@ static LONG WINAPI ExceptionFilter( struct _EXCEPTION_POINTERS * pExceptionPoint sprintf (p, "winuae_%d%02d%02d_%02d%02d%02d.dmp", when.tm_year + 1900, when.tm_mon + 1, when.tm_mday, when.tm_hour, when.tm_min, when.tm_sec); if (dll == NULL) - dll = LoadLibrary("DBGHELP.DLL"); + dll = WIN32_LoadLibrary ("DBGHELP.DLL"); if (dll) { MINIDUMPWRITEDUMP dump = (MINIDUMPWRITEDUMP)GetProcAddress(dll, "MiniDumpWriteDump"); if (dump) { @@ -2491,6 +2479,21 @@ void systraymenu (HWND hwnd) winuae_active (hwnd, FALSE); } + +HMODULE WIN32_LoadLibrary (const char *name) +{ + HMODULE m; + char *s = xmalloc (strlen (start_path) + strlen (WIN32_PLUGINDIR) + strlen (name) + 1); + if (s) { + sprintf (s, "%s%s%s", start_path, WIN32_PLUGINDIR, name); + m = LoadLibrary (s); + xfree (s); + if (m) + return m; + } + return LoadLibrary (name); +} + int PASCAL WinMain (HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow) { diff --git a/od-win32/win32.h b/od-win32/win32.h index b2b2d95a..fd977607 100755 --- a/od-win32/win32.h +++ b/od-win32/win32.h @@ -22,7 +22,7 @@ extern int manual_palette_refresh_needed; extern int mouseactive, focus; extern int ignore_messages_all; #define WINUAEBETA 1 -#define WINUAEBETASTR " Beta 1" +#define WINUAEBETASTR " Beta 2" extern void my_kbd_handler (int, int, int); extern void clearallkeys(void); @@ -92,4 +92,7 @@ void fetch_path (char *name, char *out, int size); void set_path (char *name, char *path); void read_rom_list (int); +#define WIN32_PLUGINDIR "plugins\\" +HMODULE WIN32_LoadLibrary (const char *); + #endif \ No newline at end of file diff --git a/od-win32/win32gfx.c b/od-win32/win32gfx.c index f581e65f..bb7bc446 100755 --- a/od-win32/win32gfx.c +++ b/od-win32/win32gfx.c @@ -1075,8 +1075,14 @@ int check_prefs_changed_gfx (void) return 1; } - if (strcmp (currprefs.prtname, changed_prefs.prtname)) { + if (strcmp (currprefs.prtname, changed_prefs.prtname) || + currprefs.parallel_postscript_emulation != changed_prefs.parallel_postscript_emulation || + currprefs.parallel_postscript_detection != changed_prefs.parallel_postscript_detection || + strcmp (currprefs.ghostscript_parameters, changed_prefs.ghostscript_parameters)) { strcpy (currprefs.prtname, changed_prefs.prtname); + currprefs.parallel_postscript_emulation = changed_prefs.parallel_postscript_emulation; + currprefs.parallel_postscript_detection = changed_prefs.parallel_postscript_detection; + strcpy (currprefs.ghostscript_parameters, changed_prefs.ghostscript_parameters); #ifdef PARALLEL_PORT closeprinter (); #endif diff --git a/od-win32/win32gui.c b/od-win32/win32gui.c index 88101e6d..34996779 100755 --- a/od-win32/win32gui.c +++ b/od-win32/win32gui.c @@ -66,8 +66,8 @@ #include "moduleripper.h" #endif -#define DISK_FORMAT_STRING "(*.adf;*.adz;*.gz;*.dms;*.fdi;*.ipf;*.zip;*.exe)\0*.adf;*.adz;*.gz;*.dms;*.fdi;*.ipf;*.zip;*.exe\0" -#define ROM_FORMAT_STRING "(*.rom;*.zip;*.roz)\0*.rom;*.zip;*.roz\0" +#define DISK_FORMAT_STRING "(*.adf;*.adz;*.gz;*.dms;*.fdi;*.ipf;*.zip;*.rar;*.7z;*.exe)\0*.adf;*.adz;*.gz;*.dms;*.fdi;*.ipf;*.zip;*.rar;*.7z;*.exe\0" +#define ROM_FORMAT_STRING "(*.rom;*.zip;*.rar;*.7z;*.roz)\0*.rom;*.zip;*.rar;*.7z;*.roz\0" #define USS_FORMAT_STRING_RESTORE "(*.uss;*.gz;*.zip)\0*.uss;*.gz;*.zip\0" #define USS_FORMAT_STRING_SAVE "(*.uss)\0*.uss\0" #define CONFIG_HOST "Host" @@ -754,6 +754,7 @@ int DirectorySelection(HWND hDlg, int flag, char *path) // flag = 11 for selecting flash files // flag = 12 for loading anything // flag = 13 for selecting path +// flag = 14 for loading filesystem int DiskSelection( HWND hDlg, WPARAM wParam, int flag, struct uae_prefs *prefs, char *path_out) { OPENFILENAME openFileName; @@ -913,6 +914,14 @@ int DiskSelection( HWND hDlg, WPARAM wParam, int flag, struct uae_prefs *prefs, openFileName.lpstrFilter = NULL; openFileName.lpstrDefExt = NULL; break; + case 12: + WIN32GUI_LoadUIString( IDS_SELECTFS, szTitle, MAX_DPATH ); + + openFileName.lpstrTitle = szTitle; + openFileName.lpstrFilter = NULL; + openFileName.lpstrDefExt = NULL; + openFileName.lpstrInitialDir = path_out; + break; case 13: WIN32GUI_LoadUIString( IDS_SELECTINFO, szTitle, MAX_DPATH ); @@ -1059,15 +1068,17 @@ int DiskSelection( HWND hDlg, WPARAM wParam, int flag, struct uae_prefs *prefs, return result; } -static BOOL CreateHardFile (HWND hDlg, UINT hfsizem) +static BOOL CreateHardFile (HWND hDlg, UINT hfsizem, char *dostype) { HANDLE hf; int i = 0; BOOL result = FALSE; LONG highword = 0; - DWORD ret; + DWORD ret, written; char init_path[MAX_DPATH] = ""; uae_u64 hfsize; + uae_u32 dt; + uae_u8 b; hfsize = (uae_u64)hfsizem * 1024 * 1024; DiskSelection (hDlg, IDC_PATH_NAME, 3, &workprefs, 0); @@ -1085,6 +1096,23 @@ static BOOL CreateHardFile (HWND hDlg, UINT hfsizem) write_log ("SetFilePointer() failure for %s to posn %ud\n", init_path, hfsize); else result = SetEndOfFile (hf); + SetFilePointer (hf, 0, NULL, FILE_BEGIN); + b = 0; + WriteFile (hf, &b, 1, &written, NULL); + WriteFile (hf, &b, 1, &written, NULL); + WriteFile (hf, &b, 1, &written, NULL); + WriteFile (hf, &b, 1, &written, NULL); + if (sscanf (dostype, "%x", &dt) > 0) { + SetFilePointer (hf, 0, NULL, FILE_BEGIN); + b = dt >> 24; + WriteFile (hf, &b, 1, &written, NULL); + b = dt >> 16; + WriteFile (hf, &b, 1, &written, NULL); + b = dt >> 8; + WriteFile (hf, &b, 1, &written, NULL); + b = dt >> 0; + WriteFile (hf, &b, 1, &written, NULL); + } CloseHandle (hf); } else { write_log ("CreateFile() failed to create %s\n", init_path); @@ -1143,7 +1171,7 @@ static int CalculateHardfileSize (HWND hDlg) BOOL Translated = FALSE; UINT mbytes = 0; - mbytes = GetDlgItemInt( hDlg, IDC_HFSIZE, &Translated, FALSE ); + mbytes = GetDlgItemInt( hDlg, IDC_HF_SIZE, &Translated, FALSE ); if (mbytes <= 0) mbytes = 0; if( !Translated ) @@ -4740,6 +4768,7 @@ static void values_to_sounddlg (HWND hDlg) SendDlgItemMessage(hDlg, IDC_SOUNDDRIVESELECT, CB_ADDSTRING, 0, (LPARAM)txt); WIN32GUI_LoadUIString (IDS_DRIVESOUND_DEFAULT_A500, txt, sizeof (txt)); SendDlgItemMessage(hDlg, IDC_SOUNDDRIVESELECT, CB_ADDSTRING, 0, (LPARAM)txt); + SendDlgItemMessage (hDlg, IDC_SOUNDDRIVESELECT, CB_SETCURSEL, 0, 0); p = drivesounds; if (p) { while (p[0]) { @@ -4747,7 +4776,7 @@ static void values_to_sounddlg (HWND hDlg) p += strlen (p) + 1; } } - if (workprefs.dfxclick[idx] && workprefs.dfxclickexternal[idx][0]) { + if (workprefs.dfxclick[idx] < 0) { p = drivesounds; i = DS_BUILD_IN_SOUNDS + 1; while (p && p[0]) { @@ -4758,6 +4787,7 @@ static void values_to_sounddlg (HWND hDlg) i++; p += strlen (p) + 1; } + } else { SendDlgItemMessage (hDlg, IDC_SOUNDDRIVESELECT, CB_SETCURSEL, workprefs.dfxclick[idx], 0); } @@ -4870,14 +4900,12 @@ static BOOL CALLBACK SoundDlgProc (HWND hDlg, UINT msg, WPARAM wParam, LPARAM lP if (recursive > 0) break; recursive++; - if ((wParam & 0xffff) == IDC_SOUNDCALIBRATE) { + if (LOWORD (wParam) == IDC_SOUNDCALIBRATE) { int pct = sound_calibrate (hDlg, &workprefs); workprefs.sound_adjust = (pct - 1000); update_soundgui (hDlg); - } else if((wParam & 0xffff) == IDC_SOUNDDRIVE) { - int idx = SendDlgItemMessage (hDlg, IDC_SOUNDDRIVE, CB_GETCURSEL, 0, 0);; - if (idx >= 0) - SendDlgItemMessage (hDlg, IDC_SOUNDDRIVESELECT, CB_SETCURSEL, workprefs.dfxclick[idx], 0); + } else if(LOWORD (wParam) == IDC_SOUNDDRIVE) { + values_to_sounddlg (hDlg); } values_from_sounddlg (hDlg); enable_for_sounddlg (hDlg); @@ -5027,6 +5055,28 @@ static void sethardfile (HWND hDlg) !(current_hfdlg.sectors == 0 && current_hfdlg.surfaces == 0 && current_hfdlg.reserved == 0)); } +static void inithardfile (HWND hDlg) +{ + char tmp[MAX_DPATH]; + + EnableWindow (GetDlgItem (hDlg, IDC_HF_DOSTYPE), FALSE); + EnableWindow (GetDlgItem (hDlg, IDC_HF_CREATE), FALSE); + SendDlgItemMessage(hDlg, IDC_HF_TYPE, CB_RESETCONTENT, 0, 0); + WIN32GUI_LoadUIString (IDS_HF_FS_CUSTOM, tmp, sizeof (tmp)); + SendDlgItemMessage (hDlg, IDC_HF_TYPE, CB_ADDSTRING, 0, (LPARAM)"OFS/FFS/RDB"); + SendDlgItemMessage (hDlg, IDC_HF_TYPE, CB_ADDSTRING, 0, (LPARAM)"SFS"); + SendDlgItemMessage (hDlg, IDC_HF_TYPE, CB_ADDSTRING, 0, (LPARAM)tmp); + SendDlgItemMessage (hDlg, IDC_HF_TYPE, CB_SETCURSEL, 0, 0); +} + +static void sethfdostype (HWND hDlg, int idx) +{ + if (idx == 1) + SetDlgItemText (hDlg, IDC_HF_DOSTYPE, "0x53465300"); + else + SetDlgItemText (hDlg, IDC_HF_DOSTYPE, ""); +} + static void hardfile_testrdb (HWND hDlg) { void *f = zfile_fopen (current_hfdlg.filename, "rb"); @@ -5049,12 +5099,14 @@ static void hardfile_testrdb (HWND hDlg) static int CALLBACK HardfileSettingsProc (HWND hDlg, UINT msg, WPARAM wParam, LPARAM lParam) { static int recursive = 0; - UINT setting; + int i; switch (msg) { case WM_INITDIALOG: recursive++; + inithardfile (hDlg); sethardfile (hDlg); + sethfdostype (hDlg, 0); recursive--; return TRUE; @@ -5063,21 +5115,33 @@ static int CALLBACK HardfileSettingsProc (HWND hDlg, UINT msg, WPARAM wParam, LP break; recursive++; - if (HIWORD (wParam) == BN_CLICKED) { - switch (LOWORD (wParam)) { - case IDC_CREATEHF: - setting = CalculateHardfileSize (hDlg); - if( !CreateHardFile(hDlg, setting) ) - { - char szMessage[ MAX_DPATH ]; - char szTitle[ MAX_DPATH ]; - WIN32GUI_LoadUIString( IDS_FAILEDHARDFILECREATION, szMessage, MAX_DPATH ); - WIN32GUI_LoadUIString( IDS_CREATIONERROR, szTitle, MAX_DPATH ); - + switch (LOWORD (wParam)) { + case IDC_HF_SIZE: + EnableWindow (GetDlgItem (hDlg, IDC_HF_CREATE), CalculateHardfileSize (hDlg) > 0); + break; + case IDC_HF_TYPE: + i = SendDlgItemMessage (hDlg, IDC_HF_TYPE, CB_GETCURSEL, 0, 0); + sethfdostype (hDlg, i); + EnableWindow (GetDlgItem (hDlg, IDC_HF_DOSTYPE), i >= 2); + break; + case IDC_HF_CREATE: + { + UINT setting = CalculateHardfileSize (hDlg); + char dostype[16]; + GetDlgItemText (hDlg, IDC_HF_DOSTYPE, dostype, sizeof (dostype)); + i = SendDlgItemMessage (hDlg, IDC_HF_TYPE, CB_GETCURSEL, 0, 0); + if (i == 0) + dostype[0] = 0; + if (!CreateHardFile(hDlg, setting, dostype)) { + char szMessage[MAX_DPATH]; + char szTitle[MAX_DPATH]; + WIN32GUI_LoadUIString (IDS_FAILEDHARDFILECREATION, szMessage, MAX_DPATH); + WIN32GUI_LoadUIString (IDS_CREATIONERROR, szTitle, MAX_DPATH); MessageBox( hDlg, szMessage, szTitle, MB_OK | MB_ICONERROR | MB_APPLMODAL | MB_SETFOREGROUND); } - break; + } + break; case IDC_SELECTOR: DiskSelection (hDlg, IDC_PATH_NAME, 2, &workprefs, 0); GetDlgItemText (hDlg, IDC_PATH_NAME, current_hfdlg.filename, sizeof current_hfdlg.filename); @@ -5115,7 +5179,6 @@ static int CALLBACK HardfileSettingsProc (HWND hDlg, UINT msg, WPARAM wParam, LP current_hfdlg.sectors = current_hfdlg.reserved = current_hfdlg.surfaces = 0; sethardfile (hDlg); break; - } } GetDlgItemText (hDlg, IDC_PATH_NAME, current_hfdlg.filename, sizeof current_hfdlg.filename); @@ -6577,12 +6640,14 @@ static BOOL CALLBACK PortsDlgProc (HWND hDlg, UINT msg, WPARAM wParam, LPARAM lP switch (msg) { case WM_INITDIALOG: + recursive++; pages[PORTS_ID] = hDlg; currentpage = PORTS_ID; init_portsdlg( hDlg ); enable_for_portsdlg (hDlg); values_to_portsdlg (hDlg); updatejoyport (hDlg); + recursive--; break; case WM_USER: recursive++; @@ -7852,6 +7917,7 @@ static void centerWindow (HWND hDlg) RECT rc, rcDlg, rcOwner; HWND owner = GetParent(hDlg); LONG x = 0, y = 0; + POINT pt1, pt2; if (owner == NULL) owner = GetDesktopWindow(); @@ -7877,6 +7943,14 @@ static void centerWindow (HWND hDlg) y = rcOwner.top + (rc.bottom / 2); } SetForegroundWindow (hDlg); + pt1.x = x; + pt1.y = y; + pt2.x = x + 16; + pt2.y = y + GetSystemMetrics (SM_CYMENU) + GetSystemMetrics (SM_CYBORDER); + if (MonitorFromPoint (pt1, MONITOR_DEFAULTTONULL) == NULL || MonitorFromPoint (pt2, MONITOR_DEFAULTTONULL) == NULL) { + x = 16; + y = 16; + } SetWindowPos (hDlg, HWND_TOP, x, y, 0, 0, SWP_NOSIZE); } diff --git a/od-win32/winuae_msvc/winuae_msvc.vcproj b/od-win32/winuae_msvc/winuae_msvc.vcproj index 2fe9c646..64aeedad 100755 --- a/od-win32/winuae_msvc/winuae_msvc.vcproj +++ b/od-win32/winuae_msvc/winuae_msvc.vcproj @@ -47,7 +47,7 @@ OutputFile="d:\amiga\winuae.exe" LinkIncremental="2" SuppressStartupBanner="TRUE" - DelayLoadDLLs="zlib1.dll;winio.dll;setupapi.dll;capsimg.dll" + DelayLoadDLLs="setupapi.dll" GenerateDebugInformation="TRUE" ProgramDatabaseFile=".\Debug/winuae.pdb" SubSystem="2" @@ -92,12 +92,13 @@ WholeProgramOptimization="FALSE"> + + + + + + + + + + + + + + + + + + + + @@ -887,6 +982,12 @@ Name="VCCLCompilerTool" ObjectFile="$(IntDir)/$(InputName)1.obj"/> + + + @@ -902,6 +1003,12 @@ Name="VCCLCompilerTool" ObjectFile="$(IntDir)/$(InputName)1.obj"/> + + + @@ -920,6 +1027,12 @@ Name="VCCLCompilerTool" ObjectFile="$(IntDir)/$(InputName)1.obj"/> + + + @@ -935,6 +1048,12 @@ Name="VCCLCompilerTool" ObjectFile="$(IntDir)/$(InputName)1.obj"/> + + + @@ -956,6 +1075,12 @@ Name="VCCLCompilerTool" ObjectFile="$(IntDir)/$(InputName)1.obj"/> + + + @@ -971,6 +1096,12 @@ Name="VCCLCompilerTool" ObjectFile="$(IntDir)/$(InputName)1.obj"/> + + + @@ -986,6 +1117,12 @@ Name="VCCLCompilerTool" ObjectFile="$(IntDir)/$(InputName)1.obj"/> + + + @@ -1004,6 +1141,12 @@ Name="VCCLCompilerTool" ObjectFile="$(IntDir)/$(InputName)1.obj"/> + + + @@ -1022,6 +1165,12 @@ Name="VCCLCompilerTool" ObjectFile="$(IntDir)/$(InputName)1.obj"/> + + + @@ -1037,6 +1186,12 @@ Name="VCCLCompilerTool" ObjectFile="$(IntDir)/$(InputName)1.obj"/> + + + @@ -1052,6 +1207,12 @@ Name="VCCLCompilerTool" ObjectFile="$(IntDir)/$(InputName)1.obj"/> + + + @@ -1067,6 +1228,12 @@ Name="VCCLCompilerTool" ObjectFile="$(IntDir)/$(InputName)1.obj"/> + + + @@ -1082,6 +1249,12 @@ Name="VCCLCompilerTool" ObjectFile="$(IntDir)/$(InputName)1.obj"/> + + + @@ -1097,6 +1270,12 @@ Name="VCCLCompilerTool" ObjectFile="$(IntDir)/$(InputName)1.obj"/> + + + @@ -1112,6 +1291,12 @@ Name="VCCLCompilerTool" ObjectFile="$(IntDir)/$(InputName)1.obj"/> + + + @@ -1127,6 +1312,12 @@ Name="VCCLCompilerTool" ObjectFile="$(IntDir)/$(InputName)1.obj"/> + + + @@ -1142,6 +1333,12 @@ Name="VCCLCompilerTool" ObjectFile="$(IntDir)/$(InputName)1.obj"/> + + + @@ -1157,6 +1354,12 @@ Name="VCCLCompilerTool" ObjectFile="$(IntDir)/$(InputName)1.obj"/> + + + @@ -1172,6 +1375,12 @@ Name="VCCLCompilerTool" ObjectFile="$(IntDir)/$(InputName)1.obj"/> + + + @@ -1187,6 +1396,12 @@ Name="VCCLCompilerTool" ObjectFile="$(IntDir)/$(InputName)1.obj"/> + + + @@ -1202,6 +1417,12 @@ Name="VCCLCompilerTool" ObjectFile="$(IntDir)/$(InputName)1.obj"/> + + + @@ -1217,6 +1438,12 @@ Name="VCCLCompilerTool" ObjectFile="$(IntDir)/$(InputName)1.obj"/> + + + @@ -1232,6 +1459,12 @@ Name="VCCLCompilerTool" ObjectFile="$(IntDir)/$(InputName)1.obj"/> + + + @@ -1247,6 +1480,12 @@ Name="VCCLCompilerTool" ObjectFile="$(IntDir)/$(InputName)1.obj"/> + + + @@ -1262,6 +1501,12 @@ Name="VCCLCompilerTool" ObjectFile="$(IntDir)/$(InputName)1.obj"/> + + + @@ -1277,6 +1522,12 @@ Name="VCCLCompilerTool" ObjectFile="$(IntDir)/$(InputName)1.obj"/> + + + @@ -1292,6 +1543,12 @@ Name="VCCLCompilerTool" ObjectFile="$(IntDir)/$(InputName)1.obj"/> + + + @@ -1307,6 +1564,12 @@ Name="VCCLCompilerTool" ObjectFile="$(IntDir)/$(InputName)1.obj"/> + + + @@ -1322,6 +1585,12 @@ Name="VCCLCompilerTool" ObjectFile="$(IntDir)/$(InputName)1.obj"/> + + + @@ -1346,6 +1615,12 @@ Name="VCCLCompilerTool" ObjectFile="$(IntDir)/$(InputName)1.obj"/> + + + @@ -1361,6 +1636,12 @@ Name="VCCLCompilerTool" ObjectFile="$(IntDir)/$(InputName)1.obj"/> + + + @@ -1376,6 +1657,12 @@ Name="VCCLCompilerTool" ObjectFile="$(IntDir)/$(InputName)1.obj"/> + + + @@ -1391,6 +1678,12 @@ Name="VCCLCompilerTool" ObjectFile="$(IntDir)/$(InputName)1.obj"/> + + + @@ -1406,6 +1699,12 @@ Name="VCCLCompilerTool" ObjectFile="$(IntDir)/$(InputName)1.obj"/> + + + @@ -1421,11 +1720,17 @@ Name="VCCLCompilerTool" ObjectFile="$(IntDir)/$(InputName)1.obj"/> - - + Name="TestRelease|Win32"> + + + + + @@ -1436,6 +1741,12 @@ Name="VCCLCompilerTool" ObjectFile="$(IntDir)/$(InputName)1.obj"/> + + + @@ -1451,6 +1762,12 @@ Name="VCCLCompilerTool" ObjectFile="$(IntDir)/$(InputName)1.obj"/> + + + @@ -1466,6 +1783,12 @@ Name="VCCLCompilerTool" ObjectFile="$(IntDir)/$(InputName)1.obj"/> + + + @@ -1481,6 +1804,12 @@ Name="VCCLCompilerTool" ObjectFile="$(IntDir)/$(InputName)1.obj"/> + + + @@ -1496,6 +1825,12 @@ Name="VCCLCompilerTool" ObjectFile="$(IntDir)/$(InputName)1.obj"/> + + + @@ -1511,6 +1846,12 @@ Name="VCCLCompilerTool" ObjectFile="$(IntDir)/$(InputName)1.obj"/> + + + @@ -1526,6 +1867,12 @@ Name="VCCLCompilerTool" ObjectFile="$(IntDir)/$(InputName)1.obj"/> + + + @@ -1541,6 +1888,12 @@ Name="VCCLCompilerTool" ObjectFile="$(IntDir)/$(InputName)1.obj"/> + + + @@ -1556,6 +1909,12 @@ Name="VCCLCompilerTool" ObjectFile="$(IntDir)/$(InputName)1.obj"/> + + + @@ -1571,6 +1930,12 @@ Name="VCCLCompilerTool" ObjectFile="$(IntDir)/$(InputName)1.obj"/> + + + @@ -1586,6 +1951,12 @@ Name="VCCLCompilerTool" ObjectFile="$(IntDir)/$(InputName)1.obj"/> + + + @@ -1601,6 +1972,12 @@ Name="VCCLCompilerTool" ObjectFile="$(IntDir)/$(InputName)1.obj"/> + + + @@ -1619,6 +1996,12 @@ Name="VCCLCompilerTool" ObjectFile="$(IntDir)/$(InputName)1.obj"/> + + + @@ -1634,6 +2017,12 @@ Name="VCCLCompilerTool" ObjectFile="$(IntDir)/$(InputName)1.obj"/> + + + @@ -1649,6 +2038,12 @@ Name="VCCLCompilerTool" ObjectFile="$(IntDir)/$(InputName)1.obj"/> + + + @@ -1664,6 +2059,12 @@ Name="VCCLCompilerTool" ObjectFile="$(IntDir)/$(InputName)1.obj"/> + + + @@ -1679,6 +2080,12 @@ Name="VCCLCompilerTool" ObjectFile="$(IntDir)/$(InputName)1.obj"/> + + + @@ -1694,6 +2101,12 @@ Name="VCCLCompilerTool" ObjectFile="$(IntDir)/$(InputName)1.obj"/> + + + @@ -1709,6 +2122,12 @@ Name="VCCLCompilerTool" ObjectFile="$(IntDir)/$(InputName)1.obj"/> + + + @@ -1724,6 +2143,12 @@ Name="VCCLCompilerTool" ObjectFile="$(IntDir)/$(InputName)1.obj"/> + + + @@ -1739,6 +2164,12 @@ Name="VCCLCompilerTool" ObjectFile="$(IntDir)/$(InputName)1.obj"/> + + + @@ -1754,6 +2185,12 @@ Name="VCCLCompilerTool" ObjectFile="$(IntDir)/$(InputName)1.obj"/> + + + @@ -1769,6 +2206,12 @@ Name="VCCLCompilerTool" ObjectFile="$(IntDir)/$(InputName)1.obj"/> + + + @@ -1784,6 +2227,12 @@ Name="VCCLCompilerTool" ObjectFile="$(IntDir)/$(InputName)1.obj"/> + + + @@ -1799,6 +2248,12 @@ Name="VCCLCompilerTool" ObjectFile="$(IntDir)/$(InputName)1.obj"/> + + + @@ -1814,6 +2269,12 @@ Name="VCCLCompilerTool" ObjectFile="$(IntDir)/$(InputName)1.obj"/> + + + @@ -1829,6 +2290,12 @@ Name="VCCLCompilerTool" ObjectFile="$(IntDir)/$(InputName)1.obj"/> + + + @@ -1844,6 +2311,12 @@ Name="VCCLCompilerTool" ObjectFile="$(IntDir)/$(InputName)1.obj"/> + + + @@ -1859,6 +2332,12 @@ Name="VCCLCompilerTool" ObjectFile="$(IntDir)/$(InputName)1.obj"/> + + + @@ -1874,6 +2353,12 @@ Name="VCCLCompilerTool" ObjectFile="$(IntDir)/$(InputName)1.obj"/> + + + @@ -1889,6 +2374,12 @@ Name="VCCLCompilerTool" ObjectFile="$(IntDir)/$(InputName)1.obj"/> + + + @@ -1904,6 +2395,12 @@ Name="VCCLCompilerTool" ObjectFile="$(IntDir)/$(InputName)1.obj"/> + + + @@ -1919,6 +2416,12 @@ Name="VCCLCompilerTool" ObjectFile="$(IntDir)/$(InputName)1.obj"/> + + + @@ -1934,6 +2437,12 @@ Name="VCCLCompilerTool" ObjectFile="$(IntDir)/$(InputName)1.obj"/> + + + @@ -1949,6 +2458,12 @@ Name="VCCLCompilerTool" ObjectFile="$(IntDir)/$(InputName)1.obj"/> + + + @@ -1964,6 +2479,12 @@ Name="VCCLCompilerTool" ObjectFile="$(IntDir)/$(InputName)1.obj"/> + + + @@ -1979,6 +2500,12 @@ Name="VCCLCompilerTool" ObjectFile="$(IntDir)/$(InputName)1.obj"/> + + + @@ -1994,6 +2521,12 @@ Name="VCCLCompilerTool" ObjectFile="$(IntDir)/$(InputName)1.obj"/> + + + @@ -2009,6 +2542,12 @@ Name="VCCLCompilerTool" ObjectFile="$(IntDir)/$(InputName)1.obj"/> + + + @@ -2024,6 +2563,12 @@ Name="VCCLCompilerTool" ObjectFile="$(IntDir)/$(InputName)1.obj"/> + + + @@ -2039,6 +2584,12 @@ Name="VCCLCompilerTool" ObjectFile="$(IntDir)/$(InputName)1.obj"/> + + + @@ -2054,6 +2605,12 @@ Name="VCCLCompilerTool" ObjectFile="$(IntDir)/$(InputName)1.obj"/> + + + @@ -2069,6 +2626,12 @@ Name="VCCLCompilerTool" ObjectFile="$(IntDir)/$(InputName)1.obj"/> + + + @@ -2084,6 +2647,12 @@ Name="VCCLCompilerTool" ObjectFile="$(IntDir)/$(InputName)1.obj"/> + + + @@ -2099,6 +2668,12 @@ Name="VCCLCompilerTool" ObjectFile="$(IntDir)/$(InputName)1.obj"/> + + + @@ -2114,6 +2689,12 @@ Name="VCCLCompilerTool" ObjectFile="$(IntDir)/$(InputName)1.obj"/> + + + @@ -2129,6 +2710,12 @@ Name="VCCLCompilerTool" ObjectFile="$(IntDir)/$(InputName)1.obj"/> + + + @@ -2144,6 +2731,12 @@ Name="VCCLCompilerTool" ObjectFile="$(IntDir)/$(InputName)1.obj"/> + + + @@ -2159,6 +2752,12 @@ Name="VCCLCompilerTool" ObjectFile="$(IntDir)/$(InputName)1.obj"/> + + + @@ -2174,6 +2773,12 @@ Name="VCCLCompilerTool" ObjectFile="$(IntDir)/$(InputName)1.obj"/> + + + @@ -2189,6 +2794,12 @@ Name="VCCLCompilerTool" ObjectFile="$(IntDir)/$(InputName)1.obj"/> + + + @@ -2204,6 +2815,12 @@ Name="VCCLCompilerTool" ObjectFile="$(IntDir)/$(InputName)1.obj"/> + + + @@ -2219,6 +2836,12 @@ Name="VCCLCompilerTool" ObjectFile="$(IntDir)/$(InputName)1.obj"/> + + + @@ -2234,6 +2857,12 @@ Name="VCCLCompilerTool" ObjectFile="$(IntDir)/$(InputName)1.obj"/> + + + @@ -2249,6 +2878,12 @@ Name="VCCLCompilerTool" ObjectFile="$(IntDir)/$(InputName)1.obj"/> + + + @@ -2264,6 +2899,12 @@ Name="VCCLCompilerTool" ObjectFile="$(IntDir)/$(InputName)1.obj"/> + + + @@ -2279,6 +2920,12 @@ Name="VCCLCompilerTool" ObjectFile="$(IntDir)/$(InputName)1.obj"/> + + + @@ -2289,7 +2936,13 @@ ObjectFile="$(IntDir)/$(InputName)1.obj"/> + Name="Release|Win32"> + + + @@ -2313,6 +2966,12 @@ Name="VCCLCompilerTool" ObjectFile="$(IntDir)/$(InputName)2.obj"/> + + + @@ -2328,6 +2987,12 @@ Name="VCCLCompilerTool" ObjectFile="$(IntDir)/$(InputName)2.obj"/> + + + @@ -2343,6 +3008,12 @@ Name="VCCLCompilerTool" ObjectFile="$(IntDir)/$(InputName)2.obj"/> + + + @@ -2358,6 +3029,12 @@ Name="VCCLCompilerTool" ObjectFile="$(IntDir)/$(InputName)2.obj"/> + + + @@ -2376,6 +3053,12 @@ Name="VCCLCompilerTool" ObjectFile="$(IntDir)/$(InputName)2.obj"/> + + + @@ -2391,6 +3074,12 @@ Name="VCCLCompilerTool" ObjectFile="$(IntDir)/$(InputName)2.obj"/> + + + @@ -2406,6 +3095,12 @@ Name="VCCLCompilerTool" ObjectFile="$(IntDir)/$(InputName)2.obj"/> + + + @@ -2421,6 +3116,12 @@ Name="VCCLCompilerTool" ObjectFile="$(IntDir)/$(InputName)2.obj"/> + + + @@ -2436,6 +3137,12 @@ Name="VCCLCompilerTool" ObjectFile="$(IntDir)/$(InputName)2.obj"/> + + + @@ -2451,6 +3158,12 @@ Name="VCCLCompilerTool" ObjectFile="$(IntDir)/$(InputName)2.obj"/> + + + @@ -2466,6 +3179,12 @@ Name="VCCLCompilerTool" ObjectFile="$(IntDir)/$(InputName)2.obj"/> + + + @@ -2481,6 +3200,12 @@ Name="VCCLCompilerTool" ObjectFile="$(IntDir)/$(InputName)2.obj"/> + + + @@ -2496,6 +3221,12 @@ Name="VCCLCompilerTool" ObjectFile="$(IntDir)/$(InputName)2.obj"/> + + + @@ -2511,6 +3242,12 @@ Name="VCCLCompilerTool" ObjectFile="$(IntDir)/$(InputName)2.obj"/> + + + @@ -2526,6 +3263,12 @@ Name="VCCLCompilerTool" ObjectFile="$(IntDir)/$(InputName)2.obj"/> + + + @@ -2541,6 +3284,12 @@ Name="VCCLCompilerTool" ObjectFile="$(IntDir)/$(InputName)2.obj"/> + + + @@ -2556,6 +3305,12 @@ Name="VCCLCompilerTool" ObjectFile="$(IntDir)/$(InputName)2.obj"/> + + + @@ -2580,6 +3335,12 @@ Name="VCCLCompilerTool" ObjectFile="$(IntDir)/$(InputName)1.obj"/> + + + @@ -2595,6 +3356,12 @@ Name="VCCLCompilerTool" ObjectFile="$(IntDir)/$(InputName)1.obj"/> + + + @@ -2613,6 +3380,12 @@ Name="VCCLCompilerTool" ObjectFile="$(IntDir)/$(InputName)2.obj"/> + + + @@ -2628,6 +3401,12 @@ Name="VCCLCompilerTool" ObjectFile="$(IntDir)/$(InputName)2.obj"/> + + + @@ -2643,6 +3422,12 @@ Name="VCCLCompilerTool" ObjectFile="$(IntDir)/$(InputName)2.obj"/> + + + @@ -2658,6 +3443,12 @@ Name="VCCLCompilerTool" ObjectFile="$(IntDir)/$(InputName)2.obj"/> + + + @@ -2673,6 +3464,12 @@ Name="VCCLCompilerTool" ObjectFile="$(IntDir)/$(InputName)2.obj"/> + + + @@ -2688,6 +3485,12 @@ Name="VCCLCompilerTool" ObjectFile="$(IntDir)/$(InputName)2.obj"/> + + + @@ -2703,6 +3506,12 @@ Name="VCCLCompilerTool" ObjectFile="$(IntDir)/$(InputName)2.obj"/> + + + @@ -2718,6 +3527,12 @@ Name="VCCLCompilerTool" ObjectFile="$(IntDir)/$(InputName)2.obj"/> + + + @@ -2733,6 +3548,12 @@ Name="VCCLCompilerTool" ObjectFile="$(IntDir)/$(InputName)1.obj"/> + + + @@ -2748,6 +3569,12 @@ Name="VCCLCompilerTool" ObjectFile="$(IntDir)/$(InputName)2.obj"/> + + + @@ -2763,6 +3590,12 @@ Name="VCCLCompilerTool" ObjectFile="$(IntDir)/$(InputName)2.obj"/> + + + @@ -2778,6 +3611,12 @@ Name="VCCLCompilerTool" ObjectFile="$(IntDir)/$(InputName)2.obj"/> + + + @@ -2793,6 +3632,12 @@ Name="VCCLCompilerTool" ObjectFile="$(IntDir)/$(InputName)2.obj"/> + + + @@ -2808,6 +3653,12 @@ Name="VCCLCompilerTool" ObjectFile="$(IntDir)/$(InputName)2.obj"/> + + + @@ -2823,6 +3674,12 @@ Name="VCCLCompilerTool" ObjectFile="$(IntDir)/$(InputName)2.obj"/> + + + @@ -2838,6 +3695,12 @@ Name="VCCLCompilerTool" ObjectFile="$(IntDir)/$(InputName)2.obj"/> + + + @@ -2853,6 +3716,12 @@ Name="VCCLCompilerTool" ObjectFile="$(IntDir)/$(InputName)2.obj"/> + + + @@ -2868,6 +3737,12 @@ Name="VCCLCompilerTool" ObjectFile="$(IntDir)/$(InputName)2.obj"/> + + + @@ -2883,6 +3758,12 @@ Name="VCCLCompilerTool" ObjectFile="$(IntDir)/$(InputName)2.obj"/> + + + @@ -2898,6 +3779,12 @@ Name="VCCLCompilerTool" ObjectFile="$(IntDir)/$(InputName)2.obj"/> + + + @@ -2913,6 +3800,12 @@ Name="VCCLCompilerTool" ObjectFile="$(IntDir)/$(InputName)2.obj"/> + + + @@ -2928,6 +3821,12 @@ Name="VCCLCompilerTool" ObjectFile="$(IntDir)/$(InputName)2.obj"/> + + + @@ -2943,6 +3842,12 @@ Name="VCCLCompilerTool" ObjectFile="$(IntDir)/$(InputName)2.obj"/> + + + @@ -2958,6 +3863,12 @@ Name="VCCLCompilerTool" ObjectFile="$(IntDir)/$(InputName)2.obj"/> + + + @@ -2973,6 +3884,12 @@ Name="VCCLCompilerTool" ObjectFile="$(IntDir)/$(InputName)2.obj"/> + + + @@ -2988,6 +3905,12 @@ Name="VCCLCompilerTool" ObjectFile="$(IntDir)/$(InputName)2.obj"/> + + + @@ -3003,6 +3926,12 @@ Name="VCCLCompilerTool" ObjectFile="$(IntDir)/$(InputName)2.obj"/> + + + @@ -3018,6 +3947,12 @@ Name="VCCLCompilerTool" ObjectFile="$(IntDir)/$(InputName)3.obj"/> + + + @@ -3033,6 +3968,12 @@ Name="VCCLCompilerTool" ObjectFile="$(IntDir)/$(InputName)2.obj"/> + + + @@ -3048,6 +3989,12 @@ Name="VCCLCompilerTool" ObjectFile="$(IntDir)/$(InputName)2.obj"/> + + + @@ -3063,6 +4010,12 @@ Name="VCCLCompilerTool" ObjectFile="$(IntDir)/$(InputName)2.obj"/> + + + @@ -3078,6 +4031,12 @@ Name="VCCLCompilerTool" ObjectFile="$(IntDir)/$(InputName)2.obj"/> + + + diff --git a/unzip.c b/unzip.c index 887441c3..ee414f00 100755 --- a/unzip.c +++ b/unzip.c @@ -946,7 +946,7 @@ extern int ZEXPORT unzOpenCurrentFile (file) pfile_in_zip_read_info->stream.zfree = (free_func)0; pfile_in_zip_read_info->stream.opaque = (voidpf)0; - err=inflateInit2(&pfile_in_zip_read_info->stream, -MAX_WBITS); + err=pinflateInit2(&pfile_in_zip_read_info->stream, -MAX_WBITS, ZLIB_VERSION, sizeof(z_stream)); if (err == Z_OK) pfile_in_zip_read_info->stream_initialised=1; /* windowBits is passed < 0 to tell that there is no zlib header. @@ -1055,7 +1055,7 @@ extern int ZEXPORT unzReadCurrentFile (file, buf, len) *(pfile_in_zip_read_info->stream.next_out+i) = *(pfile_in_zip_read_info->stream.next_in+i); - pfile_in_zip_read_info->crc32 = crc32(pfile_in_zip_read_info->crc32, + pfile_in_zip_read_info->crc32 = pcrc32(pfile_in_zip_read_info->crc32, pfile_in_zip_read_info->stream.next_out, uDoCopy); pfile_in_zip_read_info->rest_read_uncompressed-=uDoCopy; @@ -1082,13 +1082,13 @@ extern int ZEXPORT unzReadCurrentFile (file, buf, len) (pfile_in_zip_read_info->rest_read_compressed == 0)) flush = Z_FINISH; */ - err=inflate(&pfile_in_zip_read_info->stream,flush); + err=pinflate(&pfile_in_zip_read_info->stream,flush); uTotalOutAfter = pfile_in_zip_read_info->stream.total_out; uOutThis = uTotalOutAfter-uTotalOutBefore; pfile_in_zip_read_info->crc32 = - crc32(pfile_in_zip_read_info->crc32,bufBefore, + pcrc32(pfile_in_zip_read_info->crc32,bufBefore, (uInt)(uOutThis)); pfile_in_zip_read_info->rest_read_uncompressed -= @@ -1238,7 +1238,7 @@ extern int ZEXPORT unzCloseCurrentFile (file) TRYFREE(pfile_in_zip_read_info->read_buffer); pfile_in_zip_read_info->read_buffer = NULL; if (pfile_in_zip_read_info->stream_initialised) - inflateEnd(&pfile_in_zip_read_info->stream); + pinflateEnd(&pfile_in_zip_read_info->stream); pfile_in_zip_read_info->stream_initialised = 0; TRYFREE(pfile_in_zip_read_info); diff --git a/zfile.c b/zfile.c index f29dbd2d..a5a20062 100755 --- a/zfile.c +++ b/zfile.c @@ -30,22 +30,26 @@ struct zfile { int seek; int deleteafterclose; struct zfile *next; + int writeskipbytes; }; static struct zfile *zlist = 0; int is_zlib; -static int zlib_test (void) -{ - static int zlibmsg; - if (is_zlib) - return 1; - if (zlibmsg) - return 0; - zlibmsg = 1; - notify_user (NUMSG_NOZLIB); - return 0; -} +#ifdef _WIN32 +static HMODULE zlib; +#include "win32.h" +#endif + +INFLATEINIT2 pinflateInit2; +INFLATEINIT pinflateInit; +INFLATEEND pinflateEnd; +INFLATE pinflate; +static DEFLATEINIT pdeflateInit; +static DEFLATEEND pdeflateEnd; +static DEFLATE pdeflate; +CRC32 pcrc32; +static int zlib_test (int, int); static struct zfile *zfile_create (void) { @@ -232,7 +236,7 @@ static struct zfile *gunzip (struct zfile *z) struct zfile *z2; uae_u8 b; - if (!zlib_test ()) + if (!zlib_test (1, 0)) return z; strcpy (name, z->name); memset (&zs, 0, sizeof (zs)); @@ -288,13 +292,13 @@ static struct zfile *gunzip (struct zfile *z) zs.avail_in = sizeof (buffer); zfile_fread (buffer, sizeof (buffer), 1, z); if (first) { - if (inflateInit2 (&zs, -MAX_WBITS) != Z_OK) + if (pinflateInit2 (&zs, -MAX_WBITS, ZLIB_VERSION, sizeof(z_stream)) != Z_OK) break; first = 0; } - ret = inflate (&zs, 0); + ret = pinflate (&zs, 0); } while (ret == Z_OK); - inflateEnd (&zs); + pinflateEnd (&zs); if (ret != Z_STREAM_END || first != 0) { zfile_fclose (z2); return z; @@ -363,6 +367,236 @@ static int isdiskimage (char *name) return 0; } +struct aa_FILETIME +{ + uae_u32 dwLowDateTime; + uae_u32 dwHighDateTime; +}; +struct aa_FileInArchiveInfo { + int ArchiveHandle; + uae_u64 CompressedFileSize; + uae_u64 UncompressedFileSize; + int attributes; + int IsDir; + struct aa_FILETIME LastWriteTime; + char path[MAX_DPATH]; +}; + +typedef int (__stdcall *aa_ReadCallback)(int StreamID, uae_u64 offset, uae_u32 count, void* buf, uae_u32 *processedSize); +typedef int (__stdcall *aa_WriteCallback)(int StreamID, uae_u32 count, const void *buf, uae_u32 *processedSize); +typedef int (CALLBACK *aa_pOpenArchive)(aa_ReadCallback function, int StreamID, uae_u64 FileSize, int ArchiveType, int *result); +typedef int (CALLBACK *aa_pGetFileCount)(int ArchiveHandle); +typedef int (CALLBACK *aa_pGetFileInfo)(int ArchiveHandle, int FileNum, struct aa_FileInArchiveInfo *FileInfo); +typedef int (CALLBACK *aa_pExtract)(int ArchiveHandle, int FileNum, int StreamID, aa_WriteCallback WriteFunc); +typedef int (CALLBACK *aa_pCloseArchive)(int ArchiveHandle); + +static aa_pOpenArchive openArchive; +static aa_pGetFileCount getFileCount; +static aa_pGetFileInfo getFileInfo; +static aa_pExtract extract; +static aa_pCloseArchive closeArchive; + +#ifdef _WIN32 +#include +#include "win32.h" +static HMODULE arcacc_mod; + +static void arcacc_free (void) +{ + if (arcacc_mod) + FreeLibrary (arcacc_mod); + arcacc_mod = NULL; +} + +static int arcacc_init (void) +{ + if (arcacc_mod) + return 1; + arcacc_mod = WIN32_LoadLibrary ("archiveaccess.dll"); + if (!arcacc_mod) { + arcacc_mod = WIN32_LoadLibrary ("archiveaccess-debug.dll"); + if (!arcacc_mod) + return 0; + } + openArchive = (aa_pOpenArchive) GetProcAddress (arcacc_mod, "openArchive"); + getFileCount = (aa_pGetFileCount) GetProcAddress (arcacc_mod, "getFileCount"); + getFileInfo = (aa_pGetFileInfo) GetProcAddress (arcacc_mod, "getFileInfo"); + extract = (aa_pExtract) GetProcAddress (arcacc_mod, "extract"); + closeArchive = (aa_pCloseArchive) GetProcAddress (arcacc_mod, "closeArchive"); + if (!openArchive || !getFileCount || !getFileInfo || !extract || !closeArchive) { + arcacc_free (); + return 0; + } + return 1; +} +#endif + +#define ARCACC_STACKSIZE 10 +static struct zfile *arcacc_stack[ARCACC_STACKSIZE]; +static int arcacc_stackptr = -1; + +static int arcacc_push (struct zfile *f) +{ + if (arcacc_stackptr == ARCACC_STACKSIZE - 1) + return -1; + arcacc_stackptr++; + arcacc_stack[arcacc_stackptr] = f; + return arcacc_stackptr; +} +static void arcacc_pop (void) +{ + arcacc_stackptr--; +} + +static int __stdcall readCallback (int StreamID, uae_u64 offset, uae_u32 count, void *buf, uae_u32 *processedSize) +{ + struct zfile *f = arcacc_stack[StreamID]; + int ret; + + zfile_fseek (f, (long)offset, SEEK_SET); + ret = zfile_fread (buf, 1, count, f); + if (processedSize) + *processedSize = ret; + return 0; +} +int __stdcall writeCallback (int StreamID, uae_u32 count, const void *buf, uae_u32 *processedSize) +{ + struct zfile *f = arcacc_stack[StreamID]; + int ret; + + ret = zfile_fwrite ((void*)buf, 1, count, f); + if (processedSize) + *processedSize = ret; + if (ret != count) + return -1; + return 0; +} + +static struct zfile *arcacc_unpack (struct zfile *z, int type) +{ + int ah, status, i, f; + char tmphist[MAX_DPATH]; + int first = 1; + int we_have_file = 0; + int size, id_r, id_w; + struct zfile *zf; + int skipsize = 0; + + tmphist[0] = 0; + zf = 0; + if (!arcacc_init ()) + return z; + id_r = arcacc_push (z); + zfile_fseek (z, 0, SEEK_END); + size = zfile_ftell (z); + zfile_fseek (z, 0, SEEK_SET); + ah = openArchive (readCallback, id_r, z->size, type, &status); + if (!status) { + int fc = getFileCount (ah); + int zipcnt = 0; + for (f = 0; f < fc; f++) { + struct aa_FileInArchiveInfo fi; + char *name; + + zipcnt++; + memset (&fi, 0, sizeof (fi)); + getFileInfo (ah, f, &fi); + if (fi.IsDir) + continue; + + name = fi.path; + for (i = 0; ignoreextensions[i]; i++) { + if (strlen(name) > strlen (ignoreextensions[i]) && + !strcasecmp (ignoreextensions[i], name + strlen (name) - strlen (ignoreextensions[i]))) + break; + } + if (!ignoreextensions[i]) { + int select = 0; + if (tmphist[0]) { + DISK_history_add (tmphist, -1); + tmphist[0] = 0; + first = 0; + } + if (first) { + if (isdiskimage (name)) + sprintf (tmphist,"%s/%s", z->name, name); + } else { + sprintf (tmphist,"%s/%s", z->name, name); + DISK_history_add (tmphist, -1); + tmphist[0] = 0; + } + if (!z->zipname) + select = 1; + if (z->zipname && !strcasecmp (z->zipname, name)) + select = -1; + if (z->zipname && z->zipname[0] == '#' && atol (z->zipname + 1) == zipcnt) + select = -1; + if (select && !we_have_file) { + + zf = zfile_fopen_empty (name, (int)fi.UncompressedFileSize); + if (zf) { + int err; + zf->writeskipbytes = skipsize; + id_w = arcacc_push (zf); + err = extract (ah, f, id_w, writeCallback); + if (zf->seek != fi.UncompressedFileSize) + write_log ("%s unpack failed, got only %d bytes\n", name, zf->seek); + if (zf->seek == fi.UncompressedFileSize && (select < 0 || zfile_gettype (zf))) + we_have_file = 1; + if (!we_have_file) { + zfile_fclose (zf); + zf = 0; + } + arcacc_pop (); + } + } + } + if (type == 7) { + if (fi.CompressedFileSize) + skipsize = 0; + skipsize += (int)fi.UncompressedFileSize; + } + } + } + closeArchive (ah); + arcacc_pop (); + if (zf) { + zfile_fclose (z); + z = zf; + zfile_fseek (z, 0, SEEK_SET); + } + return z; +} + +static int zlib_test (int needzlib, int nomsg) +{ + static int zlibmsg; + if (is_zlib) + return 1; +#ifdef _WIN32 + zlib = WIN32_LoadLibrary ("zlib1.dll"); + if (zlib) { + pinflateInit2 = (INFLATEINIT2)GetProcAddress (zlib, "inflateInit2_"); + pinflateInit = (INFLATEINIT)GetProcAddress (zlib, "inflateInit_"); + pinflate = (INFLATE)GetProcAddress (zlib, "inflate"); + pinflateEnd = (INFLATEEND)GetProcAddress (zlib, "inflateEnd"); + pdeflateInit = (DEFLATEINIT)GetProcAddress (zlib, "deflateInit_"); + pdeflate = (DEFLATE)GetProcAddress (zlib, "deflate"); + pdeflateEnd = (DEFLATEEND)GetProcAddress (zlib, "deflateEnd"); + pcrc32 = (CRC32)GetProcAddress (zlib, "crc32"); + is_zlib = 1; + return 1; + } +#endif + if (!needzlib && arcacc_init ()) + return 1; + if (zlibmsg || nomsg) + return 0; + zlibmsg = 1; + notify_user (NUMSG_NOZLIB); + return 0; +} + static struct zfile *unzip (struct zfile *z) { unzFile uz; @@ -373,7 +607,7 @@ static struct zfile *unzip (struct zfile *z) char tmphist[MAX_DPATH]; int first = 1; - if (!zlib_test ()) + if (!zlib_test (1, 0)) return z; zf = 0; uz = unzOpen (z); @@ -450,20 +684,30 @@ static struct zfile *unzip (struct zfile *z) return z; } +static char *plugins_7z[] = { "7z", "rar", "zip", NULL }; +static char *plugins_7z_x[] = { "7z", "Rar!", "MK" }; +static int plugins_7z_t[] = { 7, 12, 11 }; + static int iszip (struct zfile *z) { char *name = z->name; char *ext = strrchr (name, '.'); uae_u8 header[4]; + int i; - if (!ext || strcasecmp (ext, ".zip")) + if (!ext) return 0; memset (header, 0, sizeof (header)); zfile_fseek (z, 0, SEEK_SET); zfile_fread (header, sizeof (header), 1, z); zfile_fseek (z, 0, SEEK_SET); - if (header[0] == 'P' && header[1] == 'K') - return 1; + if (!strcasecmp (ext, ".zip") && header[0] == 'P' && header[1] == 'K' && zlib_test (1, 1)) + return -1; + for (i = 0; plugins_7z[i]; i++) { + if (plugins_7z_x[i] && !strcasecmp (ext + 1, plugins_7z[i]) && + !memcmp (header, plugins_7z_x[i], strlen (plugins_7z_x[i]))) + return plugins_7z_t[i]; + } return 0; } @@ -472,13 +716,11 @@ static struct zfile *zuncompress (struct zfile *z) char *name = z->name; char *ext = strrchr (name, '.'); uae_u8 header[4]; + int i; if (ext != NULL) { ext++; - if (strcasecmp (ext, "lha") == 0 - || strcasecmp (ext, "lzh") == 0) - return lha (z); - if (strcasecmp (ext, "zip") == 0) + if (strcasecmp (ext, "zip") == 0 && zlib_test (1, 1)) return unzip (z); if (strcasecmp (ext, "gz") == 0) return gunzip (z); @@ -488,6 +730,13 @@ static struct zfile *zuncompress (struct zfile *z) return gunzip (z); if (strcasecmp (ext, "dms") == 0) return dms (z); + for (i = 0; plugins_7z[i]; i++) { + if (strcasecmp (ext, plugins_7z[i]) == 0) + return arcacc_unpack (z, plugins_7z_t[i]); + } + if (strcasecmp (ext, "lha") == 0 + || strcasecmp (ext, "lzh") == 0) + return lha (z); memset (header, 0, sizeof (header)); zfile_fseek (z, 0, SEEK_SET); zfile_fread (header, sizeof (header), 1, z); @@ -504,7 +753,7 @@ static struct zfile *zuncompress (struct zfile *z) static FILE *openzip (char *name, char *zippath) { - int i; + int i, j; char v; i = strlen (name) - 2; @@ -514,12 +763,16 @@ static FILE *openzip (char *name, char *zippath) if (name[i] == '/' || name[i] == '\\' && i > 4) { v = name[i]; name[i] = 0; - if (!strcasecmp (name + i - 4, ".zip")) { - FILE *f = fopen (name, "rb"); - if (f) { - if (zippath) - strcpy (zippath, name + i + 1); - return f; + for (j = 0; plugins_7z[j]; j++) { + int len = strlen (plugins_7z[j]); + if (name[i - len - 1] == '.' && !strcasecmp (name + i - len, plugins_7z[j])) { + FILE *f = fopen (name, "rb"); + if (f) { + if (zippath) + strcpy (zippath, name + i + 1); + return f; + } + break; } } name[i] = v; @@ -600,6 +853,71 @@ static struct zfile *zfile_fopen_2 (const char *name, const char *mode) return l; } +/* archiveaccess 7z-plugin compressed file scanner */ +static int arcacc_zunzip (struct zfile *z, zfile_callback zc, void *user, int type) +{ + char tmp[MAX_DPATH], tmp2[2]; + struct zfile *zf; + int err, fc, size, ah, status, i; + int id_r, id_w; + struct aa_FileInArchiveInfo fi; + int skipsize = 0; + + memset (&fi, 0, sizeof (fi)); + if (!arcacc_init ()) + return 0; + zf = 0; + id_r = arcacc_push (z); + if (id_r < 0) + return 0; + zfile_fseek (z, 0, SEEK_END); + size = zfile_ftell (z); + zfile_fseek (z, 0, SEEK_SET); + ah = openArchive (readCallback, id_r, size, type, &status); + if (status) { + arcacc_pop (); + return 0; + } + fc = getFileCount (ah); + for (i = 0; i < fc; i++) { + getFileInfo (ah, i, &fi); + if (fi.IsDir) + continue; + tmp2[0] = FSDB_DIR_SEPARATOR; + tmp2[1] = 0; + strcpy (tmp, z->name); + strcat (tmp, tmp2); + strcat (tmp, fi.path); + zf = zfile_fopen_empty (tmp, (int)fi.UncompressedFileSize); + if (zf) { + id_w = arcacc_push (zf); + if (id_w >= 0) { + zf->writeskipbytes = skipsize; + err = extract (ah, i, id_w, writeCallback); + if (zf->seek == fi.UncompressedFileSize) { + zfile_fseek (zf, 0, SEEK_SET); + if (!zc (zf, user)) { + closeArchive (ah); + arcacc_pop (); + zfile_fclose (zf); + arcacc_pop (); + return 0; + } + } + arcacc_pop (); + } + zfile_fclose (zf); + } + if (fi.CompressedFileSize) + skipsize = 0; + skipsize += (int)fi.UncompressedFileSize; + } + closeArchive (ah); + arcacc_pop (); + return 1; +} + +/* zip (zlib) scanning */ static int zunzip (struct zfile *z, zfile_callback zc, void *user) { unzFile uz; @@ -609,7 +927,7 @@ static int zunzip (struct zfile *z, zfile_callback zc, void *user) struct zfile *zf; int err; - if (!zlib_test ()) + if (!zlib_test (1, 0)) return 0; zf = 0; uz = unzOpen (z); @@ -635,9 +953,12 @@ static int zunzip (struct zfile *z, zfile_callback zc, void *user) unzCloseCurrentFile (uz); if (err == 0 || err == file_info.uncompressed_size) { zf = zuncompress (zf); - if (!zc (zf, user)) + if (!zc (zf, user)) { + zfile_fclose (zf); return 0; + } } + zfile_fclose (zf); } } } @@ -652,15 +973,18 @@ static int zunzip (struct zfile *z, zfile_callback zc, void *user) int zfile_zopen (const char *name, zfile_callback zc, void *user) { struct zfile *l; + int ztype; l = zfile_fopen_2 (name, "rb"); if (!l) return 0; - if (!iszip (l)) { + ztype = iszip (l); + if (!ztype) zc (l, user); - } else { + else if (ztype < 0) zunzip (l, zc, user); - } + else + arcacc_zunzip (l, zc, user, ztype); zfile_fclose (l); return 1; } @@ -765,6 +1089,14 @@ size_t zfile_fputs (struct zfile *z, char *s) size_t zfile_fwrite (void *b, size_t l1, size_t l2, struct zfile *z) { long len = l1 * l2; + + if (z->writeskipbytes) { + z->writeskipbytes -= len; + if (z->writeskipbytes >= 0) + return len; + len = -z->writeskipbytes; + z->writeskipbytes = 0; + } if (z->data) { if (z->seek + len > z->size) { len = z->size - z->seek; @@ -785,10 +1117,10 @@ int zfile_zuncompress (void *dst, int dstsize, struct zfile *src, int srcsize) uae_u8 inbuf[4096]; int incnt; - if (!zlib_test ()) + if (!zlib_test (1, 0)) return 0; memset (&zs, 0, sizeof(zs)); - if (inflateInit (&zs) != Z_OK) + if (pinflateInit (&zs, ZLIB_VERSION, sizeof(z_stream)) != Z_OK) return 0; zs.next_out = dst; zs.avail_out = dstsize; @@ -804,9 +1136,9 @@ int zfile_zuncompress (void *dst, int dstsize, struct zfile *src, int srcsize) zs.avail_in = zfile_fread (inbuf, 1, left, src); incnt += left; } - v = inflate (&zs, 0); + v = pinflate (&zs, 0); } - inflateEnd (&zs); + pinflateEnd (&zs); return 0; } @@ -819,7 +1151,7 @@ int zfile_zcompress (struct zfile *f, void *src, int size) if (!is_zlib) return 0; memset (&zs, 0, sizeof (zs)); - if (deflateInit (&zs, Z_DEFAULT_COMPRESSION) != Z_OK) + if (pdeflateInit (&zs, Z_DEFAULT_COMPRESSION, ZLIB_VERSION, sizeof(z_stream)) != Z_OK) return 0; zs.next_in = src; zs.avail_in = size; @@ -827,11 +1159,11 @@ int zfile_zcompress (struct zfile *f, void *src, int size) while (v == Z_OK) { zs.next_out = outbuf; zs.avail_out = sizeof (outbuf); - v = deflate(&zs, Z_NO_FLUSH | Z_FINISH); + v = pdeflate(&zs, Z_NO_FLUSH | Z_FINISH); if (sizeof(outbuf) - zs.avail_out > 0) zfile_fwrite (outbuf, 1, sizeof (outbuf) - zs.avail_out, f); } - deflateEnd(&zs); + pdeflateEnd(&zs); return zs.total_out; } -- 2.47.3