#include "newcpu.h"
#define AKIKO_DEBUG_NVRAM 0
-#define AKIKO_DEBUG_IO 0
-#define AKIKO_DEBUG_IO_CMD 0
+#define AKIKO_DEBUG_IO 1
+#define AKIKO_DEBUG_IO_CMD 1
// 43 48 49 4E 4F 4E 20 20 4F 2D 36 35 38 2D 32 20 32 34
#define FIRMWAREVERSION "CHINON O-658-2 24"
static uae_u8 *sector_buffer_info_1, *sector_buffer_info_2;
static int unitnum = -1;
-static int cdromok = 0;
static bool akiko_inited;
static volatile int mediachanged, mediacheckcounter;
static volatile int frame2counter;
static void cdaudiostop_do (void)
{
qcode_valid = 0;
- cdrom_playing = 0;
- cdrom_paused = 0;
if (unitnum < 0)
return;
sys_command_cd_pause (unitnum, 0);
sys_command_cd_stop (unitnum);
- sys_command_cd_pause (unitnum, 1);
}
static void cdaudiostop (void)
{
cdrom_playing = 0;
cdrom_paused = 0;
- write_comm_pipe_u32 (&requests, 0x104, 1);
+ write_comm_pipe_u32 (&requests, 0x0104, 1);
}
static void subfunc (uae_u8 *data, int cnt)
}
last_play_end = endlsn;
cdrom_audiotimeout = 0;
+ cdrom_paused = 0;
write_comm_pipe_u32 (&requests, 0x0110, 0);
write_comm_pipe_u32 (&requests, startlsn, 0);
write_comm_pipe_u32 (&requests, endlsn, 0);
last_play_pos = 0;
buf = qcode_buf;
as = buf[1];
+ if (cdrom_playing) // fake it!
+ as = AUDIO_STATUS_IN_PROGRESS;
if (as != AUDIO_STATUS_IN_PROGRESS && as != AUDIO_STATUS_PAUSED && as != AUDIO_STATUS_PLAY_COMPLETE && as != AUDIO_STATUS_NO_STATUS) /* audio status ok? */
return 0;
s = buf + 4;
if (checkerr ())
return 2;
cdrom_result_buffer[1] = 0;
- write_comm_pipe_u32 (&requests, 0x0104, 1);
+ cdaudiostop ();
return 2;
}
if (checkerr ())
return 2;
cdrom_result_buffer[1] = cdrom_playing ? CDS_PLAYING : 0;
- if (!cdrom_playing)
- return 2;
if (cdrom_paused)
return 2;
- write_comm_pipe_u32 (&requests, 0x0102, 1);
cdrom_paused = 1;
+ if (!cdrom_playing)
+ return 2;
+ write_comm_pipe_u32 (&requests, 0x0102, 1);
return 2;
}
cdrom_result_buffer[1] = cdrom_playing ? CDS_PLAYING : 0;
if (!cdrom_paused)
return 2;
+ cdrom_paused = 0;
if (!cdrom_playing)
return 2;
- cdrom_paused = 0;
write_comm_pipe_u32 (&requests, 0x0103, 1);
return 2;
}
}
if (cdrom_audiotimeout == -1) { // play finished (or disk end)
if (cdrom_playing) {
- write_comm_pipe_u32 (&requests, 0x0104, 1);
+ cdaudiostop ();
cdrom_audiotimeout = -2;
} else {
cdrom_audiotimeout = 0;
framecounter--;
if (framecounter <= 0) {
- if (cdrom_led) {
- if (cdrom_playing)
- cdrom_led |= LED_CD_AUDIO;
- else
- cdrom_led &= ~LED_CD_AUDIO;
- gui_flicker_led (LED_CD, 0, cdrom_led);
- }
if (cdrom_seek_delay <= 0) {
cdrom_run_read ();
} else {
qcode_valid = 1;
if (as == AUDIO_STATUS_IN_PROGRESS) {
frame2counter /= 4;
- int lsn = msf2lsn (fromlongbcd (qcode_buf + 4 + 7));
- // make sure audio play really ends because not all drives report position accurately
- if ((lsn >= cdrom_toc_cd_buffer.lastaddress - 3 * 75 || lsn >= last_play_end - 3 * 75) && cdrom_audiotimeout == 0) {
- cdrom_audiotimeout = 3 * 312;
+ if (cdrom_audiotimeout == 0) {
+ int lsn = msf2lsn (fromlongbcd (qcode_buf + 4 + 7));
+ // make sure audio play really ends because not all drives report position accurately
+ if ((lsn >= cdrom_toc_cd_buffer.lastaddress - 3 * 75 || lsn >= last_play_end - 3 * 75)) {
+ cdrom_audiotimeout = 3 * 312;
+ }
}
}
}
sector_buffer_2 = 0;
sector_buffer_info_1 = 0;
sector_buffer_info_2 = 0;
- cdromok = 0;
}
void akiko_reset (void)
cdrom_speed = 1;
cdrom_current_sector = -1;
- cdcomtxinx = 0;
- cdcomrxinx = 0;
- cdcomtxcmp = 0;
+ if (!savestate_state) {
+ cdcomtxinx = 0;
+ cdcomrxinx = 0;
+ cdcomtxcmp = 0;
+ }
cdrom_led = 0;
lastmediastate = 0;
cdrom_receive_started = 0;
int akiko_init (void)
{
- if (currprefs.cs_cd32cd && cdromok == 0) {
- unitnum = -1;
- if (!sys_cddev_open ()) {
- cdromok = 1;
- sector_buffer_1 = xmalloc (uae_u8, SECTOR_BUFFER_SIZE * 2352);
- sector_buffer_2 = xmalloc (uae_u8, SECTOR_BUFFER_SIZE * 2352);
- sector_buffer_info_1 = xmalloc (uae_u8, SECTOR_BUFFER_SIZE);
- sector_buffer_info_2 = xmalloc (uae_u8, SECTOR_BUFFER_SIZE);
- sector_buffer_sector_1 = -1;
- sector_buffer_sector_2 = -1;
- }
- }
+ if (!currprefs.cs_cd32cd)
+ return 0;
+ akiko_free ();
+ unitnum = -1;
+ sys_cddev_open ();
+ sector_buffer_1 = xmalloc (uae_u8, SECTOR_BUFFER_SIZE * 2352);
+ sector_buffer_2 = xmalloc (uae_u8, SECTOR_BUFFER_SIZE * 2352);
+ sector_buffer_info_1 = xmalloc (uae_u8, SECTOR_BUFFER_SIZE);
+ sector_buffer_info_2 = xmalloc (uae_u8, SECTOR_BUFFER_SIZE);
+ sector_buffer_sector_1 = -1;
+ sector_buffer_sector_2 = -1;
uae_sem_init (&akiko_sem, 0, 1);
uae_sem_init (&sub_sem, 0, 1);
if (!savestate_state) {
cdrom_playing = cdrom_paused = 0;
cdrom_data_offset = -1;
}
- if (cdromok && !akiko_thread_running) {
+ if (!akiko_thread_running) {
akiko_thread_running = 1;
init_comm_pipe (&requests, 100, 1);
uae_start_thread (L"akiko", akiko_thread, 0, NULL);
save_u32 (cdrom_addressdata);
save_u32 (cdrom_addressmisc);
save_u8 (cdrom_subcodeoffset);
- save_u8 (cdcomrxinx);
+ save_u8 (cdcomtxinx);
save_u8 (cdcomrxinx);
save_u8 (0);
save_u8 (0);
int i;
akiko_free ();
- if (!currprefs.cs_cd32cd || !cdromok) {
+ if (!currprefs.cs_cd32cd) {
changed_prefs.cs_cd32c2p = changed_prefs.cs_cd32cd = changed_prefs.cs_cd32nvram = true;
currprefs.cs_cd32c2p = currprefs.cs_cd32cd = currprefs.cs_cd32nvram = true;
akiko_init ();
{
if (!currprefs.cs_cd32cd)
return;
+ sys_cddev_close ();
akiko_init ();
akiko_c2p_do ();
get_cdrom_toc ();
write_comm_pipe_u32 (&requests, last_play_end, 0);
write_comm_pipe_u32 (&requests, 0, 1);
}
+ cd_initialized = 1;
}
#endif
void (*sample_handler) (void);
static void (*sample_prehandler) (unsigned long best_evtime);
-float sample_evtime, scaled_sample_evtime;
+static float sample_evtime;
+float scaled_sample_evtime;
static unsigned long last_cycles;
static float next_sample_evtime;
// copy AUDxPT - 2 to internal latch instantly
cdp->pt = cdp->lc - 2;
cdp->dsr = false;
- setirq (nr, 1);
} else {
// normal hardware behavior: latch it after first DMA fetch comes
cdp->dsr = true;
cdp->have_dat = false;
cdp->losample = cdp->hisample = false;
#endif
- if (!usehacks ())
- setirq (nr, 10);
+ setirq (nr, 10);
setdr (nr);
if (cdp->wlen != 1)
cdp->wlen = (cdp->wlen - 1) & 0xffff;
sample_prehandler = anti_prehandler;
}
- audio_activate ();
-
if (currprefs.produce_sound == 0) {
eventtab[ev_audio].active = 0;
events_schedule ();
+ } else {
+ audio_activate ();
+ schedule_audio ();
+ events_schedule ();
}
config_changed = 1;
}
return init_sound ();
}
-
void led_filter_audio (void)
{
led_filter_on = 0;
led_filter_on = 1;
}
-uae_u8 *restore_audio (int i, uae_u8 *src)
+void audio_vsync (void)
{
- struct audio_channel_data *acd;
+#if SOUNDSTUFF > 0
+ int max, min;
+ int vsync = isfullscreen () > 0 && currprefs.gfx_avsync;
+ static int lastdir;
+
+ if (!vsync) {
+ extrasamples = 0;
+ return;
+ }
+
+ min = -10 * 10;
+ max = vsync ? 10 * 10 : 20 * 10;
+ extrasamples = 0;
+ if (gui_data.sndbuf < min) { // +1
+ extrasamples = (min - gui_data.sndbuf) / 10;
+ lastdir = 1;
+ } else if (gui_data.sndbuf > max) { // -1
+ extrasamples = (max - gui_data.sndbuf) / 10;
+ } else if (gui_data.sndbuf > 1 * 50 && lastdir < 0) {
+ extrasamples--;
+ } else if (gui_data.sndbuf < -1 * 50 && lastdir > 0) {
+ extrasamples++;
+ } else {
+ lastdir = 0;
+ }
+
+ if (extrasamples > 99)
+ extrasamples = 99;
+ if (extrasamples < -99)
+ extrasamples = -99;
+#endif
+}
+
+uae_u8 *restore_audio (int nr, uae_u8 *src)
+{
+ struct audio_channel_data *acd = audio_channel + nr;
uae_u16 p;
- acd = audio_channel + i;
acd->state = restore_u8 ();
acd->vol = restore_u8 ();
acd->intreq2 = restore_u8 () ? true : false;
acd->wlen = restore_u16 ();
p = restore_u16 ();
acd->per = p ? p * CYCLE_UNIT : PERIOD_MAX;
- p = restore_u16 ();
+ acd->dat = acd->dat2 = restore_u16 ();
acd->lc = restore_u32 ();
acd->pt = restore_u32 ();
acd->evtime = restore_u32 ();
- last_cycles = get_cycles () - 1;
+ acd->dmaenstore = (dmacon & DMA_MASTER) && (dmacon & (1 << nr));
return src;
}
-
-uae_u8 *save_audio (int i, int *len, uae_u8 *dstptr)
+uae_u8 *save_audio (int nr, int *len, uae_u8 *dstptr)
{
- struct audio_channel_data *acd;
+ struct audio_channel_data *acd = audio_channel + nr;
uae_u8 *dst, *dstbak;
- uae_u16 p;
if (dstptr)
dstbak = dst = dstptr;
else
dstbak = dst = xmalloc (uae_u8, 100);
- acd = audio_channel + i;
- save_u8 ((uae_u8)acd->state);
+ save_u8 (acd->state);
save_u8 (acd->vol);
save_u8 (acd->intreq2);
save_u8 ((acd->dr ? 1 : 0) | (acd->dsr ? 2 : 0));
save_u16 (acd->len);
save_u16 (acd->wlen);
- p = acd->per == PERIOD_MAX ? 0 : acd->per / CYCLE_UNIT;
- save_u16 (p);
- save_u16 (acd->dat2);
+ save_u16 (acd->per == PERIOD_MAX ? 0 : acd->per / CYCLE_UNIT);
+ save_u16 (acd->dat);
save_u32 (acd->lc);
save_u32 (acd->pt);
save_u32 (acd->evtime);
*len = dst - dstbak;
return dstbak;
}
-
-void audio_vsync (void)
-{
-#if SOUNDSTUFF > 0
- int max, min;
- int vsync = isfullscreen () > 0 && currprefs.gfx_avsync;
- static int lastdir;
-
- if (!vsync) {
- extrasamples = 0;
- return;
- }
-
- min = -10 * 10;
- max = vsync ? 10 * 10 : 20 * 10;
- extrasamples = 0;
- if (gui_data.sndbuf < min) { // +1
- extrasamples = (min - gui_data.sndbuf) / 10;
- lastdir = 1;
- } else if (gui_data.sndbuf > max) { // -1
- extrasamples = (max - gui_data.sndbuf) / 10;
- } else if (gui_data.sndbuf > 1 * 50 && lastdir < 0) {
- extrasamples--;
- } else if (gui_data.sndbuf < -1 * 50 && lastdir > 0) {
- extrasamples++;
- } else {
- lastdir = 0;
- }
-
- if (extrasamples > 99)
- extrasamples = 99;
- if (extrasamples < -99)
- extrasamples = -99;
-#endif
-}
enum audenc { AUDENC_NONE, AUDENC_PCM, AUDENC_MP3, AUDENC_FLAC };
-#define AUDIO_STATUS_NOT_SUPPORTED 0x00
-#define AUDIO_STATUS_IN_PROGRESS 0x11
-#define AUDIO_STATUS_PAUSED 0x12
-#define AUDIO_STATUS_PLAY_COMPLETE 0x13
-#define AUDIO_STATUS_PLAY_ERROR 0x14
-#define AUDIO_STATUS_NO_STATUS 0x15
-
struct cdtoc
{
struct zfile *handle;
t->subhandle = zfile_dup (t->handle);
t->skipsize = SUB_CHANNEL_SIZE;
t->size -= SUB_CHANNEL_SIZE;
+ if ((t->ctrl & 0x0c) != 4)
+ t->enctype = AUDENC_PCM;
}
}
t->size = 2352;
t->offset = lba * t->size;
t->track = tracknum;
+ if ((control & 0x0c) != 4)
+ t->enctype = AUDENC_PCM;
if (zsub) {
t->subcode = 2;
t->subhandle = zfile_dup (zsub);
cdu->tracks = 0;
if (!img)
return 0;
- zcue = zfile_fopen (img, L"rb", ZFD_ARCHIVE | ZFD_CD);
+ zcue = zfile_fopen (img, L"rb", ZFD_ARCHIVE | ZFD_CD | ZFD_DELAYEDOPEN);
if (!zcue)
return 0;
return 1;
}
+static void cdaudiostop_do (void)
+{
+ if (unitnum < 0)
+ return;
+ sys_command_cd_pause (unitnum, 0);
+ sys_command_cd_stop (unitnum);
+}
+
static void cdaudiostop (void)
{
cd_finished = 0;
cd_playing = 0;
cd_paused = 0;
cd_motor = 0;
- if (unitnum < 0)
- return;
- sys_command_cd_pause (unitnum, 0);
- sys_command_cd_stop (unitnum);
+ write_comm_pipe_u32 (&requests, 0x0104, 1);
}
+
static void cdaudiostopfp (void)
{
- cdaudiostop ();
+ cdaudiostop_do ();
cd_audio_status = AUDIO_STATUS_NO_STATUS;
activate_stch = 1;
+ cd_finished = 0;
+ cd_playing = 0;
+ cd_paused = 0;
+ cd_motor = 0;
}
static int pause_audio (int pause)
end = last_cd_position;
play_end = end;
play_start = start;
+ last_play_pos = start;
+ last_play_end = end;
#ifdef CDTV_DEBUG
write_log (L"PLAY CD AUDIO from %06X (%d) to %06X (%d)\n",
lsn2msf (start), start, lsn2msf (end), end);
out[10] = (msflsn ? trackposmsf : trackposlsn) >> 8;
out[11] = (msflsn ? trackposmsf : trackposlsn) >> 0;
out[12] = 0;
+ if (cd_audio_status == AUDIO_STATUS_IN_PROGRESS)
+ last_play_pos = diskposlsn;
return 13;
}
sys_command_cd_pause (unitnum, 0);
break;
case 0x0104: // stop
- cdaudiostop ();
+ cdaudiostop_do ();
break;
case 0x0105: // pause
pause_audio (1);
bool cdtv_front_panel (int button)
{
- if (!frontpanel || !configured)
+ if (!frontpanel || configured <= 0)
return false;
if (button < 0)
return true;
{
static int subqcnt;
- if (!currprefs.cs_cdtvcd || !configured)
+ if (!currprefs.cs_cdtvcd || configured <= 0)
return;
cdtv_hsync++;
if (!cd_isready)
do_stch ();
}
- if (cd_playing)
- cd_led |= LED_CD_AUDIO;
- else
- cd_led &= ~LED_CD_AUDIO;
if (dmac_dma || dma_finished)
cd_led |= LED_CD_ACTIVE;
else
cd_led &= ~LED_CD_ACTIVE;
- if (cd_led)
+ if (cd_led && !cd_playing)
gui_flicker_led (LED_CD, 0, cd_led);
subqcnt--;
static void cdtv_reset (void)
{
write_log (L"CDTV: reset\n");
- cdaudiostop();
+ cdaudiostop ();
cd_playing = cd_paused = 0;
cd_motor = 0;
cd_media = 0;
#endif
addr &= 65535;
v = dmac_bget2 (addr);
- if (!configured)
+ if (configured <= 0)
return v;
return v;
}
if (addr == 0x48) {
map_banks (&dmac_bank, b, 0x10000 >> 16, 0x10000);
write_log (L"CDTV DMAC autoconfigured at %02X0000\n", b);
- configured = 1;
+ configured = b;
expamem_next ();
return;
}
if (addr == 0x4c) {
write_log (L"CDTV DMAC AUTOCONFIG SHUT-UP!\n");
- configured = 1;
+ configured = -1;
expamem_next ();
return;
}
- if (!configured)
+ if (configured <= 0)
return;
dmac_bput2 (addr, b);
}
unitnum = get_standard_cd_unit (CD_STANDARD_UNIT_CDTV);
sys_command_info (unitnum, &di, 0);
write_log (L"using drive %s (unit %d, media %d)\n", di.label, unitnum, di.media_inserted);
- /* make sure CD audio is not playing */
- cdaudiostop ();
}
static void ew (int addr, uae_u32 value)
if (thread_alive > 0) {
dmac_dma = 0;
dma_finished = 0;
- write_comm_pipe_u32 (&requests, 0x0104, 1);
+ cdaudiostop ();
write_comm_pipe_u32 (&requests, 0xffff, 1);
while (thread_alive > 0)
sleep_millis (10);
}
thread_alive = 0;
- cdaudiostop ();
if (unitnum >= 0)
sys_command_close (unitnum);
unitnum = -1;
+ uae_sem_destroy (&sub_sem);
configured = 0;
}
}
write_comm_pipe_u32 (&requests, 0x0104, 1);
- configured = 0;
- tp_a = tp_b = tp_c = tp_ad = tp_bd = tp_cd = 0;
- tp_imask = tp_cr = tp_air = tp_ilatch = 0;
- stch = 0;
- sten = 0;
- scor = 0;
- sbcp = 0;
cdrom_command_cnt_out = -1;
cmd = enable = xaen = dten = 0;
memset (dmacmemory, 0xff, 100);
uae_sem_init (&sub_sem, 0, 1);
-#ifdef ROMHACK2
- romhack();
-#endif
-
/* KS autoconfig handles the rest */
map_banks (&dmac_bank, 0xe80000 >> 16, 0x10000 >> 16, 0x10000);
+ if (!savestate_state) {
+ configured = 0;
+ tp_a = tp_b = tp_c = tp_ad = tp_bd = tp_cd = 0;
+ tp_imask = tp_cr = tp_air = tp_ilatch = 0;
+ stch = 0;
+ sten = 0;
+ scor = 0;
+ sbcp = 0;
+ }
+
cdtv_battram_reset ();
open_unit ();
}
+void cdtv_check_banks (void)
+{
+ if (configured > 0)
+ map_banks (&dmac_bank, configured, 0x10000 >> 16, 0x10000);
+}
+
#ifdef SAVESTATE
uae_u8 *save_dmac (int *len)
save_u32 (dmac_acr);
save_u16 (dmac_dawr);
save_u32 (dmac_dma ? 1 : 0);
+ save_u8 (configured);
*len = dst - dstbak;
return dstbak;
dmac_acr = restore_u32 ();
dmac_dawr = restore_u16 ();
restore_u32 ();
+ configured = restore_u8 ();
return src;
}
for (int i = 0; i < sizeof cdrom_command_input; i++)
save_u8 (cdrom_command_input[i]);
save_u8 (cdrom_command_cnt_in);
+ save_u16 (cdtv_sectorsize);
*len = dst - dstbak;
return dstbak;
for (int i = 0; i < sizeof cdrom_command_input; i++)
cdrom_command_input[i] = restore_u8 ();
cdrom_command_cnt_in = restore_u8 ();
+ cdtv_sectorsize = restore_u16 ();
return src;
}
return;
cdtv_init ();
get_toc ();
- write_comm_pipe_u32 (&requests, 0x0102, 1); // pause
- write_comm_pipe_u32 (&requests, 0x0104, 1); // stop
- write_comm_pipe_u32 (&requests, 0x0103, 1); // unpause
+ write_comm_pipe_u32 (&requests, 0x0104, 1);
if (cd_playing) {
write_comm_pipe_u32 (&requests, 0x0103, 1); // unpause
write_comm_pipe_u32 (&requests, 0x0110, 0); // play
NULL
};
static const TCHAR *cdmodes[] = { L"disabled", L"", L"image", L"ioctl", L"spti", L"aspi", 0 };
+static const TCHAR *cdconmodes[] = { L"", L"uae", L"ide", L"scsi", L"cdtv", L"cd32", 0 };
static const TCHAR *obsolete[] = {
L"accuracy", L"gfx_opengl", L"gfx_32bit_blits", L"32bit_blits",
xfree (p);
return p2;
}
- return target_expand_environment (file);
+ TCHAR *s = target_expand_environment (file);
+ if (s) {
+ TCHAR tmp[MAX_DPATH];
+ _tcscpy (tmp, s);
+ xfree (s);
+ fullpath (tmp, sizeof tmp / sizeof (TCHAR));
+ s = my_strdup (tmp);
+ }
+ return s;
}
static int isdefault (const TCHAR *s)
if (!_tcsicmp (option, tmp)) {
TCHAR *next = _tcsrchr (value, ',');
int type = SCSI_UNIT_DEFAULT;
+ int mode = 0;
+ int unitnum = 0;
if (next) {
*next++ = 0;
TCHAR *next2 = _tcschr (next, ':');
if (next2)
- *next2 = 0;
+ *next2++ = 0;
int tmpval = 0;
- if (cfgfile_intval (option, next, tmp, &type, 1))
+ type = match_string (cdmodes, next);
+ if (type < 0)
+ type = SCSI_UNIT_DEFAULT;
+ else
type--;
+ next = next2;
+ next2 = _tcschr (next, ':');
+ if (next2)
+ *next2++ = 0;
+ mode = match_string (cdconmodes, next);
+ if (mode < 0)
+ mode = 0;
+ next = next2;
+ next2 = _tcschr (next, ':');
+ if (next2)
+ *next2++ = 0;
+ cfgfile_intval (option, next, tmp, &unitnum, 1);
}
_tcsncpy (p->cdslots[i].name, value, sizeof p->cdslots[i].name);
p->cdslots[i].name[sizeof p->cdslots[i].name - 1] = 0;
}
}
empty_fs:
- if (root)
+ if (root) {
+ if (_tcslen (root) > 3 && root[0] == 'H' && root[1] == 'D' && root[2] == '_') {
+ root += 2;
+ *root = ':';
+ }
str = cfgfile_subst_path (UNEXPANDED, p->path_hardfile, root);
+ }
#ifdef FILESYS
add_filesys_config (p, -1, dname, aname, str, ro, secs, heads, reserved, bs, bp, fs, hdcv, 0);
#endif
- free (str);
+ xfree (str);
return 1;
invalid_fs:
#define SPR0_HPOS 0x15
#define MAX_SPRITES 8
#define SPRITE_COLLISIONS
-//#define SPEEDUP
+#define SPEEDUP
#define AUTOSCALE_SPRITES 1
#define SPRBORDER 0
hzc = 1;
if (beamcon0 != new_beamcon0) {
write_log (L"BEAMCON0 %04x -> %04x\n", beamcon0, new_beamcon0);
- vpos_count = 0;
+ vpos_count = vpos_count_prev = 0;
}
beamcon0 = new_beamcon0;
isntsc = (beamcon0 & 0x20) ? 0 : 1;
if (vpos_count < 10)
vpos_count = 10;
vblank_hz = (15600 + vpos_count - 1) / vpos_count;
- maxvpos_nom = vpos_count;
+ maxvpos_nom = vpos_count - (lof_current ? 1 : 0);
reset_drawing ();
}
if (beamcon0 & 0x80) {
vpos_count = p96refresh_active;
vtotal = vpos_count;
}
- if ((beamcon0 & (0x20 | 0x80)) != (new_beamcon0 & (0x20 | 0x80)) || (abs (vpos_count - vpos_count_prev) > 1))
+ if ((beamcon0 & (0x20 | 0x80)) != (new_beamcon0 & (0x20 | 0x80)) || (abs (vpos_count - vpos_count_prev) > 1))
init_hz ();
if (lof_changed)
compute_vsynctime ();
unset_special (~(SPCFLAG_BRK | SPCFLAG_MODE_CHANGE));
vpos = 0;
+ vpos_count = vpos_count_prev = 0;
inputdevice_reset ();
timehack_alive = 0;
diwstate = DIW_waiting_start;
set_cycles (0);
- vpos_count = vpos_count_prev = 0;
dmal = 0;
init_hz ();
vpos_lpen = -1;
time (&t);
today = localtime( &t );
- _tcsftime (tmp, sizeof (tmp) / sizeof (TCHAR), L"%Y", today);
+ _tcsftime (tmp, sizeof tmp / sizeof (TCHAR), L"%Y", today);
year = _tstoi (tmp);
- _tcsftime (tmp, sizeof (tmp) / sizeof (TCHAR), L"%j", today);
+ _tcsftime (tmp, sizeof tmp / sizeof (TCHAR), L"%j", today);
days = _tstoi (tmp) - 1;
- _tcsftime (tmp, sizeof (tmp) / sizeof (TCHAR), L"%H", today);
+ _tcsftime (tmp, sizeof tmp / sizeof (TCHAR), L"%H", today);
minutes = _tstoi (tmp) * 60;
- _tcsftime (tmp, sizeof (tmp) / sizeof (TCHAR), L"%M", today);
+ _tcsftime (tmp, sizeof tmp / sizeof (TCHAR), L"%M", today);
minutes += _tstoi (tmp);
- _tcsftime (tmp, sizeof (tmp) / sizeof (TCHAR), L"%S", today);
+ _tcsftime (tmp, sizeof tmp / sizeof (TCHAR), L"%S", today);
ticks = _tstoi (tmp) * 50;
while (year > 1978) {
if ( !(year % 100) ? !(year % 400) : !(year % 4) ) days++;
memset (sector, 0, FS_FLOPPY_BLOCKSIZE);
memcpy (sector, "DOS", 3);
if (bootable)
- memcpy (sector, bootblock, sizeof (bootblock));
+ memcpy (sector, bootblock, sizeof bootblock);
}
static void createrootblock (uae_u8 *sector, char *disk_name)
char *dirname1 = "s";
struct zfile *ss;
- memset (bitmap, 0, sizeof (bitmap));
+ memset (bitmap, 0, sizeof bitmap);
zfile_fseek (src, 0, SEEK_END);
exesize = zfile_ftell (src);
blocks = (exesize + blocksize - 1) / blocksize;
}
i--;
}
- fetch_saveimagepath (path, sizeof (path), 1);
+ fetch_saveimagepath (path, sizeof path / sizeof (TCHAR), 1);
_stprintf (name1, L"%s%s_save.adf", path, name2 + i);
return name1;
}
*needwritefile = 1;
return wrprot2;
}
- if (memcmp (exeheader, buffer, sizeof (exeheader)) == 0)
+ if (memcmp (exeheader, buffer, sizeof exeheader) == 0)
return 0;
if (wrprot1)
return wrprot2;
offs += tid->len;
}
- } else if (memcmp (exeheader, buffer, sizeof (exeheader)) == 0) {
+ } else if (memcmp (exeheader, buffer, sizeof exeheader) == 0) {
int i;
struct zfile *z = zfile_fopen_empty (NULL, L"", 512 * 1760);
createimagefromexe (drv->diskfile, z);
buf[3] = ti->type;
do_put_mem_long ((uae_u32 *) (buf + 4), ti->len);
do_put_mem_long ((uae_u32 *) (buf + 8), ti->bitlen);
- zfile_fwrite (buf, sizeof (buf), 1, diskfile);
+ zfile_fwrite (buf, sizeof buf, 1, diskfile);
if (ti->len > (len + 7) / 8) {
zerobuf = xmalloc (uae_u8, ti->len);
memset (zerobuf, 0, ti->len);
uae_u8 mark;
uae_u16 crc;
- memset (sectable, 0, sizeof (sectable));
+ memset (sectable, 0, sizeof sectable);
memcpy (mbuf + fwlen, mbuf, fwlen * sizeof (uae_u16));
mend -= 518;
secbuf[0] = secbuf[1] = secbuf[2] = 0xa1;
tmp[4] = 0; tmp[5] = 0; tmp[6]=(uae_u8)(l >> 8); tmp[7] = (uae_u8)l;
tmp[8] = 0; tmp[9] = 0; tmp[10] = 0; tmp[11] = 0;
for (i = 0; i < tracks; i++)
- zfile_fwrite (tmp, sizeof (tmp), 1, f);
+ zfile_fwrite (tmp, sizeof tmp, 1, f);
for (i = 0; i < tracks; i++)
zfile_fwrite (chunk, l, 1, f);
}
card_map[cardno++] = expamem_map_clear;
}
- if (cardno == 0)
+ if (cardno == 0 || savestate_state)
expamem_init_clear_zero ();
else
(*card_init[0]) ();
extern void cdtv_init (void);
extern void cdtv_free (void);
extern void CDTV_hsync_handler(void);
+extern void cdtv_check_banks (void);
extern void cdtv_entergui (void);
extern void cdtv_exitgui (void);
struct romdata *rd;
};
-extern struct romdata *getromdatabypath (TCHAR *path);
+extern struct romdata *getromdatabypath (const TCHAR *path);
extern struct romdata *getromdatabycrc (uae_u32 crc32);
extern struct romdata *getromdatabydata (uae_u8 *rom, int size);
extern struct romdata *getromdatabyid (int id);
extern struct romdata *getromdatabyidgroup (int id, int group, int subitem);
extern struct romdata *getromdatabyzfile (struct zfile *f);
extern struct romlist **getarcadiaroms (void);
-extern struct romdata *getarcadiarombyname (TCHAR *name);
-extern struct romlist **getromlistbyident (int ver, int rev, int subver, int subrev, TCHAR *model, int all);
-extern void getromname (struct romdata*, TCHAR*);
+extern struct romdata *getarcadiarombyname (const TCHAR *name);
+extern struct romlist **getromlistbyident (int ver, int rev, int subver, int subrev, const TCHAR *model, int all);
+extern void getromname (const struct romdata*, TCHAR*);
extern struct romdata *getromdatabyname (const TCHAR*);
-extern struct romlist *getromlistbyids (int *ids);
-extern void romwarning(int *ids);
-extern struct romlist *getromlistbyromdata (struct romdata *rd);
-extern void romlist_add (TCHAR *path, struct romdata *rd);
-extern TCHAR *romlist_get (struct romdata *rd);
+extern struct romlist *getromlistbyids (const int *ids);
+extern void romwarning(const int *ids);
+extern struct romlist *getromlistbyromdata (const struct romdata *rd);
+extern void romlist_add (const TCHAR *path, struct romdata *rd);
+extern TCHAR *romlist_get (const struct romdata *rd);
extern void romlist_clear (void);
extern struct zfile *read_rom (struct romdata **rd);
extern struct zfile *read_rom_name (const TCHAR *filename);
-extern int load_keyring (struct uae_prefs *p, TCHAR *path);
-extern uae_u8 *target_load_keyfile (struct uae_prefs *p, TCHAR *path, int *size, TCHAR *name);
+extern int load_keyring (struct uae_prefs *p, const TCHAR *path);
+extern uae_u8 *target_load_keyfile (struct uae_prefs *p, const TCHAR *path, int *size, TCHAR *name);
extern void free_keyring (void);
extern int get_keyring (void);
extern void kickstart_fix_checksum (uae_u8 *mem, int size);
extern struct zfile *rom_fopen (const TCHAR *name, const TCHAR *mode, int mask);
extern struct zfile *read_rom_name_guess (const TCHAR *filename);
extern void addkeydir (const TCHAR *path);
+extern void addkeyfile (const TCHAR *path);
extern int romlist_count (void);
extern struct romlist *romlist_getit (void);
-extern int configure_rom (struct uae_prefs *p, int *rom, int msg);
+extern int configure_rom (struct uae_prefs *p, const int *rom, int msg);
extern void target_run (void);
extern void target_quit (void);
extern bool get_plugin_path (TCHAR *out, int size, const TCHAR *path);
+extern void stripslashes (TCHAR *p);
+extern void fixtrailing (TCHAR *p);
+extern void fullpath (TCHAR *path, int size);
extern int quit_program;
extern bool console_emulation;
map_banks (&mbres_bank, 0xDE, 1, 0);
if (currprefs.cs_cd32c2p || currprefs.cs_cd32cd || currprefs.cs_cd32nvram)
map_banks (&akiko_bank, AKIKO_BASE >> 16, 1, 0);
+ if (currprefs.cs_cdtvcd)
+ cdtv_check_banks ();
if (currprefs.cs_mbdmac == 1)
a3000scsi_reset ();
struct device_info di;
uae_sem_t sub_sem, sub_sem2;
bool open;
+ bool usesptiread;
};
static struct dev_info_ioctl ciw32[MAX_TOTAL_SCSI_DEVICES];
extern void encode_l2 (uae_u8 *p, int address);
+static int read2048 (struct dev_info_ioctl *ciw, int sector)
+{
+ seterrormode (ciw);
+ if (SetFilePointer (ciw->h, sector * 2048, 0, FILE_BEGIN) == INVALID_SET_FILE_POINTER) {
+ reseterrormode (ciw);
+ return 0;
+ }
+ DWORD dtotal = 0;
+ ReadFile (ciw->h, ciw->tempbuffer, 2048, &dtotal, 0);
+ reseterrormode (ciw);
+ return dtotal;
+}
+
static int read_block (struct dev_info_ioctl *ciw, int unitnum, uae_u8 *data, int sector, int size, int sectorsize)
{
- int forcexp = 0;
- RAW_READ_INFO rri;
DWORD len;
uae_u8 *p = ciw->tempbuffer;
int ret;
- int xp = forcexp || (os_winxp && !os_vista) ? 1 : 0;
+ int origsize = size;
+ int origsector = sector;
+ uae_u8 *origdata = data;
+ bool got;
- if (!open_createfile (ciw, xp))
+retry:
+ if (!open_createfile (ciw, ciw->usesptiread ? 1 : 0))
return 0;
ret = 0;
while (size-- > 0) {
- seterrormode (ciw);
- rri.DiskOffset.QuadPart = sector * 2048;
- rri.SectorCount = 1;
- rri.TrackMode = (sectorsize > 2352 + 96) ? RawWithC2AndSubCode : RawWithSubCode;
- len = sectorsize;
- memset (p, 0, sectorsize);
- if (!forcexp && DeviceIoControl (ciw->h, IOCTL_CDROM_RAW_READ, &rri, sizeof rri, p, IOCTL_DATA_BUFFER, &len, NULL)) {
- reseterrormode (ciw);
- if (data) {
- if (sectorsize >= 2352) {
- memcpy (data, p, sectorsize);
+ got = false;
+ if (!ciw->usesptiread && (sectorsize == 2048 || sectorsize == 2352)) {
+ if (read2048 (ciw, sector) == 2048) {
+ if (sectorsize == 2352) {
+ memset (data, 0, 16);
+ memcpy (data + 16, p, 2048);
+ encode_l2 (data, sector + 150);
+ sector++;
data += sectorsize;
ret += sectorsize;
- } else {
- memcpy (data, p + 16, sectorsize);
+ } else if (sectorsize == 2048) {
+ memcpy (data, p, 2048);
+ sector++;
data += sectorsize;
ret += sectorsize;
}
+ ciw->cd_last_pos = sector;
+ got = true;
}
- ciw->cd_last_pos = sector;
- } else if (xp) {
+ }
+ if (!got && !ciw->usesptiread) {
+ RAW_READ_INFO rri;
+ rri.DiskOffset.QuadPart = sector * 2048;
+ rri.SectorCount = 1;
+ rri.TrackMode = (sectorsize > 2352 + 96) ? RawWithC2AndSubCode : RawWithSubCode;
+ len = sectorsize;
+ memset (p, 0, sectorsize);
+ seterrormode (ciw);
+ if (DeviceIoControl (ciw->h, IOCTL_CDROM_RAW_READ, &rri, sizeof rri, p, IOCTL_DATA_BUFFER, &len, NULL)) {
+ reseterrormode (ciw);
+ if (data) {
+ if (sectorsize >= 2352) {
+ memcpy (data, p, sectorsize);
+ data += sectorsize;
+ ret += sectorsize;
+ } else {
+ memcpy (data, p + 16, sectorsize);
+ data += sectorsize;
+ ret += sectorsize;
+ }
+ }
+ ciw->cd_last_pos = sector;
+ got = true;
+ } else {
+ reseterrormode (ciw);
+ DWORD err = GetLastError ();
+ write_log (L"IOCTL_CDROM_RAW_READ(%d,%d) failed, err=%d\n", sector, rri.TrackMode, err);
+ if ((err == ERROR_INVALID_FUNCTION || err == ERROR_INVALID_PARAMETER) && origsector == sector && origdata == data) {
+ write_log (L"-> fallback to SPTI mode\n");
+ ciw->usesptiread = true;
+ size = origsize;
+ goto retry;
+ }
+ }
+ }
+ if (!got) {
int len = spti_read (ciw, unitnum, data, sector, sectorsize);
if (len) {
if (data) {
}
}
ciw->cd_last_pos = sector;
+ got = true;
}
}
- if (!ret) {
- if (SetFilePointer (ciw->h, sector * 2048, 0, FILE_BEGIN) == INVALID_SET_FILE_POINTER) {
- reseterrormode (ciw);
- return ret;
- }
- DWORD dtotal = 0;
- ReadFile (ciw->h, p, 2048, &dtotal, 0);
- reseterrormode (ciw);
+ if (!got) {
+ int dtotal = read2048 (ciw, sector);
if (dtotal != 2048)
return ret;
if (sectorsize >= 2352) {
data += sectorsize;
ret += sectorsize;
}
+ got = true;
}
sector++;
}
int volume[2], volume_main;
int oldplay;
int firstloops;
+ int readblocksize = 2352 + 96;
for (i = 0; i < 2; i++) {
memset (&whdr[i], 0, sizeof (WAVEHDR));
Sleep (10);
oldplay = -1;
- p = xmalloc (uae_u8, 2 * num_sectors * CD_RAW_SECTOR_WITH_SUBCODE_SIZE);
+ p = xmalloc (uae_u8, 2 * num_sectors * readblocksize);
px[0] = p;
- px[1] = p + num_sectors * CD_RAW_SECTOR_WITH_SUBCODE_SIZE;
+ px[1] = p + num_sectors * readblocksize;
bufon[0] = bufon[1] = 0;
bufnum = 0;
buffered = 0;
cdda_pos = ciw->cdda_start;
oldplay = ciw->cdda_play;
firstloops = 25;
- write_log (L"IOCTL CDDA: playing from %d to %d\n", ciw->cdda_start, ciw->cdda_end);
+ write_log (L"IOCTL%s CDDA: playing from %d to %d\n",
+ ciw->usesptiread ? L"(SPTI)" : L"", ciw->cdda_start, ciw->cdda_end);
ciw->subcodevalid = false;
while (ciw->cdda_paused && ciw->cdda_play > 0) {
firstloops = -1;
ciw->subcodevalid = false;
memset (ciw->subcode, 0, sizeof ciw->subcode);
- memset (px[bufnum], 0, sectors * CD_RAW_SECTOR_WITH_SUBCODE_SIZE);
+ memset (px[bufnum], 0, sectors * readblocksize);
if (firstloops > 0) {
} else {
firstloops = -1;
- if (!read_block (ciw, -1, px[bufnum], cdda_pos, sectors, 2352 + 96)) {
+ if (!read_block (ciw, -1, px[bufnum], cdda_pos, sectors, readblocksize)) {
if (ciw->cdda_subfunc)
ciw->cdda_subfunc (ciw->subcode, sectors);
} else {
for (i = 0; i < sectors; i++) {
- memcpy (ciw->subcode + i * SUB_CHANNEL_SIZE, px[bufnum] + CD_RAW_SECTOR_WITH_SUBCODE_SIZE * i + 2352, SUB_CHANNEL_SIZE);
+ memcpy (ciw->subcode + i * SUB_CHANNEL_SIZE, px[bufnum] + readblocksize * i + 2352, SUB_CHANNEL_SIZE);
}
if (ciw->cdda_subfunc)
ciw->cdda_subfunc (ciw->subcode, sectors);
for (i = 1; i < sectors; i++) {
- memmove (px[bufnum] + 2352 * i, px[bufnum] + CD_RAW_SECTOR_WITH_SUBCODE_SIZE * i, 2352);
+ memmove (px[bufnum] + 2352 * i, px[bufnum] + readblocksize * i, 2352);
}
ciw->subcodevalid = true;
}
int isharddrive (const TCHAR *name)
{
int i;
-
for (i = 0; i < hdf_getnumharddrives (); i++) {
if (!_tcscmp (uae_drives[i].device_name, name))
return i;
hfd->handle = xcalloc (struct hardfilehandle, 1);
hfd->handle->h = INVALID_HANDLE_VALUE;
hfd_log (L"hfd open: '%s'\n", name);
- if (_tcslen (name) > 4 && !_tcsncmp (name, L"HD_", 3)) {
+ if (name[0] == ':') {
hdf_init_target ();
i = isharddrive (name);
if (i >= 0) {
udi->removablemedia = devDesc->RemovableMedia;
write_log (L"device id string: '%s'\n", udi->device_name);
if (ignoreduplicates) {
- _stprintf (orgname, L"HD_%s", udi->device_name);
+ _stprintf (orgname, L":%s", udi->device_name);
if (isharddrive (orgname) >= 0) {
write_log (L"duplicate device, ignored\n");
return 1;
udi->offset = pi->StartingOffset.QuadPart;
udi->size = pi->PartitionLength.QuadPart;
write_log (L"used\n");
- _stprintf (udi->device_name, L"HD_P#%d_%s", pi->PartitionNumber, orgname);
+ _stprintf (udi->device_name, L":P#%d_%s", pi->PartitionNumber, orgname);
udi->dangerous = -5;
udi++;
(*index2)++;
goto end;
}
amipartfound:
- _stprintf (udi->device_name, L"HD_%s", orgname);
+ _stprintf (udi->device_name, L":%s", orgname);
{
int cnt = 1;
int off = _tcslen (udi->device_name);
else
_stprintf (tmp, L"%.1fM", ((double)(uae_u32)(size / (1024))) / 1024.0);
}
- _stprintf (name, L"%10s [%s,%s] %s", dang, tmp, rw, uae_drives[index].device_name + 3);
+ _stprintf (name, L"%10s [%s,%s] %s", dang, tmp, rw, uae_drives[index].device_name + 1);
return name;
}
if (flags & 2)
if (scancode_new == currprefs.win32_guikey && scancode_new != DIK_F12)
scancode = scancode_new;
- //write_log ( "keyboard = %d scancode = 0x%02x state = %d\n", keyboard, scancode, newstate );
+ //write_log (L"keyboard = %d scancode = 0x%02x state = %d\n", keyboard, scancode, newstate );
+
+ if (newstate == 0 && code == 0) {
+ switch (scancode)
+ {
+ case DIK_SYSRQ:
+ screenshot (specialpressed () ? 1 : 0, 1);
+ break;
+ }
+ }
+
+
if (newstate && code == 0) {
if (scancode == DIK_F12 || scancode == currprefs.win32_guikey) {
code = AKS_STATESAVEQUICK + v * 2 + ((shiftpressed () || ctrlpressed ()) ? 0 : 1);
}
break;
- case DIK_SYSRQ:
- screenshot (specialpressed () ? 1 : 0, 1);
- break;
case DIK_PAUSE:
if (specialpressed ()) {
if (shiftpressed ())
p++;
w--;
}
- v |= v << 32;
+ uae_u64 vv = v | (v << 32);
while (w >= 2 * 8) {
- *((uae_u64*)p) ^= v;
+ *((uae_u64*)p) ^= vv;
p += 8;
- *((uae_u64*)p) ^= v;
+ *((uae_u64*)p) ^= vv;
p += 8;
w -= 2 * 8;
}
#define IDS_PRI_LOW 187
#define IDI_FOLDER 188
#define IDS_OLDRTGLIBRARY 188
-#define IDS_DEFAULT_AF2005 189
#define IDI_DISPLAY 190
#define IDS_DEFAULT_AF 190
#define IDS_DEFAULT_WINUAE 191
#define IDC_RTG_24BIT 1789
#define IDC_ASSOCIATELIST 1789
#define IDC_PORT_TABLET 1789
+#define IDC_PATHS_CONFIGCACHE2 1789
+#define IDC_PATHS_RELATIVE 1789
#define IDC_RTG_32BIT 1790
#define IDC_ASSOCIATE_OFF 1790
#define IDC_PORT_TABLET_FULL 1790
CONTROL "Vertical Sync",IDC_CS_CIAA_TOD1,"Button",BS_AUTORADIOBUTTON | WS_GROUP | WS_TABSTOP,19,68,63,10\r
CONTROL "Power Supply 50Hz",IDC_CS_CIAA_TOD2,"Button",BS_AUTORADIOBUTTON | WS_TABSTOP,90,68,85,10\r
CONTROL "Power Supply 60Hz",IDC_CS_CIAA_TOD3,"Button",BS_AUTORADIOBUTTON | WS_TABSTOP,186,68,88,10\r
- CONTROL "ROM Mirror (A8)",IDC_CS_KSMIRROR_A8,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,94,146,80,10\r
+ CONTROL "ROM Mirror (A8)",IDC_CS_KSMIRROR_A8,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,94,146,86,10\r
CONTROL "A1000 Boot RAM/ROM",IDC_CS_A1000RAM,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,94,95,88,10\r
CONTROL "CD32 CD",IDC_CS_CD32CD,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,14,108,76,10\r
CONTROL "CD32 C2P",IDC_CS_CD32C2P,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,94,108,87,10\r
- CONTROL "CD32 NVRAM",IDC_CS_CD32NVRAM,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,187,108,84,10\r
- CONTROL "CDTV CD",IDC_CS_CDTVCD,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,14,121,47,10\r
+ CONTROL "CD32 NVRAM",IDC_CS_CD32NVRAM,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,187,108,97,10\r
+ CONTROL "CDTV CD",IDC_CS_CDTVCD,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,14,121,76,10\r
CONTROL "CDTV SRAM",IDC_CS_CDTVRAM,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,94,120,87,10\r
- CONTROL "CDTV SRAM Expansion",IDC_CS_CDTVRAMEXP,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,187,120,90,10\r
- CONTROL "A600/A1200 IDE",IDC_CS_IDE1,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,14,133,79,10\r
+ CONTROL "CDTV SRAM Expansion",IDC_CS_CDTVRAMEXP,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,187,120,102,10\r
+ CONTROL "A600/A1200 IDE",IDC_CS_IDE1,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,14,133,77,10\r
CONTROL "A4000/A4000T IDE",IDC_CS_IDE2,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,94,133,88,10\r
CONTROL "Ramsey revision:",IDC_CS_RAMSEY,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,14,216,71,10\r
EDITTEXT IDC_CS_RAMSEYREV,91,214,45,13,ES_AUTOHSCROLL\r
EDITTEXT IDC_CS_FATGARYREV,91,228,45,13,ES_AUTOHSCROLL\r
CONTROL "A3000 SCSI",IDC_CS_DMAC,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,94,188,76,10\r
CONTROL "Compatible Settings",IDC_CS_COMPATIBLE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,14,8,234,10\r
- CONTROL "DF0: ID Hardware",IDC_CS_DF0IDHW,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,187,95,92,10\r
+ CONTROL "DF0: ID Hardware",IDC_CS_DF0IDHW,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,187,95,101,10\r
CONTROL "Agnus/Alice revision:",IDC_CS_AGNUS,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,147,216,81,10\r
EDITTEXT IDC_CS_AGNUSREV,232,214,45,13,ES_AUTOHSCROLL\r
CONTROL "Denise/Lisa revision:",IDC_CS_DENISE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,147,229,81,10\r
EDITTEXT IDC_CS_DENISEREV,232,228,45,13,ES_AUTOHSCROLL\r
CONTROL "A590/A2091 SCSI",IDC_CS_A2091,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,14,188,76,10\r
- CONTROL "A4000T SCSI",IDC_CS_DMAC2,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,187,188,88,10\r
+ CONTROL "A4000T SCSI",IDC_CS_DMAC2,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,187,188,100,10\r
LTEXT "A4091/A4000T SCSI not yet implemented.",IDC_STATIC,17,174,159,8,SS_CENTERIMAGE\r
- CONTROL "PCMCIA",IDC_CS_PCMCIA,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,187,133,92,10\r
+ CONTROL "PCMCIA",IDC_CS_PCMCIA,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,187,133,105,10\r
CONTROL "A4091 SCSI",IDC_CS_A4091,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,14,200,76,10\r
CONTROL "CDTV SCSI",IDC_CS_CDTVSCSI,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,94,200,76,10\r
- CONTROL "Include host SCSI devices",IDC_CS_SCSIMODE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,187,200,101,10\r
- CONTROL "C00000 is Fast RAM",IDC_CS_SLOWISFAST,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,187,146,92,10\r
- CONTROL "ROM Mirror (E0)",IDC_CS_KSMIRROR_E0,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,14,146,80,10\r
- CONTROL "CIA ROM Overlay",IDC_CS_CIAOVERLAY,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,14,95,80,10\r
- CONTROL "KB Reset Warning",IDC_CS_RESETWARNING,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,14,159,80,10\r
- CONTROL "No-EHB Denise",IDC_CS_NOEHB,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,94,159,80,10\r
- CONTROL "A1000 Agnus (8361)",IDC_CS_DIPAGNUS,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,187,159,94,10\r
+ CONTROL "Include host SCSI devices",IDC_CS_SCSIMODE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,187,200,104,10\r
+ CONTROL "C00000 is Fast RAM",IDC_CS_SLOWISFAST,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,187,146,105,10\r
+ CONTROL "ROM Mirror (E0)",IDC_CS_KSMIRROR_E0,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,14,146,76,10\r
+ CONTROL "CIA ROM Overlay",IDC_CS_CIAOVERLAY,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,14,95,75,10\r
+ CONTROL "KB Reset Warning",IDC_CS_RESETWARNING,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,14,159,77,10\r
+ CONTROL "No-EHB Denise",IDC_CS_NOEHB,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,94,159,87,10\r
+ CONTROL "A1000 Agnus (8361/8367)",IDC_CS_DIPAGNUS,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,187,159,107,10\r
END\r
\r
IDD_AVIOUTPUT DIALOGEX 0, 0, 288, 217\r
LTEXT "Rips:",IDC_PATHS_RIPSL,13,168,261,8,SS_CENTERIMAGE\r
EDITTEXT IDC_PATHS_RIP,13,178,261,15,ES_AUTOHSCROLL\r
PUSHBUTTON "...",IDC_PATHS_RIPS,280,178,11,15\r
+ CONTROL "Use relative paths",IDC_PATHS_RELATIVE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,113,230,161,10\r
END\r
\r
IDD_QUICKSTART DIALOGEX 0, 0, 300, 242\r
BEGIN\r
END\r
\r
+ IDD_CHIPSET2, DIALOG\r
+ BEGIN\r
+ END\r
+\r
IDD_INPUT, DIALOG\r
BEGIN\r
END\r
IDS_PRI_BELOWNORMAL "Below Normal"\r
IDS_PRI_LOW "Low"\r
IDS_OLDRTGLIBRARY "The installed LIBS:Picasso96/rtg.library (%d.%d) should be updated.\nA newer version is included in the ""Amiga Programs"" directory\n of the WinUAE distribution archive.\n\nNewer library version fixes graphics problems and increases performance."\r
- IDS_DEFAULT_AF2005 "Amiga Forever 2005+"\r
IDS_DEFAULT_AF "Amiga Forever"\r
IDS_DEFAULT_WINUAE "WinUAE default (old)"\r
END\r
return 1;
oops:
- screenshot_free();
+ screenshot_free ();
return 0;
}
}
#endif
-static int savebmp(FILE *fp)
+static int savebmp (FILE *fp)
{
BITMAPFILEHEADER bfh;
// write the file header, bitmap information and pixel data
lines += 1.0;
hpos = maxhpos_short;
}
-#if 0
- write_log (L"%d.%d %d.%d\n",
- maxhpos_short, linetoggle ? 5 : 0,
- maxvpos_nom + (lines == 1.0 ? 1 : 0), lines > 0 && lines < 1 ? 5 : 0);
-#endif
lines += maxvpos_nom;
scaled_sample_evtime_orig = hpos * lines * freq * CYCLE_UNIT / (float)sdp->obtainedfreq;
scaled_sample_evtime = scaled_sample_evtime_orig;
sampler_evtime = hpos * lines * freq * CYCLE_UNIT;
+#if 0
+ lines -= maxvpos_nom;
+ write_log (L"%d.%d %d.%d %.2f\n",
+ maxhpos_short, linetoggle ? 5 : 0,
+ maxvpos_nom + (lines == 1.0 ? 1 : 0), lines > 0 && lines < 1 ? 5 : 0,
+ scaled_sample_evtime);
+#endif
}
static void clearbuffer_ds (struct sound_data *sd)
return ok == 2;
}
-static void mcierr (TCHAR *str, DWORD err)
+static void mcierr (const TCHAR *str, DWORD err)
{
TCHAR es[1000];
if (err == MMSYSERR_NOERROR)
TCHAR VersionStr[256];
TCHAR BetaStr[64];
-extern int path_type;
+extern pathtype path_type;
int in_sizemove;
int manual_painting_needed;
TCHAR start_path_data[MAX_DPATH];
TCHAR start_path_exe[MAX_DPATH];
TCHAR start_path_plugins[MAX_DPATH];
-TCHAR start_path_af[MAX_DPATH]; /* OLD AF */
TCHAR start_path_new1[MAX_DPATH]; /* AF2005 */
TCHAR start_path_new2[MAX_DPATH]; /* AMIGAFOREVERDATA */
TCHAR help_file[MAX_DPATH];
-int af_path_2005, af_path_old;
-int quickstart = 1, configurationcache = 1;
+int af_path_2005;
+int quickstart = 1, configurationcache = 1, relativepaths = 0;
static int multi_display = 1;
static TCHAR *inipath = NULL;
void logging_init (void)
{
+#ifndef _WIN64
LPFN_ISWOW64PROCESS fnIsWow64Process;
+#endif
int wow64 = 0;
static int started;
static int first;
L"\nEnd+F1 changes floppy 0, End+F2 changes floppy 1, etc."
L"\n");
tmp[0] = 0;
- GetModuleFileName (NULL, tmp, sizeof (tmp) / sizeof (TCHAR));
+ GetModuleFileName (NULL, tmp, sizeof tmp / sizeof (TCHAR));
write_log (L"'%s'\n", tmp);
write_log (L"EXE: '%s', DATA: '%s', PLUGIN: '%s'\n", start_path_exe, start_path_data, start_path_plugins);
regstatus ();
return dst;
}
-static void strip_slashes (TCHAR *p)
+void stripslashes (TCHAR *p)
{
while (_tcslen (p) > 0 && (p[_tcslen (p) - 1] == '\\' || p[_tcslen (p) - 1] == '/'))
p[_tcslen (p) - 1] = 0;
}
-static void fixtrailing (TCHAR *p)
+void fixtrailing (TCHAR *p)
{
if (_tcslen(p) == 0)
return;
return;
_tcscat(p, L"\\");
}
+// convert path to absolute or relative
+void fullpath (TCHAR *path, int size)
+{
+ if (path[0] == 0 || (path[0] == '\\' && path[1] == '\\') || path[0] == ':')
+ return;
+ if (relativepaths) {
+ TCHAR tmp1[MAX_DPATH], tmp2[MAX_DPATH];
+ tmp1[0] = 0;
+ GetCurrentDirectory (sizeof tmp1 / sizeof (TCHAR), tmp1);
+ fixtrailing (tmp1);
+ tmp2[0] = 0;
+ int ret = GetFullPathName (path, sizeof tmp2 / sizeof (TCHAR), tmp2, NULL);
+ if (ret == 0 || ret >= sizeof tmp2 / sizeof (TCHAR))
+ return;
+ if (_tcsnicmp (tmp1, tmp2, _tcslen (tmp1)) == 0) { // tmp2 is inside tmp1
+ _tcscpy (path, L".\\");
+ _tcscat (path, tmp2 + _tcslen (tmp1));
+ } else {
+ _tcscpy (path, tmp2);
+ }
+ } else {
+ TCHAR tmp[MAX_DPATH];
+ _tcscpy (tmp, path);
+ GetFullPathName (tmp, size, path, NULL);
+ }
+}
typedef DWORD (STDAPICALLTYPE *PFN_GetKey)(LPVOID lpvBuffer, DWORD dwSize);
-uae_u8 *target_load_keyfile (struct uae_prefs *p, TCHAR *path, int *sizep, TCHAR *name)
+uae_u8 *target_load_keyfile (struct uae_prefs *p, const TCHAR *path, int *sizep, TCHAR *name)
{
uae_u8 *keybuf = NULL;
HMODULE h;
void fetch_saveimagepath (TCHAR *out, int size, int dir)
{
- assert (size > MAX_DPATH);
fetch_path (L"SaveimagePath", out, size);
if (dir) {
out[_tcslen (out) - 1] = 0;
fetch_path (NULL, out, size);
}
-static int isfilesindir (TCHAR *p)
+static int isfilesindir (const TCHAR *p)
{
WIN32_FIND_DATA fd;
HANDLE h;
return 0;
}
-void fetch_path (TCHAR *name, TCHAR *out, int size)
+void fetch_path (const TCHAR *name, TCHAR *out, int size)
{
int size2 = size;
_tcscpy (out, start_path_data);
- if (!name)
+ if (!name) {
+ fullpath (out, size);
return;
+ }
if (!_tcscmp (name, L"FloppyPath"))
_tcscat (out, L"..\\shared\\adf\\");
if (!_tcscmp (name, L"CDPath"))
regquerystr (NULL, name, out, &size);
if (GetFileAttributes (out) == INVALID_FILE_ATTRIBUTES)
_tcscpy (out, start_path_data);
+#if 0
if (out[0] == '\\' && (_tcslen (out) >= 2 && out[1] != '\\')) { /* relative? */
_tcscpy (out, start_path_data);
if (start_data >= 0) {
regquerystr (NULL, name, out, &size2);
}
}
- strip_slashes (out);
+#endif
+ stripslashes (out);
if (!_tcscmp (name, L"KickstartPath")) {
DWORD v = GetFileAttributes (out);
if (v == INVALID_FILE_ATTRIBUTES || !(v & FILE_ATTRIBUTE_DIRECTORY))
_tcscpy (out, start_path_data);
}
fixtrailing (out);
+ fullpath (out, size);
}
-int get_rom_path (TCHAR *out, int mode)
+int get_rom_path (TCHAR *out, pathtype mode)
{
TCHAR tmp[MAX_DPATH];
tmp[0] = 0;
switch (mode)
{
- case 0:
+ case PATH_TYPE_DEFAULT:
{
if (!_tcscmp (start_path_data, start_path_exe))
_tcscpy (tmp, L".\\");
} else {
_tcscpy (tmp2, tmp);
_tcscpy (tmp2, L"roms");
- if (GetFileAttributes (tmp2) != INVALID_FILE_ATTRIBUTES)
+ if (GetFileAttributes (tmp2) != INVALID_FILE_ATTRIBUTES) {
_tcscpy (tmp, tmp2);
+ } else {
+ if (!get_rom_path (tmp, PATH_TYPE_NEWAF)) {
+ if (!get_rom_path (tmp, PATH_TYPE_AMIGAFOREVERDATA)) {
+ _tcscpy (tmp, start_path_data);
+ }
+ }
+ }
}
}
}
break;
- case 1:
+ case PATH_TYPE_NEWAF:
{
TCHAR tmp2[MAX_DPATH];
_tcscpy (tmp2, start_path_new1);
_tcscat (tmp2, L"..\\system\\rom");
- if (isfilesindir (tmp2))
+ if (isfilesindir (tmp2)) {
+ _tcscpy (tmp, tmp2);
+ break;
+ }
+ _tcscpy (tmp2, start_path_new1);
+ _tcscat (tmp2, L"..\\shared\\rom");
+ if (isfilesindir (tmp2)) {
_tcscpy (tmp, tmp2);
+ break;
+ }
}
break;
- case 2:
+ case PATH_TYPE_AMIGAFOREVERDATA:
{
TCHAR tmp2[MAX_DPATH];
_tcscpy (tmp2, start_path_new2);
_tcscat (tmp2, L"system\\rom");
- if (isfilesindir (tmp2))
+ if (isfilesindir (tmp2)) {
_tcscpy (tmp, tmp2);
- }
- break;
- case 3:
- {
- TCHAR tmp2[MAX_DPATH];
- _tcscpy (tmp2, start_path_af);
- _tcscat (tmp2, L"..\\shared\\rom");
- if (isfilesindir (tmp2))
+ break;
+ }
+ _tcscpy (tmp2, start_path_new2);
+ _tcscat (tmp2, L"shared\\rom");
+ if (isfilesindir (tmp2)) {
_tcscpy (tmp, tmp2);
+ break;
+ }
}
break;
default:
_tcscpy (out, tmp);
fixtrailing (out);
}
+ if (out[0]) {
+ fullpath (out, MAX_DPATH);
+ }
return out[0] ? 1 : 0;
}
-
-
-void set_path (TCHAR *name, TCHAR *path)
+void set_path (const TCHAR *name, TCHAR *path, pathtype mode)
{
TCHAR tmp[MAX_DPATH];
} else {
_tcscpy (tmp, path);
}
- strip_slashes (tmp);
+ stripslashes (tmp);
if (!_tcscmp (name, L"KickstartPath")) {
DWORD v = GetFileAttributes (tmp);
if (v == INVALID_FILE_ATTRIBUTES || !(v & FILE_ATTRIBUTE_DIRECTORY))
- get_rom_path (tmp, 0);
- if ((af_path_2005 & 1) && path_type == PATH_TYPE_NEWAF) {
- get_rom_path (tmp, 1);
- } else if ((af_path_2005 & 2) && path_type == PATH_TYPE_AMIGAFOREVERDATA) {
- get_rom_path (tmp, 2);
- } else if (af_path_old && path_type == PATH_TYPE_OLDAF) {
- get_rom_path (tmp, 3);
+ get_rom_path (tmp, PATH_TYPE_DEFAULT);
+ if (mode == PATH_TYPE_NEWAF) {
+ get_rom_path (tmp, PATH_TYPE_NEWAF);
+ } else if (mode == PATH_TYPE_AMIGAFOREVERDATA) {
+ get_rom_path (tmp, PATH_TYPE_AMIGAFOREVERDATA);
}
}
fixtrailing (tmp);
+ fullpath (tmp, sizeof tmp / sizeof (TCHAR));
regsetstr (NULL, name, tmp);
}
+void set_path (const TCHAR *name, TCHAR *path)
+{
+ set_path (name, path, PATH_TYPE_DEFAULT);
+}
-static void initpath (TCHAR *name, TCHAR *path)
+static void initpath (const TCHAR *name, TCHAR *path)
{
if (regexists (NULL, name))
return;
set_path (name, NULL);
}
-static void romlist_add2 (TCHAR *path, struct romdata *rd)
+static void romlist_add2 (const TCHAR *path, struct romdata *rd)
{
if (getregmode ()) {
int ok = 0;
struct assext exts[] = {
// { L".cue", L"-cdimage=\"%1\" -s use_gui=no", L"WinUAE CD image", IDI_DISKIMAGE, cc_cd },
// { L".iso", L"-cdimage=\"%1\" -s use_gui=no", L"WinUAE CD image", IDI_DISKIMAGE, cc_cd },
+// { L".ccd", L"-cdimage=\"%1\" -s use_gui=no", L"WinUAE CD image", IDI_DISKIMAGE, cc_cd },
{ L".uae", L"-f \"%1\"", L"WinUAE configuration file", IDI_CONFIGFILE, NULL },
{ L".adf", L"-0 \"%1\" -s use_gui=no", L"WinUAE floppy disk image", IDI_DISKIMAGE, cc_disk },
{ L".adz", L"-0 \"%1\" -s use_gui=no", L"WinUAE floppy disk image", IDI_DISKIMAGE, cc_disk },
if (shell_associate_is (exts[i].ext))
exts[i].enabled = 1;
}
- if (rp_param)
+ if (rp_param || inipath)
return;
// associate .uae by default when running for the first time
if (!regexiststree (NULL, L"FileAssociations")) {
regqueryint (NULL, L"ConfigurationCache", &configurationcache);
else
regsetint (NULL, L"ConfigurationCache", configurationcache);
+ if (regexists (NULL, L"RelativePaths"))
+ regqueryint (NULL, L"RelativePaths", &relativepaths);
+ else
+ regsetint (NULL, L"RelativePaths", relativepaths);
regqueryint (NULL, L"QuickStartMode", &quickstart);
reopen_console ();
fetch_path (L"ConfigurationPath", path, sizeof (path) / sizeof (TCHAR));
return false;
}
+void setpathmode (pathtype pt)
+{
+ TCHAR pathmode[32] = { 0 };
+ if (pt == PATH_TYPE_WINUAE)
+ _tcscpy (pathmode, L"WinUAE");
+ if (pt == PATH_TYPE_NEWWINUAE)
+ _tcscpy (pathmode, L"WinUAE_2");
+ if (pt == PATH_TYPE_NEWAF)
+ _tcscpy (pathmode, L"AmigaForever");
+ if (pt == PATH_TYPE_AMIGAFOREVERDATA)
+ _tcscpy (pathmode, L"AMIGAFOREVERDATA");
+ regsetstr (NULL, L"PathMode", pathmode);
+}
+
static void getstartpaths (void)
{
TCHAR *posn, *p;
TCHAR xstart_path_uae[MAX_DPATH], xstart_path_old[MAX_DPATH];
TCHAR xstart_path_new1[MAX_DPATH], xstart_path_new2[MAX_DPATH];
- path_type = -1;
+ path_type = PATH_TYPE_DEFAULT;
prevpath[0] = 0;
xstart_path_uae[0] = xstart_path_old[0] = xstart_path_new1[0] = xstart_path_new2[0] = 0;
key = regcreatetree (NULL, NULL);
path_type = PATH_TYPE_WINUAE;
if (!_tcscmp (prevpath, L"WinUAE_2"))
path_type = PATH_TYPE_NEWWINUAE;
- if (!_tcscmp (prevpath, L"AF"))
- path_type = PATH_TYPE_OLDAF;
- if (!_tcscmp (prevpath, L"AF2005"))
+ if (!_tcscmp (prevpath, L"AF2005") || !_tcscmp (prevpath, L"AmigaForever"))
path_type = PATH_TYPE_NEWAF;
if (!_tcscmp (prevpath, L"AMIGAFOREVERDATA"))
path_type = PATH_TYPE_AMIGAFOREVERDATA;
if((posn = _tcsrchr (start_path_exe, '\\')))
posn[1] = 0;
- if (path_type < 0 && start_data == 0 && key) {
+ if (path_type == PATH_TYPE_DEFAULT && inipath) {
+ path_type = PATH_TYPE_WINUAE;
+ _tcscpy (xstart_path_uae, start_path_exe);
+ relativepaths = 1;
+ } else if (path_type == PATH_TYPE_DEFAULT && start_data == 0 && key) {
bool ispath = false;
_tcscpy (tmp2, start_path_exe);
_tcscat (tmp2, L"configurations\\configuration.cache");
_tcscpy (xstart_path_uae, start_path_exe);
}
- _tcscpy (tmp, start_path_exe);
- _tcscat (tmp, L"..\\system\\rom\\rom.key");
- v = GetFileAttributes (tmp);
- if (v != INVALID_FILE_ATTRIBUTES) {
- af_path_old = 1;
- _tcscpy (xstart_path_old, start_path_exe);
- _tcscat (xstart_path_old, L"..\\system\\");
- _tcscpy (start_path_af, xstart_path_old);
- } else {
- _tcscpy (tmp, start_path_exe);
- _tcscat (tmp, L"..\\shared\\rom\\rom.key");
- v = GetFileAttributes (tmp);
- if (v != INVALID_FILE_ATTRIBUTES) {
- af_path_old = 1;
- _tcscpy (xstart_path_old, start_path_exe);
- _tcscat (xstart_path_old, L"..\\shared\\");
- _tcscpy (start_path_af, xstart_path_old);
- }
- }
-
p = _wgetenv (L"AMIGAFOREVERDATA");
if (p) {
_tcscpy (tmp, p);
fixtrailing (tmp);
_tcscpy (start_path_new2, p);
- fixtrailing (start_path_af);
v = GetFileAttributes (tmp);
if (v != INVALID_FILE_ATTRIBUTES && (v & FILE_ATTRIBUTE_DIRECTORY)) {
- _tcscpy (xstart_path_new2, start_path_af);
+ _tcscpy (xstart_path_new2, start_path_new2);
_tcscpy (xstart_path_new2, L"WinUAE\\");
af_path_2005 |= 2;
}
}
- {
- if (SUCCEEDED (SHGetFolderPath (NULL, CSIDL_COMMON_DOCUMENTS, NULL, SHGFP_TYPE_CURRENT, tmp))) {
- fixtrailing (tmp);
- _tcscpy (tmp2, tmp);
- _tcscat (tmp2, L"Amiga Files\\");
- _tcscpy (tmp, tmp2);
- _tcscat (tmp, L"WinUAE");
- v = GetFileAttributes (tmp);
- if (v != INVALID_FILE_ATTRIBUTES && (v & FILE_ATTRIBUTE_DIRECTORY)) {
- TCHAR *p;
- _tcscpy (xstart_path_new1, tmp2);
- _tcscat (xstart_path_new1, L"WinUAE\\");
- _tcscpy (xstart_path_uae, start_path_exe);
- _tcscpy (start_path_new1, xstart_path_new1);
- p = tmp2 + _tcslen (tmp2);
- _tcscpy (p, L"System");
+ if (SUCCEEDED (SHGetFolderPath (NULL, CSIDL_COMMON_DOCUMENTS, NULL, SHGFP_TYPE_CURRENT, tmp))) {
+ fixtrailing (tmp);
+ _tcscpy (tmp2, tmp);
+ _tcscat (tmp2, L"Amiga Files\\");
+ _tcscpy (tmp, tmp2);
+ _tcscat (tmp, L"WinUAE");
+ v = GetFileAttributes (tmp);
+ if (v != INVALID_FILE_ATTRIBUTES && (v & FILE_ATTRIBUTE_DIRECTORY)) {
+ TCHAR *p;
+ _tcscpy (xstart_path_new1, tmp2);
+ _tcscat (xstart_path_new1, L"WinUAE\\");
+ _tcscpy (xstart_path_uae, start_path_exe);
+ _tcscpy (start_path_new1, xstart_path_new1);
+ p = tmp2 + _tcslen (tmp2);
+ _tcscpy (p, L"System");
+ if (isfilesindir (tmp2)) {
+ af_path_2005 |= 1;
+ } else {
+ _tcscpy (p, L"Shared");
if (isfilesindir (tmp2)) {
af_path_2005 |= 1;
- } else {
- _tcscpy (p, L"Shared");
- if (isfilesindir (tmp2)) {
- af_path_2005 |= 1;
- }
}
}
}
if (start_data == 0) {
start_data = 1;
- if (path_type == 0 && xstart_path_uae[0]) {
+ if (path_type == PATH_TYPE_WINUAE && xstart_path_uae[0]) {
_tcscpy (start_path_data, xstart_path_uae);
- } else if (path_type == PATH_TYPE_OLDAF && af_path_old && xstart_path_old[0]) {
- _tcscpy (start_path_data, xstart_path_old);
} else if (path_type == PATH_TYPE_NEWWINUAE && xstart_path_new1[0]) {
_tcscpy (start_path_data, xstart_path_new1);
create_afnewdir (0);
create_afnewdir (0);
} else if (path_type == PATH_TYPE_AMIGAFOREVERDATA && (af_path_2005 & 2) && xstart_path_new2[0]) {
_tcscpy (start_path_data, xstart_path_new2);
- } else if (path_type < 0) {
- path_type = 0;
+ } else if (path_type == PATH_TYPE_DEFAULT) {
_tcscpy (start_path_data, xstart_path_uae);
- if (af_path_old) {
- path_type = PATH_TYPE_OLDAF;
- _tcscpy (start_path_data, xstart_path_old);
- }
if (af_path_2005 & 1) {
path_type = PATH_TYPE_NEWAF;
create_afnewdir (1);
_tcscpy (start_path_data, start_path_exe);
}
fixtrailing (start_path_data);
- GetFullPathName (start_path_data, sizeof tmp / sizeof (TCHAR), tmp, NULL);
- _tcscpy (start_path_data, tmp);
+ fullpath (start_path_data, sizeof start_path_data / sizeof (TCHAR));
SetCurrentDirectory (start_path_data);
if (!start_path_plugins[0]) {
}
}
fixtrailing (start_path_plugins);
- GetFullPathName (start_path_plugins, sizeof tmp / sizeof (TCHAR), tmp, NULL);
- _tcscpy (start_path_plugins, tmp);
+ fullpath (start_path_plugins, sizeof start_path_plugins / sizeof (TCHAR));
+ setpathmode (path_type);
+
}
extern void test (void);
}
}
-static int parseargs (const TCHAR *arg, const TCHAR *np, const TCHAR *np2)
+static TCHAR *getdefaultini (void)
+{
+ FILE *f;
+ TCHAR path[MAX_DPATH], orgpath[MAX_DPATH];
+ _tcscpy (path, _wpgmptr);
+ TCHAR *posn;
+ if((posn = _tcsrchr (path, '\\')))
+ posn[1] = 0;
+ _tcscat (path, L"winuae.ini");
+ _tcscpy (orgpath, path);
+#if 1
+ f = _tfopen (path, L"r+");
+ if (f) {
+ fclose (f);
+ return my_strdup (path);
+ }
+ f = _tfopen (path, L"w");
+ if (f) {
+ fclose (f);
+ return my_strdup (path);
+ }
+#endif
+ int v = GetTempPath (sizeof path / sizeof (TCHAR), path);
+ if (v == 0 || v > sizeof path / sizeof (TCHAR))
+ return my_strdup (orgpath);
+ _tcsncat (path, L"winuae.ini", sizeof path / sizeof (TCHAR));
+ f = _tfopen (path, L"w");
+ if (f) {
+ fclose (f);
+ return my_strdup (path);
+ }
+ return my_strdup (orgpath);
+}
+
+static int parseargs (const TCHAR *argx, const TCHAR *np, const TCHAR *np2)
{
- if (!_tcscmp (arg, L"-convert") && np && np2) {
+ const TCHAR *arg = argx + 1;
+
+ if (argx[0] != '-' && argx[0] != '/')
+ return 0;
+
+ if (!_tcscmp (arg, L"convert") && np && np2) {
zfile_convertimage (np, np2);
return -1;
}
- if (!_tcscmp (arg, L"-console")) {
+ if (!_tcscmp (arg, L"console")) {
console_started = 1;
return 1;
}
- if (!_tcscmp (arg, L"-cli")) {
+ if (!_tcscmp (arg, L"cli")) {
console_emulation = 1;
return 1;
}
- if (!_tcscmp (arg, L"-log")) {
+ if (!_tcscmp (arg, L"log")) {
console_logging = 1;
return 1;
}
#ifdef FILESYS
- if (!_tcscmp (arg, L"-rdbdump")) {
+ if (!_tcscmp (arg, L"rdbdump")) {
do_rdbdump = 1;
return 1;
}
- if (!_tcscmp (arg, L"-disableharddrivesafetycheck")) {
+ if (!_tcscmp (arg, L"disableharddrivesafetycheck")) {
//harddrive_dangerous = 0x1234dead;
return 1;
}
- if (!_tcscmp (arg, L"-noaspifiltering")) {
+ if (!_tcscmp (arg, L"noaspifiltering")) {
aspi_allow_all = 1;
return 1;
}
#endif
- if (!_tcscmp (arg, L"-pngprint")) {
+ if (!_tcscmp (arg, L"pngprint")) {
pngprint = 1;
return 1;
}
- if (!_tcscmp (arg, L"-norawinput")) {
+ if (!_tcscmp (arg, L"norawinput")) {
no_rawinput = 1;
return 1;
}
- if (!_tcscmp (arg, L"-rawkeyboard")) {
+ if (!_tcscmp (arg, L"rawkeyboard")) {
// obsolete
return 1;
}
- if (!_tcscmp (arg, L"-directsound")) {
+ if (!_tcscmp (arg, L"directsound")) {
force_directsound = 1;
return 1;
}
- if (!_tcscmp (arg, L"-scsilog")) {
+ if (!_tcscmp (arg, L"scsilog")) {
log_scsi = 1;
return 1;
}
- if (!_tcscmp (arg, L"-netlog")) {
+ if (!_tcscmp (arg, L"netlog")) {
log_net = 1;
return 1;
}
- if (!_tcscmp (arg, L"-seriallog")) {
+ if (!_tcscmp (arg, L"seriallog")) {
log_uaeserial = 1;
return 1;
}
- if (!_tcscmp (arg, L"-clipboarddebug")) {
+ if (!_tcscmp (arg, L"clipboarddebug")) {
clipboard_debug = 1;
return 1;
}
- if (!_tcscmp (arg, L"-rplog")) {
+ if (!_tcscmp (arg, L"rplog")) {
log_rp = 1;
return 1;
}
- if (!_tcscmp (arg, L"-nomultidisplay")) {
+ if (!_tcscmp (arg, L"nomultidisplay")) {
multi_display = 0;
return 1;
}
- if (!_tcscmp (arg, L"-legacypaths")) {
+ if (!_tcscmp (arg, L"legacypaths")) {
start_data = -2;
return 1;
}
- if (!_tcscmp (arg, L"-screenshotbmp")) {
+ if (!_tcscmp (arg, L"screenshotbmp")) {
screenshotmode = 0;
return 1;
}
- if (!_tcscmp (arg, L"-psprintdebug")) {
+ if (!_tcscmp (arg, L"psprintdebug")) {
postscript_print_debugging = 1;
return 1;
}
- if (!_tcscmp (arg, L"-sounddebug")) {
+ if (!_tcscmp (arg, L"sounddebug")) {
sound_debug = 1;
return 1;
}
- if (!_tcscmp (arg, L"-directcatweasel")) {
+ if (!_tcscmp (arg, L"directcatweasel")) {
force_direct_catweasel = 1;
if (np) {
force_direct_catweasel = getval (np);
}
return 1;
}
- if (!_tcscmp (arg, L"-forcerdtsc")) {
+ if (!_tcscmp (arg, L"forcerdtsc")) {
userdtsc = 1;
return 1;
}
- if (!_tcscmp (arg, L"-ddsoftwarecolorkey")) {
+ if (!_tcscmp (arg, L"ddsoftwarecolorkey")) {
// obsolete
return 1;
}
- if (!_tcscmp (arg, L"-nod3d9ex")) {
+ if (!_tcscmp (arg, L"nod3d9ex")) {
D3DEX = 0;
return 1;
}
- if (!_tcscmp (arg, L"-d3ddebug")) {
+ if (!_tcscmp (arg, L"d3ddebug")) {
d3ddebug = 1;
return 1;
}
- if (!_tcscmp (arg, L"-logflush")) {
+ if (!_tcscmp (arg, L"logflush")) {
extern int always_flush_log;
always_flush_log = 1;
return 1;
}
- if (!_tcscmp (arg, L"-ahidebug")) {
+ if (!_tcscmp (arg, L"ahidebug")) {
extern int ahi_debug;
ahi_debug = 2;
return 1;
}
- if (!_tcscmp (arg, L"-ahidebug2")) {
+ if (!_tcscmp (arg, L"ahidebug2")) {
extern int ahi_debug;
ahi_debug = 3;
return 1;
}
- if (!_tcscmp (arg, L"-quittogui")) {
+ if (!_tcscmp (arg, L"quittogui")) {
quit_to_gui = 1;
return 1;
}
+ if (!_tcscmp (arg, L"ini") && np) {
+ inipath = my_strdup (np);
+ return 2;
+ }
+ if (!_tcscmp (arg, L"portable")) {
+ inipath = getdefaultini ();
+ return 2;
+ }
if (!np)
return 0;
- if (!_tcscmp (arg, L"-ddforcemode")) {
+ if (!_tcscmp (arg, L"ddforcemode")) {
extern int ddforceram;
ddforceram = getval (np);
if (ddforceram < 0 || ddforceram > 3)
ddforceram = 0;
return 2;
}
- if (!_tcscmp (arg, L"-affinity")) {
+ if (!_tcscmp (arg, L"affinity")) {
cpu_affinity = getval (np);
if (cpu_affinity == 0)
cpu_affinity = original_affinity;
SetThreadAffinityMask (GetCurrentThread (), cpu_affinity);
return 2;
}
- if (!_tcscmp (arg, L"-paffinity")) {
+ if (!_tcscmp (arg, L"paffinity")) {
cpu_paffinity = getval (np);
if (cpu_paffinity == 0)
cpu_paffinity = original_affinity;
SetProcessAffinityMask (GetCurrentProcess (), cpu_paffinity);
return 2;
}
- if (!_tcscmp (arg, L"-datapath")) {
+ if (!_tcscmp (arg, L"datapath")) {
ExpandEnvironmentStrings (np, start_path_data, sizeof start_path_data / sizeof (TCHAR));
start_data = -1;
return 2;
}
- if (!_tcscmp (arg, L"-pluginpath")) {
+ if (!_tcscmp (arg, L"pluginpath")) {
ExpandEnvironmentStrings (np, start_path_plugins, sizeof start_path_plugins / sizeof (TCHAR));
return 2;
}
- if (!_tcscmp (arg, L"-maxmem")) {
+ if (!_tcscmp (arg, L"maxmem")) {
maxmem = getval (np);
return 2;
}
- if (!_tcscmp (arg, L"-soundmodeskip")) {
+ if (!_tcscmp (arg, L"soundmodeskip")) {
sound_mode_skip = getval (np);
return 2;
}
- if (!_tcscmp (arg, L"-ini")) {
- inipath = my_strdup (np);
- return 2;
- }
- if (!_tcscmp (arg, L"-p96skipmode")) {
+ if (!_tcscmp (arg, L"p96skipmode")) {
extern int p96skipmode;
p96skipmode = getval (np);
return 2;
}
- if (!_tcscmp (arg, L"-minidumpmode")) {
+ if (!_tcscmp (arg, L"minidumpmode")) {
minidumpmode = (MINIDUMP_TYPE)getval (np);
return 2;
}
- if (!_tcscmp (arg, L"-jitevent")) {
+ if (!_tcscmp (arg, L"jitevent")) {
pissoff_value = getval (np);
return 2;
}
#ifdef RETROPLATFORM
- if (!_tcscmp (arg, L"-rphost")) {
+ if (!_tcscmp (arg, L"rphost")) {
rp_param = my_strdup (np);
return 2;
}
- if (!_tcscmp (arg, L"-rpescapekey")) {
+ if (!_tcscmp (arg, L"rpescapekey")) {
rp_rpescapekey = getval (np);
return 2;
}
- if (!_tcscmp (arg, L"-rpescapeholdtime")) {
+ if (!_tcscmp (arg, L"rpescapeholdtime")) {
rp_rpescapeholdtime = getval (np);
return 2;
}
- if (!_tcscmp (arg, L"-rpscreenmode")) {
+ if (!_tcscmp (arg, L"rpscreenmode")) {
rp_screenmode = getval (np);
return 2;
}
- if (!_tcscmp (arg, L"-rpinputmode")) {
+ if (!_tcscmp (arg, L"rpinputmode")) {
rp_inputmode = getval (np);
return 2;
}
KEY_WRITE | KEY_READ, NULL, &hWinUAEKey, &disposition);
if (hWinUAEKey == NULL) {
FILE *f;
- TCHAR path[MAX_DPATH];
- TCHAR *posn;
+ TCHAR *path;
- _tcscpy (path, _wpgmptr);
- if((posn = _tcsrchr (path, '\\')))
- posn[1] = 0;
- _tcscat (path, L"winuae.ini");
+ path = getdefaultini ();
f = _tfopen (path, L"r");
if (!f)
f = _tfopen (path, L"w");
fclose (f);
reginitializeinit (path);
}
+ xfree (path);
}
}
if (regquerystr (NULL, L"Commandline", tmp, &size))
#define WINUAEPUBLICBETA 1
#define LANG_DLL 1
-#define WINUAEBETA L"6"
-#define WINUAEDATE MAKEBD(2010, 7, 24)
+#define WINUAEBETA L"7"
+#define WINUAEDATE MAKEBD(2010, 7, 28)
#define WINUAEEXTRA L""
#define WINUAEREV L""
extern OSVERSIONINFO osVersion;
extern int paraport_mask;
extern int gui_active;
-extern int quickstart, configurationcache;
+extern int quickstart, configurationcache, relativepaths;
extern HKEY hWinUAEKey;
extern int screen_is_picasso, scalepicasso;
extern HINSTANCE hInst;
extern int win_x_diff, win_y_diff;
extern int window_extra_width, window_extra_height;
-extern int af_path_2005, af_path_old;
-extern TCHAR start_path_af[MAX_DPATH], start_path_new1[MAX_DPATH], start_path_new2[MAX_DPATH];
-#define PATH_TYPE_WINUAE 0
-#define PATH_TYPE_NEWWINUAE 1
-#define PATH_TYPE_OLDAF 2
-#define PATH_TYPE_NEWAF 3
-#define PATH_TYPE_AMIGAFOREVERDATA 4
+extern int af_path_2005;
+extern TCHAR start_path_new1[MAX_DPATH], start_path_new2[MAX_DPATH];
+enum pathtype { PATH_TYPE_DEFAULT, PATH_TYPE_WINUAE, PATH_TYPE_NEWWINUAE, PATH_TYPE_NEWAF, PATH_TYPE_AMIGAFOREVERDATA, PATH_TYPE_END };
+void setpathmode (pathtype pt);
extern void sleep_millis (int ms);
extern void sleep_millis_busy (int ms);
void systray (HWND hwnd, int remove);
void systraymenu (HWND hwnd);
void exit_gui (int);
-void fetch_path (TCHAR *name, TCHAR *out, int size);
-void set_path (TCHAR *name, TCHAR *path);
+void fetch_path (const TCHAR *name, TCHAR *out, int size);
+void set_path (const TCHAR *name, TCHAR *path);
+void set_path (const TCHAR *name, TCHAR *path, pathtype);
void read_rom_list (void);
void associate_file_extensions (void);
: currprefs.color_mode == 2 ? 16 : 32;
if (screen_is_picasso && currprefs.win32_rtgmatchdepth && isfullscreen () > 0) {
int pbits = picasso96_state.BytesPerPixel * 8;
- if (pbits <= 8)
- pbits = 16;
+ if (pbits <= 8) {
+ if (currentmode->current_depth == 32)
+ pbits = 32;
+ else
+ pbits = 16;
+ }
if (pbits == 24)
pbits = 32;
currentmode->current_depth = pbits;
ofn.lpstrInitialDir = path;
ofn.nMaxFile = MAX_DPATH;
val = GetFileDialog (&ofn, NULL, -1);
+ fullpath (path, MAX_DPATH);
return val;
}
}
if (!rd) {
write_log (L"!: Name='%s':%d\nCRC32=%08X SHA1=%s\n",
- zfile_getname(f), size, get_crc32(rombuf, size), get_sha1_txt(rombuf, size));
+ zfile_getname (f), size, get_crc32 (rombuf, size), get_sha1_txt (rombuf, size));
} else {
TCHAR tmp[MAX_DPATH];
getromname (rd, tmp);
write_log (L"*: %s:%d = %s\nCRC32=%08X SHA1=%s\n",
- zfile_getname(f), size, tmp, get_crc32(rombuf, size), get_sha1_txt(rombuf, size));
+ zfile_getname (f), size, tmp, get_crc32 (rombuf, size), get_sha1_txt (rombuf, size));
}
xfree (rombuf);
return rd;
}
-static struct romdata *scan_single_rom (TCHAR *path)
+static struct romdata *scan_single_rom (const TCHAR *path)
{
struct zfile *z;
TCHAR tmp[MAX_DPATH];
memmove (name, name + _tcslen (start_path_exe), (_tcslen (name) - _tcslen (start_path_exe) + 1) * sizeof (TCHAR));
}
-static int addrom (UAEREG *fkey, struct romdata *rd, TCHAR *name)
+static int addrom (UAEREG *fkey, struct romdata *rd, const TCHAR *name)
{
TCHAR tmp1[MAX_DPATH], tmp2[MAX_DPATH];
return 0;
getromname (rd, tmp2);
if (name) {
+ TCHAR name2[MAX_DPATH];
+ _tcscpy (name2, name);
_tcscat (tmp2, L" / \"");
if (getregmode ())
- abspathtorelative (name);
- _tcscat (tmp2, name);
+ abspathtorelative (name2);
+ _tcscat (tmp2, name2);
_tcscat (tmp2, L"\"");
}
if (rd->crc32 == 0xffffffff) {
return 1;
}
-static int isromext (TCHAR *path)
+static int isromext (const TCHAR *path)
{
- TCHAR *ext;
+ const TCHAR *ext;
int i;
if (!path)
getromname (rd, name);
scan_rom_hook (name, 3);
addrom (rsd->fkey, rd, path);
+ if (rd->type & ROMTYPE_KEY)
+ addkeyfile (path);
rsd->got = 1;
}
return 0;
}
-static int scan_rom (TCHAR *path, UAEREG *fkey)
+static int scan_rom (const TCHAR *path, UAEREG *fkey)
{
struct romscandata rsd = { fkey, 0 };
struct romdata *rd;
free (p);
}
-static int scan_roms_2 (UAEREG *fkey, TCHAR *path)
+static int scan_roms_2 (UAEREG *fkey, const TCHAR *path)
{
TCHAR buf[MAX_DPATH];
WIN32_FIND_DATA find_data;
#define MAX_ROM_PATHS 10
-static int scan_roms_3 (UAEREG *fkey, TCHAR **paths, TCHAR *path)
+static int scan_roms_3 (UAEREG *fkey, TCHAR **paths, const TCHAR *path)
{
int i, ret;
TCHAR pathp[MAX_DPATH];
ret = 0;
scan_rom_hook (NULL, 0);
+ pathp[0] = 0;
GetFullPathName (path, MAX_DPATH, pathp, NULL);
+ if (!pathp[0])
+ return ret;
+ if (_tcsicmp (pathp, start_path_exe) == 0)
+ return ret;
for (i = 0; i < MAX_ROM_PATHS; i++) {
if (paths[i] && !_tcsicmp (paths[i], pathp))
return ret;
return ret;
}
-extern int get_rom_path (TCHAR *out, int mode);
+extern int get_rom_path (TCHAR *out, pathtype mode);
int scan_roms (HWND hDlg, int show)
{
fetch_path (L"KickstartPath", path, sizeof path / sizeof (TCHAR));
cnt += scan_roms_3 (fkey, paths, path);
if (1) {
- for(i = 0; i < MAX_ROM_PATHS; i++) {
- ret = get_rom_path (path, i);
+ static pathtype pt[] = { PATH_TYPE_DEFAULT, PATH_TYPE_WINUAE, PATH_TYPE_NEWWINUAE, PATH_TYPE_NEWAF, PATH_TYPE_AMIGAFOREVERDATA, PATH_TYPE_END };
+ for (i = 0; pt[i] != PATH_TYPE_END; i++) {
+ ret = get_rom_path (path, pt[i]);
if (ret < 0)
break;
cnt += scan_roms_3 (fkey, paths, path);
}
}
-static void selectcd (struct uae_prefs *prefs, HWND hDlg, int num, int id, TCHAR *full_path)
+static void selectcd (struct uae_prefs *prefs, HWND hDlg, int num, int id, const TCHAR *full_path)
{
SetDlgItemText (hDlg, id, full_path);
if (quickstart_cddrive[0])
eject_cd ();
_tcscpy (prefs->cdslots[0].name, full_path);
- DISK_history_add (full_path, -1, HISTORY_CD, 0);
+ fullpath (prefs->cdslots[0].name, sizeof prefs->cdslots[0].name / sizeof (TCHAR));
+ DISK_history_add (prefs->cdslots[0].name, -1, HISTORY_CD, 0);
}
-static void selectdisk (struct uae_prefs *prefs, HWND hDlg, int num, int id, TCHAR *full_path)
+static void selectdisk (struct uae_prefs *prefs, HWND hDlg, int num, int id, const TCHAR *full_path)
{
if (iscd (num)) {
selectcd (prefs, hDlg, num, id, full_path);
}
SetDlgItemText (hDlg, id, full_path);
_tcscpy(prefs->df[num], full_path);
- DISK_history_add (full_path, -1, HISTORY_FLOPPY, 0);
+ fullpath (prefs->df[num], sizeof prefs->df[num] / sizeof (TCHAR));
+ DISK_history_add (prefs->df[num], -1, HISTORY_FLOPPY, 0);
}
+static void setdpath (const TCHAR *name, const TCHAR *path)
+{
+ TCHAR tmp[MAX_DPATH];
+ _tcscpy (tmp, path);
+ fullpath (tmp, sizeof tmp / sizeof (TCHAR));
+ regsetstr (NULL, name, tmp);
+}
// Common routine for popping up a file-requester
// flag - 0 for floppy loading, 1 for floppy creation, 2 for loading hdf, 3 for saving hdf
if (multi)
openFileName.Flags |= OFN_ALLOWMULTISELECT;
- if (flag == 1 || flag == 3 || flag == 5 || flag == 9 || flag == 11 || flag == 16) {
+ if (flag == 1 || flag == 3 || flag == 5 || flag == 9 || flag == 16) {
if (!(result = GetSaveFileName_2 (hDlg, &openFileName, guid)))
write_log (L"GetSaveFileNameX() failed, err=%d.\n", GetLastError ());
} else {
case IDC_PATH_NAME:
case IDC_PATH_FILESYS:
if (flag == 8) {
- if(_tcsstr(full_path, L"Configurations\\")) {
- _tcscpy(full_path, init_path);
- _tcscat(full_path, file_name);
+ if(_tcsstr (full_path, L"Configurations\\")) {
+ _tcscpy (full_path, init_path);
+ _tcscat (full_path, file_name);
}
}
SetDlgItemText (hDlg, wParam, full_path);
break;
case IDC_ROMFILE:
_tcscpy (workprefs.romfile, full_path);
+ fullpath (workprefs.romfile, MAX_DPATH);
break;
case IDC_ROMFILE2:
_tcscpy (workprefs.romextfile, full_path);
+ fullpath (workprefs.romextfile, MAX_DPATH);
break;
case IDC_FLASHFILE:
_tcscpy (workprefs.flashfile, full_path);
+ fullpath (workprefs.flashfile, MAX_DPATH);
break;
case IDC_CARTFILE:
_tcscpy (workprefs.cartfile, full_path);
+ fullpath (workprefs.cartfile, MAX_DPATH);
break;
case IDC_INPREC_PLAY:
inprec_open (full_path, ischecked (hDlg, IDC_INPREC_PLAYMODE) ? -1 : -2);
amiga_path = _tcsstr (openFileName.lpstrFile, openFileName.lpstrFileTitle);
if (amiga_path && amiga_path != openFileName.lpstrFile) {
*amiga_path = 0;
- regsetstr (NULL, L"FloppyPath", openFileName.lpstrFile);
+ setdpath (L"FloppyPath", openFileName.lpstrFile);
}
} else if (flag == 2 || flag == 3) {
amiga_path = _tcsstr (openFileName.lpstrFile, openFileName.lpstrFileTitle);
if (amiga_path && amiga_path != openFileName.lpstrFile) {
*amiga_path = 0;
- regsetstr (NULL, L"hdfPath", openFileName.lpstrFile);
+ setdpath (L"hdfPath", openFileName.lpstrFile);
}
} else if (flag == 17) {
amiga_path = _tcsstr (openFileName.lpstrFile, openFileName.lpstrFileTitle);
if (amiga_path && amiga_path != openFileName.lpstrFile) {
*amiga_path = 0;
- regsetstr (NULL, L"CDPath", openFileName.lpstrFile);
+ setdpath (L"CDPath", openFileName.lpstrFile);
}
}
}
regdelete (NULL, L"QuickStartCompatibility");
regdelete (NULL, L"QuickStartHostConfig");
regdelete (NULL, L"ConfigurationCache");
+ regdelete (NULL, L"RelativePaths");
regdelete (NULL, L"DirectDraw_Secondary");
regdelete (NULL, L"ShownsupportedModes");
}
-int path_type;
+pathtype path_type;
static INT_PTR CALLBACK PathsDlgProc (HWND hDlg, UINT msg, WPARAM wParam, LPARAM lParam)
{
const GUID pathsguid = { 0x5674338c, 0x7a0b, 0x4565, { 0xbf, 0x75, 0x62, 0x8c, 0x80, 0x4a, 0xef, 0xf7 } };
void create_afnewdir(int);
static int recursive;
- static int ptypes[10], numtypes;
+ static pathtype ptypes[10];
+ static int numtypes;
int val, selpath = 0;
- TCHAR tmp[MAX_DPATH], pathmode[32];
+ TCHAR tmp[MAX_DPATH];
switch (msg)
{
setac (hDlg, IDC_PATHS_AVIOUTPUT);
setac (hDlg, IDC_PATHS_RIP);
CheckDlgButton(hDlg, IDC_PATHS_CONFIGCACHE, configurationcache);
+ CheckDlgButton(hDlg, IDC_PATHS_RELATIVE, relativepaths);
currentpage = PATHS_ID;
ShowWindow (GetDlgItem (hDlg, IDC_RESETREGISTRY), FALSE);
numtypes = 0;
SendDlgItemMessage (hDlg, IDC_PATHS_DEFAULTTYPE, CB_RESETCONTENT, 0, 0L);
if (af_path_2005 & 1) {
- WIN32GUI_LoadUIString (IDS_DEFAULT_AF2005, tmp, sizeof tmp / sizeof (TCHAR));
+ WIN32GUI_LoadUIString (IDS_DEFAULT_AF, tmp, sizeof tmp / sizeof (TCHAR));
SendDlgItemMessage (hDlg, IDC_PATHS_DEFAULTTYPE, CB_ADDSTRING, 0, (LPARAM)tmp);
if (path_type == PATH_TYPE_NEWAF)
selpath = numtypes;
selpath = numtypes;
ptypes[numtypes++] = PATH_TYPE_NEWWINUAE;
}
- if (af_path_2005 & 2) {
+ if ((af_path_2005 & 3) == 2) {
SendDlgItemMessage (hDlg, IDC_PATHS_DEFAULTTYPE, CB_ADDSTRING, 0, (LPARAM)L"AmigaForeverData");
if (path_type == PATH_TYPE_AMIGAFOREVERDATA)
selpath = numtypes;
ptypes[numtypes++] = PATH_TYPE_AMIGAFOREVERDATA;
}
- if (af_path_old) {
- WIN32GUI_LoadUIString (IDS_DEFAULT_AF, tmp, sizeof tmp / sizeof (TCHAR));
- SendDlgItemMessage (hDlg, IDC_PATHS_DEFAULTTYPE, CB_ADDSTRING, 0, (LPARAM)tmp);
- if (path_type == PATH_TYPE_OLDAF)
- selpath = numtypes;
- ptypes[numtypes++] = PATH_TYPE_OLDAF;
- }
WIN32GUI_LoadUIString (IDS_DEFAULT_WINUAE, tmp, sizeof tmp / sizeof (TCHAR));
SendDlgItemMessage (hDlg, IDC_PATHS_DEFAULTTYPE, CB_ADDSTRING, 0, (LPARAM)tmp);
- if (path_type == 0)
+ if (path_type == PATH_TYPE_WINUAE || path_type == PATH_TYPE_DEFAULT)
selpath = numtypes;
- ptypes[numtypes++] = 0;
+ ptypes[numtypes++] = PATH_TYPE_WINUAE;
SendDlgItemMessage (hDlg, IDC_PATHS_DEFAULTTYPE, CB_SETCURSEL, selpath, 0);
EnableWindow (GetDlgItem (hDlg, IDC_PATHS_DEFAULTTYPE), numtypes > 0 ? TRUE : FALSE);
values_to_pathsdialog (hDlg);
if (val == PATH_TYPE_WINUAE) {
_tcscpy (start_path_data, start_path_exe);
path_type = PATH_TYPE_WINUAE;
- _tcscpy (pathmode, L"WinUAE");
} else if (val == PATH_TYPE_NEWWINUAE && start_path_new1[0]) {
_tcscpy (start_path_data, start_path_new1);
path_type = PATH_TYPE_NEWWINUAE;
create_afnewdir(0);
- _tcscpy (pathmode, L"WinUAE_2");
- } else if (val == PATH_TYPE_OLDAF && start_path_af[0]) {
- _tcscpy (start_path_data, start_path_af);
- _tcscpy (pathmode, L"AF");
- path_type = PATH_TYPE_OLDAF;
} else if (val == PATH_TYPE_NEWAF && start_path_new1[0]) {
- _tcscpy (pathmode, L"AF2005");
path_type = PATH_TYPE_NEWAF;
create_afnewdir(0);
_tcscpy (start_path_data, start_path_new1);
} else if (val == PATH_TYPE_AMIGAFOREVERDATA && start_path_new2[0]) {
- _tcscpy (pathmode, L"AMIGAFOREVERDATA");
path_type = PATH_TYPE_AMIGAFOREVERDATA;
_tcscpy (start_path_data, start_path_new1);
}
SetCurrentDirectory (start_path_data);
- regsetstr (NULL, L"PathMode", pathmode);
- set_path (L"KickstartPath", NULL);
- set_path (L"ConfigurationPath", NULL);
- set_path (L"ScreenshotPath", NULL);
- set_path (L"StatefilePath", NULL);
- set_path (L"SaveimagePath", NULL);
- set_path (L"VideoPath", NULL);
- set_path (L"RipperPath", NULL);
+ setpathmode (path_type);
+ set_path (L"KickstartPath", NULL, path_type);
+ set_path (L"ConfigurationPath", NULL, path_type);
+ set_path (L"ScreenshotPath", NULL, path_type);
+ set_path (L"StatefilePath", NULL, path_type);
+ set_path (L"SaveimagePath", NULL, path_type);
+ set_path (L"VideoPath", NULL, path_type);
+ set_path (L"RipperPath", NULL, path_type);
values_to_pathsdialog (hDlg);
FreeConfigStore ();
}
configurationcache = ischecked (hDlg, IDC_PATHS_CONFIGCACHE) ? 1 : 0;
regsetint (NULL, L"ConfigurationCache", configurationcache);
break;
+ case IDC_PATHS_RELATIVE:
+ relativepaths = ischecked (hDlg, IDC_PATHS_RELATIVE) ? 1 : 0;
+ regsetint (NULL, L"RelativePaths", relativepaths);
+ break;
}
recursive--;
break;
case 11:
quickstart_ok_floppy = 1;
- if (quickstart_model != 1 && quickstart_model != 2 && quickstart_model != 4 && quickstart_model != 5 && quickstart_model != 6 && quickstart_model != 8) {
+ if (quickstart_model != 1 && quickstart_model != 2 && quickstart_model != 4 &&
+ quickstart_model != 5 && quickstart_model != 6 && quickstart_model != 8 && quickstart_model != 11) {
quickstart_model = 4;
messageid = IDS_IMGCHK_KS2;
reload = 1;
break;
case 12:
quickstart_ok_floppy = 1;
- if (quickstart_model != 4) {
+ if (quickstart_model != 4 && quickstart_model != 8 && quickstart_model != 11) {
quickstart_model = 4;
messageid = IDS_IMGCHK_KS3;
reload = 1;
SetDlgItemText(hDlg, IDC_FLASHFILE, workprefs.flashfile);
CheckDlgButton(hDlg, IDC_KICKSHIFTER, workprefs.kickshifter);
CheckDlgButton(hDlg, IDC_MAPROM, workprefs.maprom);
- //CheckDlgButton(hDlg, IDC_HRTMON, workprefs.cart_internal == 1);
}
static void init_kickstart (HWND hDlg)
case IDC_MAPROM:
workprefs.maprom = ischecked (hDlg, IDC_MAPROM) ? 0x0f000000 : 0;
break;
-#if 0
- case IDC_HRTMON:
- workprefs.cart_internal = ischecked (hDlg, IDC_HRTMON) ? 1 : 0;
- ew (hDlg, IDC_CARTFILE, workprefs.cart_internal == 1 ? FALSE : TRUE);
- break;
-#endif
}
recursive--;
break;
static void enable_for_miscdlg (HWND hDlg)
{
- ew (hDlg, IDC_DD_SURFACETYPE, full_property_sheet);
if (!full_property_sheet) {
ew (hDlg, IDC_JULIAN, TRUE);
ew (hDlg, IDC_CTRLF11, TRUE);
ew (hDlg, IDC_ASSOCIATELIST, !rp_isactive ());
ew (hDlg, IDC_ASSOCIATE_ON, !rp_isactive ());
ew (hDlg, IDC_ASSOCIATE_OFF, !rp_isactive ());
- ew (hDlg, IDC_DD_SURFACETYPE, workprefs.gfx_api == 0);
+ ew (hDlg, IDC_DD_SURFACETYPE, full_property_sheet && workprefs.gfx_api == 0);
}
static void misc_kbled (HWND hDlg, int v, int nv)
break;
case IDC_DXMODE:
v = SendDlgItemMessage (hDlg, IDC_DXMODE, CB_GETCURSEL, 0, 0L);
- if (v != CB_ERR)
+ if (v != CB_ERR) {
workprefs.gfx_api = v;
+ enable_for_miscdlg (hDlg);
+ }
break;
case IDC_DD_SURFACETYPE:
v = SendDlgItemMessage (hDlg, IDC_DD_SURFACETYPE, CB_GETCURSEL, 0, 0L);
{
DiskSelection (hDlg, IDC_PATH_NAME, 2, &workprefs, newpath);
GetDlgItemText (hDlg, IDC_PATH_NAME, current_hfdlg.filename, sizeof current_hfdlg.filename / sizeof (TCHAR));
+ fullpath (current_hfdlg.filename, sizeof current_hfdlg.filename / sizeof (TCHAR));
inithardfile (hDlg);
hardfile_testrdb (hDlg, ¤t_hfdlg);
updatehdfinfo (hDlg, 1);
loopmulti (path, NULL);
while (loopmulti (path, dpath) && entry < MAX_SPARE_DRIVES) {
_tcscpy (workprefs.dfxlist[entry], dpath);
+ fullpath (workprefs.dfxlist[entry], MAX_DPATH);
lastentry = entry;
entry++;
}
<Culture>0x0409</Culture>
</ResourceCompile>
<Link>
- <AdditionalDependencies>ws2_32.lib;ddraw.lib;dxguid.lib;winmm.lib;comctl32.lib;version.lib;vfw32.lib;msacm32.lib;dsound.lib;dinput8.lib;d3d9.lib;d3dx9.lib;setupapi.lib;wininet.lib;dxerr.lib;shlwapi.lib;zlibstat.lib;portaudio_x64.lib;packet.lib;wpcap.lib;openal32.lib;libpng.lib;lglcd.lib;wtsapi32.lib;wntab32x.lib;enet_x64.lib;prowizard_x64.lib;lzmalib.lib;%(AdditionalDependencies)</AdditionalDependencies>
+ <AdditionalDependencies>ws2_32.lib;ddraw.lib;dxguid.lib;winmm.lib;comctl32.lib;version.lib;vfw32.lib;msacm32.lib;dsound.lib;dinput8.lib;d3d9.lib;d3dx9.lib;setupapi.lib;wininet.lib;dxerr.lib;shlwapi.lib;zlibstat.lib;portaudio_x64.lib;packet.lib;wpcap.lib;openal32.lib;libpng.lib;lglcd.lib;wtsapi32.lib;wntab32x.lib;enet_x64.lib;prowizard_x64.lib;lzmalib.lib;libFLAC_static.lib;%(AdditionalDependencies)</AdditionalDependencies>
<ShowProgress>NotSet</ShowProgress>
<OutputFile>$(OutDir)$(TargetName)$(TargetExt)</OutputFile>
<SuppressStartupBanner>true</SuppressStartupBanner>
+Beta 7:
+
+- reverted b5 audio hack, it breaks other programs and also it does not seem to
+ be audio.device bug after all but application calling CMD_WRITE with interrupts
+ disabled..
+- zipped iso was unnecessarily unpacked completely during scanning if cue was found
+ later
+- some drives/driver/Windows versions don't seem to like IOCTL_CDROM_RAW_READ, returns
+ ERROR_INVALID_FUNCTION (XP returned ERROR_INVALID_PARAMETER). Falls back to
+ SPTI SCSI passthrough in this situation and uses SCSI READ CD command
+- improved default ROM path handling
+- ccd and mds CDA was silent (b5)
+- higher CPU usage, display emulation debugging stuff.. (b5)
+- initial rom scan didn't load AF key files correctly
+- updated VPOSW fake 60hz support sometimes selected bogus 314 line timing for sound sync
+ (not really much difference, might have caused some extra SND% changes)
+- CD32 audio play status code was unreliable if new CDA play command was send without
+ stopping previous play state (Fightin' Spirit CD32)
+- CD32 state restore ignored statefile embedded CD image path (if included)
+- CD32 state save saved wrong command fifo offset, restoring state can send some
+ random commands to drive (old bug)
+- new CDTV state file support was quite unusable
+- state restore didn't initialize audio completely, samples playing while state was
+ restored could play incorrectly until sample (on any channel) ended or new sample
+ was started (old bug)
+- printscreen key saves screenshot when button is released (was when pressed)
+ quick workaround for Windows built-in screenshot not getting overridden in
+ rawinput keyboard mode (perhaps there is better way..)
+- "highend" quickstart mode was not in KS2.0+ check list
+- fullscreen 8-bit RTG and "match depth" RTG setting enabled and 32-bit display
+ mode selected in Display panel: 16-bit mode was selected with 32-bit mode
+ color settings.
+
+"Portable mode" updates: (and no stupid registry related comments again or..)
+
+- added -portable command line parameter which is same as "-ini winuae.ini",
+ creates ini in temp directory if winuae.exe directory is write protected
+- /<command line parameter name> also accepted
+- official support for relative paths added, checkbox in Paths panel, automatically
+ enabled when ini mode is started (ini missing or empty), all paths that are inside
+ of winuae directory are kept relative. Report all possible side-effects or paths that
+ are not in correct format. Currently all relative paths have .\ prefix, this may
+ disappear in future
+- do not set apppath in registry in ini-mode
+- real harddrive configuration path is now ":<name of device>" (was "HD_<name of device>")
+ (to prevent relative/absolute path conversion conflicts, field is unfortunately shared
+ with hdf paths), this is automatically converted when old config is loaded
+
+Beta 6:
+
- MP3/FLAC background decompression, no more delayed CDA startup if audio file
decompression takes more than 2 seconds
- implemented "delayed decompression" zfile open flag, currently only zip backend supports it
if CDFS polling flag was disabled (empty drive without diskchange command)
- new dynamic hardfiles have .vhd extension instead of .hdf
-Beta 5
+Beta 5:
- version number bumped to 2.3
- few lines of non-filter scanlines was missing in bottom part of display
return romlist_cnt;
}
-TCHAR *romlist_get (struct romdata *rd)
+TCHAR *romlist_get (const struct romdata *rd)
{
int i;
return 0;
}
-static struct romlist *romlist_getrl (struct romdata *rd)
+static struct romlist *romlist_getrl (const struct romdata *rd)
{
int i;
}
static void romlist_cleanup (void);
-void romlist_add (TCHAR *path, struct romdata *rd)
+void romlist_add (const TCHAR *path, struct romdata *rd)
{
struct romlist *rl2;
}
-struct romdata *getromdatabypath (TCHAR *path)
+struct romdata *getromdatabypath (const TCHAR *path)
{
int i;
for (i = 0; i < romlist_cnt; i++) {
return NULL;
}
-#define NEXT_ROM_ID 73
+#define NEXT_ROM_ID 74
static struct romheader romheaders[] = {
{ L"Freezer Cartridges", 1 },
0x869ae1b1, 0x801bbab3,0x2e3d3738,0x6dd1636d,0x4f1d6fa7,0xe21d5874 },
{ L"Cloanto Amiga Forever 2006 ROM key", 0, 0, 0, 0, 0, 750, 48, 0, 1, ROMTYPE_KEY, 0, 0, NULL,
0xb01c4b56, 0xbba8e5cd,0x118b8d92,0xafed5693,0x5eeb9770,0x2a662d8f },
+// { L"Cloanto Amiga Forever 2010 ROM key", 0, 0, 0, 0, 0, 1544, 73, 0, 1, ROMTYPE_KEY, 0, 0, NULL,
+// 0x8c4dd05c, 0x05034f62,0x0b5bb7b2,0x86954ea9,0x164fdb90,0xfb2897a4 },
{ L"KS ROM v1.0 (A1000)(NTSC)", 1, 0, 1, 0, L"A1000\0", 262144, 1, 0, 0, ROMTYPE_KICK, 0, 0, NULL,
0x299790ff, 0x00C15406,0xBEB4B8AB,0x1A16AA66,0xC05860E1,0xA7C1AD79 },
}
}
-struct romlist **getromlistbyident (int ver, int rev, int subver, int subrev, TCHAR *model, int all)
+struct romlist **getromlistbyident (int ver, int rev, int subver, int subrev, const TCHAR *model, int all)
{
int i, j, ok, out, max;
struct romdata *rd;
return rdout;
}
-struct romdata *getarcadiarombyname (TCHAR *name)
+struct romdata *getarcadiarombyname (const TCHAR *name)
{
int i;
for (i = 0; roms[i].name; i++) {
TCHAR *p = roms[i].name;
p = p + _tcslen (p) + 1;
if (_tcslen (name) >= _tcslen (p) + 4) {
- TCHAR *p2 = name + _tcslen (name) - _tcslen (p) - 4;
+ const TCHAR *p2 = name + _tcslen (name) - _tcslen (p) - 4;
if (!memcmp (p, p2, _tcslen (p)) && !memcmp (p2 + _tcslen (p2) - 4, ".zip", 4))
return &roms[i];
}
return cksum == 0xffffffff;
}
-#define ROM_KEY_NUM 3
+#define ROM_KEY_NUM 4
struct rom_key {
uae_u8 *key;
int size;
write_log (L"ROM KEY '%s' %d bytes loaded\n", name, size);
}
-static void addkeyfile (const TCHAR *path)
+void addkeyfile (const TCHAR *path)
{
struct zfile *f;
int keysize;
return num;
}
-int load_keyring (struct uae_prefs *p, TCHAR *path)
+int load_keyring (struct uae_prefs *p, const TCHAR *path)
{
uae_u8 *keybuf;
int keysize;
TCHAR tmp[MAX_PATH], *d;
- int keyids[] = { 0, 48, -1 };
+ int keyids[] = { 0, 48, 73, -1 };
int cnt, i;
free_keyring ();
int i;
for (i = 0; i < ROM_KEY_NUM; i++)
xfree (keyring[i].key);
- memset(keyring, 0, sizeof (struct rom_key) * ROM_KEY_NUM);
+ memset (keyring, 0, sizeof (struct rom_key) * ROM_KEY_NUM);
}
struct romdata *getromdatabyname (const TCHAR *name)
return 0;
}
-static int cmpsha1 (uae_u8 *s1, struct romdata *rd)
+static int cmpsha1 (const uae_u8 *s1, const struct romdata *rd)
{
int i;
return 0;
}
-static struct romdata *checkromdata (uae_u8 *sha1, int size, uae_u32 mask)
+static struct romdata *checkromdata (const uae_u8 *sha1, int size, uae_u32 mask)
{
int i = 0;
while (roms[i].name) {
return rd;
}
-void getromname (struct romdata *rd, TCHAR *name)
+void getromname (const struct romdata *rd, TCHAR *name)
{
name[0] = 0;
if (!rd)
_stprintf (name + _tcslen (name), L" [%s]", rd->partnumber);
}
-struct romlist *getromlistbyromdata (struct romdata *rd)
+struct romlist *getromlistbyromdata (const struct romdata *rd)
{
int ids[2];
return getromlistbyids(ids);
}
-struct romlist *getromlistbyids (int *ids)
+struct romlist *getromlistbyids (const int *ids)
{
struct romdata *rd;
int i, j;
return NULL;
}
-void romwarning (int *ids)
+void romwarning (const int *ids)
{
int i, exp;
TCHAR tmp1[MAX_DPATH], tmp2[MAX_DPATH];
#endif
}
-static void descramble (struct romdata *rd, uae_u8 *data, int size, int odd)
+static void descramble (const struct romdata *rd, uae_u8 *data, int size, int odd)
{
int flags = rd->type;
descramble_nordicpro (data, size, odd);
}
-static int read_rom_file (uae_u8 *buf, struct romdata *rd)
+static int read_rom_file (uae_u8 *buf, const struct romdata *rd)
{
struct zfile *zf;
struct romlist *rl = romlist_getrl (rd);
return 1;
}
-int configure_rom (struct uae_prefs *p, int *rom, int msg)
+int configure_rom (struct uae_prefs *p, const int *rom, int msg)
{
struct romdata *rd;
TCHAR *path = 0;
xfree (dst);
#endif
#ifdef CDTV
- dst = save_dmac (&len);
- save_chunk (f, dst, len, L"DMAC", 0);
- xfree (dst);
dst = save_cdtv (&len);
save_chunk (f, dst, len, L"CDTV", 0);
xfree (dst);
+ dst = save_dmac (&len);
+ save_chunk (f, dst, len, L"DMAC", 0);
+ xfree (dst);
#endif
#ifdef ACTION_REPLAY