diff -Nru fuse-emulator-1.5.0+dfsg1/ChangeLog fuse-emulator-1.5.1+dfsg1/ChangeLog --- fuse-emulator-1.5.0+dfsg1/ChangeLog 2017-12-10 11:17:13.000000000 +0000 +++ fuse-emulator-1.5.1+dfsg1/ChangeLog 2018-02-25 12:40:31.000000000 +0000 @@ -1,3 +1,25 @@ +2018-02-25 Philip Kendall + + * Fuse 1.5.1 released. + + * Debugger improvements: + * Prevent crash when we try to disassemble an instruction with many + DD or FD prefixes (Philip Kendall; thanks, Miguel Angel Rodríguez + Jódar). + * Fix crash when setting debugger variables (Gergely Szasz). + + * Profiler improvements: + * Prevent crash when we try to profile an instruction with many DD + or FD prefixes (Philip Kendall; thanks, Sergio Baldoví). + + * Miscellaneous improvements: + * GTK+ UI: Improve behaviour of default button on dialogs (thanks, + atom-atom) (ub880d and Sergio Baldoví). + * GTK+ and win32 UIs: Support hex numbers in load/save binary and + pokefinder dialogs (thanks, Allan Turvey) (Sergio Baldoví). + * SDL UI: Allow to select the video mode used in full-screen (Gergely + Szasz). + 2017-12-10 Philip Kendall * Fuse 1.5.0 released. diff -Nru fuse-emulator-1.5.0+dfsg1/configure fuse-emulator-1.5.1+dfsg1/configure --- fuse-emulator-1.5.0+dfsg1/configure 2017-12-10 11:17:35.000000000 +0000 +++ fuse-emulator-1.5.1+dfsg1/configure 2018-02-25 04:55:51.000000000 +0000 @@ -1,6 +1,6 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.69 for fuse 1.5.0. +# Generated by GNU Autoconf 2.69 for fuse 1.5.1. # # Report bugs to . # @@ -590,8 +590,8 @@ # Identity of this package. PACKAGE_NAME='fuse' PACKAGE_TARNAME='fuse' -PACKAGE_VERSION='1.5.0' -PACKAGE_STRING='fuse 1.5.0' +PACKAGE_VERSION='1.5.1' +PACKAGE_STRING='fuse 1.5.1' PACKAGE_BUGREPORT='http://sourceforge.net/p/fuse-emulator/bugs/' PACKAGE_URL='http://fuse-emulator.sourceforge.net/' @@ -1457,7 +1457,7 @@ # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF -\`configure' configures fuse 1.5.0 to adapt to many kinds of systems. +\`configure' configures fuse 1.5.1 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... @@ -1531,7 +1531,7 @@ if test -n "$ac_init_help"; then case $ac_init_help in - short | recursive ) echo "Configuration of fuse 1.5.0:";; + short | recursive ) echo "Configuration of fuse 1.5.1:";; esac cat <<\_ACEOF @@ -1696,7 +1696,7 @@ test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF -fuse configure 1.5.0 +fuse configure 1.5.1 generated by GNU Autoconf 2.69 Copyright (C) 2012 Free Software Foundation, Inc. @@ -2065,7 +2065,7 @@ This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. -It was created by fuse $as_me 1.5.0, which was +It was created by fuse $as_me 1.5.1, which was generated by GNU Autoconf 2.69. Invocation command line was $ $0 $@ @@ -3004,7 +3004,7 @@ # Define the identity of the package. PACKAGE='fuse' - VERSION='1.5.0' + VERSION='1.5.1' cat >>confdefs.h <<_ACEOF @@ -3095,18 +3095,18 @@ AM_BACKSLASH='\' -FUSE_FULL_VERSION=1.5.0.0 -FUSE_COPYRIGHT="(c) 1999-2017 Philip Kendall and others" +FUSE_FULL_VERSION=1.5.1.0 +FUSE_COPYRIGHT="(c) 1999-2018 Philip Kendall and others" FUSE_URL=http://fuse-emulator.sourceforge.net/ -$as_echo "#define FUSE_RC_VERSION 1,5,0,0" >>confdefs.h +$as_echo "#define FUSE_RC_VERSION 1,5,1,0" >>confdefs.h -$as_echo "#define FUSE_COPYRIGHT \"(c) 1999-2017 Philip Kendall and others\"" >>confdefs.h +$as_echo "#define FUSE_COPYRIGHT \"(c) 1999-2018 Philip Kendall and others\"" >>confdefs.h ac_ext=c @@ -18655,7 +18655,7 @@ # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. ac_log=" -This file was extended by fuse $as_me 1.5.0, which was +This file was extended by fuse $as_me 1.5.1, which was generated by GNU Autoconf 2.69. Invocation command line was CONFIG_FILES = $CONFIG_FILES @@ -18722,7 +18722,7 @@ cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" ac_cs_version="\\ -fuse config.status 1.5.0 +fuse config.status 1.5.1 configured by $0, generated by GNU Autoconf 2.69, with options \\"\$ac_cs_config\\" diff -Nru fuse-emulator-1.5.0+dfsg1/configure.ac fuse-emulator-1.5.1+dfsg1/configure.ac --- fuse-emulator-1.5.0+dfsg1/configure.ac 2017-12-10 11:17:13.000000000 +0000 +++ fuse-emulator-1.5.1+dfsg1/configure.ac 2018-02-25 04:54:49.000000000 +0000 @@ -19,18 +19,18 @@ dnl E-mail: philip-fuse@shadowmagic.org.uk dnl Package version -m4_define([fuse_version], [1.5.0]) +m4_define([fuse_version], [1.5.1]) dnl Product full version m4_define([fuse_major_version], [1]) m4_define([fuse_minor_version], [5]) -m4_define([fuse_micro_version], [0]) +m4_define([fuse_micro_version], [1]) m4_define([fuse_nano_version], [0]) m4_define([fuse_full_version], [fuse_major_version.fuse_minor_version.fuse_micro_version.fuse_nano_version]) m4_define([fuse_rc_version], [fuse_major_version,fuse_minor_version,fuse_micro_version,fuse_nano_version]) dnl Package info -m4_define([fuse_copyright], ["(c) 1999-2017 Philip Kendall and others"]) +m4_define([fuse_copyright], ["(c) 1999-2018 Philip Kendall and others"]) m4_define([fuse_url], [http://fuse-emulator.sourceforge.net/]) m4_define([fuse_bugreport], [http://sourceforge.net/p/fuse-emulator/bugs/]) diff -Nru fuse-emulator-1.5.0+dfsg1/data/shell-completion/bash/fuse fuse-emulator-1.5.1+dfsg1/data/shell-completion/bash/fuse --- fuse-emulator-1.5.0+dfsg1/data/shell-completion/bash/fuse 2017-09-01 09:53:55.000000000 +0000 +++ fuse-emulator-1.5.1+dfsg1/data/shell-completion/bash/fuse 2018-02-25 04:54:49.000000000 +0000 @@ -158,7 +158,8 @@ --joystick-[12]-output|--joystick-keyboard-down| \ --joystick-keyboard-fire|--joystick-keyboard-left| \ --joystick-keyboard-output|--joystick-keyboard-right| \ - --joystick-keyboard-up|--mdr-len|--rate|--snet|--sound-device|-d| \ + --joystick-keyboard-up|--mdr-len|--phantom-typist-mode|--rate| \ + --sdl-fullscreen-mode|--snet|--sound-device|-d| \ --sound-freq|-f|--speccyboot-tap|--speed|--svga-modes|--volume-ay| \ --volume-beeper|--volume-covox|--volume-specdrum) # argument required but no completions available @@ -234,8 +235,8 @@ --no-strict-aspect-hint --no-traps --no-unittests --no-usource --no-writable-roms --no-zxatasp --no-zxatasp-upload --no-zxatasp-write-protect --no-zxcf --no-zxcf-upload --no-zxmmc - --no-zxprinter --opus --opusdisk --pal-tv2x --playback - --plus3-detect-speedlock --plus3disk --plusd --plusddisk + --no-zxprinter --opus --opusdisk --pal-tv2x --phantom-typist-mode + --playback --plus3-detect-speedlock --plus3disk --plusd --plusddisk --printer --rate --raw-s-net --record --recreated-spectrum --rom-128-0 --rom-128-1 --rom-16 --rom-48 --rom-beta128 --rom-didaktik80 --rom-disciple @@ -253,8 +254,8 @@ --rom-speccyboot --rom-spec-se-0 --rom-spec-se-1 --rom-tc2048 --rom-tc2068-0 --rom-tc2068-1 --rom-ts2068-0 --rom-ts2068-1 --rom-usource --rs232-handshake --rs232-rx - --rs232-tx --rzx-autosaves --separation --simpleide - --simpleide-masterfile --simpleide-slavefile --slt + --rs232-tx --rzx-autosaves --sdl-fullscreen-mode --separation + --simpleide --simpleide-masterfile --simpleide-slavefile --slt --snapshot --snet --sound --sound-device --sound-force-8bit --sound-freq --speaker-type --speccyboot --speccyboot-tap --specdrum --spectranet --spectranet-disable --speed diff -Nru fuse-emulator-1.5.0+dfsg1/data/win32/distribution.mk fuse-emulator-1.5.1+dfsg1/data/win32/distribution.mk --- fuse-emulator-1.5.0+dfsg1/data/win32/distribution.mk 2016-11-24 12:02:24.000000000 +0000 +++ fuse-emulator-1.5.1+dfsg1/data/win32/distribution.mk 2018-02-25 04:54:49.000000000 +0000 @@ -31,7 +31,6 @@ cp $(top_srcdir)/roms/README.copyright $(DESTDIR)/roms cp $(top_srcdir)/lib/*.bmp $(DESTDIR)/lib cp $(top_srcdir)/lib/*.scr $(DESTDIR)/lib - cp $(top_builddir)/lib/*.szx $(DESTDIR)/lib test "$(UI)" != "sdl" || cp $(top_builddir)/ui/widget/fuse.font $(DESTDIR)/ui/widget # Copy fuse executable (we should manually copy the required libraries) cp $(top_builddir)/.libs/fuse$(EXEEXT) $(DESTDIR) || \ diff -Nru fuse-emulator-1.5.0+dfsg1/debian/changelog fuse-emulator-1.5.1+dfsg1/debian/changelog --- fuse-emulator-1.5.0+dfsg1/debian/changelog 2017-12-13 21:11:23.000000000 +0000 +++ fuse-emulator-1.5.1+dfsg1/debian/changelog 2018-02-27 08:28:50.000000000 +0000 @@ -1,3 +1,17 @@ +fuse-emulator (1.5.1+dfsg1-1) unstable; urgency=medium + + * New upstream release. + * Refresh the following patches: + - debian/patches/bash-completion.patch + - debian/patches/load-opense-rom.patch + - debian/patches/manpage-errors.patch + * debian/copyright: + - Update copyright years. + * debian/control: + - Update Standards-Version to 4.1.3 (no changes). + + -- Alberto Garcia Tue, 27 Feb 2018 10:28:50 +0200 + fuse-emulator (1.5.0+dfsg1-1) unstable; urgency=medium * New upstream release. diff -Nru fuse-emulator-1.5.0+dfsg1/debian/control fuse-emulator-1.5.1+dfsg1/debian/control --- fuse-emulator-1.5.0+dfsg1/debian/control 2017-12-13 21:11:23.000000000 +0000 +++ fuse-emulator-1.5.1+dfsg1/debian/control 2018-02-27 08:28:50.000000000 +0000 @@ -13,7 +13,7 @@ libgtk-3-dev, zlib1g-dev, libspectrum-dev (>= 1.4.0) -Standards-Version: 4.1.2 +Standards-Version: 4.1.3 Homepage: http://fuse-emulator.sourceforge.net/ Package: fuse-emulator-common diff -Nru fuse-emulator-1.5.0+dfsg1/debian/copyright fuse-emulator-1.5.1+dfsg1/debian/copyright --- fuse-emulator-1.5.0+dfsg1/debian/copyright 2017-12-13 21:11:23.000000000 +0000 +++ fuse-emulator-1.5.1+dfsg1/debian/copyright 2018-02-27 08:28:50.000000000 +0000 @@ -6,7 +6,7 @@ non-free software. See the README.Debian file for details. Files: * -Copyright: 1999-2017 Philip Kendall and others +Copyright: 1999-2018 Philip Kendall and others License: GPL-2+ Comment: See the AUTHORS file for details on other contributors. @@ -28,7 +28,7 @@ License: LGPL-2.1+ Files: debian/* -Copyright: 2010-2013,2015-2017 Alberto Garcia +Copyright: 2010-2013,2015-2018 Alberto Garcia License: GPL-2+ License: GPL-2+ diff -Nru fuse-emulator-1.5.0+dfsg1/debian/patches/bash-completion.patch fuse-emulator-1.5.1+dfsg1/debian/patches/bash-completion.patch --- fuse-emulator-1.5.0+dfsg1/debian/patches/bash-completion.patch 2017-12-13 21:11:23.000000000 +0000 +++ fuse-emulator-1.5.1+dfsg1/debian/patches/bash-completion.patch 2018-02-27 08:28:50.000000000 +0000 @@ -5,7 +5,7 @@ =================================================================== --- fuse-emulator.orig/data/shell-completion/bash/fuse +++ fuse-emulator/data/shell-completion/bash/fuse -@@ -268,4 +268,4 @@ _fuse() +@@ -269,4 +269,4 @@ _fuse() _filedir '@(csw|CSW|ltp|LTP|pzx|PZX|spc|SPC|sta|STA|tap|TAP|tzx|TZX|wav|WAV|slt|SLT|sna?(pshot)|SNA?(PSHOT)|?(mgt)snp|?(MGT)SNP|sp|SP|szx|SZX|z80|Z80|zxs|ZXS|d40|D40|d80|D80|dsk|DSK|img|IMG|fdi|FDI|mgt|MGT|opd|OPD|opu|OPU|sad|SAD|scl|SCL|td0|TD0|trd|TRD|udi|UDI|rzx|RZX|dck|DCK|hdf|HDF|mdr|MDR)' fi } && diff -Nru fuse-emulator-1.5.0+dfsg1/debian/patches/load-opense-rom.patch fuse-emulator-1.5.1+dfsg1/debian/patches/load-opense-rom.patch --- fuse-emulator-1.5.0+dfsg1/debian/patches/load-opense-rom.patch 2017-12-13 21:11:23.000000000 +0000 +++ fuse-emulator-1.5.1+dfsg1/debian/patches/load-opense-rom.patch 2018-02-27 08:28:50.000000000 +0000 @@ -85,7 +85,7 @@ /* The default settings of options, etc */ settings_info settings_default = { -@@ -378,6 +379,8 @@ read_config_file( settings_info *setting +@@ -379,6 +380,8 @@ read_config_file( settings_info *setting xmlFreeDoc( doc ); diff -Nru fuse-emulator-1.5.0+dfsg1/debian/patches/manpage-errors.patch fuse-emulator-1.5.1+dfsg1/debian/patches/manpage-errors.patch --- fuse-emulator-1.5.0+dfsg1/debian/patches/manpage-errors.patch 2017-12-13 21:11:23.000000000 +0000 +++ fuse-emulator-1.5.1+dfsg1/debian/patches/manpage-errors.patch 2018-02-27 08:28:50.000000000 +0000 @@ -5,7 +5,7 @@ =================================================================== --- fuse-emulator.orig/man/fuse.1 +++ fuse-emulator/man/fuse.1 -@@ -1628,7 +1628,7 @@ selects the ALSA device used, it can be +@@ -1638,7 +1638,7 @@ selects the ALSA device used, it can be device name. e.g.: .IR default " or " hw:0 " or " tee:plughw:0,\(aq/tmp/out.raw\(aq,raw . See the alsa-lib pcm api reference at @@ -14,7 +14,7 @@ for further explanation. .br .IP \[bu] -@@ -3283,7 +3283,7 @@ Spectrum's power off, and then turning i +@@ -3293,7 +3293,7 @@ Spectrum's power off, and then turning i .RS Choose a type of Spectrum to emulate. An brief overview of the Sinclair, Amstrad and Timex can be found at @@ -23,7 +23,7 @@ while more technical information can be found at .IR "http://www.worldofspectrum.org/faq/reference/reference.htm" , and -@@ -5336,7 +5336,7 @@ Didaktik 80 and Didaktik 40 file formats +@@ -5346,7 +5346,7 @@ Didaktik 80 and Didaktik 40 file formats TR-DOS disk image. TRD and SCL sectors are loaded interleaved, therefore you might experience problems with TR\-DOS ROMs that use the turbo format (sequential sectors); for detailed information please see diff -Nru fuse-emulator-1.5.0+dfsg1/debugger/debugger.h fuse-emulator-1.5.1+dfsg1/debugger/debugger.h --- fuse-emulator-1.5.0+dfsg1/debugger/debugger.h 2017-10-10 08:46:59.000000000 +0000 +++ fuse-emulator-1.5.1+dfsg1/debugger/debugger.h 2018-02-25 04:54:49.000000000 +0000 @@ -94,4 +94,7 @@ debugger_get_system_variable_fn_t get, debugger_set_system_variable_fn_t set ); +/* Unit tests */ +int debugger_disassemble_unittest( void ); + #endif /* #ifndef FUSE_DEBUGGER_H */ diff -Nru fuse-emulator-1.5.0+dfsg1/debugger/disassemble.c fuse-emulator-1.5.1+dfsg1/debugger/disassemble.c --- fuse-emulator-1.5.0+dfsg1/debugger/disassemble.c 2017-01-31 11:23:00.000000000 +0000 +++ fuse-emulator-1.5.1+dfsg1/debugger/disassemble.c 2018-02-25 04:54:49.000000000 +0000 @@ -27,12 +27,14 @@ #include #include +#include #include #include "debugger.h" #include "fuse.h" #include "memory_pages.h" +#include "ui/ui.h" /* Used to flag whether we're after a DD or FD prefix */ enum hl_type { USE_HL, USE_IX, USE_IY }; @@ -107,9 +109,19 @@ { libspectrum_byte b; char buffer2[40], buffer3[40]; + size_t prefix_length = 0; b = readbyte_internal( address ); + /* Before we do anything else, strip off any DD or FD prefixes, keeping + a count of how many we've seen */ + while( b == 0xdd || b == 0xfd ) { + use_hl = b == 0xdd ? USE_IX : USE_IY; + address++; + prefix_length++; + b = readbyte_internal( address ); + } + if( b < 0x40 ) { disassemble_00xxxxxx( address, buffer, buflen, length, use_hl ); } else if( b == 0x76 ) { @@ -139,6 +151,9 @@ } else { disassemble_11xxxxxx( address, buffer, buflen, length, use_hl ); } + + /* Increment the instruction length by the number of prefix bytes */ + *length += prefix_length; } /* Disassemble something of the form 00xxxxxx */ @@ -428,7 +443,11 @@ break; case 0x03: - disassemble_main( address+1, buffer, buflen, length, USE_IX ); (*length)++; + case 0x07: + /* These should never happen as we strip off all DD/FD prefixes before + * disassembling the instruction itself */ + ui_error( UI_ERROR_ERROR, "disassemble_11xx101: b = 0x%02x", b ); + fuse_abort(); break; case 0x05: @@ -438,10 +457,6 @@ case 0x06: snprintf( buffer, buflen, "PUSH AF" ); *length = 1; break; - - case 0x07: - disassemble_main( address+1, buffer, buflen, length, USE_IY ); (*length)++; - break; } } @@ -812,3 +827,74 @@ return address; } + +/* Unit tests */ + +/* Disassembly test data */ +libspectrum_byte test1_data[] = { 0x00 }; + +libspectrum_byte test2_data[] = { 0xdd, 0x00 }; +libspectrum_byte test3_data[] = { 0xdd, 0x09 }; +libspectrum_byte test4_data[] = { 0xdd, 0xdd, 0x00 }; +libspectrum_byte test5_data[] = { 0xdd, 0xcb, 0x55, 0x06 }; + +libspectrum_byte test6_data[] = { 0xfd, 0x00 }; +libspectrum_byte test7_data[] = { 0xfd, 0x09 }; +libspectrum_byte test8_data[] = { 0xfd, 0xfd, 0x00 }; +libspectrum_byte test9_data[] = { 0xfd, 0xcb, 0x55, 0x06 }; + +libspectrum_byte test10_data[] = { 0xdd, 0xfd, 0x09 }; +libspectrum_byte test11_data[] = { 0xfd, 0xdd, 0x09 }; + +libspectrum_byte test12_data[] = { 0xdd, 0xfd, 0xdd, 0xfd, 0xdd, 0xfd, 0xdd, + 0xfd, 0xdd, 0xfd, 0xdd, 0xfd, 0x09 }; +libspectrum_byte test13_data[] = { 0xfd, 0xdd, 0xfd, 0xdd, 0xfd, 0xdd, 0xfd, + 0xdd, 0xfd, 0xdd, 0xfd, 0xdd, 0x09 }; + +libspectrum_byte test14_data[] = { 0x7e }; +libspectrum_byte test15_data[] = { 0xdd, 0x7e, 0x55 }; + +static int +run_test( libspectrum_byte *data, size_t data_length, const char *expected ) +{ + char disassembly[16]; + size_t length; + + memcpy( memory_map_read[8].page, data, data_length ); + + debugger_disassemble( disassembly, sizeof( disassembly ), &length, 0x4000 ); + + if( strcmp( disassembly, expected ) ) return 1; + if( length != data_length ) return 1; + + return 0; +} + +int +debugger_disassemble_unittest( void ) +{ + int r = 0; + + r += run_test( test1_data, sizeof( test1_data ), "NOP" ); + + r += run_test( test2_data, sizeof( test2_data ), "NOP" ); + r += run_test( test3_data, sizeof( test3_data ), "ADD IX,BC" ); + r += run_test( test4_data, sizeof( test4_data ), "NOP" ); + r += run_test( test5_data, sizeof( test5_data ), "RLC (IX+55)" ); + + r += run_test( test6_data, sizeof( test6_data ), "NOP" ); + r += run_test( test7_data, sizeof( test7_data ), "ADD IY,BC" ); + r += run_test( test8_data, sizeof( test8_data ), "NOP" ); + r += run_test( test9_data, sizeof( test9_data ), "RLC (IY+55)" ); + + r += run_test( test10_data, sizeof( test10_data ), "ADD IY,BC" ); + r += run_test( test11_data, sizeof( test11_data ), "ADD IX,BC" ); + + r += run_test( test12_data, sizeof( test12_data ), "ADD IY,BC" ); + r += run_test( test13_data, sizeof( test13_data ), "ADD IX,BC" ); + + r += run_test( test14_data, sizeof( test14_data ), "LD A,(HL)" ); + r += run_test( test15_data, sizeof( test15_data ), "LD A,(IX+55)" ); + + return r; +} diff -Nru fuse-emulator-1.5.0+dfsg1/debugger/variable.c fuse-emulator-1.5.1+dfsg1/debugger/variable.c --- fuse-emulator-1.5.0+dfsg1/debugger/variable.c 2016-11-24 12:02:24.000000000 +0000 +++ fuse-emulator-1.5.1+dfsg1/debugger/variable.c 2018-02-25 04:54:49.000000000 +0000 @@ -55,13 +55,8 @@ void debugger_variable_set( const char *name, libspectrum_dword value ) { - /* Check if we need to allocate memory for this key */ - if( !g_hash_table_lookup( debugger_variables, name ) ) - name = utils_safe_strdup( name ); - - /* Cast is safe as we have either taken a copy of the key, or know that - it already exists so we're not going to use it */ - g_hash_table_insert( debugger_variables, (char*)name, GINT_TO_POINTER(value) ); + g_hash_table_insert( debugger_variables, utils_safe_strdup( name ), + GINT_TO_POINTER(value) ); } libspectrum_dword diff -Nru fuse-emulator-1.5.0+dfsg1/Makefile.in fuse-emulator-1.5.1+dfsg1/Makefile.in --- fuse-emulator-1.5.0+dfsg1/Makefile.in 2017-12-10 11:17:35.000000000 +0000 +++ fuse-emulator-1.5.1+dfsg1/Makefile.in 2018-02-25 04:55:52.000000000 +0000 @@ -3183,7 +3183,6 @@ @COMPAT_WIN32_TRUE@ cp $(top_srcdir)/roms/README.copyright $(DESTDIR)/roms @COMPAT_WIN32_TRUE@ cp $(top_srcdir)/lib/*.bmp $(DESTDIR)/lib @COMPAT_WIN32_TRUE@ cp $(top_srcdir)/lib/*.scr $(DESTDIR)/lib -@COMPAT_WIN32_TRUE@ cp $(top_builddir)/lib/*.szx $(DESTDIR)/lib @COMPAT_WIN32_TRUE@ test "$(UI)" != "sdl" || cp $(top_builddir)/ui/widget/fuse.font $(DESTDIR)/ui/widget # Copy fuse executable (we should manually copy the required libraries) @COMPAT_WIN32_TRUE@ cp $(top_builddir)/.libs/fuse$(EXEEXT) $(DESTDIR) || \ diff -Nru fuse-emulator-1.5.0+dfsg1/man/fuse.1 fuse-emulator-1.5.1+dfsg1/man/fuse.1 --- fuse-emulator-1.5.0+dfsg1/man/fuse.1 2017-12-11 08:35:56.000000000 +0000 +++ fuse-emulator-1.5.1+dfsg1/man/fuse.1 2018-02-25 04:54:49.000000000 +0000 @@ -23,7 +23,7 @@ .\" E-mail: philip-fuse@shadowmagic.org.uk .\" .\" -.TH fuse 1 "10th December, 2017" "Version 1.5.0" "Emulators" +.TH fuse 1 "25th February, 2018" "Version 1.5.1" "Emulators" .\" .\"------------------------------------------------------------------ .\" @@ -1341,6 +1341,16 @@ see there for more details. .RE .PP +.B \-\-sdl\-fullscreen\-mode +.I mode +.RS +Select a screen resolution for full screen mode. Available values for +.IR mode " are listed in a table, when Fuse is called with" +.B \-\-sdl\-fullscreen\-mode +.IR list " command line option." +This option is effective only under the SDL UI. +.RE +.PP .B \-\-separation .I type .RS diff -Nru fuse-emulator-1.5.0+dfsg1/profile.c fuse-emulator-1.5.1+dfsg1/profile.c --- fuse-emulator-1.5.0+dfsg1/profile.c 2017-04-28 11:40:32.000000000 +0000 +++ fuse-emulator-1.5.1+dfsg1/profile.c 2018-02-25 04:54:49.000000000 +0000 @@ -30,7 +30,6 @@ #include "event.h" #include "infrastructure/startup_manager.h" -#include "fuse.h" #include "module.h" #include "profile.h" #include "ui/ui.h" @@ -97,8 +96,6 @@ void profile_map( libspectrum_word pc ) { - if( tstates - profile_last_tstates > 256 ) fuse_abort(); - total_tstates[ profile_last_pc ] += tstates - profile_last_tstates; profile_last_pc = z80.pc.w; diff -Nru fuse-emulator-1.5.0+dfsg1/README fuse-emulator-1.5.1+dfsg1/README --- fuse-emulator-1.5.0+dfsg1/README 2017-12-11 08:35:56.000000000 +0000 +++ fuse-emulator-1.5.1+dfsg1/README 2018-02-25 04:54:49.000000000 +0000 @@ -1,4 +1,4 @@ -The Free Unix Spectrum Emulator (Fuse) 1.5.0 +The Free Unix Spectrum Emulator (Fuse) 1.5.1 ============================================ Fuse (the Free Unix Spectrum Emulator) was originally, and somewhat @@ -111,4 +111,4 @@ . Philip Kendall -10th December, 2017 +25th February, 2018 diff -Nru fuse-emulator-1.5.0+dfsg1/settings.c fuse-emulator-1.5.1+dfsg1/settings.c --- fuse-emulator-1.5.0+dfsg1/settings.c 2017-12-10 11:17:49.000000000 +0000 +++ fuse-emulator-1.5.1+dfsg1/settings.c 2018-02-25 04:56:02.000000000 +0000 @@ -260,6 +260,7 @@ /* rs232_tx */ (char *)NULL, /* rzx_autosaves */ 1, /* rzx_compression */ 1, + /* sdl_fullscreen_mode */ (char *)NULL, /* simpleide_active */ 0, /* simpleide_master_file */ (char *)NULL, /* simpleide_slave_file */ (char *)NULL, @@ -1836,6 +1837,14 @@ xmlFree( xmlstring ); } } else + if( !strcmp( (const char*)node->name, "sdlfullscreenmode" ) ) { + xmlstring = xmlNodeListGetString( doc, node->xmlChildrenNode, 1 ); + if( xmlstring ) { + libspectrum_free( settings->sdl_fullscreen_mode ); + settings->sdl_fullscreen_mode = utils_safe_strdup( (char*)xmlstring ); + xmlFree( xmlstring ); + } + } else if( !strcmp( (const char*)node->name, "simpleide" ) ) { xmlstring = xmlNodeListGetString( doc, node->xmlChildrenNode, 1 ); if( xmlstring ) { @@ -2527,6 +2536,8 @@ xmlNewTextChild( root, NULL, (const xmlChar*)"rs232tx", (const xmlChar*)settings->rs232_tx ); xmlNewTextChild( root, NULL, (const xmlChar*)"rzxautosaves", (const xmlChar*)(settings->rzx_autosaves ? "1" : "0") ); xmlNewTextChild( root, NULL, (const xmlChar*)"compressrzx", (const xmlChar*)(settings->rzx_compression ? "1" : "0") ); + if( settings->sdl_fullscreen_mode ) + xmlNewTextChild( root, NULL, (const xmlChar*)"sdlfullscreenmode", (const xmlChar*)settings->sdl_fullscreen_mode ); xmlNewTextChild( root, NULL, (const xmlChar*)"simpleide", (const xmlChar*)(settings->simpleide_active ? "1" : "0") ); if( settings->simpleide_master_file ) xmlNewTextChild( root, NULL, (const xmlChar*)"simpleidemasterfile", (const xmlChar*)settings->simpleide_master_file ); @@ -3444,6 +3455,10 @@ *val_int = &settings->rzx_compression; return 0; } + if( n == 17 && !strncmp( (const char *)name, "sdlfullscreenmode", n ) ) { + *val_char = &settings->sdl_fullscreen_mode; + return 0; + } if( n == 9 && !strncmp( (const char *)name, "simpleide", n ) ) { *val_int = &settings->simpleide_active; return 0; @@ -4300,6 +4315,9 @@ if( settings_boolean_write( doc, "compressrzx", settings->rzx_compression ) ) goto error; + if( settings_string_write( doc, "sdlfullscreenmode", + settings->sdl_fullscreen_mode ) ) + goto error; if( settings_boolean_write( doc, "simpleide", settings->simpleide_active ) ) goto error; @@ -4698,14 +4716,15 @@ { "no-rzx-autosaves", 0, &(settings->rzx_autosaves), 0 }, { "compress-rzx", 0, &(settings->rzx_compression), 1 }, { "no-compress-rzx", 0, &(settings->rzx_compression), 0 }, + { "sdl-fullscreen-mode", 1, NULL, 396 }, { "simpleide", 0, &(settings->simpleide_active), 1 }, { "no-simpleide", 0, &(settings->simpleide_active), 0 }, - { "simpleide-masterfile", 1, NULL, 396 }, - { "simpleide-slavefile", 1, NULL, 397 }, + { "simpleide-masterfile", 1, NULL, 397 }, + { "simpleide-slavefile", 1, NULL, 398 }, { "slt", 0, &(settings->slt_traps), 1 }, { "no-slt", 0, &(settings->slt_traps), 0 }, { "snapshot", 1, NULL, 's' }, - { "snet", 1, NULL, 399 }, + { "snet", 1, NULL, 400 }, { "sound", 0, &(settings->sound), 1 }, { "no-sound", 0, &(settings->sound), 0 }, { "sound-device", 1, NULL, 'd' }, @@ -4714,10 +4733,10 @@ { "sound-freq", 1, NULL, 'f' }, { "loading-sound", 0, &(settings->sound_load), 1 }, { "no-loading-sound", 0, &(settings->sound_load), 0 }, - { "speaker-type", 1, NULL, 400 }, + { "speaker-type", 1, NULL, 401 }, { "speccyboot", 0, &(settings->speccyboot), 1 }, { "no-speccyboot", 0, &(settings->speccyboot), 0 }, - { "speccyboot-tap", 1, NULL, 401 }, + { "speccyboot-tap", 1, NULL, 402 }, { "specdrum", 0, &(settings->specdrum), 1 }, { "no-specdrum", 0, &(settings->specdrum), 0 }, { "spectranet", 0, &(settings->spectranet), 1 }, @@ -4728,10 +4747,10 @@ { "graphics-filter", 1, NULL, 'g' }, { "statusbar", 0, &(settings->statusbar), 1 }, { "no-statusbar", 0, &(settings->statusbar), 0 }, - { "separation", 1, NULL, 402 }, + { "separation", 1, NULL, 403 }, { "strict-aspect-hint", 0, &(settings->strict_aspect_hint), 1 }, { "no-strict-aspect-hint", 0, &(settings->strict_aspect_hint), 0 }, - { "svga-modes", 1, NULL, 403 }, + { "svga-modes", 1, NULL, 404 }, { "tape", 1, NULL, 't' }, { "traps", 0, &(settings->tape_traps), 1 }, { "no-traps", 0, &(settings->tape_traps), 0 }, @@ -4739,30 +4758,30 @@ { "no-unittests", 0, &(settings->unittests), 0 }, { "usource", 0, &(settings->usource), 1 }, { "no-usource", 0, &(settings->usource), 0 }, - { "volume-ay", 1, NULL, 404 }, - { "volume-beeper", 1, NULL, 405 }, - { "volume-covox", 1, NULL, 406 }, - { "volume-specdrum", 1, NULL, 407 }, + { "volume-ay", 1, NULL, 405 }, + { "volume-beeper", 1, NULL, 406 }, + { "volume-covox", 1, NULL, 407 }, + { "volume-specdrum", 1, NULL, 408 }, { "writable-roms", 0, &(settings->writable_roms), 1 }, { "no-writable-roms", 0, &(settings->writable_roms), 0 }, { "cmos-z80", 0, &(settings->z80_is_cmos), 1 }, { "no-cmos-z80", 0, &(settings->z80_is_cmos), 0 }, { "zxatasp", 0, &(settings->zxatasp_active), 1 }, { "no-zxatasp", 0, &(settings->zxatasp_active), 0 }, - { "zxatasp-masterfile", 1, NULL, 408 }, - { "zxatasp-slavefile", 1, NULL, 409 }, + { "zxatasp-masterfile", 1, NULL, 409 }, + { "zxatasp-slavefile", 1, NULL, 410 }, { "zxatasp-upload", 0, &(settings->zxatasp_upload), 1 }, { "no-zxatasp-upload", 0, &(settings->zxatasp_upload), 0 }, { "zxatasp-write-protect", 0, &(settings->zxatasp_wp), 1 }, { "no-zxatasp-write-protect", 0, &(settings->zxatasp_wp), 0 }, { "zxcf", 0, &(settings->zxcf_active), 1 }, { "no-zxcf", 0, &(settings->zxcf_active), 0 }, - { "zxcf-cffile", 1, NULL, 410 }, + { "zxcf-cffile", 1, NULL, 411 }, { "zxcf-upload", 0, &(settings->zxcf_upload), 1 }, { "no-zxcf-upload", 0, &(settings->zxcf_upload), 0 }, { "zxmmc", 0, &(settings->zxmmc_enabled), 1 }, { "no-zxmmc", 0, &(settings->zxmmc_enabled), 0 }, - { "zxmmc-file", 1, NULL, 411 }, + { "zxmmc-file", 1, NULL, 412 }, { "zxprinter", 0, &(settings->zxprinter), 1 }, { "no-zxprinter", 0, &(settings->zxprinter), 0 }, #line 607"./settings.pl" @@ -4934,27 +4953,28 @@ case 393: settings_set_string( &settings->rom_usource, optarg ); break; case 394: settings_set_string( &settings->rs232_rx, optarg ); break; case 395: settings_set_string( &settings->rs232_tx, optarg ); break; - case 396: settings_set_string( &settings->simpleide_master_file, optarg ); break; - case 397: settings_set_string( &settings->simpleide_slave_file, optarg ); break; + case 396: settings_set_string( &settings->sdl_fullscreen_mode, optarg ); break; + case 397: settings_set_string( &settings->simpleide_master_file, optarg ); break; + case 398: settings_set_string( &settings->simpleide_slave_file, optarg ); break; case 's': settings_set_string( &settings->snapshot, optarg ); break; - case 399: settings_set_string( &settings->snet, optarg ); break; + case 400: settings_set_string( &settings->snet, optarg ); break; case 'd': settings_set_string( &settings->sound_device, optarg ); break; case 'f': settings->sound_freq = atoi( optarg ); break; - case 400: settings_set_string( &settings->speaker_type, optarg ); break; - case 401: settings_set_string( &settings->speccyboot_tap, optarg ); break; + case 401: settings_set_string( &settings->speaker_type, optarg ); break; + case 402: settings_set_string( &settings->speccyboot_tap, optarg ); break; case 'm': settings_set_string( &settings->start_machine, optarg ); break; case 'g': settings_set_string( &settings->start_scaler_mode, optarg ); break; - case 402: settings_set_string( &settings->stereo_ay, optarg ); break; - case 403: settings_set_string( &settings->svga_modes, optarg ); break; + case 403: settings_set_string( &settings->stereo_ay, optarg ); break; + case 404: settings_set_string( &settings->svga_modes, optarg ); break; case 't': settings_set_string( &settings->tape_file, optarg ); break; - case 404: settings->volume_ay = atoi( optarg ); break; - case 405: settings->volume_beeper = atoi( optarg ); break; - case 406: settings->volume_covox = atoi( optarg ); break; - case 407: settings->volume_specdrum = atoi( optarg ); break; - case 408: settings_set_string( &settings->zxatasp_master_file, optarg ); break; - case 409: settings_set_string( &settings->zxatasp_slave_file, optarg ); break; - case 410: settings_set_string( &settings->zxcf_pri_file, optarg ); break; - case 411: settings_set_string( &settings->zxmmc_file, optarg ); break; + case 405: settings->volume_ay = atoi( optarg ); break; + case 406: settings->volume_beeper = atoi( optarg ); break; + case 407: settings->volume_covox = atoi( optarg ); break; + case 408: settings->volume_specdrum = atoi( optarg ); break; + case 409: settings_set_string( &settings->zxatasp_master_file, optarg ); break; + case 410: settings_set_string( &settings->zxatasp_slave_file, optarg ); break; + case 411: settings_set_string( &settings->zxcf_pri_file, optarg ); break; + case 412: settings_set_string( &settings->zxmmc_file, optarg ); break; #line 657"./settings.pl" case 'h': settings->show_help = 1; break; @@ -5466,6 +5486,10 @@ } dest->rzx_autosaves = src->rzx_autosaves; dest->rzx_compression = src->rzx_compression; + dest->sdl_fullscreen_mode = NULL; + if( src->sdl_fullscreen_mode ) { + dest->sdl_fullscreen_mode = utils_safe_strdup( src->sdl_fullscreen_mode ); + } dest->simpleide_active = src->simpleide_active; dest->simpleide_master_file = NULL; if( src->simpleide_master_file ) { @@ -5745,6 +5769,7 @@ if( settings->rom_usource ) libspectrum_free( settings->rom_usource ); if( settings->rs232_rx ) libspectrum_free( settings->rs232_rx ); if( settings->rs232_tx ) libspectrum_free( settings->rs232_tx ); + if( settings->sdl_fullscreen_mode ) libspectrum_free( settings->sdl_fullscreen_mode ); if( settings->simpleide_master_file ) libspectrum_free( settings->simpleide_master_file ); if( settings->simpleide_slave_file ) libspectrum_free( settings->simpleide_slave_file ); if( settings->snapshot ) libspectrum_free( settings->snapshot ); diff -Nru fuse-emulator-1.5.0+dfsg1/settings.dat fuse-emulator-1.5.1+dfsg1/settings.dat --- fuse-emulator-1.5.0+dfsg1/settings.dat 2017-12-10 11:17:13.000000000 +0000 +++ fuse-emulator-1.5.1+dfsg1/settings.dat 2018-02-25 04:54:49.000000000 +0000 @@ -201,6 +201,7 @@ strict_aspect_hint, boolean, 0 fb_mode, numeric, 320, 'v', fbmode svga_modes, string, NULL +sdl_fullscreen_mode, string, NULL doublescan_mode, numeric, 1, 'D', doublescan-mode start_scaler_mode, string, "normal", 'g', graphics-filter diff -Nru fuse-emulator-1.5.0+dfsg1/settings.h fuse-emulator-1.5.1+dfsg1/settings.h --- fuse-emulator-1.5.0+dfsg1/settings.h 2017-12-10 11:17:49.000000000 +0000 +++ fuse-emulator-1.5.1+dfsg1/settings.h 2018-02-25 04:56:02.000000000 +0000 @@ -222,6 +222,7 @@ char *rs232_tx; int rzx_autosaves; int rzx_compression; + char *sdl_fullscreen_mode; int simpleide_active; char *simpleide_master_file; char *simpleide_slave_file; diff -Nru fuse-emulator-1.5.0+dfsg1/ui/gtk/binary.c fuse-emulator-1.5.1+dfsg1/ui/gtk/binary.c --- fuse-emulator-1.5.0+dfsg1/ui/gtk/binary.c 2017-01-31 11:23:00.000000000 +0000 +++ fuse-emulator-1.5.1+dfsg1/ui/gtk/binary.c 2018-02-25 04:54:49.000000000 +0000 @@ -219,11 +219,16 @@ struct binary_info *info = user_data; long start, length; size_t i; + const gchar *nptr; + char *endptr; + int base; errno = 0; - length = strtol( gtk_entry_get_text( GTK_ENTRY( info->length_widget ) ), - NULL, 10 ); - if( errno || length < 1 || length > 0x10000 ) { + nptr = gtk_entry_get_text( GTK_ENTRY( info->length_widget ) ); + base = ( g_str_has_prefix( nptr, "0x" ) )? 16 : 10; + length = strtol( nptr, &endptr, base ); + + if( errno || length < 1 || length > 0x10000 || endptr == nptr ) { ui_error( UI_ERROR_ERROR, "Length must be between 1 and 65536" ); return; } @@ -236,9 +241,11 @@ } errno = 0; - start = strtol( gtk_entry_get_text( GTK_ENTRY( info->start_widget ) ), - NULL, 10 ); - if( errno || start < 0 || start > 0xffff ) { + nptr = gtk_entry_get_text( GTK_ENTRY( info->start_widget ) ); + base = ( g_str_has_prefix( nptr, "0x" ) )? 16 : 10; + start = strtol( nptr, &endptr, base ); + + if( errno || start < 0 || start > 0xffff || endptr == nptr ) { ui_error( UI_ERROR_ERROR, "Start must be between 0 and 65535" ); return; } @@ -303,13 +310,18 @@ long start, length; size_t i; libspectrum_byte *buffer; + const gchar *nptr; + char *endptr; + int base; int error; errno = 0; - length = strtol( gtk_entry_get_text( GTK_ENTRY( info->length_widget ) ), - NULL, 10 ); - if( errno || length < 1 || length > 0x10000 ) { + nptr = gtk_entry_get_text( GTK_ENTRY( info->length_widget ) ); + base = ( g_str_has_prefix( nptr, "0x" ) )? 16 : 10; + length = strtol( nptr, &endptr, base ); + + if( errno || length < 1 || length > 0x10000 || endptr == nptr ) { ui_error( UI_ERROR_ERROR, "Length must be between 1 and 65536" ); return; } @@ -321,9 +333,11 @@ } errno = 0; - start = strtol( gtk_entry_get_text( GTK_ENTRY( info->start_widget ) ), - NULL, 10 ); - if( errno || start < 0 || start > 0xffff ) { + nptr = gtk_entry_get_text( GTK_ENTRY( info->start_widget ) ); + base = ( g_str_has_prefix( nptr, "0x" ) )? 16 : 10; + start = strtol( nptr, &endptr, base ); + + if( errno || start < 0 || start > 0xffff || endptr == nptr ) { ui_error( UI_ERROR_ERROR, "Start must be between 0 and 65535" ); free( buffer ); return; diff -Nru fuse-emulator-1.5.0+dfsg1/ui/gtk/confirm.c fuse-emulator-1.5.1+dfsg1/ui/gtk/confirm.c --- fuse-emulator-1.5.0+dfsg1/ui/gtk/confirm.c 2016-11-24 12:02:24.000000000 +0000 +++ fuse-emulator-1.5.1+dfsg1/ui/gtk/confirm.c 2018-02-25 04:54:49.000000000 +0000 @@ -60,6 +60,8 @@ gtkstock_create_ok_cancel( dialog, NULL, G_CALLBACK( set_confirmed ), &confirm, DEFAULT_DESTROY, DEFAULT_DESTROY ); + gtk_dialog_set_default_response( GTK_DIALOG( dialog ), GTK_RESPONSE_CANCEL ); + gtk_widget_show_all( dialog ); gtk_main(); @@ -96,14 +98,16 @@ { static gtkstock_button btn[] = { - { "_No", G_CALLBACK( set_dont_save ), NULL, DEFAULT_DESTROY, 0, 0, 0, 0 }, - { "_Cancel", NULL, NULL, DEFAULT_DESTROY, GDK_KEY_Escape, 0, 0, 0 }, - { "_Save", G_CALLBACK( set_save ), NULL, DEFAULT_DESTROY, 0, 0, 0, 0 } + { "_No", G_CALLBACK( set_dont_save ), NULL, DEFAULT_DESTROY, 0, 0, 0, 0, GTK_RESPONSE_NO }, + { "_Cancel", NULL, NULL, DEFAULT_DESTROY, GDK_KEY_Escape, 0, 0, 0, GTK_RESPONSE_CANCEL }, + { "_Save", G_CALLBACK( set_save ), NULL, DEFAULT_DESTROY, 0, 0, 0, 0, GTK_RESPONSE_YES } }; btn[0].actiondata = btn[2].actiondata = &confirm; gtkstock_create_buttons( dialog, NULL, btn, ARRAY_SIZE( btn ) ); } + gtk_dialog_set_default_response( GTK_DIALOG( dialog ), GTK_RESPONSE_CANCEL ); + gtk_widget_show_all( dialog ); gtk_main(); diff -Nru fuse-emulator-1.5.0+dfsg1/ui/gtk/debugger.c fuse-emulator-1.5.1+dfsg1/ui/gtk/debugger.c --- fuse-emulator-1.5.0+dfsg1/ui/gtk/debugger.c 2017-01-31 11:23:00.000000000 +0000 +++ fuse-emulator-1.5.1+dfsg1/ui/gtk/debugger.c 2018-02-25 04:54:49.000000000 +0000 @@ -775,9 +775,9 @@ create_buttons( GtkDialog *parent, GtkAccelGroup *accel_group ) { static const gtkstock_button - step = { "Single step", G_CALLBACK( gtkui_debugger_done_step ), NULL, NULL, 0, 0, 0, 0 }, - cont = { "Continue", G_CALLBACK( gtkui_debugger_done_continue ), NULL, NULL, 0, 0, 0, 0 }, - brk = { "Break", G_CALLBACK( gtkui_debugger_break ), NULL, NULL, 0, 0, 0, 0 }; + step = { "Single step", G_CALLBACK( gtkui_debugger_done_step ), NULL, NULL, 0, 0, 0, 0, GTK_RESPONSE_NONE }, + cont = { "Continue", G_CALLBACK( gtkui_debugger_done_continue ), NULL, NULL, 0, 0, 0, 0, GTK_RESPONSE_NONE }, + brk = { "Break", G_CALLBACK( gtkui_debugger_break ), NULL, NULL, 0, 0, 0, 0, GTK_RESPONSE_NONE }; /* Create the action buttons for the dialog box */ gtkstock_create_button( GTK_WIDGET( parent ), accel_group, &step ); diff -Nru fuse-emulator-1.5.0+dfsg1/ui/gtk/gtkcompat.h fuse-emulator-1.5.1+dfsg1/ui/gtk/gtkcompat.h --- fuse-emulator-1.5.0+dfsg1/ui/gtk/gtkcompat.h 2016-11-24 12:02:24.000000000 +0000 +++ fuse-emulator-1.5.1+dfsg1/ui/gtk/gtkcompat.h 2018-02-25 04:54:49.000000000 +0000 @@ -60,9 +60,11 @@ #define GDK_KEY_Return GDK_Return #define GDK_KEY_Escape GDK_Escape #define GDK_KEY_space GDK_space +#define GDK_KEY_quotedbl GDK_quotedbl #define GDK_KEY_exclam GDK_exclam #define GDK_KEY_numbersign GDK_numbersign #define GDK_KEY_dollar GDK_dollar +#define GDK_KEY_percent GDK_percent #define GDK_KEY_ampersand GDK_ampersand #define GDK_KEY_apostrophe GDK_apostrophe #define GDK_KEY_parenleft GDK_parenleft @@ -88,6 +90,8 @@ #define GDK_KEY_less GDK_less #define GDK_KEY_equal GDK_equal #define GDK_KEY_greater GDK_greater +#define GDK_KEY_question GDK_question +#define GDK_KEY_at GDK_at #define GDK_KEY_A GDK_A #define GDK_KEY_B GDK_B #define GDK_KEY_C GDK_C @@ -114,7 +118,11 @@ #define GDK_KEY_X GDK_X #define GDK_KEY_Y GDK_Y #define GDK_KEY_Z GDK_Z +#define GDK_KEY_bracketleft GDK_bracketleft +#define GDK_KEY_backslash GDK_backslash +#define GDK_KEY_bracketright GDK_bracketright #define GDK_KEY_asciicircum GDK_asciicircum +#define GDK_KEY_underscore GDK_underscore #define GDK_KEY_dead_circumflex GDK_dead_circumflex #define GDK_KEY_a GDK_a #define GDK_KEY_b GDK_b @@ -142,7 +150,10 @@ #define GDK_KEY_x GDK_x #define GDK_KEY_y GDK_y #define GDK_KEY_z GDK_z +#define GDK_KEY_braceleft GDK_braceleft #define GDK_KEY_bar GDK_bar +#define GDK_KEY_braceright GDK_braceright +#define GDK_KEY_asciitilde GDK_asciitilde #define GDK_KEY_BackSpace GDK_BackSpace #define GDK_KEY_KP_Enter GDK_KP_Enter #define GDK_KEY_Up GDK_Up diff -Nru fuse-emulator-1.5.0+dfsg1/ui/gtk/gtkinternals.h fuse-emulator-1.5.1+dfsg1/ui/gtk/gtkinternals.h --- fuse-emulator-1.5.0+dfsg1/ui/gtk/gtkinternals.h 2016-11-24 12:02:24.000000000 +0000 +++ fuse-emulator-1.5.1+dfsg1/ui/gtk/gtkinternals.h 2018-02-25 04:54:49.000000000 +0000 @@ -84,6 +84,7 @@ GdkModifierType modifier; /* primary shortcut */ guint shortcut_alt; GdkModifierType modifier_alt; /* secondary shortcut */ + gint response_id; /* response id for dialog */ } gtkstock_button; /* GTK1: create a simple button with the given label. diff -Nru fuse-emulator-1.5.0+dfsg1/ui/gtk/gtkjoystick.c fuse-emulator-1.5.1+dfsg1/ui/gtk/gtkjoystick.c --- fuse-emulator-1.5.0+dfsg1/ui/gtk/gtkjoystick.c 2016-11-24 12:02:24.000000000 +0000 +++ fuse-emulator-1.5.1+dfsg1/ui/gtk/gtkjoystick.c 2018-02-25 04:54:49.000000000 +0000 @@ -229,6 +229,8 @@ gtkstock_create_ok_cancel( dialog, NULL, G_CALLBACK( joystick_done ), &info, DEFAULT_DESTROY, DEFAULT_DESTROY ); + gtk_dialog_set_default_response( GTK_DIALOG( dialog ), GTK_RESPONSE_OK ); + gtk_widget_show_all( dialog ); gtk_main(); diff -Nru fuse-emulator-1.5.0+dfsg1/ui/gtk/gtkui.c fuse-emulator-1.5.1+dfsg1/ui/gtk/gtkui.c --- fuse-emulator-1.5.0+dfsg1/ui/gtk/gtkui.c 2017-10-10 08:46:59.000000000 +0000 +++ fuse-emulator-1.5.1+dfsg1/ui/gtk/gtkui.c 2018-02-25 04:54:49.000000000 +0000 @@ -323,7 +323,7 @@ int ui_error_specific( ui_error_level severity, const char *message ) { - GtkWidget *dialog, *label, *vbox, *content_area, *action_area; + GtkWidget *dialog, *label, *vbox, *content_area; const gchar *title; /* If we don't have a UI yet, we can't output widgets */ @@ -350,10 +350,8 @@ /* Make a new vbox for the top part for saner spacing */ vbox = gtk_box_new( GTK_ORIENTATION_VERTICAL, 0 ); content_area = gtk_dialog_get_content_area( GTK_DIALOG( dialog ) ); - action_area = gtk_dialog_get_action_area( GTK_DIALOG( dialog ) ); gtk_box_pack_start( GTK_BOX( content_area ), vbox, TRUE, TRUE, 0 ); gtk_container_set_border_width( GTK_CONTAINER( vbox ), 5 ); - gtk_container_set_border_width( GTK_CONTAINER( action_area ), 5 ); /* Put the label in it */ gtk_container_add( GTK_CONTAINER( vbox ), label ); @@ -466,6 +464,9 @@ (gpointer) &dialog, DEFAULT_DESTROY, DEFAULT_DESTROY ); + gtk_dialog_set_default_response( GTK_DIALOG( dialog.dialog ), + GTK_RESPONSE_OK ); + gtk_widget_show_all( dialog.dialog ); /* Process events until the window is done with */ @@ -604,6 +605,9 @@ (gpointer) &dialog, DEFAULT_DESTROY, DEFAULT_DESTROY ); + gtk_dialog_set_default_response( GTK_DIALOG( dialog.dialog ), + GTK_RESPONSE_OK ); + gtk_widget_show_all( dialog.dialog ); /* Process events until the window is done with */ @@ -767,6 +771,9 @@ (gpointer) &dialog, DEFAULT_DESTROY, DEFAULT_DESTROY ); + gtk_dialog_set_default_response( GTK_DIALOG( dialog.dialog ), + GTK_RESPONSE_OK ); + gtk_widget_show_all( dialog.dialog ); /* Process events until the window is done with */ diff -Nru fuse-emulator-1.5.0+dfsg1/ui/gtk/options.c fuse-emulator-1.5.1+dfsg1/ui/gtk/options.c --- fuse-emulator-1.5.0+dfsg1/ui/gtk/options.c 2017-12-10 11:17:49.000000000 +0000 +++ fuse-emulator-1.5.1+dfsg1/ui/gtk/options.c 2018-02-25 04:56:03.000000000 +0000 @@ -94,6 +94,7 @@ 5 ); snprintf( buffer, 80, "%d", settings_current.emulation_speed ); gtk_entry_set_text( GTK_ENTRY( dialog.emulation_speed ), buffer ); + gtk_entry_set_activates_default( GTK_ENTRY( dialog.emulation_speed ), TRUE ); gtk_box_pack_start( GTK_BOX( hbox ), dialog.emulation_speed, TRUE, TRUE, 0 ); @@ -116,6 +117,7 @@ 1 ); snprintf( buffer, 80, "%d", settings_current.frame_rate ); gtk_entry_set_text( GTK_ENTRY( dialog.frame_rate ), buffer ); + gtk_entry_set_activates_default( GTK_ENTRY( dialog.frame_rate ), TRUE ); gtk_box_pack_start( GTK_BOX( hbox ), dialog.frame_rate, TRUE, TRUE, 0 ); @@ -205,6 +207,9 @@ G_CALLBACK( menu_options_general_done ), (gpointer) &dialog, NULL, DEFAULT_DESTROY ); + gtk_dialog_set_default_response( GTK_DIALOG( dialog.dialog ), + GTK_RESPONSE_OK ); + /* Display the window */ gtk_widget_show_all( dialog.dialog ); @@ -344,6 +349,7 @@ 3 ); snprintf( buffer, 80, "%d", settings_current.mdr_len ); gtk_entry_set_text( GTK_ENTRY( dialog.mdr_len ), buffer ); + gtk_entry_set_activates_default( GTK_ENTRY( dialog.mdr_len ), TRUE ); gtk_box_pack_start( GTK_BOX( hbox ), dialog.mdr_len, TRUE, TRUE, 0 ); @@ -361,6 +367,9 @@ G_CALLBACK( menu_options_media_done ), (gpointer) &dialog, NULL, DEFAULT_DESTROY ); + gtk_dialog_set_default_response( GTK_DIALOG( dialog.dialog ), + GTK_RESPONSE_OK ); + /* Display the window */ gtk_widget_show_all( dialog.dialog ); @@ -546,6 +555,9 @@ G_CALLBACK( menu_options_peripherals_general_done ), (gpointer) &dialog, NULL, DEFAULT_DESTROY ); + gtk_dialog_set_default_response( GTK_DIALOG( dialog.dialog ), + GTK_RESPONSE_OK ); + /* Display the window */ gtk_widget_show_all( dialog.dialog ); @@ -772,6 +784,9 @@ G_CALLBACK( menu_options_peripherals_disk_done ), (gpointer) &dialog, NULL, DEFAULT_DESTROY ); + gtk_dialog_set_default_response( GTK_DIALOG( dialog.dialog ), + GTK_RESPONSE_OK ); + /* Display the window */ gtk_widget_show_all( dialog.dialog ); @@ -919,6 +934,7 @@ 8 ); snprintf( buffer, 80, "%d", settings_current.competition_code ); gtk_entry_set_text( GTK_ENTRY( dialog.competition_code ), buffer ); + gtk_entry_set_activates_default( GTK_ENTRY( dialog.competition_code ), TRUE ); gtk_box_pack_start( GTK_BOX( hbox ), dialog.competition_code, TRUE, TRUE, 0 ); @@ -936,6 +952,9 @@ G_CALLBACK( menu_options_rzx_done ), (gpointer) &dialog, NULL, DEFAULT_DESTROY ); + gtk_dialog_set_default_response( GTK_DIALOG( dialog.dialog ), + GTK_RESPONSE_OK ); + /* Display the window */ gtk_widget_show_all( dialog.dialog ); @@ -1119,6 +1138,7 @@ 3 ); snprintf( buffer, 80, "%d", settings_current.volume_ay ); gtk_entry_set_text( GTK_ENTRY( dialog.volume_ay ), buffer ); + gtk_entry_set_activates_default( GTK_ENTRY( dialog.volume_ay ), TRUE ); gtk_box_pack_start( GTK_BOX( hbox ), dialog.volume_ay, TRUE, TRUE, 0 ); @@ -1141,6 +1161,7 @@ 3 ); snprintf( buffer, 80, "%d", settings_current.volume_beeper ); gtk_entry_set_text( GTK_ENTRY( dialog.volume_beeper ), buffer ); + gtk_entry_set_activates_default( GTK_ENTRY( dialog.volume_beeper ), TRUE ); gtk_box_pack_start( GTK_BOX( hbox ), dialog.volume_beeper, TRUE, TRUE, 0 ); @@ -1163,6 +1184,7 @@ 3 ); snprintf( buffer, 80, "%d", settings_current.volume_specdrum ); gtk_entry_set_text( GTK_ENTRY( dialog.volume_specdrum ), buffer ); + gtk_entry_set_activates_default( GTK_ENTRY( dialog.volume_specdrum ), TRUE ); gtk_box_pack_start( GTK_BOX( hbox ), dialog.volume_specdrum, TRUE, TRUE, 0 ); @@ -1185,6 +1207,7 @@ 3 ); snprintf( buffer, 80, "%d", settings_current.volume_covox ); gtk_entry_set_text( GTK_ENTRY( dialog.volume_covox ), buffer ); + gtk_entry_set_activates_default( GTK_ENTRY( dialog.volume_covox ), TRUE ); gtk_box_pack_start( GTK_BOX( hbox ), dialog.volume_covox, TRUE, TRUE, 0 ); @@ -1196,6 +1219,9 @@ G_CALLBACK( menu_options_sound_done ), (gpointer) &dialog, NULL, DEFAULT_DESTROY ); + gtk_dialog_set_default_response( GTK_DIALOG( dialog.dialog ), + GTK_RESPONSE_OK ); + /* Display the window */ gtk_widget_show_all( dialog.dialog ); @@ -1905,6 +1931,9 @@ G_CALLBACK( menu_options_diskoptions_done ), (gpointer) &dialog, NULL, DEFAULT_DESTROY ); + gtk_dialog_set_default_response( GTK_DIALOG( dialog.dialog ), + GTK_RESPONSE_OK ); + /* Display the window */ gtk_widget_show_all( dialog.dialog ); @@ -2070,6 +2099,9 @@ G_CALLBACK( menu_options_movie_done ), (gpointer) &dialog, NULL, DEFAULT_DESTROY ); + gtk_dialog_set_default_response( GTK_DIALOG( dialog.dialog ), + GTK_RESPONSE_OK ); + /* Display the window */ gtk_widget_show_all( dialog.dialog ); diff -Nru fuse-emulator-1.5.0+dfsg1/ui/gtk/options.pl fuse-emulator-1.5.1+dfsg1/ui/gtk/options.pl --- fuse-emulator-1.5.0+dfsg1/ui/gtk/options.pl 2016-11-24 12:02:24.000000000 +0000 +++ fuse-emulator-1.5.1+dfsg1/ui/gtk/options.pl 2018-02-25 04:54:49.000000000 +0000 @@ -197,6 +197,7 @@ $widget->{data1} ); snprintf( buffer, 80, "%d", settings_current.$widget->{value} ); gtk_entry_set_text( GTK_ENTRY( dialog.$widget->{value} ), buffer ); + gtk_entry_set_activates_default( GTK_ENTRY( dialog.$widget->{value} ), TRUE ); gtk_box_pack_start( GTK_BOX( hbox ), dialog.$widget->{value}, TRUE, TRUE, 0 ); @@ -248,6 +249,9 @@ G_CALLBACK( menu_options_$_->{name}_done ), (gpointer) &dialog, NULL, DEFAULT_DESTROY ); + gtk_dialog_set_default_response( GTK_DIALOG( dialog.dialog ), + GTK_RESPONSE_OK ); + /* Display the window */ gtk_widget_show_all( dialog.dialog ); diff -Nru fuse-emulator-1.5.0+dfsg1/ui/gtk/pokefinder.c fuse-emulator-1.5.1+dfsg1/ui/gtk/pokefinder.c --- fuse-emulator-1.5.0+dfsg1/ui/gtk/pokefinder.c 2016-11-24 12:02:24.000000000 +0000 +++ fuse-emulator-1.5.1+dfsg1/ui/gtk/pokefinder.c 2018-02-25 04:54:49.000000000 +0000 @@ -163,10 +163,10 @@ { static gtkstock_button btn[] = { - { "Incremented", G_CALLBACK( gtkui_pokefinder_incremented ), NULL, NULL, 0, 0, 0, 0 }, - { "Decremented", G_CALLBACK( gtkui_pokefinder_decremented ), NULL, NULL, 0, 0, 0, 0 }, - { "!Search", G_CALLBACK( gtkui_pokefinder_search ), NULL, NULL, GDK_KEY_Return, 0, 0, 0 }, - { "Reset", G_CALLBACK( gtkui_pokefinder_reset ), NULL, NULL, 0, 0, 0, 0 } + { "Incremented", G_CALLBACK( gtkui_pokefinder_incremented ), NULL, NULL, 0, 0, 0, 0, GTK_RESPONSE_NONE }, + { "Decremented", G_CALLBACK( gtkui_pokefinder_decremented ), NULL, NULL, 0, 0, 0, 0, GTK_RESPONSE_NONE }, + { "!Search", G_CALLBACK( gtkui_pokefinder_search ), NULL, NULL, GDK_KEY_Return, 0, 0, 0, GTK_RESPONSE_NONE }, + { "Reset", G_CALLBACK( gtkui_pokefinder_reset ), NULL, NULL, 0, 0, 0, 0, GTK_RESPONSE_NONE } }; btn[2].actiondata = G_OBJECT( entry ); accel_group = gtkstock_create_buttons( dialog, NULL, btn, @@ -203,11 +203,16 @@ gtkui_pokefinder_search( GtkWidget *widget, gpointer user_data GCC_UNUSED ) { long value; + const gchar *entry; + char *endptr; + int base; errno = 0; - value = strtol( gtk_entry_get_text( GTK_ENTRY( widget ) ), NULL, 10 ); + entry = gtk_entry_get_text( GTK_ENTRY( widget ) ); + base = ( g_str_has_prefix( entry, "0x" ) )? 16 : 10; + value = strtol( entry, &endptr, base ); - if( errno != 0 || value < 0 || value > 255 ) { + if( errno != 0 || value < 0 || value > 255 || endptr == entry ) { ui_error( UI_ERROR_ERROR, "Invalid value: use an integer from 0 to 255" ); return; } diff -Nru fuse-emulator-1.5.0+dfsg1/ui/gtk/pokemem.c fuse-emulator-1.5.1+dfsg1/ui/gtk/pokemem.c --- fuse-emulator-1.5.0+dfsg1/ui/gtk/pokemem.c 2016-11-24 12:02:24.000000000 +0000 +++ fuse-emulator-1.5.1+dfsg1/ui/gtk/pokemem.c 2018-02-25 04:54:49.000000000 +0000 @@ -156,7 +156,7 @@ /* Create Add button for custom pokes */ static const gtkstock_button add = { "_Add", G_CALLBACK( pokemem_add_custom_poke ), NULL, NULL, - 0, 0, 0, 0 }; + 0, 0, 0, 0, GTK_RESPONSE_NONE }; gtkstock_create_button( GTK_WIDGET( hbox ), accel_group, &add ); label = gtk_label_new( "Choose active POKES:" ); @@ -182,7 +182,6 @@ (gpointer) &dialog, G_CALLBACK( pokemem_close ), G_CALLBACK( pokemem_close ) ); - gtk_accel_group_disconnect_key( accel_group, GDK_KEY_Return, 0 ); /* Users shouldn't be able to resize this window */ gtk_window_set_resizable( GTK_WINDOW( dialog ), FALSE ); diff -Nru fuse-emulator-1.5.0+dfsg1/ui/gtk/stock.c fuse-emulator-1.5.1+dfsg1/ui/gtk/stock.c --- fuse-emulator-1.5.0+dfsg1/ui/gtk/stock.c 2016-11-24 12:02:24.000000000 +0000 +++ fuse-emulator-1.5.1+dfsg1/ui/gtk/stock.c 2018-02-25 04:54:49.000000000 +0000 @@ -71,15 +71,15 @@ { GtkWidget *btn; gboolean link_object = ( button->label[0] == '!' ); + const gchar *button_label = button->label + link_object; if( !accel ) accel = gtkstock_add_accel_group (widget); - btn = gtk_button_new_with_mnemonic( button->label ); - if( GTK_IS_DIALOG( widget ) ) { - GtkWidget *action_area = gtk_dialog_get_action_area( GTK_DIALOG( widget ) ); - gtk_container_add( GTK_CONTAINER( action_area ), btn ); + btn = gtk_dialog_add_button( GTK_DIALOG( widget ), button_label, + button->response_id ); } else { + btn = gtk_button_new_with_mnemonic( button_label ); gtk_container_add( GTK_CONTAINER( widget ), btn ); } @@ -147,8 +147,8 @@ GCallback destroy_ok, GCallback destroy_cancel ) { gtkstock_button btn[] = { - { "_Cancel", NULL, NULL, NULL, GDK_KEY_Escape, 0, 0, 0 }, - { "_OK", NULL, NULL, NULL, GDK_KEY_Return, 0, 0, 0 }, + { "_Cancel", NULL, NULL, NULL, GDK_KEY_Escape, 0, 0, 0, GTK_RESPONSE_CANCEL}, + { "_OK", NULL, NULL, NULL, 0, 0, 0, 0, GTK_RESPONSE_OK}, }; btn[0].destroy = destroy_cancel ? destroy_cancel : NULL; btn[1].destroy = destroy_ok ? destroy_ok : NULL; @@ -165,7 +165,8 @@ { gtkstock_button btn = { "_Close", NULL, NULL, (destroy ? destroy : DEFAULT_DESTROY), - (esconly ? GDK_KEY_VoidSymbol : GDK_KEY_Return), 0, GDK_KEY_Escape, 0 + (esconly ? GDK_KEY_VoidSymbol : GDK_KEY_Return), 0, GDK_KEY_Escape, 0, + GTK_RESPONSE_CLOSE }; return gtkstock_create_buttons( widget, accel, &btn, 1 ); } @@ -175,6 +176,7 @@ { GtkWidget *dialog = gtk_dialog_new(); if( title ) gtk_window_set_title( GTK_WINDOW( dialog ), title ); + /* TODO: allow to keep the dialog after closing for gtk_dialog_run() */ g_signal_connect( G_OBJECT( dialog ), "delete-event", destroy ? destroy : DEFAULT_DESTROY, NULL ); if( destroy == NULL ) gtk_window_set_modal( GTK_WINDOW( dialog ), TRUE ); diff -Nru fuse-emulator-1.5.0+dfsg1/ui/sdl/sdldisplay.c fuse-emulator-1.5.1+dfsg1/ui/sdl/sdldisplay.c --- fuse-emulator-1.5.0+dfsg1/ui/sdl/sdldisplay.c 2017-07-02 05:36:42.000000000 +0000 +++ fuse-emulator-1.5.1+dfsg1/ui/sdl/sdldisplay.c 2018-02-25 04:54:49.000000000 +0000 @@ -86,6 +86,9 @@ static int max_fullscreen_height; static int min_fullscreen_height; +static int fullscreen_width = 0; +static int fullscreen_x_off = 0; +static int fullscreen_y_off = 0; /* The current size of the display (in units of DISPLAY_SCREEN_*) */ static float sdldisplay_current_size = 1; @@ -214,16 +217,57 @@ uidisplay_init( int width, int height ) { SDL_Rect **modes; - int i; + int no_modes; + int i, mw = 0, mh = 0, mn = 0; /* Get available fullscreen/software modes */ modes=SDL_ListModes(NULL, SDL_FULLSCREEN|SDL_SWSURFACE); + + no_modes = ( modes == (SDL_Rect **) 0 || modes == (SDL_Rect **) -1 ) ? 1 : 0; + + if( settings_current.sdl_fullscreen_mode && + strcmp( settings_current.sdl_fullscreen_mode, "list" ) == 0 ) { + + fprintf( stderr, + "=====================================================================\n" + " List of available SDL fullscreen modes:\n" + "---------------------------------------------------------------------\n" + " No. width height\n" + "---------------------------------------------------------------------\n" + ); + if( no_modes ) { + fprintf( stderr, " ** The modes list is empty%s...\n", + no_modes == 2 ? ", all resolution allowed" : "" ); + } else { + for( i = 0; modes[i]; i++ ) { + fprintf( stderr, "% 3d % 5d % 5d\n", i + 1, modes[i]->w, modes[i]->h ); + } + } + fprintf( stderr, + "=====================================================================\n"); + fuse_exiting = 1; + return 0; + } + + for( i=0; modes[i]; ++i ); /* count modes */ + if( settings_current.sdl_fullscreen_mode ) { + if( sscanf( settings_current.sdl_fullscreen_mode, " %dx%d", &mw, &mh ) != 2 ) { + if( sscanf( settings_current.sdl_fullscreen_mode, " %d", &mn ) == 1 && mn <= i ) { + mw = modes[mn - 1]->w; mh = modes[mn - 1]->h; + } + } + } + /* Check if there are any modes available, or if our resolution is restricted at all */ - if( modes == (SDL_Rect **) 0 || modes == (SDL_Rect **) -1 ){ + if( no_modes ){ /* Just try whatever we have and see what happens */ max_fullscreen_height = 480; min_fullscreen_height = 240; + } else if( mh > 0 ) { + /* set from command line */ + max_fullscreen_height = min_fullscreen_height = mh; + fullscreen_width = mw; } else { /* Record the largest supported fullscreen software mode */ max_fullscreen_height = modes[0]->h; @@ -342,8 +386,10 @@ /* Create the surface that contains the scaled graphics in 16 bit mode */ sdldisplay_gc = SDL_SetVideoMode( - image_width * sdldisplay_current_size, - image_height * sdldisplay_current_size, + settings_current.full_screen && fullscreen_width ? fullscreen_width : + image_width * sdldisplay_current_size, + settings_current.full_screen && fullscreen_width ? max_fullscreen_height : + image_height * sdldisplay_current_size, 16, settings_current.full_screen ? (SDL_FULLSCREEN|SDL_SWSURFACE) : SDL_SWSURFACE @@ -381,6 +427,11 @@ fuse_abort(); } + fullscreen_x_off = ( sdldisplay_gc->w - image_width * sdldisplay_current_size ) * + sdldisplay_is_full_screen / 2; + fullscreen_y_off = ( sdldisplay_gc->h - image_height * sdldisplay_current_size ) * + sdldisplay_is_full_screen / 2; + sdldisplay_allocate_colours( 16, colour_values, bw_values ); /* Redraw the entire screen... */ @@ -448,7 +499,7 @@ SDL_Rect *r, Uint32 tmp_screen_pitch, Uint32 dstPitch ) { - int x, y, w, h, dst_y, dst_h; + int x, y, w, h, dst_x, dst_y, dst_h; if( timex ) { r->x<<=1; @@ -471,8 +522,9 @@ if( scaler_flags & SCALER_FLAGS_EXPAND ) scaler_expander( &x, &y, &w, &h, image_width, image_height ); - dst_y = y * sdldisplay_current_size; + dst_y = y * sdldisplay_current_size + fullscreen_y_off; dst_h = h; + dst_x = x * sdldisplay_current_size + fullscreen_x_off; scaler_proc16( (libspectrum_byte*)tmp_screen->pixels + @@ -480,9 +532,7 @@ (y+1) * tmp_screen_pitch, tmp_screen_pitch, (libspectrum_byte*)sdldisplay_gc->pixels + - x * (libspectrum_byte) - (sdldisplay_gc->format->BytesPerPixel * - sdldisplay_current_size) + + dst_x * sdldisplay_gc->format->BytesPerPixel + dst_y * dstPitch, dstPitch, w, dst_h ); @@ -493,7 +543,7 @@ } /* Adjust rects for the destination rect size */ - updated_rects[num_rects].x = x * sdldisplay_current_size; + updated_rects[num_rects].x = dst_x; updated_rects[num_rects].y = dst_y; updated_rects[num_rects].w = w * sdldisplay_current_size; updated_rects[num_rects].h = dst_h * sdldisplay_current_size; @@ -733,8 +783,9 @@ for( r = updated_rects; r != last_rect; r++ ) { - int dst_y = r->y * sdldisplay_current_size; + int dst_y = r->y * sdldisplay_current_size + fullscreen_y_off; int dst_h = r->h; + int dst_x = r->x * sdldisplay_current_size + fullscreen_x_off; scaler_proc16( (libspectrum_byte*)tmp_screen->pixels + @@ -742,15 +793,13 @@ (r->y+1)*tmp_screen_pitch, tmp_screen_pitch, (libspectrum_byte*)sdldisplay_gc->pixels + - r->x*(libspectrum_byte) - (sdldisplay_gc->format->BytesPerPixel * - sdldisplay_current_size) + + dst_x * sdldisplay_gc->format->BytesPerPixel + dst_y*dstPitch, dstPitch, r->w, dst_h ); /* Adjust rects for the destination rect size */ - r->x *= sdldisplay_current_size; + r->x = dst_x; r->y = dst_y; r->w *= sdldisplay_current_size; r->h = dst_h * sdldisplay_current_size; diff -Nru fuse-emulator-1.5.0+dfsg1/ui/win32/binary.c fuse-emulator-1.5.1+dfsg1/ui/win32/binary.c --- fuse-emulator-1.5.0+dfsg1/ui/win32/binary.c 2016-11-24 12:02:24.000000000 +0000 +++ fuse-emulator-1.5.1+dfsg1/ui/win32/binary.c 2018-02-25 04:54:49.000000000 +0000 @@ -175,11 +175,13 @@ load_data( HWND hwndDlg, LONG_PTR user_data ) { struct binary_info *info = ( struct binary_info * )user_data; + HWND hwnd_control; long start, length; size_t i; - - TCHAR *temp_buffer; + + TCHAR *temp_buffer, *endptr; size_t temp_buffer_len; + int base; errno = 0; temp_buffer_len = SendDlgItemMessage( hwndDlg, IDC_BINARY_EDIT_LENGTH, @@ -187,12 +189,18 @@ temp_buffer = malloc( sizeof( TCHAR ) * ( temp_buffer_len + 1 ) ); SendDlgItemMessage( hwndDlg, IDC_BINARY_EDIT_LENGTH, WM_GETTEXT, temp_buffer_len + 1, ( LPARAM ) temp_buffer ); - length = _tcstol( temp_buffer, NULL, 10 ); - free( temp_buffer ); - if( errno || length < 1 || length > 0x10000 ) { + + errno = 0; + base = ( !_tcsncmp( _T("0x"), temp_buffer, strlen( _T("0x") ) ) )? 16 : 10; + length = _tcstol( temp_buffer, &endptr, base ); + if( errno || length < 1 || length > 0x10000 || endptr == temp_buffer ) { + free( temp_buffer ); ui_error( UI_ERROR_ERROR, "Length must be between 1 and 65536" ); + hwnd_control = GetDlgItem( hwndDlg, IDC_BINARY_EDIT_LENGTH ); + SendMessage( hwndDlg, WM_NEXTDLGCTL, (WPARAM) hwnd_control, TRUE ); return; } + free( temp_buffer ); if( length > info->file.length ) { ui_error( UI_ERROR_ERROR, @@ -207,15 +215,23 @@ temp_buffer = malloc( sizeof( TCHAR ) * ( temp_buffer_len + 1 ) ); SendDlgItemMessage( hwndDlg, IDC_BINARY_EDIT_START, WM_GETTEXT, temp_buffer_len + 1, ( LPARAM ) temp_buffer ); - start = _tcstol( temp_buffer, NULL, 10 ); - free( temp_buffer ); - if( errno || start < 0 || start > 0xffff ) { + + errno = 0; + base = ( !_tcsncmp( _T("0x"), temp_buffer, strlen( _T("0x") ) ) )? 16 : 10; + start = _tcstol( temp_buffer, &endptr, base ); + if( errno || start < 0 || start > 0xffff || endptr == temp_buffer ) { + free( temp_buffer ); ui_error( UI_ERROR_ERROR, "Start must be between 0 and 65535" ); + hwnd_control = GetDlgItem( hwndDlg, IDC_BINARY_EDIT_START ); + SendMessage( hwndDlg, WM_NEXTDLGCTL, (WPARAM) hwnd_control, TRUE ); return; } + free( temp_buffer ); if( start + length > 0x10000 ) { ui_error( UI_ERROR_ERROR, "Block ends after address 65535" ); + hwnd_control = GetDlgItem( hwndDlg, IDC_BINARY_EDIT_LENGTH ); + SendMessage( hwndDlg, WM_NEXTDLGCTL, (WPARAM) hwnd_control, TRUE ); return; } @@ -274,9 +290,11 @@ long start, length; size_t i; libspectrum_byte *buffer; + HWND hwnd_control; - TCHAR *temp_buffer; + TCHAR *temp_buffer, *endptr; size_t temp_buffer_len; + int base; int error; @@ -286,12 +304,18 @@ temp_buffer = malloc( sizeof( TCHAR ) * ( temp_buffer_len + 1 ) ); SendDlgItemMessage( hwndDlg, IDC_BINARY_EDIT_LENGTH, WM_GETTEXT, temp_buffer_len + 1, ( LPARAM ) temp_buffer ); - length = _tcstol( temp_buffer, NULL, 10 ); - free( temp_buffer ); - if( errno || length < 1 || length > 0x10000 ) { + + errno = 0; + base = ( !_tcsncmp( _T("0x"), temp_buffer, strlen( _T("0x") ) ) )? 16 : 10; + length = _tcstol( temp_buffer, &endptr, base ); + if( errno || length < 1 || length > 0x10000 || endptr == temp_buffer ) { + free( temp_buffer ); ui_error( UI_ERROR_ERROR, "Length must be between 1 and 65536" ); + hwnd_control = GetDlgItem( hwndDlg, IDC_BINARY_EDIT_LENGTH ); + SendMessage( hwndDlg, WM_NEXTDLGCTL, (WPARAM) hwnd_control, TRUE ); return; } + free( temp_buffer ); buffer = malloc( length * sizeof( libspectrum_byte ) ); if( !buffer ) { @@ -305,17 +329,25 @@ temp_buffer = malloc( sizeof( TCHAR ) * ( temp_buffer_len + 1 ) ); SendDlgItemMessage( hwndDlg, IDC_BINARY_EDIT_START, WM_GETTEXT, temp_buffer_len + 1, ( LPARAM ) temp_buffer ); - start = _tcstol( temp_buffer, NULL, 10 ); - free( temp_buffer ); - if( errno || start < 0 || start > 0xffff ) { + + errno = 0; + base = ( !_tcsncmp( _T("0x"), temp_buffer, strlen( _T("0x") ) ) )? 16 : 10; + start = _tcstol( temp_buffer, &endptr, base ); + if( errno || start < 0 || start > 0xffff || endptr == temp_buffer ) { + free( temp_buffer ); ui_error( UI_ERROR_ERROR, "Start must be between 0 and 65535" ); free( buffer ); + hwnd_control = GetDlgItem( hwndDlg, IDC_BINARY_EDIT_START ); + SendMessage( hwndDlg, WM_NEXTDLGCTL, (WPARAM) hwnd_control, TRUE ); return; } + free( temp_buffer ); if( start + length > 0x10000 ) { ui_error( UI_ERROR_ERROR, "Block ends after address 65535" ); free( buffer ); + hwnd_control = GetDlgItem( hwndDlg, IDC_BINARY_EDIT_LENGTH ); + SendMessage( hwndDlg, WM_NEXTDLGCTL, (WPARAM) hwnd_control, TRUE ); return; } diff -Nru fuse-emulator-1.5.0+dfsg1/ui/win32/pokefinder.c fuse-emulator-1.5.1+dfsg1/ui/win32/pokefinder.c --- fuse-emulator-1.5.0+dfsg1/ui/win32/pokefinder.c 2016-11-24 12:02:24.000000000 +0000 +++ fuse-emulator-1.5.1+dfsg1/ui/win32/pokefinder.c 2018-02-25 04:54:49.000000000 +0000 @@ -229,6 +229,9 @@ initial_width = rect.right - rect.left; initial_height = rect.bottom - rect.top; + /* Set text limit */ + SendDlgItemMessage( fuse_hPFWnd, IDC_PF_EDIT, EM_LIMITTEXT, 4, 0 ); + /* set extended listview style to select full row, when an item is selected */ DWORD lv_ext_style; @@ -285,8 +288,9 @@ win32ui_pokefinder_search( void ) { long value; - TCHAR *buffer; - int buffer_size; + TCHAR *buffer, *endptr; + int buffer_size, base; + HWND hwnd_control; /* poll the size of the value in Search box first */ buffer_size = SendDlgItemMessage( fuse_hPFWnd, IDC_PF_EDIT, WM_GETTEXTLENGTH, @@ -305,14 +309,19 @@ return; } - value = _ttol( buffer ); - free( buffer ); + errno = 0; + base = ( !_tcsncmp( _T("0x"), buffer, strlen( _T("0x") ) ) )? 16 : 10; + value = _tcstol( buffer, &endptr, base ); - if( value < 0 || value > 255 ) { + if( errno || value < 0 || value > 255 || endptr == buffer ) { + free( buffer ); ui_error( UI_ERROR_ERROR, "Invalid value: use an integer from 0 to 255" ); + hwnd_control = GetDlgItem( fuse_hPFWnd, IDC_PF_EDIT ); + SendMessage( fuse_hPFWnd, WM_NEXTDLGCTL, (WPARAM) hwnd_control, TRUE ); return; } - + free( buffer ); + pokefinder_search( value ); update_pokefinder(); } diff -Nru fuse-emulator-1.5.0+dfsg1/unittests/unittests.c fuse-emulator-1.5.1+dfsg1/unittests/unittests.c --- fuse-emulator-1.5.0+dfsg1/unittests/unittests.c 2017-09-01 09:53:55.000000000 +0000 +++ fuse-emulator-1.5.1+dfsg1/unittests/unittests.c 2018-02-25 04:54:49.000000000 +0000 @@ -26,6 +26,7 @@ #include +#include "debugger/debugger.h" #include "fuse.h" #include "machine.h" #include "mempool.h" @@ -784,6 +785,9 @@ r += floating_bus_merge_test(); r += mempool_test(); r += paging_test(); + r += debugger_disassemble_unittest(); + + printf("Final return value: %d (should be 0)\n", r); return r; }