From 7d61007297b372f08ca75fbf8250944610f3f773 Mon Sep 17 00:00:00 2001 From: Toni Wilen Date: Mon, 9 Jul 2007 21:19:54 +0300 Subject: [PATCH] imported winuaesrc1430b9.zip --- akiko.c | 90 +++++++++++++++++++++++++++-------- cdtv.c | 6 --- moduleripper.c | 6 +++ od-win32/win32.h | 4 +- od-win32/win32gui.c | 92 ++++++++++++++++++------------------ od-win32/winuaechangelog.txt | 12 +++++ 6 files changed, 135 insertions(+), 75 deletions(-) diff --git a/akiko.c b/akiko.c index 63823a0d..cae9a660 100755 --- a/akiko.c +++ b/akiko.c @@ -25,10 +25,19 @@ #include "gui.h" #include "crc32.h" #include "uae.h" +#include "custom.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 + + +static void irq(void) +{ + if (!(intreq & 8)) { + INTREQ_f(0x8000 | 0x0008); + } +} static int m68k_getpc(void) { return 0; } @@ -280,7 +289,8 @@ static void akiko_c2p_do (void) { int i; - for (i = 0; i < 8; i++) akiko_result[i] = 0; + for (i = 0; i < 8; i++) + akiko_result[i] = 0; /* FIXME: better c2p algoritm than this piece of crap.... */ for (i = 0; i < 8 * 32; i++) { if (akiko_buffer[7 - (i >> 5)] & (1 << (i & 31))) @@ -290,7 +300,8 @@ static void akiko_c2p_do (void) static void akiko_c2p_write (int offset, uae_u32 v) { - if (offset == 3) akiko_buffer[akiko_write_offset] = 0; + if (offset == 3) + akiko_buffer[akiko_write_offset] = 0; akiko_buffer[akiko_write_offset] |= v << ( 8 * (3 - offset)); if (offset == 0) { akiko_write_offset++; @@ -323,14 +334,22 @@ static uae_u32 akiko_c2p_read (int offset) */ #define CDSTATUS_FRAME 0x80000000 +#define CDSTATUS_UNK1 0x40000000 /* not used by ROM */ +#define CDSTATUS_UNK2 0x20000000 /* not used by ROM */ #define CDSTATUS_DATA_AVAILABLE 0x10000000 #define CDSTATUS_DATASECTOR_ERROR 0x08000000 /* ?? */ #define CDSTATUS_DATASECTOR 0x04000000 -#define CDSTATUS_UNKNOWN 0x02000000 #define CDS_ERROR 0x80 #define CDS_PLAYING 0x08 +#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 + static uae_u32 cdrom_status1, cdrom_status2; static uae_u8 cdrom_status3; static uae_u32 cdrom_address1, cdrom_address2; @@ -344,7 +363,7 @@ static uae_u8 cdrom_result_buffer[32]; static uae_u8 cdrom_command_buffer[32]; static uae_u8 cdrom_command; -#define MAX_TOC_ENTRIES 103 /* tracks 1-99, A0,A1 and A2 */ +#define MAX_TOC_ENTRIES 103 /* tracks 1-99, A0, A1 and A2 */ static int cdrom_toc_entries; static int cdrom_toc_counter; static uae_u32 cdrom_toc_crc; @@ -369,6 +388,13 @@ static int cdromok = 0; static int cd_hunt; +static void set_status(uae_u32 status) +{ + cdrom_status1 |= status; + if (cdrom_status1 & cdrom_status2) + irq(); +} + static uae_u8 frombcd (uae_u8 v) { return (v >> 4) * 10 + (v & 15); @@ -418,10 +444,9 @@ static void cdaudiostop (void) static uae_u32 last_play_end; static int cd_play_audio (uae_u32 startmsf, uae_u32 endmsf, int scan) { - if (endmsf == 0xffffffff) - endmsf = last_play_end; - else - last_play_end = endmsf; + if (endmsf >= lsn2msf (cdrom_leadout)) + endmsf = lsn2msf (cdrom_leadout); + last_play_end = endmsf; return sys_command_cd_play (DF_IOCTL, unitnum,startmsf, endmsf, scan); } @@ -473,7 +498,6 @@ static int cd_qcode (uae_u8 *d) d[10] = tobcd ((uae_u8)(msf >> 0)); } } - return 0; } @@ -601,7 +625,8 @@ static void cdrom_return_data (int len) int i; uae_u8 checksum; - if (len <= 0) return; + if (len <= 0) + return; #if AKIKO_DEBUG_IO_CMD write_log ("OUT:"); #endif @@ -618,7 +643,7 @@ static void cdrom_return_data (int len) write_log ("%02.2X\n", checksum); #endif cdrom_result_complete += len + 1; - cdrom_status1 |= CDSTATUS_DATA_AVAILABLE; + set_status(CDSTATUS_DATA_AVAILABLE); } static int cdrom_command_something (void) @@ -855,7 +880,7 @@ static void cdrom_run_read (void) return; if (!cdrom_readmask_w) return; - if (cdrom_data_offset<0) + if (cdrom_data_offset < 0) return; j = cdrom_sector_counter & 15; if (unitnum >= 0 && cdrom_readmask_w & (1 << j)) { @@ -884,7 +909,7 @@ static void cdrom_run_read (void) } cdrom_sector_counter++; if (cdrom_readmask_w == 0) - cdrom_status1 |= CDSTATUS_DATASECTOR; + set_status(CDSTATUS_DATASECTOR); } static uae_sem_t akiko_sem; @@ -897,7 +922,7 @@ static void akiko_handler (void) if (unitnum < 0) return; if (cdrom_result_complete > cdrom_result_last_pos && cdrom_result_complete - cdrom_result_last_pos < 100) { - cdrom_status1 |= CDSTATUS_DATA_AVAILABLE; + set_status(CDSTATUS_DATA_AVAILABLE); return; } if (cdrom_result_last_pos < cdrom_result_complete) @@ -963,6 +988,7 @@ static void do_hunt(void) void AKIKO_hsync_handler (void) { static int framecounter; + static int frame2counter; if (!currprefs.cs_cd32cd) return; @@ -982,13 +1008,32 @@ void AKIKO_hsync_handler (void) gui_cd_led (1); cdrom_run_read (); framecounter = 1000000 / (74 * 75 * cdrom_speed); - cdrom_status1 |= CDSTATUS_FRAME; + set_status(CDSTATUS_FRAME); + } + if (cdrom_playing) { + frame2counter--; + if (frame2counter <= 0) { + uae_u8 *s; + frame2counter = 312 * 50 * 2; + s = sys_command_cd_qcode (DF_IOCTL, unitnum); + if (s) { + uae_u8 as = s[1]; + if (as == AUDIO_STATUS_IN_PROGRESS) { + int lsn = msf2lsn ((s[5 + 4] << 16) | (s[6 + 4] << 8) | (s[7 + 4] << 0)); + if (lsn >= cdrom_leadout - 75 || lsn >= msf2lsn(last_play_end) - 75) { + set_status(CDSTATUS_DATA_AVAILABLE); + cdrom_playing = 0; + cdrom_result_buffer[1] = 0; + cdrom_return_data (2); + } + } + } + } } akiko_internal (); akiko_handler (); } - static volatile int akiko_thread_running; /* cdrom data buffering thread */ @@ -1377,14 +1422,15 @@ void akiko_reset (void) akiko_cdrom_free (); } -static uae_u8 patchdata[]={0x0c,0x82,0x00,0x00,0x03,0xe8,0x64,0x00,0x00,0x46}; +static uae_u8 patchdata1[]={0x0c,0x82,0x00,0x00,0x03,0xe8,0x64,0x00,0x00,0x46}; +static uae_u8 patchdata2[]={0x0c,0x82,0x00,0x00,0x03,0xe8,0x4e,0x71,0x4e,0x71}; static void patchrom (void) { int i; uae_u8 *p = (uae_u8*)extendedkickmemory; - for (i = 0; i < 524288 - sizeof (patchdata); i++) { - if (!memcmp (p + i, patchdata, sizeof(patchdata))) { + for (i = 0; i < 524288 - sizeof (patchdata1); i++) { + if (!memcmp (p + i, patchdata1, sizeof(patchdata1))) { p[i + 6] = 0x4e; p[i + 7] = 0x71; p[i + 8] = 0x4e; @@ -1392,6 +1438,8 @@ static void patchrom (void) write_log ("extended rom delay loop patched at 0x%p\n", i + 6 + 0xe00000); return; } + if (!memcmp (p + i, patchdata2, sizeof(patchdata2))) + return; } write_log ("couldn't patch extended rom\n"); } diff --git a/cdtv.c b/cdtv.c index 6649a58e..0e250afb 100755 --- a/cdtv.c +++ b/cdtv.c @@ -161,12 +161,6 @@ static int get_qcode(void) } } s[1] = cd_audio_status; -#if 0 - if (s[1] != subq0) { - subq0 = s[1]; - do_stch(); - } -#endif return 1; } diff --git a/moduleripper.c b/moduleripper.c index a0241b34..0239932d 100755 --- a/moduleripper.c +++ b/moduleripper.c @@ -41,6 +41,8 @@ void moduleripper (void) size = currprefs.chipmem_size; size += currprefs.fastmem_size; size += currprefs.bogomem_size; + size += currprefs.mbresmem_low_size; + size += currprefs.mbresmem_high_size; size += currprefs.z3fastmem_size; buf = p = (uae_u8*)xmalloc (size); if (!buf) @@ -51,6 +53,10 @@ void moduleripper (void) p += currprefs.fastmem_size; mc (p, bogomem_start, currprefs.bogomem_size); p += currprefs.bogomem_size; + mc (p, a3000lmem_start, currprefs.mbresmem_low_size); + p += currprefs.mbresmem_low_size; + mc (p, a3000hmem_start, currprefs.mbresmem_high_size); + p += currprefs.mbresmem_high_size; mc (p, z3fastmem_start, currprefs.z3fastmem_size); p += currprefs.z3fastmem_size; diff --git a/od-win32/win32.h b/od-win32/win32.h index 94dd8708..e8711c8d 100755 --- a/od-win32/win32.h +++ b/od-win32/win32.h @@ -15,9 +15,9 @@ #define GETBDM(x) (((x) - ((x / 10000) * 10000)) / 100) #define GETBDD(x) ((x) % 100) -#define WINUAEBETA 8 +#define WINUAEBETA 9 #define WINUAEPUBLICBETA 1 -#define WINUAEDATE MAKEBD(2007, 7, 6) +#define WINUAEDATE MAKEBD(2007, 7, 9) #define WINUAEEXTRA "" #define WINUAEREV "" diff --git a/od-win32/win32gui.c b/od-win32/win32gui.c index dfa490da..56fc4a68 100755 --- a/od-win32/win32gui.c +++ b/od-win32/win32gui.c @@ -607,9 +607,11 @@ static void show_rom_list (void) ok = 1; while(*rp++ != -1); if (*rp != -1) { - ok = 0; - if (listrom (rp)) - ok = 1; + if (ok) { + ok = 0; + if (listrom (rp)) + ok = 1; + } while(*rp++ != -1); } rp++; @@ -9823,56 +9825,52 @@ static int init_page (int tmpl, int icon, int title, static RECT dialog_rect; -static void dialogmousemove(HWND hDlg, MSG *msg) +static void dialogmousemove(HWND hDlg) { - int edge2 = 80; - int rate = 32; - int qual = msg->wParam; - int newmx, newmy; - static int oldx, oldy, ignorenext; - int mx, my; - - mx = (signed short) LOWORD (msg->lParam); - my = (signed short) HIWORD (msg->lParam); + static int newmx, newmy; + RECT rc; + POINT pt; + static POINT pt2; + int dx, dy; + int sw, sh; - if (!(qual & MK_CONTROL) || ignorenext > 0) { - oldx = mx; - oldy = my; - if (ignorenext > 0) - ignorenext--; + if (isfullscreen() <= 0) return; - } - - newmx = mx - oldx; - newmy = my - oldy; - - oldx = mx; - oldy = my; - - if (newmx < -edge2 || newmy < -edge2 || newmx > edge2 || newmy > edge2) { - ignorenext++; + GetCursorPos(&pt); + if (pt.x == pt2.x && pt.y == pt2.y) return; - } + sw = WIN32GFX_GetWidth(); + sh = WIN32GFX_GetHeight(); + dx = dialog_x_offset; + dy = dialog_y_offset; + GetWindowRect(hDlg, &rc); + rc.right -= rc.left; + rc.bottom -= rc.top; + rc.left = 0; + rc.top = 0; + if (rc.right <= sw && rc.bottom <= sh) + return; + pt2.x = pt.x; + pt2.y = pt.y; - write_log("%dx%d\n", newmx, newmy); + newmx = pt.x; + newmy = pt.y; - dialog_x_offset += newmx; - dialog_y_offset += newmy; - - /* - if (dialog_x_offset >= dialog_rect.right - WIN32GFX_GetWidth() + edge2) - dialog_x_offset = dialog_rect.right - WIN32GFX_GetWidth() + edge2; - if (dialog_y_offset >= dialog_rect.bottom - WIN32GFX_GetHeight() + edge2) - dialog_y_offset = dialog_rect.bottom - WIN32GFX_GetHeight() + edge2; - if (dialog_x_offset < -edge2) - dialog_x_offset = -edge2; - if (dialog_y_offset < -edge2) - dialog_y_offset = -edge2; -*/ - SetWindowPos(hDlg, 0, dialog_x_offset, dialog_y_offset, 0, 0, - SWP_NOOWNERZORDER | SWP_NOREDRAW | SWP_NOSIZE | SWP_NOACTIVATE | SWP_DEFERERASE); - ignorenext++; + if (newmx >= sw - 1 && rc.right > sw) + dx = sw - rc.right; + if (newmx <= 1) + dx = 0; + if (newmy >= sh - 1 && rc.bottom > sh) + dy = sh - rc.bottom; + if (newmy <= 1) + dy = 0; + if (dx != dialog_x_offset || dy != dialog_y_offset) { + dialog_x_offset = dx; + dialog_y_offset = dy; + SetWindowPos(hDlg, 0, dialog_x_offset, dialog_y_offset, 0, 0, + SWP_NOOWNERZORDER | SWP_NOSIZE | SWP_NOACTIVATE | SWP_DEFERERASE); + } } static int GetSettings (int all_options, HWND hwnd) @@ -9963,6 +9961,7 @@ static int GetSettings (int all_options, HWND hwnd) } ShowWindow (dhwnd, SW_SHOW); MapDialogRect(dhwnd, &dialog_rect); + for (;;) { HANDLE IPChandle; IPChandle = geteventhandleIPC(); @@ -9972,6 +9971,7 @@ static int GetSettings (int all_options, HWND hwnd) } else { WaitMessage(); } + dialogmousemove(dhwnd); while ((v = PeekMessage (&msg, NULL, 0, 0, PM_REMOVE))) { if (dialogreturn >= 0) break; diff --git a/od-win32/winuaechangelog.txt b/od-win32/winuaechangelog.txt index 6cc2a944..ea0b6066 100755 --- a/od-win32/winuaechangelog.txt +++ b/od-win32/winuaechangelog.txt @@ -1,4 +1,16 @@ +Beta 9: + +- ROM scan dialog listed "available" even if configuration required + 2 ROMs (like CDTV or CD32) and only one was available. +- if fullscreen resolution is smaller than GUI size, moving mouse to + screen borders moves the GUI dialog. (in future this means it is now + possible to increase GUI size to 800x600 without too many complaints) +- CD32 CD audio end position detection and signaling, interrupt + handling finally implemented, fixes non-looping audio tracks, + (for example Brian the Lion), and games that freeze (for example + Fightin' Spirit, Base Jumpers) + Beta 8: - plain executable mounted as a harddrive automatically creates -- 2.47.3