static void INT2 (void)
{
- int irq = 0;
-
if (currprefs.cs_cdtvscsi)
return;
if (!(auxstatus & 0x80))
uae_u8 wdscsi_get (void)
{
- uae_u8 v, osasr = sasr;
+ uae_u8 v;
+#if WD33C93_DEBUG > 1
+ uae_u8 osasr = sasr;
+#endif
v = wdregs[sasr];
if (sasr == WD_DATA) {
static uae_u32 mbdmac_read (uae_u32 addr, int mode)
{
+#if A3000_DEBUG > 1
uae_u32 vaddr = addr;
+#endif
uae_u32 v = 0xffffffff;
if (currprefs.cs_mbdmac > 1)
static int qcode_valid;
static int cdrom_disk, cdrom_paused, cdrom_playing, cdrom_audiostatus;
-static int cdrom_command_active, cdrom_command_idle;
+static int cdrom_command_active;
static int cdrom_command_length;
static int cdrom_checksum_error, cdrom_unknown_command;
static int cdrom_data_offset, cdrom_speed, cdrom_sector_counter;
}
if (cdrom_command_buffer[7] == 0x80) { /* data read */
+#if AKIKO_DEBUG_IO_CMD
int cdrom_data_offset_end = endpos;
+#endif
cdrom_data_offset = seekpos;
cdrom_seek_delay = abs (cdrom_current_sector - cdrom_data_offset);
if (cdrom_seek_delay < 100) {
#endif
cdrom_result_buffer[1] |= 0x02;
} else if (cdrom_command_buffer[10] & 4) { /* play audio */
+#if AKIKO_DEBUG_IO_CMD
int scan = 0;
if (cdrom_command_buffer[7] & 0x04)
scan = 1;
else if (cdrom_command_buffer[7] & 0x08)
scan = -1;
-#if AKIKO_DEBUG_IO_CMD
write_log (_T("PLAY FROM %06X (%d) to %06X (%d) SCAN=%d\n"),
seekpos, msf2lsn (seekpos), endpos, msf2lsn (endpos), scan);
#endif
{
int i, cmd_len;
uae_u8 checksum;
+#if 0
uae_u8 *pp = get_real_address (cdtx_address);
+#endif
if (!(cdrom_flags & CDFLAG_TXD))
return;
static void cdrom_run_read (void)
{
int i, sector, inc;
- int read = 0;
int sec;
int seccnt;
if (!cdrom_command_active)
cdrom_run_command_run ();
}
-#if 0
- if (!cdrom_playing && !cdrom_command_active) {
- cdrom_command_idle++;
- if (cdrom_command_idle > 1000) {
- cdrom_command_idle = 0;
- cdrom_start_return_data (cdrom_command_idle_status ());
- }
- }
-#endif
}
void AKIKO_hsync_handler (void)
if (frame2counter <= 0) {
frame2counter = 312 * 50 / 2;
if (unitnum >= 0 && sys_command_cd_qcode (unitnum, qcode_buf)) {
- uae_u8 as = qcode_buf[1];
qcode_valid = 1;
}
}
arram_lget, arram_wget, ABFLAG_RAM
};
+
+static void action_replay_map_banks (void)
+{
+ if(!armemory_rom)
+ return;
+ map_banks (&arrom_bank, arrom_start >> 16, arrom_size >> 16, 0);
+ map_banks (&arram_bank, arram_start >> 16, arram_size >> 16, 0);
+}
+
static void action_replay_unmap_banks (void)
{
if(!armemory_rom)
map_banks (&dummy_bank, arram_start >> 16 , arram_size >> 16, 0);
}
-static void action_replay_map_banks (void)
-{
- if(!armemory_rom)
- return;
- map_banks (&arrom_bank, arrom_start >> 16, arrom_size >> 16, 0);
- map_banks (&arram_bank, arram_start >> 16, arram_size >> 16, 0);
-}
-
static void hide_cart (int hide)
{
#ifdef ACTION_REPLAY_HIDE_CARTRIDGE
TCHAR path[MAX_DPATH];
int i;
uae_u8 *tmp = xmalloc (uae_u8, 131072);
- TCHAR *bin = extra == 1 ? _T(".bin") : _T("");
+ const TCHAR *bin = extra == 1 ? _T(".bin") : _T("");
memset (tmp, 0, 131072);
_stprintf (path, _T("%s%s%s"), xpath, extra == 3 ? _T("-hi") : (extra == 2 ? _T("hi") : _T("h")), bin);
#include <math.h>
-#define MAX_EV ~0ul
+#define MAX_EV ~0u
#define DEBUG_AUDIO 0
#define DEBUG_CHANNEL_MASK 15
#define TEST_AUDIO 0
return currprefs.produce_sound != 0;
}
+#if DEBUG_AUDIO > 0
static bool debugchannel (int ch)
{
return ((1 << ch) & DEBUG_CHANNEL_MASK) != 0;
}
+#endif
STATIC_INLINE bool usehacks1 (void)
{
while (rs) {
if (rs->changed) {
rs->changed = 0;
- fetch_ripperpath (path, sizeof (path) / sizeof TCHAR);
+ fetch_ripperpath (path, sizeof (path) / sizeof (TCHAR));
name[0] = 0;
if (currprefs.floppyslots[0].dfxtype >= 0)
_tcscpy (name, currprefs.floppyslots[0].df);
void (*sample_handler) (void);
static void (*sample_prehandler) (unsigned long best_evtime);
-static float sample_evtime;
+float sample_evtime;
float scaled_sample_evtime;
static unsigned long last_cycles;
void update_audio (void)
{
unsigned long int n_cycles = 0;
+#if SOUNDSTUFF > 1
static int samplecounter;
+#endif
if (!isaudio ())
goto end;
extern struct device_functions devicefunc_win32_ioctl;
extern struct device_functions devicefunc_cdimage;
+#endif
+
static struct device_functions *devicetable[] = {
NULL,
&devicefunc_cdimage,
+#ifdef _WIN32
&devicefunc_win32_ioctl,
&devicefunc_win32_spti,
&devicefunc_win32_aspi,
+#endif
NULL
};
static int driver_installed[6];
}
}
-#endif
void blkdev_default_prefs (struct uae_prefs *p)
{
MDS_SessionBlock *sb = (MDS_SessionBlock*)(mds + head->sessions_blocks_offset);
cdu->tracks = sb->last_track - sb->first_track + 1;
for (int i = 0; i < sb->num_all_blocks; i++) {
- MDS_TrackBlock *tb = (MDS_TrackBlock*)(mds + sb->tracks_blocks_offset + i * sizeof MDS_TrackBlock);
+ MDS_TrackBlock *tb = (MDS_TrackBlock*)(mds + sb->tracks_blocks_offset + i * sizeof (MDS_TrackBlock));
int point = tb->point;
int tracknum = -1;
if (point == 0xa2)
s2 = _tcsrchr (tmp, '/');
if (s2) {
s2[0] = 0;
- _tcscat (tmp, _T("\\"));
+ _tcscat (tmp, FSDB_DIR_SEPARATOR_S);
_tcscat (tmp, fname);
ztrack = zfile_fopen (tmp, _T("rb"), ZFD_ARCHIVE | ZFD_DELAYEDOPEN);
}
for(i = 0; i < 5; i++) {
printf("{%d,%d}%s", flaguse[i], flagset[i], i == 4 ? "" : ",");
}
- printf("},%2d,L\"%s\"}", sduse, opstrp);
+ printf("},%2d,_T(\"%s\")}", sduse, opstrp);
}
}
printf("};\nint n_defs68k = %d;\n", no_insns);
fmv_wput (addr + 2, w >> 0);
}
-extern addrbank fmv_bank;
-
static void REGPARAM2 fmv_bput (uaecptr addr, uae_u32 w)
{
addr -= fmv_start & fmv_mask;
return false;
}
-static size_t cfg_write (void *b, struct zfile *z)
+static size_t cfg_write (const void *b, struct zfile *z)
{
size_t v;
if (unicode_config) {
{
int roms[4];
- roms[0] = 6;
- roms[1] = 32;
- roms[2] = -1;
- if (!configure_rom (p, roms, romcheck))
- return 0;
- roms[0] = 20;
- roms[1] = 21;
- roms[2] = 22;
- roms[3] = -1;
- if (!configure_rom (p, roms, romcheck))
- return 0;
p->bogomem_size = 0;
p->chipmem_size = 0x100000;
p->chipset_mask = CSMASK_ECS_AGNUS;
built_in_chipset_prefs (p);
fetch_datapath (p->flashfile, sizeof (p->flashfile) / sizeof (TCHAR));
_tcscat (p->flashfile, _T("cdtv.nvr"));
+ roms[0] = 6;
+ roms[1] = 32;
+ roms[2] = -1;
+ if (!configure_rom (p, roms, romcheck))
+ return 0;
+ roms[0] = 20;
+ roms[1] = 21;
+ roms[2] = 22;
+ roms[3] = -1;
+ if (!configure_rom (p, roms, romcheck))
+ return 0;
return 1;
}
int roms[2];
buildin_default_prefs_68020 (p);
+ p->cs_cd32c2p = p->cs_cd32cd = p->cs_cd32nvram = 1;
+ p->nr_floppies = 0;
+ p->floppyslots[0].dfxtype = DRV_NONE;
+ p->floppyslots[1].dfxtype = DRV_NONE;
+ set_68020_compa (p, compa, 1);
+ p->cs_compatible = CP_CD32;
+ built_in_chipset_prefs (p);
+ fetch_datapath (p->flashfile, sizeof (p->flashfile) / sizeof (TCHAR));
+ _tcscat (p->flashfile, _T("cd32.nvr"));
roms[0] = 64;
roms[1] = -1;
if (!configure_rom (p, roms, 0)) {
if (!configure_rom (p, roms, romcheck))
return 0;
}
- p->cs_cd32c2p = p->cs_cd32cd = p->cs_cd32nvram = 1;
- p->nr_floppies = 0;
- p->floppyslots[0].dfxtype = DRV_NONE;
- p->floppyslots[1].dfxtype = DRV_NONE;
- set_68020_compa (p, compa, 1);
- p->cs_compatible = CP_CD32;
- built_in_chipset_prefs (p);
- fetch_datapath (p->flashfile, sizeof (p->flashfile) / sizeof (TCHAR));
- _tcscat (p->flashfile, _T("cd32.nvr"));
return 1;
}
record_key_direct ((0x10 << 1) | 0);
record_key_direct ((0x10 << 1) | 1);
}
+ return NULL;
}
int consolehook_activate (void)
#include "debug.h"
#include "cpummu.h"
+static void REGPARAM3 mmu_flush_atc(uaecptr addr, bool super, bool global) REGPARAM;
+static void REGPARAM3 mmu_flush_atc_all(bool global) REGPARAM;
+
#define DBG_MMU_VERBOSE 1
#define DBG_MMU_SANITY 1
#include <ctype.h>
#include <assert.h>
+#include <math.h>
#include "options.h"
#include "uae.h"
col = (datab & 3) << (2 * num);
#if 0
if (sprxp == sprite_minx || sprxp == sprite_maxx - 1)
- col ^= (rand () << 16) | rand ();
+ col ^= (uaerand () << 16) | uaerand ();
#endif
if ((j & mask) == 0) {
unsigned int tmp = (*buf) | col;
fake_vblank_hz = 0;
vblank_hz_mult = 0;
vblank_hz_state = 1;
- if (abs (currprefs.chipset_refreshrate) > 0.1) {
+ if (fabs (currprefs.chipset_refreshrate) > 0.1) {
vblank_hz = currprefs.chipset_refreshrate;
if (isvsync_chipset ()) {
int mult = 0;
if (!picasso_on) {
if (isvsync_chipset ()) {
if (cr->index == CHIPSET_REFRESH_PAL || cr->index == CHIPSET_REFRESH_NTSC) {
- if ((abs (vblank_hz - 50) < 1 || abs (vblank_hz - 60) < 1 || abs (vblank_hz - 100) < 1 || abs (vblank_hz - 120) < 1) && currprefs.gfx_apmode[0].gfx_vsync == 2 && currprefs.gfx_apmode[0].gfx_fullscreen > 0) {
+ if ((fabs (vblank_hz - 50) < 1 || fabs (vblank_hz - 60) < 1 || fabs (vblank_hz - 100) < 1 || fabs (vblank_hz - 120) < 1) && currprefs.gfx_apmode[0].gfx_vsync == 2 && currprefs.gfx_apmode[0].gfx_fullscreen > 0) {
vsync_switchmode (vblank_hz);
}
}
maxvpos_total = (currprefs.chipset_mask & CSMASK_ECS_AGNUS) ? 2047 : 511;
if (maxvpos_total > MAXVPOS)
maxvpos_total = MAXVPOS;
+#ifdef PICASSO96
if (!p96refresh_active) {
maxvpos_stored = maxvpos;
maxhpos_stored = maxhpos;
vblank_hz_stored = vblank_hz;
}
+#endif
compute_framesync ();
static void rtg_vsync (void)
{
+#ifdef PICASSO96
frame_time_t start, end;
start = read_processor_time ();
picasso_handle_vsync ();
end = read_processor_time ();
frameskiptime += end - start;
+#endif
}
static void rtg_vsynccheck (void)
{
if (vblank_found_rtg) {
vblank_found_rtg = false;
+#ifdef PICASSO96
rtg_vsync ();
+#endif
}
}
if (debug_dma)
record_dma_reset ();
+#ifdef PICASSO96
if (p96refresh_active) {
vpos_count = p96refresh_active;
vtotal = vpos_count;
}
+#endif
+
if ((beamcon0 & (0x20 | 0x80)) != (new_beamcon0 & (0x20 | 0x80)) || abs (vpos_count - vpos_count_diff) > 1 || lof_changed) {
init_hz ();
} else if (interlace_changed || changed_chipset_refresh ()) {
int vp = vpos & (((cop_state.saved_i2 >> 8) & 0x7F) | 0x80);
if (vp < cop_state.vcmp) {
if (copper_enabled_thisline)
- write_log (_T("COPPER BUG %d: vp=%d vpos=%d vcmp=%d act=%d thisline=%d\n"), n, vp, vpos, cop_state.vcmp, copper_enabled_thisline);
+ write_log (_T("COPPER BUG %d: vp=%d vpos=%d vcmp=%d thisline=%d\n"), n, vp, vpos, cop_state.vcmp, copper_enabled_thisline);
}
}
}
#endif
gayle_hsync ();
+#ifdef A2091
scsi_hsync ();
+#endif
//copper_check (2);
if (hardreset)
rtc_hardreset();
+#ifdef PICASSO96
picasso_reset ();
+#endif
}
void dumpcustom (void)
save_u32 (CYCLE_UNIT);
save_u64 (get_cycles ());
save_u32 (extra_cycle);
- write_log (_T("SAVECYCLES %08X\n"), get_cycles ());
+ write_log (_T("SAVECYCLES %08lX\n"), get_cycles ());
*len = dst - dstbak;
return dstbak;
}
restore_u32 ();
start_cycles = restore_u64 ();
extra_cycle = restore_u32 ();
- write_log (_T("RESTORECYCLES %08X\n"), start_cycles);
+ write_log (_T("RESTORECYCLES %08lX\n"), start_cycles);
return src;
}
return 0;
*val = v;
// stupid but works!
- _stprintf(p, L"%u", v);
+ _stprintf(p, _T("%u"), v);
p += _tcslen (p);
if (peekchar (cp) == '.') {
readchar (cp);
}
static TCHAR *BSTR2CSTR (uae_u8 *bstr)
{
- WCHAR *s;
+ TCHAR *s;
char *cstr = xmalloc (char, bstr[0] + 1);
if (cstr) {
memcpy (cstr, bstr + 1, bstr[0]);
return 1;
}
-
int getdebug(void)
{
return floppy[0].mfmpos;
-}
\ No newline at end of file
+}
z3fastmem2_bank.baseaddr = z3fastmem2;
z3chipmem_bank.baseaddr = z3chipmem;
fastmem_bank.baseaddr = fastmemory;
+#ifdef PICASSO96
gfxmem_bank.baseaddr = gfxmemory;
+#endif
#ifdef SAVESTATE
if (savestate_state == STATE_RESTORE) {
static void expamem_init_a2065 (void)
{
+#ifdef A2065
a2065_init ();
+#endif
}
static void expamem_init_cdtv (void)
{
+#ifdef CDTV
cdtv_init ();
+#endif
}
static void expamem_init_a2091 (void)
{
+#ifdef A2091
a2091_init ();
+#endif
}
static void expamem_init_a4091 (void)
{
+#ifdef NCR
ncr_init ();
+#endif
}
#if 0
void p96memstart (void)
if (i >= pulses)
i = 0;
indx = idx[i];
- if (uaerand() <= (indx * RAND_MAX) / maxidx) {
+ if (uaerand() <= (indx * UAE_RAND_MAX) / maxidx) {
pulse += avgp[i] - ref_pulse;
if (indx >= maxidx)
ref_pulse = 0;
if (min_pulse < ref_pulse)
min_pulse = ref_pulse;
randval = uaerand();
- if (randval < (RAND_MAX / 2)) {
- if (randval > (RAND_MAX / 4)) {
- if (randval <= (3 * RAND_MAX / 8))
- randval = (2 * randval) - (RAND_MAX /4);
+ if (randval < (UAE_RAND_MAX / 2)) {
+ if (randval > (UAE_RAND_MAX / 4)) {
+ if (randval <= (3 * UAE_RAND_MAX / 8))
+ randval = (2 * randval) - (UAE_RAND_MAX /4);
else
- randval = (4 * randval) - RAND_MAX;
+ randval = (4 * randval) - UAE_RAND_MAX;
}
- jitter = 0 - (randval * (avg_pulse - min_pulse)) / RAND_MAX;
+ jitter = 0 - (randval * (avg_pulse - min_pulse)) / UAE_RAND_MAX;
} else {
- randval -= RAND_MAX / 2;
- if (randval > (RAND_MAX / 4)) {
- if (randval <= (3 * RAND_MAX / 8))
- randval = (2 * randval) - (RAND_MAX /4);
+ randval -= UAE_RAND_MAX / 2;
+ if (randval > (UAE_RAND_MAX / 4)) {
+ if (randval <= (3 * UAE_RAND_MAX / 8))
+ randval = (2 * randval) - (UAE_RAND_MAX /4);
else
- randval = (4 * randval) - RAND_MAX;
+ randval = (4 * randval) - UAE_RAND_MAX;
}
- jitter = (randval * (max_pulse - avg_pulse)) / RAND_MAX;
+ jitter = (randval * (max_pulse - avg_pulse)) / UAE_RAND_MAX;
}
avg_pulse += jitter;
if ((avg_pulse < min_pulse) || (avg_pulse > max_pulse)) {
ref_pulse = 0;
if (i == eodat)
outstep++;
- } else if (uaerand() <= ((idx[i] * RAND_MAX) / maxidx)) {
+ } else if (uaerand() <= ((idx[i] * UAE_RAND_MAX) / maxidx)) {
avg_pulse = avgp[i];
min_pulse = minp[i];
max_pulse = maxp[i];
randval = uaerand();
- if (randval < (RAND_MAX / 2)) {
- if (randval > (RAND_MAX / 4)) {
- if (randval <= (3 * RAND_MAX / 8))
- randval = (2 * randval) - (RAND_MAX /4);
+ if (randval < (UAE_RAND_MAX / 2)) {
+ if (randval > (UAE_RAND_MAX / 4)) {
+ if (randval <= (3 * UAE_RAND_MAX / 8))
+ randval = (2 * randval) - (UAE_RAND_MAX /4);
else
- randval = (4 * randval) - RAND_MAX;
+ randval = (4 * randval) - UAE_RAND_MAX;
}
- avg_pulse -= (randval * (avg_pulse - min_pulse)) / RAND_MAX;
+ avg_pulse -= (randval * (avg_pulse - min_pulse)) / UAE_RAND_MAX;
} else {
- randval -= RAND_MAX / 2;
- if (randval > (RAND_MAX / 4)) {
- if (randval <= (3 * RAND_MAX / 8))
- randval = (2 * randval) - (RAND_MAX /4);
+ randval -= UAE_RAND_MAX / 2;
+ if (randval > (UAE_RAND_MAX / 4)) {
+ if (randval <= (3 * UAE_RAND_MAX / 8))
+ randval = (2 * randval) - (UAE_RAND_MAX /4);
else
- randval = (4 * randval) - RAND_MAX;
+ randval = (4 * randval) - UAE_RAND_MAX;
}
- avg_pulse += (randval * (max_pulse - avg_pulse)) / RAND_MAX;
+ avg_pulse += (randval * (max_pulse - avg_pulse)) / UAE_RAND_MAX;
}
if ((avg_pulse > ref_pulse) && (avg_pulse < (avgp[nexti] - jitter))) {
pulse += avg_pulse - ref_pulse;
#define TRACE2(x)
#endif
+static void get_time (time_t t, long* days, long* mins, long* ticks);
+
static uae_sem_t test_sem;
int bootrom_header, bootrom_items;
}
-static void filesys_addexternals (void);
+void filesys_addexternals (void);
static void initialize_mountinfo (void)
{
uci->devname, uci->sectors, uci->surfaces, uci->reserved,
uci->bootpri, uci->filesys);
} else if (uci->controller <= HD_CONTROLLER_SCSI6) {
+#ifdef A2091
if (currprefs.cs_mbdmac) {
a3000_add_scsi_unit (uci->controller - HD_CONTROLLER_SCSI0, uci->rootdir, uci->blocksize, uci->readonly,
uci->devname, uci->sectors, uci->surfaces, uci->reserved,
uci->bootpri, uci->filesys);
+#endif
} else if (currprefs.cs_a2091) {
+#ifdef A2091
a2091_add_scsi_unit (uci->controller - HD_CONTROLLER_SCSI0, uci->rootdir, uci->blocksize, uci->readonly,
uci->devname, uci->sectors, uci->surfaces, uci->reserved,
uci->bootpri, uci->filesys);
+#endif
} else if (currprefs.cs_cdtvscsi) {
+#ifdef CDTV
cdtv_add_scsi_unit (uci->controller - HD_CONTROLLER_SCSI0, uci->rootdir, uci->blocksize, uci->readonly,
uci->devname, uci->sectors, uci->surfaces, uci->reserved,
uci->bootpri, uci->filesys);
+#endif
}
} else if (uci->controller == HD_CONTROLLER_PCMCIA_SRAM) {
gayle_add_pcmcia_sram_unit (uci->rootdir, uci->readonly);
uip[num].rootdir, uip[num].readonly ? "ro" : "");
else
_stprintf (buffer, _T("(DH%d:) Hardfile, \"%s\", size %d Mbytes"), num,
- uip[num].rootdir, uip[num].hf.virtsize / (1024 * 1024));
+ uip[num].rootdir, (int)(uip[num].hf.virtsize / (1024 * 1024)));
return 0;
}
#define dp64_Arg5 56
/* result codes */
-#define DOS_TRUE ((unsigned long)-1L)
+#define DOS_TRUE ((uae_u32)-1L)
#define DOS_FALSE (0L)
#define MAXFILESIZE32 (0x7fffffff)
static void free_all_ainos (Unit *u, a_inode *parent)
{
a_inode *a;
- while (a = parent->child) {
+ while ((a = parent->child)) {
free_all_ainos (u, a);
dispose_aino (u, &parent->child, a);
}
return n;
}
+#if 0
static void free_notify_item (Notify *n)
{
xfree (n->fullname);
xfree (n->partname);
xfree (n);
}
+#endif
static void free_notify (Unit *unit, int hash, Notify *n)
{
if (!unit)
return;
xfree (unit->ui.volname);
- memcpy (&unit->ui, uinfo, sizeof UnitInfo);
+ memcpy (&unit->ui, uinfo, sizeof (UnitInfo));
unit->ui.devname = uinfo->devname;
unit->ui.volname = my_strdup (uinfo->volname); /* might free later for rename */
}
return k;
}
+#if TRACING_ENABLED
static void
dumplock (Unit *unit, uaecptr lock)
{
}
TRACE((_T(" }\n")));
}
+#endif
static a_inode *find_aino (Unit *unit, uaecptr lock, const TCHAR *name, int *err)
{
uaecptr control = GET_PCK_ARG5 (packet);
ExAllKey *eak = NULL;
- a_inode *base;
+ a_inode *base = NULL;
struct fs_dirhandle *d;
int ok, i;
uaecptr exp;
aino->shlock++;
}
de_recycle_aino (unit, aino);
+
PUT_PCK_RES1 (packet, DOS_TRUE);
}
if (mode < 0)
whence = SEEK_SET;
- TRACE((_T("ACTION_CHANGE_FILE_POSITION64(%s,%I64d,%d)\n"), k->aino->nname, pos, mode));
+ TRACE((_T("ACTION_CHANGE_FILE_POSITION64(%s,%lld,%d)\n"), k->aino->nname, pos, mode));
gui_flicker_led (LED_HD, unit->unit, 1);
cur = fs_lseek64 (k->fd, 0, SEEK_CUR);
if (mode < 0)
whence = SEEK_SET;
- TRACE((_T("ACTION_CHANGE_FILE_SIZE64(0x%lx, %I64d, 0x%x)\n"), GET_PCK64_ARG1 (packet), offset, mode));
+ TRACE((_T("ACTION_CHANGE_FILE_SIZE64(0x%lx, %lld, 0x%x)\n"), GET_PCK64_ARG1 (packet), offset, mode));
k = lookup_key (unit, GET_PCK64_ARG1 (packet));
if (k == 0) {
}
#ifdef UAE_FILESYS_THREADS
+
+static int filesys_iteration(UnitInfo *ui)
+{
+ dpacket pck;
+ uaecptr msg;
+ uae_u32 morelocks;
+
+ pck = read_comm_pipe_u32_blocking (ui->unit_pipe);
+ msg = read_comm_pipe_u32_blocking (ui->unit_pipe);
+ morelocks = (uae_u32)read_comm_pipe_int_blocking (ui->unit_pipe);
+
+ if (ui->reset_state == FS_GO_DOWN) {
+ if (pck != 0)
+ return 1;
+ /* Death message received. */
+ uae_sem_post (&ui->reset_sync_sem);
+ /* Die. */
+ return 0;
+ }
+
+ put_long (get_long (morelocks), get_long (ui->self->locklist));
+ put_long (ui->self->locklist, morelocks);
+ int ret = handle_packet (ui->self, pck, msg);
+ if (!ret) {
+ PUT_PCK_RES1 (pck, DOS_FALSE);
+ PUT_PCK_RES2 (pck, ERROR_ACTION_NOT_KNOWN);
+ }
+ if (ret >= 0) {
+ /* Mark the packet as processed for the list scan in the assembly code. */
+ put_long (msg + 4, 0xffffffff);
+ }
+ /* Acquire the message lock, so that we know we can safely send the message. */
+ ui->self->cmds_sent++;
+ /* The message is sent by our interrupt handler, so make sure an interrupt happens. */
+ do_uae_int_requested ();
+ /* Send back the locks. */
+ if (get_long (ui->self->locklist) != 0)
+ write_comm_pipe_int (ui->back_pipe, (int)(get_long (ui->self->locklist)), 0);
+ put_long (ui->self->locklist, 0);
+ return 1;
+}
+
+
static void *filesys_thread (void *unit_v)
{
UnitInfo *ui = (UnitInfo *)unit_v;
uae_set_thread_priority (NULL, 1);
for (;;) {
- dpacket pck;
- uaecptr msg;
- uae_u32 morelocks;
-
- pck = read_comm_pipe_u32_blocking (ui->unit_pipe);
- msg = read_comm_pipe_u32_blocking (ui->unit_pipe);
- morelocks = (uae_u32)read_comm_pipe_int_blocking (ui->unit_pipe);
-
- if (ui->reset_state == FS_GO_DOWN) {
- if (pck != 0)
- continue;
- /* Death message received. */
- uae_sem_post (&ui->reset_sync_sem);
- /* Die. */
+ if (!filesys_iteration (ui)) {
return 0;
}
-
- put_long (get_long (morelocks), get_long (ui->self->locklist));
- put_long (ui->self->locklist, morelocks);
- int ret = handle_packet (ui->self, pck, msg);
- if (!ret) {
- PUT_PCK_RES1 (pck, DOS_FALSE);
- PUT_PCK_RES2 (pck, ERROR_ACTION_NOT_KNOWN);
- }
- if (ret >= 0) {
- /* Mark the packet as processed for the list scan in the assembly code. */
- put_long (msg + 4, 0xffffffff);
- }
- /* Acquire the message lock, so that we know we can safely send the message. */
- ui->self->cmds_sent++;
- /* The message is sent by our interrupt handler, so make sure an interrupt happens. */
- do_uae_int_requested ();
- /* Send back the locks. */
- if (get_long (ui->self->locklist) != 0)
- write_comm_pipe_int (ui->back_pipe, (int)(get_long (ui->self->locklist)), 0);
- put_long (ui->self->locklist, 0);
-
}
return 0;
}
{
case 1:
mountertask = m68k_areg (regs, 1);
+#ifdef PICASSO96
picasso96_alloc (context);
+#endif
break;
case 2:
ret = automountunit;
xfree (s);
if ((uae_u64)highcyl * spt * surfaces * blocksize > hfd->virtsize) {
- write_log (_T("RDB: WARNING: end of partition > size of disk! (%I64u > %I64u)\n"),
+ write_log (_T("RDB: WARNING: end of partition > size of disk! (%llu > %llu)\n"),
(uae_u64)highcyl * spt * surfaces * blocksize, hfd->virtsize);
}
}
}
-#define rdbmnt write_log (_T("Mounting uaehf.device %d (%d) (size=%I64u):\n"), unit_no, partnum, hfd->virtsize);
+#define rdbmnt write_log (_T("Mounting uaehf.device %d (%d) (size=%llu):\n"), unit_no, partnum, hfd->virtsize);
static int rdb_mount (UnitInfo *uip, int unit_no, int partnum, uaecptr parmpacket)
{
}
if (lastblock * hfd->blocksize > hfd->virtsize) {
rdbmnt
- write_log (_T("failed, too small (%d*%d > %I64u)\n"), lastblock, hfd->blocksize, hfd->virtsize);
+ write_log (_T("failed, too small (%d*%d > %llu)\n"), lastblock, hfd->blocksize, hfd->virtsize);
return -2;
}
for (rdblock = 0; rdblock < lastblock; rdblock++) {
if (showdebug) {
if ((uae_u64)hfd->cylinders * hfd->sectors * hfd->heads * blocksize > hfd->virtsize)
- write_log (_T("RDB: WARNING: RDSK header disk size > disk size! (%I64u > %I64u)\n"),
+ write_log (_T("RDB: WARNING: RDSK header disk size > disk size! (%llu > %llu)\n"),
(uae_u64)hfd->cylinders * hfd->sectors * hfd->heads * blocksize, hfd->virtsize);
write_log (_T("RDSK dump start\n"));
write_log (_T("RDSK at %d, C=%d S=%d H=%d\n"),
#endif
}
-#if USE_CDFS
+#if USE_CDFS == 1
#include "cdrom-handler.cpp"
#endif
+#ifdef _WIN32
#include "od-win32/win32_filesys.cpp"
+#endif
static uae_u8 *restore_filesys_hardfile (UnitInfo *ui, uae_u8 *src)
{
write_log (_T("*** FS: Open file '%s', couldn't create dummy file!\n"), p);
}
} else {
- write_log (L"*** FS: Too big, ignored\n");
+ write_log (_T("*** FS: Too big, ignored\n"));
}
} else {
k->fd = fs_openfile (u, a, openmode | O_BINARY);
uae_s64 s;
s = fs_fsize64 (k->fd);
if (s != savedsize)
- write_log (_T("FS: restored file '%s' size changed! orig=%I64d, now=%I64d!!\n"), p, savedsize, s);
+ write_log (_T("FS: restored file '%s' size changed! orig=%lld, now=%lld!!\n"), p, savedsize, s);
if (k->file_pos > s) {
- write_log (_T("FS: restored filepos larger than size of file '%s'!! %I64d > %d\n"), p, k->file_pos, s);
+ write_log (_T("FS: restored filepos larger than size of file '%s'!! %lld > %d\n"), p, k->file_pos, s);
k->file_pos = s;
}
fs_lseek64 (k->fd, k->file_pos, SEEK_SET);
if (a->elock || a->shlock || a->uniq == 0) {
if (dst) {
TCHAR *fn = NULL;
- write_log (_T("uniq=%d %I64d s=%d e=%d d=%d '%s' '%s'\n"), a->uniq, a->uniq_external, a->shlock, a->elock, a->dir, a->aname, a->nname);
+ write_log (_T("uniq=%d %lld s=%d e=%d d=%d '%s' '%s'\n"), a->uniq, a->uniq_external, a->shlock, a->elock, a->dir, a->aname, a->nname);
if (a->aname) {
fn = getfullaname (a);
write_log (_T("->'%s'\n"), fn);
save_string (fn);
save_u64 (k->file_pos);
save_u64 (size);
- write_log (_T("'%s' uniq=%d size=%I64d seekpos=%I64d mode=%d dosmode=%d\n"),
+ write_log (_T("'%s' uniq=%d size=%lld seekpos=%lld mode=%d dosmode=%d\n"),
fn, k->uniq, size, k->file_pos, k->createmode, k->dosmode);
xfree (fn);
return dst;
#endif
}
+#ifndef HAVE_ISINF
extern int isinf (double x);
+#endif
uae_u32 get_fpsr (void)
{
{
TCHAR *p = 0;
int de;
- void *dir;
+ my_opendir_s *dir;
TCHAR fn[MAX_DPATH];
dir = my_opendir (dirname);
/* tmpnam isn't reentrant and I don't really want to hack configure
* right now to see whether tmpnam_r is available... */
for (i = 0; i < 8; i++) {
- tmp[i] = "_abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789"[random () % 63];
+ tmp[i] = "_abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789"[uaerand () % 63];
}
}
}
return (blocks + (blocks < 0 ? -1 : 1)) / (tosize / fromsize);
}
-#ifdef _WIN32
+#ifdef WINDOWS
#include "od-win32/posixemu.h"
#include <windows.h>
int get_fs_usage (const TCHAR *path, const TCHAR *disk, struct fs_usage *fsp)
Return the actual number of bytes read, zero for EOF, or negative
for an error. */
-int
- safe_read (desc, ptr, len)
- int desc;
-TCHAR *ptr;
-int len;
+int safe_read (int desc, TCHAR *ptr, int len)
{
int n_chars;
Return 0 if successful, -1 if not. When returning -1, ensure that
ERRNO is either a system error value, or zero if DISK is NULL
on a system that requires a non-NULL value. */
-int
- get_fs_usage (path, disk, fsp)
- const TCHAR *path;
-const TCHAR *disk;
-struct fs_usage *fsp;
+#ifndef WINDOWS
+int get_fs_usage (const TCHAR *path, const TCHAR *disk, struct fs_usage *fsp)
{
#ifdef STAT_STATFS3_OSF1
# define CONVERT_BLOCKS(B) adjust_blocks ((B), fsd.f_fsize, 512)
return 0;
}
+#endif
#if defined(_AIX) && defined(_I386)
/* AIX PS/2 does not supply statfs. */
unsigned int doMask (int p, int bits, int shift)
{
/* scale to 0..255, shift to align msb with mask, and apply mask */
- unsigned long val;
+ uae_u32 val;
if (flashscreen)
p ^= 0xff;
void alloc_colors_picasso (int rw, int gw, int bw, int rs, int gs, int bs, int rgbfmt)
{
+#ifdef PICASSO96
int byte_swap = 0;
int i;
int red_bits = 0, green_bits, blue_bits;
p96_rgbx16[i] = c;
}
}
+#endif
}
void alloc_colors_rgb (int rw, int gw, int bw, int rs, int gs, int bs, int aw, int as, int alpha, int byte_swap,
grec[2 * 256 + i] = xgreencolors[255];
bluc[2 * 256 + i] = xbluecolors[255];
}
+#ifdef GFXFILTER
if (usedfilter && usedfilter->yuv) {
/* create internal 5:6:5 color tables */
for (i = 0; i < 256; i++) {
tcrrgb[i] = ((uae_s8)get_cr (r, g, b)) * 256;
}
}
+#endif
#endif
xredcolor_b = rw;
extern void action_replay_memory_reset (void);
extern void action_replay_init (int);
extern void action_replay_cleanup (void);
-extern void action_replay_map_banks (void);
extern void REGPARAM3 chipmem_lput_actionreplay23 (uaecptr addr, uae_u32 l) REGPARAM;
extern void REGPARAM3 chipmem_wput_actionreplay23 (uaecptr addr, uae_u32 w) REGPARAM;
extern void REGPARAM3 chipmem_bput_actionreplay1 (uaecptr addr, uae_u32 b) REGPARAM;
};
-extern struct device_functions *device_func[MAX_TOTAL_SCSI_DEVICES];
-
extern int device_func_init(int flags);
extern void device_func_reset(void);
extern int sys_command_open (int unitnum);
uae_u32 logfacility;
uaecptr fdcallback;
+ unsigned int *mtable; /* window messages allocated for asynchronous event notification */
/* host-specific fields below */
#ifdef _WIN32
SOCKET_TYPE sockAbort; /* for aborting WinSock2 select() (damn Microsoft) */
int needAbort; /* abort flag */
void *hAsyncTask; /* async task handle */
void *hEvent; /* thread event handle */
- unsigned int *mtable; /* window messages allocated for asynchronous event notification */
#else
uae_sem_t sem; /* semaphore to notify the socket thread of work */
uae_thread_id thread; /* socket thread */
#define ATC_L2_INDEX(addr) ((((addr) >> 12) ^ ((addr) >> (32 - ATC_L2_SIZE_LOG))) % ATC_L2_SIZE)
-extern struct mmu_atc_line atc_l2[2][ATC_L2_SIZE];
-
/*
* lookup address in the level 1 atc cache,
* the data and write arguments are constant in the common,
extern void REGPARAM3 dfc_put_word(uaecptr addr, uae_u16 val) REGPARAM;
extern void REGPARAM3 dfc_put_byte(uaecptr addr, uae_u8 val) REGPARAM;
-
-extern void REGPARAM3 mmu_flush_atc(uaecptr addr, bool super, bool global) REGPARAM;
-extern void REGPARAM3 mmu_flush_atc_all(bool global) REGPARAM;
extern void REGPARAM3 mmu_op_real(uae_u32 opcode, uae_u16 extra) REGPARAM;
extern void REGPARAM3 mmu_reset(void) REGPARAM;
#define CYCLE_CPUNASTY 0x80
extern unsigned long frametime, timeframes;
-extern int plfstrt, plfstop, plffirstline, plflastline;
extern uae_u16 htotal, vtotal, beamcon0;
/* 100 words give you 1600 horizontal pixels. Should be more than enough for
#define max_diwlastword (PIXEL_XPOS(0x1d4 >> 1))
-extern int lores_factor, lores_shift, sprite_width, interlace_seen;
+extern int lores_factor, lores_shift, interlace_seen;
extern bool aga_mode, direct_rgb;
STATIC_INLINE int coord_hw_to_window_x (int x)
/* Way too much... */
#define MAX_REG_CHANGE ((MAXVPOS + 1) * 2 * MAXHPOS)
-#ifdef OS_WITHOUT_MEMORY_MANAGEMENT
-extern struct color_change *color_changes[2];
-#else
-extern struct color_change color_changes[2][MAX_REG_CHANGE];
-#endif
-
-extern struct color_entry color_tables[2][(MAXVPOS + 2) * 2];
extern struct color_entry *curr_color_tables, *prev_color_tables;
extern struct sprite_entry *curr_sprite_entries, *prev_sprite_entries;
int nr_color_changes, nr_sprites;
};
-extern int next_sprite_entry;
-
extern struct decision line_decisions[2 * (MAXVPOS + 2) + 1];
extern uae_u8 line_data[(MAXVPOS + 2) * 2][MAX_PLANES * MAX_WORDS_PER_LINE * 2];
/* Finally, stuff that shouldn't really be shared. */
extern int thisframe_first_drawn_line, thisframe_last_drawn_line;
-extern int diwfirstword, diwlastword;
#define IHF_SCROLLLOCK 0
#define IHF_QUIT_PROGRAM 1
extern int addr_valid (const TCHAR*, uaecptr,uae_u32);
/* For faster access in custom chip emulation. */
-extern uae_u32 REGPARAM3 chipmem_lget (uaecptr) REGPARAM;
-extern uae_u32 REGPARAM3 chipmem_wget (uaecptr) REGPARAM;
-extern uae_u32 REGPARAM3 chipmem_bget (uaecptr) REGPARAM;
extern void REGPARAM3 chipmem_lput (uaecptr, uae_u32) REGPARAM;
extern void REGPARAM3 chipmem_wput (uaecptr, uae_u32) REGPARAM;
extern void REGPARAM3 chipmem_bput (uaecptr, uae_u32) REGPARAM;
-extern uae_u32 REGPARAM3 chipmem_agnus_lget (uaecptr) REGPARAM;
extern uae_u32 REGPARAM3 chipmem_agnus_wget (uaecptr) REGPARAM;
-extern uae_u32 REGPARAM3 chipmem_agnus_bget (uaecptr) REGPARAM;
-extern void REGPARAM3 chipmem_agnus_lput (uaecptr, uae_u32) REGPARAM;
extern void REGPARAM3 chipmem_agnus_wput (uaecptr, uae_u32) REGPARAM;
-extern void REGPARAM3 chipmem_agnus_bput (uaecptr, uae_u32) REGPARAM;
extern uae_u32 chipmem_mask, kickmem_mask;
extern uae_u8 *kickmemory;
-extern int kickmem_size;
extern addrbank dummy_bank;
/* 68020+ Chip RAM DMA contention emulation */
-extern uae_u32 REGPARAM3 chipmem_lget_ce2 (uaecptr) REGPARAM;
-extern uae_u32 REGPARAM3 chipmem_wget_ce2 (uaecptr) REGPARAM;
-extern uae_u32 REGPARAM3 chipmem_bget_ce2 (uaecptr) REGPARAM;
-extern void REGPARAM3 chipmem_lput_ce2 (uaecptr, uae_u32) REGPARAM;
-extern void REGPARAM3 chipmem_wput_ce2 (uaecptr, uae_u32) REGPARAM;
extern void REGPARAM3 chipmem_bput_c2 (uaecptr, uae_u32) REGPARAM;
extern uae_u32 (REGPARAM3 *chipmem_lget_indirect)(uaecptr) REGPARAM;
extern void memcpyah (uae_u8 *dst, uaecptr src, int size);
extern uae_s32 getz2size (struct uae_prefs *p);
-extern ULONG getz2endaddr (void);
\ No newline at end of file
+extern ULONG getz2endaddr (void);
#define MAX_PATHS 8
struct multipath {
- TCHAR path[MAX_PATHS][256];
+ TCHAR path[MAX_PATHS][PATH_MAX];
};
struct strlist {
extern uae_u8 *save_configuration (int *len);
extern uae_u8 *restore_configuration (uae_u8 *src);
extern uae_u8 *save_log (int, int *len);
-extern uae_u8 *restore_log (uae_u8 *src);
+//extern uae_u8 *restore_log (uae_u8 *src);
extern uae_u8 *restore_input (uae_u8 *src);
extern uae_u8 *save_input (int *len, uae_u8 *dstptr);
#define memcpy q_memcpy
#define memset q_memset
#define strdup my_strdup
-#define random rand
+#define random uaerand
#define creat(x,y) open("T:creat",O_CREAT|O_RDWR|O_TRUNC,777)
extern void* q_memset(void*,int,size_t);
extern void* q_memcpy(void*,const void*,size_t);
#endif
-#define DBLEQU(f, i) (abs ((f) - (i)) < 0.000001)
\ No newline at end of file
+#define DBLEQU(f, i) (abs ((f) - (i)) < 0.000001)
extern void leave_program (void);
extern void real_main (int, TCHAR **);
extern void usage (void);
-extern void parse_cmdline (int argc, TCHAR **argv);
extern void sleep_millis (int ms);
extern void sleep_millis_main (int ms);
extern void sleep_millis_busy (int ms);
typedef uae_s64 (*ZFILEREAD)(void*, uae_u64, uae_u64, struct zfile*);
-typedef uae_s64 (*ZFILEWRITE)(void*, uae_u64, uae_u64, struct zfile*);
+typedef uae_s64 (*ZFILEWRITE)(const void*, uae_u64, uae_u64, struct zfile*);
typedef uae_s64 (*ZFILESEEK)(struct zfile*, uae_s64, int);
struct zfile {
extern struct znode *znode_adddir (struct znode *parent, const TCHAR *name, struct zarchive_info*);
extern struct zvolume *archive_directory_plain (struct zfile *zf);
-extern struct zfile *archive_access_plain (struct znode *zn);
extern struct zvolume *archive_directory_lha(struct zfile *zf);
extern struct zfile *archive_access_lha (struct znode *zn);
extern struct zvolume *archive_directory_zip(struct zfile *zf);
-extern struct zfile *archive_access_zip (struct znode *zn, int flags);
extern struct zvolume *archive_directory_7z (struct zfile *z);
extern struct zfile *archive_access_7z (struct znode *zn);
extern struct zvolume *archive_directory_rar (struct zfile *z);
extern struct zvolume *archive_directory_arcacc (struct zfile *z, unsigned int id);
extern struct zfile *archive_access_arcacc (struct znode *zn);
extern struct zvolume *archive_directory_adf (struct znode *zn, struct zfile *z);
-extern struct zfile *archive_access_adf (struct znode *zn);
extern struct zvolume *archive_directory_rdb (struct zfile *z);
-extern struct zfile *archive_access_rdb (struct znode *zn);
extern struct zvolume *archive_directory_fat (struct zfile *z);
-extern struct zfile *archive_access_fat (struct znode *zn);
-extern struct zfile *archive_access_dir (struct znode *zn);
extern struct zvolume *archive_directory_tar (struct zfile *zf);
extern struct zfile *archive_access_tar (struct znode *zn);
extern struct zfile *archive_getzfile (struct znode *zn, unsigned int id, int flags);
extern struct zfile *archive_unpackzfile (struct zfile *zf);
-extern struct zfile *decompress_zfd (struct zfile*);
\ No newline at end of file
+extern struct zfile *decompress_zfd (struct zfile*);
extern uae_s64 zfile_ftell (struct zfile *z);
extern uae_s64 zfile_size (struct zfile *z);
extern size_t zfile_fread (void *b, size_t l1, size_t l2, struct zfile *z);
-extern size_t zfile_fwrite (void *b, size_t l1, size_t l2, struct zfile *z);
+extern size_t zfile_fwrite (const void *b, size_t l1, size_t l2, struct zfile *z);
extern TCHAR *zfile_fgets (TCHAR *s, int size, struct zfile *z);
extern char *zfile_fgetsa (char *s, int size, struct zfile *z);
extern size_t zfile_fputs (struct zfile *z, TCHAR *s);
extern void zfile_close_archive (struct zfile *d);
extern struct zfile *zfile_open_archive (const TCHAR *path, int flags);
extern int zfile_exists_archive (const TCHAR *path, const TCHAR *rel);
-extern bool zfile_needwrite (struct zfile*);
\ No newline at end of file
+extern bool zfile_needwrite (struct zfile*);
#define JOYMOUSE_CDTV 8
-#define DEFEVENT(A, B, C, D, E, F) {L#A, B, C, D, E, F },
+#define DEFEVENT(A, B, C, D, E, F) {_T(#A), B, C, D, E, F },
static struct inputevent events[] = {
{0, 0, AM_K,0,0,0},
#include "inputevents.def"
void inputdevice_do_keyboard (int code, int state)
{
+#ifdef CDTV
if (code >= 0x72 && code <= 0x77) { // CDTV keys
if (cdtv_front_panel (-1)) {
// front panel active
return;
}
}
+#endif
if (code < 0x80) {
uae_u8 key = code | (state ? 0x00 : 0x80);
keybuf[key & 0x7f] = (key & 0x80) ? 0 : 1;
dpnt = de->name;
/* Basic sanity check, whether name doesn't exceed dir entry */
if (de_len < dlen + sizeof(struct iso_directory_record)) {
- write_log (_T("iso9660: Corrupted directory entry in block %lu of inode %lu\n"), block, dir->i_ino);
+ write_log (_T("iso9660: Corrupted directory entry in block %lu of inode %u\n"), block, dir->i_ino);
return 0;
}
{
int len;
while (_tcscspn (s, _T("\t \r\n")) == 0)
- memmove (s, s + 1, (_tcslen (s + 1) + 1) * sizeof TCHAR);
+ memmove (s, s + 1, (_tcslen (s + 1) + 1) * sizeof (TCHAR));
len = _tcslen (s);
while (len > 0 && _tcscspn (s + len - 1, _T("\t \r\n")) == 0)
s[--len] = '\0';
while (len > 0 && _tcscspn (s + len - 1, _T("\t \r\n")) == 0)
len--;
out = xmalloc (TCHAR, len + 1);
- memcpy (out, s, len * sizeof TCHAR);
+ memcpy (out, s, len * sizeof (TCHAR));
out[len] = 0;
return out;
}
#endif
#if !defined (SCSIEMU)
p->scsi = 0;
+#ifdef _WIN32
p->win32_aspi = 0;
#endif
+#endif
#if !defined (SANA2)
p->sana2 = 0;
#endif
#ifdef OPTIONS_IN_HOME
/* sam: if not found in $HOME then look in current directory */
_tcscpy (optionsfile, restart_config);
- target_cfgfile_load (&currprefs, optionsfile, 0);
+ target_cfgfile_load (&currprefs, optionsfile, 0, default_config);
#endif
}
fixup_prefs (&currprefs);
* Add #ifdefs around these as appropriate.
*/
+#ifdef _WIN32
#ifndef JIT
extern int DummyException (LPEXCEPTION_POINTERS blah, int n_except)
{
return EXCEPTION_CONTINUE_SEARCH;
}
#endif
+#endif
void do_start_program (void)
{
if (MAX_ILG >= 0)
illegal_count++;
if (ins) {
- write_log (_T("WARNING: Illegal opcode %cget at %08lx PC=%x\n"),
+ write_log (_T("WARNING: Illegal opcode %cget at %08x PC=%x\n"),
size == 2 ? 'w' : 'l', addr, M68K_GETPC);
} else if (rw) {
- write_log (_T("Illegal %cput at %08lx=%08lx PC=%x\n"),
+ write_log (_T("Illegal %cput at %08x=%08x PC=%x\n"),
size == 1 ? 'b' : size == 2 ? 'w' : 'l', addr, val, M68K_GETPC);
} else {
- write_log (_T("Illegal %cget at %08lx PC=%x\n"),
+ write_log (_T("Illegal %cget at %08x PC=%x\n"),
size == 1 ? 'b' : size == 2 ? 'w' : 'l', addr, M68K_GETPC);
}
}
static uae_u32 chipmem_dummy (void)
{
/* not really right but something random that has more ones than zeros.. */
- return 0xffff & ~((1 << (rand () & 31)) | (1 << (rand () & 31)));
+ return 0xffff & ~((1 << (uaerand () & 31)) | (1 << (uaerand () & 31)));
}
void REGPARAM2 chipmem_dummy_bput (uaecptr addr, uae_u32 b)
{
} else
a1000_handle_kickstart (0);
} else if (currprefs.illegal_mem)
- write_log (_T("Illegal kickmem lput at %08lx\n"), addr);
+ write_log (_T("Illegal kickmem lput at %08x\n"), addr);
}
static void REGPARAM2 kickmem_wput (uaecptr addr, uae_u32 b)
} else
a1000_handle_kickstart (0);
} else if (currprefs.illegal_mem)
- write_log (_T("Illegal kickmem wput at %08lx\n"), addr);
+ write_log (_T("Illegal kickmem wput at %08x\n"), addr);
}
static void REGPARAM2 kickmem_bput (uaecptr addr, uae_u32 b)
} else
a1000_handle_kickstart (0);
} else if (currprefs.illegal_mem)
- write_log (_T("Illegal kickmem bput at %08lx\n"), addr);
+ write_log (_T("Illegal kickmem bput at %08x\n"), addr);
}
static void REGPARAM2 kickmem2_lput (uaecptr addr, uae_u32 l)
special_mem |= S_WRITE;
#endif
if (currprefs.illegal_mem)
- write_log (_T("Illegal extendedkickmem lput at %08lx\n"), addr);
+ write_log (_T("Illegal extendedkickmem lput at %08x\n"), addr);
}
static void REGPARAM2 extendedkickmem_wput (uaecptr addr, uae_u32 b)
{
special_mem |= S_WRITE;
#endif
if (currprefs.illegal_mem)
- write_log (_T("Illegal extendedkickmem wput at %08lx\n"), addr);
+ write_log (_T("Illegal extendedkickmem wput at %08x\n"), addr);
}
static void REGPARAM2 extendedkickmem_bput (uaecptr addr, uae_u32 b)
{
special_mem |= S_WRITE;
#endif
if (currprefs.illegal_mem)
- write_log (_T("Illegal extendedkickmem lput at %08lx\n"), addr);
+ write_log (_T("Illegal extendedkickmem lput at %08x\n"), addr);
}
static int REGPARAM2 extendedkickmem_check (uaecptr addr, uae_u32 size)
{
special_mem |= S_WRITE;
#endif
if (currprefs.illegal_mem)
- write_log (_T("Illegal extendedkickmem2 lput at %08lx\n"), addr);
+ write_log (_T("Illegal extendedkickmem2 lput at %08x\n"), addr);
}
static void REGPARAM2 extendedkickmem2_wput (uaecptr addr, uae_u32 b)
{
special_mem |= S_WRITE;
#endif
if (currprefs.illegal_mem)
- write_log (_T("Illegal extendedkickmem2 wput at %08lx\n"), addr);
+ write_log (_T("Illegal extendedkickmem2 wput at %08x\n"), addr);
}
static void REGPARAM2 extendedkickmem2_bput (uaecptr addr, uae_u32 b)
{
special_mem |= S_WRITE;
#endif
if (currprefs.illegal_mem)
- write_log (_T("Illegal extendedkickmem2 lput at %08lx\n"), addr);
+ write_log (_T("Illegal extendedkickmem2 lput at %08x\n"), addr);
}
static int REGPARAM2 extendedkickmem2_check (uaecptr addr, uae_u32 size)
{
#ifndef NATMEM_OFFSET
-uae_u8 *mapped_malloc (size_t s, TCHAR *file)
+uae_u8 *mapped_malloc (size_t s, const TCHAR *file)
{
return xmalloc (uae_u8, s);
}
}
need_hardreset = 1;
}
+#ifdef CDTV
if (allocated_cardmem != currprefs.cs_cdtvcard * 1024) {
if (cardmemory)
mapped_free (cardmemory);
}
cdtv_loadcardmem(cardmemory, allocated_cardmem);
}
+#endif
if (allocated_custmem1 != currprefs.custom_memory_sizes[0]) {
if (custmem1)
mapped_free (custmem1);
map_banks (&clock_bank, 0xDC, 1, 0); /* none clock */
if (currprefs.cs_fatgaryrev >= 0 || currprefs.cs_ramseyrev >= 0)
map_banks (&mbres_bank, 0xDE, 1, 0);
+#ifdef CD32
if (currprefs.cs_cd32c2p || currprefs.cs_cd32cd || currprefs.cs_cd32nvram) {
map_banks (&akiko_bank, AKIKO_BASE >> 16, 1, 0);
map_banks (&gayle2_bank, 0xDD, 2, 0);
}
+#endif
+#ifdef CDTV
if (currprefs.cs_cdtvcd)
cdtv_check_banks ();
+#endif
+#ifdef A2091
if (currprefs.cs_mbdmac == 1)
a3000scsi_reset ();
+#endif
if (a3000lmemory != 0)
map_banks (&a3000lmem_bank, a3000lmem_start >> 16, allocated_a3000lmem >> 16, 0);
if (a3000hmemory != 0)
map_banks (&a3000hmem_bank, a3000hmem_start >> 16, allocated_a3000hmem >> 16, 0);
+#ifdef CDTV
if (cardmemory != 0)
map_banks (&cardmem_bank, cardmem_start >> 16, allocated_cardmem >> 16, 0);
+#endif
map_banks (&kickmem_bank, 0xF8, 8, 0);
if (currprefs.maprom)
xfree (a1000_bootrom);
if (chipmemory)
mapped_free (chipmemory);
+#ifdef CDTV
if (cardmemory) {
cdtv_savecardmem (cardmemory, allocated_cardmem);
mapped_free (cardmemory);
}
+#endif
if (custmem1)
mapped_free (custmem1);
if (custmem2)
ncr_bput2 (addr, b);
}
-static addrbank ncr_bank = {
+addrbank ncr_bank = {
ncr_lget, ncr_wget, ncr_bget,
ncr_lput, ncr_wput, ncr_bput,
default_xlate, default_check, NULL, _T("A4091"),
//#define X86_MSVC_ASSEMBLY_MEMACCESS
#define OPTIMIZED_FLAGS
#define __i386__
+#define WINDOWS
#ifndef UAE_MINI
#endif
+#define A_ZIP
+#define A_RAR
+#define A_7Z
+#define A_LHA
+#define A_LZX
+#define A_DMS
+#define A_WRP
+
+#ifndef PATH_MAX
+#define PATH_MAX 256
+#endif
+
+#define UAE_RAND_MAX RAND_MAX
+
#ifndef GFXFILTER
#undef OPENGL
#undef D3D
#define SIZEOF_DOUBLE 8
#define HAVE_ISNAN
-#define HAVE_ISINF
+#undef HAVE_ISINF
#define isnan _isnan
/* Define if you have the bcopy function. */
return 0;
}
-static void filesys_addexternals (void)
+void filesys_addexternals (void)
{
int drive, drivetype;
UINT errormode;
restore_disk_finish ();
restore_blitter_finish ();
restore_akiko_finish ();
+#ifdef CDTV
restore_cdtv_finish ();
+#endif
+#ifdef PICASSO96
restore_p96_finish ();
+#endif
+#ifdef A2065
restore_a2065_finish ();
+#endif
restore_cia_finish ();
restore_debug_memwatch_finish ();
savestate_state = 0;
int i = 0;
if (log_scsi)
- write_log (_T("async request %p removed\n"), request);
+ write_log (_T("async request %08x removed\n"), request);
while (i < MAX_ASYNC_REQUESTS) {
if (dev->d_request[i] == request) {
int type = dev->d_request_type[i];
uae_u32 sdd = get_long (request + 40);
io_error = sys_command_scsi_direct (dev->unitnum, sdd);
if (log_scsi)
- write_log (_T("scsidev: did io: sdd %p request %p error %d\n"), sdd, request, get_byte (request + 31));
+ write_log (_T("scsidev: did io: sdd %08x request %08x error %d\n"), sdd, request, get_byte (request + 31));
}
break;
case NSCMD_DEVICEQUERY:
if (dev->opencnt > 0) {
for (j = 0; j < MAX_ASYNC_REQUESTS; j++) {
uaecptr request;
- if (request = dev->d_request[i])
+ if ((request = dev->d_request[i]))
abort_async (dev, request, 0, 0);
}
dev->opencnt = 1;
void serial_flush_buffer (void);
static int serial_read (char *buffer);
-int serial_readstatus (void);
-uae_u16 serial_writestatus (int, int);
-
uae_u16 SERDATR (void);
int SERDATS (void);
static int inptr, inlast, outlast;
int waitqueue=0,
- carrier=0,
- serdev=0,
- dsr=0,
- dtr=0,
- isbaeh=0,
- doreadser=0,
- serstat=-1;
+ carrier=0,
+ serdev=0,
+ dsr=0,
+ dtr=0,
+ isbaeh=0,
+ doreadser=0,
+ serstat=-1;
int sd = -1;
#ifdef POSIX_SERIAL
- struct termios tios;
+ struct termios tios;
#endif
uae_u16 serper=0,serdat;
void SERPER (uae_u16 w)
{
- int baud=0, pspeed;
+ int baud=0, pspeed;
- if (!currprefs.use_serial)
- return;
+ if (!currprefs.use_serial)
+ return;
#if defined POSIX_SERIAL
- if (serper == w) /* don't set baudrate if it's already ok */
- return;
- serper=w;
+ if (serper == w) /* don't set baudrate if it's already ok */
+ return;
+ serper=w;
- if (w&0x8000)
+ if (w&0x8000)
write_log ("SERPER: 9bit transmission not implemented.\n");
- switch (w & 0x7fff) {
- /* These values should be calculated by the current
- * color clock value (NTSC/PAL). But this solution is
- * easy and it works.
- */
-
- case 0x2e9b:
- case 0x2e14: baud=300; pspeed=B300; break;
- case 0x170a:
- case 0x0b85: baud=1200; pspeed=B1200; break;
- case 0x05c2:
- case 0x05b9: baud=2400; pspeed=B2400; break;
- case 0x02e9:
- case 0x02e1: baud=4800; pspeed=B4800; break;
- case 0x0174:
- case 0x0170: baud=9600; pspeed=B9600; break;
- case 0x00b9:
- case 0x00b8: baud=19200; pspeed=B19200; break;
- case 0x005c:
- case 0x005d: baud=38400; pspeed=B38400; break;
- case 0x003d: baud=57600; pspeed=B57600; break;
- case 0x001e: baud=115200; pspeed=B115200; break;
- case 0x000f: baud=230400; pspeed=B230400; break;
- default:
- write_log ("SERPER: unsupported baudrate (0x%04x) %d\n",w&0x7fff,
- (unsigned int)(3579546.471/(double)((w&0x7fff)+1))); return;
- }
-
- /* Only access hardware when we own it */
- if (serdev == 1) {
- if (tcgetattr (sd, &tios) < 0) {
- write_log ("SERPER: TCGETATTR failed\n");
- return;
+ switch (w & 0x7fff) {
+ /* These values should be calculated by the current
+ * color clock value (NTSC/PAL). But this solution is
+ * easy and it works.
+ */
+
+ case 0x2e9b:
+ case 0x2e14: baud=300; pspeed=B300; break;
+ case 0x170a:
+ case 0x0b85: baud=1200; pspeed=B1200; break;
+ case 0x05c2:
+ case 0x05b9: baud=2400; pspeed=B2400; break;
+ case 0x02e9:
+ case 0x02e1: baud=4800; pspeed=B4800; break;
+ case 0x0174:
+ case 0x0170: baud=9600; pspeed=B9600; break;
+ case 0x00b9:
+ case 0x00b8: baud=19200; pspeed=B19200; break;
+ case 0x005c:
+ case 0x005d: baud=38400; pspeed=B38400; break;
+ case 0x003d: baud=57600; pspeed=B57600; break;
+ case 0x001e: baud=115200; pspeed=B115200; break;
+ case 0x000f: baud=230400; pspeed=B230400; break;
+ default:
+ write_log ("SERPER: unsupported baudrate (0x%04x) %d\n",w&0x7fff,
+ (unsigned int)(3579546.471/(double)((w&0x7fff)+1))); return;
}
- if (cfsetispeed (&tios, pspeed) < 0) { /* set serial input speed */
- write_log ("SERPER: CFSETISPEED (%d bps) failed\n", baud);
- return;
+ /* Only access hardware when we own it */
+ if (serdev == 1) {
+ if (tcgetattr (sd, &tios) < 0) {
+ write_log ("SERPER: TCGETATTR failed\n");
+ return;
+ }
+
+ if (cfsetispeed (&tios, pspeed) < 0) { /* set serial input speed */
+ write_log ("SERPER: CFSETISPEED (%d bps) failed\n", baud);
+ return;
+ }
+ if (cfsetospeed (&tios, pspeed) < 0) { /* set serial output speed */
+ write_log ("SERPER: CFSETOSPEED (%d bps) failed\n", baud);
+ return;
+ }
+
+ if (tcsetattr (sd, TCSADRAIN, &tios) < 0) {
+ write_log ("SERPER: TCSETATTR failed\n");
+ return;
+ }
}
- if (cfsetospeed (&tios, pspeed) < 0) { /* set serial output speed */
- write_log ("SERPER: CFSETOSPEED (%d bps) failed\n", baud);
- return;
- }
-
- if (tcsetattr (sd, TCSADRAIN, &tios) < 0) {
- write_log ("SERPER: TCSETATTR failed\n");
- return;
- }
- }
#endif
#if SERIALDEBUG > 0
- if (serdev == 1)
- write_log ("SERPER: baudrate set to %d bit/sec\n", baud);
+ if (serdev == 1)
+ write_log ("SERPER: baudrate set to %d bit/sec\n", baud);
#endif
}
/* Not (fully) implemented yet:
*
* - Something's wrong with the Interrupts.
- * (NComm works, TERM does not. TERM switches to a
- * blind mode after a connect and wait's for the end
- * of an asynchronous read before switching blind
- * mode off again. It never gets there on UAE :-< )
+ * (NComm works, TERM does not. TERM switches to a
+ * blind mode after a connect and wait's for the end
+ * of an asynchronous read before switching blind
+ * mode off again. It never gets there on UAE :-< )
*
* - RTS/CTS handshake, this is not really neccessary,
- * because you can use RTS/CTS "outside" without
- * passing it through to the emulated Amiga
+ * because you can use RTS/CTS "outside" without
+ * passing it through to the emulated Amiga
*
* - ADCON-Register ($9e write, $10 read) Bit 11 (UARTBRK)
- * (see "Amiga Intern", pg 246)
+ * (see "Amiga Intern", pg 246)
*/
void SERDAT (uae_u16 w)
{
- unsigned char z;
-
- if (!currprefs.use_serial)
- return;
-
- z = (unsigned char)(w&0xff);
-
- if (currprefs.serial_demand && !dtr) {
- if (!isbaeh) {
- write_log ("SERDAT: Baeh.. Your software needs SERIAL_ALWAYS to work properly.\n");
- isbaeh=1;
+ unsigned char z;
+
+ if (!currprefs.use_serial)
+ return;
+
+ z = (unsigned char)(w&0xff);
+
+ if (currprefs.serial_demand && !dtr) {
+ if (!isbaeh) {
+ write_log ("SERDAT: Baeh.. Your software needs SERIAL_ALWAYS to work properly.\n");
+ isbaeh=1;
+ }
+ return;
+ } else {
+ outbuf[outlast++] = z;
+ if (outlast == sizeof outbuf)
+ serial_flush_buffer();
}
- return;
- } else {
- outbuf[outlast++] = z;
- if (outlast == sizeof outbuf)
- serial_flush_buffer();
- }
#if SERIALDEBUG > 2
- write_log ("SERDAT: wrote 0x%04x\n", w);
+ write_log ("SERDAT: wrote 0x%04x\n", w);
#endif
- serdat|=0x2000; /* Set TBE in the SERDATR ... */
- intreq|=1; /* ... and in INTREQ register */
- return;
+ serdat|=0x2000; /* Set TBE in the SERDATR ... */
+ intreq|=1; /* ... and in INTREQ register */
+ return;
}
uae_u16 SERDATR (void)
{
- if (!currprefs.use_serial)
- return 0;
+ if (!currprefs.use_serial)
+ return 0;
#if SERIALDEBUG > 2
- write_log ("SERDATR: read 0x%04x\n", serdat);
+ write_log ("SERDATR: read 0x%04x\n", serdat);
#endif
- waitqueue = 0;
- return serdat;
+ waitqueue = 0;
+ return serdat;
}
int SERDATS (void)
{
- unsigned char z;
+ unsigned char z;
- if (!serdev) /* || (serdat&0x4000)) */
- return 0;
+ if (!serdev) /* || (serdat&0x4000)) */
+ return 0;
- if (waitqueue == 1) {
- intreq |= 0x0800;
- return 1;
- }
+ if (waitqueue == 1) {
+ intreq |= 0x0800;
+ return 1;
+ }
- if ((serial_read ((char *)&z)) == 1) {
- waitqueue = 1;
- serdat = 0x4100; /* RBF and STP set! */
- serdat |= ((unsigned int)z) & 0xff;
- intreq |= 0x0800; /* Set RBF flag (Receive Buffer full) */
+ if ((serial_read ((char *)&z)) == 1) {
+ waitqueue = 1;
+ serdat = 0x4100; /* RBF and STP set! */
+ serdat |= ((unsigned int)z) & 0xff;
+ intreq |= 0x0800; /* Set RBF flag (Receive Buffer full) */
#if SERIALDEBUG > 1
- write_log ("SERDATS: received 0x%02x --> serdat==0x%04x\n",
- (unsigned int)z, (unsigned int)serdat);
+ write_log ("SERDATS: received 0x%02x --> serdat==0x%04x\n",
+ (unsigned int)z, (unsigned int)serdat);
#endif
- return 1;
- }
- return 0;
+ return 1;
+ }
+ return 0;
}
void serial_dtr_on(void)
{
#if SERIALDEBUG > 0
- write_log ("DTR on.\n");
+ write_log ("DTR on.\n");
#endif
- dtr=1;
+ dtr=1;
- if (currprefs.serial_demand)
- serial_open ();
+ if (currprefs.serial_demand)
+ serial_open ();
}
void serial_dtr_off(void)
{
#if SERIALDEBUG > 0
- write_log ("DTR off.\n");
+ write_log ("DTR off.\n");
#endif
- dtr=0;
- if (currprefs.serial_demand)
- serial_close ();
+ dtr=0;
+ if (currprefs.serial_demand)
+ serial_close ();
}
static int serial_read (char *buffer)
{
- if (inptr < inlast) {
- *buffer = inbuf[inptr++];
- return 1;
- }
-
- if (serdev == 1) {
- inlast = read (sd, inbuf, sizeof inbuf);
- inptr = 0;
if (inptr < inlast) {
- *buffer = inbuf[inptr++];
- return 1;
+ *buffer = inbuf[inptr++];
+ return 1;
+ }
+
+ if (serdev == 1) {
+ inlast = read (sd, inbuf, sizeof inbuf);
+ inptr = 0;
+ if (inptr < inlast) {
+ *buffer = inbuf[inptr++];
+ return 1;
+ }
}
- }
- return 0;
+ return 0;
}
void serial_flush_buffer(void)
{
- if (serdev == 1) {
- if (outlast) {
- if (sd != 0) {
- write (sd, outbuf, outlast);
- }
+ if (serdev == 1) {
+ if (outlast) {
+ if (sd != 0) {
+ write (sd, outbuf, outlast);
+ }
+ }
+ outlast = 0;
+ } else {
+ outlast = 0;
+ inptr = 0;
+ inlast = 0;
}
- outlast = 0;
- } else {
- outlast = 0;
- inptr = 0;
- inlast = 0;
- }
}
-int serial_readstatus(void)
+uae_u8 serial_readstatus(void)
{
- int status = 0;
+ int status = 0;
#ifdef POSIX_SERIAL
- ioctl (sd, TIOCMGET, &status);
+ ioctl (sd, TIOCMGET, &status);
- if (status & TIOCM_CAR) {
- if (!carrier) {
- ciabpra |= 0x20; /* Push up Carrier Detect line */
- carrier = 1;
+ if (status & TIOCM_CAR) {
+ if (!carrier) {
+ ciabpra |= 0x20; /* Push up Carrier Detect line */
+ carrier = 1;
#if SERIALDEBUG > 0
- write_log ("Carrier detect.\n");
+ write_log ("Carrier detect.\n");
#endif
- }
- } else {
- if (carrier) {
- ciabpra &= ~0x20;
- carrier = 0;
+ }
+ } else {
+ if (carrier) {
+ ciabpra &= ~0x20;
+ carrier = 0;
#if SERIALDEBUG > 0
- write_log ("Carrier lost.\n");
+ write_log ("Carrier lost.\n");
#endif
+ }
}
- }
- if (status & TIOCM_DSR) {
- if (!dsr) {
- ciabpra |= 0x08; /* DSR ON */
- dsr = 1;
- }
- } else {
- if (dsr) {
- ciabpra &= ~0x08;
- dsr = 0;
+ if (status & TIOCM_DSR) {
+ if (!dsr) {
+ ciabpra |= 0x08; /* DSR ON */
+ dsr = 1;
+ }
+ } else {
+ if (dsr) {
+ ciabpra &= ~0x08;
+ dsr = 0;
+ }
}
- }
#endif
- return status;
+ return status;
}
-uae_u16 serial_writestatus (int old, int nw)
+uae_u8 serial_writestatus (int old, int nw)
{
- if ((old & 0x80) == 0x80 && (nw & 0x80) == 0x00)
- serial_dtr_on();
- if ((old & 0x80) == 0x00 && (nw & 0x80) == 0x80)
- serial_dtr_off();
+ if ((old & 0x80) == 0x80 && (nw & 0x80) == 0x00)
+ serial_dtr_on();
+ if ((old & 0x80) == 0x00 && (nw & 0x80) == 0x80)
+ serial_dtr_off();
- if ((old & 0x40) != (nw & 0x40))
- write_log ("RTS %s.\n", ((nw & 0x40) == 0x40) ? "set" : "cleared");
+ if ((old & 0x40) != (nw & 0x40))
+ write_log ("RTS %s.\n", ((nw & 0x40) == 0x40) ? "set" : "cleared");
- if ((old & 0x10) != (nw & 0x10))
- write_log ("CTS %s.\n", ((nw & 0x10) == 0x10) ? "set" : "cleared");
+ if ((old & 0x10) != (nw & 0x10))
+ write_log ("CTS %s.\n", ((nw & 0x10) == 0x10) ? "set" : "cleared");
- return nw; /* This value could also be changed here */
+ return nw; /* This value could also be changed here */
}
void serial_open(void)
{
- if (serdev == 1)
- return;
+ if (serdev == 1)
+ return;
- if ((sd = open (currprefs.sername, O_RDWR|O_NONBLOCK|O_BINARY, 0)) < 0) {
- write_log ("Error: Could not open Device %s\n", currprefs.sername);
- return;
- }
+ if ((sd = open (currprefs.sername, O_RDWR|O_NONBLOCK|O_BINARY, 0)) < 0) {
+ write_log ("Error: Could not open Device %s\n", currprefs.sername);
+ return;
+ }
- serdev = 1;
+ serdev = 1;
#ifdef POSIX_SERIAL
- if (tcgetattr (sd, &tios) < 0) { /* Initialize Serial tty */
- write_log ("Serial: TCGETATTR failed\n");
- return;
- }
- cfmakeraw (&tios);
+ if (tcgetattr (sd, &tios) < 0) { /* Initialize Serial tty */
+ write_log ("Serial: TCGETATTR failed\n");
+ return;
+ }
+ cfmakeraw (&tios);
#ifndef MODEMTEST
- tios.c_cflag &= ~CRTSCTS; /* Disable RTS/CTS */
+ tios.c_cflag &= ~CRTSCTS; /* Disable RTS/CTS */
#else
- tios.c_cflag |= CRTSCTS; /* Enabled for testing modems */
+ tios.c_cflag |= CRTSCTS; /* Enabled for testing modems */
#endif
- if (tcsetattr (sd, TCSADRAIN, &tios) < 0) {
- write_log ("Serial: TCSETATTR failed\n");
- return;
- }
+ if (tcsetattr (sd, TCSADRAIN, &tios) < 0) {
+ write_log ("Serial: TCSETATTR failed\n");
+ return;
+ }
#endif
}
void serial_close (void)
{
- if (sd >= 0)
- close (sd);
- serdev = 0;
+ if (sd >= 0)
+ close (sd);
+ serdev = 0;
}
void serial_init (void)
{
- if (!currprefs.use_serial)
- return;
+ if (!currprefs.use_serial)
+ return;
- if (!currprefs.serial_demand)
- serial_open ();
+ if (!currprefs.serial_demand)
+ serial_open ();
- serdat = 0x2000;
- return;
+ serdat = 0x2000;
+ return;
}
void serial_exit (void)
{
- serial_close (); /* serial_close can always be called because it */
- dtr = 0; /* just closes *opened* filehandles which is ok */
- return; /* when exiting. */
+ serial_close (); /* serial_close can always be called because it */
+ dtr = 0; /* just closes *opened* filehandles which is ok */
+ return; /* when exiting. */
}
#define ARG4 (get_long (m68k_areg (regs, 7) + 20))
#define ARG5 (get_long (m68k_areg (regs, 7) + 24))
+#ifdef PICASSO96
if (ARG0 >= 16 && ARG0 <= 39)
return picasso_demux (ARG0, context);
+#endif
switch (ARG0)
{
z->dataseek = 1;
z->userdata = zvhd;
z->zfileread = vhd_fread;
- write_log (_T("%s is VHD %s image, virtual size=%dK\n"),
+ write_log (_T("%s is VHD %s image, virtual size=%lldK\n"),
zfile_getname (z),
zvhd->vhd_type == 2 ? _T("fixed") : _T("dynamic"),
zvhd->virtsize / 1024);
}
#endif
+#ifdef A_LZX
static struct zfile *dsq (struct zfile *z, int lzx, int *retcode)
{
struct zfile *zi = NULL;
zfile_fclose (zi);
return z;
}
+#endif
+#ifdef A_WRP
static struct zfile *wrp (struct zfile *z, int *retcode)
{
if (zfile_needwrite (z)) {
}
return unwarp (z);
}
+#endif
-#include "7z/xz.h"
-#include "7z/lzmadec.h"
-#include "7z/7zcrc.h"
+#ifdef A_7Z
+#include "7z/Xz.h"
+#include "7z/Lzmadec.h"
+#include "7z/7zCrc.h"
static void *SzAlloc (void *p, size_t size)
{
XzUnpacker_Free (&cx);
return zo;
}
+#endif
+#ifdef A_DMS
static struct zfile *dms (struct zfile *z, int index, int *retcode)
{
int ret;
zfile_fclose (zextra[i]);
return zo;
}
+#endif
const TCHAR *uae_ignoreextensions[] =
{ _T(".gif"), _T(".jpg"), _T(".png"), _T(".xml"), _T(".pdf"), _T(".txt"), 0 };
return zfile_gunzip (z, retcode);
if (strcasecmp (ext, _T("hdz")) == 0)
return zfile_gunzip (z, retcode);
+#ifdef A_WRP
if (strcasecmp (ext, _T("wrp")) == 0)
return wrp (z, retcode);
+#endif
+#ifdef A_7Z
if (strcasecmp (ext, _T("xz")) == 0)
return xz (z, retcode);
+#endif
}
+#ifdef A_DMS
if (strcasecmp (ext, _T("dms")) == 0)
return dms (z, index, retcode);
+#endif
}
if (mask & ZFD_RAWDISK) {
#ifdef CAPS
if (index == 0) {
if (header[0] == 0x1f && header[1] == 0x8b)
return zfile_gunzip (z, retcode);
+#ifdef A_LZX
if (header[0] == 'P' && header[1] == 'K' && header[2] == 'D')
return dsq (z, 0, retcode);
+#endif
+#ifdef A_7Z
if (header[0] == 0xfd && header[1] == 0x37 && header[2] == 0x7a && header[3] == 0x58 && header[4] == 0x5a && header[5] == 0)
return xz (z, retcode);
+#endif
}
+#ifdef A_DMS
if (header[0] == 'D' && header[1] == 'M' && header[2] == 'S' && header[3] == '!')
return dms (z, index, retcode);
+#endif
}
if (mask & ZFD_RAWDISK) {
#ifdef CAPS
if (ext) {
if (mask & ZFD_UNPACK) {
+#ifdef A_LZX
if (strcasecmp (ext, _T("dsq")) == 0)
return dsq (z, 1, retcode);
+#endif
}
if (mask & ZFD_ADF) {
if (strcasecmp (ext, _T("adf")) == 0 && !memcmp (header, "DOS", 3))
struct zfile *l;
l = zfile_create (NULL);
- l->name = name ? my_strdup (name) : _T("");
+ l->name = my_strdup (name ? name : _T(""));
l->data = xmalloc (uae_u8, size);
l->size = size;
l->datasize = size;
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 (const void *b, size_t l1, size_t l2, struct zfile *z)
{
if (z->archiveparent)
return 0;
if (ext != NULL) {
ext++;
if (flags & ZFD_ARCHIVE) {
+#ifdef A_LHA
if (strcasecmp (ext, _T("lha")) == 0 || strcasecmp (ext, _T("lzh")) == 0)
zv = archive_directory_lha (zf);
+#endif
+#ifdef A_ZIP
if (strcasecmp (ext, _T("zip")) == 0)
zv = archive_directory_zip (zf);
+#endif
+#ifdef A_7Z
if (strcasecmp (ext, _T("7z")) == 0)
zv = archive_directory_7z (zf);
+#endif
+#ifdef A_LZX
if (strcasecmp (ext, _T("lzx")) == 0)
zv = archive_directory_lzx (zf);
+#endif
+#ifdef A_RAR
if (strcasecmp (ext, _T("rar")) == 0)
zv = archive_directory_rar (zf);
+#endif
if (strcasecmp (ext, _T("tar")) == 0)
zv = archive_directory_tar (zf);
}
zfile_fread (header, sizeof (header), 1, zf);
zfile_fseek (zf, 0, SEEK_SET);
if (flags & ZFD_ARCHIVE) {
+#ifdef A_ZIP
if (header[0] == 'P' && header[1] == 'K')
zv = archive_directory_zip (zf);
+#endif
+#ifdef A_RAR
if (header[0] == 'R' && header[1] == 'a' && header[2] == 'r' && header[3] == '!')
zv = archive_directory_rar (zf);
+#endif
+#ifdef A_LZX
if (header[0] == 'L' && header[1] == 'Z' && header[2] == 'X')
zv = archive_directory_lzx (zf);
+#endif
+#ifdef A_LHA
if (header[2] == '-' && header[3] == 'l' && header[4] == 'h' && header[6] == '-')
zv = archive_directory_lha (zf);
+#endif
}
if (flags & ZFD_ADF) {
if (header[0] == 'D' && header[1] == 'O' && header[2] == 'S' && (header[3] >= 0 && header[3] <= 7))
if (!_tcscmp (fname, _T(".")) || !_tcscmp (fname, _T("..")))
continue;
_tcscpy (fullname, dirname);
- _tcscat (fullname, _T("\\"));
+ _tcscat (fullname, FSDB_DIR_SEPARATOR_S);
_tcscat (fullname, fname);
if (stat (fullname, &statbuf) == -1)
continue;
return zd->cnt;
if (fullpath) {
_tcscpy (out, zd->parentpath);
- _tcscat (out, _T("\\"));
+ _tcscat (out, FSDB_DIR_SEPARATOR_S);
}
_tcscat (out, zd->filenames[zd->offset]);
zd->offset++;
switch (id)
{
+#ifdef A_ZIP
case ArchiveFormatZIP:
zv = archive_directory_zip (zf);
break;
+#endif
+#ifdef A_7Z
case ArchiveFormat7Zip:
zv = archive_directory_7z (zf);
break;
+#endif
+#ifdef A_RAR
case ArchiveFormatRAR:
zv = archive_directory_rar (zf);
break;
+#endif
+#ifdef A_LHA
case ArchiveFormatLHA:
zv = archive_directory_lha (zf);
break;
+#endif
+#ifdef A_LZX
case ArchiveFormatLZX:
zv = archive_directory_lzx (zf);
break;
+#endif
case ArchiveFormatPLAIN:
zv = archive_directory_plain (zf);
break;
zv = archive_directory_fat (zf);
break;
}
+#ifdef ARCHIVEACCESS
if (!zv)
zv = archive_directory_arcacc (zf, id);
+#endif
return zv;
}
}
/* ZIP */
+#ifdef A_ZIP
static void archive_close_zip (void *handle)
{
{
return archive_do_zip (NULL, zf, 0);
}
+#endif
+#ifdef A_7Z
/* 7Z */
#include "7z/7z.h"
}
return z;
}
+#endif
/* RAR */
-
-
+#ifdef A_RAR
/* copy and paste job? you are only imagining it! */
static struct zfile *rarunpackzf; /* stupid unrar.dll */
pRARCloseArchive(rc->hArcData);
return zf;
}
+#endif
+
/* ArchiveAccess */
for (i = 0; i < len; i++) {
uae_char c = *s++;
if (c >= 0 && c <= 9) {
- tmp[j++] = '\\';
+ tmp[j++] = FSDB_DIR_SEPARATOR;
tmp[j++] = '0' + c;
} else if (c < ' ' || c > 'z') {
tmp[j++] = '.';
{
switch (id)
{
+#ifdef A_ZIP
case ArchiveFormatZIP:
archive_close_zip (handle);
break;
+#endif
+#ifdef A_7Z
case ArchiveFormat7Zip:
archive_close_7z (handle);
break;
+#endif
+#ifdef A_RAR
case ArchiveFormatRAR:
archive_close_rar (handle);
break;
+#endif
+#ifdef A_LHA
case ArchiveFormatLHA:
break;
+#endif
case ArchiveFormatADF:
archive_close_adf (handle);
break;
zf->datasize = zf->size;
switch (zf->archiveid)
{
+#ifdef A_ZIP
case ArchiveFormatZIP:
zout = archive_unpack_zip (zf);
break;
+#endif
}
zfile_fclose (zf->archiveparent);
zf->archiveparent = NULL;
switch (id)
{
+#ifdef A_ZIP
case ArchiveFormatZIP:
zf = archive_access_zip (zn, flags);
break;
+#endif
+#ifdef A_7Z
case ArchiveFormat7Zip:
zf = archive_access_7z (zn);
break;
+#endif
+#ifdef A_RAR
case ArchiveFormatRAR:
zf = archive_access_rar (zn);
break;
+#endif
+#ifdef A_LHA
case ArchiveFormatLHA:
zf = archive_access_lha (zn);
break;
+#endif
+#ifdef A_LZX
case ArchiveFormatLZX:
zf = archive_access_lzx (zn);
break;
+#endif
case ArchiveFormatPLAIN:
zf = archive_access_plain (zn);
break;