calltrap (deftrap2 (nullfunc, TRAPFLAG_NO_RETVAL, ""));
org (rtarea_base + 0xFF80);
- calltrap (deftrap2 (getchipmemsize, TRAPFLAG_DORET, ""));
+ calltrap (deftrapres (getchipmemsize, TRAPFLAG_DORET, "getchipmemsize"));
org (rtarea_base + 0xFF10);
- calltrap (deftrap2 (uae_puts, TRAPFLAG_NO_RETVAL, ""));
+ calltrap (deftrapres (uae_puts, TRAPFLAG_NO_RETVAL, "uae_puts"));
dw (RTS);
org (a);
ddat1use = ddat2use = 0;
bltstate = BLT_done;
blitter_done_notify ();
- INTREQ(0x8040);
- event2_remevent(ev2_blitter);
+ INTREQ (0x8040);
+ event2_remevent (ev2_blitter);
unset_special (®s, SPCFLAG_BLTNASTY);
#ifdef BLITTER_DEBUG
write_log ("vpos=%d, cycles %d, missed %d, total %d\n",
}
}
-static void write_compatibility_cpu(struct zfile *f, struct uae_prefs *p)
+static void write_compatibility_cpu (struct zfile *f, struct uae_prefs *p)
{
char tmp[100];
int model;
copper_enabled_thisline = 0;
cop_state.strobe = num;
- if (nocustom()) {
+ if (nocustom ()) {
immediate_copper (num);
return;
}
return 1;
}
-static int custom_wput_copper(int hpos, uaecptr addr, uae_u32 value, int noget)
+static int custom_wput_copper (int hpos, uaecptr addr, uae_u32 value, int noget)
{
debug_wputpeek (0xdff000 + (cop_state.saved_i1 & 0x1fe), cop_state.saved_i2);
return custom_wput_1 (hpos, addr, value, noget);
cop_state.last_write = cop_state.saved_i1;
cop_state.last_write_hpos = old_hpos;
old_hpos++;
- if (!nocustom() && cop_state.saved_i1 >= 0x140 && cop_state.saved_i1 < 0x180 && old_hpos >= SPR0_HPOS && old_hpos < SPR0_HPOS + 4 * MAX_SPRITES) {
+ if (!nocustom () && cop_state.saved_i1 >= 0x140 && cop_state.saved_i1 < 0x180 && old_hpos >= SPR0_HPOS && old_hpos < SPR0_HPOS + 4 * MAX_SPRITES) {
//write_log ("%d:%d %04.4X:%04.4X\n", vpos, old_hpos, cop_state.saved_i1, cop_state.saved_i2);
do_sprites (old_hpos);
}
int vp = vpos & (((cop_state.saved_i2 >> 8) & 0x7F) | 0x80);
int c_hpos = cop_state.hpos;
- if (nocustom())
+ if (nocustom ())
return;
if (cop_state.state == COP_wait && vp < cop_state.vcmp) {
if (copper_cant_read (old_hpos))
continue;
cop_state.i2 = chipmem_agnus_wget (cop_state.ip);
- alloc_cycle(old_hpos, CYCLE_COPPER);
+ alloc_cycle (old_hpos, CYCLE_COPPER);
cop_state.ip += 2;
if (cop_state.ignore_next) {
cop_state.ignore_next = 0;
/* another undocumented copper feature:
copper stops if skipped instruction is MOVE to dangerous register...
*/
- test_copper_dangerous (chipmem_agnus_wget(cop_state.ip));
+ test_copper_dangerous (chipmem_agnus_wget (cop_state.ip));
}
#ifdef DEBUGGER
{
copper_enabled_thisline = 0;
unset_special (®s, SPCFLAG_COPPER);
- if (!dmaen (DMA_COPPER) || cop_state.state == COP_stop || cop_state.state == COP_bltwait || nocustom())
+ if (!dmaen (DMA_COPPER) || cop_state.state == COP_stop || cop_state.state == COP_bltwait || nocustom ())
return;
if (cop_state.state == COP_wait) {
cop_state.hpos = current_hpos () & ~1;
cop_state.vpos = vpos;
- /* apparently there is small delay until copper wakes up.. */
- cop_state.state = COP_wait_in2;
+ cop_state.state = COP_read1;
compute_spcflag_copper ();
}
filesys_vsync ();
init_hardware_frame ();
+
}
#ifdef JIT
}
{
- //extern void uaenet_fake_int_handler (void);
extern int volatile uaenet_int_requested;
extern int volatile uaenet_vsync_requested;
if (uaenet_int_requested || (uaenet_vsync_requested && vpos == 10)) {
INTREQ (0x8000 | 0x2000);
- //uaenet_fake_int_handler ();
}
}
ham_decode_pixel = src_pixel;
ham_lastcolor = color_reg_get (&colors_for_drawing, 0);
- if (! bplham || (bplplanecnt != 6 && ((currprefs.chipset_mask & CSMASK_AGA) == 0 || bplplanecnt != 8))) {
+ if (!bplham) {
if (unpainted_amiga > 0) {
int pv = pixdata.apixels[ham_decode_pixel + unpainted_amiga - 1];
#ifdef AGA
}
#ifdef AGA
} else if (currprefs.chipset_mask & CSMASK_AGA) {
- if (bplplanecnt == 8) { /* AGA mode HAM8 */
+ if (bplplanecnt >= 7) { /* AGA mode HAM8 */
while (unpainted_amiga-- > 0) {
int pv = pixdata.apixels[ham_decode_pixel++];
- switch (pv & 0x3) {
- case 0x0: ham_lastcolor = colors_for_drawing.color_regs_aga[pv >> 2]; break;
- case 0x1: ham_lastcolor &= 0xFFFF03; ham_lastcolor |= (pv & 0xFC); break;
- case 0x2: ham_lastcolor &= 0x03FFFF; ham_lastcolor |= (pv & 0xFC) << 16; break;
- case 0x3: ham_lastcolor &= 0xFF03FF; ham_lastcolor |= (pv & 0xFC) << 8; break;
+ switch (pv & 0x3)
+ {
+ case 0x0: ham_lastcolor = colors_for_drawing.color_regs_aga[pv >> 2]; break;
+ case 0x1: ham_lastcolor &= 0xFFFF03; ham_lastcolor |= (pv & 0xFC); break;
+ case 0x2: ham_lastcolor &= 0x03FFFF; ham_lastcolor |= (pv & 0xFC) << 16; break;
+ case 0x3: ham_lastcolor &= 0xFF03FF; ham_lastcolor |= (pv & 0xFC) << 8; break;
}
}
- } else if (bplplanecnt == 6) { /* AGA mode HAM6 */
+ } else { /* AGA mode HAM6 */
while (unpainted_amiga-- > 0) {
int pv = pixdata.apixels[ham_decode_pixel++];
- switch (pv & 0x30) {
- case 0x00: ham_lastcolor = colors_for_drawing.color_regs_aga[pv]; break;
- case 0x10: ham_lastcolor &= 0xFFFF00; ham_lastcolor |= (pv & 0xF) << 4; break;
- case 0x20: ham_lastcolor &= 0x00FFFF; ham_lastcolor |= (pv & 0xF) << 20; break;
- case 0x30: ham_lastcolor &= 0xFF00FF; ham_lastcolor |= (pv & 0xF) << 12; break;
+ switch (pv & 0x30)
+ {
+ case 0x00: ham_lastcolor = colors_for_drawing.color_regs_aga[pv]; break;
+ case 0x10: ham_lastcolor &= 0xFFFF00; ham_lastcolor |= (pv & 0xF) << 4; break;
+ case 0x20: ham_lastcolor &= 0x00FFFF; ham_lastcolor |= (pv & 0xF) << 20; break;
+ case 0x30: ham_lastcolor &= 0xFF00FF; ham_lastcolor |= (pv & 0xF) << 12; break;
}
}
}
#endif
} else {
- if (bplplanecnt == 6) { /* OCS/ECS mode HAM6 */
- while (unpainted_amiga-- > 0) {
- int pv = pixdata.apixels[ham_decode_pixel++];
- switch (pv & 0x30) {
- case 0x00: ham_lastcolor = colors_for_drawing.color_regs_ecs[pv]; break;
- case 0x10: ham_lastcolor &= 0xFF0; ham_lastcolor |= (pv & 0xF); break;
- case 0x20: ham_lastcolor &= 0x0FF; ham_lastcolor |= (pv & 0xF) << 8; break;
- case 0x30: ham_lastcolor &= 0xF0F; ham_lastcolor |= (pv & 0xF) << 4; break;
- }
+ /* OCS/ECS mode HAM6 */
+ while (unpainted_amiga-- > 0) {
+ int pv = pixdata.apixels[ham_decode_pixel++];
+ switch (pv & 0x30)
+ {
+ case 0x00: ham_lastcolor = colors_for_drawing.color_regs_ecs[pv]; break;
+ case 0x10: ham_lastcolor &= 0xFF0; ham_lastcolor |= (pv & 0xF); break;
+ case 0x20: ham_lastcolor &= 0x0FF; ham_lastcolor |= (pv & 0xF) << 8; break;
+ case 0x30: ham_lastcolor &= 0xF0F; ham_lastcolor |= (pv & 0xF) << 4; break;
}
}
}
{
int todraw_amiga = res_shift_from_window (stoppos - pix);
- if (! bplham || (bplplanecnt != 6 && ((currprefs.chipset_mask & CSMASK_AGA) == 0 || bplplanecnt != 8))) {
+ if (!bplham) {
while (todraw_amiga-- > 0) {
int pv = pixdata.apixels[ham_decode_pixel];
#ifdef AGA
}
#ifdef AGA
} else if (currprefs.chipset_mask & CSMASK_AGA) {
- if (bplplanecnt == 8) { /* AGA mode HAM8 */
+ if (bplplanecnt >= 7) { /* AGA mode HAM8 */
while (todraw_amiga-- > 0) {
int pv = pixdata.apixels[ham_decode_pixel];
- switch (pv & 0x3) {
- case 0x0: ham_lastcolor = colors_for_drawing.color_regs_aga[pv >> 2]; break;
- case 0x1: ham_lastcolor &= 0xFFFF03; ham_lastcolor |= (pv & 0xFC); break;
- case 0x2: ham_lastcolor &= 0x03FFFF; ham_lastcolor |= (pv & 0xFC) << 16; break;
- case 0x3: ham_lastcolor &= 0xFF03FF; ham_lastcolor |= (pv & 0xFC) << 8; break;
+ switch (pv & 0x3)
+ {
+ case 0x0: ham_lastcolor = colors_for_drawing.color_regs_aga[pv >> 2]; break;
+ case 0x1: ham_lastcolor &= 0xFFFF03; ham_lastcolor |= (pv & 0xFC); break;
+ case 0x2: ham_lastcolor &= 0x03FFFF; ham_lastcolor |= (pv & 0xFC) << 16; break;
+ case 0x3: ham_lastcolor &= 0xFF03FF; ham_lastcolor |= (pv & 0xFC) << 8; break;
}
ham_linebuf[ham_decode_pixel++] = ham_lastcolor;
}
- } else if (bplplanecnt == 6) { /* AGA mode HAM6 */
+ } else { /* AGA mode HAM6 */
while (todraw_amiga-- > 0) {
int pv = pixdata.apixels[ham_decode_pixel];
- switch (pv & 0x30) {
- case 0x00: ham_lastcolor = colors_for_drawing.color_regs_aga[pv]; break;
- case 0x10: ham_lastcolor &= 0xFFFF00; ham_lastcolor |= (pv & 0xF) << 4; break;
- case 0x20: ham_lastcolor &= 0x00FFFF; ham_lastcolor |= (pv & 0xF) << 20; break;
- case 0x30: ham_lastcolor &= 0xFF00FF; ham_lastcolor |= (pv & 0xF) << 12; break;
+ switch (pv & 0x30)
+ {
+ case 0x00: ham_lastcolor = colors_for_drawing.color_regs_aga[pv]; break;
+ case 0x10: ham_lastcolor &= 0xFFFF00; ham_lastcolor |= (pv & 0xF) << 4; break;
+ case 0x20: ham_lastcolor &= 0x00FFFF; ham_lastcolor |= (pv & 0xF) << 20; break;
+ case 0x30: ham_lastcolor &= 0xFF00FF; ham_lastcolor |= (pv & 0xF) << 12; break;
}
ham_linebuf[ham_decode_pixel++] = ham_lastcolor;
}
}
#endif
} else {
- if (bplplanecnt == 6) { /* OCS/ECS mode HAM6 */
- while (todraw_amiga-- > 0) {
- int pv = pixdata.apixels[ham_decode_pixel];
- switch (pv & 0x30) {
- case 0x00: ham_lastcolor = colors_for_drawing.color_regs_ecs[pv]; break;
- case 0x10: ham_lastcolor &= 0xFF0; ham_lastcolor |= (pv & 0xF); break;
- case 0x20: ham_lastcolor &= 0x0FF; ham_lastcolor |= (pv & 0xF) << 8; break;
- case 0x30: ham_lastcolor &= 0xF0F; ham_lastcolor |= (pv & 0xF) << 4; break;
- }
- ham_linebuf[ham_decode_pixel++] = ham_lastcolor;
+ /* OCS/ECS mode HAM6 */
+ while (todraw_amiga-- > 0) {
+ int pv = pixdata.apixels[ham_decode_pixel];
+ switch (pv & 0x30)
+ {
+ case 0x00: ham_lastcolor = colors_for_drawing.color_regs_ecs[pv]; break;
+ case 0x10: ham_lastcolor &= 0xFF0; ham_lastcolor |= (pv & 0xF); break;
+ case 0x20: ham_lastcolor &= 0x0FF; ham_lastcolor |= (pv & 0xF) << 8; break;
+ case 0x30: ham_lastcolor &= 0xF0F; ham_lastcolor |= (pv & 0xF) << 4; break;
}
+ ham_linebuf[ham_decode_pixel++] = ham_lastcolor;
}
}
}
static void mix (void)
{
- int total = ((uae_u8*)sndbufpt - (uae_u8*)sndbuffer) / (get_audio_nativechannels() * 2);
+ int total = ((uae_u8*)sndbufpt - (uae_u8*)sndbuffer) / (get_audio_nativechannels () * 2);
if (currprefs.dfxclickvolume > 0) {
while (clickcnt < total) {
- clickbuffer[clickcnt++] = getsample() * (100 - currprefs.dfxclickvolume) / 100;
+ clickbuffer[clickcnt++] = getsample () * (100 - currprefs.dfxclickvolume) / 100;
}
} else {
while (clickcnt < total) {
- clickbuffer[clickcnt++] = getsample();
+ clickbuffer[clickcnt++] = getsample ();
}
}
}
if (!wave_initialized)
return;
- mix();
+ mix ();
clickcnt = 0;
- if (!get_audio_ismono ()) {
- for (i = 0; i < size / 2; i++) {
- uae_s16 s = clickbuffer[i];
- sndbuffer[0] = limit(((sndbuffer[0] + s) * 2) / 3);
- sndbuffer[1] = limit(((sndbuffer[1] + s) * 2) / 3);
- sndbuffer += 2;
- }
- } else {
- for (i = 0; i < size; i++) {
- sndbuffer[0] = limit(((sndbuffer[0] + clickbuffer[i]) * 2) / 3);
- sndbuffer++;
- }
+ switch (get_audio_nativechannels ())
+ {
+ case 6:
+ for (i = 0; i < size / 6; i++) {
+ uae_s16 s = clickbuffer[i];
+ sndbuffer[0] = limit (((sndbuffer[0] + s) * 2) / 3);
+ sndbuffer[1] = limit (((sndbuffer[1] + s) * 2) / 3);
+ sndbuffer[2] = limit (((sndbuffer[2] + s) * 2) / 3);
+ sndbuffer[3] = limit (((sndbuffer[3] + s) * 2) / 3);
+ sndbuffer[4] = limit (((sndbuffer[4] + s) * 2) / 3);
+ sndbuffer[5] = limit (((sndbuffer[5] + s) * 2) / 3);
+ sndbuffer += 6;
+ }
+ break;
+ case 4:
+ for (i = 0; i < size / 4; i++) {
+ uae_s16 s = clickbuffer[i];
+ sndbuffer[0] = limit (((sndbuffer[0] + s) * 2) / 3);
+ sndbuffer[1] = limit (((sndbuffer[1] + s) * 2) / 3);
+ sndbuffer[2] = limit (((sndbuffer[2] + s) * 2) / 3);
+ sndbuffer[3] = limit (((sndbuffer[3] + s) * 2) / 3);
+ sndbuffer += 4;
+ }
+ break;
+ case 2:
+ for (i = 0; i < size / 2; i++) {
+ uae_s16 s = clickbuffer[i];
+ sndbuffer[0] = limit (((sndbuffer[0] + s) * 2) / 3);
+ sndbuffer[1] = limit (((sndbuffer[1] + s) * 2) / 3);
+ sndbuffer += 2;
+ }
+ break;
+ case 1:
+ for (i = 0; i < size; i++) {
+ sndbuffer[0] = limit (((sndbuffer[0] + clickbuffer[i]) * 2) / 3);
+ sndbuffer++;
+ }
+ break;
}
}
static void dr_audio_activate(void)
{
- if (audio_activate())
+ if (audio_activate ())
clickcnt = 0;
}
return;
if (prevcyl[drive] == 0 && cyl == 0) // "noclick" check
return;
- dr_audio_activate();
+ dr_audio_activate ();
prevcyl[drive] = cyl;
if (!wave_initialized) {
driveclick_fdrawcmd_seek (currprefs.dfxclick[drive] - 2, cyl);
return;
}
- mix();
+ mix ();
drvs[drive][DS_CLICK].pos = drvs[drive][DS_CLICK].indexes[cyl] << DS_SHIFT;
drvs[drive][DS_CLICK].len = (drvs[drive][DS_CLICK].indexes[cyl] + (drvs[drive][DS_CLICK].lengths[cyl] / 2)) << DS_SHIFT;
}
driveclick_fdrawcmd_motor (currprefs.dfxclick[drive] - 2, running);
return;
}
- mix();
+ mix ();
if (running == 0) {
drv_starting[drive] = 0;
drv_spinning[drive] = 0;
{
int i;
- driveclick_fdrawcmd_vsync();
- if (driveclick_active())
- dr_audio_activate();
+ driveclick_fdrawcmd_vsync ();
+ if (driveclick_active ())
+ dr_audio_activate ();
if (currprefs.dfxclickvolume != changed_prefs.dfxclickvolume ||
currprefs.dfxclick[0] != changed_prefs.dfxclick[0] ||
currprefs.dfxclick[1] != changed_prefs.dfxclick[1] ||
if (currprefs.cs_cdtvcd || currprefs.cs_cdtvscsi || currprefs.uae_hide > 1)
b = RTAREA_BACKUP;
+ if (currprefs.cs_mbdmac == 1)
+ b = RTAREA_BACKUP;
ab = &get_mem_bank (RTAREA_DEFAULT);
if (ab) {
if (valid_address (RTAREA_DEFAULT, 65536))
green_shift = 5;
blue_shift = 10;
break;
+ default:
+ red_bits = rw;
+ green_bits = gw;
+ blue_bits = bw;
+ red_shift = rs;
+ green_shift = gs;
+ blue_shift = bs;
+ break;
}
memset (p96_rgbx16, 0, sizeof p96_rgbx16);
enum {
SND_MONO, SND_STEREO, SND_4CH_CLONEDSTEREO, SND_4CH, SND_6CH_CLONEDSTEREO, SND_6CH, SND_NONE };
-STATIC_INLINE int get_audio_nativechannels(void)
+STATIC_INLINE int get_audio_nativechannels (void)
{
int ch[] = { 1, 2, 4, 4, 6, 6, 0 };
return ch[currprefs.sound_stereo];
}
-STATIC_INLINE int get_audio_amigachannels(void)
+STATIC_INLINE int get_audio_amigachannels (void)
{
int ch[] = { 1, 2, 2, 4, 2, 4, 0 };
return ch[currprefs.sound_stereo];
}
-STATIC_INLINE int get_audio_ismono(void)
+STATIC_INLINE int get_audio_ismono (void)
{
if (currprefs.sound_stereo == 0)
return 1;
#define deftrap(f) define_trap((f), 0, "")
#define deftrap2(f, mode, str) define_trap((f), (mode), (str))
+#define deftrapres(f, mode, str) define_trap((f), (mode | TRAPFLAG_UAERES), (str))
extern void align (int);
extern void expansion_clear (void);
extern void uaegfx_install_code (void);
-
-#define TRAPFLAG_NO_REGSAVE 1
-#define TRAPFLAG_NO_RETVAL 2
-#define TRAPFLAG_EXTRA_STACK 4
-#define TRAPFLAG_DORET 8
-
extern int get_keyring (void);
uaecptr strcpyha_safe (uaecptr dst, const char *src);
-extern char *strcpyah_safe (char *dst, uaecptr src);
+extern char *strcpyah_safe (char *dst, uaecptr src, int maxsize);
void memcpyha_safe (uaecptr dst, const uae_u8 *src, int size);
void memcpyha (uaecptr dst, const uae_u8 *src, int size);
void memcpyah_safe (uae_u8 *dst, uaecptr src, int size);
#define TRAPFLAG_NO_RETVAL 2
#define TRAPFLAG_EXTRA_STACK 4
#define TRAPFLAG_DORET 8
+#define TRAPFLAG_UAERES 16
/*
* A function which handles a 68k trap
extern void REGPARAM3 m68k_handle_trap (unsigned int trap_num, struct regstruct *) REGPARAM;
unsigned int define_trap (TrapHandler handler_func, int flags, const char *name);
+uaecptr find_trap (const char *name);
/*
* Call a 68k Library function from an extended trap
pause_emulation = pause_emulation ? 0 : 1;
else
pause_emulation = mode;
-#ifdef RETROPLATFORM
- rp_pause (pause_emulation);
-#endif
}
int jsem_isjoy (int port, const struct uae_prefs *p)
static int canjit (void)
{
- return 1;
-#if 0
- if (canbang || currprefs.cpu_model >= 68020)
+ if (currprefs.cpu_model >= 68020)
return 1;
return 0;
-#endif
}
+
static void nocanbang (void)
{
canbang = 0;
return;
}
romlist_cnt++;
- rl = (struct romlist*)realloc (rl, sizeof (struct romlist) * romlist_cnt);
+ rl = realloc (rl, sizeof (struct romlist) * romlist_cnt);
rl2 = rl + romlist_cnt - 1;
rl2->path = my_strdup (path);
rl2->rd = rd;
max = i;
else
max = romlist_cnt;
- buf = xmalloc((sizeof (struct romlist*) + sizeof (struct romlist)) * (i + 1));
+ buf = xmalloc ((sizeof (struct romlist*) + sizeof (struct romlist)) * (i + 1));
rdout = (struct romlist**)buf;
rltmp = (struct romlist*)((uae_u8*)buf + (i + 1) * sizeof (struct romlist*));
out = 0;
if (roms[i].group == 0 && (roms[i].type == ROMTYPE_ARCADIABIOS || roms[i].type == ROMTYPE_ARCADIAGAME))
max++;
}
- buf = xmalloc((sizeof (struct romlist*) + sizeof (struct romlist)) * (max + 1));
+ buf = xmalloc ((sizeof (struct romlist*) + sizeof (struct romlist)) * (max + 1));
rdout = (struct romlist**)buf;
rltmp = (struct romlist*)((uae_u8*)buf + (max + 1) * sizeof (struct romlist*));
out = 0;
/* Slow memory */
static uae_u8 *bogomemory;
+static int bogomemory_allocated;
static uae_u32 REGPARAM3 bogomem_lget (uaecptr) REGPARAM;
static uae_u32 REGPARAM3 bogomem_wget (uaecptr) REGPARAM;
static int a3000_f0;
void a3000_fakekick (int map)
{
- static uae_u8 *blop;
+ static uae_u8 *kickstore;
if (map) {
uae_u8 *fkickmemory = a3000lmemory + allocated_a3000lmem - fkickmem_size;
if (fkickmemory[2] == 0x4e && fkickmemory[3] == 0xf9 && fkickmemory[4] == 0x00) {
- if (!blop)
- blop = xmalloc (fkickmem_size);
- memcpy (blop, kickmemory, fkickmem_size);
+ if (!kickstore)
+ kickstore = xmalloc (fkickmem_size);
+ memcpy (kickstore, kickmemory, fkickmem_size);
if (fkickmemory[5] == 0xfc) {
memcpy (kickmemory, fkickmemory, fkickmem_size / 2);
memcpy (kickmemory + fkickmem_size / 2, fkickmemory, fkickmem_size / 2);
- if (need_uae_boot_rom () != 0xf00000) {
- extendedkickmem_size = 65536;
- extendedkickmem_mask = extendedkickmem_size - 1;
- extendedkickmemory = mapped_malloc (extendedkickmem_size, "rom_f0");
- extendedkickmem_bank.baseaddr = extendedkickmemory;
- memcpy (extendedkickmemory, fkickmemory + fkickmem_size / 2, 65536);
- map_banks (&extendedkickmem_bank, 0xf0, 1, 1);
- a3000_f0 = 1;
- } else {
- write_log ("A3000 Bonus hack: can't map bonus when uae boot rom is enabled\n");
- }
+ extendedkickmem_size = 65536;
+ extendedkickmem_mask = extendedkickmem_size - 1;
+ extendedkickmemory = mapped_malloc (extendedkickmem_size, "rom_f0");
+ extendedkickmem_bank.baseaddr = extendedkickmemory;
+ memcpy (extendedkickmemory, fkickmemory + fkickmem_size / 2, 65536);
+ map_banks (&extendedkickmem_bank, 0xf0, 1, 1);
+ a3000_f0 = 1;
} else {
memcpy (kickmemory, fkickmemory, fkickmem_size);
}
} else {
if (a3000_f0) {
map_banks (&dummy_bank, 0xf0, 1, 1);
- mapped_free(extendedkickmemory);
+ mapped_free (extendedkickmemory);
extendedkickmemory = NULL;
a3000_f0 = 0;
}
- if (blop)
- memcpy (kickmemory, blop, fkickmem_size);
- xfree(blop);
- blop = NULL;
+ if (kickstore)
+ memcpy (kickmemory, kickstore, fkickmem_size);
+ xfree (kickstore);
+ kickstore = NULL;
}
}
static void allocate_memory (void)
{
+ /* emulate 0.5M+0.5M with 1M Agnus chip ram aliasing */
+ if ((allocated_chipmem != currprefs.chipmem_size || allocated_bogomem != currprefs.bogomem_size) &&
+ currprefs.chipmem_size == 0x80000 && currprefs.bogomem_size >= 0x80000 &&
+ (currprefs.chipset_mask & CSMASK_ECS_AGNUS) && !(currprefs.chipset_mask & CSMASK_AGA) && !canjit ()) {
+ int memsize1, memsize2;
+ if (chipmemory)
+ mapped_free (chipmemory);
+ chipmemory = 0;
+ if (bogomemory_allocated)
+ mapped_free (bogomemory);
+ bogomemory = 0;
+ bogomemory_allocated = 0;
+ memsize1 = allocated_chipmem = currprefs.chipmem_size;
+ memsize2 = allocated_bogomem = currprefs.bogomem_size;
+ chipmem_mask = allocated_chipmem - 1;
+ chipmem_full_mask = allocated_chipmem * 2 - 1;
+ chipmemory = mapped_malloc (memsize1 + memsize2, "chip");
+ bogomemory = chipmemory + memsize1;
+ bogomem_mask = allocated_bogomem - 1;
+ if (chipmemory == 0) {
+ write_log ("Fatal error: out of memory for chipmem.\n");
+ allocated_chipmem = 0;
+ } else {
+ need_hardreset = 1;
+ }
+ }
+
if (allocated_chipmem != currprefs.chipmem_size) {
int memsize;
if (chipmemory)
if (memsize != allocated_chipmem)
memset (chipmemory + allocated_chipmem, 0xff, memsize - allocated_chipmem);
}
- }
-
- currprefs.chipset_mask = changed_prefs.chipset_mask;
- chipmem_full_mask = allocated_chipmem - 1;
- if (currprefs.chipset_mask & CSMASK_ECS_AGNUS) {
- if (allocated_chipmem < 0x100000)
- chipmem_full_mask = 0x100000 - 1;
- if (allocated_chipmem > 0x100000 && allocated_chipmem < 0x200000)
- chipmem_full_mask = chipmem_mask = 0x200000 - 1;
+ currprefs.chipset_mask = changed_prefs.chipset_mask;
+ chipmem_full_mask = allocated_chipmem - 1;
+ if (currprefs.chipset_mask & CSMASK_ECS_AGNUS) {
+ if (allocated_chipmem < 0x100000)
+ chipmem_full_mask = 0x100000 - 1;
+ if (allocated_chipmem > 0x100000 && allocated_chipmem < 0x200000)
+ chipmem_full_mask = chipmem_mask = 0x200000 - 1;
+ }
}
if (allocated_bogomem != currprefs.bogomem_size) {
- if (bogomemory)
+ if (bogomemory_allocated)
mapped_free (bogomemory);
bogomemory = 0;
+ bogomemory_allocated = 0;
allocated_bogomem = currprefs.bogomem_size;
bogomem_mask = allocated_bogomem - 1;
map_banks (&dummy_bank, 0, 32, 0);
if (!isdirectjit ()) {
map_banks (cb, 0, size, allocated_chipmem);
- if (currprefs.chipset_mask & CSMASK_ECS_AGNUS) {
+ if ((currprefs.chipset_mask & CSMASK_ECS_AGNUS) && allocated_bogomem == 0) {
int start = allocated_chipmem >> 16;
if (allocated_chipmem < 0x100000) {
int dummy = (0x100000 - allocated_chipmem) >> 16;
if (a1000_bootrom)
a1000_handle_kickstart (1);
+
#ifdef AUTOCONFIG
map_banks (&expamem_bank, 0xE8, 1, 0);
#endif
+
if (a3000_f0)
- a3000_fakekick (1);
+ map_banks (&extendedkickmem_bank, 0xf0, 1, 0);
/* Map the chipmem into all of the lower 8MB */
map_overlay (1);
#endif
}
-void memory_hardreset(void)
+void memory_hardreset (void)
{
if (savestate_state == STATE_RESTORE)
return;
memset (a3000lmemory, 0, allocated_a3000lmem);
if (a3000hmemory)
memset (a3000hmemory, 0, allocated_a3000hmem);
- expansion_clear();
+ expansion_clear ();
}
void map_banks (addrbank *bank, int start, int size, int realsize)
addrbank *orgbank = bank;
uae_u32 realstart = start;
+ //write_log ("MAP_BANK %04X0000 %d %s\n", start, size, bank->name);
+
flush_icache (1); /* Sure don't want to keep any old mappings around! */
#ifdef NATMEM_OFFSET
delete_shmmaps (start << 16, size << 16);
realsize = size << 16;
if ((size << 16) < realsize) {
- gui_message ("Broken mapping, size=%x, realsize=%x\nStart is %x\n",
+ write_log ("Broken mapping, size=%x, realsize=%x\nStart is %x\n",
size, realsize, start);
}
/* memory save/restore code */
-uae_u8 *save_bootrom(int *len)
+uae_u8 *save_bootrom (int *len)
{
if (!uae_boot_rom)
return 0;
if (dstptr)
dstbak = dst = dstptr;
else
- dstbak = dst = (uae_u8*)xmalloc (4 + 4 + 4 + 4 + 4 + 256 + 256 + mem_size);
+ dstbak = dst = xmalloc (4 + 4 + 4 + 4 + 4 + 256 + 256 + mem_size);
save_u32 (mem_start);
save_u32 (mem_size);
save_u32 (mem_type);
strcpy (dst, tmpname);
dst += strlen (dst) + 1;
strcpy (dst, path);/* rom image name */
- dst += strlen(dst) + 1;
+ dst += strlen (dst) + 1;
if (saverom) {
for (i = 0; i < mem_size; i++)
*dst++ = byteget (mem_start + i);
void memcpyha_safe (uaecptr dst, const uae_u8 *src, int size)
{
- if (!addr_valid("memcpyha", dst, size))
+ if (!addr_valid ("memcpyha", dst, size))
return;
while (size--)
put_byte (dst++, *src++);
}
void memcpyah_safe (uae_u8 *dst, uaecptr src, int size)
{
- if (!addr_valid("memcpyah", src, size))
+ if (!addr_valid ("memcpyah", src, size))
return;
while (size--)
*dst++ = get_byte (src++);
while (size--)
*dst++ = get_byte (src++);
}
-char *strcpyah_safe (char *dst, uaecptr src)
+char *strcpyah_safe (char *dst, uaecptr src, int maxsize)
{
char *res = dst;
uae_u8 b;
do {
- if (!addr_valid("strcpyah", src, 1))
+ if (!addr_valid ("strcpyah", src, 1))
return res;
b = get_byte (src++);
*dst++ = b;
+ maxsize--;
+ if (maxsize <= 1) {
+ *dst++= 0;
+ break;
+ }
} while (b);
return res;
}
uaecptr res = dst;
uae_u8 b;
do {
- if (!addr_valid("strcpyha", dst, 1))
+ if (!addr_valid ("strcpyha", dst, 1))
return res;
b = *src++;
put_byte (dst++, b);
STATIC_INLINE void do_interrupt (int nr, struct regstruct *regs)
{
+ int vector;
#if 0
if (nr == 2)
write_log (".");
regs->stopped = 0;
unset_special (regs, SPCFLAG_STOP);
assert (nr < 8 && nr >= 0);
- Exception (nr + 24, regs, 0);
+
+ if (currprefs.cpu_cycle_exact)
+ vector = get_byte_ce (0x00fffff1 | (nr << 1));
+ else if (currprefs.cpu_model <= 68010)
+ vector = get_byte (0x00fffff1 | (nr << 1));
+ else
+ vector = nr + 24;
+
+ Exception (vector, regs, 0);
regs->intmask = nr;
doint ();
static LPSTR lpData,sndptrout;
extern uae_u32 chipmem_mask;
unsigned int *sndbufrecpt;
-static char *ahisndbuffer,*sndrecbuffer;
-static int ahisndbufsize,*ahisndbufpt,ahitweak;;
+static char *ahisndbuffer, *sndrecbuffer;
+static int ahisndbufsize, *ahisndbufpt, ahitweak;;
int ahi_pollrate = 40;
int sound_freq_ahi, sound_channels_ahi, sound_bits_ahi;
-static int vin,devicenum;
+static int vin, devicenum;
static int amigablksize;
static DWORD sound_flushes2 = 0;
#if defined(X86_MSVC_ASSEMBLY)
-#define CREATE_NATIVE_FUNC_PTR2 uae_u32 (* native_func)( uae_u32, uae_u32, uae_u32, uae_u32, uae_u32, uae_u32, uae_u32, \
+#define CREATE_NATIVE_FUNC_PTR2 uae_u32 (*native_func)(uae_u32, uae_u32, uae_u32, uae_u32, uae_u32, uae_u32, uae_u32,\
uae_u32, uae_u32, uae_u32, uae_u32, uae_u32, uae_u32,uae_u32,uae_u32)
#define SET_NATIVE_FUNC2(x) native_func = (uae_u32 (*)(uae_u32, uae_u32, uae_u32, uae_u32, uae_u32, uae_u32, uae_u32, uae_u32, uae_u32, uae_u32, uae_u32, uae_u32, uae_u32,uae_u32,uae_u32))(x)
-#define CALL_NATIVE_FUNC2( d1,d2,d3,d4,d5,d6,d7,a1,a2,a3,a4,a5,a6,a7) if(native_func) return native_func( d1,d2,d3,d4,d5,d6,d7,a1,a2,a3,a4,a5,a6,a7,regs_ )
+#define CALL_NATIVE_FUNC2(d1,d2,d3,d4,d5,d6,d7,a1,a2,a3,a4,a5,a6,a7) if(native_func) return native_func(d1,d2,d3,d4,d5,d6,d7,a1,a2,a3,a4,a5,a6,a7,regs_)
static uae_u32 REGPARAM2 emulib_ExecuteNativeCode2 (TrapContext *context)
{
uaevar.z3offset = (uae_u32)(get_real_address (0x10000000) - 0x10000000);
uaevar.amigawnd = hAmigaWnd;
a6 = &uaevar;
- if(object_UAM) {
- SET_NATIVE_FUNC2(object_UAM);
+ if (object_UAM) {
+ SET_NATIVE_FUNC2 (object_UAM);
__asm
{ mov espstore,esp
push regs_
return;
ahi_on = 0;
record_enabled = 0;
- ahisndbufpt = (int*) ahisndbuffer;
+ ahisndbufpt = (int*)ahisndbuffer;
if (lpDSB2) {
hr = IDirectSoundBuffer_Stop (lpDSB2);
- if(FAILED(hr))
- write_log ( "AHI: SoundStop() failure: %s\n", DXError(hr));
+ if(FAILED (hr))
+ write_log ("AHI: SoundStop() failure: %s\n", DXError (hr));
} else {
- write_log ( "AHI: Sound Stopped...\n" );
+ write_log ("AHI: Sound Stopped...\n");
}
if (lpDSB2)
IDirectSound_Release (lpDS2r);
lpDS2r = NULL;
if (ahisndbuffer)
- free(ahisndbuffer);
+ free (ahisndbuffer);
ahisndbuffer = NULL;
}
LPVOID dwData1, dwData2;
static int oldpos;
- if(sound_flushes2 == 1) {
+ if (sound_flushes2 == 1) {
oldpos = 0;
intcount = 1;
INTREQ_f (0x8000 | 0x2000);
- hr = IDirectSoundBuffer_Play(lpDSB2, 0, 0, DSBPLAY_LOOPING);
+ hr = IDirectSoundBuffer_Play (lpDSB2, 0, 0, DSBPLAY_LOOPING);
if(hr == DSERR_BUFFERLOST) {
- IDirectSoundBuffer_Restore(lpDSB2);
- hr = IDirectSoundBuffer_Play(lpDSB2, 0, 0, DSBPLAY_LOOPING);
+ IDirectSoundBuffer_Restore (lpDSB2);
+ hr = IDirectSoundBuffer_Play (lpDSB2, 0, 0, DSBPLAY_LOOPING);
}
}
- hr = IDirectSoundBuffer_GetCurrentPosition(lpDSB2, &pos, 0);
- if(hr != DSERR_BUFFERLOST) {
+ hr = IDirectSoundBuffer_GetCurrentPosition (lpDSB2, &pos, 0);
+ if (hr != DSERR_BUFFERLOST) {
pos -= ahitweak;
if (pos < 0)
pos += ahisndbufsize;
}
}
- hr = IDirectSoundBuffer_Lock(lpDSB2, oldpos, amigablksize * 4, &dwData1, &dwBytes1, &dwData2, &dwBytes2, 0);
+ hr = IDirectSoundBuffer_Lock (lpDSB2, oldpos, amigablksize * 4, &dwData1, &dwBytes1, &dwData2, &dwBytes2, 0);
if(hr == DSERR_BUFFERLOST) {
write_log ("AHI: lostbuf %d %x\n", pos, amigablksize);
- IDirectSoundBuffer_Restore(lpDSB2);
- hr = IDirectSoundBuffer_Lock(lpDSB2, oldpos, amigablksize * 4, &dwData1, &dwBytes1, &dwData2, &dwBytes2, 0);
+ IDirectSoundBuffer_Restore (lpDSB2);
+ hr = IDirectSoundBuffer_Lock (lpDSB2, oldpos, amigablksize * 4, &dwData1, &dwBytes1, &dwData2, &dwBytes2, 0);
}
if(FAILED(hr))
return;
}
}
- memcpy(dwData1, ahisndbuffer, dwBytes1);
+ memcpy (dwData1, ahisndbuffer, dwBytes1);
if (dwData2)
- memcpy(dwData2, (uae_u8*)ahisndbuffer + dwBytes1, dwBytes2);
+ memcpy (dwData2, (uae_u8*)ahisndbuffer + dwBytes1, dwBytes2);
sndptrmax = ahisndbuffer + ahisndbufsize;
ahisndbufpt = (int*)ahisndbuffer;
- IDirectSoundBuffer_Unlock(lpDSB2, dwData1, dwBytes1, dwData2, dwBytes2);
+ IDirectSoundBuffer_Unlock (lpDSB2, dwData1, dwBytes1, dwData2, dwBytes2);
oldpos += amigablksize * 4;
if (oldpos >= ahisndbufsize)
}
-void ahi_finish_sound_buffer( void )
+void ahi_finish_sound_buffer (void)
{
sound_flushes2++;
ahi_updatesound(2);
HRESULT hr;
DSCBUFFERDESC sound_buffer_rec;
// Record begin
- hr = DirectSoundCaptureCreate(NULL, &lpDS2r, NULL);
- if (FAILED(hr)) {
- write_log ( "AHI: DirectSoundCaptureCreate() failure: %s\n", DXError(hr));
+ hr = DirectSoundCaptureCreate (NULL, &lpDS2r, NULL);
+ if (FAILED (hr)) {
+ write_log ( "AHI: DirectSoundCaptureCreate() failure: %s\n", DXError (hr));
record_enabled = -1;
return 0;
}
- memset (&sound_buffer_rec, 0, sizeof(DSCBUFFERDESC));
- sound_buffer_rec.dwSize = sizeof(DSCBUFFERDESC);
+ memset (&sound_buffer_rec, 0, sizeof (DSCBUFFERDESC));
+ sound_buffer_rec.dwSize = sizeof (DSCBUFFERDESC);
sound_buffer_rec.dwBufferBytes = amigablksize * 4 * RECORDBUFFER;
sound_buffer_rec.lpwfxFormat = &wavfmt;
sound_buffer_rec.dwFlags = 0 ;
- hr = IDirectSoundCapture_CreateCaptureBuffer(lpDS2r, &sound_buffer_rec, &lpDSB2r, NULL);
- if (FAILED(hr)) {
+ hr = IDirectSoundCapture_CreateCaptureBuffer (lpDS2r, &sound_buffer_rec, &lpDSB2r, NULL);
+ if (FAILED (hr)) {
write_log ("AHI: CreateCaptureSoundBuffer() failure: %s\n", DXError(hr));
record_enabled = -1;
return 0;
}
- hr = IDirectSoundCaptureBuffer_Start(lpDSB2r, DSCBSTART_LOOPING);
- if (FAILED(hr)) {
- write_log ("AHI: DirectSoundCaptureBuffer_Start failed: %s\n", DXError(hr));
+ hr = IDirectSoundCaptureBuffer_Start (lpDSB2r, DSCBSTART_LOOPING);
+ if (FAILED (hr)) {
+ write_log ("AHI: DirectSoundCaptureBuffer_Start failed: %s\n", DXError (hr));
record_enabled = -1;
return 0;
}
if (!lpDS2)
return;
hr = IDirectSoundBuffer_SetVolume (lpDSB2, vol);
- if (FAILED(hr))
+ if (FAILED (hr))
write_log ("AHI: SetVolume(%d) failed: %s\n", vol, DXError (hr));
}
return 0;
soundneutral = 0;
ahisndbufsize = (amigablksize * 4) * NATIVBUFFNUM; // use 4 native buffer
- ahisndbuffer = malloc(ahisndbufsize + 32);
+ ahisndbuffer = malloc (ahisndbufsize + 32);
if (!ahisndbuffer)
return 0;
hr = DirectSoundCreate (&sound_device_guid[currprefs.win32_soundcard], &lpDS2, NULL);
if (FAILED (hr)) {
- write_log ( "AHI: DirectSoundCreate() failure: %s\n", DXError (hr));
+ write_log ("AHI: DirectSoundCreate() failure: %s\n", DXError (hr));
return 0;
}
memset (&sound_buffer, 0, sizeof (DSBUFFERDESC));
sound_buffer.lpwfxFormat = NULL;
DSCaps.dwSize = sizeof(DSCAPS);
- hr = IDirectSound_GetCaps(lpDS2, &DSCaps);
- if (SUCCEEDED(hr)) {
+ hr = IDirectSound_GetCaps (lpDS2, &DSCaps);
+ if (SUCCEEDED (hr)) {
if (DSCaps.dwFlags & DSCAPS_EMULDRIVER)
write_log ( "AHI: Your DirectSound Driver is emulated via WaveOut - yuck!\n");
}
}
hr = IDirectSoundBuffer_SetFormat (lpDSBprimary2, &wavfmt);
if (FAILED (hr)) {
- write_log ( "AHI: SetFormat() failure: %s\n", DXError (hr));
+ write_log ("AHI: SetFormat() failure: %s\n", DXError (hr));
return 0;
}
sound_buffer.dwBufferBytes = ahisndbufsize;
sound_buffer.dwFlags = DSBCAPS_CTRLFREQUENCY | DSBCAPS_CTRLVOLUME
| DSBCAPS_GETCURRENTPOSITION2 | DSBCAPS_GLOBALFOCUS | DSBCAPS_LOCSOFTWARE;
sound_buffer.guid3DAlgorithm = GUID_NULL;
- hr = IDirectSound_CreateSoundBuffer(lpDS2, &sound_buffer, &lpDSB2, NULL);
+ hr = IDirectSound_CreateSoundBuffer (lpDS2, &sound_buffer, &lpDSB2, NULL);
if (FAILED (hr)) {
write_log ("AHI: CreateSoundBuffer() failure: %s\n", DXError (hr));
return 0;
setvolume_ahi (0);
- hr = IDirectSoundBuffer_GetFormat(lpDSBprimary2,&wavfmt,500,0);
- if(FAILED(hr)) {
- write_log ("AHI: GetFormat() failure: %s\n", DXError(hr));
+ hr = IDirectSoundBuffer_GetFormat (lpDSBprimary2,&wavfmt,500,0);
+ if (FAILED (hr)) {
+ write_log ("AHI: GetFormat() failure: %s\n", DXError (hr));
return 0;
}
ahisndbufpt =(int*)ahisndbuffer;
sndptrmax = ahisndbuffer + ahisndbufsize;
- memset(ahisndbuffer, soundneutral, amigablksize * 8);
+ memset (ahisndbuffer, soundneutral, amigablksize * 8);
ahi_on = 1;
return sound_freq_ahi;
}
if (!sound_freq_ahi)
return 0;
if (ahi_on)
- ahi_close_sound();
+ ahi_close_sound ();
sound_flushes2 = 1;
if ((rate = ahi_init_sound_win32 ()))
return rate;
: License version 2 as published by the Free Software Foundation.
Authors : os, mcb
Created : 2007-08-27 13:55:49
- Updated : 2008-05-20 10:37:00
+ Updated : 2008-05-27 10:37:00
Comment : RP Player interprocess communication include file
*****************************************************************************/
#define RPIPCGM_ESCAPED (WM_APP + 20)
#define RPIPCGM_PARENT (WM_APP + 21)
#define RPIPCGM_DEVICESEEK (WM_APP + 22)
+#define RPIPCGM_CLOSE (WM_APP + 23)
// ****************************************************************************
#define RP_FEATURE_PAUSE 0x00000080 // pause functionality is available (see RPIPCHM_PAUSE message)
#define RP_FEATURE_TURBO 0x00000100 // turbo mode functionality is available (see RPIPCHM_TURBO message)
#define RP_FEATURE_VOLUME 0x00000200 // volume adjustment is possible (see RPIPCHM_VOLUME message)
-#define RP_FEATURE_STATE 0x00000400 // loading and saving of emulation state is supported (see RPIPCHM_SAVESTATE message)
+#define RP_FEATURE_STATE 0x00000400 // loading and saving of emulation state is supported (see RPIPCHM_SAVESTATE/RPIPCHM_LOADSTATE message)
// Screen Modes
#define RP_SCREENMODE_1X 0x00000000 // 1x window or full-screen mode ("CGA mode")
Description:
the guest sends a RPIPCGM_SCREENMODE message to notify the host
about a change in its "screen mode"
- (1x/2x/3x/4x, full screen, clipping coordinates, etc.);
+ (1x/2x/3x/4x, full screen, clipping coordinates, etc.),
+ or to keep the host updated about the guest window handle
+ (just before destroying its window, the guest sends this message
+ with the hGuestWindow field of the RPSCREENMODE structure set to NULL);
screen mode changes requested by the host
(see the RPIPCHM_SCREENMODE message) must not be notified,
unless this is an asynchronous screen mode change
(i.e. the guest returned the INVALID_HANDLE_VALUE
response to a RPIPCHM_SCREENMODE host request);
- this message can also be sent when the guest has to close
- and reopen its window for other reasons;
at startup-time, the guest must create
a borderless and hidden window and send its handle
using this message; the host will then take care
the guest sends this message to the host
when it enters or exits pause mode;
pause mode changes requested by the host
- (see the RPIPCHM_PAUSE message) must not be notified;
- note: when paused, the guest should release the mouse (if captured)
+ (see the RPIPCHM_PAUSE message) must not be notified,
+ unless the guest returned the value 2 as RPIPCHM_PAUSE response;
+ note: when paused, the guest should release the mouse (if captured);
+ during pause moude, the mouse should never be captured
Data sent:
WPARAM = non-zero when the guest enters pause mode
or zero when the guest exits from pause mode
this notification must not be sent when the event
has been requested by the host (see the RPIPCHM_DEVICECONTENT message)
Data sent:
- pData = a RPDEVICECONTENT structure (see below);
- the szImageFile field of the structure
+ pData = a RPDEVICECONTENT structure (see RetroPlatformIPC.h);
+ the szContent field of the structure
contains an empty string when the guest
is ejecting something from the device
Response:
none
+Message:
+ RPIPCGM_CLOSE
+Description:
+ when the user presses ALT+F4 in the guest window
+ the guest should intercept such an event
+ (WM_SYSCOMMAND with wParam set to SC_CLOSE),
+ send this notification message to the host
+ and not close its window (i.e. not call the DefWindowProc() of its window);
+ the host will then open its Close Options dialog
+ and will send a RPIPCHM_CLOSE command to the guest
+ if the user confirms the close request
+Data sent:
+ none
+Response:
+ none
+
Data sent:
none
Response:
- LRESULT = non-zero if the guest can safely terminate or 0 otherwise
+ LRESULT = 1 if the guest can safely terminate or 0 otherwise
Message:
pData = (Unicode) full path and name of the file to save
(note: the file may exist and can be overwritten)
Response:
- LRESULT = non-zero if the guest saved its screen to the file
+ LRESULT = 1 if the guest successfully saved its screen to the file or 0 otherwise
Message:
Description:
the RPIPCHM_PAUSE message sets the guest into pause mode
or resumes the guest from pause mode;
- note: when paused, the guest should release the mouse (if captured)
+ note: when paused, the guest should release the mouse (if captured);
+ during pause moude, the mouse should never be captured
Data sent:
WPARAM = non-zero to set the guest into pause mode
or zero to resume the guest from pause mode
Response:
- LRESULT = non-zero if the guest executed the command
+ LRESULT = 0 (error), 1 (command successfully executed)
+ or 2 (the command will be asynchronously executed
+ and a RPIPCGM_PAUSE will be later sent from the guest
+ to confirm execution)
Message:
or a physical or keyboard-emulated joystick into an input port)
or to unload the currently loaded content from the device
Data sent:
- pData = a RPDEVICECONTENT structure (see below);
- if the szImageFile field of the structure
+ pData = a RPDEVICECONTENT structure (see RetroPlatformIPC.h);
+ if the szContent field of the structure
contains an empty string, the guest should
- unload the current content from the device
+ unload the current content from the device;
+ for joysticks, szContent may contain multiple identifiers
+ using the "Joystick1\ProductGUID\ProductName" format
+ (ProductName is last and may contain unescaped backslash
+ characters itself)
Response:
- LRESULT = non-zero if the guest executed the command
+ LRESULT = 1 if the guest successfully executed the command or 0 otherwise
Message:
Data sent:
WPARAM = a RP_RESET_* value
Response:
- LRESULT = non-zero if the guest executed the command
+ LRESULT = 1 if the guest successfully executed the command or 0 otherwise
Message:
(1 = speedup the guest functionality
0 = revert to normal speed emulation)
Response:
- LRESULT = non-zero if the guest executed the command
+ LRESULT = 1 if the guest successfully executed the command or 0 otherwise
Message:
Data sent:
WPARAM = volume level (min 0, max 100)
Response:
- LRESULT = non-zero if the guest set the volume as requested
+ LRESULT = 1 if the guest successfully set the volume as requested or 0 otherwise
Message:
LPARAM = milliseconds value
(amount of time the user has to hold the above key to trigger the escape functionality)
Response:
- LRESULT = non-zero if the guest accepted the new settings
+ LRESULT = 1 if the guest successfully accepted the new settings or 0 otherwise
Message:
Data sent:
pData = (Unicode) event string (guest-specific)
Response:
- LRESULT = non-zero if the guest simulated the specified event
+ LRESULT = 1 if the guest successfully simulated the specified event or 0 otherwise
Message:
Data sent:
WPARAM = mouse capture state being requested (RP_MOUSECAPTURE_* flags)
Response:
- LRESULT = non-zero if the guest executed the command
+ LRESULT = 1 if the guest successfully executed the command or 0 otherwise
+
+
+Message:
+ RPIPCHM_SAVESTATE
+Description:
+ with this message the host asks the guest to save
+ the emulation status to the the specified file
+Data sent:
+ pData = (Unicode) full path and name of the file to save
+Response:
+ LRESULT = 1 if the guest successfully saved the status file or 0 otherwise
+
+
+Message:
+ RPIPCHM_LOADSTATE
+Description:
+ with this message the host asks the guest to load
+ the emulation status from the the specified file
+Data sent:
+ pData = (Unicode) full path and name of the file to load
+Response:
+ LRESULT = 1 if the guest successfully loaded the status file or 0 otherwise
//check ALT-F4
if (pressed && !di_keycodes[num][DIK_F4] && scancode == DIK_F4 && di_keycodes[num][DIK_LALT] && !currprefs.win32_ctrl_F11_is_quit) {
+#ifdef RETROPLATFORM
+ if (rp_close ())
+ return -1;
+#endif
uae_quit ();
return -1;
}
void D3D_unlocktexture (void)
{
float x, y, sx, sy;
+
IDirect3DTexture9_UnlockRect (texture, 0);
calc (&x, &y, &sx, &sy);
BlitRect (d3ddev, texture, x, y, sx, sy, 0xffffff, 0.1f);
return 0;
}
ptr_gsapi_run_string_begin (gsinstance, 0, &gs_exitcode);
- } __except(ExceptionFilter(GetExceptionInformation(), GetExceptionCode())) {
+ } __except (ExceptionFilter (GetExceptionInformation (), GetExceptionCode ())) {
write_log ("GS crashed\n");
return 0;
}
return;
} else if (hPrt == INVALID_HANDLE_VALUE) {
flushprtbuf ();
- if (OpenPrinter(currprefs.prtname, &hPrt, NULL)) {
+ if (OpenPrinter (currprefs.prtname, &hPrt, NULL)) {
// Fill in the structure with info about this "document."
DocInfo.pDocName = "My Document";
DocInfo.pOutputFile = NULL;
DocInfo.pDatatype = "RAW";
// Inform the spooler the document is beginning.
- if( (dwJob = StartDocPrinter(hPrt, 1, (LPSTR)&DocInfo)) == 0) {
+ if ((dwJob = StartDocPrinter(hPrt, 1, (LPSTR)&DocInfo)) == 0) {
ClosePrinter(hPrt );
hPrt = INVALID_HANDLE_VALUE;
- } else if(StartPagePrinter(hPrt)) {
+ } else if(StartPagePrinter (hPrt)) {
prtopen = 1;
}
} else {
void flushprinter (void)
{
- closeprinter();
+ closeprinter ();
}
void closeprinter( void )
static void putprinter (char val)
{
- DoSomeWeirdPrintingStuff( val );
+ DoSomeWeirdPrintingStuff (val);
}
int doprinter (uae_u8 val)
}
if (midi_ready) {
extern uae_u16 serper;
- Midi_Close();
+ Midi_Close ();
//need for camd Midi Stuff(it close midi and reopen it but serial.c think the baudrate
//is the same and do not open midi), so setting serper to different value helps
serper = 0x30;
if (uae_boot_rom) {
uaecptr a = here (); //this install the ahisound
org (rtarea_base + 0xFFC0);
- calltrap (deftrap (ahi_demux));
+ calltrap (deftrapres (ahi_demux, 0, "ahi_winuae"));
dw (0x4e75);// rts
org (a);
}
case RGBFB_R5G6B5:
if (d == 4)
v = RGBFB_R5G6B5_32;
+ else
+ v = RGBFB_R5G6B5_16;
break;
case RGBFB_R5G5B5:
if (d == 4)
v = RGBFB_R5G5B5_32;
+ else
+ v = RGBFB_R5G5B5_16;
break;
case RGBFB_B5G5R5PC:
if (d == 4)
v = RGBFB_B5G5R5PC_32;
+ else
+ v = RGBFB_B5G5R5PC_16;
break;
-
+ case RGBFB_A8R8G8B8:
+ if (d == 2)
+ v = RGBFB_A8R8G8B8_16;
+ else if (d == 4)
+ v = RGBFB_A8R8G8B8_32;
+ break;
case RGBFB_R8G8B8:
- if (d == 4)
+ if (d == 2)
+ v = RGBFB_R8G8B8_16;
+ else if (d == 4)
v = RGBFB_R8G8B8_32;
break;
case RGBFB_B8G8R8:
- if (d == 4)
+ if (d == 2)
+ v = RGBFB_B8G8R8_16;
+ else if (d == 4)
v = RGBFB_B8G8R8_32;
break;
case RGBFB_A8B8G8R8:
else if (d == 4)
v = RGBFB_B8G8R8A8_32;
break;
+ case RGBFB_R8G8B8A8:
+ if (d == 2)
+ v = RGBFB_R8G8B8A8_16;
+ else if (d == 4)
+ v = RGBFB_R8G8B8A8_32;
+ break;
}
picasso_convert = v;
host_mode = DirectDraw_GetSurfacePixelFormat (NULL);
switch (picasso_convert)
{
+ /* Picasso96mode == Nativemode */
case RGBFB_B8G8R8A8_32:
- case RGBFB_B5G6R5PC_16:
case RGBFB_R5G6B5PC_16:
case RGBFB_CLUT_8:
memcpy (dst2 + x * dstpix, src2 + x * srcpix, width * dstpix);
break;
+ /* 24bit->32bit */
case RGBFB_R8G8B8_32:
while (x < endx) {
((uae_u32*)dst2)[x] = (src2[x * 3 + 0] << 16) | (src2[x * 3 + 1] << 8) | (src2[x * 3 + 2] << 0);
x++;
}
break;
+
+ /* 32bit->32bit */
case RGBFB_R8G8B8A8_32:
while (x < endx) {
((uae_u32*)dst2)[x] = (src2[x * 4 + 0] << 16) | (src2[x * 4 + 1] << 8) | (src2[x * 4 + 2] << 0);
break;
case RGBFB_A8B8G8R8_32:
while (x < endx) {
- ((uae_u32*)dst2)[x] = ((uae_u32*)src2)[0] << 8;
+ ((uae_u32*)dst2)[x] = ((uae_u32*)src2)[x] >> 8;
x++;
}
break;
+ /* 15/16bit->32bit */
case RGBFB_R5G6B5PC_32:
case RGBFB_R5G5B5PC_32:
case RGBFB_R5G6B5_32:
}
break;
+ /* 16/15bit->16bit */
case RGBFB_R5G5B5PC_16:
case RGBFB_R5G6B5_16:
case RGBFB_R5G5B5_16:
case RGBFB_B5G5R5PC_16:
+ case RGBFB_B5G6R5PC_16:
while (x < endx) {
((uae_u16*)dst2)[x] = (uae_u16)p96_rgbx16[((uae_u16*)src2)[x]];
x++;
}
break;
+ /* 24bit->16bit */
case RGBFB_R8G8B8_16:
+ while (x < endx) {
+ uae_u8 r, g, b;
+ r = src2[x * 3 + 0];
+ g = src2[x * 3 + 1];
+ b = src2[x * 3 + 2];
+ ((uae_u16*)dst2)[x] = p96_rgbx16[(((r >> 3) & 0x1f) << 11) | (((g >> 2) & 0x3f) << 5) | (((b >> 3) & 0x1f) << 0)];
+ x++;
+ }
break;
case RGBFB_B8G8R8_16:
+ while (x < endx) {
+ uae_u32 v;
+ v = ((uae_u32*)(&src2[x * 3]))[0] >> 8;
+ ((uae_u16*)dst2)[x] = p96_rgbx16[(((v >> (8 + 3)) & 0x1f) << 11) | (((v >> (0 + 2)) & 0x3f) << 5) | (((v >> (16 + 3)) & 0x1f) << 0)];
+ x++;
+ }
break;
+
+ /* 32bit->16bit */
case RGBFB_R8G8B8A8_16:
+ while (x < endx) {
+ uae_u32 v;
+ v = ((uae_u32*)src2)[x];
+ ((uae_u16*)dst2)[x] = p96_rgbx16[(((v >> (0 + 3)) & 0x1f) << 11) | (((v >> (8 + 2)) & 0x3f) << 5) | (((v >> (16 + 3)) & 0x1f) << 0)];
+ x++;
+ }
break;
case RGBFB_A8R8G8B8_16:
+ while (x < endx) {
+ uae_u32 v;
+ v = ((uae_u32*)src2)[x];
+ ((uae_u16*)dst2)[x] = p96_rgbx16[(((v >> (8 + 3)) & 0x1f) << 11) | (((v >> (16 + 2)) & 0x3f) << 5) | (((v >> (24 + 3)) & 0x1f) << 0)];
+ x++;
+ }
break;
case RGBFB_A8B8G8R8_16:
+ while (x < endx) {
+ uae_u32 v;
+ v = ((uae_u32*)src2)[x];
+ ((uae_u16*)dst2)[x] = p96_rgbx16[(((v >> (24 + 3)) & 0x1f) << 11) | (((v >> (16 + 2)) & 0x3f) << 5) | (((v >> (8 + 3)) & 0x1f) << 0)];
+ x++;
+ }
break;
-
case RGBFB_B8G8R8A8_16:
while (x < endx) {
uae_u32 v;
}
break;
+ /* 8bit->32bit */
case RGBFB_CLUT_RGBFB_32:
while (x < endx) {
((uae_u32*)dst2)[x] = picasso_vidinfo.clut[src2[x]];
x++;
}
break;
+
+ /* 8bit->16bit */
case RGBFB_CLUT_RGBFB_16:
while (x < endx) {
((uae_u16*)dst2)[x] = picasso_vidinfo.clut[src2[x]];
int rp_rpescapeholdtime = 600;
int rp_screenmode = 0;
int rp_inputmode = 0;
-int log_rp = 1;
+int log_rp = 0;
static int max_horiz_dbl = RES_HIRES;
static int max_vert_dbl = 1;
static DWORD hd_mask, cd_mask, floppy_mask;
static int mousecapture, mousemagic;
static int rp_filter, rp_filter_default;
-
static int recursive_device, recursive;
+static int currentpausemode;
static int cando (void)
{
static char *ua (const WCHAR *s)
{
char *d;
- int len = WideCharToMultiByte (CP_ACP, 0, s, -1, NULL, 0, 0, FALSE);
+ int len;
+
+ if (s == NULL)
+ return NULL;
+ len = WideCharToMultiByte (CP_ACP, 0, s, -1, NULL, 0, 0, FALSE);
if (!len)
return my_strdup ("");
d = xmalloc (len + 1);
case RPIPCGM_REGISTER: return "RPIPCGM_REGISTER";
case RPIPCGM_FEATURES: return "RPIPCGM_FEATURES";
case RPIPCGM_CLOSED: return "RPIPCGM_CLOSED";
+ case RPIPCGM_CLOSE: return "RPIPCGM_CLOSE";
case RPIPCGM_ACTIVATED: return "RPIPCGM_ACTIVATED";
case RPIPCGM_DEACTIVATED: return "RPIPCGM_DEACTIVATED";
case RPIPCGM_PARENT: return "RPIPCGM_PARENT";
}
return TRUE;
case RPIPCHM_PAUSE:
- pausemode (wParam ? 1 : 0);
- return TRUE;
+ currentpausemode = pause_emulation;
+ if (wParam ? 1 : 0 != pause_emulation ? 1 : 0) {
+ pausemode (wParam ? 1 : 0);
+ if (wParam) {
+ currentpausemode = -1;
+ return 2;
+ }
+ }
+ return 1;
case RPIPCHM_VOLUME:
currprefs.sound_volume = changed_prefs.sound_volume = 100 - wParam;
set_volume (currprefs.sound_volume, 0);
{
char *s = ua ((WCHAR*)pData);
DWORD ret = FALSE;
+ if (s == NULL) {
+ savestate_initsave (NULL, 0, 0);
+ return 1;
+ }
if (vpos == 0) {
- save_state (s, "AF");
+ save_state (s, "AF2008");
ret = 1;
} else {
- savestate_initsave (s, 1, TRUE);
- ret = -1;
+ //savestate_initsave (s, 1, TRUE);
+ //ret = -1;
}
xfree (s);
return ret;
RPUninitializeGuest (&guestinfo);
}
+int rp_close (void)
+{
+ if (!cando ())
+ return 0;
+ RPSendMessagex (RPIPCGM_CLOSE, 0, 0, NULL, 0, &guestinfo, NULL);
+ return 1;
+}
+
HWND rp_getparent (void)
{
LRESULT lr;
return;
if (isrecursive ())
return;
- RPSendMessagex (RPIPCGM_PAUSE, (WPARAM)paused, 0, NULL, 0, &guestinfo, NULL);
+ if (currentpausemode != paused)
+ RPSendMessagex (RPIPCGM_PAUSE, (WPARAM)paused, 0, NULL, 0, &guestinfo, NULL);
+ currentpausemode = paused;
}
static void rp_mouse (void)
extern HRESULT rp_init (void);
extern void rp_free (void);
+extern int rp_close (void);
extern void rp_fixup_options (struct uae_prefs*);
extern void rp_update_volume (struct uae_prefs*);
extern void rp_pause (int paused);
extern int rp_rpescapeholdtime;
extern int rp_screenmode;
extern int rp_inputmode;
+extern int log_rp;
extern void rp_input_change (int num);
extern void rp_disk_image_change (int num, const char *name);
{
int i;
for (i = 0; i < len; i += 2) {
- uae_s16 t = sndbuffer[i];
+ uae_s16 t;
+ t = sndbuffer[i];
sndbuffer[i] = sndbuffer[i + 1];
sndbuffer[i + 1] = t;
}
{
int i;
for (i = 0; i < len; i += 6) {
- uae_s16 t = sndbuffer[i + 0];
+ uae_s16 t;
+ t = sndbuffer[i + 0];
sndbuffer[i + 0] = sndbuffer[i + 1];
sndbuffer[i + 1] = t;
t = sndbuffer[i + 4];
HINSTANCE hInst = NULL;
HMODULE hUIDLL = NULL;
HWND (WINAPI *pHtmlHelp)(HWND, LPCSTR, UINT, LPDWORD) = NULL;
-HWND hAmigaWnd, hMainWnd, hHiddenWnd;
+HWND hAmigaWnd, hMainWnd, hHiddenWnd, hGUIWnd;
RECT amigawin_rect;
static int mouseposx, mouseposy;
static UINT TaskbarRestart;
setmouseactive (-1);
pausemouseactive = 0;
pause_emulation = FALSE;
+#ifdef RETROPLATFORM
+ rp_pause (pause_emulation);
+#endif
}
void setpaused (void)
pausemouseactive = mouseactive;
setmouseactive (0);
}
+#ifdef RETROPLATFORM
+ rp_pause (pause_emulation);
+#endif
}
static void checkpause (void)
break;
default:
{
- LRESULT lr = DefWindowProc (hWnd, message, wParam, lParam);
+ LRESULT lr;
+
+#ifdef RETROPLATFORM
+ if ((wParam & 0xfff0) == SC_CLOSE) {
+ if (rp_close ())
+ return 0;
+ }
+#endif
+ lr = DefWindowProc (hWnd, message, wParam, lParam);
switch (wParam & 0xfff0)
{
case SC_MINIMIZE:
case SC_RESTORE:
break;
case SC_CLOSE:
- PostQuitMessage (0);
+ PostQuitMessage (0);
break;
}
return lr;
}
break;
- case WM_USER + 1: /* Systray icon */
- switch (lParam)
- {
- case WM_LBUTTONDOWN:
- SetForegroundWindow (hWnd);
- break;
- case WM_LBUTTONDBLCLK:
- gui_display (-1);
- break;
- case WM_RBUTTONDOWN:
- if (!gui_active)
- systraymenu (hWnd);
- else
- SetForegroundWindow (hWnd);
- break;
- }
- break;
-
- case WM_COMMAND:
- switch (wParam & 0xffff)
- {
- case ID_ST_CONFIGURATION:
- gui_display (-1);
- break;
- case ID_ST_HELP:
- if (pHtmlHelp)
- pHtmlHelp (NULL, help_file, 0, NULL);
- break;
- case ID_ST_QUIT:
- uae_quit ();
- break;
- case ID_ST_RESET:
- uae_reset (0);
- break;
- case ID_ST_EJECTALL:
- disk_eject (0);
- disk_eject (1);
- disk_eject (2);
- disk_eject (3);
- break;
- case ID_ST_DF0:
- DiskSelection (isfullscreen() > 0 ? NULL : hWnd, IDC_DF0, 0, &changed_prefs, 0);
- disk_insert (0, changed_prefs.df[0]);
- break;
- case ID_ST_DF1:
- DiskSelection (isfullscreen() > 0 ? NULL : hWnd, IDC_DF1, 0, &changed_prefs, 0);
- disk_insert (1, changed_prefs.df[0]);
- break;
- case ID_ST_DF2:
- DiskSelection (isfullscreen() > 0 ? NULL : hWnd, IDC_DF2, 0, &changed_prefs, 0);
- disk_insert (2, changed_prefs.df[0]);
- break;
- case ID_ST_DF3:
- DiskSelection (isfullscreen() > 0 ? NULL : hWnd, IDC_DF3, 0, &changed_prefs, 0);
- disk_insert (3, changed_prefs.df[0]);
- break;
- }
- break;
default:
- if (TaskbarRestart != 0 && TaskbarRestartHWND == hWnd && message == TaskbarRestart) {
- //write_log ("notif: taskbarrestart\n");
- systray (TaskbarRestartHWND, FALSE);
- }
break;
}
default:
- if (TaskbarRestart != 0 && TaskbarRestartHWND == hWnd && message == TaskbarRestart)
- return AmigaWindowProc (hWnd, message, wParam, lParam);
break;
}
static LRESULT CALLBACK HiddenWindowProc (HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
{
+ switch (message)
+ {
+ case WM_USER + 1: /* Systray icon */
+ switch (lParam)
+ {
+ case WM_LBUTTONDOWN:
+ SetForegroundWindow (hGUIWnd ? hGUIWnd : hMainWnd);
+ break;
+ case WM_LBUTTONDBLCLK:
+ if (!gui_active)
+ inputdevice_add_inputcode (AKS_ENTERGUI, 1);
+ break;
+ case WM_RBUTTONDOWN:
+ if (!gui_active)
+ systraymenu (hWnd);
+ else
+ SetForegroundWindow (hGUIWnd ? hGUIWnd : hMainWnd);
+ break;
+ }
+ break;
+ case WM_COMMAND:
+ switch (wParam & 0xffff)
+ {
+ case ID_ST_CONFIGURATION:
+ inputdevice_add_inputcode (AKS_ENTERGUI, 1);
+ break;
+ case ID_ST_HELP:
+ if (pHtmlHelp)
+ pHtmlHelp (NULL, help_file, 0, NULL);
+ break;
+ case ID_ST_QUIT:
+ uae_quit ();
+ break;
+ case ID_ST_RESET:
+ uae_reset (0);
+ break;
+ case ID_ST_EJECTALL:
+ disk_eject (0);
+ disk_eject (1);
+ disk_eject (2);
+ disk_eject (3);
+ break;
+ case ID_ST_DF0:
+ DiskSelection (isfullscreen() > 0 ? NULL : hWnd, IDC_DF0, 0, &changed_prefs, 0);
+ disk_insert (0, changed_prefs.df[0]);
+ break;
+ case ID_ST_DF1:
+ DiskSelection (isfullscreen() > 0 ? NULL : hWnd, IDC_DF1, 0, &changed_prefs, 0);
+ disk_insert (1, changed_prefs.df[0]);
+ break;
+ case ID_ST_DF2:
+ DiskSelection (isfullscreen() > 0 ? NULL : hWnd, IDC_DF2, 0, &changed_prefs, 0);
+ disk_insert (2, changed_prefs.df[0]);
+ break;
+ case ID_ST_DF3:
+ DiskSelection (isfullscreen() > 0 ? NULL : hWnd, IDC_DF3, 0, &changed_prefs, 0);
+ disk_insert (3, changed_prefs.df[0]);
+ break;
+ }
+ break;
+ }
+ if (TaskbarRestart != 0 && TaskbarRestartHWND == hWnd && message == TaskbarRestart) {
+ //write_log ("notif: taskbarrestart\n");
+ systray (TaskbarRestartHWND, FALSE);
+ }
return DefWindowProc (hWnd, message, wParam, lParam);
}
{
}
-int WIN32_RegisterClasses (void)
+static void WIN32_UnregisterClasses (void)
+{
+ systray (hHiddenWnd, TRUE);
+ DestroyWindow (hHiddenWnd);
+}
+
+static int WIN32_RegisterClasses (void)
{
WNDCLASS wc;
HDC hDC;
if (!hHiddenWnd)
return 0;
+ systray (hHiddenWnd, FALSE);
+
return 1;
}
log_uaeserial = 1;
continue;
}
+ if (!strcmp (arg, "-rplog")) {
+ log_rp = 1;
+ continue;
+ }
if (!strcmp (arg, "-nomultidisplay")) {
multi_display = 0;
continue;
}
}
+ WIN32_UnregisterClasses ();
#ifdef RETROPLATFORM
rp_free ();
#endif
}
}
-void systray (HWND hwnd, int remove)
+static void systray (HWND hwnd, int remove)
{
NOTIFYICONDATA nid;
BOOL v;
}
}
-void systraymenu (HWND hwnd)
+static void systraymenu (HWND hwnd)
{
POINT pt;
HMENU menu, menu2, drvmenu;
int i;
char text[100];
- winuae_inactive (hwnd, FALSE);
WIN32GUI_LoadUIString (IDS_STMENUNOFLOPPY, text, sizeof (text));
GetCursorPos (&pt);
menu = LoadMenu (hUIDLL ? hUIDLL : hInst, MAKEINTRESOURCE (IDM_SYSTRAY));
pt.x, pt.y, 0, hwnd, NULL);
PostMessage (hwnd, WM_NULL, 0, 0);
DestroyMenu (menu);
- winuae_active (hwnd, FALSE);
}
static void LLError(const char *s)
#define GETBDM(x) (((x) - ((x / 10000) * 10000)) / 100)
#define GETBDD(x) ((x) % 100)
-#define WINUAEBETA 20
+#define WINUAEBETA 21
#define WINUAEPUBLICBETA 1
-#define WINUAEDATE MAKEBD(2008, 5, 24)
+#define WINUAEDATE MAKEBD(2008, 5, 28)
#define WINUAEEXTRA ""
#define WINUAEREV ""
#define NORMAL_WINDOW_STYLE (WS_VISIBLE | WS_BORDER | WS_CAPTION | WS_MINIMIZEBOX | WS_SYSMENU)
extern HMODULE hUIDLL;
-extern HWND hAmigaWnd, hMainWnd, hHiddenWnd;
+extern HWND hAmigaWnd, hMainWnd, hHiddenWnd, hGUIWnd;
extern RECT amigawin_rect;
extern int in_sizemove;
extern int manual_painting_needed;
}
if (hAmigaWnd) {
addnotifications (hAmigaWnd, TRUE);
- //write_log ("notif: close_hwnds\n");
- systray (NULL, TRUE);
#ifdef OPENGL
OGL_free ();
#endif
void close_windows (void)
{
- systray (NULL, TRUE);
reset_sound();
#if defined (GFXFILTER)
S2X_free ();
close_hwnds();
return 0;
}
- systray (NULL, TRUE);
- systray (hAmigaWnd, FALSE);
addnotifications (hAmigaWnd, FALSE);
if (hMainWnd != hAmigaWnd) {
ShowWindow (hMainWnd, SW_SHOWNORMAL);
struct ConfigStruct *Parent, *Child;
int host, hardware;
HTREEITEM item;
+ FILETIME t;
};
static char *configreg[] = { "ConfigFile", "ConfigFileHardware", "ConfigFileHost" };
manual_painting_needed++; /* So that WM_PAINT will refresh the display */
if (isfullscreen () > 0) {
- hr = DirectDraw_FlipToGDISurface();
- if (FAILED(hr))
+ hr = DirectDraw_FlipToGDISurface ();
+ if (FAILED (hr))
write_log ("FlipToGDISurface failed, %s\n", DXError (hr));
}
static char *fgetsx (char *dst, FILE *f)
{
- char *s = fgets (dst, MAX_DPATH, f);
+ char *s;
+ dst[0] = 0;
+ s = fgets (dst, MAX_DPATH, f);
if (!s)
return s;
if (strlen (dst) == 0)
return s;
}
-static char configcachever[] = "0.1";
+static char configcachever[] = "WinUAE Configuration.Cache";
+
+static void setconfighosthard (struct ConfigStruct *config)
+{
+ if (!config->Directory)
+ return;
+ if (!stricmp (config->Name, CONFIG_HOST))
+ config->host = 1;
+ if (!stricmp (config->Name, CONFIG_HARDWARE))
+ config->hardware = 1;
+}
+
+static void flushconfigcache (const char *cachepath)
+{
+ FILE *zcache;
+ zcache = fopen (cachepath, "r");
+ if (zcache == NULL)
+ return;
+ fclose (zcache);
+ zcache = fopen (cachepath, "w+");
+ if (zcache)
+ fclose (zcache);
+ write_log ("'%s' flushed\n", cachepath);
+}
static struct ConfigStruct *readconfigcache (const char *path)
{
char cachepath[MAX_DPATH];
char buf[MAX_DPATH];
char rootpath[MAX_DPATH];
- char path2[MAX_DPATH];
+ char path2[MAX_DPATH], tmp[MAX_DPATH];
struct ConfigStruct *cs, *first;
- int err, i;
+ int err;
+ int filelines, dirlines, headlines, dirmode, lines;
+ char dirsep = '\\';
+ FILETIME t;
+ SYSTEMTIME st;
+ ULARGE_INTEGER t1, stt, dirtt;
+ HANDLE h;
+ WIN32_FIND_DATA ffd;
err = 0;
first = NULL;
if (!zcache)
return NULL;
fgetsx (buf, zcache);
- if (!feof (zcache) && !strcmp (buf, configcachever)) {
- GetFullPathName (path, sizeof path2, path2, NULL);
- strcpy (rootpath, path2);
+ if (feof (zcache))
+ goto end;
+ if (strcmp (buf, configcachever))
+ goto end;
+ GetFullPathName (path, sizeof path2, path2, NULL);
+ strcpy (rootpath, path2);
+ if (path2[strlen (path2) - 1] == '\\' || path2[strlen (path2) -1] == '/')
+ path2[strlen (path2) - 1] = 0;
+ h = FindFirstFile (path2, &ffd);
+ if (h == INVALID_HANDLE_VALUE)
+ goto end;
+ FindClose (h);
+ memcpy (&dirtt, &ffd.ftLastWriteTime, sizeof (ULARGE_INTEGER));
+
+ fgetsx (buf, zcache);
+ headlines = atol (buf);
+ fgetsx (buf, zcache);
+ headlines--;
+ dirlines = atol (buf);
+ fgetsx (buf, zcache);
+ headlines--;
+ filelines = atol (buf);
+ fgetsx (buf, zcache);
+ t1.QuadPart = _atoi64 (buf);
+ headlines--;
+ GetSystemTime (&st);
+ SystemTimeToFileTime (&st, &t);
+ memcpy (&stt, &t, sizeof (ULARGE_INTEGER));
+
+ if (headlines < 0 || dirlines < 3 || filelines < 3 ||
+ t1.QuadPart == 0 || t1.QuadPart > stt.QuadPart || dirtt.QuadPart > t1.QuadPart)
+ goto end;
+
+ while (headlines-- > 0)
fgetsx (buf, zcache);
- if (!strcmp (buf, rootpath)) {
- fgetsx (buf, zcache);
- if (!feof (zcache) && strlen (buf) == 0) {
- while (fgetsx (buf, zcache)) {
- cs = AllocConfigStruct ();
- if (configstore == NULL || configstoreallocated == configstoresize) {
- configstoreallocated += 100;
- configstore = realloc (configstore, sizeof (struct ConfigStruct*) * configstoreallocated);
- }
- configstore[configstoresize++] = cs;
- if (!first)
- first = cs;
- if (buf[0] == '1')
- cs->Directory = 1;
-
- fgetsx (buf, zcache);
- if (strlen (buf) > strlen (rootpath)) {
- for (i = 0; i < configstoresize; i++) {
- GetFullPathName (configstore[i]->Fullpath, sizeof path2, path2, NULL);
- if (!strcmp (path2, buf) && strcmp (path2, rootpath)) {
- cs->Parent = configstore[i];
- break;
- }
- }
- }
+ fgetsx (buf, zcache);
+ if (buf[0] != ';')
+ goto end;
- fgetsx (cs->Name, zcache);
- fgetsx (cs->Path, zcache);
- fgetsx (cs->Fullpath, zcache);
- fgetsx (cs->Description, zcache);
- fgetsx (cs->HardwareLink, zcache);
- fgetsx (cs->HostLink, zcache);
- fgetsx (buf, zcache);
- cs->Type = 3;
-
- fgetsx (buf, zcache);
- if (strlen (buf) > 0)
- break;
+ while (fgetsx (buf, zcache)) {
+ char c;
+ char dirpath[MAX_DPATH];
+
+ dirmode = 0;
+ if (strlen (buf) > 0) {
+ c = buf[strlen (buf) - 1];
+ if (c == '/' || c == '\\') {
+ dirmode = 1;
+ dirsep = c;
+ }
+ }
+
+ strcpy (dirpath, buf);
+ if (dirmode) {
+ lines = dirlines;
+ } else {
+ char *p;
+ lines = filelines;
+ p = strrchr (dirpath, dirsep);
+ if (p)
+ *p = 0;
+ else
+ dirpath[0] = 0;
+ }
+
+ lines--;
+ cs = AllocConfigStruct ();
+ if (configstore == NULL || configstoreallocated == configstoresize) {
+ configstoreallocated += 100;
+ configstore = realloc (configstore, sizeof (struct ConfigStruct*) * configstoreallocated);
+ }
+ configstore[configstoresize++] = cs;
+ if (!first)
+ first = cs;
+
+ cs->Directory = dirmode;
+ strcpy (tmp, path);
+ strcat (tmp, dirpath);
+ strcpy (cs->Fullpath, tmp);
+ strcpy (cs->Path, dirpath);
+
+ fgetsx (tmp, zcache);
+ lines--;
+ t1.QuadPart = _atoi64 (tmp);
+ if (t1.QuadPart > stt.QuadPart)
+ goto end;
+
+ fgetsx (cs->Name, zcache);
+ lines--;
+ fgetsx (cs->Description, zcache);
+ lines--;
+
+ strcpy (tmp, cs->Path);
+ if (strlen (tmp) > 0) {
+ char *p = tmp;
+ if (tmp[strlen (tmp) - 1] == dirsep) {
+ tmp[strlen (tmp) - 1] = 0;
+ p = strrchr (tmp, dirsep);
+ if (p)
+ p[1] = 0;
+ } else {
+ tmp[strlen (tmp) + 1] = 0;
+ tmp[strlen (tmp)] = dirsep;
+ }
+ if (p) {
+ int i;
+ for (i = 0; i < configstoresize; i++) {
+ struct ConfigStruct *cs2 = configstore[i];
+ if (cs2 != cs && !strcmp (cs2->Path, tmp)) {
+ cs->Parent = cs2;
+ if (!cs2->Child)
+ cs2->Child = cs;
+ cs->host = cs2->host;
+ cs->hardware = cs2->hardware;
+ }
}
}
}
+
+ if (!dirmode) {
+ fgetsx (cs->HardwareLink, zcache);
+ lines--;
+ fgetsx (cs->HostLink, zcache);
+ lines--;
+ fgetsx (buf, zcache);
+ lines--;
+ cs->Type = atol (buf);
+ }
+
+ setconfighosthard (cs);
+
+ if (lines < 0)
+ goto end;
+ while (lines-- > 0)
+ fgetsx (tmp, zcache);
+
+ fgetsx (tmp, zcache);
+ if (tmp[0] != ';')
+ goto end;
+
}
+
+end:
if (!feof (zcache))
err = 1;
fclose (zcache);
if (err || first == NULL) {
- zcache = fopen (cachepath, "w+");
- if (zcache)
- fclose (zcache);
+ write_log ("'%s' load failed\n", cachepath);
+ flushconfigcache (cachepath);
FreeConfigStore ();
return NULL;
+ } else {
+ write_log ("'%s' loaded successfully\n", cachepath);
}
return first;
}
+static void writeconfigcacheentry (FILE *zcache, const char *relpath, struct ConfigStruct *cs)
+{
+ char path2[MAX_DPATH];
+ char lf = 10;
+ char el[] = ";\n";
+ char *p;
+ ULARGE_INTEGER li;
+
+ GetFullPathName (cs->Fullpath, sizeof path2, path2, NULL);
+ if (strlen (path2) < strlen (relpath))
+ return;
+ if (memcmp (path2, relpath, strlen (relpath)))
+ return;
+ p = path2 + strlen (relpath);
+ if (!cs->Directory)
+ strcat (p, cs->Name);
+ fwrite (p, strlen (p), 1, zcache);
+ fwrite (&lf, 1, 1, zcache);
+
+ memcpy (&li, &cs->t, sizeof (ULARGE_INTEGER));
+ sprintf (path2, "%I64u", li.QuadPart);
+ fwrite (path2, strlen (path2), 1, zcache);
+ fwrite (&lf, 1, 1, zcache);
+
+ fwrite (cs->Name, strlen (cs->Name), 1, zcache);
+ fwrite (&lf, 1, 1, zcache);
+ fwrite (cs->Description, strlen (cs->Description), 1, zcache);
+ fwrite (&lf, 1, 1, zcache);
+
+ if (!cs->Directory) {
+ fwrite (cs->HardwareLink, strlen (cs->HardwareLink), 1, zcache);
+ fwrite (&lf, 1, 1, zcache);
+ fwrite (cs->HostLink, strlen (cs->HostLink), 1, zcache);
+ fwrite (&lf, 1, 1, zcache);
+ sprintf (path2, "%d", cs->Type);
+ fwrite (path2, strlen (path2), 1, zcache);
+ fwrite (&lf, 1, 1, zcache);
+ }
+
+ fwrite (el, strlen (el), 1, zcache);
+}
+
+static void writeconfigcacherec (FILE *zcache, const char *relpath, struct ConfigStruct *cs)
+{
+ int i;
+
+ if (!cs->Directory)
+ return;
+ writeconfigcacheentry (zcache, relpath, cs);
+ for (i = 0; i < configstoresize; i++) {
+ struct ConfigStruct *cs2 = configstore[i];
+ if (cs2->Parent == cs)
+ writeconfigcacherec (zcache, relpath, cs2);
+ }
+}
+
static void writeconfigcache (const char *path)
{
int i;
FILE *zcache;
char cachepath[MAX_DPATH];
char path2[MAX_DPATH];
+ FILETIME t;
+ SYSTEMTIME st;
getconfigcache (cachepath, path);
+#if CONFIGCACHE == 0
zcache = fopen (cachepath, "r");
if (!zcache)
return;
fclose (zcache);
+#endif
zcache = fopen (cachepath, "w");
if (!zcache)
return;
- GetFullPathName (path, sizeof path2, path2, NULL);
+ t.dwHighDateTime = t.dwLowDateTime = 0;
+ GetSystemTime (&st);
+ SystemTimeToFileTime (&st, &t);
fwrite (configcachever, strlen (configcachever), 1, zcache);
fwrite (&lf, 1, 1, zcache);
+ sprintf (path2, "3\n4\n7\n%I64u\n;\n", t);
fwrite (path2, strlen (path2), 1, zcache);
- fwrite (&lf, 1, 1, zcache);
- fwrite (&lf, 1, 1, zcache);
- for (i = configstoresize - 1; i >= 0; i--) {
+ GetFullPathName (path, sizeof path2, path2, NULL);
+ for (i = 0; i < configstoresize; i++) {
struct ConfigStruct *cs = configstore[i];
- sprintf (path2, "%d", cs->Directory);
- fwrite (path2, strlen (path2), 1, zcache);
- fwrite (&lf, 1, 1, zcache);
- GetFullPathName (cs->Fullpath, sizeof path2, path2, NULL);
- fwrite (path2, strlen (path2), 1, zcache);
- fwrite (&lf, 1, 1, zcache);
- fwrite (cs->Name, strlen (cs->Name), 1, zcache);
- fwrite (&lf, 1, 1, zcache);
- fwrite (cs->Fullpath, strlen (cs->Fullpath), 1, zcache);
- fwrite (&lf, 1, 1, zcache);
- fwrite (cs->Path, strlen (cs->Path), 1, zcache);
- fwrite (&lf, 1, 1, zcache);
- fwrite (cs->Description, strlen (cs->Description), 1, zcache);
- fwrite (&lf, 1, 1, zcache);
- fwrite (cs->HardwareLink, strlen (cs->HardwareLink), 1, zcache);
- fwrite (&lf, 1, 1, zcache);
- fwrite (cs->HostLink, strlen (cs->HostLink), 1, zcache);
- fwrite (&lf, 1, 1, zcache);
- sprintf (path2, "%d", cs->Type);
- fwrite (path2, strlen (path2), 1, zcache);
- fwrite (&lf, 1, 1, zcache);
-
- fwrite (&lf, 1, 1, zcache);
+ if (cs->Directory && cs->Parent == NULL)
+ writeconfigcacherec (zcache, path2, cs);
+ }
+ for (i = 0; i < configstoresize; i++) {
+ struct ConfigStruct *cs = configstore[i];
+ if (!cs->Directory)
+ writeconfigcacheentry (zcache, path2, cs);
}
fclose (zcache);
+ write_log ("'%s' created\n", cachepath);
}
-static struct ConfigStruct *GetConfigs (struct ConfigStruct *configparent, int usedirs, int *level)
+static struct ConfigStruct *GetConfigs (struct ConfigStruct *configparent, int usedirs, int *level, int flushcache)
{
DWORD num_bytes = 0;
char path[MAX_DPATH];
strncat (path2, "*.*", MAX_DPATH);
if (*level == 0) {
+ if (flushcache) {
+ char cachepath[MAX_DPATH];
+ getconfigcache (cachepath, path);
+ flushconfigcache (cachepath);
+ }
first = readconfigcache (path);
if (first)
return first;
config = AllocConfigStruct ();
strcpy (config->Path, shortpath);
strcpy (config->Fullpath, path);
+ memcpy (&config->t, &find_data.ftLastWriteTime, sizeof (FILETIME));
if ((find_data.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) && usedirs) {
if ((*level) < 2) {
struct ConfigStruct *child;
config->Directory = 1;
(*level)++;
config->Parent = configparent;
- if (!stricmp (config->Name, CONFIG_HOST))
- config->host = 1;
- if (!stricmp (config->Name, CONFIG_HARDWARE))
- config->hardware = 1;
- child = GetConfigs (config, usedirs, level);
+ setconfighosthard (config);
+ child = GetConfigs (config, usedirs, level, FALSE);
(*level)--;
if (child)
config->Child = child;
break;
}
}
- if (*level == 0 && CONFIGCACHE)
+ if (*level == 0)
writeconfigcache (path);
return first;
}
-static struct ConfigStruct *CreateConfigStore (struct ConfigStruct *oldconfig)
+static struct ConfigStruct *CreateConfigStore (struct ConfigStruct *oldconfig, int flushcache)
{
int level = 0, i;
char path[MAX_DPATH], name[MAX_DPATH];
strcpy (path, oldconfig->Path);
strcpy (name, oldconfig->Name);
}
- GetConfigs (NULL, 1, &level);
+ GetConfigs (NULL, 1, &level, flushcache);
if (oldconfig) {
for (i = 0; i < configstoresize; i++) {
cs = configstore[i];
strcpy (workprefs.description, desc);
cfgfile_save (&workprefs, path, configtypepanel);
}
- break;
+ break;
case CONFIG_LOAD:
if (strlen (name) == 0) {
} else {
ew (hDlg, IDC_VIEWINFO, workprefs.info[0]);
}
- break;
+ }
+ break;
- case CONFIG_DELETE:
- if (strlen (name) == 0) {
- char szMessage[MAX_DPATH];
- WIN32GUI_LoadUIString(IDS_MUSTSELECTCONFIGFORDELETE, szMessage, MAX_DPATH);
- pre_gui_message (szMessage);
- } else {
- char szMessage[MAX_DPATH];
- char szTitle[MAX_DPATH];
- WIN32GUI_LoadUIString (IDS_DELETECONFIGCONFIRMATION, szMessage, MAX_DPATH);
- WIN32GUI_LoadUIString (IDS_DELETECONFIGTITLE, szTitle, MAX_DPATH );
- if (MessageBox (hDlg, szMessage, szTitle,
- MB_YESNO | MB_ICONWARNING | MB_APPLMODAL | MB_SETFOREGROUND) == IDYES) {
- cfgfile_backup (path);
- DeleteFile (path);
- write_log ("deleted config '%s'\n", path);
- config_filename[0] = 0;
- }
+ case CONFIG_DELETE:
+ if (strlen (name) == 0) {
+ char szMessage[MAX_DPATH];
+ WIN32GUI_LoadUIString (IDS_MUSTSELECTCONFIGFORDELETE, szMessage, MAX_DPATH);
+ pre_gui_message (szMessage);
+ } else {
+ char szMessage[MAX_DPATH];
+ char szTitle[MAX_DPATH];
+ WIN32GUI_LoadUIString (IDS_DELETECONFIGCONFIRMATION, szMessage, MAX_DPATH);
+ WIN32GUI_LoadUIString (IDS_DELETECONFIGTITLE, szTitle, MAX_DPATH );
+ if (MessageBox (hDlg, szMessage, szTitle,
+ MB_YESNO | MB_ICONWARNING | MB_APPLMODAL | MB_SETFOREGROUND) == IDYES) {
+ cfgfile_backup (path);
+ DeleteFile (path);
+ write_log ("deleted config '%s'\n", path);
+ config_filename[0] = 0;
}
- break;
- }
+ }
+ break;
}
+
setguititle (NULL);
return full_path;
}
if (configstore[idx2] == config->Child) {
config->item = par;
if (LoadConfigTreeView (hDlg, idx2, par) == 0) {
- if (!config->hardware && !config->host)
+ if (!config->hardware && !config->host && !config->Directory)
TreeView_DeleteItem (GetDlgItem(hDlg, IDC_CONFIGTREE), par);
}
break;
{
case IDC_SAVE:
HandleConfiguration (hDlg, CONFIG_SAVE_FULL, config, newpath);
- config = CreateConfigStore (config);
+ config = CreateConfigStore (config, TRUE);
config = fixloadconfig (hDlg, config);
ConfigToRegistry (config, configtypepanel);
InitializeConfigTreeView (hDlg);
break;
case IDC_QUICKSAVE:
HandleConfiguration (hDlg, CONFIG_SAVE, config, NULL);
- config = CreateConfigStore (config);
+ config = CreateConfigStore (config, TRUE);
config = fixloadconfig (hDlg, config);
ConfigToRegistry (config, configtypepanel);
InitializeConfigTreeView (hDlg);
break;
case IDC_DELETE:
HandleConfiguration (hDlg, CONFIG_DELETE, config, NULL);
- config = CreateConfigStore (config);
+ config = CreateConfigStore (config, TRUE);
config = fixloadconfig (hDlg, config);
InitializeConfigTreeView (hDlg);
break;
case WM_INITDIALOG:
recursive++;
if (!configstore) {
- CreateConfigStore (NULL);
+ CreateConfigStore (NULL, FALSE);
config = NULL;
}
pages[LOADSAVE_ID] = hDlg;
}
if (all_options || !configstore)
- CreateConfigStore (NULL);
+ CreateConfigStore (NULL, FALSE);
dialogreturn = -1;
hAccelTable = NULL;
setguititle (dhwnd);
ShowWindow (dhwnd, SW_SHOW);
MapDialogRect (dhwnd, &dialog_rect);
+ hGUIWnd = dhwnd;
for (;;) {
HANDLE IPChandle;
IPChandle = geteventhandleIPC ();
if (IPChandle != INVALID_HANDLE_VALUE) {
MsgWaitForMultipleObjects (1, &IPChandle, FALSE, INFINITE, QS_ALLINPUT);
- while (checkIPC( &workprefs));
+ while (checkIPC (&workprefs));
} else {
WaitMessage();
}
psresult = dialogreturn;
}
+ hGUIWnd = NULL;
if (quit_program)
psresult = -2;
else if (qs_request_reset && quickstart)
+Beta 21:
+
+- A3000 1.3 SuperKickstart fakeMMU bonus remapping fixed
+- A3000 mode (=A3000 SCSI enabled) forces UAE boot rom to backup
+ location (no more conflicts with 1.3 SuperKickstart bonus area)
+- notification area icon is now created only once at startup
+- added function to uae.resource that can be used to query function
+ pointers using string labels (more portable and safe)
+- 32->16bit Picasso96 color space conversion fixed
+- all missing Picasso96 color space conversion routines added
+- HAM6 with less than 6 planes emulated properly
+- 0.5M chip + 0.5M slow + ECS Agnus chip ram aliasing implemented
+ (DMA addresses 0x80000-0xfffff are aliased to 0xc00000-0xc7ffff)
+ Previous chip mapping fixes were not 100% correct, there is no "bus
+ noise" when slow ram is enabled.
+ Fixes demo "Move Any Mountain" by "Lazy Bones"
+- floppy drive sounds fixed in 4+ sound channel modes
+- fixed rare bug in configuration list, missing directory entries
+ possible if it only contained other directories (no files)
+- implemented configuration cache that caches all data needed to
+ populate Configuration-panel quickly without directory/file scanning.
+ Currently always enabled (this way I surely get enough testing..)
+ Cache is stored in file called "configuration.cache" in configuration
+ root directory. Cache file is only re-created when configuration is
+ saved, deleted or cache file is missing or corrupted.
+ Enable/disable in future, first some testing :)
+
Beta 20:
- only reset sound when changing configuration if sound mode, sound card,
- added Amiga-side uae.resource, safe method to find "uae rom" base and
other information. Version of resource is UAEVERSION.UAEREVISION
NOTE: in compatible modes resource may not be available.
- Check source for more information.
+ Check sources for more information.
Beta 19:
/* 1=compressed,2=not compressed,3=ram dump,4=audio dump */
void savestate_initsave (const char *filename, int mode, int nodialogs)
{
+ if (filename == NULL) {
+ savestate_fname[0] = 0;
+ savestate_docompress = 0;
+ savestate_specialdump = 0;
+ savestate_nodialogs = 0;
+ return;
+ }
strcpy (savestate_fname, filename);
savestate_docompress = (mode == 1) ? 1 : 0;
savestate_specialdump = (mode == 3) ? 1 : (mode == 4) ? 2 : 0;
TrapHandler handler; /* Handler function to be invoked for this trap. */
int flags; /* Trap attributes. */
const char *name; /* For debugging purposes. */
+ uaecptr addr;
};
#define MAX_TRAPS 4096
static void trap_HandleExtendedTrap (TrapHandler, int has_retval);
+uaecptr find_trap (const char *name)
+{
+ int i;
+
+ for (i = 0; i < trap_count; i++) {
+ struct Trap *trap = &traps[i];
+ if ((trap->flags & TRAPFLAG_UAERES) && trap->name && !strcmp (trap->name, name))
+ return trap->addr;
+ }
+ return 0;
+}
+
+
/*
* Define an emulator trap
*
trap->handler = handler_func;
trap->flags = flags;
trap->name = name;
+ trap->addr = here ();
return trap_num;
}
loop = here ();
org (UAEEXE_ORG);
- calltrap (deftrap (uaeexe_server));
+ calltrap (deftrapres (uaeexe_server, 0, "uaeexe_server"));
dw (RTS);
org (loop);
}
dw ((rtarea_base >> 16) | get_word (rtarea_base + 36));
dw (get_word (rtarea_base + 38) + 12);
#endif
- calltrap (define_trap (uaelib_demux, 0, ""));
+ calltrap (deftrapres (uaelib_demux, 0, "uaelib_demux"));
dw (RTS);
org (a);
}
#include "uaeresource.h"
#if 0
- struct uaebase
- {
- struct Library lib;
- UWORD uae_version;
- UWORD uae_revision;
- UWORD uae_subrevision;
- UWORD zero;
- APTR uae_rombase;
- };
+
+ #define UAERESNAME "uae.resource"
+
+ #define UAERES_GETFUNC (LIB_BASE - 0*LIB_VECTSIZE)
+
+ APTR GetFunc (const char *name);
+
+ struct uaebase
+ {
+ struct Library uae_lib;
+ UWORD uae_version;
+ UWORD uae_revision;
+ UWORD uae_subrevision;
+ UWORD zero;
+ APTR uae_rombase;
+ };
+
#endif
static uaecptr res_init, res_name, res_id;
-static uae_u32 REGPARAM2 res_close (TrapContext *context)
+static uae_u32 REGPARAM2 res_getfunc (TrapContext *context)
{
- uaecptr base = m68k_areg (&context->regs, 6);
- put_word (base + 32, get_word (base + 32) - 1);
- return 0;
-}
-static uae_u32 REGPARAM2 res_open (TrapContext *context)
-{
- uaecptr base = m68k_areg (&context->regs, 6);
- put_word (base + 32, get_word (base + 32) + 1);
- return 0;
-}
-static uae_u32 REGPARAM2 res_expunge (TrapContext *context)
-{
- return 0;
+ uaecptr funcname = m68k_areg (&context->regs, 0);
+ char tmp[256];
+ if (funcname == 0)
+ return 0;
+ strcpyah_safe (tmp, funcname, sizeof tmp);
+ return find_trap (tmp);
}
+
static uae_u32 REGPARAM2 res_initcode (TrapContext *context)
{
uaecptr base = m68k_dreg (&context->regs, 0);
void uaeres_install (void)
{
uae_u32 functable, datatable;
- uae_u32 initcode, openfunc, closefunc, expungefunc;
+ uae_u32 initcode, getfunc;
char tmp[100];
sprintf (tmp, "UAE resource %d.%d.%d", UAEMAJOR, UAEMINOR, UAESUBREV);
/* initcode */
initcode = here ();
calltrap (deftrap (res_initcode)); dw (RTS);
- /* Open */
- openfunc = here ();
- calltrap (deftrap (res_open)); dw (RTS);
- /* Close */
- closefunc = here ();
- calltrap (deftrap (res_close)); dw (RTS);
- /* Expunge */
- expungefunc = here ();
- calltrap (deftrap (res_expunge)); dw (RTS);
+ /* getfunc */
+ getfunc = here ();
+ calltrap (deftrap (res_getfunc)); dw (RTS);
/* FuncTable */
functable = here ();
- dl (openfunc); /* Open */
- dl (closefunc); /* Close */
- dl (expungefunc); /* Expunge */
- dl (EXPANSION_nullfunc); /* Null */
+ dl (getfunc); /* getfunc */
dl (0xFFFFFFFF); /* end of table */
/* DataTable */
{
struct zfile *z;
- z = (struct zfile*)malloc (sizeof *z);
+ z = xmalloc (sizeof *z);
if (!z)
return 0;
memset (z, 0, sizeof *z);
const char *uae_diskimageextensions[] =
{ ".adf", ".adz", ".ipf", ".fdi", ".exe", ".dms", ".wrp", ".dsq", 0 };
-int zfile_is_ignore_ext(const char *name)
+int zfile_is_ignore_ext (const char *name)
{
int i;
if (name[i - len - 1] == '.' && !strcasecmp (name + i - len, plugins_7z[j])) {
struct zfile *f = zfile_fopen_nozip (name, "rb");
if (f) {
- f->zipname = my_strdup(name + i + 1);
+ f->zipname = my_strdup (name + i + 1);
return f;
}
break;
static void manglefilename(char *out, const char *in)
{
out[0] = 0;
- if (!strncasecmp(in, AF, strlen(AF)))
+ if (!strncasecmp (in, AF, strlen(AF)))
strcpy (out, start_path_data);
if ((in[0] == '/' || in[0] == '\\') || (strlen(in) > 3 && in[1] == ':' && in[2] == '\\'))
out[0] = 0;
- strcat(out, in);
+ strcat (out, in);
}
#else
static void manglefilename(char *out, const char *in)
int ztype;
char path[MAX_DPATH];
- manglefilename(path, name);
- l = zfile_fopen_2(path, "rb");
+ manglefilename (path, name);
+ l = zfile_fopen_2 (path, "rb");
if (!l)
return 0;
ztype = iszip (l);
struct zfile *l, *l2;
char path[MAX_DPATH];
- manglefilename(path, name);
+ manglefilename (path, name);
l = zfile_fopen_2 (path, mode);
if (!l)
return 0;
struct zfile *nzf;
if (!zf || !zf->data)
return NULL;
- nzf = zfile_create();
- nzf->data = (uae_u8*)malloc (zf->size);
+ nzf = zfile_create ();
+ nzf->data = xmalloc (zf->size);
memcpy (nzf->data, zf->data, zf->size);
nzf->size = zf->size;
return nzf;
if (strlen (name) == 0)
return 0;
- manglefilename(fname, name);
+ manglefilename (fname, name);
f = openzip (fname);
if (!f) {
FILE *f2;
- manglefilename(fname, name);
- if (!my_existsfile(fname))
+ manglefilename (fname, name);
+ if (!my_existsfile (fname))
return 0;
- f2 = fopen(fname, "rb");
+ f2 = fopen (fname, "rb");
if (!f2)
return 0;
- fclose(f2);
+ fclose (f2);
}
zfile_fclose (f);
return 1;
l = zfile_create ();
l->name = name ? strdup (name) : "";
if (size) {
- l->data = (uae_u8*)malloc (size);
+ l->data = xmalloc (size);
l->size = size;
memset (l->data, 0, size);
} else {
- l->data = (uae_u8*)calloc (1, 1);
+ l->data = xcalloc (1, 1);
l->size = 0;
}
return l;
struct zfile *l;
l = zfile_create ();
l->name = name ? strdup (name) : "";
- l->data = (uae_u8*)malloc (size);
+ l->data = xmalloc (size);
l->size = size;
memcpy (l->data, data, size);
return l;
return fread (b, l1, l2, z->f);
}
-size_t zfile_fwrite (void *b, size_t l1, size_t l2, struct zfile *z)
+size_t zfile_fwrite (void *b, size_t l1, size_t l2, struct zfile *z)
{
if (z->data) {
if (z->seek + l1 * l2 > z->size) {
*s = 0;
return os;
} else {
- return fgets(s, size, z->f);
+ return fgets (s, size, z->f);
}
}
uae_u8 outbuf[4096];
memset (&zs, 0, sizeof (zs));
- if (deflateInit_ (&zs, Z_DEFAULT_COMPRESSION, ZLIB_VERSION, sizeof(z_stream)) != Z_OK)
+ if (deflateInit_ (&zs, Z_DEFAULT_COMPRESSION, ZLIB_VERSION, sizeof (z_stream)) != Z_OK)
return 0;
zs.next_in = (Bytef*)src;
zs.avail_in = size;
while (v == Z_OK) {
zs.next_out = outbuf;
zs.avail_out = sizeof (outbuf);
- v = deflate(&zs, Z_NO_FLUSH | Z_FINISH);
- if (sizeof(outbuf) - zs.avail_out > 0)
+ v = deflate (&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);
+ deflateEnd (&zs);
return zs.total_out;
}
pos = zfile_ftell (f);
zfile_fseek (f, 0, SEEK_END);
size = zfile_ftell (f);
- p = (uae_u8*)xmalloc (size);
+ p = xmalloc (size);
if (!p)
return 0;
memset (p, 0, size);
static struct zvolume *zvolume_list;
-static struct znode *znode_alloc(struct znode *parent, const char *name)
+static struct znode *znode_alloc (struct znode *parent, const char *name)
{
char fullpath[MAX_DPATH];
- struct znode *zn = xcalloc(sizeof(struct znode), 1);
+ struct znode *zn = xcalloc (sizeof (struct znode), 1);
- sprintf(fullpath,"%s%c%s", parent->fullname, FSDB_DIR_SEPARATOR, name);
- zn->fullname = my_strdup(fullpath);
- zn->name = my_strdup(name);
+ sprintf (fullpath,"%s%c%s", parent->fullname, FSDB_DIR_SEPARATOR, name);
+ zn->fullname = my_strdup (fullpath);
+ zn->name = my_strdup (name);
zn->volume = parent->volume;
zn->volume->last->next = zn;
zn->prev = zn->volume->last;
return zn;
}
-static struct znode *znode_alloc_child(struct znode *parent, const char *name)
+static struct znode *znode_alloc_child (struct znode *parent, const char *name)
{
- struct znode *zn = znode_alloc(parent, name);
+ struct znode *zn = znode_alloc (parent, name);
if (!parent->child) {
parent->child = zn;
zn->parent = parent;
return zn;
}
-static struct znode *znode_alloc_sibling(struct znode *sibling, const char *name)
+static struct znode *znode_alloc_sibling (struct znode *sibling, const char *name)
{
- struct znode *zn = znode_alloc(sibling->parent, name);
+ struct znode *zn = znode_alloc (sibling->parent, name);
if (!sibling->sibling) {
sibling->sibling = zn;
return zn;
}
-static void zvolume_addtolist(struct zvolume *zv)
+static void zvolume_addtolist (struct zvolume *zv)
{
if (!zv)
return;
}
}
-static struct zvolume *zvolume_alloc_2(const char *name, struct zfile *z, unsigned int id, void *handle)
+static struct zvolume *zvolume_alloc_2 (const char *name, struct zfile *z, unsigned int id, void *handle)
{
- struct zvolume *zv = xcalloc(sizeof (struct zvolume), 1);
+ struct zvolume *zv = xcalloc (sizeof (struct zvolume), 1);
struct znode *root;
size_t pos;
zv->id = id;
zv->blocks = 4;
root->volume = zv;
- root->name = my_strdup(name);
- root->fullname = my_strdup(name);
+ root->name = my_strdup (name);
+ root->fullname = my_strdup (name);
if (z) {
- pos = zfile_ftell(z);
- zfile_fseek(z, 0, SEEK_END);
- zv->archivesize = zfile_ftell(z);
- zfile_fseek(z, pos, SEEK_SET);
+ pos = zfile_ftell (z);
+ zfile_fseek (z, 0, SEEK_END);
+ zv->archivesize = zfile_ftell (z);
+ zfile_fseek (z, pos, SEEK_SET);
}
return zv;
}
-struct zvolume *zvolume_alloc(struct zfile *z, unsigned int id, void *handle)
+struct zvolume *zvolume_alloc (struct zfile *z, unsigned int id, void *handle)
{
- return zvolume_alloc_2(zfile_getname(z), z, id, handle);
+ return zvolume_alloc_2 (zfile_getname (z), z, id, handle);
}
-struct zvolume *zvolume_alloc_empty(const char *name)
+struct zvolume *zvolume_alloc_empty (const char *name)
{
return zvolume_alloc_2(name, 0, 0, 0);
}
-static struct zvolume *get_zvolume(const char *path)
+static struct zvolume *get_zvolume (const char *path)
{
struct zvolume *zv = zvolume_list;
while (zv) {
- char *s = zfile_getname(zv->archive);
- if (strlen(path) >= strlen(s) && !memcmp (path, s, strlen(s)))
+ char *s = zfile_getname (zv->archive);
+ if (strlen (path) >= strlen(s) && !memcmp (path, s, strlen(s)))
return zv;
zv = zv->next;
}
return NULL;
}
-static struct zvolume *zfile_fopen_archive_ext(struct zfile *zf)
+static struct zvolume *zfile_fopen_archive_ext (struct zfile *zf)
{
struct zvolume *zv = NULL;
char *ext = strrchr (zfile_getname(zf), '.');
}
-struct zvolume *zfile_fopen_archive_data(struct zfile *zf)
+struct zvolume *zfile_fopen_archive_data (struct zfile *zf)
{
struct zvolume *zv = NULL;
uae_u8 header[7];
return zv;
}
-static struct znode *get_znode(struct zvolume *zv, const char *ppath);
+static struct znode *get_znode (struct zvolume *zv, const char *ppath);
-static int zfile_fopen_archive_recurse(struct zvolume *zv)
+static int zfile_fopen_archive_recurse (struct zvolume *zv)
{
struct znode *zn;
int i, added;
char *ext = strrchr (zn->name, '.');
if (ext && !zn->vchild && zn->isfile) {
for (i = 0; plugins_7z[i]; i++) {
- if (!strcasecmp(ext + 1, plugins_7z[i])) {
+ if (!strcasecmp (ext + 1, plugins_7z[i])) {
struct zvolume *zvnew;
struct znode *zndir;
char tmp[MAX_DPATH];
- sprintf(tmp, "%s.DIR", zn->fullname + strlen(zv->root.name) + 1);
- zndir = get_znode(zv, tmp);
+ sprintf (tmp, "%s.DIR", zn->fullname + strlen (zv->root.name) + 1);
+ zndir = get_znode (zv, tmp);
if (!zndir) {
struct zarchive_info zai = { 0 };
zvnew = zvolume_alloc_empty (tmp);
zai.name = tmp;
zai.t = zn->mtime;
- zndir = zvolume_adddir_abs(zv, &zai);
+ zndir = zvolume_adddir_abs (zv, &zai);
zndir->vfile = zn;
zndir->vchild = zvnew;
zvnew->parent = zv;
return 0;
}
-static void recursivepath(char *path, struct zvolume *zv)
+static void recursivepath (char *path, struct zvolume *zv)
{
char tmp[2] = { FSDB_DIR_SEPARATOR, 0 };
if (!zv)
return;
- recursivepath(path, zv->parent);
- strcat(path, zv->root.fullname);
- strcat(path, tmp);
+ recursivepath (path, zv->parent);
+ strcat (path, zv->root.fullname);
+ strcat (path, tmp);
}
-static struct zvolume *prepare_recursive_volume(struct zvolume *zv, const char *path)
+static struct zvolume *prepare_recursive_volume (struct zvolume *zv, const char *path)
{
struct zfile *zf = NULL;
struct zvolume *zvnew = NULL;
write_log ("unpacking '%s'\n", path);
- zf = zfile_open_archive(path, 0);
+ zf = zfile_open_archive (path, 0);
if (!zf)
goto end;
- zvnew = zfile_fopen_archive_ext(zf);
+ zvnew = zfile_fopen_archive_ext (zf);
if (!zvnew)
goto end;
zvnew->parent = zv->parent;
- zfile_fopen_archive_recurse(zvnew);
- zfile_fclose_archive(zv);
+ zfile_fopen_archive_recurse (zvnew);
+ zfile_fclose_archive (zv);
return zvnew;
end:
write_log ("unpack failed\n");
zfile_fclose_archive (zvnew);
- zfile_fclose(zf);
+ zfile_fclose (zf);
return NULL;
}
-static struct znode *get_znode(struct zvolume *zv, const char *ppath)
+static struct znode *get_znode (struct zvolume *zv, const char *ppath)
{
struct znode *zn;
int prevlen = 0;
zn = &zv->root;
while (zn) {
if (zn->isfile) {
- if (!stricmp(zn->fullname, path))
+ if (!stricmp (zn->fullname, path))
return zn;
} else {
- int len = strlen(zn->fullname);
- if (strlen(path) >= len && (path[len] == 0 || path[len] == FSDB_DIR_SEPARATOR) && !strnicmp(zn->fullname, path, len)) {
+ int len = strlen (zn->fullname);
+ if (strlen (path) >= len && (path[len] == 0 || path[len] == FSDB_DIR_SEPARATOR) && !strnicmp (zn->fullname, path, len)) {
if (path[len] == 0)
return zn;
if (zn->vchild) {
struct zvolume *zvdeep = zn->vchild;
char *p = path + prevlen + 1;
if (zvdeep->archive == NULL) {
- zvdeep = prepare_recursive_volume(zvdeep, zn->fullname);
+ zvdeep = prepare_recursive_volume (zvdeep, zn->fullname);
if (!zvdeep) {
write_log ("failed to unpack '%s'\n", zn->fullname);
return NULL;
return NULL;
p++;
strcpy (path, zn->volume->root.name);
- memmove(path + strlen(path) + 1, p, strlen (p) + 1);
+ memmove (path + strlen (path) + 1, p, strlen (p) + 1);
path[strlen(path)] = FSDB_DIR_SEPARATOR;
} else {
zn = zn->child;
}
-static void addvolumesize(struct zvolume *zv, int size)
+static void addvolumesize (struct zvolume *zv, int size)
{
int blocks = (size + 511) / 512;
}
}
-struct znode *znode_adddir(struct znode *parent, const char *name, struct zarchive_info *zai)
+struct znode *znode_adddir (struct znode *parent, const char *name, struct zarchive_info *zai)
{
struct znode *zn;
char path[MAX_DPATH];
sprintf(path, "%s%c%s", parent->fullname, FSDB_DIR_SEPARATOR, name);
- zn = get_znode(parent->volume, path);
+ zn = get_znode (parent->volume, path);
if (zn)
return zn;
- zn = znode_alloc_child(parent, name);
+ zn = znode_alloc_child (parent, name);
zn->mtime = zai->t;
- addvolumesize(parent->volume, 0);
+ addvolumesize (parent->volume, 0);
return zn;
}
-struct znode *zvolume_adddir_abs(struct zvolume *zv, struct zarchive_info *zai)
+struct znode *zvolume_adddir_abs (struct zvolume *zv, struct zarchive_info *zai)
{
struct znode *zn2;
- char *path = my_strdup(zai->name);
+ char *path = my_strdup (zai->name);
char *p, *p2;
int i;
for (i = 0; path[i]; i++) {
if (path[i] == '/' || path[i] == '\\') {
path[i] = 0;
- zn2 = znode_adddir(zn2, p, zai);
+ zn2 = znode_adddir (zn2, p, zai);
path[i] = FSDB_DIR_SEPARATOR;
p = p2 = &path[i + 1];
}
}
- return znode_adddir(zn2, p, zai);
+ return znode_adddir (zn2, p, zai);
}
-struct znode *zvolume_addfile_abs(struct zvolume *zv, struct zarchive_info *zai)
+struct znode *zvolume_addfile_abs (struct zvolume *zv, struct zarchive_info *zai)
{
struct znode *zn, *zn2;
int i;
- char *path = my_strdup(zai->name);
+ char *path = my_strdup (zai->name);
char *p, *p2;
zn2 = &zv->root;
for (i = 0; path[i]; i++) {
if (path[i] == '/' || path[i] == '\\') {
path[i] = 0;
- zn2 = znode_adddir(zn2, p, zai);
+ zn2 = znode_adddir (zn2, p, zai);
path[i] = FSDB_DIR_SEPARATOR;
p = p2 = &path[i + 1];
}
}
if (p2) {
- zn = znode_alloc_child(zn2, p2);
+ zn = znode_alloc_child (zn2, p2);
zn->size = zai->size;
zn->isfile = 1;
zn->mtime = zai->t;
if (zai->comment)
- zn->comment = my_strdup(zai->comment);
+ zn->comment = my_strdup (zai->comment);
zn->flags = zai->flags;
- addvolumesize(zn->volume, zai->size);
+ addvolumesize (zn->volume, zai->size);
}
- xfree(path);
+ xfree (path);
return zn;
}
-struct zvolume *zfile_fopen_archive(const char *filename)
+struct zvolume *zfile_fopen_archive (const char *filename)
{
struct zvolume *zv = NULL;
struct zfile *zf = zfile_fopen_nozip (filename, "rb");
if (!zf)
return NULL;
- zv = zfile_fopen_archive_ext(zf);
+ zv = zfile_fopen_archive_ext (zf);
if (!zv)
- zv = zfile_fopen_archive_data(zf);
+ zv = zfile_fopen_archive_data (zf);
#if RECURSIVE_ARCHIVES
if (zv)
zfile_fopen_archive_recurse (zv);
if (zv)
zvolume_addtolist (zv);
else
- zfile_fclose(zf);
+ zfile_fclose (zf);
return zv;
}
-void zfile_fclose_archive(struct zvolume *zv)
+void zfile_fclose_archive (struct zvolume *zv)
{
struct znode *zn;
struct zvolume *v;
while (zn) {
struct znode *zn2 = zn->next;
if (zn->vchild)
- zfile_fclose_archive(zn->vchild);
- xfree(zn->comment);
- xfree(zn->fullname);
- xfree(zn->name);
- zfile_fclose(zn->f);
+ zfile_fclose_archive (zn->vchild);
+ xfree (zn->comment);
+ xfree (zn->fullname);
+ xfree (zn->name);
+ zfile_fclose (zn->f);
if (zn != &zv->root)
- xfree(zn);
+ xfree (zn);
zn = zn2;
}
archive_access_close (zv->handle, zv->id);
v = v->next;
}
}
- xfree(zv);
+ xfree (zv);
}
struct zdirectory {
struct znode *n;
};
-void *zfile_opendir_archive(const char *path)
+void *zfile_opendir_archive (const char *path)
{
- struct zvolume *zv = get_zvolume(path);
- struct znode *zn = get_znode(zv, path);
- struct zdirectory *zd = xmalloc(sizeof (struct zdirectory));
+ struct zvolume *zv = get_zvolume (path);
+ struct znode *zn = get_znode (zv, path);
+ struct zdirectory *zd = xmalloc (sizeof (struct zdirectory));
if (!zn || (!zn->child && !zn->vchild))
return NULL;
}
return zd;
}
-void zfile_closedir_archive(struct zdirectory *zd)
+void zfile_closedir_archive (struct zdirectory *zd)
{
- xfree(zd);
+ xfree (zd);
}
-int zfile_readdir_archive(struct zdirectory *zd, char *out)
+int zfile_readdir_archive (struct zdirectory *zd, char *out)
{
if (!zd->n)
return 0;
return 1;
}
-int zfile_fill_file_attrs_archive(const char *path, int *isdir, int *flags, char **comment)
+int zfile_fill_file_attrs_archive (const char *path, int *isdir, int *flags, char **comment)
{
- struct zvolume *zv = get_zvolume(path);
- struct znode *zn = get_znode(zv, path);
+ struct zvolume *zv = get_zvolume (path);
+ struct znode *zn = get_znode (zv, path);
*isdir = 0;
*flags = 0;
*isdir = zn->isfile ? 0 : 1;
*flags = zn->flags;
if (zn->comment)
- *comment = my_strdup(zn->comment);
+ *comment = my_strdup (zn->comment);
return 1;
}
-int zfile_fs_usage_archive(const char *path, const char *disk, struct fs_usage *fsp)
+int zfile_fs_usage_archive (const char *path, const char *disk, struct fs_usage *fsp)
{
- struct zvolume *zv = get_zvolume(path);
+ struct zvolume *zv = get_zvolume (path);
if (!zv)
return -1;
int zfile_stat_archive (const char *path, struct stat *s)
{
- struct zvolume *zv = get_zvolume(path);
- struct znode *zn = get_znode(zv, path);
+ struct zvolume *zv = get_zvolume (path);
+ struct znode *zn = get_znode (zv, path);
if (!zn)
return 0;
void *zfile_open_archive (const char *path, int flags)
{
- struct zvolume *zv = get_zvolume(path);
- struct znode *zn = get_znode(zv, path);
+ struct zvolume *zv = get_zvolume (path);
+ struct znode *zn = get_znode (zv, path);
struct zfile *z;
if (!zn)
return 0;
if (zn->f) {
- zfile_fseek(zn->f, 0, SEEK_SET);
+ zfile_fseek (zn->f, 0, SEEK_SET);
return zn->f;
}
if (zn->vfile)
zn = zn->vfile;
z = archive_getzfile (zn, zn->volume->id);
if (z)
- zfile_fseek(z, 0, SEEK_SET);
+ zfile_fseek (z, 0, SEEK_SET);
zn->f = z;
return zn->f;
}
struct zvolume *zv;
struct znode *zn;
- sprintf(tmp, "%s%c%s", path, FSDB_DIR_SEPARATOR, rel);
- zv = get_zvolume(tmp);
- zn = get_znode(zv, tmp);
+ sprintf (tmp, "%s%c%s", path, FSDB_DIR_SEPARATOR, rel);
+ zv = get_zvolume (tmp);
+ zn = get_znode (zv, tmp);
return zn ? 1 : 0;
}