You can subscribe to this list here.
2003 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
(208) |
Nov
(108) |
Dec
(114) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2004 |
Jan
(160) |
Feb
(184) |
Mar
(149) |
Apr
(148) |
May
(168) |
Jun
(144) |
Jul
(194) |
Aug
(47) |
Sep
(40) |
Oct
(44) |
Nov
(54) |
Dec
(30) |
2005 |
Jan
(77) |
Feb
(77) |
Mar
(69) |
Apr
(22) |
May
(21) |
Jun
(4) |
Jul
(3) |
Aug
(1) |
Sep
(11) |
Oct
(26) |
Nov
|
Dec
(10) |
2006 |
Jan
|
Feb
|
Mar
|
Apr
|
May
(7) |
Jun
(11) |
Jul
(59) |
Aug
(51) |
Sep
(34) |
Oct
(6) |
Nov
(4) |
Dec
(24) |
2007 |
Jan
(102) |
Feb
(69) |
Mar
(50) |
Apr
(56) |
May
(198) |
Jun
(119) |
Jul
(51) |
Aug
(48) |
Sep
(49) |
Oct
(87) |
Nov
(107) |
Dec
(79) |
2008 |
Jan
(46) |
Feb
(32) |
Mar
(60) |
Apr
(15) |
May
(39) |
Jun
(60) |
Jul
(30) |
Aug
(26) |
Sep
(11) |
Oct
(26) |
Nov
(50) |
Dec
(56) |
2009 |
Jan
(55) |
Feb
(7) |
Mar
(8) |
Apr
(21) |
May
(15) |
Jun
(13) |
Jul
(20) |
Aug
(14) |
Sep
(19) |
Oct
(6) |
Nov
(3) |
Dec
(7) |
2010 |
Jan
(4) |
Feb
(9) |
Mar
(1) |
Apr
|
May
(13) |
Jun
(1) |
Jul
(4) |
Aug
(11) |
Sep
(11) |
Oct
(23) |
Nov
(16) |
Dec
(33) |
2011 |
Jan
(49) |
Feb
(33) |
Mar
(12) |
Apr
(73) |
May
(44) |
Jun
(71) |
Jul
(14) |
Aug
(3) |
Sep
(12) |
Oct
|
Nov
(44) |
Dec
(25) |
2012 |
Jan
(36) |
Feb
(28) |
Mar
(7) |
Apr
|
May
(21) |
Jun
(14) |
Jul
(7) |
Aug
|
Sep
(8) |
Oct
(18) |
Nov
(25) |
Dec
(59) |
2013 |
Jan
(30) |
Feb
(30) |
Mar
(14) |
Apr
(7) |
May
(91) |
Jun
(11) |
Jul
(5) |
Aug
(4) |
Sep
(21) |
Oct
(6) |
Nov
|
Dec
(4) |
2014 |
Jan
(6) |
Feb
(5) |
Mar
(3) |
Apr
(2) |
May
(7) |
Jun
|
Jul
(3) |
Aug
(2) |
Sep
(6) |
Oct
|
Nov
(1) |
Dec
(8) |
2015 |
Jan
(7) |
Feb
(2) |
Mar
(77) |
Apr
(23) |
May
(69) |
Jun
(26) |
Jul
(2) |
Aug
(4) |
Sep
(2) |
Oct
(7) |
Nov
(9) |
Dec
(17) |
2016 |
Jan
(5) |
Feb
(1) |
Mar
(18) |
Apr
(57) |
May
(134) |
Jun
(96) |
Jul
(52) |
Aug
(76) |
Sep
(26) |
Oct
(49) |
Nov
(44) |
Dec
(23) |
2017 |
Jan
(72) |
Feb
(13) |
Mar
(29) |
Apr
(19) |
May
(61) |
Jun
(75) |
Jul
(58) |
Aug
(165) |
Sep
(62) |
Oct
(23) |
Nov
(41) |
Dec
(11) |
2018 |
Jan
(18) |
Feb
(16) |
Mar
(20) |
Apr
(56) |
May
(28) |
Jun
(49) |
Jul
(37) |
Aug
(15) |
Sep
(32) |
Oct
(11) |
Nov
(10) |
Dec
(11) |
2019 |
Jan
(50) |
Feb
(12) |
Mar
(26) |
Apr
(12) |
May
(6) |
Jun
|
Jul
(6) |
Aug
|
Sep
(10) |
Oct
(1) |
Nov
(1) |
Dec
|
2020 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
(12) |
Oct
|
Nov
|
Dec
|
2021 |
Jan
|
Feb
(39) |
Mar
(31) |
Apr
|
May
(2) |
Jun
(2) |
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
2023 |
Jan
(1) |
Feb
(1) |
Mar
(19) |
Apr
(2) |
May
(4) |
Jun
(14) |
Jul
(11) |
Aug
(7) |
Sep
(7) |
Oct
(18) |
Nov
(5) |
Dec
|
2024 |
Jan
(2) |
Feb
(5) |
Mar
|
Apr
|
May
|
Jun
|
Jul
(4) |
Aug
|
Sep
|
Oct
(7) |
Nov
|
Dec
|
From: <sba...@us...> - 2024-10-19 16:33:24
|
This is an automated email from the git hooks/post-receive-user script. sbaldovi pushed a commit to branch master in repository fuse. View the commit online: https://sourceforge.net/p/fuse-emulator/fuse/ci/039d7db373eed83cb347d39d6688a07e7a296ec7/ The following commit(s) were added to refs/heads/master by this push: new 039d7db3 Keep only the mime types for the most common formats 039d7db3 is described below commit 039d7db373eed83cb347d39d6688a07e7a296ec7 Author: Alberto Garcia <be...@ig...> AuthorDate: Sun Oct 6 01:30:47 2024 +0200 Keep only the mime types for the most common formats The fuse.xml file contains a large amount of file formats, some of them are quite obscure and others like .wav are generic. This patch simplifies this file and keeps only some of the most common formats: .dsk, .pzx, .rzx, .slt, .sna, .szx, .tap, .tzx and .z80 More from bug #494 --- data/fuse.xml.in | 178 ------------------------------------------------------- 1 file changed, 178 deletions(-) diff --git a/data/fuse.xml.in b/data/fuse.xml.in index 14e566a7..1f6e6da4 100644 --- a/data/fuse.xml.in +++ b/data/fuse.xml.in @@ -1,24 +1,5 @@ <?xml version="1.0" encoding="UTF-8"?> <mime-info xmlns='http://www.freedesktop.org/standards/shared-mime-info'> - <mime-type type="audio/x-spectrum-csw"> - <comment>ZX Spectrum audio</comment> - <magic> - <match type="string" offset="0" value="Compressed Square Wave\x1a"/> - </magic> - <generic-icon name="application-x-spectrum"/> - <glob pattern="*.csw"/> - </mime-type> - <mime-type type="application/x-spectrum-dck"> - <comment>ZX Spectrum cartridge</comment> - <generic-icon name="application-x-spectrum"/> - <glob pattern="*.dck"/> - </mime-type> - <mime-type type="application/x-spectrum-d80"> - <comment>ZX Spectrum disk</comment> - <generic-icon name="application-x-spectrum"/> - <glob pattern="*.d40"/> - <glob pattern="*.d80"/> - </mime-type> <mime-type type="application/x-spectrum-dsk"> <comment>ZX Spectrum disk</comment> <magic> @@ -28,52 +9,6 @@ <generic-icon name="application-x-spectrum"/> <glob pattern="*.dsk"/> </mime-type> - <mime-type type="application/x-spectrum-fdi"> - <comment>ZX Spectrum disk</comment> - <magic> - <match type="string" offset="0" value="FDI"/> - </magic> - <generic-icon name="application-x-spectrum"/> - <glob pattern="*.fdi"/> - </mime-type> - <mime-type type="application/x-spectrum-hdf"> - <comment>ZX Spectrum harddisk</comment> - <magic> - <match type="string" offset="0" value="RS-IDE\x1a"/> - </magic> - <generic-icon name="application-x-spectrum"/> - <glob pattern="*.hdf"/> - </mime-type> - <mime-type type="application/x-spectrum-ltp"> - <comment>ZX Spectrum tape</comment> - <generic-icon name="application-x-spectrum"/> - <glob pattern="*.ltp"/> - </mime-type> - <mime-type type="application/x-spectrum-mdr"> - <comment>ZX Spectrum microdrive</comment> - <generic-icon name="application-x-spectrum"/> - <glob pattern="*.mdr"/> - </mime-type> - <mime-type type="application/x-spectrum-mgt"> - <comment>ZX Spectrum disk</comment> - <generic-icon name="application-x-spectrum"/> - <glob pattern="*.mgt"/> - </mime-type> - <mime-type type="application/x-spectrum-mgtsnp"> - <comment>ZX Spectrum snapshot</comment> - <generic-icon name="application-x-spectrum"/> - <glob pattern="*.mgtsnp"/> - </mime-type> - <mime-type type="application/x-spectrum-opd"> - <comment>ZX Spectrum disk</comment> - <generic-icon name="application-x-spectrum"/> - <glob pattern="*.opd"/> - </mime-type> - <mime-type type="application/x-spectrum-opu"> - <comment>ZX Spectrum disk</comment> - <generic-icon name="application-x-spectrum"/> - <glob pattern="*.opu"/> - </mime-type> <mime-type type="application/x-spectrum-pzx"> <comment>ZX Spectrum tape</comment> <magic> @@ -90,22 +25,6 @@ <generic-icon name="application-x-spectrum"/> <glob pattern="*.rzx"/> </mime-type> - <mime-type type="application/x-spectrum-sad"> - <comment>ZX Spectrum disk</comment> - <magic> - <match type="string" offset="0" value="Aley's disk backup"/> - </magic> - <generic-icon name="application-x-spectrum"/> - <glob pattern="*.sad"/> - </mime-type> - <mime-type type="application/x-spectrum-scl"> - <comment>ZX Spectrum disk</comment> - <magic> - <match type="string" offset="0" value="SINCLAIR"/> - </magic> - <generic-icon name="application-x-spectrum"/> - <glob pattern="*.scl"/> - </mime-type> <mime-type type="application/x-spectrum-slt"> <comment>ZX Spectrum snapshot</comment> <generic-icon name="application-x-spectrum"/> @@ -115,32 +34,6 @@ <comment>ZX Spectrum snapshot</comment> <generic-icon name="application-x-spectrum"/> <glob pattern="*.sna"/> - <glob pattern="*.snapshot"/> - </mime-type> - <mime-type type="application/x-spectrum-s"> - <comment>ZX Spectrum snapshot</comment> - <generic-icon name="application-x-spectrum"/> - <glob pattern="*.s"/> - </mime-type> - <mime-type type="application/x-spectrum-snp"> - <comment>ZX Spectrum snapshot</comment> - <generic-icon name="application-x-spectrum"/> - <glob pattern="*.snp"/> - </mime-type> - <mime-type type="application/x-spectrum-sp"> - <comment>ZX Spectrum snapshot</comment> - <generic-icon name="application-x-spectrum"/> - <glob pattern="*.sp"/> - </mime-type> - <mime-type type="application/x-spectrum-spc"> - <comment>ZX Spectrum tape</comment> - <generic-icon name="application-x-spectrum"/> - <glob pattern="*.spc"/> - </mime-type> - <mime-type type="application/x-spectrum-sta"> - <comment>ZX Spectrum tape</comment> - <generic-icon name="application-x-spectrum"/> - <glob pattern="*.sta"/> </mime-type> <mime-type type="application/x-spectrum-szx"> <comment>ZX Spectrum snapshot</comment> @@ -151,28 +44,11 @@ <glob pattern="*.szx"/> <glob pattern="*.zx-state"/> </mime-type> - <mime-type type="application/x-spectrum-td0"> - <comment>ZX Spectrum disk</comment> - <magic> - <match type="string" offset="0" value="TD"/> - <match type="string" offset="0" value="td"/> - </magic> - <generic-icon name="application-x-spectrum"/> - <glob pattern="*.td0"/> - </mime-type> <mime-type type="application/x-spectrum-tap"> <comment>ZX Spectrum tape</comment> <generic-icon name="application-x-spectrum"/> <glob pattern="*.tap"/> </mime-type> - <mime-type type="application/x-spectrum-trd"> - <comment>ZX Spectrum disk</comment> - <magic> - <match type="string" offset="0" value="SINCLAIR"/> - </magic> - <generic-icon name="application-x-spectrum"/> - <glob pattern="*.trd"/> - </mime-type> <mime-type type="application/x-spectrum-tzx"> <comment>ZX Spectrum tape</comment> <magic> @@ -181,91 +57,37 @@ <generic-icon name="application-x-spectrum"/> <glob pattern="*.tzx"/> </mime-type> - <mime-type type="application/x-spectrum-udi"> - <comment>ZX Spectrum disk</comment> - <magic> - <match type="string" offset="0" value="UDI!"/> - </magic> - <generic-icon name="application-x-spectrum"/> - <glob pattern="*.udi"/> - </mime-type> <mime-type type="application/x-spectrum-z80"> <comment>ZX Spectrum snapshot</comment> <generic-icon name="application-x-spectrum"/> <glob pattern="*.z80"/> </mime-type> - <mime-type type="application/x-spectrum-zxs"> - <comment>ZX Spectrum snapshot</comment> - <magic> - <match type="string" offset="0" value="SNAP"/> - </magic> - <generic-icon name="application-x-spectrum"/> - <glob pattern="*.zxs"/> - </mime-type> - ##LIBSPECTRUM_HAVE_AUDIOFILE_BEGIN## - <mime-type type="audio/x-spectrum-wav"> - <comment>ZX Spectrum audio</comment> - <magic priority="20"> - <match value="WAVE" type="string" offset="8"/> - <match value="WAV " type="string" offset="8"/> - </magic> - <glob pattern="*.wav"/> - </mime-type> - ##LIBSPECTRUM_HAVE_AUDIOFILE_END## ##LIBSPECTRUM_HAVE_ZLIB_BEGIN## <mime-type type="application/x-spectrum-compressed"> <comment>ZX Spectrum compressed</comment> <generic-icon name="application-x-spectrum"/> - <glob pattern="*.csw.gz"/> - <glob pattern="*.dck.gz"/> - <glob pattern="*.mgtsnp.gz"/> - <glob pattern="*.ltp.gz"/> <glob pattern="*.pzx.gz"/> - <glob pattern="*.raw.gz"/> <glob pattern="*.rzx.gz"/> <glob pattern="*.slt.gz"/> <glob pattern="*.sna.gz"/> - <glob pattern="*.snapshot.gz"/> - <glob pattern="*.snp.gz"/> - <glob pattern="*.sp.gz"/> - <glob pattern="*.spc.gz"/> - <glob pattern="*.sta.gz"/> <glob pattern="*.szx.gz"/> <glob pattern="*.tap.gz"/> <glob pattern="*.tzx.gz"/> - ##LIBSPECTRUM_HAVE_AUDIOFILE_BEGIN## - <glob pattern="*.wav.gz"/> - ##LIBSPECTRUM_HAVE_AUDIOFILE_END## <glob pattern="*.z80.gz"/> - <glob pattern="*.zxs.gz"/> </mime-type> ##LIBSPECTRUM_HAVE_ZLIB_END## ##LIBSPECTRUM_HAVE_BZ2_BEGIN## <mime-type type="application/x-spectrum-compressed-bz2"> <comment>ZX Spectrum compressed</comment> <generic-icon name="application-x-spectrum"/> - <glob pattern="*.csw.bz2"/> - <glob pattern="*.dck.bz2"/> - <glob pattern="*.mgtsnp.bz2"/> - <glob pattern="*.ltp.bz2"/> <glob pattern="*.pzx.bz2"/> - <glob pattern="*.raw.bz2"/> <glob pattern="*.rzx.bz2"/> <glob pattern="*.slt.bz2"/> <glob pattern="*.sna.bz2"/> - <glob pattern="*.snapshot.bz2"/> - <glob pattern="*.snp.bz2"/> - <glob pattern="*.sp.bz2"/> - <glob pattern="*.spc.bz2"/> - <glob pattern="*.sta.bz2"/> <glob pattern="*.szx.bz2"/> <glob pattern="*.tap.bz2"/> <glob pattern="*.tzx.bz2"/> - ##LIBSPECTRUM_HAVE_AUDIOFILE_BEGIN## - <glob pattern="*.wav.bz2"/> - ##LIBSPECTRUM_HAVE_AUDIOFILE_END## <glob pattern="*.z80.bz2"/> - <glob pattern="*.zxs.bz2"/> </mime-type> ##LIBSPECTRUM_HAVE_BZ2_END## </mime-info> |
From: <sba...@us...> - 2024-10-19 08:06:04
|
This is an automated email from the git hooks/post-receive-user script. sbaldovi pushed a commit to branch master in repository fuse-utils. View the commit online: https://sourceforge.net/p/fuse-emulator/fuse-utils/ci/98fc1ded794467a98436c5a6c239844f3d9f562d/ The following commit(s) were added to refs/heads/master by this push: new 98fc1de Fix description of TZX message blocks 98fc1de is described below commit 98fc1ded794467a98436c5a6c239844f3d9f562d Author: Alberto Garcia <be...@ig...> AuthorDate: Mon Oct 14 00:13:33 2024 +0200 Fix description of TZX message blocks TZX message blocks specify the time in seconds, but libspectrum's tzx_read_message() stores it internally in miliseconds. (fixes bug #502) --- tzxlist.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tzxlist.c b/tzxlist.c index 68c1b98..f15c3ef 100644 --- a/tzxlist.c +++ b/tzxlist.c @@ -608,7 +608,7 @@ process_tape( char *filename ) case LIBSPECTRUM_TAPE_BLOCK_MESSAGE: - printf(" Display for %d seconds\n", + printf(" Display for %d ms\n", libspectrum_tape_block_pause( block ) ); /* Fall through */ |
From: <sba...@us...> - 2024-10-19 07:54:23
|
This is an automated email from the git hooks/post-receive-user script. sbaldovi pushed a commit to branch master in repository fuse. View the commit online: https://sourceforge.net/p/fuse-emulator/fuse/ci/e65a7bb0a884827f0c0a95ffe77da4ef7831ed27/ commit e65a7bb0a884827f0c0a95ffe77da4ef7831ed27 Author: Sergio Baldoví <ser...@gm...> AuthorDate: Sat Oct 19 09:45:54 2024 +0200 Suppress a -Wmisleading-indentation warning from GCC in Xlib UI --- ui/xlib/xdisplay.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/ui/xlib/xdisplay.c b/ui/xlib/xdisplay.c index ce29a497..cc9dc17b 100644 --- a/ui/xlib/xdisplay.c +++ b/ui/xlib/xdisplay.c @@ -975,7 +975,11 @@ xdisplay_destroy_image(void) shm_used = 0; } #endif - if( image ) XDestroyImage( image ); image = NULL; + + if( image != NULL ) { + XDestroyImage( image ); + image = NULL; + } } static void |
From: <sba...@us...> - 2024-10-19 07:54:21
|
This is an automated email from the git hooks/post-receive-user script. sbaldovi pushed a commit to branch master in repository fuse. View the commit online: https://sourceforge.net/p/fuse-emulator/fuse/ci/8f1102713187dadea6ea7a78cfb3e5afda383c51/ commit 8f1102713187dadea6ea7a78cfb3e5afda383c51 Author: Sergio Baldoví <ser...@gm...> AuthorDate: Sat Oct 19 09:41:22 2024 +0200 Remove GTK names for XPM icons used in Xlib UI --- ui/xlib/xpixmaps.c.in | 22 +++++++++++----------- ui/xlib/xstatusbar.pl | 1 - 2 files changed, 11 insertions(+), 12 deletions(-) diff --git a/ui/xlib/xpixmaps.c.in b/ui/xlib/xpixmaps.c.in index a86ecbda..7ae2dc90 100644 --- a/ui/xlib/xpixmaps.c.in +++ b/ui/xlib/xpixmaps.c.in @@ -23,7 +23,7 @@ #error "This file is used to generate ui/xlib/xpixmaps.c and is not meant to be compiled" -const char *gtkpixmap_tape_inactive[] = { +const char *pixmap_tape_inactive[] = { "27 17 13 1", " c None", ". c #D5D5D5", @@ -56,7 +56,7 @@ const char *gtkpixmap_tape_inactive[] = { ".+..>.................>..+.", "....>.................>...."}; -const char *gtkpixmap_tape_active[] = { +const char *pixmap_tape_active[] = { "27 17 13 1", " c None", ". c #00D500", @@ -89,7 +89,7 @@ const char *gtkpixmap_tape_active[] = { ".+..>.................>..+.", "....>.................>...."}; -const char *gtkpixmap_mdr_inactive[] = { +const char *pixmap_mdr_inactive[] = { "15 20 6 1", " c None", ". c #000000", @@ -118,7 +118,7 @@ const char *gtkpixmap_mdr_inactive[] = { "+++++++++++++++", "+++++++++++++++"}; -const char *gtkpixmap_mdr_active[] = { +const char *pixmap_mdr_active[] = { "15 20 6 1", " c None", ". c #000000", @@ -147,7 +147,7 @@ const char *gtkpixmap_mdr_active[] = { "+++++++++++++++", "+++++++++++++++"}; -const char *gtkpixmap_disk_inactive[] = { +const char *pixmap_disk_inactive[] = { "15 20 7 1", " c None", ". c #A5A5A5", @@ -177,7 +177,7 @@ const char *gtkpixmap_disk_inactive[] = { "++@@@@@@@#@@#..", "..##@#@@@@#@#.+"}; -const char *gtkpixmap_disk_active[] = { +const char *pixmap_disk_active[] = { "15 20 7 1", " c None", ". c #00A500", @@ -207,7 +207,7 @@ const char *gtkpixmap_disk_active[] = { "++@@@@@@@#@@#..", "..##@#@@@@#@#.+"}; -const char *gtkpixmap_pause_inactive[] = { +const char *pixmap_pause_inactive[] = { "30 21 7 1", " c None", ". c #6C6C6C", @@ -238,7 +238,7 @@ const char *gtkpixmap_pause_inactive[] = { " #$$$$+ ", " %$@ "}; -const char *gtkpixmap_pause_active[] = { +const char *pixmap_pause_active[] = { "30 21 7 1", " c None", ". c #D80000", @@ -269,7 +269,7 @@ const char *gtkpixmap_pause_active[] = { " #$$$$+ ", " %$@ "}; -const char *gtkpixmap_tape_marker[] = { +const char *pixmap_tape_marker[] = { "8 16 2 1", " c None", ". c #212FC6", @@ -290,7 +290,7 @@ const char *gtkpixmap_tape_marker[] = { ".. ", ". "}; -const char *gtkpixmap_mouse_inactive[] = { +const char *pixmap_mouse_inactive[] = { "14 21 4 1", " c None", "# c #6C6C6C", @@ -318,7 +318,7 @@ const char *gtkpixmap_mouse_inactive[] = { " +##########+ ", " ++######++ "}; -const char *gtkpixmap_mouse_active[] = { +const char *pixmap_mouse_active[] = { "14 21 4 1", " c None", "# c #0000D0", diff --git a/ui/xlib/xstatusbar.pl b/ui/xlib/xstatusbar.pl index fd6644dd..979bf1ba 100644 --- a/ui/xlib/xstatusbar.pl +++ b/ui/xlib/xstatusbar.pl @@ -174,7 +174,6 @@ sub xpm_read() { next if($var_name =~ /tape_marker/); next if($var_name =~ /pause/); next if($var_name =~ /mouse/); - $var_name =~ s/gtkpixmap/pixmap/; %colors = (); $def = ''; $col = 'AA'; |
From: <sba...@us...> - 2024-10-19 07:54:20
|
This is an automated email from the git hooks/post-receive-user script. sbaldovi pushed a commit to branch master in repository fuse. View the commit online: https://sourceforge.net/p/fuse-emulator/fuse/ci/9b8343b71f3ea774e12fdfb8d9e4f4799c7b23e6/ commit 9b8343b71f3ea774e12fdfb8d9e4f4799c7b23e6 Author: Alberto Garcia <be...@ig...> AuthorDate: Sat Oct 12 01:23:25 2024 +0200 Don't leak tape_marker_pixbuf when the tape browser is closed --- ui/gtk/browse.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ui/gtk/browse.c b/ui/gtk/browse.c index 257b2205..b2211b6e 100644 --- a/ui/gtk/browse.c +++ b/ui/gtk/browse.c @@ -156,7 +156,7 @@ create_dialog( void ) /* The tape marker pixbuf */ tape_marker_pixbuf = gdk_pixbuf_new_from_resource( ICON_TAPE_MARKER, NULL ); - /* FIXME: unref this at exit */ + g_object_weak_ref( G_OBJECT( dialog ), (GWeakNotify) g_clear_object, &tape_marker_pixbuf ); /* And the list itself */ blocks = create_block_list(); |
From: <sba...@us...> - 2024-10-19 07:54:18
|
This is an automated email from the git hooks/post-receive-user script. sbaldovi pushed a commit to branch master in repository fuse. View the commit online: https://sourceforge.net/p/fuse-emulator/fuse/ci/51438970e6931d66adbc2de22dd56b5bc17177a7/ commit 51438970e6931d66adbc2de22dd56b5bc17177a7 Author: Alberto Garcia <be...@ig...> AuthorDate: Sat Oct 12 01:23:23 2024 +0200 Use PNG instead of XPM for the icons in the GTK UI Starting from version 2.42.11 the gdk-pixbuf library disables the XPM loader by default. Because of that Fuse won't be able to show the toolbar icons in the GTK UI. This patch converts the icons to PNG and embeds them in the binary using GResource. The old ui/gtk/pixmaps.c is no longer needed by the GTK UI but it is still used to generate ui/xlib/xpixmaps.c so it is moved to that directory. (fixes bug #509) --- .gitignore | 2 ++ ui/gtk/Makefile.am | 29 ++++++++++++++++++++++++++--- ui/gtk/browse.c | 2 +- ui/gtk/gtkinternals.h | 26 ++++++++++++++------------ ui/gtk/gtkui.c | 5 +++++ ui/gtk/icons/disk_active.png | Bin 0 -> 244 bytes ui/gtk/icons/disk_inactive.png | Bin 0 -> 262 bytes ui/gtk/icons/mdr_active.png | Bin 0 -> 183 bytes ui/gtk/icons/mdr_inactive.png | Bin 0 -> 187 bytes ui/gtk/icons/mouse_active.png | Bin 0 -> 158 bytes ui/gtk/icons/mouse_inactive.png | Bin 0 -> 162 bytes ui/gtk/icons/pause_active.png | Bin 0 -> 265 bytes ui/gtk/icons/pause_inactive.png | Bin 0 -> 275 bytes ui/gtk/icons/tape_active.png | Bin 0 -> 221 bytes ui/gtk/icons/tape_inactive.png | Bin 0 -> 244 bytes ui/gtk/icons/tape_marker.png | Bin 0 -> 142 bytes ui/gtk/resources.xml | 16 ++++++++++++++++ ui/gtk/statusbar.c | 20 ++++++++++---------- ui/xlib/Makefile.am | 5 +++-- ui/{gtk/pixmaps.c => xlib/xpixmaps.c.in} | 4 +--- ui/xlib/xstatusbar.pl | 2 +- 21 files changed, 79 insertions(+), 32 deletions(-) diff --git a/.gitignore b/.gitignore index b321f4a0..8b1dc1d0 100644 --- a/.gitignore +++ b/.gitignore @@ -77,6 +77,8 @@ tags /ui/gtk/options.c /ui/gtk/options.h /ui/gtk/options_internals.h +/ui/gtk/resources.c +/ui/gtk/resources.h /ui/null/options.c /ui/sdl/keysyms.c /ui/widget/fuse.font diff --git a/ui/gtk/Makefile.am b/ui/gtk/Makefile.am index ef5f3891..76385cbf 100644 --- a/ui/gtk/Makefile.am +++ b/ui/gtk/Makefile.am @@ -30,6 +30,18 @@ pkgdata_DATA += ui/gtk/menu_data.ui endif +gtkui_resource_files = \ + ui/gtk/icons/disk_active.png \ + ui/gtk/icons/disk_inactive.png \ + ui/gtk/icons/mdr_active.png \ + ui/gtk/icons/mdr_inactive.png \ + ui/gtk/icons/mouse_active.png \ + ui/gtk/icons/mouse_inactive.png \ + ui/gtk/icons/pause_active.png \ + ui/gtk/icons/pause_inactive.png \ + ui/gtk/icons/tape_active.png \ + ui/gtk/icons/tape_inactive.png \ + ui/gtk/icons/tape_marker.png CLEANFILES += $(ui_gtk_built) @@ -50,9 +62,10 @@ ui_gtk_files = \ ui/gtk/menu_data.c \ ui/gtk/options.c \ ui/gtk/picture.c \ - ui/gtk/pixmaps.c \ ui/gtk/pokefinder.c \ ui/gtk/pokemem.c \ + ui/gtk/resources.c \ + ui/gtk/resources.h \ ui/gtk/rollback.c \ ui/gtk/roms.c \ ui/gtk/statusbar.c \ @@ -74,11 +87,15 @@ ui_gtk_built = \ ui/gtk/menu_data.c \ ui/gtk/menu_data.ui \ ui/gtk/options.c \ - ui/gtk/options_internals.h + ui/gtk/options_internals.h \ + ui/gtk/resources.c \ + ui/gtk/resources.h EXTRA_DIST += \ + $(gtkui_resource_files) \ ui/gtk/options.pl \ - ui/gtk/options-header.pl + ui/gtk/options-header.pl \ + ui/gtk/resources.xml ui/gtk/keysyms.c: $(srcdir)/keysyms.pl $(srcdir)/keysyms.dat @$(MKDIR_P) ui/gtk @@ -99,3 +116,9 @@ ui/gtk/options.c: $(srcdir)/perl/cpp-perl.pl config.h $(srcdir)/ui/gtk/options.p ui/gtk/options_internals.h: $(srcdir)/perl/cpp-perl.pl config.h $(srcdir)/ui/gtk/options-header.pl $(srcdir)/ui/options.dat $(srcdir)/perl/Fuse.pm $(srcdir)/perl/Fuse/Dialog.pm @$(MKDIR_P) ui/gtk $(AM_V_GEN)$(PERL) $(srcdir)/perl/cpp-perl.pl config.h $(srcdir)/ui/options.dat | $(PERL) -I$(srcdir)/perl $(srcdir)/ui/gtk/options-header.pl - > $@.tmp && mv $@.tmp $@ + +ui/gtk/resources.c: ui/gtk/resources.xml $(gtkui_resource_files) + $(AM_V_GEN)glib-compile-resources --sourcedir=$(srcdir) --target=$@ --internal --generate-source --c-name=gtkui $< + +ui/gtk/resources.h: ui/gtk/resources.xml $(gtkui_resource_files) + $(AM_V_GEN)glib-compile-resources --sourcedir=$(srcdir) --target=$@ --internal --generate-header --c-name=gtkui $< diff --git a/ui/gtk/browse.c b/ui/gtk/browse.c index 7bd8c962..257b2205 100644 --- a/ui/gtk/browse.c +++ b/ui/gtk/browse.c @@ -155,7 +155,7 @@ create_dialog( void ) gtk_box_pack_start( GTK_BOX( content_area ), scrolled_window, TRUE, TRUE, 0 ); /* The tape marker pixbuf */ - tape_marker_pixbuf = gdk_pixbuf_new_from_xpm_data( gtkpixmap_tape_marker ); + tape_marker_pixbuf = gdk_pixbuf_new_from_resource( ICON_TAPE_MARKER, NULL ); /* FIXME: unref this at exit */ /* And the list itself */ diff --git a/ui/gtk/gtkinternals.h b/ui/gtk/gtkinternals.h index e06307f6..4b96c2fc 100644 --- a/ui/gtk/gtkinternals.h +++ b/ui/gtk/gtkinternals.h @@ -130,19 +130,21 @@ extern GtkActionEntry gtkui_menu_data[]; extern guint gtkui_menu_data_size; /* - * The icon pixmaps (pixmaps.c) + * Resources for the GTK UI (ui/gtk/resources.xml) */ -extern const char *gtkpixmap_tape_inactive[]; -extern const char *gtkpixmap_tape_active[]; -extern const char *gtkpixmap_mdr_inactive[]; -extern const char *gtkpixmap_mdr_active[]; -extern const char *gtkpixmap_disk_inactive[]; -extern const char *gtkpixmap_disk_active[]; -extern const char *gtkpixmap_pause_inactive[]; -extern const char *gtkpixmap_pause_active[]; -extern const char *gtkpixmap_tape_marker[]; -extern const char *gtkpixmap_mouse_inactive[]; -extern const char *gtkpixmap_mouse_active[]; + +#define FUSE_RESOURCE_PREFIX "/net/sourceforge/fuse_emulator/" +#define ICON_DISK_ACTIVE FUSE_RESOURCE_PREFIX "disk_active.png" +#define ICON_DISK_INACTIVE FUSE_RESOURCE_PREFIX "disk_inactive.png" +#define ICON_MDR_ACTIVE FUSE_RESOURCE_PREFIX "mdr_active.png" +#define ICON_MDR_INACTIVE FUSE_RESOURCE_PREFIX "mdr_inactive.png" +#define ICON_MOUSE_ACTIVE FUSE_RESOURCE_PREFIX "mouse_active.png" +#define ICON_MOUSE_INACTIVE FUSE_RESOURCE_PREFIX "mouse_inactive.png" +#define ICON_PAUSE_ACTIVE FUSE_RESOURCE_PREFIX "pause_active.png" +#define ICON_PAUSE_INACTIVE FUSE_RESOURCE_PREFIX "pause_inactive.png" +#define ICON_TAPE_ACTIVE FUSE_RESOURCE_PREFIX "tape_active.png" +#define ICON_TAPE_INACTIVE FUSE_RESOURCE_PREFIX "tape_inactive.png" +#define ICON_TAPE_MARKER FUSE_RESOURCE_PREFIX "tape_marker.png" /* * Statusbar routines (statusbar.c) diff --git a/ui/gtk/gtkui.c b/ui/gtk/gtkui.c index 835b74e5..7229fb09 100644 --- a/ui/gtk/gtkui.c +++ b/ui/gtk/gtkui.c @@ -51,6 +51,7 @@ #include "settings.h" #include "snapshot.h" #include "timer/timer.h" +#include "ui/gtk/resources.h" #include "ui/ui.h" #include "utils.h" @@ -166,6 +167,8 @@ ui_init( int *argc, char ***argv ) gtk_widget_set_default_visual( gdk_rgb_get_visual() ); #endif /* #if !GTK_CHECK_VERSION( 3, 0, 0 ) */ + g_resources_register( gtkui_get_resource() ); + gtkui_window = gtk_window_new(GTK_WINDOW_TOPLEVEL); #ifdef FUSE_ICON_AVAILABLE @@ -317,6 +320,8 @@ ui_end(void) g_object_unref( ui_manager_menu ); + g_resources_unregister( gtkui_get_resource() ); + return 0; } diff --git a/ui/gtk/icons/disk_active.png b/ui/gtk/icons/disk_active.png new file mode 100644 index 00000000..027c63e7 Binary files /dev/null and b/ui/gtk/icons/disk_active.png differ diff --git a/ui/gtk/icons/disk_inactive.png b/ui/gtk/icons/disk_inactive.png new file mode 100644 index 00000000..56843cdc Binary files /dev/null and b/ui/gtk/icons/disk_inactive.png differ diff --git a/ui/gtk/icons/mdr_active.png b/ui/gtk/icons/mdr_active.png new file mode 100644 index 00000000..e198241e Binary files /dev/null and b/ui/gtk/icons/mdr_active.png differ diff --git a/ui/gtk/icons/mdr_inactive.png b/ui/gtk/icons/mdr_inactive.png new file mode 100644 index 00000000..b8c44996 Binary files /dev/null and b/ui/gtk/icons/mdr_inactive.png differ diff --git a/ui/gtk/icons/mouse_active.png b/ui/gtk/icons/mouse_active.png new file mode 100644 index 00000000..7178af74 Binary files /dev/null and b/ui/gtk/icons/mouse_active.png differ diff --git a/ui/gtk/icons/mouse_inactive.png b/ui/gtk/icons/mouse_inactive.png new file mode 100644 index 00000000..82a98c70 Binary files /dev/null and b/ui/gtk/icons/mouse_inactive.png differ diff --git a/ui/gtk/icons/pause_active.png b/ui/gtk/icons/pause_active.png new file mode 100644 index 00000000..014e6464 Binary files /dev/null and b/ui/gtk/icons/pause_active.png differ diff --git a/ui/gtk/icons/pause_inactive.png b/ui/gtk/icons/pause_inactive.png new file mode 100644 index 00000000..269543f2 Binary files /dev/null and b/ui/gtk/icons/pause_inactive.png differ diff --git a/ui/gtk/icons/tape_active.png b/ui/gtk/icons/tape_active.png new file mode 100644 index 00000000..cd5781e1 Binary files /dev/null and b/ui/gtk/icons/tape_active.png differ diff --git a/ui/gtk/icons/tape_inactive.png b/ui/gtk/icons/tape_inactive.png new file mode 100644 index 00000000..d6719f0a Binary files /dev/null and b/ui/gtk/icons/tape_inactive.png differ diff --git a/ui/gtk/icons/tape_marker.png b/ui/gtk/icons/tape_marker.png new file mode 100644 index 00000000..4090343b Binary files /dev/null and b/ui/gtk/icons/tape_marker.png differ diff --git a/ui/gtk/resources.xml b/ui/gtk/resources.xml new file mode 100644 index 00000000..9e7ba5bc --- /dev/null +++ b/ui/gtk/resources.xml @@ -0,0 +1,16 @@ +<?xml version="1.0" encoding="UTF-8"?> +<gresources> + <gresource prefix="/net/sourceforge/fuse_emulator"> + <file alias="disk_active.png">ui/gtk/icons/disk_active.png</file> + <file alias="disk_inactive.png">ui/gtk/icons/disk_inactive.png</file> + <file alias="mdr_active.png">ui/gtk/icons/mdr_active.png</file> + <file alias="mdr_inactive.png">ui/gtk/icons/mdr_inactive.png</file> + <file alias="mouse_active.png">ui/gtk/icons/mouse_active.png</file> + <file alias="mouse_inactive.png">ui/gtk/icons/mouse_inactive.png</file> + <file alias="pause_active.png">ui/gtk/icons/pause_active.png</file> + <file alias="pause_inactive.png">ui/gtk/icons/pause_inactive.png</file> + <file alias="tape_active.png">ui/gtk/icons/tape_active.png</file> + <file alias="tape_inactive.png">ui/gtk/icons/tape_inactive.png</file> + <file alias="tape_marker.png">ui/gtk/icons/tape_marker.png</file> + </gresource> +</gresources> diff --git a/ui/gtk/statusbar.c b/ui/gtk/statusbar.c index 5e845f1c..d97c66c5 100644 --- a/ui/gtk/statusbar.c +++ b/ui/gtk/statusbar.c @@ -59,29 +59,29 @@ gtkstatusbar_create( GtkBox *parent ) /* FIXME: unref these pixbuf on statusbar destroy */ pixbuf_tape_inactive = - gdk_pixbuf_new_from_xpm_data( gtkpixmap_tape_inactive ); + gdk_pixbuf_new_from_resource( ICON_TAPE_INACTIVE, NULL ); pixbuf_tape_active = - gdk_pixbuf_new_from_xpm_data( gtkpixmap_tape_active ); + gdk_pixbuf_new_from_resource( ICON_TAPE_ACTIVE, NULL ); pixbuf_mdr_inactive = - gdk_pixbuf_new_from_xpm_data( gtkpixmap_mdr_inactive ); + gdk_pixbuf_new_from_resource( ICON_MDR_INACTIVE, NULL ); pixbuf_mdr_active = - gdk_pixbuf_new_from_xpm_data( gtkpixmap_mdr_active ); + gdk_pixbuf_new_from_resource( ICON_MDR_ACTIVE, NULL ); pixbuf_disk_inactive = - gdk_pixbuf_new_from_xpm_data( gtkpixmap_disk_inactive ); + gdk_pixbuf_new_from_resource( ICON_DISK_INACTIVE, NULL ); pixbuf_disk_active = - gdk_pixbuf_new_from_xpm_data( gtkpixmap_disk_active ); + gdk_pixbuf_new_from_resource( ICON_DISK_ACTIVE, NULL ); pixbuf_pause_inactive = - gdk_pixbuf_new_from_xpm_data( gtkpixmap_pause_inactive ); + gdk_pixbuf_new_from_resource( ICON_PAUSE_INACTIVE, NULL ); pixbuf_pause_active = - gdk_pixbuf_new_from_xpm_data( gtkpixmap_pause_active ); + gdk_pixbuf_new_from_resource( ICON_PAUSE_ACTIVE, NULL ); pixbuf_mouse_inactive = - gdk_pixbuf_new_from_xpm_data( gtkpixmap_mouse_inactive ); + gdk_pixbuf_new_from_resource( ICON_MOUSE_INACTIVE, NULL ); pixbuf_mouse_active = - gdk_pixbuf_new_from_xpm_data( gtkpixmap_mouse_active ); + gdk_pixbuf_new_from_resource( ICON_MOUSE_ACTIVE, NULL ); speed_status = gtk_label_new( "100%" ); gtk_label_set_width_chars( GTK_LABEL( speed_status ), 8 ); diff --git a/ui/xlib/Makefile.am b/ui/xlib/Makefile.am index a2345ec1..a5577b12 100644 --- a/ui/xlib/Makefile.am +++ b/ui/xlib/Makefile.am @@ -50,12 +50,13 @@ ui_xlib_built = \ EXTRA_DIST += \ ui/xlib/xpixmaps.c \ + ui/xlib/xpixmaps.c.in \ ui/xlib/xstatusbar.pl ui/xlib/keysyms.c: $(srcdir)/keysyms.pl $(srcdir)/keysyms.dat @$(MKDIR_P) ui/xlib $(AM_V_GEN)$(PERL) -I$(srcdir)/perl $(srcdir)/keysyms.pl x $(srcdir)/keysyms.dat > $@.tmp && mv $@.tmp $@ -ui/xlib/xpixmaps.c: ui/xlib/xstatusbar.pl $(srcdir)/ui/gtk/pixmaps.c +ui/xlib/xpixmaps.c: ui/xlib/xstatusbar.pl $(srcdir)/ui/xlib/xpixmaps.c.in @$(MKDIR_P) ui/xlib - $(AM_V_GEN)$(PERL) -I$(srcdir)/perl $(srcdir)/ui/xlib/xstatusbar.pl $(srcdir)/ui/gtk/pixmaps.c > $@.tmp && mv $@.tmp $@ + $(AM_V_GEN)$(PERL) -I$(srcdir)/perl $(srcdir)/ui/xlib/xstatusbar.pl $(srcdir)/ui/xlib/xpixmaps.c.in > $@.tmp && mv $@.tmp $@ diff --git a/ui/gtk/pixmaps.c b/ui/xlib/xpixmaps.c.in similarity index 98% rename from ui/gtk/pixmaps.c rename to ui/xlib/xpixmaps.c.in index 40311da6..a86ecbda 100644 --- a/ui/gtk/pixmaps.c +++ b/ui/xlib/xpixmaps.c.in @@ -21,9 +21,7 @@ */ -#include "config.h" - -#include "gtkinternals.h" +#error "This file is used to generate ui/xlib/xpixmaps.c and is not meant to be compiled" const char *gtkpixmap_tape_inactive[] = { "27 17 13 1", diff --git a/ui/xlib/xstatusbar.pl b/ui/xlib/xstatusbar.pl index 0f753382..fd6644dd 100644 --- a/ui/xlib/xstatusbar.pl +++ b/ui/xlib/xstatusbar.pl @@ -13,7 +13,7 @@ my $check_mask = ''; my $do_icon = 0; -print "/*\n This file generated from ../gtk/pixmaps.c with xstatusbar.pl\n" . +print "/*\n This file generated from xpixmaps.c.in with xstatusbar.pl\n" . "*/\n\n"; my $pixmaps = shift; |
From: <sba...@us...> - 2024-10-19 07:54:17
|
This is an automated email from the git hooks/post-receive-user script. sbaldovi pushed a change to branch master in repository fuse. from 8fd925c7 Merge request #30: improve the teletext datastream code new 51438970 Use PNG instead of XPM for the icons in the GTK UI new 9b8343b7 Don't leak tape_marker_pixbuf when the tape browser is closed new 8f110271 Remove GTK names for XPM icons used in Xlib UI new e65a7bb0 Suppress a -Wmisleading-indentation warning from GCC in Xlib UI The 4 revisions listed above as "new" are entirely new to this repository and will be described in separate emails. The revisions listed as "add" were already present in the repository and have only been added to this reference. Summary of changes: .gitignore | 2 ++ ui/gtk/Makefile.am | 29 ++++++++++++++++++++++++++--- ui/gtk/browse.c | 4 ++-- ui/gtk/gtkinternals.h | 26 ++++++++++++++------------ ui/gtk/gtkui.c | 5 +++++ ui/gtk/icons/disk_active.png | Bin 0 -> 244 bytes ui/gtk/icons/disk_inactive.png | Bin 0 -> 262 bytes ui/gtk/icons/mdr_active.png | Bin 0 -> 183 bytes ui/gtk/icons/mdr_inactive.png | Bin 0 -> 187 bytes ui/gtk/icons/mouse_active.png | Bin 0 -> 158 bytes ui/gtk/icons/mouse_inactive.png | Bin 0 -> 162 bytes ui/gtk/icons/pause_active.png | Bin 0 -> 265 bytes ui/gtk/icons/pause_inactive.png | Bin 0 -> 275 bytes ui/gtk/icons/tape_active.png | Bin 0 -> 221 bytes ui/gtk/icons/tape_inactive.png | Bin 0 -> 244 bytes ui/gtk/icons/tape_marker.png | Bin 0 -> 142 bytes ui/gtk/resources.xml | 16 ++++++++++++++++ ui/gtk/statusbar.c | 20 ++++++++++---------- ui/xlib/Makefile.am | 5 +++-- ui/xlib/xdisplay.c | 6 +++++- ui/{gtk/pixmaps.c => xlib/xpixmaps.c.in} | 26 ++++++++++++-------------- ui/xlib/xstatusbar.pl | 3 +-- 22 files changed, 96 insertions(+), 46 deletions(-) create mode 100644 ui/gtk/icons/disk_active.png create mode 100644 ui/gtk/icons/disk_inactive.png create mode 100644 ui/gtk/icons/mdr_active.png create mode 100644 ui/gtk/icons/mdr_inactive.png create mode 100644 ui/gtk/icons/mouse_active.png create mode 100644 ui/gtk/icons/mouse_inactive.png create mode 100644 ui/gtk/icons/pause_active.png create mode 100644 ui/gtk/icons/pause_inactive.png create mode 100644 ui/gtk/icons/tape_active.png create mode 100644 ui/gtk/icons/tape_inactive.png create mode 100644 ui/gtk/icons/tape_marker.png create mode 100644 ui/gtk/resources.xml rename ui/{gtk/pixmaps.c => xlib/xpixmaps.c.in} (93%) |
From: <sba...@us...> - 2024-07-06 06:25:31
|
This is an automated email from the git hooks/post-receive-user script. sbaldovi pushed a commit to branch master in repository fuse. View the commit online: https://sourceforge.net/p/fuse-emulator/fuse/ci/8fd925c76955e74f7b5ac37c2462a0366f0aa268/ commit 8fd925c76955e74f7b5ac37c2462a0366f0aa268 Merge: d9dc1456 52da9153 Author: Sergio Baldoví <ser...@gm...> AuthorDate: Sat Jul 6 08:20:41 2024 +0200 Merge request #30: improve the teletext datastream code compat.h | 1 + compat/unix/socket.c | 10 +++++ compat/win32/socket.c | 6 +++ peripherals/ttx2000s.c | 100 +++++++++++++++++++++++++++++++++---------------- 4 files changed, 85 insertions(+), 32 deletions(-) |
From: <sba...@us...> - 2024-07-06 06:25:30
|
This is an automated email from the git hooks/post-receive-user script. sbaldovi pushed a commit to branch master in repository fuse. View the commit online: https://sourceforge.net/p/fuse-emulator/fuse/ci/52da9153ee12199b4e60589be97ced31892695c0/ commit 52da9153ee12199b4e60589be97ced31892695c0 Author: ZXGuesser <ali...@zx...> AuthorDate: Sun Jun 30 10:46:31 2024 +0100 move FIONREAD probe to compat function --- compat.h | 1 + compat/unix/socket.c | 10 ++++++++++ compat/win32/socket.c | 6 ++++++ peripherals/ttx2000s.c | 2 +- 4 files changed, 18 insertions(+), 1 deletion(-) diff --git a/compat.h b/compat.h index 0d142805..a3aae044 100644 --- a/compat.h +++ b/compat.h @@ -202,6 +202,7 @@ void compat_socket_networking_init( void ); void compat_socket_networking_end( void ); int compat_socket_blocking_mode( compat_socket_t fd, int blocking ); +int compat_socket_get_fionread( compat_socket_t fd, u_long *bytes ); int compat_socket_close( compat_socket_t fd ); int compat_socket_get_error( void ); const char *compat_socket_get_strerror( void ); diff --git a/compat/unix/socket.c b/compat/unix/socket.c index f182a0d5..c57554c9 100644 --- a/compat/unix/socket.c +++ b/compat/unix/socket.c @@ -27,6 +27,7 @@ #include <string.h> #include <unistd.h> #include <fcntl.h> +#include <sys/ioctl.h> #include "compat.h" #include "fuse.h" @@ -62,6 +63,15 @@ compat_socket_blocking_mode( compat_socket_t fd, int blocking ) return ( fcntl( fd, F_SETFL, flags ) != 0 ); } +int +compat_socket_get_fionread( compat_socket_t fd, u_long *bytes) +{ + int b; + int err = ioctl( fd, FIONREAD, &b ); + *bytes = b; + return ( err ); +} + int compat_socket_close( compat_socket_t fd ) { diff --git a/compat/win32/socket.c b/compat/win32/socket.c index 013cc82d..e88151ce 100644 --- a/compat/win32/socket.c +++ b/compat/win32/socket.c @@ -45,6 +45,12 @@ compat_socket_blocking_mode( compat_socket_t fd, int blocking ) return ( ioctlsocket( fd, FIONBIO, &mode ) ); } +int +compat_socket_get_fionread( compat_socket_t fd, u_long *bytes) +{ + return ( ioctlsocket( fd, FIONREAD, bytes ) ); +} + int compat_socket_close( compat_socket_t fd ) { diff --git a/peripherals/ttx2000s.c b/peripherals/ttx2000s.c index 36344aba..27916e8d 100644 --- a/peripherals/ttx2000s.c +++ b/peripherals/ttx2000s.c @@ -354,7 +354,7 @@ ttx2000s_field_event( libspectrum_dword last_tstates GCC_UNUSED, int event, if( teletext_socket != compat_socket_invalid && ttx2000s_connected ) { u_long n; /* try to determine the amount of data available in socket read buffer */ - if( ioctlsocket( teletext_socket, FIONREAD, &n ) == -1) { + if( compat_socket_get_fionread( teletext_socket, &n ) == -1) { ui_error( UI_ERROR_ERROR, "ttx2000s: FIONREAD failed with errno %d: %s\n", errno, compat_socket_get_strerror() ); |
From: <sba...@us...> - 2024-07-06 06:25:28
|
This is an automated email from the git hooks/post-receive-user script. sbaldovi pushed a commit to branch master in repository fuse. View the commit online: https://sourceforge.net/p/fuse-emulator/fuse/ci/256bd78dc91f799a845095fde114e7e1b5375a33/ commit 256bd78dc91f799a845095fde114e7e1b5375a33 Author: ZXGuesser <ali...@zx...> AuthorDate: Sun Apr 7 00:25:25 2024 +0100 Protect against desynchronized packet streams, and fast forward buffer after emulation is paused for menus etc. --- peripherals/ttx2000s.c | 100 +++++++++++++++++++++++++++++++++---------------- 1 file changed, 68 insertions(+), 32 deletions(-) diff --git a/peripherals/ttx2000s.c b/peripherals/ttx2000s.c index 687933b7..36344aba 100644 --- a/peripherals/ttx2000s.c +++ b/peripherals/ttx2000s.c @@ -348,43 +348,79 @@ ttx2000s_field_event( libspectrum_dword last_tstates GCC_UNUSED, int event, { int bytes_read; int i; - libspectrum_byte ttx2000s_socket_buffer[672]; + libspectrum_byte ttx2000s_socket_buffer[672*25]; /* space for 25 fields */ /* do stuff */ if( teletext_socket != compat_socket_invalid && ttx2000s_connected ) { - bytes_read = - recv( teletext_socket, (char *)ttx2000s_socket_buffer, 672, 0 ); - /* packet server sends 16 lines of 42 bytes, unused lines are padded with 0x00 */ - if( bytes_read == 672 ) { - /* 11 line syncs occur before the first teletext line */ - ttx2000s_line_counter = ( ttx2000s_line_counter + 11 ) & 0xF; - i = 0; - while( 1 ) - { - if( ttx2000s_socket_buffer[i * 42] != 0 ) /* packet isn't blank */ - ttx2000s_ram[ ttx2000s_line_counter << 6 ] = 0x27; /* framing code */ - memcpy( ttx2000s_ram + (ttx2000s_line_counter << 6) + 1, - ttx2000s_socket_buffer + (i * 42), 42 ); - i++; - if( ++ttx2000s_line_counter > 15 ) - break; /* ignore packets once line counter overflows */ + u_long n; + /* try to determine the amount of data available in socket read buffer */ + if( ioctlsocket( teletext_socket, FIONREAD, &n ) == -1) { + ui_error( UI_ERROR_ERROR, + "ttx2000s: FIONREAD failed with errno %d: %s\n", errno, + compat_socket_get_strerror() ); + } else if ( n > (672 * 50) ) { + /* over 50 fields of data are queued on the socket. Discard 25 fields */ + bytes_read = + recv( teletext_socket, (char *)ttx2000s_socket_buffer, 672*25, 0 ); + if( bytes_read != 672*25 ) { + /* something failed and is probably a fatal issue */ + ui_error( UI_ERROR_ERROR, + "ttx2000s: recv returned unexpected errno %d: %s\n", errno, + compat_socket_get_strerror() ); + if( compat_socket_close( teletext_socket ) ) { + ui_error( UI_ERROR_ERROR, + "ttx2000s: close returned unexpected errno %d: %s\n", + compat_socket_get_error(), compat_socket_get_strerror() ); + } + ttx2000s_connected = 0; /* the connection has failed */ } - - /* only generate NMI when ROM is paged in and there is signal */ - if( ttx2000s_paged ) - event_add( 0, z80_nmi_event ); /* pull /NMI */ - } else if( bytes_read == -1 ) { - errno = compat_socket_get_error(); - if( errno == COMPAT_ECONNREFUSED ) { - /* the connection was refused */ - ttx2000s_connected = 0; - } else if( errno == COMPAT_ENOTCONN || errno == COMPAT_EWOULDBLOCK ) { - /* just ignore if the socket is not connected or recv would block */ + } else if ( n > 675 ) { + /* a complete field is immediately available to read */ + bytes_read = + recv( teletext_socket, (char *)ttx2000s_socket_buffer, 672, 0 ); + /* read a complete field (16 lines of 42 bytes) */ + if( bytes_read == 672 ) { + /* 11 line syncs occur before the first teletext line */ + ttx2000s_line_counter = ( ttx2000s_line_counter + 11 ) & 0xF; + i = 0; + while( 1 ) + { + if( ttx2000s_socket_buffer[i * 42] != 0 ) /* packet isn't blank */ + ttx2000s_ram[ ttx2000s_line_counter << 6 ] = 0x27; /* framing +code */ + memcpy( ttx2000s_ram + (ttx2000s_line_counter << 6) + 1, + ttx2000s_socket_buffer + (i * 42), 42 ); + i++; + if( ++ttx2000s_line_counter > 15 ) + break; /* ignore packets once line counter overflows */ + } + + /* only generate NMI when ROM is paged in and there is signal */ + if( ttx2000s_paged ) + event_add( 0, z80_nmi_event ); /* pull /NMI */ + } else if( bytes_read == -1 ) { + errno = compat_socket_get_error(); + if( errno == COMPAT_ECONNREFUSED ) { + /* the connection was refused */ + ttx2000s_connected = 0; + } else if( errno == COMPAT_ENOTCONN || errno == COMPAT_EWOULDBLOCK ) { + /* just ignore if the socket is not connected or recv would block */ + } else { + /* TODO: what should we do when there's an unexpected error */ + ui_error( UI_ERROR_ERROR, + "ttx2000s: recv returned unexpected errno %d: %s\n", errno, + compat_socket_get_strerror() ); + ttx2000s_connected = 0; /* the connection has failed */ + } } else { - /* TODO: what should we do when there's an unexpected error */ - ui_error( UI_ERROR_ERROR, - "ttx2000s: recv returned unexpected errno %d: %s\n", errno, - compat_socket_get_strerror() ); + /* failed to read a whole field at once. This means a partial field + has been removed from buffer and packets will now be desynchronized */ + + if( compat_socket_close( teletext_socket ) ) { + ui_error( UI_ERROR_ERROR, + "ttx2000s: close returned unexpected errno %d: %s\n", + compat_socket_get_error(), compat_socket_get_strerror() ); + } ttx2000s_connected = 0; /* the connection has failed */ } } |
From: <sba...@us...> - 2024-07-06 06:25:27
|
This is an automated email from the git hooks/post-receive-user script. sbaldovi pushed a change to branch master in repository fuse. from d9dc1456 Remove use of deprecated `gdk_keymap_get_default` function. new 256bd78d Protect against desynchronized packet streams, and fast forward buffer after emulation is paused for menus etc. new 52da9153 move FIONREAD probe to compat function new 8fd925c7 Merge request #30: improve the teletext datastream code The 3 revisions listed above as "new" are entirely new to this repository and will be described in separate emails. The revisions listed as "add" were already present in the repository and have only been added to this reference. Summary of changes: compat.h | 1 + compat/unix/socket.c | 10 +++++ compat/win32/socket.c | 6 +++ peripherals/ttx2000s.c | 100 +++++++++++++++++++++++++++++++++---------------- 4 files changed, 85 insertions(+), 32 deletions(-) |
From: <pa...@us...> - 2024-02-18 19:49:51
|
This is an automated email from the git hooks/post-receive-user script. pak21 pushed a change to branch master in repository fuse. from 03bee5e1 Cap tstates of timer event to (further) prevent segfault. add d9dc1456 Remove use of deprecated `gdk_keymap_get_default` function. No new revisions were added by this update. Summary of changes: ui/gtk/gtkkeyboard.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) |
From: <pa...@us...> - 2024-02-18 19:48:45
|
This is an automated email from the git hooks/post-receive-user script. pak21 pushed a commit to branch patch-440-remove-gdk_keymap_get_default-2 in repository fuse. View the commit online: https://sourceforge.net/p/fuse-emulator/fuse/ci/d9dc1456c37579a9c39d5e56d0fa6abfcaa81a72/ commit d9dc1456c37579a9c39d5e56d0fa6abfcaa81a72 Author: Philip Kendall <phi...@sh...> AuthorDate: Sun Feb 18 19:47:26 2024 +0000 Remove use of deprecated `gdk_keymap_get_default` function. Simpler version as Berto pointed out `gdk_display_get_default()` is a trivial call so no need to cache it. --- ui/gtk/gtkkeyboard.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/ui/gtk/gtkkeyboard.c b/ui/gtk/gtkkeyboard.c index c431ba60..e3522f3f 100644 --- a/ui/gtk/gtkkeyboard.c +++ b/ui/gtk/gtkkeyboard.c @@ -1,5 +1,5 @@ /* gtkkeyboard.c: GTK routines for dealing with the keyboard - Copyright (c) 2000-2008 Philip Kendall, Russell Marks + Copyright (c) 2000-2024 Philip Kendall, Russell Marks This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -42,9 +42,10 @@ unshift_keysym( guint keycode, gint group ) GdkKeymapKey *maps; guint *keyvals, i, r = GDK_KEY_VoidSymbol, r2 = GDK_KEY_VoidSymbol; gint count; + GdkDisplay *display = gdk_display_get_default(); - gdk_keymap_get_entries_for_keycode( gdk_keymap_get_default(), keycode, - &maps, &keyvals, &count ); + gdk_keymap_get_entries_for_keycode( gdk_keymap_get_for_display( display ), + keycode, &maps, &keyvals, &count ); for( i = 0; i < count; i++ ) { if( maps[i].group == group && maps[i].level == 0 ) { |
From: <pa...@us...> - 2024-02-18 19:48:43
|
This is an automated email from the git hooks/post-receive-user script. pak21 pushed a change to branch patch-440-remove-gdk_keymap_get_default-2 in repository fuse. at d9dc1456 Remove use of deprecated `gdk_keymap_get_default` function. This branch includes the following new commits: new d9dc1456 Remove use of deprecated `gdk_keymap_get_default` function. The 1 revisions listed above as "new" are entirely new to this repository and will be described in separate emails. The revisions listed as "add" were already present in the repository and have only been added to this reference. |
From: <pa...@us...> - 2024-02-18 09:32:15
|
This is an automated email from the git hooks/post-receive-user script. pak21 pushed a commit to branch patch-440-remove-gdk_keymap_get_default in repository fuse. View the commit online: https://sourceforge.net/p/fuse-emulator/fuse/ci/617a6a7987d3c895e2c8837c8afcb92ceaca909a/ commit 617a6a7987d3c895e2c8837c8afcb92ceaca909a Author: Philip Kendall <phi...@sh...> AuthorDate: Sun Feb 18 09:28:12 2024 +0000 Remove use of deprecated `gdk_keymap_get_default` function. --- ui/gtk/gtkdisplay.c | 6 ++---- ui/gtk/gtkinternals.h | 4 +++- ui/gtk/gtkkeyboard.c | 4 ++-- ui/gtk/gtkmouse.c | 6 ++---- ui/gtk/gtkui.c | 6 +++++- 5 files changed, 14 insertions(+), 12 deletions(-) diff --git a/ui/gtk/gtkdisplay.c b/ui/gtk/gtkdisplay.c index 7dcd7c27..006338c3 100644 --- a/ui/gtk/gtkdisplay.c +++ b/ui/gtk/gtkdisplay.c @@ -1,5 +1,5 @@ /* gtkdisplay.c: GTK routines for dealing with the Speccy screen - Copyright (c) 2000-2005 Philip Kendall + Copyright (c) 2000-2024 Philip Kendall This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -618,9 +618,7 @@ gtkdisplay_update_geometry( void ) #ifdef GDK_WINDOWING_WAYLAND /* We don't calculate the window size enough accurately on wayland backend to force the window geometry (bug #367) */ - GdkDisplay *display = gdk_display_get_default(); - - if( GDK_IS_WAYLAND_DISPLAY( display ) ) { + if( GDK_IS_WAYLAND_DISPLAY( gtkui_default_display ) ) { hints &= ~GDK_HINT_RESIZE_INC; } #endif /* #ifdef GDK_WINDOWING_WAYLAND */ diff --git a/ui/gtk/gtkinternals.h b/ui/gtk/gtkinternals.h index e06307f6..3838b243 100644 --- a/ui/gtk/gtkinternals.h +++ b/ui/gtk/gtkinternals.h @@ -1,5 +1,5 @@ /* gtkinternals.h: stuff internal to the GTK UI - Copyright (c) 2003-2015 Philip Kendall + Copyright (c) 2003-2024 Philip Kendall This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -60,6 +60,8 @@ void gtkmouse_init( void ); extern GtkWidget *gtkui_window; extern GtkWidget *gtkui_drawing_area; +extern GdkDisplay *gtkui_default_display; + void gtkui_destroy_widget_and_quit( GtkWidget *widget, gpointer data ); int gtkui_confirm( const char *string ); diff --git a/ui/gtk/gtkkeyboard.c b/ui/gtk/gtkkeyboard.c index c431ba60..0f9d57ab 100644 --- a/ui/gtk/gtkkeyboard.c +++ b/ui/gtk/gtkkeyboard.c @@ -1,5 +1,5 @@ /* gtkkeyboard.c: GTK routines for dealing with the keyboard - Copyright (c) 2000-2008 Philip Kendall, Russell Marks + Copyright (c) 2000-2024 Philip Kendall, Russell Marks This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -43,7 +43,7 @@ unshift_keysym( guint keycode, gint group ) guint *keyvals, i, r = GDK_KEY_VoidSymbol, r2 = GDK_KEY_VoidSymbol; gint count; - gdk_keymap_get_entries_for_keycode( gdk_keymap_get_default(), keycode, + gdk_keymap_get_entries_for_keycode( gdk_keymap_get_for_display( gtkui_default_display ), keycode, &maps, &keyvals, &count ); for( i = 0; i < count; i++ ) { diff --git a/ui/gtk/gtkmouse.c b/ui/gtk/gtkmouse.c index e7ff0508..c2680c53 100644 --- a/ui/gtk/gtkmouse.c +++ b/ui/gtk/gtkmouse.c @@ -1,6 +1,5 @@ /* gtkmouse.c: GTK routines for emulating Spectrum mice - Copyright (c) 2004 Darren Salt - Copyright (c) 2015 Sergio Baldoví + Copyright (c) 2004-2024 Darren Salt, Sergio Baldoví, Philip Kendall This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -120,8 +119,7 @@ gtkmouse_reset_pointer( void ) #ifdef GDK_WINDOWING_WAYLAND - GdkDisplay *display = gdk_display_get_default(); - if( GDK_IS_WAYLAND_DISPLAY( display ) ) { + if( GDK_IS_WAYLAND_DISPLAY( gtkui_default_display ) ) { mouse_motion_fn = mouse_motion_relative; have_last_position = 0; return; diff --git a/ui/gtk/gtkui.c b/ui/gtk/gtkui.c index 835b74e5..bb06fd0e 100644 --- a/ui/gtk/gtkui.c +++ b/ui/gtk/gtkui.c @@ -1,5 +1,5 @@ /* gtkui.c: GTK routines for dealing with the user interface - Copyright (c) 2000-2015 Philip Kendall, Russell Marks, Sergio Baldoví + Copyright (c) 2000-2024 Philip Kendall, Russell Marks, Sergio Baldoví This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -60,6 +60,8 @@ GtkWidget *gtkui_window; /* The area into which the screen will be drawn */ GtkWidget *gtkui_drawing_area; +GdkDisplay *gtkui_default_display; + static GtkWidget *menu_bar; /* The UIManager used to create the menu bar */ @@ -235,6 +237,8 @@ ui_init( int *argc, char ***argv ) gtk_widget_show_all( gtkui_window ); gtkstatusbar_set_visibility( settings_current.statusbar ); + gtkui_default_display = gdk_display_get_default(); + ui_mouse_present = 1; return 0; |
From: <pa...@us...> - 2024-02-18 09:32:14
|
This is an automated email from the git hooks/post-receive-user script. pak21 pushed a change to branch patch-440-remove-gdk_keymap_get_default in repository fuse. at 617a6a79 Remove use of deprecated `gdk_keymap_get_default` function. This branch includes the following new commits: new 617a6a79 Remove use of deprecated `gdk_keymap_get_default` function. The 1 revisions listed above as "new" are entirely new to this repository and will be described in separate emails. The revisions listed as "add" were already present in the repository and have only been added to this reference. |
From: <pa...@us...> - 2024-01-24 20:54:58
|
This is an automated email from the git hooks/post-receive-user script. pak21 pushed a commit to branch master in repository fuse. View the commit online: https://sourceforge.net/p/fuse-emulator/fuse/ci/03bee5e18f8cc1556d7bc527894f418e358433d0/ The following commit(s) were added to refs/heads/master by this push: new 03bee5e1 Cap tstates of timer event to (further) prevent segfault. 03bee5e1 is described below commit 03bee5e18f8cc1556d7bc527894f418e358433d0 Author: Philip Kendall <phi...@sh...> AuthorDate: Wed Jan 24 20:47:42 2024 +0000 Cap tstates of timer event to (further) prevent segfault. Additional fix for bug #504. --- ChangeLog | 2 ++ timer/timer.c | 8 +++++++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 0feb6c5b..d1afd9fb 100644 --- a/ChangeLog +++ b/ChangeLog @@ -19,6 +19,8 @@ * Miscellaneous improvements: * Add ZIP files to the bash completion script (Alberto Garcia). + * Prevent potential segmentation fault due to overflow when emulation + speed is set very high (Pete Moore) 2021-02-27 Philip Kendall <phi...@sh...> diff --git a/timer/timer.c b/timer/timer.c index d7cafb1e..f0bf7bca 100644 --- a/timer/timer.c +++ b/timer/timer.c @@ -246,7 +246,13 @@ timer_frame( libspectrum_dword last_tstates, int event GCC_UNUSED, tstates = ( ( difference + TEN_MS / 1000.0 ) * machine_current->timings.processor_speed ) * speed + 0.5; - + + /* If speed is very large, tstates can also get very large; cap it to + avoid any potential overflows */ + if( tstates > 1 << 30 ) { + tstates = 1 << 30; + } + event_add( last_tstates + tstates, timer_event ); start_time = current_time + TEN_MS / 1000.0; |
From: <al...@us...> - 2024-01-21 12:48:44
|
This is an automated email from the git hooks/post-receive-user script. allura pushed a commit to branch master in repository fuse. View the commit online: https://sourceforge.net/p/fuse-emulator/fuse/ci/54bb53145a42f054dd7b5e5aa0bfa2d41020e265/ The following commit(s) were added to refs/heads/master by this push: new 54bb5314 Bug 504 - avoid overflow in event_add_cmp 54bb5314 is described below commit 54bb53145a42f054dd7b5e5aa0bfa2d41020e265 Author: Pete Moore <pm...@mo...> AuthorDate: Sat Jan 20 11:16:04 2024 +0100 Bug 504 - avoid overflow in event_add_cmp --- event.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/event.c b/event.c index cd0fc245..ce90b343 100644 --- a/event.c +++ b/event.c @@ -84,8 +84,13 @@ static gint event_add_cmp( gconstpointer a1, gconstpointer b1 ) { const event_t *a = a1, *b = b1; - - return a->tstates != b->tstates ? a->tstates - b->tstates + /* (a->tstates - b->tstates) although usually sufficient as a GCompareFunc, + can overflow for high values of b->tstates. High values can occur in e.g. + timer events when fuse is run with --speed <very high number>. This + overflow can cause a crash if it pushes a spectrum frame event beyond a + distant timer event. Therefore use overflow safe variation + (a->tstates > b->tstates) - (a->tstates < b->tstates) instead. */ + return a->tstates != b->tstates ? (a->tstates > b->tstates) - (a->tstates < b->tstates) : a->type - b->type; } |
From: <sba...@us...> - 2023-11-04 18:43:11
|
This is an automated email from the git hooks/post-receive-user script. sbaldovi pushed a commit to branch master in repository fuse. View the commit online: https://sourceforge.net/p/fuse-emulator/fuse/ci/51f4e2780401a6cb1c42e87cc6f46b361282f498/ commit 51f4e2780401a6cb1c42e87cc6f46b361282f498 Author: Gergely Szasz <sz...@hu...> AuthorDate: Sat Nov 4 19:37:01 2023 +0100 Allow to load unformatted EDSK disk images Typically images with length of 256 bytes. Happens usually with blank B sides that interfere when loading side A. This patch also adds some minor changes in open_cpc(): - merge special case 1 and 4 - merge special case 3 and 3a - check available data if sector count > 29 (sector count extension) (fixes bug #455). --- peripherals/disk/disk.c | 72 +++++++++++++++++++++++-------------------------- 1 file changed, 34 insertions(+), 38 deletions(-) diff --git a/peripherals/disk/disk.c b/peripherals/disk/disk.c index d850bfcc..ce2d0e12 100644 --- a/peripherals/disk/disk.c +++ b/peripherals/disk/disk.c @@ -1592,16 +1592,13 @@ cpc_set_weak_range( disk_t *d, int idx, buffer_t *buffer, int n, int len ) extern int fuse_exiting; /* Shall we exit now? */ #endif #define CPC_ISSUE_NONE 0 -/* 1x 8k sector */ +/* 1x 8k sector with 6k or 8k data */ #define CPC_ISSUE_1 1 /* 1x 8k + Nx 512 sector */ #define CPC_ISSUE_2 2 -/* 128 256 512 1024 2048 4096 */ +/* (128 )256 512 1024 2048 4096 */ #define CPC_ISSUE_3 3 -/* 128 256 512 1024 2048 4096 ... */ -#define CPC_ISSUE_3a 13 -#define CPC_ISSUE_4 4 -/* 512 256 512 256 512 256 ... (9x) */ +/* track38 512 256 512 256 512 256 ... (9x) */ #define CPC_ISSUE_5 5 static int @@ -1660,6 +1657,11 @@ fprintf( stderr, "%ds/%dc\n", d->sides, d->cylinders ); if( buffavail( buffer ) < 256 || memcmp( buff, "Track-Info", 10 ) ) /* check track header */ return d->status = DISK_OPEN; + j = 24 + 8 * buff[ 0x15 ]; /* sector info block(s) */ + j += 0x100 - ( j % 0x100 ); /* round up to next 0x100 */ + if( buff[ 0x15 ] > 29 && buffavail( buffer ) < j ) { /* https://simonowen.com/misc/extextdsk.txt */ + return d->status = DISK_OPEN; /* Sector count space check */ + } /* gap = (unsigned char)buff[0x16] == 0xff ? GAP_MINIMAL_FM : GAP_MINIMAL_MFM; @@ -1699,18 +1701,14 @@ fprintf( stderr, " (%d/%d) %d", seclen, idlen, bpt ); #endif bpt += calc_sectorlen( buff[ 0x13 ] == 2 ? 1 : 0, seclen > idlen ? idlen : seclen, gap ); if( d->flag & DISK_FLAG_PLUS3_CPC ) { - if( j == 0 && buff[ 0x1b + 8 * j ] == 6 && seclen > 6144 ) - cpc_fix = CPC_ISSUE_4; - else if( j == 0 && buff[ 0x1b + 8 * j ] == 6 ) /* sec1 = 8k */ + if( j == 0 && buff[ 0x1b + 8 * j ] == 6 ) /* sec1 = 8k */ cpc_fix = CPC_ISSUE_1; - else if( j == 0 && - buff[ 0x18 + 8 * j ] == j && buff[ 0x19 + 8 * j ] == j && - buff[ 0x1a + 8 * j ] == j && buff[ 0x1b + 8 * j ] == j ) - cpc_fix = CPC_ISSUE_3; - else if( j == 0 && - buff[ 0x18 + 8 * j ] == 1 && buff[ 0x19 + 8 * j ] == 1 && - buff[ 0x1a + 8 * j ] == 1 && buff[ 0x1b + 8 * j ] == 1 ) - cpc_fix = CPC_ISSUE_3a; + else if( j == 0 && ( + ( buff[ 0x18 ] == 0 && buff[ 0x19 ] == 0 && + buff[ 0x1a ] == 0 && buff[ 0x1b ] == 0 ) || + ( buff[ 0x18 ] == 1 && buff[ 0x19 ] == 1 && + buff[ 0x1a ] == 1 && buff[ 0x1b ] == 1 ) ) ) + cpc_fix = CPC_ISSUE_3; else if( j == 1 && cpc_fix == CPC_ISSUE_1 && /* sec1 = 8k && sec2 = 512 sec3 = 512 ... sec10 = 512 */ buff[ 0x1b + 8 * j ] == 2 ) cpc_fix = CPC_ISSUE_2; @@ -1719,13 +1717,11 @@ fprintf( stderr, " (%d/%d) %d", seclen, idlen, bpt ); else if( j > 1 && cpc_fix == CPC_ISSUE_2 && buff[ 0x1b + 8 * j ] != 2 ) cpc_fix = CPC_ISSUE_NONE; else if( j > 0 && cpc_fix == CPC_ISSUE_3 && - ( buff[ 0x18 + 8 * j ] != j || buff[ 0x19 + 8 * j ] != j || - buff[ 0x1a + 8 * j ] != j || buff[ 0x1b + 8 * j ] != j ) ) + ( buff[ 0x18 + 8 * j ] != j + buff[ 0x18 ] || + buff[ 0x19 + 8 * j ] != j + buff[ 0x18 ] || + buff[ 0x1a + 8 * j ] != j + buff[ 0x18 ] || + buff[ 0x1b + 8 * j ] != j + buff[ 0x18 ] ) ) cpc_fix = CPC_ISSUE_NONE; - else if( j > 0 && cpc_fix == CPC_ISSUE_3a && - ( buff[ 0x18 + 8 * j ] != j + 1 || buff[ 0x19 + 8 * j ] != j + 1 || - buff[ 0x1a + 8 * j ] != j + 1 || buff[ 0x1b + 8 * j ] != j + 1 ) ) - cpc_fix = CPC_ISSUE_NONE; else if( j > 10 && cpc_fix == CPC_ISSUE_2 ) cpc_fix = CPC_ISSUE_NONE; else if( i == 38 && j > 0 && cpc_fix == CPC_ISSUE_5 && @@ -1745,10 +1741,10 @@ fprintf( stderr, " (%d/%d) %d", seclen, idlen, bpt ); fprintf( stderr, "Warning: unknown sector configuration, cannot build track. BPT too high: %d", bpt ); } } - if( buff[0x00] == CPC_ISSUE_4 && seclen > 6144 ) bpt = 6500;/* Type 1 variant DD+ (e.g. Coin Op Hits) */ + if( buff[0x00] == CPC_ISSUE_1 && seclen > 6144 ) bpt = 6500;/* Type 1 variant DD+ (e.g. Coin Op Hits) */ else if( buff[0x00] != CPC_ISSUE_NONE ) bpt = 6250;/* we assume a standard DD track */ #ifdef CPC_DEBUG -fprintf( stderr, "----spec:%d gap3%s:%d bpt:%d\n", cpc_fix, buff[0x00] & 0x80 ? "*" : "", buff[0x16], bpt ); +fprintf( stderr, "----spec:%d gap3%s:%d bpt:%d/%d\n", cpc_fix, buff[0x00] & 0x80 ? "*" : "", buff[0x16], bpt, max_bpt ); if( cpc_fix ) cpc_fix_fix = cpc_fix; #endif /* extended DSK image uses track size table */ @@ -1762,10 +1758,14 @@ if( cpc_fix_fix ) { cpc_fix_fix = 0; } #endif -/****TODO +/**** open unformatted disks e.g.: edd_the_duck_master_b.dsk - this disk looks has 0 track... so fail to open, and merge + this disk looks has 0 track... only 256 byte */ + if( max_bpt == 0 && buffer->index == 0x100 ) { + max_bpt = 6250; + if( d->cylinders == 0 ) d->cylinders = 1; + } if( max_bpt == 0 ) return d->status = DISK_GEOM; @@ -1808,7 +1808,7 @@ if( cpc_fix_fix ) { DISK_SET_TRACK_IDX( d, i ); if( d->c_bpt == 6500 ) { /* DD+ */ - if( cpc_fix != CPC_ISSUE_4 ) { /* only + tracks use 6500 bpt */ + if( cpc_fix != CPC_ISSUE_1 ) { /* only + tracks use 6500 bpt */ d->track[-3] = 6250 % 256; d->track[-2] = 6250 / 256; d->c_bpt = 6250; @@ -1835,27 +1835,23 @@ if( cpc_fix_fix ) { hdrb[ 0x1a + 8 * j ], hdrb[ 0x1b + 8 * j ], gap, hdrb[ 0x1c + 8 * j ] & 0x20 && !( hdrb[ 0x1d + 8 * j ] & 0x20 ) ? CRC_ERROR : CRC_OK ); - if( cpc_fix == CPC_ISSUE_1 && j == 0 ) { /* 6144 */ - data_add( d, buffer, NULL, seclen, + if( cpc_fix == CPC_ISSUE_1 && j == 0 ) { /* 6144 or 8192 */ + data_add( d, buffer, NULL, seclen > 6144 ? 6384 : seclen, hdrb[ 0x1d + 8 * j ] & 0x40 ? DDAM : NO_DDAM, gap, hdrb[ 0x1c + 8 * j ] & 0x20 && hdrb[ 0x1d + 8 * j ] & 0x20 ? CRC_ERROR : CRC_OK, 0x00, NULL ); + if( seclen > 6144 ) + buffer->index += seclen - 6384; } else if( cpc_fix == CPC_ISSUE_2 && j == 0 ) { /* 6144, 10x512 */ datamark_add( d, hdrb[ 0x1d + 8 * j ] & 0x40 ? DDAM : NO_DDAM, gap ); gap_add( d, 2, gap ); buffer->index += seclen; - } else if( cpc_fix == CPC_ISSUE_3 ) { /* 128, 256, 512, ... 4096k */ - data_add( d, buffer, NULL, 128, + } else if( cpc_fix == CPC_ISSUE_3 ) { /* (128,) 256, 512, ... 4096k */ + data_add( d, buffer, NULL, 128, hdrb[ 0x1d + 8 * j ] & 0x40 ? DDAM : NO_DDAM, gap, hdrb[ 0x1c + 8 * j ] & 0x20 && hdrb[ 0x1d + 8 * j ] & 0x20 ? CRC_ERROR : CRC_OK, 0x00, NULL ); buffer->index += seclen - 128; - } else if( cpc_fix == CPC_ISSUE_4 ) { /* Nx8192 (max 6384 byte ) */ - data_add( d, buffer, NULL, 6384, - hdrb[ 0x1d + 8 * j ] & 0x40 ? DDAM : NO_DDAM, gap, - hdrb[ 0x1c + 8 * j ] & 0x20 && hdrb[ 0x1d + 8 * j ] & 0x20 ? - CRC_ERROR : CRC_OK, 0x00, NULL ); - buffer->index += seclen - 6384; } else if( cpc_fix == CPC_ISSUE_5 ) { /* 9x512 */ /* 512 256 512 256 512 256 512 256 512 */ if( idlen == 256 ) { |
From: <sba...@us...> - 2023-11-04 18:43:09
|
This is an automated email from the git hooks/post-receive-user script. sbaldovi pushed a commit to branch master in repository fuse. View the commit online: https://sourceforge.net/p/fuse-emulator/fuse/ci/edac6086d417189e4fa69a47a47328d0627fefae/ commit edac6086d417189e4fa69a47a47328d0627fefae Author: Gergely Szasz <sz...@hu...> AuthorDate: Sat Nov 4 17:12:38 2023 +0100 Allow to merge disk sides with different bpt (fixes bug #454). --- peripherals/disk/disk.c | 118 ++++++++++++++++++++++++++------------------- peripherals/disk/disk.h | 11 +++-- peripherals/disk/fdd.c | 17 +++---- peripherals/disk/fdd.h | 1 - peripherals/disk/upd_fdc.c | 24 ++++----- peripherals/disk/wd_fdc.c | 16 +++--- 6 files changed, 103 insertions(+), 84 deletions(-) diff --git a/peripherals/disk/disk.c b/peripherals/disk/disk.c index d4774b60..d850bfcc 100644 --- a/peripherals/disk/disk.c +++ b/peripherals/disk/disk.c @@ -150,6 +150,7 @@ position_context_save( const disk_t *d, disk_position_context_t *c ) c->clocks = d->clocks; c->fm = d->fm; c->weak = d->weak; + c->c_bpt = d->c_bpt; c->i = d->i; } @@ -160,6 +161,7 @@ position_context_restore( disk_t *d, const disk_position_context_t *c ) d->clocks = c->clocks; d->fm = c->fm; d->weak = c->weak; + d->c_bpt = c->c_bpt; d->i = c->i; } @@ -168,7 +170,7 @@ id_read( disk_t *d, int *head, int *track, int *sector, int *length ) { int a1mark = 0; - while( d->i < d->bpt ) { + while( d->i < d->c_bpt ) { if( d->track[ d->i ] == 0xa1 && bitmap_test( d->clocks, d->i ) ) { /* 0xa1 with clock */ a1mark = 1; @@ -195,7 +197,7 @@ datamark_read( disk_t *d, int *deleted ) { int a1mark = 0; - while( d->i < d->bpt ) { + while( d->i < d->c_bpt ) { if( d->track[ d->i ] == 0xa1 && bitmap_test( d->clocks, d->i ) ) { /* 0xa1 with clock */ a1mark = 1; @@ -328,14 +330,13 @@ guess_track_geom( disk_t *d, int head, int track, int *sector_base, static void update_tracks_mode( disk_t *d ) { - int i, j, bpt; + int i, j; int mfm, fm, weak; for( i = 0; i < d->cylinders * d->sides; i++ ) { DISK_SET_TRACK_IDX( d, i ); mfm = 0, fm = 0, weak = 0; - bpt = d->track[-3] + 256 * d->track[-2]; - for( j = DISK_CLEN( bpt ) - 1; j >= 0; j-- ) { + for( j = DISK_CLEN( d->c_bpt ) - 1; j >= 0; j-- ) { mfm |= ~d->fm[j]; fm |= d->fm[j]; weak |= d->weak[j]; @@ -417,7 +418,7 @@ static int gap_add( disk_t *d, int gap, int gaptype ) { disk_gap_t *g = &gaps[ gaptype ]; - if( d->i + g->len[gap] >= d->bpt ) /* too many data bytes */ + if( d->i + g->len[gap] >= d->c_bpt ) /* too many data bytes */ return 1; /*-------------------------------- given gap --------------------------------*/ memset( d->track + d->i, g->gap, g->len[gap] ); d->i += g->len[gap]; @@ -440,7 +441,7 @@ static int preindex_add( disk_t *d, int gaptype ) /* preindex gap and index mark */ { disk_gap_t *g = &gaps[ gaptype ]; - if( d->i + preindex_len( d, gaptype ) >= d->bpt ) + if( d->i + preindex_len( d, gaptype ) >= d->c_bpt ) return 1; /*------------------------------ pre-index gap -------------------------------*/ if( gap_add( d, 0, gaptype ) ) @@ -476,7 +477,7 @@ postindex_add( disk_t *d, int gaptype ) /* postindex gap */ static int gap4_add( disk_t *d, int gaptype ) { - int len = d->bpt - d->i; + int len = d->c_bpt - d->i; disk_gap_t *g = &gaps[ gaptype ]; if( len < 0 ) { @@ -484,7 +485,7 @@ gap4_add( disk_t *d, int gaptype ) } /*------------------------------ GAP IV ------------------------------*/ memset( d->track + d->i, g->gap, len ); /* GAP IV fill until end of track */ - d->i = d->bpt; + d->i = d->c_bpt; return 0; } @@ -505,7 +506,7 @@ id_add( disk_t *d, int h, int t, int s, int l, int gaptype, int crc_error ) { libspectrum_word crc = 0xffff; disk_gap_t *g = &gaps[ gaptype ]; - if( d->i + g->sync_len + ( g->mark >= 0 ? 3 : 0 ) + 7 >= d->bpt ) + if( d->i + g->sync_len + ( g->mark >= 0 ? 3 : 0 ) + 7 >= d->c_bpt ) return 1; /*------------------------------ sync ---------------------------*/ memset( d->track + d->i, g->sync, g->sync_len ); d->i += g->sync_len; @@ -547,7 +548,7 @@ static int datamark_add( disk_t *d, int ddam, int gaptype ) { disk_gap_t *g = &gaps[ gaptype ]; - if( d->i + g->len[2] + g->sync_len + ( g->mark >= 0 ? 3 : 0 ) + 1 >= d->bpt ) + if( d->i + g->len[2] + g->sync_len + ( g->mark >= 0 ? 3 : 0 ) + 1 >= d->c_bpt ) return 1; /*------------------------------ sync ---------------------------*/ memset( d->track + d->i, g->sync, g->sync_len ); d->i += g->sync_len; @@ -588,7 +589,7 @@ data_add( disk_t *d, buffer_t *buffer, unsigned char *data, int len, int ddam, crc = crc_fdc( crc, ddam ? 0xf8 : 0xfb ); /* deleted or normal */ if( len < 0 ) goto header_crc_error; /* CRC error */ - if( d->i + len + 2 >= d->bpt ) /* too many data bytes */ + if( d->i + len + 2 >= d->c_bpt ) /* too many data bytes */ return 1; /*------------------------------ data ------------------------------*/ if( start_data != NULL ) *start_data = d->i; /* record data start position */ @@ -755,6 +756,7 @@ disk_alloc( disk_t *d ) d->data = libspectrum_new0( libspectrum_byte, dlen ); + disk_update_tlens( d ); return d->status = DISK_OK; } @@ -780,7 +782,6 @@ disk_new( disk_t *d, int sides, int cylinders, d->wrprot = 0; d->dirty = 1; - disk_update_tlens( d ); return d->status = DISK_OK; } @@ -1732,12 +1733,22 @@ fprintf( stderr, " (%d/%d) %d", seclen, idlen, bpt ); cpc_fix = CPC_ISSUE_NONE; } } -// fix[i] = cpc_fix; buff[0x00] = cpc_fix; /* we use "Track-Info..." T to store "FIX" */ - if( buff[0x00] == CPC_ISSUE_4 ) bpt = 6500;/* Type 1 variant DD+ (e.g. Coin Op Hits) */ + /* bpt := bpt(0) + NxGAP3 */ + if( bpt > 6250 / ( buff[0x13] == 2 ? 1 : 2 ) ) { /* DD first try to align gap3 */ + if( cpc_fix == CPC_ISSUE_NONE && + bpt - buff[ 0x15 ] * gaps[gap].len[3] <= + 6250 / ( buff[0x13] == 2 ? 1 : 2 ) - buff[ 0x15 ] * 8 ) { + buff[0x16] = ( 6250 / ( buff[0x13] == 2 ? 1 : 2 ) + buff[ 0x15 ] * gaps[gap].len[3] - bpt ) / buff[ 0x15 ]; + buff[0x00] |= 0x80; /* we use custom gap3 length */ + } else if( cpc_fix == CPC_ISSUE_NONE ) { + fprintf( stderr, "Warning: unknown sector configuration, cannot build track. BPT too high: %d", bpt ); + } + } + if( buff[0x00] == CPC_ISSUE_4 && seclen > 6144 ) bpt = 6500;/* Type 1 variant DD+ (e.g. Coin Op Hits) */ else if( buff[0x00] != CPC_ISSUE_NONE ) bpt = 6250;/* we assume a standard DD track */ #ifdef CPC_DEBUG -fprintf( stderr, "----spec:%d bpt:%d\n", cpc_fix, bpt ); +fprintf( stderr, "----spec:%d gap3%s:%d bpt:%d\n", cpc_fix, buff[0x00] & 0x80 ? "*" : "", buff[0x16], bpt ); if( cpc_fix ) cpc_fix_fix = cpc_fix; #endif /* extended DSK image uses track size table */ @@ -1783,7 +1794,27 @@ if( cpc_fix_fix ) { if( hdrb[0x10] * d->sides + hdrb[0x11] > i ) /* adjust track No. */ i = hdrb[0x10] * d->sides + hdrb[0x11]; + cpc_fix = hdrb[ 0x00 ]; + if( cpc_fix & 0x80 ) { /* we use custom gap3 value */ + int new_gap; + + new_gap = hdrb[0x13] == 2 ? GAP_CUSTOM_MFM : GAP_CUSTOM_FM; + for( j = 0; j < 3; j++ ) + gaps[ new_gap ].len[ j ] = gaps[ gap ].len[ j ]; + gaps[ new_gap ].len[ 3 ] = hdrb[0x16]; + gap = new_gap; + cpc_fix &= 0x7f; + } + DISK_SET_TRACK_IDX( d, i ); + if( d->c_bpt == 6500 ) { /* DD+ */ + if( cpc_fix != CPC_ISSUE_4 ) { /* only + tracks use 6500 bpt */ + d->track[-3] = 6250 % 256; + d->track[-2] = 6250 / 256; + d->c_bpt = 6250; + DISK_SET_TRACK_IDX( d, i ); /* recalculate */ + } + } d->i = 0; if( preindex) preindex_add( d, gap ); @@ -1804,7 +1835,6 @@ if( cpc_fix_fix ) { hdrb[ 0x1a + 8 * j ], hdrb[ 0x1b + 8 * j ], gap, hdrb[ 0x1c + 8 * j ] & 0x20 && !( hdrb[ 0x1d + 8 * j ] & 0x20 ) ? CRC_ERROR : CRC_OK ); - cpc_fix = hdrb[ 0x00 ]; if( cpc_fix == CPC_ISSUE_1 && j == 0 ) { /* 6144 */ data_add( d, buffer, NULL, seclen, hdrb[ 0x1d + 8 * j ] & 0x40 ? DDAM : NO_DDAM, gap, @@ -1853,7 +1883,7 @@ if( cpc_fix_fix ) { /* idx -> first data byte */ d->i = idx + idlen; /* end of the sector data (CRC) */ for( k = seclen - idlen; k > 0; k-- ) { - if( d->i == d->bpt ) + if( d->i == d->c_bpt ) d->i = 0; /* wrap around */ d->track[ d->i ] = *buff; d->i++; @@ -2280,7 +2310,6 @@ fuse_exiting = 1; } utils_close_file( &buffer.file ); d->dirty = 0; - disk_update_tlens( d ); update_tracks_mode( d ); d->filename = utils_safe_strdup( filename ); #ifdef CPC_DEBUG_EXIT @@ -2296,10 +2325,8 @@ int disk_merge_sides( disk_t *d, disk_t *d1, disk_t *d2, int autofill ) { int i; - int clen; if( d1->sides != 1 || d2->sides != 1 || - d1->bpt != d2->bpt || ( autofill < 0 && d1->cylinders != d2->cylinders ) ) return DISK_GEOM; @@ -2308,36 +2335,35 @@ disk_merge_sides( disk_t *d, disk_t *d1, disk_t *d2, int autofill ) d->sides = 2; d->type = d1->type; d->cylinders = d2->cylinders > d1->cylinders ? d2->cylinders : d1->cylinders; - d->bpt = d1->bpt; + d->bpt = d2->bpt >= d1->bpt ? d2->bpt : d1->bpt; d->density = DISK_DENS_AUTO; if( disk_alloc( d ) != DISK_OK ) return d->status; - clen = DISK_CLEN( d->bpt ); d->track = d->data; d1->track = d1->data; d2->track = d2->data; for( i = 0; i < d->cylinders; i++ ) { if( i < d1->cylinders ) - memcpy( d->track, d1->track, d->tlen ); + memcpy( d->track, d1->track, d1->tlen ); else { - d->track[0] = d->bpt & 0xff; - d->track[1] = ( d->bpt >> 8 ) & 0xff; + d->track[0] = d1->bpt & 0xff; + d->track[1] = ( d1->bpt >> 8 ) & 0xff; d->track[2] = 0x00; - memset( d->track + 3, autofill & 0xff, d->bpt ); /* fill data */ - memset( d->track + 3 + d->bpt, 0x00, 3 * clen ); /* no clock and other marks */ + memset( d->track + 3, autofill & 0xff, d1->bpt ); /* fill data */ + memset( d->track + 3 + d1->bpt, 0x00, 3 * DISK_CLEN( d1->bpt ) ); /* no clock and other marks */ } d->track += d->tlen; d1->track += d1->tlen; if( i < d2->cylinders ) - memcpy( d->track, d2->track, d->tlen ); + memcpy( d->track, d2->track, d2->tlen ); else { - d->track[0] = d->bpt & 0xff; - d->track[1] = ( d->bpt >> 8 ) & 0xff; + d->track[0] = d2->bpt & 0xff; + d->track[1] = ( d2->bpt >> 8 ) & 0xff; d->track[2] = 0x00; - memset( d->track + 1, autofill & 0xff, d->bpt ); /* fill data */ - memset( d->track + 1 + d->bpt, 0x00, 3 * clen ); /* no clock and other marks */ + memset( d->track + 3, autofill & 0xff, d2->bpt ); /* fill data */ + memset( d->track + 3 + d2->bpt, 0x00, 3 * DISK_CLEN( d2->bpt ) ); /* no clock and other marks */ } d->track += d->tlen; d2->track += d2->tlen; @@ -2365,10 +2391,13 @@ disk_open( disk_t *d, const char *filename, int preindex, int merge_disks ) return disk_open2( d, filename, preindex ); filename2 = (char *)filename + ( l - 1 ); - while( l ) { /* [Ss]ide[ _][abAB12][ _.] */ + while( l ) { /* [Ss]ide[ _][abAB12][ _.]*[ _.] */ if( g == 0 && ( *filename2 == '.' || *filename2 == '_' || *filename2 == ' ' ) ) { g++; + } else if( g == 1 && ( *filename2 == '.' || *filename2 == '_' || + *filename2 == ' ' ) ) { + ; } else if( g == 1 && ( *filename2 == '1' || *filename2 == 'a' || *filename2 == 'A' ) ) { g++; @@ -2917,7 +2946,7 @@ write_log( FILE *file, disk_t *d ) if( !( k % 16 ) ) fprintf( file, " | %s\n", str ); d->i++; - if( d->i >= d->bpt ) { + if( d->i >= d->c_bpt ) { d->i = 0; rev++; if( rev == 6 ) @@ -2935,7 +2964,7 @@ write_log( FILE *file, disk_t *d ) fprintf( file, "\n*********\nSide: %d, cylinder: %d type: 0x%02x tlen: %5u\n", i, j, d->track[-1], d->track[-3] + 256 * d->track[-2] ); k = 0; - while( d->i < d->bpt ) { + while( d->i < d->c_bpt ) { if( !( k % 8 ) ) fprintf( file, "0x%08x:", d->i ); fprintf( file, " 0x%04x", d->track[ d->i ] | @@ -2958,8 +2987,7 @@ disk_write( disk_t *d, const char *filename ) FILE *file; const char *ext; size_t namelen; - libspectrum_byte *t, *c, *f, *w; - int idx; + disk_position_context_t context; if( ( file = fopen( filename, "wb" ) ) == NULL ) return d->status = DISK_WRFILE; @@ -3002,11 +3030,7 @@ disk_write( disk_t *d, const char *filename ) } /* Save position of current data */ - t = d->track; - c = d->clocks; - f = d->fm; - w = d->weak; - idx = d->i; + position_context_save( d, &context ); update_tracks_mode( d ); switch( d->type ) { @@ -3045,13 +3069,7 @@ disk_write( disk_t *d, const char *filename ) break; } - /* Restore position of previous data. - FIXME: This is a workaround. Revisit bug #279 and rethink a proper fix */ - d->track = t; - d->clocks = c; - d->fm = f; - d->weak = w; - d->i = idx; + position_context_restore( d, &context ); if( d->status != DISK_OK ) { fclose( file ); diff --git a/peripherals/disk/disk.h b/peripherals/disk/disk.h index ef73912f..1e5f7432 100644 --- a/peripherals/disk/disk.h +++ b/peripherals/disk/disk.h @@ -97,6 +97,7 @@ typedef struct disk_t { libspectrum_byte *data; /* disk data */ /* private part */ int tlen; /* length of a track with clock and other marks (bpt + 3/8bpt) */ + int c_bpt; /* current track bpt value it can be other than allocated bpt */ libspectrum_byte *track; /* current track data bytes */ libspectrum_byte *clocks; /* clock marks bits */ libspectrum_byte *fm; /* FM/MFM marks bits */ @@ -111,7 +112,7 @@ TRACK_LEN TYPE TRACK......DATA CLOCK..MARKS MF..MARKS WEAK..MARKS ^ ^ ^ ^ |__ track |__ clocks |__ mf |__ weak so, track[-1] = TYPE - TLEN = track[-3] + tarck 256 * track[-2] + TLEN = track[-3] + 256 * track[-2] TYPE is Track type as in UDI spec (0x00, 0x01, 0x02, 0x80, 0x81, 0x82) after update_tracks_mode() !!! */ @@ -119,9 +120,10 @@ TRACK_LEN TYPE TRACK......DATA CLOCK..MARKS MF..MARKS WEAK..MARKS #define DISK_SET_TRACK_IDX( d, idx ) \ d->track = d->data + 3 + ( idx ) * d->tlen; \ - d->clocks = d->track + d->bpt; \ - d->fm = d->clocks + DISK_CLEN( d->bpt ); \ - d->weak = d->fm + DISK_CLEN( d->bpt ) + d->c_bpt = d->track[-3] + 256 * d->track[-2]; \ + d->clocks = d->track + d->c_bpt; \ + d->fm = d->clocks + DISK_CLEN( d->c_bpt ); \ + d->weak = d->fm + DISK_CLEN( d->c_bpt ) #define DISK_SET_TRACK( d, head, cyl ) \ DISK_SET_TRACK_IDX( (d), (d)->sides * cyl + head ) @@ -132,6 +134,7 @@ typedef struct disk_position_context_t { libspectrum_byte *fm; /* FM/MFM marks bits */ libspectrum_byte *weak; /* weak marks bits/weak data */ int i; /* index for track and clocks */ + int c_bpt; } disk_position_context_t; const char *disk_strerror( int error ); diff --git a/peripherals/disk/fdd.c b/peripherals/disk/fdd.c index c15c1885..ecc8737c 100644 --- a/peripherals/disk/fdd.c +++ b/peripherals/disk/fdd.c @@ -133,16 +133,15 @@ fdd_set_data( fdd_t *d, int fact ) } DISK_SET_TRACK( &d->disk, head, d->c_cylinder ); - d->c_bpt = d->disk.track[-3] + 256 * d->disk.track[-2]; if( fact > 0 ) { /* this generate a bpt/fact +-10% triangular distribution skip in bytes i know, we should use the higher bits of rand(), but we not keen on _real_ (pseudo)random numbers... ;) */ - d->disk.i += d->c_bpt / fact + d->c_bpt * + d->disk.i += d->disk.c_bpt / fact + d->disk.c_bpt * ( rand() % 10 + rand() % 10 - 9 ) / fact / 100; - while( d->disk.i >= d->c_bpt ) - d->disk.i -= d->c_bpt; + while( d->disk.i >= d->disk.c_bpt ) + d->disk.i -= d->disk.c_bpt; } d->index = d->disk.i ? 0 : 1; } @@ -353,24 +352,24 @@ fdd_read_write_data( fdd_t *d, fdd_write_t write ) { if( !d->selected || !d->ready || !d->loadhead || d->disk.track == NULL ) { if( d->loaded && d->motoron ) { /* spin the disk */ - if( d->disk.i >= d->c_bpt ) { /* next data byte */ + if( d->disk.i >= d->disk.c_bpt ) { /* next data byte */ d->disk.i = 0; } if( !write ) d->data = 0x100; /* no data */ d->disk.i++; - d->index = d->disk.i >= d->c_bpt ? 1 : 0; + d->index = d->disk.i >= d->disk.c_bpt ? 1 : 0; } return d->status = FDD_OK; } - if( d->disk.i >= d->c_bpt ) { /* next data byte */ + if( d->disk.i >= d->disk.c_bpt ) { /* next data byte */ d->disk.i = 0; } if( write ) { if( d->disk.wrprot ) { d->disk.i++; - d->index = d->disk.i >= d->c_bpt ? 1 : 0; + d->index = d->disk.i >= d->disk.c_bpt ? 1 : 0; return d->status = FDD_RDONLY; } d->disk.track[ d->disk.i ] = d->data & 0x00ff; @@ -406,7 +405,7 @@ fdd_read_write_data( fdd_t *d, fdd_write_t write ) } } d->disk.i++; - d->index = d->disk.i >= d->c_bpt ? 1 : 0; + d->index = d->disk.i >= d->disk.c_bpt ? 1 : 0; return d->status = FDD_OK; } diff --git a/peripherals/disk/fdd.h b/peripherals/disk/fdd.h index 8a2e03f0..3cab5655 100644 --- a/peripherals/disk/fdd.h +++ b/peripherals/disk/fdd.h @@ -101,7 +101,6 @@ typedef struct fdd_t { int do_read_weak; int c_head; /* current head (side) */ int c_cylinder; /* current cylinder number (0 -> TR00) */ - int c_bpt; /* current track length in bytes */ int motoron; /* motor on */ int loadhead; /* head loaded */ int index_pulse; /* 'second' index hole, for index status */ diff --git a/peripherals/disk/upd_fdc.c b/peripherals/disk/upd_fdc.c index 64d9974c..73756e73 100644 --- a/peripherals/disk/upd_fdc.c +++ b/peripherals/disk/upd_fdc.c @@ -542,12 +542,12 @@ start_read_id( upd_fdc *f ) f->read_id = 1; } if( f->rev ) { - i = f->current_drive->disk.i >= f->current_drive->disk.bpt ? + i = f->current_drive->disk.i >= f->current_drive->disk.c_bpt ? 0 : f->current_drive->disk.i; /* start position */ if( read_id( f ) != 2 ) f->rev = 0; - i = f->current_drive->disk.bpt ? - ( f->current_drive->disk.i - i ) * 200 / f->current_drive->disk.bpt : 200; + i = f->current_drive->disk.c_bpt ? + ( f->current_drive->disk.i - i ) * 200 / f->current_drive->disk.c_bpt : 200; if( i > 0 ) { event_add_with_data( tstates + i * /* i * 1/20 revolution */ machine_current->timings.processor_speed / 1000, @@ -580,12 +580,12 @@ start_read_diag( upd_fdc *f ) f->read_id = 1; } if( f->rev ) { - i = f->current_drive->disk.i >= f->current_drive->disk.bpt ? + i = f->current_drive->disk.i >= f->current_drive->disk.c_bpt ? 0 : f->current_drive->disk.i; /* start position */ if( read_id( f ) != 2 ) f->rev = 0; - i = f->current_drive->disk.bpt ? - ( f->current_drive->disk.i - i ) * 200 / f->current_drive->disk.bpt : 200; + i = f->current_drive->disk.c_bpt ? + ( f->current_drive->disk.i - i ) * 200 / f->current_drive->disk.c_bpt : 200; if( i > 0 ) { event_add_with_data( tstates + i * /* i * 1/20 revolution */ machine_current->timings.processor_speed / 1000, @@ -648,14 +648,14 @@ multi_track_next: f->read_id = 1; } while( f->rev ) { - i = f->current_drive->disk.i >= f->current_drive->disk.bpt ? + i = f->current_drive->disk.i >= f->current_drive->disk.c_bpt ? 0 : f->current_drive->disk.i; /* start position */ if( seek_id( f ) == 0 ) f->rev = 0; else f->id_mark = UPD_FDC_AM_NONE; - i = f->current_drive->disk.bpt ? - ( f->current_drive->disk.i - i ) * 200 / f->current_drive->disk.bpt : 200; + i = f->current_drive->disk.c_bpt ? + ( f->current_drive->disk.i - i ) * 200 / f->current_drive->disk.c_bpt : 200; if( i > 0 ) { event_add_with_data( tstates + i * /* i * 1/20 revolution */ machine_current->timings.processor_speed / 1000, @@ -743,14 +743,14 @@ multi_track_next: f->read_id = 1; } while( f->rev ) { - i = f->current_drive->disk.i >= f->current_drive->disk.bpt ? + i = f->current_drive->disk.i >= f->current_drive->disk.c_bpt ? 0 : f->current_drive->disk.i; /* start position */ if( seek_id( f ) == 0 ) f->rev = 0; else f->id_mark = UPD_FDC_AM_NONE; - i = f->current_drive->disk.bpt ? - ( f->current_drive->disk.i - i ) * 200 / f->current_drive->disk.bpt : 200; + i = f->current_drive->disk.c_bpt ? + ( f->current_drive->disk.i - i ) * 200 / f->current_drive->disk.c_bpt : 200; if( i > 0 ) { event_add_with_data( tstates + i * /* i * 1/20 revolution */ machine_current->timings.processor_speed / 1000, diff --git a/peripherals/disk/wd_fdc.c b/peripherals/disk/wd_fdc.c index 909d9618..ef84b3aa 100644 --- a/peripherals/disk/wd_fdc.c +++ b/peripherals/disk/wd_fdc.c @@ -404,14 +404,14 @@ wd_fdc_seek_verify_read_id( wd_fdc *f ) event_remove_type( fdc_event ); if( f->id_mark == WD_FDC_AM_NONE ) { while( f->rev ) { - i = d->disk.i >= d->disk.bpt ? 0 : d->disk.i; /* start position */ + i = d->disk.i >= d->disk.c_bpt ? 0 : d->disk.i; /* start position */ if( !read_id( f ) ) { if( f->id_track != f->track_register ) { f->status_register |= WD_FDC_SR_RNF; } } else f->id_mark = WD_FDC_AM_NONE; - i = d->disk.bpt ? ( d->disk.i - i ) * 200 / d->disk.bpt : 200; + i = d->disk.c_bpt ? ( d->disk.i - i ) * 200 / d->disk.c_bpt : 200; if( i > 0 ) { event_add_with_data( tstates + i * /* i * 1/20 revolution */ machine_current->timings.processor_speed / 1000, @@ -561,7 +561,7 @@ wd_fdc_type_ii_seek( wd_fdc *f ) if( f->id_mark == WD_FDC_AM_NONE ) { f->read_id = 1; while( f->rev ) { - i = d->disk.i >= d->disk.bpt ? 0 : d->disk.i; /* start position */ + i = d->disk.i >= d->disk.c_bpt ? 0 : d->disk.i; /* start position */ if( !read_id( f ) ) { if( ( f->data_check_head != -1 && f->data_check_head != !!( f->id_head ) ) || ( f->id_track != f->track_register || f->id_sector != f->sector_register ) ) { @@ -570,8 +570,8 @@ wd_fdc_type_ii_seek( wd_fdc *f ) } else { f->id_mark = WD_FDC_AM_NONE; } - i = d->disk.bpt ? - ( d->disk.i - i ) * 200 / d->disk.bpt : 200; + i = d->disk.c_bpt ? + ( d->disk.i - i ) * 200 / d->disk.c_bpt : 200; if( i > 0 ) { event_add_with_data( tstates + i * /* i * 1/20 revolution */ machine_current->timings.processor_speed / 1000, @@ -723,10 +723,10 @@ wd_fdc_type_iii( wd_fdc *f ) } if( f->id_mark == WD_FDC_AM_NONE ) { while( f->rev ) { - i = d->disk.i >= d->disk.bpt ? 0 : d->disk.i; /* start position */ + i = d->disk.i >= d->disk.c_bpt ? 0 : d->disk.i; /* start position */ read_id( f ); - i = d->disk.bpt ? - ( d->disk.i - i ) * 200 / d->disk.bpt : 200; + i = d->disk.c_bpt ? + ( d->disk.i - i ) * 200 / d->disk.c_bpt : 200; if( i > 0 ) { event_add_with_data( tstates + i * /* i * 1/20 revolution */ machine_current->timings.processor_speed / 1000, |
From: <sba...@us...> - 2023-11-04 18:43:08
|
This is an automated email from the git hooks/post-receive-user script. sbaldovi pushed a change to branch master in repository fuse. from d789c009 Treat special "Stored data length" in EDSK images new edac6086 Allow to merge disk sides with different bpt new 51f4e278 Allow to load unformatted EDSK disk images The 2 revisions listed above as "new" are entirely new to this repository and will be described in separate emails. The revisions listed as "add" were already present in the repository and have only been added to this reference. Summary of changes: peripherals/disk/disk.c | 184 ++++++++++++++++++++++++--------------------- peripherals/disk/disk.h | 11 ++- peripherals/disk/fdd.c | 17 ++--- peripherals/disk/fdd.h | 1 - peripherals/disk/upd_fdc.c | 24 +++--- peripherals/disk/wd_fdc.c | 16 ++-- 6 files changed, 134 insertions(+), 119 deletions(-) |
From: <sba...@us...> - 2023-11-04 15:47:35
|
This is an automated email from the git hooks/post-receive-user script. sbaldovi pushed a commit to branch master in repository fuse. View the commit online: https://sourceforge.net/p/fuse-emulator/fuse/ci/d789c009ec461a6fec084450ccb79075c15e51b9/ The following commit(s) were added to refs/heads/master by this push: new d789c009 Treat special "Stored data length" in EDSK images d789c009 is described below commit d789c009ec461a6fec084450ccb79075c15e51b9 Author: Gergely Szasz <sz...@hu...> AuthorDate: Sat Nov 4 16:43:31 2023 +0100 Treat special "Stored data length" in EDSK images Implements Simon Owen's special extension when the stored length exceeds sector length: "If data length exceeds normal sector length, but is not an exact multiple of the normal length, the data also includes the CRC and gap3 bytes beyond the data field." https://simonowen.com/misc/extextdsk.txt Fixes the load of Cabal, NARC and Robin of Sherlock disk images (fixes bug #452). --- peripherals/disk/disk.c | 245 ++++++++++++++++++++++++++++++++++++------------ 1 file changed, 183 insertions(+), 62 deletions(-) diff --git a/peripherals/disk/disk.c b/peripherals/disk/disk.c index 16ad994a..d4774b60 100644 --- a/peripherals/disk/disk.c +++ b/peripherals/disk/disk.c @@ -86,14 +86,22 @@ disk_gap_t gaps[] = { { 0x4e, 0x00, 12, 0xa1, { 80, 50, 22, 54 } }, /* IBM34 MFM */ { 0xff, 0x00, 6, -1, { 0, 16, 11, 10 } }, /* MINIMAL FM */ { 0x4e, 0x00, 12, 0xa1, { 0, 32, 22, 24 } }, /* MINIMAL MFM */ + { 0xff, 0x00, 6, -1, { 8, 8, 11, 10 } }, /* 4k UPD765 FM - maybe never... */ + { 0x4e, 0x00, 12, 0xa1, { 16, 16, 22, 24 } }, /* 8k UPD765 MFM */ + { 0xff, 0x00, 6, -1, { 0, 0, 0, 0 } }, /* CUSTOM FM */ + { 0x4e, 0x00, 12, 0xa1, { 0, 0, 0, 0 } }, /* CUSTOM MFM */ }; #define GAP_MGT_PLUSD 0 #define GAP_TRDOS 1 #define GAP_IBM3740 2 #define GAP_IBM34 3 -#define GAP_MINIMAL_FM 4 -#define GAP_MINIMAL_MFM 5 +#define GAP_MINIMAL_FM 4 +#define GAP_MINIMAL_MFM 5 +#define GAP_4k765_FM 6 +#define GAP_8k765_MFM 7 +#define GAP_CUSTOM_FM 8 +#define GAP_CUSTOM_MFM 9 #define buffavail(buffer) ( buffer->file.length - buffer->index ) /* data buffer */ @@ -1575,11 +1583,24 @@ cpc_set_weak_range( disk_t *d, int idx, buffer_t *buffer, int n, int len ) } } +/* +#define CPC_DEBUG 1 +#define CPC_DEBUG_EXIT 1 +*/ +#ifdef CPC_DEBUG_EXIT +extern int fuse_exiting; /* Shall we exit now? */ +#endif #define CPC_ISSUE_NONE 0 +/* 1x 8k sector */ #define CPC_ISSUE_1 1 +/* 1x 8k + Nx 512 sector */ #define CPC_ISSUE_2 2 +/* 128 256 512 1024 2048 4096 */ #define CPC_ISSUE_3 3 +/* 128 256 512 1024 2048 4096 ... */ +#define CPC_ISSUE_3a 13 #define CPC_ISSUE_4 4 +/* 512 256 512 256 512 256 ... (9x) */ #define CPC_ISSUE_5 5 static int @@ -1587,15 +1608,43 @@ open_cpc( buffer_t *buffer, disk_t *d, int preindex ) { int i, j, seclen, idlen, gap, idx; int bpt, max_bpt = 0, trlen; - int fix[84], plus3_fix; - unsigned char *hdrb; + int cpc_fix; + unsigned char *hdrb, *tltbl; +#ifdef CPC_DEBUG + int cpc_fix_fix = 0; +#endif d->sides = buff[0x31]; d->cylinders = buff[0x30]; /* maximum number of tracks */ GEOM_CHECK; +/* first scan for the longest track */ + if( d->type != DISK_ECPC ) { + /* All track sizes in the standard disk image must be the same */ + trlen = buff[0x32] + 256 * buff[0x33]; + } else { + trlen = -1; + tltbl = &buff[0x34]; /* track size table */ + } + idx = 256; + for( i = 0; i < d->sides * d->cylinders; i++ ) { + if( buff[ idx + 0x13 ] == 0 ) /* we now assume MFM */ + buff[ idx + 0x13 ] = 2; + idx += d->type == DISK_ECPC ? tltbl[i] * 256 : trlen; + } + buffer->index = idx; +/* later we try to use Offset-Info block to determine gap lengths... + if( buffavail( buffer ) >= 13 && !memcmp( buff, "Offset-Info\r\n", 13 ) ) + offinf = buff; + else + offinf = NULL; +*/ buffer->index = 256; +#ifdef CPC_DEBUG +fprintf( stderr, "%ds/%dc\n", d->sides, d->cylinders ); +#endif /* first scan for the longest track */ for( i = 0; i < d->sides*d->cylinders; i++ ) { + /* ignore Sector Offset block */ if( buffavail( buffer ) >= 13 && !memcmp( buff, "Offset-Info\r\n", 13 ) ) { buffer->index = buffer->file.length; @@ -1606,73 +1655,106 @@ open_cpc( buffer_t *buffer, disk_t *d, int preindex ) d->cylinders = i / d->sides + i % d->sides; /* the real cylinder number */ break; } + if( d->type == DISK_ECPC && tltbl[i] == 0 ) continue; /* skip unformatted tracks */ if( buffavail( buffer ) < 256 || memcmp( buff, "Track-Info", 10 ) ) /* check track header */ return d->status = DISK_OPEN; - +/* gap = (unsigned char)buff[0x16] == 0xff ? GAP_MINIMAL_FM : GAP_MINIMAL_MFM; - plus3_fix = trlen = 0; - while( i < buff[0x10] * d->sides + buff[0x11] ) { - if( i < 84 ) fix[i] = 0; - i++; +*/ + if( buff[0x1b] >= 6 ) { + gap = buff[0x13] == 2 ? GAP_8k765_MFM : GAP_4k765_FM; + } else { + gap = buff[0x13] == 2 ? GAP_IBM34 : GAP_IBM3740; } + cpc_fix = 0; + if( i >= d->sides*d->cylinders || i != buff[0x10] * d->sides + buff[0x11] ) /* problem with track idx. */ return d->status = DISK_OPEN; bpt = postindex_len( d, gap ) + ( preindex ? preindex_len( d, gap ) : 0 ) + - ( gap == GAP_MINIMAL_MFM ? 6 : 3 ); /* gap4 */ - for( j = 0; j < buff[0x15]; j++ ) { /* each sector */ + ( buff[ 0x13 ] == 2 ? 6 : 3 ); /* gap4 */ +#ifdef CPC_DEBUG +fprintf( stderr, "%d:: %d/%d.%d [%d] %d", i, buff[ 0x15 ], gap, buff[0x13], buffer->index, bpt ); +#endif + for( j = 0; j < buff[ 0x15 ]; j++ ) { /* each sector */ seclen = d->type == DISK_ECPC ? buff[ 0x1e + 8 * j ] + 256 * buff[ 0x1f + 8 * j ] : 0x80 << buff[ 0x1b + 8 * j ]; - idlen = 0x80 << buff[ 0x1b + 8 * j ]; /* sector length from ID */ - if( idlen != 0 && idlen <= ( 0x80 << 0x08 ) && /* idlen is o.k. */ - seclen > idlen && seclen % idlen ) /* seclen != N * len */ - return d->status = DISK_OPEN; - - bpt += calc_sectorlen( gap == GAP_MINIMAL_MFM ? 1 : 0, seclen > idlen ? idlen : seclen, gap ); - if( i < 84 && d->flag & DISK_FLAG_PLUS3_CPC ) { + idlen = 0x80 << ( buff[ 0x1b + 8 * j ] > 7 ? 8 : buff[ 0x1b + 8 * j ] ); + /* sector length from ID if N >= 8 -> N = 8 */ + if( d->type != DISK_ECPC && ( + ( seclen == 6144 && idlen != 8192 ) || + ( idlen > 4096 && seclen != 0 ) || + seclen != idlen + ) ) + return d->status = DISK_OPEN; /* relax the sector length rule */ + +#ifdef CPC_DEBUG +fprintf( stderr, " (%d/%d) %d", seclen, idlen, bpt ); +#endif + bpt += calc_sectorlen( buff[ 0x13 ] == 2 ? 1 : 0, seclen > idlen ? idlen : seclen, gap ); + if( d->flag & DISK_FLAG_PLUS3_CPC ) { if( j == 0 && buff[ 0x1b + 8 * j ] == 6 && seclen > 6144 ) - plus3_fix = CPC_ISSUE_4; - else if( j == 0 && buff[ 0x1b + 8 * j ] == 6 ) - plus3_fix = CPC_ISSUE_1; + cpc_fix = CPC_ISSUE_4; + else if( j == 0 && buff[ 0x1b + 8 * j ] == 6 ) /* sec1 = 8k */ + cpc_fix = CPC_ISSUE_1; else if( j == 0 && buff[ 0x18 + 8 * j ] == j && buff[ 0x19 + 8 * j ] == j && buff[ 0x1a + 8 * j ] == j && buff[ 0x1b + 8 * j ] == j ) - plus3_fix = CPC_ISSUE_3; - else if( j == 1 && plus3_fix == CPC_ISSUE_1 && + cpc_fix = CPC_ISSUE_3; + else if( j == 0 && + buff[ 0x18 + 8 * j ] == 1 && buff[ 0x19 + 8 * j ] == 1 && + buff[ 0x1a + 8 * j ] == 1 && buff[ 0x1b + 8 * j ] == 1 ) + cpc_fix = CPC_ISSUE_3a; + else if( j == 1 && cpc_fix == CPC_ISSUE_1 && /* sec1 = 8k && sec2 = 512 sec3 = 512 ... sec10 = 512 */ buff[ 0x1b + 8 * j ] == 2 ) - plus3_fix = CPC_ISSUE_2; + cpc_fix = CPC_ISSUE_2; else if( i == 38 && j == 0 && buff[ 0x1b + 8 * j ] == 2 ) - plus3_fix = CPC_ISSUE_5; - else if( j > 1 && plus3_fix == CPC_ISSUE_2 && buff[ 0x1b + 8 * j ] != 2 ) - plus3_fix = CPC_ISSUE_NONE; - else if( j > 0 && plus3_fix == CPC_ISSUE_3 && + cpc_fix = CPC_ISSUE_5; + else if( j > 1 && cpc_fix == CPC_ISSUE_2 && buff[ 0x1b + 8 * j ] != 2 ) + cpc_fix = CPC_ISSUE_NONE; + else if( j > 0 && cpc_fix == CPC_ISSUE_3 && ( buff[ 0x18 + 8 * j ] != j || buff[ 0x19 + 8 * j ] != j || buff[ 0x1a + 8 * j ] != j || buff[ 0x1b + 8 * j ] != j ) ) - plus3_fix = CPC_ISSUE_NONE; - else if( j > 10 && plus3_fix == CPC_ISSUE_2 ) - plus3_fix = CPC_ISSUE_NONE; - else if( i == 38 && j > 0 && plus3_fix == CPC_ISSUE_5 && + cpc_fix = CPC_ISSUE_NONE; + else if( j > 0 && cpc_fix == CPC_ISSUE_3a && + ( buff[ 0x18 + 8 * j ] != j + 1 || buff[ 0x19 + 8 * j ] != j + 1 || + buff[ 0x1a + 8 * j ] != j + 1 || buff[ 0x1b + 8 * j ] != j + 1 ) ) + cpc_fix = CPC_ISSUE_NONE; + else if( j > 10 && cpc_fix == CPC_ISSUE_2 ) + cpc_fix = CPC_ISSUE_NONE; + else if( i == 38 && j > 0 && cpc_fix == CPC_ISSUE_5 && buff[ 0x1b + 8 * j ] != 2 - ( j & 1 ) ) - plus3_fix = CPC_ISSUE_NONE; + cpc_fix = CPC_ISSUE_NONE; } - trlen += seclen; - } - if( i < 84 ) { - fix[i] = plus3_fix; - if( fix[i] == CPC_ISSUE_4 ) bpt = 6500;/* Type 1 variant DD+ (e.g. Coin Op Hits) */ - else if( fix[i] != CPC_ISSUE_NONE ) bpt = 6250;/* we assume a standard DD track */ } - if( trlen % 0x100 ) - trlen += 0x100 - trlen % 0x100; - buffer->index += trlen + 256; +// fix[i] = cpc_fix; + buff[0x00] = cpc_fix; /* we use "Track-Info..." T to store "FIX" */ + if( buff[0x00] == CPC_ISSUE_4 ) bpt = 6500;/* Type 1 variant DD+ (e.g. Coin Op Hits) */ + else if( buff[0x00] != CPC_ISSUE_NONE ) bpt = 6250;/* we assume a standard DD track */ +#ifdef CPC_DEBUG +fprintf( stderr, "----spec:%d bpt:%d\n", cpc_fix, bpt ); +if( cpc_fix ) cpc_fix_fix = cpc_fix; +#endif +/* extended DSK image uses track size table */ + buffer->index += ( d->type == DISK_ECPC ? 256 * tltbl[i] : trlen ); if( bpt > max_bpt ) max_bpt = bpt; } +#ifdef CPC_DEBUG +if( cpc_fix_fix ) { + fprintf( stderr, "@@@spec:%d\n", cpc_fix_fix ); + cpc_fix_fix = 0; +} +#endif +/****TODO + open unformatted disks e.g.: edd_the_duck_master_b.dsk + this disk looks has 0 track... so fail to open, and merge +*/ if( max_bpt == 0 ) return d->status = DISK_GEOM; @@ -1684,57 +1766,67 @@ open_cpc( buffer_t *buffer, disk_t *d, int preindex ) DISK_SET_TRACK_IDX( d, 0 ); buffer->index = 256; /* rewind to first track */ for( i = 0; i < d->sides*d->cylinders; i++ ) { + int idx_save; + + if( d->type == DISK_ECPC && tltbl[i] == 0 ) continue; /* skip unformatted tracks */ hdrb = buff; + idx_save = buffer->index; buffer->index += 256; /* skip to data */ +/* gap = (unsigned char)hdrb[0x16] == 0xff ? GAP_MINIMAL_FM : GAP_MINIMAL_MFM; +*/ + if( hdrb[0x1b] >= 6 ) { + gap = hdrb[0x13] == 2 ? GAP_8k765_MFM : GAP_4k765_FM; + } else { + gap = hdrb[0x13] == 2 ? GAP_IBM34 : GAP_IBM3740; + } - i = hdrb[0x10] * d->sides + hdrb[0x11]; /* adjust track No. */ + if( hdrb[0x10] * d->sides + hdrb[0x11] > i ) /* adjust track No. */ + i = hdrb[0x10] * d->sides + hdrb[0x11]; DISK_SET_TRACK_IDX( d, i ); d->i = 0; if( preindex) preindex_add( d, gap ); postindex_add( d, gap ); - trlen = 0; for( j = 0; j < hdrb[0x15]; j++ ) { /* each sector */ seclen = d->type == DISK_ECPC ? hdrb[ 0x1e + 8 * j ] + /* data length in sector */ 256 * hdrb[ 0x1f + 8 * j ] : 0x80 << hdrb[ 0x1b + 8 * j ]; - idlen = 0x80 << hdrb[ 0x1b + 8 * j ]; /* sector length from ID */ - - if( idlen == 0 || idlen > ( 0x80 << 0x08 ) ) /* error in sector length code -> ignore */ - idlen = seclen; + idlen = 0x80 << ( hdrb[ 0x1b + 8 * j ] > 7 ? 8 : hdrb[ 0x1b + 8 * j ] ); + /* sector length from ID if N >= 8 -> N = 8 + https://simonowen.com/misc/extextdsk.txt */ - if( i < 84 && fix[i] == 2 && j == 0 ) { /* repositionate the dummy track */ + if( hdrb[ 0x00 ] == CPC_ISSUE_2 && j == 0 ) { /* repositionate the dummy sector (?) */ d->i = 8; } id_add( d, hdrb[ 0x19 + 8 * j ], hdrb[ 0x18 + 8 * j ], hdrb[ 0x1a + 8 * j ], hdrb[ 0x1b + 8 * j ], gap, hdrb[ 0x1c + 8 * j ] & 0x20 && !( hdrb[ 0x1d + 8 * j ] & 0x20 ) ? CRC_ERROR : CRC_OK ); - - if( i < 84 && fix[i] == CPC_ISSUE_1 && j == 0 ) { /* 6144 */ + cpc_fix = hdrb[ 0x00 ]; + if( cpc_fix == CPC_ISSUE_1 && j == 0 ) { /* 6144 */ data_add( d, buffer, NULL, seclen, hdrb[ 0x1d + 8 * j ] & 0x40 ? DDAM : NO_DDAM, gap, hdrb[ 0x1c + 8 * j ] & 0x20 && hdrb[ 0x1d + 8 * j ] & 0x20 ? CRC_ERROR : CRC_OK, 0x00, NULL ); - } else if( i < 84 && fix[i] == CPC_ISSUE_2 && j == 0 ) { /* 6144, 10x512 */ + } else if( cpc_fix == CPC_ISSUE_2 && j == 0 ) { /* 6144, 10x512 */ datamark_add( d, hdrb[ 0x1d + 8 * j ] & 0x40 ? DDAM : NO_DDAM, gap ); gap_add( d, 2, gap ); buffer->index += seclen; - } else if( i < 84 && fix[i] == CPC_ISSUE_3 ) { /* 128, 256, 512, ... 4096k */ + } else if( cpc_fix == CPC_ISSUE_3 ) { /* 128, 256, 512, ... 4096k */ data_add( d, buffer, NULL, 128, hdrb[ 0x1d + 8 * j ] & 0x40 ? DDAM : NO_DDAM, gap, hdrb[ 0x1c + 8 * j ] & 0x20 && hdrb[ 0x1d + 8 * j ] & 0x20 ? CRC_ERROR : CRC_OK, 0x00, NULL ); buffer->index += seclen - 128; - } else if( i < 84 && fix[i] == CPC_ISSUE_4 ) { /* Nx8192 (max 6384 byte ) */ + } else if( cpc_fix == CPC_ISSUE_4 ) { /* Nx8192 (max 6384 byte ) */ data_add( d, buffer, NULL, 6384, hdrb[ 0x1d + 8 * j ] & 0x40 ? DDAM : NO_DDAM, gap, hdrb[ 0x1c + 8 * j ] & 0x20 && hdrb[ 0x1d + 8 * j ] & 0x20 ? CRC_ERROR : CRC_OK, 0x00, NULL ); buffer->index += seclen - 6384; - } else if( i < 84 && fix[i] == CPC_ISSUE_5 ) { /* 9x512 */ + } else if( cpc_fix == CPC_ISSUE_5 ) { /* 9x512 */ /* 512 256 512 256 512 256 512 256 512 */ if( idlen == 256 ) { data_add( d, NULL, buff, 512, @@ -1749,21 +1841,35 @@ open_cpc( buffer_t *buffer, disk_t *d, int preindex ) CRC_ERROR : CRC_OK, 0x00, NULL ); } } else { - data_add( d, buffer, NULL, seclen > idlen ? idlen : seclen, + if( data_add( d, buffer, NULL, seclen > idlen ? idlen : seclen, hdrb[ 0x1d + 8 * j ] & 0x40 ? DDAM : NO_DDAM, gap, hdrb[ 0x1c + 8 * j ] & 0x20 && hdrb[ 0x1d + 8 * j ] & 0x20 ? - CRC_ERROR : CRC_OK, 0x00, &idx ); - if( seclen > idlen ) { /* weak sector with multiple copy */ + CRC_ERROR : CRC_OK, 0x00, &idx ) ) + buffer->index += seclen; /* if cannot add data, we have to advance buffer->index! */ + if( seclen > idlen && seclen % idlen ) { /* data in gap ??? */ + int k, save_index; + + save_index = d->i; + /* idx -> first data byte */ + d->i = idx + idlen; /* end of the sector data (CRC) */ + for( k = seclen - idlen; k > 0; k-- ) { + if( d->i == d->bpt ) + d->i = 0; /* wrap around */ + d->track[ d->i ] = *buff; + d->i++; + buffer->index++; + } + d->i = save_index; /* restore pointer */ + } else if( seclen > idlen ) { /* weak sector with multiple copy */ cpc_set_weak_range( d, idx, buffer, seclen / idlen, idlen ); buffer->index += ( seclen / idlen - 1 ) * idlen; /* ( ( N * len ) / len - 1 ) * len */ } } - trlen += seclen; } gap4_add( d, gap ); - if( trlen % 0x100 ) - buffer->index += 0x100 - trlen % 0x100; +/* extended DSK image uses track size table */ + buffer->index = idx_save + ( d->type == DISK_ECPC ? 256 * tltbl[i] : trlen ); } return d->status = DISK_OK; } @@ -2110,6 +2216,9 @@ disk_open2( disk_t *d, const char *filename, int preindex ) buffer.file.buffer, buffer.file.length ); if( error ) return d->status = DISK_OPEN; d->type = DISK_TYPE_NONE; +#ifdef CPC_DEBUG +fprintf( stderr, "\n::::%s:::: ", filename ); +#endif switch ( type ) { case LIBSPECTRUM_ID_DISK_UDI: d->type = DISK_UDI; @@ -2161,6 +2270,12 @@ disk_open2( disk_t *d, const char *filename, int preindex ) if( d->data != NULL ) libspectrum_free( d->data ); utils_close_file( &buffer.file ); +#ifdef CPC_DEBUG +fprintf( stderr, "\n!!!!error opening: %s!!!!\n", filename ); +#ifdef CPC_DEBUG_EXIT +fuse_exiting = 1; +#endif +#endif return d->status; } utils_close_file( &buffer.file ); @@ -2168,6 +2283,9 @@ disk_open2( disk_t *d, const char *filename, int preindex ) disk_update_tlens( d ); update_tracks_mode( d ); d->filename = utils_safe_strdup( filename ); +#ifdef CPC_DEBUG_EXIT +fuse_exiting = 1; +#endif return d->status = DISK_OK; } @@ -2261,7 +2379,10 @@ disk_open( disk_t *d, const char *filename, int preindex, int merge_disks ) g++; pos = filename2 - filename; c = *filename2 - 1; /* 2->1, b->a, B->A */ - } else if( g == 2 && ( *filename2 == '_' || *filename2 == ' ' ) ) { + } else if( g == 2 && ( *filename2 < '0' || + ( *filename2 > '9' && *filename2 < 'A') || + ( *filename2 > 'Z' && *filename2 < 'a') || + *filename2 > 'x' ) ) { g++; } else if( g == 3 && l >= 5 && ( !memcmp( filename2 - 3, "Side", 4 ) || !memcmp( filename2 - 3, "side", 4 ) ) ) { |
From: <sba...@us...> - 2023-11-01 19:00:10
|
This is an automated email from the git hooks/post-receive-user script. sbaldovi pushed a commit to branch master in repository fuse. View the commit online: https://sourceforge.net/p/fuse-emulator/fuse/ci/3af9c3204b4f9ac73939b69e4f3cdba99cea4b79/ The following commit(s) were added to refs/heads/master by this push: new 3af9c320 Pad disk tracks to length multiple of 256 bytes 3af9c320 is described below commit 3af9c3204b4f9ac73939b69e4f3cdba99cea4b79 Author: Gergely Szasz <sz...@hu...> AuthorDate: Wed Nov 1 16:03:11 2023 +0100 Pad disk tracks to length multiple of 256 bytes Instead of padding sectors. Fixes loading of Action Countdown, Discology +3, Genial, Gonzzalezz, SP5 and Trigger (Lightgun) (fixes bug #451). --- peripherals/disk/disk.c | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/peripherals/disk/disk.c b/peripherals/disk/disk.c index 7d0b9f41..16ad994a 100644 --- a/peripherals/disk/disk.c +++ b/peripherals/disk/disk.c @@ -1585,7 +1585,7 @@ cpc_set_weak_range( disk_t *d, int idx, buffer_t *buffer, int n, int len ) static int open_cpc( buffer_t *buffer, disk_t *d, int preindex ) { - int i, j, seclen, idlen, gap, sector_pad, idx; + int i, j, seclen, idlen, gap, idx; int bpt, max_bpt = 0, trlen; int fix[84], plus3_fix; unsigned char *hdrb; @@ -1624,7 +1624,6 @@ open_cpc( buffer_t *buffer, disk_t *d, int preindex ) bpt = postindex_len( d, gap ) + ( preindex ? preindex_len( d, gap ) : 0 ) + ( gap == GAP_MINIMAL_MFM ? 6 : 3 ); /* gap4 */ - sector_pad = 0; for( j = 0; j < buff[0x15]; j++ ) { /* each sector */ seclen = d->type == DISK_ECPC ? buff[ 0x1e + 8 * j ] + 256 * buff[ 0x1f + 8 * j ] @@ -1662,15 +1661,15 @@ open_cpc( buffer_t *buffer, disk_t *d, int preindex ) plus3_fix = CPC_ISSUE_NONE; } trlen += seclen; - if( seclen % 0x100 ) /* every? 128/384/...byte length sector padded */ - sector_pad++; } if( i < 84 ) { fix[i] = plus3_fix; if( fix[i] == CPC_ISSUE_4 ) bpt = 6500;/* Type 1 variant DD+ (e.g. Coin Op Hits) */ else if( fix[i] != CPC_ISSUE_NONE ) bpt = 6250;/* we assume a standard DD track */ } - buffer->index += trlen + sector_pad * 128 + 256; + if( trlen % 0x100 ) + trlen += 0x100 - trlen % 0x100; + buffer->index += trlen + 256; if( bpt > max_bpt ) max_bpt = bpt; } @@ -1696,7 +1695,7 @@ open_cpc( buffer_t *buffer, disk_t *d, int preindex ) preindex_add( d, gap ); postindex_add( d, gap ); - sector_pad = 0; + trlen = 0; for( j = 0; j < hdrb[0x15]; j++ ) { /* each sector */ seclen = d->type == DISK_ECPC ? hdrb[ 0x1e + 8 * j ] + /* data length in sector */ 256 * hdrb[ 0x1f + 8 * j ] @@ -1760,11 +1759,11 @@ open_cpc( buffer_t *buffer, disk_t *d, int preindex ) /* ( ( N * len ) / len - 1 ) * len */ } } - if( seclen % 0x100 ) /* every? 128/384/...byte length sector padded */ - sector_pad++; + trlen += seclen; } gap4_add( d, gap ); - buffer->index += sector_pad * 0x80; + if( trlen % 0x100 ) + buffer->index += 0x100 - trlen % 0x100; } return d->status = DISK_OK; } |
From: <sba...@us...> - 2023-10-21 10:28:55
|
This is an automated email from the git hooks/post-receive-user script. sbaldovi pushed a commit to branch master in repository fuse. View the commit online: https://sourceforge.net/p/fuse-emulator/fuse/ci/84f7feba545b5d7570c87f07a0e9928dd66da5ad/ commit 84f7feba545b5d7570c87f07a0e9928dd66da5ad Author: Gergely Szasz <sz...@hu...> AuthorDate: Sat Oct 21 07:52:44 2023 +0200 Add debugging info in uPD765 FDC (more from bug #453) (thanks, Vic Chwe). --- peripherals/disk/upd_fdc.c | 151 ++++++++++++++++++++++++++++++++++++++++++++- peripherals/disk/upd_fdc.h | 7 ++- 2 files changed, 156 insertions(+), 2 deletions(-) diff --git a/peripherals/disk/upd_fdc.c b/peripherals/disk/upd_fdc.c index 9e10e87c..64d9974c 100644 --- a/peripherals/disk/upd_fdc.c +++ b/peripherals/disk/upd_fdc.c @@ -33,6 +33,34 @@ #define MAX_SIZE_CODE 8 +#ifdef DEBUG_UPD +const char *debug_cmd_str[] = { + "INVALID", + "--", + "READ_DIAG", + "SPECIFY", + "SENSE_DRIVE", + "WRITE_DATA", + "READ_DATA", + "RECALIBRATE", + "SENSE_INTERRUPT", + "WRITE_DATA_DEL", + "READ_ID", + "--", + "READ_DATA_DEL", + "WRITE_ID", + "--", + "SEEK", + "VERSION", + "SCAN_EQ", + "--","--","--","--","--","--","--", + "SCAN_LE", + "--","--","--", + "SCAN_HE", + "--","--" +}; +#endif + /* static const int UPD_FDC_MAIN_DRV_0_SEEK = 0x01; */ /* static const int UPD_FDC_MAIN_DRV_1_SEEK = 0x02; */ /* static const int UPD_FDC_MAIN_DRV_2_SEEK = 0x04; */ @@ -901,9 +929,53 @@ upd_fdc_event( libspectrum_dword last_tstates GCC_UNUSED, int event, return; } +#ifdef DEBUG_UPD +#define CHECK_BIT_STR( n ) ( n ) ? "\e[42;30m" : "\e[100;37m" +#define CHECK_BIT_RED( n ) ( n ) ? "\e[42;30m" : "\e[41;37m" +#define CHECK_4BIT_STR( b ) ( b ) & CHECK_BIT_STR( 0x20 ), \ + ( b ) & CHECK_BIT_STR( 0x10 ), \ + ( b ) & CHECK_BIT_STR( 0x08 ), \ + ( b ) & CHECK_BIT_STR( 0x04 ) + +#define CHECK_6BIT_STR( b ) ( b ) & CHECK_BIT_STR( 0x80 ), \ + ( b ) & CHECK_BIT_STR( 0x40 ), \ + ( b ) & CHECK_BIT_STR( 0x20 ), \ + ( b ) & CHECK_BIT_STR( 0x10 ), \ + ( b ) & CHECK_BIT_STR( 0x08 ), \ + ( b ) & CHECK_BIT_STR( 0x04 ) + +#define CHECK_8BIT_STR( b ) ( b ) & CHECK_BIT_STR( 0x80 ), \ + ( b ) & CHECK_BIT_STR( 0x40 ), \ + ( b ) & CHECK_BIT_STR( 0x20 ), \ + ( b ) & CHECK_BIT_STR( 0x10 ), \ + ( b ) & CHECK_BIT_STR( 0x08 ), \ + ( b ) & CHECK_BIT_STR( 0x04 ), \ + ( b ) & CHECK_BIT_STR( 0x02 ), \ + ( b ) & CHECK_BIT_STR( 0x01 ) +#endif /* #ifdef DEBUG_UPD */ + libspectrum_byte upd_fdc_read_status( upd_fdc *f ) { +#ifdef DEBUG_UPD + /* RQM DIO EXM CB D3B D2B D1B D0B */ + if( f ) { + static int last_status = -1; + static size_t num = 0; + if( last_status == f->main_status ) { + num++; + } else { + if( num ) + fprintf( stderr, "Main ST (0x%02x): %sRQM\e[0m %sDIO\e[0m %sEXM\e[0m %s CB\e[0m %sD3B\e[0m %sD2B\e[0m %sD1B\e[0m %sD0B\e[0m x%zu\n", last_status, + CHECK_8BIT_STR( last_status ), num ); + fprintf( stderr, "Main ST (0x%02x): %sRQM\e[0m %sDIO\e[0m %sEXM\e[0m %s CB\e[0m %sD3B\e[0m %sD2B\e[0m %sD1B\e[0m %sD0B\e[0m\n", f->main_status, + CHECK_8BIT_STR( f->main_status ) ); + last_status = f->main_status; + num = 0; + } + } +#endif /* #ifdef DEBUG_UPD */ + return f->main_status; } @@ -911,6 +983,10 @@ libspectrum_byte upd_fdc_read_data( upd_fdc *f ) { libspectrum_byte r; +#ifdef DEBUG_UPD + int state = f->state; + const char *t_str[] = { " NT", " AT", " IC", "RAT" }; +#endif /* #ifdef DEBUG_UPD */ fdd_t *d = f->current_drive; @@ -1000,15 +1076,54 @@ upd_fdc_read_data( upd_fdc *f ) if( f->intrq < UPD_INTRQ_READY ) f->intrq = UPD_INTRQ_NONE; } + +#ifdef DEBUG_UPD + if( state == UPD_FDC_STATE_RES ) { /* result */ + if( f->cmd->id == UPD_CMD_SENSE_DRIVE ) { /* sense drive -> ST3 */ + fprintf( stderr, "--- %s RESULT\nSTATUS3 (0x%02x): %sFLT\e[0m %s WP\e[0m %sRDY\e[0m %s T0\e[0m %s TS\e[0m %s HD\e[0m US: %d\n", debug_cmd_str[f->command_register & 0x1f], r, + CHECK_6BIT_STR( r ), r & 0x03 ); + } else if( f->cmd->id == UPD_CMD_SENSE_INT && f->cycle == 0 ) { /* ST0 PCN */ + fprintf( stderr, "--- %s RESULT\nSTATUS0 (0x%02x): TRM:%s%s\e[0m %s SE\e[0m %s EC\e[0m %s NR\e[0m %s HD\e[0m US: %d PCN:% 3d\n", debug_cmd_str[f->command_register & 0x1f], f->sense_int_res[0], + CHECK_BIT_RED( !( f->sense_int_res[0] & 0xc0 ) ), t_str[f->sense_int_res[0] >> 6], + CHECK_4BIT_STR( r ), f->sense_int_res[0] & 0x03, f->sense_int_res[1] ); + } else if( f->cmd->res_length == 7 && f->cycle == 0 ) { + fprintf( stderr, "--- %s RESULT\nSTATUS0 (0x%02x): TRM:%s%s\e[0m %s SE\e[0m %s EC\e[0m %s NR\e[0m %s HD\e[0m US: %d\n", debug_cmd_str[f->command_register & 0x1f], f->status_register[0], + CHECK_BIT_RED( !( f->status_register[0] & 0xc0 ) ), t_str[f->status_register[0] >> 6], + CHECK_4BIT_STR( r ), f->sense_int_res[0] & 0x03 ); + fprintf( stderr, "STATUS1 (0x%02x): %sEOC\e[0m %s---\e[0m %sIDE\e[0m %s OR\e[0m %s---\e[0m %s ND\e[0m %s NW\e[0m %s MA\e[0m\n", f->status_register[1], + CHECK_8BIT_STR( f->status_register[1] ) ); + fprintf( stderr, "STATUS2 (0x%02x): %s---\e[0m %s CM\e[0m %sDDE\e[0m %s WC\e[0m %s SH\e[0m %s SN\e[0m %s BC\e[0m %s MD\e[0m\n", f->status_register[2], + CHECK_8BIT_STR( f->status_register[2] ) ); + fprintf( stderr, "C H R N (....): CYL: %2d HEAD: %d REC:%3d LEN: %d\n", f->data_register[1], + f->data_register[2], f->data_register[3], f->data_register[4] ); + } + } +#endif /* #ifdef DEBUG_UPD */ + return r; } +#ifdef DEBUG_UPD +#define FDR( n ) f->data_register[n] +#define CHECK_CMD_STR( b ) ( b ) & CHECK_BIT_STR( 0x80 ), \ + ( b ) & CHECK_BIT_STR( 0x40 ), \ + ( b ) & CHECK_BIT_STR( 0x20 ) +#endif /* #ifdef DEBUG_UPD */ + void upd_fdc_write_data( upd_fdc *f, libspectrum_byte data ) { int i, terminated = 0; unsigned int u; fdd_t *d; +#ifdef DEBUG_UPD + static int cmd = 0; + + f->dbg_data_wr = 0; + if( f->cycle == 0 ) { + cmd = data; + } +#endif /* #ifdef DEBUG_UPD */ if( !( f->main_status & UPD_FDC_MAIN_DATAREQ ) || ( f->main_status & UPD_FDC_MAIN_DATA_READ ) ) @@ -1133,7 +1248,7 @@ upd_fdc_write_data( upd_fdc *f, libspectrum_byte data ) ( f->scan == UPD_SCAN_HI && d->data < data ) ) { f->status_register[2] |= UPD_FDC_ST2_SCAN_NOT_SAT; } - + if( f->data_offset == f->sector_length ) { /* read the CRC */ fdd_read_data( d ); crc_add( f, d ); fdd_read_data( d ); crc_add( f, d ); @@ -1191,6 +1306,10 @@ upd_fdc_write_data( upd_fdc *f, libspectrum_byte data ) f->main_status |= UPD_FDC_MAIN_EXECUTION; } +#ifdef DEBUG_UPD + f->dbg_data_wr = 1; +#endif + /* select current drive and head if needed */ if( f->cmd->id != UPD_CMD_SENSE_INT && f->cmd->id != UPD_CMD_SPECIFY && @@ -1385,4 +1504,34 @@ upd_fdc_write_data( upd_fdc *f, libspectrum_byte data ) } else { f->cycle++; } + +#ifdef DEBUG_UPD + if( f->dbg_data_wr ) { /* we already read all neccessery byte */ + if( f->cmd->cmd_length == 0 ) { /* 0 */ + fprintf( stderr, "\n--- %s (0x%02x) START\n", debug_cmd_str[f->command_register & 0x1f], cmd ); + } else if( f->cmd->cmd_length == 1 ) { /* HD, US */ + fprintf( stderr, "\n--- %s (0x%02x) START\n HD: %d US: %d\n", debug_cmd_str[f->command_register & 0x1f], cmd, ( data & 0x04 ) >> 2, data & 0x03 ); + } else if( f->cmd->id == UPD_CMD_SPECIFY ) { /* */ + fprintf( stderr, "\n--- %s (0x%02x) START\n SRT: %d HUT: %dms HLT: %dms NDMA: %d\n", debug_cmd_str[f->command_register & 0x1f], cmd, + FDR( 0 ) >> 4, FDR( 0 ) & 0x0f, + data >> 1, data & 1); + } else if( f->cmd->id == UPD_CMD_SEEK ) { /* */ + fprintf( stderr, "\n--- %s (0x%02x) START\n HD: %d US: %d NCN: %d\n", debug_cmd_str[f->command_register & 0x1f], cmd, + ( FDR( 0 ) & 0x04 ) >> 2, FDR( 0 ) & 0x03, data ); + } else if( f->cmd->cmd_length == 6 ) { /* HD, US */ + fprintf( stderr, "\n--- %s (0x%02x) START\n %sMT\e[0m %sMF\e[0m %sSK\e[0m HD: %d US: %d - N: %d SC: %d GPL: %d FILL: 0x%02x\n", debug_cmd_str[f->command_register & 0x1f], cmd, + CHECK_CMD_STR( f->command_register & 0x40 ), ( FDR( 0 ) & 0x04 ) >> 2, FDR( 0 ) & 0x03, + FDR( 1 ), FDR( 2 ), FDR( 3 ), data ); + } else if( f->cmd->cmd_length == 8 ) { + fprintf( stderr, "\n--- %s (0x%02x) START (%d)\n" + " %sMT\e[0m %sMF\e[0m %sSK\e[0m HD: %d US: %d\n" + " CYL: %2d HEAD: %d REC:%3d LEN: %d\n" + " EOT: %2d GPL: %2d DTL:%3d\n", debug_cmd_str[f->command_register & 0x1f], cmd, f->cycle, + CHECK_CMD_STR( f->command_register ), ( FDR( 0 ) & 0x04 ) >> 2, FDR( 0 ) & 0x03, + FDR( 1 ), FDR( 2 ), FDR( 3 ), FDR( 4 ), FDR( 5 ), FDR(6), data ); + } + } +#undef FDR +#endif /* #ifdef DEBUG_UPD */ + } diff --git a/peripherals/disk/upd_fdc.h b/peripherals/disk/upd_fdc.h index cffcf9d2..e14c0f30 100644 --- a/peripherals/disk/upd_fdc.h +++ b/peripherals/disk/upd_fdc.h @@ -33,6 +33,8 @@ #include "fdd.h" #include "fuse.h" +/* #define DEBUG_UPD 1 */ + typedef enum upd_type_t { UPD765A = 0, UPD765B, @@ -143,7 +145,7 @@ typedef struct upd_fdc { int seek_age[4]; /* order of overlapped seeks for 4 drive */ int rlen; /* expected record length */ upd_scan_t scan; /* SCAN type: eq/lo/hi */ - + upd_cmd_t *cmd; /* current command */ libspectrum_byte command_register; /* command register */ @@ -160,6 +162,9 @@ typedef struct upd_fdc { void ( *set_datarq ) ( struct upd_fdc *f ); void ( *reset_datarq ) ( struct upd_fdc *f ); +#ifdef DEBUG_UPD + int dbg_data_wr; +#endif } upd_fdc; void upd_fdc_init_events( void ); |
From: <sba...@us...> - 2023-10-21 10:28:54
|
This is an automated email from the git hooks/post-receive-user script. sbaldovi pushed a commit to branch master in repository fuse. View the commit online: https://sourceforge.net/p/fuse-emulator/fuse/ci/ce0a650efb17b01ca2e1a780afdb44fa2607f7c6/ commit ce0a650efb17b01ca2e1a780afdb44fa2607f7c6 Author: Gergely Szasz <sz...@hu...> AuthorDate: Sat Oct 21 06:23:01 2023 +0200 Fix SCAN bug in uPD765 FDC Allows to format a disk on CP/M Plus and Fuzix (fixes bug #453) (thanks, Phil Reynolds and Vic Chwe). --- peripherals/disk/upd_fdc.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/peripherals/disk/upd_fdc.c b/peripherals/disk/upd_fdc.c index b1263e4d..9e10e87c 100644 --- a/peripherals/disk/upd_fdc.c +++ b/peripherals/disk/upd_fdc.c @@ -688,6 +688,8 @@ abort_read_data: f->main_status |= UPD_FDC_MAIN_DATAREQ; if( f->cmd->id != UPD_CMD_SCAN ) f->main_status |= UPD_FDC_MAIN_DATA_READ; + else + f->main_status |= UPD_FDC_MAIN_DATA_WRITE; f->data_offset = 0; event_remove_type( timeout_event ); event_add_with_data( tstates + 4 * /* 2 revolution: 2 * 200 / 1000 */ @@ -871,7 +873,7 @@ upd_fdc_event( libspectrum_dword last_tstates GCC_UNUSED, int event, } if( f->read_id ) { - if( f->cmd->id == UPD_CMD_READ_DATA ) { + if( f->cmd->id == UPD_CMD_READ_DATA || f->cmd->id == UPD_CMD_SCAN ) { start_read_data( f ); } else if( f->cmd->id == UPD_CMD_READ_ID ) { start_read_id( f ); @@ -1013,7 +1015,7 @@ upd_fdc_write_data( upd_fdc *f, libspectrum_byte data ) return; if( f->main_status & UPD_FDC_MAIN_BUSY && - f->state == UPD_FDC_STATE_EXE ) { /* execution phase WRITE/FORMAT */ + f->state == UPD_FDC_STATE_EXE ) { /* execution phase WRITE/FORMAT/SCAN */ d = f->current_drive; if( f->cmd->id == UPD_CMD_WRITE_ID ) { /* FORMAT */ /* at the index hole... */ @@ -1120,7 +1122,7 @@ upd_fdc_write_data( upd_fdc *f, libspectrum_byte data ) } else { /* SCAN */ f->data_offset++; fdd_read_data( d ); crc_add( f, d ); - if( f->data_offset == 0 && d->data == data ) /* `scan hit' */ + if( f->data_offset == 1 && d->data == data ) /* `scan hit' */ f->status_register[2] |= UPD_FDC_ST2_SCAN_HIT; if( d->data != data ) /* `scan _not_ hit' */ @@ -1366,6 +1368,9 @@ upd_fdc_write_data( upd_fdc *f, libspectrum_byte data ) UPD_SCAN_LO; f->rlen = 0x80 << ( f->data_register[4] > MAX_SIZE_CODE ? MAX_SIZE_CODE : f->data_register[4] ); + f->first_rw = 1; /* always read at least one sector */ + if( f->data_register[4] == 0 && f->data_register[7] < 128 ) + f->rlen = f->data_register[7]; head_load( f ); return; } |