cwhsync = 10;
if (handshake) {
/* keyboard handshake */
- catweasel_do_bput(0xd0, 0);
+ catweasel_do_bput (0xd0, 0);
handshake = 0;
}
if (hsync_requested < 0)
if (cwmk3buttonsync <= 0) {
cwmk3buttonsync = 30;
b = 0;
- if (sid_read(0x19, 0) > 0x7f)
+ if (sid_read (0x19, 0) > 0x7f)
b |= 2;
- if (sid_read(0x1a, 0) > 0x7f)
+ if (sid_read (0x1a, 0) > 0x7f)
b |= 1;
if (cwmk3port == 0) {
cwmk3port1 = b;
- catweasel_do_bput(0xd4, 0); // select port2
+ catweasel_do_bput (0xd4, 0); // select port2
cwmk3port = 1;
} else {
cwmk3port2 = b;
- catweasel_do_bget(0xd4); // select port1
+ catweasel_do_bget (0xd4); // select port1
cwmk3port = 0;
}
}
if (!cwc.can_mouse)
return;
/* read MK4 mouse counters */
- catweasel_do_bput(3, 0x81);
+ catweasel_do_bput (3, 0x81);
for (i = 0; i < 2; i++) {
int x, y, dx, dy;
- x = (uae_s8)catweasel_do_bget(0xc4 + i * 8);
- y = (uae_s8)catweasel_do_bget(0xc0 + i * 8);
+ x = (uae_s8)catweasel_do_bget (0xc4 + i * 8);
+ y = (uae_s8)catweasel_do_bget (0xc0 + i * 8);
dx = mouse_px[i] - x;
if (dx > 127)
dx = 255 - dx;
mouse_px[i] = x;
mouse_py[i] = y;
}
- catweasel_do_bput(3, 0x41);
+ catweasel_do_bput (3, 0x41);
}
int catweasel_read_joystick (uae_u8 *dir, uae_u8 *buttons)
{
if (!cwc.can_joy || !cwc.direct_access)
return 0;
- hsync_request();
- *dir = catweasel_do_bget(0xc0);
- *buttons = get_buttons();
+ hsync_request ();
+ *dir = catweasel_do_bget (0xc0);
+ *buttons = get_buttons ();
return 1;
}
|| cfgfile_yesno (option, value, L"gfx_flickerfixer", &p->gfx_scandoubler)
|| cfgfile_yesno (option, value, L"synchronize_clock", &p->tod_hack)
|| cfgfile_yesno (option, value, L"magic_mouse", &p->input_magic_mouse)
+ || cfgfile_yesno (option, value, L"warp", &p->turbo_emulation)
+ || cfgfile_yesno (option, value, L"headless", &p->headless)
|| cfgfile_yesno (option, value, L"bsdsocket_emu", &p->socket_emu))
return 1;
p->scsi = 0;
p->uaeserial = 0;
p->cpu_idle = 0;
+ p->turbo_emulation = 0;
+ p->headless = 0;
p->catweasel = 0;
p->tod_hack = 0;
p->maprom = 0;
p->scsi = 0;
p->uaeserial = 0;
p->cpu_idle = 0;
+ p->turbo_emulation = 0;
p->catweasel = 0;
p->tod_hack = 0;
p->maprom = 0;
}
int vsynctime_orig;
-int turbo_emulation;
void compute_vsynctime (void)
{
}
if (!fake_vblank_hz)
fake_vblank_hz = vblank_hz;
- if (turbo_emulation)
+ if (currprefs.turbo_emulation)
vsynctime = vsynctime_orig = 1;
else
vsynctime = vsynctime_orig = syncbase / fake_vblank_hz;
double mult = (double)fake_vblank_hz * 10.0 / fps;
idle *= mult;
}
- if (turbo_emulation && idle < 100 * 10)
+ if (currprefs.turbo_emulation && idle < 100 * 10)
idle = 100 * 10;
gui_fps (fps, (int)idle);
frametime2 = 0;
/* Allow this to be one frame's worth of cycles out */
while (diff32 (curr_time, vsyncmintime + vsynctime) > 0) {
vsyncmintime += vsynctime * N_LINES / maxvpos;
- if (turbo_emulation)
+ if (currprefs.turbo_emulation)
break;
}
}
extern int picasso_requested_on;
extern int picasso_on;
-extern int turbo_emulation;
/* Set to 1 to leave out the current frame in average frame time calculation.
* Useful if the debugger was active. */
#define IDEV_MAPPED_AUTOFIRE_POSSIBLE 1
#define IDEV_MAPPED_AUTOFIRE_SET 2
+#define IDEV_MAPPED_TOGGLE 4
#define ID_BUTTON_OFFSET 0
#define ID_BUTTON_TOTAL 32
#define ID_AXIS_TOTAL 32
extern int inputdevice_iterate (int devnum, int num, TCHAR *name, int *af);
-extern int inputdevice_set_mapping (int devnum, int num, TCHAR *name, TCHAR *custom, int af, int sub);
+extern int inputdevice_set_mapping (int devnum, int num, TCHAR *name, TCHAR *custom, int flags, int sub);
extern int inputdevice_get_mapped_name (int devnum, int num, int *pflags, TCHAR *name, TCHAR *custom, int sub);
extern void inputdevice_copyconfig (const struct uae_prefs *src, struct uae_prefs *dst);
extern void inputdevice_copy_single_config (struct uae_prefs *p, int src, int dst, int devnum);
int floppy_write_length;
int tod_hack;
uae_u32 maprom;
+ int turbo_emulation;
+ int headless;
int cs_compatible;
int cs_ciaatod;
extern struct zvolume *archive_directory_fat (struct zfile *z);
extern struct zfile *archive_access_fat (struct znode *zn);
-extern struct zfile *archive_access_select (struct znode *parent, struct zfile *zf, unsigned int id, int doselect);
-extern struct zfile *archive_access_arcacc_select (struct zfile *zf, unsigned int id);
+extern struct zfile *archive_access_select (struct znode *parent, struct zfile *zf, unsigned int id, int doselect, int *retcode);
+extern struct zfile *archive_access_arcacc_select (struct zfile *zf, unsigned int id, int *retcode);
extern int isfat (uae_u8*);
extern void archive_access_scan (struct zfile *zf, zfile_callback zc, void *user, unsigned int id);
extern int zfile_isdiskimage (const TCHAR *name);
extern int iszip (struct zfile *z);
extern int zfile_convertimage (const TCHAR *src, const TCHAR *dst);
-extern struct zfile *zuncompress (struct znode*, struct zfile *z, int dodefault, int imgonly);
+extern struct zfile *zuncompress (struct znode*, struct zfile *z, int dodefault, int mask, int *retcode);
extern void zfile_seterror (const TCHAR *format, ...);
extern TCHAR *zfile_geterror (void);
/* event flags */
#define ID_FLAG_AUTOFIRE 1
+#define ID_FLAG_TOGGLE 2
+#define ID_FLAG_SAVE_MASK 0xff
+#define ID_FLAG_TOGGLED 0x100
#define DEFEVENT(A, B, C, D, E, F) {L#A, B, C, D, E, F },
struct inputevent events[] = {
return 0;
}
input_recording = record;
- srand(t);
+ srand (t);
CIA_inprec_prepare ();
write_log (L"inprec initialized '%s', mode=%d\n", fname, input_recording);
return 1;
*p++ = ',';
*p = 0;
}
- if (custom)
- _stprintf (p, L"'%s'.%d", custom, id->flags[i + offset][j] & 0xff);
+ if (custom && _tcslen (custom) > 0)
+ _stprintf (p, L"'%s'.%d", custom, id->flags[i + offset][j] & ID_FLAG_SAVE_MASK);
else if (evt <= 0)
_stprintf (p, L"NULL");
else
static void kbrlabel (TCHAR *s)
{
while (*s) {
- *s = toupper(*s);
- if (*s == ' ') *s = '_';
+ *s = _totupper (*s);
+ if (*s == ' ')
+ *s = '_';
s++;
}
}
*p++ = ',';
*p = 0;
}
- if (custom)
+ if (custom && _tcslen (custom) > 0)
_stprintf (p, L"'%s'.%d", custom, kbr->flags[i][j] & 0xff);
else if (evt > 0)
_stprintf (p, L"%s.%d", events[evt].confname, kbr->flags[i][j]);
const TCHAR *p = *pp;
int v = _tstol (p);
- while (*p != 0 && *p !='.' && *p != ',') p++;
- if (*p == '.' || *p == ',') p++;
+ while (*p != 0 && *p !='.' && *p != ',')
+ p++;
+ if (*p == '.' || *p == ',')
+ p++;
*pp = p;
return v;
}
return mousehack_alive_cnt > 0 ? mousehack_alive_cnt : 0;
}
-static uaecptr get_base (const TCHAR *name)
+static uaecptr get_base (const uae_char *name)
{
uaecptr v = get_long (4);
addrbank *b = &get_mem_bank(v);
- if (!b || !b->check(v, 400) || b->flags != ABFLAG_RAM)
+ if (!b || !b->check (v, 400) || b->flags != ABFLAG_RAM)
return 0;
v += 378; // liblist
while (v = get_long (v)) {
uae_u32 v2;
uae_u8 *p;
- b = &get_mem_bank(v);
+ b = &get_mem_bank (v);
if (!b || !b->check (v, 32) || b->flags != ABFLAG_RAM)
return 0xffffffff;
v2 = get_long (v + 10); // name
- b = &get_mem_bank(v2);
+ b = &get_mem_bank (v2);
if (!b || !b->check (v2, 20))
return 0xffffffff;
if (b->flags != ABFLAG_ROM && b->flags != ABFLAG_RAM)
return 0;
- p = b->xlateaddr(v2);
- if (!memcmp (p, name, _tcslen (name) + 1))
+ p = b->xlateaddr (v2);
+ if (!memcmp (p, name, strlen (name) + 1))
return v;
}
return 0;
return 0;
if (magicmouse_ibase)
return magicmouse_ibase;
- magicmouse_ibase = get_base (L"intuition.library");
+ magicmouse_ibase = get_base ("intuition.library");
return magicmouse_ibase;
}
static uaecptr get_gfxbase (void)
return 0;
if (magicmouse_gfxbase)
return magicmouse_gfxbase;
- magicmouse_gfxbase = get_base (L"graphics.library");
+ magicmouse_gfxbase = get_base ("graphics.library");
return magicmouse_gfxbase;
}
static void setbuttonstateall (struct uae_input_device *id, struct uae_input_device2 *id2, int button, int state)
{
- int evt, autofire, i;
+ int i;
uae_u32 mask = 1 << button;
uae_u32 omask = id2->buttonmask & mask;
uae_u32 nmask = (state ? 1 : 0) << button;
return;
for (i = 0; i < MAX_INPUT_SUB_EVENT; i++) {
- evt = id->eventid[ID_BUTTON_OFFSET + button][sublevdir[state <= 0 ? 1 : 0][i]];
- autofire = (id->flags[ID_BUTTON_OFFSET + button][sublevdir[state <= 0 ? 1 : 0][i]] & ID_FLAG_AUTOFIRE) ? 1 : 0;
+ int evt = evt = id->eventid[ID_BUTTON_OFFSET + button][sublevdir[state <= 0 ? 1 : 0][i]];
+ int autofire = (id->flags[ID_BUTTON_OFFSET + button][sublevdir[state <= 0 ? 1 : 0][i]] & ID_FLAG_AUTOFIRE) ? 1 : 0;
+ int toggle = (id->flags[ID_BUTTON_OFFSET + button][sublevdir[state <= 0 ? 1 : 0][i]] & ID_FLAG_TOGGLE) ? 1 : 0;
+
if (state < 0) {
handle_input_event (evt, 1, 1, 0);
queue_input_event (evt, 0, 1, 1, 0); /* send release event next frame */
if (i == 0)
process_custom_event (id, ID_BUTTON_OFFSET + button, state);
+ } else if (toggle) {
+ int toggled;
+ if (!state)
+ continue;
+ if (omask & mask)
+ continue;
+ id->flags[ID_BUTTON_OFFSET + button][sublevdir[state <= 0 ? 1 : 0][i]] ^= ID_FLAG_TOGGLED;
+ toggled = (id->flags[ID_BUTTON_OFFSET + button][sublevdir[state <= 0 ? 1 : 0][i]] & ID_FLAG_TOGGLED) ? 1 : 0;
+ handle_input_event (evt, toggled, 1, autofire);
+ if (i == 0)
+ process_custom_event (id, ID_BUTTON_OFFSET + button, toggled);
} else {
if ((omask ^ nmask) & mask) {
handle_input_event (evt, state, 1, autofire);
if (na->extra[j][0] == scancode) {
for (k = 0; k < MAX_INPUT_SUB_EVENT; k++) {/* send key release events in reverse order */
int autofire = (na->flags[j][sublevdir[state == 0 ? 1 : 0][k]] & ID_FLAG_AUTOFIRE) ? 1 : 0;
+ int toggle = (na->flags[j][sublevdir[state == 0 ? 1 : 0][k]] & ID_FLAG_TOGGLE) ? 1 : 0;
int evt = na->eventid[j][sublevdir[state == 0 ? 1 : 0][k]];
- handled |= handle_input_event (evt, state, 1, autofire);
+ int toggled;
+
+ if (toggle) {
+ if (!state)
+ continue;
+ na->flags[j][sublevdir[state == 0 ? 1 : 0][k]] ^= ID_FLAG_TOGGLED;
+ toggled = (na->flags[j][sublevdir[state == 0 ? 1 : 0][k]] & ID_FLAG_TOGGLED) ? 1 : 0;
+ handled |= handle_input_event (evt, toggled, 1, autofire);
+ } else {
+ handled |= handle_input_event (evt, state, 1, autofire);
+ }
}
process_custom_event (na, j, state);
return handled;
uid->eventid[i][sub] = eventid;
uid->flags[i][sub] = flags;
xfree (uid->custom[i][sub]);
- uid->custom[i][sub] = custom ? my_strdup (custom) : NULL;
+ uid->custom[i][sub] = custom && _tcslen (custom) > 0 ? my_strdup (custom) : NULL;
return i;
} else if (type == IDEV_WIDGET_AXIS) {
i = num - id->get_widget_first (devnum, type) + ID_AXIS_OFFSET;
uid->eventid[i][sub] = eventid;
uid->flags[i][sub] = flags;
xfree (uid->custom[i][sub]);
- uid->custom[i][sub] = custom ? my_strdup (custom) : NULL;
+ uid->custom[i][sub] = custom && _tcslen (custom) > 0 ? my_strdup (custom) : NULL;
return i;
} else if (type == IDEV_WIDGET_KEY) {
i = num - id->get_widget_first (devnum, type);
uid->eventid[i][sub] = eventid;
uid->flags[i][sub] = flags;
xfree (uid->custom[i][sub]);
- uid->custom[i][sub] = custom ? my_strdup (custom) : NULL;
+ uid->custom[i][sub] = custom && _tcslen (custom) > 0 ? my_strdup (custom) : NULL;
return i;
}
return -1;
_tcscpy (custom, customp);
if (flag & ID_FLAG_AUTOFIRE)
flags |= IDEV_MAPPED_AUTOFIRE_SET;
+ if (flag & ID_FLAG_TOGGLE)
+ flags |= IDEV_MAPPED_TOGGLE;
if (!data)
return 0;
if (events[data].allow_mask & AM_AF)
return data;
}
-int inputdevice_set_mapping (int devnum, int num, TCHAR *name, TCHAR *custom, int af, int sub)
+int inputdevice_set_mapping (int devnum, int num, TCHAR *name, TCHAR *custom, int flags, int sub)
{
const struct inputdevice_functions *idf = getidf (devnum);
const struct uae_input_device *uid = get_uid (idf, inputdevice_get_device_index (devnum));
return 0;
if (data >= 0) {
amask = events[eid].allow_mask;
- flag &= ~ID_FLAG_AUTOFIRE;
- if (amask & AM_AF)
- flag |= af ? ID_FLAG_AUTOFIRE : 0;
+ flag &= ~(ID_FLAG_AUTOFIRE | ID_FLAG_TOGGLE);
+ if (amask & AM_AF) {
+ flag |= (flags & IDEV_MAPPED_AUTOFIRE_SET) ? ID_FLAG_AUTOFIRE : 0;
+ flag |= (flags & IDEV_MAPPED_TOGGLE) ? ID_FLAG_TOGGLE : 0;
+ }
put_event_data (idf, devindex, num, eid, custom, flag, sub);
return 1;
}
void setjoybuttonstate (int joy, int button, int state)
{
- if (ignoreoldinput(joy)) {
+ if (ignoreoldinput (joy)) {
if (state)
switchdevice (&joysticks[joy], button, 1);
return;
{
int i;
- if (ignoreoldinput(joy))
+ if (ignoreoldinput (joy))
return;
for (i = 0; i < ID_BUTTON_TOTAL; i++) {
if (buttonmask & (1 << i))
fr = currprefs.gfx_framerate;
if (fr == 0)
fr = -1;
- fr2 = turbo_emulation;
+ fr2 = currprefs.turbo_emulation;
if (fr2 == -1)
fr2 = 0;
if (mode < 0) {
- if (turbo_emulation) {
+ if (currprefs.turbo_emulation) {
changed_prefs.gfx_framerate = currprefs.gfx_framerate = fr2;
- turbo_emulation = 0;
+ currprefs.turbo_emulation = 0;
} else {
- turbo_emulation = fr;
+ currprefs.turbo_emulation = fr;
}
- } else if (mode == 0 && turbo_emulation) {
- if (turbo_emulation > 0)
+ } else if (mode == 0 && currprefs.turbo_emulation) {
+ if (currprefs.turbo_emulation > 0)
changed_prefs.gfx_framerate = currprefs.gfx_framerate = fr2;
- turbo_emulation = 0;
- } else if (mode > 0 && !turbo_emulation) {
- turbo_emulation = fr;
+ currprefs.turbo_emulation = 0;
+ } else if (mode > 0 && !currprefs.turbo_emulation) {
+ currprefs.turbo_emulation = fr;
}
- if (turbo_emulation) {
+ if (currprefs.turbo_emulation) {
if (!currprefs.cpu_cycle_exact && !currprefs.blitter_cycle_exact)
changed_prefs.gfx_framerate = currprefs.gfx_framerate = 10;
pause_sound ();
}
compute_vsynctime ();
#ifdef RETROPLATFORM
- rp_turbo (turbo_emulation);
+ rp_turbo (currprefs.turbo_emulation);
#endif
}
} else if (_tcsncmp (argv[i], L"-config=", 8) == 0) {
TCHAR *txt = parsetext (argv[i] + 8);
currprefs.mountitems = 0;
- target_cfgfile_load (&currprefs, txt, -1, 1);
+ target_cfgfile_load (&currprefs, txt, -1, 0);
xfree (txt);
} else if (_tcsncmp (argv[i], L"-statefile=", 11) == 0) {
TCHAR *txt = parsetext (argv[i] + 11);
write_log (L"Missing argument for '-f' option.\n");
} else {
currprefs.mountitems = 0;
- target_cfgfile_load (&currprefs, argv[++i], -1, 1);
+ target_cfgfile_load (&currprefs, argv[++i], -1, 0);
}
} else if (_tcscmp (argv[i], L"-s") == 0) {
if (i + 1 == argc)
}
}
-/* remove rom entries that need 2 or more roms but not everyone is present */
+/* remove rom entries that need 2 or more roms but not everything required is present */
static void romlist_cleanup (void)
{
int i = 0;
struct romlist *rl = romlist_getrl (&roms[i]);
if (rl) {
int cnt = romlist_cnt - i - 1;
- write_log (L"%d '%s' removed from romlist\n", roms[k].name, rl->path);
+ write_log (L"%s '%s' removed from romlist\n", roms[k].name, rl->path);
xfree (rl->path);
if (cnt > 0)
memmove (rl, rl + 1, cnt * sizeof (struct romlist));
return NULL;
}
+static struct zfile *rom_fopen (const TCHAR *name, const TCHAR *mode, int mask)
+{
+ struct zfile *f;
+ //write_log (L"attempting to load '%s'\n", name);
+ f = zfile_fopen (name, mode, mask);
+ //write_log (L"=%p\n", f);
+ return f;
+}
+
struct zfile *read_rom_name (const TCHAR *filename)
{
int i;
return f;
}
}
- f = zfile_fopen (filename, L"rb", ZFD_NORMAL);
+ f = rom_fopen (filename, L"rb", ZFD_NORMAL);
if (f) {
uae_u8 tmp[11];
zfile_fread (tmp, sizeof tmp, 1, f);
j = 0;
while (residents[j]) {
if (!memcmp (residents[j], kickmemory + addr - base, strlen (residents[j]) + 1)) {
- write_log (L"KSPatcher: '%s' at %08X disabled\n", residents[j], i + base);
+ TCHAR *s = au (residents[j]);
+ write_log (L"KSPatcher: '%s' at %08X disabled\n", s, i + base);
+ xfree (s);
kickmemory[i] = 0x4b; /* destroy RTC_MATCHWORD */
patched++;
break;
_tcscpy (tmprom, currprefs.romfile);
if (f == NULL) {
_stprintf (tmprom2, L"%s%s", start_path_data, currprefs.romfile);
- f = zfile_fopen (tmprom2, L"rb", ZFD_NORMAL);
+ f = rom_fopen (tmprom2, L"rb", ZFD_NORMAL);
if (f == NULL) {
_stprintf (currprefs.romfile, L"%sroms/kick.rom", start_path_data);
- f = zfile_fopen (currprefs.romfile, L"rb", ZFD_NORMAL);
+ f = rom_fopen (currprefs.romfile, L"rb", ZFD_NORMAL);
if (f == NULL) {
_stprintf (currprefs.romfile, L"%skick.rom", start_path_data);
- f = zfile_fopen (currprefs.romfile, L"rb", ZFD_NORMAL);
+ f = rom_fopen (currprefs.romfile, L"rb", ZFD_NORMAL);
if (f == NULL) {
_stprintf (currprefs.romfile, L"%s../shared/rom/kick.rom", start_path_data);
- f = zfile_fopen (currprefs.romfile, L"rb", ZFD_NORMAL);
+ f = rom_fopen (currprefs.romfile, L"rb", ZFD_NORMAL);
if (f == NULL) {
_stprintf (currprefs.romfile, L"%s../System/rom/kick.rom", start_path_data);
- f = zfile_fopen (currprefs.romfile, L"rb", ZFD_NORMAL);
+ f = rom_fopen (currprefs.romfile, L"rb", ZFD_NORMAL);
}
}
}
base = ((uae_u8 *) NATMEM_OFFSET) + start;
y->native_address = shmat (y->id, base, 0);
if (y->native_address == (void *) -1) {
- write_log (L"NATMEM: Failure to map existing at %08x(%p)\n", start, base);
+ write_log (L"NATMEM: Failure to map existing at %08x (%p)\n", start, base);
dumplist ();
nocanbang ();
return;
allocated_chipmem = 0;
} else {
need_hardreset = 1;
- if (memsize != allocated_chipmem)
+ if (memsize > allocated_chipmem)
memset (chipmemory + allocated_chipmem, 0xff, memsize - allocated_chipmem);
}
currprefs.chipset_mask = changed_prefs.chipset_mask;
init_mem_banks ();
allocate_memory ();
-
+
if (_tcscmp (currprefs.romfile, changed_prefs.romfile) != 0
|| _tcscmp (currprefs.romextfile, changed_prefs.romextfile) != 0)
{
+ write_log (L"ROM loader..\n");
kickstart_rom = 1;
ersatzkickfile = 0;
a1000_handle_kickstart (0);
} else {
struct romdata *rd = getromdatabydata (kickmemory, kickmem_size);
if (rd) {
+ write_log (L"Known ROM '%s' loaded\n", rd->name);
if ((rd->cpu & 3) == 3 && changed_prefs.cpu_model != 68030) {
notify_user (NUMSG_KS68030);
uae_restart (-1, NULL);
if (currprefs.cs_ide != IDE_A4000)
changed_prefs.cs_ide = currprefs.cs_ide = -1;
}
+ } else {
+ write_log (L"Unknown ROM '%s' loaded\n", currprefs.romfile);
}
}
patch_kick ();
+ write_log (L"ROM loader end\n");
}
if (cloanto_rom && currprefs.maprom < 0x01000000)
}
#endif
#endif
+ write_log (L"memory init end\n");
}
void memory_init (void)
tmp[4] = 0;
rev = au (tmp);
- write_log (L"ASPI: %d:%d:%d '%s' '%s' '%s",
+ write_log (L"ASPI: %d:%d:%d '%s' '%s' '%s' ",
scgp->addr.scsibus,scgp->addr.target,scgp->addr.lun, vend, prod, rev);
if (unitcnt < MAX_TOTAL_DEVICES) {
struct scsi_info *cis = &si[unitcnt];
BSDTRACE((L"failed (%d)\n",sb->sb_errno));
return -1;
} else
- sd = getsd(sb,(int)s);
+ sd = getsd(sb,s);
sb->ftable[sd-1] = SF_BLOCKING;
ioctlsocket(s,FIONBIO,&nonblocking);
--- /dev/null
+
+#include <windows.h>
+
+#include <stdio.h>
+#include <tchar.h>
+
+static int runthread = 1;
+static HANDLE stdin_save, stdout_save, stderr_save;
+static PROCESS_INFORMATION pi;
+
+
+static DWORD WINAPI pipethread (LPVOID pipewr)
+{
+ TCHAR buff[256];
+ DWORD read, wrote;
+ HANDLE pipewrite = (HANDLE)pipewr;
+
+ while (runthread) {
+ read = 0;
+ ReadConsole (stdin_save, buff, 1, &read, NULL);
+ buff[read] = 0;
+ if (read > 0) {
+ if (!WriteFile (pipewrite, buff, read * sizeof (TCHAR), &wrote, NULL)) {
+ if (GetLastError () == ERROR_NO_DATA)
+ break;
+ }
+ }
+ }
+ return 0;
+}
+
+static void HandleOutput (HANDLE piperead)
+{
+ TCHAR buffer[256];
+ DWORD read, wrote;
+
+ for (;;) {
+ read = 0;
+ if (!ReadFile (piperead, buffer, sizeof buffer, &read, NULL)) {
+ if (GetLastError () == ERROR_BROKEN_PIPE)
+ break;
+ }
+ if (read > 0) {
+ WriteConsole (stdout_save, buffer, read / sizeof (TCHAR), &wrote, NULL);
+ }
+ }
+}
+
+static BOOL WINAPI ctrlhandler (DWORD type)
+{
+ if (pi.hProcess)
+ TerminateProcess (pi.hProcess, 0);
+ ExitProcess (0);
+ return TRUE;
+}
+
+#define conpar L"-console"
+
+int wmain (int argc, wchar_t *argv[], wchar_t *envp[])
+{
+ CONSOLE_SCREEN_BUFFER_INFO csbi;
+ STARTUPINFO si;
+ TCHAR *cmd, *parms2;
+ int len, parmlen, i;
+ HANDLE cp;
+ HANDLE out_rd = NULL, out_wr = NULL, out_rd_tmp = NULL;
+ HANDLE in_rd = NULL, in_wr = NULL, in_wr_tmp = NULL;
+ HANDLE err_wr;
+ DWORD tid;
+ HANDLE thread;
+ SECURITY_ATTRIBUTES sa;
+
+ len = _tcslen (argv[0]);
+ if (len < 4)
+ return 0;
+ cmd = malloc ((len + 4 + 1) * sizeof (TCHAR));
+ _tcscpy (cmd, argv[0]);
+ if (_tcsicmp (cmd + len - 4, L".com"))
+ _tcscat (cmd + len, L".exe");
+ else
+ _tcscpy (cmd + len - 4, L".exe");
+
+ parmlen = 0;
+ for (i = 1; i < argc; i++) {
+ if (parmlen > 0)
+ parmlen ++;
+ parmlen += 1 + _tcslen (argv[i]) + 1;
+ }
+ parms2 = malloc ((_tcslen (cmd) + 1 + parmlen + 1 + _tcslen (conpar) + 1) * sizeof (TCHAR));
+ _tcscpy (parms2, cmd);
+ _tcscat (parms2, L" ");
+ _tcscat (parms2, conpar);
+ for (i = 1; i < argc; i++) {
+ int isspace = 0;
+ _tcscat (parms2, L" ");
+ if (_tcschr (argv[i], ' '))
+ isspace = 1;
+ if (isspace)
+ _tcscat (parms2, L"\"");
+ _tcscat (parms2, argv[i]);
+ if (isspace)
+ _tcscat (parms2, L"\"");
+ }
+
+ cp = GetCurrentProcess ();
+ sa.nLength = sizeof sa;
+ sa.bInheritHandle = TRUE;
+ sa.lpSecurityDescriptor = NULL;
+
+ stdout_save = GetStdHandle (STD_OUTPUT_HANDLE);
+ stdin_save = GetStdHandle (STD_INPUT_HANDLE);
+ stderr_save = GetStdHandle (STD_ERROR_HANDLE);
+
+ SetConsoleMode (stdin_save, ENABLE_PROCESSED_INPUT|ENABLE_LINE_INPUT|ENABLE_ECHO_INPUT|ENABLE_PROCESSED_OUTPUT);
+ SetConsoleCP (65001);
+ SetConsoleOutputCP (65001);
+ if (GetConsoleScreenBufferInfo (stdout_save, &csbi)) {
+ if (csbi.dwMaximumWindowSize.Y < 900) {
+ csbi.dwMaximumWindowSize.Y = 900;
+ SetConsoleScreenBufferSize (stdout_save, csbi.dwMaximumWindowSize);
+ }
+ }
+
+ CreatePipe (&out_rd_tmp, &out_wr, &sa, 0);
+ CreatePipe (&in_rd, &in_wr_tmp, &sa, 0);
+
+ DuplicateHandle (cp, out_wr, cp, &err_wr, 0, TRUE, DUPLICATE_SAME_ACCESS);
+ DuplicateHandle (cp, out_rd_tmp, cp, &out_rd, 0, FALSE, DUPLICATE_SAME_ACCESS);
+ DuplicateHandle (cp, in_wr_tmp, cp, &in_wr, 0, FALSE, DUPLICATE_SAME_ACCESS);
+
+ CloseHandle (out_rd_tmp);
+ CloseHandle (in_wr_tmp);
+
+ memset (&si, 0, sizeof si);
+ si.cb = sizeof si;
+ si.dwFlags = STARTF_USESTDHANDLES;
+ si.hStdInput = in_rd;
+ si.hStdOutput = out_wr;
+ si.hStdError = err_wr;
+
+ SetConsoleCtrlHandler (&ctrlhandler, TRUE);
+
+ if (!CreateProcess (cmd, parms2,
+ NULL, NULL, TRUE,
+ CREATE_SUSPENDED | CREATE_NEW_CONSOLE | GetPriorityClass (GetCurrentProcess ()),
+ NULL, NULL, &si, &pi)) {
+ _tprintf (L"CreateProcess(%s) failed\n", cmd);
+ goto end;
+ }
+
+ CloseHandle (out_wr);
+ CloseHandle (in_rd);
+ CloseHandle (err_wr);
+
+ thread = CreateThread (NULL, 0, pipethread, (LPVOID)in_wr, 0, &tid);
+
+ ResumeThread (pi.hThread);
+
+ HandleOutput (out_rd);
+ runthread = 0;
+ CloseHandle (stdin_save);
+ WaitForSingleObject (thread, INFINITE);
+
+ CloseHandle (out_rd);
+ CloseHandle (in_wr);
+
+ CloseHandle (pi.hProcess);
+ CloseHandle (pi.hThread);
+end:
+ free (parms2);
+ free (cmd);
+ return 0;
+}
maximized = 0;
ShowWindow(hDbgWnd, maximized ? SW_SHOWMAXIMIZED : SW_SHOW);
UpdateWindow(hDbgWnd);
+ SetForegroundWindow (hDbgWnd);
update_debug_info();
return 1;
}
unacquire (lpdi, L"mouse");
if (did->connection == DIDC_DX && lpdi) {
setcoop (&di_mouse[num], flags ? (DISCL_FOREGROUND | DISCL_EXCLUSIVE) : (DISCL_BACKGROUND | DISCL_NONEXCLUSIVE), L"mouse");
- dipdw.diph.dwSize = sizeof(DIPROPDWORD);
- dipdw.diph.dwHeaderSize = sizeof(DIPROPHEADER);
+ dipdw.diph.dwSize = sizeof (DIPROPDWORD);
+ dipdw.diph.dwHeaderSize = sizeof (DIPROPHEADER);
dipdw.diph.dwObj = 0;
dipdw.diph.dwHow = DIPH_DEVICE;
dipdw.dwData = DI_BUFFER;
DWORD elements;
HRESULT hr;
int i, j, k;
- int fs = isfullscreen() > 0 ? 1 : 0;
+ int fs = isfullscreen () > 0 ? 1 : 0;
int istest = inputdevice_istest ();
if (IGNOREEVERYTHING)
hr = IDirect3DDevice9_SetSamplerState (d3ddev, 0, D3DSAMP_MIPFILTER, D3DTEXF_NONE);
}
+static void setupscenecoordssl (void)
+{
+ float w, h;
+
+ w = window_w;
+ h = window_h;
+
+ MatrixOrthoOffCenterLH (&m_matProj, 0.0f, (float)w, 0.0f, (float)h, 0.0f, 1.0f);
+ MatrixTranslation (&m_matView,
+ (float)w / 2 - 0.5,
+ (float)h / 2 + 0.5,
+ 0.0f);
+ MatrixScaling (&m_matWorld, w, h, 1.0f);
+}
+
static void setupscenecoords (void)
{
RECT sr, dr, zr;
hr = IDirect3DVertexBuffer9_Unlock (vertexBuffer);
}
+static void settransformsl (void)
+{
+ HRESULT hr;
+
+ hr = IDirect3DDevice9_SetTransform (d3ddev, D3DTS_PROJECTION, &m_matProj);
+ hr = IDirect3DDevice9_SetTransform (d3ddev, D3DTS_VIEW, &m_matView);
+ hr = IDirect3DDevice9_SetTransform (d3ddev, D3DTS_WORLD, &m_matWorld);
+}
+
static void settransform (void)
{
HRESULT hr;
LPDIRECT3DSURFACE9 lpRenderTarget;
LPDIRECT3DSURFACE9 lpNewRenderTarget;
LPDIRECT3DTEXTURE9 lpWorkTexture;
+
if (!psEffect_SetTextures (texture, lpWorkTexture1, lpWorkTexture2, lpHq2xLookupTexture))
return;
if (psPreProcess) {
hr = IDirect3DDevice9_SetTexture (d3ddev, 0, (IDirect3DBaseTexture9*)texture);
hr = IDirect3DDevice9_DrawPrimitive (d3ddev, D3DPT_TRIANGLESTRIP, 0, 2);
+
if (scanlines_ok) {
+ setupscenecoordssl ();
+ settransformsl ();
hr = IDirect3DDevice9_SetTexture (d3ddev, 0, (IDirect3DBaseTexture9*)sltexture);
hr = IDirect3DDevice9_DrawPrimitive (d3ddev, D3DPT_TRIANGLESTRIP, 0, 2);
}
hr = IDirect3DTexture9_AddDirtyRect (texture, &r);
D3D_render2 (0);
- if (vsync2)
+ if (vsync2 && !currprefs.turbo_emulation)
D3D_render2 (0);
}
DirectDraw_FillSurface (dxdata.primary, NULL, 0);
}
-extern int vblank_skip, turbo_emulation;
+extern int vblank_skip;
static void flip (void)
{
int result = 0;
HRESULT ddrval = DD_OK;
DWORD flags = DDFLIP_WAIT;
- if (turbo_emulation)
+ if (currprefs.turbo_emulation)
flags |= DDFLIP_NOVSYNC;
if (dxdata.backbuffers == 2) {
DirectDraw_Blit (dxdata.flipping[1], dxdata.flipping[0]);
if (currprefs.gfx_avsync) {
- if (vblank_skip >= 0) {
+ if (vblank_skip >= 0 || currprefs.turbo_emulation) {
ddrval = IDirectDrawSurface7_Flip (dxdata.primary, NULL, flags);
} else {
if (flipinterval_supported) {
if (wglSwapIntervalEXT) {
int i1, i2;
i1 = (currprefs.gfx_avsync > 0 && isfullscreen() > 0) ? (abs (currprefs.gfx_refreshrate) > 85 ? 2 : 1) : 0;
- if (turbo_emulation)
+ if (currprefs.turbo_emulation)
i1 = 0;
wglSwapIntervalEXT (i1);
i2 = wglGetSwapIntervalEXT ();
#define IDI_GAMEPORTS 262
#define IDS_ALL 262
#define IDD_GAMEPORTS 263
+#define IDS_STRING22 263
+#define IDS_INPUTTOGGLE 263
#define IDS_NUMSG_NEEDEXT2 300
#define IDS_NUMSG_NOROMKEY 301
#define IDS_NUMSG_KSROMCRCERROR 302
IDS_SOUND_51 "5.1 Channels"\r
IDS_AUTOMATIC "Automatic"\r
IDS_ALL "All"\r
+ IDS_INPUTTOGGLE "Toggle"\r
END\r
\r
STRINGTABLE \r
}
rp_update_volume (&currprefs);
- rp_turbo (turbo_emulation);
+ rp_turbo (currprefs.turbo_emulation);
for (i = 0; i <= 4; i++)
rp_update_leds (i, 0, 0);
}
PaStreamParameters p;
PaError err;
TCHAR *name;
+ TCHAR *errtxt;
size = sd->sndbufsize;
s->paframesperbuffer = size;
p.suggestedLatency = di->defaultLowOutputLatency;
p.hostApiSpecificStreamInfo = NULL;
for (;;) {
+ int err2;
err = Pa_IsFormatSupported (NULL, &p, freq);
if (err == paFormatIsSupported)
break;
+ err2 = err;
+ errtxt = au (Pa_GetErrorText (err));
+ write_log (L"PASOUND: sound format not supported, ch=%d, rate=%d. %s\n", freq, ch, errtxt);
+ xfree (errtxt);
if (freq < 48000) {
freq = 48000;
err = Pa_IsFormatSupported (NULL, &p, freq);
break;
}
}
- write_log (L"PASOUND: sound format not supported\n");
+ if (err2 != err) {
+ errtxt = au (Pa_GetErrorText (err));
+ write_log (L"PASOUND: sound format not supported, ch=%d, rate=%d. %s\n", freq, ch, errtxt);
+ xfree (errtxt);
+ }
goto end;
}
err = Pa_OpenStream (&s->pastream, NULL, &p, freq, s->paframesperbuffer, paNoFlag, portAudioCallback, sd);
if (err != paNoError) {
- write_log (L"PASOUND: Pa_OpenStream() error %d (%s)\n", err, Pa_GetErrorText (err));
+ errtxt = au (Pa_GetErrorText (err));
+ write_log (L"PASOUND: Pa_OpenStream() error %d (%s)\n", err, errtxt);
+ xfree (errtxt);
goto end;
}
s->paevent = CreateEvent (NULL, FALSE, FALSE, NULL);
void finish_sound_buffer (void)
{
- if (turbo_emulation)
+ if (currprefs.turbo_emulation)
return;
if (currprefs.sound_stereo_swap_paula) {
if (get_audio_nativechannels () == 2 || get_audio_nativechannels () == 4)
zfile_convertimage (np, np2);
return -1;
}
-
+ if (!_tcscmp (arg, L"-console")) {
+ return 1;
+ }
if (!_tcscmp (arg, L"-log")) {
console_logging = 1;
return 1;
GetModuleHandle (L"user32.dll"), "SetProcessDPIAware");
if (pSetProcessDPIAware)
pSetProcessDPIAware ();
+ log_open (NULL, 0, 0);
__try {
WinMain2 (hInstance, hPrevInstance, lpCmdLine, nCmdShow);
#define WINUAEPUBLICBETA 1
-#define WINUAEBETA L"Beta 1"
-#define WINUAEDATE MAKEBD(2009, 5, 30)
+#define WINUAEBETA L"Beta 2"
+#define WINUAEDATE MAKEBD(2009, 6, 6)
#define WINUAEEXTRA L""
#define WINUAEREV L""
WS_EX_TOPMOST :
WS_EX_ACCEPTFILES | exstyle | (currprefs.win32_alwaysontop ? WS_EX_TOPMOST : 0),
L"AmigaPowah", L"WinUAE",
- (dxfs || d3dfs ? WS_POPUP : (WS_CLIPCHILDREN | WS_CLIPSIBLINGS | (hMainWnd ? WS_VISIBLE | WS_CHILD : WS_VISIBLE | WS_POPUP | WS_SYSMENU | WS_MINIMIZEBOX))),
+ (dxfs || d3dfs || currprefs.headless ? WS_POPUP : (WS_CLIPCHILDREN | WS_CLIPSIBLINGS | (hMainWnd ? WS_VISIBLE | WS_CHILD : WS_VISIBLE | WS_POPUP | WS_SYSMENU | WS_MINIMIZEBOX))),
x, y, w, h,
borderless ? NULL : (hMainWnd ? hMainWnd : hhWnd), NULL, hInst, NULL);
}
if (!hAmigaWnd) {
write_log (L"creation of amiga window failed\n");
- close_hwnds();
+ close_hwnds ();
return 0;
}
if (hMainWnd == NULL)
SetCursorPos (x + w / 2, y + h / 2);
addnotifications (hAmigaWnd, FALSE);
if (hMainWnd != hAmigaWnd) {
- ShowWindow (hMainWnd, firstwindow ? SW_SHOWDEFAULT : SW_SHOWNORMAL);
+ if (!currprefs.headless)
+ ShowWindow (hMainWnd, firstwindow ? SW_SHOWDEFAULT : SW_SHOWNORMAL);
UpdateWindow (hMainWnd);
}
- ShowWindow (hAmigaWnd, firstwindow ? SW_SHOWDEFAULT : SW_SHOWNORMAL);
+ if (!currprefs.headless)
+ ShowWindow (hAmigaWnd, firstwindow ? SW_SHOWDEFAULT : SW_SHOWNORMAL);
UpdateWindow (hAmigaWnd);
firstwindow = 0;
keys = get_keyring ();
fetch_path (L"KickstartPath", path, sizeof path / sizeof (TCHAR));
cnt += scan_roms_3 (fkey, paths, path);
- if (TRUE) {
+ if (1) {
for(i = 0; i < MAX_ROM_PATHS; i++) {
ret = get_rom_path (path, i);
if (ret < 0)
int flags, i, sub;
TCHAR name[256];
TCHAR custom[MAX_DPATH];
- TCHAR af[10];
+ TCHAR af[32], toggle[32];
inputdevice_get_mapped_name (input_selected_device, index, &flags, name, custom, input_selected_sub_num);
if (flags & IDEV_MAPPED_AUTOFIRE_SET)
WIN32GUI_LoadUIString (IDS_NO, af, sizeof (af) / sizeof (TCHAR));
else
_tcscpy (af, L"-");
- ListView_SetItemText(list, index, 1, custom[0] ? custom : name);
- ListView_SetItemText(list, index, 2, af);
+ if (flags & IDEV_MAPPED_TOGGLE)
+ WIN32GUI_LoadUIString (IDS_YES, toggle, sizeof (toggle) / sizeof (TCHAR));
+ else if (flags & IDEV_MAPPED_AUTOFIRE_POSSIBLE)
+ WIN32GUI_LoadUIString (IDS_NO, toggle, sizeof (toggle) / sizeof (TCHAR));
+ else
+ _tcscpy (toggle, L"-");
+ ListView_SetItemText (list, index, 1, custom[0] ? custom : name);
+ ListView_SetItemText (list, index, 2, af);
+ ListView_SetItemText (list, index, 3, toggle);
sub = 0;
for (i = 0; i < MAX_INPUT_SUB_EVENT; i++) {
if (inputdevice_get_mapped_name (input_selected_device, index, &flags, name, custom, i) || custom[0])
sub++;
}
_stprintf (name, L"%d", sub);
- ListView_SetItemText(list, index, 3, name);
+ ListView_SetItemText (list, index, 4, name);
}
static void update_listview_input (HWND hDlg)
#define LV_LOADSAVE 1
#define LV_HARDDISK 2
-#define LV_INPUT 3
+#define LV_INPUT 4
#define LV_DISK 4
#define LV_MISC2 5
WIN32GUI_LoadUIString(IDS_INPUTHOSTWIDGET, column_heading[0], MAX_COLUMN_HEADING_WIDTH);
WIN32GUI_LoadUIString(IDS_INPUTAMIGAEVENT, column_heading[1], MAX_COLUMN_HEADING_WIDTH);
WIN32GUI_LoadUIString(IDS_INPUTAUTOFIRE, column_heading[2], MAX_COLUMN_HEADING_WIDTH);
- _tcscpy (column_heading[3], L"#");
+ WIN32GUI_LoadUIString(IDS_INPUTTOGGLE, column_heading[3], MAX_COLUMN_HEADING_WIDTH);
+ _tcscpy (column_heading[4], L"#");
list = GetDlgItem(hDlg, IDC_INPUTLIST);
} else if (hDlg == pages[MISC2_ID]) {
listview_num_columns = MISC2_COLUMNS;
}
listview_column_width [1] = 260;
listview_column_width [2] = 65;
- listview_column_width [3] = 30;
+ listview_column_width [3] = 65;
+ listview_column_width [4] = 30;
update_listview_input (hDlg);
} else if (lv_type == LV_DISK) {
for (i = 0; i < MAX_SPARE_DRIVES; i++) {
if (_tcslen (custom1) > 0 || newcustom) {
if (askinputcustom (hDlg, custom1, sizeof custom1 / sizeof (TCHAR), IDS_SB_CUSTOMEVENT)) {
inputdevice_set_mapping (input_selected_device, input_selected_widget,
- 0, custom1, (flags & IDEV_MAPPED_AUTOFIRE_SET) ? 1 : 0, input_selected_sub_num);
+ 0, custom1, flags, input_selected_sub_num);
}
}
}
custom[0] = 0;
inputdevice_set_mapping (input_selected_device, input_selected_widget,
eventnames[input_selected_event], _tcslen (custom) == 0 ? NULL : custom,
- (flags & IDEV_MAPPED_AUTOFIRE_SET) ? 1 : 0, input_selected_sub_num);
+ flags, input_selected_sub_num);
update_listview_input (hDlg);
inputdevice_updateconfig (&workprefs);
}
static void input_toggleautofire (void)
{
- int af, flags, evt;
+ int flags, evt;
+ TCHAR name[256];
+ TCHAR custom[MAX_DPATH];
+ if (input_selected_device < 0 || input_selected_widget < 0)
+ return;
+ evt = inputdevice_get_mapped_name (input_selected_device, input_selected_widget,
+ &flags, name, custom, input_selected_sub_num);
+ if (evt <= 0)
+ return;
+ inputdevice_set_mapping (input_selected_device, input_selected_widget,
+ name, custom, flags ^ IDEV_MAPPED_AUTOFIRE_SET, input_selected_sub_num);
+}
+static void input_toggletoggle (void)
+{
+ int flags, evt;
TCHAR name[256];
TCHAR custom[MAX_DPATH];
if (input_selected_device < 0 || input_selected_widget < 0)
&flags, name, custom, input_selected_sub_num);
if (evt <= 0)
return;
- af = (flags & IDEV_MAPPED_AUTOFIRE_SET) ? 0 : 1;
inputdevice_set_mapping (input_selected_device, input_selected_widget,
- name, custom, af, input_selected_sub_num);
+ name, custom, flags ^ IDEV_MAPPED_TOGGLE, input_selected_sub_num);
}
static INT_PTR CALLBACK InputDlgProc (HWND hDlg, UINT msg, WPARAM wParam, LPARAM lParam)
input_swap (hDlg);
break;
case IDC_INPUTDEVICEDISABLE:
- inputdevice_set_device_status (input_selected_device, IsDlgButtonChecked( hDlg, IDC_INPUTDEVICEDISABLE) ? 1 : 0);
+ inputdevice_set_device_status (input_selected_device, IsDlgButtonChecked (hDlg, IDC_INPUTDEVICEDISABLE) ? 1 : 0);
break;
default:
switch (LOWORD (wParam))
input_selected_widget = entry;
if (row == 2 && entry == oldentry)
input_toggleautofire ();
- if (row == 3) {
+ if (row == 3 && entry == oldentry)
+ input_toggletoggle ();
+ if (row == 4) {
input_selected_sub_num++;
if (input_selected_sub_num >= MAX_INPUT_SUB_EVENT)
input_selected_sub_num = 0;
ew (hDlg, IDC_FILTERVZMULT, v && !as);
ew (hDlg, IDC_FILTERHO, v && !as);
ew (hDlg, IDC_FILTERVO, v && !as);
- ew (hDlg, IDC_FILTERSLR, vv3 && !as);
- ew (hDlg, IDC_FILTERXL, vv2 && !as);
- ew (hDlg, IDC_FILTERXLV, vv2 && !as);
+ ew (hDlg, IDC_FILTERSLR, vv3);
+ ew (hDlg, IDC_FILTERXL, vv2);
+ ew (hDlg, IDC_FILTERXLV, vv2);
ew (hDlg, IDC_FILTERXTRA, vv2);
ew (hDlg, IDC_FILTERDEFAULT, v);
ew (hDlg, IDC_FILTERFILTER, vv);
+Beta 2:
-Beta 1
+- fs "double vsync" mode (100Hz+) was still slow in warp mode
+ (note D3D mode will stay "slow" because afaik it is not possible
+ to switch D3D vsync on/off on the fly)
+- added warp mode to configuration file (warp=true/false, config file
+ read-only)
+- and another read-only configuration entry, "headless" that switches
+ invisible emulation mode (window gets hidden). future feature..
+- log window scrollback buffer increased to 900 lines
+- command prompt "console wrapper" support (run winuae in command
+ prompt: output goes to command prompt window, does not open separate
+ log window) More information later, not important just yet..
+- saving configuration after modifying input-panel autofire setting
+ caused modified input event to be saved incorrectly (old bug)
+- display scaling does not anymore change D3D filter scanline scaling
+- unicode conversion broke magic mouse
+- uaeunp file handling update broke some archive operations (b1)
+- loading config from command line with GUI enabled didn't override
+ quickstart (if enabled)
+- added "toggle" option to input panel. First button/key press =
+ emulated button is pressed and kept down. Second button/key press
+ = emulated button is released
+
+Beta 1:
- development PC updated to Intel Core i7 based. (Asus P6T DeluxeV2,
i7 920 2.66GHz CPU @ 3.7GHz, 3x2G 1866MHz RAM)
#define SHOW_CONSOLE 0
int consoleopen = 0;
+static int realconsole;
static HANDLE stdinput,stdoutput;
static int bootlogmode;
static CRITICAL_SECTION cs;
return GetConsoleWindow ();
}
-static void open_console_window (void)
+static void getconsole (void)
{
- AllocConsole();
+ CONSOLE_SCREEN_BUFFER_INFO csbi;
+
stdinput = GetStdHandle (STD_INPUT_HANDLE);
stdoutput = GetStdHandle (STD_OUTPUT_HANDLE);
SetConsoleMode (stdinput, ENABLE_PROCESSED_INPUT|ENABLE_LINE_INPUT|ENABLE_ECHO_INPUT|ENABLE_PROCESSED_OUTPUT);
SetConsoleCP (65001);
SetConsoleOutputCP (65001);
+ if (GetConsoleScreenBufferInfo (stdoutput, &csbi)) {
+ if (csbi.dwMaximumWindowSize.Y < 900) {
+ csbi.dwMaximumWindowSize.Y = 900;
+ SetConsoleScreenBufferSize (stdoutput, csbi.dwMaximumWindowSize);
+ }
+ }
+}
+
+static void open_console_window (void)
+{
+ AllocConsole ();
+ getconsole ();
consoleopen = -1;
reopen_console ();
}
-static void openconsole( void)
+static void openconsole (void)
{
+ if (realconsole) {
+ if (debugger_type == 2) {
+ open_debug_window ();
+ consoleopen = 1;
+ } else {
+ close_debug_window ();
+ consoleopen = -1;
+ }
+ return;
+ }
if (debugger_active && (debugger_type < 0 || debugger_type == 2)) {
if (consoleopen > 0 || debuggerinitializing)
return;
{
HWND hwnd;
+ if (realconsole)
+ return;
if (consoleopen >= 0)
return;
hwnd = myGetConsoleWindow ();
void close_console (void)
{
+ if (realconsole)
+ return;
if (consoleopen > 0) {
close_debug_window ();
} else if (consoleopen < 0) {
static void writeconsole (const TCHAR *buffer)
{
DWORD temp;
+
if (!consoleopen)
- openconsole();
- if (consoleopen > 0)
+ openconsole ();
+
+ if (consoleopen > 0) {
WriteOutput (buffer, _tcslen (buffer));
- else if (consoleopen < 0)
- WriteConsole (stdoutput, buffer, _tcslen (buffer), &temp,0);
+ } else if (realconsole) {
+ fputws (buffer, stdout);
+ fflush (stdout);
+ } else if (consoleopen < 0) {
+ WriteConsole (stdoutput, buffer, _tcslen (buffer), &temp, 0);
+ }
}
void console_out_f (const TCHAR *format,...)
int console_get (TCHAR *out, int maxlen)
{
*out = 0;
+
if (consoleopen > 0) {
return console_get_gui (out, maxlen);
+ } else if (realconsole) {
+ _fgetts (out, maxlen, stdin);
+ return _tcslen (out);
} else if (consoleopen < 0) {
DWORD len, totallen;
void *log_open (const TCHAR *name, int append, int bootlog)
{
- FILE *f;
+ FILE *f = NULL;
- f = _tfopen (name, append ? L"a, ccs=UTF-8" : L"wt, ccs=UTF-8");
- bootlogmode = bootlog;
if (!cs_init)
- InitializeCriticalSection (&cs);
+ InitializeCriticalSection (&cs);
cs_init = 1;
+
+ if (name != NULL) {
+ f = _tfopen (name, append ? L"a, ccs=UTF-8" : L"wt, ccs=UTF-8");
+ bootlogmode = bootlog;
+ } else if (1) {
+ TCHAR *c = GetCommandLine ();
+ if (_tcsstr (c, L" -console")) {
+ if (GetStdHandle (STD_INPUT_HANDLE) && GetStdHandle (STD_OUTPUT_HANDLE)) {
+ consoleopen = -1;
+ realconsole = 1;
+ getconsole ();
+ _setmode(_fileno (stdout), _O_U16TEXT);
+ _setmode(_fileno (stdin), _O_U16TEXT);
+ }
+ }
+ }
return f;
}
return 0;
}
-struct zfile *zuncompress (struct znode *parent, struct zfile *z, int dodefault, int mask)
+struct zfile *zuncompress (struct znode *parent, struct zfile *z, int dodefault, int mask, int *retcode)
{
TCHAR *name = z->name;
TCHAR *ext = NULL;
uae_u8 header[32];
int i;
+ if (*retcode)
+ *retcode = 0;
if (!mask)
return NULL;
if (name) {
if (ext != NULL) {
if (mask & ZFD_ARCHIVE) {
if (strcasecmp (ext, L"7z") == 0)
- return archive_access_select (parent, z, ArchiveFormat7Zip, dodefault);
+ return archive_access_select (parent, z, ArchiveFormat7Zip, dodefault, retcode);
if (strcasecmp (ext, L"zip") == 0)
- return archive_access_select (parent, z, ArchiveFormatZIP, dodefault);
+ return archive_access_select (parent, z, ArchiveFormatZIP, dodefault, retcode);
if (strcasecmp (ext, L"lha") == 0 || strcasecmp (ext, L"lzh") == 0)
- return archive_access_select (parent, z, ArchiveFormatLHA, dodefault);
+ return archive_access_select (parent, z, ArchiveFormatLHA, dodefault, retcode);
if (strcasecmp (ext, L"lzx") == 0)
- return archive_access_select (parent, z, ArchiveFormatLZX, dodefault);
+ return archive_access_select (parent, z, ArchiveFormatLZX, dodefault, retcode);
if (strcasecmp (ext, L"rar") == 0)
- return archive_access_select (parent, z, ArchiveFormatRAR, dodefault);
+ return archive_access_select (parent, z, ArchiveFormatRAR, dodefault, retcode);
}
if (mask & ZFD_UNPACK) {
if (strcasecmp (ext, L"gz") == 0)
#if defined(ARCHIVEACCESS)
for (i = 0; plugins_7z_x[i]; i++) {
if ((plugins_7z_t[i] & mask) && strcasecmp (ext, plugins_7z[i]) == 0)
- return archive_access_arcacc_select (z, plugins_7z_t[i]);
+ return archive_access_arcacc_select (z, plugins_7z_t[i], retcode);
}
#endif
}
}
if (mask & ZFD_ARCHIVE) {
if (header[0] == 'P' && header[1] == 'K')
- return archive_access_select (parent, z, ArchiveFormatZIP, dodefault);
+ return archive_access_select (parent, z, ArchiveFormatZIP, dodefault, retcode);
if (header[0] == 'R' && header[1] == 'a' && header[2] == 'r' && header[3] == '!')
- return archive_access_select (parent, z, ArchiveFormatRAR, dodefault);
+ return archive_access_select (parent, z, ArchiveFormatRAR, dodefault, retcode);
if (header[0] == 'L' && header[1] == 'Z' && header[2] == 'X')
- return archive_access_select (parent, z, ArchiveFormatLZX, dodefault);
+ return archive_access_select (parent, z, ArchiveFormatLZX, dodefault, retcode);
if (header[2] == '-' && header[3] == 'l' && header[4] == 'h' && header[6] == '-')
- return archive_access_select (parent, z, ArchiveFormatLHA, dodefault);
+ return archive_access_select (parent, z, ArchiveFormatLHA, dodefault, retcode);
}
if (mask & ZFD_ADF) {
if (header[0] == 'D' && header[1] == 'O' && header[2] == 'S' && (header[3] >= 0 && header[3] <= 7))
- return archive_access_select (parent, z, ArchiveFormatADF, dodefault);
+ return archive_access_select (parent, z, ArchiveFormatADF, dodefault, retcode);
if (header[0] == 'S' && header[1] == 'F' && header[2] == 'S')
- return archive_access_select (parent, z, ArchiveFormatADF, dodefault);
+ return archive_access_select (parent, z, ArchiveFormatADF, dodefault, retcode);
if (isfat (header))
- return archive_access_select (parent, z, ArchiveFormatFAT, dodefault);
+ return archive_access_select (parent, z, ArchiveFormatFAT, dodefault, retcode);
}
if (ext) {
}
if (mask & ZFD_ADF) {
if (strcasecmp (ext, L"adf") == 0 && !memcmp (header, "DOS", 3))
- return archive_access_select (parent, z, ArchiveFormatADF, dodefault);
+ return archive_access_select (parent, z, ArchiveFormatADF, dodefault, retcode);
}
}
return NULL;
/*
* fopen() for a compressed file
*/
-struct zfile *zfile_fopen (const TCHAR *name, const TCHAR *mode, int mask)
+static struct zfile *zfile_fopen_x (const TCHAR *name, const TCHAR *mode, int mask)
{
int cnt = 10;
struct zfile *l, *l2;
return l;
l2 = NULL;
while (cnt-- > 0) {
+ int rc;
zfile_fseek (l, 0, SEEK_SET);
- l2 = zuncompress (NULL, l, 0, mask);
- zfile_fseek (l, 0, SEEK_SET);
- if (!l2)
+ l2 = zuncompress (NULL, l, 0, mask, &rc);
+ if (!l2) {
+ if (rc < 0) {
+ zfile_fclose (l);
+ return NULL;
+ }
+ zfile_fseek (l, 0, SEEK_SET);
break;
+ }
l = l2;
}
return l;
}
+struct zfile *zfile_fopen (const TCHAR *name, const TCHAR *mode, int mask)
+{
+ struct zfile *f;
+ //write_log (L"zfile_fopen('%s','%s',%08x)\n", name, mode, mask);
+ f = zfile_fopen_x (name, mode, mask);
+ //write_log (L"=%p\n", f);
+ return f;
+}
+
struct zfile *zfile_dup (struct zfile *zf)
{
goto end;
zvnew = zfile_fopen_archive_ext (zv->parentz, zf);
if (!zvnew) {
- struct zfile *zf2 = zuncompress (&zv->root, zf, 0, ZFD_ALL);
+ struct zfile *zf2 = zuncompress (&zv->root, zf, 0, ZFD_ALL, NULL);
if (zf2) {
zf = zf2;
zvnew = archive_directory_plain (zf);
return zf;
}
-struct zfile *archive_access_select (struct znode *parent, struct zfile *zf, unsigned int id, int dodefault)
+struct zfile *archive_access_select (struct znode *parent, struct zfile *zf, unsigned int id, int dodefault, int *retcode)
{
struct zvolume *zv;
struct znode *zn;
struct zfile *z = NULL;
int we_have_file;
+ if (retcode)
+ *retcode = 0;
zv = getzvolume (parent, zf, id);
if (!zv)
- return zf;
+ return NULL;
we_have_file = 0;
tmphist[0] = 0;
zipcnt = 1;
zfile_fclose (zf);
zf = z;
} else if (!dodefault && zf->zipname && zf->zipname[0]) {
- zfile_fclose (zf);
+ if (retcode)
+ *retcode = -1;
zf = NULL;
}
return zf;
}
-struct zfile *archive_access_arcacc_select (struct zfile *zf, unsigned int id)
+struct zfile *archive_access_arcacc_select (struct zfile *zf, unsigned int id, int *retcode)
{
return zf;
}
struct znode *zn;
struct zarchive_info zai;
uae_u8 id[8];
+ int rc;
memset (&zai, 0, sizeof zai);
zv = zvolume_alloc (z, ArchiveFormatPLAIN, NULL, NULL);
xfree (data);
}
zf = zfile_dup (z);
- zf2 = zuncompress (NULL, zf, 0, ZFD_ALL);
+ zf2 = zuncompress (NULL, zf, 0, ZFD_ALL, &rc);
if (zf2) {
zf = NULL;
zai.name = zfile_getfilename (zf2);