From 23722453df637c578ef78a473ee810ee49c75bfc Mon Sep 17 00:00:00 2001 From: Toni Wilen Date: Wed, 28 Jul 2010 21:39:55 +0300 Subject: [PATCH] 2300b7 --- akiko.cpp | 82 ++--- audio.cpp | 107 +++--- blkdev_cdimage.cpp | 13 +- cdtv.cpp | 87 +++-- cfgfile.cpp | 41 ++- custom.cpp | 10 +- disk.cpp | 26 +- expansion.cpp | 2 +- include/cdtv.h | 1 + include/rommgr.h | 25 +- include/uae.h | 3 + memory.cpp | 2 + od-win32/blkdev_win32_ioctl.cpp | 117 ++++-- od-win32/hardfile_win32.cpp | 11 +- od-win32/keyboard_win32.cpp | 16 +- od-win32/picasso96_win.cpp | 6 +- od-win32/resources/resource | 3 +- od-win32/resources/winuae.rc | 36 +- od-win32/screenshot.cpp | 4 +- od-win32/sounddep/sound.cpp | 14 +- od-win32/win32.cpp | 398 +++++++++++++-------- od-win32/win32.h | 22 +- od-win32/win32gfx.cpp | 8 +- od-win32/win32gui.cpp | 147 ++++---- od-win32/winuae_msvc10/winuae_msvc.vcxproj | 2 +- od-win32/winuaechangelog.txt | 52 ++- rommgr.cpp | 46 +-- savestate.cpp | 6 +- 28 files changed, 769 insertions(+), 518 deletions(-) diff --git a/akiko.cpp b/akiko.cpp index 82a448a0..f9390033 100644 --- a/akiko.cpp +++ b/akiko.cpp @@ -29,8 +29,8 @@ #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" @@ -419,7 +419,6 @@ static int sector_buffer_sector_1, sector_buffer_sector_2; 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; @@ -449,20 +448,17 @@ void rethink_akiko (void) 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) @@ -563,6 +559,7 @@ static int cd_play_audio (int startlsn, int endlsn, int scan) } 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); @@ -582,6 +579,8 @@ static int cd_qcode (uae_u8 *d) 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; @@ -785,7 +784,7 @@ static int cdrom_command_stop (void) if (checkerr ()) return 2; cdrom_result_buffer[1] = 0; - write_comm_pipe_u32 (&requests, 0x0104, 1); + cdaudiostop (); return 2; } @@ -798,12 +797,12 @@ static int cdrom_command_pause (void) 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; } @@ -816,9 +815,9 @@ static int cdrom_command_unpause (void) 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; } @@ -1083,7 +1082,7 @@ static void akiko_handler (void) } 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; @@ -1121,13 +1120,6 @@ void AKIKO_hsync_handler (void) 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 { @@ -1218,10 +1210,12 @@ static void *akiko_thread (void *null) 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; + } } } } @@ -1604,7 +1598,6 @@ static void akiko_cdrom_free (void) sector_buffer_2 = 0; sector_buffer_info_1 = 0; sector_buffer_info_2 = 0; - cdromok = 0; } void akiko_reset (void) @@ -1617,9 +1610,11 @@ 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; @@ -1646,25 +1641,24 @@ void akiko_free (void) 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); @@ -1692,7 +1686,7 @@ uae_u8 *save_akiko (int *len) 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); @@ -1737,7 +1731,7 @@ uae_u8 *restore_akiko (uae_u8 *src) 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 (); @@ -1801,6 +1795,7 @@ void restore_akiko_finish (void) { if (!currprefs.cs_cd32cd) return; + sys_cddev_close (); akiko_init (); akiko_c2p_do (); get_cdrom_toc (); @@ -1814,6 +1809,7 @@ void restore_akiko_finish (void) write_comm_pipe_u32 (&requests, last_play_end, 0); write_comm_pipe_u32 (&requests, 0, 1); } + cd_initialized = 1; } #endif diff --git a/audio.cpp b/audio.cpp index ecf24069..b9f0c203 100644 --- a/audio.cpp +++ b/audio.cpp @@ -289,7 +289,8 @@ int sound_available = 0; 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; @@ -1269,7 +1270,6 @@ static void audio_state_channel2 (int nr, bool perfin) // 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; @@ -1308,8 +1308,7 @@ static void audio_state_channel2 (int nr, bool perfin) 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; @@ -1633,11 +1632,13 @@ void set_audio (void) 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; } @@ -1914,7 +1915,6 @@ int init_audio (void) return init_sound (); } - void led_filter_audio (void) { led_filter_on = 0; @@ -1922,12 +1922,46 @@ void led_filter_audio (void) 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; @@ -1942,73 +1976,34 @@ uae_u8 *restore_audio (int i, uae_u8 *src) 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 -} diff --git a/blkdev_cdimage.cpp b/blkdev_cdimage.cpp index 30f80f90..50c2a9c6 100644 --- a/blkdev_cdimage.cpp +++ b/blkdev_cdimage.cpp @@ -37,13 +37,6 @@ 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; @@ -1092,6 +1085,8 @@ static int parsemds (struct cdunit *cdu, struct zfile *zmds, const TCHAR *img) 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; } } @@ -1206,6 +1201,8 @@ static int parseccd (struct cdunit *cdu, struct zfile *zcue, const TCHAR *img) 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); @@ -1475,7 +1472,7 @@ static int parse_image (struct cdunit *cdu, const TCHAR *img) 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; diff --git a/cdtv.cpp b/cdtv.cpp index e70bdf45..e89107f6 100644 --- a/cdtv.cpp +++ b/cdtv.cpp @@ -166,6 +166,14 @@ static int get_qcode (void) 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; @@ -177,16 +185,18 @@ static void cdaudiostop (void) 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) @@ -370,6 +380,8 @@ static int play_cd (uae_u8 *p) 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); @@ -402,6 +414,8 @@ static int cdrom_subq (uae_u8 *out, int msflsn) 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; } @@ -742,7 +756,7 @@ static void *dev_thread (void *p) sys_command_cd_pause (unitnum, 0); break; case 0x0104: // stop - cdaudiostop (); + cdaudiostop_do (); break; case 0x0105: // pause pause_audio (1); @@ -785,7 +799,7 @@ static void init_play (int start, int end) bool cdtv_front_panel (int button) { - if (!frontpanel || !configured) + if (!frontpanel || configured <= 0) return false; if (button < 0) return true; @@ -1114,7 +1128,7 @@ void CDTV_hsync_handler (void) { static int subqcnt; - if (!currprefs.cs_cdtvcd || !configured) + if (!currprefs.cs_cdtvcd || configured <= 0) return; cdtv_hsync++; @@ -1201,15 +1215,11 @@ void CDTV_hsync_handler (void) 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--; @@ -1252,7 +1262,7 @@ void bleh (void) static void cdtv_reset (void) { write_log (L"CDTV: reset\n"); - cdaudiostop(); + cdaudiostop (); cd_playing = cd_paused = 0; cd_motor = 0; cd_media = 0; @@ -1479,7 +1489,7 @@ static uae_u32 REGPARAM2 dmac_bget (uaecptr addr) #endif addr &= 65535; v = dmac_bget2 (addr); - if (!configured) + if (configured <= 0) return v; return v; } @@ -1522,17 +1532,17 @@ static void REGPARAM2 dmac_bput (uaecptr addr, uae_u32 b) 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); } @@ -1543,8 +1553,6 @@ static void open_unit (void) 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) @@ -1688,16 +1696,16 @@ void cdtv_free (void) 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; } @@ -1752,13 +1760,6 @@ void cdtv_init (void) } 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); @@ -1775,16 +1776,28 @@ void cdtv_init (void) 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) @@ -1802,6 +1815,7 @@ 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; @@ -1817,6 +1831,7 @@ uae_u8 *restore_dmac (uae_u8 *src) dmac_acr = restore_u32 (); dmac_dawr = restore_u16 (); restore_u32 (); + configured = restore_u8 (); return src; } @@ -1858,6 +1873,7 @@ uae_u8 *save_cdtv (int *len) 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; @@ -1908,6 +1924,7 @@ uae_u8 *restore_cdtv (uae_u8 *src) 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; } @@ -1918,9 +1935,7 @@ void restore_cdtv_finish (void) 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 diff --git a/cfgfile.cpp b/cfgfile.cpp index 365d07ba..d72fcc89 100644 --- a/cfgfile.cpp +++ b/cfgfile.cpp @@ -180,6 +180,7 @@ static const TCHAR *dongles[] = 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", @@ -231,7 +232,15 @@ TCHAR *cfgfile_subst_path (const TCHAR *path, const TCHAR *subst, const TCHAR *f 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) @@ -1145,14 +1154,31 @@ static int cfgfile_parse_host (struct uae_prefs *p, TCHAR *option, TCHAR *value) 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; @@ -2207,12 +2233,17 @@ static int cfgfile_parse_hardware (struct uae_prefs *p, TCHAR *option, TCHAR *va } } 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: diff --git a/custom.cpp b/custom.cpp index b2395ec2..4a995fcc 100644 --- a/custom.cpp +++ b/custom.cpp @@ -61,7 +61,7 @@ #define SPR0_HPOS 0x15 #define MAX_SPRITES 8 #define SPRITE_COLLISIONS -//#define SPEEDUP +#define SPEEDUP #define AUTOSCALE_SPRITES 1 #define SPRBORDER 0 @@ -2737,7 +2737,7 @@ void init_hz (void) 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; @@ -2764,7 +2764,7 @@ void init_hz (void) 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) { @@ -5106,7 +5106,7 @@ static void vsync_handler (void) 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 (); @@ -5799,6 +5799,7 @@ void customreset (int hardreset) unset_special (~(SPCFLAG_BRK | SPCFLAG_MODE_CHANGE)); vpos = 0; + vpos_count = vpos_count_prev = 0; inputdevice_reset (); timehack_alive = 0; @@ -5817,7 +5818,6 @@ void customreset (int hardreset) diwstate = DIW_waiting_start; set_cycles (0); - vpos_count = vpos_count_prev = 0; dmal = 0; init_hz (); vpos_lpen = -1; diff --git a/disk.cpp b/disk.cpp index daa8b7b9..8778c7bb 100644 --- a/disk.cpp +++ b/disk.cpp @@ -251,15 +251,15 @@ static void disk_date (uae_u8 *p) 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++; @@ -276,7 +276,7 @@ static void createbootblock (uae_u8 *sector, int bootable) 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) @@ -438,7 +438,7 @@ static int createimagefromexe (struct zfile *src, struct zfile *dst) 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; @@ -769,7 +769,7 @@ TCHAR *DISK_get_saveimagepath (const TCHAR *name) } 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; } @@ -861,7 +861,7 @@ static bool diskfile_iswriteprotect (const TCHAR *fname, int *needwritefile, dri *needwritefile = 1; return wrprot2; } - if (memcmp (exeheader, buffer, sizeof (exeheader)) == 0) + if (memcmp (exeheader, buffer, sizeof exeheader) == 0) return 0; if (wrprot1) return wrprot2; @@ -988,7 +988,7 @@ static int drive_insert (drive * drv, struct uae_prefs *p, int dnum, const TCHAR 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); @@ -1686,7 +1686,7 @@ static void diskfile_update (struct zfile *diskfile, trackid *ti, int len, image 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); @@ -1845,7 +1845,7 @@ static int drive_write_pcdos (drive *drv) 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; @@ -2115,7 +2115,7 @@ void disk_creatediskfile (TCHAR *name, int type, drive_type adftype, TCHAR *disk 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); } diff --git a/expansion.cpp b/expansion.cpp index 8e748b33..f36c0e72 100644 --- a/expansion.cpp +++ b/expansion.cpp @@ -1493,7 +1493,7 @@ void expamem_reset (void) card_map[cardno++] = expamem_map_clear; } - if (cardno == 0) + if (cardno == 0 || savestate_state) expamem_init_clear_zero (); else (*card_init[0]) (); diff --git a/include/cdtv.h b/include/cdtv.h index c51b2120..5b9af323 100644 --- a/include/cdtv.h +++ b/include/cdtv.h @@ -6,6 +6,7 @@ extern addrbank dmac_bank; 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); diff --git a/include/rommgr.h b/include/rommgr.h index 38281747..b62c75da 100644 --- a/include/rommgr.h +++ b/include/rommgr.h @@ -52,28 +52,28 @@ struct romlist { 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); @@ -83,7 +83,8 @@ extern int decode_rom (uae_u8 *mem, int size, int mode, int real_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); diff --git a/include/uae.h b/include/uae.h index 5a54aa59..31943da3 100644 --- a/include/uae.h +++ b/include/uae.h @@ -26,6 +26,9 @@ extern void target_addtorecent (const TCHAR*, int); 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; diff --git a/memory.cpp b/memory.cpp index 27e5a662..ad24ace8 100644 --- a/memory.cpp +++ b/memory.cpp @@ -2477,6 +2477,8 @@ void memory_reset (void) 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 (); diff --git a/od-win32/blkdev_win32_ioctl.cpp b/od-win32/blkdev_win32_ioctl.cpp index f56be63d..316e4a76 100644 --- a/od-win32/blkdev_win32_ioctl.cpp +++ b/od-win32/blkdev_win32_ioctl.cpp @@ -63,6 +63,7 @@ struct dev_info_ioctl { 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]; @@ -288,40 +289,90 @@ static int spti_read (struct dev_info_ioctl *ciw, int unitnum, uae_u8 *data, int 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) { @@ -336,16 +387,11 @@ static int read_block (struct dev_info_ioctl *ciw, int unitnum, uae_u8 *data, in } } 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) { @@ -363,6 +409,7 @@ static int read_block (struct dev_info_ioctl *ciw, int unitnum, uae_u8 *data, in data += sectorsize; ret += sectorsize; } + got = true; } sector++; } @@ -414,6 +461,7 @@ static void *cdda_play (void *v) 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)); @@ -424,9 +472,9 @@ static void *cdda_play (void *v) 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; @@ -460,7 +508,8 @@ static void *cdda_play (void *v) 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; @@ -480,7 +529,7 @@ static void *cdda_play (void *v) 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) { @@ -491,17 +540,17 @@ static void *cdda_play (void *v) } 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; } diff --git a/od-win32/hardfile_win32.cpp b/od-win32/hardfile_win32.cpp index 545d5226..495491b5 100644 --- a/od-win32/hardfile_win32.cpp +++ b/od-win32/hardfile_win32.cpp @@ -317,7 +317,6 @@ static void trim (TCHAR *s) int isharddrive (const TCHAR *name) { int i; - for (i = 0; i < hdf_getnumharddrives (); i++) { if (!_tcscmp (uae_drives[i].device_name, name)) return i; @@ -380,7 +379,7 @@ int hdf_open_target (struct hardfiledata *hfd, const TCHAR *pname) 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) { @@ -992,7 +991,7 @@ static int getstorageproperty (PUCHAR outBuf, int returnedLength, struct uae_dri 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; @@ -1198,7 +1197,7 @@ static BOOL GetDevicePropertyFromName(const TCHAR *DevicePath, DWORD Index, DWOR 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)++; @@ -1221,7 +1220,7 @@ static BOOL GetDevicePropertyFromName(const TCHAR *DevicePath, DWORD Index, DWOR 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); @@ -1504,7 +1503,7 @@ TCHAR *hdf_getnameharddrive (int index, int flags, int *sectorsize, int *dangero 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) diff --git a/od-win32/keyboard_win32.cpp b/od-win32/keyboard_win32.cpp index be2282ce..7fdd8f07 100644 --- a/od-win32/keyboard_win32.cpp +++ b/od-win32/keyboard_win32.cpp @@ -282,7 +282,18 @@ void my_kbd_handler (int keyboard, int scancode, int newstate) 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) { @@ -382,9 +393,6 @@ void my_kbd_handler (int keyboard, int scancode, int newstate) 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 ()) diff --git a/od-win32/picasso96_win.cpp b/od-win32/picasso96_win.cpp index 577826e7..4d758d78 100644 --- a/od-win32/picasso96_win.cpp +++ b/od-win32/picasso96_win.cpp @@ -2470,11 +2470,11 @@ static void do_xor8 (uae_u8 *p, int w, uae_u32 v) 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; } diff --git a/od-win32/resources/resource b/od-win32/resources/resource index f85fbfb7..b366c9ed 100644 --- a/od-win32/resources/resource +++ b/od-win32/resources/resource @@ -168,7 +168,6 @@ #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 @@ -1019,6 +1018,8 @@ #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 diff --git a/od-win32/resources/winuae.rc b/od-win32/resources/winuae.rc index 56e2d2a9..805acf16 100644 --- a/od-win32/resources/winuae.rc +++ b/od-win32/resources/winuae.rc @@ -645,15 +645,15 @@ BEGIN CONTROL "Vertical Sync",IDC_CS_CIAA_TOD1,"Button",BS_AUTORADIOBUTTON | WS_GROUP | WS_TABSTOP,19,68,63,10 CONTROL "Power Supply 50Hz",IDC_CS_CIAA_TOD2,"Button",BS_AUTORADIOBUTTON | WS_TABSTOP,90,68,85,10 CONTROL "Power Supply 60Hz",IDC_CS_CIAA_TOD3,"Button",BS_AUTORADIOBUTTON | WS_TABSTOP,186,68,88,10 - CONTROL "ROM Mirror (A8)",IDC_CS_KSMIRROR_A8,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,94,146,80,10 + CONTROL "ROM Mirror (A8)",IDC_CS_KSMIRROR_A8,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,94,146,86,10 CONTROL "A1000 Boot RAM/ROM",IDC_CS_A1000RAM,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,94,95,88,10 CONTROL "CD32 CD",IDC_CS_CD32CD,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,14,108,76,10 CONTROL "CD32 C2P",IDC_CS_CD32C2P,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,94,108,87,10 - CONTROL "CD32 NVRAM",IDC_CS_CD32NVRAM,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,187,108,84,10 - CONTROL "CDTV CD",IDC_CS_CDTVCD,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,14,121,47,10 + CONTROL "CD32 NVRAM",IDC_CS_CD32NVRAM,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,187,108,97,10 + CONTROL "CDTV CD",IDC_CS_CDTVCD,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,14,121,76,10 CONTROL "CDTV SRAM",IDC_CS_CDTVRAM,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,94,120,87,10 - CONTROL "CDTV SRAM Expansion",IDC_CS_CDTVRAMEXP,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,187,120,90,10 - CONTROL "A600/A1200 IDE",IDC_CS_IDE1,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,14,133,79,10 + CONTROL "CDTV SRAM Expansion",IDC_CS_CDTVRAMEXP,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,187,120,102,10 + CONTROL "A600/A1200 IDE",IDC_CS_IDE1,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,14,133,77,10 CONTROL "A4000/A4000T IDE",IDC_CS_IDE2,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,94,133,88,10 CONTROL "Ramsey revision:",IDC_CS_RAMSEY,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,14,216,71,10 EDITTEXT IDC_CS_RAMSEYREV,91,214,45,13,ES_AUTOHSCROLL @@ -661,24 +661,24 @@ BEGIN EDITTEXT IDC_CS_FATGARYREV,91,228,45,13,ES_AUTOHSCROLL CONTROL "A3000 SCSI",IDC_CS_DMAC,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,94,188,76,10 CONTROL "Compatible Settings",IDC_CS_COMPATIBLE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,14,8,234,10 - CONTROL "DF0: ID Hardware",IDC_CS_DF0IDHW,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,187,95,92,10 + CONTROL "DF0: ID Hardware",IDC_CS_DF0IDHW,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,187,95,101,10 CONTROL "Agnus/Alice revision:",IDC_CS_AGNUS,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,147,216,81,10 EDITTEXT IDC_CS_AGNUSREV,232,214,45,13,ES_AUTOHSCROLL CONTROL "Denise/Lisa revision:",IDC_CS_DENISE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,147,229,81,10 EDITTEXT IDC_CS_DENISEREV,232,228,45,13,ES_AUTOHSCROLL CONTROL "A590/A2091 SCSI",IDC_CS_A2091,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,14,188,76,10 - CONTROL "A4000T SCSI",IDC_CS_DMAC2,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,187,188,88,10 + CONTROL "A4000T SCSI",IDC_CS_DMAC2,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,187,188,100,10 LTEXT "A4091/A4000T SCSI not yet implemented.",IDC_STATIC,17,174,159,8,SS_CENTERIMAGE - CONTROL "PCMCIA",IDC_CS_PCMCIA,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,187,133,92,10 + CONTROL "PCMCIA",IDC_CS_PCMCIA,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,187,133,105,10 CONTROL "A4091 SCSI",IDC_CS_A4091,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,14,200,76,10 CONTROL "CDTV SCSI",IDC_CS_CDTVSCSI,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,94,200,76,10 - CONTROL "Include host SCSI devices",IDC_CS_SCSIMODE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,187,200,101,10 - CONTROL "C00000 is Fast RAM",IDC_CS_SLOWISFAST,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,187,146,92,10 - CONTROL "ROM Mirror (E0)",IDC_CS_KSMIRROR_E0,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,14,146,80,10 - CONTROL "CIA ROM Overlay",IDC_CS_CIAOVERLAY,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,14,95,80,10 - CONTROL "KB Reset Warning",IDC_CS_RESETWARNING,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,14,159,80,10 - CONTROL "No-EHB Denise",IDC_CS_NOEHB,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,94,159,80,10 - CONTROL "A1000 Agnus (8361)",IDC_CS_DIPAGNUS,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,187,159,94,10 + CONTROL "Include host SCSI devices",IDC_CS_SCSIMODE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,187,200,104,10 + CONTROL "C00000 is Fast RAM",IDC_CS_SLOWISFAST,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,187,146,105,10 + CONTROL "ROM Mirror (E0)",IDC_CS_KSMIRROR_E0,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,14,146,76,10 + CONTROL "CIA ROM Overlay",IDC_CS_CIAOVERLAY,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,14,95,75,10 + CONTROL "KB Reset Warning",IDC_CS_RESETWARNING,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,14,159,77,10 + CONTROL "No-EHB Denise",IDC_CS_NOEHB,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,94,159,87,10 + CONTROL "A1000 Agnus (8361/8367)",IDC_CS_DIPAGNUS,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,187,159,107,10 END IDD_AVIOUTPUT DIALOGEX 0, 0, 288, 217 @@ -875,6 +875,7 @@ BEGIN LTEXT "Rips:",IDC_PATHS_RIPSL,13,168,261,8,SS_CENTERIMAGE EDITTEXT IDC_PATHS_RIP,13,178,261,15,ES_AUTOHSCROLL PUSHBUTTON "...",IDC_PATHS_RIPS,280,178,11,15 + CONTROL "Use relative paths",IDC_PATHS_RELATIVE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,113,230,161,10 END IDD_QUICKSTART DIALOGEX 0, 0, 300, 242 @@ -1241,6 +1242,10 @@ BEGIN BEGIN END + IDD_CHIPSET2, DIALOG + BEGIN + END + IDD_INPUT, DIALOG BEGIN END @@ -1421,7 +1426,6 @@ BEGIN IDS_PRI_BELOWNORMAL "Below Normal" IDS_PRI_LOW "Low" 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." - IDS_DEFAULT_AF2005 "Amiga Forever 2005+" IDS_DEFAULT_AF "Amiga Forever" IDS_DEFAULT_WINUAE "WinUAE default (old)" END diff --git a/od-win32/screenshot.cpp b/od-win32/screenshot.cpp index 07c075dc..c1061cd5 100644 --- a/od-win32/screenshot.cpp +++ b/od-win32/screenshot.cpp @@ -217,7 +217,7 @@ donormal: return 1; oops: - screenshot_free(); + screenshot_free (); return 0; } @@ -281,7 +281,7 @@ static int savepng (FILE *fp) } #endif -static int savebmp(FILE *fp) +static int savebmp (FILE *fp) { BITMAPFILEHEADER bfh; // write the file header, bitmap information and pixel data diff --git a/od-win32/sounddep/sound.cpp b/od-win32/sounddep/sound.cpp index 7271c6f2..2756faae 100644 --- a/od-win32/sounddep/sound.cpp +++ b/od-win32/sounddep/sound.cpp @@ -174,15 +174,17 @@ void update_sound (int freq, int longframe, int linetoggle) 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) @@ -2236,7 +2238,7 @@ static int setget_master_volume_vista (int setvolume, int *volume, int *mute) 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) diff --git a/od-win32/win32.cpp b/od-win32/win32.cpp index aefd3661..13ae05e6 100644 --- a/od-win32/win32.cpp +++ b/od-win32/win32.cpp @@ -127,7 +127,7 @@ static HANDLE AVTask; TCHAR VersionStr[256]; TCHAR BetaStr[64]; -extern int path_type; +extern pathtype path_type; int in_sizemove; int manual_painting_needed; @@ -161,12 +161,11 @@ static CRITICAL_SECTION cs_time; 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; @@ -1989,7 +1988,9 @@ typedef BOOL (WINAPI *LPFN_ISWOW64PROCESS) (HANDLE, PBOOL); void logging_init (void) { +#ifndef _WIN64 LPFN_ISWOW64PROCESS fnIsWow64Process; +#endif int wow64 = 0; static int started; static int first; @@ -2033,7 +2034,7 @@ void logging_init (void) 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 (); @@ -2072,12 +2073,12 @@ uae_u8 *save_log (int bootlog, int *len) 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; @@ -2085,9 +2086,35 @@ static void fixtrailing (TCHAR *p) 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; @@ -2834,7 +2861,6 @@ static void createdir (const TCHAR *path) 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; @@ -2859,7 +2885,7 @@ void fetch_datapath (TCHAR *out, int size) fetch_path (NULL, out, size); } -static int isfilesindir (TCHAR *p) +static int isfilesindir (const TCHAR *p) { WIN32_FIND_DATA fd; HANDLE h; @@ -2885,13 +2911,15 @@ static int isfilesindir (TCHAR *p) 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")) @@ -2906,6 +2934,7 @@ void fetch_path (TCHAR *name, TCHAR *out, int size) 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) { @@ -2913,23 +2942,25 @@ void fetch_path (TCHAR *name, TCHAR *out, int size) 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".\\"); @@ -2944,37 +2975,51 @@ int get_rom_path (TCHAR *out, int mode) } 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: @@ -2984,12 +3029,13 @@ int get_rom_path (TCHAR *out, int mode) _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]; @@ -3013,31 +3059,34 @@ void set_path (TCHAR *name, TCHAR *path) } 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; @@ -3335,6 +3384,7 @@ static struct contextcommand cc_disk[] = { 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 }, @@ -3354,7 +3404,7 @@ static void associate_init_extensions (void) 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")) { @@ -3527,6 +3577,10 @@ static void WIN32_HandleRegistryStuff (void) 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)); @@ -3851,6 +3905,20 @@ bool get_plugin_path (TCHAR *out, int len, const TCHAR *path) 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; @@ -3860,7 +3928,7 @@ static void getstartpaths (void) 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); @@ -3874,9 +3942,7 @@ static void getstartpaths (void) 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; @@ -3885,7 +3951,11 @@ static void getstartpaths (void) 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"); @@ -3942,63 +4012,40 @@ static void getstartpaths (void) _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; - } } } } @@ -4006,10 +4053,8 @@ static void getstartpaths (void) 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); @@ -4018,13 +4063,8 @@ static void getstartpaths (void) 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); @@ -4054,8 +4094,7 @@ static void getstartpaths (void) _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]) { @@ -4071,8 +4110,9 @@ static void getstartpaths (void) } } 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); @@ -4120,95 +4160,134 @@ static void makeverstr (TCHAR *s) } } -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); @@ -4216,118 +4295,122 @@ static int parseargs (const TCHAR *arg, const TCHAR *np, const TCHAR *np2) } 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; } @@ -4455,13 +4538,9 @@ static TCHAR **WIN32_InitRegistry (TCHAR **argv) 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"); @@ -4469,6 +4548,7 @@ static TCHAR **WIN32_InitRegistry (TCHAR **argv) fclose (f); reginitializeinit (path); } + xfree (path); } } if (regquerystr (NULL, L"Commandline", tmp, &size)) diff --git a/od-win32/win32.h b/od-win32/win32.h index 4114b427..54d011ad 100644 --- a/od-win32/win32.h +++ b/od-win32/win32.h @@ -18,8 +18,8 @@ #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"" @@ -78,20 +78,17 @@ extern int os_winnt_admin, os_64bit, os_vista, os_winxp, os_win7; 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); @@ -126,8 +123,9 @@ extern int CheckRM (TCHAR *DriveName); 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); diff --git a/od-win32/win32gfx.cpp b/od-win32/win32gfx.cpp index 042b191f..e866f74e 100644 --- a/od-win32/win32gfx.cpp +++ b/od-win32/win32gfx.cpp @@ -1155,8 +1155,12 @@ static void update_gfxparams (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; diff --git a/od-win32/win32gui.cpp b/od-win32/win32gui.cpp index 74087578..a6bdc30c 100644 --- a/od-win32/win32gui.cpp +++ b/od-win32/win32gui.cpp @@ -472,6 +472,7 @@ int DirectorySelection (HWND hDlg, const GUID *guid, TCHAR *path) ofn.lpstrInitialDir = path; ofn.nMaxFile = MAX_DPATH; val = GetFileDialog (&ofn, NULL, -1); + fullpath (path, MAX_DPATH); return val; } @@ -1202,18 +1203,18 @@ static struct romdata *scan_single_rom_2 (struct zfile *f) } 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]; @@ -1238,7 +1239,7 @@ static void abspathtorelative (TCHAR *name) 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]; @@ -1251,10 +1252,12 @@ static int addrom (UAEREG *fkey, struct romdata *rd, TCHAR *name) 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) { @@ -1268,9 +1271,9 @@ static int addrom (UAEREG *fkey, struct romdata *rd, TCHAR *name) return 1; } -static int isromext (TCHAR *path) +static int isromext (const TCHAR *path) { - TCHAR *ext; + const TCHAR *ext; int i; if (!path) @@ -1374,12 +1377,14 @@ static int scan_rom_2 (struct zfile *f, void *vrsd) 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; @@ -1482,7 +1487,7 @@ static void show_rom_list (void) 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; @@ -1517,14 +1522,19 @@ static int scan_roms_2 (UAEREG *fkey, TCHAR *path) #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; @@ -1539,7 +1549,7 @@ static int scan_roms_3 (UAEREG *fkey, TCHAR **paths, TCHAR *path) 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) { @@ -1576,8 +1586,9 @@ 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); @@ -1946,16 +1957,17 @@ static void ejectfloppy (int n) } } -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); @@ -1963,9 +1975,17 @@ static void selectdisk (struct uae_prefs *prefs, HWND hDlg, int num, int id, TCH } 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 @@ -2233,7 +2253,7 @@ int DiskSelection_2 (HWND hDlg, WPARAM wParam, int flag, struct uae_prefs *prefs 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 { @@ -2275,9 +2295,9 @@ int DiskSelection_2 (HWND hDlg, WPARAM wParam, int flag, struct uae_prefs *prefs 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); @@ -2334,15 +2354,19 @@ int DiskSelection_2 (HWND hDlg, WPARAM wParam, int flag, struct uae_prefs *prefs 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); @@ -2356,19 +2380,19 @@ int DiskSelection_2 (HWND hDlg, WPARAM wParam, int flag, struct uae_prefs *prefs 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); } } } @@ -4505,19 +4529,21 @@ static void resetregistry (void) 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) { @@ -4532,12 +4558,13 @@ static INT_PTR CALLBACK PathsDlgProc (HWND hDlg, UINT msg, WPARAM wParam, LPARAM 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; @@ -4550,24 +4577,17 @@ static INT_PTR CALLBACK PathsDlgProc (HWND hDlg, UINT msg, WPARAM wParam, LPARAM 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); @@ -4669,35 +4689,27 @@ static INT_PTR CALLBACK PathsDlgProc (HWND hDlg, UINT msg, WPARAM wParam, LPARAM 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 (); } @@ -4715,6 +4727,10 @@ static INT_PTR CALLBACK PathsDlgProc (HWND hDlg, UINT msg, WPARAM wParam, LPARAM 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--; @@ -4946,7 +4962,8 @@ static void testimage (HWND hDlg, int num) 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; @@ -4954,7 +4971,7 @@ static void testimage (HWND hDlg, int num) 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; @@ -7006,7 +7023,6 @@ static void values_to_kickstartdlg (HWND hDlg) 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) @@ -7118,12 +7134,6 @@ static INT_PTR CALLBACK KickstartDlgProc (HWND hDlg, UINT msg, WPARAM wParam, LP 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; @@ -7133,7 +7143,6 @@ static INT_PTR CALLBACK KickstartDlgProc (HWND hDlg, UINT msg, WPARAM wParam, LP 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); @@ -7158,7 +7167,7 @@ static void enable_for_miscdlg (HWND hDlg) 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) @@ -7437,8 +7446,10 @@ static INT_PTR MiscDlgProc (HWND hDlg, UINT msg, WPARAM wParam, LPARAM lParam) 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); @@ -8713,6 +8724,7 @@ static void hardfileselecthdf (HWND hDlg, TCHAR *newpath) { 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); @@ -10010,6 +10022,7 @@ static void addswapperfile (HWND hDlg, int entry, TCHAR *newpath) 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++; } diff --git a/od-win32/winuae_msvc10/winuae_msvc.vcxproj b/od-win32/winuae_msvc10/winuae_msvc.vcxproj index 12e74aa5..6d04a3c7 100644 --- a/od-win32/winuae_msvc10/winuae_msvc.vcxproj +++ b/od-win32/winuae_msvc10/winuae_msvc.vcxproj @@ -500,7 +500,7 @@ 0x0409 - 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) + 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) NotSet $(OutDir)$(TargetName)$(TargetExt) true diff --git a/od-win32/winuaechangelog.txt b/od-win32/winuaechangelog.txt index 68d2ea10..273483f9 100644 --- a/od-win32/winuaechangelog.txt +++ b/od-win32/winuaechangelog.txt @@ -1,4 +1,54 @@ +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 +- / 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 ":" (was "HD_") + (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 @@ -14,7 +64,7 @@ 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 diff --git a/rommgr.cpp b/rommgr.cpp index eaa09deb..d8452c54 100644 --- a/rommgr.cpp +++ b/rommgr.cpp @@ -30,7 +30,7 @@ int romlist_count (void) return romlist_cnt; } -TCHAR *romlist_get (struct romdata *rd) +TCHAR *romlist_get (const struct romdata *rd) { int i; @@ -43,7 +43,7 @@ TCHAR *romlist_get (struct romdata *rd) return 0; } -static struct romlist *romlist_getrl (struct romdata *rd) +static struct romlist *romlist_getrl (const struct romdata *rd) { int i; @@ -57,7 +57,7 @@ static struct romlist *romlist_getrl (struct romdata *rd) } 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; @@ -73,7 +73,7 @@ void romlist_add (TCHAR *path, struct romdata *rd) } -struct romdata *getromdatabypath (TCHAR *path) +struct romdata *getromdatabypath (const TCHAR *path) { int i; for (i = 0; i < romlist_cnt; i++) { @@ -88,7 +88,7 @@ struct romdata *getromdatabypath (TCHAR *path) return NULL; } -#define NEXT_ROM_ID 73 +#define NEXT_ROM_ID 74 static struct romheader romheaders[] = { { L"Freezer Cartridges", 1 }, @@ -106,6 +106,8 @@ static struct romdata roms[] = { 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 }, @@ -377,7 +379,7 @@ static void romlist_cleanup (void) } } -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; @@ -457,7 +459,7 @@ struct romlist **getromlistbyident (int ver, int rev, int subver, int subrev, TC return rdout; } -struct romdata *getarcadiarombyname (TCHAR *name) +struct romdata *getarcadiarombyname (const TCHAR *name) { int i; for (i = 0; roms[i].name; i++) { @@ -465,7 +467,7 @@ struct romdata *getarcadiarombyname (TCHAR *name) 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]; } @@ -516,7 +518,7 @@ static int kickstart_checksum_do (uae_u8 *mem, int size) return cksum == 0xffffffff; } -#define ROM_KEY_NUM 3 +#define ROM_KEY_NUM 4 struct rom_key { uae_u8 *key; int size; @@ -554,7 +556,7 @@ static void addkey (uae_u8 *key, int size, const TCHAR *name) 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; @@ -602,12 +604,12 @@ int get_keyring (void) 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 (); @@ -683,7 +685,7 @@ void free_keyring (void) 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) @@ -742,7 +744,7 @@ struct romdata *getromdatabycrc (uae_u32 crc32) return 0; } -static int cmpsha1 (uae_u8 *s1, struct romdata *rd) +static int cmpsha1 (const uae_u8 *s1, const struct romdata *rd) { int i; @@ -756,7 +758,7 @@ static int cmpsha1 (uae_u8 *s1, struct romdata *rd) 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) { @@ -914,7 +916,7 @@ struct romdata *getromdatabyzfile (struct zfile *f) return rd; } -void getromname (struct romdata *rd, TCHAR *name) +void getromname (const struct romdata *rd, TCHAR *name) { name[0] = 0; if (!rd) @@ -930,7 +932,7 @@ void getromname (struct romdata *rd, TCHAR *name) _stprintf (name + _tcslen (name), L" [%s]", rd->partnumber); } -struct romlist *getromlistbyromdata (struct romdata *rd) +struct romlist *getromlistbyromdata (const struct romdata *rd) { int ids[2]; @@ -939,7 +941,7 @@ struct romlist *getromlistbyromdata (struct romdata *rd) return getromlistbyids(ids); } -struct romlist *getromlistbyids (int *ids) +struct romlist *getromlistbyids (const int *ids) { struct romdata *rd; int i, j; @@ -958,7 +960,7 @@ struct romlist *getromlistbyids (int *ids) return NULL; } -void romwarning (int *ids) +void romwarning (const int *ids) { int i, exp; TCHAR tmp1[MAX_DPATH], tmp2[MAX_DPATH]; @@ -1027,7 +1029,7 @@ static void mergecd32 (uae_u8 *dst, uae_u8 *src, int size) #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; @@ -1035,7 +1037,7 @@ static void descramble (struct romdata *rd, uae_u8 *data, int size, int odd) 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); @@ -1298,7 +1300,7 @@ int kickstart_checksum (uae_u8 *mem, int size) 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; diff --git a/savestate.cpp b/savestate.cpp index b1c5bdea..c2dc005e 100644 --- a/savestate.cpp +++ b/savestate.cpp @@ -834,12 +834,12 @@ int save_state (const TCHAR *filename, const TCHAR *description) 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 -- 2.47.3